ffmpeg.git
6 weeks agoavfilter/af_aiir: add more descriptive options aliases
Paul B Mahol [Fri, 22 May 2020 10:37:17 +0000 (12:37 +0200)]
avfilter/af_aiir: add more descriptive options aliases

6 weeks agoavfilter/af_aiir: export normalize option
Paul B Mahol [Fri, 22 May 2020 10:28:03 +0000 (12:28 +0200)]
avfilter/af_aiir: export normalize option

And enable it in all modes by default.

6 weeks agoavfilter/af_aiir: fix first delay value
Paul B Mahol [Thu, 21 May 2020 08:50:58 +0000 (10:50 +0200)]
avfilter/af_aiir: fix first delay value

6 weeks agoavformat/utils: Set stream side-data size even without side-data
Andreas Rheinhardt [Thu, 21 May 2020 22:08:00 +0000 (00:08 +0200)]
avformat/utils: Set stream side-data size even without side-data

Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
6 weeks agoavformat/matroskaenc: Remove pointless casts
Andreas Rheinhardt [Thu, 21 May 2020 21:57:19 +0000 (23:57 +0200)]
avformat/matroskaenc: Remove pointless casts

by using a const void * pointer as an intermediate.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
6 weeks agoavformat/matroskaenc: Don't use stream side-data size
Andreas Rheinhardt [Thu, 21 May 2020 21:10:51 +0000 (23:10 +0200)]
avformat/matroskaenc: Don't use stream side-data size

av_stream_get_side_data() tells the caller whether a stream has side
data of a specific type; if present it can also tell the caller the size
of the side data via an optional argument. The Matroska muxer always
used this optional argument, although it doesn't really need the size,
as the relevant side-data are not buffers, but structures. So change
this.

Furthermore, relying on the size also made the code susceptible to
a quirk of av_stream_get_side_data(): It only sets the size argument if
it found side data of the desired type. mkv_write_video_color() checks
for side-data twice with the same variable for the size without resetting
the size in between; if the second type of side-data isn't present, the
size will still be what it was after the first call. This was not
dangerous in practice, as the check for the existence of the second
side-data compared the size with the expected size, so it would only be
problematic if lots of elements were to be added to AVContentLightMetadata.

Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
6 weeks agoavformat/http: increase BUFFER_SIZE to MAX_URL_SIZE + HTTP_HEADERS_SIZE
Joey Smith [Mon, 11 May 2020 05:05:51 +0000 (23:05 -0600)]
avformat/http: increase BUFFER_SIZE to MAX_URL_SIZE + HTTP_HEADERS_SIZE

Some real-world sites use an authorization header with a bearer token; when
combined with lengthy request parameters to identify the video segment,
it's rather trivial these days to have a request body of more than 4k bytes.

MAX_URL_SIZE is hard-coded to 4k bytes in libavformat/internal.h, and
HTTP_HEADERS_SIZE is 4k as well in libavformat/http.h, so this patch increases
the buffer size to 8k, as that is the default request body limit in Apache, and
most other httpds seem to support at least as much, if not more.

Signed-off-by: Marton Balint <cus@passwd.hu>
6 weeks agoavcodec: deprecate Lossless and Intra Only encoder capabilites
James Almer [Thu, 21 May 2020 15:20:11 +0000 (12:20 -0300)]
avcodec: deprecate Lossless and Intra Only encoder capabilites

Both are codec properties and not encoder capabilities. The relevant
AVCodecDescriptor.props flags exist for this purpose.

Signed-off-by: James Almer <jamrial@gmail.com>
6 weeks agofftools/cmdutils: remove lossless and intra only capability entries from print_codec()
James Almer [Mon, 18 May 2020 15:55:00 +0000 (12:55 -0300)]
fftools/cmdutils: remove lossless and intra only capability entries from print_codec()

They are codec properties, not encoder capabilities.

Signed-off-by: James Almer <jamrial@gmail.com>
6 weeks agofftools/ffmpeg_filter: check the codec's descriptor to see if it's lossless
James Almer [Mon, 18 May 2020 15:38:35 +0000 (12:38 -0300)]
fftools/ffmpeg_filter: check the codec's descriptor to see if it's lossless

Signed-off-by: James Almer <jamrial@gmail.com>
6 weeks agoavcodec/decode: remove ff_decode_bsfs_uninit()
James Almer [Wed, 20 May 2020 03:59:32 +0000 (00:59 -0300)]
avcodec/decode: remove ff_decode_bsfs_uninit()

It's been a wrapper for a simple av_bsf_free() call since c96904f525.

Signed-off-by: James Almer <jamrial@gmail.com>
6 weeks agoavcodec/tiff: Check for Tiled and Stripped TIFFs
Michael Niedermayer [Wed, 19 Feb 2020 14:15:42 +0000 (15:15 +0100)]
avcodec/tiff: Check for Tiled and Stripped TIFFs

TIFF 6 spec: "Do not use both strip-oriented and tile-oriented fields in the same TIFF file."

Fixes: null pointer use, crash
Fixes: crash-762680f9d1b27f9b9085e12887ad44893fb2b020

Found-by: Shiziru <lunasl@protonmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
6 weeks agoavcodec/pnmdec: Use unsigned for maxval rescaling
Michael Niedermayer [Fri, 15 May 2020 22:31:23 +0000 (00:31 +0200)]
avcodec/pnmdec: Use unsigned for maxval rescaling

Fixes: signed integer overflow: 65535 * 55335 cannot be represented in type 'int'
Fixes: 21955/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_PGMYUV_fuzzer-5669206981083136

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
6 weeks agoavcodec/ivi: Clear got_p_frame before decoding a new frame using it
Michael Niedermayer [Tue, 12 May 2020 22:11:37 +0000 (00:11 +0200)]
avcodec/ivi: Clear got_p_frame before decoding a new frame using it

Fixes: assertion failure
Fixes: 21666/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_INDEO4_fuzzer-5706468994318336

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
6 weeks agoavcodec/dsddec: Check channels
Michael Niedermayer [Sun, 3 May 2020 22:04:49 +0000 (00:04 +0200)]
avcodec/dsddec: Check channels

Fixes: division by zero
Fixes: 21677/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_DSD_MSBF_fuzzer-5712547983654912
Fixes: 21751/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_DSD_LSBF_fuzzer-5197097180856320

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
6 weeks agoavcodec/xvididct: Fix integer overflow in idct_row()
Michael Niedermayer [Sat, 2 May 2020 19:25:17 +0000 (21:25 +0200)]
avcodec/xvididct: Fix integer overflow in idct_row()

