]> git.sesse.net Git - ffmpeg/log
ffmpeg
4 years agohwcontext_vulkan: set usage for DRM imports to the frames context usage
Lynne [Thu, 14 May 2020 23:21:51 +0000 (00:21 +0100)]
hwcontext_vulkan: set usage for DRM imports to the frames context usage

They're nothing special, and there's no reason they should always use the
default flags.

4 years agohwcontext_vulkan: do not OR the user-specified usage with our default flags
Lynne [Thu, 14 May 2020 23:16:58 +0000 (00:16 +0100)]
hwcontext_vulkan: do not OR the user-specified usage with our default flags

Some users may need special formats that aren't available when the STORAGE
flag bit is set, which would result in allocations failing.

4 years agohwcontext_vulkan: actually use the frames exec context for prep/import/export
Lynne [Thu, 14 May 2020 22:37:14 +0000 (23:37 +0100)]
hwcontext_vulkan: actually use the frames exec context for prep/import/export

This was never actually used, likely due to confusion, as the device context
also had one used for uploads and downloads.
Also, since we're only using it for very quick image barriers (which are
practically free on all hardware), use the compute queue instead of the
transfer queue.

4 years agohwcontext_vulkan: support user-provided pools
Lynne [Thu, 14 May 2020 22:59:22 +0000 (23:59 +0100)]
hwcontext_vulkan: support user-provided pools

If an external pool was provided we skipped all of frames init,
including the exec context.

4 years agohwcontext_vulkan: use all enabled queues for transfers, make uploads async
Lynne [Wed, 13 May 2020 23:28:00 +0000 (00:28 +0100)]
hwcontext_vulkan: use all enabled queues for transfers, make uploads async

This commit makes full use of the enabled queues to provide asynchronous
uploads of images (downloads remain synchronous).
For a pure uploading use cases, the performance gains can be significant.

4 years agohwcontext_vulkan: wrap ImageBufs into AVBufferRefs
Lynne [Thu, 14 May 2020 20:53:22 +0000 (21:53 +0100)]
hwcontext_vulkan: wrap ImageBufs into AVBufferRefs

Makes it easier to support multiple queues

4 years agohwcontext_vulkan: improve public header documentation
Lynne [Fri, 22 May 2020 18:54:00 +0000 (19:54 +0100)]
hwcontext_vulkan: improve public header documentation

Some things like using ImageLists were from a really old version that
still used multiplanar images.

4 years agohwcontext_vulkan: expose the enabled device features
Lynne [Wed, 13 May 2020 15:39:00 +0000 (16:39 +0100)]
hwcontext_vulkan: expose the enabled device features

With this, the puzzle of making libplacebo, ffmpeg and any other Vulkan
API users interoperable is complete.
Users of both libraries can initialize one another's contexts without having
to create a new one.

4 years agohwcontext_vulkan: expose the amount of queues for each queue family
Lynne [Wed, 13 May 2020 15:20:15 +0000 (16:20 +0100)]
hwcontext_vulkan: expose the amount of queues for each queue family

This, along with the next patch, are the last missing pieces to being
interoperable with libplacebo.

4 years agohwcontext: add av_hwdevice_ctx_create_derived_opts
Lynne [Wed, 20 May 2020 19:58:03 +0000 (20:58 +0100)]
hwcontext: add av_hwdevice_ctx_create_derived_opts

This allows for users who derive devices to set options for the
new device context they derive.
The main use case of this is to allow users to enable extensions
(such as surface drawing extensions) in Vulkan while deriving from
the device their frames are on. That way, users don't need to write
any initialization code themselves, since the Vulkan spec invalidates
mixing instances, physical devices and active devices.
Apart from Vulkan, other hwcontexts ignore the opts argument since they
don't support options at all (or in VAAPI and OpenCL's case, options are
currently only used for device selection, which device_derive overrides).

4 years agooggdec: remove the oggparsedaala subdemuxer
Lynne [Fri, 22 May 2020 09:30:41 +0000 (10:30 +0100)]
oggdec: remove the oggparsedaala subdemuxer

