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

102441 Commits

Author SHA1 Message Date
Andreas Rheinhardt
8f588eea8e configure: Add missing mpegvideo dependency for IPU decoder
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-05-07 21:33:35 +02:00
James Almer
5b5398722e avcodec: be more explicit about the buffer size in get_encode_buffer documentation
Signed-off-by: James Almer <jamrial@gmail.com>
2021-05-07 13:16:14 -03:00
Michael Niedermayer
f7987ce966 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: a11aa5f3ed
Fixes: Sin48k16bit1ch.mp4
Reviewed-by: Thilo Borgmann <thilo.borgmann@mail.de>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-05-07 17:53:46 +02:00
Shiyou Yin
ab04fedaaa 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>
2021-05-07 17:53:23 +02:00
gxw
464d28c070 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>
2021-05-07 17:53:23 +02:00
gxw
6458c6bdb4 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>
2021-05-07 17:53:23 +02:00
Shiyou Yin
5ab8e8bc92 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>
2021-05-07 17:53:23 +02:00
Shiyou Yin
56c57fe68a 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>
2021-05-07 17:53:23 +02:00
Limin Wang
eb390d7f9d avformat/hls: use av_strncasecmp()
Reviewed-by: Steven Liu <lq@chinaffmpeg.org>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2021-05-07 23:23:23 +08:00
James Almer
f140239777 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>
2021-05-07 09:27:22 -03:00
James Almer
7489f63281 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>
2021-05-07 09:27:21 -03:00
James Almer
b9c5fdf602 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>
2021-05-07 09:27:21 -03:00
James Almer
fab2ed4704 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>
2021-05-07 09:27:20 -03:00
James Almer
1262f67cca 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>
2021-05-07 09:27:20 -03:00
Andreas Rheinhardt
553619eacb 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>
2021-05-07 09:26:26 +02:00
Andreas Rheinhardt
141f3053ba 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>
2021-05-07 09:25:28 +02:00
Andreas Rheinhardt
e51fad097b 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>
2021-05-07 09:25:10 +02:00
Andreas Rheinhardt
9d752ab634 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>
2021-05-07 09:24:56 +02:00
Andreas Rheinhardt
14a6025384 avcodec/ttmlenc: Don't confuse capabilities and caps_internal
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-05-07 09:23:37 +02:00
James Almer
74dce63f9a 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>
2021-05-06 15:26:56 -03:00
James Almer
55475b3289 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>
2021-05-06 09:44:42 -03:00
James Almer
42895f590a 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>
2021-05-06 09:44:42 -03:00
James Almer
57aaeff523 avformat/dv: stop using av_init_packet()
Signed-off-by: James Almer <jamrial@gmail.com>
2021-05-06 09:44:42 -03:00
Andreas Rheinhardt
7539a01bb0 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>
2021-05-06 00:29:36 -04:00
Andreas Rheinhardt
e10d75610c avcodec/dvenc: Make encoder init-threadsafe
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-05-06 06:13:54 +02:00
Andreas Rheinhardt
bc5e68ea88 avcodec/dvdec: Make decoder init-threadsafe
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-05-06 06:13:54 +02:00
Andreas Rheinhardt
6d484671ec 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>
2021-05-06 06:13:54 +02:00
Andreas Rheinhardt
fbb9e0dbc8 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>
2021-05-06 06:13:54 +02:00
Andreas Rheinhardt
869b204cbc avcodec/wmalosslessdec: Mark decoder as init-threadsafe
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-05-06 06:13:54 +02:00
Andreas Rheinhardt
f48e4639ae avcodec/wmavoice: Mark decoder as init-threadsafe
It is init-threadsafe since b9c1ab8907
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>
2021-05-06 06:13:54 +02:00
Andreas Rheinhardt
f6ee90b6dc avcodec/qcelpdec: Mark decoder as init-threadsafe
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-05-06 06:13:54 +02:00
Zhao Zhili
71ad83667d 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>
2021-05-06 00:11:56 -04:00
Guo, Yejun
41ef57fdb2 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>
2021-05-06 10:50:44 +08:00
Guo, Yejun
fc26dca64e lavfi/dnn: add classify support with openvino backend
Signed-off-by: Guo, Yejun <yejun.guo@intel.com>
2021-05-06 10:50:44 +08:00
Guo, Yejun
a3b74651a0 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.
2021-05-06 10:50:44 +08:00
Guo, Yejun
7eb9accc37 lavfi/dnn_backend_openvino.c: move the logic for batch mode earlier 2021-05-06 10:50:44 +08:00
Guo, Yejun
e37cc72387 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.
2021-05-06 10:50:44 +08:00
Guo, Yejun
1b5dc712cd lavfi/dnn_backend_openvino.c: unify code for infer request for sync/async 2021-05-06 10:50:44 +08:00
Matthias C. M. Troffaes
ed409b8088 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.
2021-05-06 10:33:58 +08:00
Shubhanshu Saxena
26d3fe1a52 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>
2021-05-06 10:17:57 +08:00
Zane van Iperen
2329f7f21e
avformat/rpl: cosmetics
Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
2021-05-06 11:06:43 +10:00
James Almer
3575a495f6 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>
2021-05-05 16:39:52 -03:00
Andreas Rheinhardt
b30851c872 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>
2021-05-05 18:00:25 +02:00
Andreas Rheinhardt
03008c2811 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>
2021-05-05 17:55:37 +02:00
Andreas Rheinhardt
b05631f7b9 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>
2021-05-05 17:52:41 +02:00
Gyan Doshi
8ab2bb81b2 avformat/hlsenc: correct log text and supply packet details 2021-05-05 20:26:38 +05:30
Andreas Rheinhardt
4fda451c9f avcodec/zmbvenc: Avoid copying packet data, allow user-supplied buffers
Here the packet size is known before allocating the packet because
the encoder itself works with an internal buffer, so one can use
this information to avoid the implicit use of another intermediate
buffer for the packet data; one can also switch to
ff_get_encode_buffer() and directly use user-supplied buffers.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-05-05 14:17:04 +02:00
Andreas Rheinhardt
a3f02388f1 avcodec/yuv4enc: Avoid copying packet data, allow user-supplied buffers
When the packet size is known in advance like here, one can avoid
an intermediate buffer for the packet data by using
ff_get_encode_buffer() and also set AV_CODEC_CAP_DR1 at the same time.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-05-05 14:17:04 +02:00
Andreas Rheinhardt
a043dcbe65 avcodec/y41penc: Avoid copying packet data, allow user-supplied buffers
When the packet size is known in advance like here, one can avoid
an intermediate buffer for the packet data by using
ff_get_encode_buffer() and also set AV_CODEC_CAP_DR1 at the same time.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-05-05 14:17:03 +02:00
Andreas Rheinhardt
765366bcba avcodec/xwdenc: Avoid copying packet data, allow user-supplied buffers
When the packet size is known in advance like here, one can avoid
an intermediate buffer for the packet data by using
ff_get_encode_buffer() and also set AV_CODEC_CAP_DR1 at the same time.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-05-05 14:17:03 +02:00