Commit Graph

29 Commits

Author SHA1 Message Date
Andreas Rheinhardt e846617b82 avcodec/opus: Use prefix for defines
Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-10-08 10:19:30 +02:00
Andreas Rheinhardt 91e192c3a0 avcodec/opus: Move Silk declarations to a new header, opus_silk.h
Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-10-05 02:15:43 +02:00
Andreas Rheinhardt c095358289 avcodec/opus: Move defines to better places
Move ROUND_MUL* macros to their only users and the Celt
macros to opus_celt.h. Also improve the other headers
a bit while at it.

Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-10-05 02:15:43 +02:00
Andreas Rheinhardt 81b927a53b avcodec/opus: Move remaining celt declarations to opus_celt.h
Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-10-05 02:15:04 +02:00
Andreas Rheinhardt 4fc2531fff avcodec/opus: Move stuff shared by decoder and parser to a new file
opus.h (which is used by all the Opus code) currently includes
several structures only used by the parser and the decoder;
several elements of OpusContext are even only used by the decoder.

This commit therefore moves the part of OpusContext that is shared
between these two components (and used by ff_opus_parse_extradata())
out into a new structure and moves all the other accompanying
structures and functions to a new header, opus_parse.h; the
functions itself are also moved to a new file, opus_parse.c.
(This also allows to remove several spurious dependencies
of the Opus parser and encoder.)

Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-10-05 02:04:41 +02:00
Andreas Rheinhardt 6658028482 avcodec/opus: Move OpusStreamContext to its only user
Namely opusdec.c.

Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-10-05 02:02:41 +02:00
Anton Khirnov e15371061d lavu/mem: move the DECLARE_ALIGNED macro family to mem_internal on next+1 bump
They are not properly namespaced and not intended for public use.
2021-01-01 14:14:57 +01:00
Andreas Rheinhardt f03eade869 avcodec/opusdec: Move per-stream fields to OpusStreamContext
Besides being more natural it also avoids allocations for separate
arrays of decoded samples/output buffers/....

Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-12-31 23:23:03 +01:00
James Almer b74e13711f avcodec/opus: make redundancy_buf 32 byte aligned
Fixes ff_opus_deemphasis_fma3 segmentation fault crashes on x86_32.

Signed-off-by: James Almer <jamrial@gmail.com>
2019-04-02 11:36:56 -03:00
Rostislav Pehlivanov 51027d0b8b opus: merge encoder and decoder bitallocation functions into one
There's no difference apart from which entropy coding functions get called.

Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
2017-12-30 17:05:23 +00:00
Rostislav Pehlivanov ce87e630fa opus_celt: deduplicate band quantization/dequantization function
No point in having the same code twice to do exactly the same thing.

Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
2017-12-04 10:51:19 +00:00
Rostislav Pehlivanov 1b8649c2ce opus: add an option to toggle intensity stereo phase inversion
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>
2017-12-04 07:28:45 +00:00
Rostislav Pehlivanov 07b78340dd opus_celt: rename structures to better names and reorganize them
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>
2017-02-14 06:15:36 +00:00
Rostislav Pehlivanov e538108c21 opus_celt: move quantization and band decoding to opus_pvq.c
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>
2017-02-14 06:15:36 +00:00
Rostislav Pehlivanov 38a1315582 opus: remove redundant ff_celt_window2 declaration
Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
2016-12-18 07:11:27 +00:00
Rostislav Pehlivanov 317be31eaf opus: move the entropy decoding functions to opus_rc.c
The intention is to have both encoding and decoding functions
in opus_rc.c.

Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
2016-11-08 14:18:59 +00:00
Hendrik Leppkes 9f56aceaec Merge commit '14e558024642638085ae2bbeffc6087612e6a3f9'
* commit '14e558024642638085ae2bbeffc6087612e6a3f9':
  opusdec: properly handle mismatching configurations in multichannel streams

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2015-08-02 12:40:53 +02:00
Anton Khirnov 14e5580246 opusdec: properly handle mismatching configurations in multichannel streams
The substreams can have different resampling delays, so an additional
level of buffering is needed to synchronize them.

Bug-Id: 876
2015-08-02 08:43:51 +02:00
James Almer ba625dd8a1 avcodec: use av_mod_uintp2() where useful
Reviewed-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: James Almer <jamrial@gmail.com>
2015-04-21 22:41:20 -03:00
Kieran Kunhya 9cfa68c560 mpegts: add support for Opus
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2014-12-20 11:29:19 +01:00
Michael Niedermayer e316caf712 avcodec/opusdec: Use avpriv_float_dsp_alloc()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-03 14:52:38 +01:00
Kieran Kunhya 74141f693d avcodec: Add support for Opus in MPEG-TS
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-26 22:29:07 +01:00
Michael Niedermayer eb718f4c53 avcodec/opus: Fix () in ROUND_MULL() macro
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-05-25 19:25:58 +02:00
Michael Niedermayer 7a4424e5ed avcodec/opus: fix doxygen comments to be associated with the correct fields
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-05-15 22:41:52 +02:00
Michael Niedermayer 30cdf384d1 Merge commit 'd3f5b94762fb803c0f3b29f9ad6c5eaa813998ba'
* commit 'd3f5b94762fb803c0f3b29f9ad6c5eaa813998ba':
  aarch64: opus NEON iMDCT and FFT

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-05-15 21:13:53 +02:00
Michael Niedermayer ffa05e0802 avcodec/opusdec: switch to swresample
This also fixes linking failures in doc/examples which where apparently
caused by the linking order between avcodec and avresample

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-05-15 18:28:45 +02:00
Michael Niedermayer 2c7d3ecfc9 Merge commit 'b70d7a4ac72d23f3448f3b08b770fdf5f57de222'
* commit 'b70d7a4ac72d23f3448f3b08b770fdf5f57de222':
  lavc: add a native Opus decoder.

Conflicts:
	Changelog
	configure
	libavcodec/version.h

Fate tests pass with both avresample as well as swresample based opus decoder, but
are disabled (reference files are very large so i want to think a day or 2 about
if theres an alternative or if they could be avoided, they also dont match the
official samples)

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-05-15 18:20:17 +02:00
Janne Grunau d3f5b94762 aarch64: opus NEON iMDCT and FFT
Opus celt decoding 11% faster and the iMDCT over 2.5 times faster on
Apple's A7.
2014-05-15 18:17:02 +02:00
Anton Khirnov b70d7a4ac7 lavc: add a native Opus decoder.
Initial implementation by Andrew D'Addesio <modchipv12@gmail.com> during
GSoC 2012.

Completion by Anton Khirnov <anton@khirnov.net>, sponsored by the
Mozilla Corporation.

Further contributions by:
Christophe Gisquet <christophe.gisquet@gmail.com>
Janne Grunau <janne-libav@jannau.net>
Luca Barbato <lu_zero@gentoo.org>
2014-05-15 06:49:34 +02:00