diff --git a/libcelt/Makefile.am b/libcelt/Makefile.am index 2a2670a170e68b3472c5fad4a201e73169a8eb85..42dfa004fbda8e7e4a01d65bd07bf9f05374f548 100644 --- a/libcelt/Makefile.am +++ b/libcelt/Makefile.am @@ -32,7 +32,7 @@ noinst_HEADERS = _kiss_fft_guts.h arch.h bands.h fixed_c5x.h fixed_c6x.h \ noinst_PROGRAMS = testcelt dump_modes testcelt_SOURCES = testcelt.c testcelt_LDADD = libcelt@LIBCELT_SUFFIX@.la -INCLUDES = +INCLUDES = #libcelt@LIBCELT_SUFFIX@_la_LIBADD = dump_modes_SOURCES = dump_modes.c diff --git a/libcelt/_kiss_fft_guts.h b/libcelt/_kiss_fft_guts.h index 97e8c07d9a9d48c173d7fe7a61e06342b73ce0c8..4c39073db85b5a307edb6a7e9a7081e05ab5a6b7 100644 --- a/libcelt/_kiss_fft_guts.h +++ b/libcelt/_kiss_fft_guts.h @@ -50,7 +50,7 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND #else /* DOUBLE_PRECISION */ # define FRACBITS 15 -# define SAMPPROD opus_int32 +# define SAMPPROD opus_int32 #define SAMP_MAX 32767 #define TRIG_UPSCALE 1 #define EXT32(a) EXTEND32(a) @@ -186,7 +186,7 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND (x)->r = KISS_FFT_COS(phase);\ (x)->i = KISS_FFT_SIN(phase);\ }while(0) - + #define kf_cexp2(x,phase) \ do{ \ (x)->r = TRIG_UPSCALE*celt_cos_norm((phase));\ diff --git a/libcelt/arch.h b/libcelt/arch.h index 35c609b224d5df7b5d86672b5371743432582386..1ce1cda686b312b1f9f3c8bf0b691bcce8613c7b 100644 --- a/libcelt/arch.h +++ b/libcelt/arch.h @@ -10,14 +10,14 @@ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - + - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - + - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR @@ -247,7 +247,7 @@ typedef float celt_mask; #if defined (CONFIG_TI_C54X) || defined (CONFIG_TI_C55X) /* 2 on TI C5x DSP */ -#define BYTES_PER_CHAR 2 +#define BYTES_PER_CHAR 2 #define BITS_PER_CHAR 16 #define LOG2_BITS_PER_CHAR 4 @@ -259,12 +259,12 @@ typedef float celt_mask; #endif /* !CONFIG_TI_C54X */ -#ifndef GLOBAL_STACK_SIZE +#ifndef GLOBAL_STACK_SIZE #ifdef FIXED_POINT #define GLOBAL_STACK_SIZE 100000 #else #define GLOBAL_STACK_SIZE 100000 #endif -#endif +#endif #endif /* ARCH_H */ diff --git a/libcelt/bands.c b/libcelt/bands.c index 40afd650b3f62c4bc041bc23c9aa886d7a8726a7..f86dea3ea93a4285f55ad7d28518ef1bad3433f9 100644 --- a/libcelt/bands.c +++ b/libcelt/bands.c @@ -1,19 +1,19 @@ /* Copyright (c) 2007-2008 CSIRO Copyright (c) 2007-2009 Xiph.Org Foundation - Copyright (c) 2008-2009 Gregory Maxwell + Copyright (c) 2008-2009 Gregory Maxwell Written by Jean-Marc Valin and Gregory Maxwell */ /* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - + - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - + - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR @@ -89,12 +89,12 @@ void compute_band_energies(const CELTMode *m, const celt_sig *X, celt_ener *bank int j; opus_val32 maxval=0; opus_val32 sum = 0; - + j=M*eBands[i]; do { maxval = MAX32(maxval, X[j+c*N]); maxval = MAX32(maxval, -X[j+c*N]); } while (++j<M*eBands[i+1]); - + if (maxval > 0) { int shift = celt_ilog2(maxval)-10; @@ -406,7 +406,7 @@ int spreading_decision(const CELTMode *m, celt_norm *X, int *average, const opus_int16 * restrict eBands = m->eBands; int decision; int hf_sum=0; - + N0 = M*m->shortMdctSize; if (M*(eBands[end]-eBands[end-1]) <= 8) diff --git a/libcelt/bands.h b/libcelt/bands.h index b8c3fd2782d0536932ce139f1c14bc0ab2700855..80f62c8640b61a634c66ce7491ceb648dfb09a44 100644 --- a/libcelt/bands.h +++ b/libcelt/bands.h @@ -1,19 +1,19 @@ /* Copyright (c) 2007-2008 CSIRO Copyright (c) 2007-2009 Xiph.Org Foundation - Copyright (c) 2008-2009 Gregory Maxwell + Copyright (c) 2008-2009 Gregory Maxwell Written by Jean-Marc Valin and Gregory Maxwell */ /* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - + - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - + - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR @@ -36,8 +36,8 @@ #include "entdec.h" #include "rate.h" -/** Compute the amplitude (sqrt energy) in each of the bands - * @param m Mode data +/** Compute the amplitude (sqrt energy) in each of the bands + * @param m Mode data * @param X Spectrum * @param bands Square root of the energy for each band (returned) */ @@ -45,16 +45,16 @@ void compute_band_energies(const CELTMode *m, const celt_sig *X, celt_ener *band /*void compute_noise_energies(const CELTMode *m, const celt_sig *X, const opus_val16 *tonality, celt_ener *bank);*/ -/** Normalise each band of X such that the energy in each band is +/** Normalise each band of X such that the energy in each band is equal to 1 - * @param m Mode data + * @param m Mode data * @param X Spectrum (returned normalised) * @param bands Square root of the energy for each band */ void normalise_bands(const CELTMode *m, const celt_sig * restrict freq, celt_norm * restrict X, const celt_ener *bands, int end, int _C, int M); /** Denormalise each band of X to restore full amplitude - * @param m Mode data + * @param m Mode data * @param X Spectrum (returned de-normalised) * @param bands Square root of the energy for each band */ @@ -76,7 +76,7 @@ void measure_norm_mse(const CELTMode *m, float *X, float *X0, float *bandE, floa void haar1(celt_norm *X, int N0, int stride); /** Quantisation/encoding of the residual spectrum - * @param m Mode data + * @param m Mode data * @param X Residual (normalised) * @param total_bits Total number of bits that can be used for the frame (including the ones already spent) * @param enc Entropy encoder diff --git a/libcelt/c64_fft.c b/libcelt/c64_fft.c index f000831a786794d975232a6323adf30f4e58398b..f1bcbc3f16f3238ccd9fc1c739c097bd723b38ba 100644 --- a/libcelt/c64_fft.c +++ b/libcelt/c64_fft.c @@ -3,14 +3,14 @@ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - + - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - + - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR @@ -81,7 +81,7 @@ static int d2i(double d) int gen_twiddle16(short *w, int n, double scale) { int i, j, k; - + for (j = 1, k = 0; j < n >> 2; j = j << 2) { for (i = 0; i < n >> 2; i += j << 1) @@ -90,21 +90,21 @@ int gen_twiddle16(short *w, int n, double scale) w[k + 10] = d2s(scale * sin(6.0 * PI * (i + j) / n)); w[k + 9] = d2s(scale * cos(6.0 * PI * (i ) / n)); w[k + 8] = d2s(scale * sin(6.0 * PI * (i ) / n)); - + w[k + 7] = d2s(scale * cos(4.0 * PI * (i + j) / n)); w[k + 6] = d2s(scale * sin(4.0 * PI * (i + j) / n)); w[k + 5] = d2s(scale * cos(4.0 * PI * (i ) / n)); w[k + 4] = d2s(scale * sin(4.0 * PI * (i ) / n)); - + w[k + 3] = d2s(scale * cos(2.0 * PI * (i + j) / n)); w[k + 2] = d2s(scale * sin(2.0 * PI * (i + j) / n)); w[k + 1] = d2s(scale * cos(2.0 * PI * (i ) / n)); w[k + 0] = d2s(scale * sin(2.0 * PI * (i ) / n)); - + k += 12; } } - + return k; } @@ -129,24 +129,24 @@ int gen_twiddle16(short *w, int n, double scale) int gen_twiddle32(int *w, int n, double scale) { int i, j, k, s=0, t; - + for (j = 1, k = 0; j < n >> 2; j = j << 2, s++) { for (i = t=0; i < n >> 2; i += j, t++) { w[k + 5] = d2i(scale * cos(6.0 * PI * i / n)); w[k + 4] = d2i(scale * sin(6.0 * PI * i / n)); - + w[k + 3] = d2i(scale * cos(4.0 * PI * i / n)); w[k + 2] = d2i(scale * sin(4.0 * PI * i / n)); - + w[k + 1] = d2i(scale * cos(2.0 * PI * i / n)); w[k + 0] = d2i(scale * sin(2.0 * PI * i / n)); - + k += 6; } } - + return k; } @@ -193,7 +193,7 @@ c64_fft_t *c64_fft16_alloc(int length, int x, int y) } -c64_fft_t *c64_fft32_alloc(int length, int x, int y) +c64_fft_t *c64_fft32_alloc(int length, int x, int y) { c64_fft_t *state; int i, c; @@ -228,7 +228,7 @@ c64_fft_t *c64_fft32_alloc(int length, int x, int y) } -void c64_fft16_free(c64_fft_t *state) +void c64_fft16_free(c64_fft_t *state) { c64_fft32_free(state); } @@ -260,7 +260,7 @@ void c64_fft16_inplace(c64_fft_t * restrict state, opus_int16 *X) X[2*i+0] = cout[2*i+0]; X[2*i+1] = cout[2*i+1]; } - + RESTORE_STACK; } @@ -292,7 +292,7 @@ void c64_ifft16(c64_fft_t * restrict state, const opus_int16 *X, opus_int16 *Y) SAVE_STACK; ALLOC(cin, state->nfft*2, opus_int16); - if ((opus_int32)Y & 7) + if ((opus_int32)Y & 7) ALLOC(cout, state->nfft*2, opus_int16); else cout = Y; @@ -311,7 +311,7 @@ void c64_ifft16(c64_fft_t * restrict state, const opus_int16 *X, opus_int16 *Y) Y[2*i+0] = cout[2*i+0]; Y[2*i+1] = cout[2*i+1]; } - + RESTORE_STACK; } @@ -328,7 +328,7 @@ void c64_ifft32(c64_fft_t * restrict state, const opus_int32 *X, opus_int32 *Y) for (i = 0; i < state->nfft; i++) { // No need to scale for this one but still need to save the input // because the fft is going to change it! - cin[2*i+0] = X[2*i+0]; + cin[2*i+0] = X[2*i+0]; cin[2*i+1] = X[2*i+1]; } diff --git a/libcelt/c64_fft.h b/libcelt/c64_fft.h index 61592a8ccfef70c21e7ad37718d9d173d1ec95e3..8a3a5588ecbfc5e2676ceeb14155ea2e5ccf6c27 100644 --- a/libcelt/c64_fft.h +++ b/libcelt/c64_fft.h @@ -3,14 +3,14 @@ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - + - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - + - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR diff --git a/libcelt/celt.c b/libcelt/celt.c index 2ab643e72f9b7612ced661ec6031f385f5c1cd39..5e962e36ded4ee2e9490c339b83f17a523224513 100644 --- a/libcelt/celt.c +++ b/libcelt/celt.c @@ -1,19 +1,19 @@ /* Copyright (c) 2007-2008 CSIRO Copyright (c) 2007-2010 Xiph.Org Foundation - Copyright (c) 2008 Gregory Maxwell + Copyright (c) 2008 Gregory Maxwell Written by Jean-Marc Valin and Gregory Maxwell */ /* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - + - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - + - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR @@ -119,7 +119,7 @@ static int resampling_factor(opus_int32 rate) return ret; } -/** Encoder state +/** Encoder state @brief Encoder state */ struct CELTEncoder { @@ -127,7 +127,7 @@ struct CELTEncoder { int overlap; int channels; int stream_channels; - + int force_intra; int clip; int disable_pf; @@ -249,7 +249,7 @@ CELTEncoder *celt_encoder_init_custom(CELTEncoder *st, const CELTMode *mode, int } CELT_MEMSET((char*)st, 0, celt_encoder_get_size_custom(mode, channels)); - + st->mode = mode; st->overlap = mode->overlap; st->stream_channels = st->channels = channels; @@ -390,7 +390,7 @@ static int transient_analysis(const opus_val32 * restrict in, int len, int C, return is_transient; } -/** Apply window and compute the MDCT for all sub-frames and +/** Apply window and compute the MDCT for all sub-frames and all channels in a frame */ static void compute_mdcts(const CELTMode *mode, int shortBlocks, celt_sig * restrict in, celt_sig * restrict out, int _C, int LM) { @@ -427,7 +427,7 @@ static void compute_mdcts(const CELTMode *mode, int shortBlocks, celt_sig * rest } } -/** Compute the IMDCT and apply window for all sub-frames and +/** Compute the IMDCT and apply window for all sub-frames and all channels in a frame */ static void compute_inv_mdcts(const CELTMode *mode, int shortBlocks, celt_sig *X, celt_sig * restrict out_mem[], @@ -445,7 +445,7 @@ static void compute_inv_mdcts(const CELTMode *mode, int shortBlocks, celt_sig *X int N2 = N; int B = 1; SAVE_STACK; - + ALLOC(x, N+overlap, opus_val32); ALLOC(tmp, N, opus_val32); @@ -1509,7 +1509,7 @@ int celt_encode_with_ec_float(CELTEncoder * restrict st, const celt_sig * pcm, i #ifdef MEASURE_NORM_MSE float X0[3000]; float bandE0[60]; - c=0; do + c=0; do for (i=0;i<N;i++) X0[i+c*N] = X[i+c*N]; while (++c<C); @@ -1654,7 +1654,7 @@ int celt_encode_with_ec_float(CELTEncoder * restrict st, const celt_sig * pcm, i /* If there's any room left (can only happen for very high rates), it's already filled with zeros */ ec_enc_done(enc); - + if (st->signalling) nbCompressedBytes++; @@ -1737,7 +1737,7 @@ int celt_encode_float(CELTEncoder * restrict st, const float * pcm, int frame_si int celt_encoder_ctl(CELTEncoder * restrict st, int request, ...) { va_list ap; - + va_start(ap, request); switch (request) { @@ -1864,7 +1864,7 @@ bad_request: /**********************************************************************/ #define DECODE_BUFFER_SIZE 2048 -/** Decoder state +/** Decoder state @brief Decoder state */ struct CELTDecoder { @@ -1892,7 +1892,7 @@ struct CELTDecoder { int postfilter_tapset_old; celt_sig preemph_memD[2]; - + celt_sig _decode_mem[1]; /* Size = channels*(DECODE_BUFFER_SIZE+mode->overlap) */ /* opus_val16 lpc[], Size = channels*LPC_ORDER */ /* opus_val16 oldEBands[], Size = 2*mode->nbEBands */ @@ -2008,7 +2008,7 @@ static void celt_decode_lost(CELTDecoder * restrict st, opus_val16 * restrict pc opus_val16 *oldBandE, *oldLogE2, *backgroundLogE; int plc=1; SAVE_STACK; - + c=0; do { decode_mem[c] = st->_decode_mem + c*(DECODE_BUFFER_SIZE+st->overlap); out_mem[c] = decode_mem[c]+DECODE_BUFFER_SIZE-MAX_PERIOD; @@ -2024,7 +2024,7 @@ static void celt_decode_lost(CELTDecoder * restrict st, opus_val16 * restrict pc out_syn[1] = out_mem[1]+MAX_PERIOD-N; len = N+st->mode->overlap; - + if (st->loss_count >= 5) { VARDECL(celt_sig, freq); @@ -2236,7 +2236,7 @@ static void celt_decode_lost(CELTDecoder * restrict st, opus_val16 * restrict pc } deemphasis(out_syn, pcm, N, C, st->downsample, st->mode->preemph, st->preemph_memD); - + st->loss_count++; RESTORE_STACK; @@ -2354,7 +2354,7 @@ int celt_decode_with_ec_float(CELTDecoder * restrict st, const unsigned char *da for (i=0;i<M*st->mode->eBands[st->start];i++) X[c*N+i] = 0; while (++c<C); - c=0; do + c=0; do for (i=M*st->mode->eBands[effEnd];i<N;i++) X[c*N+i] = 0; while (++c<C); @@ -2491,7 +2491,7 @@ int celt_decode_with_ec_float(CELTDecoder * restrict st, const unsigned char *da codedBands = compute_allocation(st->mode, st->start, st->end, offsets, cap, alloc_trim, &intensity, &dual_stereo, bits, &balance, pulses, fine_quant, fine_priority, C, LM, dec, 0, 0); - + unquant_fine_energy(st->mode, st->start, st->end, oldBandE, fine_quant, dec, C); /* Decode fixed codebook */ @@ -2635,13 +2635,13 @@ int celt_decode_with_ec_float(CELTDecoder * restrict st, const unsigned char *da C = CHANNELS(st->channels); N = frame_size; - + ALLOC(out, C*N, opus_int16); ret=celt_decode_with_ec(st, data, len, out, frame_size, dec); if (ret>0) for (j=0;j<C*ret;j++) pcm[j]=out[j]*(1.f/32768.f); - + RESTORE_STACK; return ret; } @@ -2666,7 +2666,7 @@ int celt_decode_with_ec(CELTDecoder * restrict st, const unsigned char *data, in if (ret>0) for (j=0;j<C*ret;j++) pcm[j] = FLOAT2INT16 (out[j]); - + RESTORE_STACK; return ret; } @@ -2782,7 +2782,6 @@ const char *celt_strerror(int error) }; if (error > 0 || error < -7) return "unknown error"; - else + else return error_strings[-error]; } - diff --git a/libcelt/celt.h b/libcelt/celt.h index 0ebf3de8dc3e0dde72b873a87bde93b63ad1fdb0..29e28539c1fd505ee2e56e521c602bbfa50b47c7 100644 --- a/libcelt/celt.h +++ b/libcelt/celt.h @@ -1,6 +1,6 @@ /* Copyright (c) 2007-2008 CSIRO Copyright (c) 2007-2009 Xiph.Org Foundation - Copyright (c) 2008 Gregory Maxwell + Copyright (c) 2008 Gregory Maxwell Written by Jean-Marc Valin and Gregory Maxwell */ /** @file celt.h @@ -11,14 +11,14 @@ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - + - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - + - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR @@ -124,7 +124,7 @@ extern "C" { -/** Contains the state of an encoder. One encoder state is needed +/** Contains the state of an encoder. One encoder state is needed for each stream. It is initialised once at the beginning of the stream. Do *not* re-initialise the state for every frame. @brief Encoder state @@ -138,7 +138,7 @@ typedef struct CELTDecoder CELTDecoder; /** The mode contains all the information necessary to create an encoder. Both the encoder and decoder need to be initialised - with exactly the same mode, otherwise the quality will be very + with exactly the same mode, otherwise the quality will be very bad */ typedef struct CELTMode CELTMode; @@ -148,18 +148,18 @@ typedef struct CELTMode CELTMode; /* Mode calls */ -/** Creates a new mode struct. This will be passed to an encoder or - decoder. The mode MUST NOT BE DESTROYED until the encoders and +/** Creates a new mode struct. This will be passed to an encoder or + decoder. The mode MUST NOT BE DESTROYED until the encoders and decoders that use it are destroyed as well. @param Fs Sampling rate (32000 to 96000 Hz) - @param frame_size Number of samples (per channel) to encode in each + @param frame_size Number of samples (per channel) to encode in each packet (even values; 64 - 512) @param error Returned error code (if NULL, no error will be returned) @return A newly created mode */ CELT_EXPORT CELTMode *celt_mode_create(opus_int32 Fs, int frame_size, int *error); -/** Destroys a mode struct. Only call this after all encoders and +/** Destroys a mode struct. Only call this after all encoders and decoders using this mode are destroyed as well. @param mode Mode to be destroyed */ @@ -171,7 +171,7 @@ CELT_EXPORT int celt_encoder_get_size(int channels); CELT_EXPORT int celt_encoder_get_size_custom(const CELTMode *mode, int channels); -/** Creates a new encoder state. Each stream needs its own encoder +/** Creates a new encoder state. Each stream needs its own encoder state (can't be shared across simultaneous streams). @param channels Number of channels @param error Returns an error code @@ -182,7 +182,7 @@ CELT_EXPORT CELTEncoder *celt_encoder_create(int sampling_rate, int channels, in /** Creates a new encoder state. Each stream needs its own encoder state (can't be shared across simultaneous streams). @param mode Contains all the information about the characteristics of - * the stream (must be the same characteristics as used for the + * the stream (must be the same characteristics as used for the * decoder) @param channels Number of channels @param error Returns an error code @@ -201,8 +201,8 @@ CELT_EXPORT void celt_encoder_destroy(CELTEncoder *st); /** Encodes a frame of audio. @param st Encoder state - @param pcm PCM audio in float format, with a normal range of ±1.0. - * Samples with a range beyond ±1.0 are supported but will + @param pcm PCM audio in float format, with a normal range of +/-1.0. + * Samples with a range beyond +/-1.0 are supported but will * be clipped by decoders using the integer API and should * only be used if it is known that the far end supports * extended dynmaic range. There must be exactly @@ -235,7 +235,7 @@ CELT_EXPORT int celt_encode_float(CELTEncoder *st, const float *pcm, int frame_s */ CELT_EXPORT int celt_encode(CELTEncoder *st, const opus_int16 *pcm, int frame_size, unsigned char *compressed, int maxCompressedBytes); -/** Query and set encoder parameters +/** Query and set encoder parameters @param st Encoder state @param request Parameter to change or query @param value Pointer to a 32-bit int value @@ -284,7 +284,7 @@ CELT_EXPORT void celt_decoder_destroy(CELTDecoder *st); @param len Number of bytes to read from "data". This MUST be exactly the number of bytes returned by the encoder. Using a larger value WILL NOT WORK. @param pcm One frame (frame_size samples per channel) of decoded PCM will be - returned here in float format. + returned here in float format. @return Error code. */ CELT_EXPORT int celt_decode_float(CELTDecoder *st, const unsigned char *data, int len, float *pcm, int frame_size); @@ -295,7 +295,7 @@ CELT_EXPORT int celt_decode_float(CELTDecoder *st, const unsigned char *data, in @param len Number of bytes to read from "data". This MUST be exactly the number of bytes returned by the encoder. Using a larger value WILL NOT WORK. @param pcm One frame (frame_size samples per channel) of decoded PCM will be - returned here in 16-bit PCM format (native endian). + returned here in 16-bit PCM format (native endian). @return Error code. */ CELT_EXPORT int celt_decode(CELTDecoder *st, const unsigned char *data, int len, opus_int16 *pcm, int frame_size); diff --git a/libcelt/cwrs.c b/libcelt/cwrs.c index eda8eef7179a16e78469131026e95557210e2b61..940acbe2115d4f3b56e20fe547dcc36743b99e74 100644 --- a/libcelt/cwrs.c +++ b/libcelt/cwrs.c @@ -503,7 +503,7 @@ static void cwrsi5(int _k,opus_uint32 _i,int *_y){ } else if(p>_i)kr=_k-1; else break; - } + } } _i-=p; yj-=_k; diff --git a/libcelt/cwrs.h b/libcelt/cwrs.h index 24e37580a130165dceed3f0b8cbc00c09faa95eb..515a4a3c0a4c2954c8dcffd52ab14a18e27628ca 100644 --- a/libcelt/cwrs.h +++ b/libcelt/cwrs.h @@ -6,14 +6,14 @@ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - + - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - + - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR diff --git a/libcelt/dump_modes.c b/libcelt/dump_modes.c index 6875808a7f009a14653f1995848c2da64ca59e5b..a3976936d23672e5dfeced83376045874db74aee 100644 --- a/libcelt/dump_modes.c +++ b/libcelt/dump_modes.c @@ -5,14 +5,14 @@ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - + - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - + - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR @@ -80,7 +80,7 @@ void dump_modes(FILE *file, CELTMode **modes, int nb_modes) fprintf(file, "#endif\n"); fprintf(file, "\n"); } - + fprintf(file, "#ifndef DEF_WINDOW%d\n", mode->overlap); fprintf(file, "#define DEF_WINDOW%d\n", mode->overlap); fprintf (file, "static const opus_val16 window%d[%d] = {\n", mode->overlap, mode->overlap); @@ -89,7 +89,7 @@ void dump_modes(FILE *file, CELTMode **modes, int nb_modes) fprintf (file, "};\n"); fprintf(file, "#endif\n"); fprintf(file, "\n"); - + if (!standard) { fprintf(file, "#ifndef DEF_ALLOC_VECTORS%d_%d\n", mode->Fs, mdctSize); diff --git a/libcelt/fixed_c5x.h b/libcelt/fixed_c5x.h index 8c680d5a489c1c983604513e555c10807ab150af..d7d82eeff8849b1bc651ba1327fd7fa6061a0181 100644 --- a/libcelt/fixed_c5x.h +++ b/libcelt/fixed_c5x.h @@ -7,14 +7,14 @@ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - + - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - + - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR @@ -60,7 +60,7 @@ static inline long IMUL32(long i, long j) #undef MULT16_16_Q15 #define MULT16_16_Q15(a,b) (_smpy(a,b)) -#undef MULT16_16SU +#undef MULT16_16SU #define MULT16_16SU(a,b) _lmpysu(a,b) #undef MULT_16_16 diff --git a/libcelt/fixed_c6x.h b/libcelt/fixed_c6x.h index ce7faf29650da8fc8e4d2b89a3f93b57050ce42b..48f07e6432a765cfba4d05d3e3f235085a1589e4 100644 --- a/libcelt/fixed_c6x.h +++ b/libcelt/fixed_c6x.h @@ -7,14 +7,14 @@ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - + - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - + - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR @@ -31,7 +31,7 @@ #ifndef FIXED_C6X_H #define FIXED_C6X_H -#undef MULT16_16SU +#undef MULT16_16SU #define MULT16_16SU(a,b) _mpysu(a,b) #undef MULT_16_16 diff --git a/libcelt/fixed_debug.h b/libcelt/fixed_debug.h index 353d080591ecf40b002fa9c4e058adff912ab887..de1bb58abe855f320d22bd1f1a8345c7c77ffac6 100644 --- a/libcelt/fixed_debug.h +++ b/libcelt/fixed_debug.h @@ -8,14 +8,14 @@ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - + - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - + - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR @@ -113,7 +113,7 @@ static inline int _EXTEND32(int x, char *file, int line) } #define SHR16(a, shift) _SHR16(a, shift, __FILE__, __LINE__) -static inline short _SHR16(int a, int shift, char *file, int line) +static inline short _SHR16(int a, int shift, char *file, int line) { int res; if (!VERIFY_SHORT(a) || !VERIFY_SHORT(shift)) @@ -127,7 +127,7 @@ static inline short _SHR16(int a, int shift, char *file, int line) return res; } #define SHL16(a, shift) _SHL16(a, shift, __FILE__, __LINE__) -static inline short _SHL16(int a, int shift, char *file, int line) +static inline short _SHL16(int a, int shift, char *file, int line) { int res; if (!VERIFY_SHORT(a) || !VERIFY_SHORT(shift)) @@ -141,7 +141,7 @@ static inline short _SHL16(int a, int shift, char *file, int line) return res; } -static inline int SHR32(long long a, int shift) +static inline int SHR32(long long a, int shift) { long long res; if (!VERIFY_INT(a) || !VERIFY_SHORT(shift)) @@ -156,7 +156,7 @@ static inline int SHR32(long long a, int shift) celt_mips+=2; return res; } -static inline int SHL32(long long a, int shift) +static inline int SHL32(long long a, int shift) { long long res; if (!VERIFY_INT(a) || !VERIFY_SHORT(shift)) @@ -187,7 +187,7 @@ static inline int SHL32(long long a, int shift) //#define SHL(a,shift) ((a) << (shift)) #define ADD16(a, b) _ADD16(a, b, __FILE__, __LINE__) -static inline short _ADD16(int a, int b, char *file, int line) +static inline short _ADD16(int a, int b, char *file, int line) { int res; if (!VERIFY_SHORT(a) || !VERIFY_SHORT(b)) @@ -204,7 +204,7 @@ static inline short _ADD16(int a, int b, char *file, int line) } #define SUB16(a, b) _SUB16(a, b, __FILE__, __LINE__) -static inline short _SUB16(int a, int b, char *file, int line) +static inline short _SUB16(int a, int b, char *file, int line) { int res; if (!VERIFY_SHORT(a) || !VERIFY_SHORT(b)) @@ -219,7 +219,7 @@ static inline short _SUB16(int a, int b, char *file, int line) } #define ADD32(a, b) _ADD32(a, b, __FILE__, __LINE__) -static inline int _ADD32(long long a, long long b, char *file, int line) +static inline int _ADD32(long long a, long long b, char *file, int line) { long long res; if (!VERIFY_INT(a) || !VERIFY_INT(b)) @@ -236,7 +236,7 @@ static inline int _ADD32(long long a, long long b, char *file, int line) } #define SUB32(a, b) _SUB32(a, b, __FILE__, __LINE__) -static inline int _SUB32(long long a, long long b, char *file, int line) +static inline int _SUB32(long long a, long long b, char *file, int line) { long long res; if (!VERIFY_INT(a) || !VERIFY_INT(b)) @@ -252,7 +252,7 @@ static inline int _SUB32(long long a, long long b, char *file, int line) #undef UADD32 #define UADD32(a, b) _UADD32(a, b, __FILE__, __LINE__) -static inline unsigned int _UADD32(unsigned long long a, unsigned long long b, char *file, int line) +static inline unsigned int _UADD32(unsigned long long a, unsigned long long b, char *file, int line) { long long res; if (!VERIFY_UINT(a) || !VERIFY_UINT(b)) @@ -270,7 +270,7 @@ static inline unsigned int _UADD32(unsigned long long a, unsigned long long b, c #undef USUB32 #define USUB32(a, b) _USUB32(a, b, __FILE__, __LINE__) -static inline unsigned int _USUB32(unsigned long long a, unsigned long long b, char *file, int line) +static inline unsigned int _USUB32(unsigned long long a, unsigned long long b, char *file, int line) { long long res; if (!VERIFY_UINT(a) || !VERIFY_UINT(b)) @@ -289,7 +289,7 @@ static inline unsigned int _USUB32(unsigned long long a, unsigned long long b, c /* result fits in 16 bits */ -static inline short MULT16_16_16(int a, int b) +static inline short MULT16_16_16(int a, int b) { int res; if (!VERIFY_SHORT(a) || !VERIFY_SHORT(b)) @@ -304,7 +304,7 @@ static inline short MULT16_16_16(int a, int b) } #define MULT16_16(a, b) _MULT16_16(a, b, __FILE__, __LINE__) -static inline int _MULT16_16(int a, int b, char *file, int line) +static inline int _MULT16_16(int a, int b, char *file, int line) { long long res; if (!VERIFY_SHORT(a) || !VERIFY_SHORT(b)) @@ -333,7 +333,7 @@ static inline int _MULT16_32_QX(int a, long long b, int Q, char *file, int line) fprintf (stderr, "MULT16_32_Q%d: inputs are not short+int: %d %d in %s: line %d\n", Q, (int)a, (int)b, file, line); } if (ABS32(b)>=((opus_val32)(1)<<(15+Q))) - fprintf (stderr, "MULT16_32_Q%d: second operand too large: %d %d in %s: line %d\n", Q, (int)a, (int)b, file, line); + fprintf (stderr, "MULT16_32_Q%d: second operand too large: %d %d in %s: line %d\n", Q, (int)a, (int)b, file, line); res = (((long long)a)*(long long)b) >> Q; if (!VERIFY_INT(res)) fprintf (stderr, "MULT16_32_Q%d: output is not int: %d*%d=%d in %s: line %d\n", Q, (int)a, (int)b,(int)res, file, line); @@ -352,7 +352,7 @@ static inline int MULT16_32_PX(int a, long long b, int Q) fprintf (stderr, "MULT16_32_P%d: inputs are not short+int: %d %d\n", Q, (int)a, (int)b); } if (ABS32(b)>=((opus_val32)(1)<<(15+Q))) - fprintf (stderr, "MULT16_32_Q%d: second operand too large: %d %d\n", Q, (int)a, (int)b); + fprintf (stderr, "MULT16_32_Q%d: second operand too large: %d %d\n", Q, (int)a, (int)b); res = ((((long long)a)*(long long)b) + (((opus_val32)(1)<<Q)>>1))>> Q; if (!VERIFY_INT(res)) fprintf (stderr, "MULT16_32_P%d: output is not int: %d*%d=%d\n", Q, (int)a, (int)b,(int)res); @@ -383,7 +383,7 @@ static inline int SATURATE(int a, int b) return a; } -static inline int MULT16_16_Q11_32(int a, int b) +static inline int MULT16_16_Q11_32(int a, int b) { long long res; if (!VERIFY_SHORT(a) || !VERIFY_SHORT(b)) @@ -397,7 +397,7 @@ static inline int MULT16_16_Q11_32(int a, int b) celt_mips+=3; return res; } -static inline short MULT16_16_Q13(int a, int b) +static inline short MULT16_16_Q13(int a, int b) { long long res; if (!VERIFY_SHORT(a) || !VERIFY_SHORT(b)) @@ -411,7 +411,7 @@ static inline short MULT16_16_Q13(int a, int b) celt_mips+=3; return res; } -static inline short MULT16_16_Q14(int a, int b) +static inline short MULT16_16_Q14(int a, int b) { long long res; if (!VERIFY_SHORT(a) || !VERIFY_SHORT(b)) @@ -427,7 +427,7 @@ static inline short MULT16_16_Q14(int a, int b) } #define MULT16_16_Q15(a, b) _MULT16_16_Q15(a, b, __FILE__, __LINE__) -static inline short _MULT16_16_Q15(int a, int b, char *file, int line) +static inline short _MULT16_16_Q15(int a, int b, char *file, int line) { long long res; if (!VERIFY_SHORT(a) || !VERIFY_SHORT(b)) @@ -444,7 +444,7 @@ static inline short _MULT16_16_Q15(int a, int b, char *file, int line) return res; } -static inline short MULT16_16_P13(int a, int b) +static inline short MULT16_16_P13(int a, int b) { long long res; if (!VERIFY_SHORT(a) || !VERIFY_SHORT(b)) @@ -461,7 +461,7 @@ static inline short MULT16_16_P13(int a, int b) celt_mips+=4; return res; } -static inline short MULT16_16_P14(int a, int b) +static inline short MULT16_16_P14(int a, int b) { long long res; if (!VERIFY_SHORT(a) || !VERIFY_SHORT(b)) @@ -478,7 +478,7 @@ static inline short MULT16_16_P14(int a, int b) celt_mips+=4; return res; } -static inline short MULT16_16_P15(int a, int b) +static inline short MULT16_16_P15(int a, int b) { long long res; if (!VERIFY_SHORT(a) || !VERIFY_SHORT(b)) @@ -498,7 +498,7 @@ static inline short MULT16_16_P15(int a, int b) #define DIV32_16(a, b) _DIV32_16(a, b, __FILE__, __LINE__) -static inline int _DIV32_16(long long a, long long b, char *file, int line) +static inline int _DIV32_16(long long a, long long b, char *file, int line) { long long res; if (b==0) @@ -524,7 +524,7 @@ static inline int _DIV32_16(long long a, long long b, char *file, int line) } #define DIV32(a, b) _DIV32(a, b, __FILE__, __LINE__) -static inline int _DIV32(long long a, long long b, char *file, int line) +static inline int _DIV32(long long a, long long b, char *file, int line) { long long res; if (b==0) diff --git a/libcelt/fixed_generic.h b/libcelt/fixed_generic.h index a235ffc9a386e72244b1cdd2a0e60a1b0b98ce90..b7686168367c97c83857cadcdb53413d705e3fb9 100644 --- a/libcelt/fixed_generic.h +++ b/libcelt/fixed_generic.h @@ -9,14 +9,14 @@ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - + - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - + - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR diff --git a/libcelt/float_cast.h b/libcelt/float_cast.h index df546adb91dae5289d4d0e6eed2e2ef4d345fe4e..ad164f74cd919f5f0a3e7d0c1ba1ed96504017b8 100644 --- a/libcelt/float_cast.h +++ b/libcelt/float_cast.h @@ -29,20 +29,20 @@ #ifndef FLOAT_CAST_H #define FLOAT_CAST_H -/*============================================================================ +/*============================================================================ ** On Intel Pentium processors (especially PIII and probably P4), converting -** from float to int is very slow. To meet the C specs, the code produced by -** most C compilers targeting Pentium needs to change the FPU rounding mode -** before the float to int conversion is performed. +** from float to int is very slow. To meet the C specs, the code produced by +** most C compilers targeting Pentium needs to change the FPU rounding mode +** before the float to int conversion is performed. ** -** Changing the FPU rounding mode causes the FPU pipeline to be flushed. It +** Changing the FPU rounding mode causes the FPU pipeline to be flushed. It ** is this flushing of the pipeline which is so slow. ** ** Fortunately the ISO C99 specifications define the functions lrint, lrintf, -** llrint and llrintf which fix this problem as a side effect. +** llrint and llrintf which fix this problem as a side effect. ** -** On Unix-like systems, the configure process should have detected the -** presence of these functions. If they weren't found we have to replace them +** On Unix-like systems, the configure process should have detected the +** presence of these functions. If they weren't found we have to replace them ** here with a standard C cast. */ @@ -62,7 +62,7 @@ /* These defines enable functionality introduced with the 1999 ISO C ** standard. They must be defined before the inclusion of math.h to -** engage them. If optimisation is enabled, these functions will be +** engage them. If optimisation is enabled, these functions will be ** inlined. With optimisation switched off, you have to link in the ** maths library using -lm. */ @@ -98,11 +98,11 @@ #include <math.h> - /* Win32 doesn't seem to have these functions. + /* Win32 doesn't seem to have these functions. ** Therefore implement inline versions of these functions here. */ - __inline long int + __inline long int float2int (float flt) { int intgr; diff --git a/libcelt/kiss_fft.c b/libcelt/kiss_fft.c index 689a85248a490ab5c2936a8f9318a41de4cb7c6f..5a42f3c916883ffc4d3254eebaaf3894cd0fff3a 100644 --- a/libcelt/kiss_fft.c +++ b/libcelt/kiss_fft.c @@ -119,7 +119,7 @@ static void kf_bfly4( C_MUL4(scratch[0],Fout[m] , *tw1 ); C_MUL4(scratch[1],Fout[m2] , *tw2 ); C_MUL4(scratch[2],Fout[m3] , *tw3 ); - + Fout->r = PSHR(Fout->r, 2); Fout->i = PSHR(Fout->i, 2); C_SUB( scratch[5] , *Fout, scratch[1] ); @@ -133,7 +133,7 @@ static void kf_bfly4( tw2 += fstride*2; tw3 += fstride*3; C_ADDTO( *Fout , scratch[3] ); - + Fout[m].r = scratch[5].r + scratch[4].i; Fout[m].i = scratch[5].i - scratch[4].r; Fout[m3].r = scratch[5].r - scratch[4].i; @@ -168,7 +168,7 @@ static void ki_bfly4( C_MULC(scratch[0],Fout[m] , *tw1 ); C_MULC(scratch[1],Fout[m2] , *tw2 ); C_MULC(scratch[2],Fout[m3] , *tw3 ); - + C_SUB( scratch[5] , *Fout, scratch[1] ); C_ADDTO(*Fout, scratch[1]); C_ADD( scratch[3] , scratch[0] , scratch[2] ); @@ -178,7 +178,7 @@ static void ki_bfly4( tw2 += fstride*2; tw3 += fstride*3; C_ADDTO( *Fout , scratch[3] ); - + Fout[m].r = scratch[5].r - scratch[4].i; Fout[m].i = scratch[5].i + scratch[4].r; Fout[m3].r = scratch[5].r + scratch[4].i; @@ -446,7 +446,7 @@ static void kf_work( const int p=*factors++; /* the radix */ const int m=*factors++; /* stage's fft length/p */ /*printf ("fft %d %d %d %d %d %d %d\n", p*m, m, p, s2, fstride*in_stride, N, m2);*/ - if (m!=1) + if (m!=1) kf_work( Fout , f, fstride*p, in_stride, factors,st, N*p, m); /* Compensate for longer twiddles table (when sharing) */ @@ -459,7 +459,7 @@ static void kf_work( case 3: kf_bfly3(Fout,fstride,st,m, N, m2); break; case 5: kf_bfly5(Fout,fstride,st,m, N, m2); break; #endif - } + } } @@ -477,7 +477,7 @@ static void ki_work( const int p=*factors++; /* the radix */ const int m=*factors++; /* stage's fft length/p */ /*printf ("fft %d %d %d %d %d %d %d\n", p*m, m, p, s2, fstride*in_stride, N, m2);*/ - if (m!=1) + if (m!=1) ki_work( Fout , f, fstride*p, in_stride, factors,st, N*p, m); /* Compensate for longer twiddles table (when sharing) */ @@ -490,7 +490,7 @@ static void ki_work( case 3: ki_bfly3(Fout,fstride,st,m, N, m2); break; case 5: ki_bfly5(Fout,fstride,st,m, N, m2); break; #endif - } + } } @@ -531,10 +531,10 @@ void compute_bitrev_table( /* facbuf is populated by p1,m1,p2,m2, ... - where + where p[i] * m[i] = m[i-1] m0 = n */ -static +static int kf_factor(int n,opus_int16 * facbuf) { int p=4; diff --git a/libcelt/kiss_fft.h b/libcelt/kiss_fft.h index 778d2f271c7bec262dd584dae0ff6052bc12bbfb..c6ced49082875b9b795f5a9a48f88b08ac615693 100644 --- a/libcelt/kiss_fft.h +++ b/libcelt/kiss_fft.h @@ -115,9 +115,9 @@ typedef struct kiss_fft_state{ //typedef struct kiss_fft_state* kiss_fft_cfg; -/** +/** * kiss_fft_alloc - * + * * Initialize a FFT (or IFFT) algorithm's cfg/state buffer. * * typical usage: kiss_fft_cfg mycfg=kiss_fft_alloc(1024,0,NULL,NULL); @@ -127,14 +127,14 @@ typedef struct kiss_fft_state{ * * If lenmem is NULL, then kiss_fft_alloc will allocate a cfg buffer using malloc. * The returned value should be free()d when done to avoid memory leaks. - * + * * The state can be placed in a user supplied buffer 'mem': * If lenmem is not NULL and mem is not NULL and *lenmem is large enough, * then the function places the cfg in mem and the size used in *lenmem * and returns mem. - * + * * If lenmem is not NULL and ( mem is NULL or *lenmem is not large enough), - * then the function returns NULL and places the minimum cfg + * then the function returns NULL and places the minimum cfg * buffer size in *lenmem. * */ @@ -159,7 +159,7 @@ void kiss_fft_free(const kiss_fft_state *cfg); #ifdef __cplusplus -} +} #endif #endif diff --git a/libcelt/laplace.c b/libcelt/laplace.c index 70b94fcf2d8627c1e5d57df1f8f6828c40741452..43c6229140d1056b402cec0f61cf250aae442290 100644 --- a/libcelt/laplace.c +++ b/libcelt/laplace.c @@ -5,14 +5,14 @@ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - + - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - + - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR diff --git a/libcelt/laplace.h b/libcelt/laplace.h index 6089631e389704a03bd7e3c9b402cb9309713851..4756a87183ed811a71b7f0a5a306a231c51782d9 100644 --- a/libcelt/laplace.h +++ b/libcelt/laplace.h @@ -5,14 +5,14 @@ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - + - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - + - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR diff --git a/libcelt/mathops.h b/libcelt/mathops.h index a6050f231c0e6f424289a15e567048fbe14dba41..28d8649483c86c80f60886323c9fbf3c6ecc872e 100644 --- a/libcelt/mathops.h +++ b/libcelt/mathops.h @@ -10,14 +10,14 @@ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - + - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - + - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR diff --git a/libcelt/mdct.c b/libcelt/mdct.c index e0f1ca529af14bc4a492770d264e9efacc63907b..37cf6c17e2698d822b3a7c9b5531362a481013d7 100644 --- a/libcelt/mdct.c +++ b/libcelt/mdct.c @@ -5,14 +5,14 @@ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - + - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - + - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR @@ -29,14 +29,14 @@ /* This is a simple MDCT implementation that uses a N/4 complex FFT to do most of the work. It should be relatively straightforward to plug in pretty much and FFT here. - - This replaces the Vorbis FFT (and uses the exact same API), which - was a bit too messy and that was ending up duplicating code + + This replaces the Vorbis FFT (and uses the exact same API), which + was a bit too messy and that was ending up duplicating code (might as well use the same FFT everywhere). - + The algorithm is similar to (and inspired from) Fabrice Bellard's MDCT implementation in FFMPEG, but has differences in signs, ordering - and scaling in many places. + and scaling in many places. */ #ifndef SKIP_CONFIG_H @@ -227,7 +227,7 @@ void clt_mdct_backward(const mdct_lookup *l, kiss_fft_scalar *in, kiss_fft_scala #else sine = (kiss_twiddle_scalar)2*M_PI*(.125f)/N; #endif - + /* Pre-rotate */ { /* Temp pointers to make it really clear to the compiler what we're doing */ @@ -235,7 +235,7 @@ void clt_mdct_backward(const mdct_lookup *l, kiss_fft_scalar *in, kiss_fft_scala const kiss_fft_scalar * restrict xp2 = in+N2-1; kiss_fft_scalar * restrict yp = f2; const kiss_twiddle_scalar *t = &l->trig[0]; - for(i=0;i<N4;i++) + for(i=0;i<N4;i++) { kiss_fft_scalar yr, yi; yr = -S_MUL(*xp2, t[i<<shift]) + S_MUL(*xp1,t[(N4-i)<<shift]); @@ -250,7 +250,7 @@ void clt_mdct_backward(const mdct_lookup *l, kiss_fft_scalar *in, kiss_fft_scala /* Inverse N/4 complex FFT. This one should *not* downscale even in fixed-point */ kiss_ifft(l->kfft[shift], (kiss_fft_cpx *)f2, (kiss_fft_cpx *)f); - + /* Post-rotate */ { kiss_fft_scalar * restrict fp = f; diff --git a/libcelt/mdct.h b/libcelt/mdct.h index 8d0af58599ff32a7897ce253c60d56fb04c0807b..9d43ae97810937b05eda0f1b208e10133db5c9da 100644 --- a/libcelt/mdct.h +++ b/libcelt/mdct.h @@ -5,14 +5,14 @@ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - + - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - + - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR @@ -29,14 +29,14 @@ /* This is a simple MDCT implementation that uses a N/4 complex FFT to do most of the work. It should be relatively straightforward to plug in pretty much and FFT here. - - This replaces the Vorbis FFT (and uses the exact same API), which - was a bit too messy and that was ending up duplicating code + + This replaces the Vorbis FFT (and uses the exact same API), which + was a bit too messy and that was ending up duplicating code (might as well use the same FFT everywhere). - + The algorithm is similar to (and inspired from) Fabrice Bellard's MDCT implementation in FFMPEG, but has differences in signs, ordering - and scaling in many places. + and scaling in many places. */ #ifndef MDCT_H @@ -58,7 +58,7 @@ void clt_mdct_clear(mdct_lookup *l); /** Compute a forward MDCT and scale by 4/N */ void clt_mdct_forward(const mdct_lookup *l, kiss_fft_scalar *in, kiss_fft_scalar *out, const opus_val16 *window, int overlap, int shift); -/** Compute a backward MDCT (no scaling) and performs weighted overlap-add +/** Compute a backward MDCT (no scaling) and performs weighted overlap-add (scales implicitly by 1/2) */ void clt_mdct_backward(const mdct_lookup *l, kiss_fft_scalar *in, kiss_fft_scalar *out, const opus_val16 * restrict window, int overlap, int shift); diff --git a/libcelt/modes.c b/libcelt/modes.c index 09b07a3a20b39e58a3c188cbdda864f0cd9a63d3..28c488b3c22c6d1e93cae22c71c368d4fc8d03d5 100644 --- a/libcelt/modes.c +++ b/libcelt/modes.c @@ -1,19 +1,19 @@ /* Copyright (c) 2007-2008 CSIRO Copyright (c) 2007-2009 Xiph.Org Foundation - Copyright (c) 2008 Gregory Maxwell + Copyright (c) 2008 Gregory Maxwell Written by Jean-Marc Valin and Gregory Maxwell */ /* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - + - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - + - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR @@ -115,10 +115,10 @@ static opus_int16 *compute_ebands(opus_int32 Fs, int frame_size, int res, int *n high = nBark-lin; *nbEBands = low+high; eBands = celt_alloc(sizeof(opus_int16)*(*nbEBands+2)); - + if (eBands==NULL) return NULL; - + /* Linear spacing (min_width) */ for (i=0;i<low;i++) eBands[i] = i; @@ -234,7 +234,7 @@ CELTMode *celt_mode_create(opus_int32 Fs, int frame_size, int *error) #if !defined(VAR_ARRAYS) && !defined(USE_ALLOCA) if (global_stack==NULL) goto failure; -#endif +#endif #endif #ifndef CUSTOM_MODES_ONLY @@ -261,7 +261,7 @@ CELTMode *celt_mode_create(opus_int32 Fs, int frame_size, int *error) #else /* The good thing here is that permutation of the arguments will automatically be invalid */ - + if (Fs < 8000 || Fs > 96000) { if (error) @@ -350,14 +350,14 @@ CELTMode *celt_mode_create(opus_int32 Fs, int frame_size, int *error) mode->effEBands = mode->nbEBands; while (mode->eBands[mode->effEBands] > mode->shortMdctSize) mode->effEBands--; - + /* Overlap must be divisible by 4 */ mode->overlap = ((mode->shortMdctSize>>2)<<2); compute_allocation_table(mode); if (mode->allocVectors==NULL) goto failure; - + window = (opus_val16*)celt_alloc(mode->overlap*sizeof(opus_val16)); if (window==NULL) goto failure; @@ -415,7 +415,7 @@ void celt_mode_destroy(CELTMode *mode) #endif /* CUSTOM_MODES_ONLY */ celt_free((opus_int16*)mode->eBands); celt_free((opus_int16*)mode->allocVectors); - + celt_free((opus_val16*)mode->window); celt_free((opus_int16*)mode->logN); diff --git a/libcelt/modes.h b/libcelt/modes.h index 1c025f5c924299e298e340f5326aace4d3f97e77..2bafe8f32497ed513a82921fe0fde486d904c4d1 100644 --- a/libcelt/modes.h +++ b/libcelt/modes.h @@ -1,19 +1,19 @@ /* Copyright (c) 2007-2008 CSIRO Copyright (c) 2007-2009 Xiph.Org Foundation - Copyright (c) 2008 Gregory Maxwell + Copyright (c) 2008 Gregory Maxwell Written by Jean-Marc Valin and Gregory Maxwell */ /* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - + - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - + - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR @@ -65,7 +65,7 @@ typedef struct { } PulseCache; /** Mode definition (opaque) - @brief Mode definition + @brief Mode definition */ struct CELTMode { opus_int32 Fs; @@ -75,10 +75,10 @@ struct CELTMode { int effEBands; opus_val16 preemph[4]; const opus_int16 *eBands; /**< Definition for each "pseudo-critical band" */ - + int nbAllocVectors; /**< Number of lines in the matrix below */ const unsigned char *allocVectors; /**< Number of bits in each band for several rates */ - + /* Stuff that could go in the {en,de}coder, but we save space this way */ mdct_lookup mdct; diff --git a/libcelt/opus_types.h b/libcelt/opus_types.h index 1ec6d7e723bc4e202a655004c44bdf9f57f5542f..f7933e45c4968a53ccd3568208d9274c686651f3 100644 --- a/libcelt/opus_types.h +++ b/libcelt/opus_types.h @@ -41,7 +41,7 @@ typedef uint16_t opus_uint16; typedef int32_t opus_int32; typedef uint32_t opus_uint32; -#elif defined(_WIN32) +#elif defined(_WIN32) # if defined(__CYGWIN__) # include <_G_config.h> diff --git a/libcelt/os_support.h b/libcelt/os_support.h index ada0887c7cbacf52081f693516849456c5360887..e80e70002126d6848a126b0b1f55765b5253e5c6 100644 --- a/libcelt/os_support.h +++ b/libcelt/os_support.h @@ -1,5 +1,5 @@ /* Copyright (C) 2007 Jean-Marc Valin - + File: os_support.h This is the (tiny) OS abstraction layer. Aside from math.h, this is the only place where system headers are allowed. @@ -39,12 +39,12 @@ #include <stdio.h> #include <stdlib.h> -/** CELT wrapper for calloc(). To do your own dynamic allocation, all you need to do is replace this function, celt_realloc and celt_free +/** CELT wrapper for calloc(). To do your own dynamic allocation, all you need to do is replace this function, celt_realloc and celt_free NOTE: celt_alloc needs to CLEAR THE MEMORY */ #ifndef OVERRIDE_CELT_ALLOC static inline void *celt_alloc (int size) { - /* WARNING: this is not equivalent to malloc(). If you want to use malloc() + /* WARNING: this is not equivalent to malloc(). If you want to use malloc() or your own allocator, YOU NEED TO CLEAR THE MEMORY ALLOCATED. Otherwise you will experience strange bugs */ return calloc(size,1); @@ -81,7 +81,7 @@ static inline void celt_free_scratch (void *ptr) #define CELT_COPY(dst, src, n) (memcpy((dst), (src), (n)*sizeof(*(dst)) + 0*((dst)-(src)) )) #endif -/** Copy n bytes of memory from src to dst, allowing overlapping regions. The 0* term +/** Copy n bytes of memory from src to dst, allowing overlapping regions. The 0* term provides compile-time type checking */ #ifndef OVERRIDE_CELT_MOVE #define CELT_MOVE(dst, src, n) (memmove((dst), (src), (n)*sizeof(*(dst)) + 0*((dst)-(src)) )) diff --git a/libcelt/pitch.c b/libcelt/pitch.c index 3173b151e6993a6be4c90ae5e6502771ea5f783d..6ade7e3b79037fb2e95bc84cdbcfb62e09505dcd 100644 --- a/libcelt/pitch.c +++ b/libcelt/pitch.c @@ -10,14 +10,14 @@ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - + - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - + - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR @@ -226,7 +226,7 @@ void pitch_search(const opus_val16 * restrict x_lp, opus_val16 * restrict y, offset = 1; else if ((a-c) > MULT16_32_Q15(QCONST16(.7f,15),b-c)) offset = -1; - else + else offset = 0; } else { offset = 0; diff --git a/libcelt/pitch.h b/libcelt/pitch.h index 291f5a698c202077beda55d005c57fee8c7d312c..5d5f92197663369a2e3b10dca8a5f14b65e49e08 100644 --- a/libcelt/pitch.h +++ b/libcelt/pitch.h @@ -10,14 +10,14 @@ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - + - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - + - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR diff --git a/libcelt/plc.c b/libcelt/plc.c index 64cb92aad1b710dcbe33d8af953008aaec634e70..1b3714332da8e849737dac9a21cf86f896693570 100644 --- a/libcelt/plc.c +++ b/libcelt/plc.c @@ -42,7 +42,7 @@ const opus_val32 *ac, /* in: [0...p] autocorrelation values */ int p ) { - int i, j; + int i, j; opus_val32 r; opus_val32 error = ac[0]; #ifdef FIXED_POINT @@ -144,7 +144,7 @@ void _celt_autocorr( opus_val32 *ac, /* out: [0...lag-1] ac values */ const opus_val16 *window, int overlap, - int lag, + int lag, int n ) { @@ -176,7 +176,7 @@ void _celt_autocorr( #endif while (lag>=0) { - for (i = lag, d = 0; i < n; i++) + for (i = lag, d = 0; i < n; i++) d += xx[i] * xx[i-lag]; ac[lag] = d; /*printf ("%f ", ac[lag]);*/ diff --git a/libcelt/quant_bands.c b/libcelt/quant_bands.c index 82dd8d60f897eaa037c247d9467dcf58b83d4266..118fcb1f0c120d1e2b98afa0ceb57dbaba2b5742 100644 --- a/libcelt/quant_bands.c +++ b/libcelt/quant_bands.c @@ -5,14 +5,14 @@ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - + - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - + - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR @@ -245,7 +245,7 @@ static int quant_coarse_energy_impl(const CELTMode *m, int start, int end, error[i+c*m->nbEBands] = PSHR32(f,7) - SHL16(qi,DB_SHIFT); badness += abs(qi0-qi); q = SHL32(EXTEND32(qi),DB_SHIFT); - + tmp = PSHR32(MULT16_16(coef,oldE),8) + prev[c] + SHL32(q,7); #ifdef FIXED_POINT tmp = MAX32(-QCONST32(28.f, DB_SHIFT+7), tmp); @@ -493,7 +493,7 @@ void unquant_fine_energy(const CELTMode *m, int start, int end, opus_val16 *oldE { if (fine_quant[i] <= 0) continue; - c=0; + c=0; do { int q2; opus_val16 offset; diff --git a/libcelt/quant_bands.h b/libcelt/quant_bands.h index 6694cf2652612177d6e784db82bb41b5d6ffe630..3700c4c236ef496494c0bd392d1941e17ff5fd1d 100644 --- a/libcelt/quant_bands.h +++ b/libcelt/quant_bands.h @@ -5,14 +5,14 @@ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - + - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - + - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR diff --git a/libcelt/rate.c b/libcelt/rate.c index c3d86a56d6dcb1218183adcb9375c1591ceff1bf..da331feb28e0ba505738fb5d63fb2762d0d7ee1c 100644 --- a/libcelt/rate.c +++ b/libcelt/rate.c @@ -5,14 +5,14 @@ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - + - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - + - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR @@ -537,7 +537,7 @@ int compute_allocation(const CELTMode *m, int start, int end, const int *offsets VARDECL(int, thresh); VARDECL(int, trim_offset); SAVE_STACK; - + total = IMAX(total, 0); len = m->nbEBands; skip_start = start; diff --git a/libcelt/rate.h b/libcelt/rate.h index f1cd433a20eaa56aa5dbc96303e7f382399eb369..41613f49a3626289fdf0a90ece15a9fbc0bed660 100644 --- a/libcelt/rate.h +++ b/libcelt/rate.h @@ -5,14 +5,14 @@ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - + - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - + - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR @@ -92,7 +92,7 @@ static inline int pulses2bits(const CELTMode *m, int band, int LM, int pulses) opus_int16 **compute_alloc_cache(CELTMode *m, int M); /** Compute the pulse allocation, i.e. how many pulses will go in each - * band. + * band. @param m mode @param offsets Requested increase or decrease in the number of bits for each band diff --git a/libcelt/stack_alloc.h b/libcelt/stack_alloc.h index 69daf0635de2c4e7857b10c5fdf10b4770826015..f266526f981fbbac776288c1ba6521002f9a5d27 100644 --- a/libcelt/stack_alloc.h +++ b/libcelt/stack_alloc.h @@ -8,14 +8,14 @@ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - + - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - + - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR @@ -127,14 +127,14 @@ extern char *global_stack_top; #define RESTORE_STACK ((global_stack = _saved_stack),VALGRIND_MAKE_MEM_NOACCESS(global_stack, global_stack_top-global_stack)) #define ALLOC_STACK char *_saved_stack; ((global_stack = (global_stack==0) ? ((global_stack_top=celt_alloc_scratch(GLOBAL_STACK_SIZE*2)+(GLOBAL_STACK_SIZE*2))-(GLOBAL_STACK_SIZE*2)) : global_stack),VALGRIND_MAKE_MEM_NOACCESS(global_stack, global_stack_top-global_stack)); _saved_stack = global_stack; -#else +#else #define ALIGN(stack, size) ((stack) += ((size) - (long)(stack)) & ((size) - 1)) #define PUSH(stack, size, type) (ALIGN((stack),sizeof(type)/sizeof(char)),(stack)+=(size)*(sizeof(type)/sizeof(char)),(type*)((stack)-(size)*(sizeof(type)/sizeof(char)))) #define RESTORE_STACK (global_stack = _saved_stack) #define ALLOC_STACK char *_saved_stack; (global_stack = (global_stack==0) ? celt_alloc_scratch(GLOBAL_STACK_SIZE) : global_stack); _saved_stack = global_stack; -#endif /*ENABLE_VALGRIND*/ +#endif /*ENABLE_VALGRIND*/ #include "os_support.h" #define VARDECL(type, var) type *var diff --git a/libcelt/testcelt.c b/libcelt/testcelt.c index 5f36c0e1655a2a667f206bf311748bd5f5901290..2afc75597932632577bbc8f311c4fb0da80faceb 100644 --- a/libcelt/testcelt.c +++ b/libcelt/testcelt.c @@ -5,14 +5,14 @@ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - + - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - + - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR @@ -67,7 +67,7 @@ int main(int argc, char *argv[]) "<input> <output>\n"); return 1; } - + rate = atoi(argv[1]); channels = atoi(argv[2]); frame_size = atoi(argv[3]); @@ -100,7 +100,7 @@ int main(int argc, char *argv[]) fprintf (stderr, "Could not open output file %s\n", argv[argc-1]); return 1; } - + enc = celt_encoder_create_custom(mode, channels, &err); if (err != 0) { @@ -120,7 +120,7 @@ int main(int argc, char *argv[]) complexity=atoi(argv[5]); celt_encoder_ctl(enc,CELT_SET_COMPLEXITY(complexity)); } - + in = (opus_int16*)malloc(frame_size*channels*sizeof(opus_int16)); out = (opus_int16*)malloc(frame_size*channels*sizeof(opus_int16)); @@ -182,7 +182,7 @@ int main(int argc, char *argv[]) skip = 0; } PRINT_MIPS(stderr); - + celt_encoder_destroy(enc); celt_decoder_destroy(dec); fclose(fin); diff --git a/libcelt/tests/cwrs32-test.c b/libcelt/tests/cwrs32-test.c index 7cbbc077bdae3f9143083922120cb3d7afce848a..79ac0f90d3e858f1cd94ba69fd157014013a39a7 100644 --- a/libcelt/tests/cwrs32-test.c +++ b/libcelt/tests/cwrs32-test.c @@ -5,7 +5,7 @@ #include <stdio.h> #include <string.h> -#define CELT_C +#define CELT_C #include "../libcelt/stack_alloc.h" #include "../libcelt/entenc.c" #include "../libcelt/entdec.c" diff --git a/libcelt/tests/dft-test.c b/libcelt/tests/dft-test.c index 337f55e70533f769d775fef60a8a7fde0bf369b3..a673d8fa1ad05fb10ad3387f4063e48ffcb1c9d5 100644 --- a/libcelt/tests/dft-test.c +++ b/libcelt/tests/dft-test.c @@ -11,7 +11,7 @@ #include <stdio.h> #include "kiss_fft.h" -#define CELT_C +#define CELT_C #include "../libcelt/stack_alloc.h" #include "../libcelt/kiss_fft.c" #include "../libcelt/mathops.c" @@ -22,7 +22,7 @@ #define M_PI 3.141592653 #endif -#ifdef FIXED_DEBUG +#ifdef FIXED_DEBUG long long celt_mips=0; #endif int ret = 0; @@ -31,7 +31,7 @@ void check(kiss_fft_cpx * in,kiss_fft_cpx * out,int nfft,int isinverse) { int bin,k; double errpow=0,sigpow=0, snr; - + for (bin=0;bin<nfft;++bin) { double ansr = 0; double ansi = 0; @@ -88,7 +88,7 @@ void test1d(int nfft,int isinverse) in[k].i *= 32768; } #endif - + if (isinverse) { for (k=0;k<nfft;++k) { @@ -96,9 +96,9 @@ void test1d(int nfft,int isinverse) in[k].i /= nfft; } } - + /*for (k=0;k<nfft;++k) printf("%d %d ", in[k].r, in[k].i);printf("\n");*/ - + if (isinverse) kiss_ifft(cfg,in,out); else diff --git a/libcelt/tests/ectest.c b/libcelt/tests/ectest.c index a8a391e9403aca70176de292f093565745e16a93..9f94baceb11e4d63988344772a02beb3d723653b 100644 --- a/libcelt/tests/ectest.c +++ b/libcelt/tests/ectest.c @@ -5,7 +5,7 @@ #include <stdlib.h> #include <stdio.h> #include <math.h> -#include <time.h> +#include <time.h> #include "entcode.h" #include "entenc.h" #include "entdec.h" diff --git a/libcelt/tests/laplace-test.c b/libcelt/tests/laplace-test.c index 2066e03a8e89fc80ab2d50e1c3045cd05049e338..fd07cd2499980f21c7db5f157ea61f2442a5d478 100644 --- a/libcelt/tests/laplace-test.c +++ b/libcelt/tests/laplace-test.c @@ -5,7 +5,7 @@ #include <stdio.h> #include <stdlib.h> #include "laplace.h" -#define CELT_C +#define CELT_C #include "../libcelt/stack_alloc.h" #include "../libcelt/entenc.c" @@ -33,7 +33,7 @@ int main(void) ALLOC_STACK; ptr = malloc(DATA_SIZE); ec_enc_init(&enc,ptr,DATA_SIZE); - + val[0] = 3; decay[0] = 6000; val[1] = 0; decay[1] = 5800; val[2] = -1; decay[2] = 5600; @@ -60,6 +60,6 @@ int main(void) ret = 1; } } - + return ret; } diff --git a/libcelt/tests/mathops-test.c b/libcelt/tests/mathops-test.c index 68d672e115f763947e06b7a984248fceab35a786..9eb75d929ffe683a10be5081f34f508b0d246d8a 100644 --- a/libcelt/tests/mathops-test.c +++ b/libcelt/tests/mathops-test.c @@ -13,7 +13,7 @@ #define WORD "%f" #endif -#ifdef FIXED_DEBUG +#ifdef FIXED_DEBUG long long celt_mips=0; #endif int ret = 0; @@ -67,7 +67,7 @@ void testlog2(void) if (error>0.0009) { fprintf (stderr, "celt_log2 failed: fabs((1.442695040888963387*log(x))-celt_log2(x))>0.001 (x = %f, error = %f)\n", x,error); - ret = 1; + ret = 1; } } } @@ -81,7 +81,7 @@ void testexp2(void) if (error>0.0002) { fprintf (stderr, "celt_exp2 failed: fabs(x-(1.442695040888963387*log(celt_exp2(x))))>0.0005 (x = %f, error = %f)\n", x,error); - ret = 1; + ret = 1; } } } @@ -95,7 +95,7 @@ void testexp2log2(void) if (error>0.001) { fprintf (stderr, "celt_log2/celt_exp2 failed: fabs(x-(celt_log2(celt_exp2(x))))>0.001 (x = %f, error = %f)\n", x,error); - ret = 1; + ret = 1; } } } diff --git a/libcelt/tests/mdct-test.c b/libcelt/tests/mdct-test.c index 36844fe1ed4a5147c7e3762c513bfcb8d81bc895..404bd1fccbfb648d091e0c31283edda7a6a47066 100644 --- a/libcelt/tests/mdct-test.c +++ b/libcelt/tests/mdct-test.c @@ -10,7 +10,7 @@ #include <stdio.h> #include "mdct.h" -#define CELT_C +#define CELT_C #include "../libcelt/stack_alloc.h" #include "../libcelt/kiss_fft.c" @@ -22,7 +22,7 @@ #define M_PI 3.141592653 #endif -#ifdef FIXED_DEBUG +#ifdef FIXED_DEBUG long long celt_mips=0; #endif int ret = 0; @@ -38,7 +38,7 @@ void check(kiss_fft_scalar * in,kiss_fft_scalar * out,int nfft,int isinverse) for (k=0;k<nfft;++k) { double phase = 2*M_PI*(k+.5+.25*nfft)*(bin+.5)/nfft; double re = cos(phase); - + re /= nfft/4; ansr += in[k] * re; @@ -110,16 +110,16 @@ void test1d(int nfft,int isinverse) in[k] *= 32768; } #endif - + if (isinverse) { for (k=0;k<nfft;++k) { in[k] /= nfft; } } - + /*for (k=0;k<nfft;++k) printf("%d %d ", in[k].r, in[k].i);printf("\n");*/ - + if (isinverse) { for (k=0;k<nfft;++k) diff --git a/libcelt/tests/real-fft-test.c b/libcelt/tests/real-fft-test.c index f4bb20b6f3badd5bc28ee8b046ee416b30ced4fa..0b2d4c1f746615119afdc092e1ee9389b626c286 100644 --- a/libcelt/tests/real-fft-test.c +++ b/libcelt/tests/real-fft-test.c @@ -7,7 +7,7 @@ #include <stdio.h> #include <string.h> -#define CELT_C +#define CELT_C #include "../libcelt/stack_alloc.h" #include "../libcelt/kiss_fft.c" #include "../libcelt/kiss_fftr.c" @@ -18,7 +18,7 @@ long long celt_mips=0; int ret=0; static -kiss_fft_scalar rand_scalar(void) +kiss_fft_scalar rand_scalar(void) { return (rand()%32767)-16384; } @@ -31,7 +31,7 @@ double snr_compare( kiss_fft_cpx * vec1,kiss_fft_scalar * vec2, int n) vec1[0].i = vec1[n].r; for (k=0;k<n;++k) { - sigpow += (double)vec1[k].r * (double)vec1[k].r + + sigpow += (double)vec1[k].r * (double)vec1[k].r + (double)vec1[k].i * (double)vec1[k].i; err = (double)vec1[k].r - (double)vec2[2*k]; /*printf ("%f %f\n", (double)vec1[k].r, (double)vec2[2*k]);*/ @@ -107,7 +107,7 @@ int main(void) kiss_fftr_state = kiss_fftr_alloc(NFFT,0,0); kiss_fft(kiss_fft_state,cin,cout); kiss_fftr(kiss_fftr_state,rin,sout); - + printf( "nfft=%d, inverse=%d, snr=%g\n", NFFT,0, snr_compare(cout,sout,(NFFT/2)) ); @@ -120,13 +120,13 @@ int main(void) cin[i].i = rand_scalar(); } - // conjugate symmetry of real signal + // conjugate symmetry of real signal for (i=1;i< NFFT/2;++i) { cin[NFFT-i].r = cin[i].r; cin[NFFT-i].i = - cin[i].i; } - + #ifdef FIXED_POINT #ifdef DOUBLE_PRECISION for (i=0;i< NFFT;++i) { @@ -139,7 +139,7 @@ int main(void) cin[i].i /= NFFT; } #endif - + fin[0] = cin[0].r; fin[1] = cin[NFFT/2].r; for (i=1;i< NFFT/2;++i) @@ -147,13 +147,13 @@ int main(void) fin[2*i] = cin[i].r; fin[2*i+1] = cin[i].i; } - + kiss_ifft(kiss_fft_state,cin,cout); kiss_fftri(kiss_fftr_state,fin,rout); /* printf(" results from inverse kiss_fft : (%f,%f), (%f,%f), (%f,%f), (%f,%f), (%f,%f) ...\n " , (float)cout[0].r , (float)cout[0].i , (float)cout[1].r , (float)cout[1].i , (float)cout[2].r , (float)cout[2].i , (float)cout[3].r , (float)cout[3].i , (float)cout[4].r , (float)cout[4].i - ); + ); printf(" results from inverse kiss_fftr: %f,%f,%f,%f,%f ... \n" ,(float)rout[0] ,(float)rout[1] ,(float)rout[2] ,(float)rout[3] ,(float)rout[4]); diff --git a/libcelt/tests/tandem-test.c b/libcelt/tests/tandem-test.c index 3070d1d73076af117419d25151ffb188e5299efb..5de1d7309523e455552f9cd5f8d64752c613d0f6 100644 --- a/libcelt/tests/tandem-test.c +++ b/libcelt/tests/tandem-test.c @@ -1,6 +1,6 @@ /* (C) 2009 Gregory Maxwell - This test runs pink noise through the encoder and decoder many times + This test runs pink noise through the encoder and decoder many times while feeding the output back into the input. It checks that after a number of cycles the energy has not increased or decreased by too large an amount. @@ -8,14 +8,14 @@ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - + - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - + - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR @@ -70,7 +70,7 @@ int async_tandem(int rate, int frame_size, int channels, int bitrate_min, if (bmin >= bmax) bmax = bmin + 8; - increment += (bmax - bmin) / 128; + increment += (bmax - bmin) / 128; printf ("Testing asynchronous tandeming (%dHz, %dch, %d samples, %d - %d bytes).\n", rate, channels, frame_size, bmin, bmax); diff --git a/libcelt/vq.c b/libcelt/vq.c index 58173d84d4916330ff0024fb4384a6f26d87c9d3..4702811cf5c34420b07745043d347281da54c1d4 100644 --- a/libcelt/vq.c +++ b/libcelt/vq.c @@ -5,14 +5,14 @@ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - + - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - + - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR @@ -190,7 +190,7 @@ unsigned alg_quant(celt_norm *X, int N, int K, int spread, int B, ALLOC(y, N, celt_norm); ALLOC(iy, N, int); ALLOC(signx, N, opus_val16); - + exp_rotation(X, N, 1, B, K, spread); /* Get rid of the sign */ @@ -278,7 +278,7 @@ unsigned alg_quant(celt_norm *X, int N, int K, int spread, int B, rshift = 1+celt_ilog2(K-pulsesLeft+i+1); #endif best_id = 0; - /* The squared magnitude term gets added anyway, so we might as well + /* The squared magnitude term gets added anyway, so we might as well add it outside the loop */ yy = ADD32(yy, 1); j=0; @@ -302,7 +302,7 @@ unsigned alg_quant(celt_norm *X, int N, int K, int spread, int B, best_id = j; } } while (++j<N); - + /* Updating the sums of the new pulse(s) */ xy = ADD32(xy, EXTEND32(X[best_id])); /* We're multiplying y[j] by two so we don't have to do it here */ @@ -322,7 +322,7 @@ unsigned alg_quant(celt_norm *X, int N, int K, int spread, int B, iy[j] = -iy[j]; } while (++j<N); encode_pulses(iy, N, K, enc); - + if (resynth) { normalise_residual(iy, X, N, yy, gain); diff --git a/libcelt/vq.h b/libcelt/vq.h index 17d1faf9ed39bab9ba9d339225334a64cb5ff666..bda40abe690f471a46603f57437185ef50745549 100644 --- a/libcelt/vq.h +++ b/libcelt/vq.h @@ -9,14 +9,14 @@ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - + - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - + - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR @@ -37,9 +37,9 @@ #include "entdec.h" #include "modes.h" -/** Algebraic pulse-vector quantiser. The signal x is replaced by the sum of - * the pitch and a combination of pulses such that its norm is still equal - * to 1. This is the function that will typically require the most CPU. +/** Algebraic pulse-vector quantiser. The signal x is replaced by the sum of + * the pitch and a combination of pulses such that its norm is still equal + * to 1. This is the function that will typically require the most CPU. * @param x Residual signal to quantise/encode (returns quantised version) * @param W Perceptual weight to use when optimising (currently unused) * @param N Number of samples to encode