ffmpeg.git
11 hours agodoc/filters: Update commands doc for amix master
Jun Zhao [Sat, 10 Apr 2021 07:45:13 +0000 (15:45 +0800)]
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>
13 hours agoavfilter/dnn/dnn_backend_tf: fix cross library usage
Limin Wang [Tue, 11 May 2021 10:35:44 +0000 (18:35 +0800)]
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>
20 hours agoavfilter/vf_dnn_classify: add result check for av_frame_get_side_data
Steven Liu [Fri, 7 May 2021 06:42:48 +0000 (14:42 +0800)]
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>
21 hours agodnn/vf_dnn_detect.c: add tensorflow output parse support
Ting Fu [Thu, 6 May 2021 08:46:10 +0000 (16:46 +0800)]
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>
21 hours agolavfi/dnn_backend_tensorflow: support detect model
Ting Fu [Thu, 6 May 2021 08:46:09 +0000 (16:46 +0800)]
lavfi/dnn_backend_tensorflow: support detect model

Signed-off-by: Ting Fu <ting.fu@intel.com>
21 hours agolavfi/dnn_backend_tensorflow: add multiple outputs support
Ting Fu [Thu, 6 May 2021 08:46:08 +0000 (16:46 +0800)]
lavfi/dnn_backend_tensorflow: add multiple outputs support

Signed-off-by: Ting Fu <ting.fu@intel.com>
21 hours agodnn: add DCO_RGB color order to enum DNNColorOrder
Ting Fu [Thu, 6 May 2021 08:46:07 +0000 (16:46 +0800)]
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>
25 hours agoavfilter/vf_guided: Add missing const
Andreas Rheinhardt [Mon, 10 May 2021 22:29:16 +0000 (00:29 +0200)]
avfilter/vf_guided: Add missing const

Forgotten in f8d910e90f599f338438833dfc92e2f1915ce414.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
26 hours agoavcodec/vp3: Mark decoders as init-threadsafe
Andreas Rheinhardt [Sat, 8 May 2021 01:11:36 +0000 (03:11 +0200)]
avcodec/vp3: Mark decoders as init-threadsafe

Reviewed-by: Peter Ross <pross@xvid.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
26 hours agoavcodec/vp3: Reindentation
Andreas Rheinhardt [Sat, 8 May 2021 00:26:43 +0000 (02:26 +0200)]
avcodec/vp3: Reindentation

