gfx-rs / wgpu

A cross-platform, safe, pure-Rust graphics API.
https://wgpu.rs
Apache License 2.0
12.58k stars 920 forks source link

Rename NV12 format #4840

Open cwfitzgerald opened 11 months ago

cwfitzgerald commented 11 months ago

The NV12 name isn't a very wgpu-ey name. I don't know what exactly it should be, but some options:

Suggestions welcome

valaphee commented 11 months ago

I would suggest Yuv8Uint420, as it emphasizes that it uses Y luma and uv chroma information, which are expressed as 8 bit unsigned integers (I guess) and uses 4:2:0 chroma subsampling

teoxoy commented 11 months ago

I think that sounds good, but we should also specify the number of planes.

Yuyv8Unorm_422
Uyvy8Unorm_422
Yuyv16Unorm_422
Uyvy16Unorm_422
Yuv8Unorm_420_2Plane = NV12
Yuv8Unorm_420_3Plane
Yuv16Unorm_420_2Plane
Yuv16Unorm_420_3Plane
.
.
.
valaphee commented 11 months ago

Shouldn't 4:2:0 imply that there are two planes? 1 Plane full-width and height for luma, and 1 plane half-width and height for chroma, at least as far as I understand.

AdrianEddy commented 11 months ago

Shouldn't 4:2:0 imply that there are two planes?

No, there's NV12 (2 planes, Y and UV) and YUV420 (3 planes, Y, U and V), both are 4:2:0

btw, once NV12 is settled, I'll be preparing a PR to add P010 format (same as NV12 but 10-bit) and probably a few others, including 4:2:2 ones (P210) and possibly some 4:4:4

teoxoy commented 11 months ago

Vulkan has a bunch of formats, the scheme I posted above should work for all.

cwfitzgerald commented 11 months ago

The scheme @teoxoy posted sounds good!