4 years agohwcontext_dxva2: make sure the sw frame format is the right one during transfer
Anton Khirnov [Mon, 7 Nov 2016 13:12:17 +0000 (14:12 +0100)]
hwcontext_dxva2: make sure the sw frame format is the right one during transfer

4 years agohwcontext_dxva2: split transfer_data() into upload/download functions
Anton Khirnov [Mon, 7 Nov 2016 13:05:49 +0000 (14:05 +0100)]
hwcontext_dxva2: split transfer_data() into upload/download functions

Just the presence of a hw frames context is not enough to detect whether
the transfer is an upload or a download, because hw frames mapped to
system memory will have a hw frames context attached.

4 years agohwcontext_dxva2: fix handling of the mapping flags
Anton Khirnov [Mon, 7 Nov 2016 12:42:50 +0000 (13:42 +0100)]
hwcontext_dxva2: fix handling of the mapping flags

D3DLOCK_READONLY properly corresponds to the absence of the write flag,
not to the presence of the read flag, while D3DLOCK_DISCARD is
equivalent to the overwrite flag.

4 years agohwcontext_dxva2: do not assume the destination format during mapping is always the...
Anton Khirnov [Mon, 7 Nov 2016 12:34:21 +0000 (13:34 +0100)]
hwcontext_dxva2: do not assume the destination format during mapping is always the right one

Handle the cases where it is unsupported or unset.

4 years agoavpacket: Mark src pointer as constant
Luca Barbato [Thu, 17 Nov 2016 18:41:12 +0000 (19:41 +0100)]
avpacket: Mark src pointer as constant

4 years agohlsenc: Add encryption support
Luca Barbato [Tue, 11 Oct 2016 10:15:50 +0000 (12:15 +0200)]
hlsenc: Add encryption support

Partially based on Christian Suloway <csuloway@globaleagleent.com> work.

4 years agocrypto: Add encryption support
Christian Suloway [Mon, 1 Dec 2014 18:55:28 +0000 (12:55 -0600)]
crypto: Add encryption support

Signed-off-by: Christian Suloway <csuloway@globaleagleent.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
4 years agoqsvdec: Drop stray extra braces around initializer
Diego Biurrun [Tue, 15 Nov 2016 15:19:30 +0000 (16:19 +0100)]
qsvdec: Drop stray extra braces around initializer

libavcodec/qsvdec.c:93:5: warning: braces around scalar initializer

4 years agoqsv: Drop some unused variables
Diego Biurrun [Tue, 15 Nov 2016 15:17:05 +0000 (16:17 +0100)]
qsv: Drop some unused variables

4 years agoexamples/transcode_aac: Drop pointless return value const qualifier
Diego Biurrun [Tue, 8 Dec 2015 15:54:07 +0000 (16:54 +0100)]
examples/transcode_aac: Drop pointless return value const qualifier

doc/examples/transcode_aac.c:52:20: warning: type qualifiers ignored on function return type [-Wignored-qualifiers]

4 years agoIgnore all generated example binaries
Diego Biurrun [Wed, 16 Nov 2016 09:34:38 +0000 (09:34 +0000)]
Ignore all generated example binaries

4 years agodoc: Add note about recent regression in AviSynth+
Stephen Hutchinson [Sat, 29 Oct 2016 00:52:11 +0000 (20:52 -0400)]
doc: Add note about recent regression in AviSynth+

Signed-off-by: Diego Biurrun <diego@biurrun.de>
4 years agoavisynth: Support pix_fmts added to AviSynth+
Stephen Hutchinson [Thu, 27 Oct 2016 02:54:18 +0000 (22:54 -0400)]
avisynth: Support pix_fmts added to AviSynth+

A number of new pix_fmts* have been added to AviSynth+:
16-bit packed RGB and RGBA
10-, 12-, 14, and 16-bit YUV 4:2:0, 4:2:2, and 4:4:4
8-, 10-, 12-, 14-, and 16-bit Planar RGB
8-, 10-, 12-, 14-, and 16-bit Planar YUVA and Planar RGBA
10-, 12-, 14-, and 16-bit GRAY variants
32-bit floating point Planar YUV(A), Planar RGB(A), and GRAY

*some of which are not currently available pix_fmts here and were
 not added to the demuxer due to this

Signed-off-by: Diego Biurrun <diego@biurrun.de>
4 years agoavisynth: Simplify the pix_fmt check for the newer AviSynth API
Stephen Hutchinson [Mon, 8 Aug 2016 23:24:19 +0000 (19:24 -0400)]
avisynth: Simplify the pix_fmt check for the newer AviSynth API

The values don't need to be hardcoded since the correct values are
returned by avs_bits_per_pixel.

Signed-off-by: Diego Biurrun <diego@biurrun.de>
4 years agoavisynth: Fix setting stream timebase
Marton Balint [Mon, 8 Aug 2016 23:24:18 +0000 (19:24 -0400)]
avisynth: Fix setting stream timebase

Stream timebase should be set using avpriv_set_pts_info, otherwise
avctx->pkt_timebase is not correct, leading to A/V desync.

Signed-off-by: Marton Balint <cus@passwd.hu>
Reviewed-by: Stephen Hutchinson <qyot27@gmail.com>
Signed-off-by: Diego Biurrun <diego@biurrun.de>
4 years agofate: Add h264 and hevc extradata reload tests
Vittorio Giovara [Tue, 8 Nov 2016 21:47:38 +0000 (16:47 -0500)]
fate: Add h264 and hevc extradata reload tests

Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
4 years agomov: Fix identity matrix boolean logic
Vittorio Giovara [Tue, 15 Nov 2016 15:14:30 +0000 (10:14 -0500)]
mov: Fix identity matrix boolean logic

This prevented the code from correctly exporting the rotation matrix
which caused a few samples to be displayed wrong.
Introduced in ecd2ec69ce10e13f6ede353d2def7c.

Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
4 years agocheckasm: vp9dsp: Benchmark the dc-only version of idct_idct separately
Martin Storsjö [Mon, 14 Nov 2016 21:44:06 +0000 (23:44 +0200)]
checkasm: vp9dsp: Benchmark the dc-only version of idct_idct separately

