Commit Graph

103424 Commits

Author SHA1 Message Date
Andreas Rheinhardt b10a8a30db avformat/oggparsevorbis: Avoid tmp bufs when parsing VorbisComment
A single VorbisComment consists of a length field and a
non-NUL-terminated string of the form "key=value". Up until now,
when parsing such a VorbisComment, zero-terminated duplicates of
key and value would be created. This is wasteful if these duplicates
are freed shortly afterwards, as happens in particular in case of
attached pictures: In this case value is base64 encoded and only
needed to decode the actual data.

Therefore this commit changes this: The buffer is temporarily modified
so that both key and value are zero-terminated. Then the data is used
in-place and restored to its original state afterwards.

This requires that the buffer has at least one byte of padding. All
buffers currently have AV_INPUT_BUFFER_PADDING_SIZE bytes padding,
so this is ok.

Finally, this also fixes weird behaviour from ogm_chapter():
It sometimes freed given to it, leaving the caller with dangling
pointers.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-08-28 15:25:18 +02:00
Andreas Rheinhardt f1d89d6dd0 avformat/oggparsevorbis: Factor parsing a single VorbisComment out
This is in preparation for further commits.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-08-28 15:25:18 +02:00
Lynne 033105a739
h274: remove optimization pragma
This results in warnings on compilers which don't support it,
objections were raised during the review process about it but went unnoticed,
and the speed benefit is highly compiler and version specific, and
also not very critical.

We generally hand-write assembly to optimize loops like that, rather
than use compiler magic, and for 40% best case scenario, it's simply
not worth it.

Plus, tree vectorization is still problematic with GCC and disabled by default
for a good reason, so enabling it locally is sketchy.
2021-08-28 15:13:55 +02:00
Shubhanshu Saxena 1da524121c doc/filters.texi: Include dnn_processing in docs of sr and derain filter
Signed-off-by: Shubhanshu Saxena <shubhanshu.e01@gmail.com>
2021-08-28 16:19:07 +08:00
Shubhanshu Saxena 660a205b05 lavfi/dnn: Rename InferenceItem to LastLevelTaskItem
This patch renames the InferenceItem to LastLevelTaskItem in the
three backends to avoid confusion among the meanings of these structs.

The following are the renames done in this patch:

1. extract_inference_from_task -> extract_lltask_from_task
2. InferenceItem -> LastLevelTaskItem
3. inference_queue -> lltask_queue
4. inference -> lltask
5. inference_count -> lltask_count

Signed-off-by: Shubhanshu Saxena <shubhanshu.e01@gmail.com>
2021-08-28 16:19:07 +08:00
Shubhanshu Saxena 1544d6fa0a libavfilter: Remove Async Flag from DNN Filter Side
Remove async flag from filter's perspective after the unification
of async and sync modes in the DNN backend.

Signed-off-by: Shubhanshu Saxena <shubhanshu.e01@gmail.com>
2021-08-28 16:19:07 +08:00
Shubhanshu Saxena 70b4dca054 libavfilter: Remove synchronous functions from DNN filters
This commit removes the unused sync mode specific code from the DNN
filters since the sync and async mode are now unified from the
filters' perspective.

Signed-off-by: Shubhanshu Saxena <shubhanshu.e01@gmail.com>
2021-08-28 16:19:07 +08:00
Shubhanshu Saxena 60b4d07cf6 libavfilter: Unify Execution Modes in DNN Filters
This commit unifies the async and sync mode from the DNN filters'
perspective. As of this commit, the Native backend only supports
synchronous execution mode.

Now the user can switch between async and sync mode by using the
'async' option in the backend_configs. The values can be 1 for
async and 0 for sync mode of execution.

This commit affects the following filters:
1. vf_dnn_classify
2. vf_dnn_detect
3. vf_dnn_processing
4. vf_sr
5. vf_derain

This commit also updates the filters vf_dnn_detect and vf_dnn_classify
to send only the input frame and send NULL as output frame instead of
input frame to the DNN backends.

Signed-off-by: Shubhanshu Saxena <shubhanshu.e01@gmail.com>
2021-08-28 16:19:07 +08:00
Shubhanshu Saxena d39580ac11 lavfi/dnn: Task-based Inference in Native Backend
This commit rearranges the code in Native Backend to use the TaskItem
for inference.

Signed-off-by: Shubhanshu Saxena <shubhanshu.e01@gmail.com>
2021-08-28 16:19:07 +08:00
Jai Luthra d91542e618 avfilter/signature: fix integer rounding cast precedence
Co-authored-by: Oscar <oscar_davids@outlook.com>
Signed-off-by: Jai Luthra <me@jailuthra.in>
2021-08-28 13:30:02 +05:30
Jan Ekström 9dd410c804 avfilter/vf_scale: reset color matrix in case of identity & non-RGB
Fixes passing through mismatching metadata from the input side
when RGB input (from f.ex. H.264 or HEVC) gets converted to YCbCr.

