Commit Graph

44718 Commits

Author SHA1 Message Date
Aaron Levinson
3d040513a1 avutil/hwcontext_dxva2: Don't improperly free IDirect3DSurface9 objects
Add dxva2_pool_release_dummy() and use it in call to
av_buffer_create() in dxva2_pool_alloc().

Prior to this change, av_buffer_create() was called with NULL for the
third argument, which indicates that av_buffer_default_free() should
be used to free the buffer's data.  Eventually, it gets to
buffer_pool_free() and calls buf->free() on a surface object (which is
av_buffer_default_free()).

This can result in a crash when the debug version of the C-runtime is
used on Windows.  While it doesn't appear to result in a crash when
the release version of the C-runtime is used on Windows, it likely
results in memory corruption, since av_free() is being called on
memory that was allocated using
IDirectXVideoAccelerationService::CreateSurface().

Signed-off-by: Aaron Levinson <alevinsn@aracnet.com>
Reviewed-by: wm4 <nfxjfg@googlemail.com>
Reviewed-by: Steven Liu <lingjiujianke@gmail.com>
Reviewed-by: Mark Thompson <sw@jkqxz.net>
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2017-05-20 09:41:45 +02:00
Anton Khirnov
8652a2c248 decode: fix the code reducing cropping to preserve alignment
Currently it does not work at all.

Bug-Id: 1058
2017-05-20 09:41:30 +02:00
Anton Khirnov
c3f0357bdf hevcdec: move the MD5 context out of HEVCSEIPictureHash back into HEVCContext
HEVCSEIPictureHash should store only the information extracted from the
bitstream and exported to the higher layer (the decoder or the parser).
The MD5 context is allocated, used and freed by this higher layer, so it
makes more sense for it to also be stored there.
2017-05-20 09:41:30 +02:00
James Almer
d7dcd825de extract_extradata_bsf: make sure all needed parameter set NALUs were found
This mimics the behavior of the now unused h264/hevc parser's split()
function and fixes decoding some files when extract_extradata bsf is
enabled.

Signed-off-by: James Almer <jamrial@gmail.com>
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2017-05-20 09:41:30 +02:00
Anton Khirnov
3fb6b98b5e vp9_superframe_bsf: cache input packets directly
Avoids unnecessary allocs+copies and makes the code slightly simpler.
2017-05-20 09:41:30 +02:00
Anton Khirnov
126bc2c33b vp9_superframe_bsf: convert to the new bitstream reader 2017-05-20 09:41:30 +02:00
Mark Thompson
3daaa44173 hevc: Add names for reserved NAL unit types
While not yet used, these NAL units do already have some defined
semantics and are referred to elsewhere.
2017-05-16 22:23:14 +01:00
Mark Thompson
6ea220cbee h264_sei: Add namespace prefix to all SEI values
This avoids confusion with equivalent H.265 SEI values when both are
being used at the same time.
2017-05-16 22:23:14 +01:00
Mark Thompson
4d56f7ab8f avconv: Flush output BSFs when stream copy reaches EOF
Same as f64d1100a5, for stream copy
rather than encode.
2017-05-16 22:23:14 +01:00
Mark Thompson
66aa9b94da doc: Document hwupload, hwdownload and hwmap filters 2017-05-16 22:23:09 +01:00
Martin Storsjö
7c35bee025 movenc-test: Add tests for negative cts offsets
Signed-off-by: Martin Storsjö <martin@martin.st>
2017-05-15 14:08:53 +03:00
Martin Storsjö
c415c8104c movenc: Don't write any edit list if the start offset is zero
In these cases, the CTTS flag is set, but no edit list is necessary.

Signed-off-by: Martin Storsjö <martin@martin.st>
2017-05-15 14:08:48 +03:00
Martin Storsjö
c380a0d7f7 movenc: Add an option for enabling negative CTS offsets
This reduces the need for an edit list; streams that start with
e.g. dts=-1, pts=0 can be encoded as dts=0, pts=0 (which is valid
in mov/mp4) by shifting the dts values of all packets forward.
This avoids the need for edit lists for such streams (while they
still are needed for audio streams with encoder delay).

This eases conformance with the DASH-IF interoperability guidelines.

Signed-off-by: Martin Storsjö <martin@martin.st>
2017-05-15 14:08:36 +03:00
Martin Storsjö
d05c9cde0e checkasm: aarch64: Specify alignment for the register_init const array
Loads from this strictly doesn't require alignment, but specify it
just for consistency with the arm version.

Signed-off-by: Martin Storsjö <martin@martin.st>
2017-05-15 10:19:46 +03:00
Martin Storsjö
d7320ca3ed arm: Avoid using .dn register aliases
clang now (in the upcoming 5.0 version) is capable of building our
arm assembly without relying on gas-preprocessor, although clang/LLVM
doesn't support .dn register aliases.

The VC1 MC assembly was only built and used if the chosen assembler
supported the .dn directives though. This was supported as long as
gas-preprocessor was used.

This means that VC1 decoding got a speed regression on clang 5.0,
unless the user manually chose using gas-preprocessor again.

By avoiding using the .dn register aliases, we can build the VC1 MC
assembly with the latest clang version.

Support for the .dn/.qn directives in clang/LLVM isn't actively planned,
see https://bugs.llvm.org/show_bug.cgi?id=18199.

This partially reverts 896a5bff64.

Signed-off-by: Martin Storsjö <martin@martin.st>
2017-05-15 09:52:18 +03:00
Martin Storsjö
6ccf76aec7 mpjpeg: Use proper CR/LF in multipart headers
This is more correct.

Signed-off-by: Martin Storsjö <martin@martin.st>
2017-05-11 11:05:42 +03:00
Sean McGovern
cb167f2947 h264_refs: validate the SPS pointer in ff_h264_execute_ref_pic_marking()
Bug-Id: 1036
CC: libav-stable@libav.org
2017-05-09 17:28:36 -04:00
James Almer
cfd25488bf hevcdec: move SEI message parsing into a separate header
It doesn't depend on hevcdec anymore.

Signed-off-by: James Almer <jamrial@gmail.com>
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2017-05-09 13:42:20 +02:00
James Almer
648a0b4503 hevcdec: remove HEVCContext usage from hevc_sei
Based on the H264 SEI implementation.

This will be mainly useful once support for SEI messages that can be
used by the hevc parser are implemented, like Picture Timing.

Signed-off-by: James Almer <jamrial@gmail.com>
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2017-05-09 13:42:20 +02:00
Martin Storsjö
59cee42d7d arm: Check for the .arch directive in configure
When targeting windows, the .arch directive isn't available.

So far, when building for windows, we've always used gas-preprocessor,
both when using msvc's armasm and when using clang. Lately, clang/llvm
has implemented the last missing piece (altmacro support) for building
our assembly without gas-preprocessor. This means that we now build
for arm/windows with clang without any extra compatibility layer.

Signed-off-by: Martin Storsjö <martin@martin.st>
2017-05-08 14:21:08 +03:00
Alexandra Hájková
ce080f47b8 hevc: Add NEON 32x32 IDCT
Signed-off-by: Martin Storsjö <martin@martin.st>
2017-05-04 14:08:39 +02:00
Alexandra Hájková
118dd4a321 hevc: 16x16 NEON idct: Use the right element size for loads/stores
This doesn't change the actual behaviour of the code but improves
readability.

Signed-off-by: Martin Storsjö <martin@martin.st>
2017-05-04 14:08:27 +02:00
Alex Converse
504403ab28 aacsbr: Turnoff in the event of over read.
Aliased compressed AAC bytes are almost certainly not meaningful SBR
data. In the wild this causes harsh artifacts switching HE-AAC streams
that don't have SBR headers aligned with segment boundaries.

Turning off SBR falls back to a default set of upsampling parameters
that can function as a sort of error concealment. This is consistent
with how the decoder handles other sorts of errors.

Bug-Id: 1047
CC: libav-stable@libav.org

Signed-off-by: Sean McGovern <gseanmcg@gmail.com>
2017-05-03 19:00:03 -04:00
Diego Biurrun
b5f19f7478 aac: Split function to parse ADTS header data into public and private part
This makes the currently semi-public avpriv_aac_parse_header() function
private to libavcodec and adds a proper public API function to return
the parts of the ADTS header required in libavformat.
2017-05-02 18:50:34 +02:00
Luca Barbato
0ac1fec1c3 bitstream: Move VLC reading functions into the vlc.h header
This makes the bitstream.h header leaner.

Signed-off-by: Diego Biurrun <diego@biurrun.de>
2017-05-02 18:39:10 +02:00
Luca Barbato
73fc82f343 vlc: Add header #include when the types are used
Do not rely on indirectly including it from bitstream.h.

Signed-off-by: Diego Biurrun <diego@biurrun.de>
2017-05-02 18:38:26 +02:00
Alexandra Hájková
edbf0fffb1 hevc: Add NEON add_residual for bitdepth 10
Signed-off-by: Martin Storsjö <martin@martin.st>
2017-05-01 23:39:55 +03:00
Mark Thompson
81a4cb8e58 vf_hwmap: Add reverse mapping for hardware frames
This is something of a hack.  It allocates a new hwframe context for
the target format, then maps it back to the source link and overwrites
the input link hw_frames_ctx so that the previous filter will receive
the frames we want from ff_get_video_buffer().  It may fail if
the previous filter imposes any additional constraints on the frames
it wants to use as output.
2017-04-30 17:33:18 +01:00
Mark Thompson
38cb05f1c8 vf_hwmap: Add device derivation
Also refactor a little and improve error messages to make failure
cases easier to understand.
2017-04-30 17:33:18 +01:00
Mark Thompson
c5714b51aa hwcontext: Improve allocation in derived contexts
Use the flags argument of av_hwframe_ctx_create_derived() to pass the
mapping flags which will be used on allocation.  Also, set the format
and hardware context on the allocated frame automatically - the user
should not be required to do this themselves.
2017-04-30 17:33:18 +01:00
Mark Thompson
e1c5d56b18 hwcontext_qsv: Implement mapping frames to the child device type 2017-04-30 17:33:18 +01:00
Mark Thompson
eaa5e07104 hwcontext_qsv: Implement mapping frames from the child device type
Factorises out existing surface initialisation code to reuse.
2017-04-30 17:33:06 +01:00
Mark Thompson
27978155bc hwcontext: Add frame context mapping for nontrivial contexts
Some frames contexts are not usable without additional format-specific
state in hwctx.  This change adds new functions frames_derive_from and
frames_derive_to to initialise this state appropriately when deriving
a frames context which will require it to be set.
2017-04-30 16:13:56 +01:00
Mark Thompson
aa51bb3d27 hwcontext_qsv: Support derivation from child devices 2017-04-30 16:13:56 +01:00
Mark Thompson
e669db7610 avconv: Support setting the hardware device to use when filtering
This only supports one device globally, but more can be used by
passing them with input streams in hw_frames_ctx or by deriving new
devices inside a filter graph with hwmap.
2017-04-30 16:13:50 +01:00
Mark Thompson
9203aac228 avconv_hw: Add implicit device creation with default parameters
If -hwaccel foo is supplied without any other device options, and the
foo hwaccel is meant to have a device, try to make such a device with
default parameters for the hwaccel to use.
2017-04-30 16:07:16 +01:00
Mark Thompson
b43b95f478 vp9_raw_reorder_bsf: Remove a redundant allocation
This was left over from an earlier version which created the new
packet inside the current frame structure.  Now it just leaks an
unused packet, so remove the allocation entirely.
2017-04-30 14:09:05 +01:00
Anton Khirnov
831018b0bb mpeg4audio: Make avpriv_copy_pce_data() inline
The function currently accepts a PutBitContext and a GetBitContext,
which hardcodes their sizes into the lavc ABI. Since the function is
quite small and only called in a few places, the simplest solution is
making it inline, thus avoiding a runtime dependency completely.

