Commit Graph

45 Commits

Author SHA1 Message Date
Andreas Rheinhardt 80eca6ec99 avcodec/aacps: Inline ff_ps_ctx_init()
Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-27 00:11:21 +01:00
Andreas Rheinhardt 4fe91e3676 avcodec/aacps: Move initializing common stuff to aacdec_common.c
ff_ps_init() initializes some tables for AAC parametric stereo
and some of them are only valid for the fixed- or floating-point
decoder, whereas others (namely VLCs) are valid for both.
The latter are therefore initialized by ff_ps_init_common()
and because the two versions of ff_ps_init() can be run
concurrently, it is guarded by an AVOnce.

Yet now that there is ff_aacdec_common_init_once() there is
a better way to do this: Call ff_ps_init_common()
from ff_aacdec_common_init_once(). That way there is no need
to guard ff_ps_init_common() by an AVOnce any more.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-31 21:44:48 +01:00
Andreas Rheinhardt 70b5d9c569 avcodec/aacps: Remove unused AVCodecContext* parameter from ff_ps_apply
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-31 20:47:00 +01:00
Andreas Rheinhardt ab97d163b6 avcodec/aacps: Fix length of array in function definition
hybrid2_re() has a parameter declared as "const INTFLOAT filter[8]",
although the actual argument for said parameter only has seven elements;
the code itself only uses seven elements, so change the parameter.

Fixes a -Wstringop-overread warning with GCC 11.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-08-08 17:44:57 +02:00
Anton Khirnov c8c2dfbc37 lavu: move LOCAL_ALIGNED from internal.h to mem_internal.h
That is a more appropriate place for it.
2021-01-01 14:11:01 +01:00
Andreas Rheinhardt 3693e2fcee avcodec/aacps: Factor out code shared by float and fixed point decoder
Saves about 7KiB.

Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-12-31 22:12:39 +01:00
Michael Niedermayer ec749ed222 avcodec/aacps: Fix integer overflows in hybrid_synthesis()
Fixes: signed integer overflow: -822667928 + -1399761199 cannot be represented in type 'int'
Fixes: 15756/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_AAC_FIXED_fuzzer-5645182051024896

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-09-11 22:43:14 +02:00
Michael Niedermayer 5d9a69167c avcodec/aacps: Return more specific error codes.
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 0764fe1d09 avcodec/aacps: Fix multiple integer overflow in map_val_34_to_20()
Fixes: avcodec/aacps.c:511:40: runtime error: signed integer overflow: 1509077651 + 758068176 cannot be represented in type 'int'
Fixes: 2678/clusterfuzz-testcase-minimized-4702787684270080

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-24 17:52:42 +02:00
Michael Niedermayer 80b9e40b6f avcodec/aacps (fixed point): Fix multiple signed integer overflows
Fixes: runtime error: signed integer overflow: 1421978265 - -1810326882 cannot be represented in type 'int'
Fixes: 2527/clusterfuzz-testcase-minimized-5260915396050944

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-12 04:20:21 +02:00
James Almer 623d217ed1 avcodec/aacps: move checks for valid length outside the stereo_interpolate dsp function
Signed-off-by: James Almer <jamrial@gmail.com>
2017-06-15 23:49:40 -03:00
Michael Niedermayer 9faf098163 avcodec/aacps: Fix runtime error: left shift of 1073741824 by 1 places cannot be represented in type 'INTFLOAT' (aka 'int')
Fixes: 2005/clusterfuzz-testcase-minimized-5744226438479872

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 00:09:58 +02:00
Michael Niedermayer fe8c9420dd avcodec/aacps: Check border_position to be monotone
Fixes: runtime error: left shift of negative value -67108864
Fixes: 1738/clusterfuzz-testcase-minimized-6734814327603200

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-28 03:07:02 +02:00
Michael Niedermayer 527f89e059 avcodec/aacps: Fix undefined behavior
Fixes: 1337/clusterfuzz-testcase-minimized-5212314171080704

