1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-18 03:19:31 +02:00
Commit Graph

107275 Commits

Author SHA1 Message Date
Jan Ekström
92dc9c9d68 avcodec/ac3_parser{,_internal}: expose AC-3 bit_rate_code
Required by MP4's AC3SpecificBox and MPEG-TS AC-3 audio_descriptor,
of which the former is implemented in our MP4 writer.

Signed-off-by: Jan Ekström <jan.ekstrom@24i.com>
2022-06-30 16:14:05 +03:00
Paul B Mahol
3f72155fc6 avcodec/exrenc: add grayf32 format support 2022-06-30 15:07:55 +02:00
Andreas Rheinhardt
03b2ed9a50 avcodec/hevcdec: Return immediately upon hevc_init_context() failure
This function is only called from the decoder's init function
and given that this decoder has FF_CODEC_CAP_INIT_CLEANUP set,
hevc_decode_free() is called automatically (currently it would
be called twice with the second call being redundant).

Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-06-30 11:06:46 +02:00
Andreas Rheinhardt
a3b833c3ea avcodec/hevcdec: Remove redundant context_initialized
All contexts are always initialized during init, regardless
of whether frame threading is in use or not.

Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-06-30 11:06:20 +02:00
Andreas Rheinhardt
9a167a15c7 avcodec/avcodec: Don't mention removed function
avcodec_thread_init() has been removed in
9a79bb552a.

Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-06-30 11:02:21 +02:00
Vignesh Venkatasubramanian
be4d1caad4 avformat/mov: Only read the primary item for AVIF
Update the still AVIF parser to only read the primary item. With this
patch, AVIF still images with exif/icc/alpha channel will no longer
fail to parse.

For example, this patch enables parsing of files in:
https://github.com/AOMediaCodec/av1-avif/tree/master/testFiles/Microsoft

Adding two fate tests:
1) demuxing of still image with 1 item - this test will pass regardless
   of this patch.
2) demuxing of still image with 2 items - this test will fail without
   this patch and will pass with patch applied.

Partially fixes trac ticket #7621

Signed-off-by: Vignesh Venkatasubramanian <vigneshv@google.com>
Signed-off-by: James Zern <jzern@google.com>
2022-06-29 12:16:40 -07:00
Paul B Mahol
42d75f2faa avcodec/pnmenc: reindent 2022-06-29 09:52:24 +02:00
Paul B Mahol
ed4bad9977 avcodec/pnmenc: add support for grayf32 in PFM image 2022-06-29 09:51:05 +02:00
huheng
8d4bdf99e5 avformat/hlsenc: Add resend_headers option
Add pat and pmt table at start of each segment in single_file mode enhanced
compatibility of hls stream. Because some hls clients separate parsing segment
of hls stream, the absence of pat/pmt will cause parsing to fail.

Reviewed-by: Steven Liu <liuqi05@kuaishou.com>
Signed-off-by: huheng <heng.hu.1989@gmail.com>
2022-06-29 14:07:03 +08:00
Li Kai
df8ad4e391 avformat/hls: add #EXT-X-START tag support by prefer_x_start opt
Reviewed-by: Steven Liu <liuqi05@kuaishou.com>
Signed-off-by: Li Kai <wolfleekay@gmail.com>
2022-06-29 14:03:36 +08:00
Lucy
1af3698296 avformat/hlsenc: Use HLS version 2 if rounded durations are enabled
This allows for wider compatibility with older devices, such as those
running iOS 3. The only difference between HLS version 2 and version 3 is
that version 3 supports non-integer EXTINF values, and as such, we can
default to version 2 if we're using whole-integer EXTINFs anyways, when
`-hls_flags round_durations` is set.

As this code seems to otherwise consistently use the lowest compatible
version, this seems to fit in properly with existing behavior.

Testing confirms with that this patch, HLS output can work all the way back
to iOS 3.

