aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/opus_celt.c
diff options
context:
space:
mode:
authorRostislav Pehlivanov <atomnuker@gmail.com>2017-07-18 20:47:30 +0100
committerRostislav Pehlivanov <atomnuker@gmail.com>2017-07-18 20:52:06 +0100
commit79450adfc80bb5d5d94deb1e1dd573b6cebfbe99 (patch)
tree272e4641323652a5750e2b36e03d25dc47c38b39 /libavcodec/opus_celt.c
parent9b937958907daaddade139c36ce33c6eac269631 (diff)
downloadffmpeg-79450adfc80bb5d5d94deb1e1dd573b6cebfbe99.tar.gz
opus: simplify coarse energy beta coefficients
Just put the subtraction in the table. Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
Diffstat (limited to 'libavcodec/opus_celt.c')
-rw-r--r--libavcodec/opus_celt.c26
1 files changed, 11 insertions, 15 deletions
diff --git a/libavcodec/opus_celt.c b/libavcodec/opus_celt.c
index 0177b123b1..84d484753b 100644
--- a/libavcodec/opus_celt.c
+++ b/libavcodec/opus_celt.c
@@ -29,25 +29,21 @@
#include "opustab.h"
#include "opus_pvq.h"
+/* Use the 2D z-transform to apply prediction in both the time domain (alpha)
+ * and the frequency domain (beta) */
static void celt_decode_coarse_energy(CeltFrame *f, OpusRangeCoder *rc)
{
int i, j;
- float prev[2] = {0};
- float alpha, beta;
- const uint8_t *model;
-
- /* use the 2D z-transform to apply prediction in both */
- /* the time domain (alpha) and the frequency domain (beta) */
-
- if (opus_rc_tell(rc)+3 <= f->framebits && ff_opus_rc_dec_log(rc, 3)) {
- /* intra frame */
- alpha = 0;
- beta = 1.0f - 4915.0f/32768.0f;
+ float prev[2] = { 0 };
+ float alpha = ff_celt_alpha_coef[f->size];
+ float beta = ff_celt_beta_coef[f->size];
+ const uint8_t *model = ff_celt_coarse_energy_dist[f->size][0];
+
+ /* intra frame */
+ if (opus_rc_tell(rc) + 3 <= f->framebits && ff_opus_rc_dec_log(rc, 3)) {
+ alpha = 0.0f;
+ beta = 1.0f - (4915.0f/32768.0f);
model = ff_celt_coarse_energy_dist[f->size][1];
- } else {
- alpha = ff_celt_alpha_coef[f->size];
- beta = 1.0f - ff_celt_beta_coef[f->size];
- model = ff_celt_coarse_energy_dist[f->size][0];
}
for (i = 0; i < CELT_MAX_BANDS; i++) {