diff options
author | Derek Buitenhuis <derek.buitenhuis@gmail.com> | 2016-04-26 15:04:29 +0100 |
---|---|---|
committer | Derek Buitenhuis <derek.buitenhuis@gmail.com> | 2016-04-26 15:04:29 +0100 |
commit | ee38234c43b6b3280304be7a43dc569cef683c43 (patch) | |
tree | d8988b87ec816f608ac38eb18a2d236220a3ac8a /libavcodec/h264_slice.c | |
parent | 79aafd43fd255fc04e4f4db4c45d6d1f5a9b9fff (diff) | |
parent | e481458bc308ee838deaeacac51929514762e7a7 (diff) |
Merge commit 'e481458bc308ee838deaeacac51929514762e7a7'
* commit 'e481458bc308ee838deaeacac51929514762e7a7':
h264: factor out pred weight table parsing into a separate file
Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
Diffstat (limited to 'libavcodec/h264_slice.c')
-rw-r--r-- | libavcodec/h264_slice.c | 35 |
1 files changed, 18 insertions, 17 deletions
diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c index f0f0a50a55..880b69602e 100644 --- a/libavcodec/h264_slice.c +++ b/libavcodec/h264_slice.c @@ -770,8 +770,8 @@ static void implicit_weight_table(const H264Context *h, H264SliceContext *sl, in int ref0, ref1, i, cur_poc, ref_start, ref_count0, ref_count1; for (i = 0; i < 2; i++) { - sl->luma_weight_flag[i] = 0; - sl->chroma_weight_flag[i] = 0; + sl->pwt.luma_weight_flag[i] = 0; + sl->pwt.chroma_weight_flag[i] = 0; } if (field < 0) { @@ -782,8 +782,8 @@ static void implicit_weight_table(const H264Context *h, H264SliceContext *sl, in } if (sl->ref_count[0] == 1 && sl->ref_count[1] == 1 && !FRAME_MBAFF(h) && sl->ref_list[0][0].poc + (int64_t)sl->ref_list[1][0].poc == 2 * cur_poc) { - sl->use_weight = 0; - sl->use_weight_chroma = 0; + sl->pwt.use_weight = 0; + sl->pwt.use_weight_chroma = 0; return; } ref_start = 0; @@ -796,10 +796,10 @@ static void implicit_weight_table(const H264Context *h, H264SliceContext *sl, in ref_count1 = 16 + 2 * sl->ref_count[1]; } - sl->use_weight = 2; - sl->use_weight_chroma = 2; - sl->luma_log2_weight_denom = 5; - sl->chroma_log2_weight_denom = 5; + sl->pwt.use_weight = 2; + sl->pwt.use_weight_chroma = 2; + sl->pwt.luma_log2_weight_denom = 5; + sl->pwt.chroma_log2_weight_denom = 5; for (ref0 = ref_start; ref0 < ref_count0; ref0++) { int64_t poc0 = sl->ref_list[0][ref0].poc; @@ -817,10 +817,10 @@ static void implicit_weight_table(const H264Context *h, H264SliceContext *sl, in } } if (field < 0) { - sl->implicit_weight[ref0][ref1][0] = - sl->implicit_weight[ref0][ref1][1] = w; + sl->pwt.implicit_weight[ref0][ref1][0] = + sl->pwt.implicit_weight[ref0][ref1][1] = w; } else { - sl->implicit_weight[ref0][ref1][field] = w; + sl->pwt.implicit_weight[ref0][ref1][field] = w; } } } @@ -1744,15 +1744,16 @@ int ff_h264_decode_slice_header(H264Context *h, H264SliceContext *sl) if ((h->pps.weighted_pred && sl->slice_type_nos == AV_PICTURE_TYPE_P) || (h->pps.weighted_bipred_idc == 1 && sl->slice_type_nos == AV_PICTURE_TYPE_B)) - ff_pred_weight_table(h, sl); + ff_h264_pred_weight_table(&sl->gb, &h->sps, sl->ref_count, + sl->slice_type_nos, &sl->pwt); else if (h->pps.weighted_bipred_idc == 2 && sl->slice_type_nos == AV_PICTURE_TYPE_B) { implicit_weight_table(h, sl, -1); } else { - sl->use_weight = 0; + sl->pwt.use_weight = 0; for (i = 0; i < 2; i++) { - sl->luma_weight_flag[i] = 0; - sl->chroma_weight_flag[i] = 0; + sl->pwt.luma_weight_flag[i] = 0; + sl->pwt.chroma_weight_flag[i] = 0; } } @@ -1941,8 +1942,8 @@ int ff_h264_decode_slice_header(H264Context *h, H264SliceContext *sl) sl->qscale, sl->deblocking_filter, sl->slice_alpha_c0_offset, sl->slice_beta_offset, - sl->use_weight, - sl->use_weight == 1 && sl->use_weight_chroma ? "c" : "", + sl->pwt.use_weight, + sl->pwt.use_weight == 1 && sl->pwt.use_weight_chroma ? "c" : "", sl->slice_type == AV_PICTURE_TYPE_B ? (sl->direct_spatial_mv_pred ? "SPAT" : "TEMP") : ""); } |