]> git.sesse.net Git - ffmpeg/log
ffmpeg
3 years agoavformat/rawenc: remove singlejpeg muxer
Gyan Doshi [Sat, 10 Apr 2021 14:24:41 +0000 (19:54 +0530)]
avformat/rawenc: remove singlejpeg muxer

It was added in 51ac1f616f due to ticket #4218, in order to show a single
image via ffserver. With ffserver long gone, it serves no purpose.

3 years agoavcodec/nellymoserenc: Fix segfault when using unsupported channels/rate
Andreas Rheinhardt [Thu, 15 Apr 2021 13:48:34 +0000 (15:48 +0200)]
avcodec/nellymoserenc: Fix segfault when using unsupported channels/rate

NellyMoserEncodeContext.avctx is only set in init after these checks,
yet it is used by encode_end().
This is a regression since 0a56bfa71f751a2b25da8d060a019c1c75ca9d7b.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
3 years agomov: Prioritize aspect ratio values found in pasp atom
Vittorio Giovara [Tue, 6 Apr 2021 16:15:49 +0000 (18:15 +0200)]
mov: Prioritize aspect ratio values found in pasp atom

From the ISO/IEC specification for MP4:
  The pixel aspect ratio and clean aperture of the video may be specified
  using the ‘pasp’ and ‘clap’ sample entry boxes, respectively. These are
  both optional; if present, they over-ride the declarations (if any) in
  structures specific to the video codec, which structures should be
  examined if these boxes are absent. For maximum compatibility, these
  boxes should follow, not precede, any boxes defined in or required by
  derived specifications.

Fixes trac/#7277.

3 years agoavcodec/mpeg4videodec: update exported AVOptions in the user-facing context
James Almer [Mon, 12 Apr 2021 14:35:47 +0000 (11:35 -0300)]
avcodec/mpeg4videodec: update exported AVOptions in the user-facing context

This prevents bogus values being reported on frame multithreaded decoding
scenarios.

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agoavcodec/h264dec: update exported AVOptions in the user-facing context
James Almer [Sat, 10 Apr 2021 19:10:11 +0000 (16:10 -0300)]
avcodec/h264dec: update exported AVOptions in the user-facing context

Based on a patch by Hendrik Leppkes.

Fixes ticket #9176.

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agopthread_frame: introduce a codec callback to update the user-facing context
Hendrik Leppkes [Mon, 6 Jul 2020 00:29:59 +0000 (02:29 +0200)]
pthread_frame: introduce a codec callback to update the user-facing context

3 years agoffprobe: only print exported private decoder options
James Almer [Sat, 10 Apr 2021 20:23:22 +0000 (17:23 -0300)]
ffprobe: only print exported private decoder options

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agoavcodec/h264dec: add missing flags to is_avc and nal_length_size AVOptions
James Almer [Sat, 10 Apr 2021 19:06:34 +0000 (16:06 -0300)]
avcodec/h264dec: add missing flags to is_avc and nal_length_size AVOptions

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agoaarch64: h264pred: Optimize the inner loop of existing 8 bit functions
Martin Storsjö [Mon, 12 Apr 2021 07:31:22 +0000 (10:31 +0300)]
aarch64: h264pred: Optimize the inner loop of existing 8 bit functions

Move the loop counter decrement further from the branch instruction,
this hides the latency of the decrement.

In loops that first load, then store (the horizontal prediction cases),
do the decrement after the load (where the next instruction would
stall a bit anyway, waiting for the result of the load).

In loops that store twice using the same destination register,
also do the decrement between the two stores (as the second store
would need to wait for the updated destination register from the
first instruction).

In loops that store twice to two different destination registers,
do the decrement before both stores, to do it as soon before the
branch as possible.

This gives minor (1-2 cycle) speedups in most cases (modulo measurement
noise), but the horizontal prediction functions get a rather notable
speedup on the Cortex A53.

Before:                     Cortex A53     A72     A73
pred8x8_dc_8_neon:                60.7    46.2    39.2
pred8x8_dc_128_8_neon:            30.7    18.0    14.0
pred8x8_horizontal_8_neon:        42.2    29.2    18.5
pred8x8_left_dc_8_neon:           52.7    36.2    32.2
pred8x8_mad_cow_dc_0l0_8_neon:    48.2    27.7    25.7
pred8x8_mad_cow_dc_0lt_8_neon:    52.5    33.2    34.7
pred8x8_mad_cow_dc_l0t_8_neon:    52.5    31.7    33.2
pred8x8_mad_cow_dc_l00_8_neon:    43.2    27.0    25.5
pred8x8_plane_8_neon:            112.2    86.2    88.2
pred8x8_top_dc_8_neon:            40.7    23.0    21.2
pred8x8_vertical_8_neon:          27.2    15.5    14.0
pred16x16_dc_8_neon:              91.0    73.2    70.5
pred16x16_dc_128_8_neon:          43.0    34.7    30.7
pred16x16_horizontal_8_neon:      86.0    49.7    44.7
pred16x16_left_dc_8_neon:         87.0    67.2    67.5
pred16x16_plane_8_neon:          236.0   175.7   173.0
pred16x16_top_dc_8_neon:          53.2    39.0    41.7
pred16x16_vertical_8_neon:        41.7    29.7    31.0

After:
pred8x8_dc_8_neon:                59.0    46.7    42.5
pred8x8_dc_128_8_neon:            28.2    18.0    14.0
pred8x8_horizontal_8_neon:        34.2    29.2    18.5
pred8x8_left_dc_8_neon:           51.0    38.2    32.7
pred8x8_mad_cow_dc_0l0_8_neon:    46.7    28.2    26.2
pred8x8_mad_cow_dc_0lt_8_neon:    55.2    33.7    37.5
pred8x8_mad_cow_dc_l0t_8_neon:    51.2    31.7    37.2
pred8x8_mad_cow_dc_l00_8_neon:    41.7    27.5    26.0
pred8x8_plane_8_neon:            111.5    86.5    89.5
pred8x8_top_dc_8_neon:            39.0    23.2    21.0
pred8x8_vertical_8_neon:          27.2    16.0    14.0
pred16x16_dc_8_neon:              85.0    70.2    70.5
pred16x16_dc_128_8_neon:          42.0    30.0    30.7
pred16x16_horizontal_8_neon:      66.5    49.5    42.5
pred16x16_left_dc_8_neon:         81.0    66.5    67.5
pred16x16_plane_8_neon:          235.0   175.7   173.0
pred16x16_top_dc_8_neon:          52.0    39.0    41.7
pred16x16_vertical_8_neon:        40.2    33.2    31.0

