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 24th June 2023, 17:55   #2661  |  Link
salvo00786
Registered User
 
Join Date: Feb 2022
Posts: 19
Ok, thanks
salvo00786 is offline   Reply With Quote
Old 7th July 2023, 23:49   #2662  |  Link
LeXXuz
21 years and counting...
 
LeXXuz's Avatar
 
Join Date: Oct 2002
Location: Germany
Posts: 716
Dogway I'm playing around with some parameters in SMDegrain I haven't paid much attention to before.

First, is it advisable to use recursion mode for MDegrain as an additional refinement if quality is of the highest concern? Or better not as some side effects (which I haven't noticed through quick testing yet) may occur? So far the speed penalty was way less than I expected it to be.

Does recursion increase denoising strength and therefore thSAD should be adjusted/lowered? Or does it merely increase precision through the binominal weighting? Or a mixture of both? Again, side effects?

And second, the rfilter setting. Is the cubical filter mode (4) better for any scenario than the default quadratic filter?
LeXXuz is offline   Reply With Quote
Old 8th July 2023, 00:38   #2663  |  Link
Dogway
Registered User
 
Join Date: Nov 2009
Posts: 2,351
Recursion is for stronger degrain without raising the temporal radius, so it might be a good alternative, specially for busy scenes.

Also it will become center frame weighted (check tent blur in ExTools) so safer than using a higher 'tr'.

As for higher quality I don't know, it depends on source, if it's very grainy it can help I think. thSAD is something different, it's the "noise threshold", like the mask so to speak for MDegrain and it's independent to recursion.

rfilter=3 is what gave me the best qual/perf ratio in Zopti, that is not to say rfilter=4 can't give better results but in such case the performance hit didn't make it worth it, just speculating, I don't remember if it delivered better quality.
__________________
i7-4790K@Stock::GTX 1070] AviSynth+ filters and mods on GitHub + Discussion thread
Dogway is offline   Reply With Quote
Old 8th July 2023, 09:01   #2664  |  Link
LeXXuz
21 years and counting...
 
LeXXuz's Avatar
 
Join Date: Oct 2002
Location: Germany
Posts: 716


I did a b2b comparison between two encodes of a problematic source and had the impression tr6 with r looked better, even a little bit more stable, than tr12. But I wasn't sure and couldn't pinpoint it exactly. It was just the entire scenery that looked better on pans or scenes with lots of motion.

After so many tests you sometimes just start seeing things...
LeXXuz is offline   Reply With Quote
Old 10th July 2023, 09:04   #2665  |  Link
Dogway
Registered User
 
Join Date: Nov 2009
Posts: 2,351
Just updated TransformsPack with the conversion functions of YUV and YIQ, to and from RGB and YCbCr as explained in this post. Aside from that and some notes and cosmetics a fix in some indexes for color_coef(), basically XYZ and NTSC-J were wrong.

Next I'm going to fix HLG for its two flavors, and implement an state of the art tonemapper.
__________________
i7-4790K@Stock::GTX 1070] AviSynth+ filters and mods on GitHub + Discussion thread

Last edited by Dogway; 10th July 2023 at 09:10.
Dogway is offline   Reply With Quote
Old 10th July 2023, 21:28   #2666  |  Link
LeXXuz
21 years and counting...
 
LeXXuz's Avatar
 
Join Date: Oct 2002
Location: Germany
Posts: 716
I'm still fiddling with some settings to upscale SD content to 720p. And deep_resize is still my favourite choice. Is there any tweak to set to put some more punch into textures while hardly touching sharp edges, which causes even stronger halos on poor sources? Well, I could run LSFplus afterwards, but I'd like to use as few steps as possible.
LeXXuz is offline   Reply With Quote
Old 11th July 2023, 09:54   #2667  |  Link
Dogway
Registered User
 
Join Date: Nov 2009
Posts: 2,351
SD to 720p is not much of an upscale so I don't know what could be the gains, but I started deep_resize() dev using sinc4 and it was quite good for textures, then I noticed some ringing could leak outside the edge mask and decided to default lanczos8 and leave sinc4 only for HD to UHD.
I noted in the script:
Quote:
'Sinc' low taps -ie. 4- is worth testing, creates some faints halos specially for SD to HD so see whether it's faint enough for you
I haven't played much with SincLin but it promises similar characteristics as sinc minus the halos, maybe give it a go. Just updated TransformsPack - Main because I didnt update the call args (SincLin is now internal function).
Another crazy idea, is to use static grain to detailed areas, so maybe you can hack FilmGrain+ to be static and pass it through a detail mask. It will work as a cheap way of hallucination.

