Commit Graph

102958 Commits

Author SHA1 Message Date
Guangyu Sun
75510d7015 avformat/oggparsevorbis: Update end_trimming for the last packet
Without end_trimming, the last packet will contain unexpected samples used
for padding.

This commit partially fixes #6367 when the audio length is long enough.

dd if=/dev/zero of=./silence.raw count=20 bs=500
oggenc --raw silence.raw --output=silence.ogg
oggdec --raw --output silence.oggdec.raw silence.ogg
ffmpeg -codec:a libvorbis -i silence.ogg -f s16le -codec:a pcm_s16le silence.libvorbis.ffmpeg.raw
ffmpeg -i silence.ogg -f s16le -codec:a pcm_s16le silence.native.ffmpeg.raw
ls -l *.raw

The original test case in #6367 is still not fixed due to a remaining issue.

The remaining issue is that ogg_stream->private is not kept during
ogg_save()/ogg_restore(). Field final_duration in the private data is
important to calculate end_trimming.

Some common operations such as avformat_open_input() and
avformat_find_stream_info() before reading packet will trigger ogg_save()
and ogg_restore().

Luckily, final_duration will not get updated until the last ogg page. The
save/restore mentioned above will not change final_duration most of the
time. But if the audio length is short, those reads may be performed on
the last ogg page, causing trouble keeping the correct value of
final_duration. We probably need a more complicated patch to address this
issue.

Signed-off-by: Guangyu Sun <gsun@roblox.com>
2021-07-12 09:54:47 +02:00
Roman Beranek
ed240db9e3 cafenc: fill in avg. packet size later if unknown
Frame size of Opus stream was previously presumed here to be 960 samples
(20ms), however sizes of 120, 240, 480, 1920, and 2880 are also allowed.
It can also alter on a per-packet basis and even multiple frames may be
present in a single packet according to the specification, for the sake
of simplicity however, let us assume that this doesn't occur.

Because the mFramesPerPacket field, representing the number of samples
per packet in the ffmpeg terminilogy, is the key factor in calculating
packet durations and all that follows from that (index, bitrate, ...),
it is crucial to get right.

Therefore, if the packet size is not available ahead of time (as it is in
the case of Opus), calculate an average from the stream duration once we
know how many packets there are and update the filed in the header.
2021-07-12 09:54:25 +02:00
Gyan Doshi
1aa9dcd091 avcodec/qsvenc: clip global_quality for ICQ modes.
Allowed range is 1 to 51.

Ref: https://software.intel.com/content/www/us/en/develop/articles/advanced-bitrate-control-methods-in-intel-media-sdk.html
2021-07-12 09:33:22 +05:30
Shubhanshu Saxena
6f9570a633 lavfi/dnn_backend_tf: Error Handling
This commit adds handling for cases where an error may occur, clearing
the allocated memory resources.

Signed-off-by: Shubhanshu Saxena <shubhanshu.e01@gmail.com>
2021-07-11 20:12:27 +08:00
Shubhanshu Saxena
84e4e60fdc lavfi/dnn_backend_tf: Separate function for Completion Callback
This commit rearranges the existing code to create a separate function
for the completion callback in execute_model_tf.

Signed-off-by: Shubhanshu Saxena <shubhanshu.e01@gmail.com>
2021-07-11 20:12:27 +08:00
Shubhanshu Saxena
b849228ae0 lavfi/dnn_backend_tf: Separate function for filling RequestItem
This commit rearranges the existing code to create separate function
for filling request with execution data.

Signed-off-by: Shubhanshu Saxena <shubhanshu.e01@gmail.com>
2021-07-11 20:12:27 +08:00
Shubhanshu Saxena
08d8b3b631 lavfi/dnn_backend_tf: Request-based Execution
This commit uses TFRequestItem and the existing sync execution
mechanism to use request-based execution. It will help in adding
async functionality to the TensorFlow backend later.

