]> git.sesse.net Git - ffmpeg/log
ffmpeg
6 years agohevc: Validate the number of long term reference pictures
Mark Thompson [Fri, 23 Jun 2017 23:29:14 +0000 (00:29 +0100)]
hevc: Validate the number of long term reference pictures

This would overflow if the stream contained a value greater than the
maximum allowed by the standard (32).

6 years agohevc: Improve stream constraint values in common header
Mark Thompson [Fri, 23 Jun 2017 23:29:02 +0000 (00:29 +0100)]
hevc: Improve stream constraint values in common header

Add comments to describe the sources of the constraint values expressed here,
and add some more related values which will be used in following patches.

Fix the incorrect values for SPS and PPS count (they are not the same as those
used for H.264), and remove HEVC_MAX_CU_SIZE because it is not used anywhere.

6 years agoh264: Add stream constraint values to the common header
Mark Thompson [Fri, 23 Jun 2017 23:30:20 +0000 (00:30 +0100)]
h264: Add stream constraint values to the common header

With comments describing the derivation of each value.

6 years agomov: move stsd finalization to an appropriate place
Sean McGovern [Sat, 29 Jul 2017 23:17:16 +0000 (19:17 -0400)]
mov: move stsd finalization to an appropriate place

mov_finalize_stsd_codec() parses stream information from the ALAC extradata,
so run it after the extradata processing is completed in mov_read_stsd().

Fixes playback of 96kHz ALAC streams muxed by qaac or the reference alac encoder.

Adapted from an FFmpeg patch by Hendrik Leppkes <h.leppkes@gmail.com>

Bug-Id: 1072

6 years agomov: Do not set stsd_count if mov_read_stsd() fails
Sean McGovern [Fri, 28 Jul 2017 20:29:35 +0000 (16:29 -0400)]
mov: Do not set stsd_count if mov_read_stsd() fails

Based on an FFmpeg patch by Michael Niedermayer <michael@niedermayer.cc>

6 years agomov: log and return early on non-positive stsd entry counts
Sean McGovern [Fri, 28 Jul 2017 20:17:33 +0000 (16:17 -0400)]
mov: log and return early on non-positive stsd entry counts

Based on an FFmpeg patch by Michael Niedermayer <michael@niedermayer.cc>

6 years agohevcdec: add a CUVID hwaccel
Anton Khirnov [Sat, 11 Feb 2017 15:49:34 +0000 (16:49 +0100)]
hevcdec: add a CUVID hwaccel

6 years agofate/hevc: specify output pixel format explicitly
Anton Khirnov [Mon, 24 Jul 2017 09:42:09 +0000 (11:42 +0200)]
fate/hevc: specify output pixel format explicitly

This allows running those tests with hwaccel.

6 years agohevcdec: set the active SPS before calling get_format()
Anton Khirnov [Mon, 24 Jul 2017 09:41:31 +0000 (11:41 +0200)]
hevcdec: set the active SPS before calling get_format()

This way the SPS is available to the hwaccel init code.

6 years agoavconv: when using -loop option bail out if seek to start fails
Peter Große [Fri, 30 Jun 2017 15:28:53 +0000 (17:28 +0200)]
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>
6 years agocuvid: add cuvid.h to SKIPHEADERS
Anton Khirnov [Thu, 27 Jul 2017 10:42:03 +0000 (12:42 +0200)]
cuvid: add cuvid.h to SKIPHEADERS

6 years agoh264dec: add a CUVID hwaccel
Anton Khirnov [Sat, 11 Feb 2017 15:49:34 +0000 (16:49 +0100)]
h264dec: add a CUVID hwaccel

Some parts of the code are based on a patch by
Timo Rothenpieler <timo@rothenpieler.org>

6 years agodecode: add a per-frame private data for hwaccel use
Anton Khirnov [Sat, 1 Jul 2017 10:09:58 +0000 (12:09 +0200)]
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.

6 years agodecode: add a mechanism for performing delayed processing on the decoded frames
Anton Khirnov [Sat, 1 Jul 2017 10:09:58 +0000 (12:09 +0200)]
decode: add a mechanism for performing delayed processing on the decoded frames

