digitalFAQ.com Forums [Archives]

digitalFAQ.com Forums [Archives] (http://www.digitalfaq.com/archives/)
-   Avisynth Scripting (http://www.digitalfaq.com/archives/avisynth/)
-   -   Avisynth: Motion adaptive filtering now possible? (http://www.digitalfaq.com/archives/avisynth/3594-avisynth-motion-adaptive.html)

kwag 05-30-2003 04:10 PM

Quote:

Originally Posted by rendalunit
but the problem is that when there's a scene change then the first frame of the new scene is blurry :roll:

ren

I have notied that too ren, and I'm adding a work around that :)
But I also see a problem in your script, and that is that you are using fixed values ( 1.58 ) instead of using value returned as the parameter to blur. This causes a sharp turn on/turn off of the filter between boundaries, and will make sort of "flashing" visuals every time a filter is turned on and turned off :!:

-kwag

jorel 05-30-2003 04:15 PM

Quote:

Originally Posted by DorvalCS
Did anyone of you compare a scene (or frame) from this new script to the same scene created with the last "optimal script" for AviSynth 2.0x?

With this new adaptive script I noticed that the colors were washed out... It is especially noticeable with the black :?

Is it just me?

:)

install avisynth251 with ffvfw option!!!

:wink:

rendalunit 05-30-2003 05:34 PM

Quote:

Originally Posted by kwag
But I also see a problem in your script, and that is that you are using fixed values ( 1.58 ) instead of using value returned as the parameter to blur. This causes a sharp turn on/turn off of the filter between boundaries, and will make sort of "flashing" visuals every time a filter is turned on and turned off

You're right! There's flickering which is especially noticeable with the credits. This is !muy no bueno! :wink:

ren

kwag 05-30-2003 05:45 PM

Quote:

Originally Posted by rendalunit
Quote:

Originally Posted by kwag
But I also see a problem in your script, and that is that you are using fixed values ( 1.58 ) instead of using value returned as the parameter to blur. This causes a sharp turn on/turn off of the filter between boundaries, and will make sort of "flashing" visuals every time a filter is turned on and turned off

You're right! There's flickering which is especially noticeable with the credits. This is !muy no bueno! :wink:

ren

Hey, no sweat :!:, it's been only a couple of days and we already can encode at 704x480 with a >~30% better quality than two days ago :mrgreen:
So it's a matter of fine tunning this stuff, and we'll be rocking :lol:

-kwag

ovg64 05-30-2003 06:07 PM

I see you guys are talking allready about encoding more at 704x480 but with my Athlon xp 1700 i dont think ill be doing any 704 yet even with the 30% speed improvement in avs2.51. :roll:

ovg64 05-30-2003 06:20 PM

Quote:

Originally Posted by kwag
Quote:

Originally Posted by ovg64
now it would be nice if MovieStacker would generate our avs scripts again. :mrgreen:

It's just a matter of time, and a matter of muaddib getting his motheboard fixed :!: His machine went bad (again!) last week, and he told me he would be unavailable for some days until he gets his system fixed. I'm sure he will be surprised when he logs back on :mrgreen:

-kwag

Maybe we should get some Donations and buy Muaddib that Mothemboard that way we can speed up things a little. :mrgreen:

kwag 05-30-2003 06:29 PM

Quote:

Originally Posted by ovg64
Maybe we should get some Donations and buy Muaddib that Mothemboard that way we can speed up things a little. :mrgreen:

Yeah, let's take donations and when we get enough, I'll buy him a new 3 Gigahertz P4, but I'll keep it and send him my P4 @1.6Ghz :mrgreen:

ovg64 05-30-2003 08:21 PM

Quote:

I'll buy him a new 3 Gigahertz P4, but I'll keep it and send him my P4 @1.6Ghz :mrgreen
My dream mashine a full power 3 Gig P4,
Three years from now when i get it it won't
be the dream mashine anymore. :mrgreen:

muaddib 05-30-2003 08:59 PM

Quote:

Originally Posted by kwag
Quote:

Originally Posted by ovg64
now it would be nice if MovieStacker would generate our avs scripts again. :mrgreen:

It's just a matter of time, and a matter of muaddib getting his motheboard fixed :!: His machine went bad (again!) last week, and he told me he would be unavailable for some days until he gets his system fixed. I'm sure he will be surprised when he logs back on :mrgreen:

-kwag

MUCH MORE THEN SURPRISED!!
:bugeyes: :bugeyes: :bugeyes: :bugeyes: :bugeyes: :bugeyes:
:jawdrop: :jawdrop: :jawdrop: :jawdrop: :jawdrop: :jawdrop: :jawdrop: :jawdrop: :jawdrop: :jawdrop:
I need to install AVS2.5 to try that!
(well I need to install everything again... I did a fresh install of WinXP)

BTW... my system is now stable (i hope) and it's flying smooth! :mrgreen:
I just bought a new machine and it's really "near" of my dream system.
Here is my rig:
ABIT IC7 - Pentium IV 2.53GHz - 512MB Dual DDR 400 Kingston
MSI GeForce4 Ti4200 AGP 8x - 2x 80GB UDMA133 (8MB buffer) Raid 0


Oh man... this baby is FAST! 8)

ovg64 05-30-2003 09:25 PM

Quote:

Here is my rig:
ABIT IC7 - Pentium IV 2.53GHz - 512MB Dual DDR 400 Kingston
MSI GeForce4 Ti4200 AGP 8x - 2x 80GB UDMA133 (8MB buffer) Raid 0


Oh man... this baby is FAST! 8)
Nice Rig Muad, wouldn't I like to call Michall Dell and tell him to send me one 4 Christmas. :D

rendalunit 05-30-2003 11:52 PM

@kwag,

I rewrote the script I posted earlier:
Code:

Loadplugin("C:\encoding\filters25\MPEG2Dec3.dll")
Loadplugin("C:\encoding\filters25\Deen.dll")
Mpeg2Source("D:source.d2v")
Deen("m2d",1,10,12)
BicubicResize(512, 462, 1/3, 1/3, 5, 0, 710, 480)
val=0
amnt=0
FrameEvaluate("val=YDifferenceFromPrevious()")
ScriptClip("amnt=((val/10)>1.58) ? 1.58 : val/10. blur(0).Subtitle(string(amnt), y=30)")
ScriptClip("Subtitle(string(val))")
ScriptClip("val>=10 && val<20 ? blur(1.58).blur((val-10)/10) : blur(0)")
ScriptClip("val>=20 && val<35 ? blur(1.58).blur(1.58) : blur(0)")
blur(amnt).mergeluma(blur(0.2))
AddBorders(8, 9, 8, 9)
Limiter()

It transitions a lot better (not as much flickering). YDifferenceFromPrevious values above 35 seemed to usually be scene changes so i made 35 the cutoff point

ren

kwag 05-31-2003 12:10 AM

Hi ren,

The trick is to keep a variable assigned from the last frame, and compare to the current frame. Then establish a trigger threshold. So when there is a scene change, there is an abrupt change in val, and we don't apply filters at that point!
Right now I'm looking with Vdub at the value that is assigned to val on every scene change. It's usually above 3. So I'm modifying the script to consider that if (last frame to current frame diff is > 1) "abrupt change!", don't apply filters, because usually a frame to frame change increases or decreases at around .2 to .3, but not any higher :)

-kwag

Jellygoose 05-31-2003 03:56 AM

Hi all!

after watching the first movie on my TV encoded with the new script, I have to say that I'm still impressed... I haven't noticed any bad colors at all... black is completely black, and colors actually look more natural than before in my eyes... :o
however I did notice the flashing you guys were talking about. It's not very obvious, however, I'd like to get rid of it...
kwags idea sounds great, as usual, so I'm just leaning back, waiting for new script-food! :wink:

jorel 05-31-2003 05:45 AM

:!:
i had big problems,
was the decompressor.

using this script and avisynth251 my result was washed...horrible.

solving the problem:
install avisynth251 with ffvfw option!!!

i got the big sample that Kwag give with 11.8mb,
the image is incredible! :!: ! :wink: :wink: :wink:

:!:

Jellygoose 05-31-2003 05:55 AM

I can't even remember installing a YV12 decompressor... however, my picture quality is amazing with this script... :o
sorry jorel, I don't know what's going on ...

Bchteam 05-31-2003 06:46 AM

Quote:

Originally Posted by Jellygoose
I can't even remember installing a YV12 decompressor... however, my picture quality is amazing with this script... :o
sorry jorel, I don't know what's going on ...

Are you talking about the latest optimal script from Kwag???

jorel 05-31-2003 06:53 AM

Quote:

Originally Posted by Bchteam
Quote:

Originally Posted by Jellygoose
I can't even remember installing a YV12 decompressor... however, my picture quality is amazing with this script... :o
sorry jorel, I don't know what's going on ...

Are you talking about the latest optimal script from Kwag???

seems that only i had this problem....
but no more, see what i did:

"Reinstalled only AviSynth 2.51 WITH ffvfw option!"

thanks DorvalCS for this big hint.
:D

edited,
big quality now.
:)

Jellygoose 05-31-2003 07:03 AM

Quote:

Originally Posted by Bchteam
Quote:

Originally Posted by Jellygoose
I can't even remember installing a YV12 decompressor... however, my picture quality is amazing with this script... :o
sorry jorel, I don't know what's going on ...

Are you talking about the latest optimal script from Kwag???

Yes I am...

rendalunit 05-31-2003 12:35 PM

Quote:

Originally Posted by kwag
Right now I'm looking with Vdub at the value that is assigned to val on every scene change. It's usually above 3.

8O 8O way higher than 3 (like ~35-200). I wonder why the numbers you're talking about are so low :?: Are those numbers the YDifferenceFromPrevious divided by a constant?

btw- i'm using 528x480 in case it's because of using different resolutions

thnx,
ren

jorel 05-31-2003 12:57 PM

@ friendalunit and Kwag

excuse me this "pause" friends:

now my system is working with a help from DorvalCS. :wink:
the error was that i wasn't install the ffvfw option.

now everything is "shine" with avisynth251..
i see grat results in samples with great quality.
i never see quality like that....and faster :!:
:o

go ahead friends, you're the best, i'm impressed.
thank you.
:D

kwag 05-31-2003 01:02 PM

Quote:

Originally Posted by rendalunit
Quote:

Originally Posted by kwag
Right now I'm looking with Vdub at the value that is assigned to val on every scene change. It's usually above 3.

8O 8O way higher than 3 (like ~35-200). I wonder why the numbers you're talking about are so low :?: Are those numbers the YDifferenceFromPrevious divided by a constant?

btw- i'm using 528x480 in case it's because of using different resolutions

thnx,
ren

It's because of the line "ScriptClip("val=YDifferenceFromPrevious()/14.55" :) I'm testing on 704x480 resolution.
I'm getting a difference of ~3.x from previous scene to next scene on a scene change.

-kwag

Gaudi 05-31-2003 03:00 PM

I think I may be missing something.
How can I do to include this conditional filter into my script.
Should I download a new .dll?
or just using the provided optimal script will do?

Many thanks.


Gaudi

kwag 05-31-2003 03:07 PM

Quote:

Originally Posted by Gaudi
I think I may be missing something.
How can I do to include this conditional filter into my script.
Should I download a new .dll?
or just using the provided optimal script will do?

Many thanks.


Gaudi

Just install AviSynth 2.51 (Follow sh0dan's signature) and use the posted script for avisynth 2.51.
And stay tuned in this thread, because more changes WILL be coming soon ;)

-kwag

Gaudi 05-31-2003 03:18 PM

Quote:

Originally Posted by kwag
Quote:

Originally Posted by Gaudi
I think I may be missing something.
How can I do to include this conditional filter into my script.
Should I download a new .dll?
or just using the provided optimal script will do?

Many thanks.


Gaudi

Just install AviSynth 2.51 (Follow sh0dan's signature) and use the posted script for avisynth 2.51.
And stay tuned in this thread, because more changes WILL be coming soon ;)

-kwag

Thanks Kwag.

You bet I will.

Gaudi

ovg64 05-31-2003 03:21 PM

What kind of changes may i ask :?:
another :?: what happen if i put the line
MergeLuma(blur(0.2)) in front of the bilinear adaptive script line?
will it work like it suppose to?

kwag 05-31-2003 04:05 PM

Quote:

Originally Posted by ovg64
What kind of changes may i ask :?:
another :?: what happen if i put the line
MergeLuma(blur(0.2)) in front of the bilinear adaptive script line?
will it work like it suppose to?

I would add mergeluma(blur(0.1) as a static filter, and leave higher values as dynamic with the adaptive function.
Go ahead and add it :!, it will then make the MIN sustained value of 0.2 instead of close to 0 as it is now.
So the script should read something like this:

Code:

MaxTreshold=1.58

UnFilter(50, 50)
BicubicResize( Your_Resize_Values_Here )
STMedianFilter(8, 32, 0, 0 )
TemporalSoften(2,7,7,3,2) # Experimental!
mergechroma(blur(1.50)) # Static filtering
mergeluma(blur(0.1)) # Static filtering
## Dynamic linear adaptive filtering ##
ScriptClip("val=YDifferenceFromPrevious()/14.55" + "val > MaxTreshold ? MergeLuma(blur(MaxTreshold)) : MergeLuma(blur( val ))")
##
#LetterBox( Your_Values_Here ) # Depends on situation. Use MovieStacker!
#AddBorders( Your_Values_Here ) # Depends on situation. Use MovieStacker!
Limiter()

Now the file size will be even smaller that before :D

Edit: The changes to come are to detect scene changes, and avoid abrupt changes in blur, which cause slight "blinks" on some sporadic frames.

-kwag

audioslave 05-31-2003 04:47 PM

Is there a way of getting rid of Gibbs in this excellent new script? Like the Dust filters... I know the Dust filters don't work in AviSynth 2.5* but are there any similar filters that work in the same way as FaeryDust for example?

ovg64 05-31-2003 05:38 PM

The only other noise filter i know other than STM for 2.51 is Deen witch is works like Convolution 3D and give you even a smaller file size when use it with STMedian. :)

Ex. deen("a3d",1,10,12)

audioslave 05-31-2003 05:47 PM

@ovg64

Thanx! I'll try it out right away! :wink:

jorel 05-31-2003 05:48 PM

8)

great news from sh0dan:
"No "Cannot locate decompressor (YV12)" messages."
and tons more with...

AviSynth 2.5.2 Released!

http://www.kvcd.net/forum/viewtopic.php?p=28135#28135

ovg64 05-31-2003 05:59 PM

Quote:

Originally Posted by jorel
8)

great news from sh0dan:
"No "Cannot locate decompressor (YV12)" messages."
and tons more with...

AviSynth 2.5.2 Released!

http://www.kvcd.net/forum/viewtopic.php?p=28135#28135

Well here we go again, time to Download again .
yet another faster version?


Thanks Jorel :wink:

jorel 05-31-2003 06:06 PM

of course my friend,
see some ...

Optimizations:
* Added MMX RGB24->YUY2 conversion.
* Minor changes to existing RGB32 -> YUY2 MMX.
* Minor speedup to ISSE limiter.
* Added SoftWire dynamic compiled horizontal resizer.
Approximately 10-15% faster - maybe even more on P4.

:)

*otimizations copied from shOdan post

http://www.kvcd.net/forum/viewtopic.php?p=28135#28135

kwag 05-31-2003 10:04 PM

Motion Adaptive Filtering with Scene Change Detection Done!
 
Enjoy :D

Code:

## DLL Section ##
#
LoadPlugin("C:\Filters25\MPEG2Dec3.dll")
LoadPlugin("C:\Filters25\STMedianFilter.dll")
LoadPlugin("C:\Filters25\UnFilter.dll")
#
####

## Defined Variables and Constants ##
#
MaxTreshold = 1.58
scd_trigger = 1.0 # Scene change trigger value.
cf = 0 # Current frame.
lf = 0 # Last frame
#
####

## Main section and static filters ###
#
Mpeg2Source("Your_D2V_Source_Here")
UnFilter(50, 50)
BicubicResize( Your_Resize_Values_Here )
STMedianFilter(8, 32, 0, 0 )
TemporalSoften(2,7,7,3,2) # Experimental!
MergeChroma(blur(1.50))
MergeLuma(blur( 0.1))
#
####

## Dynamic linear adaptive filters and scene change detection ##
#
FrameEvaluate("lf = YDifferenceFromPrevious()/16")
FrameEvaluate("cf = YDifferenceToNext()/16")
ScriptClip("(cf - lf) < scd_trigger && cf < MaxTreshold ? MergeLuma(blur(cf)) : MergeLuma(blur( 0.1 ))")
ScriptClip("(cf - lf) < scd_trigger && cf >= MaxTreshold ? MergeLuma(blur(MaxTreshold)) : MergeLuma(blur( 0.1 ))")
#LetterBox( Your_Values_Here ) # Depends on situation. Use MovieStacker!
#AddBorders( Your_Values_Here ) # Depends on situation. Use MovieStacker!
Limiter()
#
####

Sample here: www.kvcd.net/new-scene-change.mpg
Load it in vdub, and you'll see the show :mrgreen:
"Flashes" are now permanently gone bye bye 8)

*** PLEASE, TEST THIS, SO I CAN UPDATE THE CURRENT SCRIPT !!! ***
I won't update it until I get more feedback, and that it's all working right for you too 8)
Then we can go on and build more filteres "hocked" into this :!:

-kwag

ovg64 05-31-2003 10:34 PM

Y just tried it K and it works find .

Good Deal 8)

kwag 05-31-2003 10:38 PM

Quote:

Originally Posted by ovg64
Y just tried it K and it works find .

Good Deal 8)

Try it again. I forgot to add a line: ScriptClip("(cf - lf) < scd_trigger && cf >= MaxTreshold ? MergeLuma(blur(MaxTreshold)) : MergeLuma(blur( 0.1 ))")
I just edited the post :!:

-kwag

rendalunit 05-31-2003 10:43 PM

Hi kwag,

The scene change detection was perfect in your 'city by the sea' sample :D
Do you still have the script that will add those subtitles? I'd like to do some testing too and those subs would be very helpful- i tested a script with evaluation of next frame yesterday and the encoding time doubled! 8O I'm going to try this one now 8)

Thanks!
ren

kwag 05-31-2003 10:47 PM

You bet ren :D

Code:

LoadPlugin("C:\Filters25\MPEG2Dec3.dll")
LoadPlugin("C:\Filters25\STMedianFilter.dll")
LoadPlugin("C:\Filters25\UnFilter.dll")
LoadPlugin("C:\Filters25\BlockBuster.dll")

MaxTreshold=1.58
scd_trigger = 1.0
scd="!!!!Scene Change Detected!!!!"
noscd="Normal Frame"
cf=0
lf=0

Mpeg2Source("K:\DVDbot\CITY_BY_THE_SEA\VIDEO_TS\sea.d2v")

UnFilter(50, 50)
BicubicResize(672, 448, 0, 0.6, 0, 0, 720, 480)
STMedianFilter(8, 32, 0, 0 )
TemporalSoften(2,7,7,3,2) # Experimental!
MergeChroma(blur(1.50))
MergeLuma(blur( 0.1))

## Dynamic linear adaptive filtering ##
FrameEvaluate("lf = YDifferenceFromPrevious()/16")
FrameEvaluate("cf = YDifferenceToNext()/16")
ScriptClip("(cf - lf) < scd_trigger && cf < MaxTreshold ? MergeLuma(blur(cf)) : MergeLuma(blur( 0.1 ))")
ScriptClip("(cf - lf) < scd_trigger && cf >= MaxTreshold ? MergeLuma(blur(MaxTreshold)) : MergeLuma(blur( 0.1 ))")

ScriptClip("(cf - lf) < scd_trigger && cf < MaxTreshold ? Subtitle(noscd,1,60) : Subtitle(scd,1,60)")
ScriptClip("Subtitle(String(cf),1,30)")

I didn't use add borders because I wanted to see the full frame 8)

-kwag

kwag 05-31-2003 10:51 PM

It's beer time :mrgreen: :drink:

ovg64 05-31-2003 10:53 PM

Just did a 501 frame clip output 4697Kbs same size looks as well
I must be too tire to see any difference :tongue2:

Good Deal man

Aren't you going to update that sucker up there K?, i mean the Optimal cript. :wink:

jorel 05-31-2003 11:05 PM

Quote:

Originally Posted by kwag
It's beer time :mrgreen: :drink:

one more beer for you dear friend.

i did using ToK:
Total Frames: 1001
Total Time : 00:00:33

Encoding... CQ : 65,000
Final Encoded Size: 5.725.261
Total Time (all operations): 00:01:50

my system is "tired", long time without reboot,
but the result is cool with clear details, very sharp.
:D

i download the sample too and i'm impressed with
the quality, the color of skin face, the "tunnel",
the broken glasses in the floor and
the "dimension" along the stairs. 8O

8)

yes, it's beer time :!:
:wink:


All times are GMT -5. The time now is 08:43 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.