Despite this, a number of these functions still are slower than
what e.g. GCC 7 generates - this shows the relative speedup of the
neon codepaths over the compiler generated ones:

                           Cortex A53    A72    A73
pred8x8_dc_8_neon:               0.86   0.65   1.04
pred8x8_dc_128_8_neon:           0.59   0.44   0.62
pred8x8_horizontal_8_neon:       1.51   0.58   1.30
pred8x8_left_dc_8_neon:          0.72   0.56   0.89
pred8x8_mad_cow_dc_0l0_8_neon:   0.93   0.93   1.37
pred8x8_mad_cow_dc_0lt_8_neon:   1.37   1.41   1.68
pred8x8_mad_cow_dc_l0t_8_neon:   1.21   1.17   1.32
pred8x8_mad_cow_dc_l00_8_neon:   1.24   1.19   1.60
pred8x8_plane_8_neon:            3.36   3.58   3.76
pred8x8_top_dc_8_neon:           0.97   0.99   1.43
pred8x8_vertical_8_neon:         0.86   0.78   1.18
pred16x16_dc_8_neon:             1.20   1.06   1.49
pred16x16_dc_128_8_neon:         0.83   0.95   0.99
pred16x16_horizontal_8_neon:     1.78   0.96   1.59
pred16x16_left_dc_8_neon:        1.06   0.96   1.32
pred16x16_plane_8_neon:          5.78   6.49   7.19
pred16x16_top_dc_8_neon:         1.48   1.53   1.94
pred16x16_vertical_8_neon:       1.39   1.34   1.98

In particular, on Cortex A72, many of these functions are slower
than the compiler generated code, while they're more beneficial on
e.g. the Cortex A73.

Signed-off-by: Martin Storsjö <martin@martin.st>
3 years agoavformat/dashdec: Also fetch final partial segment
Matt Robinson [Mon, 5 Apr 2021 17:45:04 +0000 (18:45 +0100)]
avformat/dashdec: Also fetch final partial segment

Currently, the DASH demuxer omits the final segment for a non-live
stream (using SegmentTemplate) if it is shorter than the other segments.

Correct calc_max_seg_no to round up when calulating the number of
segments instead of rounding down to resolve this issue.

Signed-off-by: Matt Robinson <git@nerdoftheherd.com>
3 years agofftools/ffmpeg_filter: Fix check for mjpeg encoder
Andreas Rheinhardt [Tue, 13 Apr 2021 17:13:39 +0000 (19:13 +0200)]
fftools/ffmpeg_filter: Fix check for mjpeg encoder

The MJPEG encoder supports some pixel format/color range combinations
only when strictness is set to unofficial or less. Before commit
059fc2d9da5364627613fb3e6424079e14dbdfd3 said encoder's pix_fmts array
only included the pixel formats supported with default strictness.
When strictness was <= unofficial, fftools/ffmpeg_filter.c used
an extended list of pixel formats instead of the encoder's including
the pixel formats only supported when strictness <= unofficial.

Said commit turned the logic around: The encoder's pix_fmts array now
included all pixel formats and fftools/ffmpeg_filter.c instead used
a small list of all pixel formats supported when strictness is >
unofficial and the encoder's pixel formats instead. In particular,
the codec's pix_fmt is not used when strictness is normal.

This works for the mjpeg encoder; yet it did not work for other
(hardware-based) mjpeg encoders, because the check for whether one is
using the MJPEG encoder is wrong: It just checks the codec id.
So if one used strict unofficial with a hardware-accelerated MJPEG
encoder before commit 059fc2d9da53, the unofficial (non-hardware)
pixel formats of the MJPEG encoder would be used; since said commit
the codec's pixel formats are overridden at ordinary strictness
by the ordinary MJPEG pixel formats. This leads to format conversion
errors lateron which were reported in #9186.

The solution to this is to check AVCodec.name instead of its id.

Fixes ticket #9186.

Tested-by: Eoff, Ullysses A <ullysses.a.eoff@intel.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
3 years agolibavdevice/gdigrab: fix capture of windows with non-ASCII titles
He Yang [Sat, 20 Mar 2021 15:32:15 +0000 (23:32 +0800)]
libavdevice/gdigrab: fix capture of windows with non-ASCII titles

Properly convert the UTF-8 input string to Windows wchar, and
utilize the wchar version of FindWindow.

Signed-off-by: He Yang <1160386205@qq.com>
3 years agoavcodec/jpeglsenc: Remove redundant pixel format checks
Andreas Rheinhardt [Mon, 12 Apr 2021 17:02:58 +0000 (19:02 +0200)]
avcodec/jpeglsenc: Remove redundant pixel format checks

This encoder has AVCodec.pix_fmts set, so ff_encode_preinit() already
checks for this.

Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
3 years agoavformat/matroskaenc: Put subtitles without duration into SimpleBlocks
Andreas Rheinhardt [Thu, 8 Apr 2021 23:00:51 +0000 (01:00 +0200)]
avformat/matroskaenc: Put subtitles without duration into SimpleBlocks

The value zero for AVPacket.duration means that the duration is unknown,
which in practice means "play this subtitle until overridden by the next
subtitle". Yet for Matroska a BlockGroup with duration zero means
that the subtitle really has a duration zero. "Display until overridden"
is achieved by not setting a duration on the container level at all and
this is achieved by using a SimpleBlock or a BlockGroup without
duration. This commit implements this.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
3 years agoavformat/matroskaenc: Remove remnant of inline-timing subtitle packets
Andreas Rheinhardt [Thu, 8 Apr 2021 19:54:17 +0000 (21:54 +0200)]
avformat/matroskaenc: Remove remnant of inline-timing subtitle packets

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
3 years agoavcodec/msmpeg4dec: Avoid duplication of VLC init code
Andreas Rheinhardt [Thu, 8 Apr 2021 19:01:05 +0000 (21:01 +0200)]
avcodec/msmpeg4dec: Avoid duplication of VLC init code

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
3 years agoavcodec/vc1: Remove unused hrd fields
Andreas Rheinhardt [Thu, 8 Apr 2021 18:11:20 +0000 (20:11 +0200)]
avcodec/vc1: Remove unused hrd fields

