]> git.sesse.net Git - ffmpeg/log
ffmpeg
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>
3 years agoadtsenc: Add ability to write MPEG2 ID
Marvin Scholz [Sat, 29 Aug 2020 11:57:13 +0000 (13:57 +0200)]
adtsenc: Add ability to write MPEG2 ID

Reviewed-by: Kieran Kunhya <kierank@obe.tv>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavcodec/cfhd: Replace a few literal numbers by named constants
Michael Niedermayer [Sat, 29 Aug 2020 19:45:54 +0000 (21:45 +0200)]
avcodec/cfhd: Replace a few literal numbers by named constants

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavfilter/vf_xfade: fix excessive number of queued frames
Paul B Mahol [Sun, 30 Aug 2020 09:07:51 +0000 (11:07 +0200)]
avfilter/vf_xfade: fix excessive number of queued frames

Also do not abort in some cases too early when transition is over.

Fixes #8823.

3 years agoavcodec/truemotion1: Cleanup generically after init failure
Andreas Rheinhardt [Sat, 29 Aug 2020 07:39:40 +0000 (09:39 +0200)]
avcodec/truemotion1: Cleanup generically after init failure

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/y41penc: Remove empty close function
Andreas Rheinhardt [Sat, 29 Aug 2020 15:59:17 +0000 (17:59 +0200)]
avcodec/y41penc: Remove empty close function

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/yuv4enc: Remove empty functions
Andreas Rheinhardt [Sat, 29 Aug 2020 15:55:15 +0000 (17:55 +0200)]
avcodec/yuv4enc: Remove empty functions

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/wnv1: Move temporary variables from context to stack
Andreas Rheinhardt [Sat, 29 Aug 2020 15:14:18 +0000 (17:14 +0200)]
avcodec/wnv1: Move temporary variables from context to stack

Here it even leads to the complete removal of the context.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/wnv1: Use LE bitstream reader, avoid copying packet, fix memleak
Andreas Rheinhardt [Sat, 29 Aug 2020 14:12:05 +0000 (16:12 +0200)]
avcodec/wnv1: Use LE bitstream reader, avoid copying packet, fix memleak

The Winnov WNV1 format is designed for a little-endian bitstream reader;
yet our decoder reversed every byte bitwise (in a buffer only
allocated for this purpose) to use a big-endian bitstream reader. This
commit stops this.

Two things needed to be done to achieve this: The codes in the table used
to initialize a VLC reader needed to be reversed bitwise (when
initializing a VLC in LE mode, it is expected that the first bit to be
read is in the least significant bit; with BE codes the first bit to be
read is the most significant bit of the code) and the following
expression needed to be adapted:

ff_reverse[get_bits(&w->gb, 8 - w->shift)]

But this is easy: When only the bits read are reversed, they coincide
with what a little-endian bitstream reader reads that reads the
original, not-reversed data. But ff_reverse always reverses the full
eight bits and this also performs a shift by (8 - (8 - w->shift)) on top
of reversing the bits read. So the above line needs to be changed to

get_bits(&w->gb, 8 - w->shift) << w->shift

and this also shows why the variable shift is named the way it is.

Finally, this also fixes a hypothetical memleak: For gigantic packets,
initializing a GetBitContext can fail and in this case, the buffer
containing the reversed data would leak.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/roqvideoenc: Cleanup generically after init failure
Andreas Rheinhardt [Sat, 29 Aug 2020 07:05:17 +0000 (09:05 +0200)]
avcodec/roqvideoenc: Cleanup generically after init failure

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/roqvideodec: Cleanup generically after init failure
Andreas Rheinhardt [Sat, 29 Aug 2020 07:04:42 +0000 (09:04 +0200)]
avcodec/roqvideodec: Cleanup generically after init failure

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/mss3: Cleanup generically after init failure
Andreas Rheinhardt [Sat, 29 Aug 2020 06:51:55 +0000 (08:51 +0200)]
avcodec/mss3: Cleanup generically after init failure

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/mss3: Remove unnecessary free of unallocated frame
Andreas Rheinhardt [Sat, 29 Aug 2020 06:49:45 +0000 (08:49 +0200)]
avcodec/mss3: Remove unnecessary free of unallocated frame

