1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-02 03:06:28 +02:00
Commit Graph

37568 Commits

Author SHA1 Message Date
Martin Storsjö
c8d6eec85d aarch64: vp9lpf: Fix broken indentation/vertical alignment
This is cherrypicked from libav commit
07b5136c48.

Signed-off-by: Martin Storsjö <martin@martin.st>
2017-03-11 13:14:49 +02:00
Martin Storsjö
9f3a886364 aarch64: vp9lpf: Interleave the start of flat8in into the calculation above
This adds lots of extra .ifs, but speeds it up by a couple cycles,
by avoiding stalls.

This is cherrypicked from libav commit
b0806088d3.

Signed-off-by: Martin Storsjö <martin@martin.st>
2017-03-11 13:14:49 +02:00
Martin Storsjö
83399cf569 arm: vp9lpf: Interleave the start of flat8in into the calculation above
This adds lots of extra .ifs, but speeds it up by a couple cycles,
by avoiding stalls.

This is cherrypicked from libav commit
e18c39005a.

Signed-off-by: Martin Storsjö <martin@martin.st>
2017-03-11 13:14:49 +02:00
Martin Storsjö
92ab8374b1 arm: vp9lpf: Use orrs instead of orr+cmp
This is cherrypicked from libav commit
435cd7bc99.

Signed-off-by: Martin Storsjö <martin@martin.st>
2017-03-11 13:14:49 +02:00
Martin Storsjö
f0ecbb13cf 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
e1f9de86f4.

Signed-off-by: Martin Storsjö <martin@martin.st>
2017-03-11 13:14:48 +02:00
Martin Storsjö
148cc0bb89 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
3fcf788fbb.

Signed-off-by: Martin Storsjö <martin@martin.st>
2017-03-11 13:14:48 +02:00
Martin Storsjö
758302e4bc 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
a76bf8cf12.

Signed-off-by: Martin Storsjö <martin@martin.st>
2017-03-11 13:14:48 +02:00
Martin Storsjö
045e33ae3f 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
388e0d2515.

Signed-off-by: Martin Storsjö <martin@martin.st>
2017-03-11 13:14:48 +02:00
Martin Storsjö
bff0771590 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
fea92a4b57.

Signed-off-by: Martin Storsjö <martin@martin.st>
2017-03-11 13:14:47 +02:00
Martin Storsjö
ac6cb8ae5b 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
5e0c2158fb.

Signed-off-by: Martin Storsjö <martin@martin.st>
2017-03-11 13:14:47 +02:00
Martin Storsjö
16ef000799 aarch64: vp9itxfm: Fix incorrect vertical alignment
This is cherrypicked from libav commit
0c0b87f12d.

Signed-off-by: Martin Storsjö <martin@martin.st>
2017-03-11 13:14:47 +02:00
Martin Storsjö
d0fbf7f34e aarch64: vp9itxfm: Update a comment to refer to a register with a different name
This is cherrypicked from libav commit
8476eb0d3a.

Signed-off-by: Martin Storsjö <martin@martin.st>
2017-03-11 13:14:46 +02:00
Martin Storsjö
6752318c73 aarch64: vp9itxfm: Use the right lane sizes in 8x8 for improved readability
This is cherrypicked from libav commit
3dd7827258.

Signed-off-by: Martin Storsjö <martin@martin.st>
2017-03-11 13:14:46 +02:00
Martin Storsjö
19a0f9529c 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
ed8d293306.

Signed-off-by: Martin Storsjö <martin@martin.st>
2017-03-11 13:14:46 +02:00
Martin Storsjö
3006e5253a aarch64: vp9itxfm: Share instructions for loading idct coeffs in the 8x8 function
This is cherrypicked from libav commit
4da4b2b87f.

Signed-off-by: Martin Storsjö <martin@martin.st>
2017-03-11 13:14:27 +02:00
Martin Storsjö
1d8ab576a7 arm: vp9itxfm: Share instructions for loading idct coeffs in the 8x8 function
This is cherrypicked from libav commit
3933b86bb9.

Signed-off-by: Martin Storsjö <martin@martin.st>
2017-03-11 13:14:26 +02:00
Martin Storsjö
9532a7d4d0 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
a63da4511d.

Signed-off-by: Martin Storsjö <martin@martin.st>
2017-03-11 13:14:25 +02:00
Martin Storsjö
824589556c 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
5eb5aec475.

Signed-off-by: Martin Storsjö <martin@martin.st>
2017-03-11 13:14:25 +02:00
Martin Storsjö
a681c793a3 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
79d332ebbd.

Signed-off-by: Martin Storsjö <martin@martin.st>
2017-03-11 13:14:24 +02:00
Martin Storsjö
3bd9b39108 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
47b3c2c18d.

Signed-off-by: Martin Storsjö <martin@martin.st>
2017-03-11 13:14:23 +02:00
Martin Storsjö
dc47bf3872 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
115476018d.

Signed-off-by: Martin Storsjö <martin@martin.st>
2017-03-11 13:14:22 +02:00
Martin Storsjö
f8fcee0daf 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
0331c3f5e8.

Signed-off-by: Martin Storsjö <martin@martin.st>
2017-03-11 13:14:20 +02:00
Martin Storsjö
52c7366c83 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
58d87e0f49.

Signed-off-by: Martin Storsjö <martin@martin.st>
2017-03-11 13:14:09 +02:00
Martin Storsjö
31e41350d2 arm: vp9itxfm: Avoid .irp when it doesn't save any lines
This makes it more readable.

This is cherrypicked from libav commit
3bc5b28d5a.

Signed-off-by: Martin Storsjö <martin@martin.st>
2017-03-11 13:14:00 +02:00
Michael Niedermayer
6e913f2129 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>
2017-03-11 02:50:22 +01:00
Michael Niedermayer
dc0b9b218c avcodec/h264_ps: Forward errors from decode_scaling_list()
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-03-11 02:50:22 +01:00
Aaron Boxer
195784ec95 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>
2017-03-09 20:28:45 -08:00
Thomas Guilbert
9bbc73ae9f 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>
2017-03-10 02:20:21 +01:00
Michael Niedermayer
bac9c03ed9 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>
2017-03-09 23:28:10 +01:00
Michael Niedermayer
e2a4f1a9eb 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>
2017-03-09 23:28:10 +01:00
Michael Niedermayer
222c9f031d 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>
2017-03-09 23:28:10 +01:00
Michael Niedermayer
800d02abe0 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>
2017-03-09 23:28:10 +01:00
Michael Niedermayer
58dd25f8ad 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>
2017-03-09 20:37:10 +01:00
Timo Rothenpieler
5cd3cd5b68 avcodec/cuvid: add support for cropping/resizing
Overhauled version, original patch by Miroslav Slugeň <thunder.m@email.cz>.
2017-03-09 18:39:15 +01:00
wm4
f940492bb2 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.
2017-03-09 17:33:56 +01:00
wm4
fcfc78cbab 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 946ed78f5f (2012).
2017-03-09 10:16:12 +01:00
Michael Niedermayer
3016e919d4 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>
2017-03-08 21:15:07 +01:00
Michael Niedermayer
01a33b835f 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>
2017-03-08 21:15:07 +01:00
Carl Eugen Hoyos
587226ad45 lavc/libx265: Add gray10 and gray12 encoding support. 2017-03-08 00:25:33 +01:00
Michael Niedermayer
1afd246960 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>
2017-03-07 21:29:43 +01:00
Michael Niedermayer
55d7371fe0 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>
2017-03-07 21:29:12 +01:00
Michael Niedermayer
5098a6f627 avcodec/vp8: remove redundant check
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-03-07 19:13:19 +01:00
Muhammad Faiz
e85e840880 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>
2017-03-07 20:34:44 +07:00
Vittorio Giovara
a6b1180e39 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>
2017-03-07 14:04:01 +01:00
Aman Gupta
b6eaa3928e 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
9747219958, 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 9747219958.

