1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
Index: apps/codecs/libcook/cook.h
===================================================================
--- apps/codecs/libcook/cook.h	(revision 21939)
+++ apps/codecs/libcook/cook.h	(working copy)
@@ -96,6 +96,6 @@

 int cook_decode_init(RMContext *rmctx, COOKContext *q);
 int cook_decode_frame(RMContext *rmctx,COOKContext *q,
-                      int16_t *outbuffer, int *data_size,
+                      int32_t *outbuffer, int *data_size,
                       const uint8_t *inbuffer, int buf_size);
 #endif /*_COOK_H */
Index: apps/codecs/libcook/cook_fixpoint.h
===================================================================
--- apps/codecs/libcook/cook_fixpoint.h	(revision 21939)
+++ apps/codecs/libcook/cook_fixpoint.h	(working copy)
@@ -332,12 +332,11 @@
  * @param out               pointer to the output buffer
  * @param chan              0: left or single channel, 1: right channel
  */
-static inline void output_math(COOKContext *q, int16_t *out, int chan)
+static inline void output_math(COOKContext *q, int32_t *out, int chan)
 {
     int j;

     for (j = 0; j < q->samples_per_channel; j++) {
-        out[chan + q->nb_channels * j] =
-          av_clip(fixp_pow2(q->mono_mdct_output[j], -11), -32768, 32767);
+        out[chan + q->nb_channels * j] = q->mono_mdct_output[j];
     }
 }
Index: apps/codecs/libcook/cook.c
===================================================================
--- apps/codecs/libcook/cook.c	(revision 21941)
+++ apps/codecs/libcook/cook.c	(working copy)
@@ -584,7 +584,7 @@
 static inline void
 mlt_compensate_output(COOKContext *q, REAL_T *decode_buffer,
                       cook_gains *gains, REAL_T *previous_buffer,
-                      int16_t *out, int chan)
+                      int32_t *out, int chan)
 {
     REAL_T *buffer = q->mono_mdct_output;
     int i;
@@ -620,7 +620,7 @@


 static int decode_subpacket(COOKContext *q, const uint8_t *inbuffer,
-                            int sub_packet_size, int16_t *outbuffer) {
+                            int sub_packet_size, int32_t *outbuffer) {
     /* packet dump */
 //    for (i=0 ; i<sub_packet_size ; i++) {
 //        DEBUGF("%02x", inbuffer[i]);
@@ -652,7 +652,7 @@
                                   q->mono_previous_buffer2, outbuffer, 1);
         }
     }
-    return q->samples_per_frame * sizeof(int16_t);
+    return q->samples_per_frame * sizeof(int32_t);
 }


@@ -663,7 +663,7 @@
  */

 int cook_decode_frame(RMContext *rmctx,COOKContext *q,
-            int16_t *outbuffer, int *data_size,
+            int32_t *outbuffer, int *data_size,
             const uint8_t *inbuffer, int buf_size) {
     //COOKContext *q = avctx->priv_data;
     //COOKContext *q;
Index: apps/codecs/cook.c
===================================================================
--- apps/codecs/cook.c	(revision 21941)
+++ apps/codecs/cook.c	(working copy)
@@ -31,6 +31,7 @@
 RMContext rmctx;
 RMPacket pkt;
 COOKContext q IBSS_ATTR;
+int32_t outbuf[2048];

 static void init_rm(RMContext *rmctx)
 {
@@ -43,7 +44,6 @@
     static size_t buff_size;
     int datasize, res, consumed, i, time_offset;
     uint8_t *bit_buffer;
-    int16_t outbuf[2048] __attribute__((aligned(32)));
     uint16_t fs,sps,h;
     uint32_t packet_count;
     int scrambling_unit_size, num_units;
@@ -64,7 +64,7 @@
     init_rm(&rmctx);

     ci->configure(DSP_SET_FREQUENCY, ci->id3->frequency);
-    ci->configure(DSP_SET_SAMPLE_DEPTH, 16);
+    ci->configure(DSP_SET_SAMPLE_DEPTH, 27);
     ci->configure(DSP_SET_STEREO_MODE, rmctx.nb_channels == 1 ?
                   STEREO_MONO : STEREO_INTERLEAVED);