1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-26 19:01:44 +02:00
Commit Graph

180 Commits

Author SHA1 Message Date
wm4
d6fc031caf avutil/pixdesc: deprecate AV_PIX_FMT_FLAG_PSEUDOPAL
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.
2018-04-03 17:53:00 +02:00
Paul B Mahol
713f9c5b5d avfilter/vf_scale: add more aliases for "range" options
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2017-12-08 20:36:44 +01:00
Carl Eugen Hoyos
da99b3f0c9 lavfi/scale2ref: Set output frame rate to main input frame rate.
Fixes ticket #6817.
2017-11-08 22:50:05 +01:00
Kevin Mark
d32a6c36e4 libavfilter/scale2ref: Maintain main input's DAR
The scale2ref filter will now maintain the DAR of the main input and
not the DAR of the reference input. This previous behavior was deemed
counterintuitive for most (all?) use-cases.

Before:
scale2ref=iw/4:ow/mdar
in  w:320 h:240 fmt:rgb24 sar:1/1
ref w:640 h:360 fmt:rgb24 sar:1/1
out w:160 h:120 fmt:rgb24 sar:4/3 flags:0x2
SAR: ((120 * 640) / (160 * 360)) * (1 / 1) = 4 / 3
DAR: (160 / 120) * (4 / 3) = 16 / 9
(main out now same DAR as ref)

Now:
scale2ref=iw/4:ow/mdar
in  w:320 h:240 fmt:rgb24 sar:1/1
ref w:640 h:360 fmt:rgb24 sar:1/1
out w:160 h:120 fmt:rgb24 sar:1/1 flags:0x2
SAR: ((120 * 320) / (160 * 240)) * (1 / 1) = 1 / 1
DAR: (160 / 120) * (1 / 1) = 4 / 3
(main out same DAR as main in)

The scale2ref FATE test has also been updated.

Signed-off-by: Kevin Mark <kmark937@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-07-04 15:09:10 +02:00
Muhammad Faiz
6af050d7d0 avfilter: do not use AVFrame accessor
Reviewed-by: wm4 <nfxjfg@googlemail.com>
Signed-off-by: Muhammad Faiz <mfcc64@gmail.com>
2017-04-23 14:40:30 +07:00
Maksym Veremeyenko
8efb7f5a26 avfilter/vf_scale: Fix chroma positioning for 4:2:0 pixel format
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-02-07 21:32:26 +01:00
Aman Gupta
037bb4021c avfilter/scale: refactor common code for scaling height/width expressions
Implements support for height/width expressions in vf_scale_vaapi,
by refactoring common code into a new libavfilter/scale.c

Signed-off-by: Mark Thompson <sw@jkqxz.net>
2017-02-02 22:58:54 +00:00
Ronald S. Bultje
6135aed0d2 vf_scale: support bt2020 in in/out_color_matrix properties. 2016-04-17 09:28:30 -04:00
Bela Bodecs
868a2ed568 vf_scale: Detecting changes of incoming frame properties and dinamically evaluate width and height expressions
Currently scale filter accepts expressions in its width and height
parameters but evaluates them only once at init and replaces them with
their actual values. Later on, if any parameter of incoming frames
changes - ie those were used in the original size expressions -  then
they new values will not have any affect for width and heigth values.
They remain the same. This patch makes possible that width and height
expressions be evaluated frame-by-frame basis if width/height/sar/format
properties of incoming frame would change. To retain the current
behaviour and not to break any earlier app, a new config parameter has
been introduced. Its name is "eval" and it has two distinct values:
"init" and "frame". The default value is "init".
This feature is very usefull in case of DVBT mpeg-ts streams where SAR
may change time-by-time from 4/3 to 16/9 and vica-versa and the size
remains the same and you want to create a variable sized output with 1/1
SAR.

Signed-off-by: Bela Bodecs <bodecsb@vivanet.hu>
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-01-20 13:32:00 +01:00
Thomas Mundt
73ce8162f3 avfilter/vf_scale: set proper out frame color range
Prevents that following scalers in the filter chain will do unintentional color range conversions.
Fixes Ticket #5096