Signed-off-by: wm4 <nfxjfg@googlemail.com>
2017-03-07 11:58:38 +01:00
Kagami Hiiragi
734d760e2f lavc/libvpxenc: add -row-mt option
Signed-off-by: James Zern <jzern@google.com>
2017-03-06 11:58:33 -08:00
Michael Niedermayer
8aa4f3bb4f 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>
2017-03-06 16:47:17 +01:00
Michael Niedermayer
835d9f299c 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>
2017-03-06 16:47:17 +01:00
Michael Niedermayer
a9f9b7f5c7 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>
2017-03-06 16:47:17 +01:00
wm4
a755b725ec 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.
2017-03-06 11:06:09 +01:00
wang-bin
3267e1703b avcodec/videotoolbox: set kCVPixelBufferOpenGLESCompatibilityKey for iOS
kCVPixelBufferIOSurfaceOpenGLTextureCompatibilityKey is not available in
iOS
2017-03-06 10:54:02 +01:00
Michael Niedermayer
ba15005132 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>
2017-03-05 12:03:15 +01:00
Michael Niedermayer
29638d4db9 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>
2017-03-05 12:01:48 +01:00
Michael Niedermayer
d03d386162 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>
2017-03-05 12:01:46 +01:00
Michael Niedermayer
fab13bbbcd 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>
2017-03-05 12:01:41 +01:00
Michael Niedermayer
d757ddbaab 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>
2017-03-04 17:48:04 +01:00
Michael Niedermayer
ab998f4c7f 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>
2017-03-04 17:48:04 +01:00
Michael Niedermayer
d23727e042 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>
2017-03-04 17:48:04 +01:00
Michael Niedermayer
eb41956636 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>
2017-03-04 03:05:15 +01:00
Michael Niedermayer
2ce4f28431 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>
2017-03-04 03:05:15 +01:00
Michael Niedermayer
d8094a303b avcodec/vp3: Do not return random positive values but the buf size
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-03-03 17:17:53 +01:00
Takayuki 'January June' Suwa
13332504c9 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>
2017-03-03 17:17:53 +01:00
Paul B Mahol
6d93e7d1a3 avcodec/scpr: fix top left prediction for special case when x is 0 for keyframes
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2017-03-03 12:28:24 +01:00
Michael Niedermayer
6191198c21 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>
2017-03-03 01:03:29 +01:00
Michael Niedermayer
3b0b35150d avcodec/mpegaudiodec_template: Fix runtime error: signed integer overflow: 2053224902 + 2053224902 cannot be represented in type 'int'
Fixes: 696/clusterfuzz-testcase-5853632270434304

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-03-03 01:03:29 +01:00
Michael Niedermayer
4b72d5cd6f avcodec/mjpegdec: Fix runtime error: left shift of negative value -511
Fixes: 693/clusterfuzz-testcase-6109776066904064

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-03-03 01:03:29 +01:00
Carl Eugen Hoyos
46082c2b3f lavc/sheervideo: Fix Y prediction for interlaced frames with transparency.
Based on 260de8a2 by Paul B Mahol.
Fixes ticket #6210.
2017-03-02 18:11:57 +01:00
Kostya Shishkov
a63496cc88 avcodec: add ClearVideo decoder
Only I-frames are decoded for now.

Signed-off-by: Paul B Mahol <onemda@gmail.com>
2017-03-02 11:39:54 +01:00
wm4
f07492e7fb avcodec/videotoolbox: set kCVPixelBufferIOSurfaceOpenGLTextureCompatibilityKey
Makes sure the output can be mapped as OpenGL texture.
This is what at least video players normally want.
2017-03-02 10:32:21 +01:00
wm4
ade7c1a232 avcodec/videotoolbox: allow not setting the kCVPixelBufferPixelFormatTypeKey
If AVVideotoolboxContext.cv_pix_fmt_type is set to 0, don't set the
kCVPixelBufferPixelFormatTypeKey value on the VT decoder.

This makes VT output its native format, which can be much faster on
some hardware iterations (if the native format does not match with
the requested format, it will be converted, which is slow).

The default is still forcing nv12.
2017-03-02 10:32:21 +01:00
wm4
554bc4eea8 avcodec, avutil, avformat: remove AVOption requirement for some fields
Allow all struct fields to be accessed directly, as long as they're
public.

Before this change, many fields were "public", but could be accessed via
AVOption only. This meant they were effectively not public, but were
present for documentation purposes, which was incredibly confusing at
best.
2017-03-02 10:32:12 +01:00
Michael Niedermayer
4bed066377 avcodec/vp56: Clear dimensions in case of failure in the middle of a resolution change
Similar code is used elsewhere in vp56 to force a more complete reinit in the future.
Fixes null pointer dereference
Fixes: 707/clusterfuzz-testcase-4717453097566208

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-03-02 03:16:18 +01:00
Michael Niedermayer
f8060ab927 avcodec/wavpack: Check value before shift in wp_exp2()
Fixes undefined shift, all callers should be changed to check the value
they use with wp_exp2() or its return value.

Fixes: 692/clusterfuzz-testcase-5757381516460032

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-03-02 03:16:15 +01:00
Michael Niedermayer
12c3e120fe avcodec/ituh263dec: Use 0xffff as error code in h263p_decode_umotion()
This matches ff_h263_decode_motion() both functions error codes are interpreted by the same common code

Fixes: 690/clusterfuzz-testcase-4744944981901312

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-03-02 03:16:12 +01:00
Michael Niedermayer
04c99c8042 avcodec/h264idct_template: Fix several runtime error: signed integer overflow
Fixes: 689/clusterfuzz-testcase-6029352737177600

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-03-02 03:16:10 +01:00
Rick Kern
70ebc05bce lavc/videotoolboxenc: fix symbol linking
Removes explicit reference to symbols and fixes dereferencing issue.

