5 months agoavformat/mov: Discard last STSC if its empty
Michael Niedermayer [Tue, 4 Feb 2020 08:45:35 +0000 (09:45 +0100)]
avformat/mov: Discard last STSC if its empty

Fixes: Ticket8508

5 months agoswscale/output: Fix integer overflow in yuv2rgb_write_full() with out of range input
Michael Niedermayer [Sun, 16 Feb 2020 19:11:52 +0000 (20:11 +0100)]
swscale/output: Fix integer overflow in yuv2rgb_write_full() with out of range input

Fixes: signed integer overflow: 1169365504 + 981452800 cannot be represented in type 'int'
Fixes: ticket8293

Found-by: Suhwan
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
5 months agoswscale/output: Fix integer overflow in alpha computation in yuv2gbrp16_full_X_c()
Michael Niedermayer [Sun, 16 Feb 2020 19:18:11 +0000 (20:18 +0100)]
swscale/output: Fix integer overflow in alpha computation in yuv2gbrp16_full_X_c()

Fixes: signed integer overflow: 524280 * 4432 cannot be represented in type 'int'
Fixes: ticket8322

Found-by: Suhwan
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
5 months agofftools/ffmpeg: Disable copy_ts on timestamp wraparound
Michael Niedermayer [Fri, 3 May 2019 11:38:57 +0000 (13:38 +0200)]
fftools/ffmpeg: Disable copy_ts on timestamp wraparound

This allows handling more than 26.5h of mpeg* input

Fixes: Ticket 7876

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
5 months agolibavcodec/jpeg2000dec.c: Fix indentation
Gautam Ramakrishnan [Fri, 3 Apr 2020 18:27:58 +0000 (23:57 +0530)]
libavcodec/jpeg2000dec.c: Fix indentation

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
5 months agolibavcodec/jpeg2000dec.c: Handle non EOC streams
Gautam Ramakrishnan [Fri, 3 Apr 2020 18:27:57 +0000 (23:57 +0530)]
libavcodec/jpeg2000dec.c: Handle non EOC streams

This patch allows decoding of j2k streams which do
not have an EOC marker.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
5 months agoavfilter/vf_v360: add pannini input support
Paul B Mahol [Sat, 4 Apr 2020 12:12:43 +0000 (14:12 +0200)]
avfilter/vf_v360: add pannini input support

5 months agoffplay: flush correct stream after stats update
Gyan Doshi [Fri, 3 Apr 2020 16:29:31 +0000 (21:59 +0530)]
ffplay: flush correct stream after stats update

Stats and logs are written to stderr, not stdout.

5 months agoffplay: always show stats at all log levels if requested by user
Gyan Doshi [Fri, 3 Apr 2020 11:06:31 +0000 (16:36 +0530)]
ffplay: always show stats at all log levels if requested by user

Since 3b491c5a500, stats would be hidden if loglevel was lower than
info, even if -stats was set.

Fixes #6962

5 months agoavformat/matroska: clean the structure formatting
Steve Lhomme [Sun, 22 Mar 2020 08:59:21 +0000 (09:59 +0100)]
avformat/matroska: clean the structure formatting

Always use a comma at the end, order elements by value.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
5 months agoavformat/dss: Remove unnecessary allocation
Andreas Rheinhardt [Thu, 2 Apr 2020 16:41:11 +0000 (18:41 +0200)]
avformat/dss: Remove unnecessary allocation

Put a buffer with a known fixed size into the demuxer's context instead
of allocating it separately. This also allows to remove the demuxer's

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
5 months agoavformat/ilbc: Don't reimplement ff_raw_write_packet
Andreas Rheinhardt [Thu, 2 Apr 2020 16:05:15 +0000 (18:05 +0200)]
avformat/ilbc: Don't reimplement ff_raw_write_packet

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
5 months agoavfilter/vf_v360: improve description of output fov options
Paul B Mahol [Fri, 3 Apr 2020 15:14:58 +0000 (17:14 +0200)]
avfilter/vf_v360: improve description of output fov options

5 months agoavformat/matroskaenc: Improve BlockAdditions
Andreas Rheinhardt [Wed, 20 Nov 2019 14:10:34 +0000 (15:10 +0100)]
avformat/matroskaenc: Improve BlockAdditions

8ffcc826 added support for muxing BlockAdditions with BlockAddID equal
to one. The restriction to BlockAddID == 1 probably resulted from
a limitation to what was needed; yet over time this led to three
occurences of "(side_data_size && additional_id == 1)". This commit
changes this by setting side_data_size to 0 if additional_id != 1.

It also stops hardcoding 1 for the value of BlockAddID to write;
but it still upholds the requirement that it is 1. See below.

Despite BlockAddId actually having a default value of 1, it is still
written, because until very recently (namely dbc50f8a) our demuxer
used a wrong default value of 0.

Furthermore, use put_ebml_binary() to write the BlockAdditional element.