Fixes: signed integer overflow: -1238335488 + -1003634688 cannot be represented in type 'int'
Fixes: 21649/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MJPEG_fuzzer-5112005765890048

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
6 weeks agoavcodec/wmalosslessdec: Fix integer overflows in revert_inter_ch_decorr()
Michael Niedermayer [Sun, 26 Apr 2020 19:19:13 +0000 (21:19 +0200)]
avcodec/wmalosslessdec: Fix integer overflows in revert_inter_ch_decorr()

Fixes: signed integer overflow: -717241856 + -1434459904 cannot be represented in type 'int'
Fixes: 21405/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WMALOSSLESS_fuzzer-5677143666458624

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
6 weeks agoavcodec/cbs_jpeg: Fix infinite loop in cbs_jpeg_split_fragment()
Michael Niedermayer [Thu, 19 Mar 2020 21:05:42 +0000 (22:05 +0100)]
avcodec/cbs_jpeg: Fix infinite loop in cbs_jpeg_split_fragment()

Fixes: Timeout
Fixes: 21104/clusterfuzz-testcase-minimized-ffmpeg_BSF_TRACE_HEADERS_fuzzer-5129580475318272

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
6 weeks agoavformat/mpegenc: Fix integer overflow with AV_NOPTS_VALUE
Michael Niedermayer [Sun, 16 Feb 2020 17:51:52 +0000 (18:51 +0100)]
avformat/mpegenc: Fix integer overflow with AV_NOPTS_VALUE

Fixes: signed integer overflow: -9223372036854775808 - 45000 cannot be represented in type 'long'
Fixes: ticket8187

Found-by: Suhwan
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
6 weeks agoavformat/swfenc: Fix integer overflow in frame rate handling
Michael Niedermayer [Sun, 16 Feb 2020 17:32:31 +0000 (18:32 +0100)]
avformat/swfenc: Fix integer overflow in frame rate handling

Fixes: signed integer overflow: 30000299 * 256 cannot be represented in type 'int'
Fixes: ticket8184

Found-by: Suhwan
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
6 weeks agoavcodec/bitpacked: Add codec_tags list
Michael Niedermayer [Fri, 7 Feb 2020 13:17:28 +0000 (14:17 +0100)]
avcodec/bitpacked: Add codec_tags list

This should improve coverage

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
6 weeks agoavformat/aadec: Check toc_size to contain the minimum to demuxer uses
Michael Niedermayer [Tue, 7 Apr 2020 10:04:25 +0000 (12:04 +0200)]
avformat/aadec: Check toc_size to contain the minimum to demuxer uses

Fixes: out of array access
Fixes: stack-buffer-overflow-READ-0x0831fff1

Found-by: GalyCannon <galycannon@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
6 weeks agoavcodec/cbs_h265_syntax_template: Limit num_long_term_pics more strictly
Michael Niedermayer [Mon, 20 Apr 2020 21:27:04 +0000 (23:27 +0200)]
avcodec/cbs_h265_syntax_template: Limit num_long_term_pics more strictly

The limit is based on hevcdec.c
Fixes: 20854/clusterfuzz-testcase-minimized-ffmpeg_BSF_HEVC_METADATA_fuzzer-5160442882424832
Fixes: out of array access

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
6 weeks agoavformat/ttaenc: Defer freeing dynamic buffer
Andreas Rheinhardt [Wed, 20 May 2020 19:52:09 +0000 (21:52 +0200)]
avformat/ttaenc: Defer freeing dynamic buffer

The TTA muxer writes a seektable in a dynamic buffer as it receives
packets and when writing the trailer, closes the dynamic buffer using
avio_close_dyn_buf(), writes the seektable and frees the buffer. But
the TTA muxer already has a deinit function which unconditionally
calls ffio_free_dyn_buf() on the dynamic buffer, so switching to
avio_get_dyn_buf() means that one can remove the code to free the
buffer; furthermore, it also might save an allocation if the seektable
is so small that it fits into the dynamic buffer's write buffer or if
adding the padding that avio_close_dyn_buf() adds necessitated
reallocating of the underlying buffer.

Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
6 weeks agoavformat/hls: Remove redundant resetting of pointer
Andreas Rheinhardt [Tue, 19 May 2020 10:35:59 +0000 (12:35 +0200)]
avformat/hls: Remove redundant resetting of pointer

ff_id3v2_free_extra_meta() takes a ID3V2ExtraMeta ** so that it can
already reset the pointer.

Reviewed-by: Jun Zhao <mypopy@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
6 weeks agocheckasm/sw_scale: Fix stack-buffer-overflow
Andreas Rheinhardt [Tue, 19 May 2020 06:30:05 +0000 (08:30 +0200)]
checkasm/sw_scale: Fix stack-buffer-overflow

A buffer whose size is not a multiple of four has been initialized using
consecutive writes of 32bits. This results in a stack-buffer-overflow
reported by ASAN in the checkasm-sw_scale FATE-test.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
6 weeks agocbs_h265: Ensure that a predicted RPS doesn't contain too many pictures
Mark Thompson [Sun, 3 May 2020 15:30:00 +0000 (16:30 +0100)]
cbs_h265: Ensure that a predicted RPS doesn't contain too many pictures

If the RPS we are predicting from has maximum size then at least one of
the pictures in it must be discarded before adding the current one.

Also revert 588114cea4ee434c9c61353ed91ffc817d2965f5, which added
now-redundant checks for the special case of a too-large RPS with all
pictures being in the same direction from the current one.

6 weeks agomovenc: Use first H264/HEVC frame as extradata, if it is missing
Martin Storsjö [Fri, 8 May 2020 11:21:32 +0000 (14:21 +0300)]
movenc: Use first H264/HEVC frame as extradata, if it is missing

Sticking a full frame in the extradata works, as the code for writing
the avcC/hvcC extracts the relevant parameter set NAL units - provided
that they actually exist in the frame.

Some encoders don't provide split out extradata directly on init (or
at all). In particular, the MediaFoundation encoder wrapper doesn't
always (depending on the actual encoder device) - this is the case for
Qualcomm's HEVC encoder on SD835, and also on some QSV H264 encoders).

