[FFmpeg-cvslog] Revert "avcodec/vc1: add Simple and Main profile to vc1_put_signed_blocks_clamped"

Carl Eugen Hoyos git at videolan.org
Mon Jun 18 12:59:24 EEST 2018


ffmpeg | branch: master | Carl Eugen Hoyos <ceffmpeg at gmail.com> | Mon Jun 18 11:53:56 2018 +0200| [a707a0b657da7784a1832c3d0b02c0cc5444f6a9] | committer: Carl Eugen Hoyos

Revert "avcodec/vc1: add Simple and Main profile to vc1_put_signed_blocks_clamped"

This reverts commit 2065317db6dc3a219f8ed2de427fe7e19e02eb68.

I committed a wrong version of this patch.
Also reverts the follow-up commits 77a3dfb3 and 8331e591.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a707a0b657da7784a1832c3d0b02c0cc5444f6a9
---

 libavcodec/vc1.h            |   1 +
 libavcodec/vc1_block.c      | 133 ++++++++++++++++++++++----------------------
 libavcodec/vc1_loopfilter.c |  30 ++++++++++
 3 files changed, 97 insertions(+), 67 deletions(-)

diff --git a/libavcodec/vc1.h b/libavcodec/vc1.h
index 69f6ca9e4d..1d283f8589 100644
--- a/libavcodec/vc1.h
+++ b/libavcodec/vc1.h
@@ -422,6 +422,7 @@ void ff_vc1_init_transposed_scantables(VC1Context *v);
 int  ff_vc1_decode_end(AVCodecContext *avctx);
 void ff_vc1_decode_blocks(VC1Context *v);
 
+void ff_vc1_loop_filter_iblk(VC1Context *v, int pq);
 void ff_vc1_i_overlap_filter(VC1Context *v);
 void ff_vc1_p_overlap_filter(VC1Context *v);
 void ff_vc1_i_loop_filter(VC1Context *v);
diff --git a/libavcodec/vc1_block.c b/libavcodec/vc1_block.c
index b5454b2e60..0160095c6c 100644
--- a/libavcodec/vc1_block.c
+++ b/libavcodec/vc1_block.c
@@ -66,7 +66,7 @@ static inline void init_block_index(VC1Context *v)
 
 /** @} */ //Bitplane group
 
-static void vc1_put_blocks_clamped(VC1Context *v, int put_signed)
+static void vc1_put_signed_blocks_clamped(VC1Context *v)
 {
     MpegEncContext *s = &v->s;
     uint8_t *dest;
@@ -85,14 +85,9 @@ static void vc1_put_blocks_clamped(VC1Context *v, int put_signed)
                 if (i > 3 ? v->mb_type[0][s->block_index[i] - s->block_wrap[i] - 1] :
                             v->mb_type[0][s->block_index[i] - 2 * s->block_wrap[i] - 2]) {
                     dest = s->dest[0] + ((i & 2) - 4) * 4 * s->linesize + ((i & 1) - 2) * 8;
-                    if (put_signed)
-                        s->idsp.put_signed_pixels_clamped(v->block[v->topleft_blk_idx][i],
-                                                          i > 3 ? s->dest[i - 3] - 8 * s->uvlinesize - 8 : dest,
-                                                          i > 3 ? s->uvlinesize : s->linesize);
-                    else
-                        s->idsp.put_pixels_clamped(v->block[v->topleft_blk_idx][i],
-                                                   i > 3 ? s->dest[i - 3] - 8 * s->uvlinesize - 8 : dest,
-                                                   i > 3 ? s->uvlinesize : s->linesize);
+                    s->idsp.put_signed_pixels_clamped(v->block[v->topleft_blk_idx][i],
+                                                      i > 3 ? s->dest[i - 3] - 8 * s->uvlinesize - 8 : dest,
+                                                      i > 3 ? s->uvlinesize : s->linesize);
                 }
             }
         }
@@ -101,14 +96,9 @@ static void vc1_put_blocks_clamped(VC1Context *v, int put_signed)
                 if (i > 3 ? v->mb_type[0][s->block_index[i] - s->block_wrap[i]] :
                             v->mb_type[0][s->block_index[i] - 2 * s->block_wrap[i]]) {
                     dest = s->dest[0] + ((i & 2) - 4) * 4 * s->linesize + (i & 1) * 8;
-                    if (put_signed)
-                        s->idsp.put_signed_pixels_clamped(v->block[v->top_blk_idx][i],
-                                                          i > 3 ? s->dest[i - 3] - 8 * s->uvlinesize : dest,
-                                                          i > 3 ? s->uvlinesize : s->linesize);
-                    else
-                        s->idsp.put_pixels_clamped(v->block[v->top_blk_idx][i],
-                                                   i > 3 ? s->dest[i - 3] - 8 * s->uvlinesize : dest,
-                                                   i > 3 ? s->uvlinesize : s->linesize);
+                    s->idsp.put_signed_pixels_clamped(v->block[v->top_blk_idx][i],
+                                                      i > 3 ? s->dest[i - 3] - 8 * s->uvlinesize : dest,
+                                                      i > 3 ? s->uvlinesize : s->linesize);
                 }
             }
         }
