Log in

View Full Version : What is memory format of 10bits depth 4:2:0 YUV data?


l35633
2nd December 2014, 21:29
hello, I want to test x264 compressing 10bits yuv file, now I want to record and create this yuv file, but what is memory format of 10bits depth 4:2:0 YUV data? which makes me puzzuled? Who can give me some advices?
Thank you very much!

MasterNobody
2nd December 2014, 22:25
Same as 8-bit YUV 4:2:0 but with every component in planes takes 2 bytes instead of 1 byte i.e. 1-frame is Y-plane <width>*<height>*2 bytes, U-plane <width/2>*<height/2>*2 bytes, V-plane <width/2>*<height/2>*2 bytes without any padding between planes.

l35633
2nd December 2014, 22:44
Thank you very much!

foxyshadis
3rd December 2014, 01:45
FFmpeg also lists the following formats:
IO... yuv420p16le 3 24
IO... yuv420p16be 3 24
IO... yuv420p10be 3 15
IO... yuv420p10le 3 15
IO... yuv420p12be 3 18
IO... yuv420p12le 3 18
IO... yuv420p14be 3 21
IO... yuv420p14le 3 21

There are also 16-bit gray formats (but no 10, 12, or 14). All of the 10, 12 and 14 bpp formats pack pixels together, saving space on disk (over 33% for 10 compared to 16). If you export to Y4M, x264 will understand it without needing any frame options set; Y4M is much easier to use than raw YUV.

l35633
10th December 2014, 12:03
Thank you, now I still have other problems:
1. what does it mean below you showed me? I cannot totaolly understand.
IO... yuv420p16le 3 24
IO... yuv420p16be 3 24
IO... yuv420p10be 3 15
IO... yuv420p10le 3 15
IO... yuv420p12be 3 18
IO... yuv420p12le 3 18
IO... yuv420p14be 3 21
IO... yuv420p14le 3 21

2.
As MasterNobody said "same as 8-bit YUV 4:2:0 but with every component in planes takes 2 bytes instead of 1 byte i.e. 1-frame is Y-plane <width>*<height>*2 bytes, U-plane <width/2>*<height/2>*2 bytes, V-plane <width/2>*<height/2>*2 bytes without any padding between planes."
I created a YUV file like that.
Then I run as below, x264 is the built 10bits command.
x264 vga_640x480.yuv --profile high10 --input-csp i420 --output-csp i420 -o test.264

No error shows, but the frames should be 200 frames, but the encode frames are 400, double the original number?
Do I miss some paramters in x264 command?

Thank you very much!

MasterNobody
10th December 2014, 17:34
Do I miss some paramters in x264 command?
You missed "--input-depth 10" param because default is 8-bit.

l35633
10th December 2014, 18:10
Thank you very much!
add --input-depth 10 is ok!
Then I try --input-depth 16, still can encode! What does it mean? I heard that only support 10bit not 16bit, why still work?

Thank you!

MasterNobody
10th December 2014, 18:35
Thank you very much!
add --input-depth 10 is ok!
Then I try --input-depth 16, still can encode! What does it mean? I heard that only support 10bit not 16bit, why still work?

Thank you!
Input bit depth (which can be anything from 8-bit to 16-bit) is separate thing from encoding bit depth (where only from 8-bit to 10-bit is supported and fixed during compilation). If input bit depth differ from encoding bit depth than it would be scaled (up) or dithered (down) by x264 to needed bit depth before sending to libx264.

l35633
10th December 2014, 19:08
Thank you very much!