Commit Graph

6418 Commits

Author SHA1 Message Date
Mark Thompson d984b29b21 vf_hwmap: Add missing error code
Fixes CID 1412854.

(cherry picked from commit 5635c80bf5)
2017-06-18 17:05:13 +01:00
Paul B Mahol a23a56e77c libavfilter/af_biquads: add shorter option for width_type
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2017-06-18 17:31:03 +02:00
Paul B Mahol 9b667f609c avfilter/af_headphone: fix possible memory leaks on failure
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2017-06-15 11:19:12 +02:00
Mark Thompson d81be0a60a vf_hwmap: Add reverse mapping for hardware frames
This is something of a hack.  It allocates a new hwframe context for
the target format, then maps it back to the source link and overwrites
the input link hw_frames_ctx so that the previous filter will receive
the frames we want from ff_get_video_buffer().  It may fail if
the previous filter imposes any additional constraints on the frames
it wants to use as output.

(cherry picked from commit 81a4cb8e58)
2017-06-14 22:27:34 +01:00
Mark Thompson b2ef1f42ba vf_hwmap: Add device derivation
Also refactor a little and improve error messages to make failure
cases easier to understand.

(cherry picked from commit 38cb05f1c8)
2017-06-14 22:27:34 +01:00
Mark Thompson bff7bec1d7 vf_deinterlace_vaapi: Add support for field rate output
In order to work correctly with the i965 driver, this also fixes the
direction of forward/backward references - forward references are
intended to be those from the past to the current frame, not from the
current frame to the future.

(cherry picked from commit 9aa251c98c)
2017-06-14 22:26:32 +01:00
Timo Rothenpieler feb13aed79 avfilter/vf_signature: fix memory leaks in error cases
Fixes CIDs 1403234 and 1403235
2017-06-13 19:49:39 +02:00
Timo Rothenpieler 0fbc9bbbbb avfilter/vf_scale_npp: fix out-of-bounds reads
Fixes CIDs 1396414 and 1396415
2017-06-13 19:47:44 +02:00
Timo Rothenpieler 21583e936a avfilter/unsharp: fix uninitialized pointer read
Fixes CID 1396855
2017-06-13 19:47:19 +02:00
Paul B Mahol f85cad799b avfilter: properly set SAR for A->V filters
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2017-06-13 15:10:58 +02:00
Paul B Mahol d4d1fc823f avfilter: add native headphone spatialization filter
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2017-06-12 18:08:52 +02:00
Vittorio Giovara c12e8f5f0b vf_colorspace: Add a pixdesc API alias name for bt2020nc color space 2017-06-09 10:44:11 -04:00
Paul B Mahol 2336c76b22 avfilter/af_sofalizer: switch to libmysofa
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2017-06-08 22:02:26 +02: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
Paul B Mahol 67162554d4 avfilter/af_afftfilt: fix memory leaks
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2017-06-04 22:51:57 +02:00
Paul B Mahol fab1863917 avfilter/af_surround: add support for some upmixing of 3.0, 2.1 and 5.1 channel layout
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2017-06-04 16:37:47 +02:00
Kevin Mark 08213e0b79 libavfilter/scale2ref: Fix out-of-bounds array access
ff_scale_eval_dimensions blindly assumes that two inputs are always
available as of 3385989b98. This is
notably not the case when the function is called for the scale
filter. With the scale filter inputs[1] does not exist.

ff_scale_eval_dimensions now has an updated scale2ref check that
makes certain two inputs are actually available before attempting to
access the second one.

Thanks to James Almer for reporting this bug. This should fix the 820
Valgrind tests I single-handedly managed to break.

Signed-off-by: Kevin Mark <kmark937@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-06-03 23:14:04 +02:00
Kevin Mark 3385989b98 libavfilter/scale2ref: Add constants for the primary input
Variables pertaining to the main video are now available when
using the scale2ref filter. This allows, as an example, scaling a
video with another as a reference point while maintaining the
original aspect ratio of the primary/non-reference video.

Consider the following graph: scale2ref=iw/6:-1 [main][ref]
This will scale [main] to 1/6 the width of [ref] while maintaining
the aspect ratio. This works well when the AR of [ref] is equal to
the AR of [main] only. What the above filter really does is
maintain the AR of [ref] when scaling [main]. So in all non-same-AR
situations [main] will appear stretched or compressed to conform to
the same AR of the reference video. Without doing this calculation
externally there is no way to scale in reference to another input
while maintaining AR in libavfilter.