Unused since be3492ec7eb2dbb0748c123af911a06c125c90db.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
3 years agoavcodec/mss2: Remove redundant initialization of vc1 dsp
Andreas Rheinhardt [Thu, 8 Apr 2021 16:53:16 +0000 (18:53 +0200)]
avcodec/mss2: Remove redundant initialization of vc1 dsp

ff_vc1_init_common() already does it.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
3 years agoavcodec/vc1: Don't pretend ff_vc1_init_common() can fail
Andreas Rheinhardt [Tue, 22 Dec 2020 16:55:19 +0000 (17:55 +0100)]
avcodec/vc1: Don't pretend ff_vc1_init_common() can fail

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/msmpeg4enc: Remove dead code for inexistent VC-1 encoder
Andreas Rheinhardt [Thu, 8 Apr 2021 12:40:04 +0000 (14:40 +0200)]
avcodec/msmpeg4enc: Remove dead code for inexistent VC-1 encoder

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
3 years agoavcodec/h263dec, mpeg12dec: Remove redundant writes
Andreas Rheinhardt [Tue, 6 Apr 2021 21:32:57 +0000 (23:32 +0200)]
avcodec/h263dec, mpeg12dec: Remove redundant writes

ff_mpv_decode_init() already sets MpegEncContext.codec_id.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
3 years agoavcodec/rv34: Move dsp init code to rv30/rv40
Andreas Rheinhardt [Wed, 7 Apr 2021 16:07:54 +0000 (18:07 +0200)]
avcodec/rv34: Move dsp init code to rv30/rv40

It avoids both runtime and compile-time checks.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
3 years agoavformat/mvi: Check audio_data_size to be non negative
Michael Niedermayer [Sat, 10 Apr 2021 20:55:00 +0000 (22:55 +0200)]
avformat/mvi: Check audio_data_size to be non negative

Fixes: left shift of negative value -224
Fixes: 32144/clusterfuzz-testcase-minimized-ffmpeg_dem_MVI_fuzzer-4971479323246592
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agolavfi/qsvvpp: support async depth
Fei Wang [Wed, 31 Mar 2021 02:07:44 +0000 (10:07 +0800)]
lavfi/qsvvpp: support async depth

Async depth will allow qsv filter cache few frames, and avoid force
switch and end filter task frame by frame. This change will improve
performance for some multi-task case, for example 1:N transcode(
decode + vpp + encode) with all QSV plugins.

Performance data test on my Coffee Lake Desktop(i7-8700K) by using
the following 1:8 transcode test case improvement:
1. Fps improved from 55 to 130.
2. Render/Video usage improved from ~61%/~38% to ~100%/~70%.(Data get
from intel_gpu_top)

test CMD:
ffmpeg -v verbose -init_hw_device qsv=hw:/dev/dri/renderD128 -filter_hw_device                 \
 hw -hwaccel qsv -hwaccel_output_format qsv -c:v h264_qsv -i 1920x1080.264                     \
-vf 'vpp_qsv=w=1280:h=720:async_depth=4' -c:v h264_qsv -r:v 30 -preset 7 -g 33 -refs 2 -bf 3 -q 24 -f null - \
-vf 'vpp_qsv=w=1280:h=720:async_depth=4' -c:v h264_qsv -r:v 30 -preset 7 -g 33 -refs 2 -bf 3 -q 24 -f null - \
-vf 'vpp_qsv=w=1280:h=720:async_depth=4' -c:v h264_qsv -r:v 30 -preset 7 -g 33 -refs 2 -bf 3 -q 24 -f null - \
-vf 'vpp_qsv=w=1280:h=720:async_depth=4' -c:v h264_qsv -r:v 30 -preset 7 -g 33 -refs 2 -bf 3 -q 24 -f null - \
-vf 'vpp_qsv=w=1280:h=720:async_depth=4' -c:v h264_qsv -r:v 30 -preset 7 -g 33 -refs 2 -bf 3 -q 24 -f null - \
-vf 'vpp_qsv=w=1280:h=720:async_depth=4' -c:v h264_qsv -r:v 30 -preset 7 -g 33 -refs 2 -bf 3 -q 24 -f null - \
-vf 'vpp_qsv=w=1280:h=720:async_depth=4' -c:v h264_qsv -r:v 30 -preset 7 -g 33 -refs 2 -bf 3 -q 24 -f null -

Signed-off-by: Fei Wang <fei.w.wang@intel.com>
Reviewed-by: Linjie Fu <linjie.justin.fu@gmail.com>
Signed-off-by: Zhong Li <zhongli_dev@126.com>
3 years agoavformat/rawenc: perform stream checks for mp2 muxer
Gyan Doshi [Sun, 11 Apr 2021 05:25:57 +0000 (10:55 +0530)]
avformat/rawenc: perform stream checks for mp2 muxer

3 years agoavformat/img2dec: set r_frame_rate in addition to avg_frame_rate
Jan Ekström [Wed, 7 Apr 2021 18:17:04 +0000 (21:17 +0300)]
avformat/img2dec: set r_frame_rate in addition to avg_frame_rate

Apparently for various image sequences libavformat/utils.c can
calculate rather fancy r_frame_rate values, such as `186/1921`,
and since ffmpeg.c utilizes r_frame_rate for the filter chain
time base, this can quite deteriorate the output frame timing - even
though the user has requested the image sequence to be interpreted
at a specific, constant frame rate.

3 years agoavfilter/overlay_cuda: check av_buffer_ref result
Timo Rothenpieler [Sun, 11 Apr 2021 08:15:47 +0000 (10:15 +0200)]
avfilter/overlay_cuda: check av_buffer_ref result

3 years agoavfilter/vf_v360: unbreak fov_from_dfov() for (d)fisheye when width != height
Paul B Mahol [Sun, 11 Apr 2021 08:09:48 +0000 (10:09 +0200)]
avfilter/vf_v360: unbreak fov_from_dfov() for (d)fisheye when width != height

Based on patch by Daniel Playfair Cal.

