Commit Graph

102591 Commits

Author SHA1 Message Date
Anton Khirnov
ef58f48d59 fate: add a more extensive test for APNG_DISPOSE_OP_BACKGROUND
Uses the sample from #9184.
2021-05-14 11:15:13 +02:00
Anton Khirnov
aa726eaed9 lavc/pngdec: fix updating reference frames for APNG_DISPOSE_OP_BACKGROUND
They should be treated the same as APNG_DISPOSE_OP_NONE.

Broken in 5663301560.

Fixes #9184.
2021-05-14 11:15:13 +02:00
Shubhanshu Saxena
0bdd677c5f lavfi/dnn_backend_native_layer_avgpool.h: Documentation
Add documentation for Average Pool Layer

Signed-off-by: Shubhanshu Saxena <shubhanshu.e01@gmail.com>
2021-05-14 10:21:15 +08:00
James Almer
f44d4f511d avcodec: remove leftover references to AVCodecContext.refcounted_frames
Signed-off-by: James Almer <jamrial@gmail.com>
2021-05-13 22:36:25 -03:00
Andreas Rheinhardt
5a413b392e avcodec/allcodecs: Don't include libx264 twice in the list of codecs
Since a247ac640d, allcodecs.c contained
two lines that matched the regex used by find_filters_extern in
configure; as a result, libx264 appeared twice the list of codecs
(if enabled).

Fix this by using only one matching line by adding a preprocessor define
for the part that differed in the two old lines: The const qualifier.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-05-13 23:22:27 +02:00
Andreas Rheinhardt
6ff2aba088 avformat/utils: Fix NPD when allocating AVStreamInternal fails
Regression since b9c5fdf6027010d15ee90a43aa023e45a5189097;
fixes Coverity ID #1484786.

Also remove the check for st->internal->parser as av_parser_close(NULL)
is a no-op.

Reviewed-by: James Almer <jamrial@gmail.com>
Reviewed-by: Marton Balint <cus@passwd.hu>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-05-13 22:50:53 +02:00
Jan Ekström
ec20b81302 ffmpeg: return no chosen output if an uninitialized stream is unavailable
Otherwise the rate emulation logic in `transcode_step` never gets
hit, and the unavailability flag never gets reset, leading to an
eternal loop with some rate emulation use cases.

This change was missed during the rework of ffmpeg.c, in which
encoder initialization was moved further down the time line in
commit 67be1ce0c6 . Previously,
as the encoder initialization had happened earlier, this state was
not possible (flow getting as far as hitting the rate emulation logic,
yet not having the encoder initialized yet).

Fixes #9160
2021-05-13 17:59:35 +03:00
Gyan Doshi
c122a6c10d doc/filters: correct name for guided filter
Note input requirements and reword option sub description.
2021-05-13 19:06:56 +05:30
Michael Niedermayer
f119d7526e Revert "avcodec/adpcm: Set vqa_version before use in init"
Redundant with ff946633a3.

Found-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This reverts commit 7a403da0cb.
2021-05-13 14:44:55 +02:00
Xuewei Meng
43d70feb78 GSoC: Support fast guided filter.
Two modes are supported in guided filter, basic mode and fast mode.
Basic mode is the initial pushed guided filter without optimization.
Fast mode is implemented based on the basic one by sub-sampling method.
The sub-sampling ratio which can be defined by users controls the
algorithm complexity. The larger the sub-sampling ratio, the lower
the algorithm complexity.

Signed-off-by: Xuewei Meng <xwmeng96@gmail.com>
Reviewed-by: Steven Liu <liuqi05@kuaishou.com>
2021-05-13 11:59:11 +08:00
Peter Ross
b5ea0980c5 fix broken links to msdn documentation
Signed-off-by: Peter Ross <pross@xvid.org>
2021-05-13 09:13:03 +10:00
Michael Niedermayer
63e75e09ae avcodec/clearvideo: Check for 0 tile_shift
Fixes: shift exponent -1 is negative
Fixes: 33401/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_CLEARVIDEO_fuzzer-5908683596890112

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-05-12 23:00:07 +02:00
Michael Niedermayer
e4be734e4f tools/target_dec_fuzzer: Adjust threshold for TAK
Fixes: Timeout
Fixes: 33346/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TAK_fuzzer-4715352157192192

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-05-12 23:00:07 +02:00
Michael Niedermayer
7a403da0cb avcodec/adpcm: Set vqa_version before use in init
Fixes: null pointer dereference
Fixes: 33172/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ADPCM_IMA_WS_fuzzer-5200164273913856

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-05-12 23:00:07 +02:00
Michael Niedermayer
38c4761588 avcodec/vc1: Check remaining bits in ff_vc1_parse_frame_header()
Fixes: Timeout
Fixes: 33156/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WMV3_fuzzer-6259655027326976

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-05-12 23:00:07 +02:00
Michael Niedermayer
9548dc74d8 avformat/mov: Ignore duplicate CoLL
Fixes: memleak
Fixes: 32146/clusterfuzz-testcase-minimized-ffmpeg_dem_MOV_fuzzer-5377612845285376

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-05-12 23:00:07 +02:00
Michael Niedermayer
299a56c900 avformat/mov: Limit nb_chapter_tracks to input size
Fixes: Timeout (15k loop iterations instead of 400m)
Fixes: 31368/clusterfuzz-testcase-minimized-ffmpeg_dem_MOV_fuzzer-6601583174483968

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-05-12 23:00:07 +02:00
Michael Niedermayer
537d402d56 tools/target_dec_fuzzer: Adjust threshold for jpeg2000
Fixes: Timeout (25->4sec)
Fixes: 32780/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_JPEG2000_fuzzer-6017852583837696

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-05-12 23:00:07 +02:00
Michael Niedermayer
578633fc1a avformat/utils: Use 64bit earlier in r_frame_rate check
Fixes: signed integer overflow: 1406796319 * 2 cannot be represented in type 'int'
Fixes: 32777/clusterfuzz-testcase-minimized-ffmpeg_IO_DEMUXER_fuzzer-5632576913014784

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-05-12 23:00:07 +02:00
James Almer
fc99d59553 avutil/imgutils: don't add offsets to NULL pointers
Signed-off-by: James Almer <jamrial@gmail.com>
2021-05-12 15:52:50 -03:00
Anton Khirnov
6a9a4f34bd lavf/flvdec: normalize exporting date metadata
Export them in UTC, not the local timezone. This way the output is
the same everywhere. The timezone information stored in the file is
still ignored, since there seems to be no simple way to export it
correctly.

Format them according to ISO 8601, which we generally use for exporting
dates.

Fixes fate-flv-demux, which was broken since
958bea5248 on some platforms.
2021-05-12 20:19:02 +02:00
Zane van Iperen
dcb285d2b7
avformat: add Argonaut Games CVG muxer
Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
2021-05-12 20:27:02 +10:00
Zane van Iperen
9789ea59d0
avformat: add Argonaut Games CVG demuxer
Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
2021-05-12 20:25:50 +10:00
Zane van Iperen
d1c28c6c78
avcodec/adpcm_psx: ignore unknown flag bits
As per documentation.

Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
2021-05-12 20:25:22 +10:00
Zane van Iperen
a845e6daa9
avcodec/adpcm_psx: always fetch next byte irregardless of flag
Even though all samples are meant to be zero (if flag == 0x07),
doesn't mean that they aren't there. See No$PSX docs [1].

