diff options
Diffstat (limited to 'apps/codecs/cook.c')
-rw-r--r-- | apps/codecs/cook.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/apps/codecs/cook.c b/apps/codecs/cook.c index 4214d30f38..30255d4fd7 100644 --- a/apps/codecs/cook.c +++ b/apps/codecs/cook.c | |||
@@ -31,6 +31,7 @@ CODEC_HEADER | |||
31 | RMContext rmctx; | 31 | RMContext rmctx; |
32 | RMPacket pkt; | 32 | RMPacket pkt; |
33 | COOKContext q IBSS_ATTR; | 33 | COOKContext q IBSS_ATTR; |
34 | int32_t rm_outbuf[2048]; | ||
34 | 35 | ||
35 | static void init_rm(RMContext *rmctx) | 36 | static void init_rm(RMContext *rmctx) |
36 | { | 37 | { |
@@ -43,7 +44,6 @@ enum codec_status codec_main(void) | |||
43 | static size_t buff_size; | 44 | static size_t buff_size; |
44 | int datasize, res, consumed, i, time_offset; | 45 | int datasize, res, consumed, i, time_offset; |
45 | uint8_t *bit_buffer; | 46 | uint8_t *bit_buffer; |
46 | int16_t outbuf[2048] __attribute__((aligned(32))); | ||
47 | uint16_t fs,sps,h; | 47 | uint16_t fs,sps,h; |
48 | uint32_t packet_count; | 48 | uint32_t packet_count; |
49 | int scrambling_unit_size, num_units; | 49 | int scrambling_unit_size, num_units; |
@@ -65,9 +65,11 @@ next_track: | |||
65 | init_rm(&rmctx); | 65 | init_rm(&rmctx); |
66 | 66 | ||
67 | ci->configure(DSP_SET_FREQUENCY, ci->id3->frequency); | 67 | ci->configure(DSP_SET_FREQUENCY, ci->id3->frequency); |
68 | ci->configure(DSP_SET_SAMPLE_DEPTH, 16); | 68 | /* cook's sample representation is 21.11 |
69 | * DSP_SET_SAMPLE_DEPTH = 11 (FRACT) + 16 (NATIVE) - 1 (SIGN) = 26 */ | ||
70 | ci->configure(DSP_SET_SAMPLE_DEPTH, 26); | ||
69 | ci->configure(DSP_SET_STEREO_MODE, rmctx.nb_channels == 1 ? | 71 | ci->configure(DSP_SET_STEREO_MODE, rmctx.nb_channels == 1 ? |
70 | STEREO_MONO : STEREO_INTERLEAVED); | 72 | STEREO_MONO : STEREO_NONINTERLEAVED); |
71 | 73 | ||
72 | packet_count = rmctx.nb_packets; | 74 | packet_count = rmctx.nb_packets; |
73 | rmctx.audio_framesize = rmctx.block_align; | 75 | rmctx.audio_framesize = rmctx.block_align; |
@@ -155,7 +157,7 @@ seek_start : | |||
155 | ci->set_elapsed(rmctx.audiotimestamp+(1000*8*sps/rmctx.bit_rate)*i); | 157 | ci->set_elapsed(rmctx.audiotimestamp+(1000*8*sps/rmctx.bit_rate)*i); |
156 | ci->seek_complete(); | 158 | ci->seek_complete(); |
157 | } | 159 | } |
158 | res = cook_decode_frame(&rmctx,&q, outbuf, &datasize, pkt.frames[i], rmctx.block_align); | 160 | res = cook_decode_frame(&rmctx,&q, rm_outbuf, &datasize, pkt.frames[i], rmctx.block_align); |
159 | rmctx.frame_number++; | 161 | rmctx.frame_number++; |
160 | 162 | ||
161 | /* skip the first two frames; no valid audio */ | 163 | /* skip the first two frames; no valid audio */ |
@@ -166,7 +168,9 @@ seek_start : | |||
166 | return CODEC_ERROR; | 168 | return CODEC_ERROR; |
167 | } | 169 | } |
168 | 170 | ||
169 | ci->pcmbuf_insert(outbuf, NULL, q.samples_per_frame / rmctx.nb_channels); | 171 | ci->pcmbuf_insert(rm_outbuf, |
172 | rm_outbuf+q.samples_per_channel, | ||
173 | q.samples_per_channel); | ||
170 | ci->set_elapsed(rmctx.audiotimestamp+(1000*8*sps/rmctx.bit_rate)*i); | 174 | ci->set_elapsed(rmctx.audiotimestamp+(1000*8*sps/rmctx.bit_rate)*i); |
171 | } | 175 | } |
172 | packet_count -= rmctx.audio_pkt_cnt; | 176 | packet_count -= rmctx.audio_pkt_cnt; |