diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2015-03-21 16:06:53 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2015-03-21 16:06:57 +0100 |
commit | 04d23cf1c5f678f5fe0fe0eb5fd92a59c70e8c42 (patch) | |
tree | da717a856506847fcad679c9487714044be1275e | |
parent | 7d23931632ea3af55ec4ddb1e572ff31aa2c1e9a (diff) | |
parent | a9b201cacf85d710b102010cb4baef97f00ea39b (diff) | |
download | ffmpeg-04d23cf1c5f678f5fe0fe0eb5fd92a59c70e8c42.tar.gz |
Merge commit 'a9b201cacf85d710b102010cb4baef97f00ea39b'
* commit 'a9b201cacf85d710b102010cb4baef97f00ea39b':
h264: move cabac_init_idc into the per-slice context
Merged-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r-- | libavcodec/dxva2_h264.c | 2 | ||||
-rw-r--r-- | libavcodec/h264.h | 3 | ||||
-rw-r--r-- | libavcodec/h264_cabac.c | 2 | ||||
-rw-r--r-- | libavcodec/h264_slice.c | 4 | ||||
-rw-r--r-- | libavcodec/vaapi_h264.c | 2 |
5 files changed, 6 insertions, 7 deletions
diff --git a/libavcodec/dxva2_h264.c b/libavcodec/dxva2_h264.c index 4de768cf32..cda79e71a2 100644 --- a/libavcodec/dxva2_h264.c +++ b/libavcodec/dxva2_h264.c @@ -280,7 +280,7 @@ static void fill_slice_long(AVCodecContext *avctx, DXVA_Slice_H264_Long *slice, slice->redundant_pic_cnt = h->redundant_pic_count; if (sl->slice_type == AV_PICTURE_TYPE_B) slice->direct_spatial_mv_pred_flag = sl->direct_spatial_mv_pred; - slice->cabac_init_idc = h->pps.cabac ? h->cabac_init_idc : 0; + slice->cabac_init_idc = h->pps.cabac ? sl->cabac_init_idc : 0; if (sl->deblocking_filter < 2) slice->disable_deblocking_filter_idc = 1 - sl->deblocking_filter; else diff --git a/libavcodec/h264.h b/libavcodec/h264.h index b16ba2a612..f5707435c1 100644 --- a/libavcodec/h264.h +++ b/libavcodec/h264.h @@ -453,6 +453,7 @@ typedef struct H264SliceContext { */ CABACContext cabac; uint8_t cabac_state[1024]; + int cabac_init_idc; } H264SliceContext; /** @@ -640,8 +641,6 @@ typedef struct H264Context { int long_ref_count; ///< number of actual long term references int short_ref_count; ///< number of actual short term references - int cabac_init_idc; - /** * @name Members for slice based multithreading * @{ diff --git a/libavcodec/h264_cabac.c b/libavcodec/h264_cabac.c index c84bd1d507..74c4b8d0aa 100644 --- a/libavcodec/h264_cabac.c +++ b/libavcodec/h264_cabac.c @@ -1268,7 +1268,7 @@ void ff_h264_init_cabac_states(H264Context *h, H264SliceContext *sl) const int slice_qp = av_clip(sl->qscale - 6*(h->sps.bit_depth_luma-8), 0, 51); if (sl->slice_type_nos == AV_PICTURE_TYPE_I) tab = cabac_context_init_I; - else tab = cabac_context_init_PB[h->cabac_init_idc]; + else tab = cabac_context_init_PB[sl->cabac_init_idc]; /* calculate pre-state */ for( i= 0; i < 1024; i++ ) { diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c index 1fbff66748..88e702f6ef 100644 --- a/libavcodec/h264_slice.c +++ b/libavcodec/h264_slice.c @@ -659,7 +659,7 @@ int ff_h264_update_thread_context(AVCodecContext *dst, copy_fields(h, h1, poc_lsb, redundant_pic_count); // reference lists - copy_fields(h, h1, short_ref, cabac_init_idc); + copy_fields(h, h1, short_ref, thread_context); copy_picture_range(h->short_ref, h1->short_ref, 32, h, h1); copy_picture_range(h->long_ref, h1->long_ref, 32, h, h1); @@ -1859,7 +1859,7 @@ int ff_h264_decode_slice_header(H264Context *h, H264SliceContext *sl, H264Contex av_log(h->avctx, AV_LOG_ERROR, "cabac_init_idc %u overflow\n", tmp); return AVERROR_INVALIDDATA; } - h->cabac_init_idc = tmp; + sl->cabac_init_idc = tmp; } sl->last_qscale_diff = 0; diff --git a/libavcodec/vaapi_h264.c b/libavcodec/vaapi_h264.c index a8f2916ff0..07478c16f0 100644 --- a/libavcodec/vaapi_h264.c +++ b/libavcodec/vaapi_h264.c @@ -334,7 +334,7 @@ static int vaapi_h264_decode_slice(AVCodecContext *avctx, slice_param->direct_spatial_mv_pred_flag = sl->slice_type == AV_PICTURE_TYPE_B ? sl->direct_spatial_mv_pred : 0; slice_param->num_ref_idx_l0_active_minus1 = sl->list_count > 0 ? sl->ref_count[0] - 1 : 0; slice_param->num_ref_idx_l1_active_minus1 = sl->list_count > 1 ? sl->ref_count[1] - 1 : 0; - slice_param->cabac_init_idc = h->cabac_init_idc; + slice_param->cabac_init_idc = sl->cabac_init_idc; slice_param->slice_qp_delta = sl->qscale - h->pps.init_qp; slice_param->disable_deblocking_filter_idc = sl->deblocking_filter < 2 ? !sl->deblocking_filter : sl->deblocking_filter; slice_param->slice_alpha_c0_offset_div2 = sl->slice_alpha_c0_offset / 2; |