]> git.sesse.net Git - ffmpeg/log
ffmpeg
6 years agoavfomat/hlsenc: support fmp4 format in hls
Steven Liu [Mon, 3 Jul 2017 12:20:44 +0000 (20:20 +0800)]
avfomat/hlsenc: support fmp4 format in hls

add the fmp4 format into hlsenc
because the fmp4 format add into hls from version 7.
the spec link is:
https://tools.ietf.org/html/draft-pantos-http-live-streaming-20
and the describe on WWDC
https://developer.apple.com/videos/play/wwdc2017/515/

Signed-off-by: Steven Liu <lq@onvideo.cn>
6 years agovdpau: do not use buggy HEVC support by default
wm4 [Sat, 1 Jul 2017 09:40:10 +0000 (11:40 +0200)]
vdpau: do not use buggy HEVC support by default

NVIDIA broke its own API when using VDPAU decoding. If you retrieve the
decoded YUV data, or if you map the surfaces with GL interop, the result
are interlacing artifacts. The only way to get non-broken data is by
using the vdpau video mixer to convert it to RGB. There is no way to
block the non-working operations in a reasonable way (a VdpVideoSurface
has to support all operations).

NVIDIA refuses to fix this issue (they "fixed" it by making it work with
the video mixer, but the rest is still broken). There is no sign of that
changing.

Do not use HEVC by default with the generic hwaccle API. Detect whether
it's the NVIDIA native implementation, and exit with an error. (The same
thing work with the MESA implementation.)

As an escape hatch and to allow applications to use the decoder if they
really want to (perhaps because they make sure to explicitly use the
video mixer), reuse AV_HWACCEL_FLAG_ALLOW_PROFILE_MISMATCH to disable
this check.

Once NVIDIA fixes the bug, working driver versions could be detected,
and it could be allowed again.

6 years agoavcodec/alsdec: call correct function for multi-channel coding
Paul B Mahol [Sat, 1 Jul 2017 20:19:37 +0000 (22:19 +0200)]
avcodec/alsdec: call correct function for multi-channel coding

Fixes #5942.

Signed-off-by: Paul B Mahol <onemda@gmail.com>
6 years agoavcodec/imc: cast float to int prior to comparing with int variable
Kostya Shishkov [Mon, 26 Jun 2017 10:41:13 +0000 (12:41 +0200)]
avcodec/imc: cast float to int prior to comparing with int variable

Update FATE test.

Fixes #3886.

Signed-off-by: Paul B Mahol <onemda@gmail.com>
6 years agoavcodec/s302m: fix AVOption flags
foo86 [Tue, 27 Jun 2017 09:59:15 +0000 (12:59 +0300)]
avcodec/s302m: fix AVOption flags

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
6 years agocheckasm: randomize the full input buffer in test_hybrid_analysis
James Almer [Sat, 1 Jul 2017 01:33:04 +0000 (22:33 -0300)]
checkasm: randomize the full input buffer in test_hybrid_analysis

Missed in the last commit.

6 years agocheckasm: fix size of input buffer in test_hybrid_analysis
James Almer [Fri, 30 Jun 2017 23:37:06 +0000 (20:37 -0300)]
checkasm: fix size of input buffer in test_hybrid_analysis

6 years agohevcdec: properly export some side data with frame threading
wm4 [Thu, 29 Jun 2017 13:36:55 +0000 (15:36 +0200)]
hevcdec: properly export some side data with frame threading

I noticed this with mastering display data. If frame threading is
enabled, this side data is exported only for some frames. It turns out
it's not properly propagated to the worker threads.

I didn't touch A53 captions, because that involves memory allocation and
freeing the data as side data is exported.

Micro bump so that API users can detect the bug fix.

6 years agox86/sbrdsp: sign extend start and end gprs in ff_sbr_hf_gen_sse
James Almer [Fri, 30 Jun 2017 01:51:04 +0000 (22:51 -0300)]
x86/sbrdsp: sign extend start and end gprs in ff_sbr_hf_gen_sse

Tested-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: James Almer <jamrial@gmail.com>
6 years agoavcodec/hevc_ps: Fix integer overflow with beta/tc offsets
Michael Niedermayer [Fri, 30 Jun 2017 14:23:32 +0000 (16:23 +0200)]
avcodec/hevc_ps: Fix integer overflow with beta/tc offsets

