Log in

View Full Version : Which YUV mode better fit DivX5 specs?


unplugged
2nd April 2002, 15:08
YUY2 (16-bit) or YV12 (12-bit) ??

Considering that my intention is to use Xmpeg 4.5 with YUV output and several MPEG2 movies are encoded with YUV 4:2:2 YUY2 mode, could I get image loss using YV12 (12-bit) mode?
Is there any technical stuff to know how DivX treat these YUV modes??

excuse, sure pretty exigent :o

P.S.:
Does DivX5 however downsample YUY2 to YV12? :D

...speed is not primary problem for me...

-h
2nd April 2002, 15:23
It operates in 4:2:0 space - MPEG4 doesn't actually support any other mode at the moment. So yes, you'll lose some degree of colour information if your source is 4:2:2.

-h

unplugged
3rd April 2002, 00:01
Originally posted by -h
It operates in 4:2:0 space - MPEG4 doesn't actually support any other mode at the moment.


Thanks for posting, I want believe you, -h
However what happens it's a strange thing (with Xmpeg 4.5).
Encoding a sample video, 1st time with YUY2 output and 2nd with YV12, the 2 AVIs can't be joined:
VirtualDub clearly says that formats are different.
So does DivX5 make different data struture even if it treats YUY2 and YV12 mode giving "the same goal"?

Originally posted by -h
So yes, you'll lose some degree of colour information if your source is 4:2:2.

Well, at least it's not in my intentions still use the *stupid* RGB way ;)
I cannot understand why several programs treat RGB mode as default, just a YUV to RGB conversion is enough to see how colors get a bit garbled: image isn't reencoded yet but after this pass it already looks worse!!!!!! :rolleyes:
(IMHO, also because the source and dest image bits/pixel are *few* yet (12-16 bits)).

Trust me, try to encode a short sample video in two ways: 1st in YUV mode and 2nd in RGB.
When you compare the twice result you can see how differs the result...

...Damn, I think my first DivX3 encodes were made in default VirtualDub RGB mode!

(no offense to this great work, Vdub is most used tool, RGB mode is only mandatory to use filters... now I use fast-repack... all ok :D)

unplugged
3rd April 2002, 16:21
well

I have made a test encoding two identical AVIs: 1st with YUY2 output and 2nd with YV12 output.
(matrix scene using DivX5 and **fixed quantizer 3**)
Making a comparison frame by frame I see very small differences, only in certain frames YV12 seem to look a bit better.

The files' size is almost identical but structure is different (cannot join).

P.S.: Xmpeg 4.5 - Optimized MMX iDCT - no resize - 720x424 (cropped)

movmasty
3rd April 2002, 16:49
are you sure -h?
dct and quantization are very stronger compressions than yuv,
why should you need yuv if vid is compressed more?
thought at dct and yuv as ALTERNATIVE compression modes
where yuv is used in broadcasting and some editing format like huffyuv and indeo raw.

i mean, mpg4 is compressed with dct, then the player decompress to rgb

unplugged
3rd April 2002, 17:38
Originally posted by movmasty
are you sure -h?
dct and quantization are very stronger compressions than yuv,
why should you need yuv if vid is compressed more?
thought at dct and yuv as ALTERNATIVE compression modes
where yuv is used in broadcasting and some editing format like huffyuv and indeo raw.

i mean, mpg4 is compressed with dct, then the player decompress to rgb

movmasty, you are misunderstanding this thread :p

iDCT compression with quantization can be based by two structures:
RGB or YUV.
I talking about *ONE* format (DivX5) that internally can make computations in RGB or YUV mode...


P.S.:...not perfect explanation but... :o
I don't know deeply the matter.

unplugged
3rd April 2002, 22:46
Finally I have found what I have looked for :cool:,

at headquarters:

http://www.divx.com/support/divx/guide.php

DivX5 supports
YUV 4:2:0 (alias YV12 in Xmpeg)
YUY2 4:2:2 (used for DVD MPEG-2 stuff)
UYVY
YVYU

still nobody interested?? :rolleyes:

Now I am going to make comparisons with some high-contrast *colorful* stuff to see diffs between
DivX5 YV12 (1 byte for U and V each 4 luma (Y) pixels) and
DivX5 YUY2 (1 byte for U and V each 2 luma (Y) pixels)

