]> git.sesse.net Git - ffmpeg/log
ffmpeg
3 years agotiff: remove tiff type check for ICC profiles
Lynne [Sat, 5 Sep 2020 19:07:33 +0000 (20:07 +0100)]
tiff: remove tiff type check for ICC profiles

Although the ICC specifications say to check for this, libtiff doesn't
and neither does any other TIFF implementation, and the TIFF specs
say that Photoshop has a different way to encapsulate ICC profiles,
and are asking for advice on how to deal with it.

So basically, photoshop puts a different type than what's specified,
no other implementation checks for this, we do because we tried to
follow the specs although its harmless to not, and ran into this bug
because we didn't know about it.

3 years agoavcodec/pixlet: postprocess luma using precalculated lut
Paul B Mahol [Sun, 6 Sep 2020 11:44:52 +0000 (13:44 +0200)]
avcodec/pixlet: postprocess luma using precalculated lut

Realtime decoding speed raises from 1.08 to 1.84 for
1504x846, 25391 kb/s, 24 fps video.

3 years agoavcodec/vp9dsp_template: Fix integer overflow in iadst8_1d()
Michael Niedermayer [Sun, 21 Jun 2020 22:24:55 +0000 (00:24 +0200)]
avcodec/vp9dsp_template: Fix integer overflow in iadst8_1d()

Fixes: signed integer overflow: 998938090 + 1169275991 cannot be represented in type 'int'
Fixes: 23411/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VP9_fuzzer-4644692330545152
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavformat/avidec: Fix io_fsize overflow
Michael Niedermayer [Sun, 21 Jun 2020 22:09:05 +0000 (00:09 +0200)]
avformat/avidec: Fix io_fsize overflow

Fixes: signed integer overflow: 7958120835074169528 * 9 cannot be represented in type 'long long'
Fixes: 23382/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-6230683226996736
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavcodec/tdsc: Only reallocate deflatebuffer if its size changed
Michael Niedermayer [Thu, 18 Jun 2020 10:26:08 +0000 (12:26 +0200)]
avcodec/tdsc: Only reallocate deflatebuffer if its size changed

Fixes: Timeout (47sec -> 35msec)
Fixes: 23375/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TDSC_fuzzer-5633949497032704
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavcodec/jpeglsenc: Remove redundant av_packet_unref()
Andreas Rheinhardt [Thu, 3 Sep 2020 17:44:44 +0000 (19:44 +0200)]
avcodec/jpeglsenc: Remove redundant av_packet_unref()

If encoding fails, the AVPacket that ought to contain the encoded packet
is already unreferenced generically.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/notchlc: simplify reading le16 in lz4_decompress
Paul B Mahol [Sat, 5 Sep 2020 11:00:43 +0000 (13:00 +0200)]
avcodec/notchlc: simplify reading le16 in lz4_decompress

3 years agoavformat/dashdec: drop arbitrary DASH manifest size limit
Jan Ekström [Thu, 3 Sep 2020 16:50:08 +0000 (19:50 +0300)]
avformat/dashdec: drop arbitrary DASH manifest size limit

Currently the utilized AVBPrint API is internally limited to unsigned
integers, so if we limit the file size as well as the amount to read
to UINT_MAX - 1, we do not require additional limiting to be performed
on the values.

This change is based on the fact that initially the 8*1024 value added
in 96d70694aea64616c68db8be306c159c73fb3980 was only for the case where
the file size was not known. It was not a maximum file size limit.

In 29121188983932f79aef8501652630d322a9974c this was reworked to be
a maximum manifest file size limit, while its commit message appears
to only note that it added support for larger manifest file sizes.

This should enable various unfortunately large MPEG-DASH manifests,
such as Youtube's multi-megabyte live stream archives to load up
as well as bring back the original intent of the logic.

3 years agolavf/img2dec: Auto-detect Kodak Photo CD image files.
Carl Eugen Hoyos [Sat, 5 Sep 2020 08:45:52 +0000 (10:45 +0200)]
lavf/img2dec: Auto-detect Kodak Photo CD image files.

3 years agoavcodec/dxtory: add frame threads support
Paul B Mahol [Sat, 5 Sep 2020 08:31:03 +0000 (10:31 +0200)]
avcodec/dxtory: add frame threads support

