Changeset 2107:2dafbf9739f2 in roaraudio
- Timestamp:
- 07/21/09 16:55:27 (15 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
roard/codecfilter_vorbis.c
r2087 r2107 29 29 #ifdef ROAR_HAVE_LIBVORBISFILE 30 30 31 #define FIFAC ((float)((uint64_t)1<<(ROAR_VORBIS_BITS-1))) 32 31 33 int _g_cf_vorbis_vfvio_return_err (void) { 32 34 return -1; … … 99 101 } 100 102 */ 103 s->info.bits = ROAR_VORBIS_BITS; 101 104 #else 102 105 free(self); … … 141 144 int chans; 142 145 int end; 146 #if ROAR_VORBIS_BITS == 8 147 int8_t * data = (int8_t *) buf; 148 #elif ROAR_VORBIS_BITS == 16 143 149 int16_t * data = (int16_t *) buf; 150 #elif ROAR_VORBIS_BITS == 32 151 int32_t * data = (int32_t *) buf; 152 #else 153 #error value of ROAR_VORBIS_BITS not supported 154 #endif 144 155 145 156 if ( ! self->opened ) { … … 169 180 encbuf = vorbis_analysis_buffer(&(self->encoder.vd), len /* TODO: need to lookup the menaing of this */); 170 181 chans = s->info.channels; 171 end = len /(2*chans);182 end = len*8/(ROAR_VORBIS_BITS*chans); 172 183 173 184 if ( chans == 1 ) { // use optimized code 174 185 for (i = 0; i < end; i++) 175 encbuf[0][i] = data[i]/ 32768.0;186 encbuf[0][i] = data[i]/FIFAC; 176 187 177 188 } else if ( chans == 2 ) { // use optimized code 178 189 for (i = 0; i < end; i++) { 179 encbuf[0][i] = data[2*i ]/ 32768.0;180 encbuf[1][i] = data[2*i+1]/ 32768.0;190 encbuf[0][i] = data[2*i ]/FIFAC; 191 encbuf[1][i] = data[2*i+1]/FIFAC; 181 192 } 182 193 } else { // use generic multi channel code 183 194 for (i = 0; i < end; i++) { 184 195 for (c = 0; c < chans; c++) { 185 encbuf[c][i] = data[chans*i+c]/ 32768.0;196 encbuf[c][i] = data[chans*i+c]/FIFAC; 186 197 } 187 198 }
Note: See TracChangeset
for help on using the changeset viewer.