This only works for cases where the moov hasn't already been written
(e.g. when not writing fragmented mp4 with empty_moov, unless using
the delay_moov option).

Signed-off-by: Martin Storsjö <martin@martin.st>
6 weeks agoavformat/mov: Free temp buffer upon negative sample_size error.
Dale Curtis [Mon, 18 May 2020 22:35:35 +0000 (15:35 -0700)]
avformat/mov: Free temp buffer upon negative sample_size error.

2d8d554f15a7a27cfeca81467cc9341a86f784e2 added a new error condition
to mov_read_stsz() but forgot to free a temporary buffer when it
occurs.

Signed-off-by: Dale Curtis <dalecurtis@chromium.org>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
6 weeks agofate: add adpcm_ima_cunning tests
Zane van Iperen [Sat, 9 May 2020 14:00:04 +0000 (14:00 +0000)]
fate: add adpcm_ima_cunning tests

single:               Single-track
track{0,1}:           Dual-track
trunc-t1:             Truncated track 1
trunc-t2-track{0,1}:  Fully-truncated track 2
trunc-t2a-track{0,1}: Partially-truncated track 2
trunc-h2:             Truncated track 2 header

Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
6 weeks agoavcodec/exr: output float pixels in float pixel format
Mark Reid [Sun, 10 May 2020 01:48:58 +0000 (18:48 -0700)]
avcodec/exr: output float pixels in float pixel format

changes since v1
- default behavior, no longer hidden behind decoder parameter
- updated tests to reflect change

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
6 weeks agoavfilter/af_aiir: fix phase and group delay calculation
Paul B Mahol [Wed, 20 May 2020 09:01:56 +0000 (11:01 +0200)]
avfilter/af_aiir: fix phase and group delay calculation

Properly unwrap phase.

6 weeks agoavcodec/libx265: add support for reordered_opaque
James Almer [Tue, 19 May 2020 18:55:13 +0000 (15:55 -0300)]
avcodec/libx265: add support for reordered_opaque

Reviewed-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
6 weeks agoavcodec: Add MediaFoundation encoder wrapper
wm4 [Tue, 4 Apr 2017 05:45:41 +0000 (07:45 +0200)]
avcodec: Add MediaFoundation encoder wrapper

This contains encoder wrappers for H264, HEVC, AAC, AC3 and MP3.

This is based on top of an original patch by wm4
<nfxjfg@googlemail.com>. The original patch supported both encoding
and decoding, but this patch only includes encoding.

The patch contains further changes by Paweł Wegner
<pawel.wegner95@gmail.com> (primarily for splitting out the encoding
parts of the original patch) and further cleanup, build compatibility
fixes and tweaks for use with Qualcomm encoders by Martin Storsjö.

Signed-off-by: Martin Storsjö <martin@martin.st>
6 weeks agoavfilter/af_aiir: fix invalid memory access with tf filtering
Paul B Mahol [Tue, 19 May 2020 18:03:59 +0000 (20:03 +0200)]
avfilter/af_aiir: fix invalid memory access with tf filtering

6 weeks agoavfilter/vf_chromakey: fix formula for calculation of difference
Paul B Mahol [Sat, 16 May 2020 17:48:17 +0000 (19:48 +0200)]
avfilter/vf_chromakey: fix formula for calculation of difference

6 weeks agoavfilter/vf_colorkey: fix formula for calculation of difference
Paul B Mahol [Sat, 16 May 2020 17:45:53 +0000 (19:45 +0200)]
avfilter/vf_colorkey: fix formula for calculation of difference

Also fixes colorhold filtering.

6 weeks agoavfilter: add gradients source video filter
Paul B Mahol [Fri, 15 May 2020 11:06:34 +0000 (13:06 +0200)]
avfilter: add gradients source video filter

6 weeks agoavcodec: add NotchLC decoder
Paul B Mahol [Mon, 4 May 2020 21:57:47 +0000 (23:57 +0200)]
avcodec: add NotchLC decoder

6 weeks agoavformat/url: check the result of the strrchr
Steven Liu [Fri, 15 May 2020 10:01:46 +0000 (18:01 +0800)]
avformat/url: check the result of the strrchr

because it need be check for success, is should not
change the old way if it failure.
fix ticket: 8674

Signed-off-by: Steven Liu <liuqi05@kuaishou.com>
6 weeks agodoc/muxers: Document title tag for attachments
Andreas Rheinhardt [Wed, 6 May 2020 14:02:14 +0000 (16:02 +0200)]
doc/muxers: Document title tag for attachments

The Matroska muxer has always mapped the title tag to the FileDescription
element for attachments streams since support for writing attachments
was added in commit c7a63a521b5c165405e3577751d649529d09f0c5. This
commit merely documents this fact.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
6 weeks agoavformat/matroskadec: Export FileDescription as title tag
Andreas Rheinhardt [Wed, 6 May 2020 13:24:33 +0000 (15:24 +0200)]
avformat/matroskadec: Export FileDescription as title tag

Each AttachedFile in Matroska can have a FileDescription element that
contains a human-friendly name for the attached file; yet this element
has been ignored up until now. This commit changes this and exports it
as title tag instead (the Matroska muxer mapped the title tag to the
AttachedFile element since support for Attachments was added).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
6 weeks agoavformat/matroskaenc: Don't ignore tags of chapters written late
Andreas Rheinhardt [Wed, 29 Apr 2020 08:27:23 +0000 (10:27 +0200)]
avformat/matroskaenc: Don't ignore tags of chapters written late

The Matroska muxer writes the Chapters early when chapters were already
available when writing the header; in this case any tags pertaining to
these chapters get written, too.

Yet if no chapters had been supplied before writing the header, Chapters
can also be written when writing the trailer if any are supplied. Tags
belonging to these chapters were up until now completely ignored.

This commit changes this: Writing the tags belonging to chapters has
been moved to mkv_write_chapters(). If mkv_write_tags() has not been
called yet (i.e. when chapters are written when writing the header),
the AVIOContext for writing the ordinary Tags element is used, but not
output, as this is left to mkv_write_tags() in order to only write one
Tags element. Yet if mkv_write_tags() has already been called,
mkv_write_chapters() will output a Tags element of its own which only
contains the tags for chapters.

When chapters are available initially, the corresponding tags will now
be the first tags in the Tags element; but the ordering of tags in Tags
is irrelevant anyway.

This commit also makes chapter_id_offset local to mkv_write_chapters()
as it is used only there and not reused at all.