Reviewed-by: Peter Ross <pross@xvid.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
26 hours agoavcodec/vp3: Avoid code duplication when initializing coeff_vlcs
Andreas Rheinhardt [Sat, 8 May 2021 00:24:22 +0000 (02:24 +0200)]
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>
26 hours agoavcodec/vp3: Don't try to decode VP4 when VP4 decoder is disabled
Andreas Rheinhardt [Sat, 8 May 2021 00:08:05 +0000 (02:08 +0200)]
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>
27 hours agoavcodec/ttmlenc: Mark encoder as init-threadsafe
Andreas Rheinhardt [Wed, 5 May 2021 17:53:16 +0000 (19:53 +0200)]
avcodec/ttmlenc: Mark encoder as init-threadsafe

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
27 hours agoavcodec/vmdvideo: Mark decoder as init-threadsafe
Andreas Rheinhardt [Thu, 6 May 2021 05:24:18 +0000 (07:24 +0200)]
avcodec/vmdvideo: Mark decoder as init-threadsafe

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
27 hours agoavcodec/vmdvideo: Cleanup generically upon init failure
Andreas Rheinhardt [Thu, 6 May 2021 05:23:32 +0000 (07:23 +0200)]
avcodec/vmdvideo: Cleanup generically upon init failure

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
27 hours agoavcodec/dnxhdenc: Mark encoder as init-threadsafe
Andreas Rheinhardt [Thu, 6 May 2021 01:37:37 +0000 (03:37 +0200)]
avcodec/dnxhdenc: Mark encoder as init-threadsafe

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
27 hours agoavcodec/dnxhdenc: Use av_memdup() instead of av_malloc()+memcpy()
Andreas Rheinhardt [Thu, 6 May 2021 00:01:38 +0000 (02:01 +0200)]
avcodec/dnxhdenc: Use av_memdup() instead of av_malloc()+memcpy()

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
27 hours agoavcodec/dnxhdenc: Fix segfault when using too many slice threads
Andreas Rheinhardt [Wed, 5 May 2021 23:47:57 +0000 (01:47 +0200)]
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>
27 hours agoavcodec/dnxhddec: Mark decoder as init-threadsafe
Andreas Rheinhardt [Wed, 5 May 2021 22:03:10 +0000 (00:03 +0200)]
avcodec/dnxhddec: Mark decoder as init-threadsafe

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
27 hours agoavcodec/pngenc: Mark encoders as init-threadsafe
Andreas Rheinhardt [Wed, 5 May 2021 18:50:16 +0000 (20:50 +0200)]
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>
27 hours agoavcodec/exrenc: Mark encoder as init-threadsafe
Andreas Rheinhardt [Wed, 5 May 2021 21:57:00 +0000 (23:57 +0200)]
avcodec/exrenc: Mark encoder as init-threadsafe

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
27 hours agoavcodec/wmaprodec: Make decoders init-threadsafe
Andreas Rheinhardt [Wed, 5 May 2021 21:40:09 +0000 (23:40 +0200)]
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>
27 hours agoavcodec/wmaprodec: Check ff_mdct_init() for failure
Andreas Rheinhardt [Wed, 5 May 2021 21:03:41 +0000 (23:03 +0200)]
avcodec/wmaprodec: Check ff_mdct_init() for failure

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
27 hours agoavcodec/tscc: Mark decoder as init-threadsafe
Andreas Rheinhardt [Wed, 5 May 2021 18:50:16 +0000 (20:50 +0200)]
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>
27 hours agoavcodec/tscc: Don't free uninitialized z_stream
Andreas Rheinhardt [Wed, 5 May 2021 18:36:44 +0000 (20:36 +0200)]
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>
27 hours agoavcodec/mscc: Mark decoders as init-threadsafe
Andreas Rheinhardt [Wed, 5 May 2021 18:50:16 +0000 (20:50 +0200)]
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>
27 hours agoavcodec/vp8: Mark decoders as init-threadsafe
Andreas Rheinhardt [Wed, 5 May 2021 19:56:28 +0000 (21:56 +0200)]
avcodec/vp8: Mark decoders as init-threadsafe

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
27 hours agoavcodec/vp9: Mark decoder as init-threadsafe
Andreas Rheinhardt [Wed, 5 May 2021 19:31:58 +0000 (21:31 +0200)]
avcodec/vp9: Mark decoder as init-threadsafe

It only allocates some AVFrames.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
27 hours agoavcodec/vp9: Inline function with only one caller into it
Andreas Rheinhardt [Wed, 5 May 2021 19:27:21 +0000 (21:27 +0200)]
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>
27 hours agoavcodec/vp9: Remove excessive log messages
Andreas Rheinhardt [Wed, 5 May 2021 19:21:25 +0000 (21:21 +0200)]
avcodec/vp9: Remove excessive log messages

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
27 hours agoavcodec/vp9: Cleanup generically on init failure
Andreas Rheinhardt [Wed, 5 May 2021 19:18:45 +0000 (21:18 +0200)]
avcodec/vp9: Cleanup generically on init failure

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
27 hours agoavcodec/rawdec: Mark decoder as init-threadsafe
Andreas Rheinhardt [Wed, 5 May 2021 19:04:59 +0000 (21:04 +0200)]
avcodec/rawdec: Mark decoder as init-threadsafe

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
27 hours agoavcodec/ljpegenc: Mark encoder as init-threadsafe
Andreas Rheinhardt [Fri, 11 Dec 2020 12:02:43 +0000 (13:02 +0100)]
avcodec/ljpegenc: Mark encoder as init-threadsafe

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
42 hours agoGSoC: Add guided filter
Xuewei Meng [Sat, 8 May 2021 10:06:39 +0000 (18:06 +0800)]
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>
2 days agodoc/muxers: note movie_timescale option in movenc
Gyan Doshi [Fri, 7 May 2021 13:16:20 +0000 (18:46 +0530)]
doc/muxers: note movie_timescale option in movenc

2 days agolavf/framecrcenc: do not hash side data
Anton Khirnov [Sat, 24 Apr 2021 13:08:51 +0000 (15:08 +0200)]
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

