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

102556 Commits

Author SHA1 Message Date
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
Ting Fu
1b1064054c lavfi/dnn_backend_tensorflow: add multiple outputs support
Signed-off-by: Ting Fu <ting.fu@intel.com>
2021-05-11 10:28:35 +08:00
Ting Fu
f02928eb5a dnn: add DCO_RGB color order to enum DNNColorOrder
Adding DCO_RGB color order to DNNColorOrder, since tensorflow model
needs this kind of color oder as input.

Signed-off-by: Ting Fu <ting.fu@intel.com>
2021-05-11 10:28:35 +08:00
Andreas Rheinhardt
7fac6efa97 avfilter/vf_guided: Add missing const
Forgotten in f8d910e90f.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-05-11 00:29:16 +02:00
Andreas Rheinhardt
6bf95c2066 avcodec/vp3: Mark decoders as init-threadsafe
Reviewed-by: Peter Ross <pross@xvid.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-05-10 23:13:30 +02:00
Andreas Rheinhardt
802166f709 avcodec/vp3: Reindentation
Reviewed-by: Peter Ross <pross@xvid.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-05-10 23:13:14 +02:00
Andreas Rheinhardt
80b5c4bc08 avcodec/vp3: Avoid code duplication when initializing coeff_vlcs
Reviewed-by: Peter Ross <pross@xvid.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-05-10 23:12:15 +02:00
Andreas Rheinhardt
9afb291267 avcodec/vp3: Don't try to decode VP4 when VP4 decoder is disabled
Otherwise decoding will crash lateron; e.g. because dct_tokens
is never set or because a VLC that has not been allocated is used.

Reviewed-by: Peter Ross <pross@xvid.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-05-10 23:11:35 +02:00
Andreas Rheinhardt
af7468a282 avcodec/ttmlenc: Mark encoder as init-threadsafe
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-05-10 22:12:02 +02:00
Andreas Rheinhardt
8f9a4ae63e avcodec/vmdvideo: Mark decoder as init-threadsafe
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-05-10 22:12:02 +02:00
Andreas Rheinhardt
b15fcdfe5c avcodec/vmdvideo: Cleanup generically upon init failure
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-05-10 22:12:02 +02:00
Andreas Rheinhardt
8b32a6f1aa avcodec/dnxhdenc: Mark encoder as init-threadsafe
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-05-10 22:12:02 +02:00
Andreas Rheinhardt
3c1208be02 avcodec/dnxhdenc: Use av_memdup() instead of av_malloc()+memcpy()
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-05-10 22:12:02 +02:00
Andreas Rheinhardt
eb583b3cb9 avcodec/dnxhdenc: Fix segfault when using too many slice threads
The DNXHD encoder's context contains an array of 32 pointers to
DNXHDEncContexts used in case of slice threading; when trying
to use more than 32 threads with slice threading, the encoder's init
function errors out, but the close function takes avctx->thread_count
at face value and tries to free inexistent elements of the array,
leading to potential crashes.