3 years agoavcodec/dxtory: add missed rgb555/rgb565 formats for vflip case
Paul B Mahol [Thu, 3 Sep 2020 22:29:08 +0000 (00:29 +0200)]
avcodec/dxtory: add missed rgb555/rgb565 formats for vflip case

3 years agoavcodec/dxtory: support subsampled formats with non-aligned size
Paul B Mahol [Thu, 3 Sep 2020 16:59:13 +0000 (18:59 +0200)]
avcodec/dxtory: support subsampled formats with non-aligned size

Also unbreak decoding after 6e1a167c556

3 years agoavcodec/photocd: Remove set-but-unused variables
Andreas Rheinhardt [Fri, 4 Sep 2020 19:46:09 +0000 (21:46 +0200)]
avcodec/photocd: Remove set-but-unused variables

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/mobiclip: Fix mixed declarations and code
Andreas Rheinhardt [Fri, 4 Sep 2020 19:31:58 +0000 (21:31 +0200)]
avcodec/mobiclip: Fix mixed declarations and code

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/binkaudio: Avoid allocation for array
Andreas Rheinhardt [Fri, 4 Sep 2020 14:52:49 +0000 (16:52 +0200)]
avcodec/binkaudio: Avoid allocation for array

The array in question can not be too large (only 26 elements), so it can
simply be put on the context.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/binkaudio: Remove unused array from context
Andreas Rheinhardt [Fri, 4 Sep 2020 14:42:28 +0000 (16:42 +0200)]
avcodec/binkaudio: Remove unused array from context

Unused since 7bfd1766d1c18f07b0a2dd042418a874d49ea60d.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/binkaudio: Don't use static storage for context-dependent data
Andreas Rheinhardt [Fri, 4 Sep 2020 14:16:15 +0000 (16:16 +0200)]
avcodec/binkaudio: Don't use static storage for context-dependent data

Move it to the context instead.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/bink: Only keep what is used from HpelDSPContext
Andreas Rheinhardt [Fri, 4 Sep 2020 15:29:28 +0000 (17:29 +0200)]
avcodec/bink: Only keep what is used from HpelDSPContext

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/bink: Combine allocations of arrays into one
Andreas Rheinhardt [Fri, 4 Sep 2020 16:30:22 +0000 (18:30 +0200)]
avcodec/bink: Combine allocations of arrays into one

Saves allocations, checks for the allocations as well as frees.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/bink: Fix memleak upon init failure
Andreas Rheinhardt [Fri, 4 Sep 2020 15:49:16 +0000 (17:49 +0200)]
avcodec/bink: Fix memleak upon init failure

The init function first allocates an AVFrame and then some buffers; if
one of the buffers couldn't be allocated, the AVFrame leaks. Solve this
by setting the FF_CODEC_CAP_INIT_CLEANUP flag.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavfilter/asrc_anullsrc: remove not useful function
Paul B Mahol [Fri, 4 Sep 2020 17:16:57 +0000 (19:16 +0200)]
avfilter/asrc_anullsrc: remove not useful function

3 years agoavfilter/vsrc_gradients: switch to activate
Paul B Mahol [Fri, 4 Sep 2020 16:50:57 +0000 (18:50 +0200)]
avfilter/vsrc_gradients: switch to activate

Allow to set the EOF timestamp.

3 years agoavfilter/asrc_anullsrc: switch to activate
Paul B Mahol [Fri, 4 Sep 2020 16:39:27 +0000 (18:39 +0200)]
avfilter/asrc_anullsrc: switch to activate

Allow to set the EOF timestamp.

3 years agoavfilter/asrc_anullsrc: add support to set output duration
Paul B Mahol [Fri, 4 Sep 2020 16:30:46 +0000 (18:30 +0200)]
avfilter/asrc_anullsrc: add support to set output duration

3 years agoavfilter/vf_alphamerge: use framesync
Paul B Mahol [Sun, 30 Aug 2020 21:07:17 +0000 (23:07 +0200)]
avfilter/vf_alphamerge: use framesync

3 years agoavfilter/src_movie: switch to activate
Paul B Mahol [Mon, 31 Aug 2020 17:10:43 +0000 (19:10 +0200)]
avfilter/src_movie: switch to activate

Allow to set the EOF timestamp.

3 years agoavfilter/af_arnndn: reduce size of second_check[] table
Paul B Mahol [Fri, 4 Sep 2020 15:39:18 +0000 (17:39 +0200)]
avfilter/af_arnndn: reduce size of second_check[] table

3 years agoavformat/yuv4mpegenc: Add const where appropriate
Andreas Rheinhardt [Fri, 4 Sep 2020 10:46:09 +0000 (12:46 +0200)]
avformat/yuv4mpegenc: Add const where appropriate

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavformat/yuv4mpegenc: Simplify writing global and packet headers
Andreas Rheinhardt [Fri, 4 Sep 2020 10:36:41 +0000 (12:36 +0200)]
avformat/yuv4mpegenc: Simplify writing global and packet headers

YUV4MPEG writes a string as header for both the file itself as well as
for every frame; these strings contain magic strings and these were up
until now included in the string to write via %s. Yet they are compile
time constants, so one can use the compile-time string concatentation
instead of inserting these strings at runtime.
Furthermore, the global header has been written via snprintf() to
a local buffer first before writing it. This can be simplified by using
avio_printf().

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec: add PhotoCD decoder
Paul B Mahol [Sat, 29 Aug 2020 15:03:20 +0000 (17:03 +0200)]
avcodec: add PhotoCD decoder

3 years agoavformat/yuv4mpegenc: simplify writing the header
James Almer [Thu, 3 Sep 2020 18:39:32 +0000 (15:39 -0300)]
avformat/yuv4mpegenc: simplify writing the header

Actually write it in yuv4_write_header() instead of with the first
packet.

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agoavformat/mov: Stash mfra size if we're reading it anyway
Derek Buitenhuis [Tue, 1 Sep 2020 14:42:17 +0000 (15:42 +0100)]
avformat/mov: Stash mfra size if we're reading it anyway

This also changes a check for mfra_size from < 0 to == 0, since
it was always wrong, as avio_rb32 returns an unsigned integer.

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
3 years agoavformat/mov: Only read the mfra size once during sidx parsing
Derek Buitenhuis [Tue, 1 Sep 2020 14:33:47 +0000 (15:33 +0100)]
avformat/mov: Only read the mfra size once during sidx parsing

On files with more than one sidx box, like live fragmented MP4
files, it was previously re-reading and seeking on every singl
sidx box, leading to extremely poor performance on larger files,
especially over the network.

Only do it on the first one, and stash its result.

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
3 years agoavformat/mov: Do not try and seek to an mfra if the reader can't seek
Derek Buitenhuis [Tue, 1 Sep 2020 14:21:52 +0000 (15:21 +0100)]
avformat/mov: Do not try and seek to an mfra if the reader can't seek

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
3 years agoavformat/mov: Fix return type used for av_seek in mfra code
Derek Buitenhuis [Tue, 1 Sep 2020 14:15:28 +0000 (15:15 +0100)]
avformat/mov: Fix return type used for av_seek in mfra code

It should be a 64-bit integer, otherwise it overflows and fails
on files greater than 2GB on some systems like x86_64 Linux.

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
3 years agoavformat: add MODS demuxer
Paul B Mahol [Tue, 1 Sep 2020 09:12:53 +0000 (11:12 +0200)]
avformat: add MODS demuxer

3 years agoavformat: add moflex demuxer
Paul B Mahol [Sun, 23 Aug 2020 20:24:29 +0000 (22:24 +0200)]
avformat: add moflex demuxer

3 years agoavcodec: add MobiClip video decoder
Paul B Mahol [Tue, 25 Aug 2020 10:34:32 +0000 (12:34 +0200)]
avcodec: add MobiClip video decoder

3 years agoavcodec: add FastAudio decoder
Paul B Mahol [Mon, 24 Aug 2020 17:11:41 +0000 (19:11 +0200)]
avcodec: add FastAudio decoder

3 years agoavcodec: add ADPCM IMA MOFLEX decoder
Paul B Mahol [Mon, 24 Aug 2020 22:51:11 +0000 (00:51 +0200)]
avcodec: add ADPCM IMA MOFLEX decoder

3 years agoavcodec/dxtory: add support for vertically flipped frames
Paul B Mahol [Wed, 2 Sep 2020 15:38:26 +0000 (17:38 +0200)]
avcodec/dxtory: add support for vertically flipped frames

