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.

 

Go Back   Doom9's Forum > Capturing and Editing Video > Avisynth Development

Reply
 
Thread Tools Search this Thread Display Modes
Old 29th October 2016, 21:23   #1  |  Link
Stephen R. Savage
Registered User
 
Stephen R. Savage's Avatar
 
Join Date: Nov 2009
Posts: 327
z.lib resizers for AviSynth+

Code:
z_ConvertFormat(
    clip clip,
    int "width",
    int "height",
    str "pixel_type",
    str "colorspace_op",
    str "chromaloc_op",
    bool "interlaced",
    float "src_left",
    float "src_top",
    float "src_width",
    float "src_height",
    str "resample_filter",
    float "filter_param_a",
    float "filter_param_b",
    str "resample_filter_uv",
    float "filter_param_a_uv",
    float "filter_param_b_uv",
    str "dither_type")

width:                  output width in pixels
height:                 output height in pixels
pixel_type:             output pixel type ("YV12", "YUV420P16", etc.)
colorspace_op:          colorspace operation description
    Format is
        "matS[:transS[:primS[:rangeS]]]=>matD[:transD[:primD[:rangeD]]]"
    Example JPEG to MPEG: "170m:709:709:f=>709:709:709:l"
chromaloc_op:           chroma location operation description
    Format is "[locS]=>[locD]"
    Example JPEG to MPEG2: "center=>left"
interlaced:             whether to use interlaced mode (default: false)
resample_filter:        resampling mode
filter_param_a:         first parameter to resampler
filter_param_b:         second parameter to resampler
    Example Bicubic (Mitchell-Netravali):
        resample_filter="bicubic", filter_param_a=0.333, filter_param_b=0.333
    Example 4-tap Lanczos: resample_filter="lanczos", filter_param_a=4
resample_filter_uv:     resampling mode for chroma
filter_param_a_uv:      first parameter to chroma resampler
filter_param_b_uv:      second parameter to chroma resampler
dither_type:            dithering type

See VapourSynth documentation for valid string constants.
Also has all the AviSynth resizers, but with "z_" prefix.

Download: r2

Last edited by Stephen R. Savage; 7th July 2022 at 15:59.
Stephen R. Savage is offline   Reply With Quote
Old 30th October 2016, 14:43   #2  |  Link
Reel.Deel
Registered User
 
Join Date: Mar 2012
Location: Texas
Posts: 1,664
Thanks twc, are you planning on adding support for colorspace and bit depth conversions?
Reel.Deel is offline   Reply With Quote
Old 4th November 2016, 10:44   #3  |  Link
pinterf
Registered User
 
Join Date: Jan 2014
Posts: 2,309
Thanks, I will look try it later it when I have time, just looked at the source.

A remark: Planar RGB plane order is PLANAR_G, PLANAR_B, PLANAR_R
Question: AVS+ default alignment is 32. Is the 64 byte alignment is a requirement for zimg?
pinterf is offline   Reply With Quote
Old 6th November 2016, 01:20   #4  |  Link
wonkey_monkey
Formerly davidh*****
 
wonkey_monkey's Avatar
 
Join Date: Jan 2004
Posts: 2,492
Just curious, but what does "z.lib" refer to in this context? It's too close to zlib to Google for it...
__________________
My AviSynth filters / I'm the Doctor
wonkey_monkey is offline   Reply With Quote
Old 6th November 2016, 01:46   #5  |  Link
Reel.Deel
Registered User
 
Join Date: Mar 2012
Location: Texas
Posts: 1,664
Quote:
Originally Posted by davidhorman View Post
Just curious, but what does "z.lib" refer to in this context? It's too close to zlib to Google for it...
See here: https://github.com/sekrit-twc/zimg#zlib
Reel.Deel is offline   Reply With Quote
Old 6th November 2016, 02:02   #6  |  Link
TheFluff
Excessively jovial fellow
 
Join Date: Jun 2004
Location: rude
Posts: 1,100
I'm pretty sure he named it that just to be obnoxious. It's what he does.
TheFluff is offline   Reply With Quote
Old 6th November 2016, 03:04   #7  |  Link
filler56789
SuperVirus
 
filler56789's Avatar
 
