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

resizer: do not go past the hardware limitations (0.25 to 4)

Signed-off-by: Jean-Paul Saman's avatarJean-Paul Saman <jean-paul.saman@m2x.nl>
parent fe8d7919
...@@ -85,16 +85,36 @@ struct decoder_sys_t ...@@ -85,16 +85,36 @@ struct decoder_sys_t
#ifdef DAVINCI_HACK #ifdef DAVINCI_HACK
static void Resize( unsigned int *i_width, unsigned int *i_height, static void Resize( decoder_t *p_dec,
unsigned int i_vidw, unsigned int i_vidh ) unsigned int *i_width, unsigned int *i_height )
{ {
unsigned int i_vidw = p_dec->fmt_out.video.i_width;
unsigned int i_vidh = p_dec->fmt_out.video.i_height;
unsigned int i_hratio = VOUT_ASPECT_FACTOR * *i_height / i_vidh; unsigned int i_hratio = VOUT_ASPECT_FACTOR * *i_height / i_vidh;
unsigned int i_wratio = VOUT_ASPECT_FACTOR * *i_width / i_vidw; unsigned int i_wratio = VOUT_ASPECT_FACTOR * *i_width / i_vidw;
if( i_hratio == i_wratio ) msg_Dbg( p_dec, "Original Video %dx%d, Output destination %dx%d",
return; /* nothing to do */ i_vidw, i_vidh, *i_width, *i_height );
/* else choose the minimum for both axes */ /* 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 )
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 )
i_wratio = VOUT_ASPECT_FACTOR * 4;
msg_Dbg( p_dec, "Final resolution %dx%d (%.2f , %.2f)",
i_vidw * i_wratio / VOUT_ASPECT_FACTOR,
i_vidh * i_hratio / VOUT_ASPECT_FACTOR,
(float)i_wratio / VOUT_ASPECT_FACTOR,
(float)i_hratio / VOUT_ASPECT_FACTOR );
/* choose the minimum for both axes */
i_hratio = i_wratio = i_hratio < i_wratio ? i_hratio : i_wratio; i_hratio = i_wratio = i_hratio < i_wratio ? i_hratio : i_wratio;
/* and set the new resolution accordingly */ /* and set the new resolution accordingly */
...@@ -737,8 +757,7 @@ static picture_t *DecodeVideoBlockInner( decoder_t *p_dec, block_t **pp_block, i ...@@ -737,8 +757,7 @@ static picture_t *DecodeVideoBlockInner( decoder_t *p_dec, block_t **pp_block, i
rsz_params.out_hsize = p_sys->var_info.xres; rsz_params.out_hsize = p_sys->var_info.xres;
rsz_params.out_vsize = p_sys->var_info.yres; rsz_params.out_vsize = p_sys->var_info.yres;
/* And then modify it to keep the same aspect ratio */ /* And then modify it to keep the same aspect ratio */
Resize( &rsz_params.out_hsize, &rsz_params.out_vsize, Resize( p_dec, &rsz_params.out_hsize, &rsz_params.out_vsize );
p_dec->fmt_out.video.i_width, p_dec->fmt_out.video.i_height );
rsz_params.out_pitch = p_sys->fix_info.line_length; rsz_params.out_pitch = p_sys->fix_info.line_length;
short hcoefs[32] = { short hcoefs[32] = {
......
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