3 years agoavformat/musx: improve probing
Paul B Mahol [Thu, 3 Sep 2020 15:50:45 +0000 (17:50 +0200)]
avformat/musx: improve probing

3 years agoavcodec/nvenc_hevc: add ff_nvenc_encode_flush() for .flush
Limin Wang [Fri, 21 Aug 2020 11:22:32 +0000 (19:22 +0800)]
avcodec/nvenc_hevc: add ff_nvenc_encode_flush() for .flush

for the .capabilities have AV_CODEC_CAP_ENCODER_FLUSH, so it's better to add it.

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
3 years agodoc/filters: add example for drawtext fontsize expr
Andrei Rybak [Wed, 2 Sep 2020 22:57:17 +0000 (00:57 +0200)]
doc/filters: add example for drawtext fontsize expr

Expressions for option fontsize of video filter drawtext have been
supported since commit 6442e4ab3c.

Signed-off-by: Andrei Rybak <rybak.a.v@gmail.com>
Revised-by: Gyan Doshi <ffmpeg@gyani.pro>
3 years agoavcodec/proresdec2: let long name match one from codec_desc.c
Paul B Mahol [Wed, 2 Sep 2020 16:59:19 +0000 (18:59 +0200)]
avcodec/proresdec2: let long name match one from codec_desc.c

3 years agoavcodec/cbs_av1: add missing frame restoration type enum values
Fei Wang [Wed, 2 Sep 2020 07:31:28 +0000 (15:31 +0800)]
avcodec/cbs_av1: add missing frame restoration type enum values

Signed-off-by: Fei Wang <fei.w.wang@intel.com>
Signed-off-by: James Almer <jamrial@gmail.com>
3 years agocbs_av1: Fill tile width/height values when uniform_tile_spacing_flag is set
Mark Thompson [Mon, 31 Aug 2020 21:00:57 +0000 (22:00 +0100)]
cbs_av1: Fill tile width/height values when uniform_tile_spacing_flag is set

They are not explicitly in the bitstream in this case, but it is helpful
to be able to use these values without always needing to check the flag
beforehand.

3 years agocbs_mpeg2: Use table-based alloc/free
Mark Thompson [Mon, 27 Jul 2020 16:32:27 +0000 (17:32 +0100)]
cbs_mpeg2: Use table-based alloc/free

3 years agocbs_av1: Use table-based alloc/free
Mark Thompson [Mon, 27 Jul 2020 16:32:26 +0000 (17:32 +0100)]
cbs_av1: Use table-based alloc/free

3 years agocbs_vp9: Use table-based alloc/free
Mark Thompson [Mon, 27 Jul 2020 16:32:25 +0000 (17:32 +0100)]
cbs_vp9: Use table-based alloc/free

3 years agocbs_h265: Use table-based alloc/free
Mark Thompson [Mon, 27 Jul 2020 16:32:24 +0000 (17:32 +0100)]
cbs_h265: Use table-based alloc/free

3 years agoh264_redundant_pps: Make it reference-compatible
Andreas Rheinhardt [Mon, 27 Jul 2020 16:32:23 +0000 (17:32 +0100)]
h264_redundant_pps: Make it reference-compatible

Since c6a63e11092c975b89d824f08682fe31948d3686, the parameter sets
modified as content of PPS units were references shared with the
CodedBitstreamH264Context, so modifying them alters the parsing process
of future access units which meant that frames often got discarded
because invalid values were parsed. This patch makes h264_redundant_pps
compatible with the reality of reference-counted parameter sets.

Fixes #7807.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Mark Thompson <sw@jkqxz.net>
3 years agocbs_h2645: Ensure that non-refcounted parameter sets are fully copied
Mark Thompson [Mon, 27 Jul 2020 16:32:22 +0000 (17:32 +0100)]
cbs_h2645: Ensure that non-refcounted parameter sets are fully copied

Only copying the main structure is not necessarily sufficient - there
could be references to substructures.

3 years agocbs: Add support functions for handling unit content references
Mark Thompson [Mon, 27 Jul 2020 16:32:21 +0000 (17:32 +0100)]
cbs: Add support functions for handling unit content references

Use the unit type table to determine what we need to do to clone the
internals of the unit content when making copies for refcounting or
writeability.  (This will still fail for units with complex content
if they do not have a defined clone function.)

