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 Development

Reply
 
Thread Tools Search this Thread Display Modes
Old 1st June 2018, 10:01   #521  |  Link
jpsdr
Registered User
 
Join Date: Oct 2002
Location: France
Posts: 1,702
New version, see first post.
__________________
My github.
jpsdr is offline   Reply With Quote
Old 20th May 2019, 15:41   #522  |  Link
LouieChuckyMerry
Registered User
 
LouieChuckyMerry's Avatar
 
Join Date: Feb 2014
Posts: 306
Hello, and thank you jpsdr for your hard work . I'm preparing to upscale my PAL Futurama DVD's to 960x720 and found this:

Code:
### Resize ###
NNEDI3_RPow2(RFactor=2,CShift="Spline64Resize",FWidth=960,FHeight=720)
aWarpSharp2(Depth=5)
Sharpen(0.2)
to do a very nice job. I'm having some trouble, though, fitting this into my 16-bit pipeline and was hoping you could help. Here's the part of the script that's causing trouble:

Code:
### Overall Temporal Denoise ###
SMDegrain(TR=2,ThSAD=200,ContraSharp=True,RefineMotion=True,Plane=0,PreFilter=2,Chroma=False,LSB=True,LSB_Out=True)### Resize ###
NNEDI3_RPow2(RFactor=2,CShift="Spline64Resize",FWidth=960,FHeight=720)
aWarpSharp2(Depth=5)
Sharpen(0.2)
This outputs video with a resolution of 960x360 and for the life of me I can't figure out why. SMDegrain is sending 16-bits to NNEDI3, which I know from reading the thread should be OK. Please, do you have any ideas? Thanks for your time.

Edit: I just noticed that this thread hasn't seen action in almost a year; however, if anyone can answer my question I'd be very appreciative.

Last edited by LouieChuckyMerry; 20th May 2019 at 15:42. Reason: Date
LouieChuckyMerry is offline   Reply With Quote
Old 20th May 2019, 17:07   #523  |  Link
gonca
Registered User
 
Join Date: Jul 2012
Location: Scarborough, Canada
Posts: 895
Your source filter might be stacking in order to give you a 16 bit pipeline.
At conclusion of workflow when the "8 over 8" is undone you get half height resolution
Try a quick sample with resize of 960 x 1440 or get a better source filter if possible
gonca is offline   Reply With Quote
Old 20th May 2019, 19:26   #524  |  Link
LouieChuckyMerry
Registered User
 
LouieChuckyMerry's Avatar
 
Join Date: Feb 2014
Posts: 306
Thanks for your reply, gonca. My source filter is DGIndexNV for the .m2v video. I know that SMDegrain stacks the video then sends stacked 16-bit to NNEDI3, but it seems NNEDI3 isn't happy about this. I'm using the latest AviSynth+. Let me try a quick resize... That actually worked, but is it the correct way or is there some AviSynth+ syntax I'm missing?

Edit: I indexed with LSMASH and it's the same story, 960x360 output. Hmmm...

Last edited by LouieChuckyMerry; 20th May 2019 at 19:34.
LouieChuckyMerry is offline   Reply With Quote
Old 20th May 2019, 21:34   #525  |  Link
gonca
Registered User
 
Join Date: Jul 2012
Location: Scarborough, Canada
Posts: 895
DGIndexNV is fine and not the problem
Can you give DGDenoise a try instead of using SMDegrain
or use
Quote:
ConvertFromStacked(clip clip, int bits )
http://avisynth.nl/index.php/ConvertStacked
after SMDegrain
gonca is offline   Reply With Quote
Old 20th May 2019, 23:16   #526  |  Link
LouieChuckyMerry
Registered User
 
LouieChuckyMerry's Avatar
 
Join Date: Feb 2014
Posts: 306
Quote:
Originally Posted by gonca View Post
DGIndexNV is fine and not the problem
Can you give DGDenoise a try instead of using SMDegrain
I searched about for DGDenoise but couldn't find anything, yet it seems familiar. Could you please give me a hint.


Quote:
Originally Posted by gonca View Post
I actually tried this some days ago but received the error message "ConvertFromStacked: Input stacked clip must be YV12, YV16, YV24 or YV8". At the time I wondered how this could be, given that the final line of my functional script is "ConvertFromStacked", but then I went about my business. Here's my script starting from the SMDegrain call (where the high bit depth begins); the earlier calls are deinterlacing, color conversion, Gibbs noise block, etc, all done in 8-bit:

Code:
### Overall Temporal Denoise ###
SMDegrain(TR=2,ThSAD=200,ContraSharp=True,RefineMotion=True,Plane=0,PreFilter=2,Chroma=False,LSB=True,LSB_Out=True)
### Resize ###
NNEDI3_RPow2(RFactor=2,CShift="Spline64Resize",FWidth=960,FHeight=720)
aWarpSharp2(Depth=5)
Sharpen(0.2)
### Darken-Thin Lines ###
F=DitherPost(Mode=-1)
S=F.FastLineDarkenMod(Strength=24,Prot=6).aWarpSharp2(Blur=4,Type=1,Depth=8,Chroma=2)
D=MT_MakeDiff(S,F).Dither_Convert_8_To_16()
Dither_Add16(Last,D,Dif=True,U=2,V=2)
### Deband ###
F3KDB(Y=100,Cb=100,Cr=100,GrainY=0,GrainC=0,Input_Mode=1,Input_Depth=16,Output_Mode=1,Output_Depth=16)
ConvertFromStacked
If I reverse the Overall Temporal Denoise and Resize lines, then the script runs fine and outputs 960x720 video; however, everything I've ever read regarding video encoding states that denoising should come before resizing (which makes perfect sense). I know the issue begins with the resizing because removing everything but "ConvertFromStacked" after the Resize section still results in the above error message.

I guess now I'm wondering why SMDegrain outputs seemingly different 16-bit than F3KDB, since the F3KDB output has no issue with the "ConvertFromStacked" call. Anyway, thanks again for your help.
LouieChuckyMerry is offline   Reply With Quote
Old 20th May 2019, 23:31   #527  |  Link
gonca
Registered User
 
Join Date: Jul 2012
Location: Scarborough, Canada
Posts: 895
As for DGDenoise, look in the DGDecodeNV manual

Re
Code:
ConvertFromStacked(16)
Try it after SMDegrain and before NNEDI3

Last edited by gonca; 20th May 2019 at 23:49.
gonca is offline   Reply With Quote
Old 21st May 2019, 09:12   #528  |  Link
jpsdr
Registered User
 
Join Date: Oct 2002
Location: France
Posts: 1,702
What do you mean "stack" ? I support 16 bits, but only "true" 16 bits, so only on avs+ for more than 8 bits data. I don't support "hacked" format.
__________________
My github.
jpsdr is offline   Reply With Quote
Old 21st May 2019, 10:55   #529  |  Link
gonca
Registered User
 
Join Date: Jul 2012
Location: Scarborough, Canada
Posts: 895
Quote:
Originally Posted by jpsdr View Post
What do you mean "stack" ? I support 16 bits, but only "true" 16 bits, so only on avs+ for more than 8 bits data. I don't support "hacked" format.
If this is meant for me, I don't know what source filter is being used or how the 8 bit DVD got to be 16 bit
And there is no mention of NNEDI3 not handling 16 bits
gonca is offline   Reply With Quote
Old 21st May 2019, 12:36   #530  |  Link
FranceBB
Broadcast Encoder
 
FranceBB's Avatar
 
Join Date: Nov 2013
Location: Germany
Posts: 561
@LouieChuckyMerry... You are feeding NNEDI3_RPow2 with 16bit stacked data while it's expecting 8bit.
Please note that the Jean-Philippe mod of NNEDI3 works in planar only, so it expects 8bit/10bit/12bit/14bit/16bit planar, not stacked nor interleaved, however SMDegrain with lsb=true is working in 16bit stacked.

This is what you gotta do:

Code:
#Indexing your 8bit source using your preferred indexer
FFMpegSource2("video.ts")

#Bring everything up to 16bit stacked
Dither_Convert_8_To_16()

#Denoise with 16bit stacked precision
SMDegrain(TR=2,ThSAD=200,ContraSharp=True,RefineMotion=True,Plane=0,PreFilter=2,Chroma=False,LSB=True,LSB_Out=True)

#Upscale with 16bit stacked precision
nnedi3_resize16(target_width=960, target_height=720, mixed=true, thr=1.0, elast=1.5, nns=4, qual=2, etype=0, pscrn=4, threads=0, tv_range=true, kernel_d="Spline", kernel_u="Spline", taps=6, f_d=1.0, f_u=2.0, sharp=0, lsb_in=true, lsb=true)

#Sharpening
#please note that you can't use awarpsharp2 as you did
#because awarpsharp is expecting 8bit planar
#while you are feeding it with 16bit stacked
#so you need to use aWarpSharp4xx
aWarpSharp4xx(depth=5, lsb=true)

#Do not use Sharpen(0.2)
#not only you can't use it with 16bit stacked
#but it's also a very basic and simple sharpening
#which does not work well;
#if you really have to use something else

