Skip to content

NV12 format, number of bytes should be 1.5x of pixel count, instead of 2 #9885

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
chengguizi opened this issue May 5, 2025 · 1 comment · Fixed by #9890
Closed

NV12 format, number of bytes should be 1.5x of pixel count, instead of 2 #9885

chengguizi opened this issue May 5, 2025 · 1 comment · Fixed by #9890
Labels
🪳 bug Something isn't working 🌊 C++ API C/C++ API specific 🏎️ Quick Issue Can be fixed in a few hours or less 🦀 Rust API Rust logging API

Comments

@chengguizi
Copy link

chengguizi commented May 5, 2025

Describe the bug

I am seeing error like this when attempting to us NV12 format

Rerun ERROR: Image buffer has the wrong size. Got 3072000 bytes, expected 4096000

case datatypes::PixelFormat::NV12:

https://ref.rerun.io/docs/cpp/stable/namespacererun_1_1datatypes.html

Upon checking I suspect the image_utils.hpp wrongly code NV12 as 4:2:2 type, where it should be 4:2:0 type which is consistent in docs and rest of Internet.

@chengguizi chengguizi added 🪳 bug Something isn't working 👀 needs triage This issue needs to be triaged by the Rerun team labels May 5, 2025
@Wumpf
Copy link
Member

Wumpf commented May 5, 2025

Seems the mistake creeped into both the C++ and Rust SDKs

.. while being correctly documented in various places (e.g.

/// `NV12` (aka `Y_UV12`) is a YUV 4:2:0 chroma downsampled form at with 12 bits per pixel and 8 bits per channel.
)

Should be trivial to fix!

There's a semi-manual test for verifying that python ingest & viewer decode works but that ends up not hitting any of the broken paths :/

def bgra2nv12(bgra: npt.NDArray[np.uint8]) -> npt.NDArray[np.uint8]:

@Wumpf Wumpf added 🦀 Rust API Rust logging API 🏎️ Quick Issue Can be fixed in a few hours or less 🌊 C++ API C/C++ API specific and removed 👀 needs triage This issue needs to be triaged by the Rerun team labels May 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🪳 bug Something isn't working 🌊 C++ API C/C++ API specific 🏎️ Quick Issue Can be fixed in a few hours or less 🦀 Rust API Rust logging API
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants