StainlessS
22nd February 2011, 07:43
Levels Bug ?
I assume, but could be wrong that the original Levels code used a min/max
limiting of the output, which at some later date was converted to using
PixelClip(), this in my opinion is a BUG, and certainly does not lay easy
with the original programmers intent.
I quote from the manual entry on the levels filter:-
"However, the input and output parameters can be larger than 255."
It seems to have been omitted that they could be less than zero too.
It is my assumption from the quote (that I take, to be from the original
Levels programmer), that the intent was to have no limits on either the
input nor output arguments to the levels filter, this was and is, quite a
sensible and flexible stance to take. Unfortunately, using PixelClip() has
almost completely negated the intent. As it now stands, PixelClip has a
slightly larger array (both +ve and -ve) than the normal 0-255 range to
presumably cope with slightly out of range results. BUT, as the quote above
points out, in levels, they could be deliberately far outside of the 0-255
range, much further than PixelClip was designed to 'contain'. PixelClip is
presumably designed to cope with eg rounding errors. In Levels, Arguments
outside the 0-255 range are not errors, only the eventual result should be
limited to the 0-255 range by a a simple min/max solution.
I say, put back what was I presume the original min/max limiting.
Unfortunately, there is at least one script that will fail badly if
the Levels code is amended, InPaintFunc.avs by Reuf Toc, for AVSInpaint.dll,
relies on the above problem. Reuf Toc, uses as output args 0-900,
and relies on PixelClip() out of PixelClip array, to produce all zero's
for those out of array elements. As it happens, it works quite well
as there seem to be a lot of zeros following the pixel clip array in
current versions of Avisynth, but only due to code link order.
I have a ripped out version of Levels source, only difference being that
it always outputs the LUT tables as text files (for use in comparing
Levels output with my Levels Grapher thing), and this alternate version of
the exact same code produces completely different results.
I say that PixelClip() in Levels is a BUG, put back min/max.
Perhaps I am wrong.
What Say YOU.
EDIT: the 0-900 thing in InPaintFunc.avs only affects the
postprocessing of edge of the logo.
I assume, but could be wrong that the original Levels code used a min/max
limiting of the output, which at some later date was converted to using
PixelClip(), this in my opinion is a BUG, and certainly does not lay easy
with the original programmers intent.
I quote from the manual entry on the levels filter:-
"However, the input and output parameters can be larger than 255."
It seems to have been omitted that they could be less than zero too.
It is my assumption from the quote (that I take, to be from the original
Levels programmer), that the intent was to have no limits on either the
input nor output arguments to the levels filter, this was and is, quite a
sensible and flexible stance to take. Unfortunately, using PixelClip() has
almost completely negated the intent. As it now stands, PixelClip has a
slightly larger array (both +ve and -ve) than the normal 0-255 range to
presumably cope with slightly out of range results. BUT, as the quote above
points out, in levels, they could be deliberately far outside of the 0-255
range, much further than PixelClip was designed to 'contain'. PixelClip is
presumably designed to cope with eg rounding errors. In Levels, Arguments
outside the 0-255 range are not errors, only the eventual result should be
limited to the 0-255 range by a a simple min/max solution.
I say, put back what was I presume the original min/max limiting.
Unfortunately, there is at least one script that will fail badly if
the Levels code is amended, InPaintFunc.avs by Reuf Toc, for AVSInpaint.dll,
relies on the above problem. Reuf Toc, uses as output args 0-900,
and relies on PixelClip() out of PixelClip array, to produce all zero's
for those out of array elements. As it happens, it works quite well
as there seem to be a lot of zeros following the pixel clip array in
current versions of Avisynth, but only due to code link order.
I have a ripped out version of Levels source, only difference being that
it always outputs the LUT tables as text files (for use in comparing
Levels output with my Levels Grapher thing), and this alternate version of
the exact same code produces completely different results.
I say that PixelClip() in Levels is a BUG, put back min/max.
Perhaps I am wrong.
What Say YOU.
EDIT: the 0-900 thing in InPaintFunc.avs only affects the
postprocessing of edge of the logo.