Log in

View Full Version : Updated aWarpSharp version, with some new features


Pages : 1 2 3 [4]

jpsdr
15th March 2021, 20:38
I don't know when i'll be able to take a better look, but there is 2 issues it seems.
One with multi-threading and 16 bits, as if you put "threads=1" you'll get the bottom of the bars, and with "threads=2" they're gone...
Another with 16bits and YV12.

real.finder
16th March 2021, 18:39
I don't know when i'll be able to take a better look, but there is 2 issues it seems.
One with multi-threading and 16 bits, as if you put "threads=1" you'll get the bottom of the bars, and with "threads=2" they're gone...
Another with 16bits and YV12.

yes, I note that

also I did try SetMaxCPU("none") to use the c code only but it say it need sse2 cpu now, that mean you didn't add the c code from VS port? maybe it need to add opt parameter like the one in nnedi3

jpsdr
16th March 2021, 20:16
Didn't take any code from VS port.

real.finder
17th March 2021, 03:25
I got some strange case

using dvd VOB and nnedi3_rpow2(rfactor=2) with awarp4
LWLibavVideoSource("VTS_01_4.VOB")
awarp4(nnedi3_rpow2(rfactor=2).nnedi3_rpow2(rfactor=2),asobel(thresh=255).ablur(),depth=6)

https://i.postimg.cc/44cpFBzG/Untitled.png (https://postimages.org/)
ffms2 show same problem, but DirectShowSource work! replace nnedi3_rpow2(rfactor=2).nnedi3_rpow2(rfactor=2) with Spline36Resize(width*4, height*4, 0.375, 0.375) also work!

jpsdr
17th March 2021, 18:50
I think i've found the MT issue with aWarp4.
There is C code for the aWarp part, but (i don't remember for now and didn't search) it's possible that in all the aWarp4 chain, there is still some parts without C code. I'll check (i don't know when), to see if the "SSE2 minimal CPU" is still necessary.

For the others check...

Your last issue is with 8 bit data so ?

And out of curisity with :

a=LWLibavVideoSource("VTS_01_4.VOB")
b=nnedi3_rpow2(a,rfactor=2).nnedi3_rpow2(rfactor=2)
c=asobel(a,thresh=255).ablur()
awarp4(b,c,depth=6,threads=[1 or 2])

real.finder
17th March 2021, 19:25
For the others check...

Your last issue is with 8 bit data so ?

And out of curisity with :

a=LWLibavVideoSource("VTS_01_4.VOB")
b=nnedi3_rpow2(a,rfactor=2).nnedi3_rpow2(rfactor=2)
c=asobel(a,thresh=255).ablur()
awarp4(b,c,depth=6,threads=[1 or 2])


yes it's 8bit, and this code give same error

in case someone need .vob sample I find this http://download4.dvdloc8.com/trailers/dolbydts/dolbyrain.zip from https://dvdloc8.com/dolbydtsclip.php?clipid=7

StvG
18th March 2021, 17:04
I got some strange case

using dvd VOB and nnedi3_rpow2(rfactor=2) with awarp4
LWLibavVideoSource("VTS_01_4.VOB")
awarp4(nnedi3_rpow2(rfactor=2).nnedi3_rpow2(rfactor=2),asobel(thresh=255).ablur(),depth=6)

https://i.postimg.cc/44cpFBzG/Untitled.png (https://postimages.org/)
ffms2 show same problem, but DirectShowSource work! replace nnedi3_rpow2(rfactor=2).nnedi3_rpow2(rfactor=2) with Spline36Resize(width*4, height*4, 0.375, 0.375) also work!
It seems awarp4 doesn't accept colorspace i420 (returned by ffms2/lsmash).
Adding something like z_convertformat(pixel_type="yv12") will return yv12 and awarp4 is ok.

jpsdr
18th March 2021, 18:57
Euh... What am i missing...????

if (!(vi.IsYUV() && vi.IsPlanar() && vi2.IsYUV() && vi2.IsPlanar()))
{
if (threads>1) poolInterface->DeAllocateAllThreads(true);
env->ThrowError("aWarp4: Planar YUV input is required");
}

StvG
18th March 2021, 19:51
Euh... What am i missing...????

if (!(vi.IsYUV() && vi.IsPlanar() && vi2.IsYUV() && vi2.IsPlanar()))
{
if (threads>1) poolInterface->DeAllocateAllThreads(true);
env->ThrowError("aWarp4: Planar YUV input is required");
}

nnedi3_rpow2(a,rfactor=2).nnedi3_rpow2(rfactor=2) returns YV12.
asobel(a,thresh=255).ablur() returns i420. It seems asobel doesn't convert i420 to YV12.
That's why awarp4 is complaining.
This works:a=LWLibavVideoSource(".\dolbyrain\dolbyrain.vob")
b=nnedi3_rpow2(a,rfactor=2).nnedi3_rpow2(rfactor=2)
c=asobel(a,thresh=255).propset("_FieldBased", 0).z_ConvertFormat(pixel_type="yv12").ablur()
awarp4(b,c,depth=6,threads=1)

jpsdr
18th March 2021, 20:43
Ok... I've never checked what i420 is exactly...
So, if i understand, from avisynth filter chain data access point of view, YV12 or i420 are the same thing. When i access data and get width, height, pointers or other picture stuff i don't see the difference (and maybe there is not within the avs filter chain), but the "pixel_type" is not the same, and maybe the format storage data outside avs is also not the same.
Inside avs, they are the same, but not outside so...

real.finder
18th March 2021, 21:13
nnedi3_rpow2(a,rfactor=2).nnedi3_rpow2(rfactor=2) returns YV12.
asobel(a,thresh=255).ablur() returns i420. It seems asobel doesn't convert i420 to YV12.
That's why awarp4 is complaining.
This works:a=LWLibavVideoSource(".\dolbyrain\dolbyrain.vob")
b=nnedi3_rpow2(a,rfactor=2).nnedi3_rpow2(rfactor=2)
c=asobel(a,thresh=255).propset("_FieldBased", 0).z_ConvertFormat(pixel_type="yv12").ablur()
awarp4(b,c,depth=6,threads=1)

so I think nnedi3_rpow2 need to change in this case to not convert i420 to YV12

jpsdr
18th March 2021, 21:45
nnedi3_rpow2 splits and process the channels in "Y only", and after recomb using "YtoUV".
You can even if you want write an avs script using "PlaneToY", "nnedi3" and "YtoUV". So when "YtoUV" is used to "regroup" output data when inpiut data was checked Is420(), i think it's automaticaly tagged to YV12.
The nnedi3_rpow2 function is like an avs script.
I don't know if there is a function to put back original vi.pixel_type...

pinterf
19th March 2021, 08:11
For Avisynth it is all the same, YV12 or I420.
That's why VideoInfo::IsSameColorspace has a second test for colorspace. Both formats report "true" on IsYV12().
https://github.com/AviSynth/AviSynthPlus/blob/master/avs_core/core/interface.cpp#L332

jpsdr
19th March 2021, 12:41
So, the proper way is not

if (vi.pixel_type!=vi2.pixel_type)

but

if (!vi.IsSameColorspace(vi2))

That's... logical... I'll change that.
I mean, if there is a IsSameColorspace function, using it is the proper way...;)
:thanks:

