]> git.sesse.net Git - ffmpeg/log
ffmpeg
4 years agoavutil/imgutils: don't fill data pointers for missing planes
James Almer [Fri, 24 Jul 2020 18:04:05 +0000 (15:04 -0300)]
avutil/imgutils: don't fill data pointers for missing planes

The size for a previous plane doesn't signal the presence of another after it.
If the plane is present, av_image_fill_plane_sizes() will have returned a size
for it.

Fixes a regression since 3a8e927176.

Reported-by: Imad R. Faiad <irfaiad@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
4 years agoavformat/ape: Error out in case of EOF in the header
Michael Niedermayer [Fri, 24 Jul 2020 21:51:11 +0000 (23:51 +0200)]
avformat/ape: Error out in case of EOF in the header

Fixes: OOM
Fixes: 24375/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-6216862443241472
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoavformat/segafilmenc: Avoid seek when writing header
Andreas Rheinhardt [Fri, 17 Jul 2020 10:04:03 +0000 (12:04 +0200)]
avformat/segafilmenc: Avoid seek when writing header

Up until now, the Sega FILM muxer would first write all the packet data,
then shift the data (in the muxer's write_trailer function) by the amount
necessary to write the header at the front (which entails a seek to the
front), then seek back to the beginning and actually write the header.

This commit changes this: The dynamic buffer that is used to write the
sample table (containing information about each sample in the file) is
now used to write the complete header. This is possible because the size
of everything in the header except the sample table is known in advance.
Said buffer can then be used as one of the two temporary buffers used
for shifting which also reduces the amount one has to allocate for this.
Thereby the header will be written when shifting, so that the second
seek to the beginning is unnecessary.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years agoavformat/segafilmenc: Don't store packet info in linked list
Andreas Rheinhardt [Fri, 17 Jul 2020 07:25:24 +0000 (09:25 +0200)]
avformat/segafilmenc: Don't store packet info in linked list

Up until now, the Sega FILM muxer would store some information about
each packet in a linked list. When writing the trailer, the information
in said linked list would be used to write a table in the file header.
Each entry in said table is 16 bytes long, but each entry of the linked
list is 32 bytes long (assuming 64 bit pointer and no padding).
Therefore it makes sense to remove the linked list and write the array
entries directly into a dynamic buffer while writing the packet (this is
possible because the table entries don't depend on any information not
available when writing the packet (the offset is not relative to the
beginning of the file, but to the end of the table). This also
simplifies writing the array at the end (there is no need to traverse a
linked list).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years agoavformat/segafilmenc: Simplify writing two bytes
Andreas Rheinhardt [Fri, 17 Jul 2020 07:11:53 +0000 (09:11 +0200)]
avformat/segafilmenc: Simplify writing two bytes

Use avio_wb16() instead of avio_write() to write two zero bytes.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years agoavformat/segafilmenc: Remove write-only variable
Andreas Rheinhardt [Fri, 17 Jul 2020 06:06:15 +0000 (08:06 +0200)]
avformat/segafilmenc: Remove write-only variable

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years agoavformat/segafilm: Reorder elements of struct to make it smaller
Andreas Rheinhardt [Fri, 17 Jul 2020 05:47:44 +0000 (07:47 +0200)]
avformat/segafilm: Reorder elements of struct to make it smaller

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years agoavformat/daudenc: Return proper error codes instead if -1
Andreas Rheinhardt [Fri, 17 Jul 2020 05:38:52 +0000 (07:38 +0200)]
avformat/daudenc: Return proper error codes instead if -1

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years agoavformat/daudenc: Turn write_header function into init function
Andreas Rheinhardt [Fri, 17 Jul 2020 05:36:11 +0000 (07:36 +0200)]
avformat/daudenc: Turn write_header function into init function

daud_write_header() doesn't write anything.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years agoavformat/webmdashenc: Cosmetics
Andreas Rheinhardt [Fri, 17 Jul 2020 05:32:52 +0000 (07:32 +0200)]
avformat/webmdashenc: Cosmetics

Mostly using intermediate pointers for accesses (i.e. storing s->pb in a
variable pb and then using pb for writing instead of s->pb) to improve
readability. Furthermore, the opening brace '{' of a function has been
moved into a line of its own in instances where it wasn't before.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years agoavformat/webmdashenc: Only check for existence of metadata if it is used
Andreas Rheinhardt [Fri, 17 Jul 2020 04:17:44 +0000 (06:17 +0200)]
avformat/webmdashenc: Only check for existence of metadata if it is used

Also return proper error codes when it is absent: AVERROR(EINVAL)
instead of AVERROR_INVALIDDATA.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years agoavformat/webmdashenc: Avoid allocations, fix memleak
Andreas Rheinhardt [Tue, 14 Jul 2020 22:06:10 +0000 (00:06 +0200)]
avformat/webmdashenc: Avoid allocations, fix memleak

When using the WebM DASH Manifest muxer, every stream of each adaptation
set has to contain a metadata entry containing the filename of the
source file. In case of live stream manifests, said filename has to
conform to a pattern of
<file_description>_<representation_id>.<extension>. These pieces are
used to create the other strings that are actually output. Up until now,
these other strings would be allocated, used once and then freed
directly after usage. This commit changes this: The function that
allocated and assembled these strings now returns pointers to the '_'
and '.' delimiters and so that the caller can easily pick substrings
from it without needing to copy the string.

Avoiding allocations also fixes a memleak: One of the allocated strings
would leak upon a subsequent allocation failure.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years agoavformat/webmdashenc: Fix segfault when no filename is given when live
Andreas Rheinhardt [Tue, 14 Jul 2020 20:49:15 +0000 (22:49 +0200)]
avformat/webmdashenc: Fix segfault when no filename is given when live

by checking a bit earlier.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years agoavformat/riffenc: correct calculation for extradata size
Gyan Doshi [Sat, 25 Jul 2020 05:09:32 +0000 (10:39 +0530)]
avformat/riffenc: correct calculation for extradata size

In 1ec2b3de5a, the extradata size was affected when the raster was
signaled as flipped due to user-set option rather than via extradata.
This resulted in a wrong header size being written. Fixed.

4 years agoswscale/yuv2rgb: cosmetics
Limin Wang [Tue, 21 Jul 2020 16:07:50 +0000 (00:07 +0800)]
swscale/yuv2rgb: cosmetics

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
4 years agoavformat/mpegtsenc: use local variable store st->codecpar->codec_id
Limin Wang [Wed, 8 Jul 2020 03:19:13 +0000 (11:19 +0800)]
avformat/mpegtsenc: use local variable store st->codecpar->codec_id

Reviewed-by: Marton Balint <cus@passwd.hu>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
4 years agoavformat/mpegtsenc: reindent the last commit
Limin Wang [Wed, 8 Jul 2020 02:40:33 +0000 (10:40 +0800)]
avformat/mpegtsenc: reindent the last commit

Reviewed-by: Marton Balint <cus@passwd.hu>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
4 years agoavformat/mpegtsenc: simplify code for condition checks
Limin Wang [Wed, 8 Jul 2020 02:40:10 +0000 (10:40 +0800)]
avformat/mpegtsenc: simplify code for condition checks

Reviewed-by: Marton Balint <cus@passwd.hu>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
4 years agolibavcodec/libaomenc.c: Add command-line options for inter-coding tools
Wang Cao [Wed, 22 Jul 2020 23:11:12 +0000 (16:11 -0700)]
libavcodec/libaomenc.c: Add command-line options for inter-coding tools

Signed-off-by: Wang Cao <wangcao@google.com>
Signed-off-by: James Zern <jzern@google.com>
4 years agolibavcodec/libaomenc.c: Add command-line options for tx tools.
Wang Cao [Wed, 22 Jul 2020 23:12:01 +0000 (16:12 -0700)]
libavcodec/libaomenc.c: Add command-line options for tx tools.

Signed-off-by: Wang Cao <wangcao@google.com>
Signed-off-by: James Zern <jzern@google.com>
4 years agolibavcodec/jpeg2000dec: Fix codeblock decode check
Gautam Ramakrishnan [Thu, 23 Jul 2020 17:11:10 +0000 (22:41 +0530)]
libavcodec/jpeg2000dec: Fix codeblock decode check

The codeblock decoder checks whether the mqc decoder
has decoded the right number of bytes. However, this
check does not account for the fact that the mqc encoder's
flush routine adds 2 bytes of data which does not have to be
read by the decoder. The check is modified to account for
this. This patch solves issue #4827

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoavcodec/alac: Check decorr_shift to avoid invalid shift
Michael Niedermayer [Thu, 23 Jul 2020 21:41:27 +0000 (23:41 +0200)]
avcodec/alac: Check decorr_shift to avoid invalid shift

Later the decorrelate_stereo call is guarded by channels == 2
and non-zero decorr_left_weight. Make sure decorr_shift is in
the expected shift range for that case.

Fixes: shift exponent 128 is too large for 32-bit type 'int'
Fixes: 23860/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ALAC_fuzzer-5751138914402304
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Alexander Strasser <eclipse7@gmx.net>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agolavc/vaapi_encode: Add render target support for 422 10-bit
Linjie Fu [Mon, 22 Jun 2020 07:41:35 +0000 (15:41 +0800)]
lavc/vaapi_encode: Add render target support for 422 10-bit

This enables VAAPI encoding support for 422 10-bit(Y210).

Signed-off-by: Linjie Fu <linjie.justin.fu@gmail.com>
4 years agovaapi_encode_h265: Enable 4:2:2 support
Mark Thompson [Thu, 5 Mar 2020 00:25:28 +0000 (00:25 +0000)]
vaapi_encode_h265: Enable 4:2:2 support

4 years agoavformat/matroskadec: Slightly simplify version check
Andreas Rheinhardt [Mon, 20 Jul 2020 17:14:38 +0000 (19:14 +0200)]
avformat/matroskadec: Slightly simplify version check

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years agoavformat/matroskadec: Avoid undefined pointer arithmetic
Andreas Rheinhardt [Sun, 19 Jul 2020 08:16:33 +0000 (10:16 +0200)]
avformat/matroskadec: Avoid undefined pointer arithmetic

The Matroska demuxer currently always opens a GetByteContext to read the
content of the projection's private data buffer; it does this even if
there is no private data buffer in which case opening the GetByteContext
will lead to a NULL + 0 which is undefined behaviour.
Furthermore, in this case the code relied both on the implicit checks
of the bytestream2 API as well as on the fact that it returns zero
if there is not enough data available.

Both of these issues have been addressed by not using the bytestream API
any more; instead the data is simply read directly by using AV_RB. This
is possible because the offsets are constants.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years agoavformat/mxfdec: Fix memleak upon repeating tags
Andreas Rheinhardt [Mon, 20 Jul 2020 05:24:53 +0000 (07:24 +0200)]
avformat/mxfdec: Fix memleak upon repeating tags

When parsing MXF encountering some tags leads to allocations. And when
these tags were encountered repeatedly, this could lead to memleaks,
because the pointer to the old data got simply overwritten with a
pointer to the new data (or to NULL on allocation failure). This has
been fixed.

Reviewed-by: Tomas Härdin <tjoppen@acc.umu.se>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years agoavformat/mxfdec: Fix memleak when parsing tag fails
Andreas Rheinhardt [Mon, 20 Jul 2020 04:20:29 +0000 (06:20 +0200)]
avformat/mxfdec: Fix memleak when parsing tag fails

The MXF demuxer uses an array of pointers to different structures of
metadata (all containing a common initial sequence containing a type
field to distinguish them) and some of these structures contain pointers
to separately allocated subelements. If an error happens while reading
and creating the tags, the semi-finished new tag is freed using the
function to free these tags. But this function doesn't free the already
allocated subelements, because the type has not been set yet. This commit
changes this.

Reviewed-by: Tomas Härdin <tjoppen@acc.umu.se>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years agoavformat/mxfdec: Fix memleak when adding element to array fails
Andreas Rheinhardt [Mon, 20 Jul 2020 00:46:09 +0000 (02:46 +0200)]
avformat/mxfdec: Fix memleak when adding element to array fails

Said array contains pointers to other structs and both the designated
new element as well as other stuff contained in it (e.g. strings) leak
if the new element can't be added to the array.

Reviewed-by: Tomas Härdin <tjoppen@acc.umu.se>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years agoavutil: bump version after addition of MIPS cpu flags
James Almer [Thu, 23 Jul 2020 17:00:31 +0000 (14:00 -0300)]
avutil: bump version after addition of MIPS cpu flags

And add the missing doc/APIchanges entry.

Signed-off-by: James Almer <jamrial@gmail.com>
4 years agolibavcodec: MIPS: MMI: Move sp out of the clobber list
Jiaxun Yang [Sat, 18 Jul 2020 15:35:42 +0000 (23:35 +0800)]
libavcodec: MIPS: MMI: Move sp out of the clobber list

GCC complains:
warning: listing the stack pointer register ‘$29’ in a clobber
list is deprecated [-Wdeprecated]

Actually stack pointer was restored at the end of the inline assembly
so there is no reason to add it to the clobber list.

Also use $sp insted of $29 to make our intention much more clear.

Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
Reviewed-by: Shiyou Yin <yinshiyou-hf@loongson.cn>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agolibavcodec: MIPS: MMI: Fix type mismatches
Jiaxun Yang [Sat, 18 Jul 2020 15:35:41 +0000 (23:35 +0800)]
libavcodec: MIPS: MMI: Fix type mismatches

GCC complains about them.

Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
Reviewed-by: Shiyou Yin <yinshiyou-hf@loongson.cn>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agolibavcodec: Enable runtime detection for MIPS MMI & MSA
Jiaxun Yang [Sat, 18 Jul 2020 15:35:40 +0000 (23:35 +0800)]
libavcodec: Enable runtime detection for MIPS MMI & MSA

Apply optimized functions according to cpuflags.
MSA is usually put after MMI as it's generally faster than MMI.

Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
Reviewed-by: Shiyou Yin <yinshiyou-hf@loongson.cn>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agolibavutil: Detect MMI and MSA flags for MIPS
Jiaxun Yang [Sat, 18 Jul 2020 15:35:39 +0000 (23:35 +0800)]
libavutil: Detect MMI and MSA flags for MIPS

Add MMI & MSA runtime detection for MIPS.

Basically there are two code pathes. For systems that
natively support CPUCFG instruction or kernel emulated
that instruction, we'll sense this feature from HWCAP and
report the flags according to values grab from CPUCFG. For
systems that have no CPUCFG (or not export it in HWCAP),
we'll parse /proc/cpuinfo instead.

Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
Reviewed-by: Shiyou Yin <yinshiyou-hf@loongson.cn>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agolibavutils: Add parse_r helper for MIPS
Jiaxun Yang [Sat, 18 Jul 2020 15:35:38 +0000 (23:35 +0800)]
libavutils: Add parse_r helper for MIPS

That helper grab from kernel code can allow us to inline
newer instructions (not implemented by the assembler) in
a elegant manner.

Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
Reviewed-by: Shiyou Yin <yinshiyou-hf@loongson.cn>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoffbuild: Refine MIPS handling
Jiaxun Yang [Sat, 18 Jul 2020 15:35:37 +0000 (23:35 +0800)]
ffbuild: Refine MIPS handling

To enable runtime detection for MIPS, we need to refine ffbuild
part to support buildding these feature together.

Firstly, we fixed configure, let it probe native ability of toolchain
to decide wether a feature can to be enabled, also clearly marked
the conflictions between loongson2 & loongson3 and Release 6 & rest.

Secondly, we compile MMI and MSA C sources with their own flags to ensure
their flags won't pollute the whole program and generate illegal code.

Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
Reviewed-by: Shiyou Yin <yinshiyou-hf@loongson.cn>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agolibavcodec/jpeg2000dec: Add check when done with main header markers
Gautam Ramakrishnan [Tue, 21 Jul 2020 18:07:14 +0000 (23:37 +0530)]
libavcodec/jpeg2000dec: Add check when done with main header markers

This patch sets a flag when the processing of the
main header is complete.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoavcodec/libdav1d: use av_image_get_buffer_size() to calculate frame size
James Almer [Fri, 17 Jul 2020 00:49:04 +0000 (21:49 -0300)]
avcodec/libdav1d: use av_image_get_buffer_size() to calculate frame size

Calling av_image_fill_arrays() with NULL as src argument may result in UB.

Signed-off-by: James Almer <jamrial@gmail.com>
4 years agolibavcodec/decode: avoid UB when getting plane sizes
Brian Kim [Mon, 13 Jul 2020 17:09:39 +0000 (10:09 -0700)]
libavcodec/decode: avoid UB when getting plane sizes

This uses av_image_fill_plane_sizes instead of av_image_fill_pointers
when we are getting plane sizes to avoid UB from adding offsets to NULL.

Signed-off-by: Brian Kim <bkkim@google.com>
Signed-off-by: James Almer <jamrial@gmail.com>
4 years agolibavutil/frame: avoid UB when getting plane sizes
Brian Kim [Mon, 13 Jul 2020 17:09:38 +0000 (10:09 -0700)]
libavutil/frame: avoid UB when getting plane sizes

This uses av_image_fill_plane_sizes instead of av_image_fill_pointers
when we are getting plane sizes to avoid UB from adding offsets to NULL.

Signed-off-by: Brian Kim <bkkim@google.com>
Signed-off-by: James Almer <jamrial@gmail.com>
4 years agoavutil/imgutils: add utility to get plane sizes
Brian Kim [Mon, 13 Jul 2020 17:09:37 +0000 (10:09 -0700)]
avutil/imgutils: add utility to get plane sizes

This utility helps avoid undefined behavior when doing things like
checking how much memory we need to allocate for an image before we have
allocated a buffer.

Signed-off-by: Brian Kim <bkkim@google.com>
Signed-off-by: James Almer <jamrial@gmail.com>
4 years agoavcodec/libvpxenc: use pix_fmt descriptors where useful
James Zern [Mon, 20 Jul 2020 17:43:47 +0000 (10:43 -0700)]
avcodec/libvpxenc: use pix_fmt descriptors where useful

similar to:
36e51c190b avcodec/libaomenc: use pix_fmt descriptors where useful

Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: James Zern <jzern@google.com>
4 years agoavfilter/vf_xfade: add hblur transition
Paul B Mahol [Tue, 21 Jul 2020 21:27:00 +0000 (23:27 +0200)]
avfilter/vf_xfade: add hblur transition

4 years agoavcodec/adpcmenc: cleanup trellis checks
Zane van Iperen [Wed, 10 Jun 2020 23:07:49 +0000 (09:07 +1000)]
avcodec/adpcmenc: cleanup trellis checks

Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
4 years agofate: add adpcm_ima_apm encoding test
Zane van Iperen [Mon, 8 Jun 2020 12:35:48 +0000 (22:35 +1000)]
fate: add adpcm_ima_apm encoding test

Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
4 years agoavformat: add apm muxer
Zane van Iperen [Wed, 10 Jun 2020 23:07:46 +0000 (09:07 +1000)]
avformat: add apm muxer

Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
4 years agoavcodec: add adpcm_ima_apm encoder
Zane van Iperen [Tue, 26 May 2020 14:17:59 +0000 (00:17 +1000)]
avcodec: add adpcm_ima_apm encoder

Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
4 years agoavcodec/apm: fix sample_rate check
Zane van Iperen [Mon, 20 Jul 2020 03:35:26 +0000 (13:35 +1000)]
avcodec/apm: fix sample_rate check

Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
4 years agoavcodec/tdsc: Fix tile checks
Michael Niedermayer [Wed, 15 Jul 2020 20:47:50 +0000 (22:47 +0200)]
avcodec/tdsc: Fix tile checks

Fixes: out of array access
Fixes: crash.asf
Found-by: anton listov <greyfarn7@yandex.ru>
Reviewed-by: anton listov <greyfarn7@yandex.ru>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoswscale/yuv2rgb: consider x2rgb10le on big endian hardware
Fei Wang [Mon, 20 Jul 2020 01:34:07 +0000 (09:34 +0800)]
swscale/yuv2rgb: consider x2rgb10le on big endian hardware

This fixed FATE fail report by filter-pixfmts* for x2rgb10le on big
endian hardware.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoavformat/sbgdec: Check for overflow in parse_timestamp()
Michael Niedermayer [Sun, 19 Jul 2020 14:20:52 +0000 (16:20 +0200)]
avformat/sbgdec: Check for overflow in parse_timestamp()

Fixes: signed integer overflow: 33986707200000000 + 9195561788997000192 cannot be represented in type 'long'
Fixes: 23790/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-6554232198266880
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoavcodec/put_bits: Fix LZW warning
Steinar H. Gunderson [Sun, 19 Jul 2020 18:29:29 +0000 (20:29 +0200)]
avcodec/put_bits: Fix LZW warning

lzwenc stores a function pointer to either put_bits or put_bits_le;
however, after the recent change, the function pointer's prototype
would depend on BitBuf. BitBuf is defined in put_bits.h, whose
definition depends on whether BITSTREAM_WRITER_LE is #defined or not.
For safety, we set a boolean flag for little/big endian instead,
which also allows the definition to be inlined.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoavfilter/vf_yaepblur: fix naming of filter class
Paul B Mahol [Mon, 20 Jul 2020 14:12:56 +0000 (16:12 +0200)]
avfilter/vf_yaepblur: fix naming of filter class

4 years agolavf/dashdec: enable custom interrup callback in sub-demuxer
Jun Zhao [Sat, 18 Jul 2020 11:45:55 +0000 (19:45 +0800)]
lavf/dashdec: enable custom interrup callback in sub-demuxer

Enable the custom callback in sub-demuxer

Reviewed-by: Steven Liu <lq@chinaffmpeg.org>
Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
4 years agolavf/hls: enable custom interrup callback in sub-demuxer
Jun Zhao [Sat, 18 Jul 2020 11:44:35 +0000 (19:44 +0800)]
lavf/hls: enable custom interrup callback in sub-demuxer

Enable the custom callback in sub-demuxer

Reviewed-by: Steven Liu <lq@chinaffmpeg.org>
Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
4 years agolavc/vaapi_encode_h265: add h265 tile encoding support
Linjie Fu [Tue, 12 May 2020 13:47:13 +0000 (21:47 +0800)]
lavc/vaapi_encode_h265: add h265 tile encoding support

Default to enable uniform_spacing_flag. Guess level by the tile
rows/cols. Supported for ICL+ platforms.

Also add documentations.

To encode with 4 rows 2 columns:
    ffmpeg ... -c:v hevc_vaapi -tiles 4x2 ...
    ffmpeg ... -c:v hevc_vaapi -tile_rows 4 -tile_cols 2 ...

Suggested-by: Jun Zhao <mypopydev@gmail.com>
Signed-off-by: Linjie Fu <linjie.justin.fu@gmail.com>
4 years agolavc/vaapi_encode: add tile slice encoding support
Linjie Fu [Tue, 12 May 2020 13:47:12 +0000 (21:47 +0800)]
lavc/vaapi_encode: add tile slice encoding support

Add functions to initialize tile slice structure and make tile slice:
 - vaapi_encode_init_tile_slice_structure
 - vaapi_encode_make_tile_slice

Tile slice is not allowed to cross the boundary of a tile due to
the constraints of media-driver. Currently adding support for one
slice per tile.

N x N tile encoding is supposed to be supported with the the
capability of ARBITRARY_MACROBLOCKS slice structures.

N X 1 tile encoding should also work in ARBITRARY_ROWS slice
structure.

Signed-off-by: Linjie Fu <linjie.justin.fu@gmail.com>
4 years agolavc/vaapi_encode: wrap slice codes into row slice functions
Linjie Fu [Tue, 12 May 2020 13:47:11 +0000 (21:47 +0800)]
lavc/vaapi_encode: wrap slice codes into row slice functions

Wrap current whole-row slice codes into following functions:
 - vaapi_encode_make_row_slice()
 - vaapi_encode_init_row_slice_structure()

Signed-off-by: Linjie Fu <linjie.justin.fu@gmail.com>
4 years agoavformat/crypto.c: remove unnecessary code
Steven Liu [Tue, 14 Jul 2020 06:18:25 +0000 (14:18 +0800)]
avformat/crypto.c: remove unnecessary code

Because the newpos variable is set value before use it.
The newpos variable declared at the head partition of crypto_seek.
Make the code clean.

Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
4 years agolavc/sgienc: Fix default 16bit encoding.
Carl Eugen Hoyos [Sun, 19 Jul 2020 19:57:41 +0000 (21:57 +0200)]
lavc/sgienc: Fix default 16bit encoding.

Broken since 7c56b879

4 years agoavcodec/mips: fix type mismatch in h264dsp_msa.c
Shiyou Yin [Sat, 18 Jul 2020 07:30:49 +0000 (15:30 +0800)]
avcodec/mips: fix type mismatch in h264dsp_msa.c

gcc warning: assignment from incompatible pointer type.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoavcodec/put_bits: Make bit buffers 64-bit
Steinar H. Gunderson [Sat, 18 Jul 2020 14:53:03 +0000 (16:53 +0200)]
avcodec/put_bits: Make bit buffers 64-bit

Change BitBuf into uint64_t on 64-bit x86. This means we need to flush the
buffer less often, which is a significant speed win. All other platforms,
including all 32-bit ones, are unchanged. Output bitstream is the same.

All API constraints are kept in place, e.g., you still cannot put_bits()
more than 31 bits at a time. This is so that codecs cannot accidentally
become 64-bit-only or similar.

Benchmarking on transcoding to various formats shows consistently
positive results:

  dnxhd                 25.60 fps ->  26.26 fps ( +2.6%)
  dvvideo               24.88 fps ->  25.17 fps ( +1.2%)
  ffv1                  14.32 fps ->  14.58 fps ( +1.8%)
  huffyuv               58.75 fps ->  63.27 fps ( +7.7%)
  jpegls                 6.22 fps ->   6.34 fps ( +1.8%)
  magicyuv              57.10 fps ->  63.29 fps (+10.8%)
  mjpeg                 48.65 fps ->  49.01 fps ( +0.7%)
  mpeg1video            76.41 fps ->  77.01 fps ( +0.8%)
  mpeg2video            75.99 fps ->  77.43 fps ( +1.9%)
  mpeg4                 80.66 fps ->  81.37 fps ( +0.9%)
  prores                12.35 fps ->  12.88 fps ( +4.3%)
  prores_ks             16.20 fps ->  16.80 fps ( +3.7%)
  rv20                  62.80 fps ->  62.99 fps ( +0.3%)
  utvideo               68.41 fps ->  76.32 fps (+11.6%)

Note that this includes video decoding and all other encoding work,
such as DCTs. If you isolate the actual bit-writing routines, it is
likely to be much more.

Benchmark details: Transcoding the first 30 seconds of Big Buck Bunny
in 1080p, Haswell 2.1 GHz, GCC 8.3, generally quantizer locked to
5.0. (Exceptions: DNxHD needs fixed bitrate, and JPEG-LS is so slow
that I only took the first 10 seconds, not 30.) All runs were done
ten times and single-threaded, top and bottom two results discarded to
get rid of outliers, arithmetic mean between the remaining six.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoavcodec/put_bits: Parametrize bit buffer type
Steinar H. Gunderson [Sat, 18 Jul 2020 14:53:02 +0000 (16:53 +0200)]
avcodec/put_bits: Parametrize bit buffer type

Preparatory patch for making the bit buffer different size on different
platforms; make a typedef and make all the hardcoded sizes into expressions
deriving from this size.

No functional change; generated assembler is near-identical.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agolibavcodec/jpeg2000dec: Support for Parameterless Markers
Gautam Ramakrishnan [Sat, 18 Jul 2020 13:16:21 +0000 (18:46 +0530)]
libavcodec/jpeg2000dec: Support for Parameterless Markers

The JPEG2000 standard reserves marker values 0xFF30
to 0xFF3F to be used as parameterless markers. This
patch adds support to decode codestream with such
markers. This allows decoding of p0_02.j2k.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agolavc/vaapi_encode: add EQUAL_MULTI_ROWS support for slice structure
Linjie Fu [Mon, 11 May 2020 06:32:42 +0000 (14:32 +0800)]
lavc/vaapi_encode: add EQUAL_MULTI_ROWS support for slice structure

VA_ENC_SLICE_STRUCTURE_EQUAL_MULTI_ROWS is added to in the latest
libva (1.8.0) which matches the hardware behaviour:

/** \brief Driver supports any number of rows per slice but they must
*    be the same for all slices except for the last one, which must be
*    equal or smaller to the previous slices.
*/

And VA_ENC_SLICE_STRUCTURE_EQUAL_ROWS is kind of deprecated for iHD
since it's somehow introduced in [1] which is misleading from what we
actually handles.

[1]<https://github.com/intel/libva/commit/0e6d5441f19bdc674b4da3169d614d10fd644778>

Signed-off-by: Linjie Fu <linjie.justin.fu@gmail.com>
4 years agoavformat/apm: fix variable/structure names and cosmetics
Zane van Iperen [Mon, 6 Jul 2020 08:50:52 +0000 (18:50 +1000)]
avformat/apm: fix variable/structure names and cosmetics

4 years agoavformat/apm: use the entire APMState structure as extradata
Zane van Iperen [Tue, 7 Jul 2020 14:42:09 +0000 (00:42 +1000)]
avformat/apm: use the entire APMState structure as extradata

Is the "actual" codec extradata instead of the hand-crafted one
from the previous revision.

4 years agoavformat/apm: read header correctly
Zane van Iperen [Tue, 30 Jun 2020 00:44:39 +0000 (10:44 +1000)]
avformat/apm: read header correctly

The leading WAVEFORMATEX in .APM files is malformed:
* The nAvgBytesPerSec field is wrong, and
* sizeof(cbSize) is 4 instead of 2.

4 years agodoc/http: Update HTTP protocol options
Jun Zhao [Fri, 17 Jul 2020 02:59:05 +0000 (10:59 +0800)]
doc/http: Update HTTP protocol options

remove the timeout option docs part for HTTP protocol and add
auth_type option part.

Reviewed-by: Gyan Doshi <ffmpeg@gyani.pro>
Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
4 years agoavformat/au: Avoid allocation for metadata string
Andreas Rheinhardt [Mon, 13 Jul 2020 17:31:46 +0000 (19:31 +0200)]
avformat/au: Avoid allocation for metadata string

When there are potentially annotation (i.e. metadata) fields to write,
au_get_annotations() is called to produce a string with them. To do so,
it uses an AVBPrint which is finalized to create the string. This is
wasteful, because it always leads to an allocation even if the string
actually fits into the internal buffer of the AVBPrint. This commit
changes this by making au_get_annotations() modify an AVBPrint that
resides on the stack of the caller (i.e. of au_write_header()).

Furthermore, the AVBPrint is now checked for truncation; limiting
the allocations implicit in the AVBPrint allowed to offload the overflow
checks. Notice that these were not correct before: The size parameter of
avio_write() is an int, yet the string in the AVBPrint was allowed to
grow bigger than INT_MAX. And if the length of the string was so near
UINT_MAX that the length + 32 overflowed, the old code would write the
first eight bytes of the string and nothing more, leading to an invalid
file.

Finally, the special case in which the metadata dictionary of the
AVFormatContext is empty (in which case one still has to write eight
binary zeroes) is now no longer treated specially, because this case
no longer incurs any allocation.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years agoavformat/au: Simplify writing string into AVBPrint
Andreas Rheinhardt [Mon, 13 Jul 2020 18:04:26 +0000 (20:04 +0200)]
avformat/au: Simplify writing string into AVBPrint

by using av_bprintf() instead of several av_bprint_append().

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years agoavformat/au: Remove redundant av_freep()
Andreas Rheinhardt [Mon, 13 Jul 2020 15:18:48 +0000 (17:18 +0200)]
avformat/au: Remove redundant av_freep()

This av_freep(&key) in conjunction with the fact that the loop condition
checks for key != NULL was equivalent to a av_freep(&key) + a break
immediately thereafter. But given that there is an av_freep(&key)
directly after the loop, the av_freep(&key) is unnecessary and the break
can also be added explicitly.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years agoavformat/au: Store strings instead of pointers to strings in array
Andreas Rheinhardt [Mon, 13 Jul 2020 15:13:51 +0000 (17:13 +0200)]
avformat/au: Store strings instead of pointers to strings in array

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years agoavfilter/vf_bilateral: simplify code a little
Paul B Mahol [Fri, 17 Jul 2020 18:29:48 +0000 (20:29 +0200)]
avfilter/vf_bilateral: simplify code a little

Make alpha_ calculation faster.

4 years agoavcodec/libaomenc: use pix_fmt descriptors where useful
James Almer [Fri, 17 Jul 2020 20:46:32 +0000 (17:46 -0300)]
avcodec/libaomenc: use pix_fmt descriptors where useful

Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: James Almer <jamrial@gmail.com>
4 years agolibaomenc: enable 8, 10 and 12 bit RGB encoding
Lynne [Thu, 16 Jul 2020 10:39:05 +0000 (11:39 +0100)]
libaomenc: enable 8, 10 and 12 bit RGB encoding

RGB pixel formats are one occasion where by pixel format we mean
pixel format, primaries, transfer characteristic, and matrix coeffs,
so we have to manually set them as they're set to unspecified by
default, despite there only being a single possible combination.

4 years agoMAINTAINERS: add myself and gpg fingerprint
Zane van Iperen [Tue, 7 Jul 2020 15:26:38 +0000 (15:26 +0000)]
MAINTAINERS: add myself and gpg fingerprint

Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoavcodec/libx264: call x264_param_cleanup() if available
James Almer [Fri, 10 Jul 2020 20:47:57 +0000 (17:47 -0300)]
avcodec/libx264: call x264_param_cleanup() if available

The documentation states it should be used to free any memory allocated
by x264_param_parse().

Signed-off-by: James Almer <jamrial@gmail.com>
4 years agoavcodec/libx264: check for param allocation failure error code
James Almer [Fri, 10 Jul 2020 20:16:49 +0000 (17:16 -0300)]
avcodec/libx264: check for param allocation failure error code

And return the proper AVERROR value.

Signed-off-by: James Almer <jamrial@gmail.com>
4 years agoavcodec/libx264: use a function to parse x264opts
James Almer [Fri, 10 Jul 2020 20:10:33 +0000 (17:10 -0300)]
avcodec/libx264: use a function to parse x264opts

This is needed for the following patch.

Signed-off-by: James Almer <jamrial@gmail.com>
4 years agoavfilter/avf_showwavespic: add filter mode
Paul B Mahol [Fri, 17 Jul 2020 12:25:13 +0000 (14:25 +0200)]
avfilter/avf_showwavespic: add filter mode

4 years agoavfilter/vf_tinterlace: fix mergex2, first frame is always considered odd
Paul B Mahol [Sat, 11 Jul 2020 11:20:45 +0000 (13:20 +0200)]
avfilter/vf_tinterlace: fix mergex2, first frame is always considered odd

4 years agoavfilter/vf_tinterlace: use frame counter from lavfi
Paul B Mahol [Sat, 11 Jul 2020 11:20:02 +0000 (13:20 +0200)]
avfilter/vf_tinterlace: use frame counter from lavfi

Remove internal counter.

4 years agoavfilter/vf_bilateral: remove useless memcpy
leozhang [Wed, 30 Oct 2019 03:07:12 +0000 (11:07 +0800)]
avfilter/vf_bilateral: remove useless memcpy

Signed-off-by: leozhang <leozhang@qiyi.com>
4 years agoavfilter/vf_bilateral: stop using sigmaS as percent of width/height
Paul B Mahol [Fri, 17 Jul 2020 11:45:16 +0000 (13:45 +0200)]
avfilter/vf_bilateral: stop using sigmaS as percent of width/height

4 years agoRevert "avcodec/cbs_av1: keep separate reference frame state for reading and writing"
James Almer [Wed, 8 Jul 2020 01:29:49 +0000 (22:29 -0300)]
Revert "avcodec/cbs_av1: keep separate reference frame state for reading and writing"

This reverts commit 4e2bef6a82b356772a5919c51c9be1530268bd79.
It's no longer needed now that all the bsfs use separate contexts
for reading and writing.

4 years agoavcodec/av1_frame_merge_bsf: Use separate contexts for reading/writing
James Almer [Wed, 8 Jul 2020 01:29:47 +0000 (22:29 -0300)]
avcodec/av1_frame_merge_bsf: Use separate contexts for reading/writing

Based on code from 235a5734e0

Signed-off-by: James Almer <jamrial@gmail.com>
4 years agoavcodec/av1_metadata_bsf: Use separate contexts for reading/writing
James Almer [Wed, 8 Jul 2020 01:29:46 +0000 (22:29 -0300)]
avcodec/av1_metadata_bsf: Use separate contexts for reading/writing

Based on code from 235a5734e0

Signed-off-by: James Almer <jamrial@gmail.com>
4 years agolibavcodec/jpeg2000 Fix RPCL Progression order check
Gautam Ramakrishnan [Tue, 14 Jul 2020 16:43:15 +0000 (22:13 +0530)]
libavcodec/jpeg2000 Fix RPCL Progression order check

The RPCL progression order check was incomplete. This
patch completes the check. Tested on p1_07.j2k.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoavformat/mov: fix atom type to string conversion
Zhao Zhili [Sat, 11 Jul 2020 16:26:58 +0000 (00:26 +0800)]
avformat/mov: fix atom type to string conversion

The conversion was endian-dependent, and it may contain non-printable
characters.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoswscale/tests/swscale: use 1 for indicating erros
Michael Niedermayer [Thu, 16 Jul 2020 07:27:28 +0000 (09:27 +0200)]
swscale/tests/swscale: use 1 for indicating erros

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoavcodec/v4l2_m2m_dec: remove redundant packet and fix double free
Andriy Gelman [Thu, 16 Jul 2020 14:52:12 +0000 (10:52 -0400)]
avcodec/v4l2_m2m_dec: remove redundant packet and fix double free

v4l2_receive_frame() uses two packets s->buf_pkt and avpkt. If avpkt
cannot be enqueued, the packet is buffered in s->buf_pkt and enqueued in
the next call. Currently the ownership transfer between the two packets
is not properly handled. A double free occurs if
ff_v4l2_context_enqueue_packet() returns EAGAIN and v4l2_try_start
returns EINVAL.

In fact, having two AVPackets is not needed and everything can be
handled by s->buf_pkt.

This commit removes the local avpkt from v4l2_receive_frame(), meaning
that the ownership transfer doesn't need to be handled and the double
free is fixed.

Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
4 years agolibavcodec/jpeg2000 Fix PCRL Progression Order check
Gautam Ramakrishnan [Tue, 14 Jul 2020 16:43:14 +0000 (22:13 +0530)]
libavcodec/jpeg2000 Fix PCRL Progression Order check

The PCRL progression checks were incomplete. This patch
modifes completes the check. Tested on p1_05.j2k.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoavformat/riffenc: indicate storage of flipped RGB bitmaps
Gyan Doshi [Wed, 8 Jul 2020 12:02:25 +0000 (17:32 +0530)]
avformat/riffenc: indicate storage of flipped RGB bitmaps

Some legacy applications such as AVI2MVE expect raw RGB bitmaps
to be stored bottom-up, whereas our RIFF BITMAPINFOHEADER assumes
they are always stored top-down and thus write a negative value
for height. This can prevent reading of these files.

Option flipped_raw_rgb added to AVI and Matroska muxers
which will write positive value for height when enabled.

Note that the user has to flip the bitmaps beforehand using other
means such as the vflip filter.

4 years agoavdevice/decklink_dec: export timecode with s12m side data
Limin Wang [Sat, 11 Jul 2020 22:29:10 +0000 (06:29 +0800)]
avdevice/decklink_dec: export timecode with s12m side data

Reviewed-by: Marton Balint <cus@passwd.hu>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
4 years agoAPI: add AV_PKT_DATA_S12M_TIMECODE to AVPacketSideDataType
Limin Wang [Tue, 30 Jun 2020 15:18:17 +0000 (23:18 +0800)]
API: add AV_PKT_DATA_S12M_TIMECODE to AVPacketSideDataType

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
4 years agoavutil/timecode: add description for SMPTE binary format
Limin Wang [Tue, 30 Jun 2020 15:22:58 +0000 (23:22 +0800)]
avutil/timecode: add description for SMPTE binary format

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
4 years agolibavcodec/jpeg2000dec : Prevent overriding SOP marker bit
Gautam Ramakrishnan [Tue, 14 Jul 2020 16:43:13 +0000 (22:13 +0530)]
libavcodec/jpeg2000dec : Prevent overriding SOP marker bit

Currently, the COC marker overrides the SOP marker bit.
However, only the COD marker may set this value. This
patch fixes this bug.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoswscale/tests/swscale: Initialize res to a non random error code
Michael Niedermayer [Sat, 11 Jul 2020 21:57:41 +0000 (23:57 +0200)]
swscale/tests/swscale: Initialize res to a non random error code

Regression since: 3adffab073bc59af39dddd035168ac72bc9ffde3

-1 is consistent what other error paths return

Reviewed-by: Martin Storsjö <martin@martin.st>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoswscale/tests/swscale: Fix incorrect return code check
Michael Niedermayer [Sat, 11 Jul 2020 21:35:00 +0000 (23:35 +0200)]
swscale/tests/swscale: Fix incorrect return code check

Regression since: 3adffab073bc59af39dddd035168ac72bc9ffde3

Reviewed-by: Martin Storsjö <martin@martin.st>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>