libav-oracle.git
2 months agocheckasm/h264: test 4:2:2 chroma loop filter functions master
Janne Grunau [Wed, 27 Feb 2019 19:51:48 +0000 (20:51 +0100)]
checkasm/h264: test 4:2:2 chroma loop filter functions

2 months agoh264/arm64: implement missing 4:2:2 chroma loop filter neon functions
Janne Grunau [Wed, 27 Feb 2019 20:51:27 +0000 (21:51 +0100)]
h264/arm64: implement missing 4:2:2 chroma loop filter neon functions

3 months agoaarch64: vp8: Optimize vp8_idct_add_neon for aarch64
Martin Storsjö [Thu, 31 Jan 2019 22:12:46 +0000 (00:12 +0200)]
aarch64: vp8: Optimize vp8_idct_add_neon for aarch64

The previous version was a pretty exact translation of the arm
version. This version does do some unnecessary arithemetic (it does
more operations on vectors that are only half filled; it does 4
uaddw and 4 sqxtun instead of 2 of each), but it reduces the overhead
of packing data together (which could be done for free in the arm
version).

This gives a decent speedup on Cortex A53, a minor speedup on
A72 and a very minor slowdown on Cortex A73.

Before:        Cortex A53    A72    A73
vp8_idct_add_neon:   79.7   67.5   65.0
After:
vp8_idct_add_neon:   67.7   64.8   66.7

Signed-off-by: Martin Storsjö <martin@martin.st>
3 months agoaarch64: vp8: Skip saturating in shrn in ff_vp8_idct_add_neon
Martin Storsjö [Thu, 31 Jan 2019 22:00:58 +0000 (00:00 +0200)]
aarch64: vp8: Skip saturating in shrn in ff_vp8_idct_add_neon

The original arm version didn't do saturation here. This probably
doesn't make any difference for performance, but reduces the
differences.

Signed-off-by: Martin Storsjö <martin@martin.st>
3 months agoaarch64: vp8: Optimize put_epel16_h6v6 with vp8_epel8_v6_y2
Martin Storsjö [Fri, 1 Feb 2019 07:47:30 +0000 (09:47 +0200)]
aarch64: vp8: Optimize put_epel16_h6v6 with vp8_epel8_v6_y2

This makes it similar to put_epel16_v6, and gives a large speedup
on Cortex A53, a minor speedup on A72 and a very minor slowdown on
A73.

Before:                 Cortex A53     A72     A73
vp8_put_epel16_h6v6_neon:   2211.4  1586.5  1431.7
After:
vp8_put_epel16_h6v6_neon:   1736.9  1522.0  1448.1

Signed-off-by: Martin Storsjö <martin@martin.st>
3 months agoarm: vp8: Optimize put_epel16_h6v6 with vp8_epel8_v6_y2
Martin Storsjö [Fri, 1 Feb 2019 09:05:22 +0000 (11:05 +0200)]
arm: vp8: Optimize put_epel16_h6v6 with vp8_epel8_v6_y2

This makes it similar to put_epel16_v6, and gives a 10-25%
speedup of this function.

Before:                   Cortex A7       A8       A9      A53     A72
vp8_put_epel16_h6v6_neon:    3058.0   2218.5   2459.8   2183.0  1572.2
After:
vp8_put_epel16_h6v6_neon:    2670.8   1934.2   2244.4   1729.4  1503.9

Signed-off-by: Martin Storsjö <martin@martin.st>
3 months agoaarch64: vp8: Port bilin functions from arm version
Martin Storsjö [Fri, 1 Feb 2019 08:08:20 +0000 (10:08 +0200)]
aarch64: vp8: Port bilin functions from arm version

                      Cortex A53     A72     A73
vp8_put_bilin4_h_c:        303.8   102.2   161.8
vp8_put_bilin4_h_neon:     100.0    40.9    41.2
vp8_put_bilin4_hv_c:       322.8   201.0   305.9
vp8_put_bilin4_hv_neon:    156.8    72.6    77.0
vp8_put_bilin4_v_c:        304.7   101.7   166.5
vp8_put_bilin4_v_neon:      82.7    41.2    33.0
vp8_put_bilin8_h_c:       1192.7   352.5   623.8
vp8_put_bilin8_h_neon:     213.5    70.2    87.8
vp8_put_bilin8_hv_c:      1098.6   769.2  1041.9
vp8_put_bilin8_hv_neon:    324.0   123.5   146.0
vp8_put_bilin8_v_c:       1193.9   350.4   617.7
vp8_put_bilin8_v_neon:     183.9    60.7    64.7
vp8_put_bilin16_h_c:      2353.1   671.2  1223.3
vp8_put_bilin16_h_neon:    261.9   140.7   145.0
vp8_put_bilin16_hv_c:     2453.2  1470.9  2355.2
vp8_put_bilin16_hv_neon:   383.9   196.0   217.0
vp8_put_bilin16_v_c:      2349.3   669.8  1251.2
vp8_put_bilin16_v_neon:    202.9   110.7    96.2

Signed-off-by: Martin Storsjö <martin@martin.st>
3 months agoaarch64: vp8: Port epel4 functions from arm version
Martin Storsjö [Fri, 1 Feb 2019 08:08:05 +0000 (10:08 +0200)]
aarch64: vp8: Port epel4 functions from arm version

                      Cortex A53    A72    A73
vp8_put_epel4_h4_c:        631.4  291.7  367.8
vp8_put_epel4_h4_neon:     241.0  131.0  155.7
vp8_put_epel4_h4v4_c:      967.5  529.3  667.7
vp8_put_epel4_h4v4_neon:   429.3  241.8  279.7
vp8_put_epel4_h4v6_c:     1374.7  657.5  864.5
vp8_put_epel4_h4v6_neon:   515.5  295.5  334.7
vp8_put_epel4_h6_c:        851.0  421.0  486.0
vp8_put_epel4_h6_neon:     321.5  195.0  217.7
vp8_put_epel4_h6v4_c:     1111.3  621.1  781.2
vp8_put_epel4_h6v4_neon:   539.2  328.0  365.3
vp8_put_epel4_h6v6_c:     1561.3  763.3  999.7
vp8_put_epel4_h6v6_neon:   645.5  401.0  434.7
vp8_put_epel4_v4_c:        663.8  298.3  357.0
vp8_put_epel4_v4_neon:     116.0   81.5   72.5
vp8_put_epel4_v6_c:        870.5  437.0  507.4
vp8_put_epel4_v6_neon:     147.7  108.8   92.0

