]> git.sesse.net Git - ffmpeg/log
ffmpeg
7 years agoarm/aarch64: vp9lpf: Calculate !hev directly
Martin Storsjö [Thu, 12 Jan 2017 14:52:33 +0000 (16:52 +0200)]
arm/aarch64: vp9lpf: Calculate !hev directly

Previously we first calculated hev, and then negated it.

Since we were able to schedule the negation in the middle
of another calculation, we don't see any gain in all cases.

Before:                     Cortex A7      A8      A9     A53  A53/AArch64
vp9_loop_filter_v_4_8_neon:     147.0   129.0   115.8    89.0         88.7
vp9_loop_filter_v_8_8_neon:     242.0   198.5   174.7   140.0        136.7
vp9_loop_filter_v_16_8_neon:    500.0   419.5   382.7   293.0        275.7
vp9_loop_filter_v_16_16_neon:   971.2   825.5   731.5   579.0        453.0
After:
vp9_loop_filter_v_4_8_neon:     143.0   127.7   114.8    88.0         87.7
vp9_loop_filter_v_8_8_neon:     241.0   197.2   173.7   140.0        136.7
vp9_loop_filter_v_16_8_neon:    497.0   419.5   379.7   293.0        275.7
vp9_loop_filter_v_16_16_neon:   965.2   818.7   731.4   579.0        452.0

This is cherrypicked from libav commit
e1f9de86f454861b69b199ad801adc2ec6c3b220.

Signed-off-by: Martin Storsjö <martin@martin.st>
7 years agoaarch64: vp9itxfm: Optimize 16x16 and 32x32 idct dc by unrolling
Martin Storsjö [Wed, 4 Jan 2017 10:57:56 +0000 (12:57 +0200)]
aarch64: vp9itxfm: Optimize 16x16 and 32x32 idct dc by unrolling

This work is sponsored by, and copyright, Google.

Before:                           Cortex A53
vp9_inv_dct_dct_16x16_sub1_add_neon:   235.3
vp9_inv_dct_dct_32x32_sub1_add_neon:   555.1
After:
vp9_inv_dct_dct_16x16_sub1_add_neon:   180.2
vp9_inv_dct_dct_32x32_sub1_add_neon:   475.3

This is cherrypicked from libav commit
3fcf788fbbccc4130868e7abe58a88990290f7c1.

Signed-off-by: Martin Storsjö <martin@martin.st>
7 years agoarm: vp9itxfm: Optimize 16x16 and 32x32 idct dc by unrolling
Martin Storsjö [Wed, 4 Jan 2017 11:08:51 +0000 (13:08 +0200)]
arm: vp9itxfm: Optimize 16x16 and 32x32 idct dc by unrolling

This work is sponsored by, and copyright, Google.

Before:                            Cortex A7      A8      A9     A53
vp9_inv_dct_dct_16x16_sub1_add_neon:   273.0   189.5   211.7   235.8
vp9_inv_dct_dct_32x32_sub1_add_neon:   752.0   459.2   862.2   553.9
After:
vp9_inv_dct_dct_16x16_sub1_add_neon:   226.5   145.0   225.1   171.8
vp9_inv_dct_dct_32x32_sub1_add_neon:   721.2   415.7   727.6   475.0

This is cherrypicked from libav commit
a76bf8cf1277ef6feb1580b578f5e6ca327e713c.

Signed-off-by: Martin Storsjö <martin@martin.st>
7 years agoaarch64: vp9mc: Calculate less unused data in the 4 pixel wide horizontal filter
Martin Storsjö [Sat, 17 Dec 2016 11:14:38 +0000 (13:14 +0200)]
aarch64: vp9mc: Calculate less unused data in the 4 pixel wide horizontal filter

No measured speedup on a Cortex A53, but other cores might benefit.

This is cherrypicked from libav commit
388e0d2515bc6bbc9d0c9af1d230bd16cf945fe7.

Signed-off-by: Martin Storsjö <martin@martin.st>
7 years agoarm: vp9mc: Calculate less unused data in the 4 pixel wide horizontal filter
Martin Storsjö [Sat, 17 Dec 2016 11:09:50 +0000 (13:09 +0200)]
arm: vp9mc: Calculate less unused data in the 4 pixel wide horizontal filter

Before:                    Cortex A7      A8     A9     A53
vp9_put_8tap_smooth_4h_neon:   378.1   273.2  340.7   229.5
After:
vp9_put_8tap_smooth_4h_neon:   352.1   222.2  290.5   229.5

This is cherrypicked from libav commit
fea92a4b57d1c328b1de226a5f213a629ee63754.

Signed-off-by: Martin Storsjö <martin@martin.st>
7 years agoaarch64: vp9mc: Simplify the extmla macro parameters
Martin Storsjö [Fri, 16 Dec 2016 22:55:41 +0000 (00:55 +0200)]
aarch64: vp9mc: Simplify the extmla macro parameters

Fold the field lengths into the macro.

This makes the macro invocations much more readable, when the
lines are shorter.

This also makes it easier to use only half the registers within
the macro.

This is cherrypicked from libav commit
5e0c2158fbc774f87d3ce4b7b950ba4d42c4a7b8.

Signed-off-by: Martin Storsjö <martin@martin.st>
7 years agoaarch64: vp9itxfm: Fix incorrect vertical alignment
Martin Storsjö [Tue, 3 Jan 2017 14:11:56 +0000 (16:11 +0200)]
aarch64: vp9itxfm: Fix incorrect vertical alignment

This is cherrypicked from libav commit
0c0b87f12d48d4e7f0d3d13f9345e828a3a5ea32.

Signed-off-by: Martin Storsjö <martin@martin.st>
7 years agoaarch64: vp9itxfm: Update a comment to refer to a register with a different name
Martin Storsjö [Tue, 3 Jan 2017 21:11:51 +0000 (23:11 +0200)]
aarch64: vp9itxfm: Update a comment to refer to a register with a different name

This is cherrypicked from libav commit
8476eb0d3ab1f7a52317b23346646389c08fb57a.

Signed-off-by: Martin Storsjö <martin@martin.st>
7 years agoaarch64: vp9itxfm: Use the right lane sizes in 8x8 for improved readability
Martin Storsjö [Tue, 3 Jan 2017 14:46:17 +0000 (16:46 +0200)]
aarch64: vp9itxfm: Use the right lane sizes in 8x8 for improved readability

This is cherrypicked from libav commit
3dd7827258ddaa2e51085d0c677d6f3b1be3572f.

Signed-off-by: Martin Storsjö <martin@martin.st>
7 years agoaarch64: vp9itxfm: Use a single lane ld1 instead of ld1r where possible
Martin Storsjö [Tue, 3 Jan 2017 12:55:46 +0000 (14:55 +0200)]
aarch64: vp9itxfm: Use a single lane ld1 instead of ld1r where possible

The ld1r is a leftover from the arm version, where this trick is
beneficial on some cores.

Use a single-lane load where we don't need the semantics of ld1r.

