util: Share a single function pointer for the 4-byte rgba unpack function.
[mesa.git] / src / util / format / u_format_yuv.c
index ae088f4397871b7072341938fb343e90f777a33f..21d082548c65a3ff7edec55c1a67beabd1d6ef3d 100644 (file)
@@ -39,7 +39,7 @@
 
 
 void
-util_format_r8g8_b8g8_unorm_unpack_rgba_float(float *dst_row, unsigned dst_stride,
+util_format_r8g8_b8g8_unorm_unpack_rgba_float(void *dst_row, unsigned dst_stride,
                                          const uint8_t *src_row, unsigned src_stride,
                                          unsigned width, unsigned height)
 {
@@ -86,8 +86,8 @@ util_format_r8g8_b8g8_unorm_unpack_rgba_float(float *dst_row, unsigned dst_strid
          dst[3] = 1.0f; /* a */
       }
 
-      src_row += src_stride/sizeof(*src_row);
-      dst_row += dst_stride/sizeof(*dst_row);
+      src_row = (uint8_t *)src_row + src_stride;
+      dst_row = (uint8_t *)dst_row + dst_stride;
    }
 }
 
@@ -259,7 +259,7 @@ util_format_r8g8_b8g8_unorm_fetch_rgba_float(float *dst, const uint8_t *src,
 
 
 void
-util_format_g8r8_g8b8_unorm_unpack_rgba_float(float *dst_row, unsigned dst_stride,
+util_format_g8r8_g8b8_unorm_unpack_rgba_float(void *dst_row, unsigned dst_stride,
                                          const uint8_t *src_row, unsigned src_stride,
                                          unsigned width, unsigned height)
 {
@@ -306,8 +306,8 @@ util_format_g8r8_g8b8_unorm_unpack_rgba_float(float *dst_row, unsigned dst_strid
          dst[3] = 1.0f; /* a */
       }
 
-      src_row += src_stride/sizeof(*src_row);
-      dst_row += dst_stride/sizeof(*dst_row);
+      src_row = (uint8_t *)src_row + src_stride;
+      dst_row = (uint8_t *)dst_row + dst_stride;
    }
 }
 
@@ -479,7 +479,7 @@ util_format_g8r8_g8b8_unorm_fetch_rgba_float(float *dst, const uint8_t *src,
 
 
 void
-util_format_uyvy_unpack_rgba_float(float *dst_row, unsigned dst_stride,
+util_format_uyvy_unpack_rgba_float(void *dst_row, unsigned dst_stride,
                               const uint8_t *src_row, unsigned src_stride,
                               unsigned width, unsigned height)
 {
@@ -520,8 +520,8 @@ util_format_uyvy_unpack_rgba_float(float *dst_row, unsigned dst_stride,
          dst[3] = 1.0f; /* a */
       }
 
-      src_row += src_stride/sizeof(*src_row);
-      dst_row += dst_stride/sizeof(*dst_row);
+      src_row = (uint8_t *)src_row + src_stride;
+      dst_row = (uint8_t *)dst_row + dst_stride;
    }
 }
 
@@ -700,7 +700,7 @@ util_format_uyvy_fetch_rgba_float(float *dst, const uint8_t *src,
 
 
 void
-util_format_yuyv_unpack_rgba_float(float *dst_row, unsigned dst_stride,
+util_format_yuyv_unpack_rgba_float(void *dst_row, unsigned dst_stride,
                               const uint8_t *src_row, unsigned src_stride,
                               unsigned width, unsigned height)
 {
@@ -741,8 +741,8 @@ util_format_yuyv_unpack_rgba_float(float *dst_row, unsigned dst_stride,
          dst[3] = 1.0f; /* a */
       }
 
-      src_row += src_stride/sizeof(*src_row);
-      dst_row += dst_stride/sizeof(*dst_row);
+      src_row = (uint8_t *)src_row + src_stride;
+      dst_row = (uint8_t *)dst_row + dst_stride;
    }
 }
 
@@ -918,232 +918,3 @@ util_format_yuyv_fetch_rgba_float(float *dst, const uint8_t *src,
 
    dst[3] = 1.0f;
 }
-
-/* XXX: Stubbed for now */
-void
-util_format_yv12_unpack_rgba_8unorm(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
-                             UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
-                             UNUSED unsigned width, UNUSED unsigned height) {}
-void
-util_format_yv12_pack_rgba_8unorm(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
-                             UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
-                             UNUSED unsigned width, UNUSED unsigned height) {}
-void
-util_format_yv12_unpack_rgba_float(UNUSED float *dst_row, UNUSED unsigned dst_stride,
-                             UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
-                             UNUSED unsigned width, UNUSED unsigned height) {}
-void
-util_format_yv12_pack_rgba_float(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
-                             UNUSED const float *src_row, UNUSED unsigned src_stride,
-                             UNUSED unsigned width, UNUSED unsigned height) {}
-void
-util_format_yv12_fetch_rgba_float(UNUSED float *dst, UNUSED const uint8_t *src,
-                             UNUSED unsigned i, UNUSED unsigned j) {}
-void
-util_format_yv16_unpack_rgba_8unorm(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
-                             UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
-                             UNUSED unsigned width, UNUSED unsigned height) {}
-void
-util_format_yv16_pack_rgba_8unorm(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
-                             UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
-                             UNUSED unsigned width, UNUSED unsigned height) {}
-void
-util_format_yv16_unpack_rgba_float(UNUSED float *dst_row, UNUSED unsigned dst_stride,
-                             UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
-                             UNUSED unsigned width, UNUSED unsigned height) {}
-void
-util_format_yv16_pack_rgba_float(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
-                             UNUSED const float *src_row, UNUSED unsigned src_stride,
-                             UNUSED unsigned width, UNUSED unsigned height) {}
-void
-util_format_yv16_fetch_rgba_float(UNUSED float *dst, UNUSED const uint8_t *src,
-                             UNUSED unsigned i, UNUSED unsigned j) {}
-void
-util_format_iyuv_unpack_rgba_8unorm(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
-                             UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
-                             UNUSED unsigned width, UNUSED unsigned height) {}
-void
-util_format_iyuv_pack_rgba_8unorm(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
-                             UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
-                             UNUSED unsigned width, UNUSED unsigned height) {}
-void
-util_format_iyuv_unpack_rgba_float(UNUSED float *dst_row, UNUSED unsigned dst_stride,
-                             UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
-                             UNUSED unsigned width, UNUSED unsigned height) {}
-void
-util_format_iyuv_pack_rgba_float(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
-                             UNUSED const float *src_row, UNUSED unsigned src_stride,
-                             UNUSED unsigned width, UNUSED unsigned height) {}
-void
-util_format_iyuv_fetch_rgba_float(UNUSED float *dst, UNUSED const uint8_t *src,
-                             UNUSED unsigned i, UNUSED unsigned j) {}
-void
-util_format_nv12_unpack_rgba_8unorm(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
-                             UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
-                             UNUSED unsigned width, UNUSED unsigned height) {}
-void
-util_format_nv12_pack_rgba_8unorm(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
-                             UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
-                             UNUSED unsigned width, UNUSED unsigned height) {}
-void
-util_format_nv12_unpack_rgba_float(UNUSED float *dst_row, UNUSED unsigned dst_stride,
-                             UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
-                             UNUSED unsigned width, UNUSED unsigned height) {}
-void
-util_format_nv12_pack_rgba_float(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
-                             UNUSED const float *src_row, UNUSED unsigned src_stride,
-                             UNUSED unsigned width, UNUSED unsigned height) {}
-void
-util_format_nv12_fetch_rgba_float(UNUSED float *dst, UNUSED const uint8_t *src,
-                             UNUSED unsigned i, UNUSED unsigned j) {}
-void
-util_format_nv21_unpack_rgba_8unorm(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
-                             UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
-                             UNUSED unsigned width, UNUSED unsigned height) {}
-void
-util_format_nv21_pack_rgba_8unorm(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
-                             UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
-                             UNUSED unsigned width, UNUSED unsigned height) {}
-void
-util_format_nv21_unpack_rgba_float(UNUSED float *dst_row, UNUSED unsigned dst_stride,
-                             UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
-                             UNUSED unsigned width, UNUSED unsigned height) {}
-void
-util_format_nv21_pack_rgba_float(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
-                             UNUSED const float *src_row, UNUSED unsigned src_stride,
-                             UNUSED unsigned width, UNUSED unsigned height) {}
-void
-util_format_nv21_fetch_rgba_float(UNUSED float *dst, UNUSED const uint8_t *src,
-                             UNUSED unsigned i, UNUSED unsigned j) {}
-void
-util_format_p010_unpack_rgba_8unorm(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
-                             UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
-                             UNUSED unsigned width, UNUSED unsigned height) {}
-void
-util_format_p010_pack_rgba_8unorm(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
-                             UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
-                             UNUSED unsigned width, UNUSED unsigned height) {}
-void
-util_format_p010_unpack_rgba_float(UNUSED float *dst_row, UNUSED unsigned dst_stride,
-                             UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
-                             UNUSED unsigned width, UNUSED unsigned height) {}
-void
-util_format_p010_pack_rgba_float(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
-                             UNUSED const float *src_row, UNUSED unsigned src_stride,
-                             UNUSED unsigned width, UNUSED unsigned height) {}
-void
-util_format_p010_fetch_rgba_float(UNUSED float *dst, UNUSED const uint8_t *src,
-                             UNUSED unsigned i, UNUSED unsigned j) {}
-void
-util_format_p016_unpack_rgba_8unorm(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
-                             UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
-                             UNUSED unsigned width, UNUSED unsigned height) {}
-void
-util_format_p016_pack_rgba_8unorm(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
-                             UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
-                             UNUSED unsigned width, UNUSED unsigned height) {}
-void
-util_format_p016_unpack_rgba_float(UNUSED float *dst_row, UNUSED unsigned dst_stride,
-                             UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
-                             UNUSED unsigned width, UNUSED unsigned height) {}
-void
-util_format_p016_pack_rgba_float(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
-                             UNUSED const float *src_row, UNUSED unsigned src_stride,
-                             UNUSED unsigned width, UNUSED unsigned height) {}
-void
-util_format_p016_fetch_rgba_float(UNUSED float *dst, UNUSED const uint8_t *src,
-                             UNUSED unsigned i, UNUSED unsigned j) {}
-
-void
-util_format_xyuv_unpack_rgba_float(UNUSED float *dst_row, UNUSED unsigned dst_stride,
-                                         UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
-                                         UNUSED unsigned width, UNUSED unsigned height) {}
-
-void
-util_format_xyuv_unpack_rgba_8unorm(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
-                                          UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
-                                          UNUSED unsigned width, UNUSED unsigned height) {}
-
-void
-util_format_xyuv_pack_rgba_float(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
-                                       UNUSED const float *src_row, UNUSED unsigned src_stride,
-                                       UNUSED unsigned width, UNUSED unsigned height) {}
-
-void
-util_format_xyuv_pack_rgba_8unorm(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
-                                        UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
-                                        UNUSED unsigned width, UNUSED unsigned height) {}
-
-void
-util_format_xyuv_fetch_rgba_float(UNUSED float *dst, UNUSED const uint8_t *src,
-                                        UNUSED unsigned i, UNUSED unsigned j) {}
-void
-util_format_ayuv_unpack_rgba_float(UNUSED float *dst_row, UNUSED unsigned dst_stride,
-                                         UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
-                                         UNUSED unsigned width, UNUSED unsigned height) {}
-
-void
-util_format_ayuv_unpack_rgba_8unorm(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
-                                          UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
-                                          UNUSED unsigned width, UNUSED unsigned height) {}
-
-void
-util_format_ayuv_pack_rgba_float(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
-                                       UNUSED const float *src_row, UNUSED unsigned src_stride,
-                                       UNUSED unsigned width, UNUSED unsigned height) {}
-
-void
-util_format_ayuv_pack_rgba_8unorm(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
-                                        UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
-                                        UNUSED unsigned width, UNUSED unsigned height) {}
-
-void
-util_format_ayuv_fetch_rgba_float(UNUSED float *dst, UNUSED const uint8_t *src,
-                                        UNUSED unsigned i, UNUSED unsigned j) {}
-void
-util_format_r8g8_r8b8_unorm_unpack_rgba_float(UNUSED float *dst_row, UNUSED unsigned dst_stride,
-                                         UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
-                                         UNUSED unsigned width, UNUSED unsigned height) {}
-
-void
-util_format_r8g8_r8b8_unorm_unpack_rgba_8unorm(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
-                                          UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
-                                          UNUSED unsigned width, UNUSED unsigned height) {}
-
-void
-util_format_r8g8_r8b8_unorm_pack_rgba_float(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
-                                       UNUSED const float *src_row, UNUSED unsigned src_stride,
-                                       UNUSED unsigned width, UNUSED unsigned height) {}
-
-void
-util_format_r8g8_r8b8_unorm_pack_rgba_8unorm(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
-                                        UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
-                                        UNUSED unsigned width, UNUSED unsigned height) {}
-
-void
-util_format_r8g8_r8b8_unorm_fetch_rgba_float(UNUSED float *dst, UNUSED const uint8_t *src,
-                                        UNUSED unsigned i, UNUSED unsigned j) {}
-
-void
-util_format_g8r8_b8r8_unorm_unpack_rgba_float(UNUSED float *dst_row, UNUSED unsigned dst_stride,
-                                         UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
-                                         UNUSED unsigned width, UNUSED unsigned height) {}
-
-void
-util_format_g8r8_b8r8_unorm_unpack_rgba_8unorm(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
-                                          UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
-                                          UNUSED unsigned width, UNUSED unsigned height) {}
-
-void
-util_format_g8r8_b8r8_unorm_pack_rgba_float(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
-                                       UNUSED const float *src_row, UNUSED unsigned src_stride,
-                                       UNUSED unsigned width, UNUSED unsigned height) {}
-
-void
-util_format_g8r8_b8r8_unorm_pack_rgba_8unorm(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
-                                        UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
-                                        UNUSED unsigned width, UNUSED unsigned height) {}
-
-void
-util_format_g8r8_b8r8_unorm_fetch_rgba_float(UNUSED float *dst, UNUSED const uint8_t *src,
-                                        UNUSED unsigned i, UNUSED unsigned j) {}