Michael Niedermayer
38d18fb578
avcodec/lpc: Avoid floating point division by 0
...
Fixes: Ticket7996
Fixes: CVE-2020-20445
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years ago
Anton Khirnov
c8c2dfbc37
lavu: move LOCAL_ALIGNED from internal.h to mem_internal.h
...
That is a more appropriate place for it.
4 years ago
Jai Luthra
0c023d181e
lavc/lpc: Add min_shift parameter in LPC
...
The min_shift parameter is needed by the MLP encoder
Signed-off-by: Jai Luthra <me@jailuthra.in>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
8 years ago
Ganesh Ajjanagadde
66edd8656b
lavc/lpc: exploit even symmetry of window function
...
Yields 2x improvement in function performance, and boosts aac encoding
speed by ~ 4% overall. Sample benchmark (Haswell+GCC under -march=native):
after:
ffmpeg -i sin.flac -acodec aac -y sin_new.aac 5.22s user 0.03s system 105% cpu 4.970 total
before:
ffmpeg -i sin.flac -acodec aac -y sin_new.aac 5.40s user 0.05s system 105% cpu 5.162 total
Reviewed-by: Rostislav Pehlivanov <atomnuker@gmail.com>
Signed-off-by: Ganesh Ajjanagadde <gajjanag@gmail.com>
9 years ago
Rostislav Pehlivanov
0cfdaf45c4
lpc: correctly apply windowing to the samples in the float-only lpc
...
Also change the window to Hamming (using coefficient which make it
a Hanning).
Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
9 years ago
Rostislav Pehlivanov
7591f8319b
lpc: increase error array size of ff_lpc_calc_ref_coefs_f by one
...
Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
9 years ago
Rostislav Pehlivanov
0fc3a51353
lpc: add ff_lpc_calc_ref_coefs_f() function
...
This commit adds a function to get the reflection coefficients on
floating point samples. It's functionally identical to
ff_lpc_calc_ref_coefs() except it works on float samples and will
return the global prediction gain. The Welch window implementation
which is more optimized works only on int32_t samples so a slower
generic expression was used.
Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
9 years ago
Rostislav Pehlivanov
a70ee2bdcd
lpc: remove unused ff_lpc_calc_levinson() function
...
Not needed anymore, it was only used by the AAC TNS
encoder and was replaced with a more suitable function
in the following commit.
Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
9 years ago
Rostislav Pehlivanov
141d80ded7
lpc: rename ff_lpc_calc_levinsion to ff_lpc_calc_levinson
...
Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
9 years ago
Rostislav Pehlivanov
20962b567b
lpc: create a simplified Levinson-Durbin LPC handling float samples
...
This commit simply duplicates the functionality of ff_lpc_calc_coefs()
for the case of a Levinson-Durbin LPC with the only difference being
that floating point samples are accepted and the resulting coefficients
are raw and unquantized.
The motivation behind doing this is the fact that the AAC encoder
requires LPC in TNS and LTP and converting non-normalized floating
point coefficients to int32_t using SWR and again back for the LPC
coefficients was very impractical.
The current LPC interfaces were designed for int32_t in mind possibly
because FLAC and ALAC use this type for most internal operations.
The mathematics in case of floats remains of course identical.
Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
9 years ago
Michael Niedermayer
a3a61d4663
avcodec/lpc: Fix lpc_apply_welch_window_c() for odd len
...
Also removes assert
this fixes an assertion failure on non-x86
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
9 years ago
Reimar Döffinger
458aadf862
lpc: Reduce stack usage by allocating LLSModel in context.
...
Signed-off-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de>
10 years ago
Vittorio Giovara
60e0ee7ca2
lpc: always initialize ref and err
...
CC: libav-stable@libav.org
Bug-Id: CID 29585 / CID 700759
10 years ago
Michael Niedermayer
70b8668fb5
drop LLS1, rename LLS2 to LLS
...
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
10 years ago
Michael Niedermayer
c3814ab654
rename new lls code to lls2 to avoid conflict with the old which has a different ABI
...
also remove failed attempt at a compatibility layer, the code simply cannot work
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
11 years ago
Michael Niedermayer
bbe66ef912
avutil: rename lls to lls2
...
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
11 years ago
Michael Niedermayer
0dd99628ea
ff_lpc_calc_coefs: assert that the type is levinson or cholesky
...
Otherwise the code could misbehave (and there are no other types anyway)
Fixes CID700759
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
12 years ago
Loren Merritt
1221bb6239
x86: lpc: fix a segfault in av_evaluate_lls_sse2()
12 years ago
Michael Niedermayer
e27be795f0
avcodec/lpc: Use a function pointer from an initialized context
...
Fixes null pointer dereference
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
12 years ago
Loren Merritt
c93ccf5a4c
lpc: use levinson for the first pass of multipass cholesky
...
Levinson is faster, and cholesky is only needed if we want to apply different
weights to different samples, which doesn't happen on the first pass.
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
12 years ago
Loren Merritt
502ab21af0
x86: lpc: simd av_update_lls
...
4x-6x faster on sandybridge
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
12 years ago
Loren Merritt
41578f70cf
lpc: use function pointers, in preparation for asm
...
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
12 years ago
Loren Merritt
cc6714bb16
lpc: remove "decay" argument
...
We never used the rolling-average mode, and this makes av_update_lls 15% faster.
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
12 years ago
Luca Barbato
9d4da474f5
lls: move to the private namespace
...
The functions are private.
12 years ago
Martin Storsjö
8b25a20efb
lpc: Add a function for calculating reflection coefficients from samples
...
Signed-off-by: Martin Storsjö <martin@martin.st>
12 years ago
Michael Niedermayer
c4a36b6f70
lpc: check that lpc_type is valid in ff_lpc_calc_coefs
...
Fixes CID700759
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
12 years ago
Janne Grunau
f101eab1be
x86: call most of the x86 dsp init functions under if (ARCH_X86)
...
Rename the called dsp init functions to *_init_x86.
12 years ago
Justin Ruggles
4b0e0f31bf
lpc: fix alignment of windowed samples for odd maximum LPC order
...
Fixes crash on x86 due to alignment requirements for w_data in
lpc_apply_welch_window_sse2().
12 years ago
Martin Storsjö
1d9c2dc89a
Don't include common.h from avutil.h
...
Signed-off-by: Martin Storsjö <martin@martin.st>
12 years ago
Michael Niedermayer
894319e010
lpc: use default number of passes when lpc_passes is invalid
...
Should fix valgrind failure (uninitialized vars)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
13 years ago
Michael Niedermayer
b1a17953ec
lpc: use av_assert
...
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
13 years ago
Diego Biurrun
32f3c541bc
doxygen: Do not include license boilerplates in Doxygen comment blocks.
13 years ago
Diego Biurrun
c18365402b
Replace Subversion revisions in comments by Git hashes.
13 years ago
Diego Biurrun
96c1e6d40d
doxygen: Make sure parameter names match between .c and .h files.
14 years ago
Diego Biurrun
24c9babaaf
doxygen: Fix parameter names to match the function prototypes.
14 years ago
Anton Khirnov
188dea1dbf
lavc: move some flac-specific options to its private context.
14 years ago
Mans Rullgard
2912e87a6c
Replace FFmpeg with Libav in licence headers
...
Signed-off-by: Mans Rullgard <mans@mansr.com>
14 years ago
Justin Ruggles
384dbd617f
cosmetics related to LPC changes.
...
Signed-off-by: Mans Rullgard <mans@mansr.com>
(cherry picked from commit 1c189fc533
)
14 years ago
Justin Ruggles
7101b18508
Separate window function from autocorrelation.
...
Signed-off-by: Mans Rullgard <mans@mansr.com>
(cherry picked from commit 77a78e9bdc
)
14 years ago
Justin Ruggles
0d8837bdda
Move lpc_compute_autocorr() from DSPContext to a new struct LPCContext.
...
Signed-off-by: Mans Rullgard <mans@mansr.com>
(cherry picked from commit 56f8952b25
)
14 years ago
Justin Ruggles
1c189fc533
cosmetics related to LPC changes.
...
Signed-off-by: Mans Rullgard <mans@mansr.com>
14 years ago
Justin Ruggles
77a78e9bdc
Separate window function from autocorrelation.
...
Signed-off-by: Mans Rullgard <mans@mansr.com>
14 years ago
Justin Ruggles
56f8952b25
Move lpc_compute_autocorr() from DSPContext to a new struct LPCContext.
...
Signed-off-by: Mans Rullgard <mans@mansr.com>
14 years ago
Justin Ruggles
23940f1405
Add AVCodecContext.lpc_type and Add AVCodecContext.lpc_passes fields.
...
Add AVLPCType enum.
Deprecate AVCodecContext.use_lpc.
Originally committed as revision 24199 to svn://svn.ffmpeg.org/ffmpeg/trunk
15 years ago
Måns Rullgård
49bd8e4b84
Fix grammar errors in documentation
...
Originally committed as revision 23904 to svn://svn.ffmpeg.org/ffmpeg/trunk
15 years ago
Justin Ruggles
fde82ca7e4
Move autocorrelation function from flacenc.c to lpc.c. Also rename the
...
corresponding dsputil functions and remove their dependency on the FLAC
encoder.
Fixes Issue1486.
Originally committed as revision 20266 to svn://svn.ffmpeg.org/ffmpeg/trunk
15 years ago
Patrik Kullman
3cfe88194a
lpc: Remove false positive compilation warning about weight being
...
uninitialized. Patch by Patrik Kullman (patrik A yes D nu).
Originally committed as revision 17218 to svn://svn.ffmpeg.org/ffmpeg/trunk
16 years ago
Patrik Kullman
eabe8c7033
Assert that ff_lpc_calc_coefs() is called with a valid LPC method.
...
Patch by Patrik Kullman (patrik A yes D nu).
Originally committed as revision 17217 to svn://svn.ffmpeg.org/ffmpeg/trunk
16 years ago
Patrik Kullman
83f63ffb22
lpc: Document the use_lpc parameter to ff_lpc_calc_coefs().
...
Patch by Patrik Kullman (patrik A yes D nu).
Originally committed as revision 17216 to svn://svn.ffmpeg.org/ffmpeg/trunk
16 years ago
Vitor Sessak
1be0fc2909
Avoid duplicating compute_lpc_coefs() function in both the RA288 and AAC decoders.
...
Originally committed as revision 15193 to svn://svn.ffmpeg.org/ffmpeg/trunk
16 years ago