Signed-off-by: Martin Storsjö <martin@martin.st>
3 months agoaarch64: vp8: Port missing epel8 functions from arm version
Martin Storsjö [Fri, 1 Feb 2019 08:05:56 +0000 (10:05 +0200)]
aarch64: vp8: Port missing epel8 functions from arm version

                      Cortex A53     A72     A73
vp8_put_epel8_h4_c:       2594.8  1159.6  1374.8
vp8_put_epel8_h4_neon:     506.4   244.2   314.0
vp8_put_epel8_h6_c:       3445.8  1677.1  1811.3
vp8_put_epel8_h6_neon:     634.4   371.7   433.0
vp8_put_epel8_v4_c:       2614.0  1174.8  1378.0
vp8_put_epel8_v4_neon:     321.0   221.7   235.8
vp8_put_epel8_v6_c:       3635.5  1703.0  2079.2
vp8_put_epel8_v6_neon:     416.9   317.0   295.5

Signed-off-by: Martin Storsjö <martin@martin.st>
3 months agoaarch64: vp8: Port vp8_luma_dc_wht and vp8_idct_dc_add4uv from arm version
Martin Storsjö [Fri, 1 Feb 2019 08:04:56 +0000 (10:04 +0200)]
aarch64: vp8: Port vp8_luma_dc_wht and vp8_idct_dc_add4uv from arm version

                     Cortex A53    A72    A73
vp8_luma_dc_wht_c:        115.7   75.7   90.7
vp8_luma_dc_wht_neon:      60.7   41.2   45.7
vp8_idct_dc_add4uv_c:     376.1  262.9  282.5
vp8_idct_dc_add4uv_neon:   52.0   29.0   37.0

Signed-off-by: Martin Storsjö <martin@martin.st>
3 months agoaarch64: vp8: Fix a typo in a comment
Martin Storsjö [Thu, 31 Jan 2019 21:36:15 +0000 (23:36 +0200)]
aarch64: vp8: Fix a typo in a comment

Signed-off-by: Martin Storsjö <martin@martin.st>
3 months agoaarch64: vp8: Reorder the function pointer inits to match the arm original
Martin Storsjö [Thu, 31 Jan 2019 21:13:13 +0000 (23:13 +0200)]
aarch64: vp8: Reorder the function pointer inits to match the arm original

Signed-off-by: Martin Storsjö <martin@martin.st>
3 months agoaarch64: vp8: Move the vp8dsp makefile entries to the right places
Martin Storsjö [Thu, 31 Jan 2019 21:03:55 +0000 (23:03 +0200)]
aarch64: vp8: Move the vp8dsp makefile entries to the right places

Even if NEON would be disabled, the init functions should be built
as they are called as long as ARCH_AARCH64 is set.

These functions are part of a generic DSP subsytem, not tied directly
to one decoder. (They should be built if the vp7 decoder is enabled,
even if the vp8 decoder is disabled.)

Signed-off-by: Martin Storsjö <martin@martin.st>
3 months agoaarch64: vp8: Remove superfluous includes
Martin Storsjö [Thu, 31 Jan 2019 21:03:38 +0000 (23:03 +0200)]
aarch64: vp8: Remove superfluous includes

This fixes building with MSVC, which lacks unistd.h.

Signed-off-by: Martin Storsjö <martin@martin.st>
3 months agoaarch64: vp8: Use the proper aarch64 form for conditional branches
Martin Storsjö [Fri, 1 Feb 2019 09:01:40 +0000 (11:01 +0200)]
aarch64: vp8: Use the proper aarch64 form for conditional branches

The previous form also does seem to assemble on current tools,
but I think it might fail on some older aarch64 tools.

Signed-off-by: Martin Storsjö <martin@martin.st>
3 months agoaarch64: vp8: Fix assembling with armasm64
Martin Storsjö [Thu, 31 Jan 2019 21:49:31 +0000 (23:49 +0200)]
aarch64: vp8: Fix assembling with armasm64

Signed-off-by: Martin Storsjö <martin@martin.st>
3 months agoaarch64: vp8: Fix assembling with clang
Martin Storsjö [Thu, 31 Jan 2019 21:43:45 +0000 (23:43 +0200)]
aarch64: vp8: Fix assembling with clang

This also partially fixes assembling with MS armasm64 (via
gas-preprocessor).

