Log in

View Full Version : A function to test filters for bad pitch assumptions (exposes decomb 5.2.3 bug)


Myrsloik
30th May 2011, 20:47
What it is:
A function that generates a clip where the frames have a varying pitch.

What to do with it:
Use it as input to filters to expose bugs in that would otherwise be missed. Specifically the case where a filter assumes pitch is constant between frames.

Why:
To show that the decomb package is broken in all versions of avisynth. At first I was just trying to figure out why chroma got corrupted in avisynth 2.6 when telecide() was used after crop(), but after looking at the source I saw it both assumes pitchuv = pitchy / 2 and constant pitch between frames.
(other minor nitpicks: comes with an ancient avisynth.h which requires internal.h too, the abs() function is used on unsigned ints which newer versions of visual studio rejects, inconsistent linebreaks, broken metrics output in decimate() when cycle!=5)

Suggestions on what to use this thread for:
Naming and shaming other filters with this issue
Pointing out how stupid this post is
Fun

function TestPitchHandling(int "width", int "height", string "pixel_type", bool "destructive") {
pixel_type = Default(pixel_type, "YV12")
destructive = Default(destructive, false)
ColorBars(width, height, pixel_type=pixel_type)
destr = ScriptClip("BilinearResize( \
(Int((Width() + 1) * (2 + Sin(current_frame))) / 2) * 2, \
(Int((Height() + 1)* (2 + Sin(current_frame))) / 2) * 2).Crop(0, 0, Width(), Height())")
plain = ScriptClip("AddBorders(0, 0, \
(Int(Width() * (1 + Sin(current_frame))) / 2) * 2, \
(Int(Height() * (1 + Sin(current_frame))) / 2) * 2).Crop(0, 0, Width(), Height())")
return (destructive ? destr : plain)
}

To break Telecide() simply do:
TestPitchHandling()
Telecide()

StainlessS
12th June 2011, 19:43
Pointing out how stupid this post is


Not stupid at all.
This is a very handy little test function that should be tried
on all new filters. I experienced similar failure in ExBlend(),
(not a released version) due to cropping and interleaving,
(I think), and fetching 7 frames at once with differing pitches.
This is definitely going in my toy box.
Thankyou :)

Edit:- this is the message I get on running your torture function on Decomb v5.2.3.

"Avisynth read error:
CAVIStreamSynth: system exception - Access Violation at 0x324e784 reading from 0x6ddf140"

Guest
13th June 2011, 01:17
The script can generate a request for a dimension of size 0, so maybe it *is* stupid. :)