Fix Ipod Video 64MB workaround for rockbox-info.txt detection.
[kugel-rb.git] / apps / codecs / libcook / cook.h
blob4fb7b1c0db92697781c6200b5e0234ae27100da4
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 /* states */
67 int random_state;
69 /* gain buffers */
70 cook_gains gains1;
71 cook_gains gains2;
72 int gain_1[9];
73 int gain_2[9];
74 int gain_3[9];
75 int gain_4[9];
77 /* VLC data */
78 int js_vlc_bits;
79 VLC envelope_quant_index[13];
80 VLC sqvh[7]; //scalar quantization
81 VLC ccpl; //channel coupling
83 /* generatable tables and related variables */
84 int gain_size_factor;
86 /* data buffers */
88 uint8_t decoded_bytes_buffer[1024];
89 REAL_T mono_mdct_output[2048] __attribute__ ((aligned(16)));
90 REAL_T mono_previous_buffer1[1024];
91 REAL_T mono_previous_buffer2[1024];
92 REAL_T decode_buffer_1[1024];
93 REAL_T decode_buffer_2[1024];
94 REAL_T decode_buffer_0[1060]; /* static allocation for joint decode */
95 } COOKContext;
97 int cook_decode_init(RMContext *rmctx, COOKContext *q);
98 int cook_decode_frame(RMContext *rmctx,COOKContext *q,
99 int16_t *outbuffer, int *data_size,
100 const uint8_t *inbuffer, int buf_size);
101 #endif /*_COOK_H */