Michael Niedermayer
c00f368caa
avcodec/ac3dec: use av_freep() for saftey
...
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
11 years ago
Michael Niedermayer
91b105ce5b
avcodec/ac3dec: avoid #if, use if() instead, its cleaner and shorter
...
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: Nedeljko Babic <nbabic@mips.com>
11 years ago
Michael Niedermayer
b219142921
avcodec/ac3: rename identifier used to select the fixed point variant
...
the CONFIG_ prefix is used by configure, using it for other things
is potentially confusing to the reader
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: Nedeljko Babic <nbabic@mips.com>
11 years ago
Nedeljko Babic
696e34a6e1
libavcodec: Implementation of AC3 fixedpoint decoder
...
Signed-off-by: Nedeljko Babic <nbabic@mips.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
11 years ago
Michael Niedermayer
eadc21cfe7
avcodec/ac3_parser: add avpriv_ac3_parse_header2() and use it in libavcodec
...
The new function has the ability to allocate the structure, allowing it to grow
without needing major bumps
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
11 years ago
Tim Walker
9cd4bc4176
ac3dec: set AV_FRAME_DATA_DOWNMIX_INFO side data.
11 years ago
John Stebbins
23d461fe87
ac3dec: Allow asymmetric application of DRC when drc_scale > 1
...
Amplification of quiet sounds is enhanced.
Inspired by gbooker's A52Decoder.
11 years ago
Tim Walker
ade75fb811
(e)ac3: clip surround mix level indexes.
...
Values 0-2 are reserved, 3 (-1.5dB) should be used instead.
11 years ago
Tim Walker
c229f571fd
(e)ac3: parse and store the Lt/Rt and LFE mix levels.
11 years ago
Tim Walker
1f604f96ea
ac3: set default matrix encoding modes in parse_frame_header.
...
Deduplicates some code.
11 years ago
Tim Walker
7840c40445
(e)ac3dec: set AV_FRAME_DATA_MATRIXENCODING side data.
11 years ago
Tim Walker
13345fc1f8
(e)ac3: parse and store the Dolby Surround, Surround EX and Headphone mode flags.
11 years ago
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>
11 years ago
Michael Niedermayer
4782c4284f
avcodec/ac3dec: check bap before use.
...
Fixes out of array read
Fixes assertion failure
Fixes asan_static-oob_16431c0_8036_rio_bravo_mono_64_spx.ac3
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
11 years ago
Tim Walker
48b24bd2d2
ac3dec: Fix out-of-array read
...
Signed-off-by: Diego Biurrun <diego@biurrun.de>
11 years ago
Michael Niedermayer
2cbf27b08a
libavcodec/ac3dec: fix channel_layout
...
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
11 years ago
Tim Walker
d4df02131b
ac3dec: Remove write-only channel_layout field from AC3DecodeContext
...
Signed-off-by: Diego Biurrun <diego@biurrun.de>
11 years ago
Tim Walker
b532854622
ac3: implement request_channel_layout.
...
Signed-off-by: Diego Biurrun <diego@biurrun.de>
11 years ago
Tim Walker
ffb0af7f17
ac3dec: simplify an expression
...
Signed-off-by: Diego Biurrun <diego@biurrun.de>
11 years ago
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
11 years ago
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.
11 years ago
Diego Biurrun
b2bed9325d
cosmetics: Group .name and .long_name together in codec/format declarations
11 years ago
Luca Barbato
b1f9cdc37f
ac3: Return proper error codes
11 years ago
Luca Barbato
818d1f1a3e
ac3: Clean up the error paths
11 years ago
Christophe Gisquet
b6293e2798
fmtconvert: Explicitly use int32_t instead of int
...
Signed-off-by: Martin Storsjö <martin@martin.st>
12 years ago
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>
12 years ago
Martin Storsjö
031be5b41b
ac3dec: Consistently use AC3_BLOCK_SIZE and sizeof
...
Signed-off-by: Martin Storsjö <martin@martin.st>
12 years ago
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>
12 years ago
Christophe Gisquet
f49564c607
fmtconvert: int32_t input to int32_to_float_fmul_scalar
...
It was previously declared as int.
Does not change fate results for x86.
Conflicts:
libavcodec/ppc/fmtconvert_altivec.c
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
12 years ago
Diego Biurrun
12e25ed284
avcodec: av_log_missing_feature(1) ---> avpriv_request_sample()
12 years ago
Clément Bœsch
1ec94b0f06
lavc: factorize ff_{thread_,re,}get_buffer error messages.
...
Coccinelle profile used:
@@
expression r, ctx, f, loglevel, str, flags;
@@
-if ((r = ff_get_buffer(ctx, f, flags)) < 0) {
- av_log(ctx, loglevel, str);
- return r;
-}
+if ((r = ff_get_buffer(ctx, f, flags)) < 0)
+ return r;
@@
expression r, ctx, f, loglevel, str;
@@
-if ((r = ff_reget_buffer(ctx, f)) < 0) {
- av_log(ctx, loglevel, str);
- return r;
-}
+if ((r = ff_reget_buffer(ctx, f)) < 0)
+ return r;
@@
expression r, ctx, f, loglevel, str, flags;
@@
-if ((r = ff_thread_get_buffer(ctx, f, flags)) < 0) {
- av_log(ctx, loglevel, str);
- return r;
-}
+if ((r = ff_thread_get_buffer(ctx, f, flags)) < 0)
+ return r;
...along with some manual patches for the remaining ones.
12 years ago
Anton Khirnov
759001c534
lavc decoders: work with refcounted frames.
12 years ago
Michael Niedermayer
e0f716a9d9
ac3dec: use AVFrame accessor functions
...
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
12 years ago
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
12 years ago
Justin Ruggles
55d2e12aef
ac3: decode directly to the user-provided AVFrame
12 years ago
Michael Niedermayer
fbdb0313f5
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
Based on patch by: Mathias Rauen <madshi@gmail.com> and commit by Justin Ruggles (04ea5491
)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
12 years ago
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>
12 years ago
Justin Ruggles
e034cc6c60
lavc: Move vector_fmul_window to AVFloatDSPContext
...
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
12 years ago
Michael Niedermayer
b888cea9cb
ac3dec: split out pointer update loop for saftey
...
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
12 years ago
Diego Biurrun
511cf612ac
miscellaneous typo fixes
12 years ago
Michael Niedermayer
d28dfa2d42
ac3dec: fix outptr increment.
...
Fixes decoding regression
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
12 years ago
Michael Niedermayer
2fb240ddb6
ac3dec: fix out of array read
...
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
12 years ago
Michael Niedermayer
7aabeea9ba
ac3dec: fix bugs in direct buffer use.
...
This fixes potentially exploitable out of array writes.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
12 years ago
Mans Rullgard
30b3916425
ac3dec: make downmix() take array of pointers to channel data
12 years ago
Mans Rullgard
b8f3ab8e6a
ac3dec: output planar float only
...
Signed-off-by: Mans Rullgard <mans@mansr.com>
12 years ago
Mans Rullgard
ec5da7aee2
ac3dec: decode directly into output buffers
...
Signed-off-by: Mans Rullgard <mans@mansr.com>
12 years ago
Anton Khirnov
594d4d5df3
lavc: add a wrapper for AVCodecContext.get_buffer().
...
It will be useful in the upcoming transition to refcounted AVFrames.
12 years ago
Diego Biurrun
717addecad
Use proper return values in case of missing features
12 years ago
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
12 years ago
Mans Rullgard
97cb9236cf
ac3: move ac3_downmix() from dsputil to ac3dsp
...
Signed-off-by: Mans Rullgard <mans@mansr.com>
12 years ago