Fix this by modifying the check used to decide whether the slice
contexts should be freed.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-05-10 22:12:02 +02:00
Andreas Rheinhardt
b539ed3fd5 avcodec/dnxhddec: Mark decoder as init-threadsafe
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-05-10 22:12:02 +02:00
Andreas Rheinhardt
413ec81ba8 avcodec/pngenc: Mark encoders as init-threadsafe
Initializing zlib in the way we do here is threadsafe, see
https://www.zlib.net/zlib_faq.html#faq21

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-05-10 22:12:02 +02:00
Andreas Rheinhardt
f100a7de5c avcodec/exrenc: Mark encoder as init-threadsafe
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-05-10 22:12:02 +02:00
Andreas Rheinhardt
3c3712ee2b avcodec/wmaprodec: Make decoders init-threadsafe
In this case this actually fixes a potential data race: The static VLC
tables were reinitialized every time an AVCodecContext has been
initialized; while the mutex in avcodec_open2() ensured that the VLCs
could not be initialized concurrently by multiple threads, nothing
guaranteed that these VLCs are not read concurrently (when decoding a
packet with an already initialized AVCodecContext) while another thread
initializes them. This is undefined behaviour despite the values being
written coinciding with the earlier values.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-05-10 22:12:02 +02:00
Andreas Rheinhardt
a1b0148366 avcodec/wmaprodec: Check ff_mdct_init() for failure
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-05-10 22:12:01 +02:00
Andreas Rheinhardt
6fc4f28a11 avcodec/tscc: Mark decoder as init-threadsafe
Initializing zlib in the way we do here is threadsafe, see
https://www.zlib.net/zlib_faq.html#faq21

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-05-10 22:12:01 +02:00
Andreas Rheinhardt
54cb70594d avcodec/tscc: Don't free uninitialized z_stream
It is not documented to be safe to call inflateEnd() on a z_stream
that has not been successfully initialized via inflateInit(); so
record whether it has been successfully initialized.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-05-10 22:12:01 +02:00
Andreas Rheinhardt
730b8182b1 avcodec/mscc: Mark decoders as init-threadsafe
Initializing zlib in the way we do here is threadsafe, see
https://www.zlib.net/zlib_faq.html#faq21

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-05-10 22:12:01 +02:00
Andreas Rheinhardt
37670f7d07 avcodec/vp8: Mark decoders as init-threadsafe
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-05-10 22:12:01 +02:00
Andreas Rheinhardt
e80d35afa8 avcodec/vp9: Mark decoder as init-threadsafe
It only allocates some AVFrames.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-05-10 22:12:01 +02:00
Andreas Rheinhardt
4818ea69d2 avcodec/vp9: Inline function with only one caller into it
The split into vp9_decode_init() and init_frames() is a remnant
of using init_thread_copy() for frame-threading; the latter has
been removed, so there is no reason for init_frames() not be part
of vp9_decode_init().

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-05-10 22:12:01 +02:00
Andreas Rheinhardt
7aa8c95f47 avcodec/vp9: Remove excessive log messages
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-05-10 22:12:01 +02:00
Andreas Rheinhardt
3572590e75 avcodec/vp9: Cleanup generically on init failure
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-05-10 22:12:01 +02:00
Andreas Rheinhardt
4848a7abff avcodec/rawdec: Mark decoder as init-threadsafe
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-05-10 22:12:01 +02:00
Andreas Rheinhardt
9e1f7e2086 avcodec/ljpegenc: Mark encoder as init-threadsafe
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-05-10 22:12:01 +02:00
Xuewei Meng
f8d910e90f GSoC: Add guided filter
Add examples on how to use this filter, and improve the code style.
Implement the slice-level parallelism for guided filter.
Add the basic version of guided filter.

Signed-off-by: Xuewei Meng <xwmeng96@gmail.com>
Reviewed-by: Steven Liu <liuqi05@kuaishou.com>
2021-05-10 13:34:29 +08:00
Gyan Doshi
8649f5dca6 doc/muxers: note movie_timescale option in movenc 2021-05-09 15:03:39 +05:30
Anton Khirnov
c6ae560a18 lavf/framecrcenc: do not hash side data
There are no guarantees that all side data types have the same
representation on all platforms.

Tests that change output due to this:

id3v2-priv-remux, cover-art-mp3-id3v2-remux, gapless-mp3: SKIP_SAMPLES,
which is tested by fate-gapless-mp3-side-data

matroska-vp8-alpha-remux: MATROSKA_BLOCKADDITIONAL, which is tested by
remux itself (side data is written into output)

matroska-mastering-display-metadata: MASTERING_DISPLAY_METADATA and
CONTENT_LIGHT_LEVEL, which are tested by ffprobe invocation in the same
test

matroska-spherical-mono-remux: STEREO3D and SPHERICAL, which are tested
by ffprobe invocation in the same test

segment-mp4-to-ts: MPEGTS_STREAM_ID, which is tested by ts remuxing
tests

webm-webvtt-remux: WEBVTT_IDENTIFIER/SETTINGS, which is tested by the
ffprobe invocation in the same test

mxf-d10-user-comments: CPB_PROPERTIES, which is tested by mxf-probe-d10

mov-cover-image: SKIP_SAMPLES, which is tested for mov by
mov-aac-2048-priming

copy-trac3074: AUDIO_SERVICE_TYPE, which is tested by fate-hls-fmp4_ac3
2021-05-09 11:07:20 +02:00
Anton Khirnov
4d28a6756c fate: drop the vp8-alpha test
It is redundant with matroska-vp8-alpha-remux.
2021-05-09 11:07:20 +02:00
Anton Khirnov
af607a8838 fate-run.sh: print stream side data in probeaudiostream()
Adds a test for reading AUDIO_SERVICE_TYPE in fate-hls-fmp4_ac3
2021-05-09 11:07:20 +02:00
Anton Khirnov
1b3bd52e54 fate-webm-webvtt-remux: print packet side data in ffprobe output 2021-05-09 11:07:20 +02:00
Anton Khirnov
958bea5248 fate/demux: convert flv-demux to ffprobe
It can handle side data cleanly.
2021-05-09 11:07:20 +02:00