Fixes #9132
2021-08-28 01:20:09 +03:00
Andreas Rheinhardt ffc00e5b16 avfilter/graphdump: Use pointer to const for pointer to static strings
Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-08-27 18:17:07 +02:00
Andreas Rheinhardt 76ff9640be avfilter/graphdump: Don't return truncated string
Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-08-27 18:17:04 +02:00
Andreas Rheinhardt 48348cd4ab avfilter/graphdump: Don't silently truncate channel layout string
64B are not enough any more.

Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-08-27 18:16:59 +02:00
Andreas Rheinhardt daeef7d220 avfilter/graphdump: Properly initialize AVBPrint
Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-08-27 18:16:35 +02:00
Andreas Rheinhardt 831718bbab avformat/movenc: Avoid calling strlen multiple times
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-08-27 10:47:35 +02:00
Andreas Rheinhardt 64020dfe08 avformat/vorbiscomment: Don't compute strlen twice
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-08-27 10:47:23 +02:00
Paul B Mahol dc34bf45c5 avfilter/vf_colorcorrect: add median analyze mode 2021-08-27 10:04:04 +02:00
Paul B Mahol 0cacef58fa avfilter/vf_blend: use float for opacity calculations 2021-08-27 09:35:33 +02:00
Paul B Mahol a6f00d4e82 avfilter/aeval: fix forgotten EOF case for activate
Bring fate test how it was previously.
2021-08-26 19:23:03 +02:00
maryam ebrahimzadeh 3e24e8108d avcodec/vc1dec: return value check for init_get_bits
As the second argument for init_get_bits(avctx and buf) can be crafted,
a return value check for this function call is necessary,
so replace init_get_bits with init_get_bits8 and add return value check.
2021-08-26 09:23:15 +02:00
Stéphane Cerveau f9fbe2f9a9 avcodec/wmadec: handle run_level_decode error
Consider data as invalid if ff_wma_run_level_decode
gets out with an error.

It avoids an unpleasant sound distorsion.

See http://trac.ffmpeg.org/ticket/9358
2021-08-26 09:20:56 +02:00
Olivier Crête 521388edb7 avcodec/wma: Return specific error code
This way, the calling function can just forward it instead of
making it up.

Signed-off-by: Olivier Crête <olivier.crete@collabora.com>
2021-08-26 09:20:56 +02:00
Paul B Mahol c1c7f2b61f avfilter/avf_showwaves: remove invalid multiplication by 2
Fixes output of average filter.
2021-08-26 09:16:35 +02:00
maryam ebrahimzadeh ad88cce3f8 avcodec/vp6: return value check for init_get_bits
As the second argument for init_get_bits(buf) can be crafted,
a return value check for this function call is necessary.
Also replace init_get_bits with init_get_bits8.

Signed-off-by: Peter Ross <pross@xvid.org>
2021-08-26 17:06:57 +10:00
Andreas Rheinhardt afeefb306e avcodec/bsf: Avoid allocation for AVBSFInternal
Do this by allocating AVBSFContext together with the data that is
currently in AVBSFInternal; or rather: Put AVBSFContext at the beginning
of a new structure called FFBSFContext (which encompasses more than just
the internal fields and is a proper context in its own right, hence the
name) and remove the AVBSFInternal altogether.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-08-25 23:01:54 +02:00
Andreas Rheinhardt 52bd399972 avformat/aviobuf: Use ffio_fill for padding
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-08-25 23:01:54 +02:00
Andreas Rheinhardt f5f984c9c3 avformat/aviobuf: Avoid allocation when using dynamic buffer
This can be achieved by allocating the AVIOContext and
the dynamic buffer's opaque and internal write buffer together.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-08-25 23:01:54 +02:00
Andreas Rheinhardt 45bfe8b838 avformat/avio: Move internal AVIOContext fields to avio_internal.h
Currently AVIOContext's private fields are all over AVIOContext.
This commit moves them into a new structure in avio_internal.h instead.
Said structure contains the public AVIOContext as its first element
in order to avoid having to allocate a separate AVIOContextInternal
which is costly for those use cases where one just wants to access
an already existing buffer via the AVIOContext-API.
For these cases ffio_init_context() can't fail and always returned zero,
which was typically not checked. Therefore it has been made to not
return anything.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-08-25 23:01:54 +02:00
Andreas Rheinhardt 530ac6aa30 avformat/aviobuf: Make ffio_set_buf_size() static
Possible since 9c3adb7ce2.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-08-25 23:01:54 +02:00
Andreas Rheinhardt 19093100fd avformat/utils: Move ffio_limit() to aviobuf
It is the more natural place for it given that it only deals with I/O;
in fact, the function already has the ffio prefix and its declaration
already is in avio_internal.h.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-08-25 23:01:53 +02:00
Andreas Rheinhardt e75ab15fd4 avformat/matroskadec: Read RealAudio extradata directly
Don't use the avio-API to read a few bytes at fixed offsets.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-08-25 23:01:53 +02:00
Andreas Rheinhardt 7cfff1512c avformat/aviobuf: Avoid calling function twice due to FFMAX()
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-08-25 23:01:53 +02:00
Andreas Rheinhardt 81b6186920 avutil/log: Reorder elements of AVClass to make it smaller
Putting child_next besides child_class_iterate is actually nicer.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-08-25 23:01:53 +02:00
Andreas Rheinhardt 417bd4f7dd avcodec/codec: Reorder elements to make AVCodec smaller
Reordering max_lowres is an ABI break.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-08-25 23:01:53 +02:00
James Almer 9677053884 avcodec/h264_slice: don't allocate film grain buffers when using hwaccel
Fixes regression since 66845cffc3