This will be useful in the CUVID hwaccel.

6 years agodecode: add a method for attaching lavc-internal data to frames
Anton Khirnov [Sat, 1 Jul 2017 09:12:44 +0000 (11:12 +0200)]
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.

6 years agodecode: avoid leaks on failure in ff_get_buffer()
Anton Khirnov [Sat, 1 Jul 2017 09:32:56 +0000 (11:32 +0200)]
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
6 years agoh264dec: Fix mix of lossless and lossy MBs decoding
Anton Mitrofanov [Thu, 15 Jun 2017 22:56:16 +0000 (18:56 -0400)]
h264dec: Fix mix of lossless and lossy MBs decoding

CC: libav-stable@libav.org
Signed-off-by: Anton Khirnov <anton@khirnov.net>
6 years agoh264_cabac: Fix CABAC+8x8dct in 4:4:4
Anton Mitrofanov [Thu, 15 Jun 2017 22:56:14 +0000 (18:56 -0400)]
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>
6 years agoh264dec: fix Lossless Decoding (Profile 244) for 8x8 Intra Prediction
Yogender Kumar Gupta [Thu, 15 Jun 2017 22:56:13 +0000 (18:56 -0400)]
h264dec: fix Lossless Decoding (Profile 244) for 8x8 Intra Prediction

CC: libav-stable@libav.org
Signed-off-by: Anton Khirnov <anton@khirnov.net>
6 years agoh264dec: track the last seen value of x264_build
Anton Khirnov [Sat, 22 Jul 2017 12:52:27 +0000 (14:52 +0200)]
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
6 years agoimgutils: add function to clear an image to black
wm4 [Sat, 22 Jul 2017 21:05:14 +0000 (23:05 +0200)]
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>
6 years agolavc, lavu: move frame cropping to a convenience function
wm4 [Sat, 22 Jul 2017 21:05:13 +0000 (23:05 +0200)]
lavc, lavu: move frame cropping to a convenience function

Signed-off-by: Anton Khirnov <anton@khirnov.net>
6 years agormdec: add missing brackets to compound statement
Sean McGovern [Tue, 25 Jul 2017 22:04:32 +0000 (18:04 -0400)]
rmdec: add missing brackets to compound statement

Accidentally left out of 95ce02b35d3d1bb16111031df1d82a6e4d894d36.

6 years agolavf/vf_deinterlace_qsv: Enable the qsv deinterlace vpp
Huang, Zhengxu [Thu, 20 Jul 2017 08:16:44 +0000 (16:16 +0800)]
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>
6 years agolibavcodec/mjpeg_qsv: Add QSV MJPEG encoder
Huang, Zhengxu [Fri, 21 Jul 2017 04:12:44 +0000 (12:12 +0800)]
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>
6 years agolavf: allow avformat_close_input() with NULL
wm4 [Sun, 16 Jul 2017 10:43:09 +0000 (12:43 +0200)]
lavf: allow avformat_close_input() with NULL

This is consistent with how other destructors behave.

Signed-off-by: Anton Khirnov <anton@khirnov.net>
6 years agodxva: DXVA2_ModeHEVC_VLD_Main10 does not support Main
wm4 [Mon, 10 Jul 2017 13:59:38 +0000 (15:59 +0200)]
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>
6 years agocaf: add an Opus tag
Anton Khirnov [Sat, 1 Jul 2017 08:49:58 +0000 (10:49 +0200)]
caf: add an Opus tag

CC: libav-stable@libav.org
6 years agohevc: Make sure to update the current frame transfer characteristic
Vittorio Giovara [Thu, 20 Jul 2017 12:43:53 +0000 (14:43 +0200)]
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>
6 years agormdec: don't ignore the return value of av_get_packet()
Sean McGovern [Wed, 12 Jul 2017 23:45:46 +0000 (19:45 -0400)]
rmdec: don't ignore the return value of av_get_packet()