2 days agofate: drop the vp8-alpha test
Anton Khirnov [Sat, 24 Apr 2021 13:36:48 +0000 (15:36 +0200)]
fate: drop the vp8-alpha test

It is redundant with matroska-vp8-alpha-remux.

2 days agofate-run.sh: print stream side data in probeaudiostream()
Anton Khirnov [Sun, 25 Apr 2021 06:57:14 +0000 (08:57 +0200)]
fate-run.sh: print stream side data in probeaudiostream()

Adds a test for reading AUDIO_SERVICE_TYPE in fate-hls-fmp4_ac3

2 days agofate-webm-webvtt-remux: print packet side data in ffprobe output
Anton Khirnov [Sun, 25 Apr 2021 06:28:01 +0000 (08:28 +0200)]
fate-webm-webvtt-remux: print packet side data in ffprobe output

2 days agofate/demux: convert flv-demux to ffprobe
Anton Khirnov [Sat, 24 Apr 2021 14:38:55 +0000 (16:38 +0200)]
fate/demux: convert flv-demux to ffprobe

It can handle side data cleanly.

2 days agofate-ts-demux: convert to ffprobe
Anton Khirnov [Sat, 24 Apr 2021 14:38:55 +0000 (16:38 +0200)]
fate-ts-demux: convert to ffprobe

It can handle side data cleanly.

2 days agofate-ts-opus-demux: convert to ffprobe
Anton Khirnov [Sat, 24 Apr 2021 14:38:55 +0000 (16:38 +0200)]
fate-ts-opus-demux: convert to ffprobe

It can handle side data cleanly.

2 days agofate-ts-small-demux: convert to ffprobe
Anton Khirnov [Sat, 24 Apr 2021 14:38:55 +0000 (16:38 +0200)]
fate-ts-small-demux: convert to ffprobe

It can handle side data cleanly.

2 days agofate/gapless: add a test for skip samples side data
Anton Khirnov [Sat, 24 Apr 2021 13:25:11 +0000 (15:25 +0200)]
fate/gapless: add a test for skip samples side data

2 days agofate-oggopus-demux: convert to ffprobe
Anton Khirnov [Sat, 24 Apr 2021 14:05:31 +0000 (16:05 +0200)]
fate-oggopus-demux: convert to ffprobe

It can print side data cleanly.

2 days agoffprobe: support printing more packet side data types
Anton Khirnov [Sat, 24 Apr 2021 15:49:35 +0000 (17:49 +0200)]
ffprobe: support printing more packet side data types

Specifically WebVTT subtitle data, CPB properties, audio service type
and mpegts stream id.

2 days agoffprobe: only hash extradata when it is present
Anton Khirnov [Sat, 24 Apr 2021 14:19:42 +0000 (16:19 +0200)]
ffprobe: only hash extradata when it is present

Passing zero-sized/NULL buffers to av_hash_update() is invalid and may
crash with certain hashes.

2 days agoconfigure: fix some filter dependencies
Matthias Troffaes [Sun, 9 May 2021 08:17:49 +0000 (10:17 +0200)]
configure: fix some filter dependencies

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2 days agoavformat/rpl: Support files containing Replay IMA ADPCM audio
Cameron Cawley [Fri, 7 May 2021 16:50:48 +0000 (17:50 +0100)]
avformat/rpl: Support files containing Replay IMA ADPCM audio

Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
2 days agoavcodec: Implement Acorn Replay IMA ADPCM decoder
Cameron Cawley [Fri, 7 May 2021 16:50:47 +0000 (17:50 +0100)]
avcodec: Implement Acorn Replay IMA ADPCM decoder

Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
3 days agoavcodec/avpacket: use av_malloc() to allocate an AVPacket
James Almer [Sat, 8 May 2021 21:36:28 +0000 (18:36 -0300)]
avcodec/avpacket: use av_malloc() to allocate an AVPacket

av_mallocz() is superfluous as get_packet_defaults() is called immediately
after it's allocated, which will initialize the entire struct to default
values.

Signed-off-by: James Almer <jamrial@gmail.com>
3 days agoavcodec/avpacket: always initialize the new packet in avpriv_packet_list_put()
James Almer [Fri, 7 May 2021 02:55:32 +0000 (23:55 -0300)]
avcodec/avpacket: always initialize the new packet in avpriv_packet_list_put()

