ffmpeg.git
4 months agoavcodec/mv30: Do not allow MVs outside the allocated image
Michael Niedermayer [Wed, 20 May 2020 19:52:23 +0000 (21:52 +0200)]
avcodec/mv30: Do not allow MVs outside the allocated image

Fixes: out of array read
Fixes: 21804/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MV30_fuzzer-5673678898724864

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 months agoavcodec/wmalosslessdec: Fix integer overflow in mclms_predict()
Michael Niedermayer [Sat, 23 May 2020 20:02:56 +0000 (22:02 +0200)]
avcodec/wmalosslessdec: Fix integer overflow in mclms_predict()

Fixes: signed integer overflow: 2147483636 + 2048 cannot be represented in type 'int'
Fixes: 22016/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WMALOSSLESS_fuzzer-5109395618004992

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 months agoavcodec/vp9dsp_template: Fix integer overflow(s) in iadst16_1d()
Michael Niedermayer [Sat, 23 May 2020 22:24:40 +0000 (00:24 +0200)]
avcodec/vp9dsp_template: Fix integer overflow(s) in iadst16_1d()

Fixes: signed integer overflow: 1080285923 - -1130879337 cannot be represented in type 'int'
Fixes: 22002/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VP9_fuzzer-6260237310099456

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 months agoavcodec/wavpack: Do not allow the sample format to change between channels
Michael Niedermayer [Wed, 3 Jun 2020 19:13:47 +0000 (21:13 +0200)]
avcodec/wavpack: Do not allow the sample format to change between channels

Fixes: out of array access
Fixes: 22692/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WAVPACK_fuzzer-5678686190960640

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: David Bryant <david@wavpack.com>
Tested-by: David Bryant <david@wavpack.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 months agoavcodec/bitpacked: add missing comma to codec tags
Michael Niedermayer [Wed, 3 Jun 2020 17:17:34 +0000 (19:17 +0200)]
avcodec/bitpacked: add missing comma to codec tags

Fixes: array end overread
Fixes: 22395/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_BITPACKED_fuzzer-5760940300828672

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: James Darnley <james.darnley@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 months agoavformat/utils: Find a fallback probe decoder that will also match a forced decoder...
Samuel Foss [Wed, 3 Jun 2020 11:15:28 +0000 (07:15 -0400)]
avformat/utils: Find a fallback probe decoder that will also match a forced decoder's codec.

Prevent codecpar->codec_id from getting out of sync with the codec instantiated for probing.

Signed-off-by: Samuel Foss <sfoss@google.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 months agoavcodec/nvenc: honor max bitrate in CQ mode
Roman Arzumanyan [Wed, 3 Jun 2020 13:12:12 +0000 (16:12 +0300)]
avcodec/nvenc: honor max bitrate in CQ mode

Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
4 months agohwcontext_vulkan: fix make checkheaders fail
Jun Zhao [Sat, 30 May 2020 12:41:31 +0000 (20:41 +0800)]
hwcontext_vulkan: fix make checkheaders fail

make checkheaders will get error as follow:
CC libavutil/hwcontext_vulkan.h.o
In file included from libavutil/hwcontext_vulkan.h.c:1:
./libavutil/hwcontext_vulkan.h:130:23: error: ‘AV_NUM_DATA_POINTERS’ undeclared here (not in a function)
  130 |     void *alloc_pnext[AV_NUM_DATA_POINTERS];
      |                       ^~~~~~~~~~~~~~~~~~~~
./libavutil/hwcontext_vulkan.h:199:43: warning: ‘enum AVPixelFormat’ declared inside parameter list will not be visible outside of this definition or declaration

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
4 months agoavcodec/decode: actually propagate AVHWAccel.alloc_frame() return value
James Almer [Fri, 29 May 2020 18:07:41 +0000 (15:07 -0300)]
avcodec/decode: actually propagate AVHWAccel.alloc_frame() return value

Finishes fixing the regression introduced in a1133db30ef07896afd96f067e5c51531a4e85ab
after the partial fix in b6d6597bef66531ec07c07a7125b88aee38fb220.

Signed-off-by: James Almer <jamrial@gmail.com>
4 months agofate/vcodec: use the encoder private option for frame skip compare function
James Almer [Wed, 27 May 2020 14:00:54 +0000 (11:00 -0300)]
fate/vcodec: use the encoder private option for frame skip compare function

Stop using the deprecated global option

Signed-off-by: James Almer <jamrial@gmail.com>
4 months agolavf/tee: pass options to protocol.
Nicolas George [Tue, 2 Jun 2020 18:55:30 +0000 (20:55 +0200)]
lavf/tee: pass options to protocol.

Fix trac ticket #8705.

4 months agodnn/native: fix typo for definition of DOT_INTERMEDIATE
Wu Zhiwen [Mon, 1 Jun 2020 01:00:45 +0000 (09:00 +0800)]
dnn/native: fix typo for definition of DOT_INTERMEDIATE

Signed-off-by: Wu Zhiwen <zhiwen.wu@intel.com>
Reviewed-by: Guo Yejun <yejun.guo@intel.com>
4 months agoavcodec/ratecontrol: fix the integer overflow after long time run
Limin Wang [Sat, 30 May 2020 14:28:22 +0000 (22:28 +0800)]
avcodec/ratecontrol: fix the integer overflow after long time run

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
4 months agoavcodec/internal: move packet related functions to their own header
James Almer [Tue, 2 Jun 2020 21:38:33 +0000 (18:38 -0300)]
avcodec/internal: move packet related functions to their own header

Signed-off-by: James Almer <jamrial@gmail.com>
4 months agoavformat/prompeg: av_dict_set() -> av_dict_set_int()
Limin Wang [Mon, 25 May 2020 12:19:28 +0000 (20:19 +0800)]
avformat/prompeg: av_dict_set() -> av_dict_set_int()

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
4 months agoavformat/rtpproto: av_dict_set() -> av_dict_set_int()
Limin Wang [Mon, 25 May 2020 12:19:09 +0000 (20:19 +0800)]
avformat/rtpproto: av_dict_set() -> av_dict_set_int()

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
4 months agoavformat/rtspdec: av_dict_set() -> av_dict_set_int()
Limin Wang [Mon, 25 May 2020 12:18:49 +0000 (20:18 +0800)]
avformat/rtspdec: av_dict_set() -> av_dict_set_int()

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
4 months agocompat/cuda/ptx2c: remove shell loop; fix BSD sed compat
rcombs [Thu, 22 Aug 2019 05:40:47 +0000 (00:40 -0500)]
compat/cuda/ptx2c: remove shell loop; fix BSD sed compat

This fixes building on macOS, and improves build times dramatically there

4 months agoavcodec/h264dec: Disable forced small_padding on flag2 fast
Michael Niedermayer [Thu, 28 May 2020 12:33:58 +0000 (14:33 +0200)]
avcodec/h264dec: Disable forced small_padding on flag2 fast

Fixes: 20978/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_H264_fuzzer-5746381832847360

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 months agoavcodec/jpeg2000dec: clear pointer which become stale in get_ppt()
Michael Niedermayer [Sun, 31 May 2020 10:49:50 +0000 (12:49 +0200)]
avcodec/jpeg2000dec: clear pointer which become stale in get_ppt()

Fixes: use after free
Fixes: 22484/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_JPEG2000_fuzzer-5671488765296640

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Gautam Ramakrishnan <gautamramk@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 months agofate: add adpcm_ima_ssi encoding test
Zane van Iperen [Sun, 31 May 2020 05:24:11 +0000 (05:24 +0000)]
fate: add adpcm_ima_ssi encoding test

Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 months agofftools/ffmpeg: update text requesting samples
Andriy Gelman [Sun, 10 May 2020 19:01:35 +0000 (15:01 -0400)]
fftools/ffmpeg: update text requesting samples

Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
Reviewed-by: Marton Balint <cus@passwd.hu>
4 months agoavcodec/nvenc: zero avg and max bitrate in CQ mode
Roman Arzumanyan [Mon, 20 Apr 2020 10:53:36 +0000 (13:53 +0300)]
avcodec/nvenc: zero avg and max bitrate in CQ mode

Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
4 months agocheckasm: sw_rgb: Fix mixed declaration and code
Jun Zhao [Sat, 30 May 2020 12:33:53 +0000 (20:33 +0800)]
checkasm: sw_rgb: Fix mixed declaration and code

Fix mixed declaration and code.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
4 months agoavformat/dashenc: use AVStream timebase when computing missing bitrate
Przemysław Sobala [Wed, 27 May 2020 15:07:22 +0000 (17:07 +0200)]
avformat/dashenc: use AVStream timebase when computing missing bitrate

4 months agoavfilter/vf_lut3d: Fix mixed declaration and code
Andreas Rheinhardt [Mon, 1 Jun 2020 11:15:21 +0000 (13:15 +0200)]
avfilter/vf_lut3d: Fix mixed declaration and code

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
5 months agoavcodec/encode: Remove ff_alloc_packet
Andreas Rheinhardt [Mon, 1 Jun 2020 09:44:00 +0000 (11:44 +0200)]
avcodec/encode: Remove ff_alloc_packet

It is no longer used anymore.

Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
5 months agoavcodec/mpeg12enc: support mpeg2 encoder const profile
Limin Wang [Sat, 30 May 2020 13:25:32 +0000 (21:25 +0800)]
avcodec/mpeg12enc: support mpeg2 encoder const profile

Reviewed-by: Marton Balint <cus@passwd.hu>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
5 months agoavformat/mpegtsenc: set stream_id correctly based on KLV profile selected
Brad Hards [Wed, 27 May 2020 10:02:00 +0000 (20:02 +1000)]
avformat/mpegtsenc: set stream_id correctly based on KLV profile selected

Previously we always set STREAM_TYPE_PRIVATE_DATA, and that remains
the default value.

Signed-off-by: Marton Balint <cus@passwd.hu>
5 months agoavcodec: add constants for KLV pseudo-profile.
Brad Hards [Wed, 27 May 2020 10:01:59 +0000 (20:01 +1000)]
avcodec: add constants for KLV pseudo-profile.

There are two different ways KLV is used in MISB specs - sync and async.
The corresponding text (in ST1401) says:

ISO/IEC 13818-1 Table-34 defines a stream_type = 0x15 for “Metadata carried in PES packets,”
and Table 2-22 defines a stream_id = 0xFC for “metadata stream.”

and

In ISO/IEC 13818-1, Table-34 defines a stream_type = 0x06 for “PES packets containing private
data,” and Table 2-22 defines a stream_id = 0xBD for “private_stream_1.”

These constants allow us to distinguish the two cases, as codec profiles.

Signed-off-by: Marton Balint <cus@passwd.hu>
5 months agoavcodec/anm: Don't unnecessarily use context variables
Andreas Rheinhardt [Sat, 30 May 2020 04:14:12 +0000 (06:14 +0200)]
avcodec/anm: Don't unnecessarily use context variables

Reviewed-by: Peter Ross <pross@xvid.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
5 months agoavcodec/anm: Check extradata length before allocating frame
Andreas Rheinhardt [Sat, 30 May 2020 03:25:06 +0000 (05:25 +0200)]
avcodec/anm: Check extradata length before allocating frame

Then one doesn't need to free the frame in case the length turns out to
be insufficient.

Reviewed-by: Peter Ross <pross@xvid.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
5 months agoavformat: add kvag muxer
Zane van Iperen [Fri, 29 May 2020 10:54:59 +0000 (10:54 +0000)]
avformat: add kvag muxer

Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
5 months agoavfilter/vf_lut3d: prelut support for 3d cinespace luts
Mark Reid [Sun, 24 May 2020 02:04:51 +0000 (19:04 -0700)]
avfilter/vf_lut3d: prelut support for 3d cinespace luts

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
5 months agoavformat/oggparsetheora: Don't update start time when lastpts is AV_NOPTS_VALUE.
Dale Curtis [Fri, 15 May 2020 19:37:02 +0000 (12:37 -0700)]
avformat/oggparsetheora: Don't update start time when lastpts is AV_NOPTS_VALUE.

Signed-off-by: Dale Curtis <dalecurtis@chromium.org>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
5 months agoavfilter/af_aiir: simplify polynomial evaluation
Paul B Mahol [Sat, 30 May 2020 15:55:32 +0000 (17:55 +0200)]
avfilter/af_aiir: simplify polynomial evaluation

5 months agoavfilter/af_aiir: use correct size when allocating in zp2tf
Paul B Mahol [Sat, 30 May 2020 08:55:28 +0000 (10:55 +0200)]
avfilter/af_aiir: use correct size when allocating in zp2tf

5 months agoavfilter: add dblur video filter
Paul B Mahol [Wed, 27 May 2020 10:03:02 +0000 (12:03 +0200)]
avfilter: add dblur video filter

5 months agoavcodec: add PFM image decoder
Paul B Mahol [Wed, 27 May 2020 14:42:24 +0000 (16:42 +0200)]
avcodec: add PFM image decoder

5 months agolavf/utils: fix start_time/duration dump if it is AV_NOPTS_VALUE
Jun Zhao [Tue, 26 May 2020 16:37:21 +0000 (00:37 +0800)]
lavf/utils: fix start_time/duration dump if it is AV_NOPTS_VALUE

e,g: the command:
ffprobe -show_format -i fate-suite/aac/foo.aac -loglevel 99 will
dump the trace message as follow when start_time is AV_NOPTS_VALUE
[aac @ 0x55bf8e1f3dc0] stream 0: start_time: -326791809695.818 duration: 2.174
[aac @ 0x55bf8e1f3dc0] format: start_time: -9223372036854.775 duration: 2.174 bitrate=120 kb/s

after this fix, will dump the start_time with "NOPTS".

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
5 months agolavfi/aiir: Refine the pad/vpad related operation
Jun Zhao [Mon, 25 May 2020 08:10:29 +0000 (16:10 +0800)]
lavfi/aiir: Refine the pad/vpad related operation

