Commit Graph

33 Commits

Author SHA1 Message Date
Paul B Mahol fddef964e8 avfilter/vf_colorspace: fix memmory leaks
Fixes #8303
2019-10-18 10:48:22 +02:00
Jun Zhao 88a9998fe8 lavfi/colorspace: typedef ThreadData as all other filters
typedef ThreadData as all other filters.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2019-10-10 09:00:15 +08:00
Paul B Mahol 22f3b6286e avfilter: add av_cold where it is missing 2019-10-03 12:09:07 +02:00
Raphaël Zumer 08dfd57fd8 avfilter: Support EBU Tech. 3213-E primaries values
Signed-off-by: Raphaël Zumer <rzumer@tebako.net>
Signed-off-by: James Almer <jamrial@gmail.com>
2019-09-01 20:00:53 -03:00
Yonglin Luo 664a27ea40 libavfilter/vf_colorspace.c: fix demarcation point of gamma linearize function
The linearize function (usually refered to EOTF) is the inverse of
delinearize function (usually referred to OETF). Demarcation point of
EOTF should be beta*delta, but the actual value used now in the source
code is beta.

For ITU Rec.709, they are 0.081 (0.018*4.5) and 0.018 respectively
(beta = 0.018 and delta = 4.5), and they correspond to pixel value 5
and 21 for an 8-bit image. Linearized result of pixel within that range
(5-21) will be different, but this commit will make linearize function
of the filter more accurate in the mathematical sense.

Signed-off-by: Yonglin Luo <vincenluo@tencent.com>
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2019-07-03 13:57:11 -04:00
Ruiling Song d0f3798b4e lavfi/colorspace: move some functions to common file
These functions can be reused by other colorspace filters,
so move them to common file. No functional changes.

Signed-off-by: Ruiling Song <ruiling.song@intel.com>
2019-03-22 09:33:28 +08:00
Paul B Mahol b0cfb2cfb9 avfilter/vf_colorspace: fix typo in comment 2018-09-17 12:51:59 +02:00
Mark Thompson 46fb150a81 lavfi/colorspace: Add namespace prefix to global functions 2018-06-28 16:14:35 +01:00
Ruiling Song 649d7ca477 lavfi: make vf_colorspace use functions from colorspace.c
These functions are shared among colorspace related filters.

Signed-off-by: Ruiling Song <ruiling.song@intel.com>
2018-06-21 01:19:25 +01:00
Vittorio Giovara c12e8f5f0b vf_colorspace: Add a pixdesc API alias name for bt2020nc color space 2017-06-09 10:44:11 -04:00
Vittorio Giovara f7f60749e0 vf_colorspace: Add support for jedec p22 primaries
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2017-06-07 23:39:31 -04:00
Vittorio Giovara 35c76f2e13 vf_colorspace: Add support for smpte248 color primaries 2017-06-07 22:56:11 -04:00
Vittorio Giovara d9909b11d9 vf_colorspace: Add support for gbr color space
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2017-06-06 11:22:52 -04:00
Vittorio Giovara afb84857bf vf_colorspace: Forbid odd dimensions
This prevents writing past bounds.

Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2016-11-28 11:24:09 -05:00
Vittorio Giovara 6f2ad32a16 vf_colorspace: Add support for film primaries
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
2016-11-01 17:47:25 -04:00
Vittorio Giovara 4697f60444 vf_colorspace: Add support for smpte 431/432 (dci/display p3) primaries
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
2016-11-01 17:47:25 -04:00
Vittorio Giovara 2996604acd vf_colorspace: Add support for ycgco color space
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
2016-11-01 17:47:25 -04:00
Vittorio Giovara 5a123f1424 vf_colorspace: Add support for iec61966-2.4 (xvYCC) transfer
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
Reviewed-by: "Ronald S. Bultje" <rsbultje@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-10-31 21:02:12 +01:00
Vittorio Giovara ba53d3ae8b vf_colorspace: Add support for iec61966-2.1 (sRGB) transfer
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
2016-10-24 16:07:44 -04:00
Ronald S. Bultje f141ac4d0b vf_colorspace: don't spam console with warnings if range is unspecified. 2016-10-24 16:03:16 -04:00
James Almer e4bfc9ecf7 avfilter/vf_colorspace: fix range for output colorspace option
Rreviewed-by: BBB
Signed-off-by: James Almer <jamrial@gmail.com>
2016-09-28 17:33:38 -03:00
Vittorio Giovara cb78d14cf9 vf_colorspace: Interpret unspecified color range as limited range
This is the assumption that is made in pixel format conversion do
throughout the code (in particular swscale), and BT-specifications
mandate.

Add a warning to inform the user that an automatic selection is being
made.

Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
2016-09-19 08:26:49 -04:00
Vittorio Giovara 76c28360b5 vf_colorspace: Add modern names for color range option
Allows to use values returned from API and from ffprobe directly.

Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2016-09-14 17:24:22 -04:00
Vittorio Giovara d41bfa9c0b vf_colorspace: Add BT-names for gamma22/28 transfer option
Allows to use values returned from API and from ffprobe directly.

Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
2016-09-13 10:22:23 -04:00
Vittorio Giovara 5df993f3b1 vf_colorspace: Allow overriding input color properties
The filter needs input frames with color properties filled out by
the decoder. Since this is not always possible, add input options to
the filter so that user may override color space, color primaries,
transfer characteristics, and color range, as well as a generic option
to set all properties at once.

Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2016-09-04 13:11:32 +02:00
Paul B Mahol a0a57072c9 avfilter: make use of ff_filter_get_nb_threads 2016-08-29 16:27:09 +02:00
Vittorio Giovara 69abf4f93c vf_colorspace: Add support for full range yuv
Whenever a full range video is input, since the YUVJ* formats are not
listed as supported for this filter, a range reduction takes place
through the auto-inserted format filter, forcing the conversion to
operate on a limited range,

However the filter handles full range videos perfectly fine, so adding
support to YUVJ* formats will allow skipping a conversion step, while
providing completely identical results.

Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
Reviewed-by: "Ronald S. Bultje" <rsbultje@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-08-27 13:08:43 +02:00
Vittorio Giovara 6648da3591 vf_colorspace: Check av_frame_copy_props() return value
This function can potentially allocate memory.

Reviewed-by: "Ronald S. Bultje" <rsbultje@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-08-27 13:08:43 +02:00
Ronald S. Bultje 531ff7161d vf_colorspace: don't enable passthrough if bitdepth doesn't match.
Also check return value of av_frame_copy() in passthrough mode, so that
if a copy fails (as it did here, because bitdepth didn't match), the filter
doesn't return success, which would mean sending an uninitialized framebuffer
further down the filtergraph.
2016-05-10 09:26:17 -04:00
Ronald S. Bultje 356c116536 vf_colorspace: fix range order. 2016-05-10 09:26:17 -04:00
Ronald S. Bultje 9bbed8645a vf_colorspace: make whitepoint adaptation mode configurable.
Also add von kries whitepoint adaptation, and add 'identity' to turn
whitepoint adaptation off.
2016-05-10 09:26:16 -04:00
Ronald S. Bultje 431117dcb5 vf_colorspace: add floyd-steinberg dithering option to full conversion. 2016-05-10 08:37:55 -04:00
Ronald S. Bultje 2e2e08a35b lavfi: new colorspace conversion filter.
The intent here is similar to colormatrix, but it's LGPLv2.1-or-later
(instead of GPLv2.0) and supports gamma/chromaticity correction.
2016-04-12 16:42:45 -04:00