If a copy callback is provided by the caller, the packet passed to it
was zeroed instead of initialized with default values.

Signed-off-by: James Almer <jamrial@gmail.com>
3 days agoavformat/matroskadec: remove special handling of av1c extradata
Jan Ekström [Mon, 23 Nov 2020 16:31:29 +0000 (18:31 +0200)]
avformat/matroskadec: remove special handling of av1c extradata

Libavcodec can now handle the standard AV1CodecConfigurationRecord
extradata as-is.

3 days agoavformat/mov: remove special handling of av1c extradata
Jan Ekström [Mon, 23 Nov 2020 16:28:28 +0000 (18:28 +0200)]
avformat/mov: remove special handling of av1c extradata

Libavcodec can now handle the AV1CodecConfigurationRecord structure
as-is when passed as extradata, so the standard behavior of
read-box-into-extradata should suffice, just like with AVC and HEVC.

4 days agoavcodec/h263, h263data: Move ff_h263_init_rl_inter to h263.c
Andreas Rheinhardt [Fri, 7 May 2021 15:52:23 +0000 (17:52 +0200)]
avcodec/h263, h263data: Move ff_h263_init_rl_inter to h263.c

The SVQ1 decoder does not need mpegvideo or rl.c, but it uses stuff
from h263data.c. But since 61fe481586425a41d45e371de1e875b49882477d
h263data.c called ff_rl_init() and this of course led to build errors
when the SVQ1 decoder is enabled and mpegvideo disabled.

Fix this by moving ff_h263_init_rl_inter() to h263.c.
Fixes ticket #9224.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
4 days agoconfigure: Add missing mpegvideo dependency for IPU decoder
Andreas Rheinhardt [Fri, 7 May 2021 15:45:16 +0000 (17:45 +0200)]
configure: Add missing mpegvideo dependency for IPU decoder

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
4 days agoavcodec: be more explicit about the buffer size in get_encode_buffer documentation
James Almer [Wed, 5 May 2021 02:10:41 +0000 (23:10 -0300)]
avcodec: be more explicit about the buffer size in get_encode_buffer documentation

Signed-off-by: James Almer <jamrial@gmail.com>
4 days agoavcodec/alsdec: Fix decoding error with mono audio files
Michael Niedermayer [Fri, 7 May 2021 01:02:01 +0000 (10:02 +0900)]
avcodec/alsdec: Fix decoding error with mono audio files

highest_decoded_channel is modified to serve as meant.

Reported-by: Noboru Harada <noboru@ieee.org>
Regression since: a11aa5f3ed7ee4d2385a7b725d43f6070d790b4c
Fixes: Sin48k16bit1ch.mp4
Reviewed-by: Thilo Borgmann <thilo.borgmann@mail.de>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 days agomips: Fix potential illegal instruction error.
Shiyou Yin [Mon, 12 Apr 2021 15:37:05 +0000 (23:37 +0800)]
mips: Fix potential illegal instruction error.

MSA2 optimizations are attached to MSA macros in generic_macros_msa.h.
It's difficult to do runtime check for them. Remove this part of code
can make it more robust. H264 1080p decoding: 5.13x==>5.12x.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 days agoavcodec/mips: Refine ff_h264_h_lpf_luma_inter_msa
gxw [Mon, 12 Apr 2021 15:37:04 +0000 (23:37 +0800)]
avcodec/mips: Refine ff_h264_h_lpf_luma_inter_msa

Using mask to avoid judgment, H264 4K decoding speed
improved about 0.1fps tested on 3A4000

Signed-off-by: Shiyou Yin <yinshiyou-hf@loongson.cn>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 days agoavcodec/mips: Optimize function ff_h264_loop_filter_strength_msa.
gxw [Mon, 12 Apr 2021 15:37:03 +0000 (23:37 +0800)]
avcodec/mips: Optimize function ff_h264_loop_filter_strength_msa.

Speed of decoding H264 1080P: 5.05x ==> 5.13x

Signed-off-by: Shiyou Yin <yinshiyou-hf@loongson.cn>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 days agoavcodec/mips: Refine get_cabac_inline_mips.
Shiyou Yin [Mon, 12 Apr 2021 15:37:02 +0000 (23:37 +0800)]
avcodec/mips: Refine get_cabac_inline_mips.

1. Refined function get_cabac_inline_mips.
2. Optimize function get_cabac_bypass and get_cabac_bypass_sign.

Speed of decoding h264: 4.89x ==> 5.05x(tested on 3A4000).

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 days agoavcodec/mips: Restore the initialization sequence of MSA and MMI in ff_h264chroma_ini...
Shiyou Yin [Mon, 12 Apr 2021 15:37:01 +0000 (23:37 +0800)]
avcodec/mips: Restore the initialization sequence of MSA and MMI in ff_h264chroma_init_mips.

The MSA optimization has been refined in commit 93218c2 and ce0a52e.
It is better than MMI version now.
Speed of decoding H264: 4.83x ==> 4.89x (tested on 3A4000).

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 days agoavformat/hls: use av_strncasecmp()
Limin Wang [Fri, 7 May 2021 11:05:13 +0000 (19:05 +0800)]
avformat/hls: use av_strncasecmp()

Reviewed-by: Steven Liu <lq@chinaffmpeg.org>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
4 days agoavformat: move AVStream.stream_identifier to AVStreamInternal
James Almer [Sun, 2 May 2021 02:43:58 +0000 (23:43 -0300)]
avformat: move AVStream.stream_identifier to AVStreamInternal

It's a private field, no reason to have it exposed in a public header.

Signed-off-by: James Almer <jamrial@gmail.com>
4 days agoavformat: move AVStream.codec_info_nb_frames to AVStreamInternal
James Almer [Sun, 2 May 2021 02:35:45 +0000 (23:35 -0300)]
avformat: move AVStream.codec_info_nb_frames to AVStreamInternal

It's a private field, no reason to have it exposed in a public header.

Signed-off-by: James Almer <jamrial@gmail.com>
4 days agoavformat: move AVStream.{parser,need_parsing} to AVStreamInternal
James Almer [Sun, 2 May 2021 02:28:18 +0000 (23:28 -0300)]
avformat: move AVStream.{parser,need_parsing} to AVStreamInternal

Those are private fields, no reason to have them exposed in a public
header.

Signed-off-by: James Almer <jamrial@gmail.com>
4 days agoavformat: move AVStream.probe_packets to AVStreamInternal
James Almer [Sun, 2 May 2021 02:13:41 +0000 (23:13 -0300)]
avformat: move AVStream.probe_packets to AVStreamInternal

It's a private fields, no reason to have it exposed in a public header.

Signed-off-by: James Almer <jamrial@gmail.com>
4 days agoavformat: move AVStream.last-IP_{pts,duration} to AVStreamInternal
James Almer [Sun, 2 May 2021 02:05:21 +0000 (23:05 -0300)]
avformat: move AVStream.last-IP_{pts,duration} to AVStreamInternal

Those are private fields, no reason to have them exposed in a public
header.

Signed-off-by: James Almer <jamrial@gmail.com>
4 days agoavcodec/zmbvenc: Mark encoder as init-threadsafe
Andreas Rheinhardt [Wed, 5 May 2021 18:50:16 +0000 (20:50 +0200)]
avcodec/zmbvenc: Mark encoder as init-threadsafe

Initializing zlib in the way we do here is threadsafe, see
https://www.zlib.net/zlib_faq.html#faq21

Reviewed-by: Tomas Härdin <tjoppen@acc.umu.se>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
4 days agoavcodec/zmbvenc: Fix memleak upon init error
Andreas Rheinhardt [Wed, 5 May 2021 18:58:03 +0000 (20:58 +0200)]
avcodec/zmbvenc: Fix memleak upon init error

Reviewed-by: Tomas Härdin <tjoppen@acc.umu.se>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
4 days agoavcodec/zmbv: Mark decoder as init-threadsafe
Andreas Rheinhardt [Wed, 5 May 2021 18:50:16 +0000 (20:50 +0200)]
avcodec/zmbv: Mark decoder as init-threadsafe

Initializing zlib in the way we do here is threadsafe, see
https://www.zlib.net/zlib_faq.html#faq21

