1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-26 19:01:44 +02:00
Commit Graph

98594 Commits

Author SHA1 Message Date
Shiyou Yin
44699db6db avcodec/mips: Fix register constraint error reported by clang.
Clang report following error in aacsbr_mips.c,ac3dsp_mips.c and aacdec_mips.c:
"couldn't allocate output register for constraint 'r'"

Use 'f' constraint for float variable.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-07-30 00:23:45 +02:00
Marton Balint
b2318c1e53 avformat/hlsenc: increase initial program date time precision
Also query time only once, not for every variant stream, otherwise variant
streams might get a slightly different initial program date time. And we can
set this unconditionally because HLS_PROGRAM_DATE_TIME flag is checked
elsewhere.

Signed-off-by: Marton Balint <cus@passwd.hu>
2020-07-29 23:10:12 +02:00
Marton Balint
53a4620fba fftools/ffmpeg: make specifying thread_queue_size turn on threaded input
Threaded input can increase smoothness of e.g. x11grab significantly. Before
this patch, in order to activate threaded input the user had to specify a
"dummy" additional input, with this change it is no longer required.

Signed-off-by: Marton Balint <cus@passwd.hu>
2020-07-29 23:10:12 +02:00
Lynne
6ceaeecaf5 avcodec/libsvt_av1: remove forced-idr option
This option is directly copy-pasted from the SVT1-HEVC wrapper and has
no place in the options for an AV1 encoder.

AV1 has no H.264/5 IDR frames nor anything like them.
All this option does is change all real keyframes to an intra-only
AV1 frame, which is not seekable. Hence, any streams encoded with
this option enabled will not be seekable.
2020-07-29 17:59:15 -03:00
Daryl Seah
0e20dee5c2 avcodec: Add an SVT-AV1 encoder wrapper
Signed-off-by: Daryl Seah <daryl.seah@intel.com>
Signed-off-by: Jing SUN <jing.a.sun@intel.com>
Signed-off-by: ZhiZhen Tang <zhizhen.tang@intel.com>
Signed-off-by: Zhong Li <zhong.li@intel.com>
Signed-off-by: Xu Guangxin <guangxin.xu@intel.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2020-07-29 17:11:26 -03:00
Andreas Rheinhardt
cbb6ba2e86 avcodec/cavsdec, h264*, hevc_parser: Use get_ue_golomb_31 where possible
instead of get_ue_golomb(). The difference between the two is that the
latter also has to take into account the case in which the read code is
more than 9 bits (four preceding zeroes + at most five value bits) long,
leading to more code.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-07-29 05:11:54 +02:00
Andreas Rheinhardt
2d5407d390 avcodec/golomb: Document return value of get_ue_golomb_31 on error
get_ue_golomb_31() reads nine bits and an array with 512 entries to
parse golomb codes. The longest golomb codes that fit into 9 bits use
four leading zeroes and five value bits and can encode numbers in the
0..30 range. 31 meanwhile is encoded on 11 bits and if the nine bits
read coincide with the first nine bits of the encoding of 31,
get_ue_golomb_31() returns 31 (and skips 11 bits).

But looking at the first nine bits only makes it impossible to distinguish
31 from 32..34. Therefore the documentation of get_ue_golomb_31() simply
states that the return value is undefined if the value of the encountered
exp golomb code was outside the 0..31 range.

But actually get_ue_golomb_31() does not behave that bad: If the returned
value is in the range of 0..30, then this is the actually encountered value,
so that this function can be used without any problems to parse and validate
parameters whose legal values are a subset of the 0..30 range.

