[vlc-commits] Fixed blending on YV12 pictures.
Laurent Aimar
git at videolan.org
Wed Apr 20 00:12:46 CEST 2011
vlc/vlc-1.1 | branch: master | Laurent Aimar <fenrir at videolan.org> | Wed Apr 20 00:00:43 2011 +0200| [8c182db2b0c81e7c5cc001c1d763017604dafc6b] | committer: Jean-Baptiste Kempf
Fixed blending on YV12 pictures.
(cherry picked from commit 5aab520dbd7e7642b5b50e942a74de8608118f6d)
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
> http://git.videolan.org/gitweb.cgi/vlc/vlc-1.1.git/?a=commit;h=8c182db2b0c81e7c5cc001c1d763017604dafc6b
---
modules/video_filter/blend.c | 56 +++++++++++++++++++++++++++---------------
1 files changed, 36 insertions(+), 20 deletions(-)
diff --git a/modules/video_filter/blend.c b/modules/video_filter/blend.c
index 06d5847..5c064e4 100644
--- a/modules/video_filter/blend.c
+++ b/modules/video_filter/blend.c
@@ -395,11 +395,13 @@ static void BlendYUVAI420( filter_t *p_filter,
int i_x, i_y, i_trans = 0;
bool b_even_scanline = i_y_offset % 2;
+ bool b_swap_up = vlc_fourcc_AreUVPlanesSwapped( p_filter->fmt_out.video.i_chroma,
+ VLC_CODEC_I420 );
p_dst_y = vlc_plane_start( &i_dst_pitch, p_dst, Y_PLANE,
i_x_offset, i_y_offset, &p_filter->fmt_out.video, 1 );
- p_dst_u = vlc_plane_start( NULL, p_dst, U_PLANE,
+ p_dst_u = vlc_plane_start( NULL, p_dst, b_swap_up ? V_PLANE : U_PLANE,
i_x_offset, i_y_offset, &p_filter->fmt_out.video, 2 );
- p_dst_v = vlc_plane_start( NULL, p_dst, V_PLANE,
+ p_dst_v = vlc_plane_start( NULL, p_dst, b_swap_up ? U_PLANE : V_PLANE,
i_x_offset, i_y_offset, &p_filter->fmt_out.video, 2 );
p_src_y = vlc_plane_start( &i_src_pitch, p_src, Y_PLANE,
@@ -714,20 +716,23 @@ static void BlendI420I420( filter_t *p_filter,
return;
}
-
+ bool b_swap_up = vlc_fourcc_AreUVPlanesSwapped( p_filter->fmt_out.video.i_chroma,
+ VLC_CODEC_I420 );
i_dst_pitch = p_dst->p[Y_PLANE].i_pitch;
p_dst_y = p_dst->p[Y_PLANE].p_pixels + i_x_offset +
p_filter->fmt_out.video.i_x_offset +
p_dst->p[Y_PLANE].i_pitch *
( i_y_offset + p_filter->fmt_out.video.i_y_offset );
- p_dst_u = p_dst->p[U_PLANE].p_pixels + i_x_offset/2 +
+ const int i_u_plane = b_swap_up ? V_PLANE : U_PLANE;
+ p_dst_u = p_dst->p[i_u_plane].p_pixels + i_x_offset/2 +
p_filter->fmt_out.video.i_x_offset/2 +
( i_y_offset + p_filter->fmt_out.video.i_y_offset ) / 2 *
- p_dst->p[U_PLANE].i_pitch;
- p_dst_v = p_dst->p[V_PLANE].p_pixels + i_x_offset/2 +
+ p_dst->p[i_u_plane].i_pitch;
+ const int i_v_plane = b_swap_up ? U_PLANE : V_PLANE;
+ p_dst_v = p_dst->p[i_v_plane].p_pixels + i_x_offset/2 +
p_filter->fmt_out.video.i_x_offset/2 +
( i_y_offset + p_filter->fmt_out.video.i_y_offset ) / 2 *
- p_dst->p[V_PLANE].i_pitch;
+ p_dst->p[i_v_plane].i_pitch;
p_src_y = vlc_plane_start( &i_src_pitch, p_src, Y_PLANE,
0, 0, &p_filter->fmt_in.video, 1 );
@@ -782,19 +787,23 @@ static void BlendI420I420_no_alpha( filter_t *p_filter,
int i_y;
bool b_even_scanline = i_y_offset % 2;
+ bool b_swap_up = vlc_fourcc_AreUVPlanesSwapped( p_filter->fmt_out.video.i_chroma,
+ VLC_CODEC_I420 );
i_dst_pitch = p_dst->p[Y_PLANE].i_pitch;
p_dst_y = p_dst->p[Y_PLANE].p_pixels + i_x_offset +
p_filter->fmt_out.video.i_x_offset +
p_dst->p[Y_PLANE].i_pitch *
( i_y_offset + p_filter->fmt_out.video.i_y_offset );
- p_dst_u = p_dst->p[U_PLANE].p_pixels + i_x_offset/2 +
+ const int i_u_plane = b_swap_up ? V_PLANE : U_PLANE;
+ p_dst_u = p_dst->p[i_u_plane].p_pixels + i_x_offset/2 +
p_filter->fmt_out.video.i_x_offset/2 +
( i_y_offset + p_filter->fmt_out.video.i_y_offset ) / 2 *
- p_dst->p[U_PLANE].i_pitch;
- p_dst_v = p_dst->p[V_PLANE].p_pixels + i_x_offset/2 +
+ p_dst->p[i_u_plane].i_pitch;
+ const int i_v_plane = b_swap_up ? U_PLANE : V_PLANE;
+ p_dst_v = p_dst->p[i_v_plane].p_pixels + i_x_offset/2 +
p_filter->fmt_out.video.i_x_offset/2 +
( i_y_offset + p_filter->fmt_out.video.i_y_offset ) / 2 *
- p_dst->p[V_PLANE].i_pitch;
+ p_dst->p[i_v_plane].i_pitch;
p_src_y = vlc_plane_start( &i_src_pitch, p_src, Y_PLANE,
0, 0, &p_filter->fmt_in.video, 1 );
@@ -1004,19 +1013,23 @@ static void BlendPalI420( filter_t *p_filter,
int i_x, i_y, i_trans;
bool b_even_scanline = i_y_offset % 2;
+ bool b_swap_up = vlc_fourcc_AreUVPlanesSwapped( p_filter->fmt_out.video.i_chroma,
+ VLC_CODEC_I420 );
i_dst_pitch = p_dst->p[Y_PLANE].i_pitch;
p_dst_y = p_dst->p[Y_PLANE].p_pixels + i_x_offset +
p_filter->fmt_out.video.i_x_offset +
p_dst->p[Y_PLANE].i_pitch *
( i_y_offset + p_filter->fmt_out.video.i_y_offset );
- p_dst_u = p_dst->p[U_PLANE].p_pixels + i_x_offset/2 +
+ const int i_u_plane = b_swap_up ? V_PLANE : U_PLANE;
+ p_dst_u = p_dst->p[i_u_plane].p_pixels + i_x_offset/2 +
p_filter->fmt_out.video.i_x_offset/2 +
( i_y_offset + p_filter->fmt_out.video.i_y_offset ) / 2 *
- p_dst->p[U_PLANE].i_pitch;
- p_dst_v = p_dst->p[V_PLANE].p_pixels + i_x_offset/2 +
+ p_dst->p[i_u_plane].i_pitch;
+ const int i_v_plane = b_swap_up ? U_PLANE : V_PLANE;
+ p_dst_v = p_dst->p[i_v_plane].p_pixels + i_x_offset/2 +
p_filter->fmt_out.video.i_x_offset/2 +
( i_y_offset + p_filter->fmt_out.video.i_y_offset ) / 2 *
- p_dst->p[V_PLANE].i_pitch;
+ p_dst->p[i_v_plane].i_pitch;
i_src_pitch = p_src_pic->p->i_pitch;
p_src = p_src_pic->p->p_pixels + p_filter->fmt_in.video.i_x_offset +
@@ -1207,20 +1220,23 @@ static void BlendRGBAI420( filter_t *p_filter,
uint8_t y, u, v;
bool b_even_scanline = i_y_offset % 2;
-
+ bool b_swap_up = vlc_fourcc_AreUVPlanesSwapped( p_filter->fmt_out.video.i_chroma,
+ VLC_CODEC_I420 );
i_dst_pitch = p_dst->p[Y_PLANE].i_pitch;
p_dst_y = p_dst->p[Y_PLANE].p_pixels + i_x_offset +
p_filter->fmt_out.video.i_x_offset +
p_dst->p[Y_PLANE].i_pitch *
( i_y_offset + p_filter->fmt_out.video.i_y_offset );
- p_dst_u = p_dst->p[U_PLANE].p_pixels + i_x_offset/2 +
+ const int i_u_plane = b_swap_up ? V_PLANE : U_PLANE;
+ p_dst_u = p_dst->p[i_u_plane].p_pixels + i_x_offset/2 +
p_filter->fmt_out.video.i_x_offset/2 +
( i_y_offset + p_filter->fmt_out.video.i_y_offset ) / 2 *
- p_dst->p[U_PLANE].i_pitch;
- p_dst_v = p_dst->p[V_PLANE].p_pixels + i_x_offset/2 +
+ p_dst->p[i_u_plane].i_pitch;
+ const int i_v_plane = b_swap_up ? U_PLANE : V_PLANE;
+ p_dst_v = p_dst->p[i_v_plane].p_pixels + i_x_offset/2 +
p_filter->fmt_out.video.i_x_offset/2 +
( i_y_offset + p_filter->fmt_out.video.i_y_offset ) / 2 *
- p_dst->p[V_PLANE].i_pitch;
+ p_dst->p[i_v_plane].i_pitch;
i_src_pix_pitch = p_src_pic->p->i_pixel_pitch;
i_src_pitch = p_src_pic->p->i_pitch;
More information about the vlc-commits
mailing list