video: Silence "restrict" issues with ORC code
authorEdward Hervey <edward@centricular.com>
Fri, 4 May 2018 08:35:36 +0000 (10:35 +0200)
committerEdward Hervey <bilboed@bilboed.com>
Sat, 5 May 2018 08:27:12 +0000 (10:27 +0200)
The problem is that even though the functions we are calling are
in-place transformation, orc automatically puts the restrict keyword
on all arguments. To silence that warning just create yet-another
variable containing the same value.

https://bugzilla.gnome.org/show_bug.cgi?id=795765

gst-libs/gst/video/video-chroma.c
gst-libs/gst/video/video-converter.c

index b994658..f761b44 100644 (file)
@@ -214,7 +214,9 @@ video_chroma_up_v2_##name (GstVideoChromaResample *resample,            \
       resample->h_resample (resample, l1, width);                       \
   }                                                                     \
   if (l0 != l1) {                                                       \
-    video_orc_chroma_up_v2_##name (l0, l1, l0, l1, width);              \
+    type *d0 = l0;                                                     \
+    type *d1 = l1;                                                     \
+    video_orc_chroma_up_v2_##name (d0, d1, l0, l1, width);              \
   }                                                                     \
 }
 /* 2x vertical upsampling interlaced without cositing
@@ -291,8 +293,9 @@ video_chroma_down_h2_##name (GstVideoChromaResample *resample,          \
     gpointer pixels, gint width)                                        \
 {                                                                       \
   type *p = pixels;                                                     \
+  type *d = p;                                                         \
                                                                         \
-  video_orc_chroma_down_h2_##name (p, p, width / 2);                    \
+  video_orc_chroma_down_h2_##name (d, p, width / 2);                    \
 }
 
 #define MAKE_DOWNSAMPLE_H2(name,type)                                   \
@@ -328,8 +331,10 @@ video_chroma_down_v2_##name (GstVideoChromaResample *resample,          \
   type *l0 = lines[0];                                                  \
   type *l1 = lines[1];                                                  \
                                                                         \
-  if (l0 != l1)                                                         \
-    video_orc_chroma_down_v2_##name (l0, l0, l1, width);                \
+  if (l0 != l1) {                                                      \
+    type *d0 = l0;                                                     \
+    video_orc_chroma_down_v2_##name (d0, l0, l1, width);                \
+  }                                                                    \
                                                                         \
   if (resample->h_resample)                                             \
     resample->h_resample (resample, l0, width);                         \
@@ -520,8 +525,9 @@ video_chroma_down_v4_##name (GstVideoChromaResample *resample,          \
   type *l1 = lines[1];                                                  \
   type *l2 = lines[2];                                                  \
   type *l3 = lines[3];                                                  \
-                                                                        \
-  video_orc_chroma_down_v4_##name(l0, l0, l1, l2, l3, width);           \
+  type *d = l0;                                                                \
+                                                                       \
+  video_orc_chroma_down_v4_##name(d, l0, l1, l2, l3, width);           \
                                                                         \
   if (resample->h_resample)                                             \
     resample->h_resample (resample, l0, width);                         \
index 31e866a..e2cb3d5 100644 (file)
@@ -1192,7 +1192,8 @@ _custom_video_orc_matrix8 (guint8 * ORC_RESTRICT d1,
 static void
 video_converter_matrix8 (MatrixData * data, gpointer pixels)
 {
-  video_orc_matrix8 (pixels, pixels, data->orc_p1, data->orc_p2,
+  gpointer d = pixels;
+  video_orc_matrix8 (d, pixels, data->orc_p1, data->orc_p2,
       data->orc_p3, data->orc_p4, data->width);
 }
 
@@ -1221,7 +1222,9 @@ video_converter_matrix8_table (MatrixData * data, gpointer pixels)
 static void
 video_converter_matrix8_AYUV_ARGB (MatrixData * data, gpointer pixels)
 {
-  video_orc_convert_AYUV_ARGB (pixels, 0, pixels, 0,
+  gpointer d = pixels;
+
+  video_orc_convert_AYUV_ARGB (d, 0, pixels, 0,
       data->im[0][0], data->im[0][2],
       data->im[2][1], data->im[1][1], data->im[1][2], data->width, 1);
 }