The Xiph foundation never standardized either Daala nor its mapping in Ogg,
and all files that were created are undecodable without knowledge of the
git hash.

4 years agolavfi: add untile filter.
Nicolas George [Thu, 16 Apr 2020 20:25:24 +0000 (22:25 +0200)]
lavfi: add untile filter.

4 years agolavfi/framesync: use av_gcd_q().
Nicolas George [Thu, 16 Apr 2020 19:36:35 +0000 (21:36 +0200)]
lavfi/framesync: use av_gcd_q().

4 years agolavu: add av_gcd_q().
Nicolas George [Thu, 16 Apr 2020 19:36:00 +0000 (21:36 +0200)]
lavu: add av_gcd_q().

4 years agolavfi/tests/formats: reindent.
Nicolas George [Thu, 16 Apr 2020 15:24:36 +0000 (17:24 +0200)]
lavfi/tests/formats: reindent.

4 years agolavfi/formats: remove dead code.
Nicolas George [Thu, 16 Apr 2020 14:55:36 +0000 (16:55 +0200)]
lavfi/formats: remove dead code.

Move the contents of all_channel_layouts.inc directly into
libavfilter/tests/formats.c.

4 years agolavfi/vf_crop: use ff_formats_pixdesc_filter().
Nicolas George [Thu, 16 Apr 2020 14:40:53 +0000 (16:40 +0200)]
lavfi/vf_crop: use ff_formats_pixdesc_filter().

4 years agolavfi/formats: add ff_formats_pixdesc_filter().
Nicolas George [Thu, 16 Apr 2020 14:40:40 +0000 (16:40 +0200)]
lavfi/formats: add ff_formats_pixdesc_filter().

4 years agoavformat/webm_chunk: Open AVIOContext before initializing sub-muxer
Andreas Rheinhardt [Sun, 17 May 2020 19:37:42 +0000 (21:37 +0200)]
avformat/webm_chunk: Open AVIOContext before initializing sub-muxer

The description of AVOutputFormat.init contains the statement that "this
method must not write output". Due to this, the webm_chunk muxer defers
opening the AVIOContext for the child muxer until avformat_write_header(),
i.e. there is no AVIOContext when the sub-muxer's avformat_init_output()
is called. But this violates the documentation of said function which
requires the AVFormatContext to have an already opened AVIOContext.
This commit fixes this.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years agoavformat/matroskaenc: Forward errors from avpriv_split_xiph_headers()
Andreas Rheinhardt [Sun, 17 May 2020 15:30:19 +0000 (17:30 +0200)]
avformat/matroskaenc: Forward errors from avpriv_split_xiph_headers()

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years agoavformat/matroskadec: Use proper context for logging
Andreas Rheinhardt [Sun, 17 May 2020 22:25:48 +0000 (00:25 +0200)]
avformat/matroskadec: Use proper context for logging

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years agoavcodec/xiph: Return better error codes
Andreas Rheinhardt [Sun, 17 May 2020 16:04:52 +0000 (18:04 +0200)]
avcodec/xiph: Return better error codes

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years agoavformat/segment: Propagate disposition
Andreas Rheinhardt [Sat, 16 May 2020 21:31:08 +0000 (23:31 +0200)]
avformat/segment: Propagate disposition

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years agoavformat/segment: Access AVStream more directly
Andreas Rheinhardt [Sun, 17 May 2020 00:36:46 +0000 (02:36 +0200)]
avformat/segment: Access AVStream more directly

by storing s->streams[i] in a pointer instead of constantly using
s->streams[i]->...

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years agoavformat/webmdashenc: Simplify parsing strings
Andreas Rheinhardt [Mon, 18 May 2020 03:11:34 +0000 (05:11 +0200)]
avformat/webmdashenc: Simplify parsing strings

