Log in

View Full Version : HuffYUV frame corruption - why?


FredThompson
15th June 2008, 06:07
Using this script, MPEG2 4:2:2 or HuffYUV CCESP Patch 0.2.5 source and writing a HuffYUV CCESP Patch 0.2.5 file from VirtualDub sometimes yields a corrupted frame. This happens on AMD and Intel CPUs, Tablet XP and XP Pro. Is there a problem in the script or dependent files? Is there a code slop difference between HuffYUV CCESP Patch 0.2.5 and ffdshow's implementation? The corruption will only happen on a single frame. I have not determined a set of conditions which will cause it but the same frame will corrupt on various CPUs.

DirectShowSource ("EM Unitizer PR2MFL at Converflex NTSC.avi")

LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\DeGrainMedian.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\EEDI2.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\medianblur.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\mt_masktools.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\MVTools.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\ReduceFlicker.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\ReInterpolate411.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\ReInterpolate420.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\RemoveGrainS.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\RepairS.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\SSEToolsS.dll")
Import("C:\Program Files\AviSynth 2.5\plugins\DeHalo_alpha.avs")
Import("C:\Program Files\AviSynth 2.5\plugins\LRemoveDust.avs")
Import("C:\Program Files\AviSynth 2.5\plugins\MCBob.avs")

# Reinterpolate chroma if needed

# ConvertToYUY2()
# ReInterpolate411()
# ReInterpolate420()

# Ensure file is top field first (DV is BFF)

GetParity() ? nop() : DoubleWeave().SelectOdd()

ConvertToYV12(Interlaced=True)
SeparateFields()
DeGrainMedian(limitY=2,limitUV=3,mode=3,interlaced=true)
evn=SelectEven().DeHalo_Alpha().LRemoveDust_YV12(10,1)
odd=SelectOdd().Dehalo_alpha().LRemoveDust_YV12(10,1)
Interleave(evn,odd)
weave()
GetParity() ? nop() : DoubleWeave().SelectOdd()

# Deinterlace

MCBob().SelectEven()

# Resize downwards

# BilinearResize (640,480)

# Resize Upwards

# BicubicResize (640,480)

AviSynth filters are:
DeGrainMedian.dll 0.8.1
EEDI2.dll 0.9.2
medianblur.dll 0.84
mt_masktools.dll 2.0a32
MVTools.dll 1.8.6
ReduceFlicker.dll 0.5
RemoveGrain 1.0 prerelease
MCBob 0.3c

Revgen
15th June 2008, 09:11
Don't use FFDShow's huffyuv decoder if it's set to use it.

Set Huffyuv to "disable" in both the VFW configuration and Video Decoder configuration. FFDShow always has a higher merit over the original HUFFYUV codec.

Some versions of FFDShow's decoder have screwed up in the past for me. The recent builds never gave this problem for me, but you never know what can come up.

If this doesn't work, then I don't know what else to suggest.


EDIT:

I just realized that your video is YV12. HUFFYUV CCESP doesn't support YV12.

Lagarith supports it, and the FFDShow version of HUFFYUV support it though.

FredThompson
16th June 2008, 22:46
I tried updating these filters and the problem went away:

DeGrainMedian.dll 0.8.1 to 0.8.2
mt_masktools.dll 2.0a32 to 2.0a35

The notes for mt_masktools mention some kind of green edge corruption which was fixed after version 2.0a32. Maybe that was the problem.

I also noticed my flow was setting the alpha to fully transparent when I tried to use layer() after ConvertToRGB32() in a later step.

There must have been something unexpected happening vis-a-vis the HuffYUV routines.

Thanks for your reply. I tested disabling ffdshow's HuffYUV as you suggested. The problem is gone now although the alpha channel setting was very confusing. It's easy to fix when you know the alpha status. Not so easy when the status inverts unexpectedly.