Log in

View Full Version : Using Avisynth to help compressing files


Pages : 1 [2]

Didée
7th November 2006, 11:03
Doing a temporal counterpart is very easy. Basically, just that "RemoveGrain(..)" has to be replaced with a temporal filter. That's all.

And that's where the questioning begins: what temporal filter to use? Clense? FluxSmoothT? TemporalSoften? TTempSmooth? MedianBlurT? There are so many ...
Also, the weighting/limiting could be extended, like always using a lower minimum plus some weighting on top of that ...

Many ways to blow up the function to fill three or four pages ...
... for something where the actual filtering is just one single line. ;)

foxyshadis
7th November 2006, 11:25
My first thought was
Soothe(last,TemporalSoften(...),40)
or perhaps vice versa... but who knows, that might not work at all. ;p

Didée
7th November 2006, 11:40
Well, you can do that ... like you can put mustard onto a cream cake. :)

Soothe reverts the work of [filter] in those places where the difference achieved by [filter] is temporally unstable.
Now, the difference achieved by a temporal filter is supposed to be temporally unstable, so ... ;)

Soothe's corresponding counterpart for temporal filters would be done through spatial processing. (Like demonstrated e.g. in SafeTemporalSoften (http://forum.doom9.org/showthread.php?p=875442#post875442))

Jeremy Duncan
8th November 2006, 05:46
Didée,

If you make a Tpresso, please include Chroma denoising, and since it would be used in realtime it would be nice if it was fast.

Thanks for your time in reading and considering this.

:)

J-Wo
23rd January 2007, 05:40
Didee, just discovered this function after your mentioned of it to me in another thread. Great work! I tried it out at the default settings (limit=2, bias=25, rgmode=4) and the results were very promising. I did an OPV encode with 3 different bias settings and compared their compressibility to one without spresso. I also threw into the mix one that used removegrain(mode=5) instead of spresso. Here's what I found:

removegrain 5 --> 5.35% compression
bias 25 --> 4.82%
bias 26 --> 7.42%
bias 33 --> 8.12%

I then did a 2 pass encode with these same filters to see how much detail was preserved by the various filters. On my 42" LCD rear projection HDTV they all looked great! But to my surprise, I think the higher bias looked the best. I think that was because the higher compression allowed the encoder to do it's... you know, encoding magic better. The result wasn't too soft at all (your original post led me to believe that a bias=33 was a very strong setting).

P.S. I believe someone mentioned it before, but the best way to use this function is to save it in your Avisynth plugin file as SPresso.avsi. This way you never have to load the function with the Import() line in your scripts.

P.P.S. You should rename this thread to put Spresso in the title! It'll make searching for help easier

foxyshadis
23rd January 2007, 12:53
But if he did that, people might actually find and start using his filters, and ask for help. So he just sneaks them into someone else's threads. ;)

This is one of the few I can't seem to get much of a handle on, probably because it's hard to see the subtle differences that make a big difference to the encoder.

J-Wo
23rd January 2007, 12:59
Well for me I do a lot of DVD9->DVD5 compression using DVD-RB. And while most of my sources are clean film material, a little grain removal (that is barely detectable to the naked eye) will help with compression. So far I think this filter is great!

AGKnotUser
13th February 2007, 00:55
Well for me I do a lot of DVD9->DVD5 compression using DVD-RB. And while most of my sources are clean film material, a little grain removal (that is barely detectable to the naked eye) will help with compression. So far I think this filter is great!

Could you post your settings? I'm also using DVD-RB and want to use this filter for the same purpose.

Jeremy Duncan
13th February 2007, 18:16
Here's what I use;

Spresso(limit=8, limitC=4, bias=59, biasc=100, rgmode=17, rgmodec=17)

AGKnotUser
13th February 2007, 21:28
Thank you for your suggestion.

Vesi
29th August 2007, 03:28
Hi Didee.
if i use SPresso(RGmode=4,bias=25,limit=2) on source which is very good source and doesn't need strong denoising + sharping what you thing? or any other suggestion?

