Commit 416e35e5 authored by Paul B Mahol's avatar Paul B Mahol

avfilter: add zscale filter

Signed-off-by: 's avatarPaul B Mahol <onemda@gmail.com>
parent e11e3268
......@@ -21,6 +21,7 @@ version <next>:
- extensive native AAC encoder improvements
- ADPCM PSX decoder
- genh, vag, ads & svag demuxer
- zscale filter
version 2.8:
......
......@@ -269,6 +269,7 @@ External library support:
--enable-libxcb-shape enable X11 grabbing shape rendering [autodetect]
--enable-libxvid enable Xvid encoding via xvidcore,
native MPEG-4/Xvid encoder exists [no]
--enable-libzimg enable z.lib, needed for zscale filter [no]
--enable-libzmq enable message passing via libzmq [no]
--enable-libzvbi enable teletext support via libzvbi [no]
--disable-lzma disable lzma [autodetect]
......@@ -1456,6 +1457,7 @@ EXTERNAL_LIBRARY_LIST="
libxcb_shape
libxcb_xfixes
libxvid
libzimg
libzmq
libzvbi
lzma
......@@ -2843,6 +2845,7 @@ tinterlace_pad_test_deps="tinterlace_filter"
uspp_filter_deps="gpl avcodec"
zmq_filter_deps="libzmq"
zoompan_filter_deps="swscale"
zscale_filter_deps="libzimg"
# examples
avio_reading="avformat avcodec avutil"
......@@ -5423,6 +5426,7 @@ enabled libx265 && require_pkg_config x265 x265.h x265_api_get &&
die "ERROR: libx265 version must be >= 57."; }
enabled libxavs && require libxavs xavs.h xavs_encoder_encode -lxavs
enabled libxvid && require libxvid xvid.h xvid_global -lxvidcore
enabled libzimg && require_pkg_config zimg zimg.h zimg_get_api_version
enabled libzmq && require_pkg_config libzmq zmq.h zmq_ctx_new
enabled libzvbi && require libzvbi libzvbi.h vbi_decoder_new -lzvbi
enabled mmal && { check_lib interface/mmal/mmal.h mmal_port_connect -lmmal_core -lmmal_util -lmmal_vc_client -lbcm_host ||
......
......@@ -11856,6 +11856,177 @@ zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
@end example
@end itemize
@section zscale
Scale (resize) the input video, using the z.lib library:
https://github.com/sekrit-twc/zimg.
The zscale filter forces the output display aspect ratio to be the same
as the input, by changing the output sample aspect ratio.
If the input image format is different from the format requested by
the next filter, the zscale filter will convert the input to the
requested format.
@subsection Options
The filter accepts the following options.
@table @option
@item width, w
@item height, h
Set the output video dimension expression. Default value is the input
dimension.
If the @var{width} or @var{w} is 0, the input width is used for the output.
If the @var{height} or @var{h} is 0, the input height is used for the output.
If one of the values is -1, the zscale filter will use a value that
maintains the aspect ratio of the input image, calculated from the
other specified dimension. If both of them are -1, the input size is
used
If one of the values is -n with n > 1, the zscale filter will also use a value
that maintains the aspect ratio of the input image, calculated from the other
specified dimension. After that it will, however, make sure that the calculated
dimension is divisible by n and adjust the value if necessary.
See below for the list of accepted constants for use in the dimension
expression.
@item size, s
Set the video size. For the syntax of this option, check the
@ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
@item dither, d
Set the dither type.
Possible values are:
@table @var
@item none
@item ordered
@item random
@item error_diffusion
@end table
Default is none.
@item filter, f
Set the resize filter type.
Possible values are:
@table @var
@item point
@item bilinear
@item bicubic
@item spline16
@item spline36
@item lanczos
@end table
Default is bilinear.
@item range, r
Set the color range.
Possible values are:
@table @var
@item input
@item limited
@item full
@end table
Default is same as input.
@item primaries, p
Set the color primaries.
Possible values are:
@table @var
@item input
@item 709
@item unspecified
@item 170m
@item 240m
@item 2020
@end table
Default is same as input.
@item transfer, t
Set the transfer characteristics.
Possible values are:
@table @var
@item input
@item 709
@item unspecified
@item 601
@item linear
@item 2020_10
@item 2020_12
@end table
Default is same as input.
@item matrix, m
Set the colorspace matrix.
Possible value are:
@table @var
@item input
@item 709
@item unspecified
@item 470bg
@item 170m
@item 2020_ncl
@item 2020_cl
@end table
Default is same as input.
@end table
The values of the @option{w} and @option{h} options are expressions
containing the following constants:
@table @var
@item in_w
@item in_h
The input width and height
@item iw
@item ih
These are the same as @var{in_w} and @var{in_h}.
@item out_w
@item out_h
The output (scaled) width and height
@item ow
@item oh
These are the same as @var{out_w} and @var{out_h}
@item a
The same as @var{iw} / @var{ih}
@item sar
input sample aspect ratio
@item dar
The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
@item hsub
@item vsub
horizontal and vertical input chroma subsample values. For example for the
pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
@item ohsub
@item ovsub
horizontal and vertical output chroma subsample values. For example for the
pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
@end table
@table @option
@end table
@c man end VIDEO FILTERS
@chapter Video Sources
......
......@@ -246,6 +246,7 @@ OBJS-$(CONFIG_XBR_FILTER) += vf_xbr.o
OBJS-$(CONFIG_YADIF_FILTER) += vf_yadif.o
OBJS-$(CONFIG_ZMQ_FILTER) += f_zmq.o
OBJS-$(CONFIG_ZOOMPAN_FILTER) += vf_zoompan.o
OBJS-$(CONFIG_ZSCALE_FILTER) += vf_zscale.o
OBJS-$(CONFIG_ALLRGB_FILTER) += vsrc_testsrc.o
OBJS-$(CONFIG_ALLYUV_FILTER) += vsrc_testsrc.o
......
......@@ -267,6 +267,7 @@ void avfilter_register_all(void)
REGISTER_FILTER(YADIF, yadif, vf);
REGISTER_FILTER(ZMQ, zmq, vf);
REGISTER_FILTER(ZOOMPAN, zoompan, vf);
REGISTER_FILTER(ZSCALE, zscale, vf);
REGISTER_FILTER(ALLRGB, allrgb, vsrc);
REGISTER_FILTER(ALLYUV, allyuv, vsrc);
......
......@@ -30,7 +30,7 @@
#include "libavutil/version.h"
#define LIBAVFILTER_VERSION_MAJOR 6
#define LIBAVFILTER_VERSION_MINOR 11
#define LIBAVFILTER_VERSION_MINOR 12
#define LIBAVFILTER_VERSION_MICRO 100
#define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment