aboutsummaryrefslogtreecommitdiffstats
path: root/src/util
diff options
context:
space:
mode:
authorBas Nieuwenhuizen <[email protected]>2020-05-25 00:05:20 +0200
committerMarge Bot <[email protected]>2020-05-30 01:22:51 +0000
commitcf9926714783efa4524ca2afd62a9817dcbccf06 (patch)
treef16020bc2f7e5a095bc78a649b387e3f05c7b567 /src/util
parentd491b0dfd97c27b245ad0ed0e7356377f25ebe67 (diff)
util/format: Add more multi-planar formats.
These don't have a fourcc code as far as I can tell, but we want them for internal Vulkan use. Reviewed-by: Eric Anholt <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5195>
Diffstat (limited to 'src/util')
-rw-r--r--src/util/format/u_format.csv9
-rw-r--r--src/util/format/u_format.h14
-rw-r--r--src/util/format/u_format_yuv.c140
-rw-r--r--src/util/format/u_format_yuv.h140
4 files changed, 303 insertions, 0 deletions
diff --git a/src/util/format/u_format.csv b/src/util/format/u_format.csv
index 97c76a92880..2f71e70e736 100644
--- a/src/util/format/u_format.csv
+++ b/src/util/format/u_format.csv
@@ -386,6 +386,15 @@ PIPE_FORMAT_IYUV , planar3, 1, 1, 1, , , , , xy
PIPE_FORMAT_NV12 , planar2, 1, 1, 1, , , , , xyzw, yuv
PIPE_FORMAT_NV21 , planar2, 1, 1, 1, , , , , xyzw, yuv
+PIPE_FORMAT_Y8_U8_V8_422_UNORM , planar3, 1, 1, 1, , , , , xyzw, yuv
+PIPE_FORMAT_Y8_U8V8_422_UNORM , planar2, 1, 1, 1, , , , , xyzw, yuv
+PIPE_FORMAT_Y8_U8_V8_444_UNORM , planar3, 1, 1, 1, , , , , xyzw, yuv
+
+PIPE_FORMAT_Y16_U16_V16_420_UNORM , planar3, 1, 1, 1, , , , , xyzw, yuv
+PIPE_FORMAT_Y16_U16_V16_422_UNORM , planar3, 1, 1, 1, , , , , xyzw, yuv
+PIPE_FORMAT_Y16_U16V16_422_UNORM , planar2, 1, 1, 1, , , , , xyzw, yuv
+PIPE_FORMAT_Y16_U16_V16_444_UNORM , planar3, 1, 1, 1, , , , , xyzw, yuv
+
PIPE_FORMAT_P010 , planar2, 1, 1, 1, , , , , xyzw, yuv
PIPE_FORMAT_P016 , planar2, 1, 1, 1, , , , , xyzw, yuv
diff --git a/src/util/format/u_format.h b/src/util/format/u_format.h
index 1b6f0b88289..f13dc9fc0d8 100644
--- a/src/util/format/u_format.h
+++ b/src/util/format/u_format.h
@@ -1336,13 +1336,21 @@ util_format_get_plane_format(enum pipe_format format, unsigned plane)
case PIPE_FORMAT_YV12:
case PIPE_FORMAT_YV16:
case PIPE_FORMAT_IYUV:
+ case PIPE_FORMAT_Y8_U8_V8_422_UNORM:
+ case PIPE_FORMAT_Y8_U8_V8_444_UNORM:
return PIPE_FORMAT_R8_UNORM;
case PIPE_FORMAT_NV12:
+ case PIPE_FORMAT_Y8_U8V8_422_UNORM:
return !plane ? PIPE_FORMAT_R8_UNORM : PIPE_FORMAT_RG88_UNORM;
case PIPE_FORMAT_NV21:
return !plane ? PIPE_FORMAT_R8_UNORM : PIPE_FORMAT_GR88_UNORM;
+ case PIPE_FORMAT_Y16_U16_V16_420_UNORM:
+ case PIPE_FORMAT_Y16_U16_V16_422_UNORM:
+ case PIPE_FORMAT_Y16_U16_V16_444_UNORM:
+ return PIPE_FORMAT_R16_UNORM;
case PIPE_FORMAT_P010:
case PIPE_FORMAT_P016:
+ case PIPE_FORMAT_Y16_U16V16_422_UNORM:
return !plane ? PIPE_FORMAT_R16_UNORM : PIPE_FORMAT_R16G16_UNORM;
default:
return format;
@@ -1361,6 +1369,11 @@ util_format_get_plane_width(enum pipe_format format, unsigned plane,
case PIPE_FORMAT_NV21:
case PIPE_FORMAT_P010:
case PIPE_FORMAT_P016:
+ case PIPE_FORMAT_Y8_U8_V8_422_UNORM:
+ case PIPE_FORMAT_Y8_U8V8_422_UNORM:
+ case PIPE_FORMAT_Y16_U16_V16_420_UNORM:
+ case PIPE_FORMAT_Y16_U16_V16_422_UNORM:
+ case PIPE_FORMAT_Y16_U16V16_422_UNORM:
return !plane ? width : (width + 1) / 2;
default:
return width;
@@ -1378,6 +1391,7 @@ util_format_get_plane_height(enum pipe_format format, unsigned plane,
case PIPE_FORMAT_NV21:
case PIPE_FORMAT_P010:
case PIPE_FORMAT_P016:
+ case PIPE_FORMAT_Y16_U16_V16_420_UNORM:
return !plane ? height : (height + 1) / 2;
case PIPE_FORMAT_YV16:
default:
diff --git a/src/util/format/u_format_yuv.c b/src/util/format/u_format_yuv.c
index ae088f43978..a6e0c2f0796 100644
--- a/src/util/format/u_format_yuv.c
+++ b/src/util/format/u_format_yuv.c
@@ -1147,3 +1147,143 @@ util_format_g8r8_b8r8_unorm_pack_rgba_8unorm(UNUSED uint8_t *dst_row, UNUSED uns
void
util_format_g8r8_b8r8_unorm_fetch_rgba_float(UNUSED float *dst, UNUSED const uint8_t *src,
UNUSED unsigned i, UNUSED unsigned j) {}
+
+void
+util_format_y8_u8_v8_422_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_y8_u8_v8_422_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_y8_u8_v8_422_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_y8_u8_v8_422_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_y8_u8_v8_422_unorm_fetch_rgba_float(UNUSED float *dst, UNUSED const uint8_t *src,
+ UNUSED unsigned i, UNUSED unsigned j) {}
+
+void
+util_format_y8_u8v8_422_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_y8_u8v8_422_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_y8_u8v8_422_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_y8_u8v8_422_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_y8_u8v8_422_unorm_fetch_rgba_float(UNUSED float *dst, UNUSED const uint8_t *src,
+ UNUSED unsigned i, UNUSED unsigned j) {}
+
+void
+util_format_y8_u8_v8_444_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_y8_u8_v8_444_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_y8_u8_v8_444_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_y8_u8_v8_444_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_y8_u8_v8_444_unorm_fetch_rgba_float(UNUSED float *dst, UNUSED const uint8_t *src,
+ UNUSED unsigned i, UNUSED unsigned j) {}
+
+void
+util_format_y16_u16_v16_420_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_y16_u16_v16_420_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_y16_u16_v16_420_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_y16_u16_v16_420_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_y16_u16_v16_420_unorm_fetch_rgba_float(UNUSED float *dst, UNUSED const uint8_t *src,
+ UNUSED unsigned i, UNUSED unsigned j) {}
+
+void
+util_format_y16_u16_v16_422_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_y16_u16_v16_422_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_y16_u16_v16_422_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_y16_u16_v16_422_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_y16_u16_v16_422_unorm_fetch_rgba_float(UNUSED float *dst, UNUSED const uint8_t *src,
+ UNUSED unsigned i, UNUSED unsigned j) {}
+
+void
+util_format_y16_u16v16_422_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_y16_u16v16_422_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_y16_u16v16_422_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_y16_u16v16_422_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_y16_u16v16_422_unorm_fetch_rgba_float(UNUSED float *dst, UNUSED const uint8_t *src,
+ UNUSED unsigned i, UNUSED unsigned j) {}
+
+void
+util_format_y16_u16_v16_444_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_y16_u16_v16_444_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_y16_u16_v16_444_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_y16_u16_v16_444_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_y16_u16_v16_444_unorm_fetch_rgba_float(UNUSED float *dst, UNUSED const uint8_t *src,
+ UNUSED unsigned i, UNUSED unsigned j) {}
diff --git a/src/util/format/u_format_yuv.h b/src/util/format/u_format_yuv.h
index 37f76dc014c..e7f03c8e157 100644
--- a/src/util/format/u_format_yuv.h
+++ b/src/util/format/u_format_yuv.h
@@ -448,4 +448,144 @@ void
util_format_g8r8_b8r8_unorm_fetch_rgba_float(float *dst, const uint8_t *src,
unsigned i, unsigned j);
+void
+util_format_y8_u8_v8_422_unorm_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
+ const uint8_t *src_row, unsigned src_stride,
+ unsigned width, unsigned height);
+void
+util_format_y8_u8_v8_422_unorm_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
+ const uint8_t *src_row, unsigned src_stride,
+ unsigned width, unsigned height);
+void
+util_format_y8_u8_v8_422_unorm_unpack_rgba_float(float *dst_row, unsigned dst_stride,
+ const uint8_t *src_row, unsigned src_stride,
+ unsigned width, unsigned height);
+void
+util_format_y8_u8_v8_422_unorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride,
+ const float *src_row, unsigned src_stride,
+ unsigned width, unsigned height);
+void
+util_format_y8_u8_v8_422_unorm_fetch_rgba_float(float *dst, const uint8_t *src,
+ unsigned i, unsigned j);
+
+void
+util_format_y8_u8v8_422_unorm_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
+ const uint8_t *src_row, unsigned src_stride,
+ unsigned width, unsigned height);
+void
+util_format_y8_u8v8_422_unorm_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
+ const uint8_t *src_row, unsigned src_stride,
+ unsigned width, unsigned height);
+void
+util_format_y8_u8v8_422_unorm_unpack_rgba_float(float *dst_row, unsigned dst_stride,
+ const uint8_t *src_row, unsigned src_stride,
+ unsigned width, unsigned height);
+void
+util_format_y8_u8v8_422_unorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride,
+ const float *src_row, unsigned src_stride,
+ unsigned width, unsigned height);
+void
+util_format_y8_u8v8_422_unorm_fetch_rgba_float(float *dst, const uint8_t *src,
+ unsigned i, unsigned j);
+
+void
+util_format_y8_u8_v8_444_unorm_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
+ const uint8_t *src_row, unsigned src_stride,
+ unsigned width, unsigned height);
+void
+util_format_y8_u8_v8_444_unorm_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
+ const uint8_t *src_row, unsigned src_stride,
+ unsigned width, unsigned height);
+void
+util_format_y8_u8_v8_444_unorm_unpack_rgba_float(float *dst_row, unsigned dst_stride,
+ const uint8_t *src_row, unsigned src_stride,
+ unsigned width, unsigned height);
+void
+util_format_y8_u8_v8_444_unorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride,
+ const float *src_row, unsigned src_stride,
+ unsigned width, unsigned height);
+void
+util_format_y8_u8_v8_444_unorm_fetch_rgba_float(float *dst, const uint8_t *src,
+ unsigned i, unsigned j);
+
+void
+util_format_y16_u16_v16_420_unorm_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
+ const uint8_t *src_row, unsigned src_stride,
+ unsigned width, unsigned height);
+void
+util_format_y16_u16_v16_420_unorm_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
+ const uint8_t *src_row, unsigned src_stride,
+ unsigned width, unsigned height);
+void
+util_format_y16_u16_v16_420_unorm_unpack_rgba_float(float *dst_row, unsigned dst_stride,
+ const uint8_t *src_row, unsigned src_stride,
+ unsigned width, unsigned height);
+void
+util_format_y16_u16_v16_420_unorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride,
+ const float *src_row, unsigned src_stride,
+ unsigned width, unsigned height);
+void
+util_format_y16_u16_v16_420_unorm_fetch_rgba_float(float *dst, const uint8_t *src,
+ unsigned i, unsigned j);
+
+void
+util_format_y16_u16_v16_422_unorm_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
+ const uint8_t *src_row, unsigned src_stride,
+ unsigned width, unsigned height);
+void
+util_format_y16_u16_v16_422_unorm_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
+ const uint8_t *src_row, unsigned src_stride,
+ unsigned width, unsigned height);
+void
+util_format_y16_u16_v16_422_unorm_unpack_rgba_float(float *dst_row, unsigned dst_stride,
+ const uint8_t *src_row, unsigned src_stride,
+ unsigned width, unsigned height);
+void
+util_format_y16_u16_v16_422_unorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride,
+ const float *src_row, unsigned src_stride,
+ unsigned width, unsigned height);
+void
+util_format_y16_u16_v16_422_unorm_fetch_rgba_float(float *dst, const uint8_t *src,
+ unsigned i, unsigned j);
+
+void
+util_format_y16_u16v16_422_unorm_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
+ const uint8_t *src_row, unsigned src_stride,
+ unsigned width, unsigned height);
+void
+util_format_y16_u16v16_422_unorm_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
+ const uint8_t *src_row, unsigned src_stride,
+ unsigned width, unsigned height);
+void
+util_format_y16_u16v16_422_unorm_unpack_rgba_float(float *dst_row, unsigned dst_stride,
+ const uint8_t *src_row, unsigned src_stride,
+ unsigned width, unsigned height);
+void
+util_format_y16_u16v16_422_unorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride,
+ const float *src_row, unsigned src_stride,
+ unsigned width, unsigned height);
+void
+util_format_y16_u16v16_422_unorm_fetch_rgba_float(float *dst, const uint8_t *src,
+ unsigned i, unsigned j);
+
+void
+util_format_y16_u16_v16_444_unorm_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
+ const uint8_t *src_row, unsigned src_stride,
+ unsigned width, unsigned height);
+void
+util_format_y16_u16_v16_444_unorm_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
+ const uint8_t *src_row, unsigned src_stride,
+ unsigned width, unsigned height);
+void
+util_format_y16_u16_v16_444_unorm_unpack_rgba_float(float *dst_row, unsigned dst_stride,
+ const uint8_t *src_row, unsigned src_stride,
+ unsigned width, unsigned height);
+void
+util_format_y16_u16_v16_444_unorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride,
+ const float *src_row, unsigned src_stride,
+ unsigned width, unsigned height);
+void
+util_format_y16_u16_v16_444_unorm_fetch_rgba_float(float *dst, const uint8_t *src,
+ unsigned i, unsigned j);
+
#endif /* U_FORMAT_YUV_H_ */