Signed-off-by: Rick Kern <kernrj@gmail.com>
2017-03-01 10:43:08 -05:00
Michael Niedermayer
7b5ff7d573 avcodec/vp8: Check for bitsteam end in decode_mb_row_no_filter()
Fixes timeout with 686/clusterfuzz-testcase-5853946876788736

this shortcuts (i.e. speeds up) the error and
return-to-user when decoding a truncated frame

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Previous version reviewed by: "Ronald S. Bultje" <rsbultje@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-03-01 14:07:33 +01:00
Michael Niedermayer
4bd3f1ce3e avcodec/h264_direct: Fix runtime error: left shift of negative value -14
Fixes: 682/clusterfuzz-testcase-4799120021651456

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-03-01 14:07:33 +01:00
Michael Niedermayer
2c00b37302 avcodec/avpacket: Check metadata key in av_packet_unpack_dictionary()
Fixes timeout
Fixes: 501/clusterfuzz-testcase-5672752870588416

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-03-01 14:07:33 +01:00
Konda Raju
5f44a4a0a9 avcodec/nvenc: add initial QP value options
Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
2017-03-01 13:15:34 +01:00
Ganapathy Raman Kasi
a549243b89 avcodec/nvenc: remove qmin and qmax constraints for vbr
qmin and qmax are not necessary for nvenc vbr.
Enforcing this constraint, doesn't allow user to use vbr 2 pass mode without explicity setting the qmin and qmax options

Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
2017-03-01 12:20:54 +01:00
Michael Niedermayer
4c0139463c avcodec/vp56: Factorize vp56_render_mb() out
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-02-28 01:13:52 +01:00
Michael Niedermayer
949d2176ef avcodec/dca: Fix multiple runtime error: signed integer overflow
Fixes: 680/clusterfuzz-testcase-5416627266912256
Fixes: 681/clusterfuzz-testcase-5013323462475776

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-02-28 01:13:52 +01:00
Michael Niedermayer
63e400a880 avcodec/pictordec: Check plane value before doing value/mask computations
Fixes integer overflow
Fixes: 675/clusterfuzz-testcase-6722971232108544

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-02-28 01:13:52 +01:00
Michael Niedermayer
25e93aacc2 avcodec/mpeg4videodec: Fix runtime error: left shift of negative value -2650
Fixes: 674/clusterfuzz-testcase-6713275880308736

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-02-28 01:13:52 +01:00
Michael Niedermayer
4ea7744859 avcodec/h264idct_template: Fix multiple runtime error: signed integer overflow
Fixes: 677/clusterfuzz-testcase-6635120628858880

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Reviewed-by: Steven Liu <lingjiujianke@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-02-28 01:13:52 +01:00
Paul B Mahol
26a7d6a301 avcodec/qdrw: check bytes per scanline for 2bpp images
One byte less is read in case of small width.
Closes #6194.

Signed-off-by: Paul B Mahol <onemda@gmail.com>
2017-02-27 14:17:51 +01:00
Paul B Mahol
86ab6b6e08 avcodec/scpr: check if total_freq is 0 in decode0
Fixes SIGFPE, closes #6196.

Signed-off-by: Paul B Mahol <onemda@gmail.com>
2017-02-27 13:55:15 +01:00
James Darnley
33de0fee2c avcodec/h264: enable sse2 chroma deblock/loop filter functions
Between 1.00 and 1.16 times faster on Intel Yorkfield Core 2 Quad.
Between 1.11 and 1.39 times faster on Intel Kaby Lake Pentium.
2017-02-27 13:22:06 +01:00
James Darnley
cd893b9307 avcodec/h264: add avx 8-bit 4:2:2 chroma h intra deblock/loop filter
~1.37x faster (147 vs. 108 cycles) compared to mmxext function
2017-02-27 13:22:06 +01:00
James Darnley
0e16b3e2be avcodec/h264: add avx 8-bit 4:2:0 chroma h intra deblock/loop filter
~1.10x faster (69 vs. 63 cycles) compared to mmxext function
2017-02-27 13:22:06 +01:00
James Darnley
987ffe4b8d avcodec/h264: add avx 8-bit chroma v intra deblock/loop filter
~1.14x faster (90 vs 78 cycles) compared with mmxext
2017-02-27 13:22:06 +01:00
James Darnley
88307b3eec avcodec/h264: add avx 8-bit 4:2:2 chroma h deblock/loop filter
~1.21x faster (68 vs. 56 cycles) compared with mmxext function
2017-02-27 13:22:06 +01:00
James Darnley
ac096fc82d avcodec/h264: add avx 8-bit 4:2:0 chroma h deblock/loop filter
~1.14x faster (93 vs. 81 cycles) compared with mmxext function
2017-02-27 13:22:06 +01:00
James Darnley
5c56758843 avcodec/h264: add avx 8-bit chroma v deblock/loop filter
~1.24x faster (101 vs. 81 cycles) compared with mmxext function
2017-02-27 13:22:06 +01:00
Carl Eugen Hoyos
1e298e7724 lavc/svq3: Remove an unused function. 2017-02-27 13:10:41 +01:00
Paul B Mahol
3a7f8d2a1f avcodec/qdrw: consume bytes when end is reached for 8bpp case
This should really be part of previous commit.

Signed-off-by: Paul B Mahol <onemda@gmail.com>
2017-02-27 12:04:15 +01:00
Paul B Mahol
1dcf91f2d3 avcodec/qdrw: fix decoding of odd sized images for 8bpp
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2017-02-27 11:49:59 +01:00
Paul B Mahol
dc78696ea4 avcodec/qdrw: fix decoding odd size images for 2bpp and 4bpp
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2017-02-27 11:39:36 +01:00
Paul B Mahol
05aa53dc55 avcodec/qdrw: fix decoding odd size images for 16bit case
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2017-02-27 11:24:43 +01:00
Paul B Mahol
6d856b2579 avcodec/scpr: add support for older version
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2017-02-26 22:09:54 +01:00
Michael Niedermayer
7e9ba78f6b avcodec/flacdsp: Fix: runtime error: signed integer overflow: -1027555328 + -1226681270 cannot be represented in type 'int'
Fixes: 673/clusterfuzz-testcase-5948736536576000

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-02-26 17:16:22 +01:00
Michael Niedermayer
87eb374970 avcodec/eac3dec: Fix runtime error: left shift of negative value -3
Fixes: 672/clusterfuzz-testcase-5595018867769344

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-02-26 17:16:22 +01:00
Michael Niedermayer
aff8cf18cb avcodec/mpeg12dec: Fix runtime error: left shift of negative value -2
671/clusterfuzz-testcase-4990381827555328

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-02-26 17:16:22 +01:00
Michael Niedermayer
0716bcce5b avcodec/ituh263dec: Check for the bitstream end in ff_h263_decode_mb()
Fixes invalid shift

