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

106615 Commits

Author SHA1 Message Date
Jason Jang
306994b887 avfilter/af_apsyclip: increase protection for high frequencies
This reduces sibilance distortion when sibilance and bass are
present at the same time. Bringing the protection of high
frequencies up to about the same level as for low frequencies
should also make the quality less dependent on the frequency
balance of the playback system.

Signed-off-by: Jason Jang <jcj83429@gmail.com>
2022-02-05 14:52:16 +01:00
Jason Jang
18fceb9926 avfilter/af_apsyclip: fix peak overestimation
Ignore more samples that are near the edge of the block. The reason
is that the filtering tends to cause these samples to go above the
window more than the samples near the middle. If these samples are
included in the unwindowed peak estimation, the peak can be
overestimated. Because the block is windowed again before
overlapping, overshoots near the edge of the block are not very
important.

0.1 is the value from the version originally contributed to calf.

Signed-off-by: Jason Jang <jcj83429@gmail.com>
2022-02-05 14:52:16 +01:00
Jason Jang
b4ad13420f avfilter/af_apsyclip: fix FFT bin indexing
With a complex FFT instead of real FFT, the negative frequencies
are not dropped from the spectrum output, so they need to be scaled
when the positive frequencies are scaled. The location of the top
bin is also different.

Signed-off-by: Jason Jang <jcj83429@gmail.com>
2022-02-05 14:52:16 +01:00
Zane van Iperen
40766ae1da
avformat/imf: cosmetics
s/++i/i++/g

Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
2022-02-05 22:52:46 +10:00
Pierre-Anthony Lemieux
bec300f4e1
avformat/tests: add /imf to .gitignore
Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
2022-02-05 22:52:39 +10:00
James Almer
0ea87ebc19 avformat/demux: don't truncate the return value of ts_to_samples()
Signed-off-by: James Almer <jamrial@gmail.com>
2022-02-05 09:44:59 -03:00
James Almer
928e7c60cc avformat/demux: print skip_samples and discard_padding as unsigned values in debug log
It's the type they should be interpreted as in the AV_PKT_DATA_SKIP_SAMPLES side
data.

Signed-off-by: James Almer <jamrial@gmail.com>
2022-02-05 09:44:59 -03:00
James Almer
22d6d2b481 avcodec/decode: ignore unsupported skip samples packet side data values
Same as in the AV_FRAME_FLAG_DISCARD codepath, ensure avci->skip_samples is not
negative.

Signed-off-by: James Almer <jamrial@gmail.com>
2022-02-05 09:44:59 -03:00
James Almer
3b9bd63ad9 avformat/demux: don't propagate unsupported skip samples packet side data values
Should fix ticket #9622

Signed-off-by: James Almer <jamrial@gmail.com>
2022-02-05 09:44:59 -03:00
Marton Balint
8a9d3d3dec avformat/imf_cpl: do not use filesize when reading XML file
Similar to the earlier patch applied to imfdec.

Signed-off-by: Marton Balint <cus@passwd.hu>
2022-02-05 10:40:31 +01:00
Patrick Keroulas
00692139c9 avformat/rtpdec_rfc4175: fix interlace format
In previous state, a new frame was allocated on each timestamp step,
i.e. each frame/field transition. However, for interlace, a new frame
should be allocated on 1st field, completed with the 2nd and finally
freed.

This commit fixes the frame allocation and the detection of missing RTP
markers.

Signed-off-by: Patrick Keroulas <patrick.keroulas@radio-canada.ca>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2022-02-05 11:40:40 +08:00
Peter Ross
cc5eb2e662 avformat/img2dec: increase probe score for GEM image fourcc variants
Signed-off-by: Peter Ross <pross@xvid.org>
2022-02-04 11:52:26 +11:00
Peter Ross
5903a4e321 avformat/img2dec: fix logic error in GEM Raster file probe
Use correct logic to express limits of the planes and pattern_size fields.

Fix ticket# 9605

Signed-off-by: Peter Ross <pross@xvid.org>
2022-02-04 11:52:26 +11:00
Martin Storsjö
c69b1a12bb libfdk-aacdec: Flush delayed samples at the end
The fdk-aac decoder can return decoded audio data with a delay.
(Whether it does this or not depends on the options set; by default
it does add some delay.) Previously, this delay was handled by
adjusting the timestamps of the decoded frames, but the last delayed
samples weren't returned.