#Line Darkening
#You did everything correctly this time
#as you brought everything back to 8bit
#you filtered with FastLineDarkenMod and awarpsharp2
#two filters that work in 8bit planar
#then you brought the result back to 16bit stacked
#and you applied the differences to the original 16bit stacked
F=DitherPost(Mode=-1)
S=F.FastLineDarkenMod(Strength=24,Prot=6).aWarpSharp2(Blur=4,Type=1,Depth=8,Chroma=2)
D=MT_MakeDiff(S,F).Dither_Convert_8_To_16()
Dither_Add16(Last,D,Dif=True,U=2,V=2)

#Debanding with 16bit stacked precision
#You did everything correctly this time as well
#as you specifically told f3kdb that it's getting 16bit stacked
#as input and that it should work internally at 16bit
#and output 16bit stacked
F3KDB(Y=100,Cb=100,Cr=100,GrainY=0,GrainC=0,Input_Mode=1,Input_Depth=16,Output_Mode=1,Output_Depth=16)
I hope it helps.
__________________
Broadcast Encoder
LinkedIn
FranceBB is offline   Reply With Quote
Old 21st May 2019, 14:14   #531  |  Link
LouieChuckyMerry
Registered User
 
LouieChuckyMerry's Avatar
 
Join Date: Feb 2014
Posts: 306
Quote:
Originally Posted by gonca View Post
As for DGDenoise, look in the DGDecodeNV manual

Re
Code:
ConvertFromStacked(16)
Try it after SMDegrain and before NNEDI3
gonca: Again, thank you for your help . I tried the above but to no avail, although now we know why:

Quote:
Originally Posted by jpsdr View Post
What do you mean "stack" ? I support 16 bits, but only "true" 16 bits, so only on avs+ for more than 8 bits data. I don't support "hacked" format.
jpsdr: Thank you for solving the mystery (and for your port of NNEDI3 ).

FranceBB: Thank you very much for your educational explanations; they're really helpful to an AviSynth hobbyist such as myself .

1) After perusing this entire thread I eventually came to understand that jpsdr's port of NNEDI3 doesn't work with stacked 16-bit. What I wonder is, would this:

Code:
### Overall Temporal Denoise ###
SMDegrain(TR=2,ThSAD=200,ContraSharp=True,RefineMotion=True,Plane=0,PreFilter=2,Chroma=False,LSB=True,LSB_Out=False)
### Resize ###
NNEDI3_RPow2(RFactor=2,CShift="Spline64Resize",FWidth=960,FHeight=1440)
aWarpSharp2(Depth=5)
Sharpen(0.2)
### Darken-Thin Lines ###
Dither_Convert_8_To_16()
F=DitherPost(Mode=-1)
S=F.FastLineDarkenMod(Strength=24,Prot=6).aWarpSharp2(Blur=4,Type=1,Depth=8,Chroma=2)
D=MT_MakeDiff(S,F).Dither_Convert_8_To_16()
Dither_Add16(Last,D,Dif=True,U=2,V=2)
be the "correct" way to use NNEDI3_RPow2 in my original script? Not that I would use this, though, because...

2) I encountered your NNEDI3_Resize16 line in this thread and was able to make it work after some effort. Thank you. I reckon it's better to upscale in 16-bits, no?

3) I did some searching, with two different engines, for aWarpSharp4 and found, literally, nothing. Do you know where I might find a copy?

4) Please, any suggestions to replace Sharpen(0.2)?

5) Thanks for your kind help .
LouieChuckyMerry is offline   Reply With Quote
Old 21st May 2019, 15:29   #532  |  Link
FranceBB
Broadcast Encoder
 
FranceBB's Avatar
 
Join Date: Nov 2013
Location: Germany
Posts: 561
1) Yes, that would be the correct way as you are feeding it with 8bit planar data.

2) Yep, definitely better to have more precision whenever you can (at the expense of speed).

3) Sure, there you go: https://forum.doom9.org/showthread.p...87#post1715287

4) If you are working in 8bit planar: LSFMod. If you are working in 16bit interleaved, either MCLS_16 or BicubicSharp. For 16bit stacked, I'm using RKS but it's closed source and I can't share it as it has been developed years ago by the engineer who taught me encoding.