Fixes: 670/clusterfuzz-testcase-4852021066727424

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-02-26 17:16:22 +01:00
Michael Niedermayer
58f3469cc6 avcodec/wavpack: Fix 280:22: runtime error: left shift of negative value -1
Fixes: 653/clusterfuzz-testcase-5773837415219200
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-02-25 22:02:23 +01:00
Michael Niedermayer
5eb04570f6 avcodec/wavpack: Check post_shift
Fixes: runtime error: shift exponent 34 is too large for 32-bit type 'int'

Fixes: 653/clusterfuzz-testcase-5773837415219200

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-02-25 22:02:23 +01:00
Michael Niedermayer
d34bf886e9 avcodec/vp56: Implement very basic error concealment
This should fix the fate failure due to a truncated last frame.
Alternatively the frame could be dropped.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-02-25 13:09:50 +01:00
Michael Niedermayer
6bd79ba59f avcodec/amrwbdec: Fix 2 runtime errors: left shift of negative value -1
Fixes: 669/clusterfuzz-testcase-4847965409640448

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-02-25 02:20:35 +01:00
Michael Niedermayer
310d2af319 avcodec/pngdec: Fix runtime error: left shift of 152 by 24 places cannot be represented in type 'int'
Fixes: 666/clusterfuzz-testcase-6581447227867136

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-02-25 01:43:53 +01:00
Michael Niedermayer
513a349439 avcodec/vp56: Fix sign typo
Fixes: 664/clusterfuzz-testcase-4917047475568640

The change to fate is due to a truncated last frames which is now detected as damaged.

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-02-24 22:23:53 +01:00
Michael Niedermayer
5d81616be3 avcodec/mpegaudiodec_template: Correct return code on id3 tag discarding
Fixes: 665/clusterfuzz-testcase-4863789881098240

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-02-24 22:23:53 +01:00
Rostislav Pehlivanov
70259737cb opus_pvq: prevent division by 0
res was 0 and divided K which made it infinity which caused K to
overflow.

Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
2017-02-24 19:14:55 +00:00
Paul B Mahol
e01c32f260 avcodec/scpr: remove 4 dead store
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2017-02-24 19:49:39 +01:00
Paul B Mahol
c583e701bd avcodec/fmvc: initialize opcode to 0
It shouldn't really matter but it doesn't hurt.

Signed-off-by: Paul B Mahol <onemda@gmail.com>
2017-02-24 15:50:16 +01:00
Paul B Mahol
0a28c50506 avcodec/scpr: improve motion vectors checking for out of buffer write
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2017-02-24 15:27:19 +01:00
Michael Niedermayer
2b8b7921c5 avcodec/vp3dsp: Fix multiple signed integer overflow: 46341 * 47523 cannot be represented in type 'int'
Fixes: 664/clusterfuzz-testcase-4917047475568640

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-02-24 14:12:13 +01:00
Michael Niedermayer
8696f25444 avcodec/rv34: Simplify and factor get_slice_offset() code
This also fixes several integer overflows by checking each value before
use.
Fixes: 662/clusterfuzz-testcase-4898131432964096

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-02-24 14:12:12 +01:00
Paul B Mahol
178cd50c47 avcodec/scpr: make sure that component value is <= 0x1F for 16 bpc
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2017-02-24 12:02:48 +01:00
Paul B Mahol
fa3e49568d avcodec/aic: unbreak decoding of files with slice_width != 16
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2017-02-24 11:35:02 +01:00
Carl Eugen Hoyos
560f5188c6 lavc/utils: Make second parameter to apply_param_change() const.
Fixes a compilation warning:
passing argument 2 of ‘apply_param_change’ discards ‘const’ qualifier from pointer target type
2017-02-24 11:04:37 +01:00
Rostislav Pehlivanov
f19442c069 opus_pvq: remove unneeded assert
Since the PVQ search has been well fuzzed and is guaranteed to never
break SUM(abs(y[])) == K, the assert is no longer needed.
Also the assert only prevented coding the wrong vector index but didn't
prevent crashes during searching for it, which made the assert rather
informational than practical.

Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
2017-02-24 07:06:59 +00:00
Rostislav Pehlivanov
22b8ada7b5 opus_pvq: improve PVQ search for low Ks
Since the probelm mentioned only happened when the phase was negative
(e.g. the sum had to be decreased), only discarding dimensions with a
zero pulse in that case restored the search's previously low distortion
at low Ks when the phase is never negative.

Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
2017-02-24 07:03:12 +00:00
Michael Niedermayer
0d85c7bb5a avcodec/ituh263dec: Fix runtime error: left shift of 1342177279 by 1 places cannot be represented in type 'int'
Fixes: 659/clusterfuzz-testcase-5866673603084288

Huge DMV could be created by an encoder ignoring the spec

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-02-24 00:38:45 +01:00
Michael Niedermayer
e98dfeb27c avcodec/jpeglsdec: check shift for values that cause overflow later
Fixes: 657/clusterfuzz-testcase-6674741433729024
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-02-24 00:38:45 +01:00
Michael Niedermayer
76ba09d182 avcodec/mpeg4videodec: Check the other 3 sprite points for intermediate overflows
This is not necessarily specific to fuzzed files

Fixes: Multiple integer overflows
Fixes: 656/clusterfuzz-testcase-6463814516080640
Fixes: 658/clusterfuzz-testcase-6691260146384896

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-02-24 00:38:45 +01:00
Paul B Mahol
20789372da avcodec/shorten: support decoding AIFF-C variant
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2017-02-23 23:03:27 +01:00
Paul B Mahol
45ed942e7e avcodec/scpr: improve check for out of range motion vectors
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2017-02-23 19:45:12 +01:00
Paul B Mahol
95a5af446b avcodec/scpr: check that current row is in valid range
Stops writing out of dst array.

Signed-off-by: Paul B Mahol <onemda@gmail.com>
2017-02-23 18:46:24 +01:00
Paul B Mahol
fd7af82c53 avcodec/scpr: do not allow out of array access for 16bit case
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2017-02-23 17:22:01 +01:00
Paul B Mahol
f062947261 avcodec/qdrw: do better w/h parsing for direct bit packing
Apparently using 0x0001 opcode solely is not correct.
Try this instead.

Signed-off-by: Paul B Mahol <onemda@gmail.com>
2017-02-23 15:20:24 +01:00
Rick Kern
dcd3418a35 lavc/videotoolboxenc: check for dictionary key symbols
Fixes #6081. Some dictionary keys are not present on OS X 10.8.
This loads the symbols and uses a default value if not present.

Signed-off-by: Rick Kern <kernrj@gmail.com>
2017-02-23 00:05:01 -05:00
Michael Niedermayer
9568b2e425 avcodec/h264_ps: Check chroma_qp_index_offset
Fixes: 647/clusterfuzz-testcase-5195745823031296

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Reviewed-by: BBB
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-02-23 02:37:55 +01:00
Jacek Manko
c104556448 avcodec/mips/Makefile: corrected conditional build of version 1 of vc1dsp optimizations for loongson mmi
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-02-23 02:37:55 +01:00
Marton Balint
436f00b10c avcodec/wrapped_avframe: allocate a buffer with padding
This ensures that the wrapped avframe will not get reallocated later, which
would invalidate internal references such as extended data.

