I'm trying to import 10/16 bit YUV HDR video files in my video sequencer and I got , with media foundation, a MFVideoFormat_P010, which is, according to the docs, a 4:2:0 10-bit sample. Normally I 'd use the Video Processor MFT to convert to RGB but , as of now, the MFT doesn't convert other than 8 bit samples.
I have two problems.
First, to ensure that my calculation of YUV is correct (no extra stride), "by" is the buffer start:
Is the above correct?Code:BYTE* StartLineUV = by + wi * he * sizeof(short); for (int x = 0; x < wi; x++) { for (int y = 0; y < he; y++) { BYTE* StartLine = by + (wi +strideext) * sizeof(short) * y; // Calculate YUV shorts for position xy BYTE* b1 = StartLine + x * sizeof(short); short Y = b1[0]; // Find the UV line for this xy int y2 = y / 2; // subsampling BYTE* StartLineUV2 = StartLineUV + (wi + strideext) * sizeof(short) * y2; // Find the UV for this row (subsampled) int x2 = x / 2; // 32 bits per x BYTE* pX = StartLineUV2 + x2 * 4; short U = pX[0]; short V = pX[1]; } }
Second, assuming I got a YUV values [0..1023]. How to convert them to floating point RGB ? The following would not work (which works for 8-bit YUV):
Code:void RGBfromYUV(double& R, double& G, double& B, double Y, double U, double V) { Y -= 16; U -= 128; V -= 128; R = 1.164 * Y + 1.596 * V; G = 1.164 * Y - 0.392 * U - 0.813 * V; B = 1.164 * Y + 2.017 * U; }
I'm trying to understand this also: https://forum.videohelp.com/threads/379292-Converting-Between-10-bit-RGB-and-YUV-and-Back
Try StreamFab Downloader and download from Netflix, Amazon, Youtube! Or Try DVDFab and copy Blu-rays!
+ Reply to Thread
Results 1 to 1 of 1
Thread
Similar Threads
-
quality while converting RGB-YUV
By taigi in forum EditingReplies: 34Last Post: 23rd May 2021, 23:23 -
Converting Blu-Ray YUV to RGB and back to YUV?
By killerteengohan in forum RestorationReplies: 17Last Post: 17th Mar 2020, 20:42 -
Inaccurate YUV -> RGB Conversion.
By chris319 in forum Video ConversionReplies: 151Last Post: 2nd Dec 2018, 17:58 -
Help Converting YUV to RGB
By chris319 in forum Video ConversionReplies: 7Last Post: 24th Sep 2018, 18:51 -
RGB to YUV to RGB
By chris319 in forum ProgrammingReplies: 70Last Post: 20th Feb 2017, 16:49