[1]: https://problemkaputt.de/psx-spx.htm#spuadpcmsamples

Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
2021-05-12 20:25:21 +10:00
Andreas Rheinhardt
175f675f7b avcodec/dvdsubdec: Mark decoder as init-threadsafe
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-05-12 06:00:14 +02:00
Andreas Rheinhardt
adf9dd1dec avcodec/dvdsubdec: Remove unnecessary close function
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-05-12 06:00:14 +02:00
Andreas Rheinhardt
5ee8359441 avcodec/metasound: Mark decoder as init-threadsafe
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-05-12 06:00:14 +02:00
Andreas Rheinhardt
06e9e9b2db avcodec/twinvqdec: Mark decoder as init-threadsafe
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-05-12 06:00:14 +02:00
Andreas Rheinhardt
cb59c8cec4 avcodec/nuv: Mark decoder as init-threadsafe
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-05-12 06:00:14 +02:00
Andreas Rheinhardt
4082520385 avcodec/webp: Mark decoder as init-threadsafe
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-05-12 06:00:14 +02:00
Andreas Rheinhardt
99ed543340 avcodec/j2kenc: Make encoder init-threadsafe
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-05-12 06:00:14 +02:00
Andreas Rheinhardt
3c26773ae2 avcodec/jpeg2000dec: Make decoder init-threadsafe
The JPEG-2000 decoder and encoder share common luts; the decoder
initializes them once, guarded by a dedicated AVOnce, whereas
the encoder initializes them always during init. This means that
the decoder is not init-threadsafe; in fact there is a potential
data race because these luts can be initialized while an active
decoder/encoder is using them.

Fix this and make the decoder init-threadsafe by making the
initialization function guard initialization itself with a dedicated
AVOnce.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-05-12 06:00:14 +02:00
Andreas Rheinhardt
b43e946b71 avcodec/mqc: Hardcode tables to save space
mqc currently initializes three arrays at runtime; each of them
has 2 * 47 elements, one is uint16_t, two are uint8_t, so that their
combined size is 8 * 47. The source data for these initializations
is contained in an array of 47 elements of size six. Said array is
only used in order to initialize the other arrays, so the savings
are just 2 * 47B. Yet this is dwarfed by the size of the code for
performing the initializations: It is 109B (GCC 10.2, x64, -O3 albeit
in an av_cold function); this does not even include the size of the
code in the callers. So just hardcode these tables.

This also fixes a data race, because the encoder always initialized
these tables during init, although they might already be used at the
same time by already running encoder/decoder instances.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-05-12 06:00:14 +02:00
Andreas Rheinhardt
6546218572 avcodec/vorbisenc: Combine codebooks, avoid relocations
The Vorbis encoder has an array of a structure containing all
the ingredients for a codebook; this includes a pointer to
the actual codebook and some even have a pointer to an array
containing quant values. Each of these real codebooks is
an array of its own.
These pointers lead to relocations and therefore the array will
be placed in .data.rel.ro and not in .rodata.

This commit avoids the pointers altogether by combining all the actual
codebooks into one big array; the actual codebooks are now accessed
consecutively by incrementing the pointer used to access them by the
length of the actual codebook that has just been dealt with (said length
is contained in the structure describing the codebook). There is
no downside to this given that these codebooks are already only used
once during init.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-05-12 06:00:14 +02:00
Andreas Rheinhardt
e1e59d7383 avcodec/vorbisenc: Mark encoder as init-threadsafe
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-05-12 06:00:14 +02:00
Andreas Rheinhardt
44e0a31ac4 avcodec/vorbisenc: Don't free uninitialized pointers
The Vorbis encoder allocates several arrays destined to contain pointers
to separately allocated arrays; yet these arrays are allocated without
initializing them: They are uninitialized until their final values
are stored in them; so if allocating one of the earlier subarrays fails,
all of the remaining pointers to subarrays are still uninitialized.
But they are used for freeing, resulting in crashes.