real.finder
23rd April 2020, 16:53
# SPresso by Didée, r.f mod in 2020.04.23 for HBD
function SPresso(clip clp, float "limit", float "bias", int "RGmode", float "limitC", float "biasC", int "RGmodeC")
{
sisavs26 = !(VersionNumber() < 2.60)
limit = default( limit, 2 )
limitC = default( limitC, 4 )
bias = default( bias, 25 )
biasC = default( biasC, 50 )
RGmode = default( RGmode, 4 )
RGmodeC = default( RGmodeC, 0 )

yy = (RGmode ==0) ? 2 : 3
uv = (RGmodeC==0) ? 2 : 3
LIM1 = (limit>0) ? string( round(limit*100.0/bias-1.0) ) : string( round(100.0/bias) )
LIM2 = (limit<0) ? "1" : string(limit)
BIA = string(bias)
LIM1c = (limitC>0) ? string( round(limitC*100.0/biasC-1.0) ) : string( round(100.0/biasC) )
LIM2c = (limitC<0) ? "1" : string(limitC)
BIAc = string(biasC)

expr = (limit<0) ? sisavs26 ? "x y - abs "+LIM1+" scalef < x x 1 x y - x y - abs / * - ?" : "x y - abs "+LIM1+" < x x 1 x y - x y - abs / * - ?"
\ : sisavs26 ? "x y - abs 0 <= x x "+LIM1+" scalef + y < x "+LIM2+" scalef + x "+LIM1+" scalef - y > x "+LIM2+" scalef - " \
+ "x 100 scalef "+BIA+" scalef - * y "+BIA+" scalef * + 100 scalef / ? ? ?" \
: "x y - abs 0 <= x x "+LIM1+" + y < x "+LIM2+" + x "+LIM1+" - y > x "+LIM2+" - " \
+ "x 100 "+BIA+" - * y "+BIA+" * + 100 / ? ? ?"
exprC = (limit<0) ? sisavs26 ? "x y - abs "+LIM1c+" scalef < x x 1 x y - x y - abs / * - ?" : "x y - abs "+LIM1c+" < x x 1 x y - x y - abs / * - ?"
\ : sisavs26 ? "x y - abs 0 <= x x "+LIM1c+" scalef + y < x "+LIM2c+" scalef + x "+LIM1c+" scalef - y > x "+LIM2c+" scalef - " \
+ "x 100 scalef "+BIAc+" scalef - * y "+BIAc+" scalef * + 100 scalef / ? ? ?" \
: "x y - abs 0 <= x x "+LIM1c+" + y < x "+LIM2c+" + x "+LIM1c+" - y > x "+LIM2c+" - " \
+ "x 100 "+BIAc+" - * y "+BIAc+" * + 100 / ? ? ?"

# For (old) MaskTools v1.5.8 :
# yv12lutxy( clp, clp.removegrain(RGmode,RGmodeC), expr,exprC,exprC, Y=yy,U=uv,V=uv)

# For (new) MaskTools v2.x :
sisavs26 ? mt_lutxy( clp, clp.removegrain(RGmode,RGmodeC), yexpr=expr,uexpr=exprC,vexpr=exprC, scale_inputs=limit<0 ? "floatf" : "none", use_expr=1, Y=yy,U=uv,V=uv) : mt_lutxy( clp, clp.removegrain(RGmode,RGmodeC), yexpr=expr,uexpr=exprC,vexpr=exprC, Y=yy,U=uv,V=uv)

return( last )
}

again, I want volunteers for testing with HBD :p

real.finder
7th May 2020, 07:35
another update, should work with 1080 and up

# SPresso by Didée, r.f mod in 2020.05.07 for HBD
function SPresso(clip clp, float "limit", float "bias", int "RGmode", float "limitC", float "biasC", int "RGmodeC", bool "HD", int "radius")
{
sisavs26 = !(VersionNumber() < 2.60)
limit = default( limit, 2 )
limitC = default( limitC, 4 )
bias = default( bias, 25 )
biasC = default( biasC, 50 )
RGmode = default( RGmode, 4 )
RGmodeC = default( RGmodeC, 0 )
h = clp.height()
ishd = h > 720
HD = default( HD, ishd )
radius = default( radius, round(h/540.0) )

yy = (RGmode ==0) ? 2 : 3
uv = (RGmodeC==0) ? 2 : 3
LIM1 = (limit>0) ? string( round(limit*100.0/bias-1.0) ) : string( round(100.0/bias) )
LIM2 = (limit<0) ? "1" : string(limit)
BIA = string(bias)
LIM1c = (limitC>0) ? string( round(limitC*100.0/biasC-1.0) ) : string( round(100.0/biasC) )
LIM2c = (limitC<0) ? "1" : string(limitC)
BIAc = string(biasC)

expr = (limit<0) ? sisavs26 ? "x y - abs "+LIM1+" scalef < x x 1 x y - x y - abs / * - ?" : "x y - abs "+LIM1+" < x x 1 x y - x y - abs / * - ?"
\ : sisavs26 ? "x y - abs 0 <= x x "+LIM1+" scalef + y < x "+LIM2+" scalef + x "+LIM1+" scalef - y > x "+LIM2+" scalef - " \
+ "x 100 scalef "+BIA+" scalef - * y "+BIA+" scalef * + 100 scalef / ? ? ?" \
: "x y - abs 0 <= x x "+LIM1+" + y < x "+LIM2+" + x "+LIM1+" - y > x "+LIM2+" - " \
+ "x 100 "+BIA+" - * y "+BIA+" * + 100 / ? ? ?"
exprC = (limit<0) ? sisavs26 ? "x y - abs "+LIM1c+" scalef < x x 1 x y - x y - abs / * - ?" : "x y - abs "+LIM1c+" < x x 1 x y - x y - abs / * - ?"
\ : sisavs26 ? "x y - abs 0 <= x x "+LIM1c+" scalef + y < x "+LIM2c+" scalef + x "+LIM1c+" scalef - y > x "+LIM2c+" scalef - " \
+ "x 100 scalef "+BIAc+" scalef - * y "+BIAc+" scalef * + 100 scalef / ? ? ?" \
: "x y - abs 0 <= x x "+LIM1c+" + y < x "+LIM2c+" + x "+LIM1c+" - y > x "+LIM2c+" - " \
+ "x 100 "+BIAc+" - * y "+BIAc+" * + 100 / ? ? ?"

# For (old) MaskTools v1.5.8 :
# yv12lutxy( clp, clp.removegrain(RGmode,RGmodeC), expr,exprC,exprC, Y=yy,U=uv,V=uv)

# For (new) MaskTools v2.x :
sisavs26 ? mt_lutxy( clp, HD ? clp.minblur(radius,uv=uv) : clp.removegrain(RGmode,RGmodeC), yexpr=expr,uexpr=exprC,vexpr=exprC, scale_inputs=limit<0 ? "floatf" : "none", use_expr=1, Y=yy,U=uv,V=uv) : mt_lutxy( clp, HD ? clp.minblur(radius,uv=uv) : clp.removegrain(RGmode,RGmodeC), yexpr=expr,uexpr=exprC,vexpr=exprC, Y=yy,U=uv,V=uv)

return( last )
}