Reviewed-by: Steven Liu <liuqi05@kuaishou.com>
Signed-off-by: Lucy <lucy@absolucy.moe>
2022-06-29 14:03:32 +08:00
Martin Storsjö
900424cda9 checkasm: Provide enough alignment in the new motion test
This fixes the checkasm test in some setups on x86.

Signed-off-by: Martin Storsjö <martin@martin.st>
2022-06-28 18:09:08 +03:00
Andreas Rheinhardt
4454142782 avutil/wchar_filename: Make the header C++ compatible
When compiling decklink, this header is included from
a C++ file (albeit inside 'extern "C"') and this
causes compilation failures because of an implicit
void* -> char* conversion. So add an explicit cast.
Fixes ticket #9819.

Reviewed-by: Martin Storsjö <martin@martin.st>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-06-28 10:59:31 +02:00
Swinney, Jonathan
c471cc7474 lavc/aarch64: motion estimation functions in neon
- ff_pix_abs16_neon
 - ff_pix_abs16_xy2_neon

In direct micro benchmarks of these ff functions verses their C implementations,
these functions performed as follows on AWS Graviton 3.

ff_pix_abs16_neon:
pix_abs_0_0_c: 141.1
pix_abs_0_0_neon: 19.6

ff_pix_abs16_xy2_neon:
pix_abs_0_3_c: 269.1
pix_abs_0_3_neon: 39.3

Tested with:
./tests/checkasm/checkasm --test=motion --bench --disable-linux-perf

Signed-off-by: Jonathan Swinney <jswinney@amazon.com>
Signed-off-by: Martin Storsjö <martin@martin.st>
2022-06-28 00:51:39 +03:00
Marton Balint
20e2aa940c fftools/ffmpeg: change frame counters to 64 bit
Frame counters can overflow relatively easily (INT_MAX number of frames is
slightly more than 1 year for 60 fps content), so make sure we are always
using 64 bit values for them.

A live stream can easily run for more than a year and the framedup logic breaks
on an overflow.

Signed-off-by: Marton Balint <cus@passwd.hu>
2022-06-27 20:37:43 +02:00
Ivan Baykalov
cbe216d3a6 avformat/mov: read PCM audio configuration box ('pcmC') if available
For ipcm and fpcm streams, big-endian format is the default, but it can be changed
with additional 'pcmC' sub-atom of audio sample description.

Details can be found in ISO/IEC 23003-5:2020

Fixes ticket #9763.
Fixes ticket #9790.

Patch simplified by Marton Balint.

Signed-off-by: Marton Balint <cus@passwd.hu>
2022-06-27 20:29:47 +02:00
Marton Balint
cd83383f4d avformat/mov: factorize setting little endian PCM streams
Signed-off-by: Marton Balint <cus@passwd.hu>
2022-06-27 20:29:47 +02:00
Vignesh Venkatasubramanian
2a3640de84 avformat/movenc: Support alpha channel for AVIF
AVIF specification allows for alpha channel as an auxiliary item (in
case of still images) or as an auxiliary track (in case of animated
images).  Add support for both of these. The AVIF muxer will take
exactly two streams (when alpha is present) as input (first one being
the YUV planes and the second one being the alpha plane).

The input has to come from two different images (one of it color and
the other one being alpha), or it can come from a single file
source with the alpha channel extracted using the "alphaextract"
filter.

Example using alphaextract:
ffmpeg -i rgba.png -filter_complex "[0:v]alphaextract[a]" -map 0 -map "[a]" -still-picture 1 avif_with_alpha.avif

Example using two sources (first source can be in any pixel format and
the second source has to be in monochrome grey pixel format):
ffmpeg -i color.avif -i grey.avif -map 0 -map 1 -c copy avif_with_alpha.avif

The generated files pass the compliance checks in Compliance Warden:
https://github.com/gpac/ComplianceWarden

libavif (the reference avif library) is able to decode the files
generated using this patch.

They also play back properly (with transparent background) in:
1) Chrome
2) Firefox (only still AVIF, no animation support)

