Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion. Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules. |
17th December 2018, 20:32 | #1 | Link |
Registered User
Join Date: Oct 2018
Posts: 35
|
Looking for a 64-bit Non-Linear Resizer
I'm upgrading to AVS+ 64-bit and I have a few scripts that need to undo some videos that took the original 4:3 image and non-linearly stretched it to 16:9. Basically the center pixels were almost unchanged, but the stretching got exponentially worse towards the edge of the images.
I've been using WarpedResize from SimpleResize.dll and it works well in 32-bit. Problem is there's inline assembly in the source code that's preventing me from compiling a 64-bit version myself. |
18th December 2018, 00:02 | #2 | Link |
Formerly davidh*****
Join Date: Jan 2004
Posts: 2,492
|
Can you give this a try?
http://horman.net/avisynth/download/widen.zip It takes four parameters: Code:
width : the new width of the video scale : stretch the center by this amount (to compensate for distortion at the edges). Defaults to 1 (maintains the original aspect ratio of the center) quality : 0 = nearest neighbour, 1 = bilinear, 2 = bicubic ( can also use WIDEN_DRAFT, WIDEN_BILINEAR, or WIDEN_BICUBIC . defaults to WIDEN_BICUBIC ) threads : number of threads to use. Defaults to number of logical processors Example: colorbars(pixel_type="yv12") widen(960,1.25) 8-bit planar RGB gives the best results because it is (approximately) gamma-aware. Last edited by wonkey_monkey; 18th December 2018 at 01:33. |
18th December 2018, 16:17 | #3 | Link | |
Registered User
Join Date: Oct 2018
Posts: 35
|
Quote:
Unfortunately, when I went to run it, I got a error message from AVISynth+ stating that there was no function named "Widen". I double checked that I had placed widen.dll in my 64-bit plugin folder (where I have MaskTools2.dll, etc.,) and it's there. I'm not sure what the problem is. |
|
18th December 2018, 16:58 | #4 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
Works here, (tested in 64 bit, plugins, plugins+ and avs LoadPlugin).
Req CPP runtimes from VS 2013. Code:
#LoadPlugin(".\Widen.dll") # if not in plugins dir Colorbars(Pixel_Type="YV24") widen(960,1.25) Return Last try Groucho2004 AvsMeter avsinfo (me guesses that you is usin' 32 bit avs+, you got both installed ?, try load into Vdub2 64 bit.).
__________________
I sometimes post sober. StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace "Some infinities are bigger than other infinities", but how many of them are infinitely bigger ??? Last edited by StainlessS; 18th December 2018 at 17:05. |
18th December 2018, 17:33 | #5 | Link |
Registered User
Join Date: Oct 2018
Posts: 35
|
I was missing VC 2013 CPP runtime. Now it runs, thanks!
Now my problem is using this. I can stretch an image, just like the colorbars example Colorbars(Pixel_Type="YV24") widen(960,1.25) but I need to go the other way. I need to shrink a 16:9 image that has been non-linearly stretched from it's original 4:3. I want to go back to the 4:3 by non-linearly shrinking the image with the shrinkage being highest at the edges and very little at the center. I tried using a width that is less than the original, as well as a fraction for scale (e.g. 0.75) and a negative for the scale (e.g. -1.25) but all I get is error messages such as "Stretch must bust be less than 1.7777" etc. |
18th December 2018, 21:14 | #6 | Link |
Formerly davidh*****
Join Date: Jan 2004
Posts: 2,492
|
Okay, how about this?
http://horman.net/avisynth/download/unwiden.zip The filter name is, rather unimaginatively, unwiden. I'm not sure what it'll do if you give it a bigger width then the input image, so don't do that. Try stretch<=1 - it should throw an error if you give it an out of range value. Edit: I have no idea how the original resizer used worked, so I don't know how good the result will be with unwiden. Last edited by wonkey_monkey; 18th December 2018 at 21:29. |
18th December 2018, 22:49 | #7 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
According to my free WordWeb popup dictionary (very old from maybe Win98/2000 or thereabouts, apparently last updated Oct 2017),
Widen, Antonym = Narrow. Perhaps you would like to rename Widen to UnNarrow.
__________________
I sometimes post sober. StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace "Some infinities are bigger than other infinities", but how many of them are infinitely bigger ??? |
19th December 2018, 00:01 | #8 | Link | |
Registered User
Join Date: Oct 2018
Posts: 35
|
Quote:
FYI, it did not work with YV12, though. There was color in the center of the image, but it was messed up. The sides of the image had no color (monochrome). Last edited by Qaenos; 19th December 2018 at 00:42. |
|
19th December 2018, 00:49 | #9 | Link |
Registered User
Join Date: Oct 2018
Posts: 35
|
By the way, do you happen to have a 32-bit dll compiled for widen/unwiden.dll? Once in a while, I still need to run a 32-bit version of AVISynth and I like to keep the same filters, if possible. If not, I'll just keep using WarpedResize from SimpleResize.dll when I have to run a 32-bit version of AVISynth, but your filter seems to work pretty good.
|
19th December 2018, 00:56 | #10 | Link |
Formerly davidh*****
Join Date: Jan 2004
Posts: 2,492
|
Obviously a scaling problem with subsampled chroma. It probably works fine with YV24, but Planar RGB gives the technically best result (if not distinguishable with normal footage).
I can compile 32-bit versions at some point, but my project's a bit all over the place at the moment. |
19th December 2018, 01:05 | #11 | Link | |
Registered User
Join Date: Oct 2018
Posts: 35
|
Quote:
|
|
19th December 2018, 04:37 | #12 | Link | |
Registered User
Join Date: Oct 2018
Posts: 35
|
Quote:
|
|
19th December 2018, 05:56 | #13 | Link |
Registered User
Join Date: Oct 2018
Posts: 35
|
Hmmm...tried a few more videos and I keep getting a "bad stretch parameter?" error when I try to Unwiden.
The error seems to be related to the ratio between the input width and the output width. For example, I have a 1920x1080 video I want to unwiden to 640x480. Unwiden(640, 0.6) BiCubicResize(640,480) will give "bad stretch parameter?" error If I go BiCubicResize(640,480) Unwiden(640, 0.6) I also get the "bad stretch parameter?" error. But if I go BiCubicResize(640 * 2,480) Unwiden(640, 0.6) It works! Yet if I go, BiCubicResize(640 * 3,480) Unwiden(640, 0.6) I once again get the "bad stretch parameter?" error. |
19th December 2018, 06:00 | #14 | Link |
Registered User
Join Date: Oct 2018
Posts: 35
|
Actually, forgive me if it's obvious (I'm still sort of new to AVISynth) but why do you recommend PlanarRGB instead of YV24? What do you mean by it gives the technically best result? Sometimes I work with RGB footage, but more often than not I'm dealing with YV12. I was under the impression that a YV12 to YV24 conversion would be better than a YV12 to PlanarRGB conversion.
|
19th December 2018, 11:22 | #16 | Link |
Formerly davidh*****
Join Date: Jan 2004
Posts: 2,492
|
I used some pretty dodgy maths to work out the remapping and some even dodgier assumptions to try and avoid getting stuck in an infinite loop. I'm not sure why some parameter combinations don't work.
RGB is best because it can take gamma into account. You'd get this with YUV: but with RGB and taking gamma into account, you get this: widen/unwiden does slightly better than the first image with YUV because it still takes gamma into account with the Y channel, but not the UV channels, so colours can still be slightly messed up. With natural footage you probably won't notice the problem. Last edited by wonkey_monkey; 19th December 2018 at 13:06. |
Thread Tools | Search this Thread |
Display Modes | |
|
|