The frame will only be allocated a few lines below.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/interplayvideo: Cleanup generically after init failure
Andreas Rheinhardt [Sat, 29 Aug 2020 06:43:42 +0000 (08:43 +0200)]
avcodec/interplayvideo: Cleanup generically after init failure

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/eacmv: Cleanup generically after init failure
Andreas Rheinhardt [Sat, 29 Aug 2020 06:26:03 +0000 (08:26 +0200)]
avcodec/eacmv: Cleanup generically after init failure

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/cinepakenc: Cleanup generically after init failure
Andreas Rheinhardt [Sat, 29 Aug 2020 06:37:17 +0000 (08:37 +0200)]
avcodec/cinepakenc: Cleanup generically after init failure

Reviewed-by: Tomas Härdin <tjoppen@acc.umu.se>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/truemotion2: Avoid duplicating array, fix memleak
Andreas Rheinhardt [Sat, 29 Aug 2020 07:40:39 +0000 (09:40 +0200)]
avcodec/truemotion2: Avoid duplicating array, fix memleak

TrueMotion 2.0 uses Huffmann trees. To parse them, the decoder allocates
arrays for the codes, their lengths and their value; afterwards a VLC
table is initialized using these values. If everything up to this point
succeeds, a new buffer of the same size as the already allocated arrays
for the values is allocated and upon success the values are copied into
the new array; all the old arrays are then freed. Yet if allocating the
new array fails, the old arrays get freed, but the VLC table doesn't.

This leak is fixed by not allocating a new array at all; instead the old
array is simply reused, ensuring that nothing can fail after the
creation of the VLC table.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agolibavformat/mxfenc: color_range should be inclusive
Harry Mallon [Thu, 20 Aug 2020 13:58:53 +0000 (14:58 +0100)]
libavformat/mxfenc: color_range should be inclusive

MXF CDCI color range was being set to (1<<sc->component_depth) - 1
for full range but it should be (1<<sc->component_depth) as 0 is
a valid value.

Signed-off-by: Harry Mallon <harry.mallon@codex.online>
3 years agoavformat/mxfdec: Read video range from CDCIEssenceDescriptor
Harry Mallon [Thu, 20 Aug 2020 13:58:52 +0000 (14:58 +0100)]
avformat/mxfdec: Read video range from CDCIEssenceDescriptor

* Capture black_ref, white_ref and color_range and recognise
  full and narrow range.

Signed-off-by: Harry Mallon <harry.mallon@codex.online>
3 years agox86/cfhddsp: zero extend int arguments
James Almer [Fri, 28 Aug 2020 22:40:09 +0000 (19:40 -0300)]
x86/cfhddsp: zero extend int arguments

if taken from stack, they may have garbage in the upper bits otherwise.
Also, there are only 8 arguments, so don't attempt to load 11.

Fixes SIGSEV crashes in some targets.

Reviewed-by: durandal_1707
Signed-off-by: James Almer <jamrial@gmail.com>
3 years agoavformat/mov: See if mfra makes up the difference for an incomplete sidx.
Dale Curtis [Thu, 13 Aug 2020 22:02:02 +0000 (15:02 -0700)]
avformat/mov: See if mfra makes up the difference for an incomplete sidx.

A few popular sites have started generating MP4 files which have a
sidx plus an mfra. The sidx accounts for all size except the mfra,
so the old code did not mark the fragment index as complete.

Instead we can just check if there's an mfra and if its size makes
up the difference we can mark the index as complete.

Bug: https://crbug.com/1107130
Signed-off-by: Dale Curtis <dalecurtis@chromium.org>
Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
3 years agoavcodec/flacdec: use designated initializers for AVClass
Paul B Mahol [Thu, 27 Aug 2020 23:15:56 +0000 (01:15 +0200)]
avcodec/flacdec: use designated initializers for AVClass

3 years agoavcodec/cfhd: Remove unused-but-set variable
Andreas Rheinhardt [Fri, 21 Aug 2020 09:44:16 +0000 (11:44 +0200)]
avcodec/cfhd: Remove unused-but-set variable

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavfilter/af_arnndn: use memcpy for copying in compute_rnn()
Paul B Mahol [Thu, 27 Aug 2020 18:32:52 +0000 (20:32 +0200)]
avfilter/af_arnndn: use memcpy for copying in compute_rnn()

