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
Register FAQ Calendar Today's Posts Search

Reply
 
Thread Tools Search this Thread Display Modes
Old 1st April 2020, 18:10   #381  |  Link
tormento
Acid fr0g
 
tormento's Avatar
 
Join Date: May 2002
Location: Italy
Posts: 2,582
Quote:
Originally Posted by FranceBB View Post
I'll wait for real.finder to comment, though, as perhaps my SMDegrain version is old and there's a new one which supports 16bit planar... I don't know...
Thanks for your help. I doubt we can mix n16 with lsb
__________________
@turment on Telegram
tormento is offline   Reply With Quote
Old 1st April 2020, 23:06   #382  |  Link
real.finder
Registered User
 
Join Date: Jan 2012
Location: Mesopotamia
Posts: 2,587
Quote:
Originally Posted by tormento View Post
@real.finder

I asked a similar question, some time ago, but this is bit different.

Hi have a Hi10P source (unfortunately x264 and so no hw decode support). My idea was to use a script like this:

Code:
SetMemoryMax(8000)
SetFilterMTMode("DEFAULT_MT_MODE", 2)
LoadPlugin("D:\eseguibili\media\MeGUI_x64\tools\lsmash\LSMASHSource.dll")
LoadPlugin("D:\eseguibili\media\MeGUI_x64\tools\avs\plugins\ConvertStacked.dll")
LWLibavVideoSource("E:\in\1_31 Tokyo godfathers\godfathers.lwi", format="YUV420P8")

SMDegrain (tr=4, thSAD=500, refinemotion=false, n16=true, mode=0, contrasharp=false, PreFilter=4, truemotion=false, plane=4, chroma=true)

Prefetch(6)
Instead of YUV420P8 space, I'd like to use YUV420P10 and let SMDegrain deal with better color space and final conversion to 8 bit. Is there any change I have to do to the script or SMDegrain parameters to feed it with 10 bit or higher bit material? As I told, I need 8 bit as output.

Thanks
just remove those with red color, and add convertbits(8,dither=0) or with dither=1 for Floyd-Steinberg before Prefetch(6)

Quote:
Originally Posted by FranceBB View Post
I don't know if there have been any updates for SMDegrain (i.e if it supports 16bit planar as well), but it definitely supports 16bit stacked, therefore (assuming you have Avisynth+):

Code:
#Indexing with 16bit planar output from 10bit planar source
LWLibavVideoSource("E:\in\1_31 Tokyo godfathers\godfathers.lwi", format="YUV420P16")

#From 16bit planar to 16bit stacked
ConverttoStacked()

#Denoise with high bit depth precision: 16bit stacked input, 8bit planar output with dither (Floyd-Steinberg error diffusion)
SMDegrain (tr=4, thSAD=500, refinemotion=false, n16=true, contrasharp=false, PreFilter=4, truemotion=false, plane=4, chroma=true, lsb_in=true, lsb_out=false, mode=6)
And that's it...
The changes I made to your parameters are:
lsb_in=true to tell SMDegrain "Hey, you're gonna get 16bit stacked input with MSB, LSB stacked one on the top of the other, not a weird aspect ratio yv12 8bit source, so deal with it properly!!"
lsb_out=false to tell SMDegrain "Hey, don't you dare outputting 16bit stacked with psychedelic garbage on the bottom, I want a nice clean regular 8bit planar as an output!"
mode=6 to tell SMDegrain to use DitherPost to dither down to 8bit the output in a proper way. There are 8 modes that you can use for dithering, but I generally use the Floyd-Steinberg Error Diffusion as it's somewhat a good compromise.
Anyway, feel free to use a different mode if you like:

-1 no dither, round to the closest value
0 8-bit ordered dither + noise.
1 1-bit dither
2 2-bit dither, light
3 2-bit dither, medium
4 2-bit dither, strong
5 2-bit dither, stronger
6 Serpentine Floyd-Steinberg error diffusion.
7 Stucki error diffusion.
8 Atkinson error diffusion.