The dc-only mode is already checked to work correctly above, but this
allows benchmarking this mode for performance tuning, and allows making
sure that it actually is correctly hooked up.

Signed-off-by: Martin Storsjö <martin@martin.st>
4 years agoaarch64: vp9: loop filter: replace 'orr; cbn?z' with 'adds; b.{eq,ne};
Janne Grunau [Mon, 14 Nov 2016 21:35:13 +0000 (22:35 +0100)]
aarch64: vp9: loop filter: replace 'orr; cbn?z' with 'adds; b.{eq,ne};

The latter is 1 cycle faster on a cortex-53 and since the operands are
bytewise (or larger) bitmask (impossible to overflow to zero) both are

4 years agoaarch64: vp9: use alternative returns in the core loop filter function
Janne Grunau [Sun, 13 Nov 2016 23:13:34 +0000 (00:13 +0100)]
aarch64: vp9: use alternative returns in the core loop filter function

Since aarch64 has enough free general purpose registers use them to
branch to the appropiate storage code. 1-2 cycles faster for the
functions using loop_filter 8/16, ... on a cortex-a53. Mixed results
(up to 2 cycles faster/slower) on a cortex-a57.

4 years agolibilbc: support for latest git of libilbc
Gianluigi Tiesi [Fri, 19 Sep 2014 02:49:36 +0000 (04:49 +0200)]
libilbc: support for latest git of libilbc

In the latest git commits of libilbc developers removed WebRtc_xxx typedefs.
This commit uses int types instead. It's safe to apply also for previous
versions since WebRtc_Word16 was always a typedef of int16_t and
WebRtc_UWord16 a typedef of uint16_t.

Reviewed-by: Timothy Gu <timothygu99@gmail.com>
Signed-off-by: Diego Biurrun <diego@biurrun.de>
4 years agoconfigure: Move mjpeg_vaapi_decoder dependency declarations to the right place
Diego Biurrun [Thu, 10 Nov 2016 16:11:42 +0000 (17:11 +0100)]
configure: Move mjpeg_vaapi_decoder dependency declarations to the right place

4 years agogolomb: Replace __PRETTY_FUNCTION__ with __func__ for tracing
Diego Biurrun [Fri, 11 Dec 2015 16:37:01 +0000 (17:37 +0100)]
golomb: Replace __PRETTY_FUNCTION__ with __func__ for tracing

The former is a GNU extension while the latter is C99.

4 years agoaf_asyncts: Use llabs instead of labs for 64-bit variable
Diego Biurrun [Mon, 4 Jan 2016 10:14:51 +0000 (11:14 +0100)]
af_asyncts: Use llabs instead of labs for 64-bit variable

libavfilter/af_asyncts.c:212:9: warning: absolute value function 'labs' given an argument of type 'int64_t' (aka 'long long') but has parameter of type 'long' which may cause truncation of value [-Wabsolute-value]

4 years agoqsv: Add VP8 decoder
Mark Thompson [Thu, 27 Oct 2016 19:33:56 +0000 (20:33 +0100)]
qsv: Add VP8 decoder

4 years agovp8: Return stream format information from parser
Mark Thompson [Thu, 27 Oct 2016 19:02:29 +0000 (20:02 +0100)]
vp8: Return stream format information from parser

4 years agoqsv: Add VC-1 decoder
Mark Thompson [Wed, 26 Oct 2016 20:29:08 +0000 (21:29 +0100)]
qsv: Add VC-1 decoder

It uses the same code as the MPEG-2 decoder, so the file is renamed
to contain all "other" (that is, not H.26[45]) codecs.

4 years agovc1: Return stream format information from parser
Mark Thompson [Wed, 26 Oct 2016 20:13:45 +0000 (21:13 +0100)]
vc1: Return stream format information from parser

4 years agoqsvdec: Only warn about unconsumed data if it happens more than once
Mark Thompson [Sun, 30 Oct 2016 16:58:23 +0000 (16:58 +0000)]
qsvdec: Only warn about unconsumed data if it happens more than once

4 years agoqsvdec: Pass field order information to libmfx
Mark Thompson [Wed, 26 Oct 2016 20:27:49 +0000 (21:27 +0100)]
qsvdec: Pass field order information to libmfx

The VC-1 decoder fails to initialise if this is not set.

4 years agoqsvdec: Pass the correct profile to libmfx
Mark Thompson [Wed, 26 Oct 2016 20:26:10 +0000 (21:26 +0100)]
qsvdec: Pass the correct profile to libmfx

This was correct for H.26[45], because libmfx uses the same values
derived from profile_idc and the constraint_set flags, but it is
wrong for other codecs.

Also avoid passing FF_LEVEL_UNKNOWN (-99) as the level, as this is
certainly invalid.

4 years agompegvideo: Return correct coded frame sizes from parser
Mark Thompson [Wed, 26 Oct 2016 20:12:02 +0000 (21:12 +0100)]
mpegvideo: Return correct coded frame sizes from parser

4 years agoaarch64: vp9: loop_filter: fix typo in skip flatout8 check
Janne Grunau [Mon, 14 Nov 2016 00:16:00 +0000 (01:16 +0100)]
aarch64: vp9: loop_filter: fix typo in skip flatout8 check

The 16_16 loop filter functions could miss an early exit before

Signed-off-by: Martin Storsjö <martin@martin.st>
4 years agoaarch64: vp9: Implement NEON loop filters
Martin Storsjö [Sun, 13 Nov 2016 22:07:27 +0000 (00:07 +0200)]
aarch64: vp9: Implement NEON loop filters

This work is sponsored by, and copyright, Google.

These are ported from the ARM version; thanks to the larger
amount of registers available, we can do the loop filters with
16 pixels at a time. The implementation is fully templated, with
a single macro which can generate versions for both 8 and
16 pixels wide, for both 4, 8 and 16 pixels loop filters
(and the 4/8 mixed versions as well).