Don't use the functions for searching substrings when all one is
looking for is a char anyway. Given that there is already a standard
library function for "find last occurence of a char in a string" also
allows one to remove a custom loop.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years agoavformat/webmdashenc: Don't segfault on invalid arguments
Andreas Rheinhardt [Mon, 18 May 2020 02:43:25 +0000 (04:43 +0200)]
avformat/webmdashenc: Don't segfault on invalid arguments

The current parsing process for adaptation_sets does not guarantee
every adaptation set to contain at least one stream, because the loop
exits immediately as soon as the end of the string has been reached,
without checking whether the currently active adaptation set group is
lacking a stream. This would lead to segfaults lateron as the rest of
the code presumed that every adaptation set contains a stream. This
commit fixes this by erroring out when the last adaptation set group
is incomplete.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years agoavformat/webmdashenc: Remove possibility of infinite loop
Andreas Rheinhardt [Mon, 18 May 2020 02:19:32 +0000 (04:19 +0200)]
avformat/webmdashenc: Remove possibility of infinite loop

The WebM DASH manifest muxer uses a loop to parse the adaptation_sets
string (which is given by the user and governs which AVStreams are
mapped to what adaptation set) and the very beginning of this loop is
"if (*p == ' ') continue;". This of course leads to an infinite loop if
the condition is true. It is true if e.g. the string begins with ' ' or
if there are more than one ' ' between different adaptation set groups.

To fix this, the parsing process has been modified to consume the space
if it is at a place where it can legitimately occur, i.e. when a new
adaptation set group is expected. The latter restriction implies that an
error is returned if a space exists where none is allowed to exist.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years agoavformat/webmdashenc: Be more strict when parsing stream indices
Andreas Rheinhardt [Mon, 18 May 2020 01:17:50 +0000 (03:17 +0200)]
avformat/webmdashenc: Be more strict when parsing stream indices

The syntax of the adaptation_sets string by which the user determines
the mapping of AVStreams to adaptation sets is
"id=x,streams=a,b,c id=y,streams=d,e" (means: the streams with the
indices a, b and c belong to the adaptation set with id x). Yet there
was no check for whether these indices were actual numbers and if there
is a number whether it really extends to the next ',', ' ' or to the
end of the string or not. This commit adds a check for this.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years agoavformat/webmdashenc: Avoid allocation for parsing a number
Andreas Rheinhardt [Mon, 18 May 2020 00:48:49 +0000 (02:48 +0200)]
avformat/webmdashenc: Avoid allocation for parsing a number

In order to parse a number from a string, the WebM DASH manifest muxer
would duplicate (via heap-allocation) the part of the string that
contains the number, then read the number via atoi() and then free the
duplicate again. This has been replaced by simply using strtoll() (which
in contrast to atoi() has defined behaviour when the number is not
representable).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years agoavformat/mux: Remove unnecessary unreferencing of AVPacket
Andreas Rheinhardt [Sat, 9 May 2020 19:26:30 +0000 (21:26 +0200)]
avformat/mux: Remove unnecessary unreferencing of AVPacket

Since commit c5324d92c5f206dcdc2cf93ae237eaa7c1ad0a40 all custom
interleave_packet() functions always return clean packets (even on
error), so that unreferencing manually can be removed.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years agoavformat/avformat: Remove redundant "NOT PART OF PUBLIC API"
Andreas Rheinhardt [Wed, 18 Mar 2020 13:49:50 +0000 (14:49 +0100)]
avformat/avformat: Remove redundant "NOT PART OF PUBLIC API"

AVStream.request_probe as well as AVStream.mux_ts_offset are below the
separator of public and private fields, so that a further "NOT PART OF
PUBLIC API" is redundant.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years agoavfilter/vf_lut3d: initial float pixel format support
Mark Reid [Tue, 19 May 2020 02:00:25 +0000 (19:00 -0700)]
avfilter/vf_lut3d: initial float pixel format support

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoavcodec/ass: explicitly set ScaledBorderAndShadow
Oneric [Thu, 16 Apr 2020 22:38:53 +0000 (00:38 +0200)]
avcodec/ass: explicitly set ScaledBorderAndShadow

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoavcodec: move mpeg4 profiles to profiles.h
Marton Balint [Sun, 10 May 2020 19:58:35 +0000 (21:58 +0200)]
avcodec: move mpeg4 profiles to profiles.h

