Commit f185b15e authored by Antoine Cellerier's avatar Antoine Cellerier

Wave and ripple should now behave correctly for chromas where pixels can take...

Wave and ripple should now behave correctly for chromas where pixels can take more than 1 byte in a row (like RV32).
parent 6673b8c6
...@@ -133,13 +133,16 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic ) ...@@ -133,13 +133,16 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
for( i_index = 0 ; i_index < p_pic->i_planes ; i_index++ ) for( i_index = 0 ; i_index < p_pic->i_planes ; i_index++ )
{ {
int i_line, i_first_line, i_num_lines, i_offset; int i_line, i_first_line, i_num_lines, i_offset, i_pixel_pitch,
i_visible_pixels;
uint8_t black_pixel; uint8_t black_pixel;
uint8_t *p_in, *p_out; uint8_t *p_in, *p_out;
black_pixel = ( i_index == Y_PLANE ) ? 0x00 : 0x80; black_pixel = ( i_index == Y_PLANE ) ? 0x00 : 0x80;
i_num_lines = p_pic->p[i_index].i_visible_lines; i_num_lines = p_pic->p[i_index].i_visible_lines;
i_pixel_pitch = p_pic->p[i_index].i_pixel_pitch;
i_visible_pixels = p_pic->p[i_index].i_visible_pitch/p_pic->p[i_index].i_pixel_pitch;
i_first_line = i_num_lines * 4 / 5; i_first_line = i_num_lines * 4 / 5;
...@@ -158,13 +161,13 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic ) ...@@ -158,13 +161,13 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
for( i_line = i_first_line ; i_line < i_num_lines ; i_line++ ) for( i_line = i_first_line ; i_line < i_num_lines ; i_line++ )
{ {
/* Calculate today's offset, don't go above 1/20th of the screen */ /* Calculate today's offset, don't go above 1/20th of the screen */
i_offset = (int)( (double)(p_pic->p[i_index].i_pitch) i_offset = (int)( (double)(i_visible_pixels)
* sin( f_angle + 2.0 * (double)i_line * sin( f_angle + 2.0 * (double)i_line
/ (double)( 1 + i_line / (double)( 1 + i_line
- i_first_line) ) - i_first_line) )
* (double)(i_line - i_first_line) * (double)(i_line - i_first_line)
/ (double)i_num_lines / (double)i_num_lines
/ 8.0 ); / 8.0 )*p_pic->p[i_index].i_pixel_pitch;
if( i_offset ) if( i_offset )
{ {
......
...@@ -134,7 +134,8 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic ) ...@@ -134,7 +134,8 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
for( i_index = 0 ; i_index < p_pic->i_planes ; i_index++ ) for( i_index = 0 ; i_index < p_pic->i_planes ; i_index++ )
{ {
int i_line, i_num_lines, i_offset; int i_line, i_num_lines, i_visible_pitch, i_pixel_pitch, i_offset,
i_visible_pixels;
uint8_t black_pixel; uint8_t black_pixel;
uint8_t *p_in, *p_out; uint8_t *p_in, *p_out;
...@@ -142,6 +143,9 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic ) ...@@ -142,6 +143,9 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
p_out = p_outpic->p[i_index].p_pixels; p_out = p_outpic->p[i_index].p_pixels;
i_num_lines = p_pic->p[i_index].i_visible_lines; i_num_lines = p_pic->p[i_index].i_visible_lines;
i_visible_pitch = p_pic->p[i_index].i_visible_pitch;
i_pixel_pitch = p_pic->p[i_index].i_pixel_pitch;
i_visible_pixels = i_visible_pitch/i_pixel_pitch;
black_pixel = ( i_index == Y_PLANE ) ? 0x00 : 0x80; black_pixel = ( i_index == Y_PLANE ) ? 0x00 : 0x80;
...@@ -149,17 +153,17 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic ) ...@@ -149,17 +153,17 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
for( i_line = 0 ; i_line < i_num_lines ; i_line++ ) for( i_line = 0 ; i_line < i_num_lines ; i_line++ )
{ {
/* Calculate today's offset, don't go above 1/20th of the screen */ /* Calculate today's offset, don't go above 1/20th of the screen */
i_offset = (int)( (double)(p_pic->p[i_index].i_visible_pitch) i_offset = (int)( (double)(i_visible_pixels)
* sin( f_angle + 10.0 * (double)i_line * sin( f_angle + 10.0 * (double)i_line
/ (double)i_num_lines ) / (double)i_num_lines )
/ 20.0 ); / 20.0 )*i_pixel_pitch;
if( i_offset ) if( i_offset )
{ {
if( i_offset < 0 ) if( i_offset < 0 )
{ {
p_filter->p_libvlc->pf_memcpy( p_out, p_in - i_offset, p_filter->p_libvlc->pf_memcpy( p_out, p_in - i_offset,
p_pic->p[i_index].i_visible_pitch + i_offset ); i_visible_pitch + i_offset );
p_in += p_pic->p[i_index].i_pitch; p_in += p_pic->p[i_index].i_pitch;
p_out += p_outpic->p[i_index].i_pitch; p_out += p_outpic->p[i_index].i_pitch;
p_filter->p_libvlc->pf_memset( p_out + i_offset, p_filter->p_libvlc->pf_memset( p_out + i_offset,
...@@ -168,7 +172,7 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic ) ...@@ -168,7 +172,7 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
else else
{ {
p_filter->p_libvlc->pf_memcpy( p_out + i_offset, p_in, p_filter->p_libvlc->pf_memcpy( p_out + i_offset, p_in,
p_pic->p[i_index].i_visible_pitch - i_offset ); i_visible_pitch - i_offset );
p_filter->p_libvlc->pf_memset( p_out, black_pixel, p_filter->p_libvlc->pf_memset( p_out, black_pixel,
i_offset ); i_offset );
p_in += p_pic->p[i_index].i_pitch; p_in += p_pic->p[i_index].i_pitch;
...@@ -178,7 +182,7 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic ) ...@@ -178,7 +182,7 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
else else
{ {
p_filter->p_libvlc->pf_memcpy( p_out, p_in, p_filter->p_libvlc->pf_memcpy( p_out, p_in,
p_pic->p[i_index].i_visible_pitch ); i_visible_pitch );
p_in += p_pic->p[i_index].i_pitch; p_in += p_pic->p[i_index].i_pitch;
p_out += p_outpic->p[i_index].i_pitch; p_out += p_outpic->p[i_index].i_pitch;
} }
......
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