/* Copyright (c) 2007-2008 CSIRO Copyright (c) 2007-2010 Xiph.Org Foundation 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 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifdef OPUS_ENABLED #include "opus/opus_config.h" #endif #define CELT_C #include "opus/celt/os_support.h" #include "opus/celt/mdct.h" #include #include "opus/celt/celt.h" #include "opus/celt/pitch.h" #include "opus/celt/bands.h" #include "opus/celt/opus_modes.h" #include "opus/celt/entcode.h" #include "opus/celt/quant_bands.h" #include "opus/celt/rate.h" #include "opus/celt/stack_alloc.h" #include "opus/celt/mathops.h" #include "opus/celt/float_cast.h" #include #include "opus/celt/celt_lpc.h" #include "opus/celt/vq.h" #ifndef PACKAGE_VERSION #define PACKAGE_VERSION "unknown" #endif int resampling_factor(opus_int32 rate) { int ret; switch (rate) { case 48000: ret = 1; break; case 24000: ret = 2; break; case 16000: ret = 3; break; case 12000: ret = 4; break; case 8000: ret = 6; break; default: #ifndef CUSTOM_MODES celt_assert(0); #endif ret = 0; break; } return ret; } #ifndef OVERRIDE_COMB_FILTER_CONST static void comb_filter_const(opus_val32 *y, opus_val32 *x, int T, int N, opus_val16 g10, opus_val16 g11, opus_val16 g12) { opus_val32 x0, x1, x2, x3, x4; int i; x4 = x[-T-2]; x3 = x[-T-1]; x2 = x[-T]; x1 = x[-T+1]; for (i=0;inbEBands;i++) { int N; N=(m->eBands[i+1]-m->eBands[i])<cache.caps[m->nbEBands*(2*LM+C-1)+i]+64)*C*N>>2; } } const char *opus_strerror(int error) { static const char * const error_strings[8] = { "success", "invalid argument", "buffer too small", "internal error", "corrupted stream", "request not implemented", "invalid state", "memory allocation failed" }; if (error > 0 || error < -7) return "unknown error"; else return error_strings[-error]; } const char *opus_get_version_string(void) { return "libopus " PACKAGE_VERSION #ifdef OPUS_FIXED_POINT "-fixed" #endif #ifdef FUZZING "-fuzzing" #endif ; }