mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-03-17 20:17:55 +02:00
Merge commit '066aafced4dc6c7c9e7b37082635472249f1e93e'
* commit '066aafced4dc6c7c9e7b37082635472249f1e93e': h264: move direct_spatial_mv_pred into the per-slice context Conflicts: libavcodec/h264_mvpred.h Merged-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
commit
a8ac4c9b06
@ -279,7 +279,7 @@ static void fill_slice_long(AVCodecContext *avctx, DXVA_Slice_H264_Long *slice,
|
|||||||
slice->slice_qp_delta = sl->qscale - h->pps.init_qp;
|
slice->slice_qp_delta = sl->qscale - h->pps.init_qp;
|
||||||
slice->redundant_pic_cnt = h->redundant_pic_count;
|
slice->redundant_pic_cnt = h->redundant_pic_count;
|
||||||
if (sl->slice_type == AV_PICTURE_TYPE_B)
|
if (sl->slice_type == AV_PICTURE_TYPE_B)
|
||||||
slice->direct_spatial_mv_pred_flag = h->direct_spatial_mv_pred;
|
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 ? h->cabac_init_idc : 0;
|
||||||
if (h->deblocking_filter < 2)
|
if (h->deblocking_filter < 2)
|
||||||
slice->disable_deblocking_filter_idc = 1 - h->deblocking_filter;
|
slice->disable_deblocking_filter_idc = 1 - h->deblocking_filter;
|
||||||
|
@ -1310,7 +1310,7 @@ int ff_set_ref_count(H264Context *h, H264SliceContext *sl)
|
|||||||
max[0] = max[1] = h->picture_structure == PICT_FRAME ? 15 : 31;
|
max[0] = max[1] = h->picture_structure == PICT_FRAME ? 15 : 31;
|
||||||
|
|
||||||
if (sl->slice_type_nos == AV_PICTURE_TYPE_B)
|
if (sl->slice_type_nos == AV_PICTURE_TYPE_B)
|
||||||
h->direct_spatial_mv_pred = get_bits1(&h->gb);
|
sl->direct_spatial_mv_pred = get_bits1(&h->gb);
|
||||||
num_ref_idx_active_override_flag = get_bits1(&h->gb);
|
num_ref_idx_active_override_flag = get_bits1(&h->gb);
|
||||||
|
|
||||||
if (num_ref_idx_active_override_flag) {
|
if (num_ref_idx_active_override_flag) {
|
||||||
|
@ -392,6 +392,8 @@ typedef struct H264SliceContext {
|
|||||||
*/
|
*/
|
||||||
int neighbor_transform_size;
|
int neighbor_transform_size;
|
||||||
|
|
||||||
|
int direct_spatial_mv_pred;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* non zero coeff count cache.
|
* non zero coeff count cache.
|
||||||
* is 64 if not available.
|
* is 64 if not available.
|
||||||
@ -483,7 +485,6 @@ typedef struct H264Context {
|
|||||||
int picture_structure;
|
int picture_structure;
|
||||||
int first_field;
|
int first_field;
|
||||||
|
|
||||||
int direct_spatial_mv_pred;
|
|
||||||
int col_parity;
|
int col_parity;
|
||||||
int col_fieldoff;
|
int col_fieldoff;
|
||||||
int dist_scale_factor[32];
|
int dist_scale_factor[32];
|
||||||
|
@ -140,7 +140,7 @@ void ff_h264_direct_ref_list_init(H264Context *const h, H264SliceContext *sl)
|
|||||||
h->col_fieldoff = 2 * h->ref_list[1][0].reference - 3;
|
h->col_fieldoff = 2 * h->ref_list[1][0].reference - 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sl->slice_type_nos != AV_PICTURE_TYPE_B || h->direct_spatial_mv_pred)
|
if (sl->slice_type_nos != AV_PICTURE_TYPE_B || sl->direct_spatial_mv_pred)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (list = 0; list < 2; list++) {
|
for (list = 0; list < 2; list++) {
|
||||||
@ -695,7 +695,7 @@ single_col:
|
|||||||
void ff_h264_pred_direct_motion(H264Context *const h, H264SliceContext *sl,
|
void ff_h264_pred_direct_motion(H264Context *const h, H264SliceContext *sl,
|
||||||
int *mb_type)
|
int *mb_type)
|
||||||
{
|
{
|
||||||
if (h->direct_spatial_mv_pred)
|
if (sl->direct_spatial_mv_pred)
|
||||||
pred_spatial_direct_motion(h, sl, mb_type);
|
pred_spatial_direct_motion(h, sl, mb_type);
|
||||||
else
|
else
|
||||||
pred_temp_direct_motion(h, sl, mb_type);
|
pred_temp_direct_motion(h, sl, mb_type);
|
||||||
|
@ -603,7 +603,7 @@ static void fill_decode_caches(H264Context *h, H264SliceContext *sl, int mb_type
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IS_INTER(mb_type) || (IS_DIRECT(mb_type) && h->direct_spatial_mv_pred)) {
|
if (IS_INTER(mb_type) || (IS_DIRECT(mb_type) && sl->direct_spatial_mv_pred)) {
|
||||||
int list;
|
int list;
|
||||||
int b_stride = h->b_stride;
|
int b_stride = h->b_stride;
|
||||||
for (list = 0; list < h->list_count; list++) {
|
for (list = 0; list < h->list_count; list++) {
|
||||||
@ -613,7 +613,7 @@ static void fill_decode_caches(H264Context *h, H264SliceContext *sl, int mb_type
|
|||||||
int16_t(*mv)[2] = h->cur_pic.motion_val[list];
|
int16_t(*mv)[2] = h->cur_pic.motion_val[list];
|
||||||
if (!USES_LIST(mb_type, list))
|
if (!USES_LIST(mb_type, list))
|
||||||
continue;
|
continue;
|
||||||
av_assert2(!(IS_DIRECT(mb_type) && !h->direct_spatial_mv_pred));
|
av_assert2(!(IS_DIRECT(mb_type) && !sl->direct_spatial_mv_pred));
|
||||||
|
|
||||||
if (USES_LIST(top_type, list)) {
|
if (USES_LIST(top_type, list)) {
|
||||||
const int b_xy = h->mb2b_xy[top_xy] + 3 * b_stride;
|
const int b_xy = h->mb2b_xy[top_xy] + 3 * b_stride;
|
||||||
@ -813,7 +813,7 @@ static void av_unused decode_mb_skip(H264Context *h, H264SliceContext *sl)
|
|||||||
if (sl->slice_type_nos == AV_PICTURE_TYPE_B) {
|
if (sl->slice_type_nos == AV_PICTURE_TYPE_B) {
|
||||||
// just for fill_caches. pred_direct_motion will set the real mb_type
|
// just for fill_caches. pred_direct_motion will set the real mb_type
|
||||||
mb_type |= MB_TYPE_L0L1 | MB_TYPE_DIRECT2 | MB_TYPE_SKIP;
|
mb_type |= MB_TYPE_L0L1 | MB_TYPE_DIRECT2 | MB_TYPE_SKIP;
|
||||||
if (h->direct_spatial_mv_pred) {
|
if (sl->direct_spatial_mv_pred) {
|
||||||
fill_decode_neighbors(h, sl, mb_type);
|
fill_decode_neighbors(h, sl, mb_type);
|
||||||
fill_decode_caches(h, sl, mb_type); //FIXME check what is needed and what not ...
|
fill_decode_caches(h, sl, mb_type); //FIXME check what is needed and what not ...
|
||||||
}
|
}
|
||||||
|
@ -1851,7 +1851,7 @@ int ff_h264_decode_slice_header(H264Context *h, H264SliceContext *sl, H264Contex
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sl->slice_type_nos == AV_PICTURE_TYPE_B && !h->direct_spatial_mv_pred)
|
if (sl->slice_type_nos == AV_PICTURE_TYPE_B && !sl->direct_spatial_mv_pred)
|
||||||
ff_h264_direct_dist_scale_factor(h);
|
ff_h264_direct_dist_scale_factor(h);
|
||||||
ff_h264_direct_ref_list_init(h, sl);
|
ff_h264_direct_ref_list_init(h, sl);
|
||||||
|
|
||||||
@ -2018,7 +2018,7 @@ int ff_h264_decode_slice_header(H264Context *h, H264SliceContext *sl, H264Contex
|
|||||||
h->slice_alpha_c0_offset, h->slice_beta_offset,
|
h->slice_alpha_c0_offset, h->slice_beta_offset,
|
||||||
sl->use_weight,
|
sl->use_weight,
|
||||||
sl->use_weight == 1 && sl->use_weight_chroma ? "c" : "",
|
sl->use_weight == 1 && sl->use_weight_chroma ? "c" : "",
|
||||||
sl->slice_type == AV_PICTURE_TYPE_B ? (h->direct_spatial_mv_pred ? "SPAT" : "TEMP") : "");
|
sl->slice_type == AV_PICTURE_TYPE_B ? (sl->direct_spatial_mv_pred ? "SPAT" : "TEMP") : "");
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -330,7 +330,7 @@ static int vaapi_h264_decode_slice(AVCodecContext *avctx,
|
|||||||
slice_param->slice_data_bit_offset = get_bits_count(&h->gb) + 8; /* bit buffer started beyond nal_unit_type */
|
slice_param->slice_data_bit_offset = get_bits_count(&h->gb) + 8; /* bit buffer started beyond nal_unit_type */
|
||||||
slice_param->first_mb_in_slice = (h->mb_y >> FIELD_OR_MBAFF_PICTURE(h)) * h->mb_width + h->mb_x;
|
slice_param->first_mb_in_slice = (h->mb_y >> FIELD_OR_MBAFF_PICTURE(h)) * h->mb_width + h->mb_x;
|
||||||
slice_param->slice_type = ff_h264_get_slice_type(sl);
|
slice_param->slice_type = ff_h264_get_slice_type(sl);
|
||||||
slice_param->direct_spatial_mv_pred_flag = sl->slice_type == AV_PICTURE_TYPE_B ? h->direct_spatial_mv_pred : 0;
|
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 = h->list_count > 0 ? h->ref_count[0] - 1 : 0;
|
slice_param->num_ref_idx_l0_active_minus1 = h->list_count > 0 ? h->ref_count[0] - 1 : 0;
|
||||||
slice_param->num_ref_idx_l1_active_minus1 = h->list_count > 1 ? h->ref_count[1] - 1 : 0;
|
slice_param->num_ref_idx_l1_active_minus1 = h->list_count > 1 ? h->ref_count[1] - 1 : 0;
|
||||||
slice_param->cabac_init_idc = h->cabac_init_idc;
|
slice_param->cabac_init_idc = h->cabac_init_idc;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user