Quote:
Thank you very much for your educational explanations; they're really helpful to an AviSynth hobbyist such as myself
The whole 16bit stacked, interleaved, planar is kinda tricky for me as well sometimes, so I'm not surprised that it's confusing for people who don't use Avisynth everyday for work and for people who didn't really went through the "evolution" of Avisynth through the years 'till the "normal" high bit depth arrived.
Honestly, if planar was introduced years ago in "vanilla" Avisynth, we wouldn't have had this "mess" of filters supporting stacked, some others supporting interleaved, some others supporting both (like f3kdb) but not planar > 8bit, some others supporting planar only 8bit, some others supporting planar high bit depth (8bit/10bit/12bit/14bit/16bit/32bit) but not stacked nor interleaved ecc.
__________________
Broadcast Encoder
LinkedIn
FranceBB is offline   Reply With Quote
Old 22nd May 2019, 01:45   #533  |  Link
LouieChuckyMerry
Registered User
 
LouieChuckyMerry's Avatar
 
Join Date: Feb 2014
Posts: 306
Quote:
Originally Posted by FranceBB View Post
1) Yes, that would be the correct way as you are feeding it with 8bit planar data.
Thanks for scratching a brain itch; I've been wondering about this for a couple weeks.


Quote:
Originally Posted by FranceBB View Post
2) Yep, definitely better to have more precision whenever you can (at the expense of speed).
For Futurama speed is no issue .


Quote:
Originally Posted by FranceBB View Post
It's been tested and added to the script.


Quote:
Originally Posted by FranceBB View Post
4) If you are working in 8bit planar: LSFMod. If you are working in 16bit interleaved, either MCLS_16 or BicubicSharp. For 16bit stacked, I'm using RKS but it's closed source and I can't share it as it has been developed years ago by the engineer who taught me encoding.
Any suggestions for 16-bit stacked that's not closed source, or is there no longer a reason to add extra sharpening after aWarpSharp4xx given the new, improved script? I stole, er, borrowed the original NNEDI3_RPow2-aWarpSharp2-Sharpen upscale block and figured that the "Sharpen(0.2)" call was like a final touch-up to the upscaling.


Quote:
Originally Posted by FranceBB View Post
The whole 16bit stacked, interleaved, planar is kinda tricky for me as well sometimes, so I'm not surprised that it's confusing for people who don't use Avisynth everyday for work and for people who didn't really went through the "evolution" of Avisynth through the years 'till the "normal" high bit depth arrived.
Honestly, if planar was introduced years ago in "vanilla" Avisynth, we wouldn't have had this "mess" of filters supporting stacked, some others supporting interleaved, some others supporting both (like f3kdb) but not planar > 8bit, some others supporting planar only 8bit, some others supporting planar high bit depth (8bit/10bit/12bit/14bit/16bit/32bit) but not stacked nor interleaved ecc.
It does get quite confusing, with almost too may possibilities to understand. I love videos, and the ability to "improve" them--at least to my eyes--makes me happy. Kind people such as yourself are especially appreciated. Danke schön!
LouieChuckyMerry is offline   Reply With Quote
Old 22nd May 2019, 04:42   #534  |  Link
FranceBB
Broadcast Encoder
 
FranceBB's Avatar
 
Join Date: Nov 2013
Location: Germany
Posts: 561
Quote:
is there no longer a reason to add extra sharpening after aWarpSharp4xx given the new, improved script? I stole, er, borrowed the original NNEDI3_RPow2-aWarpSharp2-Sharpen upscale block and figured that the "Sharpen(0.2)" call was like a final touch-up to the upscaling.
I don't think it's needed. Spline is a very sharp resizing kernel due to the nature of its implementation and if you need it to be sharper, try raising the "taps" number in NNEDI 'till you'll find the "sweet spot". As you probably know, internally, Spline is limited to Spline16Resize, Spline36Resize and Spline64Resize, however in NNEDI you can choose the number of taps yourself, so you can go above and get Spline144Resize using 12 sampling points and so on. Please note though that a very high number of taps won't be as beneficial as you might expect, which is why people are generally using Spline36 or Spline64... except Katie... She loves Spline144Resize.
__________________
Broadcast Encoder
LinkedIn
FranceBB is offline   Reply With Quote
Old 22nd May 2019, 05:13   #535  |  Link
videoh
Registered User
 
Join Date: Jul 2014
Posts: 717
If you are using Avisynth+ and DGDecNV, then you have DGSharpen(), which is a very fast CUDA implementation with functionality like LSFmod. It works in 8 or 16-bit depth.

You really should get away from all the high-bit-depth hacks, IMHO, and go for native support.
videoh is offline   Reply With Quote
Old 22nd May 2019, 14:42   #536  |  Link
LouieChuckyMerry
Registered User
 
LouieChuckyMerry's Avatar
 
