diff mbox series

[FFmpeg-devel,12/39] avcodec/libvpxenc: Avoid one level of indentation

Message ID HE1PR0301MB2154640748FDC4E3E761FD2F8F299@HE1PR0301MB2154.eurprd03.prod.outlook.com
State Accepted
Commit e099a29f5a85b14c39e4df00fe644408fec14612
Headers show
Series [FFmpeg-devel,01/39] avcodec/audiotoolboxenc: Remove AV_CODEC_CAP_DR1 | expand

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

Andreas Rheinhardt May 21, 2021, 9:17 a.m. UTC
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavcodec/libvpxenc.c | 64 ++++++++++++++++++++----------------------
 1 file changed, 31 insertions(+), 33 deletions(-)

Comments

James Zern May 21, 2021, 7:33 p.m. UTC | #1
On Fri, May 21, 2021 at 2:19 AM Andreas Rheinhardt
<andreas.rheinhardt@outlook.com> wrote:
>
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
> ---
>  libavcodec/libvpxenc.c | 64 ++++++++++++++++++++----------------------
>  1 file changed, 31 insertions(+), 33 deletions(-)
>

lgtm.
diff mbox series

Patch

diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c
index 2d9e56837b..66bad444d0 100644
--- a/libavcodec/libvpxenc.c
+++ b/libavcodec/libvpxenc.c
@@ -1176,42 +1176,40 @@  static int storeframe(AVCodecContext *avctx, struct FrameListData *cx_frame,
 {
     int ret = ff_get_encode_buffer(avctx, pkt, cx_frame->sz, 0);
     uint8_t *side_data;
-    if (ret >= 0) {
-        int pict_type;
-        memcpy(pkt->data, cx_frame->buf, pkt->size);
-        pkt->pts = pkt->dts = cx_frame->pts;
-
-        if (!!(cx_frame->flags & VPX_FRAME_IS_KEY)) {
-            pict_type = AV_PICTURE_TYPE_I;
-            pkt->flags |= AV_PKT_FLAG_KEY;
-        } else {
-            pict_type = AV_PICTURE_TYPE_P;
-        }
+    int pict_type;
 
-        ff_side_data_set_encoder_stats(pkt, 0, cx_frame->sse + 1,
-                                       cx_frame->have_sse ? 3 : 0, pict_type);
+    if (ret < 0)
+        return ret;
 
-        if (cx_frame->have_sse) {
-            int i;
-            /* Beware of the Y/U/V/all order! */
-            for (i = 0; i < 3; ++i) {
-                avctx->error[i] += cx_frame->sse[i + 1];
-            }
-            cx_frame->have_sse = 0;
-        }
-        if (cx_frame->sz_alpha > 0) {
-            side_data = av_packet_new_side_data(pkt,
-                                                AV_PKT_DATA_MATROSKA_BLOCKADDITIONAL,
-                                                cx_frame->sz_alpha + 8);
-            if(!side_data) {
-                av_packet_unref(pkt);
-                return AVERROR(ENOMEM);
-            }
-            AV_WB64(side_data, 1);
-            memcpy(side_data + 8, cx_frame->buf_alpha, cx_frame->sz_alpha);
-        }
+    memcpy(pkt->data, cx_frame->buf, pkt->size);
+    pkt->pts = pkt->dts = cx_frame->pts;
+
+    if (!!(cx_frame->flags & VPX_FRAME_IS_KEY)) {
+        pict_type = AV_PICTURE_TYPE_I;
+        pkt->flags |= AV_PKT_FLAG_KEY;
     } else {
-        return ret;
+        pict_type = AV_PICTURE_TYPE_P;
+    }
+
+    ff_side_data_set_encoder_stats(pkt, 0, cx_frame->sse + 1,
+                                   cx_frame->have_sse ? 3 : 0, pict_type);
+
+    if (cx_frame->have_sse) {
+        /* Beware of the Y/U/V/all order! */
+        for (int i = 0; i < 3; ++i)
+            avctx->error[i] += cx_frame->sse[i + 1];
+        cx_frame->have_sse = 0;
+    }
+    if (cx_frame->sz_alpha > 0) {
+        side_data = av_packet_new_side_data(pkt,
+                                            AV_PKT_DATA_MATROSKA_BLOCKADDITIONAL,
+                                            cx_frame->sz_alpha + 8);
+        if (!side_data) {
+            av_packet_unref(pkt);
+            return AVERROR(ENOMEM);
+        }
+        AV_WB64(side_data, 1);
+        memcpy(side_data + 8, cx_frame->buf_alpha, cx_frame->sz_alpha);
     }
     return pkt->size;
 }