I'll wait for real.finder to comment, though, as perhaps my SMDegrain version is old and there's a new one which supports 16bit planar... I don't know...
SMDegrain support HBD as input=output since years but not for all settings

as for now only MedianBlur2 missed the HBD, if it have HBD then SMDegrain will fully support HBD as input=output for all settings (still there are some mvtools2 functions not work with float clip)
__________________
See My Avisynth Stuff

Last edited by real.finder; 1st April 2020 at 23:15.
real.finder is offline   Reply With Quote
Old 1st April 2020, 23:21   #383  |  Link
tormento
Acid fr0g
 
tormento's Avatar
 
Join Date: May 2002
Location: Italy
Posts: 2,582
Quote:
Originally Posted by real.finder View Post
as for now only MedianBlur2 missed the HBD, if it have HBD then SMDegrain will fully support HBD as input=output for all settings (still there are some mvtools2 functions not work with float clip)
SMDegrain with variable bit in and out would be a dream. It’s still early for me to deal with 4K HDR material as I don’t own the proper hardware but I am thinking that, one day, I will have to denoise it too.

Real.Finder, do you have a roadmap?
__________________
@turment on Telegram
tormento is offline   Reply With Quote
Old 1st April 2020, 23:27   #384  |  Link
real.finder
Registered User
 
Join Date: Jan 2012
Location: Mesopotamia
Posts: 2,587
Quote:
Originally Posted by tormento View Post
SMDegrain with variable bit in and out would be a dream. It’s still early for me to deal with 4K HDR material as I don’t own the proper hardware but I am thinking that, one day, I will have to denoise it too.

Real.Finder, do you have a roadmap?
MedianBlur2 is dll plugin so no, I asked days ago in avs+ Thread for add HBD and no one but pinterf volunteered to do it but I think he busy with another things in avs+ core
__________________
See My Avisynth Stuff
real.finder is offline   Reply With Quote
Old 1st April 2020, 23:29   #385  |  Link
tormento
Acid fr0g
 
tormento's Avatar
 
Join Date: May 2002
Location: Italy
Posts: 2,582
Quote:
Originally Posted by real.finder View Post
MedianBlur2 is dll plugin so no, I asked days ago in avs+ for add HBD and no one but pinterf volunteered to do it but I think he busy with another things in avs+ core


Thanks, anyway
__________________
@turment on Telegram
tormento is offline   Reply With Quote
Old 2nd April 2020, 09:00   #386  |  Link
real.finder
Registered User
 
Join Date: Jan 2012
Location: Mesopotamia
Posts: 2,587
Quote:
Originally Posted by tormento View Post
Thanks, anyway
I see pinterf update MedianBlur2 githup for HBD so it's a good thing

anyway, aside from that, I maybe will be nice with 4:4:4 fans like dREV (cuz there is a friend who use these things 720 444 from 1080 420), but will not update Gradfun3mod, Instead there will be another new function that did what Gradfun3mod (maybe base on it) but with no deband
__________________
See My Avisynth Stuff

Last edited by real.finder; 2nd April 2020 at 09:03.
real.finder is offline   Reply With Quote
Old 2nd April 2020, 09:07   #387  |  Link
tormento
Acid fr0g
 
tormento's Avatar
 
Join Date: May 2002
Location: Italy
Posts: 2,582
Quote:
Originally Posted by real.finder View Post
I see pinterf update MedianBlur2 githup for HBD so it's a good thing
/me happy

Waiting for variable bit depth SMDegrain!
__________________
@turment on Telegram
tormento is offline   Reply With Quote
Old 2nd April 2020, 10:58   #388  |  Link
tormento
Acid fr0g
 
tormento's Avatar
 