I want to share a remaster I was doing yesterday which is similar in nature. The source is an horrendous upscale of a dumb deinterlace. So you get aliasing, shimmering and all the stuff.
I didn't know how to proceed, descale, re-deinterlace? didn't seem to work out, so I did a similar job as The Mission (pixelated mess), descale, antialias, QTGMC+ deshimmering, some avisynth-fu and filmgrain to add hallucination.

Source..........................................................................................................................................Remaster
............


Code:
DeGaussResizeMT(1024,576,order=1,p=100)
SantiagMod(strh=0,strv=1)

a=last
QTGMCp(TR0=0,TR1=1,TR2=2,Preset="Slower", InputType=1, sharpness=0.0) #deshimmer; some ghosting beware

LR=ex_edge(ex_Luma_Rebuild(5.0, 0.03),"kroon")
MM=MotionMask(LR,lo=10,sharpness=1)      # It's better to detect motion from edge masks
ex_merge(ex_LFR(a,LFR=400),MM,luma=true) # Restore LFR only on motion areas (deghost + desmear)

ex_LFR(ex_unsharp(-0.5,Fc=width()/1.5),LFR=700) # Deconv only on LFR areas

a=last
DH=DeHalo_alpha(rx=1.7, ry=1.7, darkstr=1.0, brightstr=1.0, ss=1.5, lowsens=50, highsens=50)

# Flat mask block
FlatMask(1.0,scale=50,invert=true)
ex_boxblur(4)
ex_binarize(200)
ex_expand(3)
ex_inflate()
removegrain(20)

ex_merge(a,DH,last,luma=true) # Dehalo only on edges next to flat areas

deep_resize(1920,grain=0.0)
ex_unsharp(0.3,Fc=width()/1.5,safe=true) # Remove some of the dreamy look
ex_unsharp(1.0,Fc=width()*2.0,safe=true) # Extra fine sharpness
FilmGrainPlus(preset="16mm",sharpness=0.5,skin=0.8,str=1.2,mode="log",hi=0.2)
By the way, I will probably implement the motion mask trick into MotionMask, temporal derivatives are more accurate when computed on edge masks rather than source directly, at least from my tests yesterday.
__________________
i7-4790K@Stock::GTX 1070] AviSynth+ filters and mods on GitHub + Discussion thread

Last edited by Dogway; 11th July 2023 at 10:09.
Dogway is offline   Reply With Quote
Old 11th July 2023, 11:04   #2668  |  Link
LeXXuz
21 years and counting...
 
LeXXuz's Avatar
 
Join Date: Oct 2002
Location: Germany
Posts: 716
That is some very nice outcome. I'll definitely will play around with that. Thanks a lot for sharing the script.
LeXXuz is offline   Reply With Quote
Old 11th July 2023, 11:46   #2669  |  Link
DTL
Registered User
 
Join Date: Jul 2018
Posts: 1,027
Quote:
Originally Posted by LeXXuz View Post
I did a b2b comparison between two encodes of a problematic source and had the impression tr6 with r looked better, even a little bit more stable, than tr12.
If motion vectors are not correct - increasing tr will cause more blurring. The old idea of MDegrainN was about lowering thSAD for the far frames from current to decrease this effect. So with not very good motion vectors it may be better to set thSAD2 to lower values.

"I started deep_resize() dev using sinc4 and it was quite good for textures"

If sinc (unweighted) is really sharpest - and weighting of sinc cause sharpness loss - may be try to test even more higher amplitude of sin ?
Current sinc is sin(x)/x. With weighted sinc x become higher as x increases. So to make sinc 'more unweighted' we can tweak x-divider in sinc(x). Current sinc(x) is sin(x) x 1/x . The 1/x multiplier can be replaced to higher argument function as x increases. So it will keep sinc(0)=1 to keep current samples values unchanged but will have higher amplitude of near lobes. May be test 1/(0.5x) ? Or 1/(x^0.5) and others.

Last edited by DTL; 11th July 2023 at 11:58.
DTL is offline   Reply With Quote
Old 11th July 2023, 22:34   #2670  |  Link
Dogway
Registered User
 
