Avsresize
From Avisynth wiki
(Difference between revisions)
(→Resizers: add parameter description) |
(→Resizers: add info on b, c, and taps parameters) |
||
Line 285: | Line 285: | ||
::{{Par2|c|float|0.5}} | ::{{Par2|c|float|0.5}} | ||
:::Parameters for <code>z_BicubicResize</code> only. | :::Parameters for <code>z_BicubicResize</code> only. | ||
+ | :::<code>b</code> and <code>c</code> can be used to tweak the filter’s behavior. For upscaling, it is recommended to use values that satisfy the equation <code>b + 2c = 1</code>. | ||
+ | :::Roughly speaking, raising B will cause blurring and raising C will cause ringing. | ||
+ | :::*<code>b=1.0, c=0.0</code> : B-Spline | ||
+ | :::*<code>b=0.0, c=0.0</code> : Hermite | ||
+ | :::*<code>b=1/3, c=1/3</code> : Mitchell-Netravali cubic filter | ||
+ | :::*<code>b=0.0, c=0.5</code> : Catmull-Rom spline (default) | ||
+ | :::*<code>b=0.0, c=0.75</code> : VirtualDub's "Precise Bicubic" | ||
+ | :::*<code>b=0.0, c=1.0</code> : Sharp Bicubic | ||
+ | :::Hermite is often considered one of the best choices for downscaling, as it produces only minimal artifacts, at the cost of slight blurriness.[https://guideencodemoe-mkdocs.readthedocs.io/encoding/resampling/#mitchell-netravali-bicubic] | ||
<br> | <br> | ||
::{{Par2|target_width|int| }} | ::{{Par2|target_width|int| }} | ||
Line 308: | Line 317: | ||
::{{Par2|taps|int| }} | ::{{Par2|taps|int| }} | ||
:::Parameter for <code>z_LanczosResize</code> only. | :::Parameter for <code>z_LanczosResize</code> only. | ||
+ | :::Controls the filter’s number of lobes, or taps. Increasing the number of lobes improves sharpness at the cost of increased ringing. | ||
+ | :::You might occasionally see the tap count appended to the filter name to clarify the exact filter used, e.g. Lanczos2 for 2 taps. | ||
+ | :::For downscaling, higher tap counts might help in suppressing [http://www.imagemagick.org/Usage/filter/#aliasing Moiré effects]. | ||
<br> | <br> | ||
::{{Par2|chromaloc_op|string|<nowiki>"left=>left"</nowiki>}} | ::{{Par2|chromaloc_op|string|<nowiki>"left=>left"</nowiki>}} |
Revision as of 17:45, 27 June 2020
Abstract | |
---|---|
Author | sekrit-twc |
Version | r1e |
Download | avsresize_r1e.7z |
Category | Resize |
License | Open source |
Discussion | Doom9 Forum |
Contents |
Description
z.lib resizers for AviSynth+
Requirements
- AviSynth+ x86/x64
- Supported color formats: RGB24, RGB32, Y8, YV12, YV16, YV24
- All planar formats (8/10/12/14/16/32-bit, YUV/RGB with or without alpha) are supported.
Syntax and Parameters
z_ConvertFormat
Scaling, colorspace conversion, and depth conversion.
- z_ConvertFormat (clip clip, int "width", int "height", str "pixel_type", string "colorspace_op", string "chromaloc_op", bool "interlaced", float "src_left", float "src_top", float "src_width", float "src_height", string "resample_filter", float "filter_param_a", float "filter_param_b", string "resample_filter_uv", float "filter_param_a_uv", float "filter_param_b_uv", string "dither_type", string "cpu_type", float "nominal_luminance", bool "approximate_gamma")
- clip =
- Input clip.
- clip =
- int width =
- int height =
- Output width and height in pixels.
- int width =
- string pixel_type =
- Output pixel type ("YV12", "YUV420P16", etc.).
- string pixel_type =
Bit Depth Grey YUV420 YUVA420 YUV422 YUVA422 YUV444 YUVA444 RGB RGBA 8 Y8 YV12
YUV420
YUV420P8YUVA420
YUVA420P8YV16
YUV422
YUV422P8YUVA422
YUVA422P8YV24
YUV444
YUV444P8YUVA444
YUVA444P8RGBP
RGBP8RGBAP
RGBAP810 Y10 YUV420P10 YUVA420P10 YUV422P10 YUVA422P10 YUV444P10 YUVA444P10 RGBP10 RGBAP10 12 Y12 YUV420P12 YUVA420P12 YUV422P12 YUVA422P12 YUV444P12 YUVA444P12 RGBP12 RGBAP12 14 Y14 YUV420P14 YUVA420P14 YUV422P14 YUVA422P14 YUV444P14 YUVA444P14 RGBP14 RGBAP14 16 Y16 YUV420P16 YUVA420P16 YUV422P16 YUVA422P16 YUV444P16 YUVA444P16 RGBP16 RGBAP16 32-bit Float Y32 YUV420PS YUVA420PS YUV422PS YUVA422PS YUV444PS YUVA444PS RGBPS RGBAPS All colorspaces are planar. "YUV9" and "YV411" ("YUV411", "YUV411P8") were committed from table above. See AviSynth+ color formats table.
- string 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"
- string colorspace_op =
MATRIX COEFFICIENTS TRANSFER CHARACTERISTICS COLOR PRIMARIES PIXEL RANGE "rgb" "709" "709" "limited" "709" "unspec" "unspec" "l" "unspec" "470m" "470m" "full" "fcc" "470bg" "470bg" "f" "470bg" "601" "170m" "170m" "240m" "240m" "240" "linear" "film" "ycgco" "log100" "2020" "2020ncl" "log316" "st428" "2020cl" "xvycc" "st431-2" "chromancl" "srgb" "st432-1" "chromacl" "2020_10" "jedec-p22" "ictcp" "2020_12" Compatibility aliases Compatibility aliases "st2084" "xyz" same as "st428" "601" same as "470bg" "std-b67" "dci-p3" same as "st431-2" "2020" same as "2020ncl" Compatibility aliases "display-p3" same as "st432-1" "2020" same as "2020_10" see tables on VapourSynth resize documentation
- string chromaloc_op =
- Chroma location operation description.
- Format is
"[locS]=>[locD]"
- Chroma location table, names in parenthesis are compatibility aliases:
-
"left" ("mpeg2") | "center" ("jpeg" and "mpeg1") | "top_left"
-
- Chroma location table, names in parenthesis are compatibility aliases:
- Example JPEG to MPEG2:
"center=>left"
- string chromaloc_op =
- bool interlaced = false
- Whether to use interlaced mode (default: false)
- bool interlaced = false
- float src_left =
- float src_top =
- float src_width =
- float src_height =
- Optional crop rectangle in the input frame.
- float src_left =
- string resample_filter =
- Resampling modes:
"point" | "bilinear" | "bicubic" | "spline16" | "spline36" | "spline64" | "lanczos"
- Resampling modes:
- string resample_filter =
- float filter_param_a =
- float filter_param_b =
- First and 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
- float filter_param_a =
- string resample_filter_uv =
- Resampling mode for chroma.
- string resample_filter_uv =
- float filter_param_a_uv =
- float filter_param_b_uv =
- First and second parameter to chroma resampler.
- float filter_param_a_uv =
- string dither_type = "none"
- Dithering type:
"none" | "ordered" | "random" | "error_diffusion"
- Dithering type:
- string dither_type = "none"
- string cpu_type =
- CPU type, names in parenthesis are compatibility aliases:
"none" | "avx" | "avx_e" ("ivy") | "avx2" | "avx512f | "avx512_skx" ("skx") | "avx512_clx" | "avx512_pmc" ("cannon") | "avx512_snc" ("ice")
- CPU type, names in parenthesis are compatibility aliases:
- string cpu_type =
- float nominal_luminance = 100.0
- Nominal peak luminance in cd/m^2 when converting HDR content to RGB Linear.
- float nominal_luminance = 100.0
- bool approximate_gamma = true
- Evaluating transfer functions at reduced precision.
- bool approximate_gamma = true
Resizers
z.lib compatibility wrappers with same syntax as built-in resizers.
- z_PointResize (clip, int "target_width", int "target_height", float "src_left", float "src_top", float "src_width", float "src_height", string "chromaloc_op", string "dither")
- z_BilinearResize (clip, int "target_width", int "target_height", float "src_left", float "src_top", float "src_width", float "src_height", string "chromaloc_op", string "dither")
- z_BicubicResize (clip, float "b", float "c", int "target_width", int "target_height", float "src_left", float "src_top", float "src_width", float "src_height", string "chromaloc_op", string "dither")
- z_LanczosResize (clip, int "target_width", int "target_height", float "src_left", float "src_top", float "src_width", float "src_height", int "taps", string "chromaloc_op", string "dither")
- z_Lanczos4Resize (clip, int "target_width", int "target_height", float "src_left", float "src_top", float "src_width", float "src_height", int "taps", string "chromaloc_op", string "dither")
- z_Spline16Resize (clip, int "target_width", int "target_height", float "src_left", float "src_top", float "src_width", float "src_height", string "chromaloc_op", string "dither")
- z_Spline36Resize (clip, int "target_width", int "target_height", float "src_left", float "src_top", float "src_width", float "src_height", string "chromaloc_op", string "dither")
- z_Spline64Resize (clip, int "target_width", int "target_height", float "src_left", float "src_top", float "src_width", float "src_height", string "chromaloc_op", string "dither")
- clip =
- A clip to process. All planar formats are supported.
- clip =
- float b = 0.0
- float c = 0.5
- Parameters for
z_BicubicResize
only. b
andc
can be used to tweak the filter’s behavior. For upscaling, it is recommended to use values that satisfy the equationb + 2c = 1
.- Roughly speaking, raising B will cause blurring and raising C will cause ringing.
b=1.0, c=0.0
: B-Splineb=0.0, c=0.0
: Hermiteb=1/3, c=1/3
: Mitchell-Netravali cubic filterb=0.0, c=0.5
: Catmull-Rom spline (default)b=0.0, c=0.75
: VirtualDub's "Precise Bicubic"b=0.0, c=1.0
: Sharp Bicubic
- Hermite is often considered one of the best choices for downscaling, as it produces only minimal artifacts, at the cost of slight blurriness.[1]
- Parameters for
- float b = 0.0
- int target_width =
- The width of the output.
- int target_width =
- int target_height =
- The height of the output.
- int target_height =
- float src_left = 0.0
- Cropping of the left edge.
- float src_left = 0.0
- float src_top = 0.0
- Cropping of the top edge.
- float src_top = 0.0
- float src_width = Source width
- If > 0.0 it sets the width of the clip before resizing.
- If <= 0.0 it sets the cropping of the right edges before resizing.
- float src_width = Source width
- float src_height = Source height
- If > 0.0 it sets the height of the clip before resizing.
- If <= 0.0 it sets the cropping of the bottom edges before resizing
- float src_height = Source height
- int taps =
- Parameter for
z_LanczosResize
only. - Controls the filter’s number of lobes, or taps. Increasing the number of lobes improves sharpness at the cost of increased ringing.
- You might occasionally see the tap count appended to the filter name to clarify the exact filter used, e.g. Lanczos2 for 2 taps.
- For downscaling, higher tap counts might help in suppressing Moiré effects.
- Parameter for
- int taps =
- string chromaloc_op = "left=>left"
- Chroma location operation description.
- Format is
"[locS]=>[locD]"
- Chroma location table, names in parenthesis are compatibility aliases:
-
"left" ("mpeg2") | "center" ("jpeg" and "mpeg1") | "top_left"
-
- Chroma location table, names in parenthesis are compatibility aliases:
- Example JPEG to MPEG2:
"center=>left"
- string chromaloc_op = "left=>left"
- string dither = "none"
- Dithering type:
"none" | "ordered" | "random" | "error_diffusion"
- Dithering type:
- string dither = "none"
Changelog
Version Date Changes
r1e 2020/04/23 - Changes by StvG - Update to zimg@8815111; - z_ConvertFormat: added pixel type RGBP8, RGBAP8, YUV444, YUV444P8, YUVA444P8, YUV422, YUV422P8, YUVA422P8, YUV420, YUV420P8 , YUVA420P8, YUV411, YUV411P8 - added version.
2020/04/08 - Changes by StvG - Update to zimg@5896a26 - z_ConvertFormat: add "cpu_type", "nominal_luminance", and "approximate_gamma" parameters - z_ConvertFormat: remove "gauss", "lanczos4", "blackman", and "sinc" compatibility aliases - z_ConvertFormat: remove "dv" compatibility alias from chromaloc_op - Resizers: add "chromaloc_op" and "dither" parameters - Resizers: remove z_BlackmanResize(), z_GaussResize(), and z_SincResize() compatibility aliases.
r1d 2018/03/21 - ...............
r1 2016/10/29 - initial release
Archived Downloads
Version | Download | Mirror |
---|---|---|
r1e | avsresize_r1e.7z | avsresize_r1e.7z |
2020/04/08 | avsresize.7z | avsresize_20200408.7z |
r1d | avsresize-r1d.7z | avsresize-r1d.7z |
External Links
- Doom9 Forum - 8bit or greater (AviSynth+) linear/gamma light aware resizing?
- Doom9 Forum - HDRTools vs DitherTools vs ColorMatrix
Back to External Filters ←