Potentially writing a second Tags element means that the maximum number
of SeekHead entries had to be incremented. All the changes to FATE
result from the ensuing increase in the amount of space reserved for the
SeekHead (21 bytes more).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
6 weeks agoavformat/matroskaenc: Move mkv_write_chapters()
Andreas Rheinhardt [Wed, 29 Apr 2020 06:48:25 +0000 (08:48 +0200)]
avformat/matroskaenc: Move mkv_write_chapters()

This is needed so that it can access mkv_write_tag() and mkv_check_tag()
without using forward declarations (which are unnecessary here).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
6 weeks agoavformat/matroskaenc: Allow a custom destination for writing Tags
Andreas Rheinhardt [Wed, 29 Apr 2020 05:52:56 +0000 (07:52 +0200)]
avformat/matroskaenc: Allow a custom destination for writing Tags

Up until now, the Matroska muxer writes only one Tags level 1 element
and therefore using a certain place to store the dynamic buffer used for
writing it was hardcoded; yet the Matroska specifications allow an
unlimited amount of Tags elements and we have reason to write a second
one: If chapters are provided after writing the header, they are written
when writing the trailer; yet the corresponding tags are ignored. This
can be fixed by writing them in a second Tags element.

Also use a MatroskaMuxContext * instead of an AVFormatContext * as
parameter in mkv_write_tag() and mkv_write_tag_targets() as that is all
these functions use.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
6 weeks agoavformat/matroskaenc: Clean up mkv_write_stereo_mode()
Andreas Rheinhardt [Thu, 7 May 2020 12:19:27 +0000 (14:19 +0200)]
avformat/matroskaenc: Clean up mkv_write_stereo_mode()

Mostly reindentation after the last commit. Also remove a variable that
is always zero; move another variable to a more local scope and don't
assign a value to a local variable immediately before leaving the function.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
6 weeks agoavformat/matroskaenc: Use av_stream_get_side_data() instead of loop
Andreas Rheinhardt [Thu, 7 May 2020 12:13:07 +0000 (14:13 +0200)]
avformat/matroskaenc: Use av_stream_get_side_data() instead of loop

in mkv_write_stereo_mode(). Also check the size of the AVStereo3D
side data.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
6 weeks agoavformat/matroskaenc: Make mkv_write_video_projection() return void
Andreas Rheinhardt [Wed, 6 May 2020 12:13:58 +0000 (14:13 +0200)]
avformat/matroskaenc: Make mkv_write_video_projection() return void

It can't fail since 9c8aa86883f28fc27ca790b290c3be2d347b0d19.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
6 weeks agoavformat/matroskaenc: Cosmetics
Andreas Rheinhardt [Wed, 29 Apr 2020 05:24:02 +0000 (07:24 +0200)]
avformat/matroskaenc: Cosmetics

Mainly reindentation plus some reordering in MatroskaMuxContext;
moreover, use the IS_SEEKABLE() macro troughout the code.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
6 weeks agoavformat/matroskaenc: Don't assert when writing huge files
Andreas Rheinhardt [Sat, 2 May 2020 02:39:01 +0000 (04:39 +0200)]
avformat/matroskaenc: Don't assert when writing huge files

EBML numbers are variable length numbers: Only seven bits of every byte
are available to encode the number, the other bits encode the length of
the number itself. So an eight byte EBML number can only encode numbers
in the range 0..(2^56 - 1). And when using EBML numbers to encode the
length of an EBML element, the EBML number corresponding to 2^56 - 1 is
actually reserved to mean that the length of the corresponding element
is unknown.

And therefore put_ebml_length() asserted that the length it should
represent is < 2^56 - 1. Yet there was nothing that actually guaranteed
this to be true for the Segment (the main/root EBML element of a
Matroska file that encompasses nearly the whole file). This commit
changes this by checking in advance how big the length is and only
updating the number if it is representable at all; if not, the unknown
length element is not touched.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
6 weeks agoavformat/matroskaenc: Avoid unnecessary seek
Andreas Rheinhardt [Sat, 2 May 2020 01:55:23 +0000 (03:55 +0200)]
avformat/matroskaenc: Avoid unnecessary seek

The Matroska muxer has a pair of functions designed to write master
elements whose exact length is not known in advance: start_ebml_master()
and end_ebml_master(). The first one of these would write the EBML ID of
the master element that is about to be started, reserve some bytes for
the length field and record the current position as well as how many
bytes were used for the length field. When writing the master's contents
is finished, end_ebml_master() gets the current position (at the end of
the master element), seeks to the length field using the recorded
position, writes the length field and seeks back to the end of the
master element so that one can continue writing other elements.

But if one wants to modify the content of the master element itself,
then the seek back is superfluous. This is the scenario that presents
itself when writing the trailer: One wants to update several elements
contained in the Segment master element (this is the main/root master
element of a Matroska file) that were already written when writing the
header. The current approach is to seek to the beginning of the file
to update the elements, then seek to the end, call end_ebml_master()
which immediately seeks to the beginning to write the length and seeks
back. The seek to the end (which has only been performed because
end_ebml_master() uses the initial position to determine the length
of the master element) and the seek back are of course superfluous.

This commit avoids these seeks by no longer using start/end_ebml_master()
to write the segment's length field. Instead, it is now written
manually. The new approach is: Seek to the beginning to write the length
field, then update the elements (in the order they appear in the file)
and seek back to the end.

This reduces the ordinary amount of seeks of the Matroska muxer to two
(ordinary excludes scenarios where one has big Chapters or Attachments
or where one writes the Cues at the front).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
6 weeks agoavformat/matroskaenc: Only write Cues at the front if space has been reserved
Andreas Rheinhardt [Fri, 1 May 2020 23:47:17 +0000 (01:47 +0200)]
avformat/matroskaenc: Only write Cues at the front if space has been reserved

If the AVIOContext for output was unseekable when writing the header,
no space for Cues would be reserved even if the reserve_index_space
option was used (because it is reasonable to expect that one can't seek
back to the beginning to write the Cues anyway). But if the AVIOContext
was seekable when writing the trailer, it was presumed that space for
the Cues had been reserved when the reserve_index_space option indicated
so even when it was not. As a result, the beginning of the file would be
overwritten.

