Unified · Split
| @@ -69,6 +69,12 @@ optional(EXTERNAL_GSM gsm/gsm.h gsm gsm_create "") · 68 unmodified lines | ||
| 69 | 69 | optional(HAVE_ALSA alsa/asoundlib.h asound snd_pcm_open alsa) |
| 70 | 70 | optional(HAVE_AMRNB amrnb/sp_dec.h amrnb Decoder_Interface_init amr-nb) |
| 71 | 71 | optional(HAVE_AMRWB amrwb/dec.h amrwb D_IF_init amr-wb) |
| 72 | +if(CMAKE_COMPILER_IS_GNUCC) | |
| 73 | + optional(HAVE_OPENMP omp.h gomp omp_get_thread_num "") | |
| 74 | + if(HAVE_OPENMP) | |
| 75 | + add_definitions(-fopenmp) | |
| 76 | + endif(HAVE_OPENMP) | |
| 77 | +endif(CMAKE_COMPILER_IS_GNUCC) | |
| 72 | 78 | optional(HAVE_ID3TAG id3tag.h id3tag id3_file_open "") |
| 73 | 79 | optional(HAVE_LIBAO ao/ao.h ao ao_play ao) |
| 74 | 80 | optional(HAVE_FLAC FLAC/all.h FLAC FLAC__stream_encoder_new flac) |
| @@ -183,7 +183,7 @@ AC_SUBST(LIBTOOLFLAGS) · 182 unmodified lines | ||
| 183 | 183 | dnl Check for GOMP |
| 184 | 184 | AC_MSG_CHECKING([whether to use GOMP]) |
| 185 | 185 | AC_ARG_ENABLE(gomp, |
| 186 | − AC_HELP_STRING([--enable-gomp], [Use GOMP.]),,enable_gomp=no) | |
| 186 | + AC_HELP_STRING([--disable-gomp], [Don't use GOMP.]),,enable_gomp=yes) | |
| 187 | 187 | AC_MSG_RESULT($enable_gomp) |
| 188 | 188 | if test "$enable_gomp" = "yes"; then |
| 189 | 189 | AC_CHECK_HEADERS(omp.h, |
| @@ -191,10 +191,10 @@ if test "$enable_gomp" = "yes"; then · 1 unmodified line | ||
| 191 | 191 | enable_gomp=no) |
| 192 | 192 | fi |
| 193 | 193 | if test "$enable_gomp" = yes; then |
| 194 | − AC_DEFINE(HAVE_GOMP, 1, [Define to 1 if you have GOMP.]) | |
| 194 | + AC_DEFINE(HAVE_OPENMP, 1, [Define to 1 if you have GOMP.]) | |
| 195 | 195 | CFLAGS="$CFLAGS -fopenmp" |
| 196 | 196 | fi |
| 197 | −AM_CONDITIONAL(HAVE_GOMP, test x$enable_gomp = xyes) | |
| 197 | +AM_CONDITIONAL(HAVE_OPENMP, test x$enable_gomp = xyes) | |
| 198 | 198 | AC_SUBST(GOMP_LIBS) |
| 199 | 199 | |
| 200 | 200 | audio_driver_found=no |
| @@ -254,6 +254,7 @@ static int startwrite(sox_format_t * ft) · 253 unmodified lines | ||
| 254 | 254 | static size_t write_samples(sox_format_t * ft, const sox_sample_t *buf, size_t len) |
| 255 | 255 | { |
| 256 | 256 | priv_t * p = (priv_t * ) ft->priv; |
| 257 | + SOX_SAMPLE_LOCALS; | |
| 257 | 258 | |
| 258 | 259 | unsigned char datum; |
| 259 | 260 | size_t done = 0, i; |
| @@ -13,9 +13,7 @@ if(CMAKE_COMPILER_IS_GNUCC) · 12 unmodified lines | ||
| 13 | 13 | else(${ver} LESS 403) |
| 14 | 14 | add_definitions(-Wtraditional-conversion) |
| 15 | 15 | endif(${ver} LESS 403) |
| 16 | − add_definitions(-Werror) | |
| 17 | − add_definitions(-fopenmp) | |
| 18 | − set(optional_libs ${optional_libs} gomp) | |
| 16 | + #add_definitions(-Werror) | |
| 19 | 17 | endif(CMAKE_COMPILER_IS_GNUCC) |
| 20 | 18 | |
| 21 | 19 | if (NOT EXTERNAL_GSM) |
| @@ -251,6 +251,7 @@ size_t lsx_adpcm_write(sox_format_t * ft, adpcm_io_t * state, const sox_sample_t · 250 unmodified lines | ||
| 251 | 251 | short word; |
| 252 | 252 | |
| 253 | 253 | while (count < length) { |
| 254 | + SOX_SAMPLE_LOCALS; | |
| 254 | 255 | word = SOX_SAMPLE_TO_SIGNED_16BIT(*buffer++, ft->clips); |
| 255 | 256 | |
| 256 | 257 | byte <<= 4; |
| @@ -536,12 +536,14 @@ static int startwrite(sox_format_t * ft) · 535 unmodified lines | ||
| 536 | 536 | |
| 537 | 537 | static void sox_ub_write_buf(char* buf1, sox_sample_t const * buf2, size_t len, sox_bool swap UNUSED, size_t * clips) |
| 538 | 538 | { |
| 539 | + SOX_SAMPLE_LOCALS; | |
| 539 | 540 | while (len--) |
| 540 | 541 | *(uint8_t *)buf1++ = SOX_SAMPLE_TO_UNSIGNED_8BIT(*buf2++, *clips); |
| 541 | 542 | } |
| 542 | 543 | |
| 543 | 544 | static void sox_sb_write_buf(char *buf1, sox_sample_t const * buf2, size_t len, sox_bool swap UNUSED, size_t * clips) |
| 544 | 545 | { |
| 546 | + SOX_SAMPLE_LOCALS; | |
| 545 | 547 | while (len--) |
| 546 | 548 | *(int8_t *)buf1++ = SOX_SAMPLE_TO_SIGNED_8BIT(*buf2++, *clips); |
| 547 | 549 | } |
| @@ -550,6 +552,7 @@ static void sox_uw_write_buf(char *buf1, sox_sample_t const * buf2, size_t len, · 2 unmodified lines | ||
| 550 | 552 | { |
| 551 | 553 | while (len--) |
| 552 | 554 | { |
| 555 | + SOX_SAMPLE_LOCALS; | |
| 553 | 556 | uint16_t datum = SOX_SAMPLE_TO_UNSIGNED_16BIT(*buf2++, *clips); |
| 554 | 557 | if (swap) |
| 555 | 558 | datum = lsx_swapw(datum); |
| @@ -562,6 +565,7 @@ static void sox_sw_write_buf(char *buf1, sox_sample_t const * buf2, size_t len, · 6 unmodified lines | ||
| 562 | 565 | { |
| 563 | 566 | while (len--) |
| 564 | 567 | { |
| 568 | + SOX_SAMPLE_LOCALS; | |
| 565 | 569 | int16_t datum = SOX_SAMPLE_TO_SIGNED_16BIT(*buf2++, *clips); |
| 566 | 570 | if (swap) |
| 567 | 571 | datum = lsx_swapw(datum); |
| @@ -117,6 +117,7 @@ static size_t write_samples(sox_format_t * ft, const sox_sample_t * buf, size_t · 116 unmodified lines | ||
| 117 | 117 | size_t done; |
| 118 | 118 | |
| 119 | 119 | for (done = 0; done < len; ++done) { |
| 120 | + SOX_SAMPLE_LOCALS; | |
| 120 | 121 | p->pcm[p->pcm_index++] = SOX_SAMPLE_TO_SIGNED_16BIT(*buf++, ft->clips); |
| 121 | 122 | if (p->pcm_index == AMR_FRAME) { |
| 122 | 123 | p->pcm_index = 0; |
| @@ -79,6 +79,7 @@ static void sox_sw_write_buf(char *buf1, sox_sample_t const * buf2, size_t len, · 78 unmodified lines | ||
| 79 | 79 | { |
| 80 | 80 | while (len--) |
| 81 | 81 | { |
| 82 | + SOX_SAMPLE_LOCALS; | |
| 82 | 83 | uint16_t datum = SOX_SAMPLE_TO_SIGNED_16BIT(*buf2++, *clips); |
| 83 | 84 | if (swap) |
| 84 | 85 | datum = lsx_swapw(datum); |
| @@ -150,6 +150,7 @@ static int flow(sox_effect_t * effp, const sox_sample_t * ibuf, · 149 unmodified lines | ||
| 150 | 150 | |
| 151 | 151 | /* main processing loop */ |
| 152 | 152 | for (i = 0; i < len; i++) { |
| 153 | + SOX_SAMPLE_LOCALS; | |
| 153 | 154 | ++p->in_pos; |
| 154 | 155 | |
| 155 | 156 | /* As long as we have not yet collected enough data just read in */ |
| @@ -213,6 +213,7 @@ static size_t read_samples(sox_format_t *ft, sox_sample_t *buf, size_t nsamp) · 212 unmodified lines | ||
| 213 | 213 | size_t samp_left; |
| 214 | 214 | OSStatus status; |
| 215 | 215 | float *p; |
| 216 | + SOX_SAMPLE_LOCALS; | |
| 216 | 217 | |
| 217 | 218 | if (!ac->device_started) |
| 218 | 219 | { |
| @@ -263,6 +264,7 @@ static size_t write_samples(sox_format_t *ft, const sox_sample_t *buf, size_t ns · 44 unmodified lines | ||
| 263 | 264 | size_t samp_left; |
| 264 | 265 | OSStatus status; |
| 265 | 266 | float *p; |
| 267 | + SOX_SAMPLE_LOCALS; | |
| 266 | 268 | |
| 267 | 269 | if (!ac->device_started) |
| 268 | 270 | { |
| @@ -135,6 +135,7 @@ static size_t sox_datwrite(sox_format_t * ft, const sox_sample_t *buf, size_t ns · 134 unmodified lines | ||
| 135 | 135 | sprintf(s," %15.8g ",dat->timevalue); |
| 136 | 136 | lsx_writes(ft, s); |
| 137 | 137 | for (i=0; i<ft->signal.channels; i++) { |
| 138 | + SOX_SAMPLE_LOCALS; | |
| 138 | 139 | sampval = SOX_SAMPLE_TO_FLOAT_64BIT(*buf++, ft->clips); |
| 139 | 140 | sprintf(s," %15.8g", sampval); |
| 140 | 141 | lsx_writes(ft, s); |
| @@ -218,13 +218,15 @@ static int flow_effect(sox_effects_chain_t * chain, size_t n) · 217 unmodified lines | ||
| 218 | 218 | for (f = 0; f < (int)effp->flows; ++f) |
| 219 | 219 | chain->ibufc[f][i / effp->flows] = *ibuf++; |
| 220 | 220 | |
| 221 | +#ifdef HAVE_OPENMP | |
| 221 | 222 | #pragma omp parallel for |
| 223 | +#endif | |
| 222 | 224 | for (f = 0; f < (int)effp->flows; ++f) { |
| 223 | 225 | size_t idonec = idone / effp->flows; |
| 224 | 226 | size_t odonec = obeg / effp->flows; |
| 225 | 227 | int eff_status_c = effp->handler.flow(&chain->effects[n][f], |
| 226 | 228 | chain->ibufc[f], chain->obufc[f], &idonec, &odonec); |
| 227 | −#ifndef HAVE_GOMP | |
| 229 | +#ifndef HAVE_OPENMP | |
| 228 | 230 | if (f && (idonec != idone_last || odonec != odone_last)) { |
| 229 | 231 | lsx_fail("flowed asymmetrically!"); |
| 230 | 232 | effstatus = SOX_EOF; |
| @@ -397,26 +397,36 @@ int lsx_set_dft_length(int num_taps) /* Set to 4 x nearest power of 2 */ · 396 unmodified lines | ||
| 397 | 397 | } |
| 398 | 398 | |
| 399 | 399 | #include "fft4g.h" |
| 400 | −int * lsx_fft_br; | |
| 400 | +int * lsx_fft_br; | |
| 401 | 401 | double * lsx_fft_sc; |
| 402 | +static int fft_len; | |
| 403 | +#ifdef HAVE_OPENMP | |
| 404 | +static omp_lock_t fft_cache_lock; | |
| 405 | +#endif | |
| 406 | + | |
| 407 | +static void init_fft_cache(void) | |
| 408 | +{ | |
| 409 | + omp_init_lock(&fft_cache_lock); | |
| 410 | +} | |
| 411 | + | |
| 412 | +static void clear_fft_cache(void) | |
| 413 | +{ | |
| 414 | + omp_destroy_lock(&fft_cache_lock); | |
| 415 | + free(lsx_fft_br); | |
| 416 | + free(lsx_fft_sc); | |
| 417 | + lsx_fft_sc = NULL; | |
| 418 | + lsx_fft_br = NULL; | |
| 419 | + fft_len = 0; | |
| 420 | +} | |
| 402 | 421 | |
| 403 | 422 | static void update_fft_cache(int len) |
| 404 | 423 | { |
| 405 | − static int n; | |
| 406 | − | |
| 407 | − if (!len) { | |
| 408 | − free(lsx_fft_br); | |
| 409 | − free(lsx_fft_sc); | |
| 410 | − lsx_fft_sc = NULL; | |
| 411 | − lsx_fft_br = NULL; | |
| 412 | − n = 0; | |
| 413 | − return; | |
| 414 | − } | |
| 415 | − if (len > n) { | |
| 416 | − int old_n = n; | |
| 417 | − n = len; | |
| 418 | − lsx_fft_br = lsx_realloc(lsx_fft_br, dft_br_len(n) * sizeof(*lsx_fft_br)); | |
| 419 | − lsx_fft_sc = lsx_realloc(lsx_fft_sc, dft_sc_len(n) * sizeof(*lsx_fft_sc)); | |
| 424 | + omp_set_lock(&fft_cache_lock); | |
| 425 | + if (len > fft_len) { | |
| 426 | + int old_n = fft_len; | |
| 427 | + fft_len = len; | |
| 428 | + lsx_fft_br = lsx_realloc(lsx_fft_br, dft_br_len(fft_len) * sizeof(*lsx_fft_br)); | |
| 429 | + lsx_fft_sc = lsx_realloc(lsx_fft_sc, dft_sc_len(fft_len) * sizeof(*lsx_fft_sc)); | |
| 420 | 430 | if (!old_n) |
| 421 | 431 | lsx_fft_br[0] = 0; |
| 422 | 432 | } |
| @@ -432,6 +442,7 @@ void lsx_safe_rdft(int len, int type, double * d) · 9 unmodified lines | ||
| 432 | 442 | assert(is_power_of_2(len)); |
| 433 | 443 | update_fft_cache(len); |
| 434 | 444 | lsx_rdft(len, type, d, lsx_fft_br, lsx_fft_sc); |
| 445 | + omp_unset_lock(&fft_cache_lock); | |
| 435 | 446 | } |
| 436 | 447 | |
| 437 | 448 | void lsx_safe_cdft(int len, int type, double * d) |
| @@ -439,6 +450,7 @@ void lsx_safe_cdft(int len, int type, double * d) · 1 unmodified line | ||
| 439 | 450 | assert(is_power_of_2(len)); |
| 440 | 451 | update_fft_cache(len); |
| 441 | 452 | lsx_cdft(len, type, d, lsx_fft_br, lsx_fft_sc); |
| 453 | + omp_unset_lock(&fft_cache_lock); | |
| 442 | 454 | } |
| 443 | 455 | |
| 444 | 456 | void lsx_power_spectrum(int n, double const * in, double * out) |
| @@ -536,3 +548,14 @@ void lsx_apply_kaiser(double h[], const int num_points, double beta) · 91 unmodified lines | ||
| 536 | 548 | } |
| 537 | 549 | } |
| 538 | 550 | |
| 551 | +int lsx_effects_init(void) | |
| 552 | +{ | |
| 553 | + init_fft_cache(); | |
| 554 | + return SOX_SUCCESS; | |
| 555 | +} | |
| 556 | + | |
| 557 | +int lsx_effects_quit(void) | |
| 558 | +{ | |
| 559 | + clear_fft_cache(); | |
| 560 | + return SOX_SUCCESS; | |
| 561 | +} | |
| @@ -38,7 +38,7 @@ int main(int argc, char * argv[]) · 37 unmodified lines | ||
| 38 | 38 | assert(argc == 3); |
| 39 | 39 | |
| 40 | 40 | /* All libSoX applications must start by initialising the SoX library */ |
| 41 | − assert(sox_format_init() == SOX_SUCCESS); | |
| 41 | + assert(sox_init() == SOX_SUCCESS); | |
| 42 | 42 | |
| 43 | 43 | /* Open the input file (with default parameters) */ |
| 44 | 44 | assert(in = sox_open_read(argv[1], NULL, NULL, NULL)); |
| @@ -110,7 +110,7 @@ int main(int argc, char * argv[]) · 109 unmodified lines | ||
| 110 | 110 | assert(argc == 3); |
| 111 | 111 | |
| 112 | 112 | /* All libSoX applications must start by initialising the SoX library */ |
| 113 | − assert(sox_format_init() == SOX_SUCCESS); | |
| 113 | + assert(sox_init() == SOX_SUCCESS); | |
| 114 | 114 | |
| 115 | 115 | /* Open the input file (with default parameters) */ |
| 116 | 116 | assert(in = sox_open_read(argv[1], NULL, NULL, NULL)); |
| @@ -87,6 +87,7 @@ int main(int argc, char * argv[]) · 86 unmodified lines | ||
| 87 | 87 | int l, r; |
| 88 | 88 | |
| 89 | 89 | for (i = 0; i < block_size; ++i) { |
| 90 | + SOX_SAMPLE_LOCALS; | |
| 90 | 91 | /* convert the sample from SoX's internal format to a `double' for |
| 91 | 92 | * processing in this application: */ |
| 92 | 93 | double sample = SOX_SAMPLE_TO_FLOAT_64BIT(buf[i], clips); |
| @@ -406,6 +406,7 @@ static size_t write_samples(sox_format_t * ft, const sox_sample_t *buf, size_t l · 405 unmodified lines | ||
| 406 | 406 | do { |
| 407 | 407 | /* If output frame is not full, copy data into it */ |
| 408 | 408 | if (ffmpeg->samples_index < ffmpeg->audio_input_frame_size) { |
| 409 | + SOX_SAMPLE_LOCALS; | |
| 409 | 410 | for (; nread < len && ffmpeg->samples_index < ffmpeg->audio_input_frame_size; nread++) |
| 410 | 411 | ffmpeg->samples[ffmpeg->samples_index++] = SOX_SAMPLE_TO_SIGNED_16BIT(buf[nread], ft->clips); |
| 411 | 412 | } |
| @@ -436,6 +436,7 @@ static size_t write_samples(sox_format_t * const ft, sox_sample_t const * const · 435 unmodified lines | ||
| 436 | 436 | unsigned i; |
| 437 | 437 | |
| 438 | 438 | for (i = 0; i < len; ++i) { |
| 439 | + SOX_SAMPLE_LOCALS; | |
| 439 | 440 | long pcm = SOX_SAMPLE_TO_SIGNED_32BIT(sampleBuffer[i], ft->clips); |
| 440 | 441 | p->decoded_samples[i] = pcm >> (32 - p->bits_per_sample); |
| 441 | 442 | switch (p->bits_per_sample) { |
| @@ -195,6 +195,7 @@ static size_t sox_gsmwrite(sox_format_t * ft, const sox_sample_t *buf, size_t sa · 194 unmodified lines | ||
| 195 | 195 | |
| 196 | 196 | while (done < samp) |
| 197 | 197 | { |
| 198 | + SOX_SAMPLE_LOCALS; | |
| 198 | 199 | while ((p->samplePtr < p->sampleTop) && (done < samp)) |
| 199 | 200 | *(p->samplePtr)++ = |
| 200 | 201 | SOX_SAMPLE_TO_SIGNED_16BIT(buf[done++], ft->clips); |
| @@ -277,6 +277,7 @@ static size_t write_samples(sox_format_t * ft, const sox_sample_t *buf, size_t l · 276 unmodified lines | ||
| 277 | 277 | } |
| 278 | 278 | |
| 279 | 279 | for (i = 0; i < len; i++) { |
| 280 | + SOX_SAMPLE_LOCALS; | |
| 280 | 281 | datum = *buf++; |
| 281 | 282 | p->data[p->pos++] = SOX_SAMPLE_TO_UNSIGNED_8BIT(datum, ft->clips); |
| 282 | 283 | } |
| @@ -230,6 +230,7 @@ static int sox_ladspa_flow(sox_effect_t * effp, const sox_sample_t *ibuf, sox_sa · 229 unmodified lines | ||
| 230 | 230 | |
| 231 | 231 | if (len) { |
| 232 | 232 | LADSPA_Data *buf = lsx_malloc(sizeof(LADSPA_Data) * len); |
| 233 | + SOX_SAMPLE_LOCALS; | |
| 233 | 234 | |
| 234 | 235 | /* Insert input if effect takes it */ |
| 235 | 236 | if (l_st->input_port != ULONG_MAX) { |
| @@ -85,3 +85,14 @@ SOX_MESSAGE_FUNCTION(lsx_debug_most , 6) · 84 unmodified lines | ||
| 85 | 85 | |
| 86 | 86 | #undef SOX_MESSAGE_FUNCTION |
| 87 | 87 | |
| 88 | +int sox_init(void) | |
| 89 | +{ | |
| 90 | + sox_format_init(); | |
| 91 | + return lsx_effects_init(); | |
| 92 | +} | |
| 93 | + | |
| 94 | +int sox_quit(void) | |
| 95 | +{ | |
| 96 | + sox_format_quit(); | |
| 97 | + return lsx_effects_quit(); | |
| 98 | +} | |
| @@ -161,6 +161,7 @@ static int flow(sox_effect_t * effp, const sox_sample_t * ibuf, · 160 unmodified lines | ||
| 161 | 161 | priv_t * p = (priv_t *)effp->priv; |
| 162 | 162 | size_t i, odone = min(*osamp, (size_t)fifo_occupancy(&p->output_fifo)); |
| 163 | 163 | double const * s = fifo_read(&p->output_fifo, (int)odone, NULL); |
| 164 | + SOX_SAMPLE_LOCALS; | |
| 164 | 165 | |
| 165 | 166 | for (i = 0; i < odone; ++i) |
| 166 | 167 | *obuf++ = SOX_FLOAT_64BIT_TO_SAMPLE(*s++, effp->clips); |
| @@ -153,6 +153,7 @@ static size_t read_samples(sox_format_t * ft, sox_sample_t *buf, size_t len) · 152 unmodified lines | ||
| 153 | 153 | size_t nread = 0; |
| 154 | 154 | |
| 155 | 155 | while (nread < len) { |
| 156 | + SOX_SAMPLE_LOCALS; | |
| 156 | 157 | /* Read more data if buffer is empty */ |
| 157 | 158 | if (lpc->samples == LPC10_SAMPLES_PER_FRAME) { |
| 158 | 159 | INT32 bits[LPC10_BITS_IN_COMPRESSED_FRAME]; |
| @@ -178,6 +179,7 @@ static size_t write_samples(sox_format_t * ft, const sox_sample_t *buf, size_t l · 19 unmodified lines | ||
| 178 | 179 | |
| 179 | 180 | while (len > 0) { |
| 180 | 181 | while (len > 0 && lpc->samples < LPC10_SAMPLES_PER_FRAME) { |
| 182 | + SOX_SAMPLE_LOCALS; | |
| 181 | 183 | lpc->speech[lpc->samples++] = SOX_SAMPLE_TO_FLOAT_32BIT(buf[nwritten++], ft->clips); |
| 182 | 184 | len--; |
| 183 | 185 | } |
| @@ -406,6 +406,7 @@ static size_t sox_mp3write(sox_format_t * ft, const sox_sample_t *buf, size_t sa · 405 unmodified lines | ||
| 406 | 406 | int i,j; |
| 407 | 407 | ptrdiff_t done = 0; |
| 408 | 408 | size_t written; |
| 409 | + SOX_SAMPLE_LOCALS; | |
| 409 | 410 | |
| 410 | 411 | /* NOTE: This logic assumes that "short int" is 16-bits |
| 411 | 412 | * on all platforms. It happens to be for all that I know |
| @@ -442,9 +443,7 @@ static size_t sox_mp3write(sox_format_t * ft, const sox_sample_t *buf, size_t sa · 30 unmodified lines | ||
| 442 | 443 | { |
| 443 | 444 | j=0; |
| 444 | 445 | for (i=0; i<nsamples; i++) |
| 445 | − { | |
| 446 | 446 | buffer_l[i]=SOX_SAMPLE_TO_SIGNED_16BIT(buf[j++], ft->clips); |
| 447 | − } | |
| 448 | 447 | } |
| 449 | 448 | |
| 450 | 449 | mp3buffer_size = 1.25 * nsamples + 7200; |
| @@ -124,6 +124,7 @@ static int sox_noiseprof_flow(sox_effect_t * effp, const sox_sample_t *ibuf, sox · 123 unmodified lines | ||
| 124 | 124 | |
| 125 | 125 | /* Collect data for every channel. */ |
| 126 | 126 | for (i = 0; i < chans; i ++) { |
| 127 | + SOX_SAMPLE_LOCALS; | |
| 127 | 128 | chandata_t * chan = &(p->chandata[i]); |
| 128 | 129 | for (j = 0; j < n; j ++) |
| 129 | 130 | chan->window[j + p->bufdata] = |
| @@ -230,6 +230,7 @@ static int process_window(sox_effect_t * effp, priv_t * data, unsigned chan_num, · 229 unmodified lines | ||
| 230 | 230 | int use = min(len, WINDOWSIZE)-min(len,(WINDOWSIZE/2)); |
| 231 | 231 | chandata_t *chan = &(data->chandata[chan_num]); |
| 232 | 232 | int first = (chan->lastwindow == NULL); |
| 233 | + SOX_SAMPLE_LOCALS; | |
| 233 | 234 | |
| 234 | 235 | if ((nextwindow = lsx_calloc(WINDOWSIZE, sizeof(float))) == NULL) |
| 235 | 236 | return SOX_EOF; |
| @@ -283,6 +284,7 @@ static int sox_noisered_flow(sox_effect_t * effp, const sox_sample_t *ibuf, sox_ · 47 unmodified lines | ||
| 283 | 284 | |
| 284 | 285 | /* Reduce noise on every channel. */ |
| 285 | 286 | for (i = 0; i < tracks; i ++) { |
| 287 | + SOX_SAMPLE_LOCALS; | |
| 286 | 288 | chandata_t* chan = &(data->chandata[i]); |
| 287 | 289 | size_t j; |
| 288 | 290 | |
| @@ -63,6 +63,7 @@ static int flow(sox_effect_t * effp, const sox_sample_t * ibuf, · 62 unmodified lines | ||
| 63 | 63 | return SOX_EOF; |
| 64 | 64 | } |
| 65 | 65 | if (p->balance) for (len = *isamp; len; --len, ++ibuf) { |
| 66 | + SOX_SAMPLE_LOCALS; | |
| 66 | 67 | size_t dummy = 0; |
| 67 | 68 | double d = SOX_SAMPLE_TO_FLOAT_64BIT(*ibuf, dummy); |
| 68 | 69 | p->rms += sqr(d); |
| @@ -50,6 +50,7 @@ static int flow(sox_effect_t * effp, const sox_sample_t * ibuf, · 49 unmodified lines | ||
| 50 | 50 | priv_t * p = (priv_t *)effp->priv; |
| 51 | 51 | size_t dummy = 0, len = *isamp = *osamp = min(*isamp, *osamp); |
| 52 | 52 | while (len--) { |
| 53 | + SOX_SAMPLE_LOCALS; | |
| 53 | 54 | double d = SOX_SAMPLE_TO_FLOAT_64BIT(*ibuf++, dummy), d0 = d; |
| 54 | 55 | d *= p->gain; |
| 55 | 56 | d += p->colour; |
| @@ -114,6 +114,7 @@ static int flow(sox_effect_t * effp, const sox_sample_t *ibuf, sox_sample_t *obu · 113 unmodified lines | ||
| 114 | 114 | size_t isamples0 = d->input_frames * channels; |
| 115 | 115 | size_t isamples = isamples0 + *isamp; |
| 116 | 116 | size_t osamples = isamples * (d->src_ratio + 0.01) + 8; |
| 117 | + SOX_SAMPLE_LOCALS; | |
| 117 | 118 | |
| 118 | 119 | if (osamples > *osamp) { |
| 119 | 120 | osamples = *osamp; |
| @@ -623,6 +623,7 @@ static int flow(sox_effect_t * effp, const sox_sample_t * ibuf, · 622 unmodified lines | ||
| 623 | 623 | { |
| 624 | 624 | priv_t * p = (priv_t *)effp->priv; |
| 625 | 625 | size_t i, odone = *osamp; |
| 626 | + SOX_SAMPLE_LOCALS; | |
| 626 | 627 | |
| 627 | 628 | sample_t const * s = rate_output(&p->rate, NULL, &odone); |
| 628 | 629 | for (i = 0; i < odone; ++i) *obuf++ = TO_SOX(*s++, effp->clips); |
| @@ -69,6 +69,7 @@ int lsx_rawstart(sox_format_t * ft, sox_bool default_rate, · 68 unmodified lines | ||
| 69 | 69 | sox_format_t * ft, sox_sample_t *buf, size_t len) \ |
| 70 | 70 | { \ |
| 71 | 71 | size_t n, nread; \ |
| 72 | + SOX_SAMPLE_LOCALS; \ | |
| 72 | 73 | ctype *data = lsx_malloc(sizeof(ctype) * len); \ |
| 73 | 74 | nread = lsx_read_ ## type ## _buf(ft, (uctype *)data, len); \ |
| 74 | 75 | for (n = 0; n < nread; n++) \ |
| @@ -94,6 +95,7 @@ READ_SAMPLES_FUNC(df, sizeof(double), su, double, double, SOX_FLOAT_64BIT_TO_SAM · 19 unmodified lines | ||
| 94 | 95 | static size_t sox_write_ ## sign ## type ## _samples( \ |
| 95 | 96 | sox_format_t * ft, sox_sample_t const * buf, size_t len) \ |
| 96 | 97 | { \ |
| 98 | + SOX_SAMPLE_LOCALS; \ | |
| 97 | 99 | size_t n, nwritten; \ |
| 98 | 100 | ctype *data = lsx_malloc(sizeof(ctype) * len); \ |
| 99 | 101 | for (n = 0; n < len; n++) \ |
| @@ -219,6 +219,7 @@ static int flow(sox_effect_t * effp, const sox_sample_t * ibuf, · 218 unmodified lines | ||
| 219 | 219 | { |
| 220 | 220 | priv_t * p = (priv_t *)effp->priv; |
| 221 | 221 | size_t c, i, w, len = min(*isamp / p->ichannels, *osamp / p->ochannels); |
| 222 | + SOX_SAMPLE_LOCALS; | |
| 222 | 223 | |
| 223 | 224 | *isamp = len * p->ichannels, *osamp = len * p->ochannels; |
| 224 | 225 | for (c = 0; c < p->ichannels; ++c) |
| @@ -280,6 +280,7 @@ static int aboveThreshold(sox_effect_t * effp, sox_sample_t value, double thresh · 279 unmodified lines | ||
| 280 | 280 | /* Only consider the original bits when looking for silence */ |
| 281 | 281 | switch(effp->in_signal.precision) |
| 282 | 282 | { |
| 283 | + SOX_SAMPLE_LOCALS; | |
| 283 | 284 | case 8: |
| 284 | 285 | value = SOX_SAMPLE_TO_SIGNED_8BIT(value, dummy_clipped_count); |
| 285 | 286 | ratio = (double)abs(value) / (double)SOX_INT8_MAX; |
| @@ -159,6 +159,7 @@ static size_t write_samples(sox_format_t * ft, const sox_sample_t *buf, size_t l · 158 unmodified lines | ||
| 159 | 159 | switch (ft->encoding.bits_per_sample) { |
| 160 | 160 | case 8: |
| 161 | 161 | switch (ft->encoding.encoding) { |
| 162 | + SOX_SAMPLE_LOCALS; | |
| 162 | 163 | case SOX_ENCODING_UNSIGNED: |
| 163 | 164 | while (done < len && lsx_writeb(ft, SOX_SAMPLE_TO_UNSIGNED_8BIT(*buf++, ft->clips)) == SOX_SUCCESS) |
| 164 | 165 | ++done; |
| @@ -368,6 +368,7 @@ static size_t sox_smpwrite(sox_format_t * ft, const sox_sample_t *buf, size_t le · 367 unmodified lines | ||
| 368 | 368 | size_t done = 0; |
| 369 | 369 | |
| 370 | 370 | while(done < len) { |
| 371 | + SOX_SAMPLE_LOCALS; | |
| 371 | 372 | datum = (int) SOX_SAMPLE_TO_SIGNED_16BIT(*buf++, ft->clips); |
| 372 | 373 | lsx_writew(ft, (uint16_t)datum); |
| 373 | 374 | smp->NoOfSamps++; |
| @@ -20,7 +20,7 @@ · 19 unmodified lines | ||
| 20 | 20 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
| 21 | 21 | */ |
| 22 | 22 | |
| 23 | −#include "soxconfig.h" | |
| 23 | +#include "soxomp.h" /* Make this 1st in list (for soxconfig) */ | |
| 24 | 24 | #include "sox.h" |
| 25 | 25 | #include "util.h" |
| 26 | 26 | |
| @@ -169,6 +169,10 @@ static sox_bool user_restart_eff = sox_false; · 142 unmodified lines | ||
| 169 | 169 | static int success = 0; |
| 170 | 170 | static sox_sample_t omax[2], omin[2]; |
| 171 | 171 | |
| 172 | +/* Multi-processing */ | |
| 173 | + | |
| 174 | +static sox_bool single_threaded = sox_false; | |
| 175 | + | |
| 172 | 176 | |
| 173 | 177 | /* Cleanup atexit() function, hence always called. */ |
| 174 | 178 | static void cleanup(void) |
| @@ -1516,12 +1520,18 @@ static void display_SoX_version(FILE * file) · 1341 unmodified lines | ||
| 1516 | 1520 | #elif defined __SUNPRO_C |
| 1517 | 1521 | fprintf(file, "sun c: %x\n", __SUNPRO_C); |
| 1518 | 1522 | #endif |
| 1519 | − fprintf(file, "arch: %lu%lu%lu%lu %lu%lu %lu%lu %c\n", | |
| 1523 | + fprintf(file, "arch: %lu%lu%lu%lu %lu%lu %lu%lu %c %s\n", | |
| 1520 | 1524 | (unsigned long)sizeof(char), (unsigned long)sizeof(short), |
| 1521 | 1525 | (unsigned long)sizeof(long), (unsigned long)sizeof(off_t), |
| 1522 | 1526 | (unsigned long)sizeof(float), (unsigned long)sizeof(double), |
| 1523 | 1527 | (unsigned long)sizeof(int *), (unsigned long)sizeof(int (*)(void)), |
| 1524 | − "LB"[MACHINE_IS_BIGENDIAN]); | |
| 1528 | + "LB"[MACHINE_IS_BIGENDIAN], | |
| 1529 | +#ifdef HAVE_OPENMP | |
| 1530 | + "OMP" | |
| 1531 | +#else | |
| 1532 | + "" | |
| 1533 | +#endif | |
| 1534 | + ); | |
| 1525 | 1535 | } |
| 1526 | 1536 | } |
| 1527 | 1537 | |
| @@ -1818,6 +1828,7 @@ static struct option long_options[] = · 290 unmodified lines | ||
| 1818 | 1828 | {"output" , required_argument, NULL, 0}, |
| 1819 | 1829 | {"effects-file" , required_argument, NULL, 0}, |
| 1820 | 1830 | {"temp" , required_argument, NULL, 0}, |
| 1831 | + {"single-threaded" , no_argument, NULL, 0}, | |
| 1821 | 1832 | |
| 1822 | 1833 | {"bits" , required_argument, NULL, 'b'}, |
| 1823 | 1834 | {"channels" , required_argument, NULL, 'c'}, |
| @@ -2006,6 +2017,10 @@ static char parse_gopts_and_fopts(file_t * f, int argc, char **argv) · 182 unmodified lines | ||
| 2006 | 2017 | sox_globals.tmp_path = strdup(optarg); |
| 2007 | 2018 | break; |
| 2008 | 2019 | |
| 2020 | + case 17: | |
| 2021 | + single_threaded = sox_true; | |
| 2022 | + break; | |
| 2023 | + | |
| 2009 | 2024 | } |
| 2010 | 2025 | break; |
| 2011 | 2026 | |
| @@ -2443,7 +2458,7 @@ int main(int argc, char **argv) · 431 unmodified lines | ||
| 2443 | 2458 | else if (strends(myname, "soxi")) |
| 2444 | 2459 | sox_mode = sox_soxi; |
| 2445 | 2460 | |
| 2446 | − if (sox_format_init() != SOX_SUCCESS) | |
| 2461 | + if (sox_init() != SOX_SUCCESS) | |
| 2447 | 2462 | exit(1); |
| 2448 | 2463 | |
| 2449 | 2464 | if (sox_mode == sox_soxi) |
| @@ -2471,6 +2486,11 @@ int main(int argc, char **argv) · 21 unmodified lines | ||
| 2471 | 2486 | } |
| 2472 | 2487 | #endif |
| 2473 | 2488 | |
| 2489 | +#ifdef HAVE_OPENMP | |
| 2490 | + if (single_threaded) | |
| 2491 | + omp_set_num_threads(1); | |
| 2492 | +#endif | |
| 2493 | + | |
| 2474 | 2494 | if (sox_globals.verbosity > 2) |
| 2475 | 2495 | display_SoX_version(stderr); |
| 2476 | 2496 | |
| @@ -97,9 +97,8 @@ typedef int32_t sox_sample_t; · 96 unmodified lines | ||
| 97 | 97 | * the upper-most bit then treating them as signed integers. |
| 98 | 98 | */ |
| 99 | 99 | |
| 100 | −/* Temporary variables to prevent multiple evaluation of macro arguments: */ | |
| 101 | −static sox_sample_t sox_macro_temp_sample UNUSED; | |
| 102 | −static double sox_macro_temp_double UNUSED; | |
| 100 | +#define SOX_SAMPLE_LOCALS sox_sample_t sox_macro_temp_sample UNUSED; \ | |
| 101 | + double sox_macro_temp_double UNUSED | |
| 103 | 102 | |
| 104 | 103 | #define SOX_SAMPLE_NEG SOX_INT_MIN(32) |
| 105 | 104 | #define SOX_SAMPLE_TO_UNSIGNED(bits,d,clips) \ |
| @@ -395,6 +394,10 @@ struct sox_format { · 289 unmodified lines | ||
| 395 | 394 | #define SOX_FILE_BIG_END (SOX_FILE_ENDIAN | SOX_FILE_ENDBIG) |
| 396 | 395 | |
| 397 | 396 | int sox_format_init(void); |
| 397 | +void sox_format_quit(void); | |
| 398 | + | |
| 399 | +int sox_init(void); | |
| 400 | +int sox_quit(void); | |
| 398 | 401 | |
| 399 | 402 | typedef const sox_format_handler_t *(*sox_format_fn_t)(void); |
| 400 | 403 | |
| @@ -429,7 +432,6 @@ int sox_close(sox_format_t * ft); · 28 unmodified lines | ||
| 429 | 432 | int sox_seek(sox_format_t * ft, uint64_t offset, int whence); |
| 430 | 433 | |
| 431 | 434 | sox_format_handler_t const * sox_find_format(char const * name, sox_bool no_dev); |
| 432 | −void sox_format_quit(void); | |
| 433 | 435 | |
| 434 | 436 | /* |
| 435 | 437 | * Structures for effects. |
| @@ -13,7 +13,7 @@ · 12 unmodified lines | ||
| 13 | 13 | #ifndef SOX_I_H |
| 14 | 14 | #define SOX_I_H |
| 15 | 15 | |
| 16 | −#include "soxconfig.h" | |
| 16 | +#include "soxomp.h" /* Make this 1st in list (for soxconfig) */ | |
| 17 | 17 | #include "sox.h" |
| 18 | 18 | #include "util.h" |
| 19 | 19 | |
| @@ -266,4 +266,7 @@ char * lsx_usage_lines(char * * usage, char const * const * lines, size_t n); · 246 unmodified lines | ||
| 266 | 266 | |
| 267 | 267 | int lsx_effect_set_imin(sox_effect_t * effp, size_t imin); |
| 268 | 268 | |
| 269 | +int lsx_effects_init(void); | |
| 270 | +int lsx_effects_quit(void); | |
| 271 | + | |
| 269 | 272 | #endif |
| @@ -163,6 +163,7 @@ int main() · 162 unmodified lines | ||
| 163 | 163 | size_t clips = 0; |
| 164 | 164 | |
| 165 | 165 | double d; |
| 166 | + SOX_SAMPLE_LOCALS; | |
| 166 | 167 | |
| 167 | 168 | TEST_UINT(8) |
| 168 | 169 | TEST_UINT(16) |
| @@ -23,6 +23,7 @@ · 22 unmodified lines | ||
| 23 | 23 | #cmakedefine HAVE_MKSTEMP 1 |
| 24 | 24 | #cmakedefine HAVE_OGG_SPEEX 1 |
| 25 | 25 | #cmakedefine HAVE_OGG_VORBIS 1 |
| 26 | +#cmakedefine HAVE_OPENMP 1 | |
| 26 | 27 | #cmakedefine HAVE_POPEN 1 |
| 27 | 28 | #cmakedefine HAVE_PNG 1 |
| 28 | 29 | #cmakedefine HAVE_SAMPLERATE_H 1 |
| @@ -0,0 +1,38 @@ | ||
| 1 | +#include "soxconfig.h" | |
| 2 | + | |
| 3 | +#ifdef HAVE_OPENMP | |
| 4 | + #include <omp.h> | |
| 5 | +#else | |
| 6 | + | |
| 7 | +typedef int omp_lock_t; | |
| 8 | +typedef int omp_nest_lock_t; | |
| 9 | + | |
| 10 | +#define omp_set_num_threads(int) (void)0 | |
| 11 | +#define omp_get_num_threads() 1 | |
| 12 | +#define omp_get_max_threads() 1 | |
| 13 | +#define omp_get_thread_num() 0 | |
| 14 | +#define omp_get_num_procs() 1 | |
| 15 | +#define omp_in_parallel() 1 | |
| 16 | + | |
| 17 | +#define omp_set_dynamic(int) (void)0 | |
| 18 | +#define omp_get_dynamic() 0 | |
| 19 | + | |
| 20 | +#define omp_set_nested(int) (void)0 | |
| 21 | +#define omp_get_nested() 0 | |
| 22 | + | |
| 23 | +#define omp_init_lock(omp_lock_t) (void)0 | |
| 24 | +#define omp_destroy_lock(omp_lock_t) (void)0 | |
| 25 | +#define omp_set_lock(omp_lock_t) (void)0 | |
| 26 | +#define omp_unset_lock(omp_lock_t) (void)0 | |
| 27 | +#define omp_test_lock(omp_lock_t) 0 | |
| 28 | + | |
| 29 | +#define omp_init_nest_lock(omp_nest_lock_t) (void)0 | |
| 30 | +#define omp_destroy_nest_lock(omp_nest_lock_t) (void)0 | |
| 31 | +#define omp_set_nest_lock(omp_nest_lock_t) (void)0 | |
| 32 | +#define omp_unset_nest_lock(omp_nest_lock_t) (void)0 | |
| 33 | +#define omp_test_nest_lock(omp_nest_lock_t) 0 | |
| 34 | + | |
| 35 | +#define omp_get_wtime() 0 | |
| 36 | +#define omp_get_wtick() 0 | |
| 37 | + | |
| 38 | +#endif | |
| @@ -193,6 +193,7 @@ static int flow(sox_effect_t * effp, · 192 unmodified lines | ||
| 193 | 193 | *isamp = *osamp = len; |
| 194 | 194 | |
| 195 | 195 | while (sox_true) { |
| 196 | + SOX_SAMPLE_LOCALS; | |
| 196 | 197 | if (p->read == p->step_size) { |
| 197 | 198 | memmove(p->buf, p->buf + p->step_size, |
| 198 | 199 | (p->dft_size - p->step_size) * sizeof(*p->buf)); |
| @@ -152,6 +152,7 @@ static int flow(sox_effect_t * effp, const sox_sample_t * ibuf, · 151 unmodified lines | ||
| 152 | 152 | { |
| 153 | 153 | priv_t * p = (priv_t *)effp->priv; |
| 154 | 154 | size_t c, idone = 0, odone = 0; |
| 155 | + SOX_SAMPLE_LOCALS; | |
| 155 | 156 | *isamp /= effp->in_signal.channels; |
| 156 | 157 | *osamp /= effp->in_signal.channels; |
| 157 | 158 | |
| @@ -140,6 +140,7 @@ static int sox_stat_flow(sox_effect_t * effp, const sox_sample_t *ibuf, sox_samp · 139 unmodified lines | ||
| 140 | 140 | |
| 141 | 141 | if (stat->fft) { |
| 142 | 142 | for (x = 0; x < len; x++) { |
| 143 | + SOX_SAMPLE_LOCALS; | |
| 143 | 144 | stat->re_in[stat->fft_offset++] = SOX_SAMPLE_TO_FLOAT_32BIT(ibuf[x], effp->clips); |
| 144 | 145 | |
| 145 | 146 | if (stat->fft_offset >= stat->fft_size) { |
| @@ -264,6 +264,7 @@ static int flow(sox_effect_t * effp, const sox_sample_t * ibuf, · 263 unmodified lines | ||
| 264 | 264 | priv_t * p = (priv_t *)effp->priv; |
| 265 | 265 | size_t i, odone = *osamp /= effp->in_signal.channels; |
| 266 | 266 | float const * s = tempo_output(p->tempo, NULL, &odone); |
| 267 | + SOX_SAMPLE_LOCALS; | |
| 267 | 268 | |
| 268 | 269 | for (i = 0; i < odone * effp->in_signal.channels; ++i) |
| 269 | 270 | *obuf++ = SOX_FLOAT_32BIT_TO_SAMPLE(*s++, effp->clips); |
| @@ -347,6 +347,7 @@ static size_t read_samples(sox_format_t * ft, sox_sample_t * buf, · 346 unmodified lines | ||
| 347 | 347 | /* Read the data in the file */ |
| 348 | 348 | if (v->size <= 4) { |
| 349 | 349 | if (!v->adpcm.setup.sign) { |
| 350 | + SOX_SAMPLE_LOCALS; | |
| 350 | 351 | if (lsx_readb(ft, &uc) == SOX_EOF) { |
| 351 | 352 | lsx_warn("VOC input: short file"); |
| 352 | 353 | v->block_remaining = 0; |
| @@ -489,6 +490,7 @@ static size_t write_samples(sox_format_t * ft, const sox_sample_t * buf, · 136 unmodified lines | ||
| 489 | 490 | } |
| 490 | 491 | v->samples += len; |
| 491 | 492 | while (done < len) { |
| 493 | + SOX_SAMPLE_LOCALS; | |
| 492 | 494 | if (ft->encoding.bits_per_sample == 8) { |
| 493 | 495 | uc = SOX_SAMPLE_TO_UNSIGNED_8BIT(*buf++, ft->clips); |
| 494 | 496 | lsx_writeb(ft, uc); |
| @@ -331,6 +331,7 @@ static size_t wavgsmwrite(sox_format_t * ft, const sox_sample_t *buf, size_t len · 330 unmodified lines | ||
| 331 | 331 | ft->sox_errno = SOX_SUCCESS; |
| 332 | 332 | |
| 333 | 333 | while (done < len) { |
| 334 | + SOX_SAMPLE_LOCALS; | |
| 334 | 335 | while ((wav->gsmindex < 160*2) && (done < len)) |
| 335 | 336 | wav->gsmsample[(wav->gsmindex)++] = |
| 336 | 337 | SOX_SAMPLE_TO_SIGNED_16BIT(buf[done++], ft->clips); |
| @@ -71,6 +71,7 @@ static size_t read_samples(sox_format_t * ft, sox_sample_t * buf, size_t len) · 70 unmodified lines | ||
| 71 | 71 | priv_t * p = (priv_t *)ft->priv; |
| 72 | 72 | size_t i, actual = WavpackUnpackSamples(p->codec, buf, (uint32_t) len / ft->signal.channels) * ft->signal.channels; |
| 73 | 73 | for (i = 0; i < actual; ++i) switch (ft->encoding.bits_per_sample) { |
| 74 | + SOX_SAMPLE_LOCALS; | |
| 74 | 75 | case 8: buf[i] = SOX_SIGNED_8BIT_TO_SAMPLE(buf[i],); break; |
| 75 | 76 | case 16: buf[i] = SOX_SIGNED_16BIT_TO_SAMPLE(buf[i],); break; |
| 76 | 77 | case 24: buf[i] = SOX_SIGNED_24BIT_TO_SAMPLE(buf[i],); break; |
| @@ -119,6 +120,7 @@ static size_t write_samples(sox_format_t * ft, const sox_sample_t * buf, size_t · 42 unmodified lines | ||
| 119 | 120 | int result; |
| 120 | 121 | |
| 121 | 122 | for (i = 0; i < len; ++i) switch (ft->encoding.bits_per_sample) { |
| 123 | + SOX_SAMPLE_LOCALS; | |
| 122 | 124 | case 8: obuf[i] = SOX_SAMPLE_TO_SIGNED_8BIT(buf[i], ft->clips); break; |
| 123 | 125 | case 16: obuf[i] = SOX_SAMPLE_TO_SIGNED_16BIT(buf[i], ft->clips); break; |
| 124 | 126 | case 24: obuf[i] = SOX_SAMPLE_TO_SIGNED_24BIT(buf[i], ft->clips) << 8; |