move the pad/vpad related operation with more natural
coding style.

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
5 months agolavfi/afir: fix vpad.name leak
Jun Zhao [Mon, 25 May 2020 00:48:12 +0000 (08:48 +0800)]
lavfi/afir: fix vpad.name leak

Fix vpad.name leak in error path, move the vpad related operation
only if enabled show IR frequency response.

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
5 months agoavutil/attributes: Fix too many warning: false is not defined [-Wundef]
Limin Wang [Fri, 29 May 2020 11:14:18 +0000 (19:14 +0800)]
avutil/attributes: Fix too many warning: false is not defined [-Wundef]

Reviewed-by: James Almer <jamrial@gmail.com>
Reviewed-by: Hendrik Leppkes <h.leppkes@gmail.com>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
5 months agoRevert "avfilter/af_aiir: move response drawing as last step"
Paul B Mahol [Sat, 30 May 2020 07:50:59 +0000 (09:50 +0200)]
Revert "avfilter/af_aiir: move response drawing as last step"

This reverts commit ca7095a9072fab4cdb41af12da9d94752e082e34.

5 months agoavfilter/af_aiir: improve response calculation with zp coefficients
Paul B Mahol [Sat, 30 May 2020 07:47:12 +0000 (09:47 +0200)]
avfilter/af_aiir: improve response calculation with zp coefficients

5 months agoavfilter/af_aiir: add S-plane support
Paul B Mahol [Fri, 29 May 2020 20:05:01 +0000 (22:05 +0200)]
avfilter/af_aiir: add S-plane support

5 months agoavfilter/af_aiir: make it clear that transfer function is digital one
Paul B Mahol [Fri, 29 May 2020 18:44:41 +0000 (20:44 +0200)]
avfilter/af_aiir: make it clear that transfer function is digital one

5 months agoavfilter/af_biquads: implement 1st order allpass
Paul B Mahol [Sat, 23 May 2020 15:54:54 +0000 (17:54 +0200)]
avfilter/af_biquads: implement 1st order allpass

5 months agoavformat/utils: Use av_sat_add64() when updating start_time by skip_samples.
Dale Curtis [Thu, 14 May 2020 21:29:15 +0000 (14:29 -0700)]
avformat/utils: Use av_sat_add64() when updating start_time by skip_samples.

Avoids overflow from fuzzed skip_samples values.

Signed-off-by: Dale Curtis <dalecurtis@chromium.org>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
5 months agoUse av_sat_sub64() when updating pts by duration.
Dale Curtis [Thu, 14 May 2020 21:33:55 +0000 (14:33 -0700)]
Use av_sat_sub64() when updating pts by duration.

Signed-off-by: Dale Curtis <dalecurtis@chromium.org>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
5 months agoavcodec/adpcm_data: extend ff_adpcm_ima_cunning_index_table
Michael Niedermayer [Wed, 27 May 2020 22:05:16 +0000 (00:05 +0200)]
avcodec/adpcm_data: extend ff_adpcm_ima_cunning_index_table

Fixes: overread by 1
Fixes: 21880/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ADPCM_IMA_CUNNING_fuzzer-5717917221257216.fuzz

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
5 months agolavfi/vulkan: use av_get_random_seed instead of rand
Lynne [Fri, 29 May 2020 12:10:58 +0000 (13:10 +0100)]
lavfi/vulkan: use av_get_random_seed instead of rand

We need at least a few bits of entropy to determine the start index of each
queue, in order to let filters run in parallel as much as possible, and
rand() is not thread safe and disrupts any external API's usage of rand,
so instead replace it with av_get_random_seed.
While it has more overhead than rand, we only run it once per filter upon init.

5 months agoavformat/oggdec: Avoid duplicating buffer when adding side-data
Andreas Rheinhardt [Sat, 23 May 2020 11:06:04 +0000 (13:06 +0200)]
avformat/oggdec: Avoid duplicating buffer when adding side-data

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
5 months agoavformat/img2dec: Avoid duplicating buffer when adding side-data
Andreas Rheinhardt [Sat, 23 May 2020 11:02:54 +0000 (13:02 +0200)]
avformat/img2dec: Avoid duplicating buffer when adding side-data

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
5 months agoavformat/concatdec: Avoid duplicating buffer when adding side-data
Andreas Rheinhardt [Sat, 23 May 2020 10:57:29 +0000 (12:57 +0200)]
avformat/concatdec: Avoid duplicating buffer when adding side-data

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
5 months agoavformat/flvdec: Avoid duplicating extradata when adding side-data
Andreas Rheinhardt [Sat, 23 May 2020 10:52:17 +0000 (12:52 +0200)]
avformat/flvdec: Avoid duplicating extradata when adding side-data

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
5 months agoavformat/hlsenc, hlsplaylist: Cosmetics
Andreas Rheinhardt [Mon, 25 May 2020 18:33:40 +0000 (20:33 +0200)]
avformat/hlsenc, hlsplaylist: Cosmetics

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
5 months agoavformat/hlsenc: Avoid duplicating strings when parsing
Andreas Rheinhardt [Mon, 25 May 2020 17:22:19 +0000 (19:22 +0200)]
avformat/hlsenc: Avoid duplicating strings when parsing