Also bump micro version after the recent option changes.

Signed-off-by: Marton Balint <cus@passwd.hu>
4 years agoavcodec: move msbc profile to encoder
Marton Balint [Sun, 10 May 2020 18:54:57 +0000 (20:54 +0200)]
avcodec: move msbc profile to encoder

Signed-off-by: Marton Balint <cus@passwd.hu>
4 years agoavcodec/options_table: remove dts profiles
Marton Balint [Sun, 10 May 2020 18:43:35 +0000 (20:43 +0200)]
avcodec/options_table: remove dts profiles

Our encoder (dcaenc) does not use any of these.

Signed-off-by: Marton Balint <cus@passwd.hu>
4 years agoavcodec: move aacenc profiles to profiles.h
Marton Balint [Sun, 10 May 2020 18:38:11 +0000 (20:38 +0200)]
avcodec: move aacenc profiles to profiles.h

Signed-off-by: Marton Balint <cus@passwd.hu>
4 years agoavcodec/options_table: make AVCodecContext->profile search for child constants
Marton Balint [Sun, 10 May 2020 18:08:40 +0000 (20:08 +0200)]
avcodec/options_table: make AVCodecContext->profile search for child constants

This change makes it possible for child encoders to define custom profile
option names which can be used for setting the AVCodecContext->profile.

Also rename unit name to something rather unique, so it won't be used elsewhere.

Signed-off-by: Marton Balint <cus@passwd.hu>
4 years agoavutil/opt: add AV_OPT_FLAG_CHILD_CONSTS
Marton Balint [Sun, 10 May 2020 17:54:51 +0000 (19:54 +0200)]
avutil/opt: add AV_OPT_FLAG_CHILD_CONSTS

This will be used for AVCodecContext->profile. By specifying constants in the
encoders we won't have to use the common AVCodecContext options table and
different encoders can use the same profile name even with different values.

Signed-off-by: Marton Balint <cus@passwd.hu>
4 years agomovenc: Fix accidental leftover duplication from 1aec1fbcc595
Martin Storsjö [Fri, 22 May 2020 18:59:49 +0000 (21:59 +0300)]
movenc: Fix accidental leftover duplication from 1aec1fbcc595

Signed-off-by: Martin Storsjö <martin@martin.st>
4 years agomfenc: Fall back to avctx->time_base if avctx->framerate isn't set
Martin Storsjö [Wed, 20 May 2020 20:08:17 +0000 (23:08 +0300)]
mfenc: Fall back to avctx->time_base if avctx->framerate isn't set

The framerate field is the one users are supposed to set, but not
all users might be setting it, so it might be good to fall back
time_base in that case.

Signed-off-by: Martin Storsjö <martin@martin.st>
4 years agomfenc: Fix setting has_b_frames for max_b_frames == 1
Martin Storsjö [Wed, 20 May 2020 21:11:47 +0000 (00:11 +0300)]
mfenc: Fix setting has_b_frames for max_b_frames == 1

This was a mistake in my own additions in
050b72ab5ef318605b305aa6cb920e8b52f1002e.

Signed-off-by: Martin Storsjö <martin@martin.st>
4 years agomovenc: Fix conversion of the first frame for extradata-less H264/HEVC
Martin Storsjö [Thu, 21 May 2020 11:00:14 +0000 (14:00 +0300)]
movenc: Fix conversion of the first frame for extradata-less H264/HEVC

Move the copying of the frame to vos_data further up in the function,
so that when writing the actual frame data for the first frame, it's
clear that the stream really is in annex b format, for the cases where
we create extradata from the first frame.

Alternatively - we could invert the checks for bitstream format. If
extradata is missing, we can't pretend that the bitstream is in
mp4 form, because we can't even know the NAL unit length prefix size
in that case.