Signed-off-by: Thomas Mundt <loudmax@yahoo.de>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-12-31 02:08:20 +01:00
Clément Bœsch
244766e407 lavfi/scale: add nb_slices debug option 2015-12-21 10:30:52 +01:00
Clément Bœsch
0e62b5d1ef avfilter: use AV_OPT_TYPE_BOOL in a bunch of places 2015-12-04 15:37:06 +01:00
Ganesh Ajjanagadde
6aaac24d72 avfilter/all: propagate errors of functions from avfilter/formats
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>
2015-10-14 10:04:01 -04:00
Christophe Gisquet
552faecf4b vf_scale: conditionally override chroma position
For yuv420p, the chroma position is unilaterally overriden, even
if ffmpeg's command-line explicitly set it. To fix this, override
only if the value is the default one.

Regression since 1515bfb3.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-09-23 23:30:53 +02:00
Carl Eugen Hoyos
0cb6c0ec48 lavfi/scale: Pass src_range and dst_range to libswscale.
Fixes ticket #4812.
2015-09-01 09:17:26 +02:00
Hendrik Leppkes
ea1061e147 Merge commit 'b1abd2aaf91be249f24cb74db9c205d9e4ca9da6'
* commit 'b1abd2aaf91be249f24cb74db9c205d9e4ca9da6':
  vf_scale: Add an option to pass the scaler params

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2015-08-31 10:07:34 +02:00
Michael Niedermayer
58a0b7f114 avfilter/vf_scale: If no output color matrix is specified, use the input
This should only affect yuv->yuv, and not change behavior

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-08-31 01:33:05 +02:00
Michael Niedermayer
5a00c30041 avfilter/vf_scale: Do not skip scale if the color matrix mismatches
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-08-31 01:33:05 +02:00
Carl Eugen Hoyos
75d9006475 avfilter/vf_scale: Do not skip scale if range mismatches
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-08-31 01:33:05 +02:00
Luca Barbato
b1abd2aaf9 vf_scale: Add an option to pass the scaler params
Reported-By: zehan@magicpony.technology
2015-08-26 12:13:23 +02:00
Michael Niedermayer
22f85543ed scale2ref: override request_frame() and correctly connect them to the corresponding inputs
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-08-18 15:59:23 +02:00
Michael Niedermayer
db0f8f3f9d avfilter/vf_scale: Set scale2ref ref output timebase
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-08-18 15:59:23 +02:00
Michael Niedermayer
21566b21d5 avfilter: add scale2ref filter
This filter can be used to scale one stream to match another or based on
another, useful to scale subtitles or other things to be overlayed

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-08-17 17:18:01 +02:00
Michael Niedermayer
d3d776ccf9 avfilter/vf_scale: apply generic options after flags.
Otherwise the flags overwrite anything set by the generic stuff to the flags

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-08-08 14:44:15 +02:00
Bernd Bleßmann
99ad832c7e libavfilter/vf_scale: implement process_command
Signed-off-by: Bernd Bleßmann <bb@it-entwicklung.de>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-07-21 18:20:22 +02:00
Anton Khirnov
3735b5c616 Revert "lavfi: always check av_expr_parse_and_eval() return value"
This reverts commit 63be97ec40.

All those calls were unchecked on purpose, as explained in the comments
in the code.
2015-05-05 16:27:24 +02:00
Michael Niedermayer
d5dcd94630 avfilter/vf_scale: Add warning for AVCOL_SPC_YCGCO
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-04-13 13:45:41 +02:00
Kieran Kunhya
1515bfb313 vf_scale: Use correct chroma positions for YUV420P
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-25 02:53:29 +01:00
Vittorio Giovara
63be97ec40 lavfi: always check av_expr_parse_and_eval() return value
CC: libav-stable@libav.org
Bug-Id: CID 703624
2014-12-18 23:27:14 +01:00
Michael Niedermayer
e927682e1b avfilter/vf_scale: Allow chroma samples to be above and to the left of luma samples
Found-by: Kierank
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-09-21 12:24:03 +02:00
Michael Niedermayer
cab8fc624b avfilter/vf_scale: fix log message category
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-07-28 05:15:16 +02:00
Michael Niedermayer
de5ec08825 Merge commit '862f33c10ea38ea49fa4188725df5e5246dbd1d8'
* commit '862f33c10ea38ea49fa4188725df5e5246dbd1d8':
  vf_scale: use the pixfmt descriptor API

Conflicts:
	libavfilter/vf_scale.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-05-27 02:54:58 +02:00
