Commit Graph

46 Commits

Author SHA1 Message Date
Michael Niedermayer 33d1fb0627 avcodec/aacdec_fixed: Provide context to av_log()
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-01-01 21:11:47 +01:00
Michael Niedermayer 8f15248024 avcodec/aacdec_template: Allow duplicated elements
Such streams are invalid according to
4.5.2.1 Top level payloads for the audio object types AAC main, AAC SSR, AAC LC and AAC LTP
4.5.2.1.1 Definitions
...cIn the raw_data_block(), several instances of the
same syntactic element may occur, but must have a different 4 bit
element_instance_tag, except for data_stream_element()'s and
fill_element()'s.

Fixes: Ticket7477

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-10-12 00:53:14 +02:00
Michael Niedermayer 40c2f870ae avcodec/aacdec_template: Check for duplicate elements
Fixes: Timeout
Fixes: 9552/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_AAC_FIXED_fuzzer-6027842339995648

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-08-04 16:17:01 +02:00
Vittorio Giovara fbfee6adea aac: Rework extradata parsing code
- enable the parsing code
- use the new buffer instead of replacing the context one
- do not push/pop configuration, just discard the exiting one
- propagate errors correctly
2018-04-19 10:49:06 -04:00
Dale Curtis a246701e9a Parse and drop gain control data, so that SSR packets decode.
This will result in poor quality audio for SSR streams, but they
will at least demux and decode without error; partially fixing
ticket #1693.

This pulls in the decode_gain_control() function from the
ffmpeg summer-of-code repo (original author Maxim Gavrilov) at
svn://svn.mplayerhq.hu/soc/aac/aac.c with some minor modifications
and adds AOT_AAC_SSR to decode_audio_specific_config_gb().

Signed-off-by: Dale Curtis <dalecurtis@chromium.org>
Co-authored-by: Maxim Gavrilov <maxim.gavrilov@gmail.com>
2018-02-21 18:17:24 -08:00
Michael Niedermayer 33fe17bdc8 avcodec/aacdec_templat: Fix integer overflow in apply_ltp()
Fixes: signed integer overflow: -1625276744 + -1041893960 cannot be represented in type 'int'
Fixes: 5948/clusterfuzz-testcase-minimized-5791479856365568

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-02-20 15:27:51 +01:00
James Almer b9d3def9b2 Merge commit 'b5f19f7478492307e4b4763aeac3180faf50e17f'
* commit 'b5f19f7478492307e4b4763aeac3180faf50e17f':
  aac: Split function to parse ADTS header data into public and private part

Merged-by: James Almer <jamrial@gmail.com>
2017-10-30 18:56:45 -03:00
Michael Niedermayer dcf9bae4a9 avcodec/aacdec_template: Clear tns present flag on error
Fixes: 3444/clusterfuzz-testcase-minimized-6270352105668608

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-10-04 02:16:11 +02:00
Paul B Mahol dbc9a8f21f avcodec/aac: Add floating point 960/120 MDCT window
Co-Authored-By: Alex Converse <alex.converse@gmail.com>
Co-Authored-By: Rostislav Pehlivanov <atomnuker@gmail.com>
2017-08-24 17:42:07 -07:00
Michael Niedermayer 6f03ffb47d avcodec/aacdec_template: Fix running cleanup in decode_ics_info()
Fixes: out of array read
Fixes: 2873/clusterfuzz-testcase-minimized-5924145713905664

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg

Previous version reviewed-by: Alex Converse <alex.converse@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-08-22 20:01:31 +02:00
Nicolas Sugino df884e038f avcodec/aacdec: Fix PCE channel_layout verification
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-08-09 22:08:18 +02:00
Michael Niedermayer 2886142e0c avcodec/aacdec_template (fixed point): Check gain in decode_cce() to avoid undefined shifts later
Fixes: runtime error: shift exponent 47 is too large for 32-bit type 'int'
Fixes: 2581/clusterfuzz-testcase-minimized-4681474395602944

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-07-18 22:14:16 +02:00
Michael Niedermayer 0ef8f03133 avcodec/aacdec_template: Fix undefined integer overflow in apply_tns()
Fixes: runtime error: signed integer overflow: -2147483648 - 1202286525 cannot be represented in type 'int'
Fixes: 2071/clusterfuzz-testcase-minimized-6036414271586304

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-07-16 01:07:27 +02:00
Rostislav Pehlivanov c34ece57c7 aacdec_template: fix non-power-of-two MDCT scale sign
Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
2017-07-12 02:15:19 +01:00
Rostislav Pehlivanov aef5f9ab05 mdct15: remove redundant scale argument to imdct_half
The only use of that argument was for Opus downmixing which is very rare
and better done after the mdcts.

Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
2017-07-11 21:36:48 +01:00
Michael Niedermayer 2ccd2c9003 avcodec/aacsbr_fixed: Fix multiple runtime error: left shift of negative value -407
Fixes: 1674/clusterfuzz-testcase-minimized-6092531563495424
Fixes: 1686/clusterfuzz-testcase-minimized-6282691643179008

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-19 13:14:12 +02:00
Michael Niedermayer 53a502206a avcodec/aacdec_template: Fix fixed point scale in decode_cce()
Fixes: runtime error: shift exponent 1073741824 is too large for 32-bit type 'int'
Fixes: 1654/clusterfuzz-testcase-minimized-5151903795118080

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 16:17:56 +02:00
Michael Niedermayer ad2296ab3a avcodec/aacdec_fixed: Fix various integer overflows
Fixes: 1377/clusterfuzz-testcase-minimized-5487049807233024

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-11 13:02:12 +02:00
Michael Niedermayer a5e0dbf530 avcodec/aacdec_template: Do not decode 2nd PCE if it will lead to failure
Fixes: out of array read
Fixes: 1072/clusterfuzz-testcase-6456688074817536
Fixes: 1398/clusterfuzz-testcase-minimized-4576913622302720

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-07 19:32:33 +02: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
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
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
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 3f1a38c919 aac_latm: Allow unaligned AudioSpecificConfig
Fixes ticket 4730
2017-02-13 09:31:13 -08:00
Alex Converse 51a055b206 aacdec: Rename elem_type_prev to che_prev_type.
It describes the type of the previous che element (SCE, CPE, CCE, or
LFE) and does not reflect non-che elements.
2016-12-08 13:31:50 -08:00
Alex Converse d379592687 aacdec: Allow SBR after DRC.
Fixes https://www2.iis.fraunhofer.de/AAC/7.1auditionOutLeader_v2_rtb.mp4

Reported-by: rcombs on IRC
2016-12-08 13:31:50 -08:00
Carl Eugen Hoyos a8cb567e55 lavc: Remove CR/LF from avpriv_request_sample() calls. 2016-12-03 15:40:26 +01:00
Reimar Döffinger 7c93f2c0b9 Move cbrt tables to separate cbrt_data(_fixed).c files.
Allows sharing and reusing the data between different files.

Signed-off-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de>
2016-03-13 18:15:57 +01:00
Michael Niedermayer 590863876d avcodec/aacdec_template: Check id_map
Fixes index out of bounds error
Fixes: aac_index_out_of_bounds.wmv

Found-by: Piotr Bandurski <ami_stuff@o2.pl>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-01-10 19:31:39 +01:00
Hendrik Leppkes 5e8b053452 Merge commit '2c6811397bdf13d43ca206e48d6d6da9c2cd47c6'
* commit '2c6811397bdf13d43ca206e48d6d6da9c2cd47c6':
  lavc: add profiles to AVCodecDescriptor

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2016-01-01 16:20:39 +01:00
Rostislav Pehlivanov ec0719264c aac: temporarily un-share aac_table_init AVOnce variable
AAC-Fixed decoder segfaulted. This commit makes the aac encoder
and decoder init the table twice in case of transcoding again.

Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
2015-11-27 17:51:42 +00:00
Rostislav Pehlivanov 3d62e7a30f aacenc: make threadsafe
Since the ff_aac_tableinit() can be called by both the encoder and
the decoder (in case of transcoding) this commit shares the AVOnce
variable to prevent this.

Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
2015-11-27 14:52:35 +00:00
Andreas Cadhalpun d7f29bfa69 aacdec: don't return frames without data from aac_decode_er_frame
This is similar to commit ec38a1b for aac_decode_frame_int.

Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
2015-11-10 02:12:38 +00:00
Hendrik Leppkes 4da52e3630 aacdec: fix strict prototype warning
Function protoypes without arguments require a void argument in C,
instead of an empty list.
2015-10-21 14:28:08 +02:00
Derek Buitenhuis 1a29804558 aac: Make codec init run under ff_thread_once
This makes AAC init threadsafe.

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2015-10-15 13:48:55 -04:00
Michael Niedermayer 7f46a641bf avcodec/aacdec: Fix integer overflow in argument to decode_audio_specific_config()
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-08-03 01:41:13 +02:00
Emanuel Czirai 7ab1c57a64 libavcodec/aacdec_template: Use init_get_bits8() in aac_decode_frame()
related to ticket4749

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-08-03 01:18:33 +02:00
Nedeljko Babic 902bfa5b22 avcodec/aacdec_fixed: Fix preparation for resampler
2nd channel makes sense only for CPE type.

