Frame properties support for Avisynth+

Support forum for DGDecNV
DAE avatar
Guest 2
Posts: 903
Joined: Mon Sep 20, 2010 2:18 pm

Frame properties support for Avisynth+

Post by Guest 2 »

Do you plan to introduce frame property support as per the newest builds of AVS+?
User avatar
Rocky
Posts: 3557
Joined: Fri Sep 06, 2019 12:57 pm

Feature Requests

Post by Rocky »

Yes.
DAE avatar
Guest 2
Posts: 903
Joined: Mon Sep 20, 2010 2:18 pm

Feature Requests

Post by Guest 2 »

Rocky wrote:
Tue Oct 19, 2021 10:20 am
Yes.
/me happy :D
User avatar
Rocky
Posts: 3557
Joined: Fri Sep 06, 2019 12:57 pm

Feature Requests

Post by Rocky »

Please tell me the list of properties in priority of importance for you.
DAE avatar
Boulder
Posts: 113
Joined: Fri Jul 29, 2011 7:22 am

Feature Requests

Post by Boulder »

I think these ones would be generally very useful in any resampling function.

_ChromaLocation
_Primaries
_Transfer
_Matrix

Maybe _ColorRange too even though any regular release should be 'limited'.
User avatar
Rocky
Posts: 3557
Joined: Fri Sep 06, 2019 12:57 pm

Feature Requests

Post by Rocky »

Thank you, Boulder!
User avatar
Rocky
Posts: 3557
Joined: Fri Sep 06, 2019 12:57 pm

Feature Requests

Post by Rocky »

Things are working for DGSource(). There is a problem with _ChromaLocation, however. Seems that CUVID does not return the VUI info we need. Still checking but may have to add manual parsing for that. Not a big deal having already done manual parsing for linux dgdecnv. Let's first add properties passthru to the bundled filters.
User avatar
Rocky
Posts: 3557
Joined: Fri Sep 06, 2019 12:57 pm

Feature Requests

Post by Rocky »

Do any of you fine gentlepeople have a sample with a chroma location other than left (0) for a BT709 stream? It would be great to get both AVC and HEVC. I need them to test my implementation for _ChromaLocation. I know that BT2020 uses topleft (2) so need to give one of those. Thank you.
User avatar
Rocky
Posts: 3557
Joined: Fri Sep 06, 2019 12:57 pm

Frame properties support for Avisynth+

Post by Rocky »

Released as build 236.

Example:

DGSource("file.dgi")
propShow()

or

DGSource("file.dgi")
DGDenoise()
DGSharpen()
propShow()
DAE avatar
renols
Posts: 149
Joined: Tue Feb 22, 2011 2:34 am

Frame properties support for Avisynth+

Post by renols »

Rocky wrote:
Sat Oct 30, 2021 10:42 am
Released as build 236.

Example:

DGSource("file.dgi")
propShow()

or

DGSource("file.dgi")
DGDenoise()
DGSharpen()
propShow()
Will 236 still work with "older " avisynth+ versions?

Am using avisynth+ r2772 and have no real need to update, since it works fine.

renols
User avatar
Rocky
Posts: 3557
Joined: Fri Sep 06, 2019 12:57 pm

Frame properties support for Avisynth+

Post by Rocky »

Hello renols! Should be OK, but you tell me. ;)

We check for interface version 8 or greater. If that is the case, only then will the frame properties be populated.
DAE avatar
renols
Posts: 149
Joined: Tue Feb 22, 2011 2:34 am

Frame properties support for Avisynth+

Post by renols »

Ok.

Guess I will test it then.

Just tested avisynth 3.70 compared to the r2772 with avsmeter 390.

With a 4k source 3.70 is about 4% slower than r2772 (with the same avs file). I know that for 4k, CPU is the bottleneck, but why upgrade to something that is slower than what one is currently using :-)

Since r2772 is interface version 6, I guess it should be fine.