This is cherrypicked from libav commit
ed8d293306e12c9b79022d37d39f48825ce7f2fa.

Signed-off-by: Martin Storsjö <martin@martin.st>
7 years agoaarch64: vp9itxfm: Share instructions for loading idct coeffs in the 8x8 function
Martin Storsjö [Tue, 3 Jan 2017 14:39:41 +0000 (16:39 +0200)]
aarch64: vp9itxfm: Share instructions for loading idct coeffs in the 8x8 function

This is cherrypicked from libav commit
4da4b2b87f08a1331650c7e36eb7d4029a160776.

Signed-off-by: Martin Storsjö <martin@martin.st>
7 years agoarm: vp9itxfm: Share instructions for loading idct coeffs in the 8x8 function
Martin Storsjö [Tue, 3 Jan 2017 14:38:56 +0000 (16:38 +0200)]
arm: vp9itxfm: Share instructions for loading idct coeffs in the 8x8 function

This is cherrypicked from libav commit
3933b86bb93aca47f29fbd493075b0f110c1e3f5.

Signed-off-by: Martin Storsjö <martin@martin.st>
7 years agoaarch64: vp9itxfm: Do separate functions for half/quarter idct16 and idct32
Martin Storsjö [Tue, 22 Nov 2016 20:58:35 +0000 (22:58 +0200)]
aarch64: vp9itxfm: Do separate functions for half/quarter idct16 and idct32

This work is sponsored by, and copyright, Google.

This avoids loading and calculating coefficients that we know will
be zero, and avoids filling the temp buffer with zeros in places
where we know the second pass won't read.

This gives a pretty substantial speedup for the smaller subpartitions.

The code size increases from 14740 bytes to 24292 bytes.

The idct16/32_end macros are moved above the individual functions; the
instructions themselves are unchanged, but since new functions are added
at the same place where the code is moved from, the diff looks rather
messy.

Before:
vp9_inv_dct_dct_16x16_sub1_add_neon:     236.7
vp9_inv_dct_dct_16x16_sub2_add_neon:    1051.0
vp9_inv_dct_dct_16x16_sub4_add_neon:    1051.0
vp9_inv_dct_dct_16x16_sub8_add_neon:    1051.0
vp9_inv_dct_dct_16x16_sub12_add_neon:   1387.4
vp9_inv_dct_dct_16x16_sub16_add_neon:   1387.6
vp9_inv_dct_dct_32x32_sub1_add_neon:     554.1
vp9_inv_dct_dct_32x32_sub2_add_neon:    5198.5
vp9_inv_dct_dct_32x32_sub4_add_neon:    5198.6
vp9_inv_dct_dct_32x32_sub8_add_neon:    5196.3
vp9_inv_dct_dct_32x32_sub12_add_neon:   6183.4
vp9_inv_dct_dct_32x32_sub16_add_neon:   6174.3
vp9_inv_dct_dct_32x32_sub20_add_neon:   7151.4
vp9_inv_dct_dct_32x32_sub24_add_neon:   7145.3
vp9_inv_dct_dct_32x32_sub28_add_neon:   8119.3
vp9_inv_dct_dct_32x32_sub32_add_neon:   8118.7

After:
vp9_inv_dct_dct_16x16_sub1_add_neon:     236.7
vp9_inv_dct_dct_16x16_sub2_add_neon:     640.8
vp9_inv_dct_dct_16x16_sub4_add_neon:     639.0
vp9_inv_dct_dct_16x16_sub8_add_neon:     842.0
vp9_inv_dct_dct_16x16_sub12_add_neon:   1388.3
vp9_inv_dct_dct_16x16_sub16_add_neon:   1389.3
vp9_inv_dct_dct_32x32_sub1_add_neon:     554.1
vp9_inv_dct_dct_32x32_sub2_add_neon:    3685.5
vp9_inv_dct_dct_32x32_sub4_add_neon:    3685.1
vp9_inv_dct_dct_32x32_sub8_add_neon:    3684.4
vp9_inv_dct_dct_32x32_sub12_add_neon:   5312.2
vp9_inv_dct_dct_32x32_sub16_add_neon:   5315.4
vp9_inv_dct_dct_32x32_sub20_add_neon:   7154.9
vp9_inv_dct_dct_32x32_sub24_add_neon:   7154.5
vp9_inv_dct_dct_32x32_sub28_add_neon:   8126.6
vp9_inv_dct_dct_32x32_sub32_add_neon:   8127.2

This is cherrypicked from libav commit
a63da4511d0fee66695ff4afd264ba1dbf1e812d.

Signed-off-by: Martin Storsjö <martin@martin.st>
7 years agoarm: vp9itxfm: Do a simpler half/quarter idct16/idct32 when possible
Martin Storsjö [Tue, 22 Nov 2016 09:07:38 +0000 (11:07 +0200)]
arm: vp9itxfm: Do a simpler half/quarter idct16/idct32 when possible

This work is sponsored by, and copyright, Google.

This avoids loading and calculating coefficients that we know will
be zero, and avoids filling the temp buffer with zeros in places
where we know the second pass won't read.

This gives a pretty substantial speedup for the smaller subpartitions.

The code size increases from 12388 bytes to 19784 bytes.

The idct16/32_end macros are moved above the individual functions; the
instructions themselves are unchanged, but since new functions are added
at the same place where the code is moved from, the diff looks rather
messy.

Before:                              Cortex A7       A8       A9      A53
vp9_inv_dct_dct_16x16_sub1_add_neon:     273.0    189.5    212.0    235.8
vp9_inv_dct_dct_16x16_sub2_add_neon:    2102.1   1521.7   1736.2   1265.8
vp9_inv_dct_dct_16x16_sub4_add_neon:    2104.5   1533.0   1736.6   1265.5
vp9_inv_dct_dct_16x16_sub8_add_neon:    2484.8   1828.7   2014.4   1506.5
vp9_inv_dct_dct_16x16_sub12_add_neon:   2851.2   2117.8   2294.8   1753.2
vp9_inv_dct_dct_16x16_sub16_add_neon:   3239.4   2408.3   2543.5   1994.9
vp9_inv_dct_dct_32x32_sub1_add_neon:     758.3    456.7    864.5    553.9
vp9_inv_dct_dct_32x32_sub2_add_neon:   10776.7   7949.8   8567.7   6819.7
vp9_inv_dct_dct_32x32_sub4_add_neon:   10865.6   8131.5   8589.6   6816.3
vp9_inv_dct_dct_32x32_sub8_add_neon:   12053.9   9271.3   9387.7   7564.0
vp9_inv_dct_dct_32x32_sub12_add_neon:  13328.3  10463.2  10217.0   8321.3
vp9_inv_dct_dct_32x32_sub16_add_neon:  14176.4  11509.5  11018.7   9062.3
vp9_inv_dct_dct_32x32_sub20_add_neon:  15301.5  12999.9  11855.1   9828.2
vp9_inv_dct_dct_32x32_sub24_add_neon:  16482.7  14931.5  12650.1  10575.0
vp9_inv_dct_dct_32x32_sub28_add_neon:  17589.5  15811.9  13482.8  11333.4
vp9_inv_dct_dct_32x32_sub32_add_neon:  18696.2  17049.2  14355.6  12089.7