This commit fixes this: If the reserve_index_space option had been used
and no space has been reserved in advance because of unseekability when
writing the header, then no attempt to write Cues will be performed
when writing the trailer; after all, writing them at the front is
impossible and writing them at the end is probably undesired.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
6 weeks agoavformat/matroskaenc: Don't reserve space for duration when unseekable
Andreas Rheinhardt [Sat, 2 May 2020 15:46:09 +0000 (17:46 +0200)]
avformat/matroskaenc: Don't reserve space for duration when unseekable

We won't be able to seek back to write the actual duration anyway.

FATE-tests using the md5pipe command had to be updated due to this change.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
6 weeks agoavformat/matroskaenc: Remove inconsistencies wrt seekability handling
Andreas Rheinhardt [Fri, 1 May 2020 20:31:36 +0000 (22:31 +0200)]
avformat/matroskaenc: Remove inconsistencies wrt seekability handling

The Matroska muxer behaves differently in several ways when it thinks
that it is in unseekable/livestreaming mode: It does not add Cue entries
because they won't be written anyway for a livestream and it writes some
elements only preliminarily (with the intention to overwrite them with
an updated version at the end) when non-livestreaming etc.

There are two ways to set the Matroska muxer into livestreaming mode:
Setting an option or by providing an unseekable AVIOContext. Yet the
actual checks were not consistent:

If the AVIOContext was unseekable and no AAC extradata was available
when writing the header, writing the header failed; but if the AVIOContext
was seekable, it didn't, because the muxer expected to get the extradata
via packet side-data. Here the livestreaming option has not been checked,
although one can't use the updated extradata in case it is a livestream.

If the reserve_index_space option was used, space for writing Cues would
be reserved when writing the header unless the AVIOContext was
unseekable. Yet Cues were only written if the livestreaming option was
not set and the AVIOContext was seekable (when writing the trailer), so
if the AVIOContext was seekable and the livestreaming option set, the
reserved space would never be used at all.

If the AVIOContext was unseekable and the livestreaming option was not
set, it would be attempted to update the main length field at the end.
After all, it might be possible that the file is so short that it fits
into the AVIOContext's buffer in which case the seek back would work.
Yet this is dangerous: It might be that we are not dealing with a
simple output file, but that our output gets split into chunks and that
each of these chunks is actually seekable. In this case some part of the
last chunk (namely the eight bytes that have the same offset as the
length field had in the header) will be overwritten with what the muxer
wrongly believes to be the filesize.
(The livestreaming option has been added to deal with this scenario,
yet its documentation ("Write files assuming it is a live stream.")
doesn't make this clear at all. At least the segment muxer does not
set the option for live and given that the chances of successfully
seeking when the output is actually unseekable are slim, it is best to
not attempt to update the length field in the unseekable case at all.)

All these inconsistencies were fixed by treating the output as seekable
if the livestreaming option is not set and if the AVIOContext is
seekable. A macro has been used to enforce consistency and improve code
readability.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
6 weeks agoavformat/matroskaenc: Don't segfault when seekability changes
Andreas Rheinhardt [Fri, 1 May 2020 18:21:45 +0000 (20:21 +0200)]
avformat/matroskaenc: Don't segfault when seekability changes

If the Matroska muxer's AVIOContext was unseekable when writing the
header, but is seekable when writing the trailer, the code for writing
the trailer presumes that a dynamic buffer exists and tries to update
its content in order to overwrite data that has already been
preliminarily written when writing the header, yet said buffer doesn't
exist as it has been written finally and not preliminarily when writing
the header (because of the unseekability it was presumed that one won't
be able to update the data anyway).

This commit adds a check for this and also for a similar situation
involving updating extradata with new data from packet side-data.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
6 weeks agoavcodec/frame_thread_encoder: check for frame threading codec cap instead of intra...
James Almer [Mon, 18 May 2020 13:50:06 +0000 (10:50 -0300)]
avcodec/frame_thread_encoder: check for frame threading codec cap instead of intra only

It's the correct dedicated capability reported by supported encoders.
Otherwise, the frame thread path will be used for unsupported encoders
like r210 for no gain.

Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: James Almer <jamrial@gmail.com>
6 weeks agoavcodec/libdav1d: export frame sample aspect ratio
James Almer [Mon, 18 May 2020 15:28:03 +0000 (12:28 -0300)]
avcodec/libdav1d: export frame sample aspect ratio

Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: James Almer <jamrial@gmail.com>
6 weeks agolavc/qsvenc: add encode support for HEVC 4:2:2 8-bit and 10-bit
Linjie Fu [Wed, 26 Feb 2020 08:40:02 +0000 (16:40 +0800)]
lavc/qsvenc: add encode support for HEVC 4:2:2 8-bit and 10-bit

Enables HEVC Range Extension encoding support (Linux) for 4:2:2 8/10 bit
on ICL+ (gen11 +) platform.

Restricted to linux only for now.

Signed-off-by: Linjie Fu <linjie.fu@intel.com>
6 weeks agolavc/qsvdec: add decode support for HEVC 4:2:2 8-bit and 10-bit
Linjie Fu [Wed, 26 Feb 2020 08:39:29 +0000 (16:39 +0800)]
lavc/qsvdec: add decode support for HEVC 4:2:2 8-bit and 10-bit

Enables HEVC Range Extension decoding support (Linux) for 4:2:2 8/10 bit
on ICL+ (gen11 +) platform.

Restricted to linux only for now.

Signed-off-by: Linjie Fu <linjie.fu@intel.com>
6 weeks agoavformat/hlsenc: Don't segfault on uncommon names
Andreas Rheinhardt [Wed, 6 May 2020 06:16:06 +0000 (08:16 +0200)]
avformat/hlsenc: Don't segfault on uncommon names

The parsing process of the AVOpt-enabled string controlling the mapping
of input streams to variant streams is roughly as follows: Space and tab
separate variant stream group maps while the entries in each variant
stream group map are separated by ','.

The parsing process of each variant stream group proceeded as follows:
At first the number of occurences of "a:", "v:" and "s:" in each variant
stream group is calculated so that one can can allocate an array of
streams with this number of entries. Then the string is split along ','
and each substring is parsed. If such a substring starts with "a:", "s:"
or "v:" it is treated as stream specifier and (if there is a correct
number after ':') a stream of the variant stream is mapped to one of the
actual input streams.

Nothing actually guarantees that the number of streams allocated initially
equals the number of streams that are mapped to an actual input stream.
These numbers can differ if e.g. the name, the sgroup, agroup or ccgroup
of the variant stream contain "a:", "s:" or "v:".