Join Date: Jun 2012
Location: Antarctic Japan
Posts: 1,351
Quote:
Originally Posted by TheFluff View Post
I'm pretty sure he named it that just to be obnoxious. It's what he does.
lol LoL LOL

filler56789 is offline   Reply With Quote
Old 6th November 2016, 08:37   #8  |  Link
MysteryX
Soul Architect
 
MysteryX's Avatar
 
Join Date: Apr 2014
Posts: 2,559
Does this provide 16-bit support for AviSynth+?
MysteryX is offline   Reply With Quote
Old 15th December 2017, 11:39   #9  |  Link
Sparktank
47.952fps@71.928Hz
 
Sparktank's Avatar
 
Join Date: Mar 2011
Posts: 940
Any updates on this?
__________________
Win10 (x64) build 19041
NVIDIA GeForce GTX 1060 3GB (GP106) 3071MB/GDDR5 | (r435_95-4)
NTSC | DVD: R1 | BD: A
AMD Ryzen 5 2600 @3.4GHz (6c/12th, I'm on AVX2 now!)
Sparktank is offline   Reply With Quote
Old 29th December 2017, 09:23   #10  |  Link
Sparktank
47.952fps@71.928Hz
 
Sparktank's Avatar
 
Join Date: Mar 2011
Posts: 940
Quote:
Originally Posted by Stephen R. Savage View Post
Is there any update needed?
I wouldn't know if it needs updating or not, so I was asking.
__________________
Win10 (x64) build 19041
NVIDIA GeForce GTX 1060 3GB (GP106) 3071MB/GDDR5 | (r435_95-4)
NTSC | DVD: R1 | BD: A
AMD Ryzen 5 2600 @3.4GHz (6c/12th, I'm on AVX2 now!)
Sparktank is offline   Reply With Quote
Old 14th January 2018, 21:04   #11  |  Link
Sparktank
47.952fps@71.928Hz
 
Sparktank's Avatar
 
Join Date: Mar 2011
Posts: 940
Does any of this have to do with Zimg?
Zimg is getting a lot of updates.
And the documentation for this is lazy. I find things better looking at source code.

ZIMG is getting a lot of updates. This isn't getting anything.
https://github.com/sekrit-twc/zimg

Would it be better to ask Pinterf to make a port? Or even cretindesalpes?

Open source is nice. But only for those who know what it means.

Why is ZIMG getting more updates than this very small port?
The doc really says nothing. I only learn from looking at the source code and guessing.


Does the AVS+ port mean nothing?
I'll stick to Dither_tools until AVS+ really improves on these functions.
__________________
Win10 (x64) build 19041
NVIDIA GeForce GTX 1060 3GB (GP106) 3071MB/GDDR5 | (r435_95-4)
NTSC | DVD: R1 | BD: A
AMD Ryzen 5 2600 @3.4GHz (6c/12th, I'm on AVX2 now!)
Sparktank is offline   Reply With Quote
Old 14th January 2018, 21:20   #12  |  Link
TheFluff
Excessively jovial fellow
 
Join Date: Jun 2004
Location: rude
Posts: 1,100
It's an Avisynth plugin that uses the zimg resizers, yes, but since nobody seemed interested in it I doubt it'll ever get updated again. Just use the Vapoursynth version instead; there's no reason to use Avisynth anymore since the new avsproxy plugin lets you load even ancient no-source 32-bit Avisynth plugins in a 64-bit Vapoursynth process, or run Avisynth scripts if that's a thing you need.
TheFluff is offline   Reply With Quote
Old 16th January 2018, 02:39   #13  |  Link
real.finder
Registered User
 
Join Date: Jan 2012
Location: Mesopotamia
Posts: 2,587
Quote:
Originally Posted by TheFluff View Post
It's an Avisynth plugin that uses the zimg resizers, yes, but since nobody seemed interested in it I doubt it'll ever get updated again. Just use the Vapoursynth version instead; there's no reason to use Avisynth anymore since the new avsproxy plugin lets you load even ancient no-source 32-bit Avisynth plugins in a 64-bit Vapoursynth process, or run Avisynth scripts if that's a thing you need.
what is the difference between avsproxy and MP_Pipeline?
__________________
See My Avisynth Stuff
real.finder is offline   Reply With Quote
Old 16th January 2018, 14:33   #14  |  Link
edcrfv94
Registered User
 
Join Date: Apr 2015
Posts: 84
Quote:
Originally Posted by real.finder View Post
what is the difference between avsproxy and MP_Pipeline?
MP_Pipeline can not export clip to VapourSynth and pass it back.
edcrfv94 is offline   Reply With Quote
Old 27th January 2018, 23:41   #15  |  Link
Stephen R. Savage
Registered User
 
Stephen R. Savage's Avatar
 
Join Date: Nov 2009
Posts: 327
Since it came up in the main AviSynth+ thread, I updated the first post with a new build. It has an updated version of z.lib.
Stephen R. Savage is offline   Reply With Quote
Old 28th January 2018, 18:51   #16  |  Link
pinterf
Registered User
 
Join Date: Jan 2014
Posts: 2,309
Quote:
Originally Posted by Stephen R. Savage View Post
Since it came up in the main AviSynth+ thread, I updated the first post with a new build. It has an updated version of z.lib.
Speedwise much better on my i7-7770. I guess it's really not much time is spent in resizers in complex scripts but I definitely like the art of optimization.
pinterf is offline   Reply With Quote
Old 31st January 2018, 10:57   #17  |  Link
pinterf
Registered User
 
Join Date: Jan 2014
Posts: 2,309
Something strange happens.
When resizing vertically performance suddenly drops at delta=256.
Using avsresize r1b, x64, Intel i7-7700, current dev avs+ x64
Code:
w = 1920
h = 1920
BlankClip(width=w, height=h, length=8000, pixel_type = "YUV444P8")
#z_Spline64Resize(w,h+255) # 192.5 fps
z_Spline64Resize(w,h+256) #30 fps
pinterf is offline   Reply With Quote
Old 31st January 2018, 17:48   #18  |  Link
Stephen R. Savage
Registered User
 
Stephen R. Savage's Avatar
 
Join Date: Nov 2009
Posts: 327
You managed to find an obscure bug in z.lib. I updated first post with a new build (z.lib 2.7.3).
Stephen R. Savage is offline   Reply With Quote
Old 19th March 2018, 16:35   #19  |  Link
videoh
Useful n00b
 
Join Date: Jul 2014
Posts: 1,667
These conversions seem extremely slow compared to the Vapoursynth core equivalents. Really, it is too slow to be usable. Here is the script:

dgsource("THE GREAT WALL.dgi",fulldepth=true)
z_ConvertFormat(pixel_type="RGBPS",colorspace_op="2020ncl:st2084:2020:l=>rgb:linear:2020:l", dither_type="none")
#tonemap()
z_ConvertFormat(pixel_type="YUV420P16",colorspace_op="rgb:linear:2020:l=>709:709:709:l",dither_type="ordered")
prefetch(8)

For a typical clip, this takes 45 seconds while the corresponding Vapoursynth script takes 13 seconds.

Is there any way to speed things up or do we have to declare Avisynth+ dead for things like this?

MAGA (Make Avisynth Great Again)

Last edited by videoh; 19th March 2018 at 16:51.
videoh is offline   Reply With Quote
Old 19th March 2018, 16:53   #20  |  Link
pinterf
Registered User
 
Join Date: Jan 2014
Posts: 2,309
Quote:
Originally Posted by videoh View Post
These conversions seem extremely slow compared to the Vapoursynth core equivalents. Really, it is too slow to be usable. Here is the script:

dgsource("THE GREAT WALL.dgi",fulldepth=true)
z_ConvertFormat(pixel_type="RGBPS",colorspace_op="2020ncl:st2084:2020:l=>rgb:linear:2020:l", dither_type="none")
#tonemap()
z_ConvertFormat(pixel_type="YUV420P16",colorspace_op="rgb:linear:2020:l=>709:709:709:l",dither_type="ordered")
prefetch(8)

For a typical clip, this takes 45 seconds while the corresponding Vapoursynth script takes 13 seconds.

Is there any way to speed things up or do we have to declare Avisynth+ dead for things like this?

MAGA (Make Avisynth Great Again)
The functions - I think - are not autoregistering their MT modes for Avs+. Try using SetFilterMTMode avs+ function, probably they are MT_NICE_FILTER compatible but at least good for MT_MULTI_INSTANCE.
pinterf is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 03:07.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.