5 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>
5 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]

5 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

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

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

5 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>
5 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>
5 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()

5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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

5 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

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

5 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

5 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

5 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

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

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

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

5 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

5 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

5 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

5 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

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

5 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>
5 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>
5 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

5 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>
5 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

5 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>
5 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]

5 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]

5 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]

5 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>
5 years agoswscale: Add GRAY12
Luca Barbato [Thu, 3 Nov 2016 15:10:03 +0000 (16:10 +0100)]
swscale: Add GRAY12

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

5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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]

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

5 years agolavfi: Hardware map filter
Mark Thompson [Tue, 25 Oct 2016 19:40:17 +0000 (20:40 +0100)]
lavfi: Hardware map filter

Takes a frame associated with a hardware context as input and maps it
to something else (another hardware frame or normal memory) for other
processing.  If the frame to map was originally in the target format
(but mapped to something else), the original frame is output.

Also supports mapping backwards, where only the output has a hardware
context.  The link immediately before will be supplied with mapped
hardware frames which it can write directly into, and this filter
then unmaps them back to the actual hardware frames.

5 years agohwcontext: Hardware frame mapping
Mark Thompson [Tue, 25 Oct 2016 19:38:47 +0000 (20:38 +0100)]
hwcontext: Hardware frame mapping

Adds the new av_hwframe_map() function, which allows mapping between
hardware frames and normal memory, along with internal support for
implementing it.

Also adds av_hwframe_ctx_create_derived(), for creating a hardware
frames context associated with one device using frames mapped from
another by some hardware-specific means.

5 years agoDrop unreachable break and return statements
Diego Biurrun [Thu, 12 Mar 2015 23:39:31 +0000 (00:39 +0100)]
Drop unreachable break and return statements

5 years agofloat_dsp: Have implementation match function pointer prototype
Diego Biurrun [Mon, 31 Oct 2016 23:33:05 +0000 (00:33 +0100)]
float_dsp: Have implementation match function pointer prototype

libavutil/x86/float_dsp_init.c(144) : warning C4028: formal parameter 1 different from declaration
libavutil/x86/float_dsp_init.c(144) : warning C4028: formal parameter 2 different from declaration

5 years agodnxhdenc: Have function pointer prototype match implementation
Diego Biurrun [Mon, 31 Oct 2016 23:30:33 +0000 (00:30 +0100)]
dnxhdenc: Have function pointer prototype match implementation

libavcodec/dnxhdenc.c(326) : warning C4028: formal parameter 1 different from declaration
libavcodec/dnxhdenc.c(329) : warning C4028: formal parameter 1 different from declaration

5 years agopixblockdsp: Have function pointer prototype match implementation
Diego Biurrun [Mon, 31 Oct 2016 22:12:20 +0000 (23:12 +0100)]
pixblockdsp: Have function pointer prototype match implementation

libavcodec/pixblockdsp.c(58) : warning C4028: formal parameter 1 different from declaration
libavcodec/pixblockdsp.c(63) : warning C4028: formal parameter 1 different from declaration
libavcodec/pixblockdsp.c(66) : warning C4028: formal parameter 1 different from declaration

5 years agoituh263dec: Have function signature match across declaration and definition
Diego Biurrun [Mon, 31 Oct 2016 22:06:54 +0000 (23:06 +0100)]
ituh263dec: Have function signature match across declaration and definition

libavcodec/ituh263dec.c(215) : warning C4028: formal parameter 1 different from declaration
libavcodec/ituh263dec.c(215) : warning C4028: formal parameter 2 different from declaration

5 years agovf_hwupload_cuda: Fix build error
Mark Thompson [Thu, 3 Nov 2016 16:33:25 +0000 (16:33 +0000)]
vf_hwupload_cuda: Fix build error

Broken by e3fb74f7f9a8f1895381355f40c92cac3c1023d9.