Fixes the existence of a potentially invalid pointer intermediate

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-05 13:36:52 +02:00
Andreas Cadhalpun ef7fe9851e aacps: avoid division by zero in stereo_processing
This fixes a SIGFPE crash in the aac_fixed decoder.

Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
Reviewed-by: Rostislav Pehlivanov <atomnuker@gmail.com>
2015-11-10 01:33:24 +00:00
James Almer 9dcaae70f2 x86/aacpsdsp: add SSE and SSE3 optimized functions
Between 1.5 and 2.5 times faster

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: James Almer <jamrial@gmail.com>
2015-07-30 19:01:15 -03:00
Michael Niedermayer bbad3811cc avcodec/aacps: Fix ;;
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-07-25 14:07:55 +02:00
Djordje Pesut 5fd81cf6f0 avcodec: Implementation of AAC_fixed_decoder (PS-module)
Add fixed point implementation.

Signed-off-by: Nedeljko Babic <nedeljko.babic@imgtec.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-07-22 21:51:28 +02:00
Reimar Döffinger de6d44829c aacps.c: Move large arrays to context to reduce stack usage.
Signed-off-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de>
2014-12-18 23:50:41 +01:00
Michael Niedermayer 6433b393ba avcodec/aacps: fix number of bands used with ipd/opd
Fixes use of uninitialized memory
Fixes: msan_uninit-mem_7f861d16355f_1664_File1_fixed.aac
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-01-02 17:48:01 +01:00
Michael Niedermayer 9e22b8aca0 Merge remote-tracking branch 'qatar/master'
* qatar/master:
  aacps: Adjust some const qualifiers to suppress warnings

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-11-22 13:01:11 +01:00
Diego Biurrun 0ba8ba165b aacps: Adjust some const qualifiers to suppress warnings 2013-11-22 08:21:38 +01:00
Michael Niedermayer 66e9716a36 aacps: correct opdipd code to match spec
This fixes out of array reads

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-03-29 21:03:59 +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 991e23519a aacps: check iid/icc_par more completely.
Fixes global out of array read.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-11-30 22:23:49 +01:00
Michael Niedermayer 9f36ec6aa9 aacps: fix order of operands of ipdopd_reset().
With the current implementation this is purely cosmetic

Fixes CID732285
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-10-26 03:24:13 +02:00
Michael Niedermayer 0018aa9013 aacps: loose self assignment
Fixes CID604123
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-10-26 03:24:13 +02:00
Michael Niedermayer 715c8a5a50 Merge remote-tracking branch 'qatar/master'
* qatar/master: (28 commits)
  dfa: use more meaningful return codes
  eatgv: check vector_bits
  eatgv: check motion vectors
  Mark a number of variables only used in av_dlog() calls as av_unused.
  dvdec: drop const qualifier from variable to eliminate a warning
  avcodec: Improve comment for thread_safe_callbacks to avoid misinterpretation.
  tests/utils: don't ignore the return value of fwrite()
  lavfi/formats: use sizeof(var) instead of sizeof(type).
  lavfi: remove avfilter_default_config_input_link() declaration
  lavfi: always enable the scale filter and depend on sws.
  vf_split: support user-specifiable number of outputs.
  avconv: remove stray useless comment.
  mpegmux: add stuffing to avoid incomplete PCM frames
  rtsp: avoid const warnings from strtol() call
  avserver: check return value of ftruncate()
  lagarith: make offset array type unsigned
  dfa: add some checks to ensure that decoder won't write past frame end
  aacps: NEON optimisations
  aacps: align some arrays
  aacps: move some loops to function pointers
  ...

Conflicts:
	configure
	doc/filters.texi
	libavcodec/dfa.c
	libavcodec/eatgv.c
	libavfilter/Makefile
	libavfilter/allfilters.c
	libavfilter/avfilter.h
	libavfilter/formats.c
	libavfilter/vf_split.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-05-06 21:53:19 +02:00
Mans Rullgard 47d18d5354 aacps: align some arrays
This is required for SIMD optimisations.

Signed-off-by: Mans Rullgard <mans@mansr.com>
2012-05-05 22:04:21 +01:00
Mans Rullgard bf1945af30 aacps: move some loops to function pointers
Signed-off-by: Mans Rullgard <mans@mansr.com>
2012-05-05 22:04:21 +01:00
Michael Niedermayer f58f75dd92 Merge remote-tracking branch 'qatar/master'
* qatar/master:
  rv34: error out on size changes with frame threading
  aacsbr: Add a debug check to sbr_mapping.
  aac: Reset some state variables when turning SBR off
  aac: Reset PS parameters on header decode failure.
  fate: add wmalossless test.
  aacsbr: handle m_max values smaller than 4.