For the 8 pixel wide versions, it is pretty close in speed (the
v_4_8 and v_8_8 filters are the best examples of this; the h_4_8
and h_8_8 filters seem to get some gain in the load/transpose/store
part). For the 16 pixels wide ones, we get a speedup of around
1.2-1.4x compared to the 32 bit version.

Examples of runtimes vs the 32 bit version, on a Cortex A53:
                                       ARM AArch64
vp9_loop_filter_h_4_8_neon:          144.0   127.2
vp9_loop_filter_h_8_8_neon:          207.0   182.5
vp9_loop_filter_h_16_8_neon:         415.0   328.7
vp9_loop_filter_h_16_16_neon:        672.0   558.6
vp9_loop_filter_mix2_h_44_16_neon:   302.0   203.5
vp9_loop_filter_mix2_h_48_16_neon:   365.0   305.2
vp9_loop_filter_mix2_h_84_16_neon:   365.0   305.2
vp9_loop_filter_mix2_h_88_16_neon:   376.0   305.2
vp9_loop_filter_mix2_v_44_16_neon:   193.2   128.2
vp9_loop_filter_mix2_v_48_16_neon:   246.7   218.4
vp9_loop_filter_mix2_v_84_16_neon:   248.0   218.5
vp9_loop_filter_mix2_v_88_16_neon:   302.0   218.2
vp9_loop_filter_v_4_8_neon:           89.0    88.7
vp9_loop_filter_v_8_8_neon:          141.0   137.7
vp9_loop_filter_v_16_8_neon:         295.0   272.7
vp9_loop_filter_v_16_16_neon:        546.0   453.7

The speedup vs C code in checkasm tests is around 2-7x, which is
pretty much the same as for the 32 bit version. Even if these functions
are faster than their 32 bit equivalent, the C version that we compare
to also became around 1.3-1.7x faster than the C version in 32 bit.

Based on START_TIMER/STOP_TIMER wrapping around a few individual
functions, the speedup vs C code is around 4-5x.

Examples of runtimes vs C on a Cortex A57 (for a slightly older version
of the patch):
                         A57 gcc-5.3  neon
loop_filter_h_4_8_neon:        256.6  93.4
loop_filter_h_8_8_neon:        307.3 139.1
loop_filter_h_16_8_neon:       340.1 254.1
loop_filter_h_16_16_neon:      827.0 407.9
loop_filter_mix2_h_44_16_neon: 524.5 155.4
loop_filter_mix2_h_48_16_neon: 644.5 173.3
loop_filter_mix2_h_84_16_neon: 630.5 222.0
loop_filter_mix2_h_88_16_neon: 697.3 222.0
loop_filter_mix2_v_44_16_neon: 598.5 100.6
loop_filter_mix2_v_48_16_neon: 651.5 127.0
loop_filter_mix2_v_84_16_neon: 591.5 167.1
loop_filter_mix2_v_88_16_neon: 855.1 166.7
loop_filter_v_4_8_neon:        271.7  65.3
loop_filter_v_8_8_neon:        312.5 106.9
loop_filter_v_16_8_neon:       473.3 206.5
loop_filter_v_16_16_neon:      976.1 327.8

The speed-up compared to the C functions is 2.5 to 6 and the cortex-a57
is again 30-50% faster than the cortex-a53.

Signed-off-by: Martin Storsjö <martin@martin.st>
4 years agoarm: vp9itxfm: Simplify txfm string comparisons
Martin Storsjö [Sat, 12 Nov 2016 19:25:50 +0000 (21:25 +0200)]
arm: vp9itxfm: Simplify txfm string comparisons

Signed-off-by: Martin Storsjö <martin@martin.st>
4 years agoaarch64: vp9: Add NEON itxfm routines
Martin Storsjö [Sun, 13 Nov 2016 21:53:08 +0000 (23:53 +0200)]
aarch64: vp9: Add NEON itxfm routines

This work is sponsored by, and copyright, Google.

These are ported from the ARM version; thanks to the larger
amount of registers available, we can do the 16x16 and 32x32
transforms in slices 8 pixels wide instead of 4. This gives
a speedup of around 1.4x compared to the 32 bit version.

The fact that aarch64 doesn't have the same d/q register
aliasing makes some of the macros quite a bit simpler as well.

Examples of runtimes vs the 32 bit version, on a Cortex A53:
                                       ARM  AArch64
vp9_inv_adst_adst_4x4_add_neon:       90.0     87.7
vp9_inv_adst_adst_8x8_add_neon:      400.0    354.7
vp9_inv_adst_adst_16x16_add_neon:   2526.5   1827.2
vp9_inv_dct_dct_4x4_add_neon:         74.0     72.7
vp9_inv_dct_dct_8x8_add_neon:        271.0    256.7
vp9_inv_dct_dct_16x16_add_neon:     1960.7   1372.7
vp9_inv_dct_dct_32x32_add_neon:    11988.9   8088.3
vp9_inv_wht_wht_4x4_add_neon:         63.0     57.7

The speedup vs C code (2-4x) is smaller than in the 32 bit case,
mostly because the C code ends up significantly faster (around
1.6x faster, with GCC 5.4) when built for aarch64.

Examples of runtimes vs C on a Cortex A57 (for a slightly older version
of the patch):
                                A57 gcc-5.3   neon
vp9_inv_adst_adst_4x4_add_neon:       152.2   60.0
vp9_inv_adst_adst_8x8_add_neon:       948.2  288.0
vp9_inv_adst_adst_16x16_add_neon:    4830.4 1380.5
vp9_inv_dct_dct_4x4_add_neon:         153.0   58.6
vp9_inv_dct_dct_8x8_add_neon:         789.2  180.2
vp9_inv_dct_dct_16x16_add_neon:      3639.6  917.1
vp9_inv_dct_dct_32x32_add_neon:     20462.1 4985.0
vp9_inv_wht_wht_4x4_add_neon:          91.0   49.8

The asm is around factor 3-4 faster than C on the cortex-a57 and the asm
is around 30-50% faster on the a57 compared to the a53.

