Commit Graph

123 Commits

Author SHA1 Message Date
Michael Niedermayer
f6ba58d193 avcodec/aacsbr: Fix libavcodec/aacsbr.c:257:59: runtime error: division by zero
Fixes: 1882/clusterfuzz-testcase-minimized-5539735650959360

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Rostislav Pehlivanov <atomnuker@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-05-29 02:45:17 +02:00
Ganesh Ajjanagadde
def3c83e1b lavc/aacsbr: sbr_dequant optimization
This uses ff_exp2fi to get a speedup (~ 6x).

sample benchmark (Haswell, GNU/Linux):
old:
  19102 decicycles in sbr_dequant,    1023 runs,      1 skips
  19002 decicycles in sbr_dequant,    2045 runs,      3 skips
  17638 decicycles in sbr_dequant,    4093 runs,      3 skips
  15825 decicycles in sbr_dequant,    8189 runs,      3 skips
  16404 decicycles in sbr_dequant,   16379 runs,      5 skips

new:
   3063 decicycles in sbr_dequant,    1024 runs,      0 skips
   3049 decicycles in sbr_dequant,    2048 runs,      0 skips
   2968 decicycles in sbr_dequant,    4096 runs,      0 skips
   2818 decicycles in sbr_dequant,    8191 runs,      1 skips
   2853 decicycles in sbr_dequant,   16383 runs,      1 skips

Reviewed-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
Signed-off-by: Ganesh Ajjanagadde <gajjanagadde@gmail.com>
2015-12-19 09:32:53 -08:00
Michael Niedermayer
b78885a3c5 avcodec/aacsbr: Split the env_facs table
This also removes a #ifdef and special case for the fixed point case

Reviewed-by: Andreas Cadhalpun <andreas.cadhalpun@googlemail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-12-12 12:19:07 +01:00
Michael Niedermayer
58fba4b02f avcodec/aacsbr: Replace a noise_facs_q check by an av_assert0
The replaced check should have become redundant

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-11-19 13:52:05 +01:00
Michael Niedermayer
bfd0e02dd6 avcodec/aacsbr: Split pre dequantization noise factors table
This allows removing a special case for the fixed point decoder and will
make error checks simpler

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-11-19 13:12:20 +01: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
5499467d5d avcodec: Template creation for AAC decoder (SBR-module)
Move the existing code to a new template file.

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
Michael Niedermayer
2e13a45b1a avcodec/aacsbr: Assert that bs_num_env is positive
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-07-01 02:34:01 +02:00
Michael Niedermayer
79a98294da avcodec/aacsbr: check that the element type matches before applying SBR
Fixes out of array access
Fixes: signal_sigsegv_3670fc0_2818_cov_2307326154_moon.mux

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-07-01 02:33:45 +02:00
Andreas Cadhalpun
584cc1ade1 aacsbr: break infinite loop in sbr_hf_calc_npatches
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-07 17:32:23 +02:00
Michael Niedermayer
0b961423ee avcodec/aacsbr: Replace impossible condition by assert
bits can have a value of 0 or 1 they are never -1 or otherwise negative

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-17 22:55:59 +01:00
Michael Niedermayer
45f62c74dd Merge commit 'cdce9e8025fff1dee2fd3d6bc28aebc0a330c5a0'
* commit 'cdce9e8025fff1dee2fd3d6bc28aebc0a330c5a0':
  aacsbr: Fix type for index variable

See: a15adabdd3
Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-17 21:30:36 +01:00
Vittorio Giovara
cdce9e8025 aacsbr: Fix type for index variable
Prevents unsigned overflow and variable truncation.

Bug-Id: CID 603186
2015-03-17 13:34:23 +00:00
Reimar Döffinger
8c1ce7787a aacsbr: silence message for SBR extension "padding".
Some files contain a few additional, all-0 bits.
Check for that case and don't print incorrect "not supported"
message.

Signed-off-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de>
Signed-off-by: Alex Converse <alex.converse@gmail.com>
2015-02-03 20:32:16 -08:00
Michael Niedermayer
68b8e21b8b avcodec/aacdec: Use avpriv_float_dsp_alloc()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-02 19:32:45 +01:00
Michael Niedermayer
96398cc123 Merge commit '208f3abb917757743313da0da714e525e03159d2'
* commit '208f3abb917757743313da0da714e525e03159d2':
  aacsbr: always initialize max_qmf_subbands

See: c6d3b3be15
Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-11-24 13:48:31 +01:00
Vittorio Giovara
208f3abb91 aacsbr: always initialize max_qmf_subbands
Fixes a wordly warning from clang -Wsometimes-uninitialized.
2014-11-24 01:30:15 +00:00
Michael Niedermayer
df82125acb Merge commit '930ffd46e1e742674aa7cc1c2450020c63b5015b'
* commit '930ffd46e1e742674aa7cc1c2450020c63b5015b':
  aacsbr: change order of operation to prevent out of array read