Signed-off-by: Diego Biurrun <diego@biurrun.de>
5 years agosvq3: Drop unused function dctcoef_get()
Diego Biurrun [Mon, 31 Oct 2016 22:49:12 +0000 (23:49 +0100)]
svq3: Drop unused function dctcoef_get()

libavcodec/svq3.c:627:29: warning: unused function 'dctcoef_get' [-Wunused-function]

5 years agointrax8: Have function signature match across declaration and definition
Diego Biurrun [Tue, 20 Sep 2016 14:00:15 +0000 (16:00 +0200)]
intrax8: Have function signature match across declaration and definition

libavcodec/intrax8.c(776) : warning C4028: formal parameter 1 different from declaration

5 years agooptions_table: Remove a now unnecessary include of config.h
Martin Storsjö [Thu, 3 Nov 2016 08:39:24 +0000 (10:39 +0200)]
options_table: Remove a now unnecessary include of config.h

The include of config.h was added in 2012 in 1d9c2dc8, due to
the use of CONFIG_SNOW_ENCODER ifdefs within options_table.h.
When the snow codec was dropped later (in a0c5917f8 in 2013),
this include no longer served any purpose.

options_table.h is included in builds for the host as well, when
building documentation. config.h should not be included in code
that is built for the host, since it can contain workarounds
for the target compiler/environment, like adding a missing define
of restrict, defining getenv(x) to NULL for environments that lack

The seemingly innocent include reordering in 2025d37871 broke
builds that have getenv(x) defined to NULL in config.h (Windows CE
and Windows Phone/RT), since libavcodec/options_table.h include
config.h, while libavformat/options_table.h end up bringing in
more system headers, and those system headers can contain a proper
definition of getenv, which clash with the getenv define in config.h.
This was avoided earlier as long as libavformat/options_table.h (or
avformat.h) was included before libavcodec/options_table.h.

This fixes builds for Windows Phone/RT and CE.

Signed-off-by: Martin Storsjö <martin@martin.st>
5 years agoarm: vp9: Add NEON optimizations of VP9 MC functions
Martin Storsjö [Thu, 3 Nov 2016 07:12:08 +0000 (09:12 +0200)]
arm: vp9: Add NEON optimizations of VP9 MC functions

This work is sponsored by, and copyright, Google.

The filter coefficients are signed values, where the product of the
multiplication with one individual filter coefficient doesn't
overflow a 16 bit signed value (the largest filter coefficient is
127). But when the products are accumulated, the resulting sum can
overflow the 16 bit signed range. Instead of accumulating in 32 bit,
we accumulate the largest product (either index 3 or 4) last with a
saturated addition.

(The VP8 MC asm does something similar, but slightly simpler, by
accumulating each half of the filter separately. In the VP9 MC
filters, each half of the filter can also overflow though, so the
largest component has to be handled individually.)

Examples of relative speedup compared to the C version, from checkasm:
                       Cortex      A7     A8     A9    A53