Reviewed-by: Tomas Härdin <tjoppen@acc.umu.se>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
4 days agoavcodec/zmbv: Don't free uninitialized z_stream
Andreas Rheinhardt [Wed, 5 May 2021 18:36:44 +0000 (20:36 +0200)]
avcodec/zmbv: 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.

Reviewed-by: Tomas Härdin <tjoppen@acc.umu.se>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
4 days agoavcodec/ttmlenc: Don't confuse capabilities and caps_internal
Andreas Rheinhardt [Fri, 7 May 2021 03:19:41 +0000 (05:19 +0200)]
avcodec/ttmlenc: Don't confuse capabilities and caps_internal

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
5 days agoavformat/utils: constrain the lifetime of the pointer returned by avformat_index_get_...
James Almer [Thu, 8 Apr 2021 17:16:53 +0000 (14:16 -0300)]
avformat/utils: constrain the lifetime of the pointer returned by avformat_index_get_entry()

This will give us more room to improve the implementation later.

Suggested-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: James Almer <jamrial@gmail.com>
5 days agoavformat/mov: don't save a copy of the packet's AVBufferRef on DV streams
James Almer [Sun, 2 May 2021 13:23:01 +0000 (10:23 -0300)]
avformat/mov: don't save a copy of the packet's AVBufferRef on DV streams

It's no longer needed.

Signed-off-by: James Almer <jamrial@gmail.com>
5 days agoavformat/avidec: don't save a copy of the packet's AVBufferRef on DV streams
James Almer [Sun, 2 May 2021 13:22:52 +0000 (10:22 -0300)]
avformat/avidec: don't save a copy of the packet's AVBufferRef on DV streams

It's no longer needed.

Signed-off-by: James Almer <jamrial@gmail.com>
5 days agoavformat/dv: stop using av_init_packet()
James Almer [Sun, 2 May 2021 13:13:38 +0000 (10:13 -0300)]
avformat/dv: stop using av_init_packet()

Signed-off-by: James Almer <jamrial@gmail.com>
5 days agoavcodec/videotoolboxenc: Avoid copying data, allow user-supplied buffers
Andreas Rheinhardt [Thu, 29 Apr 2021 23:57:13 +0000 (01:57 +0200)]
avcodec/videotoolboxenc: Avoid copying data, allow user-supplied buffers

Here the packet size is known before allocating the packet because
the encoder provides said information (and works with internal buffers
itself), so one use this information to avoid the implicit use of another
intermediate buffer for the packet data; and by switching to
ff_get_encode_buffer() one can also allow user-supplied buffers.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Signed-off-by: Rick Kern <kernrj@gmail.com>
5 days agoavcodec/dvenc: Make encoder init-threadsafe
Andreas Rheinhardt [Wed, 30 Dec 2020 18:05:46 +0000 (19:05 +0100)]
avcodec/dvenc: Make encoder init-threadsafe

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
5 days agoavcodec/dvdec: Make decoder init-threadsafe
Andreas Rheinhardt [Tue, 29 Dec 2020 18:31:37 +0000 (19:31 +0100)]
avcodec/dvdec: Make decoder init-threadsafe

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
5 days agoavcodec/dv: Don't initialize RL VLC for encoder
Andreas Rheinhardt [Tue, 29 Dec 2020 17:24:40 +0000 (18:24 +0100)]
avcodec/dv: Don't initialize RL VLC for encoder

Said RL VLC is only used by the decoder, ergo don't initialize it for
the encoder and move the whole code and the RL VLC table itself to
dvdec.c.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
5 days agoavcodec/dv: Don't pretend VLC allocation can't fail
Andreas Rheinhardt [Tue, 29 Dec 2020 15:31:43 +0000 (16:31 +0100)]
avcodec/dv: Don't pretend VLC allocation can't fail

It can and therefore we switch from a heap allocated VLC table to
a VLC initialized via the mechanism for static VLCs, but without
an actual static VLC.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
5 days agoavcodec/wmalosslessdec: Mark decoder as init-threadsafe
Andreas Rheinhardt [Mon, 28 Dec 2020 20:45:59 +0000 (21:45 +0100)]
avcodec/wmalosslessdec: Mark decoder as init-threadsafe

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
5 days agoavcodec/wmavoice: Mark decoder as init-threadsafe
Andreas Rheinhardt [Mon, 28 Dec 2020 18:54:41 +0000 (19:54 +0100)]
avcodec/wmavoice: Mark decoder as init-threadsafe

It is init-threadsafe since b9c1ab89078d862e0146c9d7ed277addd770e3a3
and except on MIPS even before that due to its use of ff_thread_once()
for static initialization.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
5 days agoavcodec/qcelpdec: Mark decoder as init-threadsafe
Andreas Rheinhardt [Mon, 28 Dec 2020 18:53:42 +0000 (19:53 +0100)]
avcodec/qcelpdec: Mark decoder as init-threadsafe

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
5 days agolavc/videotoolboxenc: set DataRateLimits for hevc
Zhao Zhili [Sun, 25 Apr 2021 08:06:04 +0000 (16:06 +0800)]
lavc/videotoolboxenc: set DataRateLimits for hevc

From the comment it's not available on old version. It works now
by testing on macOS 11.2.1. There is no document about since when.
So trying to set the configuration and ignore the error for hevc.

Signed-off-by: Rick Kern <kernrj@gmail.com>
5 days agolavfi/dnn_classify: add filter dnn_classify for classification based on detection...
Guo, Yejun [Wed, 17 Mar 2021 06:08:38 +0000 (14:08 +0800)]
lavfi/dnn_classify: add filter dnn_classify for classification based on detection bounding boxes

classification is done on every detection bounding box in frame's side data,
which are the results of object detection (filter dnn_detect).

Please refer to commit log of dnn_detect for the material for detection,
and see below for classification.

- download material for classifcation:
wget https://github.com/guoyejun/ffmpeg_dnn/raw/main/models/openvino/2021.1/emotions-recognition-retail-0003.bin
wget https://github.com/guoyejun/ffmpeg_dnn/raw/main/models/openvino/2021.1/emotions-recognition-retail-0003.xml
wget https://github.com/guoyejun/ffmpeg_dnn/raw/main/models/openvino/2021.1/emotions-recognition-retail-0003.label

- run command as:
./ffmpeg -i cici.jpg -vf dnn_detect=dnn_backend=openvino:model=face-detection-adas-0001.xml:input=data:output=detection_out:confidence=0.6:labels=face-detection-adas-0001.label,dnn_classify=dnn_backend=openvino:model=emotions-recognition-retail-0003.xml:input=data:output=prob_emotion:confidence=0.3:labels=emotions-recognition-retail-0003.label:target=face,showinfo -f null -

We'll see the detect&classify result as below:
[Parsed_showinfo_2 @ 0x55b7d25e77c0]   side data - detection bounding boxes:
[Parsed_showinfo_2 @ 0x55b7d25e77c0] source: face-detection-adas-0001.xml, emotions-recognition-retail-0003.xml
[Parsed_showinfo_2 @ 0x55b7d25e77c0] index: 0,  region: (1005, 813) -> (1086, 905), label: face, confidence: 10000/10000.
[Parsed_showinfo_2 @ 0x55b7d25e77c0]            classify:  label: happy, confidence: 6757/10000.
[Parsed_showinfo_2 @ 0x55b7d25e77c0] index: 1,  region: (888, 839) -> (967, 926), label: face, confidence: 6917/10000.
[Parsed_showinfo_2 @ 0x55b7d25e77c0]            classify:  label: anger, confidence: 4320/10000.

Signed-off-by: Guo, Yejun <yejun.guo@intel.com>
5 days agolavfi/dnn: add classify support with openvino backend
Guo, Yejun [Tue, 16 Mar 2021 05:02:56 +0000 (13:02 +0800)]
lavfi/dnn: add classify support with openvino backend

Signed-off-by: Guo, Yejun <yejun.guo@intel.com>
5 days agolavfi/dnn: refine dnn interface to add DNNExecBaseParams
Guo, Yejun [Thu, 1 Apr 2021 02:06:06 +0000 (10:06 +0800)]
lavfi/dnn: refine dnn interface to add DNNExecBaseParams

Different function type of model requires different parameters, for
example, object detection detects lots of objects (cat/dog/...) in
the frame, and classifcation needs to know which object (cat or dog)
it is going to classify.

The current interface needs to add a new function with more parameters
to support new requirement, with this change, we can just add a new
struct (for example DNNExecClassifyParams) based on DNNExecBaseParams,
and so we can continue to use the current interface execute_model just
with params changed.

