util/format: Add subsampling info to our YUV-as-RGB format names

This will allow for more autogen and is good to have regardless, because
it makes it clear what the subsampling is when looking at the name.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35177>
This commit is contained in:
Boris Brezillon 2025-05-27 09:49:22 +02:00 committed by Marge Bot
parent 75ba8f403d
commit f20ee2806e
4 changed files with 118 additions and 73 deletions

View file

@ -731,49 +731,57 @@
swizzles: [X, Y, Z, 1] swizzles: [X, Y, Z, 1]
# same subsampling but with rgb channels # same subsampling but with rgb channels
- name: R8G8_B8G8_UNORM - name: R8G8_B8G8_422_UNORM
alias: R8G8_B8G8_UNORM
layout: subsampled layout: subsampled
colorspace: RGB colorspace: RGB
block: {width: 2, height: 1, depth: 1} block: {width: 2, height: 1, depth: 1}
channels: [UN8, UN8, UN8, UN8] channels: [UN8, UN8, UN8, UN8]
swizzles: [X, Y, Z, 1] swizzles: [X, Y, Z, 1]
- name: G8R8_G8B8_UNORM - name: G8R8_G8B8_422_UNORM
alias: G8R8_G8B8_UNORM
layout: subsampled layout: subsampled
colorspace: RGB colorspace: RGB
block: {width: 2, height: 1, depth: 1} block: {width: 2, height: 1, depth: 1}
channels: [UN8, UN8, UN8, UN8] channels: [UN8, UN8, UN8, UN8]
swizzles: [X, Y, Z, 1] swizzles: [X, Y, Z, 1]
- name: G8R8_B8R8_UNORM - name: G8R8_B8R8_422_UNORM
alias: G8R8_B8R8_UNORM
layout: subsampled layout: subsampled
colorspace: RGB colorspace: RGB
block: {width: 2, height: 1, depth: 1} block: {width: 2, height: 1, depth: 1}
channels: [UN8, UN8, UN8, UN8] channels: [UN8, UN8, UN8, UN8]
swizzles: [Z, Y, X, 1] swizzles: [Z, Y, X, 1]
- name: R8G8_R8B8_UNORM - name: R8G8_R8B8_422_UNORM
alias: R8G8_R8B8_UNORM
layout: subsampled layout: subsampled
colorspace: RGB colorspace: RGB
block: {width: 2, height: 1, depth: 1} block: {width: 2, height: 1, depth: 1}
channels: [UN8, UN8, UN8, UN8] channels: [UN8, UN8, UN8, UN8]
swizzles: [Z, Y, X, 1] swizzles: [Z, Y, X, 1]
- name: B8R8_G8R8_UNORM - name: B8R8_G8R8_422_UNORM
alias: B8R8_G8R8_UNORM
layout: subsampled layout: subsampled
colorspace: RGB colorspace: RGB
block: {width: 2, height: 1, depth: 1} block: {width: 2, height: 1, depth: 1}
channels: [UN8, UN8, UN8, UN8] channels: [UN8, UN8, UN8, UN8]
swizzles: [Y, X, Z, 1] swizzles: [Y, X, Z, 1]
- name: R8B8_R8G8_UNORM - name: R8B8_R8G8_422_UNORM
alias: R8B8_R8G8_UNORM
layout: subsampled layout: subsampled
colorspace: RGB colorspace: RGB
block: {width: 2, height: 1, depth: 1} block: {width: 2, height: 1, depth: 1}
channels: [UN8, UN8, UN8, UN8] channels: [UN8, UN8, UN8, UN8]
swizzles: [Y, X, Z, 1] swizzles: [Y, X, Z, 1]
- name: G8B8_G8R8_UNORM - name: G8B8_G8R8_422_UNORM
alias: G8B8_G8R8_UNORM
layout: subsampled layout: subsampled
colorspace: RGB colorspace: RGB
block: {width: 2, height: 1, depth: 1} block: {width: 2, height: 1, depth: 1}
channels: [UN8, UN8, UN8, UN8] channels: [UN8, UN8, UN8, UN8]
swizzles: [X, Y, Z, 1] swizzles: [X, Y, Z, 1]
- name: B8G8_R8G8_UNORM - name: B8G8_R8G8_422_UNORM
alias: B8G8_R8G8_UNORM
layout: subsampled layout: subsampled
colorspace: RGB colorspace: RGB
block: {width: 2, height: 1, depth: 1} block: {width: 2, height: 1, depth: 1}
@ -2094,7 +2102,8 @@
block: {width: 1, height: 1, depth: 1} block: {width: 1, height: 1, depth: 1}
channels: [UN8] channels: [UN8]
swizzles: [X, Y, Z, W] swizzles: [X, Y, Z, W]
- name: R8_G8_B8_UNORM - name: R8_G8_B8_444_UNORM
alias: R8_G8_B8_UNORM
layout: planar3 layout: planar3
colorspace: RGB colorspace: RGB
block: {width: 1, height: 1, depth: 1} block: {width: 1, height: 1, depth: 1}

