[FFmpeg-devel] [PATCH 07/13] avcodec/mpegvideo_{dec, enc}: Reindent after the previous commit

Andreas Rheinhardt andreas.rheinhardt at outlook.com
Mon Jul 1 15:16:04 EEST 2024


Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>
---
Could be squashed into the preceding commit.

 libavcodec/mpegvideo_dec.c | 318 ++++++++++++++++++-------------------
 libavcodec/mpegvideo_enc.c |  70 ++++----
 2 files changed, 193 insertions(+), 195 deletions(-)

diff --git a/libavcodec/mpegvideo_dec.c b/libavcodec/mpegvideo_dec.c
index 2222d50283..78fa10c11d 100644
--- a/libavcodec/mpegvideo_dec.c
+++ b/libavcodec/mpegvideo_dec.c
@@ -940,167 +940,165 @@ void mpv_reconstruct_mb_internal(MpegEncContext *s, int16_t block[12][64],
                                  int lowres_flag, int is_mpeg12)
 {
 #define IS_MPEG12_H261(s) (is_mpeg12 == MAY_BE_MPEG12_H261 ? ((s)->out_format <= FMT_H261) : is_mpeg12)
-    {
-        uint8_t *dest_y = s->dest[0], *dest_cb = s->dest[1], *dest_cr = s->dest[2];
-        int dct_linesize, dct_offset;
-        const int linesize   = s->cur_pic.linesize[0]; //not s->linesize as this would be wrong for field pics
-        const int uvlinesize = s->cur_pic.linesize[1];
-        const int block_size = lowres_flag ? 8 >> s->avctx->lowres : 8;
-
-        dct_linesize = linesize << s->interlaced_dct;
-        dct_offset   = s->interlaced_dct ? linesize : linesize * block_size;
-
-        if (!s->mb_intra) {
-            /* motion handling */
-            if (HAVE_THREADS && is_mpeg12 != DEFINITELY_MPEG12_H261 &&
-                s->avctx->active_thread_type & FF_THREAD_FRAME) {
-                if (s->mv_dir & MV_DIR_FORWARD) {
-                    ff_thread_progress_await(&s->last_pic.ptr->progress,
-                                             lowest_referenced_row(s, 0));
-                }
-                if (s->mv_dir & MV_DIR_BACKWARD) {
-                    ff_thread_progress_await(&s->next_pic.ptr->progress,
-                                             lowest_referenced_row(s, 1));
-                }
+    uint8_t *dest_y = s->dest[0], *dest_cb = s->dest[1], *dest_cr = s->dest[2];
+    int dct_linesize, dct_offset;
+    const int linesize   = s->cur_pic.linesize[0]; //not s->linesize as this would be wrong for field pics
+    const int uvlinesize = s->cur_pic.linesize[1];
+    const int block_size = lowres_flag ? 8 >> s->avctx->lowres : 8;
+
+    dct_linesize = linesize << s->interlaced_dct;
+    dct_offset   = s->interlaced_dct ? linesize : linesize * block_size;
+
+    if (!s->mb_intra) {
+        /* motion handling */
+        if (HAVE_THREADS && is_mpeg12 != DEFINITELY_MPEG12_H261 &&
+            s->avctx->active_thread_type & FF_THREAD_FRAME) {
+            if (s->mv_dir & MV_DIR_FORWARD) {
+                ff_thread_progress_await(&s->last_pic.ptr->progress,
+                                         lowest_referenced_row(s, 0));
+            }
+            if (s->mv_dir & MV_DIR_BACKWARD) {
+                ff_thread_progress_await(&s->next_pic.ptr->progress,
+                                         lowest_referenced_row(s, 1));
             }
+        }
 
-            if (lowres_flag) {
-                const h264_chroma_mc_func *op_pix = s->h264chroma.put_h264_chroma_pixels_tab;
+        if (lowres_flag) {
+            const h264_chroma_mc_func *op_pix = s->h264chroma.put_h264_chroma_pixels_tab;
 
-                if (s->mv_dir & MV_DIR_FORWARD) {
-                    MPV_motion_lowres(s, dest_y, dest_cb, dest_cr, 0, s->last_pic.data, op_pix);
-                    op_pix = s->h264chroma.avg_h264_chroma_pixels_tab;
-                }
-                if (s->mv_dir & MV_DIR_BACKWARD) {
-                    MPV_motion_lowres(s, dest_y, dest_cb, dest_cr, 1, s->next_pic.data, op_pix);
-                }
-            } else {
-                const op_pixels_func (*op_pix)[4];
-                const qpel_mc_func (*op_qpix)[16];
-
-                if ((is_mpeg12 == DEFINITELY_MPEG12_H261 || !s->no_rounding) || s->pict_type == AV_PICTURE_TYPE_B) {
-                    op_pix = s->hdsp.put_pixels_tab;
-                    op_qpix = s->qdsp.put_qpel_pixels_tab;
-                } else {
-                    op_pix = s->hdsp.put_no_rnd_pixels_tab;
-                    op_qpix = s->qdsp.put_no_rnd_qpel_pixels_tab;
-                }
-                if (s->mv_dir & MV_DIR_FORWARD) {
-                    ff_mpv_motion(s, dest_y, dest_cb, dest_cr, 0, s->last_pic.data, op_pix, op_qpix);
-                    op_pix  = s->hdsp.avg_pixels_tab;
-                    op_qpix = s->qdsp.avg_qpel_pixels_tab;
-                }
-                if (s->mv_dir & MV_DIR_BACKWARD) {
-                    ff_mpv_motion(s, dest_y, dest_cb, dest_cr, 1, s->next_pic.data, op_pix, op_qpix);
-                }
+            if (s->mv_dir & MV_DIR_FORWARD) {
+                MPV_motion_lowres(s, dest_y, dest_cb, dest_cr, 0, s->last_pic.data, op_pix);
+                op_pix = s->h264chroma.avg_h264_chroma_pixels_tab;
+            }
+            if (s->mv_dir & MV_DIR_BACKWARD) {
+                MPV_motion_lowres(s, dest_y, dest_cb, dest_cr, 1, s->next_pic.data, op_pix);
             }
+        } else {
+            const op_pixels_func (*op_pix)[4];
+            const qpel_mc_func (*op_qpix)[16];
 
-            /* skip dequant / idct if we are really late ;) */
-            if (s->avctx->skip_idct) {
-                if(  (s->avctx->skip_idct >= AVDISCARD_NONREF && s->pict_type == AV_PICTURE_TYPE_B)
-                   ||(s->avctx->skip_idct >= AVDISCARD_NONKEY && s->pict_type != AV_PICTURE_TYPE_I)
-                   || s->avctx->skip_idct >= AVDISCARD_ALL)
-                    return;
+            if ((is_mpeg12 == DEFINITELY_MPEG12_H261 || !s->no_rounding) || s->pict_type == AV_PICTURE_TYPE_B) {
+                op_pix  = s->hdsp.put_pixels_tab;
+                op_qpix = s->qdsp.put_qpel_pixels_tab;
+            } else {
+                op_pix  = s->hdsp.put_no_rnd_pixels_tab;
+                op_qpix = s->qdsp.put_no_rnd_qpel_pixels_tab;
+            }
+            if (s->mv_dir & MV_DIR_FORWARD) {
+                ff_mpv_motion(s, dest_y, dest_cb, dest_cr, 0, s->last_pic.data, op_pix, op_qpix);
+                op_pix  = s->hdsp.avg_pixels_tab;
+                op_qpix = s->qdsp.avg_qpel_pixels_tab;
+            }
+            if (s->mv_dir & MV_DIR_BACKWARD) {
+                ff_mpv_motion(s, dest_y, dest_cb, dest_cr, 1, s->next_pic.data, op_pix, op_qpix);
             }
+        }
 
-            /* add dct residue */
-            if (!(IS_MPEG12_H261(s) || s->msmpeg4_version != MSMP4_UNUSED ||
-                  (s->codec_id == AV_CODEC_ID_MPEG4 && !s->mpeg_quant))) {
-                add_dequant_dct(s, block[0], 0, dest_y                          , dct_linesize, s->qscale);
-                add_dequant_dct(s, block[1], 1, dest_y              + block_size, dct_linesize, s->qscale);
-                add_dequant_dct(s, block[2], 2, dest_y + dct_offset             , dct_linesize, s->qscale);
-                add_dequant_dct(s, block[3], 3, dest_y + dct_offset + block_size, dct_linesize, s->qscale);
-
-                if (!CONFIG_GRAY || !(s->avctx->flags & AV_CODEC_FLAG_GRAY)) {
-                    av_assert2(s->chroma_y_shift);
-                    add_dequant_dct(s, block[4], 4, dest_cb, uvlinesize, s->chroma_qscale);
-                    add_dequant_dct(s, block[5], 5, dest_cr, uvlinesize, s->chroma_qscale);
-                }
-            } else if (is_mpeg12 == DEFINITELY_MPEG12_H261 || lowres_flag || (s->codec_id != AV_CODEC_ID_WMV2)) {
-                add_dct(s, block[0], 0, dest_y                          , dct_linesize);
-                add_dct(s, block[1], 1, dest_y              + block_size, dct_linesize);
-                add_dct(s, block[2], 2, dest_y + dct_offset             , dct_linesize);
-                add_dct(s, block[3], 3, dest_y + dct_offset + block_size, dct_linesize);
-
-                if (!CONFIG_GRAY || !(s->avctx->flags & AV_CODEC_FLAG_GRAY)) {
-                    if (s->chroma_y_shift) {//Chroma420
-                        add_dct(s, block[4], 4, dest_cb, uvlinesize);
-                        add_dct(s, block[5], 5, dest_cr, uvlinesize);
-                    } else {
-                        //chroma422
-                        dct_linesize = uvlinesize << s->interlaced_dct;
-                        dct_offset   = s->interlaced_dct ? uvlinesize : uvlinesize*block_size;
-
-                        add_dct(s, block[4], 4, dest_cb, dct_linesize);
-                        add_dct(s, block[5], 5, dest_cr, dct_linesize);
-                        add_dct(s, block[6], 6, dest_cb+dct_offset, dct_linesize);
-                        add_dct(s, block[7], 7, dest_cr+dct_offset, dct_linesize);
-                        if (!s->chroma_x_shift) {//Chroma444
-                            add_dct(s, block[8], 8, dest_cb+block_size, dct_linesize);
-                            add_dct(s, block[9], 9, dest_cr+block_size, dct_linesize);
-                            add_dct(s, block[10], 10, dest_cb+block_size+dct_offset, dct_linesize);
-                            add_dct(s, block[11], 11, dest_cr+block_size+dct_offset, dct_linesize);
-                        }
+        /* skip dequant / idct if we are really late ;) */
+        if (s->avctx->skip_idct) {
+            if (  (s->avctx->skip_idct >= AVDISCARD_NONREF && s->pict_type == AV_PICTURE_TYPE_B)
+                ||(s->avctx->skip_idct >= AVDISCARD_NONKEY && s->pict_type != AV_PICTURE_TYPE_I)
+                || s->avctx->skip_idct >= AVDISCARD_ALL)
+                return;
+        }
+
+        /* add dct residue */
+        if (!(IS_MPEG12_H261(s) || s->msmpeg4_version != MSMP4_UNUSED ||
+              (s->codec_id == AV_CODEC_ID_MPEG4 && !s->mpeg_quant))) {
+            add_dequant_dct(s, block[0], 0, dest_y                          , dct_linesize, s->qscale);
+            add_dequant_dct(s, block[1], 1, dest_y              + block_size, dct_linesize, s->qscale);
+            add_dequant_dct(s, block[2], 2, dest_y + dct_offset             , dct_linesize, s->qscale);
+            add_dequant_dct(s, block[3], 3, dest_y + dct_offset + block_size, dct_linesize, s->qscale);
+
+            if (!CONFIG_GRAY || !(s->avctx->flags & AV_CODEC_FLAG_GRAY)) {
+                av_assert2(s->chroma_y_shift);
+                add_dequant_dct(s, block[4], 4, dest_cb, uvlinesize, s->chroma_qscale);
+                add_dequant_dct(s, block[5], 5, dest_cr, uvlinesize, s->chroma_qscale);
+            }
+        } else if (is_mpeg12 == DEFINITELY_MPEG12_H261 || lowres_flag || (s->codec_id != AV_CODEC_ID_WMV2)) {
+            add_dct(s, block[0], 0, dest_y                          , dct_linesize);
+            add_dct(s, block[1], 1, dest_y              + block_size, dct_linesize);
+            add_dct(s, block[2], 2, dest_y + dct_offset             , dct_linesize);
+            add_dct(s, block[3], 3, dest_y + dct_offset + block_size, dct_linesize);
+
+            if (!CONFIG_GRAY || !(s->avctx->flags & AV_CODEC_FLAG_GRAY)) {
+                if (s->chroma_y_shift) {//Chroma420
+                    add_dct(s, block[4], 4, dest_cb, uvlinesize);
+                    add_dct(s, block[5], 5, dest_cr, uvlinesize);
+                } else {
+                    //chroma422
+                    dct_linesize = uvlinesize << s->interlaced_dct;
+                    dct_offset   = s->interlaced_dct ? uvlinesize : uvlinesize*block_size;
+
+                    add_dct(s, block[4], 4, dest_cb, dct_linesize);
+                    add_dct(s, block[5], 5, dest_cr, dct_linesize);
+                    add_dct(s, block[6], 6, dest_cb + dct_offset, dct_linesize);
+                    add_dct(s, block[7], 7, dest_cr + dct_offset, dct_linesize);
+                    if (!s->chroma_x_shift) {//Chroma444
+                        add_dct(s, block[8],   8, dest_cb + block_size, dct_linesize);
+                        add_dct(s, block[9],   9, dest_cr + block_size, dct_linesize);
+                        add_dct(s, block[10], 10, dest_cb + block_size + dct_offset, dct_linesize);
+                        add_dct(s, block[11], 11, dest_cr + block_size + dct_offset, dct_linesize);
                     }
-                } //fi gray
-            } else if (CONFIG_WMV2_DECODER) {
-                ff_wmv2_add_mb(s, block, dest_y, dest_cb, dest_cr);
+                }
+            } //fi gray
+        } else if (CONFIG_WMV2_DECODER) {
+            ff_wmv2_add_mb(s, block, dest_y, dest_cb, dest_cr);
+        }
+    } else {
+        /* Only MPEG-4 Simple Studio Profile is supported in > 8-bit mode.
+            TODO: Integrate 10-bit properly into mpegvideo.c so that ER works properly */
+        if (is_mpeg12 != DEFINITELY_MPEG12_H261 && CONFIG_MPEG4_DECODER &&
+            /* s->codec_id == AV_CODEC_ID_MPEG4 && */
+            s->avctx->bits_per_raw_sample > 8) {
+            ff_mpeg4_decode_studio(s, dest_y, dest_cb, dest_cr, block_size,
+                                    uvlinesize, dct_linesize, dct_offset);
+        } else if (!IS_MPEG12_H261(s)) {
+            /* dct only in intra block */
+            put_dct(s, block[0], 0, dest_y                          , dct_linesize, s->qscale);
+            put_dct(s, block[1], 1, dest_y              + block_size, dct_linesize, s->qscale);
+            put_dct(s, block[2], 2, dest_y + dct_offset             , dct_linesize, s->qscale);
+            put_dct(s, block[3], 3, dest_y + dct_offset + block_size, dct_linesize, s->qscale);
+
+            if (!CONFIG_GRAY || !(s->avctx->flags & AV_CODEC_FLAG_GRAY)) {
+                if (s->chroma_y_shift) {
+                    put_dct(s, block[4], 4, dest_cb, uvlinesize, s->chroma_qscale);
+                    put_dct(s, block[5], 5, dest_cr, uvlinesize, s->chroma_qscale);
+                } else {
+                    dct_offset   >>= 1;
+                    dct_linesize >>= 1;
+                    put_dct(s, block[4], 4, dest_cb,              dct_linesize, s->chroma_qscale);
+                    put_dct(s, block[5], 5, dest_cr,              dct_linesize, s->chroma_qscale);
+                    put_dct(s, block[6], 6, dest_cb + dct_offset, dct_linesize, s->chroma_qscale);
+                    put_dct(s, block[7], 7, dest_cr + dct_offset, dct_linesize, s->chroma_qscale);
+                }
             }
         } else {
-            /* Only MPEG-4 Simple Studio Profile is supported in > 8-bit mode.
-               TODO: Integrate 10-bit properly into mpegvideo.c so that ER works properly */
-            if (is_mpeg12 != DEFINITELY_MPEG12_H261 && CONFIG_MPEG4_DECODER &&
-                /* s->codec_id == AV_CODEC_ID_MPEG4 && */
-                s->avctx->bits_per_raw_sample > 8) {
-                ff_mpeg4_decode_studio(s, dest_y, dest_cb, dest_cr, block_size,
-                                       uvlinesize, dct_linesize, dct_offset);
-            } else if (!IS_MPEG12_H261(s)) {
-                /* dct only in intra block */
-                put_dct(s, block[0], 0, dest_y                          , dct_linesize, s->qscale);
-                put_dct(s, block[1], 1, dest_y              + block_size, dct_linesize, s->qscale);
-                put_dct(s, block[2], 2, dest_y + dct_offset             , dct_linesize, s->qscale);
-                put_dct(s, block[3], 3, dest_y + dct_offset + block_size, dct_linesize, s->qscale);
-
-                if (!CONFIG_GRAY || !(s->avctx->flags & AV_CODEC_FLAG_GRAY)) {
-                    if (s->chroma_y_shift) {
-                        put_dct(s, block[4], 4, dest_cb, uvlinesize, s->chroma_qscale);
-                        put_dct(s, block[5], 5, dest_cr, uvlinesize, s->chroma_qscale);
-                    } else {
-                        dct_offset >>=1;
-                        dct_linesize >>=1;
-                        put_dct(s, block[4], 4, dest_cb,              dct_linesize, s->chroma_qscale);
-                        put_dct(s, block[5], 5, dest_cr,              dct_linesize, s->chroma_qscale);
-                        put_dct(s, block[6], 6, dest_cb + dct_offset, dct_linesize, s->chroma_qscale);
-                        put_dct(s, block[7], 7, dest_cr + dct_offset, dct_linesize, s->chroma_qscale);
+            s->idsp.idct_put(dest_y,                           dct_linesize, block[0]);
+            s->idsp.idct_put(dest_y              + block_size, dct_linesize, block[1]);
+            s->idsp.idct_put(dest_y + dct_offset,              dct_linesize, block[2]);
+            s->idsp.idct_put(dest_y + dct_offset + block_size, dct_linesize, block[3]);
+
+            if (!CONFIG_GRAY || !(s->avctx->flags & AV_CODEC_FLAG_GRAY)) {
+                if (s->chroma_y_shift) {
+                    s->idsp.idct_put(dest_cb, uvlinesize, block[4]);
+                    s->idsp.idct_put(dest_cr, uvlinesize, block[5]);
+                } else {
+                    dct_linesize = uvlinesize << s->interlaced_dct;
+                    dct_offset   = s->interlaced_dct ? uvlinesize : uvlinesize*block_size;
+
+                    s->idsp.idct_put(dest_cb,              dct_linesize, block[4]);
+                    s->idsp.idct_put(dest_cr,              dct_linesize, block[5]);
+                    s->idsp.idct_put(dest_cb + dct_offset, dct_linesize, block[6]);
+                    s->idsp.idct_put(dest_cr + dct_offset, dct_linesize, block[7]);
+                    if (!s->chroma_x_shift) { //Chroma444
+                        s->idsp.idct_put(dest_cb + block_size,              dct_linesize, block[8]);
+                        s->idsp.idct_put(dest_cr + block_size,              dct_linesize, block[9]);
+                        s->idsp.idct_put(dest_cb + block_size + dct_offset, dct_linesize, block[10]);
+                        s->idsp.idct_put(dest_cr + block_size + dct_offset, dct_linesize, block[11]);
                     }
                 }
-            } else {
-                s->idsp.idct_put(dest_y,                           dct_linesize, block[0]);
-                s->idsp.idct_put(dest_y              + block_size, dct_linesize, block[1]);
-                s->idsp.idct_put(dest_y + dct_offset,              dct_linesize, block[2]);
-                s->idsp.idct_put(dest_y + dct_offset + block_size, dct_linesize, block[3]);
-
-                if (!CONFIG_GRAY || !(s->avctx->flags & AV_CODEC_FLAG_GRAY)) {
-                    if (s->chroma_y_shift) {
-                        s->idsp.idct_put(dest_cb, uvlinesize, block[4]);
-                        s->idsp.idct_put(dest_cr, uvlinesize, block[5]);
-                    } else {
-                        dct_linesize = uvlinesize << s->interlaced_dct;
-                        dct_offset   = s->interlaced_dct ? uvlinesize : uvlinesize*block_size;
-
-                        s->idsp.idct_put(dest_cb,              dct_linesize, block[4]);
-                        s->idsp.idct_put(dest_cr,              dct_linesize, block[5]);
-                        s->idsp.idct_put(dest_cb + dct_offset, dct_linesize, block[6]);
-                        s->idsp.idct_put(dest_cr + dct_offset, dct_linesize, block[7]);
-                        if (!s->chroma_x_shift) { //Chroma444
-                            s->idsp.idct_put(dest_cb + block_size,              dct_linesize, block[8]);
-                            s->idsp.idct_put(dest_cr + block_size,              dct_linesize, block[9]);
-                            s->idsp.idct_put(dest_cb + block_size + dct_offset, dct_linesize, block[10]);
-                            s->idsp.idct_put(dest_cr + block_size + dct_offset, dct_linesize, block[11]);
-                        }
-                    }
-                } //gray
-            }
+            } //gray
         }
     }
 }
@@ -1108,20 +1106,20 @@ void mpv_reconstruct_mb_internal(MpegEncContext *s, int16_t block[12][64],
 void ff_mpv_reconstruct_mb(MpegEncContext *s, int16_t block[12][64])
 {
     const int mb_xy = s->mb_y * s->mb_stride + s->mb_x;
-            uint8_t *mbskip_ptr = &s->mbskip_table[mb_xy];
+    uint8_t *mbskip_ptr = &s->mbskip_table[mb_xy];
 
     s->cur_pic.qscale_table[mb_xy] = s->qscale;
 
-        /* avoid copy if macroblock skipped in last frame too */
-            if (s->mb_skipped) {
-                s->mb_skipped = 0;
-                av_assert2(s->pict_type!=AV_PICTURE_TYPE_I);
-                *mbskip_ptr = 1;
-            } else if (!s->cur_pic.reference) {
-                *mbskip_ptr = 1;
-            } else{
-                *mbskip_ptr = 0; /* not skipped */
-            }
+    /* avoid copy if macroblock skipped in last frame too */
+    if (s->mb_skipped) {
+        s->mb_skipped = 0;
+        av_assert2(s->pict_type != AV_PICTURE_TYPE_I);
+        *mbskip_ptr = 1;
+    } else if (!s->cur_pic.reference) {
+        *mbskip_ptr = 1;
+    } else{
+        *mbskip_ptr = 0; /* not skipped */
+    }
 
     if (s->avctx->debug & FF_DEBUG_DCT_COEFF) {
        /* print DCT coefficients */
diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c
index 774d16edad..99e31be463 100644
--- a/libavcodec/mpegvideo_enc.c
+++ b/libavcodec/mpegvideo_enc.c
@@ -1135,44 +1135,44 @@ static void mpv_reconstruct_mb(MpegEncContext *s, int16_t block[12][64])
 
         if (!s->mb_intra) {
             /* No MC, as that was already done otherwise */
-                add_dequant_dct(s, block[0], 0, dest_y                          , dct_linesize, s->qscale);
-                add_dequant_dct(s, block[1], 1, dest_y              + block_size, dct_linesize, s->qscale);
-                add_dequant_dct(s, block[2], 2, dest_y + dct_offset             , dct_linesize, s->qscale);
-                add_dequant_dct(s, block[3], 3, dest_y + dct_offset + block_size, dct_linesize, s->qscale);
-
-                if (!CONFIG_GRAY || !(s->avctx->flags & AV_CODEC_FLAG_GRAY)) {
-                    if (s->chroma_y_shift) {
-                        add_dequant_dct(s, block[4], 4, dest_cb, uvlinesize, s->chroma_qscale);
-                        add_dequant_dct(s, block[5], 5, dest_cr, uvlinesize, s->chroma_qscale);
-                    } else {
-                        dct_linesize >>= 1;
-                        dct_offset   >>= 1;
-                        add_dequant_dct(s, block[4], 4, dest_cb,              dct_linesize, s->chroma_qscale);
-                        add_dequant_dct(s, block[5], 5, dest_cr,              dct_linesize, s->chroma_qscale);
-                        add_dequant_dct(s, block[6], 6, dest_cb + dct_offset, dct_linesize, s->chroma_qscale);
-                        add_dequant_dct(s, block[7], 7, dest_cr + dct_offset, dct_linesize, s->chroma_qscale);
-                    }
+            add_dequant_dct(s, block[0], 0, dest_y                          , dct_linesize, s->qscale);
+            add_dequant_dct(s, block[1], 1, dest_y              + block_size, dct_linesize, s->qscale);
+            add_dequant_dct(s, block[2], 2, dest_y + dct_offset             , dct_linesize, s->qscale);
+            add_dequant_dct(s, block[3], 3, dest_y + dct_offset + block_size, dct_linesize, s->qscale);
+
+            if (!CONFIG_GRAY || !(s->avctx->flags & AV_CODEC_FLAG_GRAY)) {
+                if (s->chroma_y_shift) {
+                    add_dequant_dct(s, block[4], 4, dest_cb, uvlinesize, s->chroma_qscale);
+                    add_dequant_dct(s, block[5], 5, dest_cr, uvlinesize, s->chroma_qscale);
+                } else {
+                    dct_linesize >>= 1;
+                    dct_offset   >>= 1;
+                    add_dequant_dct(s, block[4], 4, dest_cb,              dct_linesize, s->chroma_qscale);
+                    add_dequant_dct(s, block[5], 5, dest_cr,              dct_linesize, s->chroma_qscale);
+                    add_dequant_dct(s, block[6], 6, dest_cb + dct_offset, dct_linesize, s->chroma_qscale);
+                    add_dequant_dct(s, block[7], 7, dest_cr + dct_offset, dct_linesize, s->chroma_qscale);
                 }
+            }
         } else {
-                /* dct only in intra block */
-                put_dct(s, block[0], 0, dest_y                          , dct_linesize, s->qscale);
-                put_dct(s, block[1], 1, dest_y              + block_size, dct_linesize, s->qscale);
-                put_dct(s, block[2], 2, dest_y + dct_offset             , dct_linesize, s->qscale);
-                put_dct(s, block[3], 3, dest_y + dct_offset + block_size, dct_linesize, s->qscale);
-
-                if (!CONFIG_GRAY || !(s->avctx->flags & AV_CODEC_FLAG_GRAY)) {
-                    if (s->chroma_y_shift) {
-                        put_dct(s, block[4], 4, dest_cb, uvlinesize, s->chroma_qscale);
-                        put_dct(s, block[5], 5, dest_cr, uvlinesize, s->chroma_qscale);
-                    } else {
-                        dct_offset >>=1;
-                        dct_linesize >>=1;
-                        put_dct(s, block[4], 4, dest_cb,              dct_linesize, s->chroma_qscale);
-                        put_dct(s, block[5], 5, dest_cr,              dct_linesize, s->chroma_qscale);
-                        put_dct(s, block[6], 6, dest_cb + dct_offset, dct_linesize, s->chroma_qscale);
-                        put_dct(s, block[7], 7, dest_cr + dct_offset, dct_linesize, s->chroma_qscale);
-                    }
+            /* dct only in intra block */
+            put_dct(s, block[0], 0, dest_y                          , dct_linesize, s->qscale);
+            put_dct(s, block[1], 1, dest_y              + block_size, dct_linesize, s->qscale);
+            put_dct(s, block[2], 2, dest_y + dct_offset             , dct_linesize, s->qscale);
+            put_dct(s, block[3], 3, dest_y + dct_offset + block_size, dct_linesize, s->qscale);
+
+            if (!CONFIG_GRAY || !(s->avctx->flags & AV_CODEC_FLAG_GRAY)) {
+                if (s->chroma_y_shift) {
+                    put_dct(s, block[4], 4, dest_cb, uvlinesize, s->chroma_qscale);
+                    put_dct(s, block[5], 5, dest_cr, uvlinesize, s->chroma_qscale);
+                } else {
+                    dct_offset   >>= 1;
+                    dct_linesize >>= 1;
+                    put_dct(s, block[4], 4, dest_cb,              dct_linesize, s->chroma_qscale);
+                    put_dct(s, block[5], 5, dest_cr,              dct_linesize, s->chroma_qscale);
+                    put_dct(s, block[6], 6, dest_cb + dct_offset, dct_linesize, s->chroma_qscale);
+                    put_dct(s, block[7], 7, dest_cr + dct_offset, dct_linesize, s->chroma_qscale);
                 }
+            }
         }
     }
 }
-- 
2.40.1



More information about the ffmpeg-devel mailing list