Set the AV_CODEC_CAP_DELAY flag to indicate that the caller should
flush remaining samples at the end. Also trim off the corresponding
amount of samples at the start instead of adjusting timestamps.

Signed-off-by: Martin Storsjö <martin@martin.st>
2022-02-03 23:57:57 +02:00
Martin Storsjö
340a78afeb libfdk-aacdec: Add an option for setting the decoder's DRC album mode
Signed-off-by: Martin Storsjö <martin@martin.st>
2022-02-03 23:51:47 +02:00
Gyan Doshi
e1a14479a8 ffprobe: allow side-data selection by element
At present, side data printing forces display for all levels i.e.
stream, packets and frames. This can bloat output and also force
decode of all frames in selected streams.

Now, stream_side_data[=type], packet_side_data[=type] &
frame_side_data[=type] can be used with -show_entries to specify carrier
element.
2022-02-03 16:04:24 +05:30
TianBo Zheng
d4a910b2c8 Add MKV tags for AVS2 and AVS3 codecs.
Signed-off-by: TianBo Zheng <naturalwalker@hotmail.com>

MKV codec mappings:
  V_AVS2 and V_AVS3 (https://github.com/ietf-wg-cellar/matroska-specification/blob/master/codec_specs.md)

Encoding tool:
  Ffmpeg with AVS2/AVS3 enabled: https://github.com/xatabhk/FFmpeg-avs2-avs3/releases
  Command line:

             ffmpeg -i xxxx.mp4 -vcodec avs2 -acodec copy xxxx_avs2.mkv
             ffmpeg -i xxxx.mp4 -vcodec avs2 -speed_level 4 -acodec copy xxxx_avs2.mkv`

Players:
  (1) Ffmpeg with avs2/avs3 enabled: (https://github.com/xatabhk/FFmpeg-avs2-avs3/releases):
    Command line:

        ffplay xxxx_avs2.mkv
    ffplay xxxx_avs3.mkv
  (2) VLC 3.0.x with AVS2/AVS3 enabled: https://github.com/xatabhk/vlc-3.0-avs2-avs3/releases
  (3) Mpc-hc 1.9.x with AVS2/AVS3 enabled: https://gitee.com/zhengtianbo/cavs-avs2-avs3_decoder_added_to_mpc_hc/releases

AVS2/AVS3 MKV samples:
  https://github.com/xatabhk/avs2-avs3-video-samples

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-02-03 05:07:44 +01:00
Pierre-Anthony Lemieux
a2df665246 avformat/imf: add IMF CPL with repeated resources to FATE
Signed-off-by: Pierre-Anthony Lemieux <pal@palemieux.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-02-03 04:00:09 +01:00
Lynne
2e82c61055
x86/tx_float: avoid redefining macros
FFT16_FN was used for fft8 and for fft16 afterwards.
2022-02-02 07:51:45 +01:00
Zhao Zhili
b5a8b3d45a hwcontext_vulkan: use VkPhysicalDeviceTimelineSemaphoreFeatures
VkPhysicalDeviceVulkan12Features isn't implemented on MoltenVK yet.
VkPhysicalDeviceTimelineSemaphoreFeatures is less versatile but
simple. None of device_features_1_1 nor device_features_1_2 has real
usage yet, keep the code for future.
2022-02-01 22:54:24 +01:00
James Almer
61b104caaa avcodec/libdav1d: free the Dav1dData packet on dav1d_send_data() failure
We still own it on failure, and there's no point trying to feed it again.

This should address the issue reported in dav1d #383 and part of VLC #26259.

Signed-off-by: James Almer <jamrial@gmail.com>
Reviewed-by: Ronald S. Bultje <rsbultje@gmail.com>
2022-02-01 13:03:12 -03:00
Michael Niedermayer
d8d9d506a3 avformat/mov: Check size before subtraction
Fixes: signed integer overflow: -9223372036854775808 - 8 cannot be represented in type 'long'
Fixes: 43542/clusterfuzz-testcase-minimized-ffmpeg_dem_MOV_fuzzer-5237670148702208

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-02-01 16:50:27 +01:00
Michael Niedermayer
cd6ac013a0 avcodec/cfhd: Avoid signed integer overflow in coeff
Fixes: signed integer overflow: 15244032 * 256 cannot be represented in type 'int'
Fixes: 43504/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_CFHD_fuzzer-4865014842916864

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-02-01 16:50:27 +01:00
Andreas Rheinhardt
61cbfdc0a2 avformat/http: Fix double-free on error
av_dict_set() with AV_DICT_DONT_STRDUP_VAL takes ownership
of the string it is passed to as val; this includes freeing it
on error.

Fixes Coverity issue #1497468.

Reviewed-by: Eran Kornblau <eran.kornblau@kaltura.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-02-01 06:17:41 +01:00
erankor
f23d3a5f8f http: remove cache_redirect option
following 625ea2d, redirect caching is performed according to the http
response headers, there's no need to have it as an option -
always start from the original uri, and apply any redirects according
to the redirect_cache dictionary.

Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
2022-01-31 14:08:33 -05:00
Limin Wang
1530b3f566 avformat/dashdec: avoid calling strlen multiple times
Reviewed-by: Steven Liu <liuqi05@kuaishou.com>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2022-01-30 13:26:35 +08:00
Limin Wang
c825de87c9 avformat/rtpdec: return value check for init_get_bits()
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2022-01-30 13:26:35 +08:00
Limin Wang
d9f05bea5c avformat/rtpdec: Fix negative missed packets in warning message
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2022-01-30 13:26:35 +08:00
Andreas Rheinhardt
98cef1ebbe avutil/tests/adler32: Remove unnecessary volatile
And use an ordinary stack variable.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-01-29 21:26:26 +01:00
Andreas Rheinhardt
f0a7db12a2 avcodec/h264_ps: Remove ALLOW_INTERLACED cruft
Since e1027aba68,
ALLOW_INTERLACED is no longer defined in h264_ps.c,
leading to a warning when encountering an SPS compatible
with MBAFF. This warning was always nonsense, because
ff_h264_decode_seq_parameter_set() is also used by the parser
and it makes no sense for the parser to warn about missing
decoder features; after all, it is not a parser's job
to warn when a feature is unsupported by a decoder
(and in this case it is even weirder, because even if the H.264
decoder is disabled, the warning will only be shown for MBAFF
sequence parameter sets). So remove the warning in h264_ps.c.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-01-29 20:35:05 +01:00
Andreas Rheinhardt
937bb6bbc1 avformat/matroskadec: Export rectangular projection as displaymatrix
This is the officially supported way to express rotations
and flips in Matroska.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-01-29 20:06:04 +01:00
Andreas Rheinhardt
b065a70afa avcodec/libxvid: Don't set AVCodecContext.codec_id
Unnecessary since 2325bdad7b
(and crazy even before then).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-01-29 19:30:25 +01:00
Andreas Rheinhardt
577ba4a1af avcodec/mpeg4videodec: Move use_intra_dc_vlc to stack, fix data race
use_intra_dc_vlc is currently kept in sync between frame threads
in mpeg4_update_thread_context(), yet it is set when decoding
blocks, i.e. after ff_thread_finish_setup(). This is a data race
and therefore undefined behaviour.

This race can be fixed easily by moving the variable from the context
to the stack: use_intra_dc_vlc is only read in
mpeg4_decode_block() and only if one is decoding an intra block.
There are three callsites for this function: One in
mpeg4_decode_partitioned_mb() which always sets use_intra_dc_vlc
before the call and two in mpeg4_decode_mb(). One of these callsites
is for intra blocks and use_intra_dc_vlc is set before it;
the last callsite is for non-intra blocks, where use_intra_dc_vlc
is ignored. So if it is used, it always uses a new value and can
therefore be moved to the stack.

The above also explains why this data race did not lead to
FATE-test failures.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-01-29 19:30:25 +01:00
Andreas Rheinhardt
24a654c6c9 avcodec/mpegvideo: Use offset instead of pointer for vbv_delay
An offset has the advantage of not needing to be updated
when the buffer is reallocated. Furthermore, the way the pointer
is currently updated is undefined behaviour in case the pointer
is not already set (i.e. when not encoding MPEG-1/2), because
it calculates the nonsense NULL - s->pb.buf.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-01-29 19:30:25 +01:00
Andreas Rheinhardt
5a04c6a269 avcodec/mpegpicture: Add function to completely free MPEG-Picture
Also use said function in mpegvideo.c and mpegvideo_enc.c;
and make ff_free_picture_tables() static as it isn't needed anymore
outside of mpegpicture.c.

Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-01-29 19:30:25 +01:00
Andreas Rheinhardt
d0ceb90f44 avcodec/mpegpicture: Let ff_mpeg_unref_picture() free picture tables
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-01-29 19:30:25 +01:00
Andreas Rheinhardt
dcdb34be91 avcodec/mpegvideo: Move MPEG-4 Simple Studio Profile fields to mpeg4video
This is possible now that dealing with the Simple Studio Profile
has been moved to mpeg4videodec.c. It also allows to avoid
allocations, because one can simply put the required buffers
on the context (if one made these buffers part of MpegEncContext,
the memory would be wasted for every codec other than MPEG-4).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-01-29 19:30:25 +01:00
Andreas Rheinhardt
85ac29ad1c avcodec/mpegvideo: Move handling Simple Studio Profile to mpeg4videodec
This is its only user.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-01-29 19:30:25 +01:00
Andreas Rheinhardt
b8b1c49bfa fate/mpeg4: Add test for MPEG-4 Simple Studio Profile
The sample mpeg4/mpeg4_sstp_dpcm.m4v existed in the FATE-suite,
but it was surprisingly unused.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-01-29 19:30:25 +01:00
Andreas Rheinhardt
d4d87f2ac5 avcodec/mpegvideo: Fix crash when using lowres with 10bit MPEG-4
In this case the macroblocks written to are smaller, yet
the MPEG-4 Simple Studio Profile code for 10bit DPCM ignored this;
e.g. in case of lowres = 2 or = 3, the sample mpeg4_sstp_dpcm.m4v
from the FATE-suite reads beyond the end of the buffer.

This commit fixes this by taking lowres into account.
The DPCM macroblocks of the aforementioned sample look
as good as can be expected after this patch; yet the non-DPCM
coded macroblocks are simply corrupt.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-01-29 19:30:25 +01:00
Andreas Rheinhardt
9953fc9a23 avcodec/mpegvideo: Fix off-by-one error when decoding >8 bit MPEG-4
Fixes visual corruptions on two macroblocks from two frames from
https://samples.ffmpeg.org/ffmpeg-bugs/trac/ticket4447/A003C003_SR_422_23.98p.mxf

Reviewed-by: Kieran Kunhya <kierank@obe.tv>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-01-29 19:30:25 +01:00
Andreas Rheinhardt
83c1ac6570 avcodec/mpegvideo_enc: Don't hardcode list of codecs supporting bframes
Check for the encoder's AV_CODEC_CAP_DELAY instead.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-01-29 19:30:24 +01:00
Andreas Rheinhardt
0063a06aaa avcodec/mpegvideo_enc: Localize check for invalid number of b-frames
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-01-29 19:30:24 +01:00
Andreas Rheinhardt
aeb83322aa avcodec/mpegvideo: Move frame_rate_index to (Mpeg1|MPEG12Enc)Context
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-01-29 19:30:24 +01:00
Andreas Rheinhardt
e17ceeba3c avcodec/mpegvideo_enc: Move H.263p? encoders to ituh263enc.c
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-01-29 18:34:31 +01:00
Andreas Rheinhardt
2098d1f4c5 avcodec/mpegvideo_enc: Move msmpeg4/wmv1 encoders to msmpeg4enc.c
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-01-29 18:34:31 +01:00
Andreas Rheinhardt
4bbfe02ca0 avcodec/mpegvideo: Move gop_picture_number to MPEG12EncContext
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-01-29 18:34:31 +01:00
Andreas Rheinhardt
b90ea35182 avcodec/mpegvideo_enc: Don't sync gop_picture_number among slice threads
It is only used by the main thread.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-01-29 18:34:31 +01:00
Andreas Rheinhardt
757be51ded avcodec/mpegvideo: Move timecode_frame_start to Mpeg1Context
It is only used there and only by the main thread.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-01-29 18:34:31 +01:00
Andreas Rheinhardt
01f60973a4 avcodec/mpegvideo: Move aspect_ratio_info to Mpeg1Context
Only used there and only by the main thread.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-01-29 18:34:31 +01:00