Reviewed-by: wm4 <nfxjfg@googlemail.com>
Signed-off-by: Marton Balint <cus@passwd.hu>
2017-02-22 23:11:42 +01:00
Paul B Mahol
039011b6b0 avcodec: add ScreenPressor decoder
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2017-02-22 22:57:59 +01:00
Michael Niedermayer
ec849f637e avcodec/h264idct_template: Fix several runtime error: signed integer overflow
Fixes: 652/clusterfuzz-testcase-6174944410992640

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-02-22 22:29:03 +01:00
Michael Niedermayer
6871df02d9 avcodec/mpeg4videodec: Check sprite_offset in addition to shifts
Fixes: 651/clusterfuzz-testcase-5710668915277824

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-02-22 22:29:03 +01:00
Michael Niedermayer
5a8fec1b33 avcodec/mpegaudiodec_template: Fix multiple runtime error: signed integer overflow
Fixes: 648/clusterfuzz-testcase-5337961317007360

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-02-22 22:29:03 +01:00
Paul B Mahol
fb5c9be82e avcodec/qdrw: add support for 0x0001 code
Fixes decoding of files which sets frame width/height this way.

Signed-off-by: Paul B Mahol <onemda@gmail.com>
2017-02-22 21:24:26 +01:00
Paul B Mahol
2c5839254d avcodec/dnxhddec: fix decoding of DNxHR HQX 10-bit
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2017-02-22 21:21:52 +01:00
James Almer
a267cac928 avcodec/cbrt_data: add missing header include
Fixes make checkheaders
2017-02-22 14:36:26 -03:00
James Almer
65d7d46f71 avcodec/mjpegenc_huffman: add missing header include
Fixes make checkheaders
2017-02-22 14:36:11 -03:00
Paul B Mahol
3f878aaedf avcodec/flicvideo: update comment, 24bit support is implemented
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2017-02-22 15:45:06 +01:00
Michael Niedermayer
c9e3952b82 avcodec/rv34: Forward error from rv34_decode_mv()
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-02-22 02:42:48 +01:00
Michael Niedermayer
6179dc8aa7 avcodec/mpeg4video: Fix runtime error: left shift of negative value
Fixes: 644/clusterfuzz-testcase-4726434209726464
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-02-22 02:42:48 +01:00
Michael Niedermayer
92188c8f57 avcodec/dcadsp: Fix runtime error: signed integer overflow: 394625024 * 8 cannot be represented in type 'int'
Fixes: 643/clusterfuzz-testcase-5209078743695360

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-02-22 02:42:48 +01:00
Michael Niedermayer
24f6559bd2 avcodec/rv34: Fix runtime error: signed integer overflow: -2 + -2147483648 cannot be represented in type 'int'
Fixes: 642/clusterfuzz-testcase-558358808074649

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-02-22 02:42:48 +01:00
James Almer
d04e0a6bcf avcodec/qdrw: don't overwrite bpp when checking its value
Finishes fixing ticket #6171
2017-02-21 20:21:52 -03:00
Alex Converse
dde1bf074c aacdec: When ignoring a PCE restore the previous config
This is related to, but doesn't solve ticker 6152.
2017-02-21 15:12:16 -08:00
Paul B Mahol
770ac75ae9 avcodec/qdrw: add support for 2bpp and 4bpp packed pallette format
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2017-02-21 19:45:44 +01:00
Paul B Mahol
4e6b44559a avcodec/qdrw: fix writing past end of row
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2017-02-21 19:16:35 +01:00
Michael Niedermayer
631f748491 avcodec/ituh263dec: Fix runtime error: left shift of negative value -22
Fixes: 639/clusterfuzz-testcase-5143866241974272

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-02-21 19:05:04 +01:00
Michael Niedermayer
a59505ca76 avcodec/gsmdec_template: Fix runtime error: signed integer overflow: -22527 * 99113 cannot be represented in type 'int'
Fixes: 636/clusterfuzz-testcase-6520876646268928
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-02-21 19:05:04 +01:00
Michael Niedermayer
0c42d0add3 avcodec/bmp: Fix runtime error: negation of -2147483648 cannot be represented in type 'int'; cast to an unsigned type to negate this value to itself
There is code checking height and width later, leaving an invalid value invalid
is thus fine.

Fixes: 635/clusterfuzz-testcase-6225161437052928
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-02-21 19:05:04 +01:00
Michael Niedermayer
cbd622be99 avcodec/h264_ps: Check delta scale for validity
Fixes: signed integer overflow: 5 + 2147483646 cannot be represented in type 'int'
Fixes: 634/clusterfuzz-testcase-5285420445204480

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-02-21 15:31:06 +01:00
Michael Niedermayer
28dc6e7291 avcodec/simple_idct: Fix runtime error: left shift of negative value -6395
Fixes: 633/clusterfuzz-testcase-4553133554401280

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-02-21 15:31:06 +01:00
Michael Niedermayer
956472a323 avcodec/rv40: Fix runtime error: left shift of negative value
Fixes: 630/clusterfuzz-testcase-6608718928019456

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-02-21 15:31:06 +01:00
Paul B Mahol
f4777d1b89 avcodec/qdrw: add support for decoding rgb555
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2017-02-21 12:17:21 +01:00
Michael Niedermayer
e8a3498f24 avcodec/dca_xll: Fix runtime error: signed integer overflow: -1073741824 * 32768 cannot be represented in type 'int'
Fixes: 629/clusterfuzz-testcase-6697457381539840

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-02-21 00:40:20 +01:00
Michael Niedermayer
0a65dae9d0 avcodec/flacdec: reduce limit for golomb so that the max value does not overflow
Fixes: runtime error: left shift of 32 by 26 places cannot be represented in type 'int'

Fixes: 628/clusterfuzz-testcase-6187747641393152
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-02-21 00:40:20 +01:00
Michael Niedermayer
e04108dfa6 avcodec/dca_xll: signed integer overflow: 255251 * 32768 cannot be represented in type 'int'
Fixes: 627/clusterfuzz-testcase-5020897033322496
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-02-21 00:40:20 +01:00
Michael Niedermayer
4614bf2caf Factorize CHECK/SUINT code
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-02-21 00:40:20 +01:00
Steinar H. Gunderson
e3c14eaa54 speedhq: fix decoding artifacts
The quantization table is stored in the natural order, but when we
access it, we use an index that's in zigzag order, causing us to read
the wrong value. This causes artifacts, especially in areas with
horizontal or vertical edges. The artifacts look a lot like the
DCT ringing artifacts you'd expect to see from a low-bitrate file,
but when comparing to NewTek's own decoder, it's obvious they're not
supposed to be there.