vp9_avg4_neon:                   1.71   1.15   1.42   1.49
vp9_avg8_neon:                   2.51   3.63   3.14   2.58
vp9_avg16_neon:                  2.95   6.76   3.01   2.84
vp9_avg32_neon:                  3.29   6.64   2.85   3.00
vp9_avg64_neon:                  3.47   6.67   3.14   2.80
vp9_avg_8tap_smooth_4h_neon:     3.22   4.73   2.76   4.67
vp9_avg_8tap_smooth_4hv_neon:    3.67   4.76   3.28   4.71
vp9_avg_8tap_smooth_4v_neon:     5.52   7.60   4.60   6.31
vp9_avg_8tap_smooth_8h_neon:     6.22   9.04   5.12   9.32
vp9_avg_8tap_smooth_8hv_neon:    6.38   8.21   5.72   8.17
vp9_avg_8tap_smooth_8v_neon:     9.22  12.66   8.15  11.10
vp9_avg_8tap_smooth_64h_neon:    7.02  10.23   5.54  11.58
vp9_avg_8tap_smooth_64hv_neon:   6.76   9.46   5.93   9.40
vp9_avg_8tap_smooth_64v_neon:   10.76  14.13   9.46  13.37
vp9_put4_neon:                   1.11   1.47   1.00   1.21
vp9_put8_neon:                   1.23   2.17   1.94   1.48
vp9_put16_neon:                  1.63   4.02   1.73   1.97
vp9_put32_neon:                  1.56   4.92   2.00   1.96
vp9_put64_neon:                  2.10   5.28   2.03   2.35
vp9_put_8tap_smooth_4h_neon:     3.11   4.35   2.63   4.35
vp9_put_8tap_smooth_4hv_neon:    3.67   4.69   3.25   4.71
vp9_put_8tap_smooth_4v_neon:     5.45   7.27   4.49   6.52
vp9_put_8tap_smooth_8h_neon:     5.97   8.18   4.81   8.56
vp9_put_8tap_smooth_8hv_neon:    6.39   7.90   5.64   8.15
vp9_put_8tap_smooth_8v_neon:     9.03  11.84   8.07  11.51
vp9_put_8tap_smooth_64h_neon:    6.78   9.48   4.88  10.89
vp9_put_8tap_smooth_64hv_neon:   6.99   8.87   5.94   9.56
vp9_put_8tap_smooth_64v_neon:   10.69  13.30   9.43  14.34

For the larger 8tap filters, the speedup vs C code is around 5-14x.