Conflicts:
	libavcodec/aacsbr.c
	tests/fate/lossless-audio.mak

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-03-24 10:59:43 +01:00
Alex Converse a237b38021 aac: Reset PS parameters on header decode failure.
If the next header frame codes zero envelopes the previous frame's
values will be used. Consequently the invalid values must be cleared.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
2012-03-23 14:56:44 -07:00
Michael Niedermayer dd3ca3ea15 Merge remote-tracking branch 'qatar/master'
* qatar/master:
  fate: Add tests for more AAC features.
  aacps: Add missing newline in error message.
  fate: Add tests for vc1/wmapro in ism.
  aacdec: Add a fate test for 5.1 channel SBR.
  aacdec: Turn off PS for multichannel files that use PCE based configs.
  cabac: remove put_cabac_u/ueg from cabac-test.
  swscale: RGB4444 and BGR444 input
  FATE: add test for xWMA demuxer.
  FATE: add test for SMJPEG demuxer and associated IMA ADPCM audio decoder.
  mpegaudiodec: optimized iMDCT transform
  mpegaudiodec: change imdct window arrangment for better pointer alignment
  mpegaudiodec: move imdct and windowing function to mpegaudiodsp
  mpegaudiodec: interleave iMDCT buffer to simplify future SIMD implementations
  swscale: convert yuy2/uyvy/nv12/nv21ToY/UV from inline asm to yasm.
  FATE: test to exercise WTV demuxer.
  mjpegdec: K&R formatting cosmetics
  swscale: K&R formatting cosmetics for code examples
  swscale: K&R reformatting cosmetics for header files
  FATE test: cvid-grayscale; ensures that the grayscale Cinepak variant is exercised.

Conflicts:
	libavcodec/cabac.c
	libavcodec/mjpegdec.c
	libavcodec/mpegaudiodec.c
	libavcodec/mpegaudiodsp.c
	libavcodec/mpegaudiodsp.h
	libavcodec/mpegaudiodsp_template.c
	libavcodec/x86/Makefile
	libavcodec/x86/imdct36_sse.asm
	libavcodec/x86/mpegaudiodec_mmx.c
	libswscale/swscale-test.c
	libswscale/swscale.c
	libswscale/swscale_internal.h
	libswscale/x86/swscale_template.c
	tests/fate/demux.mak
	tests/fate/microsoft.mak
	tests/fate/video.mak
	tests/fate/wma.mak
	tests/ref/lavfi/pixfmts_scale

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-01-10 03:50:41 +01:00
Alex Converse 9de3cbc182 aacps: Add missing newline in error message. 2012-01-09 11:06:14 -08:00
Michael Niedermayer 094a496818 Merge remote-tracking branch 'qatar/master'
* qatar/master:
  fifo: add FIFO API test program, and fate test
  fifo: add av_fifo_peek2(), and deprecate av_fifo_peek()
  postprocess.c: filter name needs to be double 0 terminated
  doxygen: fix wrong comment syntax, //< vs. ///<
  doxygen: drop pointless star from pointer variable names
  Replace deprecated av_find_stream_info() by avformat_find_stream_info().
  xmv: eliminate superfluous zeroing of zero data
  configure: fix typo in avconv dependency list

Conflicts:
	configure
	doc/APIchanges
	libavutil/Makefile
	libavutil/avutil.h

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2011-08-26 23:18:54 +02:00
Diego Biurrun 0249478756 doxygen: fix wrong comment syntax, //< vs. ///< 2011-08-26 18:34:28 +02:00
Michael Niedermayer 15285d8fc5 Merge remote-tracking branch 'qatar/master'
* qatar/master: (22 commits)
  arm: remove disabled function dct_unquantize_h263_inter_iwmmxt()
  Remove commented-out call to non-existing function print_pow1().
  Do not decode RV30 files if the extradata is too small
  flashsv: split flashsv_decode_block() off from flashsv_decode_frame().
  ppc: remove disabled code
  libspeexdec: Drop const qualifier to silence compiler warning.
  libopenjpeg: Drop const qualifier to silence compiler warning.
  alac: Remove unused dummy code.
  Remove unused structs and tables.
  vaapi: do not assert on value read from input bitstream
  flashsvenc: replace bitstream description by a link to the specification
  flashsvenc: drop unnecessary cast
  flashsvenc: improve some variable names and fix corresponding comments
  flashsvenc: merge two consecutive if-conditions
  flashsvenc: merge variable declarations and initializations
  flashsvenc: convert some debug av_log() to av_dlog()
  flashsvenc: whitespace cosmetics
  flashsvenc: drop some unnecessary parentheses
  flashsvenc: fix some comment typos
  aacps: skip some memcpy() if src and dst would be equal
  ...