Join Date: Feb 2014
Posts: 306
Quote:
Originally Posted by FranceBB View Post
I don't think it's needed. Spline is a very sharp resizing kernel due to the nature of its implementation and if you need it to be sharper, try raising the "taps" number in NNEDI 'till you'll find the "sweet spot". As you probably know, internally, Spline is limited to Spline16Resize, Spline36Resize and Spline64Resize, however in NNEDI you can choose the number of taps yourself, so you can go above and get Spline144Resize using 12 sampling points and so on. Please note though that a very high number of taps won't be as beneficial as you might expect, which is why people are generally using Spline36 or Spline64... except Katie... She loves Spline144Resize.
Thanks for the very informative answer--I didn't know that about Spline--and thank you so much for all your instructive help .


Quote:
Originally Posted by videoh View Post
If you are using Avisynth+ and DGDecNV, then you have DGSharpen(), which is a very fast CUDA implementation with functionality like LSFmod. It works in 8 or 16-bit depth.

You really should get away from all the high-bit-depth hacks, IMHO, and go for native support.
Thanks for letting me know about DGSharpen; I'll definitely check it out. As for the hacks I know that you're right, but when I began trying to learn AviSynth some years ago I tested a dozen different denoisers and found SMDegrain to be by far the best for my needs and, as far as I know, there isn't yet a version available with native 16-bit support. Please correct me if I'm wrong, though. Also, could you point me to a site (or thread, or any place) where filters-plugins with native support are gathered? Thank you.
LouieChuckyMerry is offline   Reply With Quote
Old 22nd May 2019, 15:14   #537  |  Link
videoh
Registered User
 
Join Date: Jul 2014
Posts: 717
Quote:
Originally Posted by LouieChuckyMerry View Post
Thanks for letting me know about DGSharpen; I'll definitely check it out. As for the hacks I know that you're right, but when I began trying to learn AviSynth some years ago I tested a dozen different denoisers and found SMDegrain to be by far the best for my needs and, as far as I know, there isn't yet a version available with native 16-bit support. Please correct me if I'm wrong, though. Also, could you point me to a site (or thread, or any place) where filters-plugins with native support are gathered? Thank you.
Hard to say you are wrong about what you find best, although I am a little confused why you are comparing a denoiser to a sharpener. I'm not aware of any gathering like you mentioned.
videoh is offline   Reply With Quote
Old 22nd May 2019, 17:26   #538  |  Link
real.finder
Registered User
 
Join Date: Jan 2012
Location: Mesopotamia
Posts: 1,139
like videoh said, go for native HBD

SMDegrain already work with native HBD in many settings included the Default setting for now, other settings waiting for updates for dll's to support HBD, LSFmod work with HBD too

and aside form that, aWarpSharp4 link is not last update, the last one in my signature
__________________
My Avisynth Stuff

Last edited by real.finder; 22nd May 2019 at 17:45.
real.finder is offline   Reply With Quote
Old 23rd May 2019, 02:35   #539  |  Link
LouieChuckyMerry
Registered User
 
LouieChuckyMerry's Avatar
 
Join Date: Feb 2014
Posts: 306
Quote:
Originally Posted by videoh View Post
Hard to say you are wrong about what you find best, although I am a little confused why you are comparing a denoiser to a sharpener. I'm not aware of any gathering like you mentioned.
Sorry for the confusion. I wasn't comparing a denoiser to a sharpener, just lamenting the fact that SMDegrain doesn't natively support high bit depth (although real.finder's below post gives me great hope). I'll certainly add DGSharpen to my toolbag, though, and in native high bit depth (which I should find time to understand better). Thanks again .


Quote:
Originally Posted by real.finder View Post
like videoh said, go for native HBD

SMDegrain already work with native HBD in many settings included the Default setting for now, other settings waiting for updates for dll's to support HBD, LSFmod work with HBD too

and aside form that, aWarpSharp4 link is not last update, the last one in my signature
Thank you for the information . Would my usual SMDegrain call:

Code:
SMDegrain(TR=3,ThSAD=XXX,RefineMotion=True,Plane=0,Chroma=False,LSB=True,LSB_Out=True)
work with native HDB? I'll update my aWarpSharp4 and check out LSFMod. How does LSFMod compare to FastLineDarkenMod?

Last edited by LouieChuckyMerry; 23rd May 2019 at 02:37. Reason: Specificity
LouieChuckyMerry is offline   Reply With Quote
Old 23rd May 2019, 02:46   #540  |  Link
videoh
Registered User
 
Join Date: Jul 2014
Posts: 717
Thanks for the clarification, LCM. It's all clear to me now. Good luck for your projects! You're in good hands with real.finder.
videoh 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 00:58.


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