Up until now, the HLS muxer uses av_strtok() to split an input string
controlling parameters of the VariantStreams and then duplicates
parts of this string containing parameters such as the language or the
name of the VariantStream. But these parts are proper zero-terminated
strings of their own that are never modified lateron, so one can simply
use the substring as-is without creating a copy. This commit implements
this.

The same also happened for the string controlling the closed caption
groups.

Furthermore, add const to indicate that the pointers to these substrings
are not used to modify them and also to indicate that these strings are
not allocated on their own.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
5 months agoavformat/hlsenc: Don't unnecessarily duplicate baseurl string
Andreas Rheinhardt [Mon, 25 May 2020 16:52:57 +0000 (18:52 +0200)]
avformat/hlsenc: Don't unnecessarily duplicate baseurl string

Up until now, the HLS muxer duplicated a string for every VariantStream,
although neither the original nor the copies are ever modified. So use
the original directly and stop copying.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
5 months agoavformat/hlsplaylist: Add const where appropriate
Andreas Rheinhardt [Mon, 25 May 2020 17:11:34 +0000 (19:11 +0200)]
avformat/hlsplaylist: Add const where appropriate

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
5 months agolavf/mpegtsenc: misc style fixes
Jun Zhao [Tue, 26 May 2020 16:49:50 +0000 (00:49 +0800)]
lavf/mpegtsenc: misc style fixes

commit 32aeba12755 missed coding style fix.

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
5 months agolavc/libx264: misc style fixes
Jun Zhao [Tue, 26 May 2020 16:42:12 +0000 (00:42 +0800)]
lavc/libx264: misc style fixes

commit 4ed3a01d717 missed coding style fix.

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
5 months agodoc: add dia_size option documentation
Limin Wang [Wed, 27 May 2020 04:18:52 +0000 (12:18 +0800)]
doc: add dia_size option documentation

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
5 months agodnn-layer-mathunary-test: add unit test for abs
Ting Fu [Mon, 25 May 2020 14:46:27 +0000 (22:46 +0800)]
dnn-layer-mathunary-test: add unit test for abs

Signed-off-by: Ting Fu <ting.fu@intel.com>
Signed-off-by: Guo, Yejun <yejun.guo@intel.com>
5 months agodnn_backend_native_layer_mathunary: add abs support
Ting Fu [Mon, 25 May 2020 14:46:26 +0000 (22:46 +0800)]
dnn_backend_native_layer_mathunary: add abs support

more math unary operations will be added here

It can be tested with the model file generated with below python scripy:

import tensorflow as tf
import numpy as np
import imageio

in_img = imageio.imread('input.jpeg')
in_img = in_img.astype(np.float32)/255.0
in_data = in_img[np.newaxis, :]

x = tf.placeholder(tf.float32, shape=[1, None, None, 3], name='dnn_in')
x1 = tf.subtract(x, 0.5)
x2 = tf.abs(x1)
y = tf.identity(x2, name='dnn_out')

sess=tf.Session()
sess.run(tf.global_variables_initializer())

graph_def = tf.graph_util.convert_variables_to_constants(sess, sess.graph_def, ['dnn_out'])
tf.train.write_graph(graph_def, '.', 'image_process.pb', as_text=False)

print("image_process.pb generated, please use \
path_to_ffmpeg/tools/python/convert.py to generate image_process.model\n")

output = sess.run(y, feed_dict={x: in_data})
imageio.imsave("out.jpg", np.squeeze(output))

Signed-off-by: Ting Fu <ting.fu@intel.com>
Signed-off-by: Guo, Yejun <yejun.guo@intel.com>
5 months agoavcodec/decode: fix decoding when frames are allocated using AVHWAccel.alloc_frame()
James Almer [Thu, 28 May 2020 02:10:04 +0000 (23:10 -0300)]
avcodec/decode: fix decoding when frames are allocated using AVHWAccel.alloc_frame()

Regression since a1133db30ef07896afd96f067e5c51531a4e85ab