Conflicts:
	libavcodec/aacsbr.c

See: c2340831b8
Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-11-04 22:04:04 +01:00
Michael Niedermayer
ce63cb4ff2 Merge commit '9f6f407463ff8b7681befd04b6655bb7c6d9b3e1'
* commit '9f6f407463ff8b7681befd04b6655bb7c6d9b3e1':
  aacsbr: treat 1-d arrays as such

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-11-04 21:53:21 +01:00
Michael Niedermayer
930ffd46e1 aacsbr: change order of operation to prevent out of array read
CC: libav-stable@libav.org
Bug-Id: CID 732250
2014-11-04 09:28:45 -05:00
Vittorio Giovara
9f6f407463 aacsbr: treat 1-d arrays as such
CC: libav-stable@libav.org
Bug-Id: CID 1238802 / CID 1238793 / CID 1238785
        CID 1238808 / CID 1238809
2014-11-03 12:46:18 -05:00
Reimar Döffinger
87c7fb2b21 aacsbr: support hardcoding tables.
For sbr_qmf_window_us there is even a question if it maybe
should be fully hardcoded all the time.
Since half of it is coded, it ends up in .data and not .bss.

Signed-off-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de>
2014-09-06 20:59:20 +02:00
Michael Niedermayer
a9a3afec1a Merge remote-tracking branch 'qatar/master'
* qatar/master:
  aacsbr: Add some const casts to silence warnings in ff_sbr_apply()

Conflicts:
	libavcodec/aacsbr.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-11-26 02:15:47 +01:00
Diego Biurrun
5145ccf02b aacsbr: Add some const casts to silence warnings in ff_sbr_apply() 2013-11-25 21:04:29 +01:00
Michael Niedermayer
405ceb1812 Merge remote-tracking branch 'qatar/master'
* qatar/master:
  aacdec: Set the profile during decoding

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-11-04 11:51:13 +01:00
Gian-Carlo Pascutto
454959a5aa aacdec: Set the profile during decoding
Previously the profile would not be set if the bitstream needs
to be decoded to know the profile.

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2013-11-04 08:51:26 +01:00
Michael Niedermayer
cacbf64a76 Merge remote-tracking branch 'qatar/master'
* qatar/master:
  avcodec: av_log_missing_feature(1) ---> avpriv_request_sample()

Conflicts:
	libavcodec/aacsbr.c
	libavcodec/amrnbdec.c
	libavcodec/takdec.c
	libavcodec/tta.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-03-14 13:07:25 +01:00
Michael Niedermayer
fa92ee821b Merge commit '63d744e2be39466e3a734c2987cd713e0bac101e'
* commit '63d744e2be39466e3a734c2987cd713e0bac101e':
  av_log_missing_feature() ---> avpriv_report_missing_feature()

Conflicts:
	libavcodec/aacdec.c
	libavcodec/tta.c
	libavformat/mpegts.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-03-14 12:30:19 +01:00
Diego Biurrun
12e25ed284 avcodec: av_log_missing_feature(1) ---> avpriv_request_sample() 2013-03-13 21:20:12 +01:00
Diego Biurrun
63d744e2be av_log_missing_feature() ---> avpriv_report_missing_feature() 2013-03-13 20:42:21 +01:00
Michael Niedermayer
eab49f4fb5 Revert "aacdec: Reconfigure output as needed, disable pop_output_configuration()"
This reverts commit 60dbf2eff9.

This is not needed anymore, Ticket 1694 has been fixed differently
2013-03-08 14:21:40 +01:00
Michael Niedermayer
8978c743fb aacsbr: Check for envelope scalefactors overflowing
This prevents various values from becoming stuck at NAN and
output to become silent
If someone knows a cleaner solution, thats welcome!

Fixes Ticket2335

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-03-08 14:21:40 +01:00
Michael Niedermayer
60dbf2eff9 aacdec: Reconfigure output as needed, disable pop_output_configuration()
Fixes Ticket1694

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-03-07 19:50:31 +01:00
Michael Niedermayer
c6d3b3be15 aacsbr: Silence warning: max_qmf_subbands may be used uninitialized in this function
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-02-26 16:36:29 +01:00
Mirjana Vulin
8d2eb5fe58 mips: optimization for float aac decoder (sbr module)
Signed-off-by: Mirjana Vulin <mvulin@mips.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-02-21 22:43:08 +01:00
Michael Niedermayer
6b2e65078c Merge commit '218aefce4472dc02ee3f12830a9a894bf7916da9'
* commit '218aefce4472dc02ee3f12830a9a894bf7916da9':
  dsputil: Move LOCAL_ALIGNED macros to libavutil

Conflicts:
	libavcodec/dvdec.c
	libavcodec/imc.c
	libavcodec/mpegvideo_motion.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-02-09 14:33:57 +01:00