Fixes: runtime error: signed integer overflow: 2113929216 * 2 cannot be represented in type 'int'
Fixes: 2422/clusterfuzz-testcase-minimized-5242114713583616
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
6 years agolibavformat/avformat.h: Move docs inside of #if
Max Weber [Fri, 30 Jun 2017 05:58:41 +0000 (23:58 -0600)]
libavformat/avformat.h: Move docs inside of #if

Otherwise AVTimebaseSource gets av_apply_bitstream_filters' documentation in doxygen.

Signed-off-by: Max Weber <mii7303@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
6 years agoavfilter/vf_geq: >8 bps support
Michael Niedermayer [Fri, 30 Jun 2017 10:16:04 +0000 (12:16 +0200)]
avfilter/vf_geq: >8 bps support

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
6 years agoavcodec/interplayvideo: Check ff_get_buffer() for failure
Michael Niedermayer [Fri, 30 Jun 2017 01:31:54 +0000 (03:31 +0200)]
avcodec/interplayvideo: Check ff_get_buffer() for failure

Fixes: runtime error: division by zero
Fixes: 2408/clusterfuzz-testcase-minimized-5432734438653952
Fixes: 2415/clusterfuzz-testcase-minimized-4672827619803136
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
6 years agofate: Add fate-copy-trac3074
Michael Niedermayer [Thu, 29 Jun 2017 22:40:17 +0000 (00:40 +0200)]
fate: Add fate-copy-trac3074

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
6 years agolavu/cpu: disable MMX warning on non x86 platforms
Clément Bœsch [Wed, 28 Jun 2017 13:20:45 +0000 (15:20 +0200)]
lavu/cpu: disable MMX warning on non x86 platforms

We have AV_CPU_FLAG_ARMV8 == AV_CPU_FLAG_SSE3 which causes a trigger of
this MMX warning on AArch64.

6 years agoavcodec/interplayvideo: fix regression causing artifacts
Paul B Mahol [Thu, 29 Jun 2017 14:42:14 +0000 (16:42 +0200)]
avcodec/interplayvideo: fix regression causing artifacts

Signed-off-by: Paul B Mahol <onemda@gmail.com>
6 years agoavcodec/gdv: add decompression for 2 and 5 method
Paul B Mahol [Wed, 28 Jun 2017 17:24:29 +0000 (19:24 +0200)]
avcodec/gdv: add decompression for 2 and 5 method

Signed-off-by: Paul B Mahol <onemda@gmail.com>
6 years agoUpdate mp4 object type for VP9
KongQun Yang [Wed, 28 Jun 2017 21:47:34 +0000 (14:47 -0700)]
Update mp4 object type for VP9

Updated to the standard value 0xB1 defined in mp4ra.org.

Signed-off-by: James Almer <jamrial@gmail.com>
6 years agoavcodec/cfhd: Fix invalid left shift of negative value
Michael Niedermayer [Wed, 28 Jun 2017 18:47:59 +0000 (20:47 +0200)]
avcodec/cfhd: Fix invalid left shift of negative value

Fixes: runtime error: left shift of negative value -1
Fixes: 2395/clusterfuzz-testcase-minimized-6540529313513472
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
6 years agoavcodec/vb: Check vertical GMC component before multiply
Michael Niedermayer [Wed, 28 Jun 2017 18:29:02 +0000 (20:29 +0200)]
avcodec/vb: Check vertical GMC component before multiply

Fixes: runtime error: signed integer overflow: 8224 * 663584 cannot be represented in type 'int'
Fixes: 2393/clusterfuzz-testcase-minimized-6128334993883136
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
6 years agoavcodec/interplayvideo: use correct context when checking for enough bytes
Paul B Mahol [Wed, 28 Jun 2017 17:35:57 +0000 (19:35 +0200)]
avcodec/interplayvideo: use correct context when checking for enough bytes

Fixes #6502.

Signed-off-by: Paul B Mahol <onemda@gmail.com>
6 years agoavcodec/x86: use new x86-64 functions for -idct simple
James Darnley [Mon, 19 Jun 2017 12:55:53 +0000 (14:55 +0200)]
avcodec/x86: use new x86-64 functions for -idct simple

They now match according to FATE, barring any further bugs with untested
parts

6 years agoavcodec/x86: add an 8-bit simple IDCT function based on the x86-64 high depth functions
James Darnley [Fri, 2 Jun 2017 13:20:19 +0000 (15:20 +0200)]
avcodec/x86: add an 8-bit simple IDCT function based on the x86-64 high depth functions

Includes add/put functions

Rounding contributed by Ronald S. Bultje

