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

197 Commits

Author SHA1 Message Date
James Almer
109b0d7c0f avcodec/mlp_parser: split off shared code to its own file
Signed-off-by: James Almer <jamrial@gmail.com>
2019-05-07 17:30:19 -03:00
Michael Niedermayer
fc32e08941 avcodec/mlpdec: Insuffient typo
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-02-23 22:48:35 +01:00
Michael Niedermayer
63c4a4b0d6 avcodec/mlpdec: Only change noise_type if the related fields are valid
Fixes: inconsistency
Fixes:runtime error: index 8 out of bounds for type 'int32_t [8]'
Fixes: 6686/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TRUEHD_fuzzer-5191383498358784

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-05-26 00:54:55 +02:00
James Almer
34542ac033 Merge commit '970c76f32283bddf3a5afd24fe52db7a96186244'
* commit '970c76f32283bddf3a5afd24fe52db7a96186244':
  mlp_parser: Drop in-parser downmix functionality

Merged-by: James Almer <jamrial@gmail.com>
2017-10-30 17:20:45 -03:00
James Almer
e3ebc293c6 Merge commit '94c54d97e7f4fe90570c323803f2bdf6246c1010'
* commit '94c54d97e7f4fe90570c323803f2bdf6246c1010':
  mlp: Factor out channel layout subset checks

Merged-by: James Almer <jamrial@gmail.com>
2017-10-30 16:52:36 -03:00
James Almer
8b63acaeee Merge commit '1f6e5dd4d4dd9c02371ad211049d27edb6d95286'
* commit '1f6e5dd4d4dd9c02371ad211049d27edb6d95286':
  mlp: Rename the channel layout variable

Merged-by: James Almer <jamrial@gmail.com>
2017-10-30 16:40:11 -03:00
Michael Niedermayer
361e0310d9 avcodec/mlpdec: Check quant_step_size against huff_lsbs
This reorders the operations so as to avoid computations with the above arguments
before they have been initialized.
Fixes part of 1708/clusterfuzz-testcase-minimized-5035111957397504

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-06-03 23:30:31 +02:00
Michael Niedermayer
ac8dfcbd89 avcodec/mlpdec: Do not leave invalid values in matrix_out_ch[] on error
Fixes: runtime error: index 12 out of bounds for type 'uint8_t [8]'
Fixes: 1832/clusterfuzz-testcase-minimized-6574546079449088

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-05-27 14:37:42 +02:00
Michael Niedermayer
42e42af76c avcodec/mlpdec: Fix runtime error: shift exponent -5 is negative
Fixes part of 1708/clusterfuzz-testcase-minimized-5035111957397504

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-05-22 19:42:39 +02:00
Michael Niedermayer
64ea4d102a avcodec/mlpdec: Do not leave a invalid num_primitive_matrices in the context
Fixes: runtime error: index 8 out of bounds for type 'uint8_t [8]'
Fixes: 1699/clusterfuzz-testcase-minimized-6327177438035968

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-05-20 01:24:11 +02:00
Michael Niedermayer
25c81e4b73 avcodec/mlpdec: Fix: runtime error: left shift of negative value -8
Fixes: 1658/clusterfuzz-testcase-minimized-4889937130291200

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-05-18 04:08:31 +02:00
Michael Niedermayer
552adf1dd3 avcodec/mlpdec: Fix runtime error: left shift of negative value -1
Fixes: 1636/clusterfuzz-testcase-minimized-5310494757879808

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-05-17 00:54:00 +02:00
Michael Niedermayer
e3e51f8c14 avcodec/mlpdec: Check that there is enough data for headers
Fixes: out of array access
Fixes: 1541/clusterfuzz-testcase-minimized-6403410590957568

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-05-13 23:15:13 +02:00
Michael Niedermayer
74dc728a2c avcodec/mlp: Fix multiple runtime error: left shift of negative value -1
Fixes: 1512/clusterfuzz-testcase-minimized-4713846423945216

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-05-13 15:54:33 +02:00
Michael Niedermayer
c535436cbe avcodec/mlpdec: Fix runtime error: left shift of negative value -22
Fixes: 1355/clusterfuzz-testcase-minimized-6662205472768000

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-05-06 12:08:14 +02:00
Vittorio Giovara
970c76f322 mlp_parser: Drop in-parser downmix functionality
request_channel_layout is a decoder option and it makes no sense
to have it in a parser.

This feature was needed in the past when the decoder was allowed
to reuse the avctx from the demuxer. Nowadays the decoder receives
only the parameters from it, already containing the real channel
layout (and the correct request_channel_layout option).

After initialization the decoder overwrites the channel layout
with the downmixed one that is actually output, so there is no need
to preserve this functionality in the parser.

Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2017-04-27 14:19:54 -04:00
Vittorio Giovara
94c54d97e7 mlp: Factor out channel layout subset checks 2017-04-26 11:21:27 -04:00
Vittorio Giovara
1f6e5dd4d4 mlp: Rename the channel layout variable
Purely cosmetic change, will make code more readable once the new
channel layout takes over.
2017-04-26 11:14:57 -04:00
Diego Biurrun
a25dac976a Use bitstream_init8() where appropriate 2017-02-07 18:27:21 +01:00
Alexandra Hájková
00c72a1e01 mlp: Convert to the new bitstream reader 2016-12-19 13:22:29 +01:00
Ganesh Ajjanagadde
977f41e274 mlpdec: Fix a undefined left shift of negative number
This fixes a -Wshift-negative-value warning reported with clang 3.7+.

Signed-off-by: Ganesh Ajjanagadde <gajjanagadde@gmail.com>
2015-09-29 14:33:00 +02:00
Ganesh Ajjanagadde
094a1985d6 avcodec/mlpdec: fix a undefined left shift of negative number
This fixes a -Wshift-negative-value reported with clang 3.7+, e.g
http://fate.ffmpeg.org/log.cgi?time=20150918181527&log=compile&slot=x86_64-darwin-clang-polly-vectorize-stripmine-3.7.

Signed-off-by: Ganesh Ajjanagadde <gajjanagadde@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-09-20 00:30:39 +02:00
Hendrik Leppkes
b27ddffbfb Merge commit 'dc70c19476e76f1118df73b5d97cc76f0e5f6f6c'
* commit 'dc70c19476e76f1118df73b5d97cc76f0e5f6f6c':
  lavc: Drop deprecated request_channels related functions

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2015-09-05 16:42:44 +02:00
Vittorio Giovara
dc70c19476 lavc: Drop deprecated request_channels related functions
Deprecated in 04/2011.
2015-08-28 16:01:16 +02:00
Michael Niedermayer
444e9874a7 Merge commit 'def97856de6021965db86c25a732d78689bd6bb0'
* commit 'def97856de6021965db86c25a732d78689bd6bb0':
  lavc: AV-prefix all codec capabilities

Conflicts:
	cmdutils.c
	ffmpeg.c
	ffplay.c
	libavcodec/8svx.c
	libavcodec/aacenc.c
	libavcodec/ac3dec.c
	libavcodec/adpcm.c
	libavcodec/alac.c
	libavcodec/atrac3plusdec.c
	libavcodec/bink.c
	libavcodec/dnxhddec.c
	libavcodec/dvdec.c
	libavcodec/dvenc.c
	libavcodec/ffv1dec.c
	libavcodec/ffv1enc.c
	libavcodec/fic.c
	libavcodec/flacdec.c
	libavcodec/flacenc.c
	libavcodec/flvdec.c
	libavcodec/fraps.c
	libavcodec/frwu.c
	libavcodec/gifdec.c
	libavcodec/h261dec.c
	libavcodec/hevc.c
	libavcodec/iff.c
	libavcodec/imc.c
	libavcodec/libopenjpegdec.c
	libavcodec/libvo-aacenc.c
	libavcodec/libvorbisenc.c
	libavcodec/libvpxdec.c
	libavcodec/libvpxenc.c
	libavcodec/libx264.c
	libavcodec/mjpegbdec.c
	libavcodec/mjpegdec.c
	libavcodec/mpegaudiodec_float.c
	libavcodec/msmpeg4dec.c
	libavcodec/mxpegdec.c
	libavcodec/nvenc_h264.c
	libavcodec/nvenc_hevc.c
	libavcodec/pngdec.c
	libavcodec/qpeg.c
	libavcodec/ra288.c
	libavcodec/rv10.c
	libavcodec/s302m.c
	libavcodec/sp5xdec.c
	libavcodec/takdec.c
	libavcodec/tiff.c
	libavcodec/tta.c
	libavcodec/utils.c
	libavcodec/v210dec.c
	libavcodec/vp6.c
	libavcodec/vp9.c
	libavcodec/wavpack.c
	libavcodec/yop.c