Join Date: May 2002
Location: Italy
Posts: 2,582
Quote:
Originally Posted by real.finder View Post
just remove those with red color
LWLibavVideoSource("E:\in\1_31 Tokyo godfathers\godfathers.lwi")
error: KNLMeansCL: INT10 require 'channels = YUV'!

LWLibavVideoSource("E:\in\1_31 Tokyo godfathers\godfathers.lwi", format="YUV420P10")
error: KNLMeansCL: INT10 require 'channels = YUV'!

LWLibavVideoSource("E:\in\1_31 Tokyo godfathers\godfathers.lwi", format="YUV420P16")
Working and I got 4,86 fps instead of 6,71 fps on 8 bit chain.
__________________
@turment on Telegram
tormento is offline   Reply With Quote
Old 2nd April 2020, 11:42   #389  |  Link
real.finder
Registered User
 
Join Date: Jan 2012
Location: Mesopotamia
Posts: 2,587
Quote:
Originally Posted by tormento View Post
LWLibavVideoSource("E:\in\1_31 Tokyo godfathers\godfathers.lwi")
error: KNLMeansCL: INT10 require 'channels = YUV'!

LWLibavVideoSource("E:\in\1_31 Tokyo godfathers\godfathers.lwi", format="YUV420P10")
error: KNLMeansCL: INT10 require 'channels = YUV'!

LWLibavVideoSource("E:\in\1_31 Tokyo godfathers\godfathers.lwi", format="YUV420P16")
Working
KNLMeansCL has problems with 10 bit clip https://github.com/Khanattila/KNLMea...ment-469839637

Quote:
and I got 4,86 fps instead of 6,71 fps on 8 bit chain.
Thank God it's not half speed of the 8-bit

yes, more than 8 bit will be slower indeed
__________________
See My Avisynth Stuff
real.finder is offline   Reply With Quote
Old 2nd April 2020, 11:45   #390  |  Link
tormento
Acid fr0g
 
tormento's Avatar
 
Join Date: May 2002
Location: Italy
Posts: 2,582
Quote:
Originally Posted by real.finder View Post
KNLMeansCL has problems with 10 bit clip https://github.com/Khanattila/KNLMea...ment-469839637
I saw there is a workaround setting YUV, is it possible to create a script variant for that specific case, as all the H.265 HDR material out there is 10 bit?
__________________
@turment on Telegram
tormento is offline   Reply With Quote
Old 2nd April 2020, 11:50   #391  |  Link
real.finder
Registered User
 
Join Date: Jan 2012
Location: Mesopotamia
Posts: 2,587
Quote:
Originally Posted by tormento View Post
I saw there is a workaround setting YUV, is it possible to create a script variant for that specific case, as all the H.265 HDR material out there is 10 bit?
YUV in KNLMeansCL need 4:4:4 chroma, if your source is 444 then it should work with 10 bit, but in your case (4:2:0) 16 bit is better since going from 420 to 444 is not recommended
__________________
See My Avisynth Stuff
real.finder is offline   Reply With Quote
Old 2nd April 2020, 11:54   #392  |  Link
tormento
Acid fr0g
 
tormento's Avatar
 
Join Date: May 2002
Location: Italy
Posts: 2,582
Quote:
Originally Posted by real.finder View Post
YUV in KNLMeansCL need 4:4:4 chroma, if your source is 444 then it should work with 10 bit, but in your case (4:2:0) 16 bit is better since going from 420 to 444 is not recommended
Thanks man!

So if the source is 444, SMDegrain should work?
__________________
@turment on Telegram
tormento is offline   Reply With Quote
Old 2nd April 2020, 11:55   #393  |  Link
real.finder
Registered User
 
Join Date: Jan 2012
Location: Mesopotamia
Posts: 2,587
Quote:
Originally Posted by tormento View Post
Thanks man!

So if the source is 444, SMDegrain should work?
yes
__________________
See My Avisynth Stuff
real.finder is offline   Reply With Quote
Old 2nd April 2020, 15:04   #394  |  Link
tormento
Acid fr0g
 