Skip 2nd channel in preparation for resampler (in spectral_to _sample())
depending on block type.

Fixes fate failure with clang ftrapv.

Signed-off-by: Nedeljko Babic <nedeljko.babic@imgtec.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-07-29 16:53:29 +02:00
Nedeljko Babic fee7c42bf4 avcodec/aac_fixed: Fix a bug in spectral_to_sample()
There was fixed number of loops (2048) in preparation for resampler, so
when number of samples is smaller than this, there would be an overflow on
ret_buf.

For some reason this behavior popped out only under valgrind with
--disable-memory-poisoning option.

This is now fixed and number of loops depends on actual number of samples.

Signed-off-by: Nedeljko Babic <nedeljko.babic@rt-rk.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-07-28 20:13:07 +02:00
Michael Niedermayer 29d147c94d Merge commit '059a934806d61f7af9ab3fd9f74994b838ea5eba'
* commit '059a934806d61f7af9ab3fd9f74994b838ea5eba':
  lavc: Consistently prefix input buffer defines

Conflicts:
	doc/examples/decoding_encoding.c
	libavcodec/4xm.c
	libavcodec/aac_adtstoasc_bsf.c
	libavcodec/aacdec.c
	libavcodec/aacenc.c
	libavcodec/ac3dec.h
	libavcodec/asvenc.c
	libavcodec/avcodec.h
	libavcodec/avpacket.c
	libavcodec/dvdec.c
	libavcodec/ffv1enc.c
	libavcodec/g2meet.c
	libavcodec/gif.c
	libavcodec/h264.c
	libavcodec/h264_mp4toannexb_bsf.c
	libavcodec/huffyuvdec.c
	libavcodec/huffyuvenc.c
	libavcodec/jpeglsenc.c
	libavcodec/libxvid.c
	libavcodec/mdec.c
	libavcodec/motionpixels.c
	libavcodec/mpeg4videodec.c
	libavcodec/mpegvideo.c
	libavcodec/noise_bsf.c
	libavcodec/nuv.c
	libavcodec/nvenc.c
	libavcodec/options.c
	libavcodec/parser.c
	libavcodec/pngenc.c
	libavcodec/proresenc_kostya.c
	libavcodec/qsvdec.c
	libavcodec/svq1enc.c
	libavcodec/tiffenc.c
	libavcodec/truemotion2.c
	libavcodec/utils.c
	libavcodec/utvideoenc.c
	libavcodec/vc1dec.c
	libavcodec/wmalosslessdec.c
	libavformat/adxdec.c
	libavformat/aiffdec.c
	libavformat/apc.c
	libavformat/apetag.c
	libavformat/avidec.c
	libavformat/bink.c
	libavformat/cafdec.c
	libavformat/flvdec.c
	libavformat/id3v2.c
	libavformat/isom.c
	libavformat/matroskadec.c
	libavformat/mov.c
	libavformat/mpc.c
	libavformat/mpc8.c
	libavformat/mpegts.c
	libavformat/mvi.c
	libavformat/mxfdec.c
	libavformat/mxg.c
	libavformat/nutdec.c
	libavformat/oggdec.c
	libavformat/oggparsecelt.c
	libavformat/oggparseflac.c
	libavformat/oggparseopus.c
	libavformat/oggparsespeex.c
	libavformat/omadec.c
	libavformat/rawdec.c
	libavformat/riffdec.c
	libavformat/rl2.c
	libavformat/rmdec.c
	libavformat/rtpdec_latm.c
	libavformat/rtpdec_mpeg4.c
	libavformat/rtpdec_qdm2.c
	libavformat/rtpdec_svq3.c
	libavformat/sierravmd.c
	libavformat/smacker.c
	libavformat/smush.c
	libavformat/spdifenc.c
	libavformat/takdec.c
	libavformat/tta.c
	libavformat/utils.c
	libavformat/vqf.c
	libavformat/westwood_vqa.c
	libavformat/xmv.c
	libavformat/xwma.c
	libavformat/yop.c

