Commit Graph

37 Commits

Author SHA1 Message Date
Lynne 0cea3ca894 opusdsp: create and move deemphasis and postfiltering from opus_celt 2019-04-01 00:19:14 +02: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
Andrew D'Addesio fe05f93013 opus: Add Special Hybrid Folding (per RFC8251)
This decoder-side change, introduced in RFC 8251 (section 9), slightly
improves the decoded quality of 16kbps speech in Hybrid Mode.

Differences can be seen/heard in testvector05.bit, testvector06.bit,
and testvector12.bit in the RFC 6716/8251 testvectors found here:
https://people.xiph.org/~greg/opus_testvectors/

Signed-off-by: Andrew D'Addesio <modchipv12@gmail.com>
2017-12-04 07:28:45 +00:00
Andrew D'Addesio de052ea454 opus_celt: Fix arithmetic overflow (per RFC8251)
As per Sec.8 of RFC8251:
    Cap on Band Energy
    NaN due to large log-energy value. Affects celt_denormalize().

Signed-off-by: Andrew D'Addesio <modchipv12@gmail.com>
2017-12-04 07:28:45 +00:00
Rostislav Pehlivanov 79450adfc8 opus: simplify coarse energy beta coefficients
Just put the subtraction in the table.

Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
2017-07-18 20:52:06 +01:00
Rostislav Pehlivanov 594cd1f38a opus_celt: normalize using mdct scale
Removes a per-sample divide in the IIR filter deemphasis filter.

Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
2017-07-11 21:36:48 +01:00
Rostislav Pehlivanov aef5f9ab05 mdct15: remove redundant scale argument to imdct_half
The only use of that argument was for Opus downmixing which is very rare
and better done after the mdcts.

Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
2017-07-11 21:36:48 +01:00
Rostislav Pehlivanov ba67c2349c opus_celt: move postfilter taps table to the shared opustab.c file
Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
2017-07-10 23:49:44 +01:00
Rostislav Pehlivanov 7e98da9c4f opus_celt: do not use double precision exp2
Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
2017-06-22 22:37:53 +01:00
Rostislav Pehlivanov 8e7e74df93 opus_pvq: port to allow for SIMD functions
Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
2017-05-16 11:22:07 +01:00
Rostislav Pehlivanov 6d0b62a12b opus_celt: fix some style issues
Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
2017-04-08 00:27:33 +01: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 d2119f624d imdct15: rename to mdct15 and add a forward transform
Handles strides (needed for Opus transients), does pre-reindexing and folding
without needing a copy.

Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
2017-02-14 06:15:36 +00:00
Rostislav Pehlivanov 084f3addda opus_rc: rename total_bits_used to total_bits and #define some constants
Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
2017-02-04 12:07:52 +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
Rostislav Pehlivanov 0660a09dd1 opus: move all tables to a separate file
Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
2016-11-08 14:18:59 +00:00
Ganesh Ajjanagadde cea529dd7f lavc/opus_celt: replace pow(2,x) by exp2f(x)
Faster methods possible; since exponent is always a multiple of 1/8.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Ganesh Ajjanagadde <gajjanagadde@gmail.com>
2016-01-22 19:26:58 +05:30
Ganesh Ajjanagadde 97d2c2d678 lavc/opus_celt: replace pow by exp2
exp2 is faster.

It may be possible to optimize further; e.g the exponents seem to be
multiples of 0.25. This requires study though.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Ganesh Ajjanagadde <gajjanagadde@gmail.com>
2015-12-17 14:06:46 -08:00
Michael Niedermayer 94d68a41fa Merge commit '7c6eb0a1b7bf1aac7f033a7ec6d8cacc3b5c2615'
* commit '7c6eb0a1b7bf1aac7f033a7ec6d8cacc3b5c2615':
  lavc: AV-prefix all codec flags

