Skip to content

Use the limit range YUV to RGB conversion formula#79

Merged
ralfbiedert merged 7 commits into
ralfbiedert:masterfrom
Charlie-Zheng:yuv2rgb
Jun 10, 2025
Merged

Use the limit range YUV to RGB conversion formula#79
ralfbiedert merged 7 commits into
ralfbiedert:masterfrom
Charlie-Zheng:yuv2rgb

Conversation

@Charlie-Zheng

Copy link
Copy Markdown
Contributor
  • Changes the YUV to RGB to use the limit range YUV formula.
  • Added a test to convert a white H264 to RGB

Closes #42

@Charlie-Zheng

Charlie-Zheng commented May 21, 2025

Copy link
Copy Markdown
Contributor Author

One of the tests (decodes_file_requiring_flush_frame) fails now, due to the more saturated colors produced. I extracted PNGs from the multi_1024x768.h264 file using the following command:

ffmpeg -i multi_1024x768.h264 out%d.png

And the resulting image does not match the "ground truth" multi_1024x768.bmp.

The output from ffmpeg extracting video frames:
out3

I also tried extracting BMP instead of PNG and it still looks like this.

@Charlie-Zheng

Charlie-Zheng commented May 22, 2025

Copy link
Copy Markdown
Contributor Author

I can update the multi_1024x768.bmp file with the extracted image using ffmpeg if desired.

@ralfbiedert

Copy link
Copy Markdown
Owner

Thanks for the PR!

Could you make the BMP a LFS file and re-do the commit so it doesn't end up in Git history?

I can update the multi_1024x768.bmp file with the extracted image using ffmpeg if desired.

I haven't looked at exactly why this fails but yes, fixing the unit tests would be good.

@ralfbiedert ralfbiedert added the bug Something isn't working label May 23, 2025
@Charlie-Zheng

Charlie-Zheng commented May 24, 2025

Copy link
Copy Markdown
Contributor Author

Is there any specific reason why there isn't a SIMD write_rgba8?
I've added SIMD version of write_rgba8 (copying and modifying the SIMD version of write_rgb8) but I don't know if this is an appropriate PR to add it.

@ralfbiedert

Copy link
Copy Markdown
Owner

The write alpha is fine, but it looks like you still have the old bmp as non-lfs in a previous commit. It might be better to create a new branch and clean commit everything again with lfs right from the start

@Charlie-Zheng

Copy link
Copy Markdown
Contributor Author

I've correctly added multi_1024x768.bmp to git-lfs now. When I ran cargo clippy --fix, it fixed a few things (build.rs, error.rs, encoder.rs, etc) that were not touched as part of my PR. Please let me know if I should remove those changes.

@jnnks

jnnks commented Jun 8, 2025

Copy link
Copy Markdown
Contributor

Is there any specific reason why there isn't a SIMD write_rgba8?

Noone has done it yet :)

@ralfbiedert

Copy link
Copy Markdown
Owner

@Charlie-Zheng thanks for the PR and the follow ups!

@ralfbiedert ralfbiedert merged commit 2204f18 into ralfbiedert:master Jun 10, 2025
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Washed out colors when using the decoder

3 participants