summaryrefslogtreecommitdiff
path: root/libavfilter/vf_scale.c
Commit message (Collapse)AuthorAge
* lavfi: regroup formats lists in a single structure.Nicolas George2020-09-08
| | | | | | | | | | | | | | | It will allow to refernce it as a whole without clunky macros. Most of the changes have been automatically made with sed: sed -i ' s/-> *in_formats/->incfg.formats/g; s/-> *out_formats/->outcfg.formats/g; s/-> *in_channel_layouts/->incfg.channel_layouts/g; s/-> *out_channel_layouts/->outcfg.channel_layouts/g; s/-> *in_samplerates/->incfg.samplerates/g; s/-> *out_samplerates/->outcfg.samplerates/g; ' src/libavfilter/*(.)
* avfilter: add D2TS, TS2D, TS2T as a common macro in internal.hLimin Wang2020-06-19
| | | | Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
* vf_scale: switch to child_class_iterate()Anton Khirnov2020-06-10
|
* avfilter/scale: don't fail for circular expressionsGyan Doshi2020-01-26
| | | | | Due to conditional expressions, it is possible for them to be resolved successfully. A warning is still printed.
* avfilter/scale: add animation supportGyan Doshi2020-01-15
| | | | | Width and height expressions in scale and scale2ref filters can now reference frame index, timestamp and packet position.
* avfilter/scale: add function to check expressionsGyan Doshi2020-01-15
| | | | | | Allows finer identification and logging of invalid expressions and use of a single list for symbols and their index for both scale and scale2ref.
* avfilter/scale: separate exprs parse and evalGyan Doshi2020-01-15
| | | | | Retains parsed expressions which allows for better error-checking and adding animation support.
* avfilter/scale2ref: update links and re-eval expr upon ref frame changeGyan Doshi2020-01-15
| | | | Needed when filtergraph reinit is disabled for the ref input.
* avfilter/scale: store frame change evalGyan Doshi2020-01-15
| | | | Better readability and allows reuse
* lavfi/scale: enable runtime change flagJun Zhao2020-01-13
| | | | | | enable runtime change flag. Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
* avfilter: rename scale.c,h to scale_evalGyan Doshi2019-12-10
| | | | scale.c is too generic; scale_eval is more representative
* avfilter/scale.c: factorize ff_scale_eval_dimensionsGyan Doshi2019-12-08
| | | | | | | Adjustment of evaluated values shifted to ff_adjust_scale_dimensions Shifted code for force_original_aspect_ratio and force_divisble_by from vf_scale so it is now available for scale_cuda, scale_npp and scale_vaapi as well.
* avfilter/vf_scale: cosmeticsLimin Wang2019-09-27
| | | | | Signed-off-by: Limin Wang <lance.lmwang@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avfilter/vf_scale: split the scale_frame function from filter_frame for ↵Limin Wang2019-09-08
| | | | | | | activate function support Signed-off-by: Limin Wang <lance.lmwang@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* libavfilter/vf_scale: Ensure scaled video is divisible by nLars Kiesow2019-08-13
| | | | | | | | | | | | | | | | | | | | This patch adds a new option to the scale filter which ensures that the output resolution is divisible by the given integer when used together with `force_original_aspect_ratio`. This works similar to using `-n` in the `w` and `h` options. This option respects the value set for `force_original_aspect_ratio`, increasing or decreasing the resolution accordingly. The use case for this is to set a fixed target resolution using `w` and `h`, to use the `force_original_aspect_ratio` option to make sure that the video always fits in the defined bounding box regardless of aspect ratio, but to also make sure that the calculated output resolution is divisible by n so in can be encoded with certain encoders/options if that is required. Signed-off-by: Lars Kiesow <lkiesow@uos.de> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* lavfi/scale: Add sub-options for in_color_matrix/out_color_matrixJun Zhao2019-07-06
| | | | | | Add sub-options for in_color_matrix/out_color_matrix Signed-off-by: Jun Zhao <barryjzhao@tencent.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.
* avfilter/vf_scale: add more aliases for "range" optionsPaul B Mahol2017-12-08
| | | | Signed-off-by: Paul B Mahol <onemda@gmail.com>
* lavfi/scale2ref: Set output frame rate to main input frame rate.Carl Eugen Hoyos2017-11-08
| | | | Fixes ticket #6817.
* libavfilter/scale2ref: Maintain main input's DARKevin Mark2017-07-04
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* avfilter: do not use AVFrame accessorMuhammad Faiz2017-04-23
| | | | | Reviewed-by: wm4 <nfxjfg@googlemail.com> Signed-off-by: Muhammad Faiz <mfcc64@gmail.com>
* avfilter/vf_scale: Fix chroma positioning for 4:2:0 pixel formatMaksym Veremeyenko2017-02-07
| | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avfilter/scale: refactor common code for scaling height/width expressionsAman Gupta2017-02-02
| | | | | | | 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>
* vf_scale: support bt2020 in in/out_color_matrix properties.Ronald S. Bultje2016-04-17
|
* vf_scale: Detecting changes of incoming frame properties and dinamically ↵Bela Bodecs2016-01-20
| | | | | | | | | | | | | | | | | | | | | | | | 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>
* avfilter/vf_scale: set proper out frame color rangeThomas Mundt2015-12-31
| | | | | | | | 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>
* lavfi/scale: add nb_slices debug optionClément Bœsch2015-12-21
|
* avfilter: use AV_OPT_TYPE_BOOL in a bunch of placesClément Bœsch2015-12-04
|
* 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>
* vf_scale: conditionally override chroma positionChristophe Gisquet2015-09-23
| | | | | | | | | | 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>
* lavfi/scale: Pass src_range and dst_range to libswscale.Carl Eugen Hoyos2015-09-01
| | | | Fixes ticket #4812.
* Merge commit 'b1abd2aaf91be249f24cb74db9c205d9e4ca9da6'Hendrik Leppkes2015-08-31
|\ | | | | | | | | | | | | * commit 'b1abd2aaf91be249f24cb74db9c205d9e4ca9da6': vf_scale: Add an option to pass the scaler params Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
| * vf_scale: Add an option to pass the scaler paramsLuca Barbato2015-08-26
| | | | | | | | Reported-By: zehan@magicpony.technology
| * Revert "lavfi: always check av_expr_parse_and_eval() return value"Anton Khirnov2015-05-05
| | | | | | | | | | | | | | This reverts commit 63be97ec403023fb664798432acedaf6e6922527. All those calls were unchecked on purpose, as explained in the comments in the code.
| * lavfi: always check av_expr_parse_and_eval() return valueVittorio Giovara2014-12-18
| | | | | | | | | | CC: libav-stable@libav.org Bug-Id: CID 703624
* | avfilter/vf_scale: If no output color matrix is specified, use the inputMichael Niedermayer2015-08-31
| | | | | | | | | | | | This should only affect yuv->yuv, and not change behavior Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avfilter/vf_scale: Do not skip scale if the color matrix mismatchesMichael Niedermayer2015-08-31
| | | | | | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avfilter/vf_scale: Do not skip scale if range mismatchesCarl Eugen Hoyos2015-08-31
| | | | | | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | scale2ref: override request_frame() and correctly connect them to the ↵Michael Niedermayer2015-08-18
| | | | | | | | | | | | corresponding inputs Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avfilter/vf_scale: Set scale2ref ref output timebaseMichael Niedermayer2015-08-18
| | | | | | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avfilter: add scale2ref filterMichael Niedermayer2015-08-17
| | | | | | | | | | | | | | 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>
* | avfilter/vf_scale: apply generic options after flags.Michael Niedermayer2015-08-08
| | | | | | | | | | | | Otherwise the flags overwrite anything set by the generic stuff to the flags Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | libavfilter/vf_scale: implement process_commandBernd Bleßmann2015-07-21
| | | | | | | | | | Signed-off-by: Bernd Bleßmann <bb@it-entwicklung.de> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avfilter/vf_scale: Add warning for AVCOL_SPC_YCGCOMichael Niedermayer2015-04-13
| | | | | | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | vf_scale: Use correct chroma positions for YUV420PKieran Kunhya2014-12-25
| | | | | | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | avfilter/vf_scale: Allow chroma samples to be above and to the left of luma ↵Michael Niedermayer2014-09-21
| | | | | | | | | | | | | | samples Found-by: Kierank Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | avfilter/vf_scale: fix log message categoryMichael Niedermayer2014-07-28
| | | | | | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | Merge commit '862f33c10ea38ea49fa4188725df5e5246dbd1d8'Michael Niedermayer2014-05-27
|\| | | | | | | | | | | | | | | | | | | * commit '862f33c10ea38ea49fa4188725df5e5246dbd1d8': vf_scale: use the pixfmt descriptor API Conflicts: libavfilter/vf_scale.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
| * vf_scale: use the pixfmt descriptor APIAnton Khirnov2014-05-26
| | | | | | | | | | | | 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.
* | Merge commit '58400ac133bcfb6bf8196b4e5208bc178307739b'Michael Niedermayer2014-04-19
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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>