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

Fix --crop-rect top offset with --interlaced or --fake-interlaced

Bug report by Koby Shina.
parent 545de2ff
......@@ -508,7 +508,7 @@ static int validate_parameters( x264_t *h, int b_open )
}
int w_mod = 1;
int h_mod = 1 << PARAM_INTERLACED;
int h_mod = 1 << (PARAM_INTERLACED || h->param.b_fake_interlaced);
if( i_csp == X264_CSP_I400 )
{
h->param.analyse.i_chroma_qp_offset = 0;
......
......@@ -250,7 +250,7 @@ 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->crop.i_bottom = param->crop_rect.i_bottom + sps->i_mb_height*16 - param->i_height;
sps->b_crop = sps->crop.i_left || sps->crop.i_top ||
sps->crop.i_right || sps->crop.i_bottom;
......@@ -363,7 +363,7 @@ void x264_sps_write( bs_t *s, x264_sps_t *sps )
if( sps->b_crop )
{
int h_shift = sps->i_chroma_format_idc == CHROMA_420 || sps->i_chroma_format_idc == CHROMA_422;
int v_shift = sps->i_chroma_format_idc == CHROMA_420;
int v_shift = (sps->i_chroma_format_idc == CHROMA_420) + !sps->b_frame_mbs_only;
bs_write_ue( s, sps->crop.i_left >> h_shift );
bs_write_ue( s, sps->crop.i_right >> h_shift );
bs_write_ue( s, sps->crop.i_top >> v_shift );
......
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