]> git.sesse.net Git - ffmpeg/commitdiff
h264: move initialising the explicit pred weight table for MBAFF
authorAnton Khirnov <anton@khirnov.net>
Fri, 15 Apr 2016 12:45:48 +0000 (14:45 +0200)
committerAnton Khirnov <anton@khirnov.net>
Sun, 12 Jun 2016 18:27:52 +0000 (20:27 +0200)
Currently it's done in the code that initialises the ref list for
MBAFF, which is not a logical place for it. Move it to the function that
parses the pred table from the bitstream, which is analogous to what is
done for the implicit weight table as well.

libavcodec/h264_parse.c
libavcodec/h264_refs.c

index 7211c9d34cb598af95a8887b47f0072d3133eb12..052e8e41d9bcb2eaf3f5ca290d9d8cf3438923eb 100644 (file)
@@ -26,7 +26,7 @@ int ff_h264_pred_weight_table(GetBitContext *gb, const SPS *sps,
                               const int *ref_count, int slice_type_nos,
                               H264PredWeightTable *pwt)
 {
-    int list, i;
+    int list, i, j;
     int luma_def, chroma_def;
 
     pwt->use_weight             = 0;
@@ -78,6 +78,14 @@ int ff_h264_pred_weight_table(GetBitContext *gb, const SPS *sps,
                     }
                 }
             }
+
+            // for MBAFF
+            pwt->luma_weight[16 + 2 * i][list][0] = pwt->luma_weight[16 + 2 * i + 1][list][0] = pwt->luma_weight[i][list][0];
+            pwt->luma_weight[16 + 2 * i][list][1] = pwt->luma_weight[16 + 2 * i + 1][list][1] = pwt->luma_weight[i][list][1];
+            for (j = 0; j < 2; j++) {
+                pwt->chroma_weight[16 + 2 * i][list][j][0] = pwt->chroma_weight[16 + 2 * i + 1][list][j][0] = pwt->chroma_weight[i][list][j][0];
+                pwt->chroma_weight[16 + 2 * i][list][j][1] = pwt->chroma_weight[16 + 2 * i + 1][list][j][1] = pwt->chroma_weight[i][list][j][1];
+            }
         }
         if (slice_type_nos != AV_PICTURE_TYPE_B)
             break;
index a925b44327f2452a2365ea0f52279e0a10dc7744..b2f255f76157ce93411733026bccbefa22d249ac 100644 (file)
@@ -373,13 +373,6 @@ void ff_h264_fill_mbaff_ref_list(H264SliceContext *sl)
                 field[1].data[j] += frame->parent->f->linesize[j];
             field[1].reference = PICT_BOTTOM_FIELD;
             field[1].poc       = field[1].parent->field_poc[1];
-
-            sl->pwt.luma_weight[16 + 2 * i][list][0] = sl->pwt.luma_weight[16 + 2 * i + 1][list][0] = sl->pwt.luma_weight[i][list][0];
-            sl->pwt.luma_weight[16 + 2 * i][list][1] = sl->pwt.luma_weight[16 + 2 * i + 1][list][1] = sl->pwt.luma_weight[i][list][1];
-            for (j = 0; j < 2; j++) {
-                sl->pwt.chroma_weight[16 + 2 * i][list][j][0] = sl->pwt.chroma_weight[16 + 2 * i + 1][list][j][0] = sl->pwt.chroma_weight[i][list][j][0];
-                sl->pwt.chroma_weight[16 + 2 * i][list][j][1] = sl->pwt.chroma_weight[16 + 2 * i + 1][list][j][1] = sl->pwt.chroma_weight[i][list][j][1];
-            }
         }
     }
 }