summaryrefslogtreecommitdiff
path: root/apps/codecs/libwmapro/wma.h
diff options
context:
space:
mode:
Diffstat (limited to 'apps/codecs/libwmapro/wma.h')
-rw-r--r--apps/codecs/libwmapro/wma.h88
1 files changed, 1 insertions, 87 deletions
diff --git a/apps/codecs/libwmapro/wma.h b/apps/codecs/libwmapro/wma.h
index d23b7ea02f..e4a1601515 100644
--- a/apps/codecs/libwmapro/wma.h
+++ b/apps/codecs/libwmapro/wma.h
@@ -24,8 +24,6 @@
24 24
25#include "get_bits.h" 25#include "get_bits.h"
26#include "put_bits.h" 26#include "put_bits.h"
27#include "dsputil.h"
28#include "fft.h"
29 27
30/* size of blocks */ 28/* size of blocks */
31#define BLOCK_MIN_BITS 7 29#define BLOCK_MIN_BITS 7
@@ -62,90 +60,6 @@ typedef struct CoefVLCTable {
62 const uint16_t *levels; ///< table to build run/level tables 60 const uint16_t *levels; ///< table to build run/level tables
63} CoefVLCTable; 61} CoefVLCTable;
64 62
65typedef struct WMACodecContext {
66 AVCodecContext* avctx;
67 GetBitContext gb;
68 PutBitContext pb;
69 int sample_rate;
70 int nb_channels;
71 int bit_rate;
72 int version; ///< 1 = 0x160 (WMAV1), 2 = 0x161 (WMAV2)
73 int block_align;
74 int use_bit_reservoir;
75 int use_variable_block_len;
76 int use_exp_vlc; ///< exponent coding: 0 = lsp, 1 = vlc + delta
77 int use_noise_coding; ///< true if perceptual noise is added
78 int byte_offset_bits;
79 VLC exp_vlc;
80 int exponent_sizes[BLOCK_NB_SIZES];
81 uint16_t exponent_bands[BLOCK_NB_SIZES][25];
82 int high_band_start[BLOCK_NB_SIZES]; ///< index of first coef in high band
83 int coefs_start; ///< first coded coef
84 int coefs_end[BLOCK_NB_SIZES]; ///< max number of coded coefficients
85 int exponent_high_sizes[BLOCK_NB_SIZES];
86 int exponent_high_bands[BLOCK_NB_SIZES][HIGH_BAND_MAX_SIZE];
87 VLC hgain_vlc;
88
89 /* coded values in high bands */
90 int high_band_coded[MAX_CHANNELS][HIGH_BAND_MAX_SIZE];
91 int high_band_values[MAX_CHANNELS][HIGH_BAND_MAX_SIZE];
92
93 /* there are two possible tables for spectral coefficients */
94//FIXME the following 3 tables should be shared between decoders
95 VLC coef_vlc[2];
96 uint16_t *run_table[2];
97 float *level_table[2];
98 uint16_t *int_table[2];
99 const CoefVLCTable *coef_vlcs[2];
100 /* frame info */
101 int frame_len; ///< frame length in samples
102 int frame_len_bits; ///< frame_len = 1 << frame_len_bits
103 int nb_block_sizes; ///< number of block sizes
104 /* block info */
105 int reset_block_lengths;
106 int block_len_bits; ///< log2 of current block length
107 int next_block_len_bits; ///< log2 of next block length
108 int prev_block_len_bits; ///< log2 of prev block length
109 int block_len; ///< block length in samples
110 int block_num; ///< block number in current frame
111 int block_pos; ///< current position in frame
112 uint8_t ms_stereo; ///< true if mid/side stereo mode
113 uint8_t channel_coded[MAX_CHANNELS]; ///< true if channel is coded
114 int exponents_bsize[MAX_CHANNELS]; ///< log2 ratio frame/exp. length
115 DECLARE_ALIGNED(16, float, exponents)[MAX_CHANNELS][BLOCK_MAX_SIZE];
116 float max_exponent[MAX_CHANNELS];
117 WMACoef coefs1[MAX_CHANNELS][BLOCK_MAX_SIZE];
118 DECLARE_ALIGNED(16, float, coefs)[MAX_CHANNELS][BLOCK_MAX_SIZE];
119 DECLARE_ALIGNED(16, FFTSample, output)[BLOCK_MAX_SIZE * 2];
120 FFTContext mdct_ctx[BLOCK_NB_SIZES];
121 float *windows[BLOCK_NB_SIZES];
122 /* output buffer for one frame and the last for IMDCT windowing */
123 DECLARE_ALIGNED(16, float, frame_out)[MAX_CHANNELS][BLOCK_MAX_SIZE * 2];
124 /* last frame info */
125 uint8_t last_superframe[MAX_CODED_SUPERFRAME_SIZE + 4]; /* padding added */
126 int last_bitoffset;
127 int last_superframe_len;
128 float noise_table[NOISE_TAB_SIZE];
129 int noise_index;
130 float noise_mult; /* XXX: suppress that and integrate it in the noise array */
131 /* lsp_to_curve tables */
132 float lsp_cos_table[BLOCK_MAX_SIZE];
133 float lsp_pow_e_table[256];
134 float lsp_pow_m_table1[(1 << LSP_POW_BITS)];
135 float lsp_pow_m_table2[(1 << LSP_POW_BITS)];
136 DSPContext dsp;
137
138#ifdef TRACE
139 int frame_count;
140#endif
141} WMACodecContext;
142
143extern const uint16_t ff_wma_critical_freqs[25];
144extern const uint16_t ff_wma_hgain_huffcodes[37];
145extern const uint8_t ff_wma_hgain_huffbits[37];
146extern const float ff_wma_lsp_codebook[NB_LSP_COEFS][16];
147extern const uint32_t ff_aac_scalefactor_code[121];
148extern const uint8_t ff_aac_scalefactor_bits[121];
149 63
150int av_cold ff_wma_get_frame_len_bits(int sample_rate, int version, 64int av_cold ff_wma_get_frame_len_bits(int sample_rate, int version,
151 unsigned int decode_flags); 65 unsigned int decode_flags);
@@ -153,7 +67,7 @@ int ff_wma_init(AVCodecContext * avctx, int flags2);
153int ff_wma_total_gain_to_bits(int total_gain); 67int ff_wma_total_gain_to_bits(int total_gain);
154int ff_wma_end(AVCodecContext *avctx); 68int ff_wma_end(AVCodecContext *avctx);
155unsigned int ff_wma_get_large_val(GetBitContext* gb); 69unsigned int ff_wma_get_large_val(GetBitContext* gb);
156int ff_wma_run_level_decode(AVCodecContext* avctx, GetBitContext* gb, 70int ff_wma_run_level_decode(GetBitContext* gb,
157 VLC *vlc, 71 VLC *vlc,
158 const int32_t *level_table, const uint16_t *run_table, 72 const int32_t *level_table, const uint16_t *run_table,
159 int version, int32_t *ptr, int offset, 73 int version, int32_t *ptr, int offset,