Commit Graph

44876 Commits

Author SHA1 Message Date
Sean McGovern
d7bdab1ad7 mov: log and return early on non-positive stsd entry counts
Based on an FFmpeg patch by Michael Niedermayer <michael@niedermayer.cc>
2017-07-30 10:51:12 -04:00
Anton Khirnov
b90fdb2c71 hevcdec: add a CUVID hwaccel 2017-07-28 14:12:56 +02:00
Anton Khirnov
770cf1dbc2 fate/hevc: specify output pixel format explicitly
This allows running those tests with hwaccel.
2017-07-28 14:12:36 +02:00
Anton Khirnov
00fd914d49 hevcdec: set the active SPS before calling get_format()
This way the SPS is available to the hwaccel init code.
2017-07-28 14:12:30 +02:00
Peter Große
a58873b111 avconv: when using -loop option bail out if seek to start fails
Fixes an infinite loop when a demuxer fails to seek to the start of the input.

Signed-off-by: Peter Große <pegro@friiks.de>
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2017-07-28 13:13:44 +02:00
Anton Khirnov
004ea63714 cuvid: add cuvid.h to SKIPHEADERS 2017-07-27 12:46:13 +02:00
Anton Khirnov
b9129ec466 h264dec: add a CUVID hwaccel
Some parts of the code are based on a patch by
Timo Rothenpieler <timo@rothenpieler.org>
2017-07-26 23:24:34 +02:00
Anton Khirnov
704311b294 decode: add a per-frame private data for hwaccel use
This will be useful in the CUVID hwaccel. It should also eventually
replace current decoder-specific mechanisms used by various other
hwaccels.
2017-07-26 23:24:14 +02:00
Anton Khirnov
badf0951f5 decode: add a mechanism for performing delayed processing on the decoded frames
This will be useful in the CUVID hwaccel.
2017-07-26 23:24:07 +02:00
Anton Khirnov
359a8a3e2d decode: add a method for attaching lavc-internal data to frames
Use the AVFrame.opaque_ref field. The original user's opaque_ref is
wrapped in the lavc struct and then unwrapped before the frame is
returned to the caller.

This new struct will be useful in the following commits.
2017-07-26 23:23:58 +02:00
Anton Khirnov
de77671438 decode: avoid leaks on failure in ff_get_buffer()
If the get_buffer() call fails, the frame might have some side data
already set. Make sure it gets freed.

CC: libav-stable@libav.org
2017-07-26 23:23:47 +02:00
Anton Mitrofanov
70946e6059 h264dec: Fix mix of lossless and lossy MBs decoding
CC: libav-stable@libav.org

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2017-07-26 23:23:19 +02:00
Anton Mitrofanov
18d3f36d3c h264_cabac: Fix CABAC+8x8dct in 4:4:4
Use the correct ctxIdxInc calculation for coded_block_flag.
Keep old behavior for old versions of x264 for backward compatibility.

CC: libav-stable@libav.org

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2017-07-26 23:23:18 +02:00
Yogender Kumar Gupta
79c6477c2a h264dec: fix Lossless Decoding (Profile 244) for 8x8 Intra Prediction
CC: libav-stable@libav.org

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2017-07-26 23:23:17 +02:00
Anton Khirnov
45c4bf3df0 h264dec: track the last seen value of x264_build
Do not use the one in the SEI directly as that is reset at certain
points.

Inspired by patches from Michael Niedermayer <michaelni@gmx.at> and
Anton Mitrofanov <BugMaster@narod.ru>.

CC: libav-stable@libav.org
2017-07-26 23:23:13 +02:00
wm4
45df7adc1d imgutils: add function to clear an image to black
Black isn't always just memset(ptr, 0, size). Limited YUV in particular
requires relatively non-obvious values, and filling a frame with
repeating 0 bytes is disallowed in some contexts. With component sizes
larger than 8 or packed YUV, this can become relatively complicated. So
having a generic function for this seems helpful.

In order to handle the complex cases in a generic way without destroying
performance, this code attempts to compute a black pixel, and then uses
that value to clear the image data quickly by using a function like
memset.