After:
vp9_inv_dct_dct_16x16_sub1_add_neon:     273.0    189.5    211.7    235.8
vp9_inv_dct_dct_16x16_sub2_add_neon:    1203.5    998.2   1035.3    763.0
vp9_inv_dct_dct_16x16_sub4_add_neon:    1203.5    998.1   1035.5    760.8
vp9_inv_dct_dct_16x16_sub8_add_neon:    1926.1   1610.6   1722.1   1271.7
vp9_inv_dct_dct_16x16_sub12_add_neon:   2873.2   2129.7   2285.1   1757.3
vp9_inv_dct_dct_16x16_sub16_add_neon:   3221.4   2520.3   2557.6   2002.1
vp9_inv_dct_dct_32x32_sub1_add_neon:     753.0    457.5    866.6    554.6
vp9_inv_dct_dct_32x32_sub2_add_neon:    7554.6   5652.4   6048.4   4920.2
vp9_inv_dct_dct_32x32_sub4_add_neon:    7549.9   5685.0   6046.9   4925.7
vp9_inv_dct_dct_32x32_sub8_add_neon:    8336.9   6704.5   6604.0   5478.0
vp9_inv_dct_dct_32x32_sub12_add_neon:  10914.0   9777.2   9240.4   7416.9
vp9_inv_dct_dct_32x32_sub16_add_neon:  11859.2  11223.3   9966.3   8095.1
vp9_inv_dct_dct_32x32_sub20_add_neon:  15237.1  13029.4  11838.3   9829.4
vp9_inv_dct_dct_32x32_sub24_add_neon:  16293.2  14379.8  12644.9  10572.0
vp9_inv_dct_dct_32x32_sub28_add_neon:  17424.3  15734.7  13473.0  11326.9
vp9_inv_dct_dct_32x32_sub32_add_neon:  18531.3  17457.0  14298.6  12080.0

This is cherrypicked from libav commit
5eb5aec475aabc884d083566f902876ecbc072cb.

Signed-off-by: Martin Storsjö <martin@martin.st>
7 years agoaarch64: vp9itxfm: Move the load_add_store macro out from the itxfm16 pass2 function
Martin Storsjö [Sun, 5 Feb 2017 20:53:55 +0000 (22:53 +0200)]
aarch64: vp9itxfm: Move the load_add_store macro out from the itxfm16 pass2 function

This allows reusing the macro for a separate implementation of the
pass2 function.

This is cherrypicked from libav commit
79d332ebbde8c0a3e9da094dcfd10abd33ba7378.

Signed-off-by: Martin Storsjö <martin@martin.st>
7 years agoarm: vp9itxfm: Move the load_add_store macro out from the itxfm16 pass2 function
Martin Storsjö [Sun, 5 Feb 2017 20:55:20 +0000 (22:55 +0200)]
arm: vp9itxfm: Move the load_add_store macro out from the itxfm16 pass2 function

This allows reusing the macro for a separate implementation of the
pass2 function.

This is cherrypicked from libav commit
47b3c2c18d1897f3c753ba0cec4b2d7aa24526af.

Signed-off-by: Martin Storsjö <martin@martin.st>
7 years agoaarch64: vp9itxfm: Make the larger core transforms standalone functions
Martin Storsjö [Wed, 23 Nov 2016 12:03:05 +0000 (14:03 +0200)]
aarch64: vp9itxfm: Make the larger core transforms standalone functions

This work is sponsored by, and copyright, Google.

This reduces the code size of libavcodec/aarch64/vp9itxfm_neon.o from
19496 to 14740 bytes.

This gives a small slowdown of a couple of tens of cycles, but makes
it more feasible to add more optimized versions of these transforms.

Before:
vp9_inv_dct_dct_16x16_sub4_add_neon:    1036.7
vp9_inv_dct_dct_16x16_sub16_add_neon:   1372.2
vp9_inv_dct_dct_32x32_sub4_add_neon:    5180.0
vp9_inv_dct_dct_32x32_sub32_add_neon:   8095.7

After:
vp9_inv_dct_dct_16x16_sub4_add_neon:    1051.0
vp9_inv_dct_dct_16x16_sub16_add_neon:   1390.1
vp9_inv_dct_dct_32x32_sub4_add_neon:    5199.9
vp9_inv_dct_dct_32x32_sub32_add_neon:   8125.8

This is cherrypicked from libav commit
115476018d2c97df7e9b4445fe8f6cc7420ab91f.

Signed-off-by: Martin Storsjö <martin@martin.st>
7 years agoarm: vp9itxfm: Make the larger core transforms standalone functions
Martin Storsjö [Wed, 23 Nov 2016 08:56:12 +0000 (10:56 +0200)]
arm: vp9itxfm: Make the larger core transforms standalone functions

This work is sponsored by, and copyright, Google.

This reduces the code size of libavcodec/arm/vp9itxfm_neon.o from
15324 to 12388 bytes.

This gives a small slowdown of a couple tens of cycles, up to around
150 cycles for the full case of the largest transform, but makes
it more feasible to add more optimized versions of these transforms.

Before:                              Cortex A7       A8       A9      A53
vp9_inv_dct_dct_16x16_sub4_add_neon:    2063.4   1516.0   1719.5   1245.1
vp9_inv_dct_dct_16x16_sub16_add_neon:   3279.3   2454.5   2525.2   1982.3
vp9_inv_dct_dct_32x32_sub4_add_neon:   10750.0   7955.4   8525.6   6754.2
vp9_inv_dct_dct_32x32_sub32_add_neon:  18574.0  17108.4  14216.7  12010.2

After:
vp9_inv_dct_dct_16x16_sub4_add_neon:    2060.8   1608.5   1735.7   1262.0
vp9_inv_dct_dct_16x16_sub16_add_neon:   3211.2   2443.5   2546.1   1999.5
vp9_inv_dct_dct_32x32_sub4_add_neon:   10682.0   8043.8   8581.3   6810.1
vp9_inv_dct_dct_32x32_sub32_add_neon:  18522.4  17277.4  14286.7  12087.9

This is cherrypicked from libav commit
0331c3f5e8cb6e6b53fab7893e91d1be1bfa979c.

Signed-off-by: Martin Storsjö <martin@martin.st>
7 years agoaarch64: vp9itxfm: Restructure the idct32 store macros
Martin Storsjö [Thu, 1 Dec 2016 09:10:19 +0000 (11:10 +0200)]
aarch64: vp9itxfm: Restructure the idct32 store macros

This avoids concatenation, which can't be used if the whole macro
is wrapped within another macro.

This is also arguably more readable.

This is cherrypicked from libav commit
58d87e0f49bcbbc6f426328f53b657bae7430cd2.