6 years agobuild: Add feature test macros for glibc 2.19+
Diego Biurrun [Sat, 8 Jul 2017 11:18:39 +0000 (13:18 +0200)]
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.

6 years agoflac: Use a local cache for decode_residual()
Luca Barbato [Sat, 29 Apr 2017 02:15:32 +0000 (02:15 +0000)]
flac: Use a local cache for decode_residual()

About an additional 4% speedup.

Signed-off-by: Diego Biurrun <diego@biurrun.de>
6 years agoflac: Postpone unlikely condition checks
Luca Barbato [Sat, 29 Apr 2017 02:15:31 +0000 (02:15 +0000)]
flac: Postpone unlikely condition checks

About 2% speedup on gcc-6.3.

Signed-off-by: Diego Biurrun <diego@biurrun.de>
6 years agoflac: Convert to the new bitstream reader
Alexandra Hájková [Sat, 29 Apr 2017 02:15:30 +0000 (02:15 +0000)]
flac: Convert to the new bitstream reader

Signed-off-by: Diego Biurrun <diego@biurrun.de>
6 years agobitstream: Avoid undefined behavior in bitstream_skip()
Luca Barbato [Sat, 8 Jul 2017 19:04:44 +0000 (21:04 +0200)]
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
6 years agobink: Split read_dct_coeffs()
Diego Biurrun [Wed, 5 Jul 2017 13:03:56 +0000 (15:03 +0200)]
bink: Split read_dct_coeffs()

This works around type aliasing violations and related warnings.
Also add some missing error checking.

6 years agofate: Add cinepak encoder vsynth tests
Diego Biurrun [Tue, 27 Jun 2017 22:27:19 +0000 (00:27 +0200)]
fate: Add cinepak encoder vsynth tests

6 years agocinepakenc: misc small changes
Diego Biurrun [Tue, 27 Jun 2017 22:27:18 +0000 (00:27 +0200)]
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.

6 years agocinepakenc: K&R formatting cosmetics
Diego Biurrun [Tue, 27 Jun 2017 22:27:17 +0000 (00:27 +0200)]
cinepakenc: K&R formatting cosmetics

6 years agocinepakenc: Stop using AVPicture
Timothy Gu [Tue, 27 Jun 2017 22:27:15 +0000 (00:27 +0200)]
cinepakenc: Stop using AVPicture

6 years agocinepakenc: Drop broken debug code
Diego Biurrun [Tue, 27 Jun 2017 22:27:14 +0000 (00:27 +0200)]
cinepakenc: Drop broken debug code

6 years agocinepakenc: add option handling for flexibility
addr-see-the-website@aetey.se [Tue, 27 Jun 2017 22:27:13 +0000 (00:27 +0200)]
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>
6 years agocinepakenc: fixes and improvements
addr-see-the-website@aetey.se [Tue, 27 Jun 2017 22:27:12 +0000 (00:27 +0200)]
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>
6 years agoAdd Cinepak encoder
Tomas Härdin [Tue, 27 Jun 2017 22:27:11 +0000 (00:27 +0200)]
Add Cinepak encoder

With permission of Tomas Härdin applied by Rl aetey.se

Signed-off-by: Diego Biurrun <diego@biurrun.de>
6 years agoos_support: Use HAVE_UWP instead of manually checking WINAPI_FAMILY
Martin Storsjö [Wed, 5 Jul 2017 09:36:03 +0000 (12:36 +0300)]
os_support: Use HAVE_UWP instead of manually checking WINAPI_FAMILY