View file

@ -100,13 +100,13 @@ def has_access(format):
'u16y16v16a16_444_unorm', 'u16y16v16a16_444_unorm',
'x8y8u8v8_444_unorm', 'x8y8u8v8_444_unorm',
'a8y8u8v8_444_unorm', 'a8y8u8v8_444_unorm',
'r8g8_r8b8_unorm', 'r8g8_r8b8_422_unorm',
'r8b8_r8g8_unorm', 'r8b8_r8g8_422_unorm',
'g8r8_b8r8_unorm', 'g8r8_b8r8_422_unorm',
'b8r8_g8r8_unorm', 'b8r8_g8r8_422_unorm',
'g8r8_g8b8_unorm', 'g8r8_g8b8_422_unorm',
'g8b8_g8r8_unorm', 'g8b8_g8r8_422_unorm',
'b8g8_r8g8_unorm', 'b8g8_r8g8_422_unorm',
'x6g10_x6b10x6r10_420_unorm', 'x6g10_x6b10x6r10_420_unorm',
'x4g12_x4b12x4r12_420_unorm', 'x4g12_x4b12x4r12_420_unorm',
'y8_400_unorm', 'y8_400_unorm',
@ -134,7 +134,7 @@ def has_access(format):
'r8_g8_b8_420_unorm', 'r8_g8_b8_420_unorm',
'r8_b8_g8_420_unorm', 'r8_b8_g8_420_unorm',
'g8_b8_r8_420_unorm', 'g8_b8_r8_420_unorm',
'r8_g8_b8_unorm', 'r8_g8_b8_444_unorm',
'r8g8b8_420_unorm_packed', 'r8g8b8_420_unorm_packed',
'r10g10b10_420_unorm_packed', 'r10g10b10_420_unorm_packed',
'y8_unorm', 'y8_unorm',

View file