StainlessS
19th March 2021, 17:30
It is sometimes nice to be able to see the Baked code in the original v2.58 header, to give a clue about what its gonna do.
I'm not suggesting that you use same as v2.58 header, just taking a peek into the black box is sometimes informative.
Here is from v2.58 header

// Test for same colorspace
bool IsSameColorspace(const VideoInfo& vi) const {
if (vi.pixel_type == pixel_type) return TRUE;
if (IsYV12() && vi.IsYV12()) return TRUE;
return FALSE;
}


EDIT: Oops, shoulda posted this too.

bool IsYV12() const { return ((pixel_type & CS_YV12) == CS_YV12)||((pixel_type & CS_I420) == CS_I420); }

jpsdr
29th March 2021, 18:55
Begin to investigate.
First thought ChromaPlacement was the issue, but it seems not. cplace parameter has no effet.
Put configuration to be on "C" codepath only (this is why "MPEG2").
This also has issue :

SetMaxCPU("SSE2")
ColorBars(width=640, height=480, pixel_type="yv24").PlaneToY("Y")
convertbits(16)
awarp4(Spline36Resize(640*4,480*4),asobel(thresh=255).ablur(),depth=6,threads=1,cplace="MPEG2")

So it seems that the warp_c function has issue with both 16 bits and SMAGL=2.
What is the unit of depth, how should it be changed (or not) accordinb bit depth...
Still investigatig.

jpsdr
30th April 2021, 15:29
New version, see first post.

real.finder
1st May 2021, 07:14
awarp4 bug with HBD seems fixed, thanks

