videomixer: Add orc implementation for blending
authorDavid Schleef <ds@schleef.org>
Sun, 22 Aug 2010 08:58:05 +0000 (01:58 -0700)
committerSebastian Dröge <sebastian.droege@collabora.co.uk>
Sat, 4 Sep 2010 12:52:08 +0000 (14:52 +0200)
videomixer: Add orc implementation for blending

gst/videomixer/blend.c
gst/videomixer/blendorc.orc

index c868b43..13c7754 100644 (file)
@@ -701,6 +701,18 @@ BLEND_A32 (argb_mmx, _blend_loop_argb_mmx);
 BLEND_A32 (bgra_mmx, _blend_loop_bgra_mmx);
 #endif
 
+static void
+_blend_loop_argb_orc (guint8 * dest, const guint8 * src, gint src_height,
+    gint src_width, gint src_stride, gint dest_stride, guint s_alpha)
+{
+  s_alpha = MIN (255, s_alpha);
+  gst_videomixer_orc_blend_ayuv (dest, dest_stride, src, src_stride,
+      s_alpha, src_width, src_height);
+}
+
+BLEND_A32 (argb_orc, _blend_loop_argb_orc);
+
+
 /* Init function */
 BlendFunction gst_video_mixer_blend_argb;
 BlendFunction gst_video_mixer_blend_bgra;
@@ -815,4 +827,6 @@ gst_video_mixer_init_blend (void)
     gst_video_mixer_blend_bgra = blend_bgra_mmx;
   }
 #endif
+
+  gst_video_mixer_blend_argb = blend_argb_orc;
 }
index 55e20bb..1114aae 100644 (file)
@@ -28,3 +28,38 @@ addw t2, t1, t2
 shruw t2, t2, c1
 convsuswb d1, t2
 
+
+.function gst_videomixer_orc_blend_ayuv
+.flags 2d
+.dest 4 d guint8
+.source 4 s guint8
+.param 2 alpha
+.temp 4 t
+.temp 2 tw
+.temp 1 tb
+.temp 4 a
+.temp 8 d_wide
+.temp 8 s_wide
+.temp 8 a_wide
+.const 4 c_alpha 0xffffff00
+
+
+loadl t, s
+convlw tw, t
+convwb tb, tw
+splatbl a, tb
+x4 convubw a_wide, a
+x4 mullw a_wide, a_wide, alpha
+x4 shruw a_wide, a_wide, 8
+andl t, t, c_alpha
+x4 convubw s_wide, t
+andl t, d, c_alpha
+x4 convubw d_wide, t
+x4 subw s_wide, s_wide, d_wide
+x4 mullw s_wide, s_wide, a_wide
+x4 div255w s_wide, s_wide
+x4 addw d_wide, d_wide, s_wide
+x4 convwb d, d_wide
+
+
+