Signed-off-by: James Almer <jamrial@gmail.com>
2021-08-25 18:01:00 -03:00
Paul B Mahol 8cbed82b2a fftools/ffmpeg_filter: silence valgrind warning 2021-08-25 22:51:32 +02:00
Paul B Mahol 507fdcd1b0 avcodec/dnxhddec: ignore second flag for encoded field
And instead use previous field flag.

Fixes decoding files produced by non-compliant encoders.
2021-08-25 22:48:23 +02:00
Martin Storsjö 2589060b92 arm: hevc_qpel: Fix the assembly to work with non-multiple of 8 widths
This unbreaks the fate-checkasm-hevc_pel test on arm targets.

The assembly assumed that the width passed to the DSP functions is
a multiple of 8, while the checkasm test used other widths too.

This wasn't noticed before, because the hevc_pel checkasm tests
(that were added in 9c513edb79 in
January) weren't run as part of fate until in
b492cacffd in August.

As this hasn't been an issue in practice with actual full decoding
tests, it seems like the actual decoder doesn't call these functions
with such widths. Therefore, we could alternatively fix the test
to only test things that the real decoder does, and this modification
could be reverted.

Signed-off-by: Martin Storsjö <martin@martin.st>
2021-08-25 23:24:49 +03:00
Jan Ekström d48232fb4c tests/fate: move TTML-in-MP4 tests from subtitles.mak to mov.mak
subtitles.mak's fate-sub tests utilize a more strict comparator
("rawdiff"), which causes the tests fail in case of white space
differences, such as CRLF vs LF. This in turn causes these
ffprobe-using TTML-in-MP4 tests to fail on non-LF systems such as
Windows or wine.
2021-08-25 23:17:53 +03:00
Paul B Mahol 02aa7dc423 avfilter: add hsvkey and hsvhold video filters 2021-08-25 20:43:18 +02:00
Shaun Simpson 16102cada5 avcodec/jpeg2000_parser: Fix skipping of JP2 info markers by correctly reading marker size
Signed-off-by: Shaun Simpson <shauns2029@gmail.com>
2021-08-25 15:12:09 +02:00
Shaun Simpson 01284c01c1 avcodec/jpeg2000_parser: Fix parsing of tile-part header
And frames where the end of frame marker is at the end of the buffer.

Signed-off-by: Shaun Simpson <shauns2029@gmail.com>
2021-08-25 14:47:03 +02:00
Jan Ekström e41bd075dd avformat/movenc: add support for TTML muxing
Includes basic support for both the ISMV ('dfxp') and MP4 ('stpp')
methods. This initial version also foregoes fragmentation support
in case the built-in sample squashing is to be utilized, as this
eases the initial review.

Additionally, add basic tests for both muxing modes in MP4.

Signed-off-by: Jan Ekström <jan.ekstrom@24i.com>
2021-08-25 09:26:46 +03:00
Jan Ekström 460beb948c avformat/ttml: split TTML paragraph based or not check into header
This way it can be re-utilized in movenc.

Signed-off-by: Jan Ekström <jan.ekstrom@24i.com>
2021-08-25 09:26:46 +03:00
Niklas Haas 94653e0dee avcodec/h264dec: fix possible out-of-bounds array access
If slice_type is > 9, the access to ff_h264_golomb_to_pict_type is
out-of-bounds. Fix this by simply setting the slice_type to 0 in this
case.

This is completely inconsequential because the value is only being used
to being used as an offset in the calculation of the film grain seed
value, a corruption of which is practically invisible.

Fixes coverity ticket #1490802

Signed-off-by: James Almer <jamrial@gmail.com>
2021-08-25 00:56:35 -03:00
J. Dekker b492cacffd checkasm: collapse hevc pel tests
Also add to `make fate-checkasm' target.

Signed-off-by: J. Dekker <jdek@itanimul.li>
2021-08-24 22:12:06 +02:00
James Almer fbbca7b8fa fate: update some missing refs
Forgotten in 590a7e02f0

Signed-off-by: James Almer <jamrial@gmail.com>
2021-08-24 12:22:36 -03:00
James Almer ab25874e32 avcodec/h264_slice: signal the presence of Film Grain in the decoder context
Signed-off-by: James Almer <jamrial@gmail.com>
2021-08-24 10:00:20 -03:00
James Almer 9b05263ac1 avcodec/av1: signal the presence of Film Grain in the decoder context
Signed-off-by: James Almer <jamrial@gmail.com>
2021-08-24 10:00:20 -03:00