Fix by simply storing the scaled quantization table in zigzag order.
Performance is unchanged.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-02-21 00:40:20 +01:00
Timo Rothenpieler
f747e1533a avcodec/nvenc: allow forcing keyframes by default 2017-02-20 22:38:39 +01:00
Michael Niedermayer
15ccaa344c avcodec/mpegaudiodec: Eliminate many undefined operations
Fixes: 625/clusterfuzz-testcase-4574924406521856
Fixes: 626/clusterfuzz-testcase-4738718621499392

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-02-20 17:14:54 +01:00
Michael Niedermayer
01d196a67d avcodec/pictordec: Do not read more than nb_planes
Fixes undefined behavior
Fixes: 622/clusterfuzz-testcase-5745722022428672

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-02-20 17:14:54 +01:00
Michael Niedermayer
b7d9b4a1f1 avcodec/ituh263dec: Check cbpy in ff_h263_decode_mb()
Fixes: 618/clusterfuzz-testcase-6594990333493248

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-02-20 00:49:44 +01:00
Michael Niedermayer
c11d3634b0 avcodec/srtdec: Fix signed integer overflow: 1811992524 * 384 cannot be represented in type 'int'
Fixes: 617/clusterfuzz-testcase-6413875723370496

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-02-19 23:38:46 +01:00
Michael Niedermayer
59e5b05ef6 avcodec/h264_ps: Fix runtime error: signed integer overflow: -1094995528 * 2 cannot be represented in type 'int'
Fixes: 615/clusterfuzz-testcase-5488002644049920
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-02-19 22:55:04 +01:00
Michael Niedermayer
258763ad0e avcodec/h264_cabac: runtime error: signed integer overflow: 2147483647 + 14 cannot be represented in type 'int'
Fixes: 614/clusterfuzz-testcase-4931860079575040

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-02-19 22:41:40 +01:00
Michael Niedermayer
aa2b75263e avcodec/mpeg4videodec: Fix runtime error: shift exponent -2 is negative
Fixes: 612/clusterfuzz-testcase-4707817137111040

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-02-19 21:49:03 +01:00
Michael Niedermayer
c91bdd4524 avcodec/mjpegdec: Fix runtime error: left shift of negative value -507
Fixes: 611/clusterfuzz-testcase-5613455820193792

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-02-19 21:49:03 +01:00
Michael Niedermayer
067485b673 avcodec/eac3dec: Fix runtime error: left shift of negative value
Fixes: 610/clusterfuzz-testcase-4831030085156864

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-02-19 21:49:03 +01:00
Rostislav Pehlivanov
67fa02ed79 opus_pvq: fix PVQ search for K < 5 and low Ns
If the PVQ search picked a place to increment/decrement on the y[]
vector which had no pulse then it would cause a desync since it would
change the sum in the wrong direction. Fix this by not considering
places without pulses as viable.

This makes the PVQ search slightly worse at K < 5 which isn't all that
common. Still, this is a workaround to prevent making broken files until
I can think of a better way of fixing it.

Also add an assertion, which can be removed or moved to assert1/2 once
the PVQ search is stable.

Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
2017-02-19 19:13:14 +00:00
Michael Niedermayer
4279613a26 avcodec/pngdec: Check bit depth for validity
Fixes: runtime error: shift exponent 132 is too large for 32-bit type 'int'
Fixes: 609/clusterfuzz-testcase-4825202619842560

See 11.2.2 IHDR Image header

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-02-19 19:48:57 +01:00
Michael Niedermayer
706757d26d avcodec/mpeg12dec: Fix runtime error: left shift of negative value
Fixes: 608/clusterfuzz-testcase-603978286392934

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-02-19 19:48:57 +01:00
James Almer
b921b3b42b avcodec/huffyuvencdsp: use an actual unsigned long constant
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: James Almer <jamrial@gmail.com>
2017-02-19 12:27:12 -03:00
James Almer
21d25da180 avcodec/huffyuvdsp: use an actual unsigned long constant
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: James Almer <jamrial@gmail.com>
2017-02-19 12:27:06 -03:00
Michael Niedermayer
12eebb845a avcodec/wavpacl: Fix runtime error: left shift of negative value -1
Fixes: 607/clusterfuzz-testcase-5108792465293312

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-02-19 15:58:30 +01:00
Michael Niedermayer
3e1028c625 avcodec/flac: Fix several integer overflows
Fixes: 686513-media
Found-by: Matt Wolenetz <wolenetz@google.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-02-19 15:58:30 +01:00
Michael Niedermayer
e8d4eacc07 Factor CHECKED out of DEBUG so it can be set seperatly
Suggested-by: Matt Wolenetz <wolenetz@google.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-02-19 15:39:36 +01:00
Michael Niedermayer
2ac6eedac5 avcodec/pngdec: Store metadata directly into AVFrame
Fixes memleak
Fixes: 500/clusterfuzz-testcase-6315221727576064

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-02-19 15:39:36 +01:00
Michael Niedermayer
3f28caf720 avcodec/mpeg12dec: Provide debug level log on skiped P/B frames
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-02-19 02:07:12 +01:00
James Darnley
5336887867 avcodec/h264: sse2, avx h luma mbaff deblock/loop filter
x86-64 only

Yorkfield:
- sse2: ~2.17x (434 vs. 200 cycles)

Nehalem:
- sse2: ~2.94x (409 vs. 139 cycles)

Skylake:
- sse2: ~3.10x (370 vs. 119 cycles)
- avx:  ~3.29x (370 vs. 112 cycles)
2017-02-18 20:26:52 +01:00
James Darnley
e18bc2114f avcodec/h264: add named parameters to x86 function 2017-02-18 20:26:50 +01:00
James Darnley
9d815b7424 avcodec/x86: deduplicate PASS8ROWS macro 2017-02-18 20:26:49 +01:00
Miroslav Slugeň
2a2f6b2887 avcodec/cuvid: add drop_second_field as input option
Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
2017-02-18 12:44:08 +01:00
Miroslav Slugeň
4cb8872eb7 avcodec/cuvid: don't overwrite deinterlace at progressive input
If there is progressive input it will disable deinterlacing in cuvid for
all future frames even those interlaced.

Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
2017-02-18 12:44:08 +01:00
Rostislav Pehlivanov
b71f62a9c8 opusenc: initialize the emphasis coefficients on init
Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
2017-02-18 01:13:13 +00:00
Michael Niedermayer
04e611474b avcodec/opus: Check count of ambisonic channels
https://tools.ietf.org/html/draft-ietf-codec-ambisonics-01#section-3.1
specifies the maximum as 227

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-02-17 11:18:30 +01:00
Felicia
fcf3e06fe4 libopus: decode ambisonics with non-diegetic sources
Channel mapping 2 additionally supports a non-diegetic stereo track
appended to the end of a full-order ambisonics signal, such that the
total channel count is either
  (n + 1) ^ 2, or
  (n + 1) ^ 2 + 2
where n is the ambisonics order

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-02-17 11:05:15 +01:00
Paul B Mahol
1a71df9bac avcodec/fmvc: fix decoding of odd size videos
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2017-02-17 10:48:04 +01:00
Carl Eugen Hoyos
1d54be2153 lavc/avpacket: Initialize a variable in error path.
Fixes ticket #6153.