To make this possible, we introduce eight new constants to be used
in the w and h expressions only in the scale2ref filter:

 * main_w/main_h: width/height of the main input video
 * main_a: aspect ratio of the main input video
 * main_sar: sample aspect ratio of the main input video
 * main_dar: display aspect ratio of the main input video
 * main_hsub/main_vsub: horiz/vert chroma subsample vals of main
 * mdar: a shorthand alias of main_dar

Of course, not all of these constants are needed for maintaining the
AR, but adding additional constants in line of what is available for
in/out allows for other scaling possibilities I have not imagined.

So to now scale a video to 1/6 the size of another video using the
width and maintaining its own aspect ratio you can do this:

scale2ref=iw/6:ow/mdar [main][ref]

This is ideal for picture-in-picture configurations where you could
have a square or 4:3 video overlaid on a corner of a larger 16:9
feed all while keeping the scaled video in the corner at its correct
aspect ratio and always the same size relative to the larger video.

I've tried to re-use as much code as possible. I could not find a way
to avoid duplication of the var_names array. It must now be kept in
sync with the other (the normal one and the scale2ref one) for
everything to work which does not seem ideal. For every new variable
introduced/removed into/from the normal scale filter one must be
added/removed to/from the scale2ref version. Suggestions on how to
avoid var_names duplication are welcome.

var_values has been increased to always be large enough for the
additional scale2ref variables. I do not forsee this being a problem
as the names variable will always be the correct size. From my
understanding of av_expr_parse_and_eval it will stop processing
variables when it runs out of names even though there may be
additional (potentially uninitialized) entries in the values array.
The ideal solution here would be using a variable-length array but
that is unsupported in C90.

This patch does not remove any functionality and is strictly a
feature patch. There are no API changes. Behavior does not change for
any previously valid inputs.

The applicable documentation has also been updated.

Signed-off-by: Kevin Mark <kmark937@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-06-01 22:56:08 +02:00
Paul B Mahol dc72d1dde9 avfilter: add audio surround upmixer
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2017-06-01 21:25:36 +02:00
Vittorio Giovara 1f4454230d zscale: Add range options aliases to match scale ones
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2017-05-26 10:29:32 -04:00
Vittorio Giovara 6aafe56421 zscale: Add pixdesc-API compatible color names to filter options
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2017-05-26 10:28:50 -04:00
Hendrik Leppkes 9fb293cfd8 Use AVOnce as a static variable consistently
Using AVOnce as a stack variable makes no sense as the state is lost
when the function exits.

This fixes repeated calls to av(filter/device)_register_all
2017-05-22 12:36:32 +02:00
Paul B Mahol 49d0678181 avfilter/avf_showspectrum: properly initialize pts
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2017-05-22 11:06:48 +02:00
Muhammad Faiz fc3a03fcf9 avfilter: take_samples: do not directly return frame when samples are skipped
Modifying data pointer when skipping samples may make it unaligned.
Workaround for Ticket6349.

This should fix the crash of ticket's testcase and a crash/regression
with avxsynth (reported by Michael Niedermayer).

Also change frame->nb_samples < max to frame->nb_samples <= max.
This improves performance. Benchmark:
./ffmpeg -filter_complex "aevalsrc=0:n=1166,firequalizer=fixed=on" -f null null
old:
  25767 decicycles in take_samples,    1023 runs,      1 skips
  25422 decicycles in take_samples,    2047 runs,      1 skips
  25181 decicycles in take_samples,    4095 runs,      1 skips
  24904 decicycles in take_samples,    8191 runs,      1 skips

new:
    550 decicycles in take_samples,    1024 runs,      0 skips
    548 decicycles in take_samples,    2048 runs,      0 skips
    545 decicycles in take_samples,    4096 runs,      0 skips
    544 decicycles in take_samples,    8192 runs,      0 skips

Reviewed-by: Nicolas George <george@nsup.org>
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Muhammad Faiz <mfcc64@gmail.com>
2017-05-20 23:19:46 +07:00
Paul B Mahol e8ae23db27 avfilter/af_sidechaincompress: change default makeup gain to 1
This avoids producing out of range or clipped samples.