Diego Biurrun
218aefce44 dsputil: Move LOCAL_ALIGNED macros to libavutil 2013-02-08 23:13:37 +01:00
Michael Niedermayer
6e6e170898 Merge commit '42d324694883cdf1fff1612ac70fa403692a1ad4'
* commit '42d324694883cdf1fff1612ac70fa403692a1ad4':
  floatdsp: move vector_fmul_reverse from dsputil to avfloatdsp.

Conflicts:
	libavcodec/arm/dsputil_init_vfp.c
	libavcodec/arm/dsputil_vfp.S
	libavcodec/dsputil.c
	libavcodec/ppc/float_altivec.c
	libavcodec/x86/dsputil.asm
	libavutil/x86/float_dsp.asm

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-01-23 14:04:50 +01:00
Michael Niedermayer
b1b870fbd7 Merge commit '55aa03b9f8f11ebb7535424cc0e5635558590f49'
* commit '55aa03b9f8f11ebb7535424cc0e5635558590f49':
  floatdsp: move vector_fmul_add from dsputil to avfloatdsp.

Conflicts:
	libavcodec/dsputil.c
	libavcodec/x86/dsputil.asm

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-01-23 13:54:34 +01:00
Ronald S. Bultje
42d3246948 floatdsp: move vector_fmul_reverse from dsputil to avfloatdsp.
Now, nellymoserenc and aacenc no longer depends on dsputil. Independent
of this patch, wmaprodec also does not depend on dsputil, so I removed
it from there also.
2013-01-22 11:55:42 -08:00
Ronald S. Bultje
55aa03b9f8 floatdsp: move vector_fmul_add from dsputil to avfloatdsp. 2013-01-22 11:55:42 -08:00
Michael Niedermayer
af164d7d9f Merge commit 'c25fc5c2bb6ae8c93541c9427df3e47206d95152'
* commit 'c25fc5c2bb6ae8c93541c9427df3e47206d95152':
  fate: dpcm: Add dependencies
  SBR DSP x86: implement SSE sbr_hf_gen
  AAC SBR: use AVFloatDSPContext's vector_fmul
  fate: image: Add dependencies
  Changelog: add an entry for deprecating the avconv -vol option
  x86: float_dsp: fix compilation of ff_vector_dmul_scalar_avx() on x86-32

Conflicts:
	Changelog
	libavutil/x86/float_dsp.asm
	tests/fate/image.mak

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-12-07 15:21:41 +01:00
Christophe Gisquet
9a16359c38 AAC SBR: use AVFloatDSPContext's vector_fmul
Around 5% speedup on the code block using 'vector_fmul_add's.

Signed-off-by: Diego Biurrun <diego@biurrun.de>
2012-12-07 10:33:39 +01:00
Michael Niedermayer
211372e86d Merge commit '0b300daad2f5cb59a7c06dde5ac701685e6edf16'
* commit '0b300daad2f5cb59a7c06dde5ac701685e6edf16':
  h264: error out on unset current_picture_ptr for h->current_slice > 0
  avprobe: report per stream bit rate if set by the decoder
  aac: avoid a memcpy in sbr_qmf_analysis

Conflicts:
	avprobe.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-12-03 01:56:47 +01:00
Christophe Gisquet
e32bea8eb4 aac: avoid a memcpy in sbr_qmf_analysis
Swapping buffer indices allows saving one memcpy that accounts for 1% of the
runtime, according to oprofile.

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2012-12-02 21:07:48 +01:00
Michael Niedermayer
59b68ee887 Merge commit '3d3cf6745e2a5dc9c377244454c3186d75b177fa'
* commit '3d3cf6745e2a5dc9c377244454c3186d75b177fa':
  aacdec: use float planar sample format for output

Conflicts:
	libavcodec/aacdec.c
	libavcodec/aacsbr.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-11-26 15:15:02 +01:00
Justin Ruggles
3d3cf6745e aacdec: use float planar sample format for output 2012-11-25 19:06:36 -05:00
Michael Niedermayer
cf5f4c5169 aacsbr: check sample_rate before using it, fix division by 0
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-11-20 04:04:30 +01:00
Michael Niedermayer
a15adabdd3 aacsbr: fix integer overflow
Fixes CID603186
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-11-04 17:37:28 +01:00
Michael Niedermayer
35ce42e070 Merge commit '8b8899ac3233b4f7af83ded0dc032fad8902d714'
* commit '8b8899ac3233b4f7af83ded0dc032fad8902d714':
  fate: Declare avcodec/avformat deps in the respective Makefile snippets
  fate: Add dependencies for WMA and WavPack tests
  Improve wording and spelling of av_log_missing_feature messages.
  lavu: remove disabled FF_API_AV_FIFO_PEEK cruft

Conflicts:
	libavcodec/aacsbr.c
	libavutil/version.h

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-10-23 15:00:27 +02:00