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

viddec: keeps the same aspect ratio for width and height when resizing

Signed-off-by: Jean-Paul Saman's avatarJean-Paul Saman <jean-paul.saman@m2x.nl>
parent cc8b74fd
......@@ -85,6 +85,24 @@ struct decoder_sys_t
#ifdef DAVINCI_HACK
static void Resize( unsigned int *i_width, unsigned int *i_height,
unsigned int i_vidw, unsigned int i_vidh )
{
unsigned int i_hratio = VOUT_ASPECT_FACTOR * *i_height / i_vidh;
unsigned int i_wratio = VOUT_ASPECT_FACTOR * *i_width / i_vidw;
if( i_hratio == i_wratio )
return; /* nothing to do */
/* else choose the minimum for both axes */
i_hratio = i_wratio = i_hratio < i_wratio ? i_hratio : i_wratio;
/* and set the new resolution accordingly */
*i_height = (i_vidh * i_hratio) / VOUT_ASPECT_FACTOR;
*i_width = (i_vidw * i_wratio) / VOUT_ASPECT_FACTOR;
}
/* open() a framebuffer by its name (NOT device path) */
static int OpenFB( const char *psz_name )
{
int i_fd = -1;
......@@ -715,8 +733,12 @@ static picture_t *DecodeVideoBlockInner( decoder_t *p_dec, block_t **pp_block, i
(p_dec->fmt_out.video.i_width * BPP / 8 + 31) & ~31;
rsz_params.inptyp = RSZ_INTYPE_YCBCR422_16BIT;
rsz_params.pix_fmt = RSZ_PIX_FMT_YUYV;
/* Sets the destination resolution */
rsz_params.out_hsize = p_sys->var_info.xres;
rsz_params.out_vsize = p_sys->var_info.yres;
/* And then modify it to keep the same aspect ratio */
Resize( &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;
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