Signed-off-by: Martin Storsjö <martin@martin.st>
4 years agoavconv_opt: Consistently iterate through hwaccels array in all cases
Diego Biurrun [Sun, 6 Dec 2015 12:04:05 +0000 (13:04 +0100)]
avconv_opt: Consistently iterate through hwaccels array in all cases

avconv_opt.c:188:19: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits]

4 years agoDrop pointless void* casts
Diego Biurrun [Fri, 30 Oct 2015 14:26:25 +0000 (15:26 +0100)]
Drop pointless void* casts

4 years agoaac: Drop pointless cast
Diego Biurrun [Sun, 15 Mar 2015 14:56:52 +0000 (15:56 +0100)]
aac: Drop pointless cast

4 years agovf_drawtext: Drop wrong void* cast
Diego Biurrun [Fri, 30 Oct 2015 14:21:19 +0000 (15:21 +0100)]
vf_drawtext: Drop wrong void* cast

libavfilter/vf_drawtext.c:844:49: warning: ISO C forbids conversion of function pointer to object pointer type [-Wpedantic]

4 years agonut: Use correct function pointer casts instead of void*
Diego Biurrun [Fri, 30 Oct 2015 14:27:56 +0000 (15:27 +0100)]
nut: Use correct function pointer casts instead of void*

Fixes several warnings of the type
libavformat/nut.c:207:42: warning: ISO C forbids conversion of function pointer to object pointer type [-Wpedantic]

4 years agoratecontrol: Use correct function pointer casts instead of void*
Diego Biurrun [Thu, 12 Mar 2015 23:36:41 +0000 (00:36 +0100)]
ratecontrol: Use correct function pointer casts instead of void*

libavcodec/ratecontrol.c:120:9: warning: ISO C forbids initialization between function pointer and ‘void *’ [-Wpedantic]
libavcodec/ratecontrol.c:121:9: warning: ISO C forbids initialization between function pointer and ‘void *’ [-Wpedantic]

4 years agoarm: vp9: Add NEON loop filters
Martin Storsjö [Mon, 10 Oct 2016 06:48:03 +0000 (09:48 +0300)]
arm: vp9: Add NEON loop filters

This work is sponsored by, and copyright, Google.

The implementation tries to have smart handling of cases
where no pixels need the full filtering for the 8/16 width
filters, skipping both calculation and writeback of the
unmodified pixels in those cases. The actual effect of this
is hard to test with checkasm though, since it tests the
full filtering, and the benefit depends on how many filtered
blocks use the shortcut.

Examples of relative speedup compared to the C version, from checkasm:
                          Cortex       A7     A8     A9    A53
vp9_loop_filter_h_4_8_neon:          2.72   2.68   1.78   3.15
vp9_loop_filter_h_8_8_neon:          2.36   2.38   1.70   2.91
vp9_loop_filter_h_16_8_neon:         1.80   1.89   1.45   2.01
vp9_loop_filter_h_16_16_neon:        2.81   2.78   2.18   3.16
vp9_loop_filter_mix2_h_44_16_neon:   2.65   2.67   1.93   3.05
vp9_loop_filter_mix2_h_48_16_neon:   2.46   2.38   1.81   2.85
vp9_loop_filter_mix2_h_84_16_neon:   2.50   2.41   1.73   2.85
vp9_loop_filter_mix2_h_88_16_neon:   2.77   2.66   1.96   3.23
vp9_loop_filter_mix2_v_44_16_neon:   4.28   4.46   3.22   5.70
vp9_loop_filter_mix2_v_48_16_neon:   3.92   4.00   3.03   5.19
vp9_loop_filter_mix2_v_84_16_neon:   3.97   4.31   2.98   5.33
vp9_loop_filter_mix2_v_88_16_neon:   3.91   4.19   3.06   5.18
vp9_loop_filter_v_4_8_neon:          4.53   4.47   3.31   6.05
vp9_loop_filter_v_8_8_neon:          3.58   3.99   2.92   5.17
vp9_loop_filter_v_16_8_neon:         3.40   3.50   2.81   4.68
vp9_loop_filter_v_16_16_neon:        4.66   4.41   3.74   6.02

The speedup vs C code is around 2-6x. The numbers are quite
inconclusive though, since the checkasm test runs multiple filterings
on top of each other, so later rounds might end up with different
codepaths (different decisions on which filter to apply, based
on input pixel differences). Disabling the early-exit in the asm
doesn't give a fair comparison either though, since the C code
only does the necessary calcuations for each row.

Based on START_TIMER/STOP_TIMER wrapping around a few individual
functions, the speedup vs C code is around 4-9x.

This is pretty similar in runtime to the corresponding routines
in libvpx. (This is comparing vpx_lpf_vertical_16_neon,
vpx_lpf_horizontal_edge_8_neon and vpx_lpf_horizontal_edge_16_neon
to vp9_loop_filter_h_16_8_neon, vp9_loop_filter_v_16_8_neon
and vp9_loop_filter_v_16_16_neon - note that the naming of horizonal
and vertical is flipped between the libraries.)

In order to have stable, comparable numbers, the early exits in both
asm versions were disabled, forcing the full filtering codepath.

                           Cortex           A7      A8      A9     A53
vp9_loop_filter_h_16_8_neon:             597.2   472.0   482.4   415.0
libvpx vpx_lpf_vertical_16_neon:         626.0   464.5   470.7   445.0
vp9_loop_filter_v_16_8_neon:             500.2   422.5   429.7   295.0
libvpx vpx_lpf_horizontal_edge_8_neon:   586.5   414.5   415.6   383.2
vp9_loop_filter_v_16_16_neon:            905.0   784.7   791.5   546.0
libvpx vpx_lpf_horizontal_edge_16_neon: 1060.2   751.7   743.5   685.2

Our version is consistently faster on on A7 and A53, marginally slower on
A8, and sometimes faster, sometimes slower on A9 (marginally slower in all
three tests in this particular test run).

Signed-off-by: Martin Storsjö <martin@martin.st>
4 years agolibxvid: Check return value of write() call
Diego Biurrun [Tue, 8 Dec 2015 09:22:15 +0000 (10:22 +0100)]
libxvid: Check return value of write() call