jpsdr
2nd June 2021, 08:33
I'll continue the aWarpsharp (well Sobel) issues here. I'll push something latter, i'll try to think at something a little different.

Edit
I'm working on something different, having a specific code for the first and last pixel, but keeping alignment.

jpsdr
2nd June 2021, 18:25
I've pushed a possible fix. Pinterf, can you build and test if it's still crashing ?

pinterf
2nd June 2021, 20:17
I've pushed a possible fix. Pinterf, can you build and test if it's still crashing ?
PM sent with the issue.

jpsdr
20th July 2021, 18:05
New version, see first post.

GMJCZP
21st July 2021, 00:51
New version, see first post.

Thank you very much.

jpsdr
23rd February 2022, 18:43
Finaly sooner than expected, new version, see first post.

jpsdr
20th November 2022, 15:05
New version, see first post.

jpsdr
26th February 2023, 12:32
New version, see first post.

real.finder
22nd July 2023, 05:02
I got some strange case

using dvd VOB and nnedi3_rpow2(rfactor=2) with awarp4
LWLibavVideoSource("VTS_01_4.VOB")
awarp4(nnedi3_rpow2(rfactor=2).nnedi3_rpow2(rfactor=2),asobel(thresh=255).ablur(),depth=6)

https://i.postimg.cc/44cpFBzG/Untitled.png (https://postimages.org/)
ffms2 show same problem, but DirectShowSource work! replace nnedi3_rpow2(rfactor=2).nnedi3_rpow2(rfactor=2) with Spline36Resize(width*4, height*4, 0.375, 0.375) also work!

There are same problem with awarp awarp(z_convertformat(pixel_type="yv12"),asobel(thresh=255).ablur(),depth=6)

As a reminder, awarp4 was fixed back then https://github.com/jpsdr/aWarpSharpMT/commit/3cbb888d6004f748cf4a620092f2990bf0a00cc9

jpsdr
24th July 2023, 18:36
Thanks, i've pushed a fix, don't know when i'll do a new build.

jpsdr
20th November 2023, 21:51
New version, see first post.

LigH
21st June 2024, 21:12
yes, there are bug in chroma=6 or 5 or 2


ColorBars(pixel_type="yv12")
aWarp4(nnedi3_rpow2(rfactor=2).nnedi3_rpow2(rfactor=2), aSobel().aBlur(), depth=2,chroma=6)


Does anyone remember why you prefer a sequence of nnedi3_rpow2(rfactor=2).nnedi3_rpow2(rfactor=2) over nnedi3_rpow2(rfactor=4) ?

DTL
21st June 2024, 21:34
Compare performance and quality ?

real.finder
22nd June 2024, 01:48
Does anyone remember why you prefer a sequence of nnedi3_rpow2(rfactor=2).nnedi3_rpow2(rfactor=2) over nnedi3_rpow2(rfactor=4) ?

Note that upsampling for aWarp4 should be left-top aligned, so Spline36Resize(width*4, height*4) or nnedi3_rpow2(rfactor=4) won't produce correct results.

https://forum.doom9.org/showthread.php?t=147285

LigH
22nd June 2024, 07:20
:thanks:
Exactly what I wanted to know.
Seems I just caught the wrong thread.

jpsdr
29th November 2025, 12:11
First post updated, minor changes.

pwnsweet
2nd February 2026, 04:08
Sorry, but float support is not in my project. Tooooooooo much work for a plugin i'm not even personnaly using, just made hopping it could help the evangelion project, which unfortunately didn't even finish.

It's finished and your hard work is not forgotten my friend. I will reach out to you in PM

rgr
12th April 2026, 12:21
Awarsharp2 makes objects smaller (letters on keyboard):

org vs awarpsharp2: https://www.diffchecker.com/image-compare/KrM6LOCz/
awarpsharp2 vs lsfplus(preset slow): https://www.diffchecker.com/image-compare/i3Eur9Oj/

LigH
19th April 2026, 08:07
AFAIR, that is how the "warping" works; it was designed to improve upscaled cartoons (as one example) by thinning the black outlines, if I'm not completely wrong.

ChaosKing
19th April 2026, 11:08
Awarsharp2 makes objects smaller (letters on keyboard):

org vs awarpsharp2: https://www.diffchecker.com/image-compare/KrM6LOCz/
awarpsharp2 vs lsfplus(preset slow): https://www.diffchecker.com/image-compare/i3Eur9Oj/

Not a good filter for real life content. Better suited for animation / cartoons, high values destroys line art!