Found-by: comex <comexk@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
5 months agotools/target_dec_fuzzer: Adjust max_pixels for AV_CODEC_ID_HAP
Michael Niedermayer [Sun, 15 Mar 2020 19:26:27 +0000 (20:26 +0100)]
tools/target_dec_fuzzer: Adjust max_pixels for AV_CODEC_ID_HAP

Fixes: Timeout (170sec -> 6sec)
Fixes: 20956/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HAP_fuzzer-5713643025203200

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
5 months agotools/target_dec_fuzzer: Reduce maxpixels for HEVC
Michael Niedermayer [Sun, 19 Apr 2020 21:54:08 +0000 (23:54 +0200)]
tools/target_dec_fuzzer: Reduce maxpixels for HEVC

high resolutions with only small blocks appear to be rather
slow with the fuzzer + sanitizers.
A solution which makes this run faster is welcome.

Fixes: Timeout (did not wait -> 17sec)
Fixes: 21006/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HEVC_fuzzer-6002552539971584

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
5 months agotools/target_dec_fuzzer: Do not test AV_CODEC_FLAG2_FAST with AV_CODEC_ID_H264
Michael Niedermayer [Sun, 15 Mar 2020 16:59:49 +0000 (17:59 +0100)]
tools/target_dec_fuzzer: Do not test AV_CODEC_FLAG2_FAST with AV_CODEC_ID_H264

This combination skips allocating large padding which can read out of array

Fixes: 20978/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_H264_fuzzer-5746381832847360

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
5 months agoavformat/mpegts: use get_packet_size in mpegts_resync for determining raw_packet_size
Marton Balint [Wed, 20 May 2020 19:44:39 +0000 (21:44 +0200)]
avformat/mpegts: use get_packet_size in mpegts_resync for determining raw_packet_size

The old resync logic had some bugs, for example the packet size could stuck
into 192 bytes, because pos47_full was not updated for every packet, and for
unseekable inputs the resync logic simply skipped some 0x47 sync bytes,
therefore the calculated distance between sync bytes was a multiple of 188
bytes.

AVIO only buffers a single packet (for UDP/mpegts, that usually means 1316
bytes), so for every ten consecutive 188-byte MPEGTS packets there was always a
seek failure, and that caused the old code to not find the 188 byte pattern
across 10 consecutive packets.

This patch changes the custom logic to the one which is used when probing to
determine the packet size. This was already proposed as a FIXME a long time
ago...

5 months agoavcodec/adpcmenc: fix formatting
Zane van Iperen [Sat, 16 May 2020 11:53:40 +0000 (11:53 +0000)]
avcodec/adpcmenc: fix formatting

Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
5 months agoavcodec: add adpcm_ima_ssi encoder
Zane van Iperen [Sat, 16 May 2020 11:53:36 +0000 (11:53 +0000)]
avcodec: add adpcm_ima_ssi encoder

Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
5 months agoavcodec/adpcmenc: add capabilities argument to ADPCM_ENCODER()
Zane van Iperen [Sat, 16 May 2020 11:53:32 +0000 (11:53 +0000)]
avcodec/adpcmenc: add capabilities argument to ADPCM_ENCODER()

Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
5 months agoUse gcc/clang builtins for av_sat_(add|sub)_64_c if available.
Dale Curtis [Fri, 1 May 2020 17:20:43 +0000 (10:20 -0700)]
Use gcc/clang builtins for av_sat_(add|sub)_64_c if available.

Signed-off-by: Dale Curtis <dalecurtis@chromium.org>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
5 months agoavformat: fix apm makefile dependency
Zane van Iperen [Tue, 26 May 2020 10:57:49 +0000 (10:57 +0000)]
avformat: fix apm makefile dependency

Uses ff_get_wav_header() in riffdec.c

Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
5 months agoavcodec/h264dec: Add FF_CODEC_CAP_INIT_CLEANUP
Limin Wang [Wed, 27 May 2020 04:35:28 +0000 (12:35 +0800)]
avcodec/h264dec: Add FF_CODEC_CAP_INIT_CLEANUP

then ff_h264_free_tables() and h264_decode_end() can be removed
in h264_decode_init() if it's failed.

The FF_CODEC_CAP_INIT_CLEANUP flag is need for single thread, For multithread,
it'll be cleanup still by AV_CODEC_CAP_FRAME_THREADS flag if have.

Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
5 months agoavcodec: Add FF_CODEC_CAP_INIT_CLEANUP
Limin Wang [Wed, 27 May 2020 03:45:49 +0000 (11:45 +0800)]
avcodec: Add FF_CODEC_CAP_INIT_CLEANUP

then ff_mpv_encode_end() will be unnecessary in ff_mpv_encode_init()
if it's failed.