Join Date: Nov 2009
Posts: 2,351
Quote:
Originally Posted by DTL View Post
If sinc (unweighted) is really sharpest - and weighting of sinc cause sharpness loss - may be try to test even more higher amplitude of sin ?
Current sinc is sin(x)/x. With weighted sinc x become higher as x increases. So to make sinc 'more unweighted' we can tweak x-divider in sinc(x). Current sinc(x) is sin(x) x 1/x . The 1/x multiplier can be replaced to higher argument function as x increases. So it will keep sinc(0)=1 to keep current samples values unchanged but will have higher amplitude of near lobes. May be test 1/(0.5x) ? Or 1/(x^0.5) and others.
Yes, that might work, not sure what filter exposes amplitude though, otherwise I need to model it and feed into fmtc, a bit cumbersome but sinc4 is already bordering the limit, if source is already too sharp it will create pixelation and heavy ringing.

I want to note my above script is a bit rough, but works for me since it's a quick personal remaster I did yesterday, you can go nuts configuring QTGMCp, better dehalo mask, 16-bit pipeline, etc. The trick with SD upscales is to add a bit of de-emphasis, the ex_unsharp deconvolution call in my script.
__________________
i7-4790K@Stock::GTX 1070] AviSynth+ filters and mods on GitHub + Discussion thread

Last edited by Dogway; 12th July 2023 at 00:35.
Dogway is offline   Reply With Quote
Old 15th July 2023, 07:39   #2671  |  Link
LeXXuz
21 years and counting...
 
LeXXuz's Avatar
 
Join Date: Oct 2002
Location: Germany
Posts: 716
Quote:
Originally Posted by Dogway View Post
SD to 720p is not much of an upscale so I don't know what could be the gains,
I think I start to see what you mean. I did an upscale to 1080p for comparison and the overall picture looked a bit better or more balanced if you will.

The resize to 720p was out of a necessity at first. It was for some clips for a 720p display with very poor scaling.

And then I played around and started to realize that the SD content looked a tad better when upscaling. So why not encode my DVD content to 720p or even 1080p now if it benefits the visual impression of the picture.

In this case I don't mind if the final clip gets bigger than the source.

I never considered this because I always thought you can't 'create' new or finer detail through upscaling. What isn't there in the first place, won't be there if you enlarge it. So why even bother?

Yet, it looks a tad better. I even let other people do some blind comparisons and they always chose the upscale with deep_resize. So I guess it can't just be me imagining things.

Which now brings me to an important question. Is it recommended to upscale first and then denoise/clean the picture or clean it first and then do the upscale?

I'm leaning towards the first one, but I'm not quite sure. Obviously there is a speed difference, but that is secondary.
LeXXuz is offline   Reply With Quote
Old 15th July 2023, 10:32   #2672  |  Link
Dogway
Registered User
 
Join Date: Nov 2009
Posts: 2,351
Rather than 1080p the natural thing to do with upscales is an integer upscale, so 2x, because you don't have to mangle (read blur further) the pixels. So that's the optimal upscale ratio.

You can denoise after upscale but I like before for two reasons, performance, but also because deep_resize upscale will try to sharpen texture and along that noise/grain and that increases SAD. So try both ways, you can always mask out details from the upscaled version.
__________________
i7-4790K@Stock::GTX 1070] AviSynth+ filters and mods on GitHub + Discussion thread
Dogway is offline   Reply With Quote
Old 15th July 2023, 10:51   #2673  |  Link
DTL
Registered User
 
Join Date: Jul 2018
Posts: 1,027
"Is it recommended to upscale first and then denoise/clean the picture or clean it first and then do the upscale?"

If you can process upscaled (slower) it is better to process upscaled. It will be equal to increasing pel in mvtools over 4. As I see with some synthetic simulation with 'clean' source and AddGrain() and SSIM metric after denoise - going from pel=2 to pel=4 adds SSIM metric significantly. So if you 2x upscale first and process with pel=4 it will be close to processing original with pel=8. Will try to test if 2x upscaling before denoise adds visibly to SSIM metric if process with max currently supported pel=4 of mvtools. But the blocksize may need to be adjusted too (to 2x).

"Yet, it looks a tad better. I even let other people do some blind comparisons and they always chose the upscale with deep_resize. So I guess it can't just be me imagining things."

It may depend on both quality of scaler in display device and MPEG encoder action. If MPEG encoder receive upscaled - it typically uses more bits to output and the resulted bit*(original_pixel)/frame quality measure increases. So the MPEG encoder will keep more textures and other quality things. And display upscaler may be as poor as bilinear or short kernel bicubic so not best for big upscale ratios required for SD sources to FHD and larger screens. With source pre-upscale with some best available scaler you can close to hide any visibility of poor display scaler.