@@ -124,14 +114,9 @@ static void vc1_put_blocks_clamped(VC1Context *v, int put_signed)
                         dest = s->dest[0] + ((i & 2) >> 1) * s->linesize + ((i & 1) - 2) * 8;
                     else
                         dest = s->dest[0] + (i & 2) * 4 * s->linesize + ((i & 1) - 2) * 8;
-                    if (put_signed)
-                        s->idsp.put_signed_pixels_clamped(v->block[v->left_blk_idx][i],
-                                                          i > 3 ? s->dest[i - 3] - 8 : dest,
-                                                          i > 3 ? s->uvlinesize : s->linesize << fieldtx);
-                    else
-                        s->idsp.put_pixels_clamped(v->block[v->left_blk_idx][i],
-                                                   i > 3 ? s->dest[i - 3] - 8 : dest,
-                                                   i > 3 ? s->uvlinesize : s->linesize << fieldtx);
+                    s->idsp.put_signed_pixels_clamped(v->block[v->left_blk_idx][i],
+                                                      i > 3 ? s->dest[i - 3] - 8 : dest,
+                                                      i > 3 ? s->uvlinesize : s->linesize << fieldtx);
                 }
             }
         }
@@ -144,14 +129,9 @@ static void vc1_put_blocks_clamped(VC1Context *v, int put_signed)
                         dest = s->dest[0] + ((i & 2) >> 1) * s->linesize + (i & 1) * 8;
                     else
                         dest = s->dest[0] + (i & 2) * 4 * s->linesize + (i & 1) * 8;
-                    if (put_signed)
-                        s->idsp.put_signed_pixels_clamped(v->block[v->cur_blk_idx][i],
-                                                          i > 3 ? s->dest[i - 3] : dest,
-                                                          i > 3 ? s->uvlinesize : s->linesize << fieldtx);
-                    else
-                        s->idsp.put_pixels_clamped(v->block[v->cur_blk_idx][i],
-                                                   i > 3 ? s->dest[i - 3] : dest,
-                                                   i > 3 ? s->uvlinesize : s->linesize << fieldtx);
+                    s->idsp.put_signed_pixels_clamped(v->block[v->cur_blk_idx][i],
+                                                      i > 3 ? s->dest[i - 3] : dest,
+                                                      i > 3 ? s->uvlinesize : s->linesize << fieldtx);
                 }
             }
         }
@@ -1489,7 +1469,7 @@ static int vc1_decode_p_mb(VC1Context *v)
 end:
     if (v->overlap && v->pq >= 9)
         ff_vc1_p_overlap_filter(v);
-    vc1_put_blocks_clamped(v, 1);
+    vc1_put_signed_blocks_clamped(v);
 
     v->cbp[s->mb_x]      = block_cbp;
     v->ttblk[s->mb_x]    = block_tt;
@@ -1700,7 +1680,7 @@ static int vc1_decode_p_mb_intfr(VC1Context *v)
     }
     if (v->overlap && v->pq >= 9)
         ff_vc1_p_overlap_filter(v);
-    vc1_put_blocks_clamped(v, 1);
+    vc1_put_signed_blocks_clamped(v);
 
     v->cbp[s->mb_x]      = block_cbp;
     v->ttblk[s->mb_x]    = block_tt;
@@ -1820,7 +1800,7 @@ static int vc1_decode_p_mb_intfi(VC1Context *v)
     }
     if (v->overlap && v->pq >= 9)
         ff_vc1_p_overlap_filter(v);
-    vc1_put_blocks_clamped(v, 1);
+    vc1_put_signed_blocks_clamped(v);
 
     v->cbp[s->mb_x]      = block_cbp;
     v->ttblk[s->mb_x]    = block_tt;
@@ -2537,28 +2517,30 @@ static void vc1_decode_i_blocks(VC1Context *v)
     s->mb_x = s->mb_y = 0;
     s->mb_intra         = 1;
     s->first_slice_line = 1;