The FF_CODEC_CAP_INIT_CLEANUP flag is need for single thread, For multithread,
it'll be cleanup still by AV_CODEC_CAP_FRAME_THREADS flag if have.

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
5 months agoavcodec/adpcmenc: Add FF_CODEC_CAP_INIT_CLEANUP
Limin Wang [Fri, 15 May 2020 15:25:59 +0000 (23:25 +0800)]
avcodec/adpcmenc: Add FF_CODEC_CAP_INIT_CLEANUP

then we can remove adpcm_encode_close() in adpcm_encode_init() if have failed.
so the goto error lable will be unnecessary and can be removed later.

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
5 months agoconfigure: NotchLC depends on lzf
Paul B Mahol [Wed, 27 May 2020 13:22:35 +0000 (15:22 +0200)]
configure: NotchLC depends on lzf

5 months agoavformat/mpegtsenc: cosmetic
Limin Wang [Wed, 20 May 2020 12:22:42 +0000 (20:22 +0800)]
avformat/mpegtsenc: cosmetic

Merge the short lines after the last commit

Reviewed-by: Marton Balint <cus@passwd.hu>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
5 months agoavformat/mpegtsenc: simplify code by using OFFSET() and ENC macros
Limin Wang [Wed, 20 May 2020 12:16:53 +0000 (20:16 +0800)]
avformat/mpegtsenc: simplify code by using OFFSET() and ENC macros

Reviewed-by: Marton Balint <cus@passwd.hu>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
5 months agoavcodec.h: move avcodec_get_{type,name} to codec_id.h
Anton Khirnov [Mon, 25 May 2020 13:06:14 +0000 (15:06 +0200)]
avcodec.h: move avcodec_get_{type,name} to codec_id.h

5 months agoavcodec.h: split AVCodec API into its own header
Anton Khirnov [Mon, 25 May 2020 13:04:20 +0000 (15:04 +0200)]
avcodec.h: split AVCodec API into its own header

5 months agodoc/APIchanges: fix typo in version number
Anton Khirnov [Fri, 22 May 2020 12:45:05 +0000 (14:45 +0200)]
doc/APIchanges: fix typo in version number

5 months agolavf/mp3dec: don't adjust start time; packets are not adjusted.
Dale Curtis [Thu, 23 Apr 2020 23:18:18 +0000 (16:18 -0700)]
lavf/mp3dec: don't adjust start time; packets are not adjusted.

7546ac2fee4 made it so that the start_time for mp3 files is
adjusted for skip_samples. However, this appears incorrect because
subsequent packet timestamps are not adjusted and skip_samples are
applied by deleting data from a packet without changing the timestamp.

E.g., we are told the start_time is ~25ms and we get a packet with a
timestamp of 0 that has had the skip_samples discarded from it. As such
rendering engines may incorrectly discard everything prior to the
25ms thinking that is where playback should officially start. Since the
samples were deleted without adjusting timestamps though, the true
start_time is still 0.

Other formats like MP4 with edit lists will adjust both the start
time and the timestamps of subsequent packets to avoid this issue.

Signed-off-by: Dale Curtis <dalecurtis@chromium.org>
Signed-off-by: Anton Khirnov <anton@khirnov.net>
5 months agolavc/vaapi_hevc: add missing max_8bit_constraint_flag
Linjie Fu [Tue, 12 May 2020 13:46:40 +0000 (21:46 +0800)]
lavc/vaapi_hevc: add missing max_8bit_constraint_flag

This is accidentally missed while rebasing.

Signed-off-by: Linjie Fu <linjie.fu@intel.com>
5 months agolavc/hevc_refs: Fix the logic of find_ref_idx()
Xu Guangxin [Tue, 12 May 2020 13:44:21 +0000 (21:44 +0800)]
lavc/hevc_refs: Fix the logic of find_ref_idx()

Currently find_ref_idx() would trigger 2 scans in DPB to find the
requested POC:
1. Firstly, ignore MSB of ref->poc and search for the requested POC;
2. Secondly, compare the entire ref->poc with requested POC;

For long term reference, we are able to only check LSB if MSB is not
presented(e.g. delta_poc_msb_present_flag == 0). However, for short
term reference, we should never ignore poc's MSB and it should be
kind of bit-exact. (Details in 8.3.2)

Otherwise this leads to decoding failures like:
[hevc @ 0x5638f4328600] Error constructing the frame RPS.
[hevc @ 0x5638f4328600] Error parsing NAL unit #2.
[hevc @ 0x5638f4338a80] Could not find ref with POC 21
Error while decoding stream #0:0: Invalid data found when processing input

Search the requested POC based on whether MSB is used, and avoid
the 2-times scan for DPB buffer. This benefits both native HEVC
decoder and integrated HW decoders.

Signed-off-by: Xu Guangxin <guangxin.xu@intel.com>
Signed-off-by: Linjie Fu <linjie.fu@intel.com>
5 months agolavc/hevc: Add poc_msb_present filed in LongTermRPS
Xu Guangxin [Tue, 12 May 2020 13:42:49 +0000 (21:42 +0800)]
lavc/hevc: Add poc_msb_present filed in LongTermRPS

delta_poc_msb_present_flag is needed in find_ref_idx() to
indicate whether MSB of POC should be taken into account.

Details in 8.3.2.

Signed-off-by: Xu Guangxin <guangxin.xu@intel.com>
Signed-off-by: Linjie Fu <linjie.fu@intel.com>
5 months agoavfilter/vf_blend: add support for float formats
Paul B Mahol [Tue, 26 May 2020 21:07:36 +0000 (23:07 +0200)]
avfilter/vf_blend: add support for float formats

5 months agomfenc: Avoid including codecapi.h, fix building in UWP mode with clang
Martin Storsjö [Mon, 25 May 2020 10:26:04 +0000 (13:26 +0300)]
mfenc: Avoid including codecapi.h, fix building in UWP mode with clang

Including codecapi.h and uuids.h in UWP mode doesn't define all defines
properly, ending up with constructs that MSVC silently tolerates, but
that clang errors out on, like this:
    DEFINE_GUIDEX(CODECAPI_AVEncCommonFormatConstraint);

Just avoid including codecapi.h completely and hardcode the last few
enum values we use from there. We already use local versions of most
enums from there, due to older mingw-w64 headers being incomplete.

Signed-off-by: Martin Storsjö <martin@martin.st>
5 months agomfenc: Remove an unused include
Martin Storsjö [Mon, 25 May 2020 10:18:03 +0000 (13:18 +0300)]
mfenc: Remove an unused include

This might have been used originally for the decoder parts of
the MediaFoundation wrapper, which aren't merged yet.

Signed-off-by: Martin Storsjö <martin@martin.st>
5 months agofftools/ffmpeg: add new abort_on flag which aborts if there is a stream which receive...
Marton Balint [Tue, 12 May 2020 22:06:08 +0000 (00:06 +0200)]
fftools/ffmpeg: add new abort_on flag which aborts if there is a stream which received no packets

Signed-off-by: Marton Balint <cus@passwd.hu>
5 months agohwcontext_vulkan: fix uploading and downloading from/to flipped images
Lynne [Tue, 26 May 2020 11:01:54 +0000 (12:01 +0100)]
hwcontext_vulkan: fix uploading and downloading from/to flipped images

We want to copy the lowest amount of bytes per line, but while the buffer
stride is sanitized, the src/dst stride can be negative, and negative numbers
of bytes do not make a lot of sense.

5 months agoopusenc: add apply_phase_inv option
Lynne [Mon, 25 May 2020 13:41:33 +0000 (14:41 +0100)]
opusenc: add apply_phase_inv option

By popular request.
Does the same as in libopusenc.

5 months agolavfi/vulkan: fix queue counts and set indices
Lynne [Mon, 25 May 2020 14:37:17 +0000 (15:37 +0100)]
lavfi/vulkan: fix queue counts and set indices

5 months agolavfi/vulkan: use dedicated allocation for buffers when necessary
Lynne [Mon, 25 May 2020 14:36:41 +0000 (15:36 +0100)]
lavfi/vulkan: use dedicated allocation for buffers when necessary

5 months agohwcontext_vulkan: check for dedicated allocation when mapping from drm/vaapi
Lynne [Mon, 25 May 2020 19:57:16 +0000 (20:57 +0100)]
hwcontext_vulkan: check for dedicated allocation when mapping from drm/vaapi

Some vendors (AMD) require dedicated allocation to be used for all imported
images.

5 months agohwcontext_vulkan: initialize the frames context when deriving
Lynne [Mon, 25 May 2020 19:56:00 +0000 (20:56 +0100)]
hwcontext_vulkan: initialize the frames context when deriving

Otherwise, the frames context is considered to be ready to handle
mapping, and it doesn't get initialized the normal way through
.frames_init.

5 months agohwcontext_vulkan: use dedicated allocation for buffers when necessary
Lynne [Tue, 26 May 2020 09:34:31 +0000 (10:34 +0100)]
hwcontext_vulkan: use dedicated allocation for buffers when necessary

5 months agohwcontext_vulkan: use host mapped buffers when uploading and downloading
Lynne [Sat, 23 May 2020 18:02:08 +0000 (19:02 +0100)]
hwcontext_vulkan: use host mapped buffers when uploading and downloading

Speeds up both use cases by 30%.