5 days agolavfi/dnn_backend_openvino.c: move the logic for batch mode earlier
Guo, Yejun [Tue, 16 Mar 2021 05:17:34 +0000 (13:17 +0800)]
lavfi/dnn_backend_openvino.c: move the logic for batch mode earlier

5 days agolavfi/dnn_backend_openvino.c: add InferenceItem between TaskItem and RequestItem
Guo, Yejun [Mon, 15 Mar 2021 02:13:14 +0000 (10:13 +0800)]
lavfi/dnn_backend_openvino.c: add InferenceItem between TaskItem and RequestItem

There's one task item for one function call from dnn interface,
there's one request item for one call to openvino. For classify,
one task might need multiple inference for classification on every
bounding box, so add InferenceItem.

5 days agolavfi/dnn_backend_openvino.c: unify code for infer request for sync/async
Guo, Yejun [Wed, 10 Mar 2021 08:27:41 +0000 (16:27 +0800)]
lavfi/dnn_backend_openvino.c: unify code for infer request for sync/async

5 days agoconfigure: dnn needs avformat
Matthias C. M. Troffaes [Tue, 4 May 2021 12:27:12 +0000 (13:27 +0100)]
configure: dnn needs avformat

The source file "libavfilter/dnn/dnn_backend_native.h" includes
"libavformat/avio.h", so avformat needs to be declared as a dependency.

5 days agolavfi/dnn_backend_native_layer_avgpool.c: Correct Spelling of Pixel
Shubhanshu Saxena [Sat, 1 May 2021 15:17:06 +0000 (20:47 +0530)]
lavfi/dnn_backend_native_layer_avgpool.c: Correct Spelling of Pixel

Correct spelling of word `pixel` from `pxiels`

Signed-off-by: Shubhanshu Saxena <shubhanshu.e01@gmail.com>
5 days agoavformat/rpl: cosmetics
Zane van Iperen [Tue, 4 May 2021 11:59:37 +0000 (21:59 +1000)]
avformat/rpl: cosmetics

Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
6 days agoavcodec/decode: stop trying to initialize palette values in avcodec_default_get_buffer2()
James Almer [Sun, 2 May 2021 17:54:26 +0000 (14:54 -0300)]
avcodec/decode: stop trying to initialize palette values in avcodec_default_get_buffer2()

avpriv_set_systematic_pal2() is meant to fill fixed vales for formats that
until recently were tagged as "pseudo pal". This is no longer the case, so
this call is a no-op when used on real PAL formats.

Signed-off-by: James Almer <jamrial@gmail.com>
6 days agoavcodec/rl: Improve documentation of ff_rl_init/ff_rl_init_vlc
Andreas Rheinhardt [Wed, 27 Jan 2021 16:21:01 +0000 (17:21 +0100)]
avcodec/rl: Improve documentation of ff_rl_init/ff_rl_init_vlc

In particular, document that they initialize different parts of an
RLTable and therefore need not be synchronized.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
6 days agoavcodec/speedhqenc: Hardcode table to save space
Andreas Rheinhardt [Thu, 10 Dec 2020 08:19:08 +0000 (09:19 +0100)]
avcodec/speedhqenc: Hardcode table to save space

The SpeedHQ encoder currently reverses the entries of two small tables
and stores them in other tables. These other tables have a size of 48
bytes, yet the code for their initialization takes 135 bytes (GCC 9.3,
x64, O3 albeit in an av_cold function). So remove the runtime
initialization and hardcode the tables.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
6 days agoavcodec/speedhq, speedhqenc: Make codecs init-threadsafe
Andreas Rheinhardt [Thu, 10 Dec 2020 07:59:09 +0000 (08:59 +0100)]
avcodec/speedhq, speedhqenc: Make codecs init-threadsafe

The SpeedHQ decoder uses and initializes a RLTable's VLC, yet it also
initializes other parts of the RLTable that it does not use. This has
downsides besides being wasteful: Because the SpeedHQ encoder also
initializes these additional fields, there is a potential for data races
(and therefore undefined behaviour). In fact, removing the superfluous
initializations from the decoder automatically makes both the decoder
and the encoder init-threadsafe. This commit does so.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>