Signed-off-by: Martin Storsjö <martin@martin.st>
6 years agod3d11va: Check WINAPI_FAMILY instead of HAVE_LOADLIBRARY
Martin Storsjö [Tue, 4 Jul 2017 17:03:00 +0000 (20:03 +0300)]
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>
6 years agolavf: Remove codec_tag from dashenc and smoothstreamingenc
Martin Storsjö [Fri, 30 Jun 2017 09:49:49 +0000 (12:49 +0300)]
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 713efb2c0d013).

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>
7 years agohevc: Add support for alternative transfer characterics SEI
Vittorio Giovara [Fri, 9 Jun 2017 21:27:22 +0000 (17:27 -0400)]
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>
7 years agodvbsubdec: Free subrect memory on allocation error
Vittorio Giovara [Tue, 13 Jun 2017 15:35:16 +0000 (11:35 -0400)]
dvbsubdec: Free subrect memory on allocation error

Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
7 years agodvbsubdec: Fixed segfault when decoding subtitles
Lorenz Brun [Fri, 21 Oct 2016 20:51:37 +0000 (22:51 +0200)]
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>
7 years agohwframe: Allow hwaccel frame allocators to align surface sizes
Anton Khirnov [Thu, 22 Jun 2017 18:05:12 +0000 (20:05 +0200)]
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>
7 years agodxva: verbose-log decoder GUID list
wm4 [Thu, 22 Jun 2017 12:52:59 +0000 (14:52 +0200)]
dxva: verbose-log decoder GUID list

Helpful for debugging.

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
7 years agohwcontext_d3d11va: add option to enable debug mode
wm4 [Thu, 22 Jun 2017 12:52:57 +0000 (14:52 +0200)]
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>
7 years agodxva: support DXGI_FORMAT_420_OPAQUE decoding
wm4 [Thu, 22 Jun 2017 12:52:56 +0000 (14:52 +0200)]
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>
7 years agohwcontext_d3d11va: allocate staging texture lazily
wm4 [Thu, 22 Jun 2017 12:52:55 +0000 (14:52 +0200)]
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>
7 years agohwcontext_d3d11va: fix crash on frames_init failure
wm4 [Thu, 22 Jun 2017 12:52:54 +0000 (14:52 +0200)]
hwcontext_d3d11va: fix crash on frames_init failure

It appears in this case, frames_ininit is called twice (once by
av_hwframe_ctx_init(), and again by unreffing the frames ctx ref).

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
7 years agodxva: fix some warnings
wm4 [Thu, 22 Jun 2017 12:52:53 +0000 (14:52 +0200)]
dxva: fix some warnings

Some existed since forever, some are new.

The cast in get_surface() is silly, but unless we change the av_log
function signature, or all callers of ff_dxva2_get_surface_index(), it's
needed to remove the const warning.

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
7 years agodxva: add declarative profile checks
wm4 [Thu, 22 Jun 2017 12:52:52 +0000 (14:52 +0200)]
dxva: add declarative profile checks

Make supported codec profiles part of each dxva_modes entry. Every DXVA2
mode is representative for a codec with a subset of supported profiles,
so reflecting that in dxva_modes seems appropriate.

In practice, this will more strictly check MPEG2 profiles, will stop
relying on the surface format checks for selecting the correct HEVC
profile, and remove the verbose messages for mismatching H264/HEVC
profiles. Instead of the latter, it will now print the more nebulous "No
decoder device for codec found" verbose message.

This also respects AV_HWACCEL_FLAG_ALLOW_PROFILE_MISMATCH. Move the
Main10 HEVC entry before the normal one to make this work better.

Originally inspired by VLC's code.

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
7 years agoconfigure: Reset X86ASM_DEP(FLAGS) when probing for the assembler program
Diego Biurrun [Sat, 24 Jun 2017 15:51:02 +0000 (17:51 +0200)]
configure: Reset X86ASM_DEP(FLAGS) when probing for the assembler program

These variables might be set from a previous probe run, but one or the
other program that is probed for may not grok the flags, resulting in
errors during assembling when the values of those variables are passed
to the assembler.

7 years agonvenc: Minimize the surface allocation
Ben Chang [Sat, 24 Jun 2017 12:17:14 +0000 (12:17 +0000)]
nvenc: Minimize the surface allocation

The previous default sets the allocated surfaces to 32 unless it is
user-overridden or the lookahead parameter is set.

Change the surfaces calculation for default, B-frames and lookahead scenario.

7 years agonvenc: Use a fifo to manage the free surface pool
Ben Chang [Sat, 24 Jun 2017 12:14:22 +0000 (12:14 +0000)]
nvenc: Use a fifo to manage the free surface pool

