Browse Source

avcodec/binkaudio: Don't use static storage for context-dependent data

Move it to the context instead.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
tags/n4.4
Andreas Rheinhardt 5 years ago
parent
commit
2777bae7f2
1 changed files with 3 additions and 4 deletions
  1. +3
    -4
      libavcodec/binkaudio.c

+ 3
- 4
libavcodec/binkaudio.c View File

@@ -40,8 +40,6 @@
#include "rdft.h" #include "rdft.h"
#include "wma_freqs.h" #include "wma_freqs.h"


static float quant_table[96];

#define MAX_CHANNELS 2 #define MAX_CHANNELS 2
#define BINK_BLOCK_MAX_SIZE (MAX_CHANNELS << 11) #define BINK_BLOCK_MAX_SIZE (MAX_CHANNELS << 11)


@@ -58,6 +56,7 @@ typedef struct BinkAudioContext {
float root; float root;
DECLARE_ALIGNED(32, FFTSample, coeffs)[BINK_BLOCK_MAX_SIZE]; DECLARE_ALIGNED(32, FFTSample, coeffs)[BINK_BLOCK_MAX_SIZE];
float previous[MAX_CHANNELS][BINK_BLOCK_MAX_SIZE / 16]; ///< coeffs from previous audio block float previous[MAX_CHANNELS][BINK_BLOCK_MAX_SIZE / 16]; ///< coeffs from previous audio block
float quant_table[96];
AVPacket *pkt; AVPacket *pkt;
union { union {
RDFTContext rdft; RDFTContext rdft;
@@ -116,7 +115,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
s->root = s->frame_len / (sqrt(s->frame_len) * 32768.0); s->root = s->frame_len / (sqrt(s->frame_len) * 32768.0);
for (i = 0; i < 96; i++) { for (i = 0; i < 96; i++) {
/* constant is result of 0.066399999/log10(M_E) */ /* constant is result of 0.066399999/log10(M_E) */
quant_table[i] = expf(i * 0.15289164787221953823f) * s->root;
s->quant_table[i] = expf(i * 0.15289164787221953823f) * s->root;
} }


/* calculate number of bands */ /* calculate number of bands */
@@ -197,7 +196,7 @@ static int decode_block(BinkAudioContext *s, float **out, int use_dct)
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
for (i = 0; i < s->num_bands; i++) { for (i = 0; i < s->num_bands; i++) {
int value = get_bits(gb, 8); int value = get_bits(gb, 8);
quant[i] = quant_table[FFMIN(value, 95)];
quant[i] = s->quant_table[FFMIN(value, 95)];
} }


k = 0; k = 0;


Loading…
Cancel
Save