3 years agoavfilter/overlay_cuda: hold explicit reference to hw_device_ctx
Timo Rothenpieler [Sat, 10 Apr 2021 12:31:52 +0000 (14:31 +0200)]
avfilter/overlay_cuda: hold explicit reference to hw_device_ctx

3 years agoavcodec/nvenc: add support for gbrp rgb input
Timo Rothenpieler [Tue, 30 Mar 2021 20:08:49 +0000 (22:08 +0200)]
avcodec/nvenc: add support for gbrp rgb input

3 years agodoc/muxers: add entries for raw muxers
Gyan Doshi [Sat, 10 Apr 2021 10:47:53 +0000 (16:17 +0530)]
doc/muxers: add entries for raw muxers

3 years agoavfilter/vf_v360: allow user to control fov for equirectagular format
Paul B Mahol [Sat, 10 Apr 2021 22:56:44 +0000 (00:56 +0200)]
avfilter/vf_v360: allow user to control fov for equirectagular format

It may be useful to use different values from typical 360/180 deg.

3 years agodoc/protocols: update rtsp options
Andriy Gelman [Sat, 10 Apr 2021 20:11:11 +0000 (16:11 -0400)]
doc/protocols: update rtsp options

Define listen_timeout and user_agent. Set timeout and user-agent to deprecated.

Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
3 years agoavcodec/adpcm: refactor init/flush code
Zane van Iperen [Wed, 31 Mar 2021 07:23:34 +0000 (17:23 +1000)]
avcodec/adpcm: refactor init/flush code

Most of the codecs just need everything zeroed. Those that don't
are either handled inline during decode, or pull state from
extradata.

Move state reset/init functionality into adpcm_flush(), and
invoke it from adpcm_decode_init().

Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
3 years agoavcodec/adpcm_swf: remove memory allocation during trellis encoding
Zane van Iperen [Thu, 1 Apr 2021 00:29:19 +0000 (10:29 +1000)]
avcodec/adpcm_swf: remove memory allocation during trellis encoding

The block size is hardcoded, so the buffer size is always known.
Statically allocate the buffer on the stack.

Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
3 years agoavformat/matroskaenc: Fix leak when writing attachment without filename
Andreas Rheinhardt [Fri, 9 Apr 2021 22:11:06 +0000 (00:11 +0200)]
avformat/matroskaenc: Fix leak when writing attachment without filename

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
3 years agoavcodec/mpegvideo: Deprecate bframe opts for encoders not supporting them
Andreas Rheinhardt [Tue, 6 Apr 2021 17:32:07 +0000 (19:32 +0200)]
avcodec/mpegvideo: Deprecate bframe opts for encoders not supporting them

MPEG-1/2/4 are the only mpegvideo based encoders that support bframes;
yet even the encoders not supporting bframes have options that only make
sense for an encoder that supports bframes; setting any of these options
for such an encoder has no impact on the encoded outcome (but setting
b_strategy to two slows down encoding considerably). So deprecate these
options.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
3 years agoavcodec/mpegvideo: Deprecate duplicate matrix opt for unsupported codecs
Andreas Rheinhardt [Tue, 6 Apr 2021 16:51:38 +0000 (18:51 +0200)]
avcodec/mpegvideo: Deprecate duplicate matrix opt for unsupported codecs

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
3 years agoavcodec/mpegvideo: Deprecate a53cc option for encoders != MPEG-2
Andreas Rheinhardt [Tue, 6 Apr 2021 15:53:20 +0000 (17:53 +0200)]
avcodec/mpegvideo: Deprecate a53cc option for encoders != MPEG-2

The MPEG-2 encoder is the only mpegvideo-based encoder that supports
embedding a53 side data.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
3 years agoavcodec/mpegvideo: Deprecate mpeg_quant option for codecs != MPEG-4
Andreas Rheinhardt [Tue, 6 Apr 2021 15:20:57 +0000 (17:20 +0200)]
avcodec/mpegvideo: Deprecate mpeg_quant option for codecs != MPEG-4

mpeg_quant may only be set for MPEG-4 and MPEG-2, yet for the latter
it is no option as the code acts as if it were always set.
So deprecate the option for all codecs for which it makes no sense.

Furthermore, given that the code already errors out if the option is set
for a codec that doesn't support it we can restrict the range of
the option for all these codecs without breaking something. This means
that the checks for whether mpeg_quant is set for these codecs can be
removed as soon as AVCodecContext.mpeg_quant is removed.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
3 years agoavcodec/mpegvideo_enc: Combine identical checks
Andreas Rheinhardt [Tue, 6 Apr 2021 14:00:28 +0000 (16:00 +0200)]
avcodec/mpegvideo_enc: Combine identical checks

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
3 years agoavcodec/mpeg12enc: Perform size/level/profile checks earlier
Andreas Rheinhardt [Tue, 6 Apr 2021 19:33:53 +0000 (21:33 +0200)]
avcodec/mpeg12enc: Perform size/level/profile checks earlier

This has the advantage that one does not waste some allocations
if one errors out because of these checks.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
3 years agoavcodec/mpeg12enc: Move MPEG-1/2 dimension checks to mpeg12enc
Andreas Rheinhardt [Tue, 6 Apr 2021 13:03:19 +0000 (15:03 +0200)]
avcodec/mpeg12enc: Move MPEG-1/2 dimension checks to mpeg12enc

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
3 years agoavcodec/mpegvideo_enc: Remove redundant time_base check
Andreas Rheinhardt [Tue, 6 Apr 2021 11:43:46 +0000 (13:43 +0200)]
avcodec/mpegvideo_enc: Remove redundant time_base check

This check is dead as ff_encode_preinit() has an even stricter check.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
3 years agofftools/ffmpeg_filter: Don't needlessly copy string
Andreas Rheinhardt [Tue, 6 Apr 2021 05:05:00 +0000 (07:05 +0200)]
fftools/ffmpeg_filter: Don't needlessly copy string

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
3 years agofftools/ffmpeg_filter: Don't write string that is never used
Andreas Rheinhardt [Tue, 6 Apr 2021 04:21:22 +0000 (06:21 +0200)]
fftools/ffmpeg_filter: Don't write string that is never used

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
3 years agofftools/ffmpeg_filter: Avoid allocations when configuring output filters
Andreas Rheinhardt [Tue, 6 Apr 2021 03:26:31 +0000 (05:26 +0200)]
fftools/ffmpeg_filter: Avoid allocations when configuring output filters

