Commit 4991bd57 authored by Henri Fallon's avatar Henri Fallon

Put a test outside a loop : fixes task 0x31
parent d7a54c80
......@@ -4,6 +4,8 @@
* Copyright (C) 1999, 2000 VideoLAN
*
* Authors:
* Samuel "Sam" Hocevar <sam@via.ecp.fr>
* Henri Fallon <henri@via.ecp.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......@@ -124,6 +126,13 @@ void vout_RenderSPU( vout_buffer_t *p_buffer, subpicture_t *p_subpic,
+ ( p_buffer->i_pic_y + ((p_subpic->i_y * i_y_scale) >> 6))
* i_bytes_per_line;
/* Do we need scaling ?
* This is mostly dupliucate code except a few lines.
* This test was put out of the loop to avoid testing it
* each time.
*/
if ( i_y_scale >= (1 << 6) )
{
while( p_from[0] < (byte_t *)p_subpic->p_data
+ p_subpic->type.spu.i_offset[1] )
{
......@@ -131,7 +140,7 @@ void vout_RenderSPU( vout_buffer_t *p_buffer, subpicture_t *p_subpic,
if( i_code >= 0x04 )
{
found_code:
found_code_with_scale:
if( ((i_code >> 2) + vspu.i_x + vspu.i_y * vspu.i_width)
> vspu.i_height * vspu.i_width )
......@@ -154,17 +163,92 @@ void vout_RenderSPU( vout_buffer_t *p_buffer, subpicture_t *p_subpic,
((((i_code - 1) * i_x_scale) >> 8) + 1)
* i_bytes_per_pixel );
/* if we need some horizontal scaling (unlikely )
/* here we need some horizontal scaling (unlikely )
* we only scale up to 2x, someone watching a DVD
* with more than 2x zoom must be braindead */
if( i_y_scale >= (1 << 6) )
{
p_target += i_bytes_per_line;
memset( p_target, p_palette[i_color],
((((i_code - 1) * i_x_scale) >> 8) + 1)
* i_bytes_per_pixel );
}
vspu.i_x += i_code >> 2;
}
if( vspu.i_x >= vspu.i_width )
{
/* byte-align the stream */
b_aligned = 1;
/* finish the line */
NewLine( &vspu, &i_id );
}
continue;
}
ADD_NIBBLE( i_code, (i_code << 4) );
if( i_code >= 0x10 ) /* 00 11 xx cc */
goto found_code_with_scale; /* 00 01 xx cc */
ADD_NIBBLE( i_code, (i_code << 4) );
if( i_code >= 0x040 ) /* 00 00 11 xx xx cc */
goto found_code_with_scale; /* 00 00 01 xx xx cc */
ADD_NIBBLE( i_code, (i_code << 4) );
if( i_code >= 0x0100 ) /* 00 00 00 11 xx xx xx cc */
goto found_code_with_scale; /* 00 00 00 01 xx xx xx cc */
/* if the 14 first bits are 0, then it's a newline */
if( i_code <= 0x0003 )
{
if( NewLine( &vspu, &i_id ) < 0 )
return;
if( !b_aligned )
b_aligned = 1;
}
else
{
/* we have a boo boo ! */
intf_DbgMsg( "video_spu: unknown code 0x%x "
"(dest %x side %x, x=%d, y=%d)\n",
i_code, p_from[i_id], i_id, vspu.i_x, vspu.i_y );
if( NewLine( &vspu, &i_id ) < 0 )
return;
continue;
}
}
}
else
{
while( p_from[0] < (byte_t *)p_subpic->p_data
+ p_subpic->type.spu.i_offset[1] )
{
GET_NIBBLE( i_code );
if( i_code >= 0x04 )
{
found_code:
if( ((i_code >> 2) + vspu.i_x + vspu.i_y * vspu.i_width)
> vspu.i_height * vspu.i_width )
{
intf_DbgMsg ( "video_spu: invalid draw request ! %d %d\n",
i_code >> 2, vspu.i_height * vspu.i_width
- ( (i_code >> 2) + vspu.i_x
+ vspu.i_y * vspu.i_width ) );
return;
}
else
{
if( (i_color = i_code & 0x3) )
{
u8 *p_target = &vspu.p_data[
i_bytes_per_pixel * ((vspu.i_x * i_x_scale) >> 6)
+ i_bytes_per_line * ((vspu.i_y * i_y_scale) >> 6) ];
memset( p_target, p_palette[i_color],
((((i_code - 1) * i_x_scale) >> 8) + 1)
* i_bytes_per_pixel );
}
vspu.i_x += i_code >> 2;
}
......@@ -211,6 +295,7 @@ void vout_RenderSPU( vout_buffer_t *p_buffer, subpicture_t *p_subpic,
continue;
}
}
}
}
static int NewLine( vout_spu_t *p_vspu, int *i_id )
......
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