Tested-by: Tyson Smith
2017-02-17 10:31:29 +01:00
Andreas Cadhalpun
9ccc6cecd2 wmaprodec: fix leaking fdsp on init failure
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
2017-02-17 01:45:19 +01:00
Andreas Cadhalpun
783b350b2e mpegaudiodec_template: fix leaking fdsp for mp3on4float
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
2017-02-17 01:45:19 +01:00
Mark Thompson
a1e83a2f90 vaapi_vp8: Use VP8_MAX_QUANT instead of magic number 2017-02-17 00:12:40 +00:00
Michael Niedermayer
1fa8884aeb avcodec/opusenc: Add () protecting macro arguments
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-02-16 13:24:11 +01:00
Michael Niedermayer
8365c1a15c avcodec/error_resilience: Fix "assignment from incompatible pointer type" warning
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-02-16 13:20:27 +01:00
Pavel Koshevoy
e3f1b99334 lavc/vda_h264_dec.c Fix NULL pointer dereference
ps.sps_list entries may be NULL, so check before dereferencing

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-02-16 13:20:27 +01:00
Rostislav Pehlivanov
3fc86f0d69 opusenc: fix coarse energy quantization with 2 bits left
Fixes CID1400584

Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
2017-02-15 22:51:37 +00:00
Rostislav Pehlivanov
1b90e2414d opus_pvq: fix uninitialized variable usage
Fixes CID1400586

Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
2017-02-15 21:11:41 +00:00
Paul B Mahol
ee4aa388b2 adpcm: fix clipping for yamaha
According to specification max value allowed is 0x6000.
Fixes #5862.

Signed-off-by: Paul B Mahol <onemda@gmail.com>
2017-02-15 12:46:01 +01:00
Michael Niedermayer
6a37abc59a avcodec/h264_sei: Check actual presence of SEI picture timing instead of implying it
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-02-15 00:19:50 +01:00
Michael Niedermayer
db3507a670 avcodec/hevc_parser: export framerate, remove one dependency on the decoder
Fixes Ticket6090

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-02-14 17:00:30 +01:00
Timo Rothenpieler
b6f4f0b14b avcodec/cuvid: add format mismatch debug logs 2017-02-14 11:48:38 +01:00
Timo Rothenpieler
ce79410bba avcodec/cuvid: set width and height before calling get_format
The external hw_frames_ctx is initialized in that callback, and needs
that information to be accurate.
2017-02-14 11:47:10 +01:00
Timo Rothenpieler
b7d480f431 avcodec/cuvid: update hw_frames_ctx reference after get_format call 2017-02-14 11:43:47 +01:00
Timo Rothenpieler
be74ba648c avcodec/nvenc: push cuda context before encoding a frame
Thanks to Miroslav Slugeň for figuring out what was going on here.
2017-02-14 11:24:13 +01:00
Rostislav Pehlivanov
5f47c85e5c opus: add a native Opus encoder
This marks the first time anyone has written an Opus encoder without
using any libopus code. The aim of the encoder is to prove how far
the format can go by writing the craziest encoder for it.

Right now the encoder's basic, it only supports CBR encoding, however
internally every single feature the CELT layer has is implemented
(except the pitch pre-filter which needs to work well with the rest of
whatever gets implemented). Psychoacoustic and rate control systems are
under development.

The encoder takes in frames of 120 samples and depending on the value of
opus_delay the plan is to use the extra buffered frames as lookahead.
Right now the encoder will pick the nearest largest legal frame size and
won't use the lookahead, but that'll change once there's a
psychoacoustic system.

Even though its a pretty basic encoder its already outperforming
any other native encoder FFmpeg has by a huge amount.

The PVQ search algorithm is faster and more accurate than libopus's
algorithm so the encoder's performance is close to that of libopus
at zero complexity (libopus has more SIMD).
The algorithm might be ported to libopus or other codecs using PVQ in
the future.

The encoder still has a few minor bugs, like desyncs at ultra low
bitrates (below 9kbps with 20ms frames).

Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
2017-02-14 06:15:36 +00:00
Rostislav Pehlivanov
07b78340dd opus_celt: rename structures to better names and reorganize them
This is meant to be applied on top of my previous patch which
split PVQ into celt_pvq.c and made opus_celt.h

Essentially nothing has been changed other than renaming CeltFrame
to CeltBlock (CeltFrame had absolutely nothing at all to do with
a frame) and CeltContext to CeltFrame.
3 variables have been put in CeltFrame as they make more sense
there rather than being passed around as arguments.
The coefficients have been moved to the CeltBlock structure
(why the hell were they in CeltContext and not in CeltFrame??).

Now the encoder would be able to use the exact context the decoder
uses (plus a couple of extra fields in there).

FATE passes, no slowdowns, etc.

Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
2017-02-14 06:15:36 +00:00
Rostislav Pehlivanov
e538108c21 opus_celt: move quantization and band decoding to opus_pvq.c
A huge amount can be reused by the encoder, as the only thing
which needs to be done would be to add a 10 line celt_icwrsi,
a wrapper around it (celt_alg_quant) and templating the
ff_celt_decode_band to replace entropy decoding functions
with entropy encoding.

There is no performance loss but in fact a performance gain of
around 6% which is caused by the compiler being able to optimize
the decoding more efficiently.

Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
2017-02-14 06:15:36 +00:00
Rostislav Pehlivanov
d2119f624d imdct15: rename to mdct15 and add a forward transform
Handles strides (needed for Opus transients), does pre-reindexing and folding
without needing a copy.

Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
2017-02-14 06:15:36 +00:00
Rostislav Pehlivanov
373ee2c618 opus_rc: add entropy encoding functions
Mostly used the RFC document, the decoding functions and
the reference encoder's implmenentation as a reference.

Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
2017-02-14 06:15:36 +00:00
Mark Thompson
c1a5fca06f lavc: Add device context field to AVCodecContext
For use by codec implementations which can allocate frames internally.
2017-02-13 22:06:43 +00:00
Alex Converse
1fce67d640 aac_latm: Align inband PCE to the start of the payload
A strict reading of the spec seems to imply that it should be aligned to
the start of the element instance tag, but that would break all of the
samples with PCEs.

It seems like a well formed LATM stream should have its PCE in the ASC
rather than inband.

Fixes ticket 4544
2017-02-13 09:31:13 -08:00
Alex Converse
3bb24fc344 aacsbr: Associate SBR data with AAC elements on init
Quiets some log spam on pure upsampling mode.

