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
26 #include "ffmpeg_bitstream.h"
27 #include "../librm/rm.h"
28 #include "cookdata_fixpoint.h"
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
,
44 void (* interpolate
) (struct cook
*q
, REAL_T
* buffer
,
45 int gain_index
, int gain_index_next
);
56 int samples_per_channel
;
57 int samples_per_frame
;
59 int log2_numvector_size
;
60 int numvector_size
; //1 << log2_numvector_size;
64 int bits_per_subpacket
;
79 VLC envelope_quant_index
[13];
80 VLC sqvh
[7]; //scalar quantization
81 VLC ccpl
; //channel coupling
83 /* generatable tables and related variables */
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 */
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
);