movmasty
4th April 2002, 08:33
misunderstanding? dont think so
just my reply could appear wrong
what i really meant is that using RGB or YUV, after compression size will be pretty much the same,
because dct compression will average many pixels together,so doesnt really matter if you have all the colour values or just half.
Same for YUY2 and YV12

However, UYVY and YVYU are 16 bits like YUY2

unplugged
4th April 2002, 09:34
Originally posted by movmasty

...
what i really meant is that using RGB or YUV, after compression size will be pretty much the same,
because dct compression will average many pixels together,so doesnt really matter if you have all the colour values or just half.
Same for YUY2 and YV12
...


If the source is YUY2 or YV12 it's not advisable to use RGB for dest, because of the conversion, the colors (I proved this) become little distorted.
Plus, the YUV color space and its variants IMHO are preferred and most used because of the better matching with uman eye "entropy".
(if I m not wrong, also TV analog signals treat YUV like...)

Nic
4th April 2002, 11:11
Now I may have understood the thread wrong but ill try to help anyways :)

The reason the two avi files wont join is because VDub is copying the bits per pixel variable from the AVS script ? (im guessing?)

In YUY2 the bitsperpixel is 16, YV12 is 12...so VDub will not allow the join....Search for this variable difference in the AVI Header & change it (with a hex editor)...Then VDub will allow the join.

No matter what format you give DivX5 internally it will convert to 4:2:0....Just as with XviD.

-Nic

-h
4th April 2002, 11:22
The reason the avi's appear to have different formats is because DivX stores a different value for BitsPerPixel, for no reason whatsoever. The internal bitstream format is the same, colorspace and all.

I can tell you with absolute, 100% certainty that DivX operates with 4:2:0 data internally. It's just how MPEG4 works. See the MPEG4 Video Verification Model (http://mpeg.telecomitalialab.com/public/mpeg-4_video_vm.zip).

-h

unplugged
4th April 2002, 12:08
Thank you very much for explanation guys :)
This is what I wanted listen ;)

At this point YUY2 is only supported for wider input and output compatibility in DivX5.

trodas
11th February 2003, 18:38
After reading all this i have to say some usedless words about it.

I will use YUV422 (16bit/pixel) and YUV420 (12bit/pixel) as the proper naming of these colorspaces.

Now lets to to "pre-computers" times, when enginners have to invent how transport RGB signal (with have 3x more bandwitch) with lover bandwitch requirments and get it still compatible to old black and white TVsets.
The results is YUV colorspace.

IMHO the founder have to get a Nobel price for it, because its very versatitle and quite interesting thing, and everything into world now run on it. Dont believe? Let me explain this...

Very, very wrogn and basicaly spoken, then data get stored into there "transparent separated layers", each one altering the rest two of then (when at final phase joined together) and each containing some informations - Y is the luminance of picture, while U and V carry the subtracted color signal (as you maybe quess, the Y is the one what black and white TVsets using...).
The point of the seperate layers is, that you geting very verstaitle way, how to minimize the transfered data with relatively small impact of the resulting picture.
To be precise, you can very precisely set the limits.
And easily using DCT compress it very much.

So, its no wonder that mpeg1 using YUV420 as well, as all the mpeg4 standards, whyt trying to minimize the databandwitch as much, as possible, with, hoewer, slight loss to display quality.
DVD simply giving much better colors, that it is.

Thats why some scenes looks entierly terrible into DivX, while looking great on orginal DVD - for example the diving under Nazis destroyer into U-571 or opening submarine shot at beginning of Abyss.
Its just the dradeoff for getting only 12bit per pixel for image.

In fact, its not that bad. The YUV422 with its 16bit/pixel providing not half, as you might wrongly quess, quality to 32bit screens, but in fact, it getting very quite close in result!
Thats because 32bit screen use just 24bit for colors (the 8bits are unused aplhachannel - okay, mostly unused, but it still not and cant improve image quality) and not 32 and because homay eye realy dont need setting the colors that precise, as luminosity - so the YUV 422 is an excelent trade-off between quality and size, while YUV 420 get a little bit worser.

More about YUV space you can read there:
http://www.joemaller.com/fcp/fxscript_yuv_color.shtml

Thanks for your reading =:-)

temporance
11th February 2003, 19:39
trodas,

DVD's are 4:2:0, just like DivX. In fact no digital video standard available to consumers is better than 4:2:0.

Professional kit in TV studios and post houses use 4:2:2. There is very little difference in quality between 4:2:2 and 4:2:0 for the majority of video.