Browse code

vp9: copy bug in libvpx for 4:2:2 chroma bs=8x4/4x4 prediction.

Ronald S. Bultje authored on 2015/05/01 00:44:12
Showing 1 changed files
... ...
@@ -77,12 +77,20 @@ static void FN(inter_pred)(AVCodecContext *ctx)
77 77
                               ref1->data[2], ref1->linesize[2], tref1,
78 78
                               row << 3, col << (3 - s->ss_h),
79 79
                               &b->mv[0][0], 8 >> s->ss_h, 4, w1, h1, 0);
80
+                // BUG for 4:2:2 bs=8x4, libvpx uses the wrong block index
81
+                // to get the motion vector for the bottom 4x4 block
82
+                // https://code.google.com/p/webm/issues/detail?id=993
83
+                if (s->ss_h == 0) {
84
+                    uvmv = b->mv[2][0];
85
+                } else {
86
+                    uvmv = ROUNDED_DIV_MVx2(b->mv[0][0], b->mv[2][0]);
87
+                }
80 88
                 mc_chroma_dir(s, mc[3 + s->ss_h][b->filter][0],
81 89
                               s->dst[1] + 4 * ls_uv, s->dst[2] + 4 * ls_uv, ls_uv,
82 90
                               ref1->data[1], ref1->linesize[1],
83 91
                               ref1->data[2], ref1->linesize[2], tref1,
84 92
                               (row << 3) + 4, col << (3 - s->ss_h),
85
-                              &b->mv[2][0], 8 >> s->ss_h, 4, w1, h1, 0);
93
+                              &uvmv, 8 >> s->ss_h, 4, w1, h1, 0);
86 94
             }
87 95
 
88 96
             if (b->comp) {
... ...
@@ -110,12 +118,20 @@ static void FN(inter_pred)(AVCodecContext *ctx)
110 110
                                   ref2->data[2], ref2->linesize[2], tref2,
111 111
                                   row << 3, col << (3 - s->ss_h),
112 112
                                   &b->mv[0][1], 8 >> s->ss_h, 4, w2, h2, 1);
113
+                    // BUG for 4:2:2 bs=8x4, libvpx uses the wrong block index
114
+                    // to get the motion vector for the bottom 4x4 block
115
+                    // https://code.google.com/p/webm/issues/detail?id=993
116
+                    if (s->ss_h == 0) {
117
+                        uvmv = b->mv[2][1];
118
+                    } else {
119
+                        uvmv = ROUNDED_DIV_MVx2(b->mv[0][1], b->mv[2][1]);
120
+                    }
113 121
                     mc_chroma_dir(s, mc[3 + s->ss_h][b->filter][1],
114 122
                                   s->dst[1] + 4 * ls_uv, s->dst[2] + 4 * ls_uv, ls_uv,
115 123
                                   ref2->data[1], ref2->linesize[1],
116 124
                                   ref2->data[2], ref2->linesize[2], tref2,
117 125
                                   (row << 3) + 4, col << (3 - s->ss_h),
118
-                                  &b->mv[2][1], 8 >> s->ss_h, 4, w2, h2, 1);
126
+                                  &uvmv, 8 >> s->ss_h, 4, w2, h2, 1);
119 127
                 }
120 128
             }
121 129
         } else if (b->bs == BS_4x8) {
... ...
@@ -239,7 +255,10 @@ static void FN(inter_pred)(AVCodecContext *ctx)
239 239
                                   ref1->data[2], ref1->linesize[2], tref1,
240 240
                                   row << 3, col << 2,
241 241
                                   &uvmv, 4, 4, w1, h1, 0);
242
-                    uvmv = ROUNDED_DIV_MVx2(b->mv[2][0], b->mv[3][0]);
242
+                    // BUG libvpx uses wrong block index for 4:2:2 bs=4x4
243
+                    // bottom block
244
+                    // https://code.google.com/p/webm/issues/detail?id=993
245
+                    uvmv = ROUNDED_DIV_MVx2(b->mv[1][0], b->mv[2][0]);
243 246
                     mc_chroma_dir(s, mc[4][b->filter][0],
244 247
                                   s->dst[1] + 4 * ls_uv, s->dst[2] + 4 * ls_uv, ls_uv,
245 248
                                   ref1->data[1], ref1->linesize[1],
... ...
@@ -327,7 +346,10 @@ static void FN(inter_pred)(AVCodecContext *ctx)
327 327
                                       ref2->data[2], ref2->linesize[2], tref2,
328 328
                                       row << 3, col << 2,
329 329
                                       &uvmv, 4, 4, w2, h2, 1);
330
-                        uvmv = ROUNDED_DIV_MVx2(b->mv[2][1], b->mv[3][1]);
330
+                        // BUG libvpx uses wrong block index for 4:2:2 bs=4x4
331
+                        // bottom block
332
+                        // https://code.google.com/p/webm/issues/detail?id=993
333
+                        uvmv = ROUNDED_DIV_MVx2(b->mv[1][1], b->mv[2][1]);
331 334
                         mc_chroma_dir(s, mc[4][b->filter][1],
332 335
                                       s->dst[1] + 4 * ls_uv, s->dst[2] + 4 * ls_uv, ls_uv,
333 336
                                       ref2->data[1], ref2->linesize[1],