Signed-off-by: Martin Storsjö <martin@martin.st>
7 years agoarm: vp9itxfm: Avoid .irp when it doesn't save any lines
Martin Storsjö [Sat, 4 Feb 2017 20:16:09 +0000 (22:16 +0200)]
arm: vp9itxfm: Avoid .irp when it doesn't save any lines

This makes it more readable.

This is cherrypicked from libav commit
3bc5b28d5a191864c54bba60646933a63da31656.

Signed-off-by: Martin Storsjö <martin@martin.st>
7 years agolibavfilter/avf_showwaves: make sqrt and cbrt scale option values available to showwa...
Moritz Barsnick [Thu, 9 Mar 2017 09:23:28 +0000 (10:23 +0100)]
libavfilter/avf_showwaves: make sqrt and cbrt scale option values available to showwavespic by name

The 'sqrt' and 'cbrt' scalers were added in commit
80262d8c86e94ff9a4bb3a9e3c2d734e04ccb399, but their symbolic option values
only made available to the showwaves filter, not showwavespic, despite
the scalers working properly by their numerical option values.

Signed-off-by: Moritz Barsnick <barsnick@gmx.net>
7 years agoffprobe: add AVCodecContext help message into ffprobe
Steven Liu [Sat, 11 Mar 2017 03:12:23 +0000 (11:12 +0800)]
ffprobe: add AVCodecContext help message into ffprobe

because the ffprobe can use AVCodecContext parameters

Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
7 years agoavcodec/vp56: Reset have_undamaged_frame on resolution changes
Michael Niedermayer [Thu, 9 Mar 2017 16:55:32 +0000 (17:55 +0100)]
avcodec/vp56: Reset have_undamaged_frame on resolution changes

Fixes: timeout in 758/clusterfuzz-testcase-4720832028868608
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
7 years agoavcodec/h264_ps: Forward errors from decode_scaling_list()
Michael Niedermayer [Thu, 9 Mar 2017 12:54:24 +0000 (13:54 +0100)]
avcodec/h264_ps: Forward errors from decode_scaling_list()

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
7 years agolibavcodec/libopenjpegenc: enable lossless option, remove layer option, and improve...
Aaron Boxer [Fri, 10 Mar 2017 04:01:48 +0000 (23:01 -0500)]
libavcodec/libopenjpegenc: enable lossless option, remove layer option, and improve defaults

1. limit to single layer, as there is no current support for setting distortion/quality of multiple layers
2. encoder mode should be kept at default setting (0)
3. remove fixed_alloc parameter from context : seldom if ever used, and no way of properly configuring at the moment
4. add irreversible setting, to allow for lossless encoding. Set to OpenJPEG default (enabled)
5. set numresolution max to 33, which is the maximum number of allowed resolutions according the J2K spec

Signed-off-by: Michael Bradshaw <mjbshaw@google.com>
7 years agoavcodec/vp8: Fix hang with slice threads
Thomas Guilbert [Thu, 9 Mar 2017 23:15:39 +0000 (00:15 +0100)]
avcodec/vp8: Fix hang with slice threads

Fixes: 447860.webm
Reviewed-by: "Ronald S. Bultje" <rsbultje@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
7 years agoavcodec/movtextdec: run mov_text_cleanup() before overwriting pointers
Michael Niedermayer [Wed, 8 Mar 2017 21:54:10 +0000 (22:54 +0100)]
avcodec/movtextdec: run mov_text_cleanup() before overwriting pointers

Fixes: memleak
Fixes: 741/clusterfuzz-testcase-586996200452915
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
7 years agoavcodec/mpeg4videodec: Fix runtime error: signed integer overflow: -135088512 * 16...
Michael Niedermayer [Wed, 8 Mar 2017 21:25:08 +0000 (22:25 +0100)]
avcodec/mpeg4videodec: Fix runtime error: signed integer overflow: -135088512 * 16 cannot be represented in type 'int'

Fixes: 736/clusterfuzz-testcase-5580263943831552
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
7 years agoavcodec/h264_mvpred: Fix runtime error: left shift of negative value -1
Michael Niedermayer [Wed, 8 Mar 2017 20:53:15 +0000 (21:53 +0100)]
avcodec/h264_mvpred: Fix runtime error: left shift of negative value -1

Fixes: 734/clusterfuzz-testcase-4821293192970240
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
7 years agoavcodec/mjpegdec: Fix runtime error: left shift of negative value -127
Michael Niedermayer [Wed, 8 Mar 2017 20:41:34 +0000 (21:41 +0100)]
avcodec/mjpegdec: Fix runtime error: left shift of negative value -127

Fixes: 733/clusterfuzz-testcase-4682158096515072
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
7 years agoavcodec/mpegaudiodec_template: Check for negative e
Michael Niedermayer [Wed, 8 Mar 2017 20:25:13 +0000 (21:25 +0100)]
avcodec/mpegaudiodec_template: Check for negative e

Fixes: undefined shift
Fixes: 631/clusterfuzz-testcase-6725491035734016
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
7 years agoavcodec/cuvid: add support for cropping/resizing
Timo Rothenpieler [Sun, 5 Mar 2017 14:32:36 +0000 (15:32 +0100)]
avcodec/cuvid: add support for cropping/resizing

Overhauled version, original patch by Miroslav Slugeň <thunder.m@email.cz>.

7 years agoavformat/matroskaenc: add support for Spherical Video elements
James Almer [Wed, 8 Mar 2017 19:12:32 +0000 (16:12 -0300)]
avformat/matroskaenc: add support for Spherical Video elements

Reviewed-by: Vittorio Giovara <vittorio.giovara@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
7 years agoavcodec: clarify some decoding/encoding API details
wm4 [Mon, 6 Mar 2017 10:34:20 +0000 (11:34 +0100)]
avcodec: clarify some decoding/encoding API details

Make it clear that there is no timing-dependent behavior. In particular,
there is no state in which both input and output are denied, and where
you have to wait for a while yourself to make progress (apparently some
hardware decoders like to do this).

Avoid wording that makes references to time. It shouldn't be mistaken
for some kind of asynchronous API (like POSIX read() can return EAGAIN
if there is no new input yet). It's a state machine, so try to use
appropriate terms.

Signed-off-by: Diego Biurrun <diego@biurrun.de>
Merges Libav commit 8a60bba0ae.

7 years agohls: pass AVFormatContext flags to sub demuxer
wm4 [Thu, 9 Mar 2017 14:43:08 +0000 (15:43 +0100)]
hls: pass AVFormatContext flags to sub demuxer

7 years agoconcatdec: pass AVFormatContext flags to sub demuxer
wm4 [Thu, 9 Mar 2017 14:43:00 +0000 (15:43 +0100)]
concatdec: pass AVFormatContext flags to sub demuxer

7 years agoaacdec: do not mutate input packet metadata
wm4 [Wed, 8 Mar 2017 11:36:05 +0000 (12:36 +0100)]
aacdec: do not mutate input packet metadata