Common cases like yuv410p10 or rgba can't be handled with a simple
memset, so there is some code to fill memory with 2/4/8 byte patterns.
For the remaining cases, a generic slow fallback is used.

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2017-07-26 23:21:26 +02:00
wm4
47399ccdfd lavc, lavu: move frame cropping to a convenience function
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2017-07-26 23:20:40 +02:00
Sean McGovern
80e919b174 rmdec: add missing brackets to compound statement
Accidentally left out of 95ce02b35d.
2017-07-25 19:19:20 -04:00
Huang, Zhengxu
550cb6a85d lavf/vf_deinterlace_qsv: Enable the qsv deinterlace vpp
The current qsv deinterlace module does not work at all because MSDK needs user to pass
extra parameters to enable hint functions,such as denoise,deinterlace,composition and so on.

Usage:-hwaccel qsv -r 25 -c:v h264_qsv -i in -vf deinterlace_qsv=bob -b 2M
      -maxrate 3M -c:v h264_qsv -y out.h264

Signed-off-by: ChaoX A Liu <chaox.a.liu@gmail.com>
Signed-off-by: Zhengxu Huang <zhengxu.maxwell@gmail.com>
Signed-off-by: Andrew Zhang <huazh407@gmail.com>
Change-Id: I9e7ddcf884f2788c2820f6c98affacfb9d8f3287
Signed-off-by: Maxym Dmytrychenko <maxim.d33@gmail.com>
2017-07-25 13:27:52 +02:00
Huang, Zhengxu
2fd6e7d077 libavcodec/mjpeg_qsv: Add QSV MJPEG encoder
usage:
-hwaccel qsv -c:v h264_qsv -i in -c:v mjpeg_qsv -global_quality 80 -f
mjpeg out

Signed-off-by: ChaoX A Liu <chaox.a.liu@gmail.com>
Signed-off-by: Zhengxu Huang <zhengxu.maxwell@gmail.com>
Signed-off-by: Andrew Zhang <huazh407@gmail.com
Signed-off-by: Maxym Dmytrychenko <maxim.d33@gmail.com>
2017-07-25 13:27:43 +02:00
wm4
2b1324bd16 lavf: allow avformat_close_input() with NULL
This is consistent with how other destructors behave.

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2017-07-22 09:30:56 +02:00
wm4
9b9285bbf1 dxva: DXVA2_ModeHEVC_VLD_Main10 does not support Main
This mode apparently does not support decoding of HEVC Main (8 bit).
With D3D11 and Intel drivers on Windows 10 I get green corruption, while
using DXVA2_ModeHEVC_VLD_Main works.

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2017-07-22 09:30:56 +02:00
Anton Khirnov
48a5c35346 caf: add an Opus tag
CC: libav-stable@libav.org
2017-07-22 09:30:56 +02:00
Vittorio Giovara
ce1a99d870 hevc: Make sure to update the current frame transfer characteristic
Otherwise the first decoded frame will still be tagged with the
original transfer instead of the alternative one.

Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2017-07-21 20:44:05 +02:00
Sean McGovern
95ce02b35d rmdec: don't ignore the return value of av_get_packet() 2017-07-17 07:08:13 -04:00
Diego Biurrun
825e463a17 build: Add feature test macros for glibc 2.19+
glibc introduced _DEFAULT_SOURCE in version 2.19 to replace _BSD_SOURCE and
_SVID_SOURCE, which were deprecated in version 2.20. Add _DEFAULT_SOURCE
where the latter two are used to be forwards-compatible and avoid warnings
about the use of deprecated definitions.
2017-07-10 10:22:56 +02:00
Luca Barbato
0f5ad12ba2 flac: Use a local cache for decode_residual()
About an additional 4% speedup.

Signed-off-by: Diego Biurrun <diego@biurrun.de>
2017-07-09 20:51:24 +02:00
Luca Barbato
15f1cc09a4 flac: Postpone unlikely condition checks
About 2% speedup on gcc-6.3.