Previously, if a session allocates x surfaces, only x-1 surfaces are
used (due to combination of output delay and lock toggle logic).

7 years agonvenc: Add an explicit auto alias
Ben Chang [Sat, 24 Jun 2017 12:10:10 +0000 (12:10 +0000)]
nvenc: Add an explicit auto alias

7 years agobuild: Add an option for passing linker flags to the shared library build
Janne Grunau [Tue, 20 Jun 2017 17:25:43 +0000 (19:25 +0200)]
build: Add an option for passing linker flags to the shared library build

Also employ this mechanism to pass $libdir to the runtime library search
path if rpath is enabled. This fixes underlinking of some test binaries
on some systems.

7 years agoconfigure: Automatically add -isysroot for darwin if --sysroot is specified
Martin Storsjö [Wed, 21 Jun 2017 13:54:22 +0000 (16:54 +0300)]
configure: Automatically add -isysroot for darwin if --sysroot is specified

Check the existing flags in the cc/cflags/cppflags/ldflags for
occurrances of -isysroot; if none is found but --sysroot was specified,
set -isysroot to the same value as --sysroot.

This simplifies configuring cross-builds for iOS, if the global
environment variable SDKROOT isn't set.

Signed-off-by: Martin Storsjö <martin@martin.st>
7 years agoaf_bs2b: Add missing casts to complex pointer assignments
Diego Biurrun [Mon, 12 Jun 2017 20:12:17 +0000 (22:12 +0200)]
af_bs2b: Add missing casts to complex pointer assignments

Fixes several warnings of the type:
libavfilter/af_bs2b.c:171:22: warning: assignment from incompatible pointer type

7 years agotls_gnutls: Readd support for nonblocking operation
Martin Storsjö [Mon, 19 Jun 2017 12:49:25 +0000 (15:49 +0300)]
tls_gnutls: Readd support for nonblocking operation

The rtmp protocol uses nonblocking reads, to poll for incoming
messages from the server while publishing a stream.

Prior to 94599a6de3822b13c94096d764868128f388ba28 and
d13b124eaf452b267480074b2e6946538ed03a6e, the tls protocol
handled the nonblocking flag, mostly as a side effect from not
using custom IO callbacks for reading from the socket. When custom
IO callbacks were taken into use in
d15eec4d6bdfa3bd4c4b5b7dd2dbd699ba253d02, the handling of a nonblocking
socket wasn't necessary for the default blocking mode any longer.

The code was simplified, since it was overlooked that other code
within libavformat actually used the tls protocol in nonblocking mode.

This fixes publishing over rtmps, with the gnutls backend.

Signed-off-by: Martin Storsjö <martin@martin.st>
7 years agotls_openssl: Readd support for nonblocking operation
Martin Storsjö [Mon, 19 Jun 2017 12:45:08 +0000 (15:45 +0300)]
tls_openssl: Readd support for nonblocking operation

The rtmp protocol uses nonblocking reads, to poll for incoming
messages from the server while publishing a stream.

Prior to 94599a6de3822b13c94096d764868128f388ba28 and
d13b124eaf452b267480074b2e6946538ed03a6e, the tls protocol
handled the nonblocking flag, mostly as a side effect from not
using custom IO callbacks for reading from the socket. When custom
IO callbacks were taken into use in
d15eec4d6bdfa3bd4c4b5b7dd2dbd699ba253d02, the handling of a nonblocking
socket wasn't necessary for the default blocking mode any longer.

The code was simplified, since it was overlooked that other code
within libavformat actually used the tls protocol in nonblocking mode.

This fixes publishing over rtmps, with the openssl backend.

Signed-off-by: Martin Storsjö <martin@martin.st>
7 years agomovenc: allow alternative hvc1 h.265 codec tag
John Stebbins [Thu, 15 Jun 2017 18:47:16 +0000 (11:47 -0700)]
movenc: allow alternative hvc1 h.265 codec tag

If AVCodecParameters.codec_tag is 'hvc1' use it instead of 'hev1' for
h.265 streams. QuickTime (and other Apple software) requires 'hvc1'.

7 years agomovenc: write correct format hvcc when tag is hvc1
John Stebbins [Thu, 15 Jun 2017 18:41:15 +0000 (11:41 -0700)]
movenc: write correct format hvcc when tag is hvc1

7 years agomovenc: move tags definitions to where they are used
John Stebbins [Mon, 19 Jun 2017 14:53:45 +0000 (07:53 -0700)]
movenc: move tags definitions to where they are used

7 years agomovenc: simplify codec_tag lookup
John Stebbins [Mon, 19 Jun 2017 14:46:48 +0000 (07:46 -0700)]
movenc: simplify codec_tag lookup

mux.c init_muxer() already sets codec_tag correctly in the cases
simplified here.

This also adds the capability to support alternative tags for the
same codec_id.

7 years agomovenc: use correct tag list for AVOutputFormat.codec_tag
John Stebbins [Thu, 15 Jun 2017 18:20:48 +0000 (11:20 -0700)]
movenc: use correct tag list for AVOutputFormat.codec_tag

ff_mp4_obj_type contains the wrong type of tags for
AVOutputFormat.codec_tag. AVOutputFormat.codec_tag is used to
validate AVCodecParameters.codec_tag so needs to be the same
type of tag.

Creates new tag lists for mp4 and ismv.  New tag lists support
same list of codecs found in ff_mp4_obj_type. psp uses the same
tag list as mp4 since these both use mp4_get_codec_tag to look up tags.

7 years agoaarch64: vp9: Fix assembling with Xcode 6.2 and older
Memphiz [Sun, 18 Jun 2017 10:30:16 +0000 (12:30 +0200)]
aarch64: vp9: Fix assembling with Xcode 6.2 and older

Properly use the b.eq/b.ge forms instead of the nonstandard forms
(which both gas and newer clang accept though), and expand the
register list that used a range (which the Xcode 6.2 clang, based
on clang 3.5 svn, didn't support).

Signed-off-by: Martin Storsjö <martin@martin.st>
7 years agodoc: Drop the legacy symlink to README
Luca Barbato [Tue, 13 Jun 2017 23:40:40 +0000 (01:40 +0200)]
doc: Drop the legacy symlink to README

Windows does not like symlinks and README.md is pretty common nowadays.

7 years agod3d11va: Link directly to dxgi.dll and d3d11.dll functions if LoadLibrary is unavailable
Martin Storsjö [Fri, 9 Jun 2017 09:05:00 +0000 (12:05 +0300)]
d3d11va: Link directly to dxgi.dll and d3d11.dll functions if LoadLibrary is unavailable

When targeting the UWP API subset, the LoadLibrary function is not
available (and the fallback, LoadPackagedLibrary, can't be used to
load system DLLs). In these cases, link directly to the functions
in the DLLs instead of trying to load them dynamically at runtime.

Signed-off-by: Martin Storsjö <martin@martin.st>
7 years agoavconv_hw: Free device on initialisation failure
Mark Thompson [Fri, 16 Jun 2017 22:18:55 +0000 (23:18 +0100)]
avconv_hw: Free device on initialisation failure

7 years agovf_hwmap: Properly free a locally derived device
Mark Thompson [Fri, 16 Jun 2017 22:11:51 +0000 (23:11 +0100)]
vf_hwmap: Properly free a locally derived device

7 years agovf_hwmap: Add missing error code
Mark Thompson [Fri, 16 Jun 2017 22:08:47 +0000 (23:08 +0100)]
vf_hwmap: Add missing error code

7 years agoconfigure: Fix handling of _select dependencies
Diego Biurrun [Wed, 24 May 2017 15:59:59 +0000 (17:59 +0200)]
configure: Fix handling of _select dependencies

The handling of _select dependencies had two issues:

1) extralibs from _select dependencies of a component were not added to
   the list of extralibs for that component.
2) extralibs from dependencies were only added to the extralibs of a
   component if the component was enabled. This led to incorrect results
   if that component was enabled by another component later in the dependency
   resolution process. Instead, always generate the full list of component
   extralibs for use later in the dependency resolution process.