Signed-off-by: Paul B Mahol <onemda@gmail.com>
2017-05-20 12:43:11 +02:00
Muhammad Faiz 162414cefe avfilter/graphparser: allow specifying filter@id as filter instance
See http://lists.ffmpeg.org/pipermail/ffmpeg-user/2017-April/035975.html
Parsed_filter_X could remain and user can override it with custom one.

Example:
ffplay -f lavfi "nullsrc=s=640x360,
sendcmd='1 drawtext@top reinit text=Hello; 2 drawtext@bottom reinit text=World',
drawtext@top=x=16:y=16:fontsize=20:fontcolor=Red:text='',
drawtext@bottom=x=16:y=340:fontsize=16:fontcolor=Blue:text=''"

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Muhammad Faiz <mfcc64@gmail.com>
2017-05-19 20:21:47 +07:00
Paul B Mahol f5e5c53117 avfilter/af_sofalizer: make lfe gain user configurable
Default settings have it too low.

Signed-off-by: Paul B Mahol <onemda@gmail.com>
2017-05-18 23:13:52 +02:00
Paul B Mahol 79bf4d1450 avfilter/af_sofalizer: avoid casting
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2017-05-18 22:49:04 +02:00
Paul B Mahol 6111ac73d9 avfilter/af_afade: fix fading very long durations
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2017-05-17 22:59:11 +02:00
Paul B Mahol deaab31d61 avfilter: add audio crossfeed filter
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2017-05-17 20:18:39 +02:00
Paul B Mahol 5605108f4d avfilter/af_bs2b: add missing flag for options
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2017-05-16 19:16:50 +02:00
Paul B Mahol 4c55144ee9 avfilter/vf_deflicker: add bypass option
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2017-05-15 21:32:44 +02:00
Paul B Mahol 9bebad86c7 avfilter/af_stereotools: introduce different balance modes
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2017-05-15 19:58:15 +02:00
Paul B Mahol 13f4d077ed avfilter/af_compand: change default attack to 0
Fixes many distortions.

Signed-off-by: Paul B Mahol <onemda@gmail.com>
2017-05-15 14:29:18 +02:00
Paul B Mahol 7760ed7e96 avfilter/af_silenceremove: set output timestamps
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2017-05-15 14:29:18 +02:00
Yogender Gupta 921bd9a2be avfilter/scale_cuda: add CUDA scale filter
Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
2017-05-15 11:46:50 +02:00
Paul B Mahol 69b83f5992 avfilter/af_compand: fix default companding to avoid clipping
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2017-05-14 11:59:04 +02:00
Paul B Mahol ed93ed5ee3 avfilter: don't anonymously typedef structs
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2017-05-13 11:39:28 +02:00
Paul B Mahol 3d55e4883c avfilter/aeval: remove comment that was left from some other file
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2017-05-12 21:47:36 +02:00
Paul B Mahol c02921417b avfilter/aeval: free input frame on error
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2017-05-12 21:42:21 +02:00
Paul B Mahol e312ed0504 avfilter/af_astats: add RMS difference too
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2017-05-12 18:14:45 +02:00
Paul B Mahol 9cd62b2ca4 avfilter/vf_pad: revert part of 57c3670896
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2017-05-12 17:37:20 +02:00
Paul B Mahol eaf644e120 avfilter: add acopy filter
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2017-05-12 10:48:13 +02:00
Michael Niedermayer 942036e97c avfilter/vf_uspp: Fix currently unused input frame dimensions
Found-by: Nicolas
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-05-10 21:54:31 +02:00
Paul B Mahol bd404e3949 avfilter/af_afir: workaround nonsense limitation in vector_fmul_scalar()
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2017-05-10 20:10:02 +02:00
James Almer 984e2218f2 avfilter/af_afir: remove extra space in the header inclusion guards
Fixes fate-source.
2017-05-09 23:08:00 -03:00
Paul B Mahol 49bbfb9d13 avfilter: add arbitrary audio FIR filter
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2017-05-09 20:47:52 +02:00
Paul B Mahol 66be242626 avfilter/vf_histogram: actually add parade display mode
Rename previous parade mode to stack, what it really was from start.

Signed-off-by: Paul B Mahol <onemda@gmail.com>
2017-05-09 16:17:49 +02:00