Use an AVBPrint to handle the (typically short) strings involved here.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
3 years agoavcodec/mjpegenc: Include all supported pix_fmts in mpegenc pix_fmts
Andreas Rheinhardt [Tue, 6 Apr 2021 01:01:14 +0000 (03:01 +0200)]
avcodec/mjpegenc: Include all supported pix_fmts in mpegenc pix_fmts

Currently said list contains only the pixel formats that are always
supported irrespective of the range and the value of
strict_std_compliance. This makes the MJPEG encoder an outlier as all
other codecs put all potentially supported pixel formats into said list
and error out if the chosen pixel format is unsupported. This commit
brings it therefore in line with the other encoders.

The behaviour of fftools/ffmpeg_filter.c has been preserved. A more
informed decision would be possible if colour range were available
at this point, but it isn't.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
3 years agoavcodec/ljpegenc: Allow full range yuv420p, yuv422p, yuv444p by default
Andreas Rheinhardt [Mon, 5 Apr 2021 22:45:25 +0000 (00:45 +0200)]
avcodec/ljpegenc: Allow full range yuv420p, yuv422p, yuv444p by default

The documentation for AV_PIX_FMT_YUVJ420P reads:
"planar YUV 4:2:0, 12bpp, full scale (JPEG), deprecated in favor of
AV_PIX_FMT_YUV420P and setting color_range"
Yet the LJPEG encoder only accepts full scale yuv420p when strictness is
set to unofficial or lower; with default strictness it emits a nonsense
error message that says that limit range YUV is unofficial. This has
been changed to allow full range yuv420p, yuv422p and yuv444p irrespective
of the level of strictness.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
3 years agoavcodec/mpegvideo_enc: Remove redundant pixel format checks
Andreas Rheinhardt [Mon, 5 Apr 2021 20:35:30 +0000 (22:35 +0200)]
avcodec/mpegvideo_enc: Remove redundant pixel format checks

All encoders using ff_mpv_encode_init() already have pix_fmts set
so that the pixel format is already checked in ff_encode_preinit().
The one exception to this is MJPEG whose check remains.

(Btw: The AVCodec.pix_fmts check for AMV is stricter than the check
in ff_mpv_encode_init().)

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
3 years agoavcodec/mjpegenc: Remove dependency of AMV encoder on mjpegenc_huffman
Andreas Rheinhardt [Tue, 30 Mar 2021 22:21:20 +0000 (00:21 +0200)]
avcodec/mjpegenc: Remove dependency of AMV encoder on mjpegenc_huffman

Using optimal Huffman tables is not supported for AMV and always
disabled by ff_mpv_encode_init(); therefore one can build
the AMV encoder without mjpegenc_huffman if one adds the necessary
compile-time checks.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
3 years agoavcodec/mpegvideo_enc: Make AMV encoder usable without MJPEG encoder
Andreas Rheinhardt [Mon, 5 Apr 2021 19:50:12 +0000 (21:50 +0200)]
avcodec/mpegvideo_enc: Make AMV encoder usable without MJPEG encoder

Up until now the relevant checks all checked for the existence of the
MJPEG encoder only.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
3 years agoavcodec/proresenc_kostya: Remove harmful check
Andreas Rheinhardt [Wed, 7 Apr 2021 20:43:38 +0000 (22:43 +0200)]
avcodec/proresenc_kostya: Remove harmful check

The ProRes encoder allocates huge worst-case buffers just to be safe;
and for huge resolutions (8k in this case) these can be so big that the
number of bits does no longer fit into a (signed 32-bit) int; this means
that one must no longer use the parts of the PutBits API that deal with
bit counters. Yet proresenc_kostya did it, namely for a check about
whether we are already beyond the end. Yet this check is unnecessary
nowadays, because the PutBits API comes with automatic checks (with
a log message and a av_assert2() in put_bits() and an av_assert0() in
flush_put_bits()), so this is unnecessary. So simply remove the check.

Fixes ticket #9173.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
3 years agoChangelog: Add new <next> line after 4.4
Michael Niedermayer [Fri, 9 Apr 2021 04:30:31 +0000 (06:30 +0200)]
Changelog: Add new <next> line after 4.4

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoChangelog: replace <next> by 4.4
Michael Niedermayer [Fri, 9 Apr 2021 04:23:34 +0000 (06:23 +0200)]
Changelog: replace <next> by 4.4

Found-by: <jamrial>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agolavc/pngdec: always create a copy for APNG_DISPOSE_OP_BACKGROUND
Anton Khirnov [Thu, 8 Apr 2021 08:46:54 +0000 (10:46 +0200)]
lavc/pngdec: always create a copy for APNG_DISPOSE_OP_BACKGROUND

Calling av_frame_make_writable() from decoders is tricky, especially
when frame threading is used. It is much simpler and safer to just make
a private copy of the frame.
This is not expected to have a major performance impact, since
APNG_DISPOSE_OP_BACKGROUND is not used often and
av_frame_make_writable() would typically make a copy anyway.

Found-by: James Almer <jamrial@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavcodec/msp2dec: Check available space in RLE decoder
Michael Niedermayer [Tue, 6 Apr 2021 21:14:08 +0000 (23:14 +0200)]
avcodec/msp2dec: Check available space in RLE decoder

Fixes: out of array read
Fixes: 32968/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MSP2_fuzzer-5315296027082752
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavformat/webvttenc: Fix use of uninitialized variable
Andreas Rheinhardt [Thu, 8 Apr 2021 12:06:24 +0000 (14:06 +0200)]
avformat/webvttenc: Fix use of uninitialized variable

Happened in 9168a1c0e67b5c31727b12329b6f52d2bb5e0a14.

Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
3 years agoavcodec/mpegvideo_enc: Don't segfault on unorthodox mpeg_quant
Andreas Rheinhardt [Tue, 6 Apr 2021 13:45:42 +0000 (15:45 +0200)]
avcodec/mpegvideo_enc: Don't segfault on unorthodox mpeg_quant

The (deprecated) field AVCodecContext.mpeg_quant has no range
restriction; MpegEncContext.mpeg_quant is restricted to 0..1.
If the former is set, the latter is overwritten with it without
checking the range. This can trigger an av_assert2() with the MPEG-4
encoder when writing said field.