Conflicts:
	doc/examples/muxing.c
	ffmpeg.c
	ffmpeg_opt.c
	ffplay.c
	libavcodec/aacdec.c
	libavcodec/aacenc.c
	libavcodec/ac3dec.c
	libavcodec/ac3enc_float.c
	libavcodec/atrac1.c
	libavcodec/atrac3.c
	libavcodec/atrac3plusdec.c
	libavcodec/dcadec.c
	libavcodec/ffv1enc.c
	libavcodec/h264.c
	libavcodec/h264_loopfilter.c
	libavcodec/h264_mb.c
	libavcodec/imc.c
	libavcodec/libmp3lame.c
	libavcodec/libtheoraenc.c
	libavcodec/libtwolame.c
	libavcodec/libvpxenc.c
	libavcodec/libxavs.c
	libavcodec/libxvid.c
	libavcodec/mpeg12dec.c
	libavcodec/mpeg12enc.c
	libavcodec/mpegaudiodec_template.c
	libavcodec/mpegvideo.c
	libavcodec/mpegvideo_enc.c
	libavcodec/mpegvideo_motion.c
	libavcodec/nellymoserdec.c
	libavcodec/nellymoserenc.c
	libavcodec/nvenc.c
	libavcodec/on2avc.c
	libavcodec/options_table.h
	libavcodec/opus_celt.c
	libavcodec/pngenc.c
	libavcodec/ra288.c
	libavcodec/ratecontrol.c
	libavcodec/twinvq.c
	libavcodec/vc1_block.c
	libavcodec/vc1_loopfilter.c
	libavcodec/vc1_mc.c
	libavcodec/vc1dec.c
	libavcodec/vorbisdec.c
	libavcodec/vp3.c
	libavcodec/wma.c
	libavcodec/wmaprodec.c
	libavcodec/x86/hpeldsp_init.c
	libavcodec/x86/me_cmp_init.c

Merged-by: Michael Niedermayer <michael@niedermayer.cc>
2015-07-27 22:10:35 +02:00
Vittorio Giovara 7c6eb0a1b7 lavc: AV-prefix all codec flags
Convert doxygen to multiline and express bitfields more simply.

Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2015-07-27 15:24:58 +01: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
Michael Niedermayer 66d79aa2e1 Merge commit '9abc80f1ed673141326341e26a05c3e1f78576d0'
* commit '9abc80f1ed673141326341e26a05c3e1f78576d0':
  libavcodec: Make use of av_clip functions

Conflicts:
	libavcodec/takdec.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-21 11:27:24 +01:00
Peter Meerwald 9abc80f1ed libavcodec: Make use of av_clip functions
Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2015-02-21 00:54:40 +01:00
Michael Niedermayer 7b32b35bf5 Merge commit '3d5d46233cd81f78138a6d7418d480af04d3f6c8'
* commit '3d5d46233cd81f78138a6d7418d480af04d3f6c8':
  opus: Factor out imdct15 into a standalone component

Conflicts:
	configure
	libavcodec/opus_celt.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-02 20:43:13 +01:00
Diego Biurrun 3d5d46233c opus: Factor out imdct15 into a standalone component
It will be reused by the AAC decoder.
2015-02-02 16:07:33 +01:00
Michael Niedermayer 00d4759134 avcodec/opus_celt: Use avpriv_float_dsp_alloc()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-01 20:03:23 +01:00
Michael Niedermayer fb33bff990 Merge commit 'f929ab0569ff31ed5a59b0b0adb7ce09df3fca39'
* commit 'f929ab0569ff31ed5a59b0b0adb7ce09df3fca39':
  cosmetics: Write NULL pointer equality checks more compactly

Conflicts:
	cmdutils.c
	ffmpeg_opt.c
	ffplay.c
	libavcodec/dvbsub.c
	libavcodec/dvdsubdec.c
	libavcodec/dvdsubenc.c
	libavcodec/dxa.c
	libavcodec/libxvid_rc.c
	libavcodec/mpegvideo.c
	libavcodec/mpegvideo_enc.c
	libavcodec/rv10.c
	libavcodec/tiffenc.c
	libavcodec/utils.c
	libavcodec/vc1dec.c
	libavcodec/zmbv.c
	libavdevice/v4l2.c
	libavformat/matroskadec.c
	libavformat/movenc.c
	libavformat/sdp.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-15 21:00:50 +02:00
Gabriel Dume f929ab0569 cosmetics: Write NULL pointer equality checks more compactly
Signed-off-by: Diego Biurrun <diego@biurrun.de>
2014-08-15 03:18:18 -07:00
Michael Niedermayer d62a4707f9 avcodec/opus_celt: Fix () in CELT_PVQ_V macro
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-05-25 19:25:29 +02:00
Carl Eugen Hoyos 30aeab29e4 Use av_restrict instead of restrict in libavcodec/opus_celt.c. 2014-05-16 00:43:54 +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 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