Also remove a leftover unused variable.

7 years agobuild: Adjust dependencies for faan(i)dct components
Diego Biurrun [Mon, 12 Jun 2017 19:33:35 +0000 (21:33 +0200)]
build: Adjust dependencies for faan(i)dct components

7 years agoconfigure: Factorize qsv dependencies
Diego Biurrun [Tue, 6 Jun 2017 15:41:11 +0000 (17:41 +0200)]
configure: Factorize qsv dependencies

7 years agoconfigure: Add missing arch dependencies for arch extensions
Diego Biurrun [Tue, 6 Jun 2017 17:06:10 +0000 (19:06 +0200)]
configure: Add missing arch dependencies for arch extensions

7 years agoconfigure: Add x86 dependency for mmx_internal
Diego Biurrun [Tue, 6 Jun 2017 16:56:24 +0000 (18:56 +0200)]
configure: Add x86 dependency for mmx_internal

This ensures that mmx_internal is only ever enabled on x86.

7 years agobuild: Add missing idctdsp dependency for clearvideo
Diego Biurrun [Wed, 7 Jun 2017 10:48:00 +0000 (12:48 +0200)]
build: Add missing idctdsp dependency for clearvideo

7 years agobuild: Add missing mpeg4audio dependency for RTP muxer
Diego Biurrun [Sun, 11 Jun 2017 21:50:24 +0000 (23:50 +0200)]
build: Add missing mpeg4audio dependency for RTP muxer

7 years agohwcontext: Mark local table static const
Mark Thompson [Tue, 13 Jun 2017 21:27:31 +0000 (22:27 +0100)]
hwcontext: Mark local table static const

7 years agolibfdk-aacdec: Correct buffer_size parameter
Michael Niedermayer [Thu, 25 May 2017 01:21:50 +0000 (03:21 +0200)]
libfdk-aacdec: Correct buffer_size parameter

The timeDataSize argument to aacDecoder_DecodeFrame() seems undocumented
and until 2016 04 (203e3f28fbebec7011342017fafc2a0bda0ce530) unused.
After that commit libfdk-aacdec interprets it as size in sample units
and memsets that on error.

FFmpeg as well as others (like GStreamer) did interpret it as size in
bytes.

Fixes: 1442/clusterfuzz-testcase-minimized-4540199973421056 (This requires recent libfdk to reproduce)
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Martin Storsjö <martin@martin.st>
7 years agommal: Add missing .item_name to AVClass declaration
Diego Biurrun [Mon, 12 Jun 2017 09:01:14 +0000 (11:01 +0200)]
mmal: Add missing .item_name to AVClass declaration

7 years agoconfigure: Simplify AltiVec/VSX check with a helper function
Diego Biurrun [Fri, 26 May 2017 17:04:51 +0000 (19:04 +0200)]
configure: Simplify AltiVec/VSX check with a helper function

7 years agoppc: Drop support for Apple GCC
Diego Biurrun [Mon, 12 Jun 2017 09:48:57 +0000 (11:48 +0200)]
ppc: Drop support for Apple GCC

Apple GCC has not been a thing anymore on PowerPC since many years.

7 years agoConvert all AVClass struct declarations to designated initializers.
Diego Biurrun [Sat, 10 Jun 2017 14:45:06 +0000 (16:45 +0200)]
Convert all AVClass struct declarations to designated initializers.

7 years agonvenc: Add default value for AVCodecContext::refs
Srinath K R [Thu, 8 Jun 2017 09:13:54 +0000 (14:43 +0530)]
nvenc: Add default value for AVCodecContext::refs

AVCodecContext::refs is used to control the DPB size to be used by the
encoder. The default value for AVCodecContext::refs as set in
libavcodec/options_table.h is 1.

This patch sets AVCodecContext::refs to 0 for h264_nvenc and hevc_nvenc in
order to let the driver take the decision of the correct DPB size to use in
all cases.

