Commit 545de2ff authored by Anton Mitrofanov's avatar Anton Mitrofanov Committed by Henrik Gramner
Browse files

Fix possible double transpose of custom CQM if --level is not set

Bug reported by Nicolas Gaullier
parent b63c73dc
......@@ -1508,6 +1508,7 @@ x264_t *x264_encoder_open( x264_param_t *param )
set_aspect_ratio( h, &h->param, 1 );
x264_sps_init( h->sps, h->param.i_sps_id, &h->param );
x264_sps_init_scaling_list( h->sps, &h->param );
x264_pps_init( h->pps, h->param.i_sps_id, &h->param, h->sps );
x264_validate_levels( h, 1 );
......
......@@ -243,7 +243,28 @@ void x264_sps_init( x264_sps_t *sps, int i_id, x264_param_t *param )
sps->b_avcintra = !!param->i_avcintra_class;
sps->i_cqm_preset = param->i_cqm_preset;
}
void x264_sps_init_reconfigurable( x264_sps_t *sps, x264_param_t *param )
{
sps->crop.i_left = param->crop_rect.i_left;
sps->crop.i_top = param->crop_rect.i_top;
sps->crop.i_right = param->crop_rect.i_right + sps->i_mb_width*16 - param->i_width;
sps->crop.i_bottom = (param->crop_rect.i_bottom + sps->i_mb_height*16 - param->i_height) >> !sps->b_frame_mbs_only;
sps->b_crop = sps->crop.i_left || sps->crop.i_top ||
sps->crop.i_right || sps->crop.i_bottom;
sps->vui.b_aspect_ratio_info_present = 0;
if( param->vui.i_sar_width > 0 && param->vui.i_sar_height > 0 )
{
sps->vui.b_aspect_ratio_info_present = 1;
sps->vui.i_sar_width = param->vui.i_sar_width;
sps->vui.i_sar_height= param->vui.i_sar_height;
}
}
void x264_sps_init_scaling_list( x264_sps_t *sps, x264_param_t *param )
{
switch( sps->i_cqm_preset )
{
case X264_CQM_FLAT:
......@@ -280,24 +301,6 @@ void x264_sps_init( x264_sps_t *sps, int i_id, x264_param_t *param )
}
}
void x264_sps_init_reconfigurable( x264_sps_t *sps, x264_param_t *param )
{
sps->crop.i_left = param->crop_rect.i_left;
sps->crop.i_top = param->crop_rect.i_top;
sps->crop.i_right = param->crop_rect.i_right + sps->i_mb_width*16 - param->i_width;
sps->crop.i_bottom = (param->crop_rect.i_bottom + sps->i_mb_height*16 - param->i_height) >> !sps->b_frame_mbs_only;
sps->b_crop = sps->crop.i_left || sps->crop.i_top ||
sps->crop.i_right || sps->crop.i_bottom;
sps->vui.b_aspect_ratio_info_present = 0;
if( param->vui.i_sar_width > 0 && param->vui.i_sar_height > 0 )
{
sps->vui.b_aspect_ratio_info_present = 1;
sps->vui.i_sar_width = param->vui.i_sar_width;
sps->vui.i_sar_height= param->vui.i_sar_height;
}
}
void x264_sps_write( bs_t *s, x264_sps_t *sps )
{
bs_realign( s );
......
......@@ -31,6 +31,8 @@
void x264_sps_init( x264_sps_t *sps, int i_id, x264_param_t *param );
#define x264_sps_init_reconfigurable x264_template(sps_init_reconfigurable)
void x264_sps_init_reconfigurable( x264_sps_t *sps, x264_param_t *param );
#define x264_sps_init_scaling_list x264_template(sps_init_scaling_list)
void x264_sps_init_scaling_list( x264_sps_t *sps, x264_param_t *param );
#define x264_sps_write x264_template(sps_write)
void x264_sps_write( bs_t *s, x264_sps_t *sps );
#define x264_pps_init x264_template(pps_init)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment