Quantcast Avisynth: Anyone Try Fmf? - Page 2 - digitalFAQ.com Forums [Archives]
  #21  
11-17-2003, 03:57 PM
fabrice fabrice is offline
Free Member
 
Join Date: Mar 2003
Location: Madrid-Spain
Posts: 515
Thanks: 0
Thanked 0 Times in 0 Posts
Hi Jellygoose,

The problem of the unfilter linear filtering is that it blur the whole image, even if there is only a 'static' figure' in front of a moving scene.

The temporal filter, with a small radius gives a blurring effect, without ghosting (at least with what I tried). That's why I reduce the radius and increase the threshold with the motion...

I have to try mi script with the sample that generate CQMatic, to see the overall size...

Salu2
Fabrice

EDITED: with the overall sample, the difference is only 5%... It was 8% with a still scene...
Reply With Quote
Someday, 12:01 PM
admin's Avatar
Site Staff / Ad Manager
 
Join Date: Dec 2002
Posts: 42
Thanks: ∞
Thanked 42 Times in 42 Posts
  #22  
11-17-2003, 05:57 PM
digitall.doc digitall.doc is offline
Free Member
 
Join Date: Jul 2003
Location: Valencia (Espaņa)
Posts: 741
Thanks: 0
Thanked 0 Times in 0 Posts
Wellcome Jellygoose,
I wrong the terms. I wanted to say, from what I've readin the forums, that it seems better temporal smoothing in low motion, and spatial smoothing in high motion. And I realise that I did it also wrong in my test script, with STMedianFilter set to spatial in low motion, instead of temporal.
I don't think it's a question to beat nothing, but to improve (if possible) the MA script. The 3 level motion (that are also linear, as far as I know) allows us to employ three different ways to filter at three levels, and employes a different approach to stimate motion. I don't know if with this method, with my limited knowledge, I will get to something. But I also didn't know if I could make a KVCD and if it worthed, and... yes, it does.
Do you think we could improve our scripts in any way?. To be better looking and more compressed. Don't you imagine a way we could make a three level filtering?.
Fabrice: you get a 5% bigger size file. If we decrease maximum unfilter value in the MA (maybe 80 instead of 100), the file size will grow, but high action will be less blurred. I think the point is getting similar or smaller size, less blurred... well, more or less, I think, ... don't know nothing.
Reply With Quote
  #23  
11-17-2003, 06:44 PM
ak47 ak47 is offline
Free Member
 
Join Date: Oct 2002
Posts: 168
Thanks: 0
Thanked 0 Times in 0 Posts
Ok I did some testing and I actually was pretty impressed, its not a whole lot better but on high action scenes the blocky ness on lower bit rate is less noticeable. I tested them both with an average bit rate of 1000 in vbr mode, in other words MCE was wrong since the final size is 125mbs, this is on both videos. Also I tested it with an anime and kvcd format. The next will be my two scripts and size. Also I tested it without compression and saw the avs script, both look identical, I didn't see any quality loss due to the filtering.
Code:
nf =  0

Mpeg2Source("C:\GOD1\VIDEO_TS\kenshin E1.d2v")

Telecide(order=1,guide=1,post=0).Decimate(cycle=5)
TomsMoComp(1,5,1)
undot() 
Limiter() 
asharp(1, 4)
BicubicResize(496, 320, 0, 0.6, 2, 9, 716, 462) 
STMedianFilter(3, 3, 1, 1 ) 
MergeChroma(blur(1.50)) 
MergeLuma(blur(0.1))

SwitchThreshold = (Width<=352) ? 4 : (Width<=480) ? 3 : 2 
ScriptClip("nf = YDifferenceToNext()"+chr(13)+ "nf >= SwitchThreshold ? \ 
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) ") 

AddBorders(24, 80, 24, 80)
Limiter() 

function fmin( int f1, int f2) { 
  return ( f1<f2 ) ? f1 : f2 
}
This script took 1704.69s of 1441.94s an average of 1.2 times the movie.
Code:
function Low_Motion_Filter(clip c)
{
c = FluxSmooth(c,param1_lm,-1)
c = UnFilter(c,param2_lm,param2_lm)
C = MergeChroma(c,blur(c,param3_lm))
c = MergeLuma(c,blur(c,param4_lm))
return c
}

function Medium_Motion_Filter(clip c)
{
c = FluxSmooth(c,param1_mm,param2_mm)
c = UnFilter(c,param3_mm,param3_mm)
c = MergeChroma(c,blur(c,param4_mm))
c = MergeLuma(c,blur(c,param5_hm))
return c
}

function High_Motion_Filter(clip c)
{
c = FluxSmooth(c,-1,param1_hm)
c = UnFilter(c,param2_hm,param2_hm)
c = MergeChroma(c,blur(c,param3_hm))
c = MergeLuma(c,blur(c,param4_hm))
return c
}

Mpeg2Source("C:\GOD1\VIDEO_TS\kenshin E1.d2v")

Telecide(order=1,guide=1,post=0).Decimate(cycle=5)
TomsMoComp(1,5,1)
undot()
Limiter()
BicubicResize(496, 320, 0, 0.6, 2, 9, 716, 462)
STMedianFilter(3, 3, 1, 1 )
FMF(param3_lm_min=1.25,param3_lm_max=1.4,param4_mm_min=1.4,
param4_mm_max=1.5,param3_hm_min=1.5,param3_hm_max=1.58,
param4_lm_min=0.08,param4_lm_max=0.14,param5_mm_min=0.14,
param5_mm_max=0.2,param4_hm_min=0.2,param4_hm_max=0.3,
param1_lm_min=14,param1_lm_max=7,param2_lm_min=-5,param2_lm_max=-15,param1_mm_min=7,param1_mm_max=5,
param2_mm_min=3,param2_mm_max=7,param3_mm_min=-15,
param3_mm_max=-25,param1_hm_min=8,param1_hm_max=14,param2_hm_min=-25,param2_hm_max=-45)
AddBorders(24, 80, 24, 80)
Limiter()
This took 2070.63s of 1441.94s an average of 1.4 times the movie.
I could give someone the beginning part of the video, 4mbs worth, since it's a DVD off of TV caps (the quality is still DVD), but I think that is illegal so I am not going to unless I know first. Or you can just try it out yourself if you want to.
Any comments are welcome even if you think my script sucks.
P.S. Should this thread be moved to the optimal script page, since now were comparing the MA with another script.
__________________
Later ak
Reply With Quote
  #24  
11-17-2003, 08:09 PM
audioslave audioslave is offline
Free Member
 
Join Date: Mar 2003
Location: Sweden
Posts: 725
Thanks: 0
Thanked 0 Times in 0 Posts
@ak47
I'm getting an syntax error when using your latest posted FMF script?! On line 36, column 0. That's the line that start with FMF... Any ideas on why? Do I need anything besides the filters for this script to work?
__________________
AudioSlave
Reply With Quote
  #25  
11-17-2003, 08:32 PM
ak47 ak47 is offline
Free Member
 
Join Date: Oct 2002
Posts: 168
Thanks: 0
Thanked 0 Times in 0 Posts
Sorry forgot to mention that the line FMF(*****) should all be one line, I paged the lines because I didn't want to thread to look weird.
__________________
Later ak
Reply With Quote
  #26  
11-17-2003, 08:35 PM
audioslave audioslave is offline
Free Member
 
Join Date: Mar 2003
Location: Sweden
Posts: 725
Thanks: 0
Thanked 0 Times in 0 Posts
@ak47
Thanks mate! Now that error is gone, but... now I got another one - There is no function named FMF. What's this about?

EDIT: Nevermind. I read the Doom9 forum and downloaded the fmf.avs file. I just added "Import("D:\xxxxx\fmf-1.5b1.avs")" first in the script!

BTW The fmf.avs file looks like this (just copy it and paste it in Notepad or something and name the file "fmf-1.5b1.avs"):
Quote:
# FULL MOTION FILTER v1.5 b1 (10/07/2003) by HomiE FR (homie.fr@wanadoo.fr)

# FULL MOTION FILTER FUNCTION
function FMF(clip c,
\ float "threshold_min",float "threshold_lm",float "threshold_hm",float "threshold_max",
\ float "threshold_sc_min",float "threshold_sc_max",int "distance_sc_min",
\ float "temporal_influence",bool "chroma",int "transition_length",bool "debug",
\ val "param1_lm_min",val "param1_lm_max",
\ val "param2_lm_min",val "param2_lm_max",
\ val "param3_lm_min",val "param3_lm_max",
\ val "param4_lm_min",val "param4_lm_max",
\ val "param5_lm_min",val "param5_lm_max",
\ val "param1_mm_min",val "param1_mm_max",
\ val "param2_mm_min",val "param2_mm_max",
\ val "param3_mm_min",val "param3_mm_max",
\ val "param4_mm_min",val "param4_mm_max",
\ val "param5_mm_min",val "param5_mm_max",
\ val "param1_hm_min",val "param1_hm_max",
\ val "param2_hm_min",val "param2_hm_max",
\ val "param3_hm_min",val "param3_hm_max",
\ val "param4_hm_min",val "param4_hm_max",
\ val "param5_hm_min",val "param5_hm_max")
{
# SETTING CHROMA MOTION ESTIMATION
chroma = default(chroma,false)
global chroma = chroma

# SETTING MOTION LEVELS THRESHOLDS
threshold_min = default(threshold_min,0.0)
threshold_lm = default(threshold_lm,(chroma == true) ? 4.0 : 5.0)
threshold_hm = default(threshold_hm,(chroma == true) ? 12.0 : 15.0)
threshold_max = default(threshold_max,(chroma == true) ? 16.0 : 20.0)
global threshold_min = threshold_min
global threshold_lm = threshold_lm
global threshold_hm = threshold_hm
global threshold_max = threshold_max

# SETTING MIN/MAX SCENE CHANGE THRESHOLDS
threshold_sc_min = default(threshold_sc_min,(chroma == true) ? 20.0 : 30.0)
threshold_sc_max = default(threshold_sc_max,(chroma == true) ? 40.0 : 60.0)
global threshold_sc_min = threshold_sc_min
global threshold_sc_max = threshold_sc_max

# SETTING MIN DISTANCE BETWEEN SCENE CHANGES
distance_sc_min = default(distance_sc_min,10)
global distance_sc_min = distance_sc_min

# SETTING TEMPORAL INFLUENCE
temporal_influence = default(temporal_influence,50.0)
global temporal_influence = temporal_influence

# SETTING MOTION LEVEL TRANSITION
transition_length = default(transition_length,10)
global transition_length = transition_length

# ENABLING/DISABLING DEBUG INFORMATION
debug = default(debug,false)
global debug = debug

# SETTING MIN/MAX LOW MOTION PARAMETERS
param1_lm_min = default(param1_lm_min,0)
param1_lm_max = default(param1_lm_max,0)
param2_lm_min = default(param2_lm_min,0)
param2_lm_max = default(param2_lm_max,0)
param3_lm_min = default(param3_lm_min,0)
param3_lm_max = default(param3_lm_max,0)
param4_lm_min = default(param4_lm_min,0)
param4_lm_max = default(param4_lm_max,0)
param5_lm_min = default(param5_lm_min,0)
param5_lm_max = default(param5_lm_max,0)
global param1_lm_min = param1_lm_min
global param1_lm_max = param1_lm_max
global param2_lm_min = param2_lm_min
global param2_lm_max = param2_lm_max
global param3_lm_min = param3_lm_min
global param3_lm_max = param3_lm_max
global param4_lm_min = param4_lm_min
global param4_lm_max = param4_lm_max
global param5_lm_min = param5_lm_min
global param5_lm_max = param5_lm_max

# SETTING MIN/MAX MEDIUM MOTION PARAMETERS
param1_mm_min = default(param1_mm_min,0)
param1_mm_max = default(param1_mm_max,0)
param2_mm_min = default(param2_mm_min,0)
param2_mm_max = default(param2_mm_max,0)
param3_mm_min = default(param3_mm_min,0)
param3_mm_max = default(param3_mm_max,0)
param4_mm_min = default(param4_mm_min,0)
param4_mm_max = default(param4_mm_max,0)
param5_mm_min = default(param5_mm_min,0)
param5_mm_max = default(param5_mm_max,0)
global param1_mm_min = param1_mm_min
global param1_mm_max = param1_mm_max
global param2_mm_min = param2_mm_min
global param2_mm_max = param2_mm_max
global param3_mm_min = param3_mm_min
global param3_mm_max = param3_mm_max
global param4_mm_min = param4_mm_min
global param4_mm_max = param4_mm_max
global param5_mm_min = param5_mm_min
global param5_mm_max = param5_mm_max

# SETTING MIN/MAX HIGH MOTION PARAMETERS
param1_hm_min = default(param1_hm_min,0)
param1_hm_max = default(param1_hm_max,0)
param2_hm_min = default(param2_hm_min,0)
param2_hm_max = default(param2_hm_max,0)
param3_hm_min = default(param3_hm_min,0)
param3_hm_max = default(param3_hm_max,0)
param4_hm_min = default(param4_hm_min,0)
param4_hm_max = default(param4_hm_max,0)
param5_hm_min = default(param5_hm_min,0)
param5_hm_max = default(param5_hm_max,0)
global param1_hm_min = param1_hm_min
global param1_hm_max = param1_hm_max
global param2_hm_min = param2_hm_min
global param2_hm_max = param2_hm_max
global param3_hm_min = param3_hm_min
global param3_hm_max = param3_hm_max
global param4_hm_min = param4_hm_min
global param4_hm_max = param4_hm_max
global param5_hm_min = param5_hm_min
global param5_hm_max = param5_hm_max

# INITIALIZING MOTION LEVEL
global motion_level = 0

# INITIALIZING SCENE CHANGE THRESHOLD/SCENE CHANGE POSITION
global threshold_sc = threshold_sc_min
global pos_sc = 0

# INITIALIZING OLD/NEW/END MOTION LEVELS FOR MOTION LEVEL TRANSITIONS
global motion_level_old = 0
global motion_level_new = 0
global motion_level_end = 0

# INITIALIZING MOTION LEVEL TRANSITION POSITION
global transition = 0

# INITIALIZING AVERAGE DIFFERENCE
global diff_avg = 0.0

# INITIALIZING LOW MOTION PARAMETERS
global param1_lm = param1_lm_min
global param2_lm = param2_lm_min
global param3_lm = param3_lm_min
global param4_lm = param4_lm_min
global param5_lm = param5_lm_min

# INITIALIZING MEDIUM MOTION PARAMETERS
global param1_mm = param1_mm_min
global param2_mm = param2_mm_min
global param3_mm = param3_mm_min
global param4_mm = param4_mm_min
global param5_mm = param5_mm_min

# INITIALIZING HIGH MOTION PARAMETERS
global param1_hm = param1_hm_min
global param2_hm = param2_hm_min
global param3_hm = param3_hm_min
global param4_hm = param4_hm_min
global param5_hm = param5_hm_min

# SETTING TEMPORAL RATIOS ACCORDING TO TEMPORAL INFLUENCE
global ti1 = Pow(temporal_influence/100,0.50)
global ti2 = Pow(temporal_influence/100,2.00)

# ENABLING/DISABLING CHROMA DIFFERENCE INFORMATION
global y_ratio = (chroma == true) ? 0.50 : 1.00
global uv_ratio = (chroma == true) ? 0.50 : 0.00

# SETTING PAST/PRESENT/FUTURE CLIPS
global clip_p2 = Trim(c,0,-2)+c
global clip_p1 = Trim(c,0,-1)+c
global clip = c
global clip_f1 = Trim(c,1,0)
global clip_f2 = Trim(c,2,0)

# SETTING OLD/NEW CLIPS FOR MOTION LEVEL TRANSITIONS
global clip_old = c
global clip_new = c

# GETTING OUTPUT RESOLUTION
width = Width(Low_Motion_Filter(clip))
height = Height(Low_Motion_Filter(clip))
global clip_resized = PointResize(clip,width,height)

# COMPUTING MOTION FILTER
c = ScriptClip(clip_resized,"MF(clip)")

# GETTING DIFFERENCES BETWEEN PAST/PRESENT/FUTURE FRAMES
c = FrameEvaluate(c,"global diff_f2 = y_ratio*YDifferenceFromPrevious(clip_f2) + uv_ratio*UDifferenceFromPrevious(clip_f2) + uv_ratio*VDifferenceFromPrevious(clip_f2)")
c = FrameEvaluate(c,"global diff_f1 = y_ratio*YDifferenceFromPrevious(clip_f1) + uv_ratio*UDifferenceFromPrevious(clip_f1) + uv_ratio*VDifferenceFromPrevious(clip_f1)")
c = FrameEvaluate(c,"global diff = y_ratio*YDifferenceFromPrevious(clip) + uv_ratio*UDifferenceFromPrevious(clip) + uv_ratio*VDifferenceFromPrevious(clip)")
c = FrameEvaluate(c,"global diff_p1 = y_ratio*YDifferenceFromPrevious(clip_p1) + uv_ratio*UDifferenceFromPrevious(clip_p1) + uv_ratio*VDifferenceFromPrevious(clip_p1)")
c = FrameEvaluate(c,"global diff_p2 = y_ratio*YDifferenceFromPrevious(clip_p2) + uv_ratio*UDifferenceFromPrevious(clip_p2) + uv_ratio*VDifferenceFromPrevious(clip_p2)")

return c
}

# MOTION ESTIMATION FUNCTION
function ME()
{
# SETTING SCENE CHANGE THRESHOLD ACCORDING TO AVERAGE DIFFERENCE
global threshold_sc = PS(threshold_sc,threshold_sc_min,threshold_sc_max, threshold_min,threshold_max)

# UPDATING SCENE CHANGE POSITION
global pos_sc = (pos_sc > 0 && pos_sc < distance_sc_min) ? (pos_sc + 1) : 0
global pos_sc = (diff_f2 > threshold_sc && pos_sc == 0) ? 1 : pos_sc

# SCANNING FOR USELESS FRAMES
global ok_p2 = (pos_sc == 5 || pos_sc == 4 || pos_sc == 3) ? 0 : 1
global ok_p1 = (pos_sc == 4 || pos_sc == 3) ? 0 : 1
global ok = (pos_sc == 3) ? 0 : 1
global ok_f1 = (pos_sc == 2) ? 0 : 1
global ok_f2 = (pos_sc == 2 || pos_sc == 1) ? 0 : 1

# DISCARDING USELESS FRAMES
diff_p2_ok = diff_p2*ok_p2
diff_p1_ok = diff_p1*ok_p1
diff_ok = diff*ok
diff_f1_ok = diff_f1*ok_f1
diff_f2_ok = diff_f2*ok_f2

# COMPUTING AVERAGE DIFFERENCE
global diff_avg = (diff_ok + ti1*(diff_p1_ok+diff_f1_ok) + ti2*(diff_p2_ok+diff_f2_ok))/(ok + ti1*(ok_p1+ok_f1) + ti2*(ok_p2+ok_f2))

# STORING OLD MOTION LEVEL
global motion_level_old = motion_level

# SETTING MOTION LEVEL ACCORDING TO AVERAGE DIFFERENCE
global motion_level = (diff_avg < threshold_lm) ? 0 : motion_level
global motion_level = (diff_avg >= threshold_lm && diff_avg <= threshold_hm) ? 1 : motion_level
global motion_level = (diff_avg > threshold_hm) ? 2 : motion_level
global motion_level = (transition > 0) ? motion_level_end : motion_level

# STORING NEW MOTION LEVEL
global motion_level_new = motion_level

# SETTING TRANSITION POSITION
global transition = (transition > 0 && transition < transition_length) ? (transition + 1) : 0
global transition = (motion_level_new != motion_level_old && transition == 0 && transition_length > 0) ? 1 : transition
global transition = (pos_sc == 3) ? 0 : transition

# STORING TARGETTED MOTION LEVEL AFTER CURRENT MOTION LEVEL TRANSITION
global motion_level_end = (transition == 1) ? motion_level_new : motion_level_end
}

# PARAMETER SCALING FUNCTION
function PS(val param_in,val param_min,val param_max,float diff_min,float diff_max)
{
param_out = Spline(diff_avg,-1,param_min,diff_min,param_min,diff_max,param_max, 255,param_max,false)
param_out = (IsInt(param_in) == true) ? round(param_out) : param_out

return param_out
}

# MOTION FILTER FUNCTION
function MF(clip c)
{
# COMPUTING MOTION ESTIMATION
ME()

# SETTING LOW MOTION PARAMETERS ACCORDING TO AVERAGE DIFFERENCE
global param1_lm = (motion_level == 0) ? PS(param1_lm,param1_lm_min,param1_lm_max,threshold _min,threshold_lm) : param1_lm
global param2_lm = (motion_level == 0) ? PS(param2_lm,param2_lm_min,param2_lm_max,threshold _min,threshold_lm) : param2_lm
global param3_lm = (motion_level == 0) ? PS(param3_lm,param3_lm_min,param3_lm_max,threshold _min,threshold_lm) : param3_lm
global param4_lm = (motion_level == 0) ? PS(param4_lm,param4_lm_min,param4_lm_max,threshold _min,threshold_lm) : param4_lm
global param5_lm = (motion_level == 0) ? PS(param5_lm,param5_lm_min,param5_lm_max,threshold _min,threshold_lm) : param5_lm

# SETTING MEDIUM MOTION PARAMETERS ACCORDING TO AVERAGE DIFFERENCE
global param1_mm = (motion_level == 1) ? PS(param1_mm,param1_mm_min,param1_mm_max,threshold _lm,threshold_hm) : param1_mm
global param2_mm = (motion_level == 1) ? PS(param2_mm,param2_mm_min,param2_mm_max,threshold _lm,threshold_hm) : param2_mm
global param3_mm = (motion_level == 1) ? PS(param3_mm,param3_mm_min,param3_mm_max,threshold _lm,threshold_hm) : param3_mm
global param4_mm = (motion_level == 1) ? PS(param4_mm,param4_mm_min,param4_mm_max,threshold _lm,threshold_hm) : param4_mm
global param5_mm = (motion_level == 1) ? PS(param5_mm,param5_mm_min,param5_mm_max,threshold _lm,threshold_hm) : param5_mm

# SETTING HIGH MOTION PARAMETERS ACCORDING TO AVERAGE DIFFERENCE
global param1_hm = (motion_level == 2) ? PS(param1_hm,param1_hm_min,param1_hm_max,threshold _hm,threshold_max) : param1_hm
global param2_hm = (motion_level == 2) ? PS(param2_hm,param2_hm_min,param2_hm_max,threshold _hm,threshold_max) : param2_hm
global param3_hm = (motion_level == 2) ? PS(param3_hm,param3_hm_min,param3_hm_max,threshold _hm,threshold_max) : param3_hm
global param4_hm = (motion_level == 2) ? PS(param4_hm,param4_hm_min,param4_hm_max,threshold _hm,threshold_max) : param4_hm
global param5_hm = (motion_level == 2) ? PS(param5_hm,param5_hm_min,param5_hm_max,threshold _hm,threshold_max) : param5_hm

# APPLYING MOTION FILTER ACCORDING TO MOTION LEVEL
c = (transition == 0 && motion_level == 0) ? Low_Motion_Filter(c) : c
c = (transition == 0 && motion_level == 1) ? Medium_Motion_Filter(c) : c
c = (transition == 0 && motion_level == 2) ? High_Motion_Filter(c) : c

# APPLYING MOTION LEVEL TRANSITION
c = (transition > 0) ? Transition() : c

# PRINTING DEBUG INFORMATION
c = (debug == true) ? Debug(c) : c

return c
}

# MOTION LEVEL TRANSITION FUNCTION
function Transition()
{
# SETTING OLD CLIP ACCORDING TO OLD MOTION LEVEL
global clip_old = (transition == 1 && motion_level_old == 0) ? Low_Motion_Filter(clip) : clip_old
global clip_old = (transition == 1 && motion_level_old == 1) ? Medium_Motion_Filter(clip) : clip_old
global clip_old = (transition == 1 && motion_level_old == 2) ? High_Motion_Filter(clip) : clip_old

# SETTING NEW CLIP ACCORDING TO NEW MOTION LEVEL
global clip_new = (transition == 1 && motion_level_new == 0) ? Low_Motion_Filter(clip) : clip_new
global clip_new = (transition == 1 && motion_level_new == 1) ? Medium_Motion_Filter(clip) : clip_new
global clip_new = (transition == 1 && motion_level_new == 2) ? High_Motion_Filter(clip) : clip_new

# SETTING OLD/NEW CLIPS WEIGHT ACCORDING TO TRANSITION POSITION
weight = 1.0*(1.0 - (1.0/transition_length)*float(transition))

# MERGING OLD/NEW CLIPS ACCORDING TO WEIGHT
c = MergeLuma(clip_new,clip_old,weight)
c = MergeChroma(c,clip_old,weight)

return c
}

# DEBUG INFORMATION FUNCTION
function Debug(clip c)
{
# PRINTING VERSION INFORMATION
c = Subtitle(c,"Full Motion Filter v1.5 b1",x=20,y=30,font="lucida console",size=18,text_color=$FFFFFF)
c = Subtitle(c,"by HomiE FR (homie.fr@wanadoo.fr)",x=20,y=45,font="lucida console",size=14,text_color=$FFFFFF)

# PRINTING MOTION ESTIMATION INFORMATION
c = Subtitle(c,"motion estimation",x=20,y=75,font="lucida console",size=18,text_color=$FFFFFF)
c = Subtitle(c,"diff_p2 = "+string(diff_p2),x=20,y=95,font="lucida console",size=16,text_color=$FFCCCC)
c = (ok_p2 == 0) ? Subtitle(c,"[discarded]",x=230,y=95,font="lucida console",size=16,text_color=$FFFF66) : c
c = Subtitle(c,"diff_p1 = "+string(diff_p1),x=20,y=110,font="lucida console",size=16,text_color=$FFCCCC)
c = (ok_p1 == 0) ? Subtitle(c,"[discarded]",x=230,y=110,font="lucida console",size=16,text_color=$FFFF66) : c
c = Subtitle(c,"diff = "+string(diff),x=20,y=125,font="lucida console",size=16,text_color=$FFCCCC)
c = (ok == 0) ? Subtitle(c,"[discarded]",x=230,y=125,font="lucida console",size=16,text_color=$FFFF66) : c
c = Subtitle(c,"diff_f1 = "+string(diff_f1),x=20,y=140,font="lucida console",size=16,text_color=$FFCCCC)
c = (ok_f1 == 0) ? Subtitle(c,"[discarded]",x=230,y=140,font="lucida console",size=16,text_color=$FFFF66) : c
c = Subtitle(c,"diff_f2 = "+string(diff_f2),x=20,y=155,font="lucida console",size=16,text_color=$FFCCCC)
c = (ok_f2 == 0) ? Subtitle(c,"[discarded]",x=230,y=155,font="lucida console",size=16,text_color=$FFFF66) : c
c = Subtitle(c,"diff_avg = "+string(diff_avg),x=20,y=170,font="lucida console",size=16,text_color=$FF6666)

# PRINTING SCENE CHANGE DETECTION INFORMATION
c = Subtitle(c,"scene change detection",x=20,y=200,font="lucida console",size=18,text_color=$FFFFFF)
c = Subtitle(c,"threshold_sc = "+string(threshold_sc),x=20,y=220,font="lucida console",size=16,text_color=$CCCCFF)
c = (pos_sc == 0) ? Subtitle(c,"detection = enabled",x=20,y=235,font="lucida console",size=16,text_color=$CCCCFF) : Subtitle(c,"detection = disabled",x=20,y=235,font="lucida console",size=16,text_color=$CCCCFF)
c = (ok_p2+ok_p1+ok+ok_f1+ok_f2 == 5) ? Subtitle(c,"information = scanning...",x=20,y=250,font="lucida console",size=16,text_color=$9999FF) : Subtitle(c,"information = scene change !",x=20,y=250,font="lucida console",size=16,text_color=$9999FF)

# PRINTING FULL MOTION FILTER INFORMATION
c = Subtitle(c,"full motion filter",x=20,y=280,font="lucida console",size=18,text_color=$FFFFFF)
c = (motion_level == 0) ? Subtitle(c,"scene type = low motion",x=20,y=300,font="lucida console",size=16,text_color=$66FF66) : c
c = (motion_level == 1) ? Subtitle(c,"scene type = medium motion",x=20,y=300,font="lucida console",size=16,text_color=$66FF66) : c
c = (motion_level == 2) ? Subtitle(c,"scene type = high motion",x=20,y=300,font="lucida console",size=16,text_color=$66FF66) : c
c = (motion_level == 0) ? ((param1_lm_min != 0 || param1_lm_max != 0) ? Subtitle(c,"param1_lm = "+string(param1_lm),x=20,y=315,font="lucida console",size=16,text_color=$66FF66) : Subtitle(c,"param1_lm = disabled",x=20,y=315,font="lucida console",size=16,text_color=$CCFFCC)) : c
c = (motion_level == 0) ? ((param2_lm_min != 0 || param2_lm_max != 0) ? Subtitle(c,"param2_lm = "+string(param2_lm),x=20,y=330,font="lucida console",size=16,text_color=$66FF66) : Subtitle(c,"param2_lm = disabled",x=20,y=330,font="lucida console",size=16,text_color=$CCFFCC)) : c
c = (motion_level == 0) ? ((param3_lm_min != 0 || param3_lm_max != 0) ? Subtitle(c,"param3_lm = "+string(param3_lm),x=20,y=345,font="lucida console",size=16,text_color=$66FF66) : Subtitle(c,"param3_lm = disabled",x=20,y=345,font="lucida console",size=16,text_color=$CCFFCC)) : c
c = (motion_level == 0) ? ((param4_lm_min != 0 || param4_lm_max != 0) ? Subtitle(c,"param4_lm = "+string(param4_lm),x=20,y=360,font="lucida console",size=16,text_color=$66FF66) : Subtitle(c,"param4_lm = disabled",x=20,y=360,font="lucida console",size=16,text_color=$CCFFCC)) : c
c = (motion_level == 0) ? ((param5_lm_min != 0 || param5_lm_max != 0) ? Subtitle(c,"param5_lm = "+string(param5_lm),x=20,y=375,font="lucida console",size=16,text_color=$66FF66) : Subtitle(c,"param5_lm = disabled",x=20,y=375,font="lucida console",size=16,text_color=$CCFFCC)) : c
c = (motion_level == 1) ? ((param1_mm_min != 0 || param1_mm_max != 0) ? Subtitle(c,"param1_mm = "+string(param1_mm),x=20,y=315,font="lucida console",size=16,text_color=$66FF66) : Subtitle(c,"param1_mm = disabled",x=20,y=315,font="lucida console",size=16,text_color=$CCFFCC)) : c
c = (motion_level == 1) ? ((param2_mm_min != 0 || param2_mm_max != 0) ? Subtitle(c,"param2_mm = "+string(param2_mm),x=20,y=330,font="lucida console",size=16,text_color=$66FF66) : Subtitle(c,"param2_mm = disabled",x=20,y=330,font="lucida console",size=16,text_color=$CCFFCC)) : c
c = (motion_level == 1) ? ((param3_mm_min != 0 || param3_mm_max != 0) ? Subtitle(c,"param3_mm = "+string(param3_mm),x=20,y=345,font="lucida console",size=16,text_color=$66FF66) : Subtitle(c,"param3_mm = disabled",x=20,y=345,font="lucida console",size=16,text_color=$CCFFCC)) : c
c = (motion_level == 1) ? ((param4_mm_min != 0 || param4_mm_max != 0) ? Subtitle(c,"param4_mm = "+string(param4_mm),x=20,y=360,font="lucida console",size=16,text_color=$66FF66) : Subtitle(c,"param4_mm = disabled",x=20,y=360,font="lucida console",size=16,text_color=$CCFFCC)) : c
c = (motion_level == 1) ? ((param5_mm_min != 0 || param5_mm_max != 0) ? Subtitle(c,"param5_mm = "+string(param5_mm),x=20,y=375,font="lucida console",size=16,text_color=$66FF66) : Subtitle(c,"param5_mm = disabled",x=20,y=375,font="lucida console",size=16,text_color=$CCFFCC)) : c
c = (motion_level == 2) ? ((param1_hm_min != 0 || param1_hm_max != 0) ? Subtitle(c,"param1_hm = "+string(param1_hm),x=20,y=315,font="lucida console",size=16,text_color=$66FF66) : Subtitle(c,"param1_hm = disabled",x=20,y=315,font="lucida console",size=16,text_color=$CCFFCC)) : c
c = (motion_level == 2) ? ((param2_hm_min != 0 || param2_hm_max != 0) ? Subtitle(c,"param2_hm = "+string(param2_hm),x=20,y=330,font="lucida console",size=16,text_color=$66FF66) : Subtitle(c,"param2_hm = disabled",x=20,y=330,font="lucida console",size=16,text_color=$CCFFCC)) : c
c = (motion_level == 2) ? ((param3_hm_min != 0 || param3_hm_max != 0) ? Subtitle(c,"param3_hm = "+string(param3_hm),x=20,y=345,font="lucida console",size=16,text_color=$66FF66) : Subtitle(c,"param3_hm = disabled",x=20,y=345,font="lucida console",size=16,text_color=$CCFFCC)) : c
c = (motion_level == 2) ? ((param4_hm_min != 0 || param4_hm_max != 0) ? Subtitle(c,"param4_hm = "+string(param4_hm),x=20,y=360,font="lucida console",size=16,text_color=$66FF66) : Subtitle(c,"param4_hm = disabled",x=20,y=360,font="lucida console",size=16,text_color=$CCFFCC)) : c
c = (motion_level == 2) ? ((param5_hm_min != 0 || param5_hm_max != 0) ? Subtitle(c,"param5_hm = "+string(param5_hm),x=20,y=375,font="lucida console",size=16,text_color=$66FF66) : Subtitle(c,"param5_hm = disabled",x=20,y=375,font="lucida console",size=16,text_color=$CCFFCC)) : c

return c
}
__________________
AudioSlave
Reply With Quote
  #27  
11-17-2003, 08:41 PM
ak47 ak47 is offline
Free Member
 
Join Date: Oct 2002
Posts: 168
Thanks: 0
Thanked 0 Times in 0 Posts
did you import the avs file off of doom9.org called fmf-1.5b1.avs
__________________
Later ak
Reply With Quote
  #28  
11-17-2003, 08:42 PM
ak47 ak47 is offline
Free Member
 
Join Date: Oct 2002
Posts: 168
Thanks: 0
Thanked 0 Times in 0 Posts
lol cross post
P.S. make sure you have fluxsmooth 1.01
__________________
Later ak
Reply With Quote
  #29  
11-17-2003, 08:43 PM
audioslave audioslave is offline
Free Member
 
Join Date: Mar 2003
Location: Sweden
Posts: 725
Thanks: 0
Thanked 0 Times in 0 Posts

What motion search do you use in TMPGEnc for this script - Estimate or High quality? And what about the min and max bitrates? Do you use 300 for min and 2000 for max?
__________________
AudioSlave
Reply With Quote
  #30  
11-17-2003, 08:48 PM
ak47 ak47 is offline
Free Member
 
Join Date: Oct 2002
Posts: 168
Thanks: 0
Thanked 0 Times in 0 Posts
I used MCE for Mpeg-2 encoding, its definitely buggy but I get better quality out of Mpeg-2 then Tmpgenc(not Mpeg-1 though). But I would suggest motion estimate search.
__________________
Later ak
Reply With Quote
  #31  
11-17-2003, 09:16 PM
audioslave audioslave is offline
Free Member
 
Join Date: Mar 2003
Location: Sweden
Posts: 725
Thanks: 0
Thanked 0 Times in 0 Posts
@ak47
Hi again!
Now I'm encoding Matrix Reloaded with the FMF script. Occationally I get some frames that are quite red. This shows very clearly on this movie since it is very green. I don't know why this happens... Maybe it could be one of the filters that screws up
And back to the bitrates - should I use 300 for min and 2000 for max in TMPGEnc?
__________________
AudioSlave
Reply With Quote
  #32  
11-17-2003, 09:51 PM
ak47 ak47 is offline
Free Member
 
Join Date: Oct 2002
Posts: 168
Thanks: 0
Thanked 0 Times in 0 Posts
First off if your video is not interlaced then removed this line, TomsMoComp(1,5,1) (you probably already did that though), also mess with the decomb features to get what you want, also check you original source and see if there is anything wrong with it then if no problem, check with the avs script and see it though windows media player or something else to check if its yours/my script that is messing up. If it's the script then check your plugin's and see if you have the latest version on the filters, also remove the FMF line if you still have the problem and see if its that. Also can you tell me the source, AVI or straight from the DVD?
__________________
Later ak
Reply With Quote
  #33  
11-18-2003, 12:34 PM
audioslave audioslave is offline
Free Member
 
Join Date: Mar 2003
Location: Sweden
Posts: 725
Thanks: 0
Thanked 0 Times in 0 Posts
My source is DVD. I will check the filters this evening... I'll be back!
__________________
AudioSlave
Reply With Quote
  #34  
11-19-2003, 05:32 AM
digitall.doc digitall.doc is offline
Free Member
 
Join Date: Jul 2003
Location: Valencia (Espaņa)
Posts: 741
Thanks: 0
Thanked 0 Times in 0 Posts
Hi all:
... still working on it.
Let's see if I have a good departure point. If I'm wrong, please make me know:
- Low motion-> temporal filtering (like TemporalSoften, fast, good quality)
- Medium motion-> spatial-temporal filtering (TemporalSoften+Unfilter, or all in one like FluxSmooth, MIpSmooth, Convolution3d,...). Ranging from less spatial and more temporal, to more spatial and less temporal.
- High motion-> spatial filtering: Unfilter, Deen (memory leaks?), SpatialSoften (is that good?),...
Doubts: what's threshold_sc supposed to be for?. And the question about motion level threshold. I made a comparison, and a SwitchThreshold of 2 in MA equals a motion stimation about 6 in FMF (lm threshold is 4 to 5). And a motion stimation change from low to medium in FMF, equals to a nf level of 5.63-7.14 in MA. Should we raise the thresholds (_lm, _hm and _max)?, I state this because I find that there's little space in high motion, for instance, to give unfilter an ample margin of values (to heavy unfulter in really high motion).
Wait your opinions, suggestions, scripts,... I hope I'll post mine soon (still not satisfied with results).
Reply With Quote
  #35  
11-19-2003, 07:51 PM
ak47 ak47 is offline
Free Member
 
Join Date: Oct 2002
Posts: 168
Thanks: 0
Thanked 0 Times in 0 Posts
Yes I am also making a new script I removed MergeChroma from the adaptive part of the script mainly because you can max it out to 1.50 and it's not going to change much, and I am also putting a denoiser in there. Your ideas are good for the motions, but I don't know much about programming or how filters differ in that way so I just trying to make the script that looks best, that make the most sense to my knowledge, I am only a high school student.
__________________
Later ak
Reply With Quote
  #36  
11-20-2003, 08:00 PM
digitall.doc digitall.doc is offline
Free Member
 
Join Date: Jul 2003
Location: Valencia (Espaņa)
Posts: 741
Thanks: 0
Thanked 0 Times in 0 Posts
Hi ak47:
as you can see from my posts, I still have a lot to learn. I've been trying to understand the FMF.avs script, in order to know what some parameters do (like threshold_sc), and better adjusting them. I think I should raise threshold_max, to make the filters work smoother, in an ampler range of values. But as I don't have the enough knowledge, I have to end like you, making lots of tests without realyy knowing what I have to adjust to get a better result.
Reply With Quote
  #37  
11-20-2003, 08:01 PM
ak47 ak47 is offline
Free Member
 
Join Date: Oct 2002
Posts: 168
Thanks: 0
Thanked 0 Times in 0 Posts
I followed your advice digitall.doc and made a new script with different variations on filter per motion, and its fast just as fast as the MA script maybe faster.
Code:
function Low_Motion_Filter(clip c)
{
c = TemporalSoften(c,2,param1_lm,param1_lm,param3_lm,2)
c = UnFilter(c,param2_lm,param2_lm)
c = MergeLuma(c,blur(c,param4_lm))
return c
}

function Medium_Motion_Filter(clip c)
{
c = Convolution3D(c,0,param1_mm,param2_mm,param1_mm,param2_mm,param4_mm, 0)
c = UnFilter(c,param3_mm,param3_mm)
c = MergeLuma(c,blur(c,param5_hm))
return c
}

function High_Motion_Filter(clip c)
{
c = UnFilter(c,param2_hm,param2_hm)
c = VagueDenoiser(c,param3_hm,3,6,true)
c = MergeLuma(c,blur(c,param4_hm))
return c
}

Mpeg2Source("C:\GOD1\VIDEO_TS\kenshin E1.d2v")

Telecide(order=1,guide=1,post=0).Decimate(cycle=5)
TomsMoComp(1,5,1)
undot()
Limiter()
BicubicResize(496, 320, 0, 0.6, 2, 9, 716, 462)
FMF(param3_hm_min=1.0,param3_hm_max=2.2,param1_mm_min=3,param1_mm_max=5.5,param2_mm_min=4,param2_mm_max=7,
param4_mm_min=3,param4_mm_max=4.5,mergechroma(blur(1.50)),param4_lm_min=0.08,param4_lm_max=0.14,param5_mm_min=0.14,
param5_mm_max=0.2,param4_hm_min=0.2,param4_hm_max=0.3,param2_lm_min=-5,param2_lm_max=-15,param1_lm_min=3,
param1_lm_max=8,param3_lm_min=3,param3_lm_max=7,param3_mm_min=-15,param3_mm_max=-25,param2_hm_min=-25,param2_hm_max=-45)
AddBorders(24, 80, 24, 80)
Limiter()
Two things one is to FMF(**) line is one line, and second give me responds on how to make my script better if you can, thanx in advance.
__________________
Later ak
Reply With Quote
  #38  
11-20-2003, 08:10 PM
digitall.doc digitall.doc is offline
Free Member
 
Join Date: Jul 2003
Location: Valencia (Espaņa)
Posts: 741
Thanks: 0
Thanked 0 Times in 0 Posts
Hi ak: 1 minute difference in posting!
Well, I'll give a try your script. How does it look like?. I find you're blurring too much with so many spatial in low motion (unfilter -5 to -15). And in your FMF parameters appears a mergechroma(blur(1.5)). Is that really a parameter?, or is it a "bug"?. I've made several test I'll post later, with vaguedenoiser, fluxsmooth, convo3d or mipsmooth (only one each time). But from all my test (I just implement FMF instead of de adaptive routine in de MA script, and keep the rest of MA script the same) I've realised that I canīt put out STMedianFilter(3,3,1,1), because the encoding gets slower, the file bigger, and not so good looking. Looks like STM makes a light filtering that allows the rewst of the filters work better.
I'll post later my experiences.
Reply With Quote
  #39  
11-20-2003, 08:22 PM
ak47 ak47 is offline
Free Member
 
Join Date: Oct 2002
Posts: 168
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
How does it look like
The Lower Motion has saved detail and high motion has been filter more so you gain more compression in other words it looks great.
Quote:
I find you're blurring too much with so many spatial in low motion (unfilter -5 to -15)
Ya I'll change that.
Quote:
And in your FMF parameters appears a mergechroma(blur(1.5))
No bug I just want to place the filter in the right order, you can add a static filter in the FMF line so it will get adaptive filtering before of after.
Quote:
I've realised that I canīt put out STMedianFilter(3,3,1,1), because the encoding gets slower, the file bigger, and not so good looking
when your comparing quality make sure you have a constant or average bit rate, so use something like 3000kbs max,64kbs min,1000kbs average VBR. Also STMedianFilter is good for being fast, but it isn't that strong in my opinion.
__________________
Later ak
Reply With Quote
  #40  
11-20-2003, 08:29 PM
kwag kwag is offline
Free Member
 
Join Date: Apr 2002
Location: Puerto Rico, USA
Posts: 13,537
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by ak47
I mainly introduce this script to show the power and control of FMF.
But this was already discussed way back this year here: http://www.kvcd.net/forum/viewtopic....r=asc&start=16
I also discussed the disadvantage of having three sharp filter brackets ( low/medium/high ) and that's the reason I made the MA script linear. This way, there are no sharp tresholds ( sharp attack/decay ) boundaries where the filters turn on/off rapidly.
I don't remember where the threads are, but they are buried deep down somewhere in the forum.

-kwag
Reply With Quote
Reply




Thread Tools



 
All times are GMT -5. The time now is 10:43 AM  —  vBulletin Đ Jelsoft Enterprises Ltd