Log in

View Full Version : Color Space Conversion during capture- what is lost?


Kalicrys
15th April 2004, 15:38
I wonder how much is lost?
If anybody has done some tests on this matter, I would love to hear the results.

Capturing an NTSC stream at 720x480 uyvy 29.97fps and huffyuv,
I get approximately 10-15% reduction of file size by converting to RGB and then back to YUY2. So how much information am I losing?

trevlac
15th April 2004, 16:20
Hard to say ...

I'm not clear on what you are comparing ....

Capture YUV -vs-

1) Capture RGB converted to YUV by Huffy
2) Capture YUV converted to RGB then to YUV

Anyway .... The bigest loss is when the conversion from YUV->RGB changes the range and clamps. YUV has headroom and footroom. PC RGB does not. Loss depends on what does the conversion and how. Huffy YUV->RGB changes the range. If your source has too high a gain, you will be in the headroom.

If there is not a range change, the conversion from YUV->RGB and back is subject to rounding errors mainly in the UV components. If this is done with reasonably accuracy and the same/reverse equations are used to go back, I believe the loss is minimal.

The big question to you is do you see a difference? Don't get stuck on this as a big evil. :devil: There are good things and bad things about both color spaces. When done the right way, the effect of a single conversion and back is a blip in what your video goes thru on it's way back out to your viewing device.

BTW: Generally speaking, YUV 4:2:2 is the best colorspace/subsampling for analog capture. YUY2 for example. :)

Kalicrys
16th April 2004, 14:20
Thanks trevlac
Actually I was speaking of case 2.

I tried using avisync's ConvertTo functions,
and full processing mode in vdub + huffyuv set to convert RGB to YUV before compressing.
The results are exactly the same.


I just tried using Subtract() in avisynth to see the difference,
and I can see the difference in vivid colors.
I was thinking in terms of;
a) YUV->RGB, smaller colorspace to larger colorspace conversion doesn't use colors that are not in YUV, no information to be lost in RGB->YUV (assuming proper YUV->RGB conversion, range adjustment etc...)
b) IxI^-1 = 1

But thinking about it the rounding errors do sound problematic, given the limit of floating point precision in computers.

However I really wasn't able to tell the difference by plain eye, due to the complexity of the scene. Maybe I'll check something with larger areas of solid color and see if I can notice any color shift.
If not this seems like an unobtrusive way of increasing compressibility, minimal though it may be, that will not create artifacts like smoothing filters.