Apparently the demuxer outputs the wrong padding for HE-AAC (based on
the raw sample rate, or so). aacdec contains a hack to adjust the muxer
padding accordingly before it's used to trim the decoder output. This
modified the packet side data, which in combination with the old
decoding API would change the packet the user passed to the decoder.
This is clearly not allowed, and it breaks running some gapless fate
tests with "-fflags +keepside" applied (without keepside, the packet
metadata is typically newly allocated, essentially making a copy and not
modifying the user's input packet).

This should probably be fixed in the demuxer (and consequently also the
muxer), but for now only fix the immediate problem.

Regression since 946ed78f5f8 (2012).

7 years agoswresample/resample: do not allow odd filter_length
Muhammad Faiz [Wed, 8 Mar 2017 15:21:34 +0000 (22:21 +0700)]
swresample/resample: do not allow odd filter_length

except filter_length == 1

odd filter_length gives worse frequency response,
even when compared with shorter filter_length

also makes build_filter simpler

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Muhammad Faiz <mfcc64@gmail.com>
7 years agoavcodec/wavpack: Fix runtime error: left shift of negative value -5
Michael Niedermayer [Mon, 6 Mar 2017 20:52:36 +0000 (21:52 +0100)]
avcodec/wavpack: Fix runtime error: left shift of negative value -5

Fixes: 729/clusterfuzz-testcase-5154831595470848
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
7 years agoavcodec/pictordec: Fix runtime error: left shift of 64 by 25 places cannot be represe...
Michael Niedermayer [Mon, 6 Mar 2017 20:33:18 +0000 (21:33 +0100)]
avcodec/pictordec: Fix runtime error: left shift of 64 by 25 places cannot be represented in type 'int'

Fixes: 724/clusterfuzz-testcase-6738249571631104
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
7 years agofate/swresample: fix FUZZ typo
Muhammad Faiz [Wed, 8 Mar 2017 14:51:02 +0000 (21:51 +0700)]
fate/swresample: fix FUZZ typo

unintentionally changed to 0.01 at
'61926b6c3e560283ef6c015d6d85c32716942833'

Signed-off-by: Muhammad Faiz <mfcc64@gmail.com>
7 years agoavutil/tests/lfg: Remove debugging start/stop timer
Michael Niedermayer [Wed, 8 Mar 2017 10:29:40 +0000 (11:29 +0100)]
avutil/tests/lfg: Remove debugging start/stop timer

Fixes code with qemu ARM

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
7 years agoavutil/tests/lfg.c: added proper normality test
Thomas Turner [Wed, 8 Mar 2017 00:36:15 +0000 (16:36 -0800)]
avutil/tests/lfg.c: added proper normality test

The Chen-Shapiro(CS) test was used to test normality for
Lagged Fibonacci PRNG.

Normality Hypothesis Test:

The null hypothesis formally tests if the population
the sample represents is normally-distributed. For
CS, when the normality hypothesis is True, the
distribution of QH will have a mean close to 1.

Information on CS can be found here:

http://www.stata-journal.com/sjpdf.html?articlenum=st0264
http://www.originlab.com/doc/Origin-Help/NormalityTest-Algorithm

Signed-off-by: Thomas Turner <thomastdt@googlemail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
7 years agoswresample/resample: use uniform normalization
Muhammad Faiz [Wed, 1 Mar 2017 15:18:36 +0000 (22:18 +0700)]
swresample/resample: use uniform normalization

this gives better frequency response

update swresample fate and other fates
that depend on resampling

Signed-off-by: Muhammad Faiz <mfcc64@gmail.com>
7 years agoRevert "lavu/atomic: add support for the new memory model aware gcc built-ins"
James Almer [Tue, 7 Mar 2017 03:23:07 +0000 (00:23 -0300)]
Revert "lavu/atomic: add support for the new memory model aware gcc built-ins"

This reverts commit faa9d2982969c999ab0e443a226eff116f7f8e4b.

This change became superfluous when support for C11 atomics was introduced.
Reverting it will make the removal of this implementation in an upcoming
merge conflict free.

Reviewed-by: wm4 <nfxjfg@googlemail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
7 years agolsws/slice: Move a misplaced const.
Carl Eugen Hoyos [Sun, 26 Feb 2017 10:18:25 +0000 (11:18 +0100)]
lsws/slice: Move a misplaced const.

Fixes a gcc warning:
libswscale/slice.c:178:56: warning: assignment discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]

7 years agolsws/input: Do not define unused functions.
Carl Eugen Hoyos [Tue, 7 Mar 2017 08:28:00 +0000 (09:28 +0100)]
lsws/input: Do not define unused functions.

Fixes warnings like the following:
libswscale/input.c:951:13: warning: ‘planar_rgb14be_to_a’ defined but not used

7 years agolavc/libx265: Add gray10 and gray12 encoding support.
Carl Eugen Hoyos [Tue, 7 Mar 2017 23:25:33 +0000 (00:25 +0100)]
lavc/libx265: Add gray10 and gray12 encoding support.

7 years agomatroskadec: cosmetics: Rearrange checks for projection-depedendent properties
Vittorio Giovara [Tue, 7 Mar 2017 22:34:32 +0000 (17:34 -0500)]
matroskadec: cosmetics: Rearrange checks for projection-depedendent properties

7 years agomov: Fix checking layout and loading padding for cubemaps
Vittorio Giovara [Tue, 7 Mar 2017 22:29:52 +0000 (17:29 -0500)]
mov: Fix checking layout and loading padding for cubemaps

7 years agoavcodec/vp8: Check for the bitstream end per MB in decode_mb_row_no_filter()
Michael Niedermayer [Tue, 7 Mar 2017 18:09:39 +0000 (19:09 +0100)]
avcodec/vp8: Check for the bitstream end per MB in decode_mb_row_no_filter()

Fixes: timeout in 730/clusterfuzz-testcase-5265113739165696 (part 2 of 2)
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Reviewed-by: BBB
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
7 years agoavcodec/vp568: Check that there is enough data for ff_vp56_init_range_decoder()
Michael Niedermayer [Tue, 7 Mar 2017 18:09:38 +0000 (19:09 +0100)]
avcodec/vp568: Check that there is enough data for ff_vp56_init_range_decoder()

Fixes: timeout in 730/clusterfuzz-testcase-5265113739165696 (part 1 of 2)
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Reviewed-by: BBB
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
7 years agoavcodec/vp8: remove redundant check
Michael Niedermayer [Mon, 6 Mar 2017 23:53:52 +0000 (00:53 +0100)]
avcodec/vp8: remove redundant check

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
7 years agomkv: Export bounds and padding from spherical metadata
Vittorio Giovara [Fri, 10 Feb 2017 21:02:22 +0000 (16:02 -0500)]
mkv: Export bounds and padding from spherical metadata

Update the fate test as needed.

7 years agomov: Export bounds and padding from spherical metadata
Vittorio Giovara [Fri, 10 Feb 2017 20:36:56 +0000 (15:36 -0500)]
mov: Export bounds and padding from spherical metadata

Update the fate test as needed.

