Commit Graph

360 Commits

Author SHA1 Message Date
Tim Walker 9cd4bc4176 ac3dec: set AV_FRAME_DATA_DOWNMIX_INFO side data. 2014-02-15 22:25:00 +01:00
John Stebbins 23d461fe87 ac3dec: Allow asymmetric application of DRC when drc_scale > 1
Amplification of quiet sounds is enhanced.
Inspired by gbooker's A52Decoder.
2014-01-29 23:26:25 +01:00
Tim Walker ade75fb811 (e)ac3: clip surround mix level indexes.
Values 0-2 are reserved, 3 (-1.5dB) should be used instead.
2014-01-19 19:12:52 +01:00
Tim Walker c229f571fd (e)ac3: parse and store the Lt/Rt and LFE mix levels. 2014-01-19 19:12:42 +01:00
Tim Walker 1f604f96ea ac3: set default matrix encoding modes in parse_frame_header.
Deduplicates some code.
2014-01-19 19:12:33 +01:00
Tim Walker 7840c40445 (e)ac3dec: set AV_FRAME_DATA_MATRIXENCODING side data. 2014-01-05 16:41:56 +01:00
Tim Walker 13345fc1f8 (e)ac3: parse and store the Dolby Surround, Surround EX and Headphone mode flags. 2014-01-05 16:41:56 +01:00
John Stebbins c9ca220ef2 ac3dec: make drc_scale exponentially
The a52 spec suggests that "partial compression" should scale the
drc value in this manner.

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2013-12-09 08:54:42 +01:00
Tim Walker 48b24bd2d2 ac3dec: Fix out-of-array read
Signed-off-by: Diego Biurrun <diego@biurrun.de>
2013-11-23 21:36:49 +01:00
Tim Walker d4df02131b ac3dec: Remove write-only channel_layout field from AC3DecodeContext
Signed-off-by: Diego Biurrun <diego@biurrun.de>
2013-11-22 23:27:34 +01:00
Tim Walker b532854622 ac3: implement request_channel_layout.
Signed-off-by: Diego Biurrun <diego@biurrun.de>
2013-11-22 23:27:33 +01:00
Tim Walker ffb0af7f17 ac3dec: simplify an expression
Signed-off-by: Diego Biurrun <diego@biurrun.de>
2013-11-19 18:52:17 +01:00
Michael Niedermayer 6c82c87dbb ac3dec: fix outptr increment.
Fixes corrupt data errors when downmixing in the AC-3 decoder.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: Justin Ruggles <justin.ruggles@gmail.com>

CC:libav-stable@libav.org
2013-10-28 08:33:21 -04:00
Anton Khirnov 23a211cbba lavc: change all decoders to behave consistently with AV_EF_CRCCHECK.
Just crccheck prints a warning, crccheck+explode returns an error.

Also document this behavior.
2013-10-28 07:22:18 +01:00
Diego Biurrun b2bed9325d cosmetics: Group .name and .long_name together in codec/format declarations 2013-10-03 23:32:01 +02:00
Luca Barbato b1f9cdc37f ac3: Return proper error codes 2013-08-27 16:19:12 +02:00
Luca Barbato 818d1f1a3e ac3: Clean up the error paths 2013-08-27 16:19:12 +02:00
Christophe Gisquet b6293e2798 fmtconvert: Explicitly use int32_t instead of int
Signed-off-by: Martin Storsjö <martin@martin.st>
2013-07-17 11:02:47 +03:00
Martin Storsjö 8f24c12be7 ac3dec: Don't consume more data than the actual input packet size
This was handled properly in the normal return case at the end
of the function, but not in this special case.

Returning a value larger than the input packet size can cause
problems for certain library users.

Returning the actual input buffer size unconditionally, since
it is not guaranteed that frame_size is set to a sensible
value at this point.

Cc: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
2013-07-15 21:37:21 +03:00
Martin Storsjö 031be5b41b ac3dec: Consistently use AC3_BLOCK_SIZE and sizeof
Signed-off-by: Martin Storsjö <martin@martin.st>
2013-07-13 19:06:52 +03:00
Martin Storsjö 68e57cde68 ac3dec: Increment channel pointers only once per channel
If the channel mapping map multiple output channels to one
input channel, we should only increment the actual pointer once.

Cc: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
2013-07-13 18:55:07 +03:00
Diego Biurrun 12e25ed284 avcodec: av_log_missing_feature(1) ---> avpriv_request_sample() 2013-03-13 21:20:12 +01:00
Anton Khirnov 759001c534 lavc decoders: work with refcounted frames. 2013-03-08 07:38:30 +01:00
Justin Ruggles d7c450436f ac3dec: validate channel output mode against channel count
Damaged frames can lead to a mismatch, which can cause a segfault
due to using an incorrect channel mapping.

CC:libav-stable@libav.org
2013-02-23 16:59:39 -05:00
Justin Ruggles 55d2e12aef ac3: decode directly to the user-provided AVFrame 2013-02-12 12:21:21 -05:00
Mathias Rauen 04ea5491a8 ac3dec: fix non-optimal dithering of zero bit mantissas
Use a noise range of -0.707 to 0.707 instead of -0.5 to 0.5

