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

Put a test outside a loop : fixes task 0x31
parent d7a54c80
......@@ -4,7 +4,9 @@
* 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
* the Free Software Foundation; either version 2 of the License, or
......@@ -124,91 +126,174 @@ 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;
while( p_from[0] < (byte_t *)p_subpic->p_data
+ p_subpic->type.spu.i_offset[1] )
/* 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) )
{
GET_NIBBLE( i_code );
if( i_code >= 0x04 )
while( p_from[0] < (byte_t *)p_subpic->p_data
+ p_subpic->type.spu.i_offset[1] )
{
found_code:
if( ((i_code >> 2) + vspu.i_x + vspu.i_y * vspu.i_width)
> vspu.i_height * vspu.i_width )
GET_NIBBLE( i_code );
if( i_code >= 0x04 )
{
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;
found_code_with_scale:
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 );
/* 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 */
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
{
if( (i_color = i_code & 0x3) )
/* 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 )
{
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 );
/* if 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) )
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) )
{
p_target += i_bytes_per_line;
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;
}
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;
}
if( vspu.i_x >= vspu.i_width )
ADD_NIBBLE( i_code, (i_code << 4) );
if( i_code >= 0x10 ) /* 00 11 xx cc */
goto found_code; /* 00 01 xx cc */
ADD_NIBBLE( i_code, (i_code << 4) );
if( i_code >= 0x040 ) /* 00 00 11 xx xx cc */
goto found_code; /* 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; /* 00 00 00 01 xx xx xx cc */
/* if the 14 first bits are 0, then it's a newline */
if( i_code <= 0x0003 )
{
/* byte-align the stream */
b_aligned = 1;
/* finish the line */
NewLine( &vspu, &i_id );
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;
}
continue;
}
ADD_NIBBLE( i_code, (i_code << 4) );
if( i_code >= 0x10 ) /* 00 11 xx cc */
goto found_code; /* 00 01 xx cc */
ADD_NIBBLE( i_code, (i_code << 4) );
if( i_code >= 0x040 ) /* 00 00 11 xx xx cc */
goto found_code; /* 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; /* 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;
}
}
}
......
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