3 years agoavfilter/af_arnndn: use scalarproduct_float() in dct function
Paul B Mahol [Thu, 27 Aug 2020 16:49:02 +0000 (18:49 +0200)]
avfilter/af_arnndn: use scalarproduct_float() in dct function

3 years agoavfilter/af_compensationdelay: always initialize w_ptr with 0
Paul B Mahol [Thu, 27 Aug 2020 16:06:15 +0000 (18:06 +0200)]
avfilter/af_compensationdelay: always initialize w_ptr with 0

It will be changed later anyway, and in case inlink have 0 channels
(should never happen) it will not pick some random value.

3 years agoavfilter/vf_xfade: do not use alpha for average rgb color
Paul B Mahol [Thu, 27 Aug 2020 12:42:44 +0000 (14:42 +0200)]
avfilter/vf_xfade: do not use alpha for average rgb color

3 years agoavfilter/vf_xfade: add corner wipe transforms
Paul B Mahol [Thu, 27 Aug 2020 11:49:14 +0000 (13:49 +0200)]
avfilter/vf_xfade: add corner wipe transforms

3 years agoRevert "avfilter/yadif: simplify the code for better readability"
Limin Wang [Wed, 26 Aug 2020 23:30:30 +0000 (07:30 +0800)]
Revert "avfilter/yadif: simplify the code for better readability"

This reverts commit 2a9b934675b9e2d3850b46f8a618c19b03f02551.

3 years agoavfilter/af_headphone: Fix leak of channel layouts list on error
Andreas Rheinhardt [Mon, 24 Aug 2020 20:21:51 +0000 (22:21 +0200)]
avfilter/af_headphone: Fix leak of channel layouts list on error

In case the multichannel HRIR mode was enabled, an error could happen
between allocating a channel layouts list and attaching it to its target
destination. If an error happened, the list would leak. This is fixed by
attaching the list to its target directly after its allocation.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavfilter/af_headphone: Fix segfault upon allocation failure
Andreas Rheinhardt [Mon, 24 Aug 2020 03:26:57 +0000 (05:26 +0200)]
avfilter/af_headphone: Fix segfault upon allocation failure

The headphone filter uses a variable number of inpads and allocates them
in its init function; if all goes well, the number of inpads coincides
with a number stored in the filter's private context. Yet if allocating a
subsequent inpad fails, the uninit function nevertheless uses the number
stored in the private context to determine the number of inpads to free
and not the AVFilterContext's nb_inputs. This will lead to an access
beyond the end of the allocated AVFilterContext.input_pads array and
an invalid free.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavfilter/vf_signature: Avoid cast from function pointer to void*
Andreas Rheinhardt [Mon, 24 Aug 2020 22:55:56 +0000 (00:55 +0200)]
avfilter/vf_signature: Avoid cast from function pointer to void*

The signature filter uses qsort, but its compare function doesn't have
the signature required of such a function; therefore it casts the
function pointer to void. Yet this is wrong:
C90 only guarantees that one can convert a pointer to any incomplete
type or object type to void* and back with the result comparing equal
to the original which makes pointers to void generic pointers to
incomplete or object type. Yet C90 lacks a generic function pointer
type.
C99 additionally guarantees that a pointer to a function of one type may
be converted to a pointer to a function of another type with the result
and the original comparing equal when converting back.
This makes any function pointer type a generic function pointer type.
Yet even this does not make pointers to void generic function pointers.

Both GCC and Clang emit warnings for this when in pedantic mode.

This commit fixes this by modifying the compare function to comply with
the expected signature.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavfilter/vf_signature: Fix leak of string upon error
Andreas Rheinhardt [Mon, 24 Aug 2020 22:20:35 +0000 (00:20 +0200)]
avfilter/vf_signature: Fix leak of string upon error

If an error happens between allocating a string intended to be used as
an inpad's name and attaching it to its input pad, the string leaks.
Fix this by inserting the inpad directly after allocating its string.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavfilter/vf_signature: Fix leak of inpads' names
Andreas Rheinhardt [Mon, 24 Aug 2020 22:20:01 +0000 (00:20 +0200)]
avfilter/vf_signature: Fix leak of inpads' names

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavfilter/af_afir: Avoid allocating AVFilterPad names
Andreas Rheinhardt [Sat, 22 Aug 2020 03:20:01 +0000 (05:20 +0200)]
avfilter/af_afir: Avoid allocating AVFilterPad names

