summaryrefslogtreecommitdiff
path: root/lib/rbcodec/codecs/libatrac/atrac3.h
diff options
context:
space:
mode:
Diffstat (limited to 'lib/rbcodec/codecs/libatrac/atrac3.h')
-rw-r--r--lib/rbcodec/codecs/libatrac/atrac3.h114
1 files changed, 114 insertions, 0 deletions
diff --git a/lib/rbcodec/codecs/libatrac/atrac3.h b/lib/rbcodec/codecs/libatrac/atrac3.h
new file mode 100644
index 0000000000..64086b6411
--- /dev/null
+++ b/lib/rbcodec/codecs/libatrac/atrac3.h
@@ -0,0 +1,114 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2009 Mohamed Tarek
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
16 *
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
19 *
20 ****************************************************************************/
21
22#include "ffmpeg_get_bits.h"
23#include "../librm/rm.h"
24#include "codeclib.h"
25
26#if (CONFIG_CPU == PP5022) || (CONFIG_CPU == PP5024) || \
27 (CONFIG_CPU == MCF5250) || defined(CPU_S5L870X)
28/* PP5022/24, MCF5250 and S5L870x have larger IRAM */
29#define IBSS_ATTR_LARGE_IRAM IBSS_ATTR
30#define ICODE_ATTR_LARGE_IRAM ICODE_ATTR
31#define ICONST_ATTR_LARGE_IRAM ICONST_ATTR
32#else
33/* other CPUs IRAM is not large enough */
34#define IBSS_ATTR_LARGE_IRAM
35#define ICODE_ATTR_LARGE_IRAM
36#define ICONST_ATTR_LARGE_IRAM
37#endif
38
39/* These structures are needed to store the parsed gain control data. */
40typedef struct {
41 int num_gain_data;
42 int levcode[8];
43 int loccode[8];
44} gain_info;
45
46typedef struct {
47 gain_info gBlock[4];
48} gain_block;
49
50typedef struct {
51 int pos;
52 int numCoefs;
53 int32_t coef[8];
54} tonal_component;
55
56typedef struct {
57 int bandsCoded;
58 int numComponents;
59 tonal_component components[64];
60 int32_t *prevFrame;
61 int gcBlkSwitch;
62 gain_block gainBlock[2];
63
64 int32_t *spectrum;
65 int32_t *IMDCT_buf;
66
67 int32_t delayBuf1[46] MEM_ALIGN_ATTR; ///<qmf delay buffers
68 int32_t delayBuf2[46] MEM_ALIGN_ATTR;
69 int32_t delayBuf3[46] MEM_ALIGN_ATTR;
70} channel_unit;
71
72typedef struct {
73 int32_t outSamples[2048] MEM_ALIGN_ATTR;
74 GetBitContext gb;
75 //@{
76 /** stream data */
77 int channels;
78 int codingMode;
79 int bit_rate;
80 int sample_rate;
81 int samples_per_channel;
82 int samples_per_frame;
83
84 int bits_per_frame;
85 int bytes_per_frame;
86 int pBs;
87 channel_unit* pUnits;
88 //@}
89 //@{
90 /** joint-stereo related variables */
91 int matrix_coeff_index_prev[4];
92 int matrix_coeff_index_now[4];
93 int matrix_coeff_index_next[4];
94 int weighting_delay[6];
95 //@}
96 //@{
97 /** data buffers */
98 uint8_t decoded_bytes_buffer[1024] MEM_ALIGN_ATTR;
99 int32_t tempBuf[1070] MEM_ALIGN_ATTR;
100 //@}
101 //@{
102 /** extradata */
103 int atrac3version;
104 int delay;
105 int scrambled_stream;
106 int frame_factor;
107 //@}
108} ATRAC3Context;
109
110int atrac3_decode_init(ATRAC3Context *q, struct mp3entry *id3);
111
112int atrac3_decode_frame(unsigned long block_align, ATRAC3Context *q,
113 int *data_size, const uint8_t *buf, int buf_size);
114