Reviewed-by: James Zern <jzern@google.com>
Signed-off-by: Vignesh Venkatasubramanian <vigneshv@google.com>
2022-06-27 13:46:33 -03:00
Niklas Haas
a526f0cc3a fftools/ffplay: fix YUV conversion mode
GL and Metal cache the state at time of texture creation. GLES2 and
Direct3D 11 use the state at time of the render copy call.

So the only way we can get the correct behavior consistently is by
making sure the state is set for both the upload *and* the draw call.
This probably isn't our bug to fix (upstream should make itself behave
consistently and also document its functions), but as it stands,
`ffplay` is misrendering BT.709 as BT.601 on my stock Linux system, and
that leaves a bad taste in my mouth.

Signed-off-by: Niklas Haas <git@haasn.dev>
2022-06-27 12:17:59 +02:00
Jan Ekström
49027e7612 avcodec/libx265: make X265 CSP selection pixel format independent
Currently the format listing misses the J formats completely, yet
they are marked as supported in the encoder. Thus to make the logic
support them while not explicitly listing them, make the logic
utilize chroma subsampling information in both width and height
available through the pixel format descriptor.
2022-06-27 09:25:22 +03:00
Yue Heng
53baf60603 libavcodec/qsvenc: Enable fixed QP configure in qsv CQP runtime
Enable dynamic QP configuration in runtime on qsv encoder. Through
AVFrame->metadata, we can set key "qsv_config_qp" to change QP
configuration when we encode video in CQP mode.

Signed-off-by: Yue Heng <yue.heng@intel.com>
Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2022-06-27 12:09:44 +08:00
Wenbin Chen
afa20e6db8 libavcodec/qsvenc_hevc: Use default value from MSDK to set bf.
Change the default value of "bf" for hevc_qsv to -1. 8 isn't the best
choice so let MSDK to decide the number of b frames.

Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2022-06-27 12:09:44 +08:00
Zhao Zhili
07bcedc232 avcodec/cuviddec: fix null pointer dereference
It can happened on error path of cuvid_decode_init().

Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
2022-06-26 21:44:12 +02:00
Zhao Zhili
ffc91940a4 avcodec/cuviddec: fix AV1 decoding error
cuvidParseVideoData only supports pure OBUs, it reports an unknown
error with AV1CodecConfigurationRecord. Check whether extradata
is AV1CodecConfigurationRecord and skip the first 4 bytes to fix
the issue.

The bug is revealed in ffmpeg cmd since 45e3b6a68 and ffd1316e.

Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
2022-06-26 21:41:31 +02:00
Jack Bruienne
75638fe940 avcodec: fix time reporting for DFPWM streams
This adds the exact bits per sample for DFPWM to
av_get_exact_bits_per_sample.
Previously, the DTS and PTS were set to 0 because the codec never
reported them, but adding this allows libavformat to automatically
set DTS and PTS from the byte position of the stream.

Signed-off-by: Jack Bruienne <jackbruienne@gmail.com>
2022-06-26 17:04:42 +02:00
Andreas Rheinhardt
9dfec90253 avcodec/x86/h264_qpel: Remove unused functions
Forgotten in 4011a76494.
The reason for this is that these functtions are marked
as av_always_inline and GCC does not emit warnings
if such functions are unused, so this went unnoticed.
Yet Clang does, so this commit removes them.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-06-26 07:09:16 +02:00
Andreas Rheinhardt
2cce1d8528 avformat/matroskaenc: Fix use of uninitialized value
Regression since 67eea6cf02.
Affects only WebVTT when muxing WebM. (This is covered
by the webm-webvtt-remux FATE test which fails for several
FATE boxes on fate-ffmpeg.org.)

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-06-26 06:12:32 +02:00
Michael Niedermayer
e6cad01122 avformat/matroskadec: avoid integer overflows in SAR computation
This ignores >64bit
Alternatively we could support that if it occurs in reality

