Commit 05f98788 authored by Rocky Bernstein's avatar Rocky Bernstein

RenderRV16 handles scaling. But seems to slow to render subtitles.

parent 7d705ffc
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* render.c : Philips OGT (SVCD Subtitle) renderer * render.c : Philips OGT (SVCD Subtitle) renderer
***************************************************************************** *****************************************************************************
* Copyright (C) 2003 VideoLAN * Copyright (C) 2003 VideoLAN
* $Id: render.c,v 1.6 2004/01/01 13:51:38 rocky Exp $ * $Id: render.c,v 1.7 2004/01/01 15:56:56 rocky Exp $
* *
* Author: Rocky Bernstein * Author: Rocky Bernstein
* based on code from: * based on code from:
...@@ -314,7 +314,8 @@ static void RenderRV16( vout_thread_t *p_vout, picture_t *p_pic, ...@@ -314,7 +314,8 @@ static void RenderRV16( vout_thread_t *p_vout, picture_t *p_pic,
{ {
/* Common variables */ /* Common variables */
uint8_t *p_pixel_base; uint8_t *p_pixel_base;
ogt_yuvt_t *p_source = (ogt_yuvt_t *)p_spu->p_sys->p_data; ogt_yuvt_t *p_src_start = (ogt_yuvt_t *)p_spu->p_sys->p_data;
ogt_yuvt_t *p_src_end = &p_src_start[p_spu->i_height * p_spu->i_width];
int i_x, i_y; int i_x, i_y;
...@@ -324,6 +325,13 @@ static void RenderRV16( vout_thread_t *p_vout, picture_t *p_pic, ...@@ -324,6 +325,13 @@ static void RenderRV16( vout_thread_t *p_vout, picture_t *p_pic,
/* Crop-specific */ /* Crop-specific */
int i_x_start, i_y_start, i_x_end, i_y_end; int i_x_start, i_y_start, i_x_end, i_y_end;
struct subpicture_sys_t *p_sys = p_spu->p_sys;
dbg_print( (DECODE_DBG_CALL|DECODE_DBG_RENDER),
"spu width: %d, height %d, scaled (%d, %d)",
p_spu->i_width, p_spu->i_height,
p_vout->output.i_width, p_vout->output.i_height );
i_xscale = ( p_vout->output.i_width << 6 ) / p_vout->render.i_width; i_xscale = ( p_vout->output.i_width << 6 ) / p_vout->render.i_width;
i_yscale = ( p_vout->output.i_height << 6 ) / p_vout->render.i_height; i_yscale = ( p_vout->output.i_height << 6 ) / p_vout->render.i_height;
...@@ -343,24 +351,37 @@ static void RenderRV16( vout_thread_t *p_vout, picture_t *p_pic, ...@@ -343,24 +351,37 @@ static void RenderRV16( vout_thread_t *p_vout, picture_t *p_pic,
/* Draw until we reach the bottom of the subtitle */ /* Draw until we reach the bottom of the subtitle */
for( i_y = 0 ; i_y < i_height ; ) for( i_y = 0 ; i_y < i_height ; )
{ {
int i_y_src = (i_y / i_yscale) * p_spu->i_width;
i_ytmp = i_y >> 6; i_ytmp = i_y >> 6;
i_y += i_yscale; i_y += i_yscale;
/* Check whether we need to draw one line or more than one */ /* Check whether we need to draw one line or more than one */
if( i_ytmp + 1 >= ( i_y >> 6 ) ) if( i_ytmp + 1 >= ( i_y >> 6 ) )
{ {
/* Just one line : we precalculate i_y >> 6 */ /* Just one line : we precalculate i_y >> 6 */
i_yreal = p_pic->p->i_pitch * i_ytmp; i_yreal = p_pic->p->i_pitch * i_ytmp;
/* Draw until we reach the end of the line */ /* Draw until we reach the end of the line */
for( i_x = i_width ; i_x ; i_x--, p_source++ ) for( i_x = i_width ; i_x ; i_x-- )
{ {
ogt_yuvt_t *p_source;
if( b_crop if( b_crop
&& ( i_x < i_x_start || i_x > i_x_end && ( i_x < i_x_start || i_x > i_x_end
|| i_y < i_y_start || i_y > i_y_end ) ) || i_y < i_y_start || i_y > i_y_end ) )
{ {
continue; continue;
} }
p_source = &p_src_start[i_y_src + ((i_width - i_x) / i_xscale)];
if (p_source >= p_src_end) {
msg_Err( p_vout, "Trying to access beyond subtitle %d x %d %d",
(i_width - i_x) / i_xscale, i_y / i_yscale, i_height);
return;
}
switch( p_source->s.t ) switch( p_source->s.t )
{ {
...@@ -404,8 +425,10 @@ static void RenderRV16( vout_thread_t *p_vout, picture_t *p_pic, ...@@ -404,8 +425,10 @@ static void RenderRV16( vout_thread_t *p_vout, picture_t *p_pic,
i_ynext = p_pic->p->i_pitch * i_y >> 6; i_ynext = p_pic->p->i_pitch * i_y >> 6;
/* Draw until we reach the end of the line */ /* Draw until we reach the end of the line */
for( i_x = i_width ; i_x ; i_x--, p_source++ ) for( i_x = i_width ; i_x ; i_x-- )
{ {
ogt_yuvt_t *p_source;
if( b_crop if( b_crop
&& ( i_x < i_x_start || i_x > i_x_end && ( i_x < i_x_start || i_x > i_x_end
|| i_y < i_y_start || i_y > i_y_end ) ) || i_y < i_y_start || i_y > i_y_end ) )
...@@ -413,6 +436,14 @@ static void RenderRV16( vout_thread_t *p_vout, picture_t *p_pic, ...@@ -413,6 +436,14 @@ static void RenderRV16( vout_thread_t *p_vout, picture_t *p_pic,
continue; continue;
} }
p_source = &p_src_start[i_y_src + ((i_width - i_x) / i_xscale)];
if (p_source >= p_src_end) {
msg_Err( p_vout, "Trying to access beyond subtitle %d x %d %d",
(i_width - i_x) / i_xscale, i_y / i_yscale, i_height);
return;
}
switch( p_source->s.t ) switch( p_source->s.t )
{ {
case 0x00: case 0x00:
......
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