This is significantly faster than libvpx's implementation of the same
functions, at least when comparing the put_8tap_smooth_64 functions
(compared to vpx_convolve8_horiz_neon and vpx_convolve8_vert_neon from

Absolute runtimes from checkasm:
                          Cortex      A7        A8        A9       A53
vp9_put_8tap_smooth_64h_neon:    20150.3   14489.4   19733.6   10863.7
libvpx vpx_convolve8_horiz_neon: 52623.3   19736.4   21907.7   25027.7

vp9_put_8tap_smooth_64v_neon:    14455.0   12303.9   13746.4    9628.9
libvpx vpx_convolve8_vert_neon:  42090.0   17706.2   17659.9   16941.2

Thus, on the A9, the horizontal filter is only marginally faster than
libvpx, while our version is significantly faster on the other cores,
and the vertical filter is significantly faster on all cores. The
difference is especially large on the A7.

The libvpx implementation does the accumulation in 32 bit, which
probably explains most of the differences.

Signed-off-by: Martin Storsjö <martin@martin.st>
5 years agovp9: Flip the order of arguments in MC functions
Martin Storsjö [Thu, 3 Nov 2016 07:12:02 +0000 (09:12 +0200)]
vp9: Flip the order of arguments in MC functions

This makes it match the pattern already used for VP8 MC functions.

This also makes the signature match ffmpeg's version of these
functions, easing porting of code in both directions.

Signed-off-by: Martin Storsjö <martin@martin.st>
5 years agolavfi: Always propagate hw_frames_ctx through links
Mark Thompson [Tue, 25 Oct 2016 19:42:27 +0000 (20:42 +0100)]
lavfi: Always propagate hw_frames_ctx through links

Also adds a new flag to mark filters which are aware of hwframes and
will perform this task themselves, and marks all appropriate filters
with this flag.

This is required to allow software-mapped hardware frames to work,
because we need to have the frames context available for any later
mapping operation in the filter graph.

The output from the filter graph should only propagate further to an
encoder if the hardware format actually matches the visible format
(mapped frames are valid here and have an hw_frames_ctx, but this
should not be given to the encoder as its hardware context).

5 years agolavfi: Use ff_get_video_buffer in all filters using hwframes
Mark Thompson [Mon, 31 Oct 2016 22:14:10 +0000 (22:14 +0000)]
lavfi: Use ff_get_video_buffer in all filters using hwframes

5 years agolavfi: Make default get_video_buffer work with hardware frames
Mark Thompson [Mon, 31 Oct 2016 22:14:04 +0000 (22:14 +0000)]
lavfi: Make default get_video_buffer work with hardware frames

5 years agodoc: Turn off noisy deprecation warnings in the option printer
Diego Biurrun [Fri, 4 Dec 2015 11:43:10 +0000 (12:43 +0100)]
doc: Turn off noisy deprecation warnings in the option printer

5 years agortmpproto: Restructure zlib code to avoid unreachable code warning
Diego Biurrun [Thu, 29 Oct 2015 12:39:49 +0000 (13:39 +0100)]
rtmpproto: Restructure zlib code to avoid unreachable code warning

libavformat\rtmpproto.c(1165) : warning C4702: unreachable code

5 years agobink: Have function pointer prototype match implementation
Diego Biurrun [Thu, 12 Mar 2015 23:38:57 +0000 (00:38 +0100)]
bink: Have function pointer prototype match implementation

libavcodec/binkdsp.c(156) : warning C4028: formal parameter 1 different from declaration

5 years agoidct: Have function pointer prototype match implementation
Diego Biurrun [Thu, 12 Mar 2015 23:35:37 +0000 (00:35 +0100)]
idct: Have function pointer prototype match implementation

libavcodec/idctdsp.c(175) : warning C4028: formal parameter 2 different from declaration

5 years agoaactab: Move extern keyword to the front of array declarations
Diego Biurrun [Mon, 9 Nov 2015 12:25:55 +0000 (13:25 +0100)]
aactab: Move extern keyword to the front of array declarations

libavcodec/aactab.h:49:1: warning: ‘extern’ is not at beginning of declaration [-Wold-style-declaration]

5 years agovf_drawtext: Move static keyword to beginning of variable declaration
Diego Biurrun [Fri, 30 Oct 2015 14:02:04 +0000 (15:02 +0100)]
vf_drawtext: Move static keyword to beginning of variable declaration

libavfilter/vf_drawtext.c:226:1: warning: ‘static’ is not at beginning of declaration [-Wold-style-declaration]

5 years agoexamples/decode_video: remove a stray unrelated comment
Anton Khirnov [Thu, 20 Oct 2016 09:03:20 +0000 (11:03 +0200)]
examples/decode_video: remove a stray unrelated comment

5 years agoexamples/decode_video: constify the AVCodec instance
Anton Khirnov [Thu, 20 Oct 2016 09:03:20 +0000 (11:03 +0200)]
examples/decode_video: constify the AVCodec instance

5 years agoexamples/encode_video: use the AVFrame API for allocating the frame
Anton Khirnov [Thu, 20 Oct 2016 09:03:20 +0000 (11:03 +0200)]
examples/encode_video: use the AVFrame API for allocating the frame

It is more efficient and so preferred over allocating the buffers

5 years agoexamples/encode_video: set the framerate
Anton Khirnov [Thu, 20 Oct 2016 09:03:20 +0000 (11:03 +0200)]
examples/encode_video: set the framerate

5 years agoexamples/encode_video: constify the AVCodec instance
Anton Khirnov [Thu, 20 Oct 2016 09:03:20 +0000 (11:03 +0200)]
examples/encode_video: constify the AVCodec instance

5 years agoexamples/avcodec: split the remaining two examples into separate files
Anton Khirnov [Wed, 19 Oct 2016 19:05:22 +0000 (21:05 +0200)]
examples/avcodec: split the remaining two examples into separate files

5 years agoexamples/decode_audio: constify the AVCodec instance
Anton Khirnov [Wed, 19 Oct 2016 19:56:22 +0000 (21:56 +0200)]
examples/decode_audio: constify the AVCodec instance

5 years agoexamples/avcodec: split audio decoding into a separate example
Anton Khirnov [Wed, 19 Oct 2016 19:05:22 +0000 (21:05 +0200)]
examples/avcodec: split audio decoding into a separate example

The four examples (audio/video encoding/decoding) are completely
independent so it makes little sense to have them all in one file.

5 years agoexamples/encode_audio: use the AVFrame API for allocating the data
Anton Khirnov [Wed, 19 Oct 2016 19:21:08 +0000 (21:21 +0200)]
examples/encode_audio: use the AVFrame API for allocating the data

It is simpler and more efficient.

5 years agoexamples/encode_audio: constify AVCodec instances
Anton Khirnov [Wed, 19 Oct 2016 19:07:43 +0000 (21:07 +0200)]
examples/encode_audio: constify AVCodec instances

5 years agoexamples/avcodec: split audio encoding into a separate example
Anton Khirnov [Wed, 19 Oct 2016 19:05:22 +0000 (21:05 +0200)]
examples/avcodec: split audio encoding into a separate example

The four examples (audio/video encoding/decoding) are completely
independent so it makes little sense to have them all in one file.

5 years agoavconv: support parsing bitstream filter options
James Almer [Sat, 29 Oct 2016 00:44:51 +0000 (21:44 -0300)]
avconv: support parsing bitstream filter options

Example usage:

avconv -i INPUT -bsf filter[=opt1=val1:opt2=val2] OUTPUT

Signed-off-by: James Almer <jamrial@gmail.com>
Signed-off-by: Anton Khirnov <anton@khirnov.net>
5 years agomov: Evaluate the movie display matrix
Vittorio Giovara [Mon, 24 Oct 2016 21:46:47 +0000 (17:46 -0400)]
mov: Evaluate the movie display matrix

This matrix needs to be applied after all others have (currently only
display matrix from trak), but cannot be handled in movie box, since
streams are not allocated yet. So store it in main context, and apply
it when appropriate, that is after parsing the tkhd one.

Fate tests are updated accordingly.

Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
5 years agofate: Add tests for mov display matrix
Vittorio Giovara [Mon, 24 Oct 2016 21:22:55 +0000 (17:22 -0400)]
fate: Add tests for mov display matrix

Rotation, sample/display aspect ratio and pure matrix export.

Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
5 years agoavprobe: Add -show_stream_entry to get a single stream property
Vittorio Giovara [Mon, 24 Oct 2016 21:22:54 +0000 (17:22 -0400)]
avprobe: Add -show_stream_entry to get a single stream property

This is needed for improved fate testing and it is modeled after
-show_format_entry. The main behavioral difference is that when a print
function is called with an empty key, rather than discarding it, the
closes key in the hierarchy is used instead.

Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
5 years agoopenssl: Allow newer TLS versions than TLSv1
Mark Thompson [Sun, 30 Oct 2016 14:57:30 +0000 (14:57 +0000)]
openssl: Allow newer TLS versions than TLSv1

The use of TLSv1_*_method() disallows newer protocol versions; instead
use SSLv23_*_method() and then explicitly disable the deprecated
protocol versions which should not be supported.

5 years agoxcb: Add all the libraries to the link line explicitly
Luca Barbato [Sun, 30 Oct 2016 16:44:49 +0000 (17:44 +0100)]
xcb: Add all the libraries to the link line explicitly

Avoid an underlink issue on recent distributions.

CC: libav-stable@libav.org
5 years agoRevert "rtmpproto: Don't include a client version in the unencrypted C1 handshake"
Luca Barbato [Sun, 30 Oct 2016 13:52:45 +0000 (14:52 +0100)]
Revert "rtmpproto: Don't include a client version in the unencrypted C1 handshake"

This reverts commit 7d8d726be7dc46343ab1c98c339c1ed44bcb07c1.

5 years agoqsv: Be informative when reporting that no data has been consumed
Luca Barbato [Sat, 29 Oct 2016 15:00:20 +0000 (17:00 +0200)]
qsv: Be informative when reporting that no data has been consumed

5 years agoUse avpriv_request_sample() where appropriate
Diego Biurrun [Wed, 16 Dec 2015 17:02:04 +0000 (18:02 +0100)]
Use avpriv_request_sample() where appropriate