aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2015-01-17 22:28:46 +0100
committerAnton Khirnov <anton@khirnov.net>2015-03-21 11:27:14 +0100
commita9b201cacf85d710b102010cb4baef97f00ea39b (patch)
tree9a02274cb412bc791360fc4fece8585593604212
parente6c90ce94f1b07f50cea2babf7471af455cca0ff (diff)
downloadffmpeg-a9b201cacf85d710b102010cb4baef97f00ea39b.tar.gz
h264: move cabac_init_idc into the per-slice context
-rw-r--r--libavcodec/dxva2_h264.c2
-rw-r--r--libavcodec/h264.h3
-rw-r--r--libavcodec/h264_cabac.c2
-rw-r--r--libavcodec/h264_slice.c4
-rw-r--r--libavcodec/vaapi_h264.c2
5 files changed, 6 insertions, 7 deletions
diff --git a/libavcodec/dxva2_h264.c b/libavcodec/dxva2_h264.c
index 5e84275962..f7b16714f8 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 d28d1858c5..18aa8cbc00 100644
--- a/libavcodec/h264.h
+++ b/libavcodec/h264.h
@@ -416,6 +416,7 @@ typedef struct H264SliceContext {
*/
CABACContext cabac;
uint8_t cabac_state[1024];
+ int cabac_init_idc;
} H264SliceContext;
/**
@@ -597,8 +598,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 2dbd7ced80..c029fd5df8 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 a45bf9fffd..59016c147b 100644
--- a/libavcodec/h264_slice.c
+++ b/libavcodec/h264_slice.c
@@ -608,7 +608,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);
@@ -1657,7 +1657,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 2196771d71..ce7643eb9a 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;