summaryrefslogtreecommitdiff
path: root/libavcodec/opus_pvq.c
Commit message (Collapse)AuthorAge
* opusenc: add apply_phase_inv optionLynne2020-05-26
| | | | | By popular request. Does the same as in libopusenc.
* celt_pvq_init: only build when CONFIG_OPUS_ENCODER is enabledLynne2019-03-31
| | | | The entire function was defined away before.
* x86/opus_dsp: rename to celt_pvqLynne2019-03-31
| | | | Its only used in the encoder and in CELT's PVQ.
* opus_pvq: do not compile encoding/decoding code if the encoder/decoder is ↵Rostislav Pehlivanov2017-12-04
| | | | | | | | | | disabled This should save quite a bit of space if either has been disabled for size reasons. Could just check if the encoding flag is set during runtime on every single location, however the overhead of branch misses would somewhat decrease performance. Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
* opus_celt: deduplicate band quantization/dequantization functionRostislav Pehlivanov2017-12-04
| | | | | | No point in having the same code twice to do exactly the same thing. Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
* opus: add an option to toggle intensity stereo phase inversionRostislav Pehlivanov2017-12-04
| | | | | | | | | Due to a somewhat high volume of complains, phase inversion has been made optional with RFC8251. This allows for better bass frequency response when partially downmixing to play on systems with an LFE speaker. Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
* opus_pvq: fix crashing on analysis of monoRostislav Pehlivanov2017-11-23
| | | | Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
* opus_pvq: make max_den a floatRostislav Pehlivanov2017-09-28
| | | | | | | | Prevents int->float conversions on every loop. Performance gain on synthetic benchmarks: 13%. Suggested by kamedo2. Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
* SIMD opus pvq_search implementationIvan Kalvachev2017-08-18
| | | | | | | | | | | | Explanation on the workings and methods used by the Pyramid Vector Quantization Search function could be found in the following Work-In-Progress mail threads: http://ffmpeg.org/pipermail/ffmpeg-devel/2017-June/212146.html http://ffmpeg.org/pipermail/ffmpeg-devel/2017-June/212816.html http://ffmpeg.org/pipermail/ffmpeg-devel/2017-July/213030.html http://ffmpeg.org/pipermail/ffmpeg-devel/2017-July/213436.html Signed-off-by: Ivan Kalvachev <ikalvachev@gmail.com>
* opus_pvq: port to allow for SIMD functionsRostislav Pehlivanov2017-05-16
| | | | Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
* opus_pvq: use function pointers for recursionRostislav Pehlivanov2017-04-27
| | | | Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
* avcodec/opus_pvq: fix recursive inlining compilation failuresJames Almer2017-04-27
| | | | They were introduced by f16180f44859587e0211170bd82b1bfd26f24b5a
* opus_pvq: merge band encoding and decoding into one functionRostislav Pehlivanov2017-04-27
| | | | | | | | | | | Most code between the 2 functions was duplicated which made keeping both in sync difficult. This also fixes some discovered issues with encoding (incorrect TF switching buffers) and reduces stack usage (reuse the already allocated CeltFrame->scratch buffer for the quantized coefficients). Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
* opus_pvq: remove outdated/incorrect comments and redundant variablesRostislav Pehlivanov2017-04-26
| | | | | | Removes the last style issues with opus_pvq.c Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
* opus_pvq: minor cleanupsRostislav Pehlivanov2017-04-26
| | | | | | | | Removes unneeded variables, renames confusing and innacurate variables and rewrites and slightly optimizes hadamard interleave/deinterleave functions. Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
* lavc/opus_pvq: Add missing copyright notices from libopus.Carl Eugen Hoyos2017-04-15
| | | | The file is based on libopus, analyzed by Rostislav Pehlivanov.
* opus_pvq: add resynth support and band encoding cost functionRostislav Pehlivanov2017-04-14
| | | | Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
* opus_pvq: prevent division by 0Rostislav Pehlivanov2017-02-24
| | | | | | | res was 0 and divided K which made it infinity which caused K to overflow. Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
* opus_pvq: remove unneeded assertRostislav Pehlivanov2017-02-24
| | | | | | | | | | Since the PVQ search has been well fuzzed and is guaranteed to never break SUM(abs(y[])) == K, the assert is no longer needed. Also the assert only prevented coding the wrong vector index but didn't prevent crashes during searching for it, which made the assert rather informational than practical. Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
* opus_pvq: improve PVQ search for low KsRostislav Pehlivanov2017-02-24
| | | | | | | | | Since the probelm mentioned only happened when the phase was negative (e.g. the sum had to be decreased), only discarding dimensions with a zero pulse in that case restored the search's previously low distortion at low Ks when the phase is never negative. Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
* opus_pvq: fix PVQ search for K < 5 and low NsRostislav Pehlivanov2017-02-19
| | | | | | | | | | | | | | | | If the PVQ search picked a place to increment/decrement on the y[] vector which had no pulse then it would cause a desync since it would change the sum in the wrong direction. Fix this by not considering places without pulses as viable. This makes the PVQ search slightly worse at K < 5 which isn't all that common. Still, this is a workaround to prevent making broken files until I can think of a better way of fixing it. Also add an assertion, which can be removed or moved to assert1/2 once the PVQ search is stable. Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
* opus_pvq: fix uninitialized variable usageRostislav Pehlivanov2017-02-15
| | | | | | Fixes CID1400586 Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
* opus: add a native Opus encoderRostislav Pehlivanov2017-02-14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This marks the first time anyone has written an Opus encoder without using any libopus code. The aim of the encoder is to prove how far the format can go by writing the craziest encoder for it. Right now the encoder's basic, it only supports CBR encoding, however internally every single feature the CELT layer has is implemented (except the pitch pre-filter which needs to work well with the rest of whatever gets implemented). Psychoacoustic and rate control systems are under development. The encoder takes in frames of 120 samples and depending on the value of opus_delay the plan is to use the extra buffered frames as lookahead. Right now the encoder will pick the nearest largest legal frame size and won't use the lookahead, but that'll change once there's a psychoacoustic system. Even though its a pretty basic encoder its already outperforming any other native encoder FFmpeg has by a huge amount. The PVQ search algorithm is faster and more accurate than libopus's algorithm so the encoder's performance is close to that of libopus at zero complexity (libopus has more SIMD). The algorithm might be ported to libopus or other codecs using PVQ in the future. The encoder still has a few minor bugs, like desyncs at ultra low bitrates (below 9kbps with 20ms frames). Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
* opus_celt: rename structures to better names and reorganize themRostislav Pehlivanov2017-02-14
| | | | | | | | | | | | | | | | | | | | This is meant to be applied on top of my previous patch which split PVQ into celt_pvq.c and made opus_celt.h Essentially nothing has been changed other than renaming CeltFrame to CeltBlock (CeltFrame had absolutely nothing at all to do with a frame) and CeltContext to CeltFrame. 3 variables have been put in CeltFrame as they make more sense there rather than being passed around as arguments. The coefficients have been moved to the CeltBlock structure (why the hell were they in CeltContext and not in CeltFrame??). Now the encoder would be able to use the exact context the decoder uses (plus a couple of extra fields in there). FATE passes, no slowdowns, etc. Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
* opus_celt: move quantization and band decoding to opus_pvq.cRostislav Pehlivanov2017-02-14
A huge amount can be reused by the encoder, as the only thing which needs to be done would be to add a 10 line celt_icwrsi, a wrapper around it (celt_alg_quant) and templating the ff_celt_decode_band to replace entropy decoding functions with entropy encoding. There is no performance loss but in fact a performance gain of around 6% which is caused by the compiler being able to optimize the decoding more efficiently. Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>