Commit aa79cd11 authored by Sam Hocevar's avatar Sam Hocevar

. les sous-titres sont centr�s

 . la palette des sous-titres par d�faut est moins affreuse.

Bugs que j'avais oubli�s:
 . ne marchent qu'en 16 bits (devrait se fixer vite)
 . parfois quelques glitches graphiques que je ne comprends pas.
parent 3482c341
...@@ -151,6 +151,8 @@ typedef struct subpicture_s ...@@ -151,6 +151,8 @@ typedef struct subpicture_s
struct struct
{ {
int i_offset[2]; /* byte offsets to data */ int i_offset[2]; /* byte offsets to data */
int i_x1, i_x2; /* X coordinates */
int i_y1, i_y2; /* Y coordinates */
} spu; } spu;
} type; } type;
......
...@@ -298,9 +298,15 @@ static void RunThread( spudec_thread_t *p_spudec ) ...@@ -298,9 +298,15 @@ static void RunThread( spudec_thread_t *p_spudec )
break; break;
case 0x05: case 0x05:
/* 05xxxyyyxxxyyy (coordinates) */ /* 05xxxyyyxxxyyy (coordinates) */
GetWord( i_word ); i_word = GetByte( &p_spudec->bit_stream );
GetWord( i_word ); p_spu->type.spu.i_x1 = (i_word << 4) | GetBits( &p_spudec->bit_stream, 4 );
GetWord( i_word ); i_word = GetBits( &p_spudec->bit_stream, 4 );
p_spu->type.spu.i_x2 = (i_word << 8) | GetByte( &p_spudec->bit_stream );
i_word = GetByte( &p_spudec->bit_stream );
p_spu->type.spu.i_y1 = (i_word << 4) | GetBits( &p_spudec->bit_stream, 4 );
i_word = GetBits( &p_spudec->bit_stream, 4 );
p_spu->type.spu.i_y2 = (i_word << 8) | GetByte( &p_spudec->bit_stream );
i_index += 6;
break; break;
case 0x06: case 0x06:
/* 06xxxxyyyy (byte offsets) */ /* 06xxxxyyyy (byte offsets) */
......
...@@ -1009,9 +1009,10 @@ last_display_date = display_date; ...@@ -1009,9 +1009,10 @@ last_display_date = display_date;
#endif #endif
if( display_date > current_date + VOUT_DISPLAY_DELAY ) if( display_date > current_date + VOUT_DISPLAY_DELAY )
{ {
/* A picture is ready to be rendered, but its rendering date is /* A picture is ready to be rendered, but its rendering date
* far from the current one so the thread will perform an empty loop * is far from the current one so the thread will perform an
* as if no picture were found. The picture state is unchanged */ * empty loop as if no picture were found. The picture state
* is unchanged */
p_pic = NULL; p_pic = NULL;
display_date = 0; display_date = 0;
} }
...@@ -1092,6 +1093,7 @@ last_display_date = display_date; ...@@ -1092,6 +1093,7 @@ last_display_date = display_date;
} }
} }
#if 0
else if( p_subpic ) /* subpicture alone */ else if( p_subpic ) /* subpicture alone */
{ {
b_display = p_vout->b_active; b_display = p_vout->b_active;
...@@ -1119,6 +1121,7 @@ last_display_date = display_date; ...@@ -1119,6 +1121,7 @@ last_display_date = display_date;
p_subpic->i_status = DESTROYED_SUBPICTURE; p_subpic->i_status = DESTROYED_SUBPICTURE;
vlc_mutex_unlock( &p_vout->subpicture_lock );*/ vlc_mutex_unlock( &p_vout->subpicture_lock );*/
} }
#endif
else if( p_vout->b_active ) /* idle or interface screen alone */ else if( p_vout->b_active ) /* idle or interface screen alone */
{ {
if( p_vout->b_interface && 0 /* && XXX?? intf_change */ ) if( p_vout->b_interface && 0 /* && XXX?? intf_change */ )
...@@ -1829,6 +1832,7 @@ static void RenderSubPicture( vout_thread_t *p_vout, subpicture_t *p_subpic ) ...@@ -1829,6 +1832,7 @@ static void RenderSubPicture( vout_thread_t *p_vout, subpicture_t *p_subpic )
{ {
case DVD_SUBPICTURE: /* DVD subpicture unit */ case DVD_SUBPICTURE: /* DVD subpicture unit */
vout_RenderSPU( p_subpic->p_data, p_subpic->type.spu.i_offset, vout_RenderSPU( p_subpic->p_data, p_subpic->type.spu.i_offset,
p_subpic->type.spu.i_x1, p_subpic->type.spu.i_y1,
p_vout->p_buffer[ p_vout->i_buffer_index ].p_data, p_vout->p_buffer[ p_vout->i_buffer_index ].p_data,
p_vout->i_bytes_per_pixel, p_vout->i_bytes_per_line ); p_vout->i_bytes_per_pixel, p_vout->i_bytes_per_line );
break; break;
......
...@@ -53,9 +53,9 @@ static int PutPixel ( spu_t *p_spu, int len, u8 color ); ...@@ -53,9 +53,9 @@ static int PutPixel ( spu_t *p_spu, int len, u8 color );
#define GET_NIBBLE( i ) \ #define GET_NIBBLE( i ) \
if( b_aligned ) \ if( b_aligned ) \
{ \ { \
i_next = *p_dest[i_id]; \ i_next = *p_from[i_id]; \
/*printf("%.1x", i_next >> 4);*/ \ /*printf("%.1x", i_next >> 4);*/ \
p_dest[ i_id ]++; \ p_from[ i_id ]++; \
b_aligned = 0; \ b_aligned = 0; \
i = i_next >> 4; \ i = i_next >> 4; \
} \ } \
...@@ -70,9 +70,9 @@ static int PutPixel ( spu_t *p_spu, int len, u8 color ); ...@@ -70,9 +70,9 @@ static int PutPixel ( spu_t *p_spu, int len, u8 color );
#define ADD_NIBBLE( i, j ) \ #define ADD_NIBBLE( i, j ) \
if( b_aligned ) \ if( b_aligned ) \
{ \ { \
i_next = *p_dest[i_id]; \ i_next = *p_from[i_id]; \
/*printf("%.1x", i_next >> 4);*/ \ /*printf("%.1x", i_next >> 4);*/ \
p_dest[ i_id ]++; \ p_from[ i_id ]++; \
b_aligned = 0; \ b_aligned = 0; \
i = (j) + (i_next >> 4); \ i = (j) + (i_next >> 4); \
} \ } \
...@@ -88,26 +88,27 @@ static int PutPixel ( spu_t *p_spu, int len, u8 color ); ...@@ -88,26 +88,27 @@ static int PutPixel ( spu_t *p_spu, int len, u8 color );
***************************************************************************** *****************************************************************************
* *
*****************************************************************************/ *****************************************************************************/
void vout_RenderSPU( byte_t *p_data, int p_offset[2], byte_t *p_pic, void vout_RenderSPU( byte_t *p_data, int p_offset[2],
int i_x, int i_y, byte_t *p_pic,
int i_bytes_per_pixel, int i_bytes_per_line ) int i_bytes_per_pixel, int i_bytes_per_line )
{ {
int i_code = 0x00; int i_code = 0x00;
int i_next = 0; int i_next = 0;
int i_id = 0; int i_id = 0;
boolean_t b_aligned = 1; boolean_t b_aligned = 1;
byte_t *p_dest[2]; byte_t *p_from[2];
spu_t spu; spu_t spu;
p_dest[0] = p_data + p_offset[0]; p_from[1] = p_data + p_offset[1];
p_dest[1] = p_data + p_offset[1]; p_from[0] = p_data + p_offset[0];
spu.x = 0; spu.x = 0;
spu.y = 0; spu.y = 0;
spu.width = 720; spu.width = 720;
spu.height = 576; spu.height = 576;
spu.p_data = p_pic; spu.p_data = p_pic + i_x * i_bytes_per_pixel + i_y * i_bytes_per_line;
while( p_dest[0] < p_data + p_offset[1] + 2 ) while( p_from[0] < p_data + p_offset[1] + 2 )
{ {
GET_NIBBLE( i_code ); GET_NIBBLE( i_code );
...@@ -149,7 +150,7 @@ void vout_RenderSPU( byte_t *p_data, int p_offset[2], byte_t *p_pic, ...@@ -149,7 +150,7 @@ void vout_RenderSPU( byte_t *p_data, int p_offset[2], byte_t *p_pic,
{ {
intf_DbgMsg( "video_spu: unknown code 0x%x " intf_DbgMsg( "video_spu: unknown code 0x%x "
"(dest %x side %x, x=%d, y=%d)\n", "(dest %x side %x, x=%d, y=%d)\n",
i_code, p_dest[i_id], i_id, spu.x, spu.y ); i_code, p_from[i_id], i_id, spu.x, spu.y );
if( NewLine( &spu, &i_id ) < 0 ) if( NewLine( &spu, &i_id ) < 0 )
return; return;
continue; continue;
...@@ -175,7 +176,7 @@ static int NewLine( spu_t *p_spu, int *i_id ) ...@@ -175,7 +176,7 @@ static int NewLine( spu_t *p_spu, int *i_id )
static int PutPixel ( spu_t *p_spu, int i_len, u8 i_color ) static int PutPixel ( spu_t *p_spu, int i_len, u8 i_color )
{ {
//static int p_palette[4] = { 0x0000, 0xfef8, 0x7777, 0xffff }; //static int p_palette[4] = { 0x0000, 0xfef8, 0x7777, 0xffff };
static int p_palette[4] = { 0x0000, 0xffff, 0x0000, 0xffff }; static int p_palette[4] = { 0x0000, 0xffff, 0x5555, 0x0000 };
if( (i_len + p_spu->x + p_spu->y * p_spu->width) if( (i_len + p_spu->x + p_spu->y * p_spu->width)
> p_spu->height * p_spu->width ) > p_spu->height * p_spu->width )
......
...@@ -24,5 +24,6 @@ ...@@ -24,5 +24,6 @@
/***************************************************************************** /*****************************************************************************
* Prototypes * Prototypes
*****************************************************************************/ *****************************************************************************/
void vout_RenderSPU ( byte_t *p_data, int p_offset[2], byte_t *p_pic, void vout_RenderSPU ( byte_t *p_data, int p_offset[2],
int i_x, int i_y, byte_t *p_pic,
int i_bytes_per_pixel, int i_bytes_per_line ); int i_bytes_per_pixel, int i_bytes_per_line );
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