Merged-by: Michael Niedermayer <michael@niedermayer.cc>
2015-07-27 22:50:18 +02:00
Vittorio Giovara
def97856de lavc: AV-prefix all codec capabilities
Express bitfields more simply.

Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2015-07-27 15:24:58 +01:00
Hendrik Leppkes
dc2d0e06af mlpdec: support TrueHD streams with an Atmos substream
The fourth substream is being discarded, since its not raw audio data,
but an encoded Atmos stream which needs a specialized decoder.

Fixes decoding of the true hd stream from Transformers\ -\ Age\ of\ Extinction\ 2014\ 1080P-003.mkv

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2015-03-11 16:06:40 +01:00
Hendrik Leppkes
f36f6a608b mlpdec: support major sync headers with optional extension blocks
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2015-03-11 16:03:13 +01:00
Michael Niedermayer
9b424accbe Merge commit '2ffb0598dbdb81c40650952aa9299fa02fa5e834'
* commit '2ffb0598dbdb81c40650952aa9299fa02fa5e834':
  mlpdec: check for negative index

Conflicts:
	libavcodec/mlpdec.c

See: 8491ac3ad2

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-11-13 13:59:53 +01:00
Vittorio Giovara
2ffb0598db mlpdec: check for negative index
CC: libav-stable@libav.org
Bug-Id: CID 970924
2014-11-13 01:41:26 +01:00
James Almer
0de1d6287e x86/mlpdec: add ff_mlp_rematrix_channel_{sse4,avx2}
2x to 2.5x faster than the C version.

Reviewed-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: James Almer <jamrial@gmail.com>
2014-10-02 22:11:55 -03:00
James Almer
ddb813b0ef mlpdec: move rematrix_channels code to output_data()
Reviewed-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: James Almer <jamrial@gmail.com>
2014-10-02 22:11:51 -03:00
Hendrik Leppkes
36bf549b27 mlpdec: support TrueHD streams with an Atmos substream
The fourth substream is being discarded, since its not raw audio data,
but an encoded Atmos stream which needs a specialized decoder.

Fixes decoding of the true hd stream from Transformers\ -\ Age\ of\ Extinction\ 2014\ 1080P-003.mkv

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-09-21 14:38:32 +02:00
Hendrik Leppkes
ff34b2d6d3 mlpdec: support major sync headers with optional extension blocks
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-09-21 13:32:56 +02:00
Michael Niedermayer
fa160af08b avcodec/mlpdec: fix () in MSB_MASK() macro
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-05-25 05:18:18 +02:00
Michael Niedermayer
179cf14832 Merge commit 'fcf5fc444522d24caa9907225802817ae788f511'
* commit 'fcf5fc444522d24caa9907225802817ae788f511':
  truehd: tune VLC decoding for ARM.

Conflicts:
	libavcodec/mlpdec.c

See: e555e1bc39
Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-03-26 20:58:03 +01:00
Ben Avison
b01a2562ae truehd: break out part of output_data into platform-specific callback.
Verified with profiling that this doesn't have a measurable effect upon
overall performance.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-03-26 20:56:38 +01:00
Ben Avison
3f4e73afe9 truehd: break out part of rematrix_channels into platform-specific callback.
Verified with profiling that this doesn't have a measurable effect upon
overall performance.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-03-26 20:41:48 +01:00
Ben Avison
b9eb03416d truehd: break out part of output_data into platform-specific callback.
Verified with profiling that this doesn't have a measurable effect upon
overall performance.

Signed-off-by: Martin Storsjö <martin@martin.st>
2014-03-26 19:54:29 +02:00
Ben Avison
fcf5fc4445 truehd: tune VLC decoding for ARM.
Profiling on a Raspberry Pi revealed the best performance to correspond
with VLC_BITS = 5. Results for overall audio decode and the get_vlc2 function
in particular are as follows:

              Before          After
              Mean   StdDev   Mean   StdDev  Confidence  Change
