vc1dec: Don't apply the loop filter on fields

Message ID 1368530421-30472-1-git-send-email-martin@martin.st
State Committed
Commit 5d9d8461fbb87046a7ca220d3676a045bd7ab46e
Headers show

Commit Message

Martin Storsjö May 14, 2013, 11:20 a.m.
From: Michael Niedermayer <michaelni@gmx.at>

Fixes read of uninitialized memory.
---
 libavcodec/vc1dec.c        |    5 ++--
 tests/ref/fate/vc1_sa10143 |   58 ++++++++++++++++++++++----------------------
 2 files changed, 32 insertions(+), 31 deletions(-)

Comments

Kostya Shishkov May 14, 2013, 11:32 a.m. | #1
On Tue, May 14, 2013 at 02:20:21PM +0300, Martin Storsjö wrote:
> From: Michael Niedermayer <michaelni@gmx.at>
> 
> Fixes read of uninitialized memory.
> ---
>  libavcodec/vc1dec.c        |    5 ++--
>  tests/ref/fate/vc1_sa10143 |   58 ++++++++++++++++++++++----------------------
>  2 files changed, 32 insertions(+), 31 deletions(-)

I'd say it's not from him anymore (only the idea) but in general LGTM

Patch

diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c
index 994f5df..f1dc10a 100644
--- a/libavcodec/vc1dec.c
+++ b/libavcodec/vc1dec.c
@@ -4619,7 +4619,8 @@  static void vc1_decode_p_blocks(VC1Context *v)
         break;
     }
 
-    apply_loop_filter   = s->loop_filter && !(s->avctx->skip_loop_filter >= AVDISCARD_NONKEY);
+    apply_loop_filter   = s->loop_filter && !(s->avctx->skip_loop_filter >= AVDISCARD_NONKEY) &&
+                          v->fcm == PROGRESSIVE;
     s->first_slice_line = 1;
     memset(v->cbp_base, 0, sizeof(v->cbp_base[0])*2*s->mb_stride);
     for (s->mb_y = s->start_mb_y; s->mb_y < s->end_mb_y; s->mb_y++) {
@@ -4633,7 +4634,7 @@  static void vc1_decode_p_blocks(VC1Context *v)
             else if (v->fcm == ILACE_FRAME)
                 vc1_decode_p_mb_intfr(v);
             else vc1_decode_p_mb(v);
-            if (s->mb_y != s->start_mb_y && apply_loop_filter && v->fcm == PROGRESSIVE)
+            if (s->mb_y != s->start_mb_y && apply_loop_filter)
                 vc1_apply_p_loop_filter(v);
             if (get_bits_count(&s->gb) > v->bits || get_bits_count(&s->gb) < 0) {
                 // TODO: may need modification to handle slice coding
diff --git a/tests/ref/fate/vc1_sa10143 b/tests/ref/fate/vc1_sa10143
index a008356..0d2e697 100644
--- a/tests/ref/fate/vc1_sa10143
+++ b/tests/ref/fate/vc1_sa10143
@@ -1,31 +1,31 @@ 
 #tb 0: 1/25
 0,          0,          0,        1,   518400, 0x89407f55
-0,          2,          2,        1,   518400, 0xeb8d84a1
-0,          3,          3,        1,   518400, 0x2121ff57
-0,          4,          4,        1,   518400, 0xd81adb3d
-0,          5,          5,        1,   518400, 0x01e36aa2
-0,          6,          6,        1,   518400, 0x6b802361
-0,          7,          7,        1,   518400, 0xc8403c77
-0,          8,          8,        1,   518400, 0xdd342b5d
-0,          9,          9,        1,   518400, 0x2100eea5
-0,         10,         10,        1,   518400, 0x92a22da6
-0,         11,         11,        1,   518400, 0x6bacdef7
-0,         12,         12,        1,   518400, 0x4a00715f
-0,         13,         13,        1,   518400, 0x59b98727
-0,         14,         14,        1,   518400, 0xbf912ee1
-0,         15,         15,        1,   518400, 0x8c966cd6
-0,         16,         16,        1,   518400, 0x2c9a2535
-0,         17,         17,        1,   518400, 0x29085c06
-0,         18,         18,        1,   518400, 0x46ae6b7d
-0,         19,         19,        1,   518400, 0x283100f4
-0,         20,         20,        1,   518400, 0x2731b5ff
-0,         21,         21,        1,   518400, 0x1132ea54
-0,         22,         22,        1,   518400, 0x37cbe539
-0,         23,         23,        1,   518400, 0x08ff75cf
-0,         24,         24,        1,   518400, 0xafb6bc45
-0,         25,         25,        1,   518400, 0x19d3873d
-0,         26,         26,        1,   518400, 0xd494a8be
-0,         27,         27,        1,   518400, 0x285f41ef
-0,         28,         28,        1,   518400, 0xd4b1ffa1
-0,         29,         29,        1,   518400, 0xc3876c3a
-0,         30,         30,        1,   518400, 0xb73dbb62
+0,          2,          2,        1,   518400, 0x1480849d
+0,          3,          3,        1,   518400, 0x0e69ff59
+0,          4,          4,        1,   518400, 0x00d6db06
+0,          5,          5,        1,   518400, 0x1a5b6a69
+0,          6,          6,        1,   518400, 0xc1a1232e
+0,          7,          7,        1,   518400, 0x9a4e3c54
+0,          8,          8,        1,   518400, 0x04122b44
+0,          9,          9,        1,   518400, 0x0fcfeebc
+0,         10,         10,        1,   518400, 0xc7882dc1
+0,         11,         11,        1,   518400, 0x9d79df09
+0,         12,         12,        1,   518400, 0xff6b716f
+0,         13,         13,        1,   518400, 0x638a8746
+0,         14,         14,        1,   518400, 0x07572efb
+0,         15,         15,        1,   518400, 0x306f6cef
+0,         16,         16,        1,   518400, 0xd7602518
+0,         17,         17,        1,   518400, 0x49ab5bf5
+0,         18,         18,        1,   518400, 0x3c736b6c
+0,         19,         19,        1,   518400, 0x95ae00c9
+0,         20,         20,        1,   518400, 0x7b9ab64e
+0,         21,         21,        1,   518400, 0x5205ea68
+0,         22,         22,        1,   518400, 0xb486e618
+0,         23,         23,        1,   518400, 0xa3217616
+0,         24,         24,        1,   518400, 0xc66bbc56
+0,         25,         25,        1,   518400, 0xf024872a
+0,         26,         26,        1,   518400, 0x97d2a8ba
+0,         27,         27,        1,   518400, 0xa3a2418e
+0,         28,         28,        1,   518400, 0x08460005
+0,         29,         29,        1,   518400, 0x50fb6c94
+0,         30,         30,        1,   518400, 0x5584bb40