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

109394 Commits

Author SHA1 Message Date
Lynne
d556f6fa9b
fate/aacenc: increase tolerance for ln-128k test
The encoder is sensitive to changes in precision, and its test target
was a compromise. It was already close to failing on x87 FPUs.
ff_mdct_init used double precision entirely from the scale to computing
the MDCT exp tables. av_tx_init uses single-precision for the scale,
with a small input change which was enough to tip the test into failing on
x87 FPUs.

Increase the fuzz factor in line with other AAC encoder tests to fix.
2022-11-24 15:58:22 +01:00
Andreas Rheinhardt
c8e9cc8d20 avcodec/flashsvenc: Remove unnecessary or unused variable
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-11-23 22:44:09 +01:00
Andreas Rheinhardt
61d28ee0e4 avcodec/flashsvenc: Avoid copying frame
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-11-23 22:44:09 +01:00
Andreas Rheinhardt
a8d39e8846 avcodec/flashsvenc: Change check for first frame
AVCodecContext.frame_number is actually only incremented
in case encoding was successfull; if e.g. the ff_alloc_packet()
below fails, it won't be incremented and therefore it is possible
for the previous_frame buffer to be allocated for multiple
first frames, leaking every one except the last.
So check for whether there already is a previous frame instead.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-11-23 22:44:09 +01:00
Andreas Rheinhardt
721305e280 avcodec/flashsvenc: Use const where appropriate
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-11-23 22:44:09 +01:00
Andreas Rheinhardt
44c09e86c7 avcodec/flashsvenc: Remove unused buffer
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-11-23 22:44:09 +01:00
Andreas Rheinhardt
6695983111 avcodec/flashsvenc: Fix packet size calculation
The earlier code did not account for the frame header as well
as the block headers; furthermore, in case a large part of
a block is unused (due to padding), the output size may
exceed 3 * width * height (where the dimensions correspond
to the visible pixels) due to the overhead of the zlib header,
so use the padded dimensions to calculate the maximum packet size
(which is also what the actual call to compress2() uses).
Fixes ticket #10053.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-11-23 22:44:09 +01:00
Andreas Rheinhardt
715bf3509a avcodec/pnmenc: Check av_image_get_buffer_size()
Fixes the crash in ticket #10050.
Also ensure that we don't overflow before ff_get_encode_buffer().

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-11-23 22:44:09 +01:00
Anton Khirnov
14c6093528 doc/developer.texi: extend and update naming conventions
Bring it up to date with current practice, as the current text does not
cover everything. Drop the reference to unprefixed exported symbols,
which do not exist anymore.
2022-11-23 10:43:41 +01:00
Anton Khirnov
2d172b89b2 doc/developer.texi: drop a misplaced sentence from code formatting section
It describes a general development policy, not code formatting. It is
also not true, as these days we tend to prioritize correctness, safety,
and completeness over code size.
2022-11-23 10:43:27 +01:00
Anton Khirnov
d95d0b1b72 doc/developer.texi: move editor configuration under formatting
It logically belongs there.
2022-11-23 10:43:22 +01:00
Anton Khirnov
9177556bb9 doc/developer.texi: update the language feature section
It is currently very out of touch with reality.

* declare we are using C99 fully, rather than C90 plus extensions
* mention our use of stdatomic.h
* mention forbidden C99 features, like VLAs and complex numbers
2022-11-23 10:41:06 +01:00
Anton Khirnov
256db01851 doc/developer.texi: move the language feature section higher up
It makes more sense to first describe the language we are using and only
then document how to format code in it, rather than the reverse.
2022-11-23 10:41:01 +01:00
Anton Khirnov
703e76f917 configure: drop support for complex functions
They are not used since 520a5d33f0.
2022-11-23 10:40:55 +01:00
Anton Khirnov
95af0bcc34 fftools/ffmpeg_mux_init: postpone matching -disposition to streams
Do it in set_dispositions() rather than during stream creation.

Since at this point all other stream information is known, this allows
setting disposition based on metadata, which implements #10015. This
also avoids an extra allocated string in OutputStream that was unused
after of_open().
2022-11-23 10:36:23 +01:00
Anton Khirnov
3da5c60aa9 fftools/ffmpeg: _-prefix variables in MATCH_PER_STREAM_OPT()
Avoids conflicts, e.g. when 'i' is used in the outvar expression.
2022-11-23 10:36:23 +01:00
Anton Khirnov
996fed5235 fftools/ffmpeg: declare loop variables inside loops in transcode_init() 2022-11-23 10:36:23 +01:00
Anton Khirnov
005f4e1caf fftools/ffmpeg: do not assume input streams exist
There can be zero input streams, with input provided by lavfi complex
filtergraphs.
2022-11-23 10:36:23 +01:00
Anton Khirnov
fd8bf8d3b5 fftools/ffmpeg: remove the input_streams global
Replace it with an array of streams in each InputFile. This is a more
accurate reflection of the actual relationship between InputStream and
InputFile.

Analogous to what was previously done to output streams in
7ef7a22251.
2022-11-23 10:36:23 +01:00
Anton Khirnov
86e2ffedfe fftools/ffmpeg_mux_init: simplify inner loop in map_auto_{video,audio}
Skip unusable streams early and do not compute any scores for them.
2022-11-23 10:36:23 +01:00
Anton Khirnov
4c40581614 fftools/ffmpeg: replace OutputStream.source_index with a pointer to InputStream
This is simpler. The indirection via an index exists for historical
reasons that longer apply.
2022-11-23 10:36:23 +01:00
Anton Khirnov
bda06c60fe fftools/ffmpeg: stop inventing fake source information
This code was supposed to affect copying stream dispositions, but it
does not achieve that after bd55552d69, since dispositions are set
earlier.
2022-11-23 10:36:23 +01:00
Anton Khirnov
50ecba7e84 fftools/ffmpeg: drop an arbitrary condition
Encoding init code will currently fall back to a 25fps default when no
framerate is known or specified, but only if there is a known source
input stream. There is no good reason for this condition, so drop it.
2022-11-23 10:36:23 +01:00
Anton Khirnov
9654df1336 fftools/ffmpeg: move freeing an input stream into a separate function 2022-11-23 10:36:23 +01:00
Marton Balint
98f6c59f4f avformat/electronicarts: add option to return alpha channel in the main video stream in VP6A codec
VP6 alpha in EA format is a second VP6 encoded video stream where only the Y
component is used and is interpreted as the alpha channel of the first VP6
stream. The alpha VP6 stream is muxed separately from the main VP6 stream, has
its own stream headers and packet headers. In theory the two streams might not
even have the same resolution (although most likely that is not something that
is seen or supported in the wild), but the format is capable of doing it.

Merged VP6 alpha (also known as the VP6A codec) means that a packet of the
video stream contains the corresponding packet of both VP6 substreams like
this:

{OffsetOfAlpha, DataPacket, AlphaDataPacket}

So data and alpha data of a frame is merged to a single packet, this is how VP6
video with alpha is muxed in FLV and SWF.

The first approach is more like how the demuxer sees data in the EA format,
unfortunately it is different to what the FLV or SWF format expects, so -
having no better place for it in the framework - I decided to do an optional
format conversion in the EA demuxer.

Signed-off-by: Marton Balint <cus@passwd.hu>
2022-11-22 22:59:51 +01:00
Marton Balint
bd5ea78556 avformat/electronicarts: set packet_read in one place
Signed-off-by: Marton Balint <cus@passwd.hu>
2022-11-22 22:54:27 +01:00
Marton Balint
29d1d3e2e8 avformat/electronicarts: fix EOF check
Similar to feof(), avio_feof() is only true after an actual overread.

Signed-off-by: Marton Balint <cus@passwd.hu>
2022-11-22 22:54:27 +01:00
Paul B Mahol
abb5ff373d avcodec/bonk: check level value to not reach invalid values
Also reset bitstream parsing variables on fatal error.
2022-11-22 20:51:42 +01:00
Haihao Xiang
9f5a9a7499 Changelog: Add missing lines for QSV
Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2022-11-22 13:53:08 +08:00
Haihao Xiang
3dc8bceabe lavu/pixfmt: Update the description for AV_PIX_FMT_QSV
Since D3D11 was introduced for QSV in FFmpeg 5.0, there is an implied
API/ABI change for user-supplied frames [1], hence update the
description for AV_PIX_FMT_QSV.

[1] https://ffmpeg.org/pipermail/ffmpeg-devel/2021-December/290444.html

Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2022-11-22 13:52:38 +08:00
Wenbin Chen
efe2b63c89 doc/examples: Add qsv_transcode example
Add qsv_transcode example which shows how to use qsv to do hardware
accelerated transcoding, also show how to dynamically set encoding
parameters.

examples:
Normal usage:
qsv_transcode input.mp4 h264_qsv output.mp4 "g 60"