libavcodec/libxvid_rc.c:106:9: warning: ignoring return value of ‘write’, declared with attribute warn_unused_result [-Wunused-result]

4 years agolibxvid: Use proper context in av_log() calls
Diego Biurrun [Tue, 8 Dec 2015 09:21:27 +0000 (10:21 +0100)]
libxvid: Use proper context in av_log() calls

4 years agolibxvid: Require availability of mkstemp()
Diego Biurrun [Thu, 12 Feb 2015 09:11:22 +0000 (10:11 +0100)]
libxvid: Require availability of mkstemp()

The replacement code uses tempnam(), which is dangerous.
Such a fringe feature is not worth the trouble.

4 years agoarm: vp9: Add NEON itxfm routines
Martin Storsjö [Sat, 8 Oct 2016 19:36:18 +0000 (22:36 +0300)]
arm: vp9: Add NEON itxfm routines

This work is sponsored by, and copyright, Google.

For the transforms up to 8x8, we can fit all the data (including
temporaries) in registers and just do a straightforward transform
of all the data. For 16x16, we do a transform of 4x16 pixels in
4 slices, using a temporary buffer. For 32x32, we transform 4x32
pixels at a time, in two steps of 4x16 pixels each.

Examples of relative speedup compared to the C version, from checkasm:
                         Cortex       A7     A8     A9    A53
vp9_inv_adst_adst_4x4_add_neon:     3.39   5.83   4.17   4.01
vp9_inv_adst_adst_8x8_add_neon:     3.79   4.86   4.23   3.98
vp9_inv_adst_adst_16x16_add_neon:   3.33   4.36   4.11   4.16
vp9_inv_dct_dct_4x4_add_neon:       4.06   6.16   4.59   4.46
vp9_inv_dct_dct_8x8_add_neon:       4.61   6.01   4.98   4.86
vp9_inv_dct_dct_16x16_add_neon:     3.35   3.44   3.36   3.79
vp9_inv_dct_dct_32x32_add_neon:     3.89   3.50   3.79   4.42
vp9_inv_wht_wht_4x4_add_neon:       3.22   5.13   3.53   3.77

Thus, the speedup vs C code is around 3-6x.

This is mostly marginally faster than the corresponding routines
in libvpx on most cores, tested with their 32x32 idct (compared to
vpx_idct32x32_1024_add_neon). These numbers are slightly in libvpx's
favour since their version doesn't clear the input buffer like ours
do (although the effect of that on the total runtime probably is

                           Cortex       A7       A8       A9      A53
vp9_inv_dct_dct_32x32_add_neon:    18436.8  16874.1  14235.1  11988.9
libvpx vpx_idct32x32_1024_add_neon 20789.0  13344.3  15049.9  13030.5

Only on the Cortex A8, the libvpx function is faster. On the other cores,
ours is slightly faster even though ours has got source block clearing

Signed-off-by: Martin Storsjö <martin@martin.st>
4 years agocheckasm: add vp9dsp.itxfm_add tests.
Ronald S. Bultje [Tue, 22 Sep 2015 18:24:27 +0000 (14:24 -0400)]
checkasm: add vp9dsp.itxfm_add tests.

This includes fixes by Henrik Gramner.

The forward transforms are derived from the reference encoder.

Signed-off-by: Martin Storsjö <martin@martin.st>
4 years agopthread_frame: Unreference hw_frames_ctx on per-thread codec contexts
Mark Thompson [Thu, 3 Nov 2016 00:13:35 +0000 (00:13 +0000)]
pthread_frame: Unreference hw_frames_ctx on per-thread codec contexts

When decoding with threads enabled, the get_format callback will be
called with one of the per-thread codec contexts rather than with the
outer context.  If a hwaccel is in use too, this will add a reference
to the hardware frames context on that codec context, which will then
propagate to all of the other per-thread contexts for decoding.  Once
the decoder finishes, however, the per-thread contexts are not freed
normally, so these references leak.

4 years agoarm: vp9mc: Use a different helper register for PIC loads
Martin Storsjö [Thu, 10 Nov 2016 11:25:36 +0000 (13:25 +0200)]
arm: vp9mc: Use a different helper register for PIC loads

This fixes crashes since 557c1675cf in linux PIC builds.

Previously, movrelx silently used r12 as helper register, which
doesn't work when r12 is the destination register.

Signed-off-by: Martin Storsjö <martin@martin.st>
4 years agoarm: Clear the gp register alias at the end of functions
Martin Storsjö [Thu, 10 Nov 2016 11:23:38 +0000 (13:23 +0200)]
arm: Clear the gp register alias at the end of functions

We reset .Lpic_gp to zero at the start of each function, which means
that the logic within movrelx for clearing gp when necessary will
be missed.

This fixes using movrelx in different functions with a different
helper register.

Signed-off-by: Martin Storsjö <martin@martin.st>
4 years agoexamples/decode_audio: Add missing header for av_free()
Diego Biurrun [Wed, 9 Nov 2016 05:07:06 +0000 (06:07 +0100)]
examples/decode_audio: Add missing header for av_free()

4 years agoaarch64: h264idct: Use the offset parameter to movrel
Martin Storsjö [Wed, 9 Nov 2016 09:54:25 +0000 (11:54 +0200)]
aarch64: h264idct: Use the offset parameter to movrel

Signed-off-by: Martin Storsjö <martin@martin.st>
4 years agoarm: vp9mc: Minor adjustments from review of the aarch64 version
Martin Storsjö [Thu, 10 Nov 2016 09:07:39 +0000 (11:07 +0200)]
arm: vp9mc: Minor adjustments from review of the aarch64 version

This work is sponsored by, and copyright, Google.

The speedup for the large horizontal filters is surprisingly
big on A7 and A53, while there's a minor slowdown (almost within
measurement noise) on A8 and A9.

                            Cortex    A7        A8        A9       A53
vp9_put_8tap_smooth_64h_neon:    20270.0   14447.3   19723.9   10910.9
vp9_put_8tap_smooth_64h_neon:    20165.8   14466.5   19730.2   10668.8