7 years agospherical: Add tiled equirectangular type and projection-specific properties
Vittorio Giovara [Fri, 10 Feb 2017 20:26:55 +0000 (15:26 -0500)]
spherical: Add tiled equirectangular type and projection-specific properties

Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
7 years agoavdevice/alldevices: make avdevice_register_all thread safe
Muhammad Faiz [Tue, 7 Mar 2017 08:55:38 +0000 (15:55 +0700)]
avdevice/alldevices: make avdevice_register_all thread safe

use ff_thread_once

Suggested-by: wm4 <nfxjfg@googlemail.com>
Signed-off-by: Muhammad Faiz <mfcc64@gmail.com>
7 years agoavfilter/allfilters: make avfilter_register_all thread safe
Muhammad Faiz [Tue, 7 Mar 2017 08:54:44 +0000 (15:54 +0700)]
avfilter/allfilters: make avfilter_register_all thread safe

use ff_thread_once

Suggested-by: wm4 <nfxjfg@googlemail.com>
Signed-off-by: Muhammad Faiz <mfcc64@gmail.com>
7 years agoavfilter/allformats: make av_register_all thread safe
Muhammad Faiz [Tue, 7 Mar 2017 08:53:27 +0000 (15:53 +0700)]
avfilter/allformats: make av_register_all thread safe

use ff_thread_once

Suggested-by: wm4 <nfxjfg@googlemail.com>
Signed-off-by: Muhammad Faiz <mfcc64@gmail.com>
7 years agoavcodec/allcodecs: make avcodec_register_all thread safe
Muhammad Faiz [Tue, 7 Mar 2017 08:51:12 +0000 (15:51 +0700)]
avcodec/allcodecs: make avcodec_register_all thread safe

use ff_thread_once

Suggested-by: wm4 <nfxjfg@googlemail.com>
Signed-off-by: Muhammad Faiz <mfcc64@gmail.com>
7 years agoavcodec/pixlet: fix architecture-dependent code and values
Vittorio Giovara [Tue, 7 Mar 2017 12:57:34 +0000 (13:57 +0100)]
avcodec/pixlet: fix architecture-dependent code and values

The constants used in the decoder used floating point precision,
and this caused different values to be generated on different
architectures.

So, eradicate floating point numbers and use fixed point (32.32)
arithmetics everywhere, replacing constants with precomputed integer
values.

Signed-off-by: Vittorio Giovara <vittorio.giovara at gmail.com>
Signed-off-by: Paul B Mahol <onemda@gmail.com>
7 years agoavcodec/h264, videotoolbox: fix crash after VT decoder fails
Aman Gupta [Tue, 21 Feb 2017 18:48:37 +0000 (10:48 -0800)]
avcodec/h264, videotoolbox: fix crash after VT decoder fails

The way videotoolbox hooks in as a hwaccel is pretty hacky. The VT decode
API is not invoked until end_frame(), so alloc_frame() returns a dummy
frame with a 1-byte buffer. When end_frame() is eventually called, the
dummy buffer is replaced with the actual decoded data from
VTDecompressionSessionDecodeFrame().

When the VT decoder fails, the frame returned to the h264 decoder from
alloc_frame() remains invalid and should not be used. Before
9747219958060d8c4f697df62e7f172c2a77e6c7, it was accidentally being
returned all the way up to the API user. After that commit, the dummy
frame was unref'd so the user received an error.

However, since that commit, VT hwaccel failures started causing random
segfaults in the h264 decoder. This happened more often on iOS where the
VT implementation is more likely to throw errors on bitstream anomolies.
A recent report of this issue can be see in
http://ffmpeg.org/pipermail/libav-user/2016-November/009831.html

The issue here is that the dummy frame is still referenced internally by the
h264 decoder, as part of the reflist and cur_pic_ptr. Deallocating the
frame causes assertions like this one to trip later on during decoding:

  Assertion h->cur_pic_ptr->f->buf[0] failed at src/libavcodec/h264_slice.c:1340

With this commit, we leave the dummy 1-byte frame intact, but avoid returning it
to the user.

This reverts commit 9747219958060d8c4f697df62e7f172c2a77e6c7.

Signed-off-by: wm4 <nfxjfg@googlemail.com>
7 years agolavc/libvpxenc: add -row-mt option
Kagami Hiiragi [Thu, 2 Mar 2017 18:19:09 +0000 (21:19 +0300)]
lavc/libvpxenc: add -row-mt option

Signed-off-by: James Zern <jzern@google.com>
7 years agoavcodec/proresdec2: Do not discard frames with bad slices
Michael Niedermayer [Sat, 4 Mar 2017 00:30:54 +0000 (01:30 +0100)]
avcodec/proresdec2: Do not discard frames with bad slices

The code previously completely discarded frames that had any error in a slice

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
7 years agoavcodec/x86/cavsdsp: Put MMX code under mmx check
Michael Niedermayer [Sun, 5 Mar 2017 02:14:27 +0000 (03:14 +0100)]
avcodec/x86/cavsdsp: Put MMX code under mmx check

Without this the FPU state becomes trashed and causes mysterious
fate failures with cpuflags=0

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
7 years agoavcodec/movtextdec: Call mov_text_cleanup() on close
Michael Niedermayer [Sat, 4 Mar 2017 18:19:31 +0000 (19:19 +0100)]
avcodec/movtextdec: Call mov_text_cleanup() on close

Fixes memleak
Fixes: 548/clusterfuzz-testcase-5511470875934720
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
7 years agoavformat/flvdec: remove meaningless warning
wm4 [Thu, 2 Mar 2017 10:00:40 +0000 (11:00 +0100)]
avformat/flvdec: remove meaningless warning

Ever since the codecpar changes, this has been always printed when
opening a flv file. This is because the codecpar changes made all
streams to be added lazily as read_packet is called.

7 years agoffmpeg: remove unnecessary hack for decoders which refuse to drain
wm4 [Thu, 2 Mar 2017 09:38:44 +0000 (10:38 +0100)]
ffmpeg: remove unnecessary hack for decoders which refuse to drain

Now the previous commit takes care of this instead.

7 years agoavcodec: consider an error during decoder draining as EOF
wm4 [Thu, 2 Mar 2017 09:37:26 +0000 (10:37 +0100)]
avcodec: consider an error during decoder draining as EOF

There is no reason that draining couldn't return an error or two. But
some decoders don't handle this very well, and might always return an
error. This can lead to API users getting into an infinite loop and
burning CPU, because no progress is made and EOF is never returned.

In fact, ffmpeg.c contains a hack against such a case. It is made
unnecessary with this commit, and removed with the next one. (This
particular error case seems to have been fixed since the hack was
added, though.)

This might lose frames if decoding returns errors during draining.

7 years agoavcodec/videotoolbox: set kCVPixelBufferOpenGLESCompatibilityKey for iOS
wang-bin [Fri, 3 Mar 2017 10:10:54 +0000 (18:10 +0800)]
avcodec/videotoolbox: set kCVPixelBufferOpenGLESCompatibilityKey for iOS

kCVPixelBufferIOSurfaceOpenGLTextureCompatibilityKey is not available in
iOS

