~ubuntu-branches/ubuntu/karmic/gst-fluendo-mp3/karmic

« back to all changes in this revision

Viewing changes to decoder/mp3-c-synth.c

  • Committer: Bazaar Package Importer
  • Author(s): Sebastian Dröge
  • Date: 2008-02-25 11:49:03 UTC
  • mfrom: (1.1.5 upstream) (0.1.3 lenny)
  • Revision ID: james.westby@ubuntu.com-20080225114903-dmqnargae6u58b3k
Tags: 0.10.7.debian-1
* New upstream release:
  + debian/patches/01_small-mp3-frames.patch:
    - Dropped, merged upstream.
* debian/control:
  + Require gstreamer >= 0.10.14. It's not explicitely required upstream
    but having it enables some more features.

Show diffs side-by-side

added added

removed removed

Lines of Context:
54
54
  gint buf_offset;
55
55
  gfloat u_vec[HAN_SIZE];
56
56
  gfloat *cur_synbuf;
 
57
  gfloat *u_vec0; 
57
58
 
58
59
  buf_offset = fr_ps->bufOffset[channel];
59
60
  cur_synbuf = fr_ps->synbuf[channel];
61
62
  /* Shift down 64 samples in the fifo, which should always leave room */
62
63
  /* The maximum size of the synth buf is ((2 * HAN_SIZE) - 1) = 1023 */
63
64
  buf_offset = (buf_offset - 64) & 1023;
64
 
  g_assert (buf_offset <= (2 * HAN_SIZE) - 64);
 
65
  /* g_assert (buf_offset <= (2 * HAN_SIZE) - 64); */
65
66
 
66
67
  III_polyphase_matrix (polyPhaseIn, cur_synbuf + buf_offset); 
67
68
  
68
69
  /* Build the U vector and perform dewindowing */
 
70
#if 1
69
71
  for (i = 0; i < HAN_SIZE; i += 64) {
70
72
    gint k = i * 2;
71
73
    for (j = 0; j < SBLIMIT; j++) {
73
75
      u_vec[i + j + 32] = cur_synbuf[(buf_offset + k + j + 96) & 1023];
74
76
    }
75
77
  }
 
78
#else
 
79
  {
 
80
  gint cur_offset;
 
81
  for (i = 0; i < (1024 - buf_offset - 96 - 32) / 2; i += 64) {
 
82
    cur_offset = buf_offset + i + i;
 
83
    u_vec0 = u_vec + i;
 
84
    for (j = 0; j < SBLIMIT; j++) {
 
85
      u_vec0[j] = cur_synbuf[cur_offset + j];
 
86
      u_vec0[j + 32] = cur_synbuf[cur_offset + j + 96];
 
87
    }
 
88
  }
 
89
  for (; i < (1024 - buf_offset - 32) / 2; i += 64) {
 
90
    cur_offset = buf_offset + i + i;
 
91
    u_vec0 = u_vec + i;
 
92
    for (j = 0; j < SBLIMIT; j++) {
 
93
      u_vec0[j] = cur_synbuf[(cur_offset + j) & 1023];
 
94
      u_vec0[j + 32] = cur_synbuf[(cur_offset + j + 96) & 1023];
 
95
    }
 
96
  }
 
97
  for (; i < HAN_SIZE; i += 64) {
 
98
    cur_offset = buf_offset + i + i - 1024;
 
99
    u_vec0 = u_vec + i;
 
100
    for (j = 0; j < SBLIMIT; j++) {
 
101
      u_vec0[j] = cur_synbuf[cur_offset + j];
 
102
      u_vec0[j + 32] = cur_synbuf[cur_offset + j + 96];
 
103
    }
 
104
  }
 
105
  }
 
106
#endif
76
107
 
77
108
  /* dewindowing */
78
109
#ifdef USE_LIBOIL
79
110
  oil_multiply_f32 (u_vec, u_vec, dewindow, HAN_SIZE);
80
111
#else
81
 
  for (i = 0; i < HAN_SIZE; i++) {
 
112
  for (i = 0; i < HAN_SIZE; i++)
82
113
    u_vec[i] *= dewindow[i];
83
 
  }
84
114
#endif
85
115
 
86
116
  /* Now calculate and output 32 samples */
87
117
  for (i = 0; i < 32; i++) {
88
118
    gfloat sum = 0.0;
89
 
    for (j = 0; j < HAN_SIZE; j += 32) {
90
 
        sum += u_vec[j + i]; 
 
119
#if 1
 
120
    u_vec0 = u_vec + i;
 
121
    for (j = 0; j < HAN_SIZE; j += 128) {
 
122
      sum += u_vec0[j]; 
 
123
      sum += u_vec0[j + 32]; 
 
124
      sum += u_vec0[j + 64]; 
 
125
      sum += u_vec0[j + 96]; 
91
126
    }
 
127
#else
 
128
    for (j = 0; j < HAN_SIZE; j += 32)
 
129
      sum += u_vec[j + i]; 
 
130
#endif
92
131
 
93
132
    if (sum > 0) {
94
133
      sum = sum * SCALE + 0.5;
112
151
 
113
152
/* Synthesis matrixing variant which uses a 32 point DCT to compute 
114
153
 * the matrixing */
115
 
void
 
154
static void
116
155
III_polyphase_matrix (gfloat in[SBLIMIT], gfloat out[2 * SBLIMIT])
117
156
{
118
157
  int i;