The problem hereby is that the rest of the code presumes these numbers
to be equal and segfaults if it isn't (because the corresponding input
stream is NULL).

This commit fixes this by modifying the initial counting process to only
count occurences of "a:", "s:" or "v:" that are at the beginning or that
immediately follow a ','.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
6 weeks agoavutil: bump version after addition of av_sat_add64 and av_sat_sub64
James Almer [Sun, 17 May 2020 19:04:02 +0000 (16:04 -0300)]
avutil: bump version after addition of av_sat_add64 and av_sat_sub64

Signed-off-by: James Almer <jamrial@gmail.com>
6 weeks agoavformat/mpegts: Shuffle avio_seek
Michael Niedermayer [Thu, 7 May 2020 10:38:26 +0000 (12:38 +0200)]
avformat/mpegts: Shuffle avio_seek

This avoids accessing an old, no longer valid buffer.
Fixes: out of array access
Fixes: crash_audio-2020

Found-by: le wu <shoulewoba@gmail.com>
Reviewed-by: Marton Balint <cus@passwd.hu>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
6 weeks agoavformat/dump: Use int64_t for intermediate time values
Derek Buitenhuis [Sat, 16 May 2020 14:06:09 +0000 (15:06 +0100)]
avformat/dump: Use int64_t for intermediate time values

Prevents wrap-around to negative values while calculating the duration string.

Before:

    Duration: -411422:-59:-42.17, start: 0.000000, bitrate: 0 kb/s

After:

    Duration: 781623:28:34.17, start: 0.000000, bitrate: 0 kb/s

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
6 weeks agoavcodec/binkaudio: Fix 2Ghz sample_rate
Michael Niedermayer [Sun, 19 Apr 2020 15:05:53 +0000 (17:05 +0200)]
avcodec/binkaudio: Fix 2Ghz sample_rate

Fixes: signed integer overflow: 2147483647 + 1 cannot be represented in type 'int'
Fixes: 19950/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_BINKAUDIO_DCT_fuzzer-5765514337189888

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Suggested-by: Paul
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
6 weeks agoavcodec/jpeg2000dec: Free packed_headers
Michael Niedermayer [Wed, 13 May 2020 20:42:14 +0000 (22:42 +0200)]
avcodec/jpeg2000dec: Free packed_headers

Fixes: memleak
Fixes: 21784/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_JPEG2000_fuzzer-565256551058636

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Gautam Ramakrishnan <gautamramk@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
7 weeks agoavfilter/vsrc_sierpinski: unbreak configuring rate value
Paul B Mahol [Sat, 16 May 2020 09:12:57 +0000 (11:12 +0200)]
avfilter/vsrc_sierpinski: unbreak configuring rate value

7 weeks agoavfilter/vsrc_mandelbrot: unbreak configuring rate value
Paul B Mahol [Sat, 16 May 2020 09:10:32 +0000 (11:10 +0200)]
avfilter/vsrc_mandelbrot: unbreak configuring rate value

7 weeks agocheckasm: swscale: Fix running the hscale test on 32 bit x86
Martin Storsjö [Sat, 16 May 2020 05:13:58 +0000 (08:13 +0300)]
checkasm: swscale: Fix running the hscale test on 32 bit x86

This function doesn't call emms.

Signed-off-by: Martin Storsjö <martin@martin.st>
7 weeks agoavformat/mux: Call check_packet() more directly
Andreas Rheinhardt [Sat, 16 May 2020 00:04:34 +0000 (02:04 +0200)]
avformat/mux: Call check_packet() more directly

Call it directly from write_packets_common() instead of indirectly
through prepare_input_packet().

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
7 weeks agoavformat/mux: Check pkt->stream_index before using it
Andreas Rheinhardt [Thu, 7 May 2020 22:46:10 +0000 (00:46 +0200)]
avformat/mux: Check pkt->stream_index before using it

This commit stops using pkt->stream_index as index in an AVFormatContext's
streams array before actually comparing the value with the count of
streams in said array. 96e5e6abb9851d7a26ba21703955d5826ac857c0 used
pkt->stream_index in prepare_input_packet() before checking and
64063512227c4c87a7d16a1076481dc6baf19841 did likewise in
write_packets_common().

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
7 weeks agoswscale: aarch64: Add a NEON implementation of interleaveBytes
Martin Storsjö [Fri, 15 May 2020 07:54:10 +0000 (10:54 +0300)]
swscale: aarch64: Add a NEON implementation of interleaveBytes

This allows speeding up format conversions from yuv420 to nv12.

                             Cortex A53      A72      A73
interleave_bytes_c:             86077.5  51433.0  66972.0
interleave_bytes_neon:          19701.7  23019.2  15859.2
interleave_bytes_aligned_c:     86603.0  52017.2  67484.2
interleave_bytes_aligned_neon:   9061.0   7623.0   6309.0

Signed-off-by: Martin Storsjö <martin@martin.st>
7 weeks agocheckasm: sw_rgb: Add a test for interleaveBytes
Martin Storsjö [Fri, 15 May 2020 08:24:17 +0000 (11:24 +0300)]
checkasm: sw_rgb: Add a test for interleaveBytes

Signed-off-by: Martin Storsjö <martin@martin.st>
7 weeks agolibavcodec: aarch64: Add a NEON implementation of pixblockdsp
Martin Storsjö [Wed, 13 May 2020 11:08:58 +0000 (14:08 +0300)]
libavcodec: aarch64: Add a NEON implementation of pixblockdsp

                        Cortex A53    A72    A73
get_pixels_c:                140.7   87.7   72.5
get_pixels_neon:              46.0   20.0   19.5
get_pixels_unaligned_c:      140.7   87.7   73.0
get_pixels_unaligned_neon:    49.2   20.2   26.2
diff_pixels_c:               209.7  133.7  138.7
diff_pixels_neon:             54.2   31.7   23.5
diff_pixels_unaligned_c:     209.7  134.2  139.0
diff_pixels_unaligned_neon:   68.0   27.7   41.7

Signed-off-by: Martin Storsjö <martin@martin.st>
7 weeks agolibavcodec: arm: Add a NEON implementation of pixblockdsp
Martin Storsjö [Wed, 13 May 2020 10:57:59 +0000 (13:57 +0300)]
libavcodec: arm: Add a NEON implementation of pixblockdsp

                         Cortex A7     A8     A9    A53   A72
