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

View file

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

View file

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

View file

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