[FFmpeg-cvslog] Merge commit '0bad254300356005af4aef00a706bf2e8eee96bc'
Clément Bœsch
git at videolan.org
Wed Jun 29 17:44:44 CEST 2016
ffmpeg | branch: master | Clément Bœsch <clement at stupeflix.com> | Wed Jun 29 17:39:33 2016 +0200| [3b95452ca8bb39ac2136c9212a80b921e37f18c8] | committer: Clément Bœsch
Merge commit '0bad254300356005af4aef00a706bf2e8eee96bc'
* commit '0bad254300356005af4aef00a706bf2e8eee96bc':
h264: move initing the implicit pred weight table out of h264_slice_header_parse()
Merged-by: Clément Bœsch <clement at stupeflix.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=3b95452ca8bb39ac2136c9212a80b921e37f18c8
---
libavcodec/h264_slice.c | 28 ++++++++++++++--------------
1 file changed, 14 insertions(+), 14 deletions(-)
diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c
index 5cfb34f..49ed0d0 100644
--- a/libavcodec/h264_slice.c
+++ b/libavcodec/h264_slice.c
@@ -1602,25 +1602,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, h->avctx);
- 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
@@ -1708,6 +1699,15 @@ int ff_h264_decode_slice_header(H264Context *h, H264SliceContext *sl)
if (ret) // can not be ret<0 because of SLICE_SKIPED, SLICE_SINGLETHREAD, ...
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);
======================================================================
diff --cc libavcodec/h264_slice.c
index 5cfb34f,2e95879..49ed0d0
--- a/libavcodec/h264_slice.c
+++ b/libavcodec/h264_slice.c
@@@ -1606,21 -1361,7 +1611,7 @@@ static int h264_slice_header_parse(H264
(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);
+ sl->slice_type_nos, &sl->pwt, h->avctx);
- 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
@@@ -1705,9 -1446,18 +1696,18 @@@ int ff_h264_decode_slice_header(H264Con
int i, j, ret = 0;
ret = h264_slice_header_parse(h, sl);
- if (ret < 0)
+ if (ret) // can not be ret<0 because of SLICE_SKIPED, SLICE_SINGLETHREAD, ...
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);
More information about the ffmpeg-cvslog
mailing list