digitalFAQ.com Forums [Archives]

digitalFAQ.com Forums [Archives] (http://www.digitalfaq.com/archives/)
-   Avisynth Scripting (http://www.digitalfaq.com/archives/avisynth/)
-   -   Avisynth: Mod to NOT blur last frame prior to scene change? (http://www.digitalfaq.com/archives/avisynth/4456-avisynth-mod-blur.html)

FredThompson 07-10-2003 10:43 PM

Avisynth: Mod to NOT blur last frame prior to scene change?
 
Is there a very simple mod to the optimal script such that the last frame prior to a scene change is not blurred?

I started to code a secondary ConditionalFilter set with forward-looking YDifference state change detection and decided to ask here before I go through all of that.

I do realize how this affects quality at low bitrates.

Dialhot 07-11-2003 03:26 AM

As we say in programing world : RTFM :!: :-)

You have a function called YDifferenceFromPrevious() that you can use insteed of YDifferenceToNext(). That's will make the bluring start just after the scene change, and not just before.

FredThompson 07-12-2003 07:26 PM

I'm looking to have no blur which is a somewhat different beast.

Any idea how to accomplish that?

I mean, without a second ConditionalFilter to choose between the source and filtered streams?

Hmmm...another thought, getting rid of blurring altogether would also do this, wouldn't it?

Dialhot 07-12-2003 07:45 PM

I suppose that a scene change lead to a big value for nf. So you can perhaps avoid the bluring when the value is upper than a MAX value (MAx has to be determined by some tests I guess)

If you don't want blur at all, try this :

ScriptClip("nf = YDifferenceToNext()"+chr(13)+ "((nf >= SwitchThreshold) && (nf < MAX)) ? \
unfilter( -(fmin(round(nf)*2, 100)), -(fmin(round(nf)*2, 100)) ) : \
TemporalSoften( fmin( round(2/nf), 6), round(1/nf) , round(3/nf) , 1, 1) ")

jorel 07-12-2003 08:15 PM

i got this advice using the script in vdubmod:

'i don't know what "MAX" means
{[Scriptclip],line 4}"

please, recomend the values for "max"
:!:

Dialhot 07-12-2003 08:24 PM

Jorel READ MY POST !
:-)
I told that "MAX" have to be found by some tests.

Tests that I don't have the time to do because my PC is currently encoding a video (and it's 3:23am here ! :-))

I was just giving an idea, not a solution :D

jorel 07-12-2003 08:38 PM

i read before ask Phil,
the dice is tumbling.....let me see..... :!:

4...number 4 :!:
trying 4!
:lol: :lol:

ps:
Phil,
as you can see,
your ideas are better than mine "solutions"
:wink:

FredThompson 07-12-2003 08:40 PM

For some reason, I'm having a similar problem.

SwitchThreshold and MAX don't seem to be recognized as variable names even though I'm declaring them as such. Odd.

MaxTreshold = 1.50
SwitchThreshold = 3
Max=5
nf = 0 # Current frame.

undot(c)
limiter()
asharp(1,4)
STMedianFilter(8, 32, 0, 0 )
MergeChroma(blur(MaxTreshold))
MergeLuma(blur(0.1))


# ScriptClip("nf = YDifferenceToNext()"+chr(13)+ "nf > 2 ? \
# unfilter( -(fmin(round(nf)*2, 100)), -(fmin(round(nf)*2, 100)) ) : \
# TemporalSoften( fmin( round(2/nf), 6), round(1/nf) , round(3/nf) , 1, 1) ")

ScriptClip("nf = YDifferenceToNext()"+chr(13)+ "((nf >= SwitchThreshold) && (nf < MAX)) ? \
unfilter( -(fmin(round(nf)*2, 100)), -(fmin(round(nf)*2, 100)) ) : \
TemporalSoften( fmin( round(2/nf), 6), round(1/nf) , round(3/nf) , 1, 1) ")

jorel 07-12-2003 08:45 PM

i only change the word "max' in the script
to number 4 and the error is gone.

SwitchThreshold=(Width<=352)?4:(Width<=480)?3:2
ScriptClip("nf=YDifferenceToNext()"+chr(13)+"((nf> =SwitchThreshold)&&(nf<4))?\
unfilter(-(fmin(round(nf)*2,100)),-(fmin(round(nf)*2,100))):\
TemporalSoften(fmin(round(2/nf),6),round(1/nf),round(3/nf),1,1)")

maybe is right!

FredThompson 07-12-2003 09:02 PM

Still not working for me. I've put the filter into a function to apply it by field, not frame, and something isn't working. You are correct for standard script. Something isn't working properly with my modification. It reports SwitchThreshold has no value even though it is explicitly assigned inside the function. Grrr...

Cnr2("xxx",4,5,255)
ConvertToYV12()
even=SelectEven(SeparateFields()).KVCD_Filter()
odd=SelectOdd(SeparateFields()).KVCD_Filter()
Interleave(even,odd).Weave()
Limiter(min_luma=16)

##########################
#
# KVCD Filter - July 08, 2003
#
##########################

function KVCD_Filter(clip c){

MaxTreshold = 1.50
Max=5
nf = 0 # Current frame.

undot(c)
limiter()
asharp(1,4)
STMedianFilter(8, 32, 0, 0 )
MergeChroma(blur(MaxTreshold))
MergeLuma(blur(0.1))

# ScriptClip("nf = YDifferenceToNext()"+chr(13)+ "nf > 2 ? \
# unfilter( -(fmin(round(nf)*2, 100)), -(fmin(round(nf)*2, 100)) ) : \
# TemporalSoften( fmin( round(2/nf), 6), round(1/nf) , round(3/nf) , 1, 1) ")

SwitchThreshold=(Width<=352)?4:(Width<=480)?3:2
ScriptClip("nf = YDifferenceToNext()"+chr(13)+ "((nf >= SwitchThreshold) && (nf < MAX)) ? \
unfilter( -(fmin(round(nf)*2, 100)), -(fmin(round(nf)*2, 100)) ) : \
TemporalSoften( fmin( round(2/nf), 6), round(1/nf) , round(3/nf) , 1, 1) ")

Limiter()

return last}

function fmin( int f1, int f2) {
return ( f1<f2 ) ? f1 : f2}

bman 07-13-2003 08:51 AM

Hi all
Maybe MAX is reserved word ???
Could be :?: :?:
Max and MAX are the same ???
bman

FredThompson 07-13-2003 02:05 PM

Well, I've found out it's an aspect of ConditionalFilter. Arguments passed to it must be declared as globals. In a strict grammar sense, that should not be the case. However, ConditonalFilter is doing things AviSynth really isn't designed for so it's "breaking" the normal grammar.

bman 07-14-2003 04:30 AM

@FredThompson
So , is your script working ???
Are u getting better results with this script ???
I'm curiouse :D
bman

FredThompson 07-14-2003 04:42 AM

yes, it's working. I've removed the blur before a scene change. Right now I'm waiting for a 4:1:1 chroma filter to help fix some problems with saturated colors. Screenshots are at http://www.geocities.com/fredthompson6 The script posted there is old.

audioslave 07-14-2003 06:52 AM

@FredThompson,

What do your working non-blur script look like? And do you get smaller files without the blur?

FredThompson 07-15-2003 05:07 AM

I guess "better" is a personal opinion ;)

Full script should be up within a day or so. I got sidetracked with wavelet noise compression and have also played with Shadow Smoother for near-black smoothing. Also worked with Xesdeeni's 411Helper to help remove some artifacts. Waiting on an answer wrt BorderControl.

I don't use the Sansgrip cropping/resizing stuff.

Script is field-based for interlaced material, not progressive.

You can try the script yourself soon enough.

audioslave 07-15-2003 05:12 AM

@FredThompson,

Looking forward to see and test your script! Hurry please! :wink:

FredThompson 07-16-2003 03:19 AM

ok, the site is updated

http://www.geocities.com/fredthompson6

Something went bad wrong because there is some blurring that shouldn't be there. It should be fixed fairly soon. It's 4 AM and I'm pooped

Take a look at how the saturated red and near-blacks were handled. Trying to track down a problem with how AviSynth parses lines ate up 4 hours and I'm not going to stay up trying to fix the script.

cropping and border are hardcoded. Lots of variables, including those, will be pulled out soon enough.

I haven't tested enough to know if the double Shadow Smoother is causing the problems or not.

Dialhot 07-16-2003 04:04 AM

A little remark : you have all your avs filters in the plugin directory of avs2.52. So you do not need any "LoadPlugin" line in your script : avs2.52 has an autoload feature.

Other : you start by a "ConvertToYUY2" followed by a "ConvertToYV12" (with cnr2 used between the two) : don't you have a chroma noise reducer usable in YV12 ?

All these colorspace changes kill your chroma and I'm sure it's not your purpose ;-)

FredThompson 07-16-2003 04:19 AM

yes, I know. The intent is to build a modular script collection such that all the details are hidden.

Shadow Smoother forces me to have RGB at some point because it's a VirtualDub filter. DarkSmoother performs better and is AviSynth but very slow.

Pops is also RGB and limiter isn't. I do need to pay more attention to color but the first focus was to get rid of near-black swim and such. I think that is being handled ok except I don't know why it's now too smooth. I was playing around with putting all the filtering inside the field split and messed something up when I tried to put them back to the original locations. Xesdeenis' lines mix modes on purpose. I also can't replicate his results and doom9's forum is down right now.

I know it's a mess right now. The focus was on noise reduction first and I'll start tiddying up the colorspace issues afterwards.

I'm VERY open to colorspace suggestions. That's the next step, I think. Well, maybe a little WarpSharp if that's the only way to clean up the over emphasis of brights. Look at the camcorder screenshots and you'll see it in the smoke and their skin. I know Shadow Smoother needs tuning. I suspect the Xesdeeni lines are screwing it all up. His samples showed proper removal of 4:1:1 but I've got blockiness.

I'm also too tired to think coherently. Thanks for the resonse. Lemme know if you see glaring problems or have replacement ideas.


All times are GMT -5. The time now is 01:36 AM  —  vBulletin © Jelsoft Enterprises Ltd

Site design, images and content © 2002-2024 The Digital FAQ, www.digitalFAQ.com
Forum Software by vBulletin · Copyright © 2024 Jelsoft Enterprises Ltd.