Signed-off-by: Diego Biurrun <diego@biurrun.de>
2017-04-28 13:47:20 +02:00
Martin Storsjö
e1c2453a4f arm: hevc_idct: Tune the add_res_8x8 and add_res_32x32 functions
Before:              Cortex     A7      A8      A9     A53
hevc_add_res_8x8_8_neon:     116.0    58.7    80.2    90.7
hevc_add_res_32x32_8_neon:  1230.0   737.5  1187.5   974.4
After:
hevc_add_res_8x8_8_neon:      97.7    57.0    73.7    80.0
hevc_add_res_32x32_8_neon:  1216.0   698.7  1127.5   827.1

Signed-off-by: Martin Storsjö <martin@martin.st>
2017-04-28 12:02:14 +03:00
Seppo Tomperi
0d4d435137 hevc: Add NEON add_residual for bitdepth 8
Optimized by Alexandra Hájková.

Signed-off-by: Martin Storsjö <martin@martin.st>
2017-04-27 23:05:27 +03:00
Vittorio Giovara
970c76f322 mlp_parser: Drop in-parser downmix functionality
request_channel_layout is a decoder option and it makes no sense
to have it in a parser.

This feature was needed in the past when the decoder was allowed
to reuse the avctx from the demuxer. Nowadays the decoder receives
only the parameters from it, already containing the real channel
layout (and the correct request_channel_layout option).

After initialization the decoder overwrites the channel layout
with the downmixed one that is actually output, so there is no need
to preserve this functionality in the parser.

Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2017-04-27 14:19:54 -04:00
Vittorio Giovara
dd3aa85b68 aac_ac3_parser: Drop in-parser downmix functionality
request_channel_layout is a decoder option and it makes no sense
to have it in a parser.

This feature was needed in the past when the decoder was allowed
to reuse the avctx from the demuxer. Nowadays the decoder receives
only the parameters from it, already containing the real channel
layout (and the correct request_channel_layout option).

After initialization the decoder overwrites the channel layout
with the downmixed one that is actually output, so there is no need
to preserve this functionality in the parser.

Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2017-04-27 14:19:50 -04:00
James Almer
c7bf98d437 avprobe: use av_spherical_projection_name() to print spherical projection names
Signed-off-by: James Almer <jamrial@gmail.com>
2017-04-27 09:59:54 -04:00
James Almer
498864fe80 dump: use av_spherical_projection_name() to print spherical projection names
Signed-off-by: James Almer <jamrial@gmail.com>
2017-04-27 09:59:54 -04:00
James Almer
ad52eef997 spherical: add functions to retrieve and request projection names
Signed-off-by: James Almer <jamrial@gmail.com>
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2017-04-27 09:59:54 -04:00
Mark Thompson
7acb90333a vaapi: Add external control of allow-profile-mismatch
Uses the just-added ALLOW_PROFILE_MISMATCH flag.
2017-04-26 22:58:19 +01:00
Mark Thompson
64a5260c69 lavc: Add flag to allow profile mismatch with hardware decoding 2017-04-26 22:57:57 +01:00
Mark Thompson
6af014f402 vaapi_encode: Use gop_size consistently in RC parameters
The non-H.26[45] codecs already use this form.  Since we don't
currently generate I frames for codecs which support them separately
to IDR, the p_per_i variable is set to infinity by default so that it
doesn't interfere with any other calculation.  (All the code for I
frames still exists, and it works for H.264 if set manually.)
2017-04-26 22:00:33 +01:00
Vittorio Giovara
85c2bf9d2c avfoundation: update to use AVCodecParameters 2017-04-26 11:47:31 -04:00
Vittorio Giovara
94c54d97e7 mlp: Factor out channel layout subset checks 2017-04-26 11:21:27 -04:00