Anton Khirnov
862f33c10e vf_scale: use the pixfmt descriptor API
Avoid using AV_PIX_FMT_NB, since that hardcodes the number of pixel
formats into lavfi and will break when a shared lavu is updated, adding
new pixel formats.
2014-05-26 22:24:46 +02:00
Michael Niedermayer
74a8dbe1c4 Merge commit '58400ac133bcfb6bf8196b4e5208bc178307739b'
* commit '58400ac133bcfb6bf8196b4e5208bc178307739b':
  lavfi: name anonymous structs

Conflicts:
	libavfilter/buffersink.c
	libavfilter/f_select.c
	libavfilter/src_movie.c
	libavfilter/vf_drawbox.c
	libavfilter/vf_drawtext.c
	libavfilter/vf_overlay.c
	libavfilter/vf_showinfo.c
	libavfilter/vf_unsharp.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-04-19 18:20:17 +02:00
Vittorio Giovara
58400ac133 lavfi: name anonymous structs 2014-04-19 16:20:57 +02:00
Michael Niedermayer
214a3b8bf9 avfilter/vf_scale: simplify alignment code
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-01-25 16:54:24 +01:00
Michael Niedermayer
1e48c39ece avfilter/vf_scale: do aspect ratio and scale factor compensation together
Fixes rounding error

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-01-25 16:48:13 +01:00
Lars Kiesow
69b1d1d99b Documentation for scale filter factor 2014-01-25 15:02:15 +01:00
Lars Kiesow
e395f8de5a Fixed factor for scale filter 2014-01-25 15:00:02 +01:00
Lars Kiesow
7fc4c18463 Factors for scale filter 2014-01-25 14:40:48 +01:00
Michael Niedermayer
d0ac60730d avfilter/vf_scale: add ov/hsub
Suggested-by: divVerent
Reviewed-by: Stefano
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-11-04 15:23:26 +01:00
Rudolf Polzer
3a14b160bd vf_scale: make the dar variable return the DAR.
Before, it just returned width/height. Correct is width/height*sar.

That way it is consistent with DAR as in probe output and setdar.

Signed-off-by: Rudolf Polzer <divverent@xonotic.org>
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2013-11-02 21:16:29 +01:00
Michael Niedermayer
325f6e0a97 Merge remote-tracking branch 'qatar/master'
* qatar/master:
  lavfi: do not export the filters from shared objects

Conflicts:
	libavfilter/af_amix.c
	libavfilter/af_anull.c
	libavfilter/asrc_anullsrc.c
	libavfilter/f_select.c
	libavfilter/f_settb.c
	libavfilter/split.c
	libavfilter/src_movie.c
	libavfilter/vf_aspect.c
	libavfilter/vf_blackframe.c
	libavfilter/vf_colorbalance.c
	libavfilter/vf_copy.c
	libavfilter/vf_crop.c
	libavfilter/vf_cropdetect.c
	libavfilter/vf_drawbox.c
	libavfilter/vf_format.c
	libavfilter/vf_framestep.c
	libavfilter/vf_frei0r.c
	libavfilter/vf_hflip.c
	libavfilter/vf_libopencv.c
	libavfilter/vf_lut.c
	libavfilter/vf_null.c
	libavfilter/vf_overlay.c
	libavfilter/vf_scale.c
	libavfilter/vf_transpose.c
	libavfilter/vf_unsharp.c
	libavfilter/vf_vflip.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-10-29 11:58:11 +01:00
Anton Khirnov
cd43ca0443 lavfi: do not export the filters from shared objects 2013-10-28 15:29:54 +01:00
Robert Krüger
83922cccb2 avfilter/vf_scale: Correct vf_scale mappings from arguments to color range
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-10-23 15:44:31 +02:00
Michael Niedermayer
3ee796760a avfilter/vf_scale: dont duplicate default.
use the defaults set by swscale

Suggested-by: stefano
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-10-06 12:39:47 +02:00
Michael Niedermayer
931a4b433d avfilter/vf_scale: change the default scaler to bicubic
See: [FFmpeg-devel] [PATCH] swscale/options: switch default to bicubic
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-10-06 11:00:48 +02:00
Paul B Mahol
59d72f8b16 lavfi/pad,crop,scale: remove options description from filter description
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2013-09-21 12:50:02 +00:00
Paul B Mahol
b211607b5c avfilter: various cosmetics
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2013-09-12 14:01:43 +00:00
Michael Niedermayer
ec0e0eb4c1 avfilter/vf_scale+aresample: minor simpification
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-08-16 04:26:59 +02:00