6 years agoavcodec/x86: allow future 8-bit simple idct to have "DC only hack"
James Darnley [Wed, 14 Jun 2017 22:35:44 +0000 (00:35 +0200)]
avcodec/x86: allow future 8-bit simple idct to have "DC only hack"

Created by Ronald S. Bultje

6 years agoavcodec/interplayvideo: return void
Paul B Mahol [Wed, 28 Jun 2017 15:18:13 +0000 (17:18 +0200)]
avcodec/interplayvideo: return void

Signed-off-by: Paul B Mahol <onemda@gmail.com>
6 years agoavcodec/interplayvideo: fix dead-lock
Paul B Mahol [Wed, 28 Jun 2017 15:14:30 +0000 (17:14 +0200)]
avcodec/interplayvideo: fix dead-lock

Fixes #6499.

Signed-off-by: Paul B Mahol <onemda@gmail.com>
6 years agoavcodec/interplayvideo: use int16_t instead of short
Paul B Mahol [Wed, 28 Jun 2017 15:07:49 +0000 (17:07 +0200)]
avcodec/interplayvideo: use int16_t instead of short

Signed-off-by: Paul B Mahol <onemda@gmail.com>
6 years agoavcodec/interplayvideo: check that video_size is >0
Paul B Mahol [Wed, 28 Jun 2017 14:59:59 +0000 (16:59 +0200)]
avcodec/interplayvideo: check that video_size is >0

Fixes #6498.