get_pixels_c:                144.7  146.0  143.0  137.7   69.0
get_pixels_armv6:            112.0  106.7   90.2   95.0   72.5
get_pixels_neon:              69.0   29.7   68.7   40.2   19.0
get_pixels_unaligned_c:      144.7  146.2  143.0  137.7   69.0
get_pixels_unaligned_neon:    77.0   36.5   72.5   48.5   19.0
diff_pixels_c:               376.7  319.7  265.5  307.7  148.0
diff_pixels_armv6:           179.0  159.5  205.5  139.0  142.0
diff_pixels_neon:             69.0   40.2   77.5   53.2   26.0
diff_pixels_unaligned_c:     376.7  319.7  265.5  307.7  148.0
diff_pixels_unaligned_neon:   85.0   54.5   93.5   66.7   26.0

Signed-off-by: Martin Storsjö <martin@martin.st>
7 weeks agocheckasm: pixblockdsp: Add tests for get_pixels_unaligned and diff_pixels_unaligned
Martin Storsjö [Wed, 13 May 2020 10:15:27 +0000 (13:15 +0300)]
checkasm: pixblockdsp: Add tests for get_pixels_unaligned and diff_pixels_unaligned

Signed-off-by: Martin Storsjö <martin@martin.st>
7 weeks agoswscale: arm: fix NEON hscale init
Josh de Kock [Thu, 7 May 2020 11:01:16 +0000 (12:01 +0100)]
swscale: arm: fix NEON hscale init

The NEON hscale function only supports X8 filter sizes and should only
be selected when these are being used. At the moment filterAlign is
set to 8 but in the future when extra NEON assembly for specific sizes is
added they will need to have checks here too.

The immediate usecase for this change is making the hscale checkasm
test easier and without NEON specific edge-cases (x86 already has these
guards).

This applies the same fix from 718c8f9aa59751bb490e2688acf2b5cb68fd5ad1
on the 32 bit arm version of the function, fixing fate-checkasm-sw_scale
there.

Signed-off-by: Martin Storsjö <martin@martin.st>
7 weeks agoavformat/mov: Read the QT Metadata Keys only once
Thierry Foucu [Mon, 11 May 2020 16:35:00 +0000 (09:35 -0700)]
avformat/mov: Read the QT Metadata Keys only once

If you have a file with multiple Metadata Keys, the second time you parse
the keys, you will re-alloc c->meta_keys without freeing the old one.
This change will avoid parsing all the consecutive Metadata keys.

Reviewed-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
7 weeks agoavutil/common: Add saturated add/sub operations for int64_t.
Dale Curtis [Thu, 30 Apr 2020 22:16:31 +0000 (15:16 -0700)]
avutil/common: Add saturated add/sub operations for int64_t.

Many places are using their own custom code for handling overflow
around timestamps or other int64_t values. There are enough of these
now that having some common saturated math functions seems sound.

Signed-off-by: Dale Curtis <dalecurtis@chromium.org>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
7 weeks agoavformat/mov: Don't allow negative sample sizes.
Dale Curtis [Thu, 14 May 2020 22:31:55 +0000 (15:31 -0700)]
avformat/mov: Don't allow negative sample sizes.

Signed-off-by: Dale Curtis <dalecurtis@chromium.org>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
7 weeks agocheckasm: aarch64: Check for stack overflows
Martin Storsjö [Wed, 13 May 2020 11:11:39 +0000 (14:11 +0300)]
checkasm: aarch64: Check for stack overflows

Also fill x8-x17 with garbage before calling the function.

Figure out the number of stack parameters and make sure that the
value on the stack after those is untouched.

Signed-off-by: Martin Storsjö <martin@martin.st>
7 weeks agocheckasm: arm: Check for stack overflows
Martin Storsjö [Wed, 13 May 2020 18:09:08 +0000 (21:09 +0300)]
checkasm: arm: Check for stack overflows

Figure out the number of stack parameters and make sure that the
value on the stack after those is untouched.

Signed-off-by: Martin Storsjö <martin@martin.st>
7 weeks agocheckasm: arm: Don't use blx to call checkasm_fail_func
Martin Storsjö [Tue, 12 May 2020 12:50:10 +0000 (15:50 +0300)]
checkasm: arm: Don't use blx to call checkasm_fail_func

We should just use a normal bl here, and the linker will add the 'x'
bit if necessary.

This fixes calling the checkasm_fail_func on windows, where the
code is built in thumb mode (and the linker doesn't clear the 'x'
bit in the blx instruction).

Signed-off-by: Martin Storsjö <martin@martin.st>
7 weeks agocheckasm: arm: Make the indentation consistent with other files
Martin Storsjö [Tue, 12 May 2020 10:44:05 +0000 (13:44 +0300)]
checkasm: arm: Make the indentation consistent with other files

This makes it easier to share code with e.g. the dav1d implementation
of checkasm.

Signed-off-by: Martin Storsjö <martin@martin.st>
7 weeks agoaarch64: Explicitly forbid using the x18 register
Martin Storsjö [Tue, 12 May 2020 10:28:44 +0000 (13:28 +0300)]
aarch64: Explicitly forbid using the x18 register

On windows and darwin (and modern android), the x18 register is reserved
and shouldn't be modified by user code, while it is freely available on
linux. Strictly avoid it, to keep the assembly code portable.

This would have helped catch the issue fixed in 872790b1f9be6
immediately.

Signed-off-by: Martin Storsjö <martin@martin.st>
7 weeks agoRevert "avfilter/vf_framerate: if metadata lavfi.scd.mafd exists, we'll use it first"
Marton Balint [Thu, 14 May 2020 20:49:01 +0000 (22:49 +0200)]
Revert "avfilter/vf_framerate: if metadata lavfi.scd.mafd exists, we'll use it first"

This reverts commit 339593ca90cb3e05d659ec99a1479904ec742294.

Fixes null pointer dereference.

Signed-off-by: Marton Balint <cus@passwd.hu>
7 weeks agoRevert "avfilter/vf_minterpolate: if metadata lavfi.scd.mafd exists, we'll use it...
Marton Balint [Thu, 14 May 2020 20:53:14 +0000 (22:53 +0200)]
Revert "avfilter/vf_minterpolate: if metadata lavfi.scd.mafd exists, we'll use it first"

This reverts commit d88e1c9838dbcfe29d7835f2705ffc9ee6a36bf3.