Anyone who can maybe enlighten me on what I would use the frame properties info for in a practical workflow?
DAE avatar
Boulder
Posts: 113
Joined: Fri Jul 29, 2011 7:22 am

Frame properties support for Avisynth+

Post by Boulder »

renols wrote:
Sun Oct 31, 2021 2:07 pm
Ok.

Guess I will test it then.

Just tested avisynth 3.70 compared to the r2772 with avsmeter 390.

With a 4k source 3.70 is about 4% slower than r2772 (with the same avs file). I know that for 4k, CPU is the bottleneck, but why upgrade to something that is slower than what one is currently using :-)

Since r2772 is interface version 6, I guess it should be fine.

Anyone who can maybe enlighten me on what I would use the frame properties info for in a practical workflow?
There are quite a lot of fixes in the 3.x branch, so it's very highly recommended to upgrade from such an old version. The biggest changes are in caching and multithreading, I think. SetCacheMode(1) should minimize the amount of memory needed and also provide the best possible performance. Prefetch has two arguments, threads and frames. I have a 12-core 3900X and I've discovered that Prefetch(threads=24, frames=12) works best with my base script. I also use SetMemoryMax(20480) to allow 4K video to use as much memory as needed, usually around 10-12 GB.

The frame properties are useful in resampling situations, i.e. where you change the colorspace before resizing. For example, I now have this kind of a function which does the resizing part with a bit clunky deduction logic and with the frame properties, I can make it foolproof :)

Code: Select all

function Resizer(clip clp, int "width", int "height", float "b", float "c", bool "hdr", bool "i", bool "spline", int "color", bool "debug") {

b = default(b, 0)
c = default(c, 0)
hdr = default(hdr, clp.width() > 1920 ? true : false)
i = default(i, false)
spline = default(spline, b == 0 && c == 0 ? true : false)
color = default(color, hdr ? 1 : clp.width() > 720 ? 2 : clp.framerate() == 25 || clp.framerate() == 50 ? 4 : 3)
cs_in = color == 1 ? "2020ncl:st2084=>rgb:linear" : color == 2 ? "709:709:709:limited=>rgb:linear:709:full" : color == 3 ? "470bg:601:170m:limited=>rgb:linear:170m:full" : "470bg:601:170m:limited=>rgb:linear:170m:full"
cs_out = color == 1 ? "rgb:linear=>2020ncl:st2084" : color == 2 ? "rgb:linear:709:full=>709:709:709:limited" : color == 3 ? "rgb:linear:170m:full=>470bg:601:170m:limited" : "rgb:linear:170m:full=>470bg:601:170m:limited"
debug = default(debug, false)

result = clp.z_ConvertFormat(pixel_type="RGBPS", chromaloc_op="auto=>same", colorspace_op=cs_in, approximate_gamma=true, cpu_type="AVX2")
result = !spline ? result.z_ConvertFormat(width, height, chromaloc_op="auto=>same", colorspace_op="auto=>same", resample_filter="Bicubic", resample_filter_uv="Bicubic", filter_param_a=b, filter_param_b=c, approximate_gamma=true, cpu_type="AVX2") : result.z_ConvertFormat(width, height, chromaloc_op="auto=>same", colorspace_op="auto=>same", resample_filter="Bicubic", resample_filter_uv="Bicubic", filter_param_a=0, filter_param_b=0.6, approximate_gamma=true, cpu_type="AVX2")
result = result.z_ConvertFormat(pixel_type="YUV420P16", chromaloc_op="auto=>same", colorspace_op=cs_out, approximate_gamma=true, cpu_type="AVX2")

result = i ? (width == 1920 || width == 3840 || (width == 1280 && (clp.framerate() == 25 || clp.framerate == 50))) ? interleave(clp, result.Lanczos4Resize(clp.width(), clp.height()).Subtitle("Lanczos4")) : interleave(clp, result.BicubicResize(clp.width(), clp.height(), b=0, c=0.5).Subtitle("Bicubic neutral")) : result
result = debug ? result.subtitle("hdr: " + string(hdr), x=0, y=0).subtitle("color: " + string(color), x=0, y=20).subtitle("cs_in: " + string(cs_in), x=0, y=40).subtitle("cs_out: " + string(cs_out), x=0, y=60) : result

return result
}
User avatar
Rocky
Posts: 3557
Joined: Fri Sep 06, 2019 12:57 pm