6:2 total     348.8  20.1     339.6  15.1    88.8%       +2.7%  (insignificant)
6:2 function  38.1   8.1      26.4   4.1     100.0%      +44.5%
8:2 total     339.1  15.4     324.5  15.5    99.4%       +4.5%
8:2 function  33.8   7.0      27.3   5.6     99.7%       +23.6%
6:6 total     604.6  20.8     572.8  20.6    100.0%      +5.6%
6:6 function  95.8   8.4      68.9   8.2     100.0%      +39.1%
8:8 total     766.4  17.6     741.5  21.2    100.0%      +3.4%
8:8 function  106.0  11.4     86.1   9.9     100.0%      +23.1%

Signed-off-by: Martin Storsjö <martin@martin.st>
2014-03-26 19:54:12 +02:00
Ben Avison
4e5aa080bb truehd: break out part of rematrix_channels into platform-specific callback.
Verified with profiling that this doesn't have a measurable effect upon
overall performance.

Signed-off-by: Martin Storsjö <martin@martin.st>
2014-03-26 19:54:05 +02:00
Ben Avison
e555e1bc39 truehd: tune VLC decoding for ARM.
Profiling on a Raspberry Pi revealed the best performance to correspond
with VLC_BITS = 5. Results for overall audio decode and the get_vlc2 function
in particular are as follows:

              Before          After
              Mean   StdDev   Mean   StdDev  Confidence  Change
6:2 total     348.8  20.1     339.6  15.1    88.8%       +2.7%  (insignificant)
6:2 function  38.1   8.1      26.4   4.1     100.0%      +44.5%
8:2 total     339.1  15.4     324.5  15.5    99.4%       +4.5%
8:2 function  33.8   7.0      27.3   5.6     99.7%       +23.6%
6:6 total     604.6  20.8     572.8  20.6    100.0%      +5.6%
6:6 function  95.8   8.4      68.9   8.2     100.0%      +39.1%
8:8 total     766.4  17.6     741.5  21.2    100.0%      +3.4%
8:8 function  106.0  11.4     86.1   9.9     100.0%      +23.1%

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-03-19 22:24:32 +01:00
Michael Niedermayer
f90a4bfc43 mlpdec: fix request_channel_layout behavior.
When request_channel_layout is 0,
all substreams should be decoded.

Signed-off-by: Tim Walker <tdskywalker@gmail.com>
2014-02-08 20:10:35 +01:00
Michael Niedermayer
1a8050ad61 avcodec/mlpdec: fix mulichannel output
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-02-08 18:08:01 +01:00
Michael Niedermayer
aedc10137d Merge commit 'c0c45188e56cfa3050bb39f8299025345b8a204c'
* commit 'c0c45188e56cfa3050bb39f8299025345b8a204c':
  mlp: improve request_channel_layout behavior.

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-02-08 17:31:30 +01:00
Tim Walker
c0c45188e5 mlp: improve request_channel_layout behavior.
Don't decode further substreams if request_channel_layout
is a subset of the current substream's channel_layout.

Before, we would only discard further substreams if
request_channel_layout matched the substream's
channel_layout extactly, thus decoding additional
channels which the caller would probably end up downmixing.
2014-02-08 13:39:37 +01:00
Michael Niedermayer
85b424a45e Merge commit 'e92123093dfdca0ef6608998240e2f9345d63bff'
* commit 'e92123093dfdca0ef6608998240e2f9345d63bff':
  mlpdec: set AV_FRAME_DATA_MATRIXENCODING side data.

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-01-05 23:00:22 +01:00
Michael Niedermayer
b4107f7805 Merge commit '4b7f1a7ced0e98f2cc698d896f7ebab8d30eaa09'
* commit '4b7f1a7ced0e98f2cc698d896f7ebab8d30eaa09':
  mlp: Parse TrueHD decoder channel modifiers and set the AVMatrixEncoding for each substream.

Conflicts:
	libavcodec/mlp_parser.h
	libavcodec/mlpdec.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-01-05 22:53:13 +01:00
Tim Walker
e92123093d mlpdec: set AV_FRAME_DATA_MATRIXENCODING side data. 2014-01-05 16:41:56 +01:00
Tim Walker
4b7f1a7ced mlp: Parse TrueHD decoder channel modifiers and set the AVMatrixEncoding for each substream. 2014-01-05 16:41:56 +01:00