Log in

View Full Version : What's the WarpSharp equivalent of aWarpSharp(depth=16,cm=1)?


Chainmax
10th July 2007, 01:25
aWarpSharp is one of my favorite filters for animated content due to its amazing line thinning capabilities. It has two drawbacks though: sometimes it can make edges wobbly, and sometimes it can cause green or yellow smudges on the side borders of the screen. Now, I read many times that WarpSharp is able produce the same results but I never saw how should it be set for that. I have MarcFD's aWarSharp beta 1 and warpsharp_2003_1103.cab, what setting should I use on the latter to achieve the exact same results as with aWarpSharp(depth=16,cm=1)?

foxyshadis
10th July 2007, 11:03
Try WarpSharp(depth=205,blur=10,bump=127)

That's what I got by plugging it into AvsP's genetic algorithm. I'll admit there are some differences, but substantially less than with the defaults, so I'd say it works. How about that. (My apologies, I meant to figure out how this works back when you first posted this thread a month or two ago. I just forgot.) Testing PSNR gave different numbers from SSIM, but both are almost totally indistiguishable, and similar enough to aWarpSharp.

Tested on some random anime music video, I could test something else if you want. (This posting is Rei-approved.)

Didée
10th July 2007, 11:21
I'm not sure, but probably the "cm=1" mode of aWarpSharp can't be done at all by WarpSharp. cm=1 means warping chroma with "luma guidance", i.e. use luma's bump map when warping chroma.
If WarpSharp works in a generic way, then it will warp chroma by chroma's own bump map.

foxyshadis
10th July 2007, 12:35
Hunting through the source shows... chroma is a direct copy. guh? Confirmed with mt_makediff. Well then, I guess I'll have to add that. It isn't very complicated to add equivalents of cm 1 & 2, as long as a simple average reduction of the bump map is sufficient. If anything, the odd way the plugin was written is harder to wade through than the algorithm.

Chainmax
11th July 2007, 00:01
I'd be very grateful if you did that. Once you post your findings, I'll upload some comparative screenshots from one of my Simpsons DVDs so that we can all evaluate if there's any difference. Thanks for taking the time to do this :).

Chainmax
14th July 2007, 01:58
Here's (http://www.31012.com/~azulftp/Sample%20for%20(a)WarpSharping.demuxed.m2v) a sample that will likely come in handy for your testing.

Chainmax
19th July 2007, 22:52
Here's a comparison taken from the clip:


Source
http://xs217.xs.to/xs217/07294/Source.png (http://xs.to)

aWarpSharp
http://xs217.xs.to/xs217/07294/aWarpSharp.png (http://xs.to)

WarpSharp(depth=205,blur=10,bump=127)
http://xs217.xs.to/xs217/07294/WarpSharp.png (http://xs.to)


The only filters used in the second and third pictures were IVTCing and the corresponding WarpSharping method. I can redo this comparison with a full filterchain if needed.

TheRyuu
21st July 2007, 05:09
From the file, running it through my preferred filters I get this:
http://img468.imageshack.us/img468/2728/test1au3.png

Nothing to do with awarpsharp though (although I think might toon() use it)
Anyway, back to topic.

If you want to thin lines, have you ever tried fastlinedarken(mod) to try and thin them (I know it's called darken, but it can thin too). I've never tried it myself since I normally want to darken the lines on an animated source.

I don't really see the point in thinning the lines with awarpsharp I guess :)
To each his own though.

##############################
# FastLineDarken 1.3x MT MOD #
##############################
#
# Written by Vectrangle
# Didée: - Speed Boost, Updated: 11th May 2007
#
# * requires mt_masktools v2
# * requires yv12 input
#
# Usage is FastLineDarkenMOD(strength, luma_cap, threshold, thinning),
# named parameters are supported eg FastLineDarken(thinning=0)
#
# Note that you must import this avs into your script using import("...\FastLineDarken.avs")
#
# Parameters are:
# strength (integer) - Line darkening amount, 0-256. Default 48. Represents the _maximum_ amount
# that the luma will be reduced by, weaker lines will be reduced by
# proportionately less.
# luma_cap (integer) - value from 0 (black) to 255 (white), used to stop the darkening
# determination from being 'blinded' by bright pixels, and to stop grey
# lines on white backgrounds being darkened. Any pixels brighter than
# luma_cap are treated as only being as bright as luma_cap. Lowering
# luma_cap tends to reduce line darkening. 255 disables capping. Default 191.
# threshold (integer) - any pixels that were going to be darkened by an amount less than
# threshold will not be touched. setting this to 0 will disable it, setting
# it to 4 (default) is recommended, since often a lot of random pixels are
# marked for very slight darkening and a threshold of about 4 should fix
# them. Note if you set threshold too high, some lines will not be darkened
# thinning (integer) - optional line thinning amount, 0-256. Setting this to 0 will disable it,
# which is gives a _big_ speed increase. Note that thinning the lines will
# inherently darken the remaining pixels in each line a little. Default 24.
#
# Changelog:
# 1.3 - added ability to thin lines, now runs much slower unless thinning=0. Changed the defaults (again)
# 1.2 - huge speed increase using yv12lutxy =)
# - weird darkening issues gone (they were caused by yv12layer)
# - show option no longer available due to optimizations. Use subtract() instead
# 1.1 - added luma_cap option
# 1.0 - initial release
#


function FastLineDarkenMOD( clip c, int "strength", int "luma_cap", int "threshold", int "thinning")
{
## parameters ##
str = string(default(strength, 48) /128.)
lum = string(default(luma_cap, 191))
thr = string(default(threshold, 4))
thinning = default(thinning,24)
thn = string(thinning /16.)

## filtering ##
exin = c.mt_expand().mt_inpand()
diff = mt_lutxy(c,exin,yexpr="y "+lum+" < y "+lum+" ? x "+thr+" + > x y "+lum+" < y "+lum+" ? - 0 ? 127 +",uexpr="x",vexpr="x",u=2, v=2)
linemask= mt_lut(diff.mt_inpand(),"x 127 - "+thn+" * 255 +").RemoveGrain(20,-1)
thick = mt_lutxy(c, exin, yexpr="y "+lum+" < y "+lum+" ? x "+thr+" + > x y "+lum+" < y "+lum+" ? - 0 ? "+str+" * x +",uexpr="x",vexpr="x",u=2, v=2)
thin = mt_lutxy(c.mt_expand(),diff,yexpr="x y 127 - "+str+" 1 + * +",u=2, v=2)

return (thinning == 0) ? thick : mt_merge(thin,thick,linemask,y=3,u=2,v=2)
}

Chainmax
24th July 2007, 02:22
I have tried a few variants of FastLineDarken and found that it can cause some very slight aliasing. For that reason, I limit usage of it for cases that really require it like line darkening.
As for your script, I appreciate it, but the purpose of this thread is not to find a suitable filterchain for this but rather to find as accurate a replacement for aWarpSharp as possible. If you're interested, though, we can discuss about filterchains for this sample via PM: I have one that might give good results too.

2Bdecided
28th November 2007, 15:44
Hunting through the source shows... chroma is a direct copy. guh? Confirmed with mt_makediff. Well then, I guess I'll have to add that. It isn't very complicated to add equivalents of cm 1 & 2, as long as a simple average reduction of the bump map is sufficient. If anything, the odd way the plugin was written is harder to wade through than the algorithm.foxyshadis,
Did you ever get chance to do this? If so, please share. If not, I understand.

Cheers,
David.