-    for (s->mb_y = s->start_mb_y; s->mb_y < s->end_mb_y; s->mb_y++) {
+    for (s->mb_y = 0; s->mb_y < s->end_mb_y; s->mb_y++) {
         s->mb_x = 0;
         init_block_index(v);
         for (; s->mb_x < v->end_mb_x; s->mb_x++) {
-            int16_t (*block)[64] = v->block[v->cur_blk_idx];
+            uint8_t *dst[6];
             ff_update_block_index(s);
-            s->bdsp.clear_blocks(block[0]);
+            dst[0] = s->dest[0];
+            dst[1] = dst[0] + 8;
+            dst[2] = s->dest[0] + s->linesize * 8;
+            dst[3] = dst[2] + 8;
+            dst[4] = s->dest[1];
+            dst[5] = s->dest[2];
+            s->bdsp.clear_blocks(s->block[0]);
             mb_pos = s->mb_x + s->mb_y * s->mb_width;
             s->current_picture.mb_type[mb_pos]                     = MB_TYPE_INTRA;
             s->current_picture.qscale_table[mb_pos]                = v->pq;
-            for (int i = 0; i < 4; i++) {
-                s->current_picture.motion_val[1][s->block_index[i]][0] = 0;
-                s->current_picture.motion_val[1][s->block_index[i]][1] = 0;
-            }
+            s->current_picture.motion_val[1][s->block_index[0]][0] = 0;
+            s->current_picture.motion_val[1][s->block_index[0]][1] = 0;
 
             // do actual MB decoding and displaying
             cbp = get_vlc2(&v->s.gb, ff_msmp4_mb_i_vlc.table, MB_INTRA_VLC_BITS, 2);
             v->s.ac_pred = get_bits1(&v->s.gb);
 
             for (k = 0; k < 6; k++) {
-                v->mb_type[0][s->block_index[k]] = 1;
-
                 val = ((cbp >> (5 - k)) & 1);
 
                 if (k < 4) {
@@ -2568,30 +2550,52 @@ static void vc1_decode_i_blocks(VC1Context *v)
                 }
                 cbp |= val << (5 - k);
 
-                vc1_decode_i_block(v, block[k], k, val, (k < 4) ? v->codingset : v->codingset2);
+                vc1_decode_i_block(v, s->block[k], k, val, (k < 4) ? v->codingset : v->codingset2);
 
                 if (CONFIG_GRAY && k > 3 && (s->avctx->flags & AV_CODEC_FLAG_GRAY))
                     continue;
-                v->vc1dsp.vc1_inv_trans_8x8(block[k]);
-            }
-
-            if (v->overlap && v->pq >= 9) {
-                ff_vc1_i_overlap_filter(v);
-                if (v->rangeredfrm)
-                    for (k = 0; k < 6; k++)
+                v->vc1dsp.vc1_inv_trans_8x8(s->block[k]);
+                if (v->pq >= 9 && v->overlap) {
+                    if (v->rangeredfrm)
                         for (j = 0; j < 64; j++)
-                            block[k][j] <<= 1;
-                vc1_put_blocks_clamped(v, 1);
-            } else {
-                if (v->rangeredfrm)
-                    for (k = 0; k < 6; k++)
+                            s->block[k][j] <<= 1;
+                    s->idsp.put_signed_pixels_clamped(s->block[k], dst[k],
+                                                      k & 4 ? s->uvlinesize
+                                                            : s->linesize);
+                } else {
+                    if (v->rangeredfrm)
                         for (j = 0; j < 64; j++)
-                            block[k][j] = (block[k][j] - 64) << 1;
-                vc1_put_blocks_clamped(v, 0);
+                            s->block[k][j] = (s->block[k][j] - 64) << 1;
+                    s->idsp.put_pixels_clamped(s->block[k], dst[k],
+                                               k & 4 ? s->uvlinesize
+                                                     : s->linesize);
+                }
             }
 
+            if (v->pq >= 9 && v->overlap) {
+                if (s->mb_x) {
+                    v->vc1dsp.vc1_h_overlap(s->dest[0], s->linesize);
+                    v->vc1dsp.vc1_h_overlap(s->dest[0] + 8 * s->linesize, s->linesize);
+                    if (!CONFIG_GRAY || !(s->avctx->flags & AV_CODEC_FLAG_GRAY)) {
+                        v->vc1dsp.vc1_h_overlap(s->dest[1], s->uvlinesize);
+                        v->vc1dsp.vc1_h_overlap(s->dest[2], s->uvlinesize);
+                    }
+                }
+                v->vc1dsp.vc1_h_overlap(s->dest[0] + 8, s->linesize);
+                v->vc1dsp.vc1_h_overlap(s->dest[0] + 8 * s->linesize + 8, s->linesize);
+                if (!s->first_slice_line) {
+                    v->vc1dsp.vc1_v_overlap(s->dest[0], s->linesize);
+                    v->vc1dsp.vc1_v_overlap(s->dest[0] + 8, s->linesize);
+                    if (!CONFIG_GRAY || !(s->avctx->flags & AV_CODEC_FLAG_GRAY)) {
+                        v->vc1dsp.vc1_v_overlap(s->dest[1], s->uvlinesize);
+                        v->vc1dsp.vc1_v_overlap(s->dest[2], s->uvlinesize);
+                    }
+                }
+                v->vc1dsp.vc1_v_overlap(s->dest[0] + 8 * s->linesize, s->linesize);
+                v->vc1dsp.vc1_v_overlap(s->dest[0] + 8 * s->linesize + 8, s->linesize);
+            }
             if (v->s.loop_filter)
-                ff_vc1_i_loop_filter(v);
+                ff_vc1_loop_filter_iblk(v, v->pq);
 
             if (get_bits_count(&s->gb) > v->bits) {
                 ff_er_add_slice(&s->er, 0, 0, s->mb_x, s->mb_y, ER_MB_ERROR);
@@ -2599,11 +2603,6 @@ static void vc1_decode_i_blocks(VC1Context *v)
                        get_bits_count(&s->gb), v->bits);
                 return;
             }
-
-            v->topleft_blk_idx = (v->topleft_blk_idx + 1) % (v->end_mb_x + 2);
-            v->top_blk_idx = (v->top_blk_idx + 1) % (v->end_mb_x + 2);
-            v->left_blk_idx = (v->left_blk_idx + 1) % (v->end_mb_x + 2);
-            v->cur_blk_idx = (v->cur_blk_idx + 1) % (v->end_mb_x + 2);
         }
         if (!v->s.loop_filter)
             ff_mpeg_draw_horiz_band(s, s->mb_y * 16, 16);
@@ -2728,7 +2727,7 @@ static void vc1_decode_i_blocks_adv(VC1Context *v)
 
             if (v->overlap && v->condover != CONDOVER_NONE)
                 ff_vc1_i_overlap_filter(v);
-            vc1_put_blocks_clamped(v, 1);
+            vc1_put_signed_blocks_clamped(v);
             if (v->s.loop_filter)
                 ff_vc1_i_loop_filter(v);
 
diff --git a/libavcodec/vc1_loopfilter.c b/libavcodec/vc1_loopfilter.c
index 5d5630db67..cea7dae7f8 100644
--- a/libavcodec/vc1_loopfilter.c
+++ b/libavcodec/vc1_loopfilter.c
@@ -31,6 +31,36 @@
 #include "vc1.h"
 #include "vc1dsp.h"
 
+void ff_vc1_loop_filter_iblk(VC1Context *v, int pq)
+{
+    MpegEncContext *s = &v->s;
+    int j;
+    if (!s->first_slice_line) {
+        v->vc1dsp.vc1_v_loop_filter16(s->dest[0], s->linesize, pq);
+        if (s->mb_x)
+            v->vc1dsp.vc1_h_loop_filter16(s->dest[0] - 16 * s->linesize, s->linesize, pq);
+        v->vc1dsp.vc1_h_loop_filter16(s->dest[0] - 16 * s->linesize + 8, s->linesize, pq);
+        if (!CONFIG_GRAY || !(s->avctx->flags & AV_CODEC_FLAG_GRAY))
+        for (j = 0; j < 2; j++) {
+            v->vc1dsp.vc1_v_loop_filter8(s->dest[j + 1], s->uvlinesize, pq);
+            if (s->mb_x)
+                v->vc1dsp.vc1_h_loop_filter8(s->dest[j + 1] - 8 * s->uvlinesize, s->uvlinesize, pq);
+        }
+    }
+    v->vc1dsp.vc1_v_loop_filter16(s->dest[0] + 8 * s->linesize, s->linesize, pq);
+
+    if (s->mb_y == s->end_mb_y - 1) {
+        if (s->mb_x) {
+            v->vc1dsp.vc1_h_loop_filter16(s->dest[0], s->linesize, pq);
+            if (!CONFIG_GRAY || !(s->avctx->flags & AV_CODEC_FLAG_GRAY)) {
+            v->vc1dsp.vc1_h_loop_filter8(s->dest[1], s->uvlinesize, pq);
+            v->vc1dsp.vc1_h_loop_filter8(s->dest[2], s->uvlinesize, pq);
+            }
+        }
+        v->vc1dsp.vc1_h_loop_filter16(s->dest[0] + 8, s->linesize, pq);
+    }
+}
+
 static av_always_inline void vc1_h_overlap_filter(VC1Context *v, int16_t (*left_block)[64],
                                                   int16_t (*right_block)[64], int block_num)
 {



More information about the ffmpeg-cvslog mailing list