mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
h264: move cabac_init_idc into the per-slice context
This commit is contained in:
parent
e6c90ce94f
commit
a9b201cacf
@ -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
|
||||
|
@ -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
|
||||
* @{
|
||||
|
@ -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++ ) {
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user