Log in

View Full Version : Compare oddity


hello_hello
2nd February 2023, 23:29
The Avisynth wiki says Compare() only supports RGB24, RGB32, YUY2 and YV12.

I couldn't find any changes in the Avisynth+ version history to indicate that had changed, but it does seem to support unsupported formats (Avisynth+ 3.7.2 on XP). For example these seem okay.

Compare(BlankClip(Pixel_Type="YV411"), BlankClip(Pixel_Type="YV411"))
Compare(BlankClip(Pixel_Type="YUV422P16"), BlankClip(Pixel_Type="YUV422P16"))

However this results an error message:


"Convert: Input chroma placement only available with 4:2:0 or 4:2:2 sources"

Compare(\
BlankClip(Pixel_Type="YV411").propSet("_ChromaLocation", 0), \
BlankClip(Pixel_Type="YV411").propSet("_ChromaLocation", 0))

Also specifying a log file seems to control whether the graph displays, while show_graph does nothing.

Compare(A, B, show_graph=false) # displays the graph
Compare(A, B, logfile="compare.log", show_graph=true) # doesn't display the graph

And while I'm here, the ColorBars/ColorBarsHD staticframes argument seems not to work.

ColorBarsHD(staticframes=true) # 1 hour video with lots of frames
ColorBarsHD(staticframes=false) # 1 hour video with lots of frames

Cheers.

wonkey_monkey
3rd February 2023, 00:15
the ColorBars/ColorBarsHD staticframes argument seems not to work.

I don't think staticframes has any effect on the visible output. It just changes whether it serves the same frame each time, or generates a new (but still identical frame) each time.

Also specifying a log file seems to control whether the graph displays, while show_graph does nothing.

The code specifically skips all drawing code if you specify a logfile, so that is a bit misleading. But show_graph = false (without logfile) works okay for me.

"Convert: Input chroma placement only available with 4:2:0 or 4:2:2 sources"

What are you viewing it with? If something is adding a ConverttoRGB32 for display, that's what's throwing the error, not Compare.

hello_hello
3rd February 2023, 06:39
I don't think staticframes has any effect on the visible output. It just changes whether it serves the same frame each time, or generates a new (but still identical frame) each time.

I thought I'd lost the plot for a minute because you're correct when viewing the ColorBars "directly", but check this out (bottom right corner).

Z = ColorBarsHD(width=960, height=540, staticframes=true, Pixel_Type="YV24")
Compare(Z, Z)
ConvertToYV12()
Trim(0,99)

ColorBars.mkv (https://files.videohelp.com/u/210984/ColorBars.mkv) (44kB)

The code specifically skips all drawing code if you specify a logfile, so that is a bit misleading. But show_graph = false (without logfile) works okay for me.

Odd. I'm still seeing the graph, although disabling it does prevent the movement in the bottom right corner.

Z = ColorBarsHD(width=960, height=540, staticframes=true, Pixel_Type="YV24")
Compare(Z, Z, show_graph=false)
ConvertToYV12()
Trim(0,99)

"Convert: Input chroma placement only available with 4:2:0 or 4:2:2 sources"
What are you viewing it with? If something is adding a ConverttoRGB32 for display, that's what's throwing the error, not Compare.

I was opening the script with MPC-HC, although I did have a ConvertToRGB at the end of it.

You're probably correct as this produces the same error.

BlankClip(Pixel_Type="YV411")
propSet("_ChromaLocation", 0)
ConvertToRGB32()
PropShow()

And now I've looked at it, ConvertToYV11 has no ChromaOutPlacement, so I assume YV411 has a fixed chroma location?

For Y8 there's no error though when doing the same thing, despite the complete lack of chroma.

BlankClip(Pixel_Type="Y8")
propSet("_ChromaLocation", 0)
ConvertToRGB32()
PropShow()
killAudio()

RGB doesn't seem bothered by an erroneous _ChromaLocation, as long as it's not present when converting from YV411. Moving propShow's location in the script indicates that after a conversion from YUV to RGB, the _ChromaLocation frame property is deleted, but a _ChromaLocation when converting between RGB formats isn't.

BlankClip(Pixel_Type="YV24")
propSet("_ChromaLocation", 3)
ConvertToRGB64()
propSet("_ChromaLocation", 4)
ConvertToRGB32()
PropShow()

wonkey_monkey
3rd February 2023, 18:31
but check this out (bottom right corner).

I'm not sure what you mean by "but". That's working as expected - ColorBarsHD is passing the same frame each time to Compare, which then makes it writeable (which in this case means making a copy in memory; if staticframes=false, then AviSynth will allow it to draw directly on the passed frame without copying) and draws the graph on it.