Signed-off-by: Justin Ruggles <justin.ruggles@gmail.com>
2013-01-20 14:20:47 -05:00
Justin Ruggles e034cc6c60 lavc: Move vector_fmul_window to AVFloatDSPContext
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2013-01-16 10:45:45 +01:00
Diego Biurrun 511cf612ac miscellaneous typo fixes 2012-12-21 00:18:34 +01:00
Mans Rullgard ec5da7aee2 ac3dec: decode directly into output buffers
Signed-off-by: Mans Rullgard <mans@mansr.com>
2012-12-09 15:52:01 +00:00
Mans Rullgard 30b3916425 ac3dec: make downmix() take array of pointers to channel data 2012-12-09 15:52:01 +00:00
Mans Rullgard b8f3ab8e6a ac3dec: output planar float only
Signed-off-by: Mans Rullgard <mans@mansr.com>
2012-12-09 15:52:01 +00:00
Anton Khirnov 594d4d5df3 lavc: add a wrapper for AVCodecContext.get_buffer().
It will be useful in the upcoming transition to refcounted AVFrames.
2012-12-04 21:41:59 +01:00
Diego Biurrun 717addecad Use proper return values in case of missing features 2012-10-12 20:56:54 +02:00
Justin Ruggles 56b6a43056 ac3dec: ensure get_buffer() gets a buffer for the correct number of channels
If there is an error during frame parsing, but AVCodecContext.channels was
changed and AC3DecodeContext.out_channels was set previously, the two may not
match.

Fixes CVE-2012-2802
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind

CC: libav-stable@libav.org
2012-10-01 00:10:59 -04:00
Mans Rullgard 97cb9236cf ac3: move ac3_downmix() from dsputil to ac3dsp
Signed-off-by: Mans Rullgard <mans@mansr.com>
2012-09-12 23:39:50 +01:00
Martin Storsjö c7b610aa0b avopt: Explicitly store float/double option defaults in .dbl
Signed-off-by: Martin Storsjö <martin@martin.st>
2012-09-04 23:13:51 +03:00
Anton Khirnov 36ef5369ee Replace all CODEC_ID_* with AV_CODEC_ID_* 2012-08-07 16:00:24 +02:00
Diego Biurrun a92be9b856 Replace memset(0) by zero initializations.
Also remove one pointless zero initialization in rangecoder.c.
2012-03-28 09:38:33 +02:00
Justin Ruggles 3798205a77 mov: set channel layout for AC-3 streams based on the 'dac3' atom info
fixes Bug 225
2012-02-22 20:07:02 -05:00
Martin Storsjö 9cf0841ef3 dsputil: Add ff_ prefix to the dsputil*_init* functions
Signed-off-by: Martin Storsjö <martin@martin.st>
2012-02-15 22:06:34 +02:00
Michael Niedermayer e6d9fa66f1 ac3dec: Move center and surround mix level tables to the parser.
That way all mix levels as exported by avpriv_ac3_parse_header()
will have the same meaning.

Previously the 3-bit center mix level for E-AC-3 was used to index in a
4-entry table, leading to out-of-array reads.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: Justin Ruggles <justin.ruggles@gmail.com>
Signed-off-by: Alex Converse <alex.converse@gmail.com>
2012-02-09 16:36:02 -08:00
Anton Khirnov f326501a65 lavc: remove disabled FF_API_DRC_SCALE cruft. 2012-01-27 10:38:34 +01:00
Diego Biurrun 3dc99a18d4 cosmetics: drop some pointless parentheses 2012-01-07 22:13:07 +01:00
Chris Berov 541d083a40 ac3dec: cosmetics: pretty-printing
Signed-off-by: Justin Ruggles <justin.ruggles@gmail.com>
2011-12-04 16:15:48 -05:00
Justin Ruggles 0eea212943 Add avcodec_decode_audio4().
Deprecate avcodec_decode_audio3().
Implement audio support in avcodec_default_get_buffer().
Implement the new audio decoder API in all audio decoders.
2011-12-02 17:40:40 -05:00
Dustin Brody 9abc98737f lavc: replace references to deprecated AVCodecContext.error_recognition to use AVCodecContext.err_recognition
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2011-10-22 14:49:55 +02:00
Anton Khirnov 6f89efeaa7 lavc: use avpriv_ prefix for ff_ac3_parse_header.
It's used in lavf.
2011-10-20 21:06:58 +02:00
Anton Khirnov 145f741e11 AVOptions: rename FF_OPT_TYPE_* => AV_OPT_TYPE_* 2011-10-12 16:51:16 +02:00
Mans Rullgard 633ddb8519 ac3dec: use get_sbits() instead of manually sign-extending
Signed-off-by: Mans Rullgard <mans@mansr.com>
2011-10-09 23:21:31 +01:00
Anton Khirnov a4ea00d021 lavc/lavf: use unique private classes.
This is needed by the new AVOptions API.
2011-10-05 07:52:30 +02:00