{
RenderInterface( p_vout );
}
- if( p_subpic )
+ if( b_display && p_subpic )
{
- if( b_display )
- {
- RenderSubPicture( p_vout, p_subpic );
- }
-
- /* Remove subpicture from heap */
- /*vlc_mutex_lock( &p_vout->subpicture_lock );
- p_subpic->i_status = DESTROYED_SUBPICTURE;
- vlc_mutex_unlock( &p_vout->subpicture_lock );*/
- }
-
- }
-#if 0
- else if( p_subpic ) /* subpicture alone */
- {
- b_display = p_vout->b_active;
- p_vout->last_display_date = display_date;
-
- if( b_display )
- {
- /* Clear buffer */
- SetBufferPicture( p_vout, NULL );
-
- /* Render informations, interface and subpicture */
- if( p_vout->b_info )
- {
- RenderInfo( p_vout );
- }
- if( p_vout->b_interface )
- {
- RenderInterface( p_vout );
- }
RenderSubPicture( p_vout, p_subpic );
}
- /* Remove subpicture from heap */
- /*vlc_mutex_lock( &p_vout->subpicture_lock );
- p_subpic->i_status = DESTROYED_SUBPICTURE;
- vlc_mutex_unlock( &p_vout->subpicture_lock );*/
}
-#endif
else if( p_vout->b_active ) /* idle or interface screen alone */
{
if( p_vout->b_interface && 0 /* && XXX?? intf_change */ )
/* test if the picture really has to be displayed */
if( mdate() < p_subpic->begin_date )
{
+ /* not yet, see you later */
break;
}
if( mdate() > p_subpic->end_date )
int i_id;
byte_t *p_data;
- /* coordinates inside the spu */
+ /* drawing coordinates inside the spu */
int x;
int y;
- /* size of the spu */
+ /* target size */
int width;
int height;
int i_bytes_per_pixel = p_vout->i_bytes_per_pixel;
int i_bytes_per_line = p_vout->i_bytes_per_line;
- int i_width = 720;
- int i_pic_width = p_vout->p_buffer[ p_vout->i_buffer_index ].i_pic_width;
- int i_height = 576;
- int i_pic_height = p_vout->p_buffer[ p_vout->i_buffer_index ].i_pic_height;
+ /* FIXME: we need a way to get this information from the stream */
+ #define TARGET_WIDTH 720
+ #define TARGET_HEIGHT 576
+ int i_x_scale =
+ ( p_vout->p_buffer[ p_vout->i_buffer_index ].i_pic_width << 6 )
+ / TARGET_WIDTH;
+ int i_y_scale =
+ ( p_vout->p_buffer[ p_vout->i_buffer_index ].i_pic_height << 6 )
+ / TARGET_HEIGHT;
/* FIXME: fake palette - the real one has to be sought in the .IFO */
- static int p_palette[4] = { 0x0000, 0xffff, 0x5555, 0x0000 };
+ static int p_palette[4] = { 0x0000, 0x0000, 0x5555, 0xffff };
boolean_t b_aligned = 1;
byte_t *p_from[2];
vspu.x = 0;
vspu.y = 0;
- vspu.width = 720;
- vspu.height = 576;
+ vspu.width = TARGET_WIDTH;
+ vspu.height = TARGET_HEIGHT;
vspu.p_data = p_vout->p_buffer[ p_vout->i_buffer_index ].p_data
/* go to the picture coordinates */
+ p_vout->p_buffer->i_pic_x * p_vout->i_bytes_per_pixel
{
if( (i_color = i_code & 0x3) )
{
- u8 *p_target = &vspu.p_data[ i_bytes_per_pixel * (vspu.x * i_pic_width / i_width)
- + ( vspu.y * i_pic_height / i_height) * i_bytes_per_line ];
+ u8 *p_target = &vspu.p_data[
+ i_bytes_per_pixel * ((vspu.x * i_x_scale) >> 6)
+ + i_bytes_per_line * ((vspu.y * i_y_scale) >> 6) ];
+
memset( p_target, p_palette[i_color],
- ((i_code * i_pic_width / i_width) >> 2) * i_bytes_per_pixel );
+ ((((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) )
+ {
+ 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.x += i_code >> 2;
}
(((*p_y + dither10[i_real_y]) >> 4) << 7) \
+ ((*p_u + dither20[i_real_y]) >> 5) * 9 \
+ ((*p_v + dither20[i_real_y]) >> 5) ]; \
- b_jump_uv = (b_jump_uv + *p_offset) & 0x1; \
+ b_jump_uv += *p_offset; \
p_y += *p_offset; \
p_u += *p_offset & b_jump_uv; \
p_v += *p_offset++ & b_jump_uv; \
(((*p_y + dither11[i_real_y]) >> 4) << 7) \
+ ((*p_u + dither21[i_real_y]) >> 5) * 9 \
+ ((*p_v + dither21[i_real_y]) >> 5) ]; \
- b_jump_uv = (b_jump_uv + *p_offset) & 0x1; \
+ b_jump_uv += *p_offset; \
p_y += *p_offset; \
p_u += *p_offset & b_jump_uv; \
p_v += *p_offset++ & b_jump_uv; \
(((*p_y + dither12[i_real_y]) >> 4) << 7) \
+ ((*p_u + dither22[i_real_y]) >> 5) * 9 \
+ ((*p_v + dither22[i_real_y]) >> 5) ]; \
- b_jump_uv = (b_jump_uv + *p_offset) & 0x1; \
+ b_jump_uv += *p_offset; \
p_y += *p_offset; \
p_u += *p_offset & b_jump_uv; \
p_v += *p_offset++ & b_jump_uv; \
(((*p_y + dither13[i_real_y]) >> 4) << 7) \
+ ((*p_u + dither23[i_real_y]) >> 5) * 9 \
+ ((*p_v + dither23[i_real_y]) >> 5) ]; \
- b_jump_uv = (b_jump_uv + *p_offset) & 0x1; \
+ b_jump_uv += *p_offset; \
p_y += *p_offset; \
p_u += *p_offset & b_jump_uv; \
p_v += *p_offset++ & b_jump_uv; \
int dither22[4] = { 0x6, 0x16, 0x2, 0x12 };
int dither23[4] = { 0x1e, 0xe, 0x1a, 0xa };
- /* other matrices that can be interesting, either for debugging or for effects */
-#if 0
+ #if 0
+ /* other matrices that can be interesting, either for debugging or for
+ * various effects */
int dither[4][4] = { { 0, 8, 2, 10 }, { 12, 4, 14, 16 }, { 3, 11, 1, 9}, {15, 7, 13, 5} };
int dither[4][4] = { { 7, 8, 0, 15 }, { 0, 15, 8, 7 }, { 7, 0, 15, 8 }, { 15, 7, 8, 0 } };
int dither[4][4] = { { 0, 15, 0, 15 }, { 15, 0, 15, 0 }, { 0, 15, 0, 15 }, { 15, 0, 15, 0 } };
int dither[4][4] = { { 15, 15, 0, 0 }, { 15, 15, 0, 0 }, { 0, 0, 15, 15 }, { 0, 0, 15, 15 } };
int dither[4][4] = { { 8, 8, 8, 8 }, { 8, 8, 8, 8 }, { 8, 8, 8, 8 }, { 8, 8, 8, 8 } };
int dither[4][4] = { { 0, 1, 2, 3 }, { 4, 5, 6, 7 }, { 8, 9, 10, 11 }, { 12, 13, 14, 15 } };
-#endif
+ #endif
/*
* Initialize some values - i_pic_line_width will store the line skip