Dynamic setting usage:
qsv_transcode input.mp4 hevc_qsv output.mp4 "g 60 asyne_depth 1"
100 "g 120"
This command initializes codec with gop_size 60 and change it to
120 after 100 frames

Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2022-11-22 13:52:38 +08:00
Zhao Zhili
c0c0a5f106 fftools/ffmpeg_demux: set default hwaccel_output_format for mediacodec
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2022-11-21 23:57:10 +08:00
Zhao Zhili
b7a3f16957 avutil/hwcontext: verify hw_frames_ctx in transfer_data_alloc
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2022-11-21 23:57:03 +08:00
Zhao Zhili
0ff18a7d6d avcodec: add MediaCodec encoder
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2022-11-21 23:56:16 +08:00
Zhao Zhili
3a59446967 avcodec/mediacodec: add ANativeWindow support
ANativeWindow can be used without JVM.
2022-11-21 23:55:57 +08:00
Zhao Zhili
2697f23f4e avutil/hwcontext_mediacodec: add ANativeWindow support
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2022-11-21 23:53:27 +08:00
Zhao Zhili
040567965e avcodec/mediacodecdec: enable NDK mediacodec
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2022-11-21 23:53:04 +08:00
Zhao Zhili
4df9cb918e avcodec/mediacodec: add NDK media codec wrapper
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2022-11-21 23:52:34 +08:00
Zhao Zhili
4f2ea862b3 avcodec/mediacodec_wrapper: separate implementation from interface
This is in preparation for NDK media codec wrapper.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2022-11-21 23:52:25 +08:00
Zhao Zhili
d4b06c99ab avcodec/mediacodecdec_common: fix useless av_buffer_unref
Since frame->buf[0] is always NULL in this case, av_buffer_unref
has no effect. If it's not NULL, double-free will happen.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2022-11-21 23:52:18 +08:00
Zhao Zhili
2b97fdb8cc avcodec/mediacodecdec_common: fix misuse av_free/av_freep
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2022-11-21 23:52:11 +08:00
Zhao Zhili
b1facd11a3 avcodec/mediacodecdec: don't break out if both input and output port return try again
At the beginning of decoding, if we feed mediacodec too fast, the
input port will return try again. It takes some time for mediacodec
to consume bitstream and output frame. So the output port also return
try again. It possible that mediacodec_receive_frame doesn't consume
any AVPacket and no AVFrame is output. Then both avcodec_send_packet()
and avcodec_receive_frame() return EAGAIN, which shouldn't happen.

This bug can be produced with decoding benchmark on Pixel 3.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2022-11-21 23:52:02 +08:00
Zhao Zhili
093c437321 avcodec/mediacodec: fix incorrect crop info
The crop info is optional, but used unconditionally.

Co-authored-by: Aman Karmani <ffmpeg@tmm1.net>
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2022-11-21 23:51:53 +08:00
Paul B Mahol
3e288dbf56 avfilter/avf_showspectrum: set hop_size for showspectrumpic
Fixes invalid spikes in video output.
2022-11-21 15:47:02 +01:00
Wang, Bin
459527108a libavfilter/x86/vf_convolution: fix sobel swap issue on WIN64
Reviewed by: James Almer <jamrial@gmail.com>
Signed-off-by: Wang, Bin <bin.wang@intel.com>
2022-11-21 12:28:25 +08:00
Michael Niedermayer
ba209e3d51
swscale/input: Use more unsigned intermediates
Same principle as previous commit, with sufficiently huge rgb2yuv table
values this produces wrong results and undefined behavior.
The unsigned produces the same incorrect results. That is probably
ok as these cases with huge values seem not to occur in any real
use case.

Fixes: signed integer overflow
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-11-20 21:55:06 +01:00
Jeremy Dorfman
ce566281f9
swscale/input: Use unsigned intermediates in rgb64ToUV_c_template
Large rgb2yuv tables and high pixel values cause the intermediate
int32_t of ru*r + gu*g + bu*b to exceed INT_MAX, which is undefined
behavior. This causes libswscale built with LLVM -fsanitize=undefined to
assert. Using unsigned integers instead has defined behavior and
produces identical results, and makes rgb64ToUV_c_template match
rgb64ToY_c_template.

Fixes: signed integer overflow
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-11-20 21:23:57 +01:00
Michael Niedermayer
0871cb9499
avcodec/vqcdec: Check for end of input in decode_vectors()
Fixes: Timeout
Fixes: 52695/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VQC_fuzzer-4882310386548736

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Peter Ross <pross@xvid.org>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-11-20 21:23:57 +01:00
Michael Niedermayer
6634b6ae5f
avcodec/apac: reset buffer on error
Fixes: repeatly parsing the same data after each 1 byte packet
Fixes: Timeout
Fixes: 51943/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_APAC_fuzzer-5779018251370496

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-11-20 21:23:35 +01:00
Christopher Degawa
96748ac54f avcodec/libsvtav1: only set max_buf_sz if both bitrate and rc_buf_sz is set
maximum_buffer_size_ms should only be set if both are specified or if
the user sets it through -svtav1-params buf-sz=val

Signed-off-by: Christopher Degawa <ccom@randomderp.com>
2022-11-20 16:20:14 -03:00