Fixes ticket 5163.
2017-02-13 09:31:13 -08:00
Alex Converse
20ea8bf939 aac_latm: Copy whole AudioSpecificConfig when it is sized.
This preserves sync extensions.
2017-02-13 09:31:13 -08:00
Alex Converse
3f1a38c919 aac_latm: Allow unaligned AudioSpecificConfig
Fixes ticket 4730
2017-02-13 09:31:13 -08:00
Timo Rothenpieler
8a3fea14ae avcodec/nvenc: set frame buffer format for mapped frames 2017-02-13 11:30:52 +01:00
Josh de Kock
2dafbae994
lavc/libzvbi: remove deprecated API usage
Reviewed-by: Marton Balint <cus@passwd.hu>
Signed-off-by: Josh de Kock <josh@itanimul.li>
2017-02-12 21:37:23 +00:00
Paul B Mahol
5979fb0b1e avcodec/iff: support for byterun1 ACBM compression
This is apparently same as no compression.

Signed-off-by: Paul B Mahol <onemda@gmail.com>
2017-02-12 13:28:25 +01:00
Paul B Mahol
8259f8a720 avcodec: add FM Screen Capture Codec decoder
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2017-02-12 10:43:45 +01:00
Paul B Mahol
5781c983d8 avcodec/flicvideo: add support for 24bit flic files
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2017-02-11 20:20:07 +01:00
Paul B Mahol
54b5cc035a avcodec/flicvideo: fix some indentation issues
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2017-02-11 20:20:07 +01:00
Carl Eugen Hoyos
b47582f43a lavc/atrac3: Constify a pointer declaration.
Silences an "assignment discards ‘const’ qualifier" warning.
2017-02-11 16:35:22 +01:00
Paul B Mahol
280a40dd27 avcodec: add ATRAC Advanced Lossless decoders
Only lossy part is decoded for now.

Signed-off-by: Paul B Mahol <onemda@gmail.com>
2017-02-11 12:00:38 +01:00
Paul B Mahol
ba632efa93 avcodec/qdmc: silence gcc 6.2.0 warning
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2017-02-10 17:04:56 +01:00
Carl Eugen Hoyos
3ea9773793 lavc/mjpegenc_common: Remove an unused variable. 2017-02-10 12:34:36 +01:00
Michael Niedermayer
ce6e7a2db1 avcodec/mjpegenc: Simplify by moving assert into ff_mjpeg_encode_huffman_close()
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-02-10 00:26:54 +01:00
Michael Niedermayer
3e1507a954 avcodec/mjpegenc: Bypass the 2 pass encoding when optimal tables are not requested
This limits the bugs, speedloss and extra memory allocation to the case when
optimal tables are needed.
Fixes regressions with slice multi-threading

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-02-10 00:12:01 +01:00
Michael Niedermayer
f57665b318 avcodec/mjpegenc: Revert some differences in ff_mjpeg_encode_mb() relative to pre optimal huffman
The changes are not needed anymore and the return code was never used

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-02-10 00:12:01 +01:00
Michael Niedermayer
b39129b68e avcodec/mjpegenc_huffman: remove unneeded header include
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-02-10 00:12:01 +01:00
Michael Niedermayer
d23af72a0c avcodec/tests/mjpegenc_huffman: Remove static in main() table
Avoids false positives when greping for non constant statics

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-02-10 00:12:01 +01:00
Michael Niedermayer
daccbe81a2 avcodec/mjpegenc: Drop i_tex misuse, set itex/header bits correctly, fix 2pass encoding
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-02-10 00:12:01 +01:00
Michael Niedermayer
e10bd12c25 avcodec/mjpegenc: Remove non functional huffman reallocation and error handling
If this is wanted iam not against it but it must be designed to work with all cases
like slice threads, and a single growing buffer does not work very well with slices.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-02-10 00:12:01 +01:00
Rostislav Pehlivanov
53234b9ba5 tests/mjpegenc_huffman: align static tables
Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
2017-02-09 03:08:50 +00:00
Rostislav Pehlivanov
a70f0927ea mjpegenc: use s->avctx as a context for av_log rather than NULL
Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
2017-02-09 03:01:58 +00:00
Rostislav Pehlivanov
20614e868b tests/mjpegenc_huffman: replace assert() with av_assert0()
Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
2017-02-09 02:59:22 +00:00
Rostislav Pehlivanov
d164ef6589 mjpegenc_common: add missing ff_ prefix to init_uni_ac_vlc
Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
2017-02-09 02:56:13 +00:00
Mark Thompson
d1acab8293 vaapi_encode: Add VP8 support
Fixes ticket #6116.

(cherry picked from commit ca62236a89)
2017-02-08 19:14:05 +00:00
Mark Thompson
be6546a4ff vaapi_encode: Pass framerate parameters to driver
Only do this when building for a recent VAAPI version - initial
driver implementations were confused about the interpretation of the
framerate field, but hopefully this will be consistent everywhere
once 0.40.0 is released.

(cherry picked from commit ff35aa8ca4)
2017-02-08 19:14:05 +00:00
Mark Thompson
2201c02e6d vaapi_h264: Enable VBR mode
Default to using VBR when a target bitrate is set, unless the max rate
is also set and matches the target.  Changes to the Intel driver mean
that min_qp is also respected in this case, so set a codec default to
unset the value rather than using the current default inherited from
the MPEG-4 part 2 encoder.

(cherry picked from commit eddfb57210)
2017-02-08 19:14:05 +00:00
Mark Thompson
ceb28c3cc4 vaapi_encode: Support VBR mode
This includes a backward-compatibility hack to choose CBR anyway on
old drivers which have no CBR support, so that existing programs will
continue to work their options now map to VBR.

(cherry picked from commit f033ba470f)
2017-02-08 19:14:05 +00:00
Mark Thompson
3b95c7c17d vaapi_encode: Add MPEG-2 support
(cherry picked from commit ca6ae3b77a)
2017-02-08 19:14:05 +00:00
Mark Thompson
eefa4b76ee vaapi_h264: Scale log2_max_pic_order_cnt_lsb with max_b_frames
Before this change, it was possible to overflow pic_order_cnt_lsb and
generate a stream with invalid POC numbering.  This makes sure that
the field is large enough that a single IDR B* P sequence uses fewer
than half the available POC lsb values.

(cherry picked from commit 89725a8512)
2017-02-08 19:14:05 +00:00
Mark Thompson
c667c0979c vaapi_encode: Support forcing IDR frames via AVFrame.pict_type
(cherry picked from commit a3c3a5eac2)
2017-02-08 19:14:04 +00:00
Mark Thompson
760f1a7727 vaapi_encode: Fix GOP sizing
This change makes the configured GOP size be respected exactly -
previously the value could be exceeded slightly due to flaws in the
frame type selection logic.

(cherry picked from commit 37fab0661a)
2017-02-08 19:14:04 +00:00
Mark Thompson
37de9ce713 vaapi_h265: Fix CFR mode with framerate set in AVCodecContext
Same issue as 17a0f9481c.

(cherry picked from commit 7d81698b89)
2017-02-08 19:14:04 +00:00
Mark Thompson
b9514756ba vaapi_h265: Add main 10 encode support
(cherry picked from commit 5a5df90d9c)
(cherry picked from commit d08e02d929)
2017-02-08 19:14:04 +00:00