Signed-off-by: Martin Storsjö <martin@martin.st>
4 years agoaarch64: vp9: Add NEON optimizations of VP9 MC functions
Martin Storsjö [Thu, 10 Nov 2016 09:06:26 +0000 (11:06 +0200)]
aarch64: vp9: Add NEON optimizations of VP9 MC functions

This work is sponsored by, and copyright, Google.

These are ported from the ARM version; it is essentially a 1:1
port with no extra added features, but with some hand tuning
(especially for the plain copy/avg functions). The ARM version
isn't very register starved to begin with, so there's not much
to be gained from having more spare registers here - we only
avoid having to clobber callee-saved registers.

Examples of runtimes vs the 32 bit version, on a Cortex A53:
                                     ARM   AArch64
vp9_avg4_neon:                      27.2      23.7
vp9_avg8_neon:                      56.5      54.7
vp9_avg16_neon:                    169.9     167.4
vp9_avg32_neon:                    585.8     585.2
vp9_avg64_neon:                   2460.3    2294.7
vp9_avg_8tap_smooth_4h_neon:       132.7     125.2
vp9_avg_8tap_smooth_4hv_neon:      478.8     442.0
vp9_avg_8tap_smooth_4v_neon:       126.0      93.7
vp9_avg_8tap_smooth_8h_neon:       241.7     234.2
vp9_avg_8tap_smooth_8hv_neon:      690.9     646.5
vp9_avg_8tap_smooth_8v_neon:       245.0     205.5
vp9_avg_8tap_smooth_64h_neon:    11273.2   11280.1
vp9_avg_8tap_smooth_64hv_neon:   22980.6   22184.1
vp9_avg_8tap_smooth_64v_neon:    11549.7   10781.1
vp9_put4_neon:                      18.0      17.2
vp9_put8_neon:                      40.2      37.7
vp9_put16_neon:                     97.4      99.5
vp9_put32_neon/armv8:              346.0     307.4
vp9_put64_neon/armv8:             1319.0    1107.5
vp9_put_8tap_smooth_4h_neon:       126.7     118.2
vp9_put_8tap_smooth_4hv_neon:      465.7     434.0
vp9_put_8tap_smooth_4v_neon:       113.0      86.5
vp9_put_8tap_smooth_8h_neon:       229.7     221.6
vp9_put_8tap_smooth_8hv_neon:      658.9     621.3
vp9_put_8tap_smooth_8v_neon:       215.0     187.5
vp9_put_8tap_smooth_64h_neon:    10636.7   10627.8
vp9_put_8tap_smooth_64hv_neon:   21076.8   21026.9
vp9_put_8tap_smooth_64v_neon:     9635.0    9632.4

These are generally about as fast as the corresponding ARM
routines on the same CPU (at least on the A53), in most cases
marginally faster.

The speedup vs C code is pretty much the same as for the 32 bit
case; on the A53 it's around 6-13x for ther larger 8tap filters.
The exact speedup varies a little, since the C versions generally
don't end up exactly as slow/fast as on 32 bit.

Signed-off-by: Martin Storsjö <martin@martin.st>
4 years agoaarch64: Add an offset parameter to the movrel macro
Martin Storsjö [Wed, 9 Nov 2016 09:47:57 +0000 (11:47 +0200)]
aarch64: Add an offset parameter to the movrel macro

With apple tools, the linker fails with errors like these, if the
offset is negative:

ld: in section __TEXT,__text reloc 8: symbol index out of range for architecture arm64

Signed-off-by: Martin Storsjö <martin@martin.st>
4 years agovp9: Make the subpel filters non-static
Martin Storsjö [Sat, 5 Nov 2016 11:18:53 +0000 (13:18 +0200)]
vp9: Make the subpel filters non-static

Make them aligned, to allow efficient access to them from simd.

Signed-off-by: Martin Storsjö <martin@martin.st>
4 years agomatroskaenc: write updated STREAMINFO metadata for FLAC streams if available
James Almer [Wed, 9 Nov 2016 21:38:24 +0000 (18:38 -0300)]
matroskaenc: write updated STREAMINFO metadata for FLAC streams if available

FLAC streams originating from the FLAC encoder send updated and more
complete STREAMINFO metadata as part of the last packet, so write that
to CodecPrivate instead of the incomplete one available in extradata
during init.

Signed-off-by: James Almer <jamrial@gmail.com>
Signed-off-by: Anton Khirnov <anton@khirnov.net>
4 years agomatroskaenc: fix muxing AAC streams when using aac_adtstoasc bsf
James Almer [Wed, 9 Nov 2016 21:38:23 +0000 (18:38 -0300)]
matroskaenc: fix muxing AAC streams when using aac_adtstoasc bsf

aac_adtstoasc makes the aac extradata available only after the first packet
is filtered, and as packet side data.

Assume extradata will be available as part of the first packet if
avpriv_mpeg4audio_get_config() fails the first time due to missing extradata
and reserve space for the OutputSampleRate element in the Tracks master.

Signed-off-by: James Almer <jamrial@gmail.com>
Signed-off-by: Anton Khirnov <anton@khirnov.net>
4 years agopthread_frame: properly propagate the hw frame context across frame threads
Anton Khirnov [Mon, 7 Nov 2016 13:21:18 +0000 (14:21 +0100)]
pthread_frame: properly propagate the hw frame context across frame threads

4 years agompegaudiodsp: aarch64: Adjust function prototype after 2caa93b813adc5dbb7771dfe615da8...
Diego Biurrun [Tue, 8 Nov 2016 17:10:04 +0000 (18:10 +0100)]
mpegaudiodsp: aarch64: Adjust function prototype after 2caa93b813adc5dbb7771dfe615da826a2947d18

4 years agoconfigure: Move license checks directly after command line parsing
Diego Biurrun [Wed, 27 Mar 2013 17:21:10 +0000 (18:21 +0100)]
configure: Move license checks directly after command line parsing

This will allow to error out immediately if incompatible options are
passed on the command line instead of running time-consuming tests.