Fix this by just setting MpegEncContext.mpeg_quant to 1 if
AVCodecContext.mpeg_quant is set.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
3 years agoavcodec/encode: Fix check for allowed LJPEG pixel formats
Andreas Rheinhardt [Mon, 5 Apr 2021 22:32:39 +0000 (00:32 +0200)]
avcodec/encode: Fix check for allowed LJPEG pixel formats

The pix_fmts of the LJPEG encoder already contain all supported pixel
formats (including the ones only supported when strictness is unofficial
or less); yet the check in ff_encode_preinit() ignored this list in case
strictness is unofficial or less. But the encoder presumed that it is
always applied and blacklists some of the entries in pix_fmts when
strictness is > unofficial. The result is that if one uses an entry not
on that list and sets strictness to unofficial, said entry passes both
checks and this can lead to segfaults lateron (e.g. when using gray).

Fix this by removing the exception for LJPEG in ff_encode_preinit().

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
3 years agoavformat/rmdec: Don't rely on unspecified order of evaluation
Andreas Rheinhardt [Wed, 7 Apr 2021 11:37:09 +0000 (13:37 +0200)]
avformat/rmdec: Don't rely on unspecified order of evaluation

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
3 years agoavformat/rmdec: Fix memleaks upon read_header failure
Andreas Rheinhardt [Mon, 20 Jul 2020 21:26:15 +0000 (23:26 +0200)]
avformat/rmdec: Fix memleaks upon read_header failure

For both the RealMedia as well as the IVR demuxer (which share the same
context) each AVStream's priv_data contains an AVPacket that might
contain data (even when reading the header) and therefore needs to be
unreferenced. Up until now, this has not always been done:

The RealMedia demuxer didn't do it when allocating a new stream's
priv_data failed although there might be other streams with packets to
unreference. (The reason for this was that until recently rm_read_close()
couldn't handle an AVStream without priv_data, so one had to choose
between a potential crash and a memleak.)

The IVR demuxer meanwhile never ever called read_close so that the data
already contained in packets leaks upon error.

This patch fixes both demuxers by adding the appropriate cleanup code.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
3 years agofftools/ffmpeg: copy average framerate for streamcopy, when known
Anton Khirnov [Mon, 5 Apr 2021 08:48:43 +0000 (10:48 +0200)]
fftools/ffmpeg: copy average framerate for streamcopy, when known

3 years agolavf: do not derive timebase from avg_frame_rate
Anton Khirnov [Mon, 5 Apr 2021 08:47:10 +0000 (10:47 +0200)]
lavf: do not derive timebase from avg_frame_rate

avg_frame_rate is the _average_ framerate, its presence does not
guarantee that the stream is CFR, so it should not be used for setting
the timebase.

3 years agofftools/ffmpeg: when framerate is set, prefer its inverse as output timebase
Anton Khirnov [Mon, 5 Apr 2021 08:44:36 +0000 (10:44 +0200)]
fftools/ffmpeg: when framerate is set, prefer its inverse as output timebase

Codec timebase is not well-defined for streamcopy, so it should only be
used as the last resort.

3 years agolavf/movenc: use framerate correctly in mov_write_tmcd_tag
Anton Khirnov [Sun, 4 Apr 2021 18:07:15 +0000 (20:07 +0200)]
lavf/movenc: use framerate correctly in mov_write_tmcd_tag

Current code uses its inverse.

3 years agolavc: postpone FF_API_AVCTX_TIMEBASE
Anton Khirnov [Sun, 4 Apr 2021 11:01:58 +0000 (13:01 +0200)]
lavc: postpone FF_API_AVCTX_TIMEBASE

There are still several decoders setting it and the situation is
non-trivial to resolve.

3 years agolavf: postpone removal of FF_API_COMPUTE_PKT_FIELDS2
Anton Khirnov [Sun, 4 Apr 2021 09:48:48 +0000 (11:48 +0200)]
lavf: postpone removal of FF_API_COMPUTE_PKT_FIELDS2

The infrastructure to fully handle generating timestamps e.g. for raw
video streamcopy is still not present.

3 years agolavf/webvttenc: fix avio_printf argument types after bump
Anton Khirnov [Sun, 4 Apr 2021 08:41:59 +0000 (10:41 +0200)]
lavf/webvttenc: fix avio_printf argument types after bump

Field precision supplied with the '*' specification must be an int.

3 years agolavf/matroskaenc: fix avio_printf argument types after bump
Anton Khirnov [Sun, 4 Apr 2021 08:41:59 +0000 (10:41 +0200)]
lavf/matroskaenc: fix avio_printf argument types after bump

Field precision supplied with the '*' specification must be an int.

Also, make sure converting those fields to int does not overflow.

3 years agolavc/pngdec: use a separate bytestream reader for each chunk
Anton Khirnov [Fri, 2 Apr 2021 14:33:44 +0000 (16:33 +0200)]
lavc/pngdec: use a separate bytestream reader for each chunk

This makes sure that reading a truncated chunk will never overflow into
the following chunk. It also allows to remove many repeated lines
skipping over the trailing crc checksum.

3 years agolavc/pngdec: improve chunk length check
Anton Khirnov [Fri, 2 Apr 2021 14:00:23 +0000 (16:00 +0200)]
lavc/pngdec: improve chunk length check

The length does not cover the chunk type or CRC.

3 years agotests/fate: add tests for PNG side/meta data
Anton Khirnov [Sun, 21 Mar 2021 10:10:34 +0000 (11:10 +0100)]
tests/fate: add tests for PNG side/meta data

3 years agolavc/pngdec: restructure exporting frame meta/side data
Anton Khirnov [Sat, 20 Mar 2021 18:57:25 +0000 (19:57 +0100)]
lavc/pngdec: restructure exporting frame meta/side data

This data cannot be stored in PNGDecContext.picture, because the
corresponding chunks may be read after the call to
ff_thread_finish_setup(), at which point modifying shared context data
is a race.

Store intermediate state in the context and then write it directly to
the output frame.

Fixes exporting frame metadata after 5663301560
Fixes #8972

Found-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agolavc/pngdec: remove unnecessary context variables
Anton Khirnov [Fri, 2 Apr 2021 08:45:27 +0000 (10:45 +0200)]
lavc/pngdec: remove unnecessary context variables