(The Matroska specifications have evolved and now the BlockAddID 1 is
reserved for the codec (as described in the codec's codec mapping),
BlockMore elements with BlockAddID > 1 are now of a more
codec-independent nature and require a BlockAdditionalMapping in the
track's TrackEntry. Given that this muxer does not support writing said
BlockAdditionalMapping yet (actually, none have been defined yet), we
have to uphold the requirement that BlockAddID == 1.)

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
5 months agoavformat/matroskaenc: Improve checks for updating Tags
Andreas Rheinhardt [Wed, 22 Jan 2020 18:37:29 +0000 (19:37 +0100)]
avformat/matroskaenc: Improve checks for updating Tags

When updating the Tags at the end, the Matroska muxer would twice check
for whether (!mkv->is_live) is true, despite this code being only executed
if it is. Furthermore, a loop iterates over all the streams even when
there is no Tags element to update at all, because the check for whether
there are Tags is only performed later. This commit fixes this.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
5 months agoavformat/matroskaenc: Remove unnecessary avio_tell(), avio_seek()
Andreas Rheinhardt [Wed, 22 Jan 2020 17:45:08 +0000 (18:45 +0100)]
avformat/matroskaenc: Remove unnecessary avio_tell(), avio_seek()

avio_close_dyn_buf() has a bug: When the write pointer does not point to
the end of the written data when calling it (i.e. when one has performed
a seek back to update already written data), it would not add padding to
the end of the buffer, but to the current position, overwriting other
data; furthermore the reported size would be wrong (off by the amount of
data it has overwritten with padding).

In order not to run into this when updating already written elements or
elements for which size has only been reserved, the Matroska muxer would
first record the current position of the dynamic buffer, then seek to
the desired position, perform the update and seek back to the earlier

But now that end_ebml_master_crc32() does not make use of
avio_close_dyn_buf() any more, this is no longer necessary.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
5 months agoavformat/matroskaenc: Stop reallocating of Cluster buffer
Andreas Rheinhardt [Sun, 29 Dec 2019 00:01:52 +0000 (01:01 +0100)]
avformat/matroskaenc: Stop reallocating of Cluster buffer

The Matroska muxer uses a dynamic buffer to buffer the content of
Clusters before eventually writing them. Up until now, each time a
Cluster was written, the dynamic buffer was closed, i.e. freed; now it
is only reset, saving allocations of the AVIOContext itself, its opaque
as well as most of the reallocations of the buffer.

This is advantageous performance-wise, in particular on systems where
reallocations are slow (namely Windows). The following table shows the
decicyles for writing a frame on Linux (Ubuntu 19.10) and Windows (7)
on an x64 Haswell (to /dev/null on Linux, to stdout which is discarded
on Windows (the default values of the size and duration of clusters for
seekable output have been explicitly set in this case); in all tests,
writing CRC-32 values has been disabled in all tests; calls to the muxer's
write_packet function in write_packet() in libavformat/mux.c have been
timed; each of the following tests has been repeated 50 times):

    | Windows before | Windows after | Linux before | Linux after
 A  |     979437     |    192304     |    259500    |   183320
 B  |     715936     |    155648     |    152786    |   130879
 C  |     265115     |     56034     |     78496    |    53243
 D  |     386224     |     80307     |    128894    |    75354
 E  |      21732     |     10695     |     11320    |     9801

(A is a 10.2 mb/s file with a GOP length of 2s, amounting to an average
Cluster size of about 2.5 MiB; the average Cluster size of B is 1.1 MiB;
for C it is 2.35 MiB, for D it is 0.46 MiB; for E - a file with just a
single audio track of 158kb/s resulting in a Cluster size of about 100
kB, the relative gains were the smallest, probably because of the small
Cluster size.)

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
5 months agoconfigure: fix build issue of vf_dnn_processing.c when --disable-swscale
Guo, Yejun [Thu, 2 Apr 2020 03:18:08 +0000 (11:18 +0800)]
configure: fix build issue of vf_dnn_processing.c when --disable-swscale

vf_dnn_processing.c recently changed to use swscale to trasfer data
between AVFrame and dnn model.

Signed-off-by: Guo, Yejun <yejun.guo@intel.com>
Signed-off-by: Linjie Fu <linjie.fu@intel.com>
5 months agolibavformat/amr.c: Check return value from avio_read()
John Rummell [Tue, 31 Mar 2020 04:30:33 +0000 (21:30 -0700)]
libavformat/amr.c: Check return value from avio_read()

If the buffer doesn't contain enough bytes when reading a stream,
fail rather than continuing on with initialized data. Caught by
Chromium fuzzeras (crbug.com/1065731).

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
5 months agoswscale/swscale: remove useless code
Ruiling Song [Wed, 1 Apr 2020 07:32:15 +0000 (15:32 +0800)]
swscale/swscale: remove useless code

Signed-off-by: Ruiling Song <ruiling.song@intel.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
5 months agoconfigure: Do not abort when cross-compiling to the native CPU
David Michael [Wed, 1 Apr 2020 04:07:55 +0000 (00:07 -0400)]
configure: Do not abort when cross-compiling to the native CPU

Using a compiler with a different host triplet is considered
cross-compiling, even when it is for the same architecture as the
build system.  With such a cross-compiler, it is still valid to
optimize builds with --cpu=host.  Make the condition that aborts in
this case into a warning instead, since a cross-compiler for an
incompatible architecture will fail with -mtune=native anyway.

Signed-off-by: David Michael <fedora.dm0@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
5 months agofate/matroska: Add test for updating CodecPrivate from packet sidedata
Andreas Rheinhardt [Wed, 1 Apr 2020 18:22:29 +0000 (20:22 +0200)]
fate/matroska: Add test for updating CodecPrivate from packet sidedata

containing updated extradata, in this case a new FLAC streaminfo.
Furthermore, it also tests that the Matroska muxer is able to preserve
uncommon channel layouts by adding Vorbis comments to the CodecPrivate.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
5 months agoavformat/hnm: Only keep and parse what is needed later
Andreas Rheinhardt [Sat, 21 Mar 2020 05:17:36 +0000 (06:17 +0100)]
avformat/hnm: Only keep and parse what is needed later

The hnm demuxer's context struct contained lots of fields that are
write-only variables or that are not used outside of parsing the header
and that can therefore be replaced by local variables of hnm_read_header().
This commit removes all of these from the context; the second type has
been replaced by local variables.

An AVPacket (that was initialized when reading the header and for which
dead code to unreference it existed in hnm_read_close()) is among the
removed things. Removing it allowed to remove hnm_read_close()
altogether and also removes another instance of usage of sizeof(AVPacket).

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
5 months agoavformat/matroskaenc: Don't implicitly mark WebVTT in WebM as English
Andreas Rheinhardt [Sat, 18 Jan 2020 01:19:46 +0000 (02:19 +0100)]
avformat/matroskaenc: Don't implicitly mark WebVTT in WebM as English

Writing the language of WebVTT in WebM proceeded differently than the
language of all other tracks: In case no language was given, it does not
write anything instead of "und" (for undefined). Because the default
value of the Language element in WebM (that inherited it from Matroska)
is "eng" (for English), any such track will actually be flagged as

Doing it this way goes back to commit 509642b4 (the commit adding
support for WebVTT) and no reason for this has been given in the commit
message or in the discussion about this patch on the mailing list; the
best I can think of is this: the WebM wiki contains "The srclang attribute
is stored as the Language sub-element." Someone unfamiliar with default
values in Matroska/WebM could interpret this as meaning that no Language
element should be written if the language is unknown. And this is wrong
and this commit changes it.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
5 months agoavformat/matroskaenc: Reindent after previous commit
Andreas Rheinhardt [Fri, 17 Jan 2020 19:40:15 +0000 (20:40 +0100)]
avformat/matroskaenc: Reindent after previous commit

Also remove { } after an if if there is only one statement inside { }.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
5 months agoavformat/matroskaenc: Combine checks for audio
Andreas Rheinhardt [Fri, 17 Jan 2020 19:14:24 +0000 (20:14 +0100)]
avformat/matroskaenc: Combine checks for audio

mkv_write_track() currently has three places where it checks for whether
the current codec type is audio: One in a switch and two outside of it.
These checks can be combined by moving the code after the other two checks
inside the audio-related part of the switch.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
5 months agoavformat/matroskaenc: Simplify writing Void elements
Andreas Rheinhardt [Sun, 12 Jan 2020 00:30:58 +0000 (01:30 +0100)]
avformat/matroskaenc: Simplify writing Void elements

Reserving space in Matroska works by writing a Void element. And until
now this worked as follows: The current position was recorded and the
EBML ID as well as the length field written; then the new position was
recorded to know how much more to write. Afterwards the actual writing
has been performed via ffio_fill().

But it is unnecessary to explicitly use the positions (obtained via
avio_tell()) to find out how much still needs to be written, because the
length of the ID and the length field are known. So rewrite the function
to no longer use them.

Also, given that ffio_fill() uses an int parameter and given that no
current caller (and no sane future caller) will want to reserve several
GB of space, make the size parameter of put_ebml_void() itself an int.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
5 months agoavformat/matroskaenc: Avoid seek when writing Cues at the front
Andreas Rheinhardt [Sun, 29 Dec 2019 09:15:19 +0000 (10:15 +0100)]
avformat/matroskaenc: Avoid seek when writing Cues at the front

When the Cues are written in front of the Cluster, the muxer would seek
to the beginning (to where the Cues ought to be written) and write the
Cues; afterwards it would seek back to the end of the file only to seek
to the beginning once again to update several elements there. This
commit removes the seek to the end.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
5 months agoavformat/matroskaenc: Fix edge case of writing Cues at the beginning
Andreas Rheinhardt [Sat, 28 Dec 2019 17:39:38 +0000 (18:39 +0100)]
avformat/matroskaenc: Fix edge case of writing Cues at the beginning

The Matroska muxer has the ability to write the Cues (the index) at the
beginning of the file (in front of the Cluster): The user inputs the
amount of space that should be reserved at the beginning of the file and
if this is sufficient, the Cues will be written there and the part of the
reserved space not used up by the Cues will be filled with a "Void"

There is just one problem with this: One can not fill a single byte this
way, because said Void element is minimally two bytes long (one byte ID,
one byte length field). Up until now, if one reserved one byte more than
needed, one would run into an assert when writing the Void element.

There are two solutions for this: Error out if it happens. Or adjust the
length field of the Cues in order to ensure that the above situation
can't happen (i.e. write the length on one byte more than necessary).
The first solution is very unsatisfactory, as enough space has been
reserved. Therefore this commit implements the second solution.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
5 months agoavformat/matroskaenc: Don't fail if reserved Cues space doesn't suffice
Andreas Rheinhardt [Mon, 30 Dec 2019 15:28:39 +0000 (16:28 +0100)]
avformat/matroskaenc: Don't fail if reserved Cues space doesn't suffice

When the user opted to write the Cues at the beginning, the Cues were
simply written without checking in advance whether enough space has been
reserved for them. If it wasn't enough, the data following the space
reserved for the Cues was simply overwritten, corrupting the file.

This commit changes this by checking whether enough space has been
reserved for the Cues before outputting anything. If it isn't enough,
no Cues will be output at all and the file will be finalized normally,
yet writing the trailer will nevertheless return an error to notify
the user that his wish of having Cues at the front of the file hasn't
been fulfilled.

This change opens new usecases for this option: It is now safe to use
this option to e.g. record live streams or to use it when muxing the
output of an expensive encoding, because when the reserved space turns
out to be insufficient, one ends up with a file that just lacks Cues
but is otherwise fine.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
5 months agoavfilter/x86/vf_v360_init: add missing cases
Paul B Mahol [Thu, 2 Apr 2020 10:03:11 +0000 (12:03 +0200)]
avfilter/x86/vf_v360_init: add missing cases

5 months agoavfilter/vf_v360: add SIMD for lagrange9 interpolation
Paul B Mahol [Tue, 31 Mar 2020 12:08:20 +0000 (14:08 +0200)]
avfilter/vf_v360: add SIMD for lagrange9 interpolation

5 months agoavfilter/vf_v360: add lagrange9 interpolation
Paul B Mahol [Tue, 31 Mar 2020 11:22:10 +0000 (13:22 +0200)]
avfilter/vf_v360: add lagrange9 interpolation

5 months agoavformat/matroskaenc: Update the default version of WavPack
Andreas Rheinhardt [Sat, 14 Dec 2019 01:47:13 +0000 (02:47 +0100)]
avformat/matroskaenc: Update the default version of WavPack

The Matroska muxer currently assumed WavPack version 4.03 in case it was
not explicitly signalled via extradata; but following a recommendation
from David Bryant, the WavPack creator, this is changed to 4.10.

Reviewed-by: David Bryant <david@wavpack.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
5 months agoavformat/wvdec: Export version as extradata
Andreas Rheinhardt [Thu, 26 Mar 2020 03:41:42 +0000 (04:41 +0100)]
avformat/wvdec: Export version as extradata

It might be used by the Matroska muxer. This is also the reason why the
FATE-tests for muxing WavPack into Matroska needed to be updated: They
now write the correct version 4.07 and not 4.03 as before.

Reviewed-by: David Bryant <david@wavpack.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
5 months agoavformat/matroskadec: Add a workaround for missing WavPack extradata
Andreas Rheinhardt [Sat, 14 Dec 2019 00:36:54 +0000 (01:36 +0100)]
avformat/matroskadec: Add a workaround for missing WavPack extradata

mkvmerge versions 6.2 to 40.0 had a bug that made it not propagate the
WavPack extradata (containing the WavPack version) during remuxing from
a Matroska file; currently our demuxer would treat every WavPack block
encountered as invalid data (unless the WavPack stream is to be
discarded (i.e. the streams discard is >= AVDISCARD_ALL)) and try to
resync to the next level 1 element.

Luckily, the WavPack version is currently not really important; so we
fix this problem by assuming a version. David Bryant, the creator of
WavPack, recommended using version 0x410 (the most recent version) for
this. And this is what this commit does.

A FATE-test for this has been added.

Reviewed-by: David Bryant <david@wavpack.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
5 months agolibavformat/mov.c: Free aes_decrypt to avoid leaking memory
John Rummell [Mon, 30 Mar 2020 21:08:01 +0000 (14:08 -0700)]
libavformat/mov.c: Free aes_decrypt to avoid leaking memory

Found by Chromium fuzzers (crbug.com/1057205).

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
5 months agolibavformat/oggdec.c: Check return value from avio_read()
John Rummell [Mon, 30 Mar 2020 21:56:11 +0000 (14:56 -0700)]
libavformat/oggdec.c: Check return value from avio_read()

If the buffer doesn't contain enough bytes when reading a stream,
fail rather than continuing on with unitialized data. Caught by
Chromium fuzzers (crbug.com/1054229).

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
5 months agoavformat/movenc: add write_clli flag to write clli atom
Michael Bradshaw [Fri, 27 Mar 2020 23:19:02 +0000 (17:19 -0600)]
avformat/movenc: add write_clli flag to write clli atom

The clli atom isn't in ISO/IEC 14496-12:2015 so the flag is marked as
experimental and the clli atom is not written by default.

The clli atom is already parsed by FFmpeg in mov.c.

Signed-off-by: Michael Bradshaw <mjbshaw@google.com>
5 months agolavfi/deshake_opencl: Do not use bool, powerpc does not like it.
Carl Eugen Hoyos [Tue, 31 Mar 2020 20:20:10 +0000 (22:20 +0200)]
lavfi/deshake_opencl: Do not use bool, powerpc does not like it.

Fixes ticket #8591.

5 months agoavformat/avformat.h: Correct some comments
Andreas Rheinhardt [Fri, 9 Aug 2019 14:04:28 +0000 (16:04 +0200)]
avformat/avformat.h: Correct some comments

1. When set_parameters was removed from AVOutputFormat in 2fb75019, it
was forgotten to remove the comment pertaining to it. Said comment now
appeared to apply to interleave_packet(); it is of course nonsense and
has been replaced by an accurate description.
2. The description of av_write_uncoded_frame() suggested
av_interleaved_write_frame() as a replacement if the input is not
already correctly interleaved; it also referred to said function for
details. Given that said function can't write AVFrames and that the
specifics of writing uncoded frames are explained in the description
of av_interleaved_write_uncoded_frame(), both references have been fixed.
3. Removed an outdated comment about avformat_seek_file().

Reviewed-by: Marton Balint <cus@passwd.hu>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
5 months agoavcodec/v4l2_m2m_dec: Init reserved bytes to zero before ioctl call
Andriy Gelman [Sun, 8 Mar 2020 15:49:47 +0000 (11:49 -0400)]
avcodec/v4l2_m2m_dec: Init reserved bytes to zero before ioctl call

struct v4l2_selection contains reserved bytes which should be set to
zero before the ioctl call.

Fixes valgrind error:
Syscall param ioctl(VKI_V4L2_S_SELECTION) points to uninitialised byte(s)

Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
5 months agoavformat/audiointerleave: Fix memleak
Andreas Rheinhardt [Fri, 9 Aug 2019 01:43:57 +0000 (03:43 +0200)]
avformat/audiointerleave: Fix memleak

If ff_interleave_add_packet failed, the content of the newly created
packet new_pkt would leak.

Also, it is unnecessary to zero-initialize a packet that will be put
into av_new_packet lateron as the latter already initializes the packet.
Therefore this has been removed, too.

Reviewed-by: Marton Balint <cus@passwd.hu>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
5 months agoavformat/mux: Only prepare input packet if there is a packet
Andreas Rheinhardt [Fri, 9 Aug 2019 01:19:42 +0000 (03:19 +0200)]
avformat/mux: Only prepare input packet if there is a packet

It is unnecessary to call prepare_input_packet if there is no packet as
it doesn't do anything, except when the currently inactive code guarded
Then attempting to access pkt->stream_index will crash.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
5 months agoavutil/opt: Don't use NULL for %s string in a log message
Andreas Rheinhardt [Sun, 29 Mar 2020 03:03:56 +0000 (05:03 +0200)]
avutil/opt: Don't use NULL for %s string in a log message

If one calls av_opt_set() with an incorrect string to set the value of
an option of type AV_OPT_TYPE_VIDEO_RATE, the given string is used in a
log message via %s. This also happens when the string is actually a
nullpointer in which case using it for %s is forbidden.

This commit changes this by erroring out early in case of a nullpointer.

This also fixes a warning from GCC 9.2:
"‘%s’ directive argument is null [-Wformat-overflow=]"

Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
5 months agoavcodec/v4l2_m2m: fix setting frame period
Ming Qian [Tue, 17 Mar 2020 11:29:23 +0000 (19:29 +0800)]
avcodec/v4l2_m2m: fix setting frame period

Currently the driver's frame period is incorrectly set to the frame
rate. This is fixed in the commit.

Signed-off-by: Ming Qian <ming.qian@nxp.com>
Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
5 months agoavcodec/hcadec: Check scale_factors
Michael Niedermayer [Sat, 28 Mar 2020 21:04:06 +0000 (22:04 +0100)]
avcodec/hcadec: Check scale_factors

Fixes: out of array read
Fixes: 21286/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HCA_fuzzer-5683183715876864

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>
5 months agomailmap: fix 3-address entries
rcombs [Tue, 31 Mar 2020 09:13:08 +0000 (04:13 -0500)]
mailmap: fix 3-address entries

git only supports <new> <old>, not <new> <old1> <old2>

5 months agoffmpeg: Print an error instead of a debug message on exit.
Carl Eugen Hoyos [Mon, 30 Mar 2020 22:41:13 +0000 (00:41 +0200)]
ffmpeg: Print an error instead of a debug message on exit.

Reported-by: Forum user NewPlaza
5 months agoavformat/mxfdec: Correct confusing struct tag
Andreas Rheinhardt [Sun, 29 Mar 2020 03:33:04 +0000 (05:33 +0200)]
avformat/mxfdec: Correct confusing struct tag

Don't use typedef struct MXFTrack {...} MXFTimecodeComponent, in
particular given the fact that MXFTrack is a type of its own.

Reviewed-by: Tomas Härdin <tjoppen@acc.umu.se>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
5 months agoavformat/matroskaenc: Check that Cluster has been opened
Andreas Rheinhardt [Tue, 26 Nov 2019 03:40:29 +0000 (04:40 +0100)]
avformat/matroskaenc: Check that Cluster has been opened

before setting the field indicating that a Cluster has been opened.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
5 months agoavformat/matroskaenc: Remove unused function parameter
Andreas Rheinhardt [Tue, 29 Oct 2019 20:04:21 +0000 (21:04 +0100)]
avformat/matroskaenc: Remove unused function parameter

end_ebml_master_crc32_preliminary() has a MatroskaMuxContext as
parameter that isn't used at all. So remove it.
Furthermore it doesn't close its dynamic buffer; it just uses the
underlying buffer and therefore it only needs a pointer to the
dynamic buffer, not a pointer to a pointer.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
5 months agoavformat/matroskaenc: Write level 1 elements in one go
Andreas Rheinhardt [Mon, 30 Dec 2019 14:59:02 +0000 (15:59 +0100)]
avformat/matroskaenc: Write level 1 elements in one go

Up until now, writing level 1 elements proceeded as follows: First, the
element id was written to the ordinary output AVIOContext and a dynamic
buffer was opened for the content of the level 1 element in
start_ebml_master_crc32(). Then this buffer was actually used and after it
was closed (in end_ebml_master_crc32()), the size field corresponding to
the buffer's size was written, after which the actual data was written.

This commit changes this: Nothing is written to the main AVIOContext any
more in start_ebml_master_crc32(). end_ebml_master_crc32() now writes
both the id, the length field as well as the data. This implies that
one can start a level 1 element in memory without outputting anything.
This is done to enable to test whether enough space has been reserved
for the Cues (if space has been reserved for them) before writing them.
A large duration between outputting the header and outputting the rest
could also break certain streaming usecases like the one from #8578
(which this commit fixes).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
5 months agoavformat/matroskaenc: Simplify writing Cues
Andreas Rheinhardt [Mon, 30 Dec 2019 14:48:35 +0000 (15:48 +0100)]
avformat/matroskaenc: Simplify writing Cues

When the Matroska muxer writes the Cues (the index), it groups index
entries with the same timestamp into the same CuePoint to save space.
But given Matroska's variable-length length fields, it either needs
to have an upper bound of the final size of the CuePoint before writing it
or the CuePoint has to be assembled in a different buffer, so that after
having assembled the CuePoint (when the real size is known), the CuePoint's
header can be written and its data copied after it.

The first of these approaches is the currently used one. This entails
finding out the number of entries in a CuePoint before starting the
CuePoint and therefore means that the list is read at least twice.
Furthermore, a worst-case upper-bound for the length of a single entry
was used, so that sometimes bytes are wasted on length fields.

This commit switches to the second approach. This is no longer more
expensive than the current approach if one only resets the dynamic
buffer used to write the CuePoint's content instead of opening a new
buffer for every CuePoint: Writing the trailer of a file with 540.000
CuePoints improved actually from 219054414 decicycles to 2164379394
decicycles (based upon 50 iterations).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
5 months agoavformat/aviobuf: Add function to reset dynamic buffer
Andreas Rheinhardt [Tue, 26 Nov 2019 06:53:52 +0000 (07:53 +0100)]
avformat/aviobuf: Add function to reset dynamic buffer

Resetting a dynamic buffer means to keep the AVIOContext and the
internal buffer used by the dynamic buffer. This is done in order to
save (re)allocations when one has a workflow where one opens and closes
dynamic buffers in sequence.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
5 months agoavformat/matroskaenc: Avoid allocation for Cues
Andreas Rheinhardt [Mon, 30 Dec 2019 14:37:15 +0000 (15:37 +0100)]
avformat/matroskaenc: Avoid allocation for Cues

Up until now, the Matroska muxer would allocate a structure containing
three members: The segment offset, a pointer to an array containing Cue
(index) entries and a counter for said array. It is unnecessary to
allocate it separately and it is unnecessary to contain the segment
offset in said structure, as it duplicates another field contained in
the MatroskaMuxContext. This commit implements the corresponding

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
5 months agoavformat/matroskaenc: Cosmetics
Andreas Rheinhardt [Tue, 31 Dec 2019 12:21:31 +0000 (13:21 +0100)]
avformat/matroskaenc: Cosmetics

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
5 months agoavformat/matroskaenc: Avoid unnecessary seek
Andreas Rheinhardt [Sun, 29 Dec 2019 11:50:46 +0000 (12:50 +0100)]
avformat/matroskaenc: Avoid unnecessary seek

When writing the SeekHead (a form of index) at the end of the muxing
process, mkv_write_seekhead() would first seek to the position where the
SeekHead ought to be written, then write it there and seek back to the
original position afterwards. Which means: To the end of the file.
Afterwards, a seek to the beginning of the file is performed to update
further values. This of course means that the second seek in
mkv_write_seekhead() was unnecessary.

This has been changed: A new parameter was added to mkv_write_seekhead()
containing the destination for the second seek, effectively eliminating
the seek to the end of the file after writing the SeekHead.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
5 months agoavformat/matroskaenc: Check for failure when writing SeekHead
Andreas Rheinhardt [Sun, 29 Dec 2019 08:57:44 +0000 (09:57 +0100)]
avformat/matroskaenc: Check for failure when writing SeekHead

mkv_write_seekhead() would up until now try to seek to the position where
the SeekHead ought to be written, write the SeekHead and seek back. The
first of these seeks was checked as was writing, yet the seek back was
unchecked. Moreover the return value of mkv_write_seekhead() was unchecked
(the ordinary return value was the position where the SeekHead was written).

This commit changes this: Everything is checked. In the unseekable case
(where the first seek may nevertheless work when it happens in the buffer)
a failure at the first seek is not considered an error. In any case,
failure to seek back is an error.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
5 months agoavformat/matroskaenc: Improve calculating EBML ID size
Andreas Rheinhardt [Sat, 28 Dec 2019 09:00:37 +0000 (10:00 +0100)]
avformat/matroskaenc: Improve calculating EBML ID size

When the Matroska muxer writes an EBML ID, it calculates the length of
said ID before; and it does this as if this were a number that needs to
be encoded as EBML number: The formula used is (av_log2(id + 1) - 1) / 7
+ 1. But the constants used already contain the VINT_MARKER (the leading
bit indicating the length of the EBML number) and therefore the algorithm
used makes no sense. Instead the position of the most significant byte
set gives the desired length.

The algorithm used until now worked because EBML numbers are subject to
restrictions: If the EBML number takes up k bytes, then the bit 1 << (7
* k) is set and av_log2(id) is 7 * k. So the current algorithm produces
the correct result unless the EBML ID is of the form 7 * k - 1 because
of the "id + 1". But contrary to encoding lengths as EBML number (where
the + 1 exists to avoid the encodings reserved for unknown length),
such EBML numbers are simply forbidden as EBML IDs and as such none of
them were ever written.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
5 months agoavfilter/vf_v360: fix swapped variables
Paul B Mahol [Sun, 29 Mar 2020 11:18:25 +0000 (13:18 +0200)]
avfilter/vf_v360: fix swapped variables

5 months agoavfilter/vf_v360: speedup fisheye output
Paul B Mahol [Sun, 29 Mar 2020 11:07:35 +0000 (13:07 +0200)]
avfilter/vf_v360: speedup fisheye output

5 months agoavfilter/vf_v360: reduce unnecessary negations
Paul B Mahol [Sat, 28 Mar 2020 21:51:25 +0000 (22:51 +0100)]
avfilter/vf_v360: reduce unnecessary negations

5 months agoavformat/avformat: Update av_read_frame() documentation
Andreas Rheinhardt [Sun, 1 Dec 2019 07:45:05 +0000 (08:45 +0100)]
avformat/avformat: Update av_read_frame() documentation

This commit updates the documentation of av_read_frame() to match its
actual behaviour in several ways:

1. On success, av_read_frame() always returns refcounted packets.
2. It can handle uninitialized packets.
3. On error, it always returns blank packets.

This will allow callers to not initialize or unref unnecessarily.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
5 months agoavformat/dashdec: Don't allocate and leak strings that are never used
Andreas Rheinhardt [Sun, 29 Mar 2020 00:32:34 +0000 (01:32 +0100)]
avformat/dashdec: Don't allocate and leak strings that are never used

Since commit e134c203 strdups of several elements of a manifest are kept
in the DASHContext; but said commit completely forgot to free these
strings again (with xmlFree()). Given that these strings are never used
at all, this commit closes this leak by reverting said commit.

This reverts commit e134c20374ee3cbc6d04885d306b02c9871683a2.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
5 months agodoc/filters: add tpad default values
Lou Logan [Sat, 28 Mar 2020 19:44:09 +0000 (11:44 -0800)]
doc/filters: add tpad default values

Signed-off-by: Lou Logan <lou@lrcd.com>
5 months agoavfilter/vf_showinfo: limit the max number of timecode
Limin Wang [Wed, 25 Mar 2020 10:45:48 +0000 (18:45 +0800)]
avfilter/vf_showinfo: limit the max number of timecode

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
5 months agoavfilter: add vf_overlay_cuda
Yaroslav Pogrebnyak [Thu, 19 Mar 2020 16:45:48 +0000 (17:45 +0100)]
avfilter: add vf_overlay_cuda

Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
5 months agoavutil/frame: make frame copy functions hwframe aware
Timo Rothenpieler [Fri, 20 Mar 2020 15:00:16 +0000 (16:00 +0100)]
avutil/frame: make frame copy functions hwframe aware

5 months agoavutil/hwcontext: correctly set extended_data on hwframe_get_buffer
Timo Rothenpieler [Fri, 27 Mar 2020 20:31:52 +0000 (21:31 +0100)]
avutil/hwcontext: correctly set extended_data on hwframe_get_buffer

5 months agonvdec: attach real hw_frames to post-processed frames
Timo Rothenpieler [Fri, 20 Mar 2020 15:43:34 +0000 (16:43 +0100)]
nvdec: attach real hw_frames to post-processed frames

5 months agoffplay, avcodec, avformat: Don't initialize before av_packet_ref()
Andreas Rheinhardt [Sun, 1 Dec 2019 09:04:02 +0000 (10:04 +0100)]
ffplay, avcodec, avformat: Don't initialize before av_packet_ref()

It already initializes the packet.

Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
5 months agoavcodec/avcodec, avpacket: Return blank packet on av_packet_ref() failure
Andreas Rheinhardt [Fri, 27 Mar 2020 00:56:38 +0000 (01:56 +0100)]
avcodec/avcodec, avpacket: Return blank packet on av_packet_ref() failure

Up until now, it was completely unspecified what the content of the
destination packet dst was on error. Depending upon where the error
happened calling av_packet_unref() on dst might be dangerous.

This commit changes this by making sure that dst is blank on error, so
unreferencing it again is safe (and still pointless). This behaviour is

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
5 months agoavcodec/avpacket: Always treat dst in av_packet_ref as uninitialized
Andreas Rheinhardt [Wed, 12 Feb 2020 11:18:23 +0000 (12:18 +0100)]
avcodec/avpacket: Always treat dst in av_packet_ref as uninitialized

av_packet_ref() mostly treated the destination packet dst as uninitialized,
i.e. the destination fields were simply overwritten. But if the source
packet was not reference-counted, dst->buf was treated as if it pointed
to an already allocated buffer (if != NULL) to be reallocated to the
desired size.

The documentation did not explicitly state whether the dst will be treated
as uninitialized, but it stated that if the source packet is not refcounted,
a new buffer in dst will be allocated. This and the fact that the side-data
as well as the codepath taken in case src is refcounted always treated the
packet as uninitialized means that dst should always be treated as
uninitialized for the sake of consistency. And this behaviour has been
explicitly documented.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
5 months agoavcodec/jpeg2000dec: error check when processing tlm marker
Gautam Ramakrishnan [Thu, 26 Mar 2020 04:54:36 +0000 (10:24 +0530)]
avcodec/jpeg2000dec: error check when processing tlm marker

Validate the value of ST field in the TLM marker of JPEG2000.
Throw an error when ST takes value of 0b11.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
5 months agoavformat/rtp: Pass sources and block filter addresses via sdp file for rtp
phunkyfish [Mon, 2 Mar 2020 19:21:09 +0000 (19:21 +0000)]
avformat/rtp: Pass sources and block filter addresses via sdp file for rtp

Signed-off-by: Aman Gupta <aman@tmm1.net>
5 months agomovenc: mark Opus encapsulation as stable
Lynne [Mon, 23 Mar 2020 22:03:24 +0000 (22:03 +0000)]
movenc: mark Opus encapsulation as stable

The specifications are de-facto frozen now as they've already been used in
production for years, the author has indicated reluctance on IRC to change
it further, and the only potential changes would, from what I understand,
be forward-compatible.

5 months agoh264_ps: pass AVCodecContext as void* where possible
Anton Khirnov [Fri, 13 Mar 2020 09:21:28 +0000 (10:21 +0100)]
h264_ps: pass AVCodecContext as void* where possible

Makes sure it is only used for logging and nothing else.

5 months agotests/checkasm: add overflow test for hevc_add_res
Linjie Fu [Mon, 9 Mar 2020 14:55:28 +0000 (22:55 +0800)]
tests/checkasm: add overflow test for hevc_add_res

Add overflow test for hevc_add_res when int16_t coeff = -32768.

The result of C is good, while ASM is not.

To verify:
    make fate-checkasm-hevc_add_res
    ffmpeg/tests/checkasm/checkasm --test=hevc_add_res

./checkasm --test=hevc_add_res
checkasm: using random seed 679391863
    hevc_add_res_4x4_8_mmxext (hevc_add_res.c:69)
  - hevc_add_res.add_residual [FAILED]
    hevc_add_res_8x8_8_sse2 (hevc_add_res.c:69)
    hevc_add_res_16x16_8_sse2 (hevc_add_res.c:69)
    hevc_add_res_32x32_8_sse2 (hevc_add_res.c:69)
  - hevc_add_res.add_residual [FAILED]
    hevc_add_res_8x8_8_avx (hevc_add_res.c:69)
    hevc_add_res_16x16_8_avx (hevc_add_res.c:69)
    hevc_add_res_32x32_8_avx (hevc_add_res.c:69)
  - hevc_add_res.add_residual [FAILED]
    hevc_add_res_32x32_8_avx2 (hevc_add_res.c:69)
  - hevc_add_res.add_residual [FAILED]
checkasm: 8 of 14 tests have failed

Signed-off-by: Xu Guangxin <guangxin.xu@intel.com>
Signed-off-by: Linjie Fu <linjie.fu@intel.com>
Signed-off-by: Anton Khirnov <anton@khirnov.net>
5 months agocheckasm/hevc_add_res: prepare test data only if the fuction is not tested
Linjie Fu [Mon, 9 Mar 2020 14:54:59 +0000 (22:54 +0800)]
checkasm/hevc_add_res: prepare test data only if the fuction is not tested

check_func will return NULL for functions that have already been tested. If
the func is tested and skipped (which happens several times), there is no
need to prepare data(randomize_buffers and memcpy).

Move relative code in compare_add_res(), prepare data and do check only if
the function is not tested.

Signed-off-by: Linjie Fu <linjie.fu@intel.com>
Signed-off-by: Anton Khirnov <anton@khirnov.net>
5 months agolavc/x86/hevc_add_res: Fix coeff overflow in ADD_RES_SSE_16_32_8
Linjie Fu [Thu, 5 Mar 2020 07:48:09 +0000 (15:48 +0800)]
lavc/x86/hevc_add_res: Fix coeff overflow in ADD_RES_SSE_16_32_8

Fix overflow for coeff -32768 in function ADD_RES_SSE_16_32_8 with no
performance drop.(SSE2/AVX/AVX2)

./checkasm --test=hevc_add_res --bench

  - hevc_add_res.add_residual [OK]
    hevc_add_res_32x32_8_sse2: 127.5
    hevc_add_res_32x32_8_avx: 127.0
    hevc_add_res_32x32_8_avx2: 86.5

Add overflow test case:
  - hevc_add_res.add_residual [FAILED]

  - hevc_add_res.add_residual [OK]
    hevc_add_res_32x32_8_sse2: 126.8
    hevc_add_res_32x32_8_avx: 128.3
    hevc_add_res_32x32_8_avx2: 86.8

Signed-off-by: Xu Guangxin <guangxin.xu@intel.com>
Signed-off-by: Linjie Fu <linjie.fu@intel.com>
Signed-off-by: Anton Khirnov <anton@khirnov.net>
5 months agolavc/x86/hevc_add_res: Fix overflow in ADD_RES_SSE_8_8
Linjie Fu [Thu, 5 Mar 2020 07:47:54 +0000 (15:47 +0800)]
lavc/x86/hevc_add_res: Fix overflow in ADD_RES_SSE_8_8

Fix overflow for coeff -32768 in function ADD_RES_SSE_8_8 with
no performance drop.

./checkasm --test=hevc_add_res --bench

  - hevc_add_res.add_residual [OK]
    hevc_add_res_8x8_8_sse2: 15.5

Add overflow test case:
  - hevc_add_res.add_residual [FAILED]

  - hevc_add_res.add_residual [OK]
    hevc_add_res_8x8_8_sse2: 15.5

Signed-off-by: Xu Guangxin <guangxin.xu@intel.com>
Signed-off-by: Linjie Fu <linjie.fu@intel.com>
Signed-off-by: Anton Khirnov <anton@khirnov.net>
5 months agolavc/x86/hevc_add_res: Fix overflow in ADD_RES_MMX_4_8
Linjie Fu [Thu, 5 Mar 2020 07:47:37 +0000 (15:47 +0800)]
lavc/x86/hevc_add_res: Fix overflow in ADD_RES_MMX_4_8

Fix overflow for coeff -32768 in function ADD_RES_MMX_4_8 with no
performance drop.

./checkasm --test=hevc_add_res --bench

  - hevc_add_res.add_residual [OK]
    hevc_add_res_4x4_8_mmxext: 15.5

Add overflow test case:
  - hevc_add_res.add_residual [FAILED]

  - hevc_add_res.add_residual [OK]
    hevc_add_res_4x4_8_mmxext: 15.0

Signed-off-by: Xu Guangxin <guangxin.xu@intel.com>
Signed-off-by: Linjie Fu <linjie.fu@intel.com>
Signed-off-by: Anton Khirnov <anton@khirnov.net>
5 months agolavc/pthread_frame: Update user context in ff_frame_thread_free
Linjie Fu [Fri, 27 Dec 2019 08:47:35 +0000 (16:47 +0800)]
lavc/pthread_frame: Update user context in ff_frame_thread_free

Resolution/format changes lead to re-initialization of hardware
accelerations(vaapi/dxva2/..) with new hwaccel_priv_data in
the worker-thread. But hwaccel_priv_data in user context won't
be updated until the resolution changing frame is output.

A termination with "-vframes" just after the reinit will lead to:
    1. memory leak in worker-thread.
    2. double free in user-thread.

Update user context in ff_frame_thread_free with the last thread
submit_packet() was called on.

To reproduce:
ffmpeg -hwaccel vaapi(dxva2) -v verbose -i
    fate-suite/h264/reinit-large_420_8-to-small_420_8.h264 -pix_fmt nv12
    -f rawvideo -vsync passthrough -vframes 47 -y out.yuv

Signed-off-by: Linjie Fu <linjie.fu@intel.com>
Signed-off-by: Anton Khirnov <anton@khirnov.net>
5 months agoavfilter/af_acrossover: revert 270068b5a
Paul B Mahol [Thu, 26 Mar 2020 10:45:32 +0000 (11:45 +0100)]
avfilter/af_acrossover: revert 270068b5a

Actually it did not work well.

5 months agolibavcodec/jpeg2000.h: fix comments for JPEG2000 markers
Gautam Ramakrishnan [Wed, 25 Mar 2020 13:18:44 +0000 (18:48 +0530)]
libavcodec/jpeg2000.h: fix comments for JPEG2000 markers

The comments for some of the markers were incorrect.
This patch fixes the comments associated with the markers.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
5 months agoavfilter/vf_showinfo: check if the s12m data size is valid
Limin Wang [Wed, 25 Mar 2020 10:45:47 +0000 (18:45 +0800)]
avfilter/vf_showinfo: check if the s12m data size is valid

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
5 months agoconfigure: Get the correct ident for clang-cl.exe
Carl Eugen Hoyos [Wed, 25 Mar 2020 23:00:10 +0000 (00:00 +0100)]
configure: Get the correct ident for clang-cl.exe

Instead of "No input file specified"

5 months agoconfigure: Remove all C standard versions from the MSVC command line.
Carl Eugen Hoyos [Wed, 25 Mar 2020 22:59:11 +0000 (23:59 +0100)]
configure: Remove all C standard versions from the MSVC command line.

Silences a warning for every file when compiling with clang-cl.exe

5 months agoavformat/webmdashenc: Fix memleak upon realloc failure
Andreas Rheinhardt [Fri, 20 Dec 2019 20:21:59 +0000 (21:21 +0100)]
avformat/webmdashenc: Fix memleak upon realloc failure

The classical ptr = av_realloc(ptr, size).

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
5 months agoavformat/mpeg: Remove unnecessary av_packet_unref()
Andreas Rheinhardt [Sat, 21 Mar 2020 20:08:04 +0000 (21:08 +0100)]
avformat/mpeg: Remove unnecessary av_packet_unref()

Forgotten in 6a67d518.

Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
5 months agoavformat/yop: Use av_packet_move_ref() for packet ownership transfer
Andreas Rheinhardt [Sat, 21 Mar 2020 17:38:00 +0000 (18:38 +0100)]
avformat/yop: Use av_packet_move_ref() for packet ownership transfer

Also return 0 after successfully reading a packet.

Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
5 months agoavformat/nsvdec: Use av_packet_move_ref() for packet ownership transfer
Andreas Rheinhardt [Sat, 21 Mar 2020 07:57:19 +0000 (08:57 +0100)]
avformat/nsvdec: Use av_packet_move_ref() for packet ownership transfer

Also simply return 0 in case a packet has been successfully read.

Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
5 months agoavformat/matroskadec: Don't discard the upper 32bits of TrackNumber
Andreas Rheinhardt [Thu, 26 Dec 2019 03:17:24 +0000 (04:17 +0100)]
avformat/matroskadec: Don't discard the upper 32bits of TrackNumber

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
5 months agodoc/developer.texi: Add variadic macros to allowed C language features
Andreas Rheinhardt [Mon, 23 Mar 2020 02:26:58 +0000 (03:26 +0100)]
doc/developer.texi: Add variadic macros to allowed C language features

They are used in several places like CBS.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
5 months agoavformat/movenc: Reduce size of the allocated MOVIentry array
James Almer [Wed, 25 Mar 2020 17:16:35 +0000 (14:16 -0300)]
avformat/movenc: Reduce size of the allocated MOVIentry array

Increasing it by 2048 entries per realloc is exessive.
Reduces memory usage, especially on long, non fragmented output.

Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: James Almer <jamrial@gmail.com>
5 months agoavcodec/vp9: use a buffer pool to allocate VP9Frame extradata
James Almer [Thu, 5 Mar 2020 03:39:12 +0000 (00:39 -0300)]
avcodec/vp9: use a buffer pool to allocate VP9Frame extradata

Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: James Almer <jamrial@gmail.com>
5 months agoavfilter/vf_v360: improve sg input format
Paul B Mahol [Thu, 26 Mar 2020 12:53:22 +0000 (13:53 +0100)]
avfilter/vf_v360: improve sg input format

Specifically unbreak yaw functionality.

5 months agoavfilter/vf_v360: improve sg output format
Paul B Mahol [Thu, 26 Mar 2020 12:37:13 +0000 (13:37 +0100)]
avfilter/vf_v360: improve sg output format

5 months agoavformat/matroskadec: fix the type of the TrackLanguage
Steve Lhomme [Sun, 22 Mar 2020 08:59:26 +0000 (09:59 +0100)]
avformat/matroskadec: fix the type of the TrackLanguage

It's an ASCII string, not a UTF-8 string.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>