1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-07 11:13:41 +02:00
Commit Graph

99024 Commits

Author SHA1 Message Date
Mark Thompson
cf6af829c2 cbs_mpeg2: Use table-based alloc/free 2020-09-02 00:00:57 +01:00
Mark Thompson
ae7686a64f cbs_av1: Use table-based alloc/free 2020-09-02 00:00:57 +01:00
Mark Thompson
f643f9bd6d cbs_vp9: Use table-based alloc/free 2020-09-02 00:00:57 +01:00
Mark Thompson
e38646de1c cbs_h265: Use table-based alloc/free 2020-09-02 00:00:57 +01:00
Andreas Rheinhardt
d1c6e09d09 h264_redundant_pps: Make it reference-compatible
Since c6a63e1109, 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>
2020-09-02 00:00:57 +01:00
Mark Thompson
0720e15c03 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.
2020-09-02 00:00:57 +01:00
Mark Thompson
42daac1c74 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.
2020-09-02 00:00:57 +01:00
Mark Thompson
2cb152d52f cbs_h264: Use table-based alloc/free 2020-09-02 00:00:57 +01:00
Mark Thompson
225f287885 cbs: Add macros to support defining unit type tables 2020-09-02 00:00:57 +01:00
Mark Thompson
bc7a7e0d65 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.
2020-09-02 00:00:57 +01:00
Mark Thompson
1fe77d4a63 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.
2020-09-02 00:00:50 +01:00
James Almer
0271098e6c 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>
2020-09-01 10:05:05 -03:00
Paul B Mahol
2a14d55a7c avformat/wavdec: add support for chapters
Support parsing 'cue ' and 'adtl' chunks.
2020-09-01 14:19:19 +02:00
Paul B Mahol
97c73ba565 avcodec/qpeg: speed-up copy of bytes 2020-09-01 14:19:19 +02:00
Andreas Rheinhardt
a13a23bdf2 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>
2020-09-01 11:05:38 +02:00
Andreas Rheinhardt
61499c6456 avcodec/magicyuv: Unify creating Huffman tables
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-09-01 11:05:38 +02:00
Andreas Rheinhardt
aae499f77a 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>
2020-09-01 11:05:38 +02:00
Andreas Rheinhardt
7f452c099a 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>
2020-09-01 11:05:38 +02:00
Andreas Rheinhardt
e8716b7e4c 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>
2020-09-01 11:05:38 +02:00
Andreas Rheinhardt
18dbbff525 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>
2020-09-01 11:05:38 +02:00
Andreas Rheinhardt
d0b0fc7cb9 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>
2020-09-01 11:05:38 +02:00
Andreas Rheinhardt
7332a23b84 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>
2020-09-01 11:05:38 +02:00
Paul B Mahol
809d6aeffc avformat/wavdec: allow to change max size of single demuxed packet
Can make demuxing much faster, expecially for files with
huge number of channels.
2020-09-01 10:35:03 +02:00
Paul B Mahol
93aa0bec84 avformat/wavdec: add support for demuxing Broadcast Wave 64Bit 2020-09-01 10:35:03 +02:00
Andreas Rheinhardt
901251d59b 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>
2020-09-01 09:50:05 +02:00
Andreas Rheinhardt
ebd485db92 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>
2020-09-01 09:50:05 +02:00
Andreas Rheinhardt
e4a650b61a 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>
2020-09-01 09:50:05 +02:00
Andreas Rheinhardt
6fad76b51d 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
83422c1940 in 2008.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-09-01 09:07:58 +02:00
Aman Verma
e4389ba075 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>
2020-08-31 23:43:06 +02:00
Chris Miceli
4136652289 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>
2020-08-31 23:43:06 +02:00
Mark Thompson
303d252a4b 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 bc9b6358fb
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>
2020-08-31 21:42:14 +01:00
Paul B Mahol
04d335e436 avcodec/sheervideo: use cached bitstream reader except for x32 2020-08-31 20:10:24 +02:00
Paul B Mahol
e417f84003 avfilter/f_graphmonitor: also show link EOF status in blue 2020-08-31 19:59:35 +02:00
Paul B Mahol
57915df230 avcodec/magicyuv: change bits used by 12bit tables
Higher number slows decoder.
2020-08-31 19:56:22 +02:00
Paul B Mahol
276d86a8b8 avcodec/magicyuv: use cached bitstream reader except for x32 2020-08-31 16:31:25 +02:00
Paul B Mahol
445e5fb67a avcodec/magicyuv: invert symbols when building vlc
Instead at every decoded symbol.
2020-08-31 16:31:10 +02:00
Paul B Mahol
eb9fa00bcc avfilter/vsrc_gradients: add speed option 2020-08-31 11:09:53 +02:00
Paul B Mahol
823eb009cb avfilter/vsrc_gradients: do not use (l)lrint variants for double 2020-08-31 11:09:53 +02:00
Paul B Mahol
64e93025f0 avfilter/vsrc_gradients: add duration option 2020-08-31 11:09:53 +02:00
Ting Fu
4a11a6f4cc dnn/tensorflow: add log error message
Signed-off-by: Ting Fu <ting.fu@intel.com>
2020-08-31 13:12:10 +08:00
Ting Fu
74358ff4a4 dnn/openvino: add log error message
Signed-off-by: Ting Fu <ting.fu@intel.com>
2020-08-31 13:12:10 +08:00
Andreas Rheinhardt
a97d8469a6 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>
2020-08-31 03:41:38 +02:00
Andreas Rheinhardt
e6c5102fb4 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>
2020-08-31 03:00:09 +02:00
Andreas Rheinhardt
a067d44955 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>
2020-08-31 02:59:36 +02:00
Paul B Mahol
72942ad6d4 avcodec/cdxl: also mark decoded frame as keyframe 2020-08-31 00:15:22 +02:00
Paul B Mahol
ef46de695f avcodec/qpeg: reduce unnecessary size of tables 2020-08-30 23:52:21 +02:00
Gautam Ramakrishnan
341064d68a 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>
2020-08-30 16:18:37 +02:00
Gautam Ramakrishnan
f0e33119e4 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>
2020-08-30 16:18:37 +02:00
Gautam Ramakrishnan
3c06045a8b 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>
2020-08-30 16:18:37 +02:00
Gautam Ramakrishnan
87567fc398 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>
2020-08-30 16:18:37 +02:00