Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion. Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules. |
2nd September 2002, 14:44 | #1 | Link |
Registered User
Join Date: Jun 2002
Posts: 76
|
best rgb yuv conversation
I'm testing some wavelet transform, using rgb and yuv color format. I've found many different conversation formulars with different loss, and different ranges, but what formular is used in the standart windows codecs?
|
6th September 2002, 12:45 | #2 | Link |
Banned
Join Date: Aug 2002
Location: Germany
Posts: 1,737
|
When I need that conversion, I used the formula that caused an YUV overlay to look exactly as the RGB-original.
The AVI file format descriptions I have say Y = 0.299 R + 0.587 G + 0.114 B U = 0.493 (B - Y) V = 0.877 (R - Y) But for my overlay, it definitely didn't work. The colors were somehow "weak". I had to scale the values. I really don't remember the formula any more, since I did that a year ago or even more, but you can try to extract it from my RGB->YUV source code: http://www.alexander-noe.de/Video/RGBNYUV/ Last edited by alexnoe; 6th September 2002 at 13:35. |
8th September 2002, 14:20 | #4 | Link |
Banned
Join Date: Aug 2002
Location: Germany
Posts: 1,737
|
They are not "my" formulas...they are copy+pasted from an AVI file description.
I know that they can't be correct. As I said, the color was somehow weak if I used them for a RGB->YUV conversion and copied it to an overlay. Would you be so kind to give the correct ones? You seem to know them...would you mind to share your knowledge? |
8th September 2002, 17:30 | #5 | Link |
Registered User
Join Date: Oct 2001
Location: Brussels
Posts: 358
|
By converting avisynth code to formula I get this (rec601):
scaled_Y = 0.299 R + 0.587 B + 0.114 G Y = 0.859 scaled_Y + 16 U = 0.496 (B - scaled_Y) + 128 (needs clipping) V = 0.627 (R - scaled_Y) + 128 (needs clipping) or if you prefer: Y = 0.257 R + 0.504 G + 0.098 B + 16 U = -0.148 R - 0.291 G + 0.439 B + 128 V = 0.439 R - 0.368 G - 0.071 B + 128 That's assuming the standard representation of 8 bits/components, of course.
__________________
dividee |
9th September 2002, 09:06 | #7 | Link |
Registered User
Join Date: Jun 2002
Posts: 76
|
Thanks!
An other question, there are many different types yuv color formats like yuv12. i think standard is yuv12 and looks like this --------- |yuv|y | --------- |y |y | --------- Can anybody tell me a good page about yuv color formats or explain it on the forum? |
9th September 2002, 09:12 | #8 | Link |
Banned
Join Date: Aug 2002
Location: Germany
Posts: 1,737
|
yv12 is (at least for DirectDraw overlays)
------------------ |yyyyyyy... |yyyyyyy... |yyyyyyy... |yyyyyyy... |v v v v... | |v v v v... | |u u u u... | |u u u u... | Unfortunately, the page were I found this some time ago is down EDIT does anyone have an idea why there are different RGB->YUV formulas? I can promise that the last one won't work with DirectDraw overlays... Last edited by alexnoe; 9th September 2002 at 10:25. |
9th September 2002, 13:42 | #9 | Link |
Moderator
Join Date: Oct 2001
Posts: 3,530
|
Different standards, and mistakes. Some people confuse YIQ, YCbCr, and YPbPr for YUV.
Edit: btw, DVD uses three different standards (ITU-601, aka SMPTE-170 M, is one), so if you are working with DVD source make sure you check which one was used to encode. http://mpucoder.kewlhair.com/DVD/dvdmpeg.html Last edited by mpucoder; 9th September 2002 at 13:50. |
24th September 2021, 23:55 | #11 | Link |
Registered User
Join Date: Jul 2018
Posts: 1,041
|
1/1000 error in data is much less error at the full awful idea to use YUV for small 2:1 bitrate compression after subsampling to 4:2:0. Nowdays mpegs can easily reach 1000:1 compression rate but awful 4:2:0 old compression idea still bugs the data today too. I hope someday YUV will be only for processing luma/chroma separately and the awful 4:2:2 and 4:2:0 data-damaging ideas goes to the same grave as interlace scan.
|
Thread Tools | Search this Thread |
Display Modes | |
|
|