Commit Graph

109360 Commits

Author SHA1 Message Date
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
Paul B Mahol 34eeb466fb avfilter/af_surround: fix possible out of array access 2022-11-19 19:35:23 +01:00
Hirokazu Honda 7f3e38bda8 avcodec/vp8: Fix wrong vpx_rac_is_end() check
The check of vpx_rac_is_end check(s) are added originally from
1afd246960. It causes a regression
of some vp8 stream. b6b9ac5698 fixes
the regression by a sort of band-aid way. This fixes the wrongness
of the original commit. vpx_rac_is_end() should be called against
the bool decoder for the vp8 headr context, not one for each
coefficient. Reference is vp8_dixie_tokens_process_row() in token.c
in spec 20.16.

Fixes: Ticket 8069
Fixes: regression of 1afd246960.
Fixes: b6b9ac5698

Co-authored-by: Ronald S. Bultje <rsbultje@gmail.com>
Signed-off-by: Hirokazu Honda <hiroh@chromium.org>
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
2022-11-19 10:04:01 -05:00
Paul B Mahol 66afa361e8 avfilter/af_surround: refactor code
So support for new i/o layouts are more easily added.
2022-11-19 15:20:23 +01:00
Niklas Haas 46a4cc460e avfilter/vf_libplacebo: fix normalize_sar calculation
This previous expression multiplied a constant (outlink->h) that was
guaranteed to be 0 at this point, thus making it always a no-op.

