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

resizer: don't resize directly in the framebuffer if the scaled video width is...

resizer: don't resize directly in the framebuffer if the scaled video width is not equal to the framebuffer width
Signed-off-by: Jean-Paul Saman's avatarJean-Paul Saman <jean-paul.saman@m2x.nl>
parent bef48895
...@@ -88,6 +88,10 @@ struct decoder_sys_t ...@@ -88,6 +88,10 @@ struct decoder_sys_t
uint8_t *p_yuyv; uint8_t *p_yuyv;
int offset; int offset;
int i_yuyv; int i_yuyv;
vlc_bool_t b_direct; /* resize directly in the fb */
unsigned int i_out_width;
unsigned int i_out_height;
#endif #endif
}; };
...@@ -657,6 +661,12 @@ static void Resize( decoder_t *p_dec, vlc_bool_t b_scale ) ...@@ -657,6 +661,12 @@ static void Resize( decoder_t *p_dec, vlc_bool_t b_scale )
/* RSZ_PIX_FMT_YUYV is 2 bytes per pixel */ /* RSZ_PIX_FMT_YUYV is 2 bytes per pixel */
rsz_params.out_pitch = ( rsz_params.out_hsize * 2 + 15 ) & ~15; rsz_params.out_pitch = ( rsz_params.out_hsize * 2 + 15 ) & ~15;
p_sys->b_direct =
(unsigned)rsz_params.out_hsize == (unsigned)p_sys->var_info.xres;
p_sys->i_out_width = rsz_params.out_hsize;
p_sys->i_out_height = rsz_params.out_vsize;
short hcoefs[32] = { short hcoefs[32] = {
0, 256, 0, 0, 0, 256, 0, 0,
-11, 245, 23, -1, -11, 245, 23, -1,
...@@ -723,7 +733,8 @@ static void Resize( decoder_t *p_dec, vlc_bool_t b_scale ) ...@@ -723,7 +733,8 @@ static void Resize( decoder_t *p_dec, vlc_bool_t b_scale )
rsz.out_buf.index = -1; rsz.out_buf.index = -1;
rsz.out_buf.buf_type = RSZ_BUF_OUT; rsz.out_buf.buf_type = RSZ_BUF_OUT;
if( b_scale )
if( b_scale && p_sys->b_direct )
{ {
/* FIXME: use NUM_BUFFERS if needed */ /* FIXME: use NUM_BUFFERS if needed */
rsz.out_buf.offset = p_sys->p_physbufs[0]; rsz.out_buf.offset = p_sys->p_physbufs[0];
...@@ -955,12 +966,10 @@ static picture_t *DecodeVideoBlockInner( decoder_t *p_dec, block_t **pp_block, i ...@@ -955,12 +966,10 @@ static picture_t *DecodeVideoBlockInner( decoder_t *p_dec, block_t **pp_block, i
vlc_bool_t b_resize = p_sys->b_resize; vlc_bool_t b_resize = p_sys->b_resize;
vlc_mutex_unlock( &p_sys->cb_lock ); vlc_mutex_unlock( &p_sys->cb_lock );
if( b_resize ) Resize( p_dec, b_resize );
Resize( p_dec, VLC_TRUE );
else
{
Resize( p_dec, VLC_FALSE ); /* convert to YUYV */
if( !b_resize || !p_sys->b_direct )
{
uint32_t black = 0x88888888; /* for vout YUYV */ uint32_t black = 0x88888888; /* for vout YUYV */
/* fb */ /* fb */
...@@ -969,12 +978,12 @@ static picture_t *DecodeVideoBlockInner( decoder_t *p_dec, block_t **pp_block, i ...@@ -969,12 +978,12 @@ static picture_t *DecodeVideoBlockInner( decoder_t *p_dec, block_t **pp_block, i
int i_nlines = p_sys->var_info.yres; /* in lines */ int i_nlines = p_sys->var_info.yres; /* in lines */
/* bytes per input line */ /* bytes per input line */
int i_vidw = p_dec->fmt_out.video.i_width * (BPP/8); int i_vidw = p_sys->i_out_width * (BPP/8);
/* borders */ /* borders */
int i_sideborder = (i_line_len - i_vidw) / 2; /* in bytes */ int i_sideborder = (i_line_len - i_vidw) / 2; /* in bytes */
int i_edgeborder = /* in lines */ int i_edgeborder = /* in lines */
(i_nlines - p_dec->fmt_out.video.i_height) / 2; (i_nlines - p_sys->i_out_height) / 2;
int i,j; int i,j;
......
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