The SD era was really 'long' in current civilization and many good engineers worked in that time to make it close to 'perfect' in 'per_pixel' quality (so for high-end DVD players the DACs of 108 MHz used - not lowest possible 13.5 MHz). In the next move to HD and larger production typically pay much less attention to 'per_pixel' quality so a much poorer display scaler may be used in many consumer display devices. As the visual industry went to digital and HD (HD+) - it really degraded in its engineering potencial already as much as it already forgot to put to standard the restoration display scaler. So any scaler can be used by the manufacturer and give different quality. At the end of analog era with SD the semi-digital design of video systems did not define vertical scaler for line-based frames and the H-scaler expected to be simple sinc of the DAC to display at CRT. So requirements for visual system DAC at first were 'natural' and not put to standard (the standard operates in terms of analog systems like frequency response curve and it must be non-distortive (flat)). And after moving to digital the required standards for scale digital content were completely missed.

Last edited by DTL; 15th July 2023 at 11:10.
DTL is offline   Reply With Quote
Old 15th July 2023, 15:48   #2674  |  Link
LeXXuz
21 years and counting...
 
LeXXuz's Avatar
 
Join Date: Oct 2002
Location: Germany
Posts: 716
Thanks guys for your valued input.
LeXXuz is offline   Reply With Quote
Old 17th July 2023, 13:37   #2675  |  Link
Lan4
Registered User
 
Join Date: Dec 2022
Posts: 64
Hello! Help me which kernel to use for deep resize, optimal or with improved textures.
Sources: 1080x1920, about 3500 kb/s, H264
Target: 720x1280, about 800 kb/s, H265

Last edited by Lan4; 17th July 2023 at 14:00.
Lan4 is online now   Reply With Quote
Old 17th July 2023, 15:30   #2676  |  Link
Dogway
Registered User
 
Join Date: Nov 2009
Posts: 2,351
Default (SSIM2) is fine for downscaling, specially if the display is going to upscale again on TV, tablet, or elsewhere. Downscales don't do edge/flat distinction. If the target display is indeed 720p you might want something softer like spline16 or so.
__________________
i7-4790K@Stock::GTX 1070] AviSynth+ filters and mods on GitHub + Discussion thread
Dogway is offline   Reply With Quote
Old 17th July 2023, 22:14   #2677  |  Link
Lan4
Registered User
 
Join Date: Dec 2022
Posts: 64
If no width or height is specified, is the value applied as the width?

If the kernel is not specified, then the value is taken from the list of default kernels for a specific width?

The point is that phone (portrait) resolutions are reversed, as in my case.
Lan4 is online now   Reply With Quote
Old 18th July 2023, 07:56   #2678  |  Link
Dogway
Registered User
 
Join Date: Nov 2009
Posts: 2,351
The kernel is evaluated on horizontal aspect ratios, so if your source is portrait ratio you might want to rotate it 90, apply a deep_resize() to your target resolution with show=true and check the kernel chosen. Then apply those settings to the original video/image.
Code:
TurnLeft()
deep_resize(x,show=true)
If you don't specify a target resolution, for example you say, I wan't half the size: deep_resize(0.5), it will keep the portrait aspect ratio.
__________________
i7-4790K@Stock::GTX 1070] AviSynth+ filters and mods on GitHub + Discussion thread
Dogway is offline   Reply With Quote
Old 19th July 2023, 10:04   #2679  |  Link
Dogway
Registered User
 
Join Date: Nov 2009
Posts: 2,351
Just released TransformsPack v2.2.0. As promised I ported the state-of-the-art OpenDRT tonescale.

So what's left? Finishing the two HLG flavors and their OOTFs, information/resources are mixed so I will need to do some bit of research.
__________________
i7-4790K@Stock::GTX 1070] AviSynth+ filters and mods on GitHub + Discussion thread

Last edited by Dogway; 19th July 2023 at 10:06.
Dogway is offline   Reply With Quote
Old 19th July 2023, 22:38   #2680  |  Link
LeXXuz
21 years and counting...
 
LeXXuz's Avatar
 
Join Date: Oct 2002
Location: Germany
Posts: 716
Quote:
Originally Posted by Dogway View Post
Code:
ex_unsharp(1.0,Fc=width()*2.0,safe=true) # Extra fine sharpness
This line irritates me. Will everything below or above the cutoff frequency heavily sharpened? I always thought everything below, but then I don't quite understand the 'extra fine sharpness' description.

Extra fine sharpness would mean to me to sharpen just the finest details (or highest frequencies), which would imply everything above that high cutoff frequency. It's late and I'm confused
LeXXuz is offline   Reply With Quote
Reply

Tags
avisynth, dogway, filters, hbd, packs

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 15:54.


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