Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Capturing and Editing Video > Avisynth Usage

Reply
 
Thread Tools Search this Thread Display Modes
Old 28th May 2020, 18:31   #1  |  Link
mastrboy
Registered User
 
Join Date: Sep 2008
Posts: 304
Histogram Luma mode possible with expression (For HBD)?

I'm trying to find a alternative to Histogram("luma") that works with higher bit depts, but actually solving it might be out reach with my knowledge.

By the description, the function doesn't seem very complex:
"This mode will amplify luminance, and display very small luminance variations. This is good for detecting blocking and noise, and can be helpful at adjusting filter parameters. In this mode a 1 pixel luminance difference will show as a 16 pixel luminance pixel, thus seriously enhancing small flaws. "

I tried understanding the source code from Avisynth plus and Vapoursynth at
https://github.com/dubhater/vapoursy...ter/src/luma.c
https://github.com/AviSynth/AviSynth...ogram.cpp#L519
and then translating that into a expression than can be used in mt_lut.

Trying to do that has made me realize that I have no clue what I'm doing and I don't even know if mt_lut can do it at all.

So rather than wasting more time, anyone got a solution for this?
Or do I have have to wait for histogram to support HBD in Avisynth Plus?

Closest I got to something somewhat similear was:
mt_lut("x range_half / 16 ^ range_max *",use_expr=2).Grayscale()
Though it seems to remove most of the details instead of doing whatever histogram is doing.
__________________
(i have a tendency to drunk post)
mastrboy is offline   Reply With Quote
Old 28th May 2020, 18:52   #2  |  Link
Andouille
Registered sausage
 
Andouille's Avatar
 
Join Date: May 2012
Posts: 78
Quote:
mt_lut (expr="x 16 &u 17 x 15 &u - 1 x 15 &u + ? 14 *", u=-128, v=-128)
Something like that should be "basic" histogram with masktools and should be faster than internal Avisynth's one.
High bit depth ? I dont know...
Andouille is offline   Reply With Quote
Old 28th May 2020, 19:23   #3  |  Link
mastrboy
Registered User
 
Join Date: Sep 2008
Posts: 304
Quote:
Originally Posted by Andouille View Post
Something like that should be "basic" histogram with masktools and should be faster than internal Avisynth's one.
High bit depth ? I dont know...
Thanks, it's about 99% similar to histogram("luma") in 8 bit but way too dark in 10bit and completely black in 16bits. It's still way better than my attempt.

So next step to solve this is to make that expression work at any bit-depth if that is possible...

Edit:
Could it be possible with scaleb/scalef functions in Masktools2? (ref: http://avisynth.nl/index.php/MaskToo...nt_expressions )
__________________
(i have a tendency to drunk post)

Last edited by mastrboy; 28th May 2020 at 19:37.
mastrboy is offline   Reply With Quote
Old 29th May 2020, 00:40   #4  |  Link
SlowDelivery
Registered User
 
Join Date: Apr 2020
Posts: 17
Putting scale_inputs="allf" makes masktools2 work for HBD so
Quote:
mt_lut (expr="x 16 &u 17 x 15 &u - 1 x 15 &u + ? 14 *", u=-128, v=-128, scale_inputs="allf")
should do the trick.
SlowDelivery is offline   Reply With Quote
Old 29th May 2020, 10:29   #5  |  Link
mastrboy
Registered User
 
Join Date: Sep 2008
Posts: 304
Quote:
Originally Posted by SlowDelivery View Post
Putting scale_inputs="allf" makes masktools2 work for HBD so

should do the trick.
That works indeed.

Thanks for the assistance Andouille and SlowDelivery.
__________________
(i have a tendency to drunk post)
mastrboy is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 21:05.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, vBulletin Solutions Inc.