Signed-off-by: Srinath K R <skr@nvidia.com>
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
7 years agodxva: add support for new dxva2 and d3d11 hwaccel APIs
wm4 [Wed, 7 Jun 2017 15:11:17 +0000 (17:11 +0200)]
dxva: add support for new dxva2 and d3d11 hwaccel APIs

This also adds support to avconv (which is trivial due to the new
hwaccel API being generic enough).

The new decoder setup code in dxva2.c is significantly based on work by
Steve Lhomme <robux4@gmail.com>, but with heavy changes/rewrites.

Signed-off-by: Diego Biurrun <diego@biurrun.de>
7 years agodxva: move d3d11 locking/unlocking to functions
wm4 [Tue, 6 Jun 2017 16:51:10 +0000 (18:51 +0200)]
dxva: move d3d11 locking/unlocking to functions

I want to make it non-mandatory to set a mutex in the D3D11 device
context, and replacing it with user callbacks seems like the best
solution. This is preparation for it. Also makes the code slightly more
readable.

Signed-off-by: Diego Biurrun <diego@biurrun.de>
7 years agodxva: preparations for new hwaccel API
wm4 [Tue, 6 Jun 2017 16:51:09 +0000 (18:51 +0200)]
dxva: preparations for new hwaccel API

The actual hwaccel code will need to access an internal context instead
of avctx->hwaccel_context, so add a new DXVA_CONTEXT() macro, that will
dispatch between the "old" external and the new internal context.

Also, the new API requires a new D3D11 pixfmt, so all places which check
for the pixfmt need to be adjusted. Introduce a ff_dxva2_is_d3d11()
function, which does the check.

Signed-off-by: Diego Biurrun <diego@biurrun.de>
7 years agolavc: set avctx->hwaccel before init
wm4 [Tue, 6 Jun 2017 16:51:08 +0000 (18:51 +0200)]
lavc: set avctx->hwaccel before init

So a hwaccel can access avctx->hwaccel in init for whatever reason. This
is for the new d3d hwaccel API. We could create separate entrypoints for
each of the 3 hwaccel types (dxva2, d3d11va, new d3d11va), but this
seems nicer.

Signed-off-by: Diego Biurrun <diego@biurrun.de>
7 years agolavu: add new D3D11 pixfmt and hwcontext
wm4 [Tue, 6 Jun 2017 16:51:07 +0000 (18:51 +0200)]
lavu: add new D3D11 pixfmt and hwcontext

To be used with the new d3d11 hwaccel decode API.

With the new hwaccel API, we don't want surfaces to depend on the
decoder (other than the required dimension and format). The old D3D11VA
pixfmt uses ID3D11VideoDecoderOutputView pointers, which include the
decoder configuration, and thus is incompatible with the new hwaccel
API. This patch introduces AV_PIX_FMT_D3D11, which uses ID3D11Texture2D
and an index. It's simpler and compatible with the new hwaccel API.

The introduced hwcontext supports only the new pixfmt.

Frame upload code untested.

Significantly based on work by Steve Lhomme <robux4@gmail.com>, but with
heavy changes/rewrites.

Signed-off-by: Diego Biurrun <diego@biurrun.de>
7 years agoconfigure: Bail out if both GnuTLS and OpenSSL are enabled
Diego Biurrun [Fri, 26 May 2017 11:05:12 +0000 (13:05 +0200)]
configure: Bail out if both GnuTLS and OpenSSL are enabled

Both libraries provide similar functionality and cannot be used together.
When both are enabled one is used and the other ignored arbitrarily. Error
out instead and have the user choose which library to use.

7 years agoconfigure: Move x86 assembler sanity check into assembler probe function
Diego Biurrun [Mon, 22 May 2017 12:48:15 +0000 (14:48 +0200)]
configure: Move x86 assembler sanity check into assembler probe function

This allows for more graceful fallback from NASM to Yasm if the available
NASM version is too old.

7 years agobuild: Add missing zlib dependencies for several protocols
Diego Biurrun [Tue, 14 Mar 2017 15:44:24 +0000 (16:44 +0100)]
build: Add missing zlib dependencies for several protocols