@ -39,8 +39,10 @@
void void
util_format_r8g8_b8g8_unorm_unpack_rgba_float(void *restrict dst_row, unsigned dst_stride, util_format_r8g8_b8g8_422_unorm_unpack_rgba_float(void *restrict dst_row,
const uint8_t *restrict src_row, unsigned src_stride, unsigned dst_stride,
const uint8_t *restrict src_row,
unsigned src_stride,
unsigned width, unsigned height) unsigned width, unsigned height)
{ {
unsigned x, y; unsigned x, y;
@ -93,8 +95,10 @@ util_format_r8g8_b8g8_unorm_unpack_rgba_float(void *restrict dst_row, unsigned d
void void
util_format_r8g8_b8g8_unorm_unpack_rgba_8unorm(uint8_t *restrict dst_row, unsigned dst_stride, util_format_r8g8_b8g8_422_unorm_unpack_rgba_8unorm(uint8_t *restrict dst_row,
const uint8_t *restrict src_row, unsigned src_stride, unsigned dst_stride,
const uint8_t *restrict src_row,
unsigned src_stride,
unsigned width, unsigned height) unsigned width, unsigned height)
{ {
unsigned x, y; unsigned x, y;
@ -147,8 +151,10 @@ util_format_r8g8_b8g8_unorm_unpack_rgba_8unorm(uint8_t *restrict dst_row, unsign
void void
util_format_r8g8_b8g8_unorm_pack_rgba_float(uint8_t *restrict dst_row, unsigned dst_stride, util_format_r8g8_b8g8_422_unorm_pack_rgba_float(uint8_t *restrict dst_row,
const float *restrict src_row, unsigned src_stride, unsigned dst_stride,
const float *restrict src_row,
unsigned src_stride,
unsigned width, unsigned height) unsigned width, unsigned height)
{ {
unsigned x, y; unsigned x, y;
@ -196,8 +202,10 @@ util_format_r8g8_b8g8_unorm_pack_rgba_float(uint8_t *restrict dst_row, unsigned
void void
util_format_r8g8_b8g8_unorm_pack_rgba_8unorm(uint8_t *restrict dst_row, unsigned dst_stride, util_format_r8g8_b8g8_422_unorm_pack_rgba_8unorm(uint8_t *restrict dst_row,
const uint8_t *restrict src_row, unsigned src_stride, unsigned dst_stride,
const uint8_t *restrict src_row,
unsigned src_stride,
unsigned width, unsigned height) unsigned width, unsigned height)
{ {
unsigned x, y; unsigned x, y;
@ -245,7 +253,8 @@ util_format_r8g8_b8g8_unorm_pack_rgba_8unorm(uint8_t *restrict dst_row, unsigned
void void
util_format_r8g8_b8g8_unorm_fetch_rgba(void *restrict in_dst, const uint8_t *restrict src, util_format_r8g8_b8g8_422_unorm_fetch_rgba(void *restrict in_dst,
const uint8_t *restrict src,
unsigned i, ASSERTED unsigned j) unsigned i, ASSERTED unsigned j)
{ {
float *dst = in_dst; float *dst = in_dst;
@ -261,8 +270,10 @@ util_format_r8g8_b8g8_unorm_fetch_rgba(void *restrict in_dst, const uint8_t *res
void void
util_format_g8r8_g8b8_unorm_unpack_rgba_float(void *restrict dst_row, unsigned dst_stride, util_format_g8r8_g8b8_422_unorm_unpack_rgba_float(void *restrict dst_row,
const uint8_t *restrict src_row, unsigned src_stride, unsigned dst_stride,
const uint8_t *restrict src_row,
unsigned src_stride,
unsigned width, unsigned height) unsigned width, unsigned height)
{ {
unsigned x, y; unsigned x, y;
@ -315,8 +326,10 @@ util_format_g8r8_g8b8_unorm_unpack_rgba_float(void *restrict dst_row, unsigned d
void void
util_format_g8r8_g8b8_unorm_unpack_rgba_8unorm(uint8_t *restrict dst_row, unsigned dst_stride, util_format_g8r8_g8b8_422_unorm_unpack_rgba_8unorm(uint8_t *restrict dst_row,
const uint8_t *restrict src_row, unsigned src_stride, unsigned dst_stride,
const uint8_t *restrict src_row,
unsigned src_stride,
unsigned width, unsigned height) unsigned width, unsigned height)
{ {
unsigned x, y; unsigned x, y;
@ -369,8 +382,10 @@ util_format_g8r8_g8b8_unorm_unpack_rgba_8unorm(uint8_t *restrict dst_row, unsign
void void
util_format_g8r8_g8b8_unorm_pack_rgba_float(uint8_t *restrict dst_row, unsigned dst_stride, util_format_g8r8_g8b8_422_unorm_pack_rgba_float(uint8_t *restrict dst_row,
const float *restrict src_row, unsigned src_stride, unsigned dst_stride,
const float *restrict src_row,
unsigned src_stride,
unsigned width, unsigned height) unsigned width, unsigned height)
{ {
unsigned x, y; unsigned x, y;
@ -418,8 +433,10 @@ util_format_g8r8_g8b8_unorm_pack_rgba_float(uint8_t *restrict dst_row, unsigned
void void
util_format_g8r8_g8b8_unorm_pack_rgba_8unorm(uint8_t *restrict dst_row, unsigned dst_stride, util_format_g8r8_g8b8_422_unorm_pack_rgba_8unorm(uint8_t *restrict dst_row,
const uint8_t *restrict src_row, unsigned src_stride, unsigned dst_stride,
const uint8_t *restrict src_row,
unsigned src_stride,
unsigned width, unsigned height) unsigned width, unsigned height)
{ {
unsigned x, y; unsigned x, y;
@ -467,7 +484,8 @@ util_format_g8r8_g8b8_unorm_pack_rgba_8unorm(uint8_t *restrict dst_row, unsigned
void void
util_format_g8r8_g8b8_unorm_fetch_rgba(void *restrict in_dst, const uint8_t *restrict src, util_format_g8r8_g8b8_422_unorm_fetch_rgba(void *restrict in_dst,
const uint8_t *restrict src,
unsigned i, ASSERTED unsigned j) unsigned i, ASSERTED unsigned j)
{ {
float *dst = in_dst; float *dst = in_dst;

View file

@ -255,51 +255,69 @@ util_format_y8v8y8u8_422_unorm_fetch_rgba(void *restrict dst,
unsigned i, unsigned j); unsigned i, unsigned j);
void void
util_format_r8g8_b8g8_unorm_unpack_rgba_float(void *restrict dst_row, unsigned dst_stride, util_format_r8g8_b8g8_422_unorm_unpack_rgba_float(void *restrict dst_row,
const uint8_t *restrict src_row, unsigned src_stride, unsigned dst_stride,
const uint8_t *restrict src_row,
unsigned src_stride,
unsigned width, unsigned height); unsigned width, unsigned height);
void void
util_format_r8g8_b8g8_unorm_unpack_rgba_8unorm(uint8_t *restrict dst_row, unsigned dst_stride, util_format_r8g8_b8g8_422_unorm_unpack_rgba_8unorm(uint8_t *restrict dst_row,
const uint8_t *restrict src_row, unsigned src_stride, unsigned dst_stride,
const uint8_t *restrict src_row,
unsigned src_stride,
unsigned width, unsigned height); unsigned width, unsigned height);
void void
util_format_r8g8_b8g8_unorm_pack_rgba_float(uint8_t *restrict dst_row, unsigned dst_stride, util_format_r8g8_b8g8_422_unorm_pack_rgba_float(uint8_t *restrict dst_row,
const float *restrict src_row, unsigned src_stride, unsigned dst_stride,
const float *restrict src_row,
unsigned src_stride,
unsigned width, unsigned height); unsigned width, unsigned height);
void void
util_format_r8g8_b8g8_unorm_pack_rgba_8unorm(uint8_t *restrict dst_row, unsigned dst_stride, util_format_r8g8_b8g8_422_unorm_pack_rgba_8unorm(uint8_t *restrict dst_row,
const uint8_t *restrict src_row, unsigned src_stride, unsigned dst_stride,
const uint8_t *restrict src_row,
unsigned src_stride,
unsigned width, unsigned height); unsigned width, unsigned height);
void void
util_format_r8g8_b8g8_unorm_fetch_rgba(void *restrict dst, const uint8_t *restrict src, util_format_r8g8_b8g8_422_unorm_fetch_rgba(void *restrict dst,
const uint8_t *restrict src,
unsigned i, unsigned j); unsigned i, unsigned j);
void void
util_format_g8r8_g8b8_unorm_unpack_rgba_float(void *restrict dst_row, unsigned dst_stride, util_format_g8r8_g8b8_422_unorm_unpack_rgba_float(void *restrict dst_row,
const uint8_t *restrict src_row, unsigned src_stride, unsigned dst_stride,
const uint8_t *restrict src_row,
unsigned src_stride,
unsigned width, unsigned height); unsigned width, unsigned height);
void void
util_format_g8r8_g8b8_unorm_unpack_rgba_8unorm(uint8_t *restrict dst_row, unsigned dst_stride, util_format_g8r8_g8b8_422_unorm_unpack_rgba_8unorm(uint8_t *restrict dst_row,
const uint8_t *restrict src_row, unsigned src_stride, unsigned dst_stride,
const uint8_t *restrict src_row,
unsigned src_stride,
unsigned width, unsigned height); unsigned width, unsigned height);
void void
util_format_g8r8_g8b8_unorm_pack_rgba_float(uint8_t *restrict dst_row, unsigned dst_stride, util_format_g8r8_g8b8_422_unorm_pack_rgba_float(uint8_t *restrict dst_row,
const float *restrict src_row, unsigned src_stride, unsigned dst_stride,
const float *restrict src_row,
unsigned src_stride,
unsigned width, unsigned height); unsigned width, unsigned height);
void void
util_format_g8r8_g8b8_unorm_pack_rgba_8unorm(uint8_t *restrict dst_row, unsigned dst_stride, util_format_g8r8_g8b8_422_unorm_pack_rgba_8unorm(uint8_t *restrict dst_row,
const uint8_t *restrict src_row, unsigned src_stride, unsigned dst_stride,
const uint8_t *restrict src_row,
unsigned src_stride,
unsigned width, unsigned height); unsigned width, unsigned height);
void void
util_format_g8r8_g8b8_unorm_fetch_rgba(void *restrict dst, const uint8_t *restrict src, util_format_g8r8_g8b8_422_unorm_fetch_rgba(void *restrict dst,
const uint8_t *restrict src,
unsigned i, unsigned j); unsigned i, unsigned j);
#endif /* U_FORMAT_YUV_H_ */ #endif /* U_FORMAT_YUV_H_ */