Put decoder array into IRAM. Improves Coldfire (h300) performance 218MHz ->102.84...
[kugel-rb.git] / apps / codecs / libcook / cook.h
blob93abf9a52de0dc096ebfeda5a4228e6cf5cad512
1 /*
2 * COOK compatible decoder
3 * Copyright (c) 2003 Sascha Sommer
4 * Copyright (c) 2005 Benjamin Larsson
6 * This file is taken from FFmpeg.
8 * FFmpeg is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
13 * FFmpeg is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with FFmpeg; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22 #ifndef _COOK_H
23 #define _COOK_H
25 #include <inttypes.h>
26 #include "ffmpeg_bitstream.h"
27 #include "../librm/rm.h"
28 #include "cookdata_fixpoint.h"
30 typedef struct {
31 int *now;
32 int *previous;
33 } cook_gains;
35 typedef struct cook {
37 * The following 2 functions provide the lowlevel arithmetic on
38 * the internal audio buffers.
40 void (* scalar_dequant)(struct cook *q, int index, int quant_index,
41 int* subband_coef_index, int* subband_coef_sign,
42 REAL_T* mlt_p);
44 void (* interpolate) (struct cook *q, REAL_T* buffer,
45 int gain_index, int gain_index_next);
47 GetBitContext gb;
48 int frame_number;
49 int block_align;
50 int extradata_size;
51 /* stream data */
52 int nb_channels;
53 int joint_stereo;
54 int bit_rate;
55 int sample_rate;
56 int samples_per_channel;
57 int samples_per_frame;
58 int subbands;
59 int log2_numvector_size;
60 int numvector_size; //1 << log2_numvector_size;
61 int js_subband_start;
62 int total_subbands;
63 int num_vectors;
64 int bits_per_subpacket;
65 int cookversion;
66 int mdct_nbits; /* is this the same as one of above? */
67 /* states */
68 int random_state;
70 /* gain buffers */
71 cook_gains gains1;
72 cook_gains gains2;
73 int gain_1[9];
74 int gain_2[9];
75 int gain_3[9];
76 int gain_4[9];
78 /* VLC data */
79 int js_vlc_bits;
80 VLC envelope_quant_index[13];
81 VLC sqvh[7]; //scalar quantization
82 VLC ccpl; //channel coupling
84 /* generatable tables and related variables */
85 int gain_size_factor;
87 /* data buffers */
89 uint8_t decoded_bytes_buffer[1024];
90 REAL_T mono_mdct_output[2048] __attribute__ ((aligned(16)));
91 REAL_T mono_previous_buffer1[1024];
92 REAL_T mono_previous_buffer2[1024];
93 REAL_T decode_buffer_1[1024];
94 REAL_T decode_buffer_2[1024];
95 REAL_T decode_buffer_0[1060]; /* static allocation for joint decode */
96 } COOKContext;
98 int cook_decode_init(RMContext *rmctx, COOKContext *q);
99 int cook_decode_frame(RMContext *rmctx,COOKContext *q,
100 int32_t *outbuffer, int *data_size,
101 const uint8_t *inbuffer, int buf_size);
102 #endif /*_COOK_H */