Signed-off-by: Paul B Mahol <onemda@gmail.com>
7 years agohevc: Add support for alternative transfer characterics SEI
Vittorio Giovara [Fri, 9 Jun 2017 21:35:22 +0000 (17:35 -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 agoavcodec/utvideodec: Factor multiply out of inner loop
Michael Niedermayer [Tue, 27 Jun 2017 19:47:35 +0000 (21:47 +0200)]
avcodec/utvideodec: Factor multiply out of inner loop

0.5% faster loop

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Reviewed-by: Steven Liu <lingjiujianke@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
7 years agoavcodec/utvideodec: bswap directly without memcpy
Michael Niedermayer [Tue, 27 Jun 2017 19:47:34 +0000 (21:47 +0200)]
avcodec/utvideodec: bswap directly without memcpy

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
7 years agoavcodec/utvideodec: enable unchecked bitreader
Michael Niedermayer [Tue, 27 Jun 2017 19:47:33 +0000 (21:47 +0200)]
avcodec/utvideodec: enable unchecked bitreader

inner reader loop becomes 16% faster

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
7 years agoavcodec/utvideodec: hardcode vlc bits
Michael Niedermayer [Tue, 27 Jun 2017 19:47:32 +0000 (21:47 +0200)]
avcodec/utvideodec: hardcode vlc bits

2.5% faster vlc decoding

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
7 years agoavcodec/utvideodec: Move bitstream end check out of inner loop
Michael Niedermayer [Tue, 27 Jun 2017 19:47:31 +0000 (21:47 +0200)]
avcodec/utvideodec: Move bitstream end check out of inner loop

This is not needed when the buffer is large enough for the worst case of a line

2% faster vlc reading

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
7 years agolavc/aacpsdsp: use ptrdiff_t for stride in hybrid_analysis
Clément Bœsch [Thu, 22 Jun 2017 09:24:13 +0000 (11:24 +0200)]
lavc/aacpsdsp: use ptrdiff_t for stride in hybrid_analysis

7 years agolavc/aarch64: add a few SIMD functions for AAC PS
Clément Bœsch [Thu, 25 May 2017 15:50:52 +0000 (17:50 +0200)]
lavc/aarch64: add a few SIMD functions for AAC PS

☭ tests/checkasm/checkasm --bench --test=aacpsdsp
checkasm: using random seed 3318985180
MMX implied by specified flags
MMX implied by specified flags
NEON:
 - aacpsdsp.add_squares        [OK]
 - aacpsdsp.mul_pair_single    [OK]
 - aacpsdsp.hybrid_analysis    [OK]
 - aacpsdsp.stereo_interpolate [OK]
checkasm: all 5 tests passed
nop: 10.0
ps_add_squares_c: 63221.2
ps_add_squares_neon: 22311.7
ps_hybrid_analysis_c: 2466.6
ps_hybrid_analysis_neon: 1521.9
ps_mul_pair_single_c: 68592.0
ps_mul_pair_single_neon: 17426.6
ps_stereo_interpolate_c: 72344.3
ps_stereo_interpolate_neon: 72308.8
ps_stereo_interpolate_ipdopd_c: 117415.2
ps_stereo_interpolate_ipdopd_neon: 113386.3

7 years agolavc/aacpsdsp: fix a few spaces (cosmetics)
Clément Bœsch [Fri, 2 Jun 2017 14:55:32 +0000 (16:55 +0200)]
lavc/aacpsdsp: fix a few spaces (cosmetics)

7 years agocheckasm: add AAC PS tests
Clément Bœsch [Fri, 2 Jun 2017 08:06:08 +0000 (10:06 +0200)]
checkasm: add AAC PS tests

This includes various fixes and improvements from James Almer.

Signed-off-by: James Almer <jamrial@gmail.com>
7 years agolavc/arm: fix lack of precision in ff_ps_stereo_interpolate_neon
Clément Bœsch [Thu, 22 Jun 2017 09:04:26 +0000 (11:04 +0200)]
lavc/arm: fix lack of precision in ff_ps_stereo_interpolate_neon

The code originally pre-multiply by 2 the steps, causing the running sum
of the h factors to drift away due to the lack of precision. It quickly
causes an inaccuracy > 0.01.

I tried diverse approaches such as multiply by 2.0 (instead of adding
the value itself) without success.

I'm unable to bench the impact of this change, feel free to compare.

This commit fixes the incoming aacpsdsp tests.

Following is an alternative simplified function (matching the incoming
AArch64 code) that may be used:

function ff_ps_stereo_interpolate_neon, export=1
        vld1.32         {q0}, [r2]
        vld1.32         {q1}, [r3]
        ldr             r12, [sp]
        vmov.f32        q8, q0
        vmov.f32        q9, q1
        vzip.32         q8, q0
        vzip.32         q9, q1
1:
        vld1.32         {d4}, [r0,:64]
        vld1.32         {d6}, [r1,:64]
        vadd.f32        q8, q8, q9
        vadd.f32        q0, q0, q1
        vmov.f32        d5, d4
        vmov.f32        d7, d6
        vmul.f32        q2, q2, q8
        vmla.f32        q2, q3, q0
        vst1.32         {d4}, [r0,:64]!
        vst1.32         {d5}, [r1,:64]!
        subs            r12, r12, #1
        bgt             1b
        bx              lr
endfunc

7 years agox86/vf_blend: use ABS2 macro
James Almer [Tue, 27 Jun 2017 23:45:55 +0000 (20:45 -0300)]
x86/vf_blend: use ABS2 macro

7 years agoavcodec/x86/vp9dsp_init_16bpp: Fix linking to missing ff_vp9_ipred_dr_32x32_16_avx2...
Michael Niedermayer [Tue, 27 Jun 2017 22:16:18 +0000 (00:16 +0200)]
avcodec/x86/vp9dsp_init_16bpp: Fix linking to missing ff_vp9_ipred_dr_32x32_16_avx2() on 32bit

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
7 years agohwcontext_d3d11va: use correct license header
Hendrik Leppkes [Tue, 27 Jun 2017 22:19:55 +0000 (00:19 +0200)]
hwcontext_d3d11va: use correct license header

7 years agolibswresample/swresample: remove obsolete code
Michael Niedermayer [Tue, 27 Jun 2017 20:22:50 +0000 (22:22 +0200)]
libswresample/swresample: remove obsolete code

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
7 years agoavcodec/hevcdec: do basic validity check on delta_chroma_weight and offset
Michael Niedermayer [Tue, 27 Jun 2017 12:11:00 +0000 (14:11 +0200)]
avcodec/hevcdec: do basic validity check on delta_chroma_weight and offset

Fixes: runtime error: signed integer overflow: 2147483520 + 128 cannot be represented in type 'int'
Fixes: 2385/clusterfuzz-testcase-minimized-6594333576790016
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
7 years agoavcodec/vp9: add 64-bit ipred_dr_32x32_16 avx2 implementation
Ilia Valiakhmetov [Tue, 27 Jun 2017 19:06:19 +0000 (15:06 -0400)]
avcodec/vp9: add 64-bit ipred_dr_32x32_16 avx2 implementation

vp9_diag_downright_32x32_12bpp_c: 429.7
vp9_diag_downright_32x32_12bpp_sse2: 158.9
vp9_diag_downright_32x32_12bpp_ssse3: 144.6
vp9_diag_downright_32x32_12bpp_avx: 141.0
vp9_diag_downright_32x32_12bpp_avx2: 73.8

Almost 50% faster than avx implementation

Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
7 years agox86/vf_blend: optimize difference and negation functions
James Almer [Tue, 27 Jun 2017 15:42:58 +0000 (12:42 -0300)]
x86/vf_blend: optimize difference and negation functions

Process more pixels per loop.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
7 years agox86/vf_blend: add sse and ssse3 extremity functions
James Almer [Tue, 27 Jun 2017 15:27:10 +0000 (12:27 -0300)]
x86/vf_blend: add sse and ssse3 extremity functions

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: James Almer <jamrial@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.

Merges Libav commit 3fdf50f9e864c88da2139cf066832944de81acaa.

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.

Merges Libav commit 068eaa534e7ddb2155e2830818d5c3f1069c68d8.

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

Merges Libav commit cfc9e7c94eafa33e7f109099664ec4fb57ac5ca3.

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.

Merges Libav commit 5030e3856c2126fb829edb828f5aae011d178eb4.

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.

Merges Libav commit 98d73e4174333b37d961b79e1182be5a02156c02.

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).

Merges Libav commit 086321c612185469ebb85a1887527c8915b488b7.

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.

Merges Libav commit 752ddb45569ffe278393cd853b70f18ae017219e.

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.

Merges Libav commit 70e5e7c02232d1e51c362d5572c567a9e2a8dcc2.

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
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.

Merges Libav commit fd1ffa1f10e940165035ccb79d4a6523da196062.

Signed-off-by: Martin Storsjö <martin@martin.st>
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.

Merges Libav commit f9e7a2f95a7194a8736cc1416a03a1a0155a3e9f.
Also adds untested VP9 support.
The check for DXVA2 COBJs is removed. Just update your MinGW to
something newer than a 5 year old release.

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.

Merges Libav commit 831cfe10b40414915fe7b6088158421fe02e2b2d.

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.

Merges Libav commit 4dec101acc393fbfe9a8ce0237b9efbae3f20139.
Adds changes to vp9 over the Libav patch.

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.

Merges Libav commit bd747b9226414007f0207fa201976af7217e3b77.

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.

Merges Libav commit fff90422d181744cd75dbf011687ee7095f02875.

Signed-off-by: Diego Biurrun <diego@biurrun.de>
7 years agox86inc: don't use read-only data sections on COFF targets
James Almer [Mon, 26 Jun 2017 03:29:16 +0000 (00:29 -0300)]
x86inc: don't use read-only data sections on COFF targets

Yasm:
src/libavfilter/x86/af_volume.asm:24: warning: Standard COFF does not support read-only data sections
src/libavfilter/x86/af_volume.asm:24: warning: Unrecognized qualifier `align'

Nasm:
src/libavfilter/x86/af_volume.asm:24: error: standard COFF does not support section alignment specification
src/libavutil/x86/x86inc.asm:92: ... from macro `SECTION_RODATA' defined here

Tested-by: Clément Bœsch <u@pkh.me>
Signed-off-by: James Almer <jamrial@gmail.com>
7 years agoavcodec/interplayvideo: properly check if there is enough bytes left
Paul B Mahol [Tue, 27 Jun 2017 13:46:08 +0000 (15:46 +0200)]
avcodec/interplayvideo: properly check if there is enough bytes left

Signed-off-by: Paul B Mahol <onemda@gmail.com>
7 years agoInterplay MVE: Changelog entry for changes
Hein-Pieter van Braam [Sun, 25 Jun 2017 19:59:04 +0000 (21:59 +0200)]
Interplay MVE: Changelog entry for changes

Signed-off-by: Hein-Pieter van Braam <hp@tmm.cx>
7 years agoInterplay MVE: Implement frame format 0x10
Hein-Pieter van Braam [Sun, 25 Jun 2017 19:59:03 +0000 (21:59 +0200)]
Interplay MVE: Implement frame format 0x10

This implements the 0x10 frame format for Interplay MVE movies. The
format is a variation on the 0x06 format with some changes. In addition
to the decoding map there's also a skip map. This skip map is used to
determine what 8x8 blocks can change in a particular frame.

This format expects to be able to copy an 8x8 block from before the last
time it was changed. This can be an arbitrary time in the past. In order
to implement this this decoder allocates two additional AVFrames where
actual decoding happens. At the end of a frame decoding changed blocks
are copied to a finished frame based on the skip map.

The skip map's encoding is a little convulted, I'll refer to the code
for details.

Values in the decoding map are the same as in format 0x06.

Signed-off-by: Hein-Pieter van Braam <hp@tmm.cx>
7 years agoInterplay MVE: Implement frame format 0x06
Hein-Pieter van Braam [Sun, 25 Jun 2017 19:59:02 +0000 (21:59 +0200)]
Interplay MVE: Implement frame format 0x06

This implements the 0x06 frame format for Interplay MVE movies. The
format is relatively simple. The video data consists of two parts:

16 bits per 8x8 block movement data
a number of 8x8 blocks of pixel data

For each 8x8 block of pixel data the movement data is consulted. There
are 3 possible meanings of the movement data:
* zero     : copy the 8x8 block from the pixel data
* negative : copy the 8x8 block from the previous frame from an offset
             determined by the actual value of the entry -0xC000.
* positive : copy the 8x8 block from the current frame from an offset
             determined by the actual value of the entry -0x4000

Decoding happens in two passes, in the fist pass only new pixeldata is
copied, during the second pass data is copied from the previous and
current frames.

The codec expects that the current frame being decoded to still has the
data from 2 frames ago on it when decoding starts.

Signed-off-by: Hein-Pieter van Braam <hp@tmm.cx>
7 years agoInterplay MVE: Refactor IP packet format
Hein-Pieter van Braam [Sun, 25 Jun 2017 19:59:01 +0000 (21:59 +0200)]
Interplay MVE: Refactor IP packet format

Interplay MVE can contain up to three different frame formats. They
require different streams of information to render a frame. This patch
changes the IP packet format to prepare for the extra frame formats.

Signed-off-by: Hein-Pieter van Braam <hp@tmm.cx>
7 years agoInterplay MVE: Implement MVE SEND_BUFFER operation
Hein-Pieter van Braam [Sun, 25 Jun 2017 19:59:00 +0000 (21:59 +0200)]
Interplay MVE: Implement MVE SEND_BUFFER operation

Interplay MVE movies have a SEND_BUFFER operation. Only after this
command does the current decoding buffer get displayed. This is required
for the other frame formats. They are fixed-size and can't always encode
a full frame worth of pixeldata.

This code prevents half-finished frames from being emitted.

Signed-off-by: Hein-Pieter van Braam <hp@tmm.cx>
7 years agoavcodec/proresenc_kostya: add 4444XQ profile
Paul B Mahol [Mon, 26 Jun 2017 14:30:43 +0000 (16:30 +0200)]
avcodec/proresenc_kostya: add 4444XQ profile

Signed-off-by: Paul B Mahol <onemda@gmail.com>
7 years agoavcodec/ffv1enc: compute the max number of slices and limit by that
Michael Niedermayer [Tue, 27 Jun 2017 11:09:58 +0000 (13:09 +0200)]
avcodec/ffv1enc: compute the max number of slices and limit by that

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
7 years agoavformat: Fix Pro-MPEG non-square matrix
Andreas Håkon [Fri, 13 Jan 2017 12:07:57 +0000 (13:07 +0100)]
avformat: Fix Pro-MPEG non-square matrix

Reviewed-by:vtarca@mobibase.com
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
7 years agoavcodec/ffv1enc: Allow less than 2 rows of slices for low vertical resolution
Michael Niedermayer [Mon, 26 Jun 2017 14:14:35 +0000 (16:14 +0200)]
avcodec/ffv1enc: Allow less than 2 rows of slices for low vertical resolution

Fixes: Ticket5548
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
7 years agoavcodec/utvideodec: add SIMD for restore_rgb_planes
Paul B Mahol [Mon, 26 Jun 2017 19:31:12 +0000 (21:31 +0200)]
avcodec/utvideodec: add SIMD for restore_rgb_planes

Signed-off-by: Paul B Mahol <onemda@gmail.com>
7 years agoavcodec/utvideodec: decode to GBR(A)P
Paul B Mahol [Mon, 26 Jun 2017 09:29:02 +0000 (11:29 +0200)]
avcodec/utvideodec: decode to GBR(A)P

This is actually internal utvideo format.
Allows to make use of SIMD for median prediction for rgb(a) formats,
thus speeding up decoding.
Simplifies code, eases further developement and maintenance.

Update FATE because of pixel format switch.

Signed-off-by: Paul B Mahol <onemda@gmail.com>
7 years agoavfilter: remove usage of empty header
Paul B Mahol [Sun, 25 Jun 2017 13:29:18 +0000 (15:29 +0200)]
avfilter: remove usage of empty header

Signed-off-by: Paul B Mahol <onemda@gmail.com>
7 years agoavcodec/g722enc: force mono channel layout
Kyle Swanson [Fri, 23 Jun 2017 21:33:07 +0000 (16:33 -0500)]
avcodec/g722enc: force mono channel layout

Signed-off-by: Kyle Swanson <k@ylo.ph>
7 years agoavcodec/jpeg2000dwt: Fix integer overflows in sr_1d97_int()
Michael Niedermayer [Mon, 26 Jun 2017 13:00:52 +0000 (15:00 +0200)]
avcodec/jpeg2000dwt: Fix integer overflows in sr_1d97_int()

Fixes: runtime error: signed integer overflow: 1157259380 + 1157259380 cannot be represented in type 'int'
Fixes: 2365/clusterfuzz-testcase-minimized-6020421927305216
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
7 years agoavcodec/jpeg2000dwt: Fix integer overflow in dwt_decode97_int()
Michael Niedermayer [Mon, 26 Jun 2017 13:05:08 +0000 (15:05 +0200)]
avcodec/jpeg2000dwt: Fix integer overflow in dwt_decode97_int()

Fixes: runtime error: signed integer overflow: -163654656 * 256 cannot be represented in type 'int'
Fixes: 2367/clusterfuzz-testcase-minimized-4648678897745920
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
7 years agoavcodec/ffv1enc: Try to choose slice count so that slice packet sizes are within...
Michael Niedermayer [Thu, 15 Jun 2017 18:46:32 +0000 (20:46 +0200)]
avcodec/ffv1enc: Try to choose slice count so that slice packet sizes are within the supported size

Fixes assertion failure

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
7 years agoavcodec/ffv1: Increase the maximum number of slices to 1024
Michael Niedermayer [Thu, 15 Jun 2017 18:26:14 +0000 (20:26 +0200)]
avcodec/ffv1: Increase the maximum number of slices to 1024

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
7 years agolavc/x86: clear r2 higher bits in ff_sbr_sum_square
Matthieu Bouron [Fri, 23 Jun 2017 14:32:31 +0000 (16:32 +0200)]
lavc/x86: clear r2 higher bits in ff_sbr_sum_square

Suggested-by: James Almer <jamrial@gmail.com>
7 years agoavcodec/proresenc_kostya: enable frame threading
Paul B Mahol [Mon, 26 Jun 2017 07:11:03 +0000 (09:11 +0200)]
avcodec/proresenc_kostya: enable frame threading

Signed-off-by: Paul B Mahol <onemda@gmail.com>
7 years agoavcodec/frame_thread_encoder: Fix AV_OPT_TYPE_STRING handling in priv_data
Michael Niedermayer [Sun, 25 Jun 2017 19:50:15 +0000 (21:50 +0200)]
avcodec/frame_thread_encoder: Fix AV_OPT_TYPE_STRING handling in priv_data

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
7 years agoavcodec/proresenc_kostya: use frame metadata instead of avctx
Paul B Mahol [Sun, 25 Jun 2017 22:01:07 +0000 (00:01 +0200)]
avcodec/proresenc_kostya: use frame metadata instead of avctx

Signed-off-by: Paul B Mahol <onemda@gmail.com>
7 years agoavcodec/prores_kostya: increase bits usage when alpha is used
Paul B Mahol [Sat, 24 Jun 2017 14:34:52 +0000 (16:34 +0200)]
avcodec/prores_kostya: increase bits usage when alpha is used

Also fix undefined left shift of negative variable.

Signed-off-by: Paul B Mahol <onemda@gmail.com>
7 years agoavfilter/vf_blend: add extremity blend mode
Paul B Mahol [Sun, 25 Jun 2017 14:39:10 +0000 (16:39 +0200)]
avfilter/vf_blend: add extremity blend mode

Signed-off-by: Paul B Mahol <onemda@gmail.com>
7 years agoavfilter/vf_waveform: allow alpha output for >8 depth planar rgb inputs
Paul B Mahol [Sun, 25 Jun 2017 11:14:22 +0000 (13:14 +0200)]
avfilter/vf_waveform: allow alpha output for >8 depth planar rgb inputs

Signed-off-by: Paul B Mahol <onemda@gmail.com>
7 years agoavfilter/vf_overlay: separate functions with main alpha
Paul B Mahol [Sun, 25 Jun 2017 10:07:50 +0000 (12:07 +0200)]
avfilter/vf_overlay: separate functions with main alpha

~5-15% faster overall with main input without alpha.

Signed-off-by: Paul B Mahol <onemda@gmail.com>
7 years agoavcodec/hevcdec: Do not check the first ff_init_cabac_decoder() call in hls_decode_en...
Michael Niedermayer [Sun, 25 Jun 2017 02:25:56 +0000 (04:25 +0200)]
avcodec/hevcdec: Do not check the first ff_init_cabac_decoder() call in hls_decode_entry_wpp() for failure

The result of the call is not used in any testcase but breaks some cases if
its failure is considered.

Fixes regression found by jamrial

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
7 years agoavcodec/wavpack: Fix integer overflow in wv_unpack_stereo()
Michael Niedermayer [Sat, 24 Jun 2017 22:13:53 +0000 (00:13 +0200)]
avcodec/wavpack: Fix integer overflow in wv_unpack_stereo()

Fixes: runtime error: signed integer overflow: 2080374785 + 2080374784 cannot be represented in type 'int'
Fixes: 2351/clusterfuzz-testcase-minimized-5359403240783872
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
7 years agoavcodec/hevc_ps: Fix max_dec_buffer check
Michael Niedermayer [Sat, 24 Jun 2017 22:00:13 +0000 (00:00 +0200)]
avcodec/hevc_ps: Fix max_dec_buffer check

Fixes: runtime error: signed integer overflow: -2147483648 - 1 cannot be represented in type 'int'
Fixes: 2339/clusterfuzz-testcase-minimized-6663164320022528
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
7 years agoavfilter/vf_lut2: add support for gray10 and gray12 pixel formats
Paul B Mahol [Sat, 24 Jun 2017 20:40:32 +0000 (22:40 +0200)]
avfilter/vf_lut2: add support for gray10 and gray12 pixel formats

Signed-off-by: Paul B Mahol <onemda@gmail.com>
7 years agoavcodec/adpcm_data: use uint16_t to handle all values
Paul B Mahol [Sat, 24 Jun 2017 20:27:10 +0000 (22:27 +0200)]
avcodec/adpcm_data: use uint16_t to handle all values

Signed-off-by: Paul B Mahol <onemda@gmail.com>
7 years agolavc/tests/golomb: Add unit test for set_ue_golomb_long.
Jun Zhao [Wed, 14 Jun 2017 02:42:36 +0000 (10:42 +0800)]
lavc/tests/golomb: Add unit test for set_ue_golomb_long.

Add unit test for set_ue_golomb_long.

Signed-off-by: Jun Zhao <jun.zhao@intel.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
7 years agolavc/golobm: Add set_ue_golomb_long to support up to 2^32 -2.
Jun Zhao [Wed, 14 Jun 2017 02:35:20 +0000 (10:35 +0800)]
lavc/golobm: Add set_ue_golomb_long to support up to 2^32 -2.

add set_ue_golomb_long to support up to 2^32-2.

Reviewed-by: Mark Thompson <sw@jkqxz.net>
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Jun Zhao <jun.zhao@intel.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
7 years agolavc/put_bits: Add put_bits64() to support up to 64 bits.
Jun Zhao [Wed, 14 Jun 2017 02:22:10 +0000 (10:22 +0800)]
lavc/put_bits: Add put_bits64() to support up to 64 bits.

put_bits64() can write up to 64 bits into a bitstream.

Reviewed-by: Mark Thompson <sw@jkqxz.net>
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Jun Zhao <jun.zhao@intel.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
7 years agoavcodec/hevcdec: Use error path if init_get_bits8() fails
Michael Niedermayer [Sat, 24 Jun 2017 12:46:18 +0000 (14:46 +0200)]
avcodec/hevcdec: Use error path if init_get_bits8() fails

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
7 years agoavcodec/hevcdec: check ff_init_cabac_decoder() for failure
Michael Niedermayer [Sat, 24 Jun 2017 12:46:17 +0000 (14:46 +0200)]
avcodec/hevcdec: check ff_init_cabac_decoder() for failure

Fixes: runtime error: left shift of 1965559808 by 4 places cannot be represented in type 'int'
Fixes: 2333/clusterfuzz-testcase-minimized-5223935677300736
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
7 years agoavfilter/vf_overlay: remove rgb option
Paul B Mahol [Sat, 24 Jun 2017 08:30:43 +0000 (10:30 +0200)]
avfilter/vf_overlay: remove rgb option

Its been deprecated for over 3 years.

Signed-off-by: Paul B Mahol <onemda@gmail.com>
7 years agoavfilter/af_headphone: do not free frame that's gonna be reused later
Paul B Mahol [Sat, 24 Jun 2017 16:47:04 +0000 (18:47 +0200)]
avfilter/af_headphone: do not free frame that's gonna be reused later

Signed-off-by: Paul B Mahol <onemda@gmail.com>