Signed-off-by: Shubhanshu Saxena <shubhanshu.e01@gmail.com>
2021-07-11 20:12:27 +08:00
Shubhanshu Saxena
a4de605110 lavfi/dnn_backend_tf: Add TFInferRequest and TFRequestItem
This commit introduces a typedef TFInferRequest to store
execution parameters for a single call to the TensorFlow C API.
This typedef is used in the TFRequestItem.

Signed-off-by: Shubhanshu Saxena <shubhanshu.e01@gmail.com>
2021-07-11 20:12:27 +08:00
Shubhanshu Saxena
68cf14d2b1 lavfi/dnn_backend_tf: TaskItem Based Inference
This commit uses the common TaskItem and InferenceItem typedefs
for execution in TensorFlow backend.

Signed-off-by: Shubhanshu Saxena <shubhanshu.e01@gmail.com>
2021-07-11 20:12:27 +08:00
Gyan Doshi
79ebdbb9b9 ffmpeg: add option recast_media
Allows forcing decoders of different media type.
Needed to decode media data muxed as data streams.
2021-07-11 11:54:20 +05:30
Jun Zhao
7bd7377ddb lavc:libsvtav1: Update SVT-AV1 new repo
SVT-AV1 moved the repo from github to gitlab.

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2021-07-10 15:46:22 +08:00
Zhao Zhili
30ca9980ff avformat/udp: fix check for pthread_cond_wait return value
POSIX errno is positive. We have strict_pthread_cond_wait to handle
error code during development.

Signed-off-by: zhilizhao <zhilizhao@tencent.com>
Reviewed-by: Jun Zhao <barryjzhao@tencent.com>
2021-07-10 15:35:06 +08:00
James Almer
7ee17ec7e4 avcodec/libdav1d: don't repeatedly parse the same sequence header
Look at the event flag that signals a new sequence header was found
in the bitstream on supported libdav1d versions for this purpose.

Signed-off-by: James Almer <jamrial@gmail.com>
2021-07-09 11:07:29 -03:00
James Almer
48eaf8ba1c avcodec/libdav1d: use ff_decode_frame_props() to fill frame properties
The main benefit comes from propagating container level metadata like hdr,
which is more commonly used than the relevant Metadata OBUs.

Signed-off-by: James Almer <jamrial@gmail.com>
2021-07-09 11:07:29 -03:00
Michael Niedermayer
7874d40f10 swscale/slice: Fix wrong return on error
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-07-09 15:21:37 +02:00
Michael Niedermayer
eaec4df63f avcodec/aacdec_template: Avoid some invalid values to be set by decode_audio_specific_config_gb()
Fixes: NULL pointer dereference
Fixes: decode_spectrum_and_dequant.mp4

Found-by: Rafael Dutra <rafael.dutra@cispa.de>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-07-09 14:57:49 +02:00
Michael Niedermayer
fa1e158ef6 swscale/utils: Use full chroma interpolation for rgb4/8 and dither none
Dither none is only implemented in full chroma interpolation for these rgb formats
Its also a obscure choice (producing less nice images) that implementing it in the
other code-paths makes no sense

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-07-09 12:29:03 +02:00
Michael Niedermayer
7528532550 swscale/output: Implement dither none for yuv2rgb_write_full()
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-07-09 12:29:03 +02:00
Michael Niedermayer
997f9cfc12 swscale/slice: Check slice for allocation failure
Fixes: null pointer dereference
Fixes: alloc_slice.mp4