Merged-by: Michael Niedermayer <michael@niedermayer.cc>
2015-07-27 23:15:19 +02:00
Michael Niedermayer 94d68a41fa Merge commit '7c6eb0a1b7bf1aac7f033a7ec6d8cacc3b5c2615'
* commit '7c6eb0a1b7bf1aac7f033a7ec6d8cacc3b5c2615':
  lavc: AV-prefix all codec flags

Conflicts:
	doc/examples/muxing.c
	ffmpeg.c
	ffmpeg_opt.c
	ffplay.c
	libavcodec/aacdec.c
	libavcodec/aacenc.c
	libavcodec/ac3dec.c
	libavcodec/ac3enc_float.c
	libavcodec/atrac1.c
	libavcodec/atrac3.c
	libavcodec/atrac3plusdec.c
	libavcodec/dcadec.c
	libavcodec/ffv1enc.c
	libavcodec/h264.c
	libavcodec/h264_loopfilter.c
	libavcodec/h264_mb.c
	libavcodec/imc.c
	libavcodec/libmp3lame.c
	libavcodec/libtheoraenc.c
	libavcodec/libtwolame.c
	libavcodec/libvpxenc.c
	libavcodec/libxavs.c
	libavcodec/libxvid.c
	libavcodec/mpeg12dec.c
	libavcodec/mpeg12enc.c
	libavcodec/mpegaudiodec_template.c
	libavcodec/mpegvideo.c
	libavcodec/mpegvideo_enc.c
	libavcodec/mpegvideo_motion.c
	libavcodec/nellymoserdec.c
	libavcodec/nellymoserenc.c
	libavcodec/nvenc.c
	libavcodec/on2avc.c
	libavcodec/options_table.h
	libavcodec/opus_celt.c
	libavcodec/pngenc.c
	libavcodec/ra288.c
	libavcodec/ratecontrol.c
	libavcodec/twinvq.c
	libavcodec/vc1_block.c
	libavcodec/vc1_loopfilter.c
	libavcodec/vc1_mc.c
	libavcodec/vc1dec.c
	libavcodec/vorbisdec.c
	libavcodec/vp3.c
	libavcodec/wma.c
	libavcodec/wmaprodec.c
	libavcodec/x86/hpeldsp_init.c
	libavcodec/x86/me_cmp_init.c

Merged-by: Michael Niedermayer <michael@niedermayer.cc>
2015-07-27 22:10:35 +02:00
Michael Niedermayer f267d553f7 avcodec/aactab: Add ff_aac_eld_window_480_fixed
Fixes pointer type mismatch

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-07-25 13:59:53 +02:00
Djordje Pesut f85bc147fb avcodec: Implementation of AAC_fixed_decoder (SBR-module)
Add fixed poind code.

Signed-off-by: Nedeljko Babic <nedeljko.babic@imgtec.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-07-20 17:20:16 +02:00
Djordje Pesut b04f46cb4b libavcodec: Implementation of AAC_fixed_decoder (LC-module) [3/4]
Add fixed point implementation

Signed-off-by: Nedeljko Babic <nedeljko.babic@imgtec.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-07-09 14:41:31 +02:00
Jovan Zelincevic f497a9e84e libavcodec: Implementation of AAC_fixed_decoder (LC-module) [1/4]
Move existing code to the new template files

Signed-off-by: Nedeljko Babic <nedeljko.babic@imgtec.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-07-09 14:35:44 +02:00