This commit documents this fact.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-07-29 05:06:35 +02:00
Andreas Rheinhardt
69636b443c avcodec/golomb: Prevent shift by negative number
This happened in get_ue_golomb() if the cached bitstream reader was in
use, because there was no check to handle the case of the read value
not being in the supported range.
For consistency with the uncached bitstream reader and for compliance
with the documentation, every value not in the 0-8190 range is treated as
error although the cached bitstream reader could actually read values in
the range 0..65534 without problems.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-07-29 04:58:48 +02:00
Gautam Ramakrishnan
a45935fe05 libavcodec/jpeg2000dec: Support for PPM marker
This patch adds support for PPM marker for JPEG2000
decoder. It allows the samples p1_03.j2k and p1_05.j2k
to be decoded.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-07-28 21:57:50 +02:00
Michael Niedermayer
6ea8f03bf4 avcodec/jpeg2000dec: Move reslevelno check before use in case JPEG2000_PGOD_RPCL
Fixes: division by zero
Fixes: 24201/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_JPEG2000_fuzzer-5665813827420160
Fixes: 24245/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_JPEG2000_fuzzer-6285831682392064

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Gautam Ramakrishnan <gautamramk@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-07-28 21:57:50 +02:00
hwren
5f8555d156 lavc/libxavs2.c: mark key-frame packets
Signed-off-by: hwren <hwrenx@126.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-07-28 21:57:50 +02:00
Timo Rothenpieler
466c14d107 avcodec/nvenc: fix B-Ref-Mode support check for recent HEVC 2020-07-28 21:44:11 +02:00
Andreas Rheinhardt
39c4b78829 avcodec/golomb: Don't emit error message in get_ue_golomb
Said error message is not very informative and lacked a proper logging
context; furthermore, many callers already provided more descriptive
error messages of their own. So just drop this one.

Suggested-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-07-28 11:34:38 +02:00
Andreas Rheinhardt
dfd12ee053 avformat/smacker: Don't return packets for streams with AVDISCARD_ALL
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-07-28 06:29:58 +02:00
Andreas Rheinhardt
0df4e1ff93 avformat/smacker: Fix duration for PCM audio
For non-PCM audio, a Smacker frame contains the size of the decoded
audio in the first four bytes of the audio packet data; for PCM data,
said information would be redundant and according to [1] this field does
not exist. Therefore this commit sets the duration and timestamps
properly for PCM audio.

[1]: https://wiki.multimedia.cx/index.php/Smacker#Audio_Track_Chunk

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-07-28 06:29:58 +02:00
Andreas Rheinhardt
40494460f5 avformat/smacker: Set audio duration
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-07-28 06:29:58 +02:00
Timotej Lazar
edea156579 avformat/smacker: Support seeking to first frame
Add .read_seek function to the smacker demuxer for the special case of
seeking to ts=0. This is useful because smacker – like bink, with a
similar implementation – was mostly used to encode clips in video
games, where random seeks are rare but looping media are common.

Signed-off-by: Timotej Lazar <timotej.lazar@araneo.si>
2020-07-28 06:29:58 +02:00
Jun Zhao
7c59e1b0f2 lavf/srt: fix build fail when used the libsrt 1.4.1
libsrt changed the:
SRTO_SMOOTHER   -> SRTO_CONGESTION
SRTO_STRICTENC  -> SRTO_ENFORCEDENCRYPTION
and removed the front of deprecated options (SRTO_SMOOTHER/SRTO_STRICTENC)
in the header, it's lead to build fail

fix #8760

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2020-07-28 09:30:11 +08:00
Mark Thompson
16c2ed4362 Revert "lavc/vaapi_encode: add EQUAL_MULTI_ROWS support for slice structure"
This reverts commit 489c5db079.

Treating EQUAL_MULTI_ROWS in the same way as the arbitrary-size cases is
just wrong.  Consider 9 rows, 4 slices - we pick 4 slices with sizes
{ 3, 2, 2, 2 }, which EQUAL_MULTI_ROWS does not allow.  It isn't possible
to split the frame into 4 slices at all with the EQUAL_MULTI_ROWS
structure - the closest options are 3 slices with sizes { 3, 3, 3 } or 5
slices with sizes { 2, 2, 2, 2, 1 }.
2020-07-27 22:27:14 +01:00
Haihao Xiang
fa3da243e6 hwcontext_vaapi: remove duplicate formats from sw_format list
hwcontext_vaapi maps different VA fourcc to the same pix_fmt for U/V
plane swap cases, however duplicate formats are not expected in sw_format
list when merging formats.

For example:
ffmpeg -loglevel debug -init_hw_device vaapi -filter_hw_device vaapi0 \
-f lavfi -i smptebars -vf \
"hwupload=derive_device=vaapi,scale_vaapi,hwdownload,format=yuv420p" \
-vframes 1 -f null -

