avcodec/vorbisdec: Move ff_vorbis_inverse_coupling() to vorbisdsp.c

Only used there. Also make it static.

Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
pull/388/head
Andreas Rheinhardt 2 years ago
parent 5c15cb138e
commit 32129d6495
  1. 1
      libavcodec/vorbis.h
  2. 23
      libavcodec/vorbisdec.c
  3. 26
      libavcodec/vorbisdsp.c

@ -45,7 +45,6 @@ int ff_vorbis_len2vlc(uint8_t *bits, uint32_t *codes, unsigned num);
void ff_vorbis_floor1_render_list(vorbis_floor1_entry * list, int values,
uint16_t *y_list, int *flag,
int multiplier, float * out, int samples);
void ff_vorbis_inverse_coupling(float *mag, float *ang, ptrdiff_t blocksize);
#define ilog(i) av_log2(2*(i))

@ -1579,29 +1579,6 @@ static inline int vorbis_residue_decode(vorbis_context *vc, vorbis_residue *vr,
}
}
void ff_vorbis_inverse_coupling(float *mag, float *ang, ptrdiff_t blocksize)
{
for (ptrdiff_t i = 0; i < blocksize; i++) {
float angi = ang[i], magi = mag[i];
if (magi > 0.f) {
if (angi > 0.f) {
ang[i] = magi - angi;
} else {
ang[i] = magi;
mag[i] = magi + angi;
}
} else {
if (angi > 0.f) {
ang[i] = magi + angi;
} else {
ang[i] = magi;
mag[i] = magi - angi;
}
}
}
}
// Decode the audio packet using the functions above
static int vorbis_parse_audio_packet(vorbis_context *vc, float **floor_ptr)

@ -19,11 +19,33 @@
#include "config.h"
#include "libavutil/attributes.h"
#include "vorbisdsp.h"
#include "vorbis.h"
static void vorbis_inverse_coupling_c(float *mag, float *ang, ptrdiff_t blocksize)
{
for (ptrdiff_t i = 0; i < blocksize; i++) {
float angi = ang[i], magi = mag[i];
if (magi > 0.f) {
if (angi > 0.f) {
ang[i] = magi - angi;
} else {
ang[i] = magi;
mag[i] = magi + angi;
}
} else {
if (angi > 0.f) {
ang[i] = magi + angi;
} else {
ang[i] = magi;
mag[i] = magi - angi;
}
}
}
}
av_cold void ff_vorbisdsp_init(VorbisDSPContext *dsp)
{
dsp->vorbis_inverse_coupling = ff_vorbis_inverse_coupling;
dsp->vorbis_inverse_coupling = vorbis_inverse_coupling_c;
#if ARCH_AARCH64
ff_vorbisdsp_init_aarch64(dsp);

Loading…
Cancel
Save