1 #include "../libzmpeg3.h"
3 #define WRITE_SAMPLE(samples, sum) do { *(samples) = (sum); } while(0)
5 int zaudio_decoder_layer_t::
6 synth_stereo(float *bandPtr, int channel, float *out, int *pnt)
8 float *samples = out + *pnt;
10 float *b0, (*buf)[0x110];
16 buf = synth_stereo_buffs[0];
19 buf = synth_stereo_buffs[1];
24 dct64(buf[1] + ((bo + 1) & 0xf), buf[0] + bo, bandPtr);
29 dct64(buf[0] + bo, buf[1] + bo + 1, bandPtr);
32 //zmsgs("%f %f %f\n", buf[0][0], buf[1][0], bandPtr[0]);
34 float *window = decwin + 16 - bo1;
35 for( j=16; j > 0; --j, b0+=0x10, window+=0x20, ++samples ) {
36 sum = window[0x0] * b0[0x0];
37 sum -= window[0x1] * b0[0x1];
38 sum += window[0x2] * b0[0x2];
39 sum -= window[0x3] * b0[0x3];
40 sum += window[0x4] * b0[0x4];
41 sum -= window[0x5] * b0[0x5];
42 sum += window[0x6] * b0[0x6];
43 sum -= window[0x7] * b0[0x7];
44 sum += window[0x8] * b0[0x8];
45 sum -= window[0x9] * b0[0x9];
46 sum += window[0xA] * b0[0xA];
47 sum -= window[0xB] * b0[0xB];
48 sum += window[0xC] * b0[0xC];
49 sum -= window[0xD] * b0[0xD];
50 sum += window[0xE] * b0[0xE];
51 sum -= window[0xF] * b0[0xF];
52 WRITE_SAMPLE(samples, sum);
55 sum = window[0x0] * b0[0x0];
56 sum += window[0x2] * b0[0x2];
57 sum += window[0x4] * b0[0x4];
58 sum += window[0x6] * b0[0x6];
59 sum += window[0x8] * b0[0x8];
60 sum += window[0xA] * b0[0xA];
61 sum += window[0xC] * b0[0xC];
62 sum += window[0xE] * b0[0xE];
63 WRITE_SAMPLE(samples, sum);
69 for( j=15; j > 0; --j, b0-=0x10, window-=0x20, ++samples ) {
70 sum = -window[-0x1] * b0[0x0];
71 sum -= window[-0x2] * b0[0x1];
72 sum -= window[-0x3] * b0[0x2];
73 sum -= window[-0x4] * b0[0x3];
74 sum -= window[-0x5] * b0[0x4];
75 sum -= window[-0x6] * b0[0x5];
76 sum -= window[-0x7] * b0[0x6];
77 sum -= window[-0x8] * b0[0x7];
78 sum -= window[-0x9] * b0[0x8];
79 sum -= window[-0xA] * b0[0x9];
80 sum -= window[-0xB] * b0[0xA];
81 sum -= window[-0xC] * b0[0xB];
82 sum -= window[-0xD] * b0[0xC];
83 sum -= window[-0xE] * b0[0xD];
84 sum -= window[-0xF] * b0[0xE];
85 sum -= window[-0x0] * b0[0xF];
87 WRITE_SAMPLE(samples, sum);
96 /* Call this after every seek to reset the buffers */
97 int zaudio_decoder_layer_t::
101 for( i=0; i < 2; ++i ) {
102 for( j=0; j < 2; ++j ) {
103 for( k=0; k < 0x110; ++k ) {
104 synth_stereo_buffs[i][j][k] = 0;
108 for( i=0; i < 64; ++i ) {
109 synth_mono_buff[i] = 0;
110 layer2_scfsi_buf[i] = 0;
112 for( i=0; i < 2; ++i ) {
113 for( j=0; j < 2; ++j ) {
114 for( k=0; k < (int)(SBLIMIT*SSLIMIT); ++k ) {
115 mp3_block[i][j][k] = 0;