4 years agoconfigure: Log name and parameters of all helper functions where it makes sense
Diego Biurrun [Tue, 8 Nov 2016 19:04:18 +0000 (20:04 +0100)]
configure: Log name and parameters of all helper functions where it makes sense

4 years agoconfigure: Use check_cpp in CPP flags tests
Diego Biurrun [Mon, 8 Aug 2016 18:27:43 +0000 (20:27 +0200)]
configure: Use check_cpp in CPP flags tests

4 years agoconfigure: Log correct test name and use correct filter when testing objective C...
Diego Biurrun [Mon, 6 Jun 2016 17:06:30 +0000 (19:06 +0200)]
configure: Log correct test name and use correct filter when testing objective C flags

4 years agoconfigure: Do not unconditionally check for (and enable) xlib
Diego Biurrun [Mon, 7 Nov 2016 19:22:14 +0000 (20:22 +0100)]
configure: Do not unconditionally check for (and enable) xlib

This avoids unnecessarily linking against xlib.

4 years agoconfigure: Print list of enabled programs
Diego Biurrun [Mon, 7 Nov 2016 21:12:23 +0000 (22:12 +0100)]
configure: Print list of enabled programs

Also drop a related and now redundant informative output line.

4 years agoconfigure: Improve output wording
Diego Biurrun [Tue, 25 Oct 2016 20:47:00 +0000 (22:47 +0200)]
configure: Improve output wording

Also drop a redundant output line.

4 years agoavconv: Drop stray leftover debug output
Diego Biurrun [Tue, 8 Nov 2016 16:48:50 +0000 (17:48 +0100)]
avconv: Drop stray leftover debug output

4 years agoUse avpriv_report_missing_feature() where appropriate
Diego Biurrun [Wed, 16 Dec 2015 17:01:34 +0000 (18:01 +0100)]
Use avpriv_report_missing_feature() where appropriate

4 years agoconfigure: Add --quiet command line parameter to suppress informative output
Diego Biurrun [Sun, 6 Nov 2016 17:33:05 +0000 (18:33 +0100)]
configure: Add --quiet command line parameter to suppress informative output

4 years agofate: checkasm: Split monolithic test into individual components
Diego Biurrun [Thu, 3 Nov 2016 22:32:45 +0000 (23:32 +0100)]
fate: checkasm: Split monolithic test into individual components

4 years agocheckasm: Add --test parameter to check only specific components
Diego Biurrun [Thu, 3 Nov 2016 22:40:26 +0000 (23:40 +0100)]
checkasm: Add --test parameter to check only specific components

Inspired by a patch from Martin Storsjö <martin@martin.st>.

4 years agomov: Read multiple stsd from DV
Vittorio Giovara [Tue, 8 Nov 2016 03:30:22 +0000 (22:30 -0500)]
mov: Read multiple stsd from DV

Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
4 years agohevc: Support extradata changes from multiple stsd
Vittorio Giovara [Wed, 2 Nov 2016 16:03:18 +0000 (12:03 -0400)]
hevc: Support extradata changes from multiple stsd

Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
4 years agohevc: Allow parsing external extradata buffers
Vittorio Giovara [Mon, 7 Nov 2016 22:36:20 +0000 (17:36 -0500)]
hevc: Allow parsing external extradata buffers

4 years agohevc: Move hevc_decode_extradata before frame decoding
Vittorio Giovara [Wed, 2 Nov 2016 16:03:17 +0000 (12:03 -0400)]
hevc: Move hevc_decode_extradata before frame decoding

Avoids a forward-declaration in the following commit.

Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
4 years agolavc: Add hevc main10 profile to avconv cli
Vittorio Giovara [Wed, 2 Nov 2016 16:15:16 +0000 (12:15 -0400)]
lavc: Add hevc main10 profile to avconv cli

4 years agolavu: Rename ycgco color space appropriately
Vittorio Giovara [Mon, 31 Oct 2016 18:50:59 +0000 (14:50 -0400)]
lavu: Rename ycgco color space appropriately

Planes are ordered as the name suggests now.

Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
4 years agoh264_qpel: x86: Move function with only one instance out of template macro
Diego Biurrun [Sun, 3 Jan 2016 21:45:47 +0000 (22:45 +0100)]
h264_qpel: x86: Move function with only one instance out of template macro

libavcodec/x86/h264_qpel.c:392:785: warning: unused function 'ff_avg_h264_qpel8or16_hv1_lowpass_mmxext' [-Wunused-function]

4 years agoavplay: Correct function pointer assignments in options array
Diego Biurrun [Mon, 9 Nov 2015 11:55:37 +0000 (12:55 +0100)]
avplay: Correct function pointer assignments in options array

avplay.c:2928:5: warning: ISO C forbids initialization between function pointer and ‘void *’ [-Wpedantic]

4 years agoavconv: Correct function pointer assignments in options array
Diego Biurrun [Mon, 9 Nov 2015 11:54:53 +0000 (12:54 +0100)]
avconv: Correct function pointer assignments in options array

Fixes several warnings of the type
avconv_opt.c:2356:5: warning: ISO C forbids initialization between function pointer and ‘void *’ [-Wpedantic]

4 years agolzf: update pointer p after realloc
Andreas Cadhalpun [Fri, 4 Nov 2016 22:33:02 +0000 (23:33 +0100)]
lzf: update pointer p after realloc

This fixes heap-use-after-free detected by AddressSanitizer.

Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
4 years agoswscale: Add GRAY12
Luca Barbato [Thu, 3 Nov 2016 15:10:03 +0000 (16:10 +0100)]
swscale: Add GRAY12

4 years agopixfmt: Add GRAY12
Luca Barbato [Thu, 3 Nov 2016 15:03:54 +0000 (16:03 +0100)]
pixfmt: Add GRAY12

4 years agoqsv{enc,dec}: extend the internal frame allocator
Anton Khirnov [Wed, 10 Aug 2016 07:38:21 +0000 (09:38 +0200)]
qsv{enc,dec}: extend the internal frame allocator

Handle the internal frame requests, which is required by the HEVC
encoding plugin.