Signed-off-by: Diego Biurrun <diego@biurrun.de>
2017-07-09 20:49:57 +02:00
Alexandra Hájková
9c1e111406 flac: Convert to the new bitstream reader
Signed-off-by: Diego Biurrun <diego@biurrun.de>
2017-07-09 20:47:53 +02:00
Luca Barbato
79f64f7ebc bitstream: Avoid undefined behavior in bitstream_skip()
Do not use skip_remaining() to fully wipe the cache, as this could do
a 64-bit shift of a 64-bit variable which is undefined behavior in C.
Instead set the related variables to zero directly.

Thanks to Uoti for pointing out the problem.

CC: libav-stable@libav.org
2017-07-09 12:56:15 +02:00
Diego Biurrun
fd92dafaff bink: Split read_dct_coeffs()
This works around type aliasing violations and related warnings.
Also add some missing error checking.
2017-07-05 15:06:41 +02:00
Diego Biurrun
5be9939b46 fate: Add cinepak encoder vsynth tests 2017-07-05 13:05:54 +02:00
Diego Biurrun
ed3b2a999d cinepakenc: misc small changes
Avoid anonymously typedeffed structs and enums, drop an unused context member,
fix a small wording mishap, sizeof(type) ---> sizeof(*variable), drop a
needlessly verbose log message, use av_malloc_array() where appropriate.
2017-07-05 13:05:54 +02:00
Diego Biurrun
47cde2eabc cinepakenc: K&R formatting cosmetics 2017-07-05 13:05:54 +02:00
Timothy Gu
1e12730e5d cinepakenc: Stop using AVPicture 2017-07-05 13:05:54 +02:00
Diego Biurrun
b40236d954 cinepakenc: Drop broken debug code 2017-07-05 13:05:54 +02:00
addr-see-the-website@aetey.se
158d2e1545 cinepakenc: add option handling for flexibility
Now it is possible to adjust compression speed vs R/D when needed
and also skip vintage player compatibility at will.

Signed-off-by: Diego Biurrun <diego@biurrun.de>
2017-07-05 13:05:54 +02:00
addr-see-the-website@aetey.se
7da9f45231 cinepakenc: fixes and improvements
version 2013-02-08 Rl
- fixes/optimization in multistrip encoding and codebook size choice,
  quality/bitrate is now better than that of the binary proprietary encoder

version 2013-02-12 Rl
- separated codebook training sets, avoided the transfer of wasted bytes,
  which yields both better quality and smaller files
- now using the correct colorspace (TODO: move conversion to libswscale)

version 2013-02-14 Rl "Valentine's Day" version:
- made strip division more robust
- minimized bruteforcing the number of strips,
  (costs some R/D but speeds up compession a lot), the heuristic
  assumption is that score as a function of the number of strips has
  one wide minimum which moves slowly, of course not fully true
- simplified codebook generation,
  the old code was meant for other optimizations than we actually do
- optimized the codebook generation / error estimation for MODE_MC

version 2013-04-28 Rl
- bugfixed codebook optimization logic

version 2014-01-20 Rl
- made the encoder compatible with vintage decoders
  and added some yet unused code for possible future
  incremental codebook updates
- fixed a small memory leak

version 2014-01-21 Rl
- believe it or not, now we get even smaller files, with better quality
  (which means I missed an optimization earlier :)

Signed-off-by: Diego Biurrun <diego@biurrun.de>
2017-07-05 13:05:54 +02:00
Tomas Härdin
89e632de9b Add Cinepak encoder
With permission of Tomas Härdin applied by Rl aetey.se

