ffmpeg.git
3 months agoavcodec/pcm: Fix invalid shift in AV_CODEC_ID_PCM_LXF
Michael Niedermayer [Thu, 20 Feb 2020 21:26:18 +0000 (22:26 +0100)]
avcodec/pcm: Fix invalid shift in AV_CODEC_ID_PCM_LXF

Fixes: left shift of 233 by 24 places cannot be represented in type 'int'
Fixes: 20736/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_PCM_LXF_fuzzer-4829212685107200

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 months agoavcodec/cdtoons: Fix off by 4 check on diff_size
Michael Niedermayer [Thu, 20 Feb 2020 17:51:36 +0000 (18:51 +0100)]
avcodec/cdtoons: Fix off by 4 check on diff_size

Fixes: out of array read
Fixes: 20742/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_CDTOONS_fuzzer-5738148607033344

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 months agoavcodec/cdtoons: Correct several end of data checks in cdtoons_render_sprite()
Michael Niedermayer [Thu, 20 Feb 2020 17:49:56 +0000 (18:49 +0100)]
avcodec/cdtoons: Correct several end of data checks in cdtoons_render_sprite()

No testcases, found by code review when debuging issue found by oss-fuzz

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 months agoavcodec/adpcm: cosmetics; reindent
Paul B Mahol [Fri, 21 Feb 2020 13:44:44 +0000 (14:44 +0100)]
avcodec/adpcm: cosmetics; reindent

3 months agoavformat: add demuxer for Rayman 2's APM format
Zane van Iperen [Thu, 20 Feb 2020 11:31:51 +0000 (11:31 +0000)]
avformat: add demuxer for Rayman 2's APM format

Adds support for the APM file format used by Ubisoft's Rayman 2.

Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
3 months agoavcodec: add decoder for Rayman 2's ADPCM variant
Zane van Iperen [Thu, 20 Feb 2020 11:31:46 +0000 (11:31 +0000)]
avcodec: add decoder for Rayman 2's ADPCM variant

Adds support for the ADPCM variant used in Rayman 2's files.

Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
3 months agoavformat/spdifenc: fix TrueHD streams over 48kHz
Anssi Hannula [Thu, 20 Feb 2020 21:04:50 +0000 (23:04 +0200)]
avformat/spdifenc: fix TrueHD streams over 48kHz

Commit 36e156bef02 ("avformat/spdifenc: fix handling of large TrueHD
frame") added an obviously incorrect bitshift that caused incorrect
samples-per-frame calculation for TrueHD streams over 48kHz.

Fix that.

3 months agoavformat/spdifenc: fix handling of large TrueHD frames
Anssi Hannula [Wed, 19 Feb 2020 20:46:35 +0000 (22:46 +0200)]
avformat/spdifenc: fix handling of large TrueHD frames

The TrueHD IEC 61937 encapsulation code uses a very naive method of
always inserting 24 TrueHD frames evenly in a MAT frame. This does not
work for larger frames as they may exceed the size of 1/24th of a MAT
frame.

To fix that, use the input_timing field in the TrueHD frame to determine
the proper position of the TrueHD frame in the MAT frame. That field is
basically a dts field, telling the time to feed this frame to the
decoder in sample count units.

This can cause a TrueHD frame to be split between two MAT frames, so a
second concatenation hd_buf is added, alternating with the first buffer.

Large frames are preceded by smaller frames that have input_timing
values that cause the frames to be sent out faster than the nominal rate
(i.e. increasing decoder latency, long decoder buffer), allowing the
larger frames to then be sent out slower than the nominal rate as the
decoder has enough data buffered to keep it busy.

3 months agoavformat/spdifenc: make hd_buf an array
Anssi Hannula [Thu, 20 Feb 2020 19:49:50 +0000 (21:49 +0200)]
avformat/spdifenc: make hd_buf an array

This is preparation for adding a second hd_buf in a followup commit.

Also, slightly improve the comments for hd_buf_x members to clarify
which ones are actually used and kept up-to-date depending on which
codec is being muxed.

3 months agoavformat/vivo: set packet duration
Paul B Mahol [Wed, 4 Apr 2018 18:23:23 +0000 (20:23 +0200)]
avformat/vivo: set packet duration

Signed-off-by: Paul B Mahol <onemda@gmail.com>
3 months agoavformat/vivo: improve probing of some files
Paul B Mahol [Wed, 4 Apr 2018 09:47:42 +0000 (11:47 +0200)]
avformat/vivo: improve probing of some files

Signed-off-by: Paul B Mahol <onemda@gmail.com>
3 months agoavcodec: add siren audio decoder
Paul B Mahol [Tue, 3 Apr 2018 19:49:48 +0000 (21:49 +0200)]
avcodec: add siren audio decoder

3 months agolavd/opengl_enc: check strings before parsing them.
Nicolas George [Mon, 17 Feb 2020 11:59:27 +0000 (12:59 +0100)]
lavd/opengl_enc: check strings before parsing them.

Fix a segfault if OpenGL was not initialized before calling
write_header().

3 months agolavd/opengl_enc: use proper context for logging.
Nicolas George [Mon, 17 Feb 2020 11:58:35 +0000 (12:58 +0100)]
lavd/opengl_enc: use proper context for logging.

Log as [opengl @ 0xaddress] instead of [opengl outdev @ 0xaddress].

3 months agoavformat/wtvdec: Forward errors when reading packet
Andreas Rheinhardt [Mon, 10 Feb 2020 17:21:37 +0000 (18:21 +0100)]
avformat/wtvdec: Forward errors when reading packet

wtvfile_read_packet did not abide by the requirements of an
AVIOContext's read_packet-function: If it did not read anything,
it returned zero, which currently leads to a warning in read_packet_wrapper
in aviobuf.c. Said warning will be an av_assert2 as soon as
FF_API_OLD_AVIO_EOF_0 is zero (probably the next major version bump).
So instead forward the error code from the underlying protocol.

This error/assert is triggered in the wtv-demux FATE test.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Reviewed-by: Peter Ross <pross@xvid.org>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 months agolibavcodec/svq: Remove ff_svq1_packet_checksum()
Michael Niedermayer [Tue, 18 Feb 2020 23:42:33 +0000 (00:42 +0100)]
libavcodec/svq: Remove ff_svq1_packet_checksum()

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 months agoavcodec/qdm2: Check fft_coefs_index
Michael Niedermayer [Tue, 18 Feb 2020 21:58:12 +0000 (22:58 +0100)]
avcodec/qdm2: Check fft_coefs_index

Fixes: out of array access
Fixes: 20660/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_QDM2_fuzzer-5658290216501248

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 months agoansi: process ESC[3m italics attribute
Peter Ross [Tue, 18 Feb 2020 01:03:53 +0000 (12:03 +1100)]
ansi: process ESC[3m italics attribute

squelch unknown escape code warnings

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Peter Ross <pross@xvid.org>
3 months agolavc/qsvenc: add support for external bitrate control for HEVC
Linjie Fu [Thu, 13 Feb 2020 12:47:24 +0000 (20:47 +0800)]
lavc/qsvenc: add support for external bitrate control for HEVC

Enables option for hevc_qsv encoder:
    -extbrc

Improvements in BD-Rate could be observed with extbrc on.

Signed-off-by: Linjie Fu <linjie.fu@intel.com>
Signed-off-by: Zhong Li <zhongli_dev@126.com>
3 months agolavfi/vf_scale_qsv: fix the class_name in help for scale_qsv
Linjie Fu [Tue, 21 Jan 2020 08:50:14 +0000 (16:50 +0800)]
lavfi/vf_scale_qsv: fix the class_name in help for scale_qsv

Class name is used in show_help_children(avfilter_get_class(),...)
to prompt the available filters.

$ ffmpeg -h full

Before:
qsvscale AVOptions:

After:
scale_qsv AVOptions:

Signed-off-by: Linjie Fu <linjie.fu@intel.com>
Signed-off-by: Zhong Li <zhongli_dev@126.com>
3 months agolibavcodec/qsvenc.c: Set mjpeg height and width alignment
JonCookCubic [Tue, 21 Jan 2020 13:06:43 +0000 (13:06 +0000)]
libavcodec/qsvenc.c: Set mjpeg height and width alignment

Currently width_align and height_align are zero when encoding with mjpeg_qsv,
which causes "Error submitting the frame for encoding". This patch sets the alignments.

There is a little bit more about the problem here http://ffmpeg.org/pipermail/ffmpeg-user/2019-November/046143.html

Signed-off-by: JonCookCubic <jon.cook@cubicmotion.com>
Signed-off-by: Zhong Li <zhongli_dev@126.com>
3 months agoavformat/dashenc: warn if Producer Reference Time element option is missing when...
James Almer [Mon, 17 Feb 2020 15:44:18 +0000 (12:44 -0300)]
avformat/dashenc: warn if Producer Reference Time element option is missing when ldash mode is used

Signed-off-by: James Almer <jamrial@gmail.com>
3 months agoavformat/dashenc: disable Resync elements when using DVB-DASH profile
James Almer [Mon, 17 Feb 2020 15:16:07 +0000 (12:16 -0300)]
avformat/dashenc: disable Resync elements when using DVB-DASH profile

Signed-off-by: James Almer <jamrial@gmail.com>
3 months agoavcodec/v4l2_m2m: Fix typo in log message and cosmetics
Andriy Gelman [Sun, 16 Feb 2020 19:31:44 +0000 (14:31 -0500)]
avcodec/v4l2_m2m: Fix typo in log message and cosmetics

Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
3 months agoavformat/dashenc: always set coding_dependency to 1 if a parser isn't used
James Almer [Sun, 16 Feb 2020 17:42:00 +0000 (14:42 -0300)]
avformat/dashenc: always set coding_dependency to 1 if a parser isn't used

Signed-off-by: James Almer <jamrial@gmail.com>
3 months agoavformat/dashenc: include an availabilityTimeComplete element in all streaming modes
James Almer [Sun, 19 Jan 2020 21:11:08 +0000 (18:11 -0300)]
avformat/dashenc: include an availabilityTimeComplete element in all streaming modes

It's not exclusive for Low Latency streaming. The muxer will serve partial
segments regardless of streaming mode.

Signed-off-by: James Almer <jamrial@gmail.com>
3 months agoavformat/dashenc: add Trick Mode support for AdaptationSets
James Almer [Fri, 10 Jan 2020 18:51:27 +0000 (15:51 -0300)]
avformat/dashenc: add Trick Mode support for AdaptationSets

Signed-off-by: James Almer <jamrial@gmail.com>
3 months agoavformat/dashenc: make AdaptationSet id an integer value
James Almer [Wed, 8 Jan 2020 16:47:08 +0000 (13:47 -0300)]
avformat/dashenc: make AdaptationSet id an integer value

Unlike Representation id, it's defined as an integer in the spec, and not as a
string.

Signed-off-by: James Almer <jamrial@gmail.com>
3 months agoavformat/utils: Fix integer overflow with complex time bases in avformat_find_stream_...
Michael Niedermayer [Sat, 15 Feb 2020 22:23:55 +0000 (23:23 +0100)]
avformat/utils: Fix integer overflow with complex time bases in avformat_find_stream_info()

Fixes: signed integer overflow: 2045163756 * 2 cannot be represented in type 'int'
Fixes: Ticket5132

Found-by: tsmith
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 months agoavformat/avidec: Avoid integer overflow in NI switch check
Michael Niedermayer [Sat, 15 Feb 2020 22:18:25 +0000 (23:18 +0100)]
avformat/avidec: Avoid integer overflow in NI switch check

Fixes: signed integer overflow: 0 - -9223372036854775808 cannot be represented in type 'long'
Fixes: Ticket8149

Found-by: Suhwan
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 months agofftools/ffmpeg: Fix integer overflow in duration computation in seek_to_start()
Michael Niedermayer [Sat, 15 Feb 2020 21:56:18 +0000 (22:56 +0100)]
fftools/ffmpeg: Fix integer overflow in duration computation in seek_to_start()

Fixes: signed integer overflow: -9223372036854775808 - 9223372036854775807 cannot be represented in type 'long'
Fixes: Ticket8142

Found-by: Suhwan
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 months agoavfilter/vf_aspect: Fix integer overflow in compute_dar()
Michael Niedermayer [Sat, 15 Feb 2020 21:35:37 +0000 (22:35 +0100)]
avfilter/vf_aspect: Fix integer overflow in compute_dar()

Fixes: signed integer overflow: 1562273630 * 17 cannot be represented in type 'int'
Fixes: Ticket8323

Found-by: Suhwan
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 months agoavformat/utils: avoid unsigned integer overflows
Paul B Mahol [Sat, 15 Feb 2020 13:52:47 +0000 (14:52 +0100)]
avformat/utils: avoid unsigned integer overflows

3 months agoavcodec: fix pcm zork decoder
Paul B Mahol [Fri, 14 Feb 2020 19:37:42 +0000 (20:37 +0100)]
avcodec: fix pcm zork decoder

Fixes #1939

3 months agoavformat/segafilmenc: Remove AVClass
Andreas Rheinhardt [Tue, 14 Jan 2020 03:13:33 +0000 (04:13 +0100)]
avformat/segafilmenc: Remove AVClass

This muxer does not have any private options and so does not need a
private class.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 months agoavformat/ftp: slightly rework file retrieval with seeking
Marton Balint [Thu, 6 Feb 2020 22:32:10 +0000 (23:32 +0100)]
avformat/ftp: slightly rework file retrieval with seeking

- do not require a known file size for seek to work
- read the files till the actual end, do not limit data at the queried file
  size
- fix a bug which causes reading 0 byte files for non-existing files
- properly check the return status of the FTP server at the end of the file
  retrieval

Signed-off-by: Marton Balint <cus@passwd.hu>
3 months agoavformat/ftp: do not break protocol on username or password with newlines
Marton Balint [Wed, 5 Feb 2020 23:48:17 +0000 (00:48 +0100)]
avformat/ftp: do not break protocol on username or password with newlines

Signed-off-by: Marton Balint <cus@passwd.hu>
3 months agoavformat/ftp: add support for escaped credentials
Marton Balint [Wed, 5 Feb 2020 23:11:05 +0000 (00:11 +0100)]
avformat/ftp: add support for escaped credentials

Properly fixes ticket #7816.

Signed-off-by: Marton Balint <cus@passwd.hu>
3 months agoavformat/httpauth: do not decode plus sign to space in credentials
Marton Balint [Tue, 4 Feb 2020 22:46:23 +0000 (23:46 +0100)]
avformat/httpauth: do not decode plus sign to space in credentials

Signed-off-by: Marton Balint <cus@passwd.hu>
3 months agoavformat/urldecode: add the ability to not decode plus sign to space
Marton Balint [Tue, 4 Feb 2020 22:44:28 +0000 (23:44 +0100)]
avformat/urldecode: add the ability to not decode plus sign to space

Signed-off-by: Marton Balint <cus@passwd.hu>
3 months agoavformat/http: escape unsafe URL path in HTTP request
Marton Balint [Sat, 8 Feb 2020 00:44:30 +0000 (01:44 +0100)]
avformat/http: escape unsafe URL path in HTTP request

This avoids generating invalid HTTP requests if the path contains space or
other special characters.

Signed-off-by: Marton Balint <cus@passwd.hu>
3 months agoavformat/http: use AVBPrint to construct HTTP request
Marton Balint [Fri, 7 Feb 2020 23:08:54 +0000 (00:08 +0100)]
avformat/http: use AVBPrint to construct HTTP request

v2: Use s->buffer for creating request (as the old code did) instead of
the AVBPrint internal buffer. Some minor cosmetics.

Signed-off-by: Marton Balint <cus@passwd.hu>
3 months agoavformat/http: make sure URL path contains a slash
Marton Balint [Mon, 3 Feb 2020 22:29:08 +0000 (23:29 +0100)]
avformat/http: make sure URL path contains a slash

It is explicitly required by the HTTP RFC. Without this patch URLs like
http://example.com?query will not work.

Fixes ticket #8466.

Signed-off-by: Marton Balint <cus@passwd.hu>
3 months agoavformat/http: split the fragment part from the HTTP URL before the request
Marton Balint [Mon, 3 Feb 2020 22:06:09 +0000 (23:06 +0100)]
avformat/http: split the fragment part from the HTTP URL before the request

RFC 3986 states that the fragment identifier is separated from the rest of the
URI prior to a dereference, and thus the identifying information within the
fragment itself is dereferenced solely by the user agent.

Signed-off-by: Marton Balint <cus@passwd.hu>
3 months agoavformat/utils: make av_url_split search for hashmark as well to separate hostname
Marton Balint [Mon, 3 Feb 2020 00:32:00 +0000 (01:32 +0100)]
avformat/utils: make av_url_split search for hashmark as well to separate hostname

RFC 3986 states that the generic syntax uses the slash ("/"), question mark
("?"), and number sign ("#") characters to delimit components that are
significant to the generic parser's hierarchical interpretation of an
identifier.

Signed-off-by: Marton Balint <cus@passwd.hu>
3 months agoavformat/tests/url: add av_url_split tests
Marton Balint [Mon, 3 Feb 2020 00:13:28 +0000 (01:13 +0100)]
avformat/tests/url: add av_url_split tests

Signed-off-by: Marton Balint <cus@passwd.hu>
3 months agoavformat/tests/url: make format more readable
Marton Balint [Sun, 2 Feb 2020 22:26:16 +0000 (23:26 +0100)]
avformat/tests/url: make format more readable

Signed-off-by: Marton Balint <cus@passwd.hu>
3 months agoavformat/utils: Fix memleaks in avformat_open_input()
Andreas Rheinhardt [Tue, 7 Jan 2020 13:55:47 +0000 (14:55 +0100)]
avformat/utils: Fix memleaks in avformat_open_input()

A demuxer might have allocated memory while reading the header. If
reading the header was successfull and an error happens before returning
(e.g. when queueing the attached pictures), the read_close function
would have never been called, so that all those allocations would leak.
This commit changes this.

Furthermore, there would be even more memleaks if the error level was
set to AV_EF_EXPLODE in case there is both metadata and id3v2 metadata.
This has been fixed, too.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Marton Balint <cus@passwd.hu>
3 months agocompat/os2threads: define INCL_DOSERRORS
Dave Yeo [Thu, 13 Feb 2020 04:13:00 +0000 (20:13 -0800)]
compat/os2threads: define INCL_DOSERRORS

This is needed to pull in the define for ERROR_TIMEOUT

Signed-off-by: Dave Yeo <daveryeo@telus.net>
Signed-off-by: Marton Balint <cus@passwd.hu>
3 months agoMAINTAINERS: Add myself as libzmq maintainer
Andriy Gelman [Thu, 13 Feb 2020 00:17:06 +0000 (19:17 -0500)]
MAINTAINERS: Add myself as libzmq maintainer

Signed-off-by: Marton Balint <cus@passwd.hu>
3 months agoavutil/hwcontext_d3d11va: Use secure dlopen.
Matt Oliver [Mon, 30 Dec 2019 15:59:39 +0000 (02:59 +1100)]
avutil/hwcontext_d3d11va: Use secure dlopen.

dlopen contains additional security to prevent dll hijacking compared to standard LoadLibrary.

3 months agoavfilter/vf_phase: add >8 bit support
Paul B Mahol [Sat, 15 Feb 2020 10:58:44 +0000 (11:58 +0100)]
avfilter/vf_phase: add >8 bit support

3 months agoavcodec: add cdtoons decoder
Alyssa Milburn [Sun, 5 Jan 2020 18:41:14 +0000 (19:41 +0100)]
avcodec: add cdtoons decoder

This adds a decoder for Broderbund's sprite-based QuickTime CDToons
codec, based on the decoder I wrote for ScummVM.

Signed-off-by: Alyssa Milburn <amilburn@zall.org>
3 months agoavfilter/opencl: use av_fopen_utf8()
Paul B Mahol [Fri, 14 Feb 2020 20:48:54 +0000 (21:48 +0100)]
avfilter/opencl: use av_fopen_utf8()

3 months agoavfilter/vf_fieldhint: use av_fopen_utf8()
Paul B Mahol [Fri, 14 Feb 2020 20:47:55 +0000 (21:47 +0100)]
avfilter/vf_fieldhint: use av_fopen_utf8()

3 months agoavfilter/vf_lut3d: use av_fopen_utf8()
Paul B Mahol [Fri, 14 Feb 2020 20:44:38 +0000 (21:44 +0100)]
avfilter/vf_lut3d: use av_fopen_utf8()

3 months agoavcodec/pcm_tablegen: nits, reindent
Paul B Mahol [Fri, 14 Feb 2020 20:22:08 +0000 (21:22 +0100)]
avcodec/pcm_tablegen: nits, reindent

3 months agolavu/tx: improve 3-point fixed precision
Lynne [Fri, 14 Feb 2020 19:55:00 +0000 (19:55 +0000)]
lavu/tx: improve 3-point fixed precision

There's just no reason not to when its so easy (albeit messy) and its also
reducing the precision of all non-power-of-two transforms that use it.

3 months agoavcodec/dstdec: Use local channels variable
Michael Niedermayer [Thu, 13 Feb 2020 19:41:45 +0000 (20:41 +0100)]
avcodec/dstdec: Use local channels variable

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 months agofftools/ffprobe: Remove unneeded casts
Andreas Rheinhardt [Tue, 6 Aug 2019 01:17:06 +0000 (03:17 +0200)]
fftools/ffprobe: Remove unneeded casts

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 months agoavcodec/dvdsub: Fix warning about incompatible pointer type
Andreas Rheinhardt [Fri, 14 Feb 2020 11:24:03 +0000 (12:24 +0100)]
avcodec/dvdsub: Fix warning about incompatible pointer type

Fixes "passing argument 2 of ‘strtoul’ from incompatible pointer
type [-Wincompatible-pointer-types]" ("expected ‘char ** restrict’ but
argument is of type ‘const char **’") for GCC and "passing 'const char
**' to parameter of type 'char **' discards qualifiers in nested pointer
types [-Wincompatible-pointer-types-discards-qualifiers]" for Clang.

The cast itself is safe; it is only needed because strtoul itself is not
const-correct.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
3 months agoavfilter/vf_remap: add fill color option
Paul B Mahol [Fri, 14 Feb 2020 12:14:02 +0000 (13:14 +0100)]
avfilter/vf_remap: add fill color option

3 months agoavfilter: add pad opencl filter
Paul B Mahol [Thu, 6 Feb 2020 16:41:08 +0000 (17:41 +0100)]
avfilter: add pad opencl filter

3 months agoavcodec/cbs_av1: add missing value constrains to point_y_value, point_cb_value and...
James Almer [Thu, 13 Feb 2020 02:40:22 +0000 (23:40 -0300)]
avcodec/cbs_av1: add missing value constrains to point_y_value, point_cb_value and point_cr_value

If i is greater than 0, it is a requirement of bitstream conformance that point_y_value[ i ] is greater than point_y_value[ i - 1 ].
If i is greater than 0, it is a requirement of bitstream conformance that point_cb_value[ i ] is greater than point_cb_value[ i - 1 ].
If i is greater than 0, it is a requirement of bitstream conformance that point_cr_value[ i ] is greater than point_cr_value[ i - 1 ].

Reviewed-by: Mark Thompson <sw@jkqxz.net>
Signed-off-by: James Almer <jamrial@gmail.com>
3 months agolavu/tx: slightly optimize fft15
Lynne [Mon, 10 Feb 2020 17:37:34 +0000 (17:37 +0000)]
lavu/tx: slightly optimize fft15

Saves 2 additions.

3 months agolavu/tx: undef the correct macro
Lynne [Mon, 10 Feb 2020 17:36:45 +0000 (17:36 +0000)]
lavu/tx: undef the correct macro

It was renamed and no warning was given for undeffing a nonexisting one.

3 months agolavu/tx: implement 32 bit fixed point FFT and MDCT
Lynne [Sat, 8 Feb 2020 23:13:28 +0000 (23:13 +0000)]
lavu/tx: implement 32 bit fixed point FFT and MDCT

Required minimal changes to the code so made sense to implement.
FFT and MDCT tested, the output of both was properly rounded.
Fun fact: the non-power-of-two fixed-point FFT and MDCT are the fastest ever
non-power-of-two fixed-point FFT and MDCT written.
This can replace the power of two integer MDCTs in aac and ac3 if the
MIPS optimizations are ported across.
Unfortunately the ac3 encoder uses a 16-bit fixed point forward transform,
unlike the encoder which uses a 32bit inverse transform, so some modifications
might be required there.

The 3-point FFT is somewhat less accurate than it otherwise could be,
having minor rounding errors with bigger transforms. However, this
could be improved later, and the way its currently written is the way one
would write assembly for it.
Similar rounding errors can also be found throughout the power of two FFTs
as well, though those are more difficult to correct.
Despite this, the integer transforms are more than accurate enough.

3 months agoavcodec/midivid: only multiple of 4 width/height are possible
Paul B Mahol [Thu, 13 Feb 2020 11:15:42 +0000 (12:15 +0100)]
avcodec/midivid: only multiple of 4 width/height are possible

3 months agoavcodec/midivid: improve decoding of widths not multiple of 32
Paul B Mahol [Thu, 13 Feb 2020 09:11:20 +0000 (10:11 +0100)]
avcodec/midivid: improve decoding of widths not multiple of 32

3 months agoavcodec/h264_ps: Return error if pps has FMO parameters
Andriy Gelman [Wed, 12 Feb 2020 23:36:56 +0000 (18:36 -0500)]
avcodec/h264_ps: Return error if pps has FMO parameters

FMO is not supported and fields related to FMO are not parsed, meaning
that any fields which follow will be corrupt.

Signed-off-by: James Almer <jamrial@gmail.com>
3 months agofftools/ffmpeg: Integrate two checks
Andreas Rheinhardt [Sat, 12 Oct 2019 03:18:39 +0000 (05:18 +0200)]
fftools/ffmpeg: Integrate two checks

For audio packets with dts != AV_NOPTS_VALUEs the dts was converted
twice to the muxer's timebase during streamcopy, once as a normal
packet and once specifically as an audio packet. This has been changed.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 months agoavcodec/avcodec: Nits
Andreas Rheinhardt [Tue, 10 Dec 2019 21:59:55 +0000 (22:59 +0100)]
avcodec/avcodec: Nits

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 months agoavcodec/apedec: Fix invalid shift with 24 bps
Michael Niedermayer [Tue, 11 Feb 2020 22:56:45 +0000 (23:56 +0100)]
avcodec/apedec: Fix invalid shift with 24 bps

Fixes: left shift of negative value -463
Fixes: 20542/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_APE_fuzzer-5688714435231744

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 months agoavfilter/vf_xmedian: implement percentile option
Paul B Mahol [Wed, 12 Feb 2020 13:34:00 +0000 (14:34 +0100)]
avfilter/vf_xmedian: implement percentile option

3 months agoavfilter/vf_median: implement percentile option
Paul B Mahol [Wed, 12 Feb 2020 10:25:25 +0000 (11:25 +0100)]
avfilter/vf_median: implement percentile option

3 months agoavcodec/h264_ps: Show VUI and SPS overread messages just once per frame thread
Michael Niedermayer [Thu, 16 Jan 2020 16:51:29 +0000 (17:51 +0100)]
avcodec/h264_ps: Show VUI and SPS overread messages just once per frame thread

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 months agoavutil/log: Add av_log_once() for printing a message just once with a high log level
Michael Niedermayer [Thu, 16 Jan 2020 15:34:07 +0000 (16:34 +0100)]
avutil/log: Add av_log_once() for printing a message just once with a high log level

Compared to ad-hoc if(printed) ... code this allows the user to disable
it by adjusting the log level

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 months agoavformat/utils: Fix undefined behavior in ff_configure_buffers_for_index()
Dale Curtis [Wed, 29 Jan 2020 00:49:14 +0000 (16:49 -0800)]
avformat/utils: Fix undefined behavior in ff_configure_buffers_for_index()

When e2_pts == INT64_MIN and e1_pts >= 0 the calculation of
e2_pts - e1_pts will overflow an int64_t.

Signed-off-by: Dale Curtis <dalecurtis@chromium.org>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 months agoavcodec/libvpxenc: add a way to explicitly set temporal layer id
Wonkap Jang [Mon, 10 Feb 2020 18:30:09 +0000 (10:30 -0800)]
avcodec/libvpxenc: add a way to explicitly set temporal layer id

In order for rate control to correctly allocate bitrate to each temporal
layer, correct temporal layer id has to be set to each frame. This
commit provides the ability to set correct temporal layer id for each
frame.

Signed-off-by: James Zern <jzern@google.com>
3 months agoavfilter/vf_colorlevels: add support for commands
Paul B Mahol [Tue, 11 Feb 2020 13:19:56 +0000 (14:19 +0100)]
avfilter/vf_colorlevels: add support for commands

3 months agoavfilter/vf_colorkey: add support for commands
Paul B Mahol [Tue, 11 Feb 2020 12:57:43 +0000 (13:57 +0100)]
avfilter/vf_colorkey: add support for commands

3 months agolibfdk-aacdec: Allow explicitly disabling the DRC reference level option
Martin Storsjö [Tue, 4 Feb 2020 14:23:27 +0000 (16:23 +0200)]
libfdk-aacdec: Allow explicitly disabling the DRC reference level option

Previously, it was always left in the automatic mode, if the option
was set to the only special (negative) value. Now there's two separate
special values for this option, -1 for automatic (metadata based)
and -2 for explicitly disabled.

Signed-off-by: Martin Storsjö <martin@martin.st>
3 months agolibfdk-aacdec: Use the decoder's default level limiter settings
Martin Storsjö [Tue, 4 Feb 2020 14:07:06 +0000 (16:07 +0200)]
libfdk-aacdec: Use the decoder's default level limiter settings

It was disabled by default in 2dbd35b00c6433e587d5f44d5dbc8972ebbaa88e
as it added delay, but now we compensate for the delay properly
by offsetting timestamps.

Signed-off-by: Martin Storsjö <martin@martin.st>
3 months agolibfdk-aacdec: Apply the decoder's output delay on timestamps
Martin Storsjö [Tue, 4 Feb 2020 14:03:57 +0000 (16:03 +0200)]
libfdk-aacdec: Apply the decoder's output delay on timestamps

The delay is normally zero when the level limiter is disabled,
but if enabled, there's a small delay.

Signed-off-by: Martin Storsjö <martin@martin.st>
3 months agoavformat/mpjpegdec: Remove redundant initializations
Andreas Rheinhardt [Tue, 7 Jan 2020 13:55:43 +0000 (14:55 +0100)]
avformat/mpjpegdec: Remove redundant initializations

The AVPacket destined for a demuxer's output has already been
initialized before it reaches the demuxer.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Marton Balint <cus@passwd.hu>
3 months agoavfilter/vf_dedot: Fix leak of AVFrame if making it writable fails
Andreas Rheinhardt [Sun, 9 Feb 2020 18:40:34 +0000 (19:40 +0100)]
avfilter/vf_dedot: Fix leak of AVFrame if making it writable fails

Even in this scenario, the frame still contains references to data that
won't be freed if the frame isn't unreferenced. And the AVFrame itself
will leak, too.

Fixes Coverity issue #1441422.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 months agoavformat: Remove unnecessary av_packet_unref()
Andreas Rheinhardt [Tue, 7 Jan 2020 13:55:40 +0000 (14:55 +0100)]
avformat: Remove unnecessary av_packet_unref()

Since bae8844e the packet will always be unreferenced when a demuxer
returns an error, so that a lot of calls to av_packet_unref() in lots of
demuxers are now redundant and can be removed.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Marton Balint <cus@passwd.hu>
3 months agoavformat/tty: fix last timestamp for fate
Paul B Mahol [Mon, 10 Feb 2020 15:47:03 +0000 (16:47 +0100)]
avformat/tty: fix last timestamp for fate

3 months agoavfilter/vf_thumbnail: fix possible crash on error
Paul B Mahol [Mon, 10 Feb 2020 14:42:52 +0000 (15:42 +0100)]
avfilter/vf_thumbnail: fix possible crash on error

3 months agoavfilter/vf_thumbnail: add timeline support
Paul B Mahol [Mon, 10 Feb 2020 14:42:27 +0000 (15:42 +0100)]
avfilter/vf_thumbnail: add timeline support

3 months agolibswscale/x86/yuv2rgb: add ssse3 version
Ting Fu [Sun, 19 Jan 2020 03:51:04 +0000 (11:51 +0800)]
libswscale/x86/yuv2rgb: add ssse3 version

Tested using this command:
/ffmpeg -pix_fmt yuv420p -s 1920*1080 -i ArashRawYuv420.yuv \
-vcodec rawvideo -s 1920*1080 -pix_fmt rgb24 -f null /dev/null

The fps increase from 389 to 640 on Intel(R) Core(TM) i7-8700K CPU @ 3.70GHz

Signed-off-by: Ting Fu <ting.fu@intel.com>
3 months agoavformat/tty: add seeking support
Paul B Mahol [Sun, 2 Feb 2020 13:03:45 +0000 (14:03 +0100)]
avformat/tty: add seeking support

3 months agoavformat/tty: make probing strict for first 8 bytes
Paul B Mahol [Sun, 2 Feb 2020 12:51:49 +0000 (13:51 +0100)]
avformat/tty: make probing strict for first 8 bytes

3 months agoavcodec/cbs_jpeg: Use memcpy when writing pictures
Andreas Rheinhardt [Tue, 19 Nov 2019 16:12:28 +0000 (17:12 +0100)]
avcodec/cbs_jpeg: Use memcpy when writing pictures

This is possible because the size of a scan header is always a multiple
of a byte.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 months agoavcodec/cbs_mpeg2: Treat slices without data as invalid
Andreas Rheinhardt [Mon, 9 Dec 2019 22:26:04 +0000 (23:26 +0100)]
avcodec/cbs_mpeg2: Treat slices without data as invalid

They are spec-incompliant.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 months agoavcodec/dpcm: Fix integer overflow in AV_CODEC_ID_GREMLIN_DPCM
Michael Niedermayer [Wed, 22 Jan 2020 22:11:47 +0000 (23:11 +0100)]
avcodec/dpcm: Fix integer overflow in AV_CODEC_ID_GREMLIN_DPCM

Fixes: signed integer overflow: -2147479324 + -32568 cannot be represented in type 'int'
Fixes: 20103/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_GREMLIN_DPCM_fuzzer-5667667579240448

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 months agoavcodec/wmalosslessdec: Fix integer overflow with sliding in padding bits
Michael Niedermayer [Sat, 18 Jan 2020 18:55:23 +0000 (19:55 +0100)]
avcodec/wmalosslessdec: Fix integer overflow with sliding in padding bits

Fixes: signed integer overflow: -53716100 * 256 cannot be represented in type 'int'
Fixes: 20143/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WMALOSSLESS_fuzzer-5716604000403456

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 months agoavcodec/wmalosslessdec: Fix loop in revert_acfilter()
Michael Niedermayer [Sat, 18 Jan 2020 18:28:36 +0000 (19:28 +0100)]
avcodec/wmalosslessdec: Fix loop in revert_acfilter()

Fixes: out of array read
Fixes: 20059/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WMALOSSLESS_fuzzer-5691776237305856

No testcase except the fuzzed one.

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 months agoavcodec/mvha: Check remaining bits in VLC decode loop
Michael Niedermayer [Wed, 15 Jan 2020 21:13:14 +0000 (22:13 +0100)]
avcodec/mvha: Check remaining bits in VLC decode loop

Fixes: timeout (252sec -> 170msec)
Fixes: 20023/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MVHA_fuzzer-5681192565473280

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 months agoavcodec/agm: YUV420 without DCT needs even dimensions
Michael Niedermayer [Fri, 10 Jan 2020 20:30:38 +0000 (21:30 +0100)]
avcodec/agm: YUV420 without DCT needs even dimensions

Fixes: out of array access
Fixes: 19892/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_AGM_fuzzer-5707525924323328

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>