Frame properties support for Avisynth+

Post by Rocky »

Too many fermented grapes for a Sunday Halloween afternoon. I'll get back to y'all on this. Sherman told me that DG 236 is fine with AVS+ 2772. Don't upgrade AVS+ if you don't want to. We aim to please. Burp. :oops:

DG started the fall/winter feeding protocol for the birds and squirrels this morning. They seem very happy. I know all their hiding places!
DAE avatar
renols
Posts: 149
Joined: Tue Feb 22, 2011 2:34 am

Frame properties support for Avisynth+

Post by renols »

Thanks for info.

Never had any issues with r2772, but I also just use 3-4 lines in my avs files.

DGSource
ConvertBits(10) (only for 4k)
crop
Spline36Resize (if needed)

Most of the time I don't use SetFilterMTMode or Prefetch, since with the few lines I have in my avs file, I find that it slows my fps down. And sometimes quite significantly. I actually only use them in cases where I have to use deinterlace filters, in which case they help quite a bit.

If I have no real gain to use 3.70 in my workflow, which seems to be quite different than your complicated avs file, I will stick with r2772 :-)

If it works, don't fix it :-)

renols
User avatar
Curly
Posts: 712
Joined: Sun Mar 15, 2020 11:05 am

Frame properties support for Avisynth+

Post by Curly »

renols wrote:
Sun Oct 31, 2021 2:56 pm
If it works, don't fix it :-)
Fer shure, and anyway thinking hurts.

Happy Halloween everyone! :twisted: :cry: :wow:
User avatar
DG
Posts: 88
Joined: Thu Dec 31, 2020 9:55 am

Frame properties support for Avisynth+

Post by DG »

Yes indeed, Happy Halloween!
User avatar
Natasha
Posts: 150
Joined: Wed Nov 20, 2019 11:11 am

Frame properties support for Avisynth+

Post by Natasha »

Happy Halloween!
User avatar
Boris
Posts: 92
Joined: Sun Nov 10, 2019 2:55 pm

Frame properties support for Avisynth+

Post by Boris »

Image
User avatar
Natasha
Posts: 150
Joined: Wed Nov 20, 2019 11:11 am

Frame properties support for Avisynth+

Post by Natasha »

Knocked on DG's door and all he had was boiled eggs and carrots. Loser!
User avatar
Sherman
Posts: 576
Joined: Mon Jan 06, 2020 10:19 pm

Frame properties support for Avisynth+

Post by Sherman »

That was just for you. I got snickers, reeses pieces, and milky ways. Eat your heart out!
User avatar
Natasha
Posts: 150
Joined: Wed Nov 20, 2019 11:11 am

Frame properties support for Avisynth+

Post by Natasha »

Eat your heart out!
Umm, no. But yours? Delicious.

Image
User avatar
new_guy
Posts: 59
Joined: Fri Jan 15, 2021 11:12 am

Frame properties support for Avisynth+

Post by new_guy »

There is something terribly wrong with you people.

Happy Halloween!
User avatar
Rocky
Posts: 3557
Joined: Fri Sep 06, 2019 12:57 pm

Frame properties support for Avisynth+

Post by Rocky »

Little goblins have started ringing my bell! Not sure if they are more scared of me than I am of them. Can you imagine knocking on a door and being greeted by a squirrel!? :lol:
User avatar
Bullwinkle
Posts: 338
Joined: Thu Sep 05, 2019 6:37 pm

Frame properties support for Avisynth+

Post by Bullwinkle »

How about a moose? Snort!
Post Reply