tormento's Avatar
 
Join Date: May 2002
Location: Italy
Posts: 2,582
Quote:
Originally Posted by real.finder View Post
YUV in KNLMeansCL need 4:4:4 chroma, if your source is 444 then it should work with 10 bit, but in your case (4:2:0) 16 bit is better since going from 420 to 444 is not recommended
Just a question arise to my mind: Hi10P is 10 bit. You tell me to use 16 bit BUT at the end I have to dither to go back to 10 bit again to encode as proper format. Isn't better to find a way to stay in 10 bit with no dithering at the end?
__________________
@turment on Telegram
tormento is offline   Reply With Quote
Old 2nd April 2020, 15:13   #395  |  Link
real.finder
Registered User
 
Join Date: Jan 2012
Location: Mesopotamia
Posts: 2,587
Quote:
Originally Posted by tormento View Post
Just a question arise to my mind: Hi10P is 10 bit. You tell me to use 16 bit BUT at the end I have to dither to go back to 10 bit again to encode as proper format. Isn't better to find a way to stay in 10 bit with no dithering at the end?
more bits = better

anyway you can chose another prefilter other than 4 or ask KNLMeansCL developer to make it work with grayscale in any bit depth (seems he only against 420 with 10 bit which is not being used in SMDegrain)
__________________
See My Avisynth Stuff
real.finder is offline   Reply With Quote
Old 2nd April 2020, 16:30   #396  |  Link
tormento
Acid fr0g
 
tormento's Avatar
 
Join Date: May 2002
Location: Italy
Posts: 2,582
Quote:
Originally Posted by real.finder View Post
more bits = better
Yes unless the standard for UHD is 10bit and you need to dither at the end

That's why I was asking for a solution to have 10 bit chain
__________________
@turment on Telegram
tormento is offline   Reply With Quote
Old 4th April 2020, 08:49   #397  |  Link
tormento
Acid fr0g
 
tormento's Avatar
 
Join Date: May 2002
Location: Italy
Posts: 2,582
@real.finder

Would you mind consider implementing DGDenoise() as additional prefilter? It is FAST (CUDA) and gives good results.
__________________
@turment on Telegram
tormento is offline   Reply With Quote
Old 4th April 2020, 09:18   #398  |  Link
ChaosKing
Registered User
 
Join Date: Dec 2005
Location: Germany
Posts: 1,795
Quote:
Originally Posted by tormento View Post
@real.finder

Would you mind consider implementing DGDenoise() as additional prefilter? It is FAST (CUDA) and gives good results.
prefilter also accepts a clip as input.
__________________
AVSRepoGUI // VSRepoGUI - Package Manager for AviSynth // VapourSynth
VapourSynth Portable FATPACK || VapourSynth Database
ChaosKing is offline   Reply With Quote
Old 4th April 2020, 09:22   #399  |  Link
tormento
Acid fr0g
 
tormento's Avatar
 
Join Date: May 2002
Location: Italy
Posts: 2,582
Quote:
Originally Posted by ChaosKing View Post
prefilter also accepts a clip as input.
I do know but if you look at the avsi, you will notice that even KNLMeansCL needs script processing to do the job correctly.
__________________
@turment on Telegram
tormento is offline   Reply With Quote
Old 4th April 2020, 09:29   #400  |  Link
real.finder
Registered User
 
Join Date: Jan 2012
Location: Mesopotamia
Posts: 2,587
Quote:
Originally Posted by tormento View Post
@real.finder

Would you mind consider implementing DGDenoise() as additional prefilter? It is FAST (CUDA) and gives good results.
I don't has CUDA

anyway as ChaosKing said, you can always feed any clip in prefilter
__________________
See My Avisynth Stuff
real.finder is offline   Reply With Quote
Reply

Tags
avisynth, avs script, avs+, banding, generator, hbd, mod


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 23:06.


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