videomixer: Simplify NV12/21 blending code macros

This commit is contained in:
Sebastian Dröge 2013-11-29 19:57:46 +01:00
parent b0529e0fe8
commit 220a947dc7

View file

@ -443,7 +443,7 @@ PLANAR_YUV_FILL_CHECKER (y41b, GST_VIDEO_FORMAT_Y41B, memset);
PLANAR_YUV_FILL_COLOR (y41b, GST_VIDEO_FORMAT_Y41B, memset); PLANAR_YUV_FILL_COLOR (y41b, GST_VIDEO_FORMAT_Y41B, memset);
/* NV12, NV21 */ /* NV12, NV21 */
#define NV_YUV_BLEND(format_name,first_component,MEMCPY,BLENDLOOP) \ #define NV_YUV_BLEND(format_name,MEMCPY,BLENDLOOP) \
inline static void \ inline static void \
_blend_##format_name (const guint8 * src, guint8 * dest, \ _blend_##format_name (const guint8 * src, guint8 * dest, \
gint src_stride, gint dest_stride, gint src_width, gint src_height, \ gint src_stride, gint dest_stride, gint src_width, gint src_height, \
@ -550,8 +550,8 @@ blend_##format_name (GstVideoFrame * srcframe, gint xpos, gint ypos, \
dest_comp_rowstride, src_comp_width, src_comp_height, \ dest_comp_rowstride, src_comp_width, src_comp_height, \
src_alpha); \ src_alpha); \
\ \
b_src = GST_VIDEO_FRAME_COMP_DATA (srcframe, first_component); \ b_src = GST_VIDEO_FRAME_PLANE_DATA (srcframe, 1); \
b_dest = GST_VIDEO_FRAME_COMP_DATA (destframe, first_component); \ b_dest = GST_VIDEO_FRAME_PLANE_DATA (destframe, 1); \
src_comp_rowstride = GST_VIDEO_FRAME_COMP_STRIDE (srcframe, 1); \ src_comp_rowstride = GST_VIDEO_FRAME_COMP_STRIDE (srcframe, 1); \
dest_comp_rowstride = GST_VIDEO_FRAME_COMP_STRIDE (destframe, 1); \ dest_comp_rowstride = GST_VIDEO_FRAME_COMP_STRIDE (destframe, 1); \
src_comp_width = GST_VIDEO_FORMAT_INFO_SCALE_WIDTH(info, 1, b_src_width); \ src_comp_width = GST_VIDEO_FORMAT_INFO_SCALE_WIDTH(info, 1, b_src_width); \
@ -567,7 +567,7 @@ blend_##format_name (GstVideoFrame * srcframe, gint xpos, gint ypos, \
src_alpha); \ src_alpha); \
} }
#define NV_YUV_FILL_CHECKER(format_name, first_component, MEMSET) \ #define NV_YUV_FILL_CHECKER(format_name, MEMSET) \
static void \ static void \
fill_checker_##format_name (GstVideoFrame * frame) \ fill_checker_##format_name (GstVideoFrame * frame) \
{ \ { \
@ -589,7 +589,7 @@ fill_checker_##format_name (GstVideoFrame * frame) \
p += rowstride - comp_width; \ p += rowstride - comp_width; \
} \ } \
\ \
p = GST_VIDEO_FRAME_COMP_DATA (frame, first_component); \ p = GST_VIDEO_FRAME_PLANE_DATA (frame, 1); \
comp_width = GST_VIDEO_FRAME_COMP_WIDTH (frame, 1); \ comp_width = GST_VIDEO_FRAME_COMP_WIDTH (frame, 1); \
comp_height = GST_VIDEO_FRAME_COMP_HEIGHT (frame, 1); \ comp_height = GST_VIDEO_FRAME_COMP_HEIGHT (frame, 1); \
rowstride = GST_VIDEO_FRAME_COMP_STRIDE (frame, 1); \ rowstride = GST_VIDEO_FRAME_COMP_STRIDE (frame, 1); \
@ -636,11 +636,11 @@ fill_color_##format_name (GstVideoFrame * frame, \
} \ } \
} }
NV_YUV_BLEND (nv12, 1, memcpy, video_mixer_orc_blend_u8); NV_YUV_BLEND (nv12, memcpy, video_mixer_orc_blend_u8);
NV_YUV_FILL_CHECKER (nv12, 1, memset); NV_YUV_FILL_CHECKER (nv12, memset);
NV_YUV_FILL_COLOR (nv12, memset); NV_YUV_FILL_COLOR (nv12, memset);
NV_YUV_BLEND (nv21, 2, memcpy, video_mixer_orc_blend_u8); NV_YUV_BLEND (nv21, memcpy, video_mixer_orc_blend_u8);
NV_YUV_FILL_CHECKER (nv21, 2, memset); NV_YUV_FILL_CHECKER (nv21, memset);
/* RGB, BGR, xRGB, xBGR, RGBx, BGRx */ /* RGB, BGR, xRGB, xBGR, RGBx, BGRx */