Commit c011fa90 authored by Rafaël Carré's avatar Rafaël Carré Committed by Jean-Paul Saman

resizer: fix bounds checking logic, set correct and padded output pitch

Signed-off-by: Jean-Paul Saman's avatarJean-Paul Saman <jean-paul.saman@m2x.nl>
parent fd73d546
......@@ -97,16 +97,16 @@ static void Resize( decoder_t *p_dec,
i_vidw, i_vidh, *i_width, *i_height );
/* Davinci Resizer can only do from x0.25 to x4 */
if( i_hratio / 4 < VOUT_ASPECT_FACTOR )
i_hratio = VOUT_ASPECT_FACTOR / 4;
else if( i_hratio * 4 > VOUT_ASPECT_FACTOR )
if( i_hratio > VOUT_ASPECT_FACTOR * 4 )
i_hratio = VOUT_ASPECT_FACTOR * 4;
else if( i_hratio < VOUT_ASPECT_FACTOR / 4 )
i_hratio = VOUT_ASPECT_FACTOR / 4;
/* do that also for the width */
if( i_wratio / 4 < VOUT_ASPECT_FACTOR )
i_wratio = VOUT_ASPECT_FACTOR / 4;
else if( i_wratio * 4 > VOUT_ASPECT_FACTOR )
if( i_wratio > VOUT_ASPECT_FACTOR * 4 )
i_wratio = VOUT_ASPECT_FACTOR * 4;
else if( i_wratio < VOUT_ASPECT_FACTOR / 4 )
i_wratio = VOUT_ASPECT_FACTOR / 4;
msg_Dbg( p_dec, "Final resolution %dx%d (%.2f , %.2f)",
i_vidw * i_wratio / VOUT_ASPECT_FACTOR,
......@@ -758,7 +758,8 @@ static picture_t *DecodeVideoBlockInner( decoder_t *p_dec, block_t **pp_block, i
rsz_params.out_vsize = p_sys->var_info.yres;
/* And then modify it to keep the same aspect ratio */
Resize( p_dec, &rsz_params.out_hsize, &rsz_params.out_vsize );
rsz_params.out_pitch = p_sys->fix_info.line_length;
/* RSZ_PIX_FMT_YUYV is 2 bytes per pixel */
rsz_params.out_pitch = ( rsz_params.out_hsize * 2 + 15 ) & ~15;
short hcoefs[32] = {
0, 256, 0, 0,
......
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