Fix the calculation, and also properly reset the SAR to 1:1 as is now
necessary (the failure to do so previously hid this bug's existence).
2022-11-19 14:15:47 +01:00
Niklas Haas 05d390890a avfilter/vf_libplacebo: default to normalize_sar=0
As a result of a typo in the source code, this option was completely
non-functional. In order to fix it, without breaking the current default
behavior, explicitly change this default to 0.

This behavior is also consistent with how other scale filters behave by
default, so it's probably best to enshrine it anyways.
2022-11-19 14:15:19 +01:00
Paul B Mahol 3bcec58535 avfilter: fix av_tx_fn stride usage for complex inputs 2022-11-19 00:25:47 +01:00
Paul B Mahol fced45fd95 avfilter/af_surround: improve LFE loudness 2022-11-18 21:51:10 +01:00
Paul B Mahol 52291d2ac8 avfilter/af_surround: implement smooth option/support 2022-11-18 21:51:10 +01:00
Paul B Mahol 3d33003d59 avfilter/af_surround: split factors calculations
From multiplication with magnitude.
2022-11-18 21:51:10 +01:00
Paul B Mahol 08b4c3d6d6 avfilter/af_surround: improve front center channel
Stops producing too loud output of front center channel in stereo upmix
by using average magnitude instead of square root of squared magnitudes.
2022-11-18 21:51:10 +01:00
Niklas Haas 12b4ab5d4d avfilter/vf_libplacebo: fix output format selection
After commit c0b93, it's possible that `ff_vk_filter_config_input` never
gets called, leading to `s->vkctx.input_format` being left unset. This
broke the format auto-selection logic in `libplacebo_config_output`,
resulting in a default to yuv420p, instead of defaulting to the input
format as intended.

Fixes: c0b93c4f8b
2022-11-18 16:14:23 +01:00
Niklas Haas d1b14b4f0b avfilter/vf_libplacebo: suppress warning on older libplacebo
Move the declaration before the code.
2022-11-18 16:11:01 +01:00
Paul B Mahol 3e6816514c avfilter/af_surround: fix regression with channel i/o gain 2022-11-18 12:58:09 +01:00
Paul B Mahol 193270ee87 avfilter/avf_showspectrum: fix stride and set scale 2022-11-18 12:58:09 +01:00
Zhao Zhili 36a8d1e729 avcodec/libx265: fix build error
x265_sei is available since X265_BUILD 88. Bump required version
to 89 to fix the regression from commit 1f58503013, and remove a
conditional compilation.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2022-11-18 23:18:21 +08:00
Paul B Mahol 00409d81d9 avfilter/af_surround: simplify some code more 2022-11-18 00:53:51 +01:00
Christopher Degawa 1c6fd7d756 avcodec/libsvtav1: replace vbv_bufsize with maximum_buffer_size_ms
svt-av1 v1.2.0 has deprecated vbv_bufsize in favor of using
- maximum_buffer_size_ms (--buf-sz)
- starting_buffer_level_ms (--buf-initial-sz)
- optimal_buffer_level_ms (--buf-optimal-sz)

and vbv_bufsize has not been in use since svt-av1 v0.8.6

Signed-off-by: Christopher Degawa <christopher.degawa@intel.com>
2022-11-17 20:27:33 -03:00
Christopher Degawa 031f1561cd avcodec/libsvtav1: remove compressed_ten_bit_format and simplify alloc_buffer
compressed_ten_bit_format has been deprecated upstream and has no effect
and can be removed. Plus, technically it was never used in the first place
since it would require the app (ffmpeg) to set it and do additional
processing of the input frames.

Also simplify alloc_buffer by removing calculations relating to the
non-existant processing.

Signed-off-by: Christopher Degawa <christopher.degawa@intel.com>
2022-11-17 20:27:33 -03:00
Paul B Mahol 2e53376a9b avfilter/af_surround: add more layouts for stereo upmix 2022-11-17 20:27:31 +01:00
James Almer 63db6a02a7 avformat/concatdec: check that there's extradata before trying to copy it
The first argument for memcpy must not be NULL.

Signed-off-by: James Almer <jamrial@gmail.com>
2022-11-17 10:53:20 -03:00
James Almer cb925c0bc0 avformat/vpcc: parse bitstream data to get profile and bitdepth
Profile can be derived from values codecpar pixel format only with software
formats. For hardware formats, we're forced to parse a frame header to get
the required information.

Signed-off-by: James Almer <jamrial@gmail.com>
2022-11-17 10:05:49 -03:00
Paul B Mahol e9a67ababa avcodec/rpzaenc: count in packet size also fixed header 2022-11-17 13:54:52 +01:00
Paul B Mahol 4f6c06e8ff avfilter/af_firequalizer: switch to TX from lavu 2022-11-17 13:28:58 +01:00
Paul B Mahol 59b16355ec avfilter/avf_showspatial: switch to lavu TX
Also try harder to make output constant frame rate.
2022-11-17 12:37:22 +01:00
Paul B Mahol 24cd4c9661 avfilter/af_loudnorm: simplify query_formats() 2022-11-17 12:37:22 +01:00
Martin Storsjö cc6312dd3b fate: Mark the tiff-zip-* tests as requiring zlib
Signed-off-by: Martin Storsjö <martin@martin.st>
2022-11-17 13:23:14 +02:00
Anton Khirnov 6a3e174ad1 doc/developer.texi: refine the "contributing code" section
Drop the reference to directly committing code, because
- it is highly discouraged and very rarely done these days
- there is no good reason NOT to submit patches for review

Add a link to the development policy chapter.
2022-11-17 10:58:30 +01:00
Anton Khirnov 66871647dc doc/developer.texi: demote the "contributing" chapter to a section
It is very short and its main functions is linking to the
coding rules/submitting patches chapters.
2022-11-17 10:58:20 +01:00
Anton Khirnov c0c492dd47 doc/developer.texi: extend the argument for submitting patches
Stop talking about commercial programs, since this applies to any
downstream user.
2022-11-17 10:57:37 +01:00
Anton Khirnov 26080d1542 doc/developer.texi: improve the introductory text
Remove confusing references to "external" vs. "internal" developers.
2022-11-17 10:56:48 +01:00
Anton Khirnov b58264217b fftools/ffmpeg_mux_init: drop an always-false check
It cannot be true since 1959351aec. Effectively reverts 6a3833e141.
2022-11-17 10:52:58 +01:00
Anton Khirnov 13947aff3f fftools/ffmpeg_mux_init: use av_dict_iterate() where appropriate 2022-11-17 10:52:58 +01:00
Anton Khirnov 19e192eae6 fftools/ffmpeg_mux_init: do not call av{codec,format}_get_class() repeatedly 2022-11-17 10:52:58 +01:00
Anton Khirnov 52380a055b fftools/ffmpeg_mux_init: move validating codec avoptions to a separate function 2022-11-17 10:52:58 +01:00