Log in

View Full Version : AVISynth converts DV levels to PC without notice


Dali Lama
3rd April 2004, 01:33
Hi,

I have noticed that AVISynth converts levels from an original DV file (TV levels) to PC levels without giving me an option to prevent it.

I used trevlac's Histogram filter to see the levels in virtualdub.

This occurs in both AVISource and DirectShowSource. If I open the DV file in virtualdub it is fine. However, if I process that file (like encoding) then the levels are altered too, even in Fast Recompress Mode?

I was wondering if this is supossed to happen? I am obviously trying to retain the original DV/TV levels for TV viewing.

I can upload two pics of the histograms if necessary.

Thanks,

Dali

Dali Lama
3rd April 2004, 04:19
Please excuse me,

I realized I was using the Histogram filter in 16-235 mode, which produced the incorrect results. The AVISynth ColorYUV(analyze=true) shows that the original levels is remained.

sh0dan
3rd April 2004, 10:34
AviSynth never do any conversion, but some codecs do.

Have a look here (http://forum.doom9.org/showthread.php?s=&threadid=33526).

Dali Lama
4th April 2004, 05:56
Hi Sh0dan,

Thanks for the link. I read it before, but it was good to read again.

"AviSynth never do any conversion, but some codecs do."

I definitely believe you, but under further review, I realize that something IS changing the levels.

I am using the Canopus DV Codec under FourCC "CDVC"

When I open the DV file in virtualdub directly, the levels are normal and the histogram curve is smooth. However, when I open the same file in AVISynth in AVISource or DirecShowSource the picture is darkened and the levels are changed. The histogram is also less smooth in its curve.

Now, if I encode the DV file opened directly in VirtualDub under fast recompress mode to HuffYUV using YUY2, then the levels are changed too? The same occurs with Xvid. If I use Full processing mode and select "convert to yuy2" in HuffYUV then the levels are not changed, but the histogram shows jagged edges on the curves.

I am really getting confused now :confused:

Dali

sh0dan
4th April 2004, 09:26
Canopus has a different (wrong IMO) YUV->RGB conversion, that will make all your video look hazy, when it delivers RGB material - this can be seem by opening it in vdub.

When you open the video in through AviSource it will deliver YUV material to AviSynth, with correct colors.

So when using Canopus decoder, always open through AviSynth.

Mug Funky
5th April 2004, 16:20
is there any legit reason that _all_ DV codecs screw with their material so much? is there a reference implementation that just up-and decodes the stuff? i hate having to trade off desirable and undesirable properties of different DV codecs... if you want the full range (unclamped), use pinnacle or panasonic, but these blur the picture on account of being RGB24, so you use mainconcept, but this clamps and sharpens, so use canopus, but this clamps and b0rks the chroma upsampling.... etc. etc. etc.

ffdshow is almost perfect - fast, choice of iDCT (simple works best), and doesn't do postprocessing unless you ask it nicely. but it does clamp... ah well.

kempfand
5th April 2004, 17:26
If you use the Canopus DV codec (cdvc), you can open un-clamped with :

AVISource("M:\_Temp\601.avi",true,"RGB24")

Kind regards,
Andreas

trevlac
5th April 2004, 18:45
@Dali Lama

An explanation of my histogram (and WFM) in vdub.

If you open YUV source in vdub, it must be converted to RGB. This happens in 3 ways 1) by the codec, 2) by an explecit convert in avisynth, 3) the default conversion by your OS.

The last happens if you open YUV in avisynth and your script outputs uncompressed YUV without converting.

The Luma histo and wfm really take RGB as input. So to get luma, the tool must convert back (for display purposes only). If you specify your rgb as 16-255, the luma will not be remapped. If you specify it as 0-255, it needs to be remapped. Bottom line (imho), RGB can be 0-255 or 16-235. YCbCr following 601 or 709 is 16-235.


So ... as is probably clear by now ... it all depends on how you get your YUV turned into RGB.

BTW: I believe TMPGEnc only takes RGB as input. Same process happens here as for vdub.