7 years agoavformat/vivo: fix logic error in checking version in probe
Paul B Mahol [Sun, 5 Mar 2017 15:34:32 +0000 (16:34 +0100)]
avformat/vivo: fix logic error in checking version in probe

Signed-off-by: Paul B Mahol <onemda@gmail.com>
7 years agolavf/matroska: Support QDMC.
Carl Eugen Hoyos [Wed, 1 Mar 2017 22:22:40 +0000 (23:22 +0100)]
lavf/matroska: Support QDMC.

7 years agoavcodec/wavpack: Fix runtime error: left shift of negative value -2
Michael Niedermayer [Sat, 4 Mar 2017 03:55:15 +0000 (04:55 +0100)]
avcodec/wavpack: Fix runtime error: left shift of negative value -2

Fixes: 723/clusterfuzz-testcase-6471394663596032
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
7 years agoavcodec/dcadsp: Fix 2 runtime error: signed integer overflow: -1958094138 - 107890634...
Michael Niedermayer [Fri, 3 Mar 2017 19:12:22 +0000 (20:12 +0100)]
avcodec/dcadsp: Fix 2 runtime error: signed integer overflow: -1958094138 - 1078906344 cannot be represented in type 'int'

Fixes: 722/clusterfuzz-testcase-5711268868521984
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
7 years agoavcodec/wavpack: Check bitrate_acc for overflow
Michael Niedermayer [Fri, 3 Mar 2017 19:12:21 +0000 (20:12 +0100)]
avcodec/wavpack: Check bitrate_acc for overflow

Fixes: undefined behavior in 717/clusterfuzz-testcase-5434924129583104
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
7 years agoavcodec/mpeg4videodec: Fix runtime error: signed integer overflow: 134527392 * 16...
Michael Niedermayer [Fri, 3 Mar 2017 19:12:20 +0000 (20:12 +0100)]
avcodec/mpeg4videodec: Fix runtime error: signed integer overflow: 134527392 * 16 cannot be represented in type 'int'

This checks the sprite delta intermediates for overflow
Fixes: 716/clusterfuzz-testcase-4890287480504320
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
7 years agoavcodec/mpeg12dec: Fix runtime error: left shift of negative value -13
Michael Niedermayer [Fri, 3 Mar 2017 03:39:05 +0000 (04:39 +0100)]
avcodec/mpeg12dec: Fix runtime error: left shift of negative value -13

Fixes: 709/clusterfuzz-testcase-4789836449841152
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
7 years agoavcodec/h264_mvpred: Fix multiple runtime error: left shift of negative value
Michael Niedermayer [Fri, 3 Mar 2017 03:39:06 +0000 (04:39 +0100)]
avcodec/h264_mvpred: Fix multiple runtime error: left shift of negative value

Fixes: 710/clusterfuzz-testcase-5091051431788544
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
7 years agoavcodec/adxdec: Fix runtime error: left shift of negative value -1
Michael Niedermayer [Fri, 3 Mar 2017 03:39:04 +0000 (04:39 +0100)]
avcodec/adxdec: Fix runtime error: left shift of negative value -1

Fixes: 705/clusterfuzz-testcase-5129572590813184
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
7 years agoavcodec/mpeg4videodec: Improve the overflow checks in mpeg4_decode_sprite_trajectory()
Michael Niedermayer [Thu, 2 Mar 2017 02:02:07 +0000 (03:02 +0100)]
avcodec/mpeg4videodec: Improve the overflow checks in mpeg4_decode_sprite_trajectory()

Also clear the state on errors

Fixes integer overflows in 701/clusterfuzz-testcase-6594719951880192

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
7 years agoavcodec/vp56: Require a correctly decoded frame before using vp56_conceal_mb()
Michael Niedermayer [Thu, 2 Mar 2017 02:02:06 +0000 (03:02 +0100)]
avcodec/vp56: Require a correctly decoded frame before using vp56_conceal_mb()

Fixes timeout with 700/clusterfuzz-testcase-5660909504561152
Fixes timeout with 702/clusterfuzz-testcase-4553541576294400

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
7 years agoavformat/hlsenc: move the segment files handler close to before temp flags process
Steven Liu [Sat, 4 Mar 2017 01:27:56 +0000 (09:27 +0800)]
avformat/hlsenc: move the segment files handler close to before temp flags process

fix ticket: #6204

Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
7 years agodoc/encoders: mention valid values for compression_level when using FLAC encoder
James Almer [Fri, 3 Mar 2017 16:49:14 +0000 (13:49 -0300)]
doc/encoders: mention valid values for compression_level when using FLAC encoder

Found-by: Miles
Signed-off-by: James Almer <jamrial@gmail.com>
7 years agoavutil/md5: stop discarding the const qualifier for the src pointer
James Almer [Fri, 3 Mar 2017 03:27:52 +0000 (00:27 -0300)]
avutil/md5: stop discarding the const qualifier for the src pointer

The code modifying the buffer on big endian systems was removed.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: James Almer <jamrial@gmail.com>
7 years agoavutil/md5: fix misaligned reads
James Almer [Fri, 3 Mar 2017 03:25:54 +0000 (00:25 -0300)]
avutil/md5: fix misaligned reads

This makes ubsan happy and also considerably increases performance on
big endian systems.

Tested on an IBM POWER7 3.55 GHz

Before:

2.24user 0.14system 0:02.39elapsed 99%CPU (0avgtext+0avgdata 2624maxresident)k
2.26user 0.11system 0:02.38elapsed 99%CPU (0avgtext+0avgdata 2688maxresident)k
2.23user 0.15system 0:02.38elapsed 99%CPU (0avgtext+0avgdata 2624maxresident)k
2.25user 0.12system 0:02.38elapsed 100%CPU (0avgtext+0avgdata 2624maxresident)k
2.20user 0.15system 0:02.36elapsed 99%CPU (0avgtext+0avgdata 2624maxresident)k

After:

1.86user 0.13system 0:02.00elapsed 99%CPU (0avgtext+0avgdata 2624maxresident)k
1.89user 0.11system 0:02.01elapsed 99%CPU (0avgtext+0avgdata 2624maxresident)k
1.85user 0.14system 0:02.00elapsed 99%CPU (0avgtext+0avgdata 2624maxresident)k
1.84user 0.15system 0:01.99elapsed 99%CPU (0avgtext+0avgdata 2624maxresident)k
1.89user 0.13system 0:02.02elapsed 99%CPU (0avgtext+0avgdata 2688maxresident)k

