summaryrefslogtreecommitdiff
path: root/libavfilter/drawutils.c
Commit message (Collapse)AuthorAge
* lavfi/drawutils: improve colorspace supportrcombs2022-06-19
| | | | | | | | | | | | | | | | | | | | | - Introduce ff_draw_init2, which takes explicit colorspace and range args - Use lavu/csp and lavfi/colorspace for conversion, rather than the lavu/colorspace.h macros - Use the passed-in colorspace when performing RGB->YUV conversions The upshot of this is: - Support for YUV spaces other than BT601 - Better rounding for all conversions - Particular rounding improvements in >8-bit formats, which previously used simple left-shifts - Support for limited-range RGB - Support for full-range YUV in non-J pixfmts Due to the rounding improvements, this results in a large number of minor changes to FATE tests. Signed-off-by: rcombs <rcombs@rcombs.me>
* lavfi/drawutils: re-enable P010 and P016 supportrcombs2022-01-04
| | | | These formats now work as expected.
* lavfi/drawutils: overhaul to improve pixel format supportrcombs2022-01-04
| | | | | | | | | | | | - No longer mixes u8 and u16 component accesses (this was UB) - De-duplicated 8->16 conversion - De-duplicated component -> plane+offset conversion - De-duplicated planar + packed RGB - No longer calls ff_fill_rgba_map - Removed redundant comp_mask data member - RGB0 and related formats no longer write an alpha value to the 0 byte - Non-planar YA formats now work correctly - High-bit-depth semi-planar YUV now works correctly
* lavfi/drawutils: ensure we don't support formats with non-pixel-sized offsetsrcombs2022-01-04
|
* lavfi/drawutils: ensure we can't overflow a componentrcombs2022-01-04
|
* lavfi/drawutils: ensure we don't allow mixed-byte-depth formatsrcombs2022-01-04
| | | | These could be hazardous because of FFDrawColor's union
* lavfi/drawutils: reimplement ff_fill_rgba_map without hardcoding the listrcombs2022-01-04
| | | | | | Same outputs, but computed instead of statically known, so new formats will be supported more easily. Asserts in place to ensure we update this if we add anything incompatible with its logic.
* lavfi/drawutils: reject shift-packed formatsrcombs2022-01-04
| | | | Disables x2bgr10/x2rgb10 (which did not behave correctly before).
* lavfi/drawutils: remove redundant BE format checksrcombs2022-01-04
| | | | We already explicitly don't support big-endian in general
* lavfi/drawutils: move BE check out of looprcombs2022-01-04
|
* Remove unnecessary avassert.h inclusionsAndreas Rheinhardt2021-07-22
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* Remove unnecessary mem.h inclusionsAndreas Rheinhardt2021-07-22
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avutil/pixdesc: Remove deprecated AV_PIX_FMT_FLAG_PSEUDOPALAndreas Rheinhardt2021-04-27
| | | | | | | Deprecated in d6fc031caf64eed921bbdef86d79d56bfc2633b0. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Signed-off-by: James Almer <jamrial@gmail.com>
* avfilter/vf_extractplanes: add float formats supportPaul B Mahol2021-02-07
|
* avfilter/drawutils: Remove remnants of old APIAndreas Rheinhardt2021-01-29
| | | | | | | | | ff_fill_line_with_color and ff_draw_rectangle are unused since 19c8f2271423281c9b876b984076a6467c455904; ff_copy_rectangle is unused since 53b7a3fe081ec56c5706228eb6431bb943ad471a. Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avfilter/drawutils: support gray14Paul B Mahol2018-05-05
| | | | Signed-off-by: Paul B Mahol <onemda@gmail.com>
* avfilter/drawutils: add support for full rangePaul B Mahol2018-05-03
| | | | Signed-off-by: Paul B Mahol <onemda@gmail.com>
* avutil/pixdesc: deprecate AV_PIX_FMT_FLAG_PSEUDOPALwm42018-04-03
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | PSEUDOPAL pixel formats are not paletted, but carried a palette with the intention of allowing code to treat unpaletted formats as paletted. The palette simply mapped the byte values to the resulting RGB values, making it some sort of LUT for RGB conversion. It was used for 1 byte formats only: RGB4_BYTE, BGR4_BYTE, RGB8, BGR8, GRAY8. The first 4 are awfully obscure, used only by some ancient bitmap formats. The last one, GRAY8, is more common, but its treatment is grossly incorrect. It considers full range GRAY8 only, so GRAY8 coming from typical Y video planes was not mapped to the correct RGB values. This cannot be fixed, because AVFrame.color_range can be freely changed at runtime, and there is nothing to ensure the pseudo palette is updated. Also, nothing actually used the PSEUDOPAL palette data, except xwdenc (trivially changed in the previous commit). All other code had to treat it as a special case, just to ignore or to propagate palette data. In conclusion, this was just a very strange old mechnaism that has no real justification to exist anymore (although it may have been nice and useful in the past). Now it's an artifact that makes the API harder to use: API users who allocate their own pixel data have to be aware that they need to allocate the palette, or FFmpeg will crash on them in _some_ situations. On top of this, there was no API to allocate the pseuo palette outside of av_frame_get_buffer(). This patch not only deprecates AV_PIX_FMT_FLAG_PSEUDOPAL, but also makes the pseudo palette optional. Nothing accesses it anymore, though if it's set, it's propagated. It's still allocated and initialized for compatibility with API users that rely on this feature. But new API users do not need to allocate it. This was an explicit goal of this patch. Most changes replace AV_PIX_FMT_FLAG_PSEUDOPAL with FF_PSEUDOPAL. I first tried #ifdefing all code, but it was a mess. The FF_PSEUDOPAL macro reduces the mess, and still allows defining FF_API_PSEUDOPAL to 0. Passes FATE with FF_API_PSEUDOPAL enabled and disabled. In addition, FATE passes with FF_API_PSEUDOPAL set to 1, but with allocation functions manually changed to not allocating a palette.
* lavfi/drawutils: Do not claim to support P016.Carl Eugen Hoyos2018-03-08
| | | | Fixes fate on big-endian.
* avfilter/drawutils: add gray9/10/12 supportPaul B Mahol2017-08-07
|
* avfilter/drawutils: support gbrap10 tooPaul B Mahol2017-08-07
|
* avfilter/drawutils: allow drawing opaque text on transparent backgroundPaul B Mahol2016-09-21
| | | | Signed-off-by: Paul B Mahol <onemda@gmail.com>
* avfilter/drawutils: honor shift for color component descriptionTimo Rothenpieler2016-08-31
|
* avfilter/drawutils: P010 is not supportedTimo Rothenpieler2016-08-31
|
* avfilter/drawutils: Fix single plane with alphaMichael Niedermayer2016-08-09
| | | | | | Fixes Ticket5720 Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* Split drawutils test out into separate fileDerek Buitenhuis2016-05-11
| | | | | | | This was missed during 96d616052b3d39678e477fa10610ca688f46fff9 because it is not included in FATE. Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
* lavfi/drawutils: support NV12 and NV21Rodger Combs2016-05-10
|
* lavfi/drawutils: Add some missing GBRP pix_fmts.Carl Eugen Hoyos2016-03-03
| | | | Fixes for example extractplanes with GBRAP16.
* avfilter/drawutils: fix gray and gbr formats on big endianMichael Niedermayer2016-02-25
| | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avfilter/drawutils: Fix ff_fill_rectangle() on big endianMichael Niedermayer2016-02-25
| | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avfilter/drawutils: >8 bit supportPaul B Mahol2016-02-17
| | | | Signed-off-by: Paul B Mahol <onemda@gmail.com>
* avutil: Rename FF_CEIL_COMPAT to AV_CEIL_COMPATDerek Buitenhuis2016-01-27
| | | | | | | | | | Libav, for some reason, merged this as a public API function. This will aid in future merges. A define is left for backwards compat, just in case some person used it, since it is in a public header. Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
* lavfi: recognize GBR9-14P as RGB in ff_fill_rgba_map().Ronald S. Bultje2016-01-24
|
* drawutils: ReindentTimothy Gu2015-10-26
|
* lavfi/drawutils: add const to blending mask.Nicolas George2015-10-25
|
* avfilter/all: propagate errors of functions from avfilter/formatsGanesh Ajjanagadde2015-10-14
| | | | | | | | | | | | | | | | | | Many of the functions from avfilter/formats can return errors, usually AVERROR(ENOMEM). This propagates the return values. All of these were found by using av_warn_unused_result, demonstrating its utility. Tested with FATE. I am least sure of the changes to avfilter/filtergraph, since I don't know what/how reduce_format is intended to behave and how it should react to errors. Fixes: CID 1325680, 1325679, 1325678. Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Previous version Reviewed-by: Nicolas George <george@nsup.org> Previous version Reviewed-by: Clément Bœsch <u@pkh.me> Signed-off-by: Ganesh Ajjanagadde <gajjanagadde@gmail.com>
* Replace all remaining occurances of step/depth_minus1 and offset_plus1Hendrik Leppkes2015-09-08
|
* avfilter/drawutils: Assert av_pix_fmt_desc_get() return value in ↵Michael Niedermayer2015-06-13
| | | | | | | | | | | ff_fill_line_with_color() Theres currently no case where this could be triggered Found-by: Daemon404 Reviewed-by: Nicolas George <george@nsup.org> Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* avfilter/drawutils: Fix format validity check in ff_draw_init()Michael Niedermayer2015-06-13
| | | | | Found-by: Daemon404 Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* avfilter/drawutils: Check for av_malloc* failuresMichael Niedermayer2015-01-22
| | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* avfilter/drawutils: Use av_malloc_array()Michael Niedermayer2015-01-22
| | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* avfilter/vf_drawtext: Avoid using non public AV_PIX_FMT_NBMichael Niedermayer2014-05-27
| | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* lavfi/drawutils: set subsampling for rgb tooPaul B Mahol2013-07-14
| | | | | | Otherwise it is incorrectly set to 1. Signed-off-by: Paul B Mahol <onemda@gmail.com>
* lavfi/drawutils: fix planar rgbPaul B Mahol2013-07-08
| | | | Signed-off-by: Paul B Mahol <onemda@gmail.com>
* lavfi/drawutils: attempt to fix subsampling.Clément Bœsch2013-05-28
|
* replace remaining PIX_FMT_* flags with AV_PIX_FMT_FLAG_*Michael Niedermayer2013-05-15
| | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* lavfi/drawutils: add 16 bit rgb and planar rgb to ff_fill_rgba_map()Paul B Mahol2013-05-08
| | | | Signed-off-by: Paul B Mahol <onemda@gmail.com>
* lavfi/drawutils: fix blending computation in blend_line functionMatthieu Bouron2013-01-05
| | | | | If width is not alligned with hsub, background component should only be multiplied once by sub alpha component.
* Merge commit 'd1d9efaae6c7e8466b06c30ca21c6b569dd2e480'Michael Niedermayer2012-11-21
|\ | | | | | | | | | | | | | | | | | | | | * commit 'd1d9efaae6c7e8466b06c30ca21c6b569dd2e480': avcodec: split avpicture from imgconvert pixdesc: add PIX_FMT_ALPHA flag Conflicts: libavcodec/imgconvert.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
* | Merge commit '59ee9f78b0cc4fb84ae606fa317d8102ad32a627'Michael Niedermayer2012-10-12
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * commit '59ee9f78b0cc4fb84ae606fa317d8102ad32a627': lavfi: do not use av_pix_fmt_descriptors directly. Conflicts: libavfilter/buffersrc.c libavfilter/drawutils.c libavfilter/filtfmts.c libavfilter/vf_ass.c libavfilter/vf_boxblur.c libavfilter/vf_drawtext.c libavfilter/vf_lut.c libavfilter/vf_pad.c libavfilter/vf_scale.c libavfilter/vf_showinfo.c libavfilter/vf_transpose.c Merged-by: Michael Niedermayer <michaelni@gmx.at>