Setup and naming from a patch by Andreas Rheinhardt
<andreas.rheinhardt@gmail.com>, but with the implementation changed
to use the unit type information if possible rather than requiring a
codec-specific function.

3 years agocbs_h264: Use table-based alloc/free
Mark Thompson [Mon, 27 Jul 2020 16:32:20 +0000 (17:32 +0100)]
cbs_h264: Use table-based alloc/free

3 years agocbs: Add macros to support defining unit type tables
Mark Thompson [Mon, 27 Jul 2020 16:32:19 +0000 (17:32 +0100)]
cbs: Add macros to support defining unit type tables

3 years agocbs: Describe allocate/free methods in tabular form
Mark Thompson [Mon, 27 Jul 2020 16:32:18 +0000 (17:32 +0100)]
cbs: Describe allocate/free methods in tabular form

Unit types are split into three categories, depending on how their
content is managed:
* POD structure - these require no special treatment.
* Structure containing references to refcounted buffers - these can use
  a common free function when the offsets of all the internal references
  are known.
* More complex structures - these still require ad-hoc treatment.

For each codec we can then maintain a table of descriptors for each set of
equivalent unit types, defining the mechanism needed to allocate/free that
unit content.  This is not required to be used immediately - a new alloc
function supports this, but does not replace the old one which works without
referring to these tables.

3 years agocbs: Ensure that reference fields always follow the associated pointer
Mark Thompson [Mon, 27 Jul 2020 16:32:17 +0000 (17:32 +0100)]
cbs: Ensure that reference fields always follow the associated pointer

Having these together allows us to find both pointers given the address
of only one of them.

3 years agoavcodec/encode: unref the packet on AVCodec.receive_packet() failure
James Almer [Mon, 31 Aug 2020 02:57:23 +0000 (23:57 -0300)]
avcodec/encode: unref the packet on AVCodec.receive_packet() failure

Fixes memleaks with some encoders that don't unref the packet before
returning.
This is consistent with the behavior of AVCodec.encode()
implementations in encode_simple_internal().

Found-by: mkver
Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: James Almer <jamrial@gmail.com>
3 years agoavformat/wavdec: add support for chapters
Paul B Mahol [Mon, 31 Aug 2020 12:18:37 +0000 (14:18 +0200)]
avformat/wavdec: add support for chapters

Support parsing 'cue ' and 'adtl' chunks.

3 years agoavcodec/qpeg: speed-up copy of bytes
Paul B Mahol [Mon, 31 Aug 2020 21:25:22 +0000 (23:25 +0200)]
avcodec/qpeg: speed-up copy of bytes

3 years agoavcodec/magicyuv: Avoid intermediate array when parsing Huffman tables
Andreas Rheinhardt [Mon, 31 Aug 2020 19:14:54 +0000 (21:14 +0200)]
avcodec/magicyuv: Avoid intermediate array when parsing Huffman tables

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/magicyuv: Unify creating Huffman tables
Andreas Rheinhardt [Mon, 31 Aug 2020 18:49:13 +0000 (20:49 +0200)]
avcodec/magicyuv: Unify creating Huffman tables

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/magicyuv: Reuse array instead of using multiple arrays
Andreas Rheinhardt [Mon, 31 Aug 2020 17:55:28 +0000 (19:55 +0200)]
avcodec/magicyuv: Reuse array instead of using multiple arrays

The lengths of the VLC codes are implicitly contained in the VLC tables
itself; apart from that they are not used lateron. So it is unnecessary
to store them and the very same array can be reused to parse the Huffman
table for the next plane.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/magicyuv: Don't zero unnecessarily
Andreas Rheinhardt [Mon, 31 Aug 2020 17:51:03 +0000 (19:51 +0200)]
avcodec/magicyuv: Don't zero unnecessarily

The code already checks that exactly the expected amount of entries are
read and set. Ergo it is unnecessary to zero them at the beginning.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/magicyuv: Simplify check for invalid Huffman codes
Andreas Rheinhardt [Mon, 31 Aug 2020 17:47:50 +0000 (19:47 +0200)]
avcodec/magicyuv: Simplify check for invalid Huffman codes

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/magicyuv: Unify qsort comparison functions
Andreas Rheinhardt [Mon, 31 Aug 2020 17:18:03 +0000 (19:18 +0200)]
avcodec/magicyuv: Unify qsort comparison functions