Also avoid creating extradata for AVC intra. If the track tag is
an AVC intra tag, don't copy the frame into vos_data - this matches
other existing cases of how vos_data and TAG_IS_AVCI interact in
other places.

Signed-off-by: Martin Storsjö <martin@martin.st>
4 years agocbs_h265: Fix use of an uninitialized variable
Martin Storsjö [Thu, 21 May 2020 08:03:35 +0000 (11:03 +0300)]
cbs_h265: Fix use of an uninitialized variable

This fixes test failures in fate-cbs-hevc-* in certain configurations
since c53f9f436440be4e18.

Signed-off-by: Martin Storsjö <martin@martin.st>
4 years agoavcodec/bsf: mention that av_bsf_send_packet() returning EAGAIN is not an error
James Almer [Thu, 9 Apr 2020 23:02:04 +0000 (20:02 -0300)]
avcodec/bsf: mention that av_bsf_send_packet() returning EAGAIN is not an error

EAGAIN is returned when input is provided but can't be consumed. The filtering
process is unaffected in this case, and the function will be able to consume
new input after retrieving filtered packets with av_bsf_receive_packet().

Remove the line about empty packets never failing added in
41b05b849f215b03eeb9e3608571ba47de64182a while at it. Even if it's currently
the case, it unnecessarily constrains the API and could be changed in the future
in case it needs to be extended.
The user should always check for errors and never expect a call to never fail.

Reviewed-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
4 years agoavcodec.h: split bitstream filters API into its own header
Anton Khirnov [Tue, 7 Apr 2020 14:41:48 +0000 (16:41 +0200)]
avcodec.h: split bitstream filters API into its own header

4 years agolavc: rename bsf.h to bsf_internal.h
Anton Khirnov [Tue, 7 Apr 2020 14:49:28 +0000 (16:49 +0200)]
lavc: rename bsf.h to bsf_internal.h

This will allow adding a public header named bsf.h

4 years agoavcodec.h: split AVCodecParameters API into its own header
Anton Khirnov [Tue, 7 Apr 2020 14:41:48 +0000 (16:41 +0200)]
avcodec.h: split AVCodecParameters API into its own header

4 years agoStop hardcoding align=32 in av_frame_get_buffer() calls.
Anton Khirnov [Wed, 8 Feb 2017 08:51:17 +0000 (09:51 +0100)]
Stop hardcoding align=32 in av_frame_get_buffer() calls.

Use 0, which selects the alignment automatically.

4 years agocmdutils: drop libavformat/network.h include
Anton Khirnov [Sat, 20 May 2017 10:55:00 +0000 (12:55 +0200)]
cmdutils: drop libavformat/network.h include

It is not a public header and has not been used since
10173c0e58e557582dbd659f42c6aa164a8682db

4 years agoavfilter/af_aiir: move response drawing as last step
Paul B Mahol [Fri, 22 May 2020 12:14:15 +0000 (14:14 +0200)]
avfilter/af_aiir: move response drawing as last step

4 years agoavfilter/af_aiir: fix first denominator calculation
Paul B Mahol [Fri, 22 May 2020 12:12:06 +0000 (14:12 +0200)]
avfilter/af_aiir: fix first denominator calculation

4 years 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

4 years 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.

4 years 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

4 years 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>
4 years 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>
4 years 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>
4 years 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>
4 years 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>
4 years 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>
4 years 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>
4 years 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>
4 years 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>
4 years 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>
4 years 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>
4 years 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>
4 years 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>
4 years 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>
4 years 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>
4 years 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>
4 years 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>
4 years 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>
4 years 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>
4 years 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>
4 years 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>
4 years 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>
4 years 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>
4 years 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.

4 years 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>
4 years 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>
4 years 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>
4 years 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>
4 years 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.

4 years 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>
4 years 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>
4 years 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

4 years 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

4 years 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.

4 years 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

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

4 years 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>
4 years 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>
4 years 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>
4 years 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>
4 years 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>
4 years 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>
4 years 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>
4 years 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>
4 years 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>