Tested-by: Nicolas George <george@nsup.org>
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: James Almer <jamrial@gmail.com>
7 years agoavcodec/vp3: Do not return random positive values but the buf size
Michael Niedermayer [Thu, 15 Dec 2016 20:08:48 +0000 (21:08 +0100)]
avcodec/vp3: Do not return random positive values but the buf size

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
7 years agoomx: Add support for specifying H.264 profile [v5']
Takayuki 'January June' Suwa [Fri, 3 Mar 2017 06:17:37 +0000 (15:17 +0900)]
omx: Add support for specifying H.264 profile [v5']

This adds "-profile[:v] profile_name"-style option.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
7 years agoavcodec/scpr: fix top left prediction for special case when x is 0 for keyframes
Paul B Mahol [Fri, 3 Mar 2017 11:17:46 +0000 (12:17 +0100)]
avcodec/scpr: fix top left prediction for special case when x is 0 for keyframes

Signed-off-by: Paul B Mahol <onemda@gmail.com>
7 years agoffmpeg: properly cleanup filter graph on init failure
wm4 [Thu, 2 Mar 2017 18:14:58 +0000 (19:14 +0100)]
ffmpeg: properly cleanup filter graph on init failure

The filter field is often used to check whether a filter is
configured. If configuring the filter actually fails somewhere in
the middle of it, these fields could still be set to non-NULL, which
lead to other code accessing the half-configured filter graph, which
in turn could lead to crashes within libavfilter.

Solve this by properly resetting all fields.

This was triggered by a fuzzed sample after the recent changes. It's
unknown whether this behavior could be triggered before that.

7 years agoffmpeg: delay processing of subtitles before filters are initialized
wm4 [Thu, 2 Mar 2017 15:01:01 +0000 (16:01 +0100)]
ffmpeg: delay processing of subtitles before filters are initialized

If a subtitle packet came before the first video frame could be fully
decoded, the subtitle packet would get discarded. This puts the subtitle
into a queue instead, and processes it once the attached filter graph is
initialized.

7 years agoffmpeg_cuvid: adapt for recent filter graph initialization changes
Timo Rothenpieler [Thu, 9 Feb 2017 20:33:51 +0000 (21:33 +0100)]
ffmpeg_cuvid: adapt for recent filter graph initialization changes

7 years agoffmpeg: restructure sending EOF to filters
Anton Khirnov [Mon, 27 Jun 2016 17:03:42 +0000 (19:03 +0200)]
ffmpeg: restructure sending EOF to filters

Be more careful when an input stream encounters EOF when its filtergraph
has not been configured yet. The current code would immediately mark the
corresponding output streams as finished, while there may still be
buffered frames waiting for frames to appear on other filtergraph
inputs.

This should fix the random FATE failures for complex filtergraph tests
after a3a0230a9870b9018dc7415ae5872784d524cfe5

This merges Libav commit 94ebf55. It was previously skipped.

This is the last filter init related Libav commit that was skipped, so
this also removes the commits from doc/libav-merge.txt.

Signed-off-by: wm4 <nfxjfg@googlemail.com>
7 years agoffmpeg: move flushing the queued frames to configure_filtergraph()
Anton Khirnov [Mon, 27 Jun 2016 16:59:23 +0000 (18:59 +0200)]
ffmpeg: move flushing the queued frames to configure_filtergraph()

This is a more appropriate place for it, and will also be useful in the
following commit.

This merges Libav commit d2e56cf. It was previously skipped.

Signed-off-by: wm4 <nfxjfg@googlemail.com>
7 years agoffmpeg: fix printing of filter input/output names
wm4 [Wed, 8 Feb 2017 11:55:58 +0000 (12:55 +0100)]
ffmpeg: fix printing of filter input/output names

Broken by the previous Libav commit (even in Libav, thus a separate
commit).

Signed-off-by: wm4 <nfxjfg@googlemail.com>
7 years agoffmpeg: init filtergraphs only after we have a frame on each input
Anton Khirnov [Fri, 27 May 2016 10:14:33 +0000 (12:14 +0200)]
ffmpeg: init filtergraphs only after we have a frame on each input

This makes sure the actual stream parameters are used, which is
important mainly for hardware decoding+filtering cases, which would
previously require various weird workarounds to handle the fact that a
fake software graph has to be constructed, but never used.
This should also improve behaviour in rare cases where
avformat_find_stream_info() does not provide accurate information.

This merges Libav commit a3a0230. It was previously skipped.

The code in flush_encoders() which sets up a "fake" format wasn't in
Libav. I'm not sure if it's a good idea, but it tends to give
behavior closer to the old one in certain corner cases.

The vp8-size-change gives different result, because now the size of
the first frame is used. libavformat reported the size of the largest
frame for some reason.

The exr tests now use the sample aspect ratio of the first frame. For
some reason libavformat determines 0/1 as aspect ratio, while the
decoder returns the correct one.

The ffm and mxf tests change the field_order values. I'm assuming
another libavformat/decoding mismatch.

Signed-off-by: wm4 <nfxjfg@googlemail.com>
7 years agoffmpeg: do packet ts rescaling in write_packet()
Anton Khirnov [Fri, 27 May 2016 10:04:29 +0000 (12:04 +0200)]
ffmpeg: do packet ts rescaling in write_packet()

This will be useful in the following commit, after which the muxer
timebase is not always available when encoding.

This merges Libav commit 3e265ca. It was previously skipped.

There are some changes with how/when the mux_timebase field is set,
because the Libav approach often causes a too imprecise time base
to be set. This is hard, because the muxer's write_header function
can readjust the timebase, at which point we might already have
encoded packets buffered. (It might be better to buffer them after
the encoder, instead of after all the timestamp handling logic
before muxing.)

The two FATE tests change because the output time base is raised
for subtitles. (Needed to avoid certain rounding issues in other
cases.)

Includes a minor merge fix by Mark Thompson, and

    avconv: Move rescale to stream timebase before monotonisation

also by Mark Thompson <sw@jkqxz.net>.

Signed-off-by: wm4 <nfxjfg@googlemail.com>
7 years agoffmpeg: make sure packets put into the muxing FIFO are refcounted
wm4 [Wed, 8 Feb 2017 08:53:26 +0000 (09:53 +0100)]
ffmpeg: make sure packets put into the muxing FIFO are refcounted

Some callers (like do_subtitle_out()) 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.

I couldn't find a case that is fixed by this with the current code. But
it will fix the fate-pva-demux test with the later patches applied.

Signed-off-by: wm4 <nfxjfg@googlemail.com>
7 years agolavf/matroska: Support codec ID V_FFV1 for demuxing.
Carl Eugen Hoyos [Wed, 1 Mar 2017 22:40:35 +0000 (23:40 +0100)]
lavf/matroska: Support codec ID V_FFV1 for demuxing.

Fixes ticket #6206.

7 years agoRevert "avutil/frame: Disallow zero sized frame side data"
Michael Niedermayer [Wed, 1 Mar 2017 12:02:11 +0000 (13:02 +0100)]
Revert "avutil/frame: Disallow zero sized frame side data"

Found a case where we use size==0, the other related commits
remain needed, and should be sufficient to fix the original issue

This reverts commit 7e4f32f4e4b93c95dcc872cb844c5548e69f352e.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
7 years agoavcodec/interplayvideo: Fix timeout from lack of bitstream end check
Michael Niedermayer [Wed, 1 Mar 2017 16:56:23 +0000 (17:56 +0100)]
avcodec/interplayvideo: Fix timeout from lack of bitstream end check

Fixes: 697/clusterfuzz-testcase-6111250582863872
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>