The movrel macro invocations need to pass the offset via a separate
parameter. Mach-o and COFF relocations don't allow a negative
offset to a symbol, which is handled properly if the offset is passed
via the parameter. If no offset parameter is given, the macro
evaluates to something like "adrp x17, subpel_filters-16+(0)", which
older clang versions also fail to parse (the older clang versions
only support one single offset term, although it can be a parenthesis.

Signed-off-by: Martin Storsjö <martin@martin.st>
3 months agolibavcodec: vp8 neon optimizations for aarch64
Magnus Röös [Thu, 31 Jan 2019 16:04:27 +0000 (17:04 +0100)]
libavcodec: vp8 neon optimizations for aarch64

Partial port of the ARM Neon for aarch64.

Benchmarks from fate:

benchmarking with Linux Perf Monitoring API
nop: 58.6
checkasm: using random seed 1760970128
NEON:
 - vp8dsp.idct       [OK]
 - vp8dsp.mc         [OK]
 - vp8dsp.loopfilter [OK]
checkasm: all 21 tests passed
vp8_idct_add_c: 201.6
vp8_idct_add_neon: 83.1
vp8_idct_dc_add_c: 107.6
vp8_idct_dc_add_neon: 33.8
vp8_idct_dc_add4y_c: 426.4
vp8_idct_dc_add4y_neon: 59.4
vp8_loop_filter8uv_h_c: 688.1
vp8_loop_filter8uv_h_neon: 216.3
vp8_loop_filter8uv_inner_h_c: 649.3
vp8_loop_filter8uv_inner_h_neon: 195.3
vp8_loop_filter8uv_inner_v_c: 544.8
vp8_loop_filter8uv_inner_v_neon: 131.3
vp8_loop_filter8uv_v_c: 706.1
vp8_loop_filter8uv_v_neon: 141.1
vp8_loop_filter16y_h_c: 668.8
vp8_loop_filter16y_h_neon: 242.8
vp8_loop_filter16y_inner_h_c: 647.3
vp8_loop_filter16y_inner_h_neon: 224.6
vp8_loop_filter16y_inner_v_c: 647.8
vp8_loop_filter16y_inner_v_neon: 128.8
vp8_loop_filter16y_v_c: 721.8
vp8_loop_filter16y_v_neon: 154.3
vp8_loop_filter_simple_h_c: 387.8
vp8_loop_filter_simple_h_neon: 187.6
vp8_loop_filter_simple_v_c: 384.1
vp8_loop_filter_simple_v_neon: 78.6
vp8_put_epel8_h4v4_c: 3971.1
vp8_put_epel8_h4v4_neon: 855.1
vp8_put_epel8_h4v6_c: 5060.1
vp8_put_epel8_h4v6_neon: 989.6
vp8_put_epel8_h6v4_c: 4320.8
vp8_put_epel8_h6v4_neon: 1007.3
vp8_put_epel8_h6v6_c: 5449.3
vp8_put_epel8_h6v6_neon: 1158.1
vp8_put_epel16_h6_c: 6683.8
vp8_put_epel16_h6_neon: 831.8
vp8_put_epel16_h6v6_c: 11110.8
vp8_put_epel16_h6v6_neon: 2214.8
vp8_put_epel16_v6_c: 7024.8
vp8_put_epel16_v6_neon: 799.6
vp8_put_pixels8_c: 112.8
vp8_put_pixels8_neon: 78.1
vp8_put_pixels16_c: 131.3
vp8_put_pixels16_neon: 129.8

This contains a fix to include guards by Carl Eugen Hoyos.

Signed-off-by: Martin Storsjö <martin@martin.st>
3 months agoUnbreak travis on macos
Luca Barbato [Tue, 12 Feb 2019 12:53:04 +0000 (13:53 +0100)]
Unbreak travis on macos

3 months agotests: Add a convenience function for video-only lavf tests
Diego Biurrun [Wed, 8 Aug 2018 20:06:38 +0000 (22:06 +0200)]
tests: Add a convenience function for video-only lavf tests

Rename a test in the process for consistency and simplicity and
remove the remnants of the now-unused lavf regression test scripts.

3 months agotests: Convert lavf container tests to non-legacy test scripts
Diego Biurrun [Sat, 2 Feb 2019 12:58:08 +0000 (13:58 +0100)]
tests: Convert lavf container tests to non-legacy test scripts

Rename some tests in the process for consistency and simplicity.

3 months agotests: Convert lavf pixfmt conversion tests to non-legacy test scripts
Diego Biurrun [Tue, 14 Aug 2018 09:07:10 +0000 (11:07 +0200)]
tests: Convert lavf pixfmt conversion tests to non-legacy test scripts

Also split monolithic lavf-pixfmt test into individual tests.

3 months agotests: Convert lavf image tests to non-legacy test scripts
Diego Biurrun [Sat, 2 Feb 2019 12:54:47 +0000 (13:54 +0100)]
tests: Convert lavf image tests to non-legacy test scripts

Rename some tests in the process for consistency and simplicity.

3 months agotests: Convert audio-only lavf tests to non-legacy test scripts
Diego Biurrun [Sat, 2 Feb 2019 12:49:53 +0000 (13:49 +0100)]
tests: Convert audio-only lavf tests to non-legacy test scripts

Rename some tests in the process for consistency and simplicity.

3 months agotests: Convert image2pipe tests to non-legacy test scripts
Diego Biurrun [Wed, 8 Aug 2018 20:17:49 +0000 (22:17 +0200)]
tests: Convert image2pipe tests to non-legacy test scripts

3 months agotests: Use a predefined function for lavf-rm test
Diego Biurrun [Tue, 14 Aug 2018 12:11:46 +0000 (14:11 +0200)]
tests: Use a predefined function for lavf-rm test

3 months agotests: Enable CRC test for yuv4mpeg
Diego Biurrun [Tue, 14 Aug 2018 10:44:55 +0000 (12:44 +0200)]
tests: Enable CRC test for yuv4mpeg

3 months agotests: Drop duplicate variable declaration
Diego Biurrun [Thu, 20 Sep 2018 07:33:51 +0000 (09:33 +0200)]
tests: Drop duplicate variable declaration

3 months agotests: Unify output directory creation
Diego Biurrun [Fri, 1 Feb 2019 21:40:38 +0000 (22:40 +0100)]
tests: Unify output directory creation

3 months agobuild: Rename OBJDIRS variable to OUTDIRS
Diego Biurrun [Sun, 3 Feb 2019 11:59:57 +0000 (12:59 +0100)]
build: Rename OBJDIRS variable to OUTDIRS

These directories are not just for object files.

3 months agosrt: Set srto_sender flag to sender srt socket
Sven Dueking [Thu, 7 Feb 2019 08:38:16 +0000 (09:38 +0100)]
srt: Set srto_sender flag to sender srt socket

SRT API Documentation:
This flag is superfluous if both parties are at least version 1.3.0
(this shall be enforced by setting this value to SRTO_MINVERSION if
you expect that it be true) and therefore support HSv5 handshake,
where the SRT extended handshake is done with the overall handshake
process.

This flag is however obligatory if at least one party may be using
SRT below version 1.3.0 and does not support HSv5.

3 months agoh264/x86: sign extend int stride in deblock functions
Janne Grunau [Sun, 27 Jan 2019 10:06:34 +0000 (11:06 +0100)]
h264/x86: sign extend int stride in deblock functions

Fixes checkasm errors after adding the h264 deblock tests.

3 months agolibopenh264dec: Use a newer decoding entry point function
Martin Storsjö [Fri, 25 Jan 2019 08:28:46 +0000 (10:28 +0200)]
libopenh264dec: Use a newer decoding entry point function

The "new" entry point actually has existed since OpenH264 1.4 in
2015 and is the the recommended decoding entry point.

The name of this function, DecodeFrameNoDelay, is rather backwards
considering that it doesn't return the latest decoded frame immediately,
but actually does proper delaying and reordering of frames.

Signed-off-by: Martin Storsjö <martin@martin.st>
3 months agoh264/aarch64: add intra loop filter neon asm
Janne Grunau [Mon, 13 Aug 2018 18:43:19 +0000 (20:43 +0200)]
h264/aarch64: add intra loop filter neon asm

Add my neon asm from x264 relicensed under the LGPL 2.1 or later. Ported
(x264 uses nv12 chroma) and optimized.

Cycle count for checkasm --bench on a Snapdragon 820e:
h264_h_loop_filter_luma_intra_8bpp_c: 60.0
h264_h_loop_filter_luma_intra_8bpp_neon: 54.2
h264_v_loop_filter_luma_intra_8bpp_c: 148.3
h264_v_loop_filter_luma_intra_8bpp_neon: 73.8
h264_h_loop_filter_chroma_intra_8bpp_c: 27.8
h264_h_loop_filter_chroma_intra_8bpp_neon: 21.4
h264_h_loop_filter_chroma_mbaff_intra_8bpp_c: 15.8
h264_h_loop_filter_chroma_mbaff_intra_8bpp_neon: 15.7
h264_v_loop_filter_chroma_intra_8bpp_c: 45.8
h264_v_loop_filter_chroma_intra_8bpp_neon: 17.3

3 months agoh264/aarch64: optimize neon loop filter
Janne Grunau [Tue, 1 Jan 2019 21:37:11 +0000 (22:37 +0100)]
h264/aarch64: optimize neon loop filter

Exit as soon as possible if no filtering will be done.

Improves the checkasm --bench cycle count on a Snapdragon 820e:
h264_h_loop_filter_luma_8bpp_c:      72.4 ->  72.5
h264_h_loop_filter_luma_8bpp_neon:   97.1 ->  56.3
h264_v_loop_filter_luma_8bpp_c:     174.0 -> 173.5
h264_v_loop_filter_luma_8bpp_neon:   62.9 ->  60.9
h264_h_loop_filter_chroma_8bpp_c:    30.2 ->  30.3
h264_h_loop_filter_chroma_8bpp_neon: 51.6 ->  25.7
h264_v_loop_filter_chroma_8bpp_c:    57.3 ->  57.3
h264_v_loop_filter_chroma_8bpp_neon: 28.0 ->  24.0

3 months agocheckasm/h264: add loop filter tests
Janne Grunau [Tue, 1 Jan 2019 17:25:55 +0000 (18:25 +0100)]
checkasm/h264: add loop filter tests

3 months agoh264/aarch64: sign extend int stride in loop filter asm
Janne Grunau [Tue, 1 Jan 2019 17:16:33 +0000 (18:16 +0100)]
h264/aarch64: sign extend int stride in loop filter asm

3 months agoarm: Create proper .rdata sections for COFF
Martin Storsjö [Fri, 11 Jan 2019 13:23:16 +0000 (15:23 +0200)]
arm: Create proper .rdata sections for COFF

As .rodata isn't one of the default created sections for COFF, it was
created as a read-write data section. By using the default .rdata
section name for COFF, it automatically becomes a read-only data section.
The existing ".section .rodata" works as intended for ELF though.

This is based on an original patch and diagnose by Tom Tan
<Tom.Tan@microsoft.com>.

Signed-off-by: Martin Storsjö <martin@martin.st>
4 months agoavcodec/libdav1d: properly free all output picture references
James Almer [Wed, 23 Jan 2019 20:39:20 +0000 (17:39 -0300)]
avcodec/libdav1d: properly free all output picture references

Dav1dPictures contain more than one buffer reference, so we're forced to use the
API properly to free them all.

Signed-off-by: James Almer <jamrial@gmail.com>
4 months agocook: Use the correct table for 6-bit stereo coupling
Luca Barbato [Sun, 14 Oct 2018 19:31:07 +0000 (21:31 +0200)]
cook: Use the correct table for 6-bit stereo coupling

Thanks to Kostya for digging it out and telling me.

5 months agolibdav1d: update API usage to the first stable release
James Almer [Tue, 11 Dec 2018 15:59:09 +0000 (12:59 -0300)]
libdav1d: update API usage to the first stable release

The color fields were moved to another struct, and a way to propagate
timestamps and other input metadata was introduced, so the packet
fifo can be removed.

Add support for 12bit streams, an option to disable film grain, and
read the profile from the sequence header referenced by the ouput
picture instead of guessing based on output pix_fmt.

Signed-off-by: James Almer <jamrial@gmail.com>
6 months agolibdav1d: fix build after a recent API break
James Almer [Thu, 15 Nov 2018 01:04:35 +0000 (22:04 -0300)]
libdav1d: fix build after a recent API break

Signed-off-by: James Almer <jamrial@gmail.com>
6 months agoqsvenc: Add VDENC support for H264 and HEVC
Linjie Fu [Mon, 5 Nov 2018 02:28:59 +0000 (10:28 +0800)]
qsvenc: Add VDENC support for H264 and HEVC

Add VDENC(lowpower mode) support for QSV h264 and HEVC

It's an experimental function(like lowpower in vaapi) with
some limitations:
- CBR/VBR require HuC which should be explicitly loaded via i915
module parameter(i915.enable_guc=2 for linux kerner version >= 4.16)
- HEVC VDENC was supported >= ICE LAKE

use option "-low_power 1" to enable VDENC.

Signed-off-by: Linjie Fu <linjie.fu@intel.com>
6 months agoavcodec: libdav1d AV1 decoder wrapper.
James Almer [Tue, 6 Nov 2018 04:11:22 +0000 (01:11 -0300)]
avcodec: libdav1d AV1 decoder wrapper.

Originally written by Ronald S. Bultje, with fixes, optimizations and
improvements by James Almer.

Signed-off-by: James Almer <jamrial@gmail.com>
6 months agoswscale: Add GRAY10
Carl Eugen Hoyos [Tue, 6 Nov 2018 05:08:05 +0000 (02:08 -0300)]
swscale: Add GRAY10

Based on ab839054 by Luca Barbato.

Signed-off-by: James Almer <jamrial@gmail.com>
6 months agopixfmt: Add GRAY10
Carl Eugen Hoyos [Tue, 6 Nov 2018 04:39:03 +0000 (01:39 -0300)]
pixfmt: Add GRAY10

Based on 7471352f by Luca Barbato.

Signed-off-by: James Almer <jamrial@gmail.com>
6 months agolibx264: Pass the reordered_opaque field through the encoder
Martin Storsjö [Thu, 11 Oct 2018 13:03:10 +0000 (16:03 +0300)]
libx264: Pass the reordered_opaque field through the encoder

libx264 does have a field for opaque data to pass along with frames
through the encoder, but it is a pointer, while the libavcodec
reordered_opaque field is an int64_t. Therefore, allocate an array
within the libx264 wrapper, where reordered_opaque values in flight
are stored, and pass a pointer to this array to libx264.

Update the public libavcodec documentation for the AVCodecContext
field to explain this usage, and add a codec capability that allows
detecting whether an encoder handles this field.

Signed-off-by: Martin Storsjö <martin@martin.st>
6 months agolibavutil: Undeprecate the AVFrame reordered_opaque field
Martin Storsjö [Thu, 25 Oct 2018 12:41:26 +0000 (15:41 +0300)]
libavutil: Undeprecate the AVFrame reordered_opaque field

This was marked as deprecated (but only in the doxygen, not with an
actual deprecation attribute) in 81c623fae05 in 2011, but was
undeprecated in ad1ee5fa7.

Signed-off-by: Martin Storsjö <martin@martin.st>
6 months agolibaom: remove references to yuva444p pixfmt
James Almer [Fri, 26 Oct 2018 02:12:05 +0000 (23:12 -0300)]
libaom: remove references to yuva444p pixfmt

Support for it was apparently never in the codebase, and the enum
value was recently removed from the public headers [1]

[1] https://aomedia.googlesource.com/aom/+/f1570f0c2f70832dd170285f8de60bd2379c8efa

Signed-off-by: James Almer <jamrial@gmail.com>
6 months agoRevert "decode: copy the output parameters from the last bsf in the chain back to...
James Almer [Wed, 12 Sep 2018 18:21:09 +0000 (15:21 -0300)]
Revert "decode: copy the output parameters from the last bsf in the chain back to the AVCodecContext"

This reverts commit 662558f985f50834eebe82d6b6854c66f33ab320.

The avcodec_parameters_to_context() call was freeing and reallocating
AVCodecContext->extradata, essentially taking ownership of it, which according
to the doxy is user owned. This is an API break and has produces crashes in
some library users like Firefox.
Revert until a better solution is found to internally propagate the filtered
extradata back into the decoder context.

Signed-off-by: James Almer <jamrial@gmail.com>
7 months agolavc/qsvenc_jpeg: set a default quality
Zhong Li [Thu, 11 Oct 2018 09:26:13 +0000 (17:26 +0800)]
lavc/qsvenc_jpeg: set a default quality

Keep alignment with vaapi mjpeg encoder.

Signed-off-by: Zhong Li <zhong.li@intel.com>
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
7 months agolavc/qsvenc_jpeg: add async_depth support
Zhong Li [Thu, 11 Oct 2018 09:26:12 +0000 (17:26 +0800)]
lavc/qsvenc_jpeg: add async_depth support

Currently qsv (m)jpeg encoding is broken.
Regression introducing by the commit(id: c1bcd3): fix async support,
which requires the minimum async_depth to be 1, instead previous zero.
But the default async_depth of qsv (m)jpeg encoding is still initialized
(mostly) as zero.

This patch also abviously improves qsv (m)jpeg encoding performance
due to the default async_depth is changed to 4.

Signed-off-by: Zhong Li <zhong.li@intel.com>
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
7 months agoarm: Emit .thumb_func directives
Martin Storsjö [Fri, 12 Oct 2018 10:29:51 +0000 (13:29 +0300)]
arm: Emit .thumb_func directives

Prior to Xcode 9.3, the clang built-in assembler didn't support
altmacro, and gas-preprocessor was used for assembling for arm/darwin.

For thumb functions, gas-preprocessor took care of adding the .thumb_func
directives, but when now being able to assemble without gas-preprocessor,
we need to add these directives ourselves.

Signed-off-by: Martin Storsjö <martin@martin.st>
7 months agoavcodec/libaomenc: export the Sequence Header OBU as extradata
James Almer [Mon, 8 Oct 2018 16:19:06 +0000 (13:19 -0300)]
avcodec/libaomenc: export the Sequence Header OBU as extradata

Signed-off-by: James Almer <jamrial@gmail.com>
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
7 months agoavcodec/libaomenc: remove AVOption related to frame partitions
James Almer [Wed, 12 Sep 2018 14:44:56 +0000 (11:44 -0300)]
avcodec/libaomenc: remove AVOption related to frame partitions

Support for it was apparently never in the codebase, and the enum
value was recently removed from the public headers [1]

[1] https://aomedia.googlesource.com/aom/+/df4ffb73140fe31bebdabd17c1a7b53721e74838

Signed-off-by: James Almer <jamrial@gmail.com>
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
7 months agoavcodec/extract_extradata: don't uninitialize the H2645Packet on every processed...
James Almer [Sat, 10 Mar 2018 22:57:35 +0000 (19:57 -0300)]
avcodec/extract_extradata: don't uninitialize the H2645Packet on every processed packet

Based on hevc_parser code. This prevents repeated unnecessary allocations
and frees on every packet processed by the bsf.

Reviewed-by: Jun Zhao <mypopydev@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
7 months agoavcodec/extract_extradata: Move the reference in the bsf internal buffer
James Almer [Sun, 11 Mar 2018 16:45:05 +0000 (13:45 -0300)]
avcodec/extract_extradata: Move the reference in the bsf internal buffer

There is no need to allocate a new packet for it.

Reviewed-by: Mark Thompson <sw@jkqxz.net>
Signed-off-by: James Almer <jamrial@gmail.com>
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
7 months agoavcodec/extract_extradata: Do not allocate more space than needed when removing NALUs...
James Almer [Fri, 9 Mar 2018 17:31:30 +0000 (14:31 -0300)]
avcodec/extract_extradata: Do not allocate more space than needed when removing NALUs in h264/hevc

Signed-off-by: James Almer <jamrial@gmail.com>
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
7 months agoavcodec/extract_extradata: Zero-initialize the padding bytes in all allocated buffers
James Almer [Fri, 9 Mar 2018 16:00:55 +0000 (13:00 -0300)]
avcodec/extract_extradata: Zero-initialize the padding bytes in all allocated buffers

Reviewed-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
7 months agoavcodec/extract_extradata_bsf: Fix leak discovered via fuzzing
Nikolas Bowe [Tue, 5 Dec 2017 23:11:26 +0000 (15:11 -0800)]
avcodec/extract_extradata_bsf: Fix leak discovered via fuzzing

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
7 months agoavcodec/bsf: Add ff_bsf_get_packet_ref() function
Jan Sebechlebsky [Thu, 28 Jul 2016 16:18:13 +0000 (18:18 +0200)]
avcodec/bsf: Add ff_bsf_get_packet_ref() function

Use of this function can save unnecessary malloc operation
in bitstream filter.

Signed-off-by: Jan Sebechlebsky <sebechlebskyjan@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
7 months agolavu/qsv: fix a random hwupload failure regression
Zhong Li [Sun, 30 Sep 2018 09:59:52 +0000 (17:59 +0800)]
lavu/qsv: fix a random hwupload failure regression

Variable 'ret' hasn't been initialized,thus introducing a random
hwupload failure regression due to qsv session uninitialized.

Signed-off-by: Zhong Li <zhong.li@intel.com>
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
8 months agoqsvenc: AV_PIX_FMT_QSV path should release frame
Maxym Dmytrychenko [Tue, 18 Sep 2018 07:47:52 +0000 (09:47 +0200)]
qsvenc: AV_PIX_FMT_QSV path should release frame

Fixes high memory usage and prevents over allocation of the frames via
proper unref.

Can be checked as:
-hwaccel qsv -c:v h264_qsv -i ../h264-conformance/CANL2_Sony_E.jsv -c:v
h264_qsv -b:v 2000k -y qsv.mp4

8 months agolibfdk-aac: Don't use defined() in a #define
Martin Storsjö [Wed, 12 Sep 2018 20:03:12 +0000 (23:03 +0300)]
libfdk-aac: Don't use defined() in a #define

MSVC expands the preprocessor directives differently, making the
version check fail in the previous form.

Clang can warn about this with -Wexpansion-to-defined (not currently
enabled by default):
warning: macro expansion producing 'defined' has undefined behavior [-Wexpansion-to-defined]

Signed-off-by: Martin Storsjö <martin@martin.st>
8 months agolibfdk-aacenc: Allow enabling the ELDv2 profile
Martin Storsjö [Tue, 4 Sep 2018 08:45:35 +0000 (11:45 +0300)]
libfdk-aacenc: Allow enabling the ELDv2 profile

This is a new feature in FDK v2.

Signed-off-by: Martin Storsjö <martin@martin.st>
8 months agolibfdk-aacdec: Allow setting the new dynamic range control effect setting
Martin Storsjö [Tue, 4 Sep 2018 08:36:37 +0000 (11:36 +0300)]
libfdk-aacdec: Allow setting the new dynamic range control effect setting

This is a new setting in FDK v2.

Signed-off-by: Martin Storsjö <martin@martin.st>
8 months agolibfdk-aac: Consistently use a proper version check macro for detecting features
Martin Storsjö [Tue, 4 Sep 2018 08:29:37 +0000 (11:29 +0300)]
libfdk-aac: Consistently use a proper version check macro for detecting features

The previous version checks checked explicitly for the version
where the version define was added to the installed headers,
making an "#ifdef AACDECODER_LIB_VL0" enough. Now that we have
a need for more diverse version checks than this, convert all checks
to such checks.

Signed-off-by: Martin Storsjö <martin@martin.st>
8 months agoqsvvpp: Perform full init only when needed
Joe Olivas [Sun, 2 Sep 2018 18:06:48 +0000 (20:06 +0200)]
qsvvpp: Perform full init only when needed

Removing unused VPP sessions by initializing only when used in order to help
reduce CPU utilization.

Thanks to Maxym for the guidance.

Signed-off-by: Joe Olivas <joseph.k.olivas@intel.com>
Signed-off-by: Maxym Dmytrychenko <maxim.d33@gmail.com>
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
8 months agolibfdk-aacenc: Fix building with libfdk-aac v2
Martin Storsjö [Fri, 31 Aug 2018 11:25:30 +0000 (14:25 +0300)]
libfdk-aacenc: Fix building with libfdk-aac v2

When flushing the encoder, we now need to provide non-null buffer
parameters for everything, even if they are unused.

The encoderDelay parameter has been replaced by two, nDelay and
nDelayCore.

Signed-off-by: Martin Storsjö <martin@martin.st>
8 months agolavc/qsvenc: dump BufferSizeInKB message
Zhong Li [Mon, 27 Aug 2018 11:15:46 +0000 (19:15 +0800)]
lavc/qsvenc: dump BufferSizeInKB message

Signed-off-by: Zhong Li <zhong.li@intel.com>
Signed-off-by: Maxym Dmytrychenko <maxim.d33@gmail.com>
8 months agolavc/qsvenc: allow to set qp range for h264 BRC
Zhong Li [Mon, 27 Aug 2018 08:23:31 +0000 (16:23 +0800)]
lavc/qsvenc: allow to set qp range for h264 BRC

Signed-off-by: Zhong Li <zhong.li@intel.com>
Signed-off-by: Maxym Dmytrychenko <maxim.d33@gmail.com>
8 months agolibopenh264dec: Export the decoded profile and level in AVCodecContext
Martin Storsjö [Fri, 31 Aug 2018 09:25:40 +0000 (12:25 +0300)]
libopenh264dec: Export the decoded profile and level in AVCodecContext

Signed-off-by: Martin Storsjö <martin@martin.st>
8 months agotcp: Use ff_connect_parallel for RFC 8305 style connecting
Martin Storsjö [Fri, 10 Aug 2018 07:39:41 +0000 (10:39 +0300)]
tcp: Use ff_connect_parallel for RFC 8305 style connecting

Signed-off-by: Martin Storsjö <martin@martin.st>
8 months agonetwork: Add RFC 8305 style "Happy Eyeballs"/"Fast Fallback" helper function
Martin Storsjö [Fri, 10 Aug 2018 07:25:59 +0000 (10:25 +0300)]
network: Add RFC 8305 style "Happy Eyeballs"/"Fast Fallback" helper function

For cases with dual stack (IPv4 + IPv6) connectivity, but where one
stack potentially is less reliable, strive to trying to connect over
both protocols in parallel, using whichever address connected first.

In cases with a hostname resolving to multiple IPv4 and IPv6
addresses, the current connection mechanism would try all addresses
in the order returned by getaddrinfo (with all IPv6 addresses ordered
before the IPv4 addresses normally). If connection attempts to the
IPv6 addresses return quickly with an error, this was no problem, but
if they were unsuccessful leading up to timeouts, the connection process
would have to wait for timeouts on all IPv6 target addresses before
attempting any IPv4 address.

Similar to what RFC 8305 suggests, reorder the list of addresses to
try connecting to, interleaving address families. After starting one
connection attempt, start another one in parallel after a small delay
(200 ms as suggested by the RFC).

For cases with unreliable IPv6 but reliable IPv4, this should make
connection attempts work as reliably as with plain IPv4, with only an
extra 200 ms of connection delay.

Signed-off-by: Martin Storsjö <martin@martin.st>
9 months agoqsvdec: Release packet on decoding failure for mpeg2/vp8/vc1
Zhong Li [Wed, 15 Aug 2018 09:39:35 +0000 (17:39 +0800)]
qsvdec: Release packet on decoding failure for  mpeg2/vp8/vc1

H264/265 have been fixed such an issue with commit
559370f2c45110afd8308eec7194437736c323d4.
Similar fixing is needed for other codecs.

Signed-off-by: Zhong Li <zhong.li@intel.com>
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
9 months agoqsvenc: Fix a misleading log message
Zhong Li [Wed, 15 Aug 2018 09:39:34 +0000 (17:39 +0800)]
qsvenc: Fix a misleading log message

Signed-off-by: Zhong Li <zhong.li@intel.com>
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
9 months agoqsv: Error out if getting session handle failed in avfilter
Zhong Li [Wed, 15 Aug 2018 09:39:33 +0000 (17:39 +0800)]
qsv: Error out if getting session handle failed in avfilter

Solve some issues found by an automated code scansion.
Suppress the complain "variables 'handle' is used but maybe
uninitialized".

Signed-off-by: Zhong Li <zhong.li@intel.com>
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
9 months agodecode: copy the output parameters from the last bsf in the chain back to the AVCodec...
James Almer [Fri, 27 Jul 2018 16:29:03 +0000 (13:29 -0300)]
decode: copy the output parameters from the last bsf in the chain back to the AVCodecContext

Signed-off-by: James Almer <jamrial@gmail.com>
9 months agodecode: flush the internal bsfs instead of constantly reinitalizing them
James Almer [Fri, 27 Jul 2018 16:27:45 +0000 (13:27 -0300)]
decode: flush the internal bsfs instead of constantly reinitalizing them

Signed-off-by: James Almer <jamrial@gmail.com>
9 months agoh264_redundant_pps_bsf: implement a AVBSFContext.flush() callback
James Almer [Fri, 27 Jul 2018 16:24:53 +0000 (13:24 -0300)]
h264_redundant_pps_bsf: implement a AVBSFContext.flush() callback

Signed-off-by: James Almer <jamrial@gmail.com>
9 months agovp9_superframe_bsf: implement a AVBSFContext.flush() callback
James Almer [Fri, 27 Jul 2018 16:23:44 +0000 (13:23 -0300)]
vp9_superframe_bsf: implement a AVBSFContext.flush() callback

Signed-off-by: James Almer <jamrial@gmail.com>
9 months agovp9_superframe_split_bsf: implement a AVBSFContext.flush() callback
James Almer [Fri, 27 Jul 2018 16:22:34 +0000 (13:22 -0300)]
vp9_superframe_split_bsf: implement a AVBSFContext.flush() callback

Signed-off-by: James Almer <jamrial@gmail.com>
9 months agoh264_mp4toannexb_bsf: implement a AVBSFContext.flush() callback
James Almer [Fri, 27 Jul 2018 16:21:16 +0000 (13:21 -0300)]
h264_mp4toannexb_bsf: implement a AVBSFContext.flush() callback

Signed-off-by: James Almer <jamrial@gmail.com>
9 months agobsf: add a flushing mechanism to AVBSFContext
James Almer [Fri, 27 Jul 2018 16:18:29 +0000 (13:18 -0300)]
bsf: add a flushing mechanism to AVBSFContext

Meant to reset the internal bsf state without the need to reinitialize it.

Signed-off-by: James Almer <jamrial@gmail.com>
9 months agotls_openssl: Fix checks for SSL_ERROR_WANT_WRITE in nonblocking operation
Martin Storsjö [Thu, 16 Aug 2018 07:55:41 +0000 (09:55 +0200)]
tls_openssl: Fix checks for SSL_ERROR_WANT_WRITE in nonblocking operation

This was a typo in 0671eb2346c, spotted by Chris Carroux.

Signed-off-by: Martin Storsjö <martin@martin.st>
9 months agonetwork: Check for EINTR in ff_poll_interrupt
Martin Storsjö [Thu, 9 Aug 2018 18:30:48 +0000 (21:30 +0300)]
network: Check for EINTR in ff_poll_interrupt

Signed-off-by: Martin Storsjö <martin@martin.st>
9 months agonetwork: Use ff_neterrno instead of AVERROR(errno) for poll errors
Simon Thelen [Sat, 8 Apr 2017 12:21:28 +0000 (14:21 +0200)]
network: Use ff_neterrno instead of AVERROR(errno) for poll errors

This makes sure to pick up the actual error codes on windows.

Signed-off-by: Martin Storsjö <martin@martin.st>
9 months agohttp: pass return code from http_open_cnx_internal() on its failure
Andrey Utkin [Thu, 23 Oct 2014 16:55:46 +0000 (20:55 +0400)]
http: pass return code from http_open_cnx_internal() on its failure

Previously, AVERROR(EIO) was returned on failure of
http_open_cnx_internal(). Now the value is passed to upper level, thus
it is possible to distinguish ECONNREFUSED, ETIMEDOUT, ENETUNREACH etc.

Signed-off-by: Martin Storsjö <martin@martin.st>
9 months agoqsv: enforcing continuous memory layout
Maxym Dmytrychenko [Mon, 30 Jul 2018 16:02:37 +0000 (18:02 +0200)]
qsv: enforcing continuous memory layout

we need to make sure that memory allocation for Y/UV planes is continuous and re-used from a
pool

Signed-off-by: Maxym Dmytrychenko <maxim.d33@gmail.com>
9 months agoframe: Simplify the video allocation
Luca Barbato [Fri, 27 Jul 2018 06:34:08 +0000 (08:34 +0200)]
frame: Simplify the video allocation

9 months agolibopenh264: Add support for decoding of b-frames
Martin Storsjö [Mon, 30 Jul 2018 11:58:37 +0000 (14:58 +0300)]
libopenh264: Add support for decoding of b-frames

The current git master version of libopenh264 supports decoding of
b-frames.

Signed-off-by: Martin Storsjö <martin@martin.st>
9 months agoavconv: make sure packets put into the muxing FIFO are refcounted
wm4 [Wed, 8 Feb 2017 08:53:26 +0000 (09:53 +0100)]
avconv: make sure packets put into the muxing FIFO are refcounted

Some callers (like do_subtitle_out(), or do_streamcopy()) call this
with an AVPacket that is not refcounted. This can cause undefined
behavior.

Calling av_packet_move_ref() does not make a packet refcounted if it
isn't yet. (And it can't be made to, because it always succeeds,
and can't return ENOMEM.)

Call av_packet_ref() instead to make sure it's refcounted.

Cc: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
9 months agoavcodec/qsv: fix async support
Dmitry Rogozhkin [Tue, 24 Jul 2018 17:36:19 +0000 (10:36 -0700)]
avcodec/qsv: fix async support

Current implementations of qsv components incorrectly work with async level, they
actually try to work in async+1 level stepping into MFX_WRN_DEVICE_BUSY and polling
loop. This change address this misbehaviour.

Signed-off-by: Dmitry Rogozhkin <dmitry.v.rogozhkin@intel.com>
Cc: Maxym Dmytrychenko <maxim.d33@gmail.com>
Cc: Zhong Li <zhong.li@intel.com>
Signed-off-by: Maxym Dmytrychenko <maxim.d33@gmail.com>
10 months agolibsrt: Pass the correct pointer for the passphrase
Sven Dueking [Fri, 13 Jul 2018 00:08:50 +0000 (02:08 +0200)]
libsrt: Pass the correct pointer for the passphrase

The passphrase field is a pointer already.

Bug-Id: https://github.com/Haivision/srt/issues/416

10 months agolibfdk-aac: Use enum names instead of literal numbers for the output format
Martin Storsjö [Thu, 5 Jul 2018 20:05:02 +0000 (23:05 +0300)]
libfdk-aac: Use enum names instead of literal numbers for the output format

Signed-off-by: Martin Storsjö <martin@martin.st>
10 months agoconfigure: fix inline asm checks
John Cox [Wed, 30 May 2018 16:30:31 +0000 (17:30 +0100)]
configure: fix inline asm checks

Commit 8c893aa3cd5 removed quotes that were required to detect
inline asm:

check_insn armv5te qadd r0, r0, r0
.../test.c:1:34: error: expected string literal in 'asm'
void foo(void){ __asm__ volatile(qadd r0, r0, r0); }

The correct code is:

void foo(void){ __asm__ volatile("qadd r0, r0, r0"); }

Commit message written by Frank Liberato <liberato@chromium.org>

Signed-off-by: Martin Storsjö <martin@martin.st>
11 months agoqsvenc: remove vcm option on Linux
Zhong Li [Thu, 7 Jun 2018 08:51:54 +0000 (16:51 +0800)]
qsvenc: remove vcm option on Linux

1. vcm mode is only available for H264.
2. vcm is not supported on Linux, but it is shown when run "./avconv -h
encoder=h264_qsv |grep vcm". This shouldn't happen.

Signed-off-by: Zhong Li <zhong.li@intel.com>
Signed-off-by: Maxym Dmytrychenko <maxim.d33@gmail.com>
11 months agoqsvenc: use the compression_level to replace private option
Zhong Li [Thu, 7 Jun 2018 23:00:18 +0000 (07:00 +0800)]
qsvenc: use the compression_level to replace private option

Use a common way to control target_usage, keeping consistent with vaapi
encoders. The private option preset is kept only for compatibility.

Signed-off-by: Zhong Li <zhong.li@intel.com>
Signed-off-by: Maxym Dmytrychenko <maxim.d33@gmail.com>
11 months agoavformat/libsrt: add latency options and deprecate tspbdelay
Sven Dueking [Mon, 21 May 2018 07:40:17 +0000 (14:40 +0700)]
avformat/libsrt: add latency options and deprecate tspbdelay

Signed-off-by: Sven Dueking <sven.dueking@nablet.com>
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
11 months agoavformat/libsrt: add payload size option
Sven Dueking [Mon, 21 May 2018 06:55:25 +0000 (13:55 +0700)]
avformat/libsrt: add payload size option

Signed-off-by: Sven Dueking <sven.dueking@nablet.com>
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>