Signed-off-by: Diego Biurrun <diego@biurrun.de>
2017-07-05 13:05:54 +02:00
Martin Storsjö
4d330da006 os_support: Use HAVE_UWP instead of manually checking WINAPI_FAMILY
Signed-off-by: Martin Storsjö <martin@martin.st>
2017-07-05 13:55:12 +03:00
Martin Storsjö
1912973a2d d3d11va: Check WINAPI_FAMILY instead of HAVE_LOADLIBRARY
If using the winstore compat library, a fallback LoadLibrary
function does exist, that only calls LoadPackagedLibrary though
(which doesn't work for dynamically loading d3d11 DLLs).

Therefore explicitly check the targeted API family instead.

Make this check a reusable HAVE_* component which other parts
of the libraries can check when necessary as well.

Signed-off-by: Martin Storsjö <martin@martin.st>
2017-07-05 13:55:11 +03:00
Martin Storsjö
61f589e31e lavf: Remove codec_tag from dashenc and smoothstreamingenc
Currently, the tags enforced and set on the segmenter muxer level
mismatch what the mp4/ismv muxer uses (since 713efb2c0d).

Skip the codec_tag altogether here, to let the user (try to) set
whichever codec/tag is preferred; the individual chained muxer will
reject invalid codecs anyway.

Signed-off-by: Martin Storsjö <martin@martin.st>
2017-07-02 22:42:26 +03:00
Vittorio Giovara
969f215957 hevc: Add support for alternative transfer characterics SEI
The use of this SEI is for backward compatibility in HLG HDR systems:
older devices that cannot interpret the "arib-std-b67" transfer will
get the compatible transfer (usually bt709 or bt2020) from the VUI,
while newer devices that can interpret HDR will read the SEI and use
its value instead.

Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2017-06-28 09:44:09 -04:00
Vittorio Giovara
a594f17f83 dvbsubdec: Free subrect memory on allocation error
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2017-06-28 09:44:09 -04:00
Lorenz Brun
1cfd566324 dvbsubdec: Fixed segfault when decoding subtitles
This fixes a segfault (originally found in Movian, but traced to libav)
when decoding subtitles because only an array of rects is allocated,
but not the actual structs it contains. The issue was probably
introduced in commit 2383323 where the loop to allocate the rects in
the array was thrown away.

Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2017-06-28 09:44:09 -04:00
Anton Khirnov
3fdf50f9e8 hwframe: Allow hwaccel frame allocators to align surface sizes
Hardware accelerated decoding generally uses AVHWFramesContext for pool
allocation of hardware surfaces. These are setup to allocate surfaces
aligned to hardware and hwaccel API requirements. Due to the
architecture, av_hwframe_get_buffer() will return AVFrames with
the dimensions set to the aligned sizes.

This causes some decoders (like hevc) return these aligned size as
final frame size, instead of cropping them to the video's actual
dimensions. To make sure this doesn't happen, crop the frame to the
size the decoder expects when ff_get_buffer() is called.

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2017-06-27 00:23:12 +02:00
wm4
068eaa534e dxva: verbose-log decoder GUID list
Helpful for debugging.

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2017-06-27 00:23:12 +02:00
wm4
cfc9e7c94e hwcontext_d3d11va: add option to enable debug mode
Basically copied from VLC (LGPL):

http://git.videolan.org/?p=vlc.git;a=blob;f=modules/video_output/win32/direct3d11.c;h=e9fcb83dcabfe778f26e63d19f218caf06a7c3ae;hb=HEAD#l1482
http://git.videolan.org/?p=vlc.git;a=blob;f=modules/codec/avcodec/d3d11va.c;h=85e7d25caebc059a9770da2ef4bb8fe90816d76d;hb=HEAD#l599

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2017-06-27 00:23:12 +02:00
wm4
5030e3856c dxva: support DXGI_FORMAT_420_OPAQUE decoding
Some devices (some phones, apparently) will support only this opaque
format. Of course this won't work with CLI, because copying data
directly is not supported.

Automatic frame allocation (setting AVCodecContext.hw_device_ctx) does
not support this mode, even if it's the only supported mode. But since
opaque surfaces are generally less useful, that's probably ok.

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2017-06-27 00:23:12 +02:00
wm4
98d73e4174 hwcontext_d3d11va: allocate staging texture lazily
Makes dealing with formats that can not be used for staging textures
easier (DXGI_FORMAT_420_OPAQUE). It also saves memory if the staging
texture is never needed, so this is a good thing.

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2017-06-27 00:23:12 +02:00