[FFmpeg-cvslog] h264: move cabac_init_idc into the per-slice context
Anton Khirnov
git at videolan.org
Sat Mar 21 16:18:11 CET 2015
ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Sat Jan 17 22:28:46 2015 +0100| [a9b201cacf85d710b102010cb4baef97f00ea39b] | committer: Anton Khirnov
h264: move cabac_init_idc into the per-slice context
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a9b201cacf85d710b102010cb4baef97f00ea39b
---
libavcodec/dxva2_h264.c | 2 +-
libavcodec/h264.h | 3 +--
libavcodec/h264_cabac.c | 2 +-
libavcodec/h264_slice.c | 4 ++--
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 5e84275..f7b1671 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 d28d185..18aa8cb 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 2dbd7ce..c029fd5 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 a45bf9f..59016c1 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 2196771..ce7643e 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;
More information about the ffmpeg-cvslog
mailing list