Fixes: negation of -9223372036854775808
Fixes: integer overflows
Fixes: 46072/clusterfuzz-testcase-minimized-ffmpeg_dem_MATROSKA_fuzzer-5029840966778880

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-06-25 21:36:32 +02:00
Leo Izen
59a58d1a85 avcodec/libjxlenc: properly read input colorspace
Whether an ICC profile is present or not, the libjxl
encoder wrapper should now properly read colorspace tags
and forward them to libjxl appropriately, rather than just
assume sRGB as before. It will also print warnings when
colorimetric assumptions are made about the input data.

Reviewed-by: Niklas Haas <git@haasn.dev>
Signed-off-by: Leo Izen <leo.izen@gmail.com>
2022-06-25 17:07:35 +02:00
Leo Izen
ef43767911 avcodec/libjxldec: properly tag output colorspace
Whether an ICC profile is present or not, the decoder
should now properly tag the colorspace of pixel data
received by the decoder.

Reviewed-by: Niklas Haas <git@haasn.dev>
Signed-off-by: Leo Izen <leo.izen@gmail.com>
2022-06-25 17:07:09 +02:00
Gyan Doshi
0744c84792 avfilter/Makefile: always make colorspace.o
Unbreaks libavfilter builds when configured with a subset of filters.

drawutils added ff_draw_init2 in 6c3a82f043 which calls functions defined in
colorspace.c. So the latter needs to be built alongside the former.
2022-06-25 17:55:53 +05:30
Brad Smith
beaf172d75 avutil/ppc/cpu: Use proper header for OpenBSD PPC CPU detection
Use the proper header for PPC CPU detection code. sys/param.h includes
sys/types, but sys/types.h is the more appropriate header to be used
here.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-06-25 12:16:51 +02:00
James Almer
c7ce03d826 avformat/http: include version.h
This is needed to get LIBAVFORMAT_VERSION, used as part of the user agent.
Fixes a recent regression.

Reviewed-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2022-06-24 23:07:33 -03:00
ManojGuptaBonda
a44fba0b5b AV1 VDPAU hwaccel Decode support
Support for VDPAU accelerated AV1 decoding was added with libvdpau-1.5.
Support for the same in ffmpeg is added with this patch. Profiles
related to VDPAU AV1 can be found in latest vdpau.h present in
libvdpau-1.5.

Add AV1 VDPAU to list of hwaccels and supported formats
Added file vdpau_av1.c and Modified configure to add VDPAU AV1 support.
Mapped AV1 profiles to VDPAU AV1 profiles. Populated the codec specific
params that need to be passed to VDPAU.

Signed-off-by: Philip Langdale <philipl@overt.org>
2022-06-25 09:05:58 +08:00
Andreas Rheinhardt
cf30b538e5 avformat/matroskaenc: Reuse dynamic buffer
Avoids some allocations.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-06-24 18:33:18 +02:00
Andreas Rheinhardt
745966ab81 avformat/matroskaenc: Fix outdated comment
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-06-24 18:33:18 +02:00
Andreas Rheinhardt
e689a1171d avformat/matroskaenc: Improve handling of AV1 extradata
Up until now, only the first four bytes (the ones preceding
the OBU) were written because not enough space has been reserved
for the complete CodecPrivate. This commit changes this
by increasing the space reserved for the CodecPrivate (it is big
enough for every sane sequence header plus something extra);
the code falls back to writing four bytes in case the increased
space turns out to be insufficient.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-06-24 18:33:18 +02:00
Andreas Rheinhardt
a367e435d8 avcodec/av1: Add upper bound for the size of a sane sequence header
It will be used by the Matroska muxer to reserve a certain number
of bytes for the CodecPrivate in case no extradata is initially
available (as it is for the libaom-av1 encoder).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-06-24 18:33:18 +02:00
Andreas Rheinhardt
67eea6cf02 avformat/matroskaenc: Split updating CodecPrivate from writing it
Up until now, updating extradata was very ad-hoc: The amount of
space reserved for extradata was not recorded when writing the
header; instead the AAC code simply presumed that it was enough.
This commit changes this by recording how much space is available.

This brings with it that the code for writing of and reserving space
for the CodecPrivate and for updating it diverges. They are therefore
split; this allows to put other common tasks like seeking to
right offset as well as writing padding (in case the new extradata did
not fill the whole reserved space) to this common function.

