alpha: use POFFSET instead of OFFSET
authorWim Taymans <wim.taymans@collabora.co.uk>
Thu, 19 Sep 2013 14:55:25 +0000 (16:55 +0200)
committerWim Taymans <wim.taymans@collabora.co.uk>
Mon, 23 Sep 2013 12:45:23 +0000 (14:45 +0200)
Use the more correct POFFSET macro to get the offset of a component in its
plane. The offset macro gives the offset of the component relative to the start
of the frame.

gst/alpha/gstalpha.c

index b6116f0..09ba0b0 100644 (file)
@@ -637,10 +637,10 @@ gst_alpha_set_argb_ayuv (const GstVideoFrame * in_frame,
   width = GST_VIDEO_FRAME_WIDTH (in_frame);
   height = GST_VIDEO_FRAME_HEIGHT (in_frame);
 
-  o[0] = GST_VIDEO_FRAME_COMP_OFFSET (in_frame, 3);
-  o[1] = GST_VIDEO_FRAME_COMP_OFFSET (in_frame, 0);
-  o[2] = GST_VIDEO_FRAME_COMP_OFFSET (in_frame, 1);
-  o[3] = GST_VIDEO_FRAME_COMP_OFFSET (in_frame, 2);
+  o[0] = GST_VIDEO_FRAME_COMP_POFFSET (in_frame, 3);
+  o[1] = GST_VIDEO_FRAME_COMP_POFFSET (in_frame, 0);
+  o[2] = GST_VIDEO_FRAME_COMP_POFFSET (in_frame, 1);
+  o[3] = GST_VIDEO_FRAME_COMP_POFFSET (in_frame, 2);
 
   memcpy (matrix,
       alpha->out_sdtv ? cog_rgb_to_ycbcr_matrix_8bit_sdtv :
@@ -692,10 +692,10 @@ gst_alpha_chroma_key_argb_ayuv (const GstVideoFrame * in_frame,
   width = GST_VIDEO_FRAME_WIDTH (in_frame);
   height = GST_VIDEO_FRAME_HEIGHT (in_frame);
 
-  o[0] = GST_VIDEO_FRAME_COMP_OFFSET (in_frame, 3);
-  o[1] = GST_VIDEO_FRAME_COMP_OFFSET (in_frame, 0);
-  o[2] = GST_VIDEO_FRAME_COMP_OFFSET (in_frame, 1);
-  o[3] = GST_VIDEO_FRAME_COMP_OFFSET (in_frame, 2);
+  o[0] = GST_VIDEO_FRAME_COMP_POFFSET (in_frame, 3);
+  o[1] = GST_VIDEO_FRAME_COMP_POFFSET (in_frame, 0);
+  o[2] = GST_VIDEO_FRAME_COMP_POFFSET (in_frame, 1);
+  o[3] = GST_VIDEO_FRAME_COMP_POFFSET (in_frame, 2);
 
   smin = 128 - alpha->black_sensitivity;
   smax = 128 + alpha->white_sensitivity;
@@ -750,15 +750,15 @@ gst_alpha_set_argb_argb (const GstVideoFrame * in_frame,
   width = GST_VIDEO_FRAME_WIDTH (in_frame);
   height = GST_VIDEO_FRAME_HEIGHT (in_frame);
 
-  p[0] = GST_VIDEO_FRAME_COMP_OFFSET (out_frame, 3);
-  p[1] = GST_VIDEO_FRAME_COMP_OFFSET (out_frame, 0);
-  p[2] = GST_VIDEO_FRAME_COMP_OFFSET (out_frame, 1);
-  p[3] = GST_VIDEO_FRAME_COMP_OFFSET (out_frame, 2);
+  p[0] = GST_VIDEO_FRAME_COMP_POFFSET (out_frame, 3);
+  p[1] = GST_VIDEO_FRAME_COMP_POFFSET (out_frame, 0);
+  p[2] = GST_VIDEO_FRAME_COMP_POFFSET (out_frame, 1);
+  p[3] = GST_VIDEO_FRAME_COMP_POFFSET (out_frame, 2);
 
-  o[0] = GST_VIDEO_FRAME_COMP_OFFSET (in_frame, 3);
-  o[1] = GST_VIDEO_FRAME_COMP_OFFSET (in_frame, 0);
-  o[2] = GST_VIDEO_FRAME_COMP_OFFSET (in_frame, 1);
-  o[3] = GST_VIDEO_FRAME_COMP_OFFSET (in_frame, 2);
+  o[0] = GST_VIDEO_FRAME_COMP_POFFSET (in_frame, 3);
+  o[1] = GST_VIDEO_FRAME_COMP_POFFSET (in_frame, 0);
+  o[2] = GST_VIDEO_FRAME_COMP_POFFSET (in_frame, 1);
+  o[3] = GST_VIDEO_FRAME_COMP_POFFSET (in_frame, 2);
 
   for (i = 0; i < height; i++) {
     for (j = 0; j < width; j++) {
@@ -802,15 +802,15 @@ gst_alpha_chroma_key_argb_argb (const GstVideoFrame * in_frame,
   width = GST_VIDEO_FRAME_WIDTH (in_frame);
   height = GST_VIDEO_FRAME_HEIGHT (in_frame);
 
-  p[0] = GST_VIDEO_FRAME_COMP_OFFSET (out_frame, 3);
-  p[1] = GST_VIDEO_FRAME_COMP_OFFSET (out_frame, 0);
-  p[2] = GST_VIDEO_FRAME_COMP_OFFSET (out_frame, 1);
-  p[3] = GST_VIDEO_FRAME_COMP_OFFSET (out_frame, 2);
+  p[0] = GST_VIDEO_FRAME_COMP_POFFSET (out_frame, 3);
+  p[1] = GST_VIDEO_FRAME_COMP_POFFSET (out_frame, 0);
+  p[2] = GST_VIDEO_FRAME_COMP_POFFSET (out_frame, 1);
+  p[3] = GST_VIDEO_FRAME_COMP_POFFSET (out_frame, 2);
 
-  o[0] = GST_VIDEO_FRAME_COMP_OFFSET (in_frame, 3);
-  o[1] = GST_VIDEO_FRAME_COMP_OFFSET (in_frame, 0);
-  o[2] = GST_VIDEO_FRAME_COMP_OFFSET (in_frame, 1);
-  o[3] = GST_VIDEO_FRAME_COMP_OFFSET (in_frame, 2);
+  o[0] = GST_VIDEO_FRAME_COMP_POFFSET (in_frame, 3);
+  o[1] = GST_VIDEO_FRAME_COMP_POFFSET (in_frame, 0);
+  o[2] = GST_VIDEO_FRAME_COMP_POFFSET (in_frame, 1);
+  o[3] = GST_VIDEO_FRAME_COMP_POFFSET (in_frame, 2);
 
   smin = 128 - alpha->black_sensitivity;
   smax = 128 + alpha->white_sensitivity;
@@ -870,10 +870,10 @@ gst_alpha_set_ayuv_argb (const GstVideoFrame * in_frame,
   width = GST_VIDEO_FRAME_WIDTH (in_frame);
   height = GST_VIDEO_FRAME_HEIGHT (in_frame);
 
-  p[0] = GST_VIDEO_FRAME_COMP_OFFSET (out_frame, 3);
-  p[1] = GST_VIDEO_FRAME_COMP_OFFSET (out_frame, 0);
-  p[2] = GST_VIDEO_FRAME_COMP_OFFSET (out_frame, 1);
-  p[3] = GST_VIDEO_FRAME_COMP_OFFSET (out_frame, 2);
+  p[0] = GST_VIDEO_FRAME_COMP_POFFSET (out_frame, 3);
+  p[1] = GST_VIDEO_FRAME_COMP_POFFSET (out_frame, 0);
+  p[2] = GST_VIDEO_FRAME_COMP_POFFSET (out_frame, 1);
+  p[3] = GST_VIDEO_FRAME_COMP_POFFSET (out_frame, 2);
 
   memcpy (matrix,
       alpha->in_sdtv ? cog_ycbcr_to_rgb_matrix_8bit_sdtv :
@@ -925,10 +925,10 @@ gst_alpha_chroma_key_ayuv_argb (const GstVideoFrame * in_frame,
   width = GST_VIDEO_FRAME_WIDTH (in_frame);
   height = GST_VIDEO_FRAME_HEIGHT (in_frame);
 
-  p[0] = GST_VIDEO_FRAME_COMP_OFFSET (out_frame, 3);
-  p[1] = GST_VIDEO_FRAME_COMP_OFFSET (out_frame, 0);
-  p[2] = GST_VIDEO_FRAME_COMP_OFFSET (out_frame, 1);
-  p[3] = GST_VIDEO_FRAME_COMP_OFFSET (out_frame, 2);
+  p[0] = GST_VIDEO_FRAME_COMP_POFFSET (out_frame, 3);
+  p[1] = GST_VIDEO_FRAME_COMP_POFFSET (out_frame, 0);
+  p[2] = GST_VIDEO_FRAME_COMP_POFFSET (out_frame, 1);
+  p[3] = GST_VIDEO_FRAME_COMP_POFFSET (out_frame, 2);
 
   smin = 128 - alpha->black_sensitivity;
   smax = 128 + alpha->white_sensitivity;
@@ -1121,9 +1121,9 @@ gst_alpha_set_rgb_ayuv (const GstVideoFrame * in_frame,
   height = GST_VIDEO_FRAME_HEIGHT (in_frame);
 
   bpp = GST_VIDEO_FRAME_COMP_PSTRIDE (in_frame, 0);
-  o[0] = GST_VIDEO_FRAME_COMP_OFFSET (in_frame, 0);
-  o[1] = GST_VIDEO_FRAME_COMP_OFFSET (in_frame, 1);
-  o[2] = GST_VIDEO_FRAME_COMP_OFFSET (in_frame, 2);
+  o[0] = GST_VIDEO_FRAME_COMP_POFFSET (in_frame, 0);
+  o[1] = GST_VIDEO_FRAME_COMP_POFFSET (in_frame, 1);
+  o[2] = GST_VIDEO_FRAME_COMP_POFFSET (in_frame, 2);
 
   memcpy (matrix,
       alpha->out_sdtv ? cog_rgb_to_ycbcr_matrix_8bit_sdtv :
@@ -1178,9 +1178,9 @@ gst_alpha_chroma_key_rgb_ayuv (const GstVideoFrame * in_frame,
 
   bpp = GST_VIDEO_FRAME_COMP_PSTRIDE (in_frame, 0);
 
-  o[0] = GST_VIDEO_FRAME_COMP_OFFSET (in_frame, 0);
-  o[1] = GST_VIDEO_FRAME_COMP_OFFSET (in_frame, 1);
-  o[2] = GST_VIDEO_FRAME_COMP_OFFSET (in_frame, 2);
+  o[0] = GST_VIDEO_FRAME_COMP_POFFSET (in_frame, 0);
+  o[1] = GST_VIDEO_FRAME_COMP_POFFSET (in_frame, 1);
+  o[2] = GST_VIDEO_FRAME_COMP_POFFSET (in_frame, 2);
 
   smin = 128 - alpha->black_sensitivity;
   smax = 128 + alpha->white_sensitivity;
@@ -1238,14 +1238,14 @@ gst_alpha_set_rgb_argb (const GstVideoFrame * in_frame,
 
   bpp = GST_VIDEO_FRAME_COMP_PSTRIDE (in_frame, 0);
 
-  o[0] = GST_VIDEO_FRAME_COMP_OFFSET (in_frame, 0);
-  o[1] = GST_VIDEO_FRAME_COMP_OFFSET (in_frame, 1);
-  o[2] = GST_VIDEO_FRAME_COMP_OFFSET (in_frame, 2);
+  o[0] = GST_VIDEO_FRAME_COMP_POFFSET (in_frame, 0);
+  o[1] = GST_VIDEO_FRAME_COMP_POFFSET (in_frame, 1);
+  o[2] = GST_VIDEO_FRAME_COMP_POFFSET (in_frame, 2);
 
-  p[0] = GST_VIDEO_FRAME_COMP_OFFSET (out_frame, 3);
-  p[1] = GST_VIDEO_FRAME_COMP_OFFSET (out_frame, 0);
-  p[2] = GST_VIDEO_FRAME_COMP_OFFSET (out_frame, 1);
-  p[3] = GST_VIDEO_FRAME_COMP_OFFSET (out_frame, 2);
+  p[0] = GST_VIDEO_FRAME_COMP_POFFSET (out_frame, 3);
+  p[1] = GST_VIDEO_FRAME_COMP_POFFSET (out_frame, 0);
+  p[2] = GST_VIDEO_FRAME_COMP_POFFSET (out_frame, 1);
+  p[3] = GST_VIDEO_FRAME_COMP_POFFSET (out_frame, 2);
 
   for (i = 0; i < height; i++) {
     for (j = 0; j < width; j++) {
@@ -1292,14 +1292,14 @@ gst_alpha_chroma_key_rgb_argb (const GstVideoFrame * in_frame,
 
   bpp = GST_VIDEO_FRAME_COMP_PSTRIDE (in_frame, 0);
 
-  o[0] = GST_VIDEO_FRAME_COMP_OFFSET (in_frame, 0);
-  o[1] = GST_VIDEO_FRAME_COMP_OFFSET (in_frame, 1);
-  o[2] = GST_VIDEO_FRAME_COMP_OFFSET (in_frame, 2);
+  o[0] = GST_VIDEO_FRAME_COMP_POFFSET (in_frame, 0);
+  o[1] = GST_VIDEO_FRAME_COMP_POFFSET (in_frame, 1);
+  o[2] = GST_VIDEO_FRAME_COMP_POFFSET (in_frame, 2);
 
-  p[0] = GST_VIDEO_FRAME_COMP_OFFSET (out_frame, 3);
-  p[1] = GST_VIDEO_FRAME_COMP_OFFSET (out_frame, 0);
-  p[2] = GST_VIDEO_FRAME_COMP_OFFSET (out_frame, 1);
-  p[3] = GST_VIDEO_FRAME_COMP_OFFSET (out_frame, 2);
+  p[0] = GST_VIDEO_FRAME_COMP_POFFSET (out_frame, 3);
+  p[1] = GST_VIDEO_FRAME_COMP_POFFSET (out_frame, 0);
+  p[2] = GST_VIDEO_FRAME_COMP_POFFSET (out_frame, 1);
+  p[3] = GST_VIDEO_FRAME_COMP_POFFSET (out_frame, 2);
 
   smin = 128 - alpha->black_sensitivity;
   smax = 128 + alpha->white_sensitivity;
@@ -1612,10 +1612,10 @@ gst_alpha_set_planar_yuv_argb (const GstVideoFrame * in_frame,
   width = GST_VIDEO_FRAME_WIDTH (in_frame);
   height = GST_VIDEO_FRAME_HEIGHT (in_frame);
 
-  p[0] = GST_VIDEO_FRAME_COMP_OFFSET (out_frame, 3);
-  p[1] = GST_VIDEO_FRAME_COMP_OFFSET (out_frame, 0);
-  p[2] = GST_VIDEO_FRAME_COMP_OFFSET (out_frame, 1);
-  p[3] = GST_VIDEO_FRAME_COMP_OFFSET (out_frame, 2);
+  p[0] = GST_VIDEO_FRAME_COMP_POFFSET (out_frame, 3);
+  p[1] = GST_VIDEO_FRAME_COMP_POFFSET (out_frame, 0);
+  p[2] = GST_VIDEO_FRAME_COMP_POFFSET (out_frame, 1);
+  p[3] = GST_VIDEO_FRAME_COMP_POFFSET (out_frame, 2);
 
   y_stride = GST_VIDEO_FRAME_COMP_STRIDE (in_frame, 0);
   uv_stride = GST_VIDEO_FRAME_COMP_STRIDE (in_frame, 1);
@@ -1715,10 +1715,10 @@ gst_alpha_chroma_key_planar_yuv_argb (const GstVideoFrame * in_frame,
   width = GST_VIDEO_FRAME_WIDTH (in_frame);
   height = GST_VIDEO_FRAME_HEIGHT (in_frame);
 
-  p[0] = GST_VIDEO_FRAME_COMP_OFFSET (out_frame, 3);
-  p[1] = GST_VIDEO_FRAME_COMP_OFFSET (out_frame, 0);
-  p[2] = GST_VIDEO_FRAME_COMP_OFFSET (out_frame, 1);
-  p[3] = GST_VIDEO_FRAME_COMP_OFFSET (out_frame, 2);
+  p[0] = GST_VIDEO_FRAME_COMP_POFFSET (out_frame, 3);
+  p[1] = GST_VIDEO_FRAME_COMP_POFFSET (out_frame, 0);
+  p[2] = GST_VIDEO_FRAME_COMP_POFFSET (out_frame, 1);
+  p[3] = GST_VIDEO_FRAME_COMP_POFFSET (out_frame, 2);
 
   y_stride = GST_VIDEO_FRAME_COMP_STRIDE (in_frame, 0);
   uv_stride = GST_VIDEO_FRAME_COMP_STRIDE (in_frame, 1);
@@ -1815,10 +1815,10 @@ gst_alpha_set_packed_422_ayuv (const GstVideoFrame * in_frame,
 
   src_stride = GST_VIDEO_FRAME_COMP_STRIDE (in_frame, 0);
 
-  p[0] = GST_VIDEO_FRAME_COMP_OFFSET (in_frame, 0);
+  p[0] = GST_VIDEO_FRAME_COMP_POFFSET (in_frame, 0);
   p[2] = p[0] + 2;
-  p[1] = GST_VIDEO_FRAME_COMP_OFFSET (in_frame, 1);
-  p[3] = GST_VIDEO_FRAME_COMP_OFFSET (in_frame, 2);
+  p[1] = GST_VIDEO_FRAME_COMP_POFFSET (in_frame, 1);
+  p[3] = GST_VIDEO_FRAME_COMP_POFFSET (in_frame, 2);
 
   if (alpha->in_sdtv != alpha->out_sdtv) {
     gint matrix[12];
@@ -1945,10 +1945,10 @@ gst_alpha_chroma_key_packed_422_ayuv (const GstVideoFrame * in_frame,
 
   src_stride = GST_VIDEO_FRAME_COMP_STRIDE (in_frame, 0);
 
-  p[0] = GST_VIDEO_FRAME_COMP_OFFSET (in_frame, 0);
+  p[0] = GST_VIDEO_FRAME_COMP_POFFSET (in_frame, 0);
   p[2] = p[0] + 2;
-  p[1] = GST_VIDEO_FRAME_COMP_OFFSET (in_frame, 1);
-  p[3] = GST_VIDEO_FRAME_COMP_OFFSET (in_frame, 2);
+  p[1] = GST_VIDEO_FRAME_COMP_POFFSET (in_frame, 1);
+  p[3] = GST_VIDEO_FRAME_COMP_POFFSET (in_frame, 2);
 
   smin = 128 - alpha->black_sensitivity;
   smax = 128 + alpha->white_sensitivity;
@@ -2093,15 +2093,15 @@ gst_alpha_set_packed_422_argb (const GstVideoFrame * in_frame,
 
   src_stride = GST_VIDEO_FRAME_COMP_STRIDE (in_frame, 0);
 
-  o[0] = GST_VIDEO_FRAME_COMP_OFFSET (in_frame, 0);
+  o[0] = GST_VIDEO_FRAME_COMP_POFFSET (in_frame, 0);
   o[2] = o[0] + 2;
-  o[1] = GST_VIDEO_FRAME_COMP_OFFSET (in_frame, 1);
-  o[3] = GST_VIDEO_FRAME_COMP_OFFSET (in_frame, 2);
+  o[1] = GST_VIDEO_FRAME_COMP_POFFSET (in_frame, 1);
+  o[3] = GST_VIDEO_FRAME_COMP_POFFSET (in_frame, 2);
 
-  p[0] = GST_VIDEO_FRAME_COMP_OFFSET (out_frame, 3);
-  p[1] = GST_VIDEO_FRAME_COMP_OFFSET (out_frame, 0);
-  p[2] = GST_VIDEO_FRAME_COMP_OFFSET (out_frame, 1);
-  p[3] = GST_VIDEO_FRAME_COMP_OFFSET (out_frame, 2);
+  p[0] = GST_VIDEO_FRAME_COMP_POFFSET (out_frame, 3);
+  p[1] = GST_VIDEO_FRAME_COMP_POFFSET (out_frame, 0);
+  p[2] = GST_VIDEO_FRAME_COMP_POFFSET (out_frame, 1);
+  p[3] = GST_VIDEO_FRAME_COMP_POFFSET (out_frame, 2);
 
   memcpy (matrix,
       alpha->in_sdtv ? cog_ycbcr_to_rgb_matrix_8bit_sdtv :
@@ -2182,15 +2182,15 @@ gst_alpha_chroma_key_packed_422_argb (const GstVideoFrame * in_frame,
 
   src_stride = GST_VIDEO_FRAME_COMP_STRIDE (in_frame, 0);
 
-  o[0] = GST_VIDEO_FRAME_COMP_OFFSET (in_frame, 0);
+  o[0] = GST_VIDEO_FRAME_COMP_POFFSET (in_frame, 0);
   o[2] = o[0] + 2;
-  o[1] = GST_VIDEO_FRAME_COMP_OFFSET (in_frame, 1);
-  o[3] = GST_VIDEO_FRAME_COMP_OFFSET (in_frame, 2);
+  o[1] = GST_VIDEO_FRAME_COMP_POFFSET (in_frame, 1);
+  o[3] = GST_VIDEO_FRAME_COMP_POFFSET (in_frame, 2);
 
-  p[0] = GST_VIDEO_FRAME_COMP_OFFSET (out_frame, 3);
-  p[1] = GST_VIDEO_FRAME_COMP_OFFSET (out_frame, 0);
-  p[2] = GST_VIDEO_FRAME_COMP_OFFSET (out_frame, 1);
-  p[3] = GST_VIDEO_FRAME_COMP_OFFSET (out_frame, 2);
+  p[0] = GST_VIDEO_FRAME_COMP_POFFSET (out_frame, 3);
+  p[1] = GST_VIDEO_FRAME_COMP_POFFSET (out_frame, 0);
+  p[2] = GST_VIDEO_FRAME_COMP_POFFSET (out_frame, 1);
+  p[3] = GST_VIDEO_FRAME_COMP_POFFSET (out_frame, 2);
 
   memcpy (matrix,
       alpha->in_sdtv ? cog_ycbcr_to_rgb_matrix_8bit_sdtv :