If the names are always the same, they need not be duplicated; doing so
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 agoavfilter/af_aiir: Fix segfault and leak upon allocation failure
Andreas Rheinhardt [Sat, 22 Aug 2020 02:47:14 +0000 (04:47 +0200)]
avfilter/af_aiir: Fix segfault and leak upon allocation failure

The aiir filter adds output pads in its init function. Each of these
output pads had a name which was allocated and to be freed in the uninit
function. Given that the aiir filter has between one and two outputs,
one output pad's name was freed unconditionally and a second was freed
conditionally.

Yet if adding output pads fails, there are no output pads at all and
trying to free a nonexistent pad's name will lead to a segfault.

Furthermore, if the name could be successfully allocated, yet adding the
new pad fails, the name would leak.

This commit fixes this by not allocating the pads' names at all any
more: They are constant anyway. This allows to remove the code to free
them and hence fixes the aforementioned bugs.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavfilter/avf_aphasemeter: Don't allocate outpad names
Andreas Rheinhardt [Sat, 22 Aug 2020 02:33:58 +0000 (04:33 +0200)]
avfilter/avf_aphasemeter: Don't allocate outpad names

These names are always the same, so not using duplicates 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 agoavfilter/vf_bm3d: Don't allocate inpad names
Andreas Rheinhardt [Sat, 22 Aug 2020 02:17:11 +0000 (04:17 +0200)]
avfilter/vf_bm3d: Don't allocate inpad names

These names are always the same, so not using duplicates 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 agoavfilter/f_ebur128: Don't allocate outpad names
Andreas Rheinhardt [Sat, 22 Aug 2020 02:13:28 +0000 (04:13 +0200)]
avfilter/f_ebur128: Don't allocate outpad names

These names are mostly the same, so not using duplicates 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 agoavfilter/vf_decimate: Don't allocate inpad names
Andreas Rheinhardt [Sat, 22 Aug 2020 02:03:21 +0000 (04:03 +0200)]
avfilter/vf_decimate: Don't allocate inpad names

These names are always the same, so not using duplicates 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 agoavfilter/vf_fieldmatch: Don't allocate inpad names
Andreas Rheinhardt [Sat, 22 Aug 2020 01:57:55 +0000 (03:57 +0200)]
avfilter/vf_fieldmatch: Don't allocate inpad names

These names are always the same, so not using duplicates 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 agoavfilter/vf_premultiply: Fix leak of names of inpads
Andreas Rheinhardt [Sat, 22 Aug 2020 01:51:46 +0000 (03:51 +0200)]
avfilter/vf_premultiply: Fix leak of names of inpads

These names leak because freeing them in the uninit function has been
forgotten. Instead of adding the freeing code, this commit stops
allocating these names. They are constants anyway.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavfilter/af_anequalizer: Don't allocate outpad names
Andreas Rheinhardt [Sat, 22 Aug 2020 01:29:25 +0000 (03:29 +0200)]
avfilter/af_anequalizer: Don't allocate outpad names

These names are always the same, so not using duplicates 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 agoavfilter/af_anequalizer: Fix memleak when inserting pad fails
Andreas Rheinhardt [Sat, 22 Aug 2020 01:23:51 +0000 (03:23 +0200)]
avfilter/af_anequalizer: Fix memleak when inserting pad fails

It has been forgotten to free the name of the second outpad if attaching
the first one to the AVFilterContext fails. Fixing this is easy: Only
prepare the second outpad after (and if) the first outpad has been
successfully attached to the AVFilterContext.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/x86/cfhddsp: try to fix build on x32
Paul B Mahol [Wed, 26 Aug 2020 21:38:10 +0000 (23:38 +0200)]
avcodec/x86/cfhddsp: try to fix build on x32

3 years agoavfilter/vf_xfade: add fadegrays transition
Paul B Mahol [Wed, 26 Aug 2020 21:23:33 +0000 (23:23 +0200)]
avfilter/vf_xfade: add fadegrays transition

3 years agoavcodec/cfhd: add x86 SIMD
Paul B Mahol [Sun, 9 Aug 2020 15:47:34 +0000 (17:47 +0200)]
avcodec/cfhd: add x86 SIMD

Overall speed changes for 1920x1080, yuv422p10le, 60fps from: 0.19x to 0.343x