Fix this by zero-initializing the arrays with subarrays.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-05-12 06:00:14 +02:00
Andreas Rheinhardt
d919c7165a avcodec/wmaenc: Mark encoders as init-threadsafe
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-05-12 06:00:13 +02:00
Andreas Rheinhardt
20232cbbf7 avcodec/wmaenc: Check operations that can fail
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-05-12 06:00:13 +02:00
Andreas Rheinhardt
08fcb43aff avcodec/wmadec: Mark decoders as init-threadsafe
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-05-12 06:00:13 +02:00
Andreas Rheinhardt
bd1cbb5427 avcodec/wmadec: Check operations that can fail
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-05-12 06:00:13 +02:00
Andreas Rheinhardt
35381d2201 avcodec/wmadec: Forward error instead of return -1
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-05-12 06:00:13 +02:00
Andreas Rheinhardt
cb8f01951b avcodec/wma: Check initializing VLC
Initializing a VLC entails implicit allocations which may fail.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-05-12 06:00:13 +02:00
Andreas Rheinhardt
fcdb012a10 avcodec/wma(dec|enc): Fix memleaks upon allocation error
ff_wma_init() can fail without freeing everything it has allocated;
so add the FF_CODEC_CAP_INIT_CLEANUP to the codecs using it.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-05-12 06:00:13 +02:00
Andreas Rheinhardt
0bc522a0a1 avcodec/wma: Remove nonsense volatile
The address of this variable never leaks, so it cannot be modified
by anyone else at all.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-05-12 06:00:13 +02:00
Jun Zhao
d5e575ef6a doc/filters: Update commands doc for amix
commit 95b854dd06 "rename sum option to normalize" missed command
part docs

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
Reviewed-by: Gyan Doshi <ffmpeg@gyani.pro>
2021-05-11 20:24:39 +08:00
Limin Wang
2899fb61d2 avfilter/dnn/dnn_backend_tf: fix cross library usage
duplicate ff_hex_to_data() function from avformat and rename it to
hex_to_data() as static function.

Reviewed-by: Guo, Yejun <yejun.guo@intel.com>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2021-05-11 18:46:14 +08:00
Steven Liu
7ce0f246f4 avfilter/vf_dnn_classify: add result check for av_frame_get_side_data
CID: 1482090
there can return null from av_frame_get_side_data, and will use sd->data
after av_frame_get_side_data, so should check null return value.

Signed-off-by: Steven Liu <liuqi05@kuaishou.com>
2021-05-11 10:49:33 +08:00
Ting Fu
c38bc5634d dnn/vf_dnn_detect.c: add tensorflow output parse support
Testing model is tensorflow offical model in github repo, please refer
https://github.com/tensorflow/models/blob/master/research/object_detection/g3doc/tf2_detection_zoo.md
to download the detect model as you need.
For example, local testing was carried on with 'ssd_mobilenet_v2_coco_2018_03_29.tar.gz', and
used one image of dog in
https://github.com/tensorflow/models/blob/master/research/object_detection/test_images/image1.jpg

Testing command is:
./ffmpeg -i image1.jpg -vf dnn_detect=dnn_backend=tensorflow:input=image_tensor:output=\
"num_detections&detection_scores&detection_classes&detection_boxes":model=ssd_mobilenet_v2_coco.pb,\
showinfo -f null -

We will see the result similar as below:
[Parsed_showinfo_1 @ 0x33e65f0]   side data - detection bounding boxes:
[Parsed_showinfo_1 @ 0x33e65f0] source: ssd_mobilenet_v2_coco.pb
[Parsed_showinfo_1 @ 0x33e65f0] index: 0,       region: (382, 60) -> (1005, 593), label: 18, confidence: 9834/10000.
[Parsed_showinfo_1 @ 0x33e65f0] index: 1,       region: (12, 8) -> (328, 549), label: 18, confidence: 8555/10000.
[Parsed_showinfo_1 @ 0x33e65f0] index: 2,       region: (293, 7) -> (682, 458), label: 1, confidence: 8033/10000.
[Parsed_showinfo_1 @ 0x33e65f0] index: 3,       region: (342, 0) -> (690, 325), label: 1, confidence: 5878/10000.

There are two boxes of dog with cores 94.05% & 93.45% and two boxes of person with scores 80.33% & 58.78%.

Signed-off-by: Ting Fu <ting.fu@intel.com>
Signed-off-by: Guo, Yejun <yejun.guo@intel.com>
2021-05-11 10:38:36 +08:00
Ting Fu
e42125edab lavfi/dnn_backend_tensorflow: support detect model
Signed-off-by: Ting Fu <ting.fu@intel.com>
2021-05-11 10:28:35 +08:00