Found-by: Rafael Dutra <rafael.dutra@cispa.de>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-07-09 12:29:03 +02:00
Andreas Rheinhardt
40ce7aec09 avformat/img2dec: Fix typo in AVClass name
Found-by: Gyan Doshi <ffmpeg@gyani.pro>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-07-08 21:31:19 +02:00
Andreas Rheinhardt
f067795c74 avcodec/textdec: Deduplicate AVClasses
The child_class_next API relied on different AVCodecs to use
different AVClasses; yet this API has been replaced by
child_class_iterate.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-07-08 20:10:17 +02:00
Andreas Rheinhardt
d46de6d4bc avcodec/proresenc_anatoliy: Deduplicate pix_fmts arrays
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-07-08 20:10:17 +02:00
Andreas Rheinhardt
a45058ddf9 avcodec/proresenc_anatoliy: Deduplicate AVClasses
The child_class_next API relied on different AVCodecs to use
different AVClasses; yet this API has been replaced by
child_class_iterate.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-07-08 20:10:17 +02:00
Andreas Rheinhardt
f41a9b331e avcodec/pngenc: Deduplicate AVClasses
The child_class_next API relied on different AVCodecs to use
different AVClasses; yet this API has been replaced by
child_class_iterate.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-07-08 20:10:17 +02:00
Andreas Rheinhardt
34ff543672 avcodec/mpegvideo_enc: Deduplicate ff_mpv_generic_options-based AVClasses
The child_class_next API relied on different AVCodecs to use
different AVClasses; yet this API has been replaced by
child_class_iterate.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-07-08 20:10:17 +02:00
Andreas Rheinhardt
19d8077e31 avcodec/libwebpenc: Deduplicate options, AVClass, pix_fmts
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-07-08 20:10:17 +02:00
Andreas Rheinhardt
425d272507 avcodec/libcodec2: Remove AVClass for decoder
The decoder has no options.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-07-08 20:10:17 +02:00
Andreas Rheinhardt
01f4f6c297 avcodec/g726: Deduplicate AVClasses
The child_class_next API relied on different AVCodecs to use
different AVClasses; yet this API has been replaced by
child_class_iterate.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-07-08 20:10:17 +02:00
Andreas Rheinhardt
bc368575a9 avcodec/ac3enc: Deduplicate AVClasses
The child_class_next API relied on different AVCodecs to use
different AVClasses; yet this API has been replaced by
child_class_iterate.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-07-08 20:10:01 +02:00
Andreas Rheinhardt
9a1a82d21c avcodec/ac3dec_float: Deduplicate AVClasses
The child_class_next API relied on different AVCodecs to use
different AVClasses; yet this API has been replaced by
child_class_iterate.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-07-08 19:30:36 +02:00
Andreas Rheinhardt
34a7e61768 avcodec/Makefile: Fix standalone build of adpcm_argo encoder
Said encoder uses a function in adpcm.c and while it does not use
anything from adpcm_data.c, other parts of both adpcm.c and adpcmenc.c
need it, so adpcm_data.c needs to be enabled anyway.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-07-08 16:03:18 +02:00
Andreas Rheinhardt
34276e9287 avformat/v210: Deduplicate AVClasses
The child_class_next API relied on different (de)muxers to use
different AVClasses; yet this API has been replaced by
child_class_iterate.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-07-08 16:03:18 +02:00
Andreas Rheinhardt
072496ca40 avformat/segment: Deduplicate AVClasses
The child_class_next API relied on different (de)muxers to use
different AVClasses; yet this API has been replaced by
child_class_iterate.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-07-08 16:03:18 +02:00
Andreas Rheinhardt
7ca0931fe1 avformat/rawdec: Deduplicate AVClasses based upon ff_rawvideo_options
The child_class_next API relied on different (de)muxers to use
different AVClasses; yet this API has been replaced by
child_class_iterate.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-07-08 16:03:18 +02:00
Andreas Rheinhardt
6a055bf036 avformat/rawdec: Deduplicate AVClasses based upon ff_raw_options
The child_class_next API relied on different (de)muxers to use
different AVClasses; yet this API has been replaced by
child_class_iterate.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-07-08 16:03:18 +02:00
Andreas Rheinhardt
168565ce44 avformat/pcmdec: Deduplicate AVClasses
The child_class_next API relied on different (de)muxers to use
different AVClasses; yet this API has been replaced by
child_class_iterate.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-07-08 16:03:18 +02:00
Andreas Rheinhardt
d0293c770b avformat/oggenc: Deduplicate AVClasses
The child_class_next API relied on different (de)muxers to use
different AVClasses; yet this API has been replaced by
child_class_iterate.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-07-08 16:03:18 +02:00
Andreas Rheinhardt
50e523144a avformat/mpegenc: Deduplicate AVClasses
The child_class_next API relied on different (de)muxers to use
different AVClasses; yet this API has been replaced by
child_class_iterate.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-07-08 16:03:17 +02:00
Andreas Rheinhardt
637e2c0a3e avformat/movenc: Deduplicate AVClasses
The child_class_next API relied on different (de)muxers to use
different AVClasses; yet this API has been replaced by
child_class_iterate.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-07-08 16:03:17 +02:00
Andreas Rheinhardt
429651855c avformat/matroskaenc: Deduplicate AVClasses
The child_class_next API relied on different (de)muxers to use
different AVClasses; yet this API has been replaced by
child_class_iterate.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-07-08 16:03:17 +02:00
Andreas Rheinhardt
f06bd04123 avformat/img2dec: Deduplicate AVClasses
The child_class_next API relied on different (de)muxers to use
different AVClasses; yet this API has been replaced by
child_class_iterate.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-07-08 16:03:17 +02:00
Andreas Rheinhardt
c0a53884ee avformat/img2dec: Make ff_img2pipe_options static
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-07-08 16:03:17 +02:00
Andreas Rheinhardt
5ca535ee9a avformat/hashenc: Deduplicate AVClasses
The child_class_next API relied on different (de)muxers to use
different AVClasses; yet this API has been replaced by
child_class_iterate.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-07-08 16:03:17 +02:00
Andreas Rheinhardt
cd0ab3526d avformat/g726: Deduplicate AVClasses
The child_class_next API relied on different (de)muxers to use
different AVClasses; yet this API has been replaced by
child_class_iterate.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-07-08 16:03:17 +02:00
Andreas Rheinhardt
e4ee2a0629 avformat/flvdec: Deduplicate AVClasses
The child_class_next API relied on different (de)muxers to use
different AVClasses; yet this API has been replaced by
child_class_iterate.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-07-08 16:03:17 +02:00
Andreas Rheinhardt
779dba0fc0 avformat/flacdec, takdec: Use FFRawDemuxerContext directly
The beginning of the private contexts of both the FLAC and the TAK
demuxer currently mimick FFRawDemuxerContext: A pointer to an AVClass
followed by the AVOpt-enabled field raw_packet_size. Said field is only
used by the demuxers' read_packet functions via
ff_raw_read_partial_packet(), which treats the private context as an
FFRaawDemuxerContext. Yet this is fragile, so better include a
FFRawDemuxerContext struct at the beginning of said demuxers' private
contexts.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-07-08 16:03:17 +02:00
Andreas Rheinhardt
cd564ee547 avformat/codec2: Remove unused AVClass with wrong category
The codec2 muxer has no options and so it needs no AVClass;
and it certainly needs no AVClass of category AV_CLASS_CATEGORY_DEMUXER.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-07-08 16:03:17 +02:00
Andreas Rheinhardt
63ad9ba4b5 avformat/asfenc: Deduplicate AVClasses
The child_class_next API relied on different (de)muxers to use
different AVClasses; yet this API has been replaced by
child_class_iterate.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-07-08 16:03:17 +02:00
Andreas Rheinhardt
c64cfef91e avformat/aptxdec: Deduplicate AVClasses
The child_class_next API relied on different (de)muxers to use
different AVClasses; yet this API has been replaced by
child_class_iterate.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-07-08 16:03:17 +02:00
Andreas Rheinhardt
41ab409332 avformat/Makefile: Remove rawdec dependency from aptx, codec2 demuxers
These demuxers don't need anything from rawdec; they furthermore only
used rawdec.h to include opt.h. Both of this has been fixed.

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