Fixes null pointer dereference.

Signed-off-by: Marton Balint <cus@passwd.hu>
7 weeks agocheckasm: add hscale test
Josh de Kock [Wed, 13 May 2020 15:02:53 +0000 (16:02 +0100)]
checkasm: add hscale test

This tests the hscale 8bpp to 14/18bpp functions with different filter
sizes.

Signed-off-by: Josh de Kock <josh@itanimul.li>
7 weeks agocheckasm: add function to check and diff memory
Martin Storsjö [Thu, 20 Jun 2019 20:38:06 +0000 (23:38 +0300)]
checkasm: add function to check and diff memory

This was ported from dav1d (c950e7101bdf5f7117bfca816984a21e550509f0).

Signed-off-by: Josh de Kock <josh@itanimul.li>
7 weeks agoswscale: fix NEON hscale init
Josh de Kock [Thu, 7 May 2020 11:01:16 +0000 (12:01 +0100)]
swscale: fix NEON hscale init

The NEON hscale function only supports X8 filter sizes and should only
be selected when these are being used. At the moment filterAlign is
set to 8 but in the future when extra NEON assembly for specific sizes is
added they will need to have checks here too.

The immediate usecase for this change is making the hscale checkasm
test easier and without NEON specific edge-cases (x86 already has these
guards).

Signed-off-by: Josh de Kock <josh@itanimul.li>
7 weeks agoavcodec/nvenc: use framerate if available
Zachariah Brown [Thu, 14 May 2020 18:15:33 +0000 (14:15 -0400)]
avcodec/nvenc: use framerate if available

The h264_nvenc and hevc_nvenc encoders aren't respecting the framerate in the codec context.
Instead it was using the timebase which in our use-case was 1/1000 so the encoder was behaving
as if we wanted 1000fps. This resulted in poor encoding results due to an extremely low bitrate.

Both the amf and qsv encoders already contain similar logic to first check the framerate before
falling back to the timebase.

Signed-off-by: Zachariah Brown <zachariah@renewedvision.com>
Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
7 weeks agoavcodec/option_table: mark venc_params as a video decoder flag opt type
James Almer [Tue, 12 May 2020 14:08:25 +0000 (11:08 -0300)]
avcodec/option_table: mark venc_params as a video decoder flag opt type

It's not meant for audio or subtitles, or for encoders of any kind.

Reviewed-by: mypopy@gmail.com <mypopy@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
7 weeks agohwcontext_vulkan: fix incorrect print argument
Lynne [Thu, 14 May 2020 17:22:55 +0000 (18:22 +0100)]
hwcontext_vulkan: fix incorrect print argument

7 weeks agoFATE: add fate test for minterpolate filter
Limin Wang [Fri, 20 Sep 2019 03:08:36 +0000 (11:08 +0800)]
FATE: add fate test for minterpolate filter

have tested on linux x86_32/64, mingw32/64 arm & mips qemu

Tested-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
7 weeks agoavfilter/vf_minterpolate: change the default threshold to get better scene change...
Limin Wang [Fri, 20 Sep 2019 03:08:35 +0000 (11:08 +0800)]
avfilter/vf_minterpolate: change the default threshold to get better scene change detect result

 ./ffmpeg -loglevel debug -i ../fate-suite/svq3/Vertical400kbit.sorenson3.mov -vf
 minterpolate=fps=60:mi_mode=blend -an -f null -
 [Parsed_minterpolate_0 @ 0x7fe7f3e193c0] scene changed, input pts 1600
 [Parsed_minterpolate_0 @ 0x7fe7f3e193c0] scene changed, input pts 4120
 [Parsed_minterpolate_0 @ 0x7fe7f3e193c0] scene changed, input pts 5780
 [Parsed_minterpolate_0 @ 0x7fe7f3e193c0] scene changed, input pts 6700
 [Parsed_minterpolate_0 @ 0x7fe7f3e193c0] scene changed, input pts 8140
 [Parsed_minterpolate_0 @ 0x7fe7f3e193c0] scene changed, input pts 9740
 [Parsed_minterpolate_0 @ 0x7fe7f3e193c0] scene changed, input pts 14060
 [Parsed_minterpolate_0 @ 0x7fe7f3e193c0] scene changed, input pts 15680
 [Parsed_minterpolate_0 @ 0x7fe7f3e193c0] scene changed, input pts 18480
 [Parsed_minterpolate_0 @ 0x7fe7f3e193c0] scene changed, input pts 20020
 [Parsed_minterpolate_0 @ 0x7fe7f3e193c0] scene changed, input pts 21740

 The results are consistent with tests/ref/fate/filter-metadata-scenedetect

 For the master, it'll detect more than 20 scene change for the same source.

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
7 weeks agoavfilter/vf_minterpolate: correct the mafd calculation
Limin Wang [Fri, 20 Sep 2019 12:08:35 +0000 (20:08 +0800)]
avfilter/vf_minterpolate: correct the mafd calculation

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
7 weeks agofate: add scdet metadata test
Limin Wang [Tue, 8 Oct 2019 15:28:39 +0000 (23:28 +0800)]
fate: add scdet metadata test

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
7 weeks agoavfilter/vf_minterpolate: if metadata lavfi.scd.mafd exists, we'll use it first
Limin Wang [Tue, 8 Oct 2019 15:28:38 +0000 (23:28 +0800)]
avfilter/vf_minterpolate: if metadata lavfi.scd.mafd exists, we'll use it first

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
7 weeks agoavfilter/vf_framerate: if metadata lavfi.scd.mafd exists, we'll use it first
Limin Wang [Tue, 8 Oct 2019 15:28:37 +0000 (23:28 +0800)]
avfilter/vf_framerate: if metadata lavfi.scd.mafd exists, we'll use it first

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
7 weeks agoavfilter/vf_scdet: add filter to detect scene change
Limin Wang [Tue, 8 Oct 2019 15:28:36 +0000 (23:28 +0800)]
avfilter/vf_scdet: add filter to detect scene change

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
7 weeks agoavformat/mpegtsenc: Remove two duplicated fields
Andriy Gelman [Thu, 30 Apr 2020 19:43:40 +0000 (15:43 -0400)]
avformat/mpegtsenc: Remove two duplicated fields

ts->{tsid,onid} stores the values of ts->{transport_stream_id,original_network_id}

Reviewed-by: Marton Balint <cus@passwd.hu>
Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>