Log in

View Full Version : HC YV12 format


colinb
7th October 2005, 09:27
How does HC process the VY12 color space video that it is fed with?

As you know YV12 has two different formats: interlaced and progressive. In the progressive format the first chroma line corresponds to the luminamce lines 1 and 2, whereas in the interlaced format the first chroma line corresponds to luminance lines 1 and 3, and so on. This is a structural difference to the data and if it is upsampled using the wrong assumption about its progressive or interlaced format then you get chroma artefacts.

Is HC able to distinguish whether it is being fed interlaced or progressive format YV12?

When you set the HC buttons to signify that you want interlaced or progressive output from HC, what does HC do to transform the input YV12 format to the output YV12 format? For example, if HC was being fed progressive format YV12 and the interlaced button was pressed in HC then would HC convert the YV12 chroma samples from progressive format to interlaced format (which would require them to be re-calculated). Or does HC just dump out whatever chroma values it is fed with and just set output flags to interlaced or progressive (as per the button setting)?

Also, does HC only accept YV12 or can it also accept YUY2?

Boulder
7th October 2005, 11:48
I think that the interlaced setting corresponds to the source and HC does not do any extra processing, it only encodes according to how the source parameters are set. If you encode interlaced material without enabling interlaced in HC, it's your problem :D

And IMHO that's the way it should be.

HC accepts only YV12.

hank315
7th October 2005, 22:22
Is HC able to distinguish whether it is being fed interlaced or progressive format YV12?No, it only gets YUV planes from the decoder.

if HC was being fed progressive format YV12 and the interlaced button was pressed in HC then would HC convert the YV12 chroma samples from progressive format to interlaced format (which would require them to be re-calculated). This isn't quite clear to me, why should the chroma samples be re-calculated?

freelock7
8th October 2005, 07:31
No, it only gets YUV planes from the decoder.

I don't know why but there is a difference between the source and the encoded file by HC. Colors are not the same (cold tints and more blue correction).
So, even in the same Yv12 space, you have a color processing by the encoder.

video_magic
8th October 2005, 08:09
A short while after I first had tried HC Encoder I had thought I had noticed - and had commented as such - that the encoded video looked very-slightly darkened - like if you were looking at it through dark-tinted glass.

Never-the-less HC results look very HQ and clear and sharp on everything I have tried - and I don't know whether encoding to mpeg2 is supposed to actually keep the exact same shades of colour? I believe I read that mpeg compression works like jpeg and removes subtleties in tones that the Human eye doesn't notice so much.

(I'm a newbie so forgive :) )

Boulder
8th October 2005, 09:03
For color problems, see the ColorMatrix thread.

colinb
10th October 2005, 13:07
This isn't quite clear to me, why should the chroma samples be re-calculated?

My thinking was that the interlaced format YV12 has the first line of chroma samples (C1) common to luminance lines 1 and 3 (Y1 and Y3), but in progressive format YV12 C1 is common to Y1 and Y2 - i.e.:

Interlaced:
C1 -> Y1, Y3
C2 -> Y2, Y4

Progressive:
C1 -> Y1, Y2
C2 -> Y3, Y4

If say you fed HC with progressive format YV12 but set its buttons for interlaced then you would end up encoding material which would tell the DVD player that it was interlaced but its C1 was NOT common to Y1 and Y3. I was therefore assuming that some sort of transformation would be needed taking C sample values from C1 and C2 and come up with new values which would be common to Y1 and Y3 instead of Y1 and Y2.

If this transformation was not done in this case, isn't there a danger that the DVD player might incorrectly use interlaced upsampling of the YV12 chroma instead of progressive?

So doesn't HC need to know the YV12 format (interlaced or progressive) of its INPUT and do a transformation on the chroma values if the selected format is different?

Wilbert
10th October 2005, 14:33
If this transformation was not done in this case, isn't there a danger that the DVD player might incorrectly use interlaced upsampling of the YV12 chroma instead of progressive?
Such a magic transformation (without quality loss) doesn't exist. The only thing you can do is blurring the chroma a bit in the vertical direction (as in the last script you posted at neuron2.net). The main problem is that the resolution of the chroma is already low, and blurring it will lower it even more. So you have to decide for yourself whether it results in better quality.

hank315
11th October 2005, 01:23
The way HC handles chroma:
- it takes the UV planes from the source in YV12 format
- chroma is NOT upsampled during the encoding process
- it's just quantized and written in the MPEG stream

HC doesn't know if the movie is interlaced or not.
If the interlaced option is used it will do field DCT encoding for luminance blocks and set the appropriate flags.
Chroma is always frame structured in YV12 format so the type of DCT coding doesn't matter for chroma.

For interlaced frames the chroma samples do not lie exactly between the luminance samples (ISO/IEC 13818 6.1.1.8), that effect is not taken into account.