summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2016-04-14 20:53:59 +0200
committerAnton Khirnov <anton@khirnov.net>2016-06-12 20:27:52 +0200
commit0bad254300356005af4aef00a706bf2e8eee96bc (patch)
tree3632ade0a8ea21cc9b8bce25c78a7e404c4c52f1
parented9a20ebe4a89de119ea97bdccf688ece8c6648c (diff)
h264: move initing the implicit pred weight table out of h264_slice_header_parse()
It depends on the reference list, so this will allow moving out the reference list construction and consequently other code it depends on.
-rw-r--r--libavcodec/h264_slice.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c
index b84514c653..2e9587997d 100644
--- a/libavcodec/h264_slice.c
+++ b/libavcodec/h264_slice.c
@@ -1352,25 +1352,16 @@ static int h264_slice_header_parse(H264Context *h, H264SliceContext *sl)
return ret;
}
+ sl->pwt.use_weight = 0;
+ for (i = 0; i < 2; i++) {
+ sl->pwt.luma_weight_flag[i] = 0;
+ sl->pwt.chroma_weight_flag[i] = 0;
+ }
if ((pps->weighted_pred && sl->slice_type_nos == AV_PICTURE_TYPE_P) ||
(pps->weighted_bipred_idc == 1 &&
sl->slice_type_nos == AV_PICTURE_TYPE_B))
ff_h264_pred_weight_table(&sl->gb, sps, sl->ref_count,
sl->slice_type_nos, &sl->pwt);
- else if (pps->weighted_bipred_idc == 2 &&
- sl->slice_type_nos == AV_PICTURE_TYPE_B) {
- implicit_weight_table(h, sl, -1);
- if (FRAME_MBAFF(h)) {
- implicit_weight_table(h, sl, 0);
- implicit_weight_table(h, sl, 1);
- }
- } else {
- sl->pwt.use_weight = 0;
- for (i = 0; i < 2; i++) {
- sl->pwt.luma_weight_flag[i] = 0;
- sl->pwt.chroma_weight_flag[i] = 0;
- }
- }
// If frame-mt is enabled, only update mmco tables for the first slice
// in a field. Subsequent slices can temporarily clobber h->mmco_index
@@ -1458,6 +1449,15 @@ int ff_h264_decode_slice_header(H264Context *h, H264SliceContext *sl)
if (ret < 0)
return ret;
+ if (h->ps.pps->weighted_bipred_idc == 2 &&
+ sl->slice_type_nos == AV_PICTURE_TYPE_B) {
+ implicit_weight_table(h, sl, -1);
+ if (FRAME_MBAFF(h)) {
+ implicit_weight_table(h, sl, 0);
+ implicit_weight_table(h, sl, 1);
+ }
+ }
+
if (sl->slice_type_nos == AV_PICTURE_TYPE_B && !sl->direct_spatial_mv_pred)
ff_h264_direct_dist_scale_factor(h, sl);
ff_h264_direct_ref_list_init(h, sl);