Signed-off-by: Maxym Dmytrychenko <maxym.dmytrychenko@intel.com>
4 years agoqsv{dec,enc}: use a struct as a memory id with internal memory allocator
Anton Khirnov [Wed, 10 Aug 2016 06:29:23 +0000 (08:29 +0200)]
qsv{dec,enc}: use a struct as a memory id with internal memory allocator

This will allow implementing the allocator more fully, which is needed
by the HEVC encoder plugin with video memory input.

Signed-off-by: Maxym Dmytrychenko <maxym.dmytrychenko@intel.com>
4 years agoqsv{dec,enc}: always use an internal mfxFrameSurface1
Anton Khirnov [Tue, 9 Aug 2016 10:05:49 +0000 (12:05 +0200)]
qsv{dec,enc}: always use an internal mfxFrameSurface1

For encoding, this avoids modifying the input surface, which we are not
allowed to do.
This will also be useful in the following commits.

Signed-off-by: Maxym Dmytrychenko <maxym.dmytrychenko@intel.com>
4 years agohwcontext_qsv: support frame mapping
Anton Khirnov [Thu, 6 Oct 2016 09:33:15 +0000 (11:33 +0200)]
hwcontext_qsv: support frame mapping

Signed-off-by: Maxym Dmytrychenko <maxym.dmytrychenko@intel.com>
4 years agohwcontext_qsv: transfer data through the child context when VPP fails
Anton Khirnov [Wed, 10 Aug 2016 12:58:08 +0000 (14:58 +0200)]
hwcontext_qsv: transfer data through the child context when VPP fails

Uploading/downloading data through VPP may not work for some formats, in
that case we can still try to call av_hwframe_transfer_data() on the
child context.

Signed-off-by: Maxym Dmytrychenko <maxym.dmytrychenko@intel.com>
4 years agohwcontext_qsv: do not fail when download/upload VPP session creation fails
Anton Khirnov [Wed, 10 Aug 2016 10:54:31 +0000 (12:54 +0200)]
hwcontext_qsv: do not fail when download/upload VPP session creation fails

Certain pixel formats (e.g. P8) might not be supported for
download/upload through VPP operations, but can still be used otherwise.

Signed-off-by: Maxym Dmytrychenko <maxym.dmytrychenko@intel.com>
4 years agohwcontext_qsv: add support for the P8 format
Anton Khirnov [Wed, 10 Aug 2016 11:01:55 +0000 (13:01 +0200)]
hwcontext_qsv: add support for the P8 format

When using GPU surfaces with QSV, one needs to supply a frame allocator,
which will be invoked to pass surface pools to libmfx.
For encoding, this allocator gets invoked not only for the pool of input
frames, but also for a separate pool of (apparently) reconstructed frames
and another pool of MFX_FOURCC_P8, which on Windows needs to return
D3DFMT_P8 D3D surfaces. Those are probably used to store the encoded
bitstream on the GPU.

Signed-off-by: Maxym Dmytrychenko <maxym.dmytrychenko@intel.com>
4 years agohwcontext_dxva2: add support for the P8 format
Anton Khirnov [Wed, 10 Aug 2016 11:01:55 +0000 (13:01 +0200)]
hwcontext_dxva2: add support for the P8 format

This format is used internally by the QSV encoder to store the encoded

Signed-off-by: Maxym Dmytrychenko <maxym.dmytrychenko@intel.com>
4 years agohwcontext_dxva2: frame mapping support
Anton Khirnov [Wed, 5 Oct 2016 11:39:44 +0000 (13:39 +0200)]
hwcontext_dxva2: frame mapping support

Signed-off-by: Maxym Dmytrychenko <maxym.dmytrychenko@intel.com>
4 years agodxva2: fix surface selection when compiled with both d3d11va and dxva2
Hendrik Leppkes [Mon, 7 Nov 2016 08:59:28 +0000 (09:59 +0100)]
dxva2: fix surface selection when compiled with both d3d11va and dxva2

Fixes a regression introduced in

Signed-off-by: Anton Khirnov <anton@khirnov.net>
4 years agolibx265: Add option to force IDR frames
Derek Buitenhuis [Sun, 6 Nov 2016 14:09:37 +0000 (14:09 +0000)]
libx265: Add option to force IDR frames

This is in the same the same vein as 380146924ecad2e05e9dcc5c3c2e1b5ba47c51e8.

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
Signed-off-by: Martin Storsjö <martin@martin.st>
4 years agox86: Drop stray semicolons after function definitions
Diego Biurrun [Fri, 30 Oct 2015 13:04:08 +0000 (14:04 +0100)]
x86: Drop stray semicolons after function definitions

libavcodec/x86/rv40dsp_init.c:97:2: warning: ISO C does not allow extra ‘;’ outside of a function [-Wpedantic]
libavcodec/x86/vp9dsp_init.c:94:40: warning: ISO C does not allow extra ‘;’ outside of a function [-Wpedantic]

4 years agoconfigure: Silence lld-link when getting the version number
Martin Storsjö [Thu, 3 Nov 2016 12:14:12 +0000 (14:14 +0200)]
configure: Silence lld-link when getting the version number

In recent lld-link versions, this command prints the version to
stdout, but also prints an error to stderr:

$ lld-link -flavor gnu --version
LLD 4.0.0 (trunk 285641)
lld-link: error: no input files
lld-link: error: target emulation unknown: -m or at least one .o file required

Signed-off-by: Martin Storsjö <martin@martin.st>
4 years agoarm: vp9mc: Insert a literal pool at the middle of the file
Martin Storsjö [Fri, 4 Nov 2016 07:16:22 +0000 (09:16 +0200)]
arm: vp9mc: Insert a literal pool at the middle of the file

This fixes errors like this when building non-pic binaries with armv6
as baseline:

Error: invalid literal constant: pool needs to be closer

Signed-off-by: Martin Storsjö <martin@martin.st>
4 years agohwcontext_vaapi: Frame mapping support
Mark Thompson [Tue, 25 Oct 2016 19:43:08 +0000 (20:43 +0100)]
hwcontext_vaapi: Frame mapping support

Can map to any supported software format (using a GPU copy if it
doesn't actually match the surface format underneath).