Up until now, there were three comparison functions depending upon
bitness. But they all are actually the same, namely a lexical ordering:
entry a > entry b iff a.len > b.len or a.len == b.len and a.sym < b.sym.
So they can be easily unified.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/magicyuv: Avoid copying values around pointlessly
Andreas Rheinhardt [Mon, 31 Aug 2020 16:55:19 +0000 (18:55 +0200)]
avcodec/magicyuv: Avoid copying values around pointlessly

When parsing Huffman tables, an array of HuffEntries (a struct
containing a code's bitlength, its bits and its symbol) is used as
intermediate tables in order to sort the entries (the order depends on
both the length of the entries as well as on their symbols). After sorting
them, the symbol and len components are copied into other arrays (the
HuffEntries' code has never been set or used, despite using quite a lot
of stack space) and the codes are generated. Afterwards, the VLC is
created.

Yet ff_init_vlc_sparse() can handle non-continuous arrays as input;
there is no need to copy the entries at all. This commit implements
this.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/magicyuv: Don't invert Huffman table symbols twice
Andreas Rheinhardt [Mon, 31 Aug 2020 18:30:34 +0000 (20:30 +0200)]
avcodec/magicyuv: Don't invert Huffman table symbols twice

When the MagicYUV decoder builds Huffman tables from an array of code
lengths, it proceeds as follows: First it copies the entries of the
array of lengths into an array of HuffEntries (a struct which contains
a length and a symbol field); it also sets the symbol field in
descending order from nb_elem - 1 to 0, where nb_elem is the common number
of elements of the length and HuffEntry arrays. Then the HuffEntry array
is sorted lexicographically: a > b iff a.len > b.len or a.len == b.len and
a.sym > b.sym. Afterwards the symbols of the so sorted array are
inverted again (i.e. each symbol sym is replaced by nb_elem - sym).

Yet inverting can easily be avoided altogether: Just modify the order so
that smaller symbols correspond to bigger HuffEntries. This leads to the
same permutation as the current code does and given that the two
inversions just cancel each other out, the result is the same.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavformat/wavdec: allow to change max size of single demuxed packet
Paul B Mahol [Fri, 28 Aug 2020 00:02:41 +0000 (02:02 +0200)]
avformat/wavdec: allow to change max size of single demuxed packet

Can make demuxing much faster, expecially for files with
huge number of channels.

3 years agoavformat/wavdec: add support for demuxing Broadcast Wave 64Bit
Paul B Mahol [Thu, 27 Aug 2020 22:34:06 +0000 (00:34 +0200)]
avformat/wavdec: add support for demuxing Broadcast Wave 64Bit

3 years agoavdevice/lavfi: Don't set pkt->size to the value it already has
Andreas Rheinhardt [Sun, 30 Aug 2020 05:32:48 +0000 (07:32 +0200)]
avdevice/lavfi: Don't set pkt->size to the value it already has

av_new_packet() already sets the size. And if the packet is not
allocated by av_new_packet() (which seems to be impossible atm), both
pkt->size as well as size are 0, so setting it again is unnecessary in
this scenario, too.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavdevice/lavfi: Don't reimplement av_frame_get_side_data()
Andreas Rheinhardt [Sun, 30 Aug 2020 03:49:46 +0000 (05:49 +0200)]
avdevice/lavfi: Don't reimplement av_frame_get_side_data()

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavdevice/lavfi: Use av_packet_move_ref() for packet ownership transfer
Andreas Rheinhardt [Sun, 30 Aug 2020 03:45:47 +0000 (05:45 +0200)]
avdevice/lavfi: Use av_packet_move_ref() for packet ownership transfer

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/bitstream: Remove outdated comment
Andreas Rheinhardt [Sat, 29 Aug 2020 16:23:02 +0000 (18:23 +0200)]
avcodec/bitstream: Remove outdated comment

The comment referred to the INIT_VLC_USE_STATIC flag which has been
removed in 2009 in 595324e143b57a52e2329eb47b84395c70f93087; the
function it referred to was removed even earlier in commit
83422c1940d963d395a64bee0cbb9c637192ce8c in 2008.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agodoc/decoders: Document default value of ac3's drc_scale option
Aman Verma [Sun, 30 Aug 2020 18:05:53 +0000 (14:05 -0400)]
doc/decoders: Document default value of ac3's drc_scale option

Signed-off-by: Aman Verma <amanraoverma@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agolibavformat/dashenc: Reduce confusion in par error message
Chris Miceli [Mon, 31 Aug 2020 04:16:39 +0000 (14:16 +1000)]
libavformat/dashenc: Reduce confusion in par error message

In ticket #8754 there is discourse surrounding the error
message which is printed upon a mismatched aspect ratio in
derived encodings. This should make it clearer to the user
as to the issues which they are experiencing.

Reviewed-by: "Jeyapal, Karthick" <kjeyapal@akamai.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agohwcontext_vaapi: Don't require a render node when deriving from DRM
Mark Thompson [Fri, 28 Aug 2020 22:15:41 +0000 (23:15 +0100)]
hwcontext_vaapi: Don't require a render node when deriving from DRM

The V4L2 driver does not actually have an associated DRM device at all, so
users work around the requirement by giving libva an unrelated display-only
device instead (which is fine, because it doesn't actually do anything with
that device).  This was broken by bc9b6358fb7315c0173de322472641766f6289da
forcing a render node, because the display-only device did not have an
associated render node to use.  Fix that by just passing through the
original non-render DRM fd if we can't find a render node.

Reported-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
Tested-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
3 years agoavcodec/sheervideo: use cached bitstream reader except for x32
Paul B Mahol [Mon, 31 Aug 2020 18:09:28 +0000 (20:09 +0200)]
avcodec/sheervideo: use cached bitstream reader except for x32

3 years agoavfilter/f_graphmonitor: also show link EOF status in blue
Paul B Mahol [Mon, 31 Aug 2020 16:06:54 +0000 (18:06 +0200)]
avfilter/f_graphmonitor: also show link EOF status in blue

3 years agoavcodec/magicyuv: change bits used by 12bit tables
Paul B Mahol [Mon, 31 Aug 2020 17:53:30 +0000 (19:53 +0200)]
avcodec/magicyuv: change bits used by 12bit tables

Higher number slows decoder.

3 years agoavcodec/magicyuv: use cached bitstream reader except for x32
Paul B Mahol [Mon, 31 Aug 2020 14:23:23 +0000 (16:23 +0200)]
avcodec/magicyuv: use cached bitstream reader except for x32

3 years agoavcodec/magicyuv: invert symbols when building vlc
Paul B Mahol [Mon, 31 Aug 2020 14:19:55 +0000 (16:19 +0200)]
avcodec/magicyuv: invert symbols when building vlc

Instead at every decoded symbol.

3 years agoavfilter/vsrc_gradients: add speed option
Paul B Mahol [Mon, 31 Aug 2020 09:04:38 +0000 (11:04 +0200)]
avfilter/vsrc_gradients: add speed option

3 years agoavfilter/vsrc_gradients: do not use (l)lrint variants for double
Paul B Mahol [Mon, 31 Aug 2020 08:55:59 +0000 (10:55 +0200)]
avfilter/vsrc_gradients: do not use (l)lrint variants for double

3 years agoavfilter/vsrc_gradients: add duration option
Paul B Mahol [Mon, 31 Aug 2020 08:46:42 +0000 (10:46 +0200)]
avfilter/vsrc_gradients: add duration option

3 years agodnn/tensorflow: add log error message
Ting Fu [Thu, 27 Aug 2020 04:17:22 +0000 (12:17 +0800)]
dnn/tensorflow: add log error message

Signed-off-by: Ting Fu <ting.fu@intel.com>
3 years agodnn/openvino: add log error message
Ting Fu [Thu, 27 Aug 2020 04:17:21 +0000 (12:17 +0800)]
dnn/openvino: add log error message

Signed-off-by: Ting Fu <ting.fu@intel.com>
3 years agoavfilter/src_movie: Avoid intermediate buffer for writing string
Andreas Rheinhardt [Sat, 22 Aug 2020 02:08:15 +0000 (04:08 +0200)]
avfilter/src_movie: Avoid intermediate buffer for writing string

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/roqvideodec: Remove set-but-unused frame stats
Andreas Rheinhardt [Sun, 30 Aug 2020 12:20:18 +0000 (14:20 +0200)]
avcodec/roqvideodec: Remove set-but-unused frame stats

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/roqvideodec: Move transient GetByteContext to the stack
Andreas Rheinhardt [Sun, 30 Aug 2020 12:06:11 +0000 (14:06 +0200)]
avcodec/roqvideodec: Move transient GetByteContext to the stack

This avoids keeping potentially dangling pointers in the context,
beautifies the code (by replacing "&ri->gb" by gb for every access to
the GetByteContext) and also highlights the GetByteContext's short-lived
nature better.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/cdxl: also mark decoded frame as keyframe
Paul B Mahol [Sun, 30 Aug 2020 22:07:18 +0000 (00:07 +0200)]
avcodec/cdxl: also mark decoded frame as keyframe

3 years agoavcodec/qpeg: reduce unnecessary size of tables
Paul B Mahol [Sun, 30 Aug 2020 21:49:11 +0000 (23:49 +0200)]
avcodec/qpeg: reduce unnecessary size of tables

3 years agolibavcodec/jpeg2000: fix tag tree reset
Gautam Ramakrishnan [Thu, 27 Aug 2020 18:45:36 +0000 (00:15 +0530)]
libavcodec/jpeg2000: fix tag tree reset

The implementation of the tag tree did not
set the correct reset value for the encoder.
This lead to inefficent tag tree being encoded.
This patch fixes the implementation of the
ff_tag_tree_zero() function.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agolibavcodec/j2kenc: Support for multiple layers
Gautam Ramakrishnan [Thu, 27 Aug 2020 18:45:35 +0000 (00:15 +0530)]
libavcodec/j2kenc: Support for multiple layers

This patch allows setting a compression ratio and to
set multiple layers. The user has to input a compression
ratio for each layer.
The per layer compression ration can be set as follows:
-layer_rates "r1,r2,...rn"
for to create 'n' layers.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agolibavcodec/j2kenc: Fix tag tree coding
Gautam Ramakrishnan [Thu, 27 Aug 2020 18:45:34 +0000 (00:15 +0530)]
libavcodec/j2kenc: Fix tag tree coding

The implementation of tag tree encoding was incorrect.
However, this error was not visible as the current j2k
encoder encodes only 1 layer.
This patch fixes tag tree coding for JPEG2000 such tag
tree coding would work for multi layer encoding.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agolibavcodec/jpeg2000: Make tag tree functions non static
Gautam Ramakrishnan [Thu, 27 Aug 2020 18:45:33 +0000 (00:15 +0530)]
libavcodec/jpeg2000: Make tag tree functions non static

This patch makes the tag_tree_zero() and tag_tree_size()
functions non static and callable from other files.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavcodec/cfhd: Check transform type
Michael Niedermayer [Thu, 27 Aug 2020 22:17:41 +0000 (00:17 +0200)]
avcodec/cfhd: Check transform type

Fixes: out of array access
Fixes: 24823/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_CFHD_fuzzer-4855119863349248
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavcodec/aacdec_template: Initialize `layout_map` on declaration
Xiaohan Wang [Fri, 28 Aug 2020 19:51:19 +0000 (12:51 -0700)]
avcodec/aacdec_template: Initialize `layout_map` on declaration

Without this change, it'll cause use-of-uninitialized-variable error.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavcodec/mpegvideo_enc: Replace some s->avctx by avctx
Michael Niedermayer [Tue, 25 Aug 2020 19:31:57 +0000 (21:31 +0200)]
avcodec/mpegvideo_enc: Replace some s->avctx by avctx

Fixes issue reported by: Xu Guangxin <guangxin.xu@intel.com>
Original report:
Steps to reproduce:
1. ./configure --enable-debug=3 --disable-libx264 && make install
2. ffmpeg -i input.mp4 -profile:v baseline output.mp4 -y

you will see a crash like this:
[mpeg4 @ 0x5555575854c0] [Eval @ 0x7fffffffbf80] Undefined constant or missing '(' in 'baseline'
[mpeg4 @ 0x5555575854c0] Unable to parse option value "baseline"
[mpeg4 @ 0x5555575854c0] Error setting option profile to value baseline.
Thread 1 "ffmpeg" received signal SIGSEGV, Segmentation fault.

root cause:
If the codec has FF_CODEC_CAP_INIT_CLEANUP flag, and avcodec_open2 got an error before avctx->codec->init,
the ff_mpv_encode_end will face a null s->avctx.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>