Do not store the image buffer pointer/linesize in the context, just
access them directly from the frame.
Stop assuming that linesize is the same for the current and last frame.

3 years agolavc/pngdec: perform APNG blending in-place
Anton Khirnov [Thu, 1 Apr 2021 13:45:45 +0000 (15:45 +0200)]
lavc/pngdec: perform APNG blending in-place

Saves an allocation+free and two frame copies per each frame.

3 years agoavcodec/vc1dec: Fix memleak upon allocation error
Andreas Rheinhardt [Wed, 7 Apr 2021 23:49:53 +0000 (01:49 +0200)]
avcodec/vc1dec: Fix memleak upon allocation error

ff_vc1_decode_init_alloc_tables() had one error path that forgot to free
already allocated buffers; these would then be overwritten on the next
allocation attempt (or they would just not be freed in case this
happened during init, as the decoders for which it is used do not have
the FF_CODEC_CAP_INIT_CLEANUP set).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
3 years agolavfi/dnn: add post process for detection
Guo, Yejun [Tue, 9 Mar 2021 06:51:42 +0000 (14:51 +0800)]
lavfi/dnn: add post process for detection

3 years agolavfi/dnn: refine code for frame pre/proc processing
Guo, Yejun [Mon, 1 Mar 2021 11:23:20 +0000 (19:23 +0800)]
lavfi/dnn: refine code for frame pre/proc processing

3 years agolavfi/dnn_backend_openvino.c: only allow DFT_PROCESS_FRAME to get output dim
Guo, Yejun [Mon, 15 Mar 2021 08:42:27 +0000 (16:42 +0800)]
lavfi/dnn_backend_openvino.c: only allow DFT_PROCESS_FRAME to get output dim

3 years agoavcodec/h261dec: Initialize IDCT context during init
Andreas Rheinhardt [Mon, 5 Apr 2021 00:42:18 +0000 (02:42 +0200)]
avcodec/h261dec: Initialize IDCT context during init

Before 998c9f15d1ca8c7489775ebcca51623b915988f1, initializing an
MpegEncContext's IDCT parts occured in ff_mpv_common_init() and this
has been called in h261_decode_frame(), not h261_decode_init().

Yet said commit factored this out of ff_mpv_common_init() and therefore
there is no reason any more not to set this during init as this commit
does.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
3 years agoavcodec/rv34, mpegvideo: Fix segfault upon frame size change error
Andreas Rheinhardt [Mon, 5 Apr 2021 00:05:58 +0000 (02:05 +0200)]
avcodec/rv34, mpegvideo: Fix segfault upon frame size change error

The RealVideo 3.0 and 4.0 decoders call ff_mpv_common_init() only during
their init function and not during decode_frame(); when the size of the
frame changes, they call ff_mpv_common_frame_size_change(). Yet upon
error, said function calls ff_mpv_common_end() which frees the whole
MpegEncContext and not only those parts that
ff_mpv_common_frame_size_change() reinits. As a result, the context will
never be usable again; worse, because decode_frame() contains no check
for whether the context is initialized or not, it is presumed that it is
initialized, leading to segfaults. Basically the same happens if
rv34_decoder_realloc() fails.

This commit fixes this by only resetting the parts that
ff_mpv_common_frame_size_change() changes upon error and by actually
checking whether the context is in need of reinitialization in
ff_rv34_decode_frame().

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
3 years agoavcodec/rv10: Don't presume context to be initialized
Andreas Rheinhardt [Sun, 4 Apr 2021 19:30:33 +0000 (21:30 +0200)]
avcodec/rv10: Don't presume context to be initialized

In case of resolution changes rv20_decode_picture_header() closes and
reopens its MpegEncContext; it checks the latter for errors, yet when
an error happens, it might happen that no new attempt at
reinitialization is performed when decoding the next frame; this leads
to crashes lateron.

This commit fixes this by making sure that initialization will always
be attempted if the context is currently not initialized.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
3 years agoavcodec/mpegvideo: Factor common freeing code out
Andreas Rheinhardt [Fri, 25 Dec 2020 13:57:38 +0000 (14:57 +0100)]
avcodec/mpegvideo: Factor common freeing code out

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/mpegvideo: Fix memleak upon allocation error
Andreas Rheinhardt [Fri, 25 Dec 2020 13:17:10 +0000 (14:17 +0100)]
avcodec/mpegvideo: Fix memleak upon allocation error

When slice-threading is used, ff_mpv_common_init() duplicates
the first MpegEncContext and allocates some buffers for each
MpegEncContext (the first as well as the copies). But the count of
allocated MpegEncContexts is not updated until after everything has
been allocated and if an error happens after the first one has been
allocated, only the first one is freed; the others leak.

This commit fixes this: The count is now set before the copies are
allocated. Furthermore, the copies are now created and initialized
before the first MpegEncContext, so that the buffers exclusively owned
by each MpegEncContext are still NULL in the src MpegEncContext so
that no double-free happens upon allocation failure.

Given that this effectively touches every line of the init code,
it has also been factored out in a function of its own in order to
remove code duplication with the same code in
ff_mpv_common_frame_size_change() (which was never called when using
more than one slice (and if it were, there would be potential
double-frees)).

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoRevert "avcodec: add FF_CODEC_CAP_INIT_CLEANUP for all codecs which use ff_mpv_common...
Andreas Rheinhardt [Thu, 24 Dec 2020 13:36:22 +0000 (14:36 +0100)]
Revert "avcodec: add FF_CODEC_CAP_INIT_CLEANUP for all codecs which use ff_mpv_common_init()"

This mostly reverts commit 4b2863ff01b1fe93d9a518523c9098d17a9d8c6f.
Said commit removed the freeing code from ff_mpv_common_init(),
ff_mpv_common_frame_size_change() and ff_mpeg_framesize_alloc() and
instead added the FF_CODEC_CAP_INIT_CLEANUP to several codecs that use
ff_mpv_common_init(). This introduced several bugs:

a) Several decoders using ff_mpv_common_init() in their init function were
forgotten: This affected FLV, Intel H.263, RealVideo 3.0 and V4.0 as well as
VC-1/WMV3.
b) ff_mpv_common_init() is not only called from the init function of
codecs, it is also called from AVCodec.decode functions. If an error
happens after an allocation has succeeded, it can lead to memleaks;
furthermore, it is now possible for the MpegEncContext to be marked as
initialized even when ff_mpv_common_init() returns an error and this can
lead to segfaults because decoders that call ff_mpv_common_init() when
decoding a frame can mistakenly think that the MpegEncContext has been
properly initialized. This can e.g. happen with H.261 or MPEG-4.
c) Removing code for freeing from ff_mpeg_framesize_alloc() (which can't
be called from any init function) can lead to segfaults because the
check for whether it needs to allocate consists of checking whether the
first of the buffers allocated there has been allocated. This part has
already been fixed in 76cea1d2ce3f23e8131c8664086a1daf873ed694.
d) ff_mpv_common_frame_size_change() can also not be reached from any
AVCodec.init function; yet the changes can e.g. lead to segfaults with
decoders using ff_h263_decode_frame() upon allocation failure, because
the MpegEncContext will upon return be flagged as both initialized and
not in need of reinitialization (granted, the fact that
ff_h263_decode_frame() clears context_reinit before the context has been
reinited is a bug in itself). With the earlier version, the context
would be cleaned upon failure and it would be attempted to initialize
the context again in the next call to ff_h263_decode_frame().

While a) could be fixed by adding the missing FF_CODEC_CAP_INIT_CLEANUP,
keeping the current approach would entail adding cleanup code to several
other places because of b). Therefore ff_mpv_common_init() is again made
to clean up after itself; the changes to the wmv2 decoder and the SVQ1
encoder have not been reverted: The former fixed a memleak, the latter
allowed to remove cleanup code.

Fixes: double free
Fixes: ff_free_picture_tables.mp4
Fixes: ff_mpeg_update_thread_context.mp4
Fixes: decode_colskip.mp4
Fixes: memset.mp4
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavformat/url: add ff_make_absolulte_url2 to be able to test windows path cases
Marton Balint [Mon, 5 Apr 2021 23:10:30 +0000 (01:10 +0200)]
avformat/url: add ff_make_absolulte_url2 to be able to test windows path cases

Signed-off-by: Marton Balint <cus@passwd.hu>
3 years agoavformat/url: fix ff_make_absolute_url with Windows file paths
Marton Balint [Fri, 2 Apr 2021 15:07:54 +0000 (17:07 +0200)]
avformat/url: fix ff_make_absolute_url with Windows file paths

Ugly, but a lot less broken than it was.

Fixes ticket #9166.

Signed-off-by: Marton Balint <cus@passwd.hu>
3 years agoavformat/utils: add helper functions to retrieve index entries from an AVStream
James Almer [Tue, 23 Mar 2021 18:36:22 +0000 (15:36 -0300)]
avformat/utils: add helper functions to retrieve index entries from an AVStream

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agodoc/muxers: fix alphabetical sorting of entries
Gyan Doshi [Wed, 7 Apr 2021 09:11:44 +0000 (14:41 +0530)]
doc/muxers: fix alphabetical sorting of entries

3 years agomov: Skip computing SAR from invalid display matrix elements
Vittorio Giovara [Tue, 30 Mar 2021 14:47:39 +0000 (16:47 +0200)]
mov: Skip computing SAR from invalid display matrix elements

3 years agoavcodec/bsf: Simplify getting codec name
Andreas Rheinhardt [Fri, 2 Apr 2021 13:21:51 +0000 (15:21 +0200)]
avcodec/bsf: Simplify getting codec name

All codec ids on BSF whitelists have a codec descriptor, so one can just
use avcodec_get_name() without worrying about the case of what happens
when no codec descriptor is found.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
3 years agoavformat/mov: check offset for overflow in mov_probe()
Michael Niedermayer [Sun, 4 Apr 2021 19:01:46 +0000 (21:01 +0200)]
avformat/mov: check offset for overflow in mov_probe()

Fixes: Invalid read of size 4
Fixes: ASAN_Deadlysignal.zip
Found-by: Hardik Shah <hardik05@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavcodec/options: Remove always-true check
Andreas Rheinhardt [Thu, 1 Apr 2021 21:16:37 +0000 (23:16 +0200)]
avcodec/options: Remove always-true check

Every codec has a name.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
3 years agoavutil/frame: Return 0 on success in av_frame_ref()
Andreas Rheinhardt [Thu, 1 Apr 2021 21:04:19 +0000 (23:04 +0200)]
avutil/frame: Return 0 on success in av_frame_ref()

av_frame_copy() is allowed to return values >= 0 on success, whereas
the documentation of av_frame_ref() states that the return value is 0 on
success. Ergo the latter must not just return the former's return value.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
3 years agoavformat/dss: Return 0 on success
Andreas Rheinhardt [Thu, 1 Apr 2021 21:02:18 +0000 (23:02 +0200)]
avformat/dss: Return 0 on success

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
3 years agoavformat/dss: Avoid using intermediate buffer
Andreas Rheinhardt [Thu, 1 Apr 2021 20:55:31 +0000 (22:55 +0200)]
avformat/dss: Avoid using intermediate buffer

All one needs is one byte beyond the end of the normal data; and because
the packet is padded, one already has it.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
3 years agoavformat/dss: Set values known during read_header in read_header
Andreas Rheinhardt [Thu, 1 Apr 2021 20:31:13 +0000 (22:31 +0200)]
avformat/dss: Set values known during read_header in read_header

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
3 years agoavformat/mpegtsenc: Preserve disposition in the absence of language
Andreas Rheinhardt [Sat, 3 Apr 2021 05:14:40 +0000 (07:14 +0200)]
avformat/mpegtsenc: Preserve disposition in the absence of language

Implements ticket #9113.

Reviewed-by: Marton Balint <cus@passwd.hu>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
3 years agoavfilter/vf_find_rect: Use correct format specifier
Andreas Rheinhardt [Sun, 4 Apr 2021 09:26:47 +0000 (11:26 +0200)]
avfilter/vf_find_rect: Use correct format specifier

Fixes the following GCC warning:
warning: format ‘%lld’ expects argument of type ‘long long int’,
but argument 4 has type ‘int64_t’ {aka ‘long int’} [-Wformat=]

Reviewed-by: Gyan Doshi <ffmpeg@gyani.pro>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>