Sharc
28th April 2026, 19:01
It is very useful to sharpen the blurry chroma of VHS.

tormento
29th April 2026, 09:57
Unfortunately it shrinks areas too, not lines only, and sometimes it's really evident, above all in line art animes.

That's the only "issue" preventing me from using.

If someone has solutions, they are welcome.

real.finder
29th April 2026, 16:19
Awarsharp2 makes objects smaller (letters on keyboard):

org vs awarpsharp2: https://www.diffchecker.com/image-compare/KrM6LOCz/
awarpsharp2 vs lsfplus(preset slow): https://www.diffchecker.com/image-compare/i3Eur9Oj/

AFAIR, that is how the "warping" works; it was designed to improve upscaled cartoons (as one example) by thinning the black outlines, if I'm not completely wrong.

Not a good filter for real life content. Better suited for animation / cartoons, high values destroys line art!

Unfortunately it shrinks areas too, not lines only, and sometimes it's really evident, above all in line art animes.

That's the only "issue" preventing me from using.

If someone has solutions, they are welcome.

that why there are yahr() function, also maybe aWarpSharp4xx can help

It is very useful to sharpen the blurry chroma of VHS.

yes, with chroma=6, also it kinda better to be used as
aWarpSharp2(depth=0,depthv=16,chroma=6) #vertical
aWarpSharp2(thresh=255,depth=16,depthv=0,chroma=6,cplace="MPEG2") #horizontal

tormento
29th April 2026, 19:14
that why there are yahr() function, also maybe aWarpSharp4xx can help
AFAIK yahr is a dehalo function.

What do you mean with aWarpSharp4xx? Never saw it anywhere.

real.finder
29th April 2026, 19:29
AFAIK yahr is a dehalo function.

What do you mean with aWarpSharp4xx? Never saw it anywhere.

yahr is a dehalo function, yes, but I think it can be used in other things

I mean with my mod of aWarpSharp4xx which can use aWarp4 https://pastebin.com/qLkBTbiF with useaWarp4=true

tormento
30th April 2026, 10:49
yahr is a dehalo function, yes, but I think it can be used in other things
Perhaps I am too noob to see its utility in this case.
I mean with my mod of aWarpSharp4xx which can use aWarp4
Thanks, is there any thread around about it?

hello_hello
1st May 2026, 21:03
Unfortunately it shrinks areas too, not lines only, and sometimes it's really evident, above all in line art animes.

That's the only "issue" preventing me from using.

If someone has solutions, they are welcome.

A trick I picked up from jagabo at VideoHelp might help you.

Clip = Last
MergeChroma(Clip.aWarpSharp2(Depth=5), Clip.aWarpSharp2(Depth=20))

Or whatever values for Depth might float your boat.
That way you can sharpen the chroma quite a bit without thinning the lines much (or not at all if you prefer). It can help when the chroma doesn't quite meet up with the lines properly.

I invariably precede and/or follow that with FastLineDarkenMod4(thinning=0) anyway, although it can sometimes create a small amount of aliasing, but following it with a mild anti-aliasing filter tends to do the trick. :)

real.finder
1st May 2026, 22:20
Perhaps I am too noob to see its utility in this case.

Thanks, is there any thread around about it?

I think SEt was made aWarpSharp2 because he want to use it as "halo removing" as he said https://forum.doom9.org/showthread.php?t=147285

anyway, the point is, yahr() IIRC will still do aWarpSharp2 work but will not "makes objects smaller" or at least the change will not be that big, maybe you can use the idea of yahr() to make a limited aWarpSharp2 sharpening filter

the original of aWarpSharp4xx is https://forum.doom9.se/showthread.php?t=171488 but its not work similar to aWarpSharp2() because Reel.Deel didn't set the default of "type" to "0" as I said in the 2nd post their

A trick I picked up from jagabo at VideoHelp might help you.

Clip = Last
MergeChroma(Clip.aWarpSharp2(Depth=5), Clip.aWarpSharp2(Depth=20))


there are depthC already in the OP of this Thread which is jpsdr update of aWarpSharp2, so aWarpSharp2(Depth=5, depthC=20) should work without using that "trick"

rgr
4th May 2026, 21:36
OK, but how and when will aWarpSharp2 be better than lsfplus?

jpsdr
5th May 2026, 17:33
There is no bug or issue with aWarpSharp2, it works as it's intended to, so there will be no change. If there is no parameters setting that can satisfy you, it's just that aWarpSharp2 is not the tool you need. if lsplus produces results that suit you more, then use it.