The code for filling up the reserved space is smarter than the code
it replaces; therefore it is no longer necessary to reserve more
than necessary just to be sure that one can add an EBML Void element
(whose minimum size is two) lateron. This is the reason for the change
to the aac-autobsf-adtstoasc test.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-06-24 18:33:18 +02:00
Andreas Rheinhardt
3a00a1a800 avformat/matroskaenc: Avoid swapping codecpar->extradata temporarily
Instead pass extradata and extradata_size explicitly.

(It is not perfect, as ff_put_(wav|bmp)_header() still uses
the extradata embedded in codecpar, but this is not an issue
as long as their CodecPrivate isn't updated.)

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-06-24 18:33:18 +02:00
Andreas Rheinhardt
1056f9a21e avformat/matroskaenc: Split assembling CodecPrivate from writing it
This is in preparation for splitting writing and updating
extradata more thoroughly later.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-06-24 18:33:18 +02:00
Andreas Rheinhardt
70dc5fc658 avcodec/hevc_sei: Fix check for SEI end
The intention behind the current check seems to be to check for
the rbsp_trailing_bits() syntax structure which is always 0x80
for valid SEI messages. Yet this is wrong: These trailing bits
are not part of the GetBitContext -- they have already been
stripped in ff_h2645_packet_split(). And it is harmful, as
0x80 is a legal SEI message payload type (namely for
Structure of pictures information SEI messages). We ignore this
type of SEI, but because of this bug we also ignored every
SEI message in the same NALU following it.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-06-24 18:32:03 +02:00
Andreas Rheinhardt
a217c1472d avcodec/h2645_parse: Only trim RBSP trailing padding if it exists
It does not exist for NALUs for which the SODB is empty;
it also does not exist for NALUs for which not even
the complete header is present. The former category contains
end of sequence and end of bitstream units. The latter category
consists of one-byte HEVC units (the ordinary H.264 header is only
one byte long).
This commit therefore stops stripping RBSP trailing padding
from the former type of unit and discards the latter type of unit
altogether.

This also fixes an assertion failure: Before this commit, a one-byte
HEVC NALU from an ISOBMFF packet could pass all the checks in
hevc_parse_nal_header() (because the first byte of the size field
of the next unit is mistaken as containing the temporal_id);
yet because the trailing padding bits were stripped, its actually
had a size of less than eight bits; because h2645_parse.c uses
the checked bitstream reader, the get_bits_count() of the GetBitContext
is not 16 in this case; it is not even a multiple of eight
and this can trigger an assert in ff_hevc_decode_nal_sei().

Fixes: Assertion failure
Fixes: 46662/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HEVC_fuzzer-4947860854013952

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-06-24 18:31:03 +02:00
Andreas Rheinhardt
48a0cd06e3 avcodec/hevc_ps: Don't use show_bits_long() unnecessarily
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-06-24 18:28:36 +02:00
Andreas Rheinhardt
0bcca1cb40 avcodec/hcadec: Move transient GetBitContext to stack
This avoids keeping pointers to no longer valid data
in the context.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-06-24 18:28:36 +02:00
Andreas Rheinhardt
7a832f11d9 avcodec/hcadec: Don't use GetBit-API for byte-aligned reads
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-06-24 18:28:36 +02:00
Zhao Zhili
9fdfc74877 avcodec/proresdec2: fix description of known fourcc
'acpo' should be 'apco', and add missing 'ap4x'.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2022-06-24 15:49:41 +08:00
Zhao Zhili
2c2e9d3844 avcodec/libuavs3d: fix potential index out of range
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2022-06-24 15:49:11 +08:00
Zhao Zhili
a5931f58f7 avcodec/libdavs2: use frame rate code table
It's more natural than the floating to fraction conversion.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2022-06-24 15:37:23 +08:00
Zhao Zhili
58d6463296 configure: select avs2 parser for libdavs2 decoder
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2022-06-24 15:37:23 +08:00