Without this fix, an auto scaler is required for the above command
   Duplicate formats in ff_merge_formats detected
   [auto_scaler_0 @ 0x560df58f4550] Setting 'flags' to value 'bicubic'
   [auto_scaler_0 @ 0x560df58f4550] w:iw h:ih flags:'bicubic' interl:0
   [Parsed_hwupload_0 @ 0x560df58f0ec0] auto-inserting filter
   'auto_scaler_0' between the filter 'graph 0 input from stream 0:0' and
   the filter 'Parsed_hwupload_0'

Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2020-07-27 16:06:30 +01:00
Haihao Xiang
d951eea6fd hwcontext_vaapi: avoid fd leak in vaapi_device_derive 2020-07-27 15:41:32 +01:00
James Almer
9faae05ddf avutil/imgutils: always zero data pointers in av_image_fill_pointers()
This restores the relevant behavior of the function as it was before
3a8e927176.

Signed-off-by: James Almer <jamrial@gmail.com>
2020-07-26 21:51:24 -03:00
James Almer
5ce47d0aad 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>
2020-07-26 21:44:58 -03:00
Michael Niedermayer
a6df1fd5e9 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>
2020-07-26 18:29:57 +02:00
Andreas Rheinhardt
37f5feccc6 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>
2020-07-26 17:10:06 +02:00
Andreas Rheinhardt
8a3329ffba 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>
2020-07-26 17:02:24 +02:00
Andreas Rheinhardt
37ec33f42c 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>
2020-07-26 17:01:16 +02:00
Andreas Rheinhardt
f71116deb5 avformat/segafilmenc: Remove write-only variable
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-07-26 16:59:32 +02:00
Andreas Rheinhardt
efcb4112fc avformat/segafilm: Reorder elements of struct to make it smaller
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-07-26 16:58:42 +02:00
Andreas Rheinhardt
3d114c102a avformat/daudenc: Return proper error codes instead if -1
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-07-26 16:57:58 +02:00
Andreas Rheinhardt
3ba72593b3 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>
2020-07-26 16:57:21 +02:00
Andreas Rheinhardt
f38d01714a 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>
2020-07-26 16:47:01 +02:00
Andreas Rheinhardt
e45365d15d 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>
2020-07-26 16:44:07 +02:00
Andreas Rheinhardt
f163b2eb27 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>
2020-07-26 16:39:53 +02:00
Andreas Rheinhardt
c1fab8637e 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>
2020-07-26 16:22:24 +02:00
Gyan Doshi
93694fe777 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.
2020-07-26 11:09:39 +05:30
Limin Wang
7c8ad72f1c swscale/yuv2rgb: cosmetics
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2020-07-25 10:20:42 +08:00
Limin Wang
bae2ae62ba 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>
2020-07-25 10:20:30 +08:00
Limin Wang
a35facfeb3 avformat/mpegtsenc: reindent the last commit
Reviewed-by: Marton Balint <cus@passwd.hu>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2020-07-25 10:20:26 +08:00
Limin Wang
cf81d64282 avformat/mpegtsenc: simplify code for condition checks
Reviewed-by: Marton Balint <cus@passwd.hu>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2020-07-25 10:20:18 +08:00
Wang Cao
017bf9643f 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>
2020-07-24 19:10:10 -07:00
Wang Cao
498ad7b37c 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>
2020-07-24 19:10:10 -07:00
Gautam Ramakrishnan
ff5b9ece42 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>
2020-07-24 22:34:15 +02:00
Michael Niedermayer
4333718b35 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>
2020-07-24 22:34:15 +02:00
Linjie Fu
21442a820a 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>
2020-07-24 13:44:09 +08:00
Mark Thompson
9badc60292 vaapi_encode_h265: Enable 4:2:2 support 2020-07-24 13:44:09 +08:00
Andreas Rheinhardt
6f134c6d17 avformat/matroskadec: Slightly simplify version check
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-07-24 04:25:45 +02:00
Andreas Rheinhardt
880519c1de 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>
2020-07-24 04:25:45 +02:00
Andreas Rheinhardt
28ce651c6d 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>
2020-07-24 03:23:07 +02:00
Andreas Rheinhardt
78f21cab18 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>
2020-07-24 03:22:06 +02:00