Conflicts:
	libavcodec/vaapi_mpeg2.c
	libavformat/aviobuf.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2011-07-16 19:43:35 +02:00
Mans Rullgard e5902d60ce aacps: skip some memcpy() if src and dst would be equal
Signed-off-by: Mans Rullgard <mans@mansr.com>
2011-07-15 22:41:52 +01:00
Michael Niedermayer 5dc6bd86f0 Merge remote-tracking branch 'qatar/master'
* qatar/master:
  APIchanges: fill in missing hashes and dates.
  Add an APIChanges entry and bump minor versions for recent changes.
  ffmpeg: print the low bitrate warning after the codec is openend.
  doxygen: Move function documentation into the macro generating the function.
  doxygen: Make sure parameter names match between .c and .h files.
  h264: move fill_decode_neighbors()/fill_decode_caches() to h264_mvpred.h
  H.264: Add more x86 assembly for 10-bit H.264 predict functions
  lavf: fix invalid reads in avformat_find_stream_info()
  cmdutils: replace opt_default with opt_default2() and remove set_context_opts
  ffmpeg: use new avcodec_open2 and avformat_find_stream_info API.
  ffplay: use new avcodec_open2 and avformat_find_stream_info API.
  cmdutils: store all codec options in one dict instead of video/audio/sub
  ffmpeg: check experimental flag after codec is opened.
  ffmpeg: do not set GLOBAL_HEADER flag in the options context

Conflicts:
	cmdutils.c
	doc/APIchanges
	ffmpeg.c
	ffplay.c
	libavcodec/version.h
	libavformat/version.h
	libswscale/swscale_unscaled.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2011-07-14 20:44:58 +02:00
Diego Biurrun d0fcf39f0c doxygen: Move function documentation into the macro generating the function.
This fixes a bunch of related warnings where Doxygen assumed that the
documentation belonged to the macro and not the function.
2011-07-14 04:09:50 +02:00
Michael Niedermayer 976a8b2179 Merge remote-tracking branch 'qatar/master'
* qatar/master: (40 commits)
  H.264: template left MB handling
  H.264: faster fill_decode_caches
  H.264: faster write_back_*
  H.264: faster fill_filter_caches
  H.264: make filter_mb_fast support the case of unavailable top mb
  Do not include log.h in avutil.h
  Do not include pixfmt.h in avutil.h
  Do not include rational.h in avutil.h
  Do not include mathematics.h in avutil.h
  Do not include intfloat_readwrite.h in avutil.h
  Remove return statements following infinite loops without break
  RTSP: Doxygen comment cleanup
  doxygen: Escape '\' in Doxygen documentation.
  md5: cosmetics
  md5: use AV_WL32 to write result
  md5: add fate test
  md5: include correct headers
  md5: fix test program
  doxygen: Drop array size declarations from Doxygen parameter names.
  doxygen: Fix parameter names to match the function prototypes.
  ...

Conflicts:
	libavcodec/x86/dsputil_mmx.c
	libavformat/flvenc.c
	libavformat/oggenc.c
	libavformat/wtv.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2011-07-04 00:45:21 +02:00
Diego Biurrun 24c9babaaf doxygen: Fix parameter names to match the function prototypes. 2011-07-03 18:30:02 +02:00
Mans Rullgard 2912e87a6c Replace FFmpeg with Libav in licence headers
Signed-off-by: Mans Rullgard <mans@mansr.com>
2011-03-19 13:33:20 +00:00
Alex Converse fd6eb4a06c Move Parametric Stereo related ps* files to aacps*.
Originally committed as revision 23720 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-06-22 19:29:03 +00:00