Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lut HBD scale and frame properties #20

Open
realfinder opened this issue Sep 22, 2021 · 11 comments
Open

lut HBD scale and frame properties #20

realfinder opened this issue Sep 22, 2021 · 11 comments

Comments

@realfinder
Copy link

realfinder commented Sep 22, 2021

I was think about FrameProperties-aware additions

"intp"
"floatp"
"allp"

to scale_inputs, they will use _ColorRange if available, else they will act as "int", "float" and "all" for YUV

also for scale operators, scalep that can act like scalef or scaleb dependence on _ColorRange if available, if not available then it will be scaleb for YUV and scalef for RGB

same thing for avs+ expr

@pinterf
Copy link
Owner

pinterf commented Sep 23, 2021

First Avisynth core itself must read and write proper frame properties. I won't do it until this task is done. And only then I consider it, though you know my opinion about putting another special hacks into the expr "language", ehhh. Ugly.

@realfinder
Copy link
Author

I know but I don't see them as hack rather than features, anyway it's kinda update to existing "hacks" :) also I think many plugins can do proper frame properties these days especially if there are not much internal filters used

btw https://github.com/AkarinVS/vapoursynth-plugin can read frame properties in expr, is it considered as hack too?

@pinterf
Copy link
Owner

pinterf commented Sep 23, 2021

Not a hack. I know it and considered implementing it. But frame properties - as the name says - are per frame data. Expr is precompiled on clip level, once. Scaleb or scalef? They and the others are already known at compile time, percalculated and optimized away when they are after constants, it all happens before frame processing. So all frameprop related data or decision must be dynamic and evaluated frame by frame at runtime. Conceptional difference. More on that later

@realfinder
Copy link
Author

realfinder commented Sep 23, 2021

Expr is precompiled on clip level, once. Scaleb or scalef? They and the others are already known at compile time, percalculated and optimized away when they are after constants, it all happens before frame processing. So all frameprop related data or decision must be dynamic and evaluated frame by frame at runtime. Conceptional difference. More on that later

yes, I was think about that, I think the lut need to be doubled in case of scalep, one for "tv range" and another for "pc range", but for avs+ expr things different I think

btw, a bit off topic but if we have not-float YUV or RGB clip that have one Expression and all 3 planes need to be processed (all them use one Expression), it will have 1 lut (optimized) or 3 luts (not optimized)?

@pinterf
Copy link
Owner

pinterf commented Sep 23, 2021

One lut is calculated when no new expression is given. Historically this was the case for xy and xyz and with the latest release for 1d lut as well.

@pinterf
Copy link
Owner

pinterf commented Sep 24, 2021

Pls check a new Avisynth build (see doom9) with experimental frameprop reader syntax. Thx for the motivation

@realfinder
Copy link
Author

thanks! it seems work fine

d2vSource("001_Video01.d2v")
propShow
expr("x._QuantsAverage 5 > 128 x ?","","")

this can used for adaptive deblocking or another things

@pinterf
Copy link
Owner

pinterf commented Sep 24, 2021

Your welcome. I have to cleanup the source and make proper commits but I think only next week. Until then comments are welcome.

@realfinder
Copy link
Author

realfinder commented Sep 24, 2021

but

Nonexistent or non-number frame properties return with 0.0 value

isn't better to make it -1 or -2 (for more safety, or better -1 for non-number and -2 for Nonexistent) to distinguish between zero property (most of http://avisynth.nl/index.php/Internal_functions#Functions_for_frame_properties have it) and Nonexistent/non-number one?

btw, I think frameprop reader in mt_lut* is impossible (unless with realtime=true), right? so this discussion is off topic maybe

@pinterf
Copy link
Owner

pinterf commented Sep 24, 2021

I'm trying not to differ too much from VS version. Choosing any number is not a good choice either. Maybe a "defined" or "default" option would help while keep things still generic. Nor did I implement array-type frame property access yet which should be done as well for the sake of completeness.

@pinterf
Copy link
Owner

pinterf commented Sep 24, 2021

mt_lut w/ frameprops. Yes, only realtime. But it is then not a lut any more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants