master 3cf7b032f867 cached
218 files
2.0 MB
529.1k tokens
860 symbols
1 requests
Download .txt
Showing preview only (2,113K chars total). Download the full file or copy to clipboard to get everything.
Repository: ketn4391/android_silk_v3_decoder
Branch: master
Commit: 3cf7b032f867
Files: 218
Total size: 2.0 MB

Directory structure:
gitextract_cflykvbw/

├── .gitignore
├── README.md
├── app/
│   ├── .gitignore
│   ├── CMakeLists.txt
│   ├── build.gradle
│   ├── jni/
│   │   ├── SKP_Silk_A2NLSF.c
│   │   ├── SKP_Silk_CNG.c
│   │   ├── SKP_Silk_HP_variable_cutoff_FIX.c
│   │   ├── SKP_Silk_LBRR_reset.c
│   │   ├── SKP_Silk_LPC_inv_pred_gain.c
│   │   ├── SKP_Silk_LPC_synthesis_filter.c
│   │   ├── SKP_Silk_LPC_synthesis_order16.c
│   │   ├── SKP_Silk_LP_variable_cutoff.c
│   │   ├── SKP_Silk_LSF_cos_table.c
│   │   ├── SKP_Silk_LTP_analysis_filter_FIX.c
│   │   ├── SKP_Silk_LTP_scale_ctrl_FIX.c
│   │   ├── SKP_Silk_MA.c
│   │   ├── SKP_Silk_NLSF2A.c
│   │   ├── SKP_Silk_NLSF2A_stable.c
│   │   ├── SKP_Silk_NLSF_MSVQ_decode.c
│   │   ├── SKP_Silk_NLSF_MSVQ_encode_FIX.c
│   │   ├── SKP_Silk_NLSF_VQ_rate_distortion_FIX.c
│   │   ├── SKP_Silk_NLSF_VQ_sum_error_FIX.c
│   │   ├── SKP_Silk_NLSF_VQ_weights_laroia.c
│   │   ├── SKP_Silk_NLSF_stabilize.c
│   │   ├── SKP_Silk_NSQ.c
│   │   ├── SKP_Silk_NSQ_del_dec.c
│   │   ├── SKP_Silk_PLC.c
│   │   ├── SKP_Silk_VAD.c
│   │   ├── SKP_Silk_VQ_nearest_neighbor_FIX.c
│   │   ├── SKP_Silk_ana_filt_bank_1.c
│   │   ├── SKP_Silk_apply_sine_window.c
│   │   ├── SKP_Silk_array_maxabs.c
│   │   ├── SKP_Silk_autocorr.c
│   │   ├── SKP_Silk_biquad.c
│   │   ├── SKP_Silk_biquad_alt.c
│   │   ├── SKP_Silk_burg_modified.c
│   │   ├── SKP_Silk_bwexpander.c
│   │   ├── SKP_Silk_bwexpander_32.c
│   │   ├── SKP_Silk_code_signs.c
│   │   ├── SKP_Silk_control_audio_bandwidth.c
│   │   ├── SKP_Silk_control_codec_FIX.c
│   │   ├── SKP_Silk_corrMatrix_FIX.c
│   │   ├── SKP_Silk_create_init_destroy.c
│   │   ├── SKP_Silk_dec_API.c
│   │   ├── SKP_Silk_decode_core.c
│   │   ├── SKP_Silk_decode_frame.c
│   │   ├── SKP_Silk_decode_parameters.c
│   │   ├── SKP_Silk_decode_pitch.c
│   │   ├── SKP_Silk_decode_pulses.c
│   │   ├── SKP_Silk_decoder_set_fs.c
│   │   ├── SKP_Silk_detect_SWB_input.c
│   │   ├── SKP_Silk_div_oabi.c
│   │   ├── SKP_Silk_enc_API.c
│   │   ├── SKP_Silk_encode_frame_FIX.c
│   │   ├── SKP_Silk_encode_parameters.c
│   │   ├── SKP_Silk_encode_pulses.c
│   │   ├── SKP_Silk_find_LPC_FIX.c
│   │   ├── SKP_Silk_find_LTP_FIX.c
│   │   ├── SKP_Silk_find_pitch_lags_FIX.c
│   │   ├── SKP_Silk_find_pred_coefs_FIX.c
│   │   ├── SKP_Silk_gain_quant.c
│   │   ├── SKP_Silk_init_encoder_FIX.c
│   │   ├── SKP_Silk_inner_prod_aligned.c
│   │   ├── SKP_Silk_interpolate.c
│   │   ├── SKP_Silk_k2a.c
│   │   ├── SKP_Silk_k2a_Q16.c
│   │   ├── SKP_Silk_lin2log.c
│   │   ├── SKP_Silk_log2lin.c
│   │   ├── SKP_Silk_noise_shape_analysis_FIX.c
│   │   ├── SKP_Silk_pitch_analysis_core.c
│   │   ├── SKP_Silk_pitch_est_tables.c
│   │   ├── SKP_Silk_prefilter_FIX.c
│   │   ├── SKP_Silk_process_NLSFs_FIX.c
│   │   ├── SKP_Silk_process_gains_FIX.c
│   │   ├── SKP_Silk_quant_LTP_gains_FIX.c
│   │   ├── SKP_Silk_range_coder.c
│   │   ├── SKP_Silk_regularize_correlations_FIX.c
│   │   ├── SKP_Silk_resampler.c
│   │   ├── SKP_Silk_resampler_down2.c
│   │   ├── SKP_Silk_resampler_down2_3.c
│   │   ├── SKP_Silk_resampler_down3.c
│   │   ├── SKP_Silk_resampler_private_AR2.c
│   │   ├── SKP_Silk_resampler_private_ARMA4.c
│   │   ├── SKP_Silk_resampler_private_IIR_FIR.c
│   │   ├── SKP_Silk_resampler_private_copy.c
│   │   ├── SKP_Silk_resampler_private_down4.c
│   │   ├── SKP_Silk_resampler_private_down_FIR.c
│   │   ├── SKP_Silk_resampler_private_up2_HQ.c
│   │   ├── SKP_Silk_resampler_private_up4.c
│   │   ├── SKP_Silk_resampler_rom.c
│   │   ├── SKP_Silk_resampler_up2.c
│   │   ├── SKP_Silk_residual_energy16_FIX.c
│   │   ├── SKP_Silk_residual_energy_FIX.c
│   │   ├── SKP_Silk_scale_copy_vector16.c
│   │   ├── SKP_Silk_scale_vector.c
│   │   ├── SKP_Silk_schur.c
│   │   ├── SKP_Silk_schur64.c
│   │   ├── SKP_Silk_shell_coder.c
│   │   ├── SKP_Silk_sigm_Q15.c
│   │   ├── SKP_Silk_solve_LS_FIX.c
│   │   ├── SKP_Silk_sort.c
│   │   ├── SKP_Silk_sum_sqr_shift.c
│   │   ├── SKP_Silk_tables_LTP.c
│   │   ├── SKP_Silk_tables_NLSF_CB0_10.c
│   │   ├── SKP_Silk_tables_NLSF_CB0_16.c
│   │   ├── SKP_Silk_tables_NLSF_CB1_10.c
│   │   ├── SKP_Silk_tables_NLSF_CB1_16.c
│   │   ├── SKP_Silk_tables_gain.c
│   │   ├── SKP_Silk_tables_other.c
│   │   ├── SKP_Silk_tables_pitch_lag.c
│   │   ├── SKP_Silk_tables_pulses_per_block.c
│   │   ├── SKP_Silk_tables_sign.c
│   │   ├── SKP_Silk_tables_type_offset.c
│   │   ├── SKP_Silk_warped_autocorrelation_FIX.c
│   │   ├── decoder.c
│   │   ├── decoder.cpp
│   │   ├── include/
│   │   │   ├── SKP_Silk_AsmHelper.h
│   │   │   ├── SKP_Silk_AsmPreproc.h
│   │   │   ├── SKP_Silk_Inlines.h
│   │   │   ├── SKP_Silk_PLC.h
│   │   │   ├── SKP_Silk_SDK_API.h
│   │   │   ├── SKP_Silk_SigProc_FIX.h
│   │   │   ├── SKP_Silk_common_pitch_est_defines.h
│   │   │   ├── SKP_Silk_control.h
│   │   │   ├── SKP_Silk_define.h
│   │   │   ├── SKP_Silk_errors.h
│   │   │   ├── SKP_Silk_macros.h
│   │   │   ├── SKP_Silk_macros_arm.h
│   │   │   ├── SKP_Silk_main.h
│   │   │   ├── SKP_Silk_main_FIX.h
│   │   │   ├── SKP_Silk_pitch_est_defines.h
│   │   │   ├── SKP_Silk_resampler_private.h
│   │   │   ├── SKP_Silk_resampler_rom.h
│   │   │   ├── SKP_Silk_resampler_structs.h
│   │   │   ├── SKP_Silk_setup_complexity.h
│   │   │   ├── SKP_Silk_structs.h
│   │   │   ├── SKP_Silk_structs_FIX.h
│   │   │   ├── SKP_Silk_tables.h
│   │   │   ├── SKP_Silk_tables_NLSF_CB0_10.h
│   │   │   ├── SKP_Silk_tables_NLSF_CB0_16.h
│   │   │   ├── SKP_Silk_tables_NLSF_CB1_10.h
│   │   │   ├── SKP_Silk_tables_NLSF_CB1_16.h
│   │   │   ├── SKP_Silk_tuning_parameters.h
│   │   │   ├── SKP_Silk_typedef.h
│   │   │   ├── lame.h
│   │   │   └── silk.h
│   │   ├── libmp3lame/
│   │   │   ├── VbrTag.c
│   │   │   ├── VbrTag.h
│   │   │   ├── bitstream.c
│   │   │   ├── bitstream.h
│   │   │   ├── encoder.c
│   │   │   ├── encoder.h
│   │   │   ├── fft.c
│   │   │   ├── fft.h
│   │   │   ├── gain_analysis.c
│   │   │   ├── gain_analysis.h
│   │   │   ├── id3tag.c
│   │   │   ├── id3tag.h
│   │   │   ├── l3side.h
│   │   │   ├── lame-analysis.h
│   │   │   ├── lame.c
│   │   │   ├── lame_global_flags.h
│   │   │   ├── lameerror.h
│   │   │   ├── machine.h
│   │   │   ├── mpglib_interface.c
│   │   │   ├── newmdct.c
│   │   │   ├── newmdct.h
│   │   │   ├── presets.c
│   │   │   ├── psymodel.c
│   │   │   ├── psymodel.h
│   │   │   ├── quantize.c
│   │   │   ├── quantize.h
│   │   │   ├── quantize_pvt.c
│   │   │   ├── quantize_pvt.h
│   │   │   ├── reservoir.c
│   │   │   ├── reservoir.h
│   │   │   ├── set_get.c
│   │   │   ├── set_get.h
│   │   │   ├── tables.c
│   │   │   ├── tables.h
│   │   │   ├── takehiro.c
│   │   │   ├── util.c
│   │   │   ├── util.h
│   │   │   ├── vbrquantize.c
│   │   │   ├── vbrquantize.h
│   │   │   ├── vector/
│   │   │   │   ├── Makefile.am
│   │   │   │   ├── Makefile.in
│   │   │   │   ├── lame_intrin.h
│   │   │   │   └── xmm_quantize_sub.c
│   │   │   ├── version.c
│   │   │   └── version.h
│   │   └── silk.c
│   ├── proguard-rules.pro
│   └── src/
│       └── main/
│           ├── AndroidManifest.xml
│           ├── java/
│           │   └── com/
│           │       └── ketian/
│           │           └── android/
│           │               └── silkv3/
│           │                   ├── App.kt
│           │                   ├── ExportFragment.kt
│           │                   ├── MainActivity.kt
│           │                   ├── PathUtils.kt
│           │                   ├── VoiceFragment.kt
│           │                   └── jni/
│           │                       └── JNI.kt
│           └── res/
│               ├── layout/
│               │   ├── activity_main.xml
│               │   ├── export_item_layout.xml
│               │   ├── fragment_export.xml
│               │   ├── fragment_voice.xml
│               │   └── item_layout.xml
│               ├── values/
│               │   ├── colors.xml
│               │   ├── dimens.xml
│               │   ├── strings.xml
│               │   └── styles.xml
│               └── values-w820dp/
│                   └── dimens.xml
├── build.gradle
├── gradle/
│   └── wrapper/
│       ├── gradle-wrapper.jar
│       └── gradle-wrapper.properties
├── gradle.properties
├── gradlew
├── gradlew.bat
└── settings.gradle

================================================
FILE CONTENTS
================================================

================================================
FILE: .gitignore
================================================
*.iml
.gradle
/local.properties
/.idea/workspace.xml
/.idea/libraries
.DS_Store
/build
/captures
.idea

# Built application files
*.apk
*.ap_

# Files for the ART/Dalvik VM
*.dex

# Java class files
*.class

# Generated files
bin/
gen/
out/

# Gradle files
.gradle/
build/

# Local configuration file (sdk path, etc)
local.properties

# Proguard folder generated by Eclipse
proguard/

# Log Files
*.log

# Android Studio Navigation editor temp files
.navigation/

# Android Studio captures folder
captures/

# Intellij
*.iml
.idea/workspace.xml

# Keystore files
*.jks


================================================
FILE: README.md
================================================
# android_silk_v3_decoder
Convert silk v3 audio files (QQ & WeChat voice files) to mp3 files on android.

please refer to this app, https://play.google.com/store/apps/details?id=com.pleasure.trace_wechat

#2019-04-26 更新构建系统为Cmake+Clang(NDK15(记不清是不是)以后官方默认),转换成kotlin编写,修改lame/machine.h报错的部分,修改silkx JNI入口参数错误问题,增加权限验证(Android7+),替换Android支持包为AndroidX


国内的可以搜索“微痕迹”,此应用集成了微信和QQ语音的转成mp3的功能,另外提供管理微信QQ图片语音文件的功能。
因为语音转换这部分参考了一些开源工程,特将此部分开源,回馈开源社区。


================================================
FILE: app/.gitignore
================================================
/build
*.iml
.gradle
.idea
.DS_Store
/captures
.externalNativeBuild

================================================
FILE: app/CMakeLists.txt
================================================
# documentation: https://d.android.com/studio/projects/add-native-code.html
cmake_minimum_required(VERSION 3.4.1)
SET(CMAKE_BUILE_TYPE DEBUG)

if (${ANDROID_ABI} STREQUAL arm)
    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mfpu=vfp -mfloat-abi=softfp -fno-short-enums")
endif ()
set(CMAKE_CPP_FLAGS "${CMAKE_CPP_FLAGS}  -std=c++11")
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-s")

#find_library(log-lib log)
#find_library(z-lib z)
#include_directories(jni/include)
#message("搜索结果:")
add_library(mp3lame STATIC jni/libmp3lame/bitstream.c
        jni/libmp3lame/fft.c
        jni/libmp3lame/id3tag.c
        jni/libmp3lame/mpglib_interface.c
        jni/libmp3lame/presets.c
        jni/libmp3lame/quantize.c
        jni/libmp3lame/reservoir.c
        jni/libmp3lame/tables.c
        jni/libmp3lame/util.c
        jni/libmp3lame/VbrTag.c
        jni/libmp3lame/encoder.c
        jni/libmp3lame/gain_analysis.c
        jni/libmp3lame/lame.c
        jni/libmp3lame/newmdct.c
        jni/libmp3lame/psymodel.c
        jni/libmp3lame/quantize_pvt.c
        jni/libmp3lame/set_get.c
        jni/libmp3lame/takehiro.c
        jni/libmp3lame/vbrquantize.c
        jni/libmp3lame/version.c
        )

target_include_directories(mp3lame PUBLIC jni/include/lame.h)

add_library(silkx SHARED

        jni/SKP_Silk_dec_API.c
        jni/SKP_Silk_create_init_destroy.c
        jni/SKP_Silk_decoder_set_fs.c
        jni/SKP_Silk_tables_NLSF_CB0_10.c
        jni/SKP_Silk_tables_NLSF_CB1_10.c
        jni/SKP_Silk_tables_NLSF_CB0_16.c
        jni/SKP_Silk_tables_NLSF_CB1_16.c
        jni/SKP_Silk_tables_other.c
        jni/SKP_Silk_CNG.c
        jni/SKP_Silk_NLSF2A_stable.c
        jni/SKP_Silk_NLSF2A.c
        jni/SKP_Silk_bwexpander_32.c
        jni/SKP_Silk_LSF_cos_table.c
        jni/SKP_Silk_bwexpander.c
        jni/SKP_Silk_LPC_inv_pred_gain.c
        jni/SKP_Silk_LPC_synthesis_filter.c
        jni/SKP_Silk_LPC_synthesis_order16.c
        jni/SKP_Silk_PLC.c
        jni/SKP_Silk_sum_sqr_shift.c
        jni/SKP_Silk_decode_frame.c
        jni/SKP_Silk_range_coder.c
        jni/SKP_Silk_decode_parameters.c
        jni/SKP_Silk_tables_pitch_lag.c
        jni/SKP_Silk_tables_type_offset.c
        jni/SKP_Silk_gain_quant.c
        jni/SKP_Silk_lin2log.c
        jni/SKP_Silk_NLSF_MSVQ_decode.c
        jni/SKP_Silk_NLSF_stabilize.c
        jni/SKP_Silk_sort.c
        jni/SKP_Silk_decode_pitch.c
        jni/SKP_Silk_pitch_est_tables.c
        jni/SKP_Silk_tables_LTP.c
        jni/SKP_Silk_tables_gain.c
        jni/SKP_Silk_decode_pulses.c
        jni/SKP_Silk_tables_pulses_per_block.c
        jni/SKP_Silk_code_signs.c
        jni/SKP_Silk_tables_sign.c
        jni/SKP_Silk_shell_coder.c
        jni/SKP_Silk_biquad.c
        jni/SKP_Silk_decode_core.c
        jni/SKP_Silk_MA.c
        jni/SKP_Silk_resampler.c
        jni/SKP_Silk_resampler_private_down4.c
        jni/SKP_Silk_resampler_rom.c
        jni/SKP_Silk_resampler_private_copy.c
        jni/SKP_Silk_resampler_private_down_FIR.c
        jni/SKP_Silk_resampler_private_AR2.c
        jni/SKP_Silk_resampler_down2.c
        jni/SKP_Silk_resampler_private_up2_HQ.c
        jni/SKP_Silk_resampler_private_IIR_FIR.c
        jni/SKP_Silk_resampler_private_ARMA4.c
        jni/SKP_Silk_resampler_private_up4.c
        jni/SKP_Silk_resampler_up2.c
        jni/SKP_Silk_log2lin.c
        jni/silk.c
        jni/decoder.cpp
#        jni/decoder.c
        )
#target_include_directories(silkx PUBLIC
#        $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/jni/include>
#        $<INSTALL_INTERFACE:jni/include>  # <prefix>/include/mylib
#        )
target_include_directories(mp3lame PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/jni/include)


target_link_libraries(silkx
        mp3lame
        log
        z )



================================================
FILE: app/build.gradle
================================================
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-android'

android {
    compileSdkVersion 28

    defaultConfig {
        applicationId "com.ketian.android.silkv3"
        minSdkVersion 16
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"

        externalNativeBuild {
            cmake {
                cFlags "-frtti -fexceptions -Werror -DANDROID -DSTDC_HEADERS  -Werror  -fno-short-enums"
                cppFlags "-frtti -fexceptions -Werror -DANDROID -DSTDC_HEADERS  -Werror  -std=gnu++0x"
            }
            ndk {    //  abiFilters "armeabi"
                abiFilters "armeabi-v7a", "x86_64","x86","arm64-v8a"
            }
        }
    }

    externalNativeBuild {
        cmake {
            path "CMakeLists.txt"
        }
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'androidx.appcompat:appcompat:1.0.2'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    implementation 'androidx.recyclerview:recyclerview:1.0.0'
    implementation "androidx.core:core-ktx:1.0.1"
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}
repositories {
    mavenCentral()
}


================================================
FILE: app/jni/SKP_Silk_A2NLSF.c
================================================
/***********************************************************************
Copyright (c) 2006-2012, Skype Limited. All rights reserved. 
Redistribution and use in source and binary forms, with or without 
modification, (subject to the limitations in the disclaimer below) 
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.
- Neither the name of Skype Limited, nor the names of specific 
contributors, may be used to endorse or promote products derived from 
this software without specific prior written permission.
NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED 
BY THIS LICENSE. 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.
***********************************************************************/

/* Conversion between prediction filter coefficients and NLSFs  */
/* Requires the order to be an even number                      */
/* A piecewise linear approximation maps LSF <-> cos(LSF)       */
/* Therefore the result is not accurate NLSFs, but the two      */
/* function are accurate inverses of each other                 */

#include "SKP_Silk_SigProc_FIX.h"

/* Number of binary divisions */
#define BIN_DIV_STEPS_A2NLSF_FIX      3 /* must be no higher than 16 - log2( LSF_COS_TAB_SZ_FIX ) */
#define QPoly                        16
#define MAX_ITERATIONS_A2NLSF_FIX    30

/* Flag for using 2x as many cosine sampling points, reduces the risk of missing a root */
#define OVERSAMPLE_COSINE_TABLE       0

/* Helper function for A2NLSF(..)                    */
/* Transforms polynomials from cos(n*f) to cos(f)^n  */
SKP_INLINE void SKP_Silk_A2NLSF_trans_poly(
    SKP_int32        *p,    /* I/O    Polynomial                                */
    const SKP_int    dd     /* I      Polynomial order (= filter order / 2 )    */
)
{
    SKP_int k, n;
    
    for( k = 2; k <= dd; k++ ) {
        for( n = dd; n > k; n-- ) {
            p[ n - 2 ] -= p[ n ];
        }
        p[ k - 2 ] -= SKP_LSHIFT( p[ k ], 1 );
    }
}    
#if EMBEDDED_ARM<6
/* Helper function for A2NLSF(..)                    */
/* Polynomial evaluation                             */
SKP_INLINE SKP_int32 SKP_Silk_A2NLSF_eval_poly(    /* return the polynomial evaluation, in QPoly */
    SKP_int32        *p,    /* I    Polynomial, QPoly        */
    const SKP_int32   x,    /* I    Evaluation point, Q12    */
    const SKP_int    dd     /* I    Order                    */
)
{
    SKP_int   n;
    SKP_int32 x_Q16, y32;

    y32 = p[ dd ];                                    /* QPoly */
    x_Q16 = SKP_LSHIFT( x, 4 );
    for( n = dd - 1; n >= 0; n-- ) {
        y32 = SKP_SMLAWW( p[ n ], y32, x_Q16 );       /* QPoly */
    }
    return y32;
}
#else
SKP_int32 SKP_Silk_A2NLSF_eval_poly(    /* return the polynomial evaluation, in QPoly */
    SKP_int32        *p,    /* I    Polynomial, QPoly        */
    const SKP_int32   x,    /* I    Evaluation point, Q12    */
    const SKP_int    dd     /* I    Order                    */
);
#endif

SKP_INLINE void SKP_Silk_A2NLSF_init(
     const SKP_int32    *a_Q16,
     SKP_int32          *P, 
     SKP_int32          *Q, 
     const SKP_int      dd
) 
{
    SKP_int k;

    /* Convert filter coefs to even and odd polynomials */
    P[dd] = SKP_LSHIFT( 1, QPoly );
    Q[dd] = SKP_LSHIFT( 1, QPoly );
    for( k = 0; k < dd; k++ ) {
#if( QPoly < 16 )
        P[ k ] = SKP_RSHIFT_ROUND( -a_Q16[ dd - k - 1 ] - a_Q16[ dd + k ], 16 - QPoly ); /* QPoly */
        Q[ k ] = SKP_RSHIFT_ROUND( -a_Q16[ dd - k - 1 ] + a_Q16[ dd + k ], 16 - QPoly ); /* QPoly */
#elif( QPoly == 16 )
        P[ k ] = -a_Q16[ dd - k - 1 ] - a_Q16[ dd + k ]; // QPoly
        Q[ k ] = -a_Q16[ dd - k - 1 ] + a_Q16[ dd + k ]; // QPoly
#else
        P[ k ] = SKP_LSHIFT( -a_Q16[ dd - k - 1 ] - a_Q16[ dd + k ], QPoly - 16 ); /* QPoly */
        Q[ k ] = SKP_LSHIFT( -a_Q16[ dd - k - 1 ] + a_Q16[ dd + k ], QPoly - 16 ); /* QPoly */
#endif
    }

    /* Divide out zeros as we have that for even filter orders, */
    /* z =  1 is always a root in Q, and                        */
    /* z = -1 is always a root in P                             */
    for( k = dd; k > 0; k-- ) {
        P[ k - 1 ] -= P[ k ]; 
        Q[ k - 1 ] += Q[ k ]; 
    }

    /* Transform polynomials from cos(n*f) to cos(f)^n */
    SKP_Silk_A2NLSF_trans_poly( P, dd );
    SKP_Silk_A2NLSF_trans_poly( Q, dd );
}

/* Compute Normalized Line Spectral Frequencies (NLSFs) from whitening filter coefficients        */
/* If not all roots are found, the a_Q16 coefficients are bandwidth expanded until convergence.    */
void SKP_Silk_A2NLSF(
    SKP_int          *NLSF,                 /* O    Normalized Line Spectral Frequencies, Q15 (0 - (2^15-1)), [d]    */
    SKP_int32        *a_Q16,                /* I/O  Monic whitening filter coefficients in Q16 [d]                   */
    const SKP_int    d                      /* I    Filter order (must be even)                                      */
)
{
    SKP_int      i, k, m, dd, root_ix, ffrac;
    SKP_int32 xlo, xhi, xmid;
    SKP_int32 ylo, yhi, ymid;
    SKP_int32 nom, den;
    SKP_int32 P[ SKP_Silk_MAX_ORDER_LPC / 2 + 1 ];
    SKP_int32 Q[ SKP_Silk_MAX_ORDER_LPC / 2 + 1 ];
    SKP_int32 *PQ[ 2 ];
    SKP_int32 *p;

    /* Store pointers to array */
    PQ[ 0 ] = P;
    PQ[ 1 ] = Q;

    dd = SKP_RSHIFT( d, 1 );

    SKP_Silk_A2NLSF_init( a_Q16, P, Q, dd );

    /* Find roots, alternating between P and Q */
    p = P;    /* Pointer to polynomial */
    
    xlo = SKP_Silk_LSFCosTab_FIX_Q12[ 0 ]; // Q12
    ylo = SKP_Silk_A2NLSF_eval_poly( p, xlo, dd );

    if( ylo < 0 ) {
        /* Set the first NLSF to zero and move on to the next */
        NLSF[ 0 ] = 0;
        p = Q;                      /* Pointer to polynomial */
        ylo = SKP_Silk_A2NLSF_eval_poly( p, xlo, dd );
        root_ix = 1;                /* Index of current root */
    } else {
        root_ix = 0;                /* Index of current root */
    }
    k = 1;                          /* Loop counter */
    i = 0;                          /* Counter for bandwidth expansions applied */
    while( 1 ) {
        /* Evaluate polynomial */
#if OVERSAMPLE_COSINE_TABLE
        xhi = SKP_Silk_LSFCosTab_FIX_Q12[   k       >> 1 ] +
          ( ( SKP_Silk_LSFCosTab_FIX_Q12[ ( k + 1 ) >> 1 ] - 
              SKP_Silk_LSFCosTab_FIX_Q12[   k       >> 1 ] ) >> 1 );    /* Q12 */
#else
        xhi = SKP_Silk_LSFCosTab_FIX_Q12[ k ]; /* Q12 */
#endif
        yhi = SKP_Silk_A2NLSF_eval_poly( p, xhi, dd );
        
        /* Detect zero crossing */
        if( ( ylo <= 0 && yhi >= 0 ) || ( ylo >= 0 && yhi <= 0 ) ) {
            /* Binary division */
#if OVERSAMPLE_COSINE_TABLE
            ffrac = -128;
#else
            ffrac = -256;
#endif
            for( m = 0; m < BIN_DIV_STEPS_A2NLSF_FIX; m++ ) {
                /* Evaluate polynomial */
                xmid = SKP_RSHIFT_ROUND( xlo + xhi, 1 );
                ymid = SKP_Silk_A2NLSF_eval_poly( p, xmid, dd );

                /* Detect zero crossing */
                if( ( ylo <= 0 && ymid >= 0 ) || ( ylo >= 0 && ymid <= 0 ) ) {
                    /* Reduce frequency */
                    xhi = xmid;
                    yhi = ymid;
                } else {
                    /* Increase frequency */
                    xlo = xmid;
                    ylo = ymid;
#if OVERSAMPLE_COSINE_TABLE
                    ffrac = SKP_ADD_RSHIFT( ffrac,  64, m );
#else
                    ffrac = SKP_ADD_RSHIFT( ffrac, 128, m );
#endif
                }
            }
            
            /* Interpolate */
            if( SKP_abs( ylo ) < 65536 ) {
                /* Avoid dividing by zero */
                den = ylo - yhi;
                nom = SKP_LSHIFT( ylo, 8 - BIN_DIV_STEPS_A2NLSF_FIX ) + SKP_RSHIFT( den, 1 );
                if( den != 0 ) {
                    ffrac += SKP_DIV32( nom, den );
                }
            } else {
                /* No risk of dividing by zero because abs(ylo - yhi) >= abs(ylo) >= 65536 */
                ffrac += SKP_DIV32( ylo, SKP_RSHIFT( ylo - yhi, 8 - BIN_DIV_STEPS_A2NLSF_FIX ) );
            }
#if OVERSAMPLE_COSINE_TABLE
            NLSF[ root_ix ] = (SKP_int)SKP_min_32( SKP_LSHIFT( (SKP_int32)k, 7 ) + ffrac, SKP_int16_MAX ); 
#else
            NLSF[ root_ix ] = (SKP_int)SKP_min_32( SKP_LSHIFT( (SKP_int32)k, 8 ) + ffrac, SKP_int16_MAX ); 
#endif

            SKP_assert( NLSF[ root_ix ] >=     0 );
            SKP_assert( NLSF[ root_ix ] <= 32767 );

            root_ix++;        /* Next root */
            if( root_ix >= d ) {
                /* Found all roots */
                break;
            }
            /* Alternate pointer to polynomial */
            p = PQ[ root_ix & 1 ];
            
            /* Evaluate polynomial */
#if OVERSAMPLE_COSINE_TABLE
            xlo = SKP_Silk_LSFCosTab_FIX_Q12[ ( k - 1 ) >> 1 ] +
              ( ( SKP_Silk_LSFCosTab_FIX_Q12[   k       >> 1 ] - 
                  SKP_Silk_LSFCosTab_FIX_Q12[ ( k - 1 ) >> 1 ] ) >> 1 ); // Q12
#else
            xlo = SKP_Silk_LSFCosTab_FIX_Q12[ k - 1 ]; // Q12
#endif
            ylo = SKP_LSHIFT( 1 - ( root_ix & 2 ), 12 );
        } else {
            /* Increment loop counter */
            k++;
            xlo    = xhi;
            ylo    = yhi;
            
#if OVERSAMPLE_COSINE_TABLE
            if( k > 2 * LSF_COS_TAB_SZ_FIX ) {
#else
            if( k > LSF_COS_TAB_SZ_FIX ) {
#endif
                i++;
                if( i > MAX_ITERATIONS_A2NLSF_FIX ) {
                    /* Set NLSFs to white spectrum and exit */
                    NLSF[ 0 ] = SKP_DIV32_16( 1 << 15, d + 1 );
                    for( k = 1; k < d; k++ ) {
                        NLSF[ k ] = SKP_SMULBB( k + 1, NLSF[ 0 ] );
                    }
                    return;
                }

                /* Error: Apply progressively more bandwidth expansion and run again */
                SKP_Silk_bwexpander_32( a_Q16, d, 65536 - SKP_SMULBB( 10 + i, i ) ); // 10_Q16 = 0.00015

                SKP_Silk_A2NLSF_init( a_Q16, P, Q, dd );
                p = P;                            /* Pointer to polynomial */
                xlo = SKP_Silk_LSFCosTab_FIX_Q12[ 0 ]; // Q12
                ylo = SKP_Silk_A2NLSF_eval_poly( p, xlo, dd );
                if( ylo < 0 ) {
                    /* Set the first NLSF to zero and move on to the next */
                    NLSF[ 0 ] = 0;
                    p = Q;                        /* Pointer to polynomial */
                    ylo = SKP_Silk_A2NLSF_eval_poly( p, xlo, dd );
                    root_ix = 1;                  /* Index of current root */
                } else {
                    root_ix = 0;                  /* Index of current root */
                }
                k = 1;                            /* Reset loop counter */
            }
        }
    }
}


================================================
FILE: app/jni/SKP_Silk_CNG.c
================================================
/***********************************************************************
Copyright (c) 2006-2012, Skype Limited. All rights reserved. 
Redistribution and use in source and binary forms, with or without 
modification, (subject to the limitations in the disclaimer below) 
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.
- Neither the name of Skype Limited, nor the names of specific 
contributors, may be used to endorse or promote products derived from 
this software without specific prior written permission.
NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED 
BY THIS LICENSE. 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.
***********************************************************************/

#include "SKP_Silk_main.h"

/* Generates excitation for CNG LPC synthesis */
SKP_INLINE void SKP_Silk_CNG_exc(
    SKP_int16                       residual[],         /* O    CNG residual signal Q0                      */
    SKP_int32                       exc_buf_Q10[],      /* I    Random samples buffer Q10                   */
    SKP_int32                       Gain_Q16,           /* I    Gain to apply                               */
    SKP_int                         length,             /* I    Length                                      */
    SKP_int32                       *rand_seed          /* I/O  Seed to random index generator              */
)
{
    SKP_int32 seed;
    SKP_int   i, idx, exc_mask;

    exc_mask = CNG_BUF_MASK_MAX;
    while( exc_mask > length ) {
        exc_mask = SKP_RSHIFT( exc_mask, 1 );
    }

    seed = *rand_seed;
    for( i = 0; i < length; i++ ) {
        seed = SKP_RAND( seed );
        idx = ( SKP_int )( SKP_RSHIFT( seed, 24 ) & exc_mask );
        SKP_assert( idx >= 0 );
        SKP_assert( idx <= CNG_BUF_MASK_MAX );
        residual[ i ] = ( SKP_int16 )SKP_SAT16( SKP_RSHIFT_ROUND( SKP_SMULWW( exc_buf_Q10[ idx ], Gain_Q16 ), 10 ) );
    }
    *rand_seed = seed;
}

void SKP_Silk_CNG_Reset(
    SKP_Silk_decoder_state      *psDec              /* I/O  Decoder state                               */
)
{
    SKP_int i, NLSF_step_Q15, NLSF_acc_Q15;

    NLSF_step_Q15 = SKP_DIV32_16( SKP_int16_MAX, psDec->LPC_order + 1 );
    NLSF_acc_Q15 = 0;
    for( i = 0; i < psDec->LPC_order; i++ ) {
        NLSF_acc_Q15 += NLSF_step_Q15;
        psDec->sCNG.CNG_smth_NLSF_Q15[ i ] = NLSF_acc_Q15;
    }
    psDec->sCNG.CNG_smth_Gain_Q16 = 0;
    psDec->sCNG.rand_seed = 3176576;
}

/* Updates CNG estimate, and applies the CNG when packet was lost   */
void SKP_Silk_CNG(
    SKP_Silk_decoder_state      *psDec,             /* I/O  Decoder state                               */
    SKP_Silk_decoder_control    *psDecCtrl,         /* I/O  Decoder control                             */
    SKP_int16                   signal[],           /* I/O  Signal                                      */
    SKP_int                     length              /* I    Length of residual                          */
)
{
    SKP_int   i, subfr;
    SKP_int32 tmp_32, Gain_Q26, max_Gain_Q16;
    SKP_int16 LPC_buf[ MAX_LPC_ORDER ];
    SKP_int16 CNG_sig[ MAX_FRAME_LENGTH ];
    SKP_Silk_CNG_struct *psCNG;
    psCNG = &psDec->sCNG;

    if( psDec->fs_kHz != psCNG->fs_kHz ) {
        /* Reset state */
        SKP_Silk_CNG_Reset( psDec );

        psCNG->fs_kHz = psDec->fs_kHz;
    }
    if( psDec->lossCnt == 0 && psDec->vadFlag == NO_VOICE_ACTIVITY ) {
        /* Update CNG parameters */

        /* Smoothing of LSF's  */
        for( i = 0; i < psDec->LPC_order; i++ ) {
            psCNG->CNG_smth_NLSF_Q15[ i ] += SKP_SMULWB( psDec->prevNLSF_Q15[ i ] - psCNG->CNG_smth_NLSF_Q15[ i ], CNG_NLSF_SMTH_Q16 );
        }
        /* Find the subframe with the highest gain */
        max_Gain_Q16 = 0;
        subfr        = 0;
        for( i = 0; i < NB_SUBFR; i++ ) {
            if( psDecCtrl->Gains_Q16[ i ] > max_Gain_Q16 ) {
                max_Gain_Q16 = psDecCtrl->Gains_Q16[ i ];
                subfr        = i;
            }
        }
        /* Update CNG excitation buffer with excitation from this subframe */
        SKP_memmove( &psCNG->CNG_exc_buf_Q10[ psDec->subfr_length ], psCNG->CNG_exc_buf_Q10, ( NB_SUBFR - 1 ) * psDec->subfr_length * sizeof( SKP_int32 ) );
        SKP_memcpy(   psCNG->CNG_exc_buf_Q10, &psDec->exc_Q10[ subfr * psDec->subfr_length ], psDec->subfr_length * sizeof( SKP_int32 ) );

        /* Smooth gains */
        for( i = 0; i < NB_SUBFR; i++ ) {
            psCNG->CNG_smth_Gain_Q16 += SKP_SMULWB( psDecCtrl->Gains_Q16[ i ] - psCNG->CNG_smth_Gain_Q16, CNG_GAIN_SMTH_Q16 );
        }
    }

    /* Add CNG when packet is lost and / or when low speech activity */
    if( psDec->lossCnt ) {//|| psDec->vadFlag == NO_VOICE_ACTIVITY ) {

        /* Generate CNG excitation */
        SKP_Silk_CNG_exc( CNG_sig, psCNG->CNG_exc_buf_Q10, 
                psCNG->CNG_smth_Gain_Q16, length, &psCNG->rand_seed );

        /* Convert CNG NLSF to filter representation */
        SKP_Silk_NLSF2A_stable( LPC_buf, psCNG->CNG_smth_NLSF_Q15, psDec->LPC_order );

        Gain_Q26 = ( SKP_int32 )1 << 26; /* 1.0 */
        
        /* Generate CNG signal, by synthesis filtering */
        if( psDec->LPC_order == 16 ) {
            SKP_Silk_LPC_synthesis_order16( CNG_sig, LPC_buf, 
                Gain_Q26, psCNG->CNG_synth_state, CNG_sig, length );
        } else {
            SKP_Silk_LPC_synthesis_filter( CNG_sig, LPC_buf, 
                Gain_Q26, psCNG->CNG_synth_state, CNG_sig, length, psDec->LPC_order );
        }
        /* Mix with signal */
        for( i = 0; i < length; i++ ) {
            tmp_32 = signal[ i ] + CNG_sig[ i ];
            signal[ i ] = SKP_SAT16( tmp_32 );
        }
    } else {
        SKP_memset( psCNG->CNG_synth_state, 0, psDec->LPC_order *  sizeof( SKP_int32 ) );
    }
}


================================================
FILE: app/jni/SKP_Silk_HP_variable_cutoff_FIX.c
================================================
/***********************************************************************
Copyright (c) 2006-2012, Skype Limited. All rights reserved. 
Redistribution and use in source and binary forms, with or without 
modification, (subject to the limitations in the disclaimer below) 
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.
- Neither the name of Skype Limited, nor the names of specific 
contributors, may be used to endorse or promote products derived from 
this software without specific prior written permission.
NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED 
BY THIS LICENSE. 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.
***********************************************************************/

#include "SKP_Silk_main_FIX.h"
#include "SKP_Silk_tuning_parameters.h"

#if HIGH_PASS_INPUT

#define SKP_RADIANS_CONSTANT_Q19            1482    // 0.45f * 2.0f * 3.14159265359 / 1000
#define SKP_LOG2_VARIABLE_HP_MIN_FREQ_Q7    809     // log(80) in Q7

/* High-pass filter with cutoff frequency adaptation based on pitch lag statistics */
void SKP_Silk_HP_variable_cutoff_FIX(
    SKP_Silk_encoder_state_FIX      *psEnc,             /* I/O  Encoder state FIX                           */
    SKP_Silk_encoder_control_FIX    *psEncCtrl,         /* I/O  Encoder control FIX                         */
    SKP_int16                       *out,               /* O    high-pass filtered output signal            */
    const SKP_int16                 *in                 /* I    input signal                                */
)
{
    SKP_int   quality_Q15;
    SKP_int32 B_Q28[ 3 ], A_Q28[ 2 ];
    SKP_int32 Fc_Q19, r_Q28, r_Q22;
    SKP_int32 pitch_freq_Hz_Q16, pitch_freq_log_Q7, delta_freq_Q7;

    /*********************************************/
    /* Estimate Low End of Pitch Frequency Range */
    /*********************************************/
    if( psEnc->sCmn.prev_sigtype == SIG_TYPE_VOICED ) {
        /* difference, in log domain */
        pitch_freq_Hz_Q16 = SKP_DIV32_16( SKP_LSHIFT( SKP_MUL( psEnc->sCmn.fs_kHz, 1000 ), 16 ), psEnc->sCmn.prevLag );
        pitch_freq_log_Q7 = SKP_Silk_lin2log( pitch_freq_Hz_Q16 ) - ( 16 << 7 ); //0x70

        /* adjustment based on quality */
        quality_Q15 = psEncCtrl->input_quality_bands_Q15[ 0 ];
        pitch_freq_log_Q7 = SKP_SUB32( pitch_freq_log_Q7, SKP_SMULWB( SKP_SMULWB( SKP_LSHIFT( quality_Q15, 2 ), quality_Q15 ), 
            pitch_freq_log_Q7 - SKP_LOG2_VARIABLE_HP_MIN_FREQ_Q7 ) );
        pitch_freq_log_Q7 = SKP_ADD32( pitch_freq_log_Q7, SKP_RSHIFT( SKP_FIX_CONST( 0.6, 15 ) - quality_Q15, 9 ) );

        //delta_freq = pitch_freq_log - psEnc->variable_HP_smth1;
        delta_freq_Q7 = pitch_freq_log_Q7 - SKP_RSHIFT( psEnc->variable_HP_smth1_Q15, 8 );
        if( delta_freq_Q7 < 0 ) {
            /* less smoothing for decreasing pitch frequency, to track something close to the minimum */
            delta_freq_Q7 = SKP_MUL( delta_freq_Q7, 3 );
        }

        /* limit delta, to reduce impact of outliers */
        delta_freq_Q7 = SKP_LIMIT_32( delta_freq_Q7, -SKP_FIX_CONST( VARIABLE_HP_MAX_DELTA_FREQ, 7 ), SKP_FIX_CONST( VARIABLE_HP_MAX_DELTA_FREQ, 7 ) );

        /* update smoother */
        psEnc->variable_HP_smth1_Q15 = SKP_SMLAWB( psEnc->variable_HP_smth1_Q15, 
            SKP_MUL( SKP_LSHIFT( psEnc->speech_activity_Q8, 1 ), delta_freq_Q7 ), SKP_FIX_CONST( VARIABLE_HP_SMTH_COEF1, 16 ) );
    }
    /* second smoother */
    psEnc->variable_HP_smth2_Q15 = SKP_SMLAWB( psEnc->variable_HP_smth2_Q15, 
        psEnc->variable_HP_smth1_Q15 - psEnc->variable_HP_smth2_Q15, SKP_FIX_CONST( VARIABLE_HP_SMTH_COEF2, 16 ) );

    /* convert from log scale to Hertz */
    psEncCtrl->pitch_freq_low_Hz = SKP_Silk_log2lin( SKP_RSHIFT( psEnc->variable_HP_smth2_Q15, 8 ) );

    /* limit frequency range */
    psEncCtrl->pitch_freq_low_Hz = SKP_LIMIT_32( psEncCtrl->pitch_freq_low_Hz, 
        SKP_FIX_CONST( VARIABLE_HP_MIN_FREQ, 0 ), SKP_FIX_CONST( VARIABLE_HP_MAX_FREQ, 0 ) );

    /********************************/
    /* Compute Filter Coefficients  */
    /********************************/
    /* compute cut-off frequency, in radians */
    //Fc_num   = (SKP_float)( 0.45f * 2.0f * 3.14159265359 * psEncCtrl->pitch_freq_low_Hz );
    //Fc_denom = (SKP_float)( 1e3f * psEnc->sCmn.fs_kHz );
    SKP_assert( psEncCtrl->pitch_freq_low_Hz <= SKP_int32_MAX / SKP_RADIANS_CONSTANT_Q19 );
    Fc_Q19 = SKP_DIV32_16( SKP_SMULBB( SKP_RADIANS_CONSTANT_Q19, psEncCtrl->pitch_freq_low_Hz ), psEnc->sCmn.fs_kHz ); // range: 3704 - 27787, 11-15 bits
    SKP_assert( Fc_Q19 >=  3704 );
    SKP_assert( Fc_Q19 <= 27787 );

    r_Q28 = SKP_FIX_CONST( 1.0, 28 ) - SKP_MUL( SKP_FIX_CONST( 0.92, 9 ), Fc_Q19 );
    SKP_assert( r_Q28 >= 255347779 );
    SKP_assert( r_Q28 <= 266690872 );

    /* b = r * [ 1; -2; 1 ]; */
    /* a = [ 1; -2 * r * ( 1 - 0.5 * Fc^2 ); r^2 ]; */
    B_Q28[ 0 ] = r_Q28;
    B_Q28[ 1 ] = SKP_LSHIFT( -r_Q28, 1 );
    B_Q28[ 2 ] = r_Q28;
    
    // -r * ( 2 - Fc * Fc );
    r_Q22  = SKP_RSHIFT( r_Q28, 6 );
    A_Q28[ 0 ] = SKP_SMULWW( r_Q22, SKP_SMULWW( Fc_Q19, Fc_Q19 ) - SKP_FIX_CONST( 2.0,  22 ) );
    A_Q28[ 1 ] = SKP_SMULWW( r_Q22, r_Q22 );

    /********************************/
    /* High-Pass Filter             */
    /********************************/
    SKP_Silk_biquad_alt( in, B_Q28, A_Q28, psEnc->sCmn.In_HP_State, out, psEnc->sCmn.frame_length );
}

#endif // HIGH_PASS_INPUT


================================================
FILE: app/jni/SKP_Silk_LBRR_reset.c
================================================
/***********************************************************************
Copyright (c) 2006-2012, Skype Limited. All rights reserved. 
Redistribution and use in source and binary forms, with or without 
modification, (subject to the limitations in the disclaimer below) 
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.
- Neither the name of Skype Limited, nor the names of specific 
contributors, may be used to endorse or promote products derived from 
this software without specific prior written permission.
NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED 
BY THIS LICENSE. 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.
***********************************************************************/

#include "SKP_Silk_main.h"

/* Resets LBRR buffer, used if packet size changes */
void SKP_Silk_LBRR_reset( 
    SKP_Silk_encoder_state      *psEncC             /* I/O  state                                       */
)
{
    SKP_int i;

    for( i = 0; i < MAX_LBRR_DELAY; i++ ) {
        psEncC->LBRR_buffer[ i ].usage = SKP_SILK_NO_LBRR;
    }
}


================================================
FILE: app/jni/SKP_Silk_LPC_inv_pred_gain.c
================================================
/***********************************************************************
Copyright (c) 2006-2012, Skype Limited. All rights reserved. 
Redistribution and use in source and binary forms, with or without 
modification, (subject to the limitations in the disclaimer below) 
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.
- Neither the name of Skype Limited, nor the names of specific 
contributors, may be used to endorse or promote products derived from 
this software without specific prior written permission.
NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED 
BY THIS LICENSE. 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.
***********************************************************************/

/*                                                                      *
 * SKP_Silk_LPC_inverse_pred_gain.c                                   *
 *                                                                      *
 * Compute inverse of LPC prediction gain, and                          *
 * test if LPC coefficients are stable (all poles within unit circle)   *
 *                                                                      *
 * Copyright 2008 (c), Skype Limited                                    *
 *                                                                      */
#include "SKP_Silk_SigProc_FIX.h"

#define QA          16
#define A_LIMIT     SKP_FIX_CONST( 0.99975, QA )

/* Compute inverse of LPC prediction gain, and                          */
/* test if LPC coefficients are stable (all poles within unit circle)   */
static SKP_int LPC_inverse_pred_gain_QA(        /* O:   Returns 1 if unstable, otherwise 0          */
    SKP_int32           *invGain_Q30,           /* O:   Inverse prediction gain, Q30 energy domain  */
    SKP_int32           A_QA[ 2 ][ SKP_Silk_MAX_ORDER_LPC ],         
                                                /* I:   Prediction coefficients                     */
    const SKP_int       order                   /* I:   Prediction order                            */
)
{
    SKP_int   k, n, headrm;
    SKP_int32 rc_Q31, rc_mult1_Q30, rc_mult2_Q16, tmp_QA;
    SKP_int32 *Aold_QA, *Anew_QA;

    Anew_QA = A_QA[ order & 1 ];

    *invGain_Q30 = ( 1 << 30 );
    for( k = order - 1; k > 0; k-- ) {
        /* Check for stability */
        if( ( Anew_QA[ k ] > A_LIMIT ) || ( Anew_QA[ k ] < -A_LIMIT ) ) {
            return 1;
        }

        /* Set RC equal to negated AR coef */
        rc_Q31 = -SKP_LSHIFT( Anew_QA[ k ], 31 - QA );
        
        /* rc_mult1_Q30 range: [ 1 : 2^30-1 ] */
        rc_mult1_Q30 = ( SKP_int32_MAX >> 1 ) - SKP_SMMUL( rc_Q31, rc_Q31 );
        SKP_assert( rc_mult1_Q30 > ( 1 << 15 ) );                   /* reduce A_LIMIT if fails */
        SKP_assert( rc_mult1_Q30 < ( 1 << 30 ) );

        /* rc_mult2_Q16 range: [ 2^16 : SKP_int32_MAX ] */
        rc_mult2_Q16 = SKP_INVERSE32_varQ( rc_mult1_Q30, 46 );      /* 16 = 46 - 30 */

        /* Update inverse gain */
        /* invGain_Q30 range: [ 0 : 2^30 ] */
        *invGain_Q30 = SKP_LSHIFT( SKP_SMMUL( *invGain_Q30, rc_mult1_Q30 ), 2 );
        SKP_assert( *invGain_Q30 >= 0           );
        SKP_assert( *invGain_Q30 <= ( 1 << 30 ) );

        /* Swap pointers */
        Aold_QA = Anew_QA;
        Anew_QA = A_QA[ k & 1 ];
        
        /* Update AR coefficient */
        headrm = SKP_Silk_CLZ32( rc_mult2_Q16 ) - 1;
        rc_mult2_Q16 = SKP_LSHIFT( rc_mult2_Q16, headrm );          /* Q: 16 + headrm */
        for( n = 0; n < k; n++ ) {
            tmp_QA = Aold_QA[ n ] - SKP_LSHIFT( SKP_SMMUL( Aold_QA[ k - n - 1 ], rc_Q31 ), 1 );
            Anew_QA[ n ] = SKP_LSHIFT( SKP_SMMUL( tmp_QA, rc_mult2_Q16 ), 16 - headrm );
        }
    }

    /* Check for stability */
    if( ( Anew_QA[ 0 ] > A_LIMIT ) || ( Anew_QA[ 0 ] < -A_LIMIT ) ) {
        return 1;
    }

    /* Set RC equal to negated AR coef */
    rc_Q31 = -SKP_LSHIFT( Anew_QA[ 0 ], 31 - QA );

    /* Range: [ 1 : 2^30 ] */
    rc_mult1_Q30 = ( SKP_int32_MAX >> 1 ) - SKP_SMMUL( rc_Q31, rc_Q31 );

    /* Update inverse gain */
    /* Range: [ 0 : 2^30 ] */
    *invGain_Q30 = SKP_LSHIFT( SKP_SMMUL( *invGain_Q30, rc_mult1_Q30 ), 2 );
    SKP_assert( *invGain_Q30 >= 0     );
    SKP_assert( *invGain_Q30 <= 1<<30 );

    return 0;
}
/* For input in Q12 domain */
SKP_int SKP_Silk_LPC_inverse_pred_gain(       /* O:   Returns 1 if unstable, otherwise 0          */
    SKP_int32           *invGain_Q30,           /* O:   Inverse prediction gain, Q30 energy domain  */
    const SKP_int16     *A_Q12,                 /* I:   Prediction coefficients, Q12 [order]        */
    const SKP_int       order                   /* I:   Prediction order                            */
)
{
    SKP_int   k;
    SKP_int32 Atmp_QA[ 2 ][ SKP_Silk_MAX_ORDER_LPC ];
    SKP_int32 *Anew_QA;

    Anew_QA = Atmp_QA[ order & 1 ];

    /* Increase Q domain of the AR coefficients */
    for( k = 0; k < order; k++ ) {
        Anew_QA[ k ] = SKP_LSHIFT( (SKP_int32)A_Q12[ k ], QA - 12 );
    }

    return LPC_inverse_pred_gain_QA( invGain_Q30, Atmp_QA, order );
}

/* For input in Q24 domain */
SKP_int SKP_Silk_LPC_inverse_pred_gain_Q24(   /* O:   Returns 1 if unstable, otherwise 0          */
    SKP_int32           *invGain_Q30,           /* O:   Inverse prediction gain, Q30 energy domain  */
    const SKP_int32     *A_Q24,                 /* I:   Prediction coefficients, Q24 [order]        */
    const SKP_int       order                   /* I:   Prediction order                            */
)
{
    SKP_int   k;
    SKP_int32 Atmp_QA[ 2 ][ SKP_Silk_MAX_ORDER_LPC ];
    SKP_int32 *Anew_QA;

    Anew_QA = Atmp_QA[ order & 1 ];

    /* Increase Q domain of the AR coefficients */
    for( k = 0; k < order; k++ ) {
        Anew_QA[ k ] = SKP_RSHIFT_ROUND( A_Q24[ k ], 24 - QA );
    }

    return LPC_inverse_pred_gain_QA( invGain_Q30, Atmp_QA, order );
}



================================================
FILE: app/jni/SKP_Silk_LPC_synthesis_filter.c
================================================
/***********************************************************************
Copyright (c) 2006-2012, Skype Limited. All rights reserved. 
Redistribution and use in source and binary forms, with or without 
modification, (subject to the limitations in the disclaimer below) 
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.
- Neither the name of Skype Limited, nor the names of specific 
contributors, may be used to endorse or promote products derived from 
this software without specific prior written permission.
NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED 
BY THIS LICENSE. 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.
***********************************************************************/

/*                                                                      *
 * SKP_Silk_LPC_synthesis_filter.c                                    *
 * Coefficients are in Q12                                              *
 *                                                                      *
 * even order AR filter                                                 *
 *                                                                      */
#include "SKP_Silk_SigProc_FIX.h"

/* even order AR filter */
void SKP_Silk_LPC_synthesis_filter(
    const SKP_int16 *in,        /* I:   excitation signal */
    const SKP_int16 *A_Q12,     /* I:   AR coefficients [Order], between -8_Q0 and 8_Q0 */
    const SKP_int32 Gain_Q26,   /* I:   gain */
    SKP_int32 *S,               /* I/O: state vector [Order] */
    SKP_int16 *out,             /* O:   output signal */
    const SKP_int32 len,        /* I:   signal length */
    const SKP_int Order         /* I:   filter order, must be even */
)
{
    SKP_int   k, j, idx, Order_half = SKP_RSHIFT( Order, 1 );
    SKP_int32 SA, SB, out32_Q10, out32;
#if !defined(_SYSTEM_IS_BIG_ENDIAN)
    SKP_int32 Atmp, A_align_Q12[ SKP_Silk_MAX_ORDER_LPC >> 1 ];

    /* combine two A_Q12 values and ensure 32-bit alignment */
    for( k = 0; k < Order_half; k++ ) {
        idx = SKP_SMULBB( 2, k );
        A_align_Q12[ k ] = ( ( ( SKP_int32 )A_Q12[ idx ] ) & 0x0000ffff ) | SKP_LSHIFT( ( SKP_int32 )A_Q12[ idx + 1 ], 16 );
    }
#endif

    /* Order must be even */
    SKP_assert( 2 * Order_half == Order );

    /* S[] values are in Q14 */
    for( k = 0; k < len; k++ ) {
        SA = S[ Order - 1 ];
        out32_Q10 = 0;
        for( j = 0; j < ( Order_half - 1 ); j++ ) {
            idx = SKP_SMULBB( 2, j ) + 1;
#if !defined(_SYSTEM_IS_BIG_ENDIAN)
            /* multiply-add two prediction coefficients for each loop */
            /* NOTE: the code below loads two int16 values in an int32, and multiplies each using the   */
            /* SMLAWB and SMLAWT instructions. On a big-endian CPU the two int16 variables would be     */
            /* loaded in reverse order and the code will give the wrong result. In that case swapping   */
            /* the SMLAWB and SMLAWT instructions should solve the problem.                             */
            Atmp = A_align_Q12[ j ];
            SB = S[ Order - 1 - idx ];
            S[ Order - 1 - idx ] = SA;
            out32_Q10 = SKP_SMLAWB( out32_Q10, SA, Atmp );
            out32_Q10 = SKP_SMLAWT( out32_Q10, SB, Atmp );
            SA = S[ Order - 2 - idx ];
            S[ Order - 2 - idx ] = SB;
#else
            SB = S[ Order - 1 - idx ];
            S[ Order - 1 - idx ] = SA;
            out32_Q10 = SKP_SMLAWB( out32_Q10, SA, A_Q12[ ( j << 1 ) ] );
            out32_Q10 = SKP_SMLAWB( out32_Q10, SB, A_Q12[ ( j << 1 ) + 1 ] );
            SA = S[ Order - 2 - idx ];
            S[ Order - 2 - idx ] = SB;
#endif
        }

#if !defined(_SYSTEM_IS_BIG_ENDIAN)
        /* unrolled loop: epilog */
        Atmp = A_align_Q12[ Order_half - 1 ];
        SB = S[ 0 ];
        S[ 0 ] = SA;
        out32_Q10 = SKP_SMLAWB( out32_Q10, SA, Atmp );
        out32_Q10 = SKP_SMLAWT( out32_Q10, SB, Atmp );
#else
        /* unrolled loop: epilog */
        SB = S[ 0 ];
        S[ 0 ] = SA;
        out32_Q10 = SKP_SMLAWB( out32_Q10, SA, A_Q12[ Order - 2 ] );
        out32_Q10 = SKP_SMLAWB( out32_Q10, SB, A_Q12[ Order - 1 ] );
#endif
        /* apply gain to excitation signal and add to prediction */
        out32_Q10 = SKP_ADD_SAT32( out32_Q10, SKP_SMULWB( Gain_Q26, in[ k ] ) );

        /* scale to Q0 */
        out32 = SKP_RSHIFT_ROUND( out32_Q10, 10 );

        /* saturate output */
        out[ k ] = ( SKP_int16 )SKP_SAT16( out32 );

        /* move result into delay line */
        S[ Order - 1 ] = SKP_LSHIFT_SAT32( out32_Q10, 4 );
    }
}


================================================
FILE: app/jni/SKP_Silk_LPC_synthesis_order16.c
================================================
/***********************************************************************
Copyright (c) 2006-2012, Skype Limited. All rights reserved. 
Redistribution and use in source and binary forms, with or without 
modification, (subject to the limitations in the disclaimer below) 
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.
- Neither the name of Skype Limited, nor the names of specific 
contributors, may be used to endorse or promote products derived from 
this software without specific prior written permission.
NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED 
BY THIS LICENSE. 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.
***********************************************************************/

/*                                                                      *
 * SKP_Silk_LPC_synthesis_order16.c                                   *
 * Coefficients are in Q12                                              *
 *                                                                      *
 * 16th order AR filter                                                 *
 *                                                                      */
#include "SKP_Silk_SigProc_FIX.h"

/* 16th order AR filter */
void SKP_Silk_LPC_synthesis_order16(const SKP_int16 *in,          /* I:   excitation signal */
                                      const SKP_int16 *A_Q12,       /* I:   AR coefficients [16], between -8_Q0 and 8_Q0 */
                                      const SKP_int32 Gain_Q26,     /* I:   gain */
                                      SKP_int32 *S,                 /* I/O: state vector [16] */
                                      SKP_int16 *out,               /* O:   output signal */
                                      const SKP_int32 len           /* I:   signal length, must be multiple of 16 */
)
{
    SKP_int   k;
    SKP_int32 SA, SB, out32_Q10, out32;
#if !defined(_SYSTEM_IS_BIG_ENDIAN)
    SKP_int32 Atmp, A_align_Q12[ 8 ];
    /* combine two A_Q12 values and ensure 32-bit alignment */
    for( k = 0; k < 8; k++ ) {
        A_align_Q12[ k ] = ( ( ( SKP_int32 )A_Q12[ 2 * k ] ) & 0x0000ffff ) | SKP_LSHIFT( ( SKP_int32 )A_Q12[ 2 * k + 1 ], 16 );
    }
    /* S[] values are in Q14 */
    /* NOTE: the code below loads two int16 values in an int32, and multiplies each using the   */
    /* SMLAWB and SMLAWT instructions. On a big-endian CPU the two int16 variables would be     */
    /* loaded in reverse order and the code will give the wrong result. In that case swapping   */
    /* the SMLAWB and SMLAWT instructions should solve the problem.                             */
    for( k = 0; k < len; k++ ) {
        /* unrolled loop: prolog */
        /* multiply-add two prediction coefficients per iteration */
        SA = S[ 15 ];
        Atmp = A_align_Q12[ 0 ];
        SB = S[ 14 ];
        S[ 14 ] = SA;
        out32_Q10 = SKP_SMULWB(                  SA, Atmp );
        out32_Q10 = SKP_SMLAWT_ovflw( out32_Q10, SB, Atmp );
        SA = S[ 13 ];
        S[ 13 ] = SB;

        /* unrolled loop: main loop */
        Atmp = A_align_Q12[ 1 ];
        SB = S[ 12 ];
        S[ 12 ] = SA;
        out32_Q10 = SKP_SMLAWB_ovflw( out32_Q10, SA, Atmp );
        out32_Q10 = SKP_SMLAWT_ovflw( out32_Q10, SB, Atmp );
        SA = S[ 11 ];
        S[ 11 ] = SB;

        Atmp = A_align_Q12[ 2 ];
        SB = S[ 10 ];
        S[ 10 ] = SA;
        out32_Q10 = SKP_SMLAWB_ovflw( out32_Q10, SA, Atmp );
        out32_Q10 = SKP_SMLAWT_ovflw( out32_Q10, SB, Atmp );
        SA = S[ 9 ];
        S[ 9 ] = SB;

        Atmp = A_align_Q12[ 3 ];
        SB = S[ 8 ];
        S[ 8 ] = SA;
        out32_Q10 = SKP_SMLAWB_ovflw( out32_Q10, SA, Atmp );
        out32_Q10 = SKP_SMLAWT_ovflw( out32_Q10, SB, Atmp );
        SA = S[ 7 ];
        S[ 7 ] = SB;

        Atmp = A_align_Q12[ 4 ];
        SB = S[ 6 ];
        S[ 6 ] = SA;
        out32_Q10 = SKP_SMLAWB_ovflw( out32_Q10, SA, Atmp );
        out32_Q10 = SKP_SMLAWT_ovflw( out32_Q10, SB, Atmp );
        SA = S[ 5 ];
        S[ 5 ] = SB;

        Atmp = A_align_Q12[ 5 ];
        SB = S[ 4 ];
        S[ 4 ] = SA;
        out32_Q10 = SKP_SMLAWB_ovflw( out32_Q10, SA, Atmp );
        out32_Q10 = SKP_SMLAWT_ovflw( out32_Q10, SB, Atmp );
        SA = S[ 3 ];
        S[ 3 ] = SB;

        Atmp = A_align_Q12[ 6 ];
        SB = S[ 2 ];
        S[ 2 ] = SA;
        out32_Q10 = SKP_SMLAWB_ovflw( out32_Q10, SA, Atmp );
        out32_Q10 = SKP_SMLAWT_ovflw( out32_Q10, SB, Atmp );
        SA = S[ 1 ];
        S[ 1 ] = SB;

        /* unrolled loop: epilog */
        Atmp = A_align_Q12[ 7 ];
        SB = S[ 0 ];
        S[ 0 ] = SA;
        out32_Q10 = SKP_SMLAWB_ovflw( out32_Q10, SA, Atmp );
        out32_Q10 = SKP_SMLAWT_ovflw( out32_Q10, SB, Atmp );

        /* unrolled loop: end */
        /* apply gain to excitation signal and add to prediction */
        out32_Q10 = SKP_ADD_SAT32( out32_Q10, SKP_SMULWB( Gain_Q26, in[ k ] ) );

        /* scale to Q0 */
        out32 = SKP_RSHIFT_ROUND( out32_Q10, 10 );

        /* saturate output */
        out[ k ] = ( SKP_int16 )SKP_SAT16( out32 );

        /* move result into delay line */
        S[ 15 ] = SKP_LSHIFT_SAT32( out32_Q10, 4 );
    }
#else
    for( k = 0; k < len; k++ ) {
        /* unrolled loop: prolog */
        /* multiply-add two prediction coefficients per iteration */
        SA = S[ 15 ];
        SB = S[ 14 ];
        S[ 14 ] = SA;
        out32_Q10 = SKP_SMULWB(                  SA, A_Q12[ 0 ] );
        out32_Q10 = SKP_SMLAWB_ovflw( out32_Q10, SB, A_Q12[ 1 ] );
        SA = S[ 13 ];
        S[ 13 ] = SB;

        /* unrolled loop: main loop */
        SB = S[ 12 ];
        S[ 12 ] = SA;
        out32_Q10 = SKP_SMLAWB_ovflw( out32_Q10, SA, A_Q12[ 2 ] );
        out32_Q10 = SKP_SMLAWB_ovflw( out32_Q10, SB, A_Q12[ 3 ] );
        SA = S[ 11 ];
        S[ 11 ] = SB;

        SB = S[ 10 ];
        S[ 10 ] = SA;
        out32_Q10 = SKP_SMLAWB_ovflw( out32_Q10, SA, A_Q12[ 4 ] );
        out32_Q10 = SKP_SMLAWB_ovflw( out32_Q10, SB, A_Q12[ 5 ] );
        SA = S[ 9 ];
        S[ 9 ] = SB;

        SB = S[ 8 ];
        S[ 8 ] = SA;
        out32_Q10 = SKP_SMLAWB_ovflw( out32_Q10, SA, A_Q12[ 6 ] );
        out32_Q10 = SKP_SMLAWB_ovflw( out32_Q10, SB, A_Q12[ 7 ] );
        SA = S[ 7 ];
        S[ 7 ] = SB;

        SB = S[ 6 ];
        S[ 6 ] = SA;
        out32_Q10 = SKP_SMLAWB_ovflw( out32_Q10, SA, A_Q12[ 8 ] );
        out32_Q10 = SKP_SMLAWB_ovflw( out32_Q10, SB, A_Q12[ 9 ] );
        SA = S[ 5 ];
        S[ 5 ] = SB;

        SB = S[ 4 ];
        S[ 4 ] = SA;
        out32_Q10 = SKP_SMLAWB_ovflw( out32_Q10, SA, A_Q12[ 10 ] );
        out32_Q10 = SKP_SMLAWB_ovflw( out32_Q10, SB, A_Q12[ 11 ] );
        SA = S[ 3 ];
        S[ 3 ] = SB;

        SB = S[ 2 ];
        S[ 2 ] = SA;
        out32_Q10 = SKP_SMLAWB_ovflw( out32_Q10, SA, A_Q12[ 12 ] );
        out32_Q10 = SKP_SMLAWB_ovflw( out32_Q10, SB, A_Q12[ 13 ] );
        SA = S[ 1 ];
        S[ 1 ] = SB;

        /* unrolled loop: epilog */
        SB = S[ 0 ];
        S[ 0 ] = SA;
        out32_Q10 = SKP_SMLAWB_ovflw( out32_Q10, SA, A_Q12[ 14 ] );
        out32_Q10 = SKP_SMLAWB_ovflw( out32_Q10, SB, A_Q12[ 15 ] );

        /* unrolled loop: end */
        /* apply gain to excitation signal and add to prediction */
        out32_Q10 = SKP_ADD_SAT32( out32_Q10, SKP_SMULWB( Gain_Q26, in[ k ] ) );

        /* scale to Q0 */
        out32 = SKP_RSHIFT_ROUND( out32_Q10, 10 );

        /* saturate output */
        out[ k ] = ( SKP_int16 )SKP_SAT16( out32 );

        /* move result into delay line */
        S[ 15 ] = SKP_LSHIFT_SAT32( out32_Q10, 4 );
    }
#endif
}




================================================
FILE: app/jni/SKP_Silk_LP_variable_cutoff.c
================================================
/***********************************************************************
Copyright (c) 2006-2012, Skype Limited. All rights reserved. 
Redistribution and use in source and binary forms, with or without 
modification, (subject to the limitations in the disclaimer below) 
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.
- Neither the name of Skype Limited, nor the names of specific 
contributors, may be used to endorse or promote products derived from 
this software without specific prior written permission.
NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED 
BY THIS LICENSE. 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.
***********************************************************************/

/* 

    Elliptic/Cauer filters designed with 0.1 dB passband ripple, 
        80 dB minimum stopband attenuation, and
        [0.95 : 0.15 : 0.35] normalized cut off frequencies.

*/
#include "SKP_Silk_main.h"

#if SWITCH_TRANSITION_FILTERING

/* Helper function, that interpolates the filter taps */
SKP_INLINE void SKP_Silk_LP_interpolate_filter_taps( 
    SKP_int32           B_Q28[ TRANSITION_NB ], 
    SKP_int32           A_Q28[ TRANSITION_NA ],
    const SKP_int       ind,
    const SKP_int32     fac_Q16
)
{
    SKP_int nb, na;

    if( ind < TRANSITION_INT_NUM - 1 ) {
        if( fac_Q16 > 0 ) {
            if( fac_Q16 == SKP_SAT16( fac_Q16 ) ) { /* fac_Q16 is in range of a 16-bit int */
                /* Piece-wise linear interpolation of B and A */
                for( nb = 0; nb < TRANSITION_NB; nb++ ) {
                    B_Q28[ nb ] = SKP_SMLAWB(
                        SKP_Silk_Transition_LP_B_Q28[ ind     ][ nb ],
                        SKP_Silk_Transition_LP_B_Q28[ ind + 1 ][ nb ] -
                        SKP_Silk_Transition_LP_B_Q28[ ind     ][ nb ],
                        fac_Q16 );
                }
                for( na = 0; na < TRANSITION_NA; na++ ) {
                    A_Q28[ na ] = SKP_SMLAWB(
                        SKP_Silk_Transition_LP_A_Q28[ ind     ][ na ],
                        SKP_Silk_Transition_LP_A_Q28[ ind + 1 ][ na ] -
                        SKP_Silk_Transition_LP_A_Q28[ ind     ][ na ],
                        fac_Q16 );
                }
            } else if( fac_Q16 == ( 1 << 15 ) ) { /* Neither fac_Q16 nor ( ( 1 << 16 ) - fac_Q16 ) is in range of a 16-bit int */

                /* Piece-wise linear interpolation of B and A */
                for( nb = 0; nb < TRANSITION_NB; nb++ ) {
                    B_Q28[ nb ] = SKP_RSHIFT( 
                        SKP_Silk_Transition_LP_B_Q28[ ind     ][ nb ] +
                        SKP_Silk_Transition_LP_B_Q28[ ind + 1 ][ nb ],
                        1 );
                }
                for( na = 0; na < TRANSITION_NA; na++ ) {
                    A_Q28[ na ] = SKP_RSHIFT( 
                        SKP_Silk_Transition_LP_A_Q28[ ind     ][ na ] + 
                        SKP_Silk_Transition_LP_A_Q28[ ind + 1 ][ na ], 
                        1 );
                }
            } else { /* ( ( 1 << 16 ) - fac_Q16 ) is in range of a 16-bit int */
                
                SKP_assert( ( ( 1 << 16 ) - fac_Q16 ) == SKP_SAT16( ( ( 1 << 16 ) - fac_Q16) ) );
                /* Piece-wise linear interpolation of B and A */
                for( nb = 0; nb < TRANSITION_NB; nb++ ) {
                    B_Q28[ nb ] = SKP_SMLAWB(
                        SKP_Silk_Transition_LP_B_Q28[ ind + 1 ][ nb ],
                        SKP_Silk_Transition_LP_B_Q28[ ind     ][ nb ] -
                        SKP_Silk_Transition_LP_B_Q28[ ind + 1 ][ nb ],
                        ( 1 << 16 ) - fac_Q16 );
                }
                for( na = 0; na < TRANSITION_NA; na++ ) {
                    A_Q28[ na ] = SKP_SMLAWB(
                        SKP_Silk_Transition_LP_A_Q28[ ind + 1 ][ na ],
                        SKP_Silk_Transition_LP_A_Q28[ ind     ][ na ] -
                        SKP_Silk_Transition_LP_A_Q28[ ind + 1 ][ na ],
                        ( 1 << 16 ) - fac_Q16 );
                }
            }
        } else {
            SKP_memcpy( B_Q28, SKP_Silk_Transition_LP_B_Q28[ ind ], TRANSITION_NB * sizeof( SKP_int32 ) );
            SKP_memcpy( A_Q28, SKP_Silk_Transition_LP_A_Q28[ ind ], TRANSITION_NA * sizeof( SKP_int32 ) );
        }
    } else {
        SKP_memcpy( B_Q28, SKP_Silk_Transition_LP_B_Q28[ TRANSITION_INT_NUM - 1 ], TRANSITION_NB * sizeof( SKP_int32 ) );
        SKP_memcpy( A_Q28, SKP_Silk_Transition_LP_A_Q28[ TRANSITION_INT_NUM - 1 ], TRANSITION_NA * sizeof( SKP_int32 ) );
    }
}

/* Low-pass filter with variable cutoff frequency based on  */
/* piece-wise linear interpolation between elliptic filters */
/* Start by setting psEncC->transition_frame_no = 1;            */
/* Deactivate by setting psEncC->transition_frame_no = 0;   */
void SKP_Silk_LP_variable_cutoff(
    SKP_Silk_LP_state               *psLP,          /* I/O  LP filter state                     */
    SKP_int16                       *out,           /* O    Low-pass filtered output signal     */
    const SKP_int16                 *in,            /* I    Input signal                        */
    const SKP_int                   frame_length    /* I    Frame length                        */
)
{
    SKP_int32   B_Q28[ TRANSITION_NB ], A_Q28[ TRANSITION_NA ], fac_Q16 = 0;
    SKP_int     ind = 0;

    SKP_assert( psLP->transition_frame_no >= 0 );
    SKP_assert( ( ( ( psLP->transition_frame_no <= TRANSITION_FRAMES_DOWN ) && ( psLP->mode == 0 ) ) || 
                  ( ( psLP->transition_frame_no <= TRANSITION_FRAMES_UP   ) && ( psLP->mode == 1 ) ) ) );

    /* Interpolate filter coefficients if needed */
    if( psLP->transition_frame_no > 0 ) {
        if( psLP->mode == 0 ) {
            if( psLP->transition_frame_no < TRANSITION_FRAMES_DOWN ) {
                /* Calculate index and interpolation factor for interpolation */
#if( TRANSITION_INT_STEPS_DOWN == 32 )
                fac_Q16 = SKP_LSHIFT( psLP->transition_frame_no, 16 - 5 );
#else
                fac_Q16 = SKP_DIV32_16( SKP_LSHIFT( psLP->transition_frame_no, 16 ), TRANSITION_INT_STEPS_DOWN );
#endif
                ind      = SKP_RSHIFT( fac_Q16, 16 );
                fac_Q16 -= SKP_LSHIFT( ind, 16 );

                SKP_assert( ind >= 0 );
                SKP_assert( ind < TRANSITION_INT_NUM );

                /* Interpolate filter coefficients */
                SKP_Silk_LP_interpolate_filter_taps( B_Q28, A_Q28, ind, fac_Q16 );

                /* Increment transition frame number for next frame */
                psLP->transition_frame_no++;

            } else {
                SKP_assert( psLP->transition_frame_no == TRANSITION_FRAMES_DOWN );
                /* End of transition phase */
                SKP_Silk_LP_interpolate_filter_taps( B_Q28, A_Q28, TRANSITION_INT_NUM - 1, 0 );
            }
        } else {
            SKP_assert( psLP->mode == 1 );
            if( psLP->transition_frame_no < TRANSITION_FRAMES_UP ) {
                /* Calculate index and interpolation factor for interpolation */
#if( TRANSITION_INT_STEPS_UP == 64 )
                fac_Q16 = SKP_LSHIFT( TRANSITION_FRAMES_UP - psLP->transition_frame_no, 16 - 6 );
#else
                fac_Q16 = SKP_DIV32_16( SKP_LSHIFT( TRANSITION_FRAMES_UP - psLP->transition_frame_no, 16 ), TRANSITION_INT_STEPS_UP );
#endif
                ind      = SKP_RSHIFT( fac_Q16, 16 );
                fac_Q16 -= SKP_LSHIFT( ind, 16 );

                SKP_assert( ind >= 0 );
                SKP_assert( ind < TRANSITION_INT_NUM );

                /* Interpolate filter coefficients */
                SKP_Silk_LP_interpolate_filter_taps( B_Q28, A_Q28, ind, fac_Q16 );

                /* Increment transition frame number for next frame */
                psLP->transition_frame_no++;
            
            } else {
                SKP_assert( psLP->transition_frame_no == TRANSITION_FRAMES_UP );
                /* End of transition phase */
                SKP_Silk_LP_interpolate_filter_taps( B_Q28, A_Q28, 0, 0 );
            }
        }
    } 
    
    if( psLP->transition_frame_no > 0 ) {
        /* ARMA low-pass filtering */
        SKP_assert( TRANSITION_NB == 3 && TRANSITION_NA == 2 );
        SKP_Silk_biquad_alt( in, B_Q28, A_Q28, psLP->In_LP_State, out, frame_length );
    } else {
        /* Instead of using the filter, copy input directly to output */
        SKP_memcpy( out, in, frame_length * sizeof( SKP_int16 ) );
    }
}
#endif


================================================
FILE: app/jni/SKP_Silk_LSF_cos_table.c
================================================
/***********************************************************************
Copyright (c) 2006-2012, Skype Limited. All rights reserved. 
Redistribution and use in source and binary forms, with or without 
modification, (subject to the limitations in the disclaimer below) 
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.
- Neither the name of Skype Limited, nor the names of specific 
contributors, may be used to endorse or promote products derived from 
this software without specific prior written permission.
NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED 
BY THIS LICENSE. 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.
***********************************************************************/

#include "SKP_Silk_SigProc_FIX.h"

// Q12 values (even)
const SKP_int SKP_Silk_LSFCosTab_FIX_Q12[LSF_COS_TAB_SZ_FIX + 1] = {
            8192,             8190,             8182,             8170,     
            8152,             8130,             8104,             8072,     
            8034,             7994,             7946,             7896,     
            7840,             7778,             7714,             7644,     
            7568,             7490,             7406,             7318,     
            7226,             7128,             7026,             6922,     
            6812,             6698,             6580,             6458,     
            6332,             6204,             6070,             5934,     
            5792,             5648,             5502,             5352,     
            5198,             5040,             4880,             4718,     
            4552,             4382,             4212,             4038,     
            3862,             3684,             3502,             3320,     
            3136,             2948,             2760,             2570,     
            2378,             2186,             1990,             1794,     
            1598,             1400,             1202,             1002,     
             802,              602,              402,              202,     
               0,             -202,             -402,             -602,     
            -802,            -1002,            -1202,            -1400,     
           -1598,            -1794,            -1990,            -2186,     
           -2378,            -2570,            -2760,            -2948,     
           -3136,            -3320,            -3502,            -3684,     
           -3862,            -4038,            -4212,            -4382,     
           -4552,            -4718,            -4880,            -5040,     
           -5198,            -5352,            -5502,            -5648,     
           -5792,            -5934,            -6070,            -6204,     
           -6332,            -6458,            -6580,            -6698,     
           -6812,            -6922,            -7026,            -7128,     
           -7226,            -7318,            -7406,            -7490,     
           -7568,            -7644,            -7714,            -7778,     
           -7840,            -7896,            -7946,            -7994,     
           -8034,            -8072,            -8104,            -8130,     
           -8152,            -8170,            -8182,            -8190,     
           -8192
};


================================================
FILE: app/jni/SKP_Silk_LTP_analysis_filter_FIX.c
================================================
/***********************************************************************
Copyright (c) 2006-2012, Skype Limited. All rights reserved. 
Redistribution and use in source and binary forms, with or without 
modification, (subject to the limitations in the disclaimer below) 
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.
- Neither the name of Skype Limited, nor the names of specific 
contributors, may be used to endorse or promote products derived from 
this software without specific prior written permission.
NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED 
BY THIS LICENSE. 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.
***********************************************************************/

#include "SKP_Silk_main_FIX.h"

void SKP_Silk_LTP_analysis_filter_FIX(
    SKP_int16       *LTP_res,                           /* O:   LTP residual signal of length NB_SUBFR * ( pre_length + subfr_length )  */
    const SKP_int16 *x,                                 /* I:   Pointer to input signal with at least max( pitchL ) preceeding samples  */
    const SKP_int16 LTPCoef_Q14[ LTP_ORDER * NB_SUBFR ],/* I:   LTP_ORDER LTP coefficients for each NB_SUBFR subframe                   */
    const SKP_int   pitchL[ NB_SUBFR ],                 /* I:   Pitch lag, one for each subframe                                        */
    const SKP_int32 invGains_Q16[ NB_SUBFR ],           /* I:   Inverse quantization gains, one for each subframe                       */
    const SKP_int   subfr_length,                       /* I:   Length of each subframe                                                 */
    const SKP_int   pre_length                          /* I:   Length of the preceeding samples starting at &x[0] for each subframe    */
)
{
    const SKP_int16 *x_ptr, *x_lag_ptr;
    SKP_int16   Btmp_Q14[ LTP_ORDER ];
    SKP_int16   *LTP_res_ptr;
    SKP_int     k, i, j;
    SKP_int32   LTP_est;

    x_ptr = x;
    LTP_res_ptr = LTP_res;
    for( k = 0; k < NB_SUBFR; k++ ) {

        x_lag_ptr = x_ptr - pitchL[ k ];
        for( i = 0; i < LTP_ORDER; i++ ) {
            Btmp_Q14[ i ] = LTPCoef_Q14[ k * LTP_ORDER + i ];
        }

        /* LTP analysis FIR filter */
        for( i = 0; i < subfr_length + pre_length; i++ ) {
            LTP_res_ptr[ i ] = x_ptr[ i ];
            
            /* Long-term prediction */
            LTP_est = SKP_SMULBB( x_lag_ptr[ LTP_ORDER / 2 ], Btmp_Q14[ 0 ] );
            for( j = 1; j < LTP_ORDER; j++ ) {
                LTP_est = SKP_SMLABB_ovflw( LTP_est, x_lag_ptr[ LTP_ORDER / 2 - j ], Btmp_Q14[ j ] );
			}
            LTP_est = SKP_RSHIFT_ROUND( LTP_est, 14 ); // round and -> Q0

            /* Subtract long-term prediction */
            LTP_res_ptr[ i ] = ( SKP_int16 )SKP_SAT16( ( SKP_int32 )x_ptr[ i ] - LTP_est );

            /* Scale residual */
            LTP_res_ptr[ i ] = SKP_SMULWB( invGains_Q16[ k ], LTP_res_ptr[ i ] );

            x_lag_ptr++;
        }

        /* Update pointers */
        LTP_res_ptr += subfr_length + pre_length; 
        x_ptr       += subfr_length;
    }
}



================================================
FILE: app/jni/SKP_Silk_LTP_scale_ctrl_FIX.c
================================================
/***********************************************************************
Copyright (c) 2006-2012, Skype Limited. All rights reserved. 
Redistribution and use in source and binary forms, with or without 
modification, (subject to the limitations in the disclaimer below) 
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.
- Neither the name of Skype Limited, nor the names of specific 
contributors, may be used to endorse or promote products derived from 
this software without specific prior written permission.
NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED 
BY THIS LICENSE. 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.
***********************************************************************/

#include "SKP_Silk_main_FIX.h"

#define NB_THRESHOLDS           11

/* Table containing trained thresholds for LTP scaling */
static const SKP_int16 LTPScaleThresholds_Q15[ NB_THRESHOLDS ] = 
{
    31129, 26214, 16384, 13107, 9830, 6554,
     4915,  3276,  2621,  2458,    0
};

void SKP_Silk_LTP_scale_ctrl_FIX(
    SKP_Silk_encoder_state_FIX      *psEnc,     /* I/O  encoder state FIX                           */
    SKP_Silk_encoder_control_FIX    *psEncCtrl  /* I/O  encoder control FIX                         */
)
{
    SKP_int round_loss, frames_per_packet;
    SKP_int g_out_Q5, g_limit_Q15, thrld1_Q15, thrld2_Q15;

    /* 1st order high-pass filter */
    psEnc->HPLTPredCodGain_Q7 = SKP_max_int( psEncCtrl->LTPredCodGain_Q7 - psEnc->prevLTPredCodGain_Q7, 0 ) 
        + SKP_RSHIFT_ROUND( psEnc->HPLTPredCodGain_Q7, 1 );
    
    psEnc->prevLTPredCodGain_Q7 = psEncCtrl->LTPredCodGain_Q7;

    /* combine input and filtered input */
    g_out_Q5    = SKP_RSHIFT_ROUND( SKP_RSHIFT( psEncCtrl->LTPredCodGain_Q7, 1 ) + SKP_RSHIFT( psEnc->HPLTPredCodGain_Q7, 1 ), 3 );
    g_limit_Q15 = SKP_Silk_sigm_Q15( g_out_Q5 - ( 3 << 5 ) );
            
    /* Default is minimum scaling */
    psEncCtrl->sCmn.LTP_scaleIndex = 0;

    /* Round the loss measure to whole pct */
    round_loss = ( SKP_int )psEnc->sCmn.PacketLoss_perc;

    /* Only scale if first frame in packet 0% */
    if( psEnc->sCmn.nFramesInPayloadBuf == 0 ) {
        
        frames_per_packet = SKP_DIV32_16( psEnc->sCmn.PacketSize_ms, FRAME_LENGTH_MS );

        round_loss += frames_per_packet - 1;
        thrld1_Q15 = LTPScaleThresholds_Q15[ SKP_min_int( round_loss,     NB_THRESHOLDS - 1 ) ];
        thrld2_Q15 = LTPScaleThresholds_Q15[ SKP_min_int( round_loss + 1, NB_THRESHOLDS - 1 ) ];
    
        if( g_limit_Q15 > thrld1_Q15 ) {
            /* Maximum scaling */
            psEncCtrl->sCmn.LTP_scaleIndex = 2;
        } else if( g_limit_Q15 > thrld2_Q15 ) {
            /* Medium scaling */
            psEncCtrl->sCmn.LTP_scaleIndex = 1;
        }
    }
    psEncCtrl->LTP_scale_Q14 = SKP_Silk_LTPScales_table_Q14[ psEncCtrl->sCmn.LTP_scaleIndex ];
}


================================================
FILE: app/jni/SKP_Silk_MA.c
================================================
/***********************************************************************
Copyright (c) 2006-2012, Skype Limited. All rights reserved. 
Redistribution and use in source and binary forms, with or without 
modification, (subject to the limitations in the disclaimer below) 
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.
- Neither the name of Skype Limited, nor the names of specific 
contributors, may be used to endorse or promote products derived from 
this software without specific prior written permission.
NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED 
BY THIS LICENSE. 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.
***********************************************************************/

/*                                                                      *
 * SKP_Silk_MA.c                                                      *
 *                                                                      *
 * Variable order MA filter                                             *
 *                                                                      *
 * Copyright 2006 (c), Skype Limited                                    *
 * Date: 060221                                                         *
 *                                                                      */
#include "SKP_Silk_SigProc_FIX.h"

#if EMBEDDED_ARM<5
/* Variable order MA prediction error filter */
void SKP_Silk_MA_Prediction(
    const SKP_int16      *in,            /* I:   Input signal                                */
    const SKP_int16      *B,             /* I:   MA prediction coefficients, Q12 [order]     */
    SKP_int32            *S,             /* I/O: State vector [order]                        */
    SKP_int16            *out,           /* O:   Output signal                               */
    const SKP_int32      len,            /* I:   Signal length                               */
    const SKP_int32      order           /* I:   Filter order                                */
)
{
    SKP_int   k, d, in16;
    SKP_int32 out32;

    for( k = 0; k < len; k++ ) {
        in16 = in[ k ];
        out32 = SKP_LSHIFT( in16, 12 ) - S[ 0 ];
        out32 = SKP_RSHIFT_ROUND( out32, 12 );
        
        for( d = 0; d < order - 1; d++ ) {
            S[ d ] = SKP_SMLABB_ovflw( S[ d + 1 ], in16, B[ d ] );
        }
        S[ order - 1 ] = SKP_SMULBB( in16, B[ order - 1 ] );

        /* Limit */
        out[ k ] = (SKP_int16)SKP_SAT16( out32 );
    }
}
#endif

#if EMBEDDED_ARM<5

void SKP_Silk_LPC_analysis_filter(
    const SKP_int16      *in,            /* I:   Input signal                                */
    const SKP_int16      *B,             /* I:   MA prediction coefficients, Q12 [order]     */
    SKP_int16            *S,             /* I/O: State vector [order]                        */
    SKP_int16            *out,           /* O:   Output signal                               */
    const SKP_int32      len,            /* I:   Signal length                               */
    const SKP_int32      Order           /* I:   Filter order                                */
)
{
    SKP_int   k, j, idx, Order_half = SKP_RSHIFT( Order, 1 );
    SKP_int32 out32_Q12, out32;
    SKP_int16 SA, SB;
    /* Order must be even */
    SKP_assert( 2 * Order_half == Order );

    /* S[] values are in Q0 */
    for( k = 0; k < len; k++ ) {
        SA = S[ 0 ];
        out32_Q12 = 0;
        for( j = 0; j < ( Order_half - 1 ); j++ ) {
            idx = SKP_SMULBB( 2, j ) + 1;
            /* Multiply-add two prediction coefficients for each loop */
            SB = S[ idx ];
            S[ idx ] = SA;
            out32_Q12 = SKP_SMLABB( out32_Q12, SA, B[ idx - 1 ] );
            out32_Q12 = SKP_SMLABB( out32_Q12, SB, B[ idx ] );
            SA = S[ idx + 1 ];
            S[ idx + 1 ] = SB;
        }

        /* Unrolled loop: epilog */
        SB = S[ Order - 1 ];
        S[ Order - 1 ] = SA;
        out32_Q12 = SKP_SMLABB( out32_Q12, SA, B[ Order - 2 ] );
        out32_Q12 = SKP_SMLABB( out32_Q12, SB, B[ Order - 1 ] );

        /* Subtract prediction */
        out32_Q12 = SKP_SUB_SAT32( SKP_LSHIFT( (SKP_int32)in[ k ], 12 ), out32_Q12 );

        /* Scale to Q0 */
        out32 = SKP_RSHIFT_ROUND( out32_Q12, 12 );

        /* Saturate output */
        out[ k ] = ( SKP_int16 )SKP_SAT16( out32 );

        /* Move input line */
        S[ 0 ] = in[ k ];
    }
}
#endif



================================================
FILE: app/jni/SKP_Silk_NLSF2A.c
================================================
/***********************************************************************
Copyright (c) 2006-2012, Skype Limited. All rights reserved. 
Redistribution and use in source and binary forms, with or without 
modification, (subject to the limitations in the disclaimer below) 
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.
- Neither the name of Skype Limited, nor the names of specific 
contributors, may be used to endorse or promote products derived from 
this software without specific prior written permission.
NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED 
BY THIS LICENSE. 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.
***********************************************************************/

/* conversion between prediction filter coefficients and LSFs   */
/* order should be even                                         */
/* a piecewise linear approximation maps LSF <-> cos(LSF)       */
/* therefore the result is not accurate LSFs, but the two       */
/* function are accurate inverses of each other                 */

#include "SKP_Silk_SigProc_FIX.h"

/* helper function for NLSF2A(..) */
SKP_INLINE void SKP_Silk_NLSF2A_find_poly(
    SKP_int32        *out,        /* o    intermediate polynomial, Q20            */
    const SKP_int32    *cLSF,     /* i    vector of interleaved 2*cos(LSFs), Q20  */
    SKP_int            dd         /* i    polynomial order (= 1/2 * filter order) */
)
{
    SKP_int        k, n;
    SKP_int32    ftmp;

    out[0] = SKP_LSHIFT( 1, 20 );
    out[1] = -cLSF[0];
    for( k = 1; k < dd; k++ ) {
        ftmp = cLSF[2*k];            // Q20
        out[k+1] = SKP_LSHIFT( out[k-1], 1 ) - (SKP_int32)SKP_RSHIFT_ROUND64( SKP_SMULL( ftmp, out[k] ), 20 );
        for( n = k; n > 1; n-- ) {
            out[n] += out[n-2] - (SKP_int32)SKP_RSHIFT_ROUND64( SKP_SMULL( ftmp, out[n-1] ), 20 );
        }
        out[1] -= ftmp;
    }
}

/* compute whitening filter coefficients from normalized line spectral frequencies */
void SKP_Silk_NLSF2A(
    SKP_int16       *a,               /* o    monic whitening filter coefficients in Q12,  [d]    */
    const SKP_int    *NLSF,           /* i    normalized line spectral frequencies in Q15, [d]    */
    const SKP_int    d                /* i    filter order (should be even)                       */
)
{
    SKP_int k, i, dd;
    SKP_int32 cos_LSF_Q20[SKP_Silk_MAX_ORDER_LPC];
    SKP_int32 P[SKP_Silk_MAX_ORDER_LPC/2+1], Q[SKP_Silk_MAX_ORDER_LPC/2+1];
    SKP_int32 Ptmp, Qtmp;
    SKP_int32 f_int;
    SKP_int32 f_frac;
    SKP_int32 cos_val, delta;
    SKP_int32 a_int32[SKP_Silk_MAX_ORDER_LPC];
    SKP_int32 maxabs, absval, idx=0, sc_Q16; 

    SKP_assert(LSF_COS_TAB_SZ_FIX == 128);

    /* convert LSFs to 2*cos(LSF(i)), using piecewise linear curve from table */
    for( k = 0; k < d; k++ ) {
        SKP_assert(NLSF[k] >= 0 );
        SKP_assert(NLSF[k] <= 32767 );

        /* f_int on a scale 0-127 (rounded down) */
        f_int = SKP_RSHIFT( NLSF[k], 15 - 7 ); 
        
        /* f_frac, range: 0..255 */
        f_frac = NLSF[k] - SKP_LSHIFT( f_int, 15 - 7 ); 

        SKP_assert(f_int >= 0);
        SKP_assert(f_int < LSF_COS_TAB_SZ_FIX );

        /* Read start and end value from table */
        cos_val = SKP_Silk_LSFCosTab_FIX_Q12[ f_int ];                /* Q12 */
        delta   = SKP_Silk_LSFCosTab_FIX_Q12[ f_int + 1 ] - cos_val;  /* Q12, with a range of 0..200 */

        /* Linear interpolation */
        cos_LSF_Q20[k] = SKP_LSHIFT( cos_val, 8 ) + SKP_MUL( delta, f_frac ); /* Q20 */
    }
    
    dd = SKP_RSHIFT( d, 1 );

    /* generate even and odd polynomials using convolution */
    SKP_Silk_NLSF2A_find_poly( P, &cos_LSF_Q20[0], dd );
    SKP_Silk_NLSF2A_find_poly( Q, &cos_LSF_Q20[1], dd );

    /* convert even and odd polynomials to SKP_int32 Q12 filter coefs */
    for( k = 0; k < dd; k++ ) {
        Ptmp = P[k+1] + P[k];
        Qtmp = Q[k+1] - Q[k];

        /* the Ptmp and Qtmp values at this stage need to fit in int32 */

        a_int32[k]     = -SKP_RSHIFT_ROUND( Ptmp + Qtmp, 9 ); /* Q20 -> Q12 */
        a_int32[d-k-1] =  SKP_RSHIFT_ROUND( Qtmp - Ptmp, 9 ); /* Q20 -> Q12 */
    }

    /* Limit the maximum absolute value of the prediction coefficients */
    for( i = 0; i < 10; i++ ) {
        /* Find maximum absolute value and its index */
        maxabs = 0;
        for( k = 0; k < d; k++ ) {
            absval = SKP_abs( a_int32[k] );
            if( absval > maxabs ) {
                maxabs = absval;
                idx       = k;
            }    
        }
    
        if( maxabs > SKP_int16_MAX ) {    
            /* Reduce magnitude of prediction coefficients */
            maxabs = SKP_min( maxabs, 98369 ); // ( SKP_int32_MAX / ( 65470 >> 2 ) ) + SKP_int16_MAX = 98369 
            sc_Q16 = 65470 - SKP_DIV32( SKP_MUL( 65470 >> 2, maxabs - SKP_int16_MAX ), 
                                        SKP_RSHIFT32( SKP_MUL( maxabs, idx + 1), 2 ) );
            SKP_Silk_bwexpander_32( a_int32, d, sc_Q16 );
        } else {
            break;
        }
    }    

    /* Reached the last iteration */
    if( i == 10 ) {
        SKP_assert(0);
        for( k = 0; k < d; k++ ) {
            a_int32[k] = SKP_SAT16( a_int32[k] ); 
        }
    }

    /* Return as SKP_int16 Q12 coefficients */
    for( k = 0; k < d; k++ ) {
        a[k] = (SKP_int16)a_int32[k];
    }
}


================================================
FILE: app/jni/SKP_Silk_NLSF2A_stable.c
================================================
/***********************************************************************
Copyright (c) 2006-2012, Skype Limited. All rights reserved. 
Redistribution and use in source and binary forms, with or without 
modification, (subject to the limitations in the disclaimer below) 
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.
- Neither the name of Skype Limited, nor the names of specific 
contributors, may be used to endorse or promote products derived from 
this software without specific prior written permission.
NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED 
BY THIS LICENSE. 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.
***********************************************************************/

#include "SKP_Silk_main.h"

/* Convert NLSF parameters to stable AR prediction filter coefficients */
void SKP_Silk_NLSF2A_stable(
    SKP_int16                       pAR_Q12[ MAX_LPC_ORDER ],   /* O    Stabilized AR coefs [LPC_order]     */ 
    const SKP_int                   pNLSF[ MAX_LPC_ORDER ],     /* I    NLSF vector         [LPC_order]     */
    const SKP_int                   LPC_order                   /* I    LPC/LSF order                       */
)
{
    SKP_int   i;
    SKP_int32 invGain_Q30;

    SKP_Silk_NLSF2A( pAR_Q12, pNLSF, LPC_order );

    /* Ensure stable LPCs */
    for( i = 0; i < MAX_LPC_STABILIZE_ITERATIONS; i++ ) {
        if( SKP_Silk_LPC_inverse_pred_gain( &invGain_Q30, pAR_Q12, LPC_order ) == 1 ) {
            SKP_Silk_bwexpander( pAR_Q12, LPC_order, 65536 - SKP_SMULBB( 10 + i, i ) );		/* 10_Q16 = 0.00015 */
        } else {
            break;
        }
    }

    /* Reached the last iteration */
    if( i == MAX_LPC_STABILIZE_ITERATIONS ) {
        SKP_assert( 0 );
        for( i = 0; i < LPC_order; i++ ) {
            pAR_Q12[ i ] = 0;
        }
    }
}


================================================
FILE: app/jni/SKP_Silk_NLSF_MSVQ_decode.c
================================================
/***********************************************************************
Copyright (c) 2006-2012, Skype Limited. All rights reserved. 
Redistribution and use in source and binary forms, with or without 
modification, (subject to the limitations in the disclaimer below) 
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.
- Neither the name of Skype Limited, nor the names of specific 
contributors, may be used to endorse or promote products derived from 
this software without specific prior written permission.
NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED 
BY THIS LICENSE. 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.
***********************************************************************/

#include "SKP_Silk_main.h"

/* NLSF vector decoder */
void SKP_Silk_NLSF_MSVQ_decode(
    SKP_int                         *pNLSF_Q15,     /* O    Pointer to decoded output vector [LPC_ORDER x 1]    */
    const SKP_Silk_NLSF_CB_struct   *psNLSF_CB,     /* I    Pointer to NLSF codebook struct                     */
    const SKP_int                   *NLSFIndices,   /* I    Pointer to NLSF indices          [nStages x 1]      */
    const SKP_int                   LPC_order       /* I    LPC order used                                      */
) 
{
    const SKP_int16 *pCB_element;
          SKP_int    s;
          SKP_int    i;

    /* Check that each index is within valid range */
    SKP_assert( 0 <= NLSFIndices[ 0 ] && NLSFIndices[ 0 ] < psNLSF_CB->CBStages[ 0 ].nVectors );

    /* Point to the first vector element */
    pCB_element = &psNLSF_CB->CBStages[ 0 ].CB_NLSF_Q15[ SKP_MUL( NLSFIndices[ 0 ], LPC_order ) ];

    /* Initialize with the codebook vector from stage 0 */
    for( i = 0; i < LPC_order; i++ ) {
        pNLSF_Q15[ i ] = ( SKP_int )pCB_element[ i ];
    }
          
    for( s = 1; s < psNLSF_CB->nStages; s++ ) {
        /* Check that each index is within valid range */
        SKP_assert( 0 <= NLSFIndices[ s ] && NLSFIndices[ s ] < psNLSF_CB->CBStages[ s ].nVectors );

        if( LPC_order == 16 ) {
            /* Point to the first vector element */
            pCB_element = &psNLSF_CB->CBStages[ s ].CB_NLSF_Q15[ SKP_LSHIFT( NLSFIndices[ s ], 4 ) ];

            /* Add the codebook vector from the current stage */
            pNLSF_Q15[  0 ] += pCB_element[  0 ];
            pNLSF_Q15[  1 ] += pCB_element[  1 ];
            pNLSF_Q15[  2 ] += pCB_element[  2 ];
            pNLSF_Q15[  3 ] += pCB_element[  3 ];
            pNLSF_Q15[  4 ] += pCB_element[  4 ];
            pNLSF_Q15[  5 ] += pCB_element[  5 ];
            pNLSF_Q15[  6 ] += pCB_element[  6 ];
            pNLSF_Q15[  7 ] += pCB_element[  7 ];
            pNLSF_Q15[  8 ] += pCB_element[  8 ];
            pNLSF_Q15[  9 ] += pCB_element[  9 ];
            pNLSF_Q15[ 10 ] += pCB_element[ 10 ];
            pNLSF_Q15[ 11 ] += pCB_element[ 11 ];
            pNLSF_Q15[ 12 ] += pCB_element[ 12 ];
            pNLSF_Q15[ 13 ] += pCB_element[ 13 ];
            pNLSF_Q15[ 14 ] += pCB_element[ 14 ];
            pNLSF_Q15[ 15 ] += pCB_element[ 15 ];
        } else {
            /* Point to the first vector element */
            pCB_element = &psNLSF_CB->CBStages[ s ].CB_NLSF_Q15[ SKP_SMULBB( NLSFIndices[ s ], LPC_order ) ];

            /* Add the codebook vector from the current stage */
            for( i = 0; i < LPC_order; i++ ) {
                pNLSF_Q15[ i ] += pCB_element[ i ];
            }
        }
    }

    /* NLSF stabilization */
    SKP_Silk_NLSF_stabilize( pNLSF_Q15, psNLSF_CB->NDeltaMin_Q15, LPC_order );
}


================================================
FILE: app/jni/SKP_Silk_NLSF_MSVQ_encode_FIX.c
================================================
/***********************************************************************
Copyright (c) 2006-2012, Skype Limited. All rights reserved. 
Redistribution and use in source and binary forms, with or without 
modification, (subject to the limitations in the disclaimer below) 
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.
- Neither the name of Skype Limited, nor the names of specific 
contributors, may be used to endorse or promote products derived from 
this software without specific prior written permission.
NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED 
BY THIS LICENSE. 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.
***********************************************************************/

#include "SKP_Silk_main_FIX.h"

/***********************/
/* NLSF vector encoder */
/***********************/
void SKP_Silk_NLSF_MSVQ_encode_FIX(
          SKP_int                   *NLSFIndices,           /* O    Codebook path vector [ CB_STAGES ]      */
          SKP_int                   *pNLSF_Q15,             /* I/O  Quantized NLSF vector [ LPC_ORDER ]     */
    const SKP_Silk_NLSF_CB_struct   *psNLSF_CB,             /* I    Codebook object                         */
    const SKP_int                   *pNLSF_q_Q15_prev,      /* I    Prev. quantized NLSF vector [LPC_ORDER] */
    const SKP_int                   *pW_Q6,                 /* I    NLSF weight vector [ LPC_ORDER ]        */
    const SKP_int                   NLSF_mu_Q15,            /* I    Rate weight for the RD optimization     */
    const SKP_int                   NLSF_mu_fluc_red_Q16,   /* I    Fluctuation reduction error weight      */
    const SKP_int                   NLSF_MSVQ_Survivors,    /* I    Max survivors from each stage           */
    const SKP_int                   LPC_order,              /* I    LPC order                               */
    const SKP_int                   deactivate_fluc_red     /* I    Deactivate fluctuation reduction        */
)
{
    SKP_int     i, s, k, cur_survivors = 0, prev_survivors, min_survivors, input_index, cb_index, bestIndex;
    SKP_int32   rateDistThreshold_Q18;
#if( NLSF_MSVQ_FLUCTUATION_REDUCTION == 1 )
    SKP_int32   se_Q15, wsse_Q20, bestRateDist_Q20;
#endif

#if( LOW_COMPLEXITY_ONLY == 1 )
    SKP_int32   pRateDist_Q18[  NLSF_MSVQ_TREE_SEARCH_MAX_VECTORS_EVALUATED_LC_MODE ];
    SKP_int32   pRate_Q5[       MAX_NLSF_MSVQ_SURVIVORS_LC_MODE ];
    SKP_int32   pRate_new_Q5[   MAX_NLSF_MSVQ_SURVIVORS_LC_MODE ];
    SKP_int     pTempIndices[   MAX_NLSF_MSVQ_SURVIVORS_LC_MODE ];
    SKP_int     pPath[          MAX_NLSF_MSVQ_SURVIVORS_LC_MODE * NLSF_MSVQ_MAX_CB_STAGES ];
    SKP_int     pPath_new[      MAX_NLSF_MSVQ_SURVIVORS_LC_MODE * NLSF_MSVQ_MAX_CB_STAGES ];
    SKP_int     pRes_Q15[       MAX_NLSF_MSVQ_SURVIVORS_LC_MODE * MAX_LPC_ORDER ];
    SKP_int     pRes_new_Q15[   MAX_NLSF_MSVQ_SURVIVORS_LC_MODE * MAX_LPC_ORDER ];
#else
    SKP_int32   pRateDist_Q18[  NLSF_MSVQ_TREE_SEARCH_MAX_VECTORS_EVALUATED ];
    SKP_int32   pRate_Q5[       MAX_NLSF_MSVQ_SURVIVORS ];
    SKP_int32   pRate_new_Q5[   MAX_NLSF_MSVQ_SURVIVORS ];
    SKP_int     pTempIndices[   MAX_NLSF_MSVQ_SURVIVORS ];
    SKP_int     pPath[          MAX_NLSF_MSVQ_SURVIVORS * NLSF_MSVQ_MAX_CB_STAGES ];
    SKP_int     pPath_new[      MAX_NLSF_MSVQ_SURVIVORS * NLSF_MSVQ_MAX_CB_STAGES ];
    SKP_int     pRes_Q15[       MAX_NLSF_MSVQ_SURVIVORS * MAX_LPC_ORDER ];
    SKP_int     pRes_new_Q15[   MAX_NLSF_MSVQ_SURVIVORS * MAX_LPC_ORDER ];
#endif

    const SKP_int   *pConstInt;
          SKP_int   *pInt;
    const SKP_int16 *pCB_element;
    const SKP_Silk_NLSF_CBS *pCurrentCBStage;

#ifdef USE_UNQUANTIZED_LSFS
    SKP_int NLSF_orig[ MAX_LPC_ORDER ];
    SKP_memcpy( NLSF_orig, pNLSF_Q15, LPC_order * sizeof( SKP_int ) );
#endif

    SKP_assert( NLSF_MSVQ_Survivors <= MAX_NLSF_MSVQ_SURVIVORS );
    SKP_assert( ( LOW_COMPLEXITY_ONLY == 0 ) || ( NLSF_MSVQ_Survivors <= MAX_NLSF_MSVQ_SURVIVORS_LC_MODE ) );


    /****************************************************/
    /* Tree search for the multi-stage vector quantizer */
    /****************************************************/

    /* Clear accumulated rates */
    SKP_memset( pRate_Q5, 0, NLSF_MSVQ_Survivors * sizeof( SKP_int32 ) );
    
    /* Copy NLSFs into residual signal vector */
    for( i = 0; i < LPC_order; i++ ) {
        pRes_Q15[ i ] = pNLSF_Q15[ i ];
    }

    /* Set first stage values */
    prev_survivors = 1;

    /* Minimum number of survivors */
    min_survivors = NLSF_MSVQ_Survivors / 2;

    /* Loop over all stages */
    for( s = 0; s < psNLSF_CB->nStages; s++ ) {

        /* Set a pointer to the current stage codebook */
        pCurrentCBStage = &psNLSF_CB->CBStages[ s ];

        /* Calculate the number of survivors in the current stage */
        cur_survivors = SKP_min_32( NLSF_MSVQ_Survivors, SKP_SMULBB( prev_survivors, pCurrentCBStage->nVectors ) );

#if( NLSF_MSVQ_FLUCTUATION_REDUCTION == 0 )
        /* Find a single best survivor in the last stage, if we */
        /* do not need candidates for fluctuation reduction     */
        if( s == psNLSF_CB->nStages - 1 ) {
            cur_survivors = 1;
        }
#endif

        /* Nearest neighbor clustering for multiple input data vectors */
        SKP_Silk_NLSF_VQ_rate_distortion_FIX( pRateDist_Q18, pCurrentCBStage, pRes_Q15, pW_Q6, 
            pRate_Q5, NLSF_mu_Q15, prev_survivors, LPC_order );

        /* Sort the rate-distortion errors */
        SKP_Silk_insertion_sort_increasing( pRateDist_Q18, pTempIndices, 
            prev_survivors * pCurrentCBStage->nVectors, cur_survivors );

        /* Discard survivors with rate-distortion values too far above the best one */
        if( pRateDist_Q18[ 0 ] < SKP_int32_MAX / MAX_NLSF_MSVQ_SURVIVORS ) {
            rateDistThreshold_Q18 = SKP_SMLAWB( pRateDist_Q18[ 0 ], 
                SKP_MUL( NLSF_MSVQ_Survivors, pRateDist_Q18[ 0 ] ), SKP_FIX_CONST( NLSF_MSVQ_SURV_MAX_REL_RD, 16 ) );
            while( pRateDist_Q18[ cur_survivors - 1 ] > rateDistThreshold_Q18 && cur_survivors > min_survivors ) {
                cur_survivors--;
            }
        }
        /* Update accumulated codebook contributions for the 'cur_survivors' best codebook indices */
        for( k = 0; k < cur_survivors; k++ ) { 
            if( s > 0 ) {
                /* Find the indices of the input and the codebook vector */
                if( pCurrentCBStage->nVectors == 8 ) {
                    input_index = SKP_RSHIFT( pTempIndices[ k ], 3 );
                    cb_index    = pTempIndices[ k ] & 7;
                } else {
                    input_index = SKP_DIV32_16( pTempIndices[ k ], pCurrentCBStage->nVectors );  
                    cb_index    = pTempIndices[ k ] - SKP_SMULBB( input_index, pCurrentCBStage->nVectors );
                }
            } else {
                /* Find the indices of the input and the codebook vector */
                input_index = 0;
                cb_index    = pTempIndices[ k ];
            }

            /* Subtract new contribution from the previous residual vector for each of 'cur_survivors' */
            pConstInt   = &pRes_Q15[ SKP_SMULBB( input_index, LPC_order ) ];
            pCB_element = &pCurrentCBStage->CB_NLSF_Q15[ SKP_SMULBB( cb_index, LPC_order ) ];
            pInt        = &pRes_new_Q15[ SKP_SMULBB( k, LPC_order ) ];
            for( i = 0; i < LPC_order; i++ ) {
                pInt[ i ] = pConstInt[ i ] - ( SKP_int )pCB_element[ i ];
            }

            /* Update accumulated rate for stage 1 to the current */
            pRate_new_Q5[ k ] = pRate_Q5[ input_index ] + pCurrentCBStage->Rates_Q5[ cb_index ];

            /* Copy paths from previous matrix, starting with the best path */
            pConstInt = &pPath[ SKP_SMULBB( input_index, psNLSF_CB->nStages ) ];
            pInt      = &pPath_new[ SKP_SMULBB( k, psNLSF_CB->nStages ) ];
            for( i = 0; i < s; i++ ) {
                pInt[ i ] = pConstInt[ i ];
            }
            /* Write the current stage indices for the 'cur_survivors' to the best path matrix */
            pInt[ s ] = cb_index;
        }

        if( s < psNLSF_CB->nStages - 1 ) {
            /* Copy NLSF residual matrix for next stage */
            SKP_memcpy( pRes_Q15, pRes_new_Q15, SKP_SMULBB( cur_survivors, LPC_order ) * sizeof( SKP_int ) );

            /* Copy rate vector for next stage */
            SKP_memcpy( pRate_Q5, pRate_new_Q5, cur_survivors * sizeof( SKP_int32 ) );

            /* Copy best path matrix for next stage */
            SKP_memcpy( pPath, pPath_new, SKP_SMULBB( cur_survivors, psNLSF_CB->nStages ) * sizeof( SKP_int ) );
        }

        prev_survivors = cur_survivors;
    }

    /* (Preliminary) index of the best survivor, later to be decoded */
    bestIndex = 0;

#if( NLSF_MSVQ_FLUCTUATION_REDUCTION == 1 )
    /******************************/
    /* NLSF fluctuation reduction */
    /******************************/
    if( deactivate_fluc_red != 1 ) {
    
        /* Search among all survivors, now taking also weighted fluctuation errors into account */
        bestRateDist_Q20 = SKP_int32_MAX;
        for( s = 0; s < cur_survivors; s++ ) {
            /* Decode survivor to compare with previous quantized NLSF vector */
            SKP_Silk_NLSF_MSVQ_decode( pNLSF_Q15, psNLSF_CB, &pPath_new[ SKP_SMULBB( s, psNLSF_CB->nStages ) ], LPC_order );

            /* Compare decoded NLSF vector with the previously quantized vector */ 
            wsse_Q20 = 0;
            for( i = 0; i < LPC_order; i += 2 ) {
                /* Compute weighted squared quantization error for index i */
                se_Q15 = pNLSF_Q15[ i ] - pNLSF_q_Q15_prev[ i ]; // range: [ -32767 : 32767 ]
                wsse_Q20 = SKP_SMLAWB( wsse_Q20, SKP_SMULBB( se_Q15, se_Q15 ), pW_Q6[ i ] );

                /* Compute weighted squared quantization error for index i + 1 */
                se_Q15 = pNLSF_Q15[ i + 1 ] - pNLSF_q_Q15_prev[ i + 1 ]; // range: [ -32767 : 32767 ]
                wsse_Q20 = SKP_SMLAWB( wsse_Q20, SKP_SMULBB( se_Q15, se_Q15 ), pW_Q6[ i + 1 ] );
            }
            SKP_assert( wsse_Q20 >= 0 );

            /* Add the fluctuation reduction penalty to the rate distortion error */
            wsse_Q20 = SKP_ADD_POS_SAT32( pRateDist_Q18[ s ], SKP_SMULWB( wsse_Q20, NLSF_mu_fluc_red_Q16 ) );

            /* Keep index of best survivor */
            if( wsse_Q20 < bestRateDist_Q20 ) {
                bestRateDist_Q20 = wsse_Q20;
                bestIndex = s;
            }
        }
    }
#endif

    /* Copy best path to output argument */
    SKP_memcpy( NLSFIndices, &pPath_new[ SKP_SMULBB( bestIndex, psNLSF_CB->nStages ) ], psNLSF_CB->nStages * sizeof( SKP_int ) );

    /* Decode and stabilize the best survivor */
    SKP_Silk_NLSF_MSVQ_decode( pNLSF_Q15, psNLSF_CB, NLSFIndices, LPC_order );

#ifdef USE_UNQUANTIZED_LSFS
    SKP_memcpy( pNLSF_Q15, NLSF_orig, LPC_order * sizeof( SKP_int ) );
#endif

}


================================================
FILE: app/jni/SKP_Silk_NLSF_VQ_rate_distortion_FIX.c
================================================
/***********************************************************************
Copyright (c) 2006-2012, Skype Limited. All rights reserved. 
Redistribution and use in source and binary forms, with or without 
modification, (subject to the limitations in the disclaimer below) 
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.
- Neither the name of Skype Limited, nor the names of specific 
contributors, may be used to endorse or promote products derived from 
this software without specific prior written permission.
NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED 
BY THIS LICENSE. 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.
***********************************************************************/

#include "SKP_Silk_main_FIX.h"

/* Rate-Distortion calculations for multiple input data vectors */
void SKP_Silk_NLSF_VQ_rate_distortion_FIX(
    SKP_int32                       *pRD_Q20,           /* O    Rate-distortion values [psNLSF_CBS->nVectors*N] */
    const SKP_Silk_NLSF_CBS         *psNLSF_CBS,        /* I    NLSF codebook stage struct                      */
    const SKP_int                   *in_Q15,            /* I    Input vectors to be quantized                   */
    const SKP_int                   *w_Q6,              /* I    Weight vector                                   */
    const SKP_int32                 *rate_acc_Q5,       /* I    Accumulated rates from previous stage           */
    const SKP_int                   mu_Q15,             /* I    Weight between weighted error and rate          */
    const SKP_int                   N,                  /* I    Number of input vectors to be quantized         */
    const SKP_int                   LPC_order           /* I    LPC order                                       */
)
{
    SKP_int   i, n;
    SKP_int32 *pRD_vec_Q20;

    /* Compute weighted quantization errors for all input vectors over one codebook stage */
    SKP_Silk_NLSF_VQ_sum_error_FIX( pRD_Q20, in_Q15, w_Q6, psNLSF_CBS->CB_NLSF_Q15, 
        N, psNLSF_CBS->nVectors, LPC_order );

    /* Loop over input vectors */
    pRD_vec_Q20 = pRD_Q20;
    for( n = 0; n < N; n++ ) {
        /* Add rate cost to error for each codebook vector */
        for( i = 0; i < psNLSF_CBS->nVectors; i++ ) {
            SKP_assert( rate_acc_Q5[ n ] + psNLSF_CBS->Rates_Q5[ i ] >= 0 );
            SKP_assert( rate_acc_Q5[ n ] + psNLSF_CBS->Rates_Q5[ i ] <= SKP_int16_MAX );
            pRD_vec_Q20[ i ] = SKP_SMLABB( pRD_vec_Q20[ i ], rate_acc_Q5[ n ] + psNLSF_CBS->Rates_Q5[ i ], mu_Q15 );
            SKP_assert( pRD_vec_Q20[ i ] >= 0 );
        }
        pRD_vec_Q20 += psNLSF_CBS->nVectors;
    }
}


================================================
FILE: app/jni/SKP_Silk_NLSF_VQ_sum_error_FIX.c
================================================
/***********************************************************************
Copyright (c) 2006-2012, Skype Limited. All rights reserved. 
Redistribution and use in source and binary forms, with or without 
modification, (subject to the limitations in the disclaimer below) 
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.
- Neither the name of Skype Limited, nor the names of specific 
contributors, may be used to endorse or promote products derived from 
this software without specific prior written permission.
NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED 
BY THIS LICENSE. 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.
***********************************************************************/

#include "SKP_Silk_main_FIX.h"

#if (!defined(__mips__)) && (EMBEDDED_ARM < 6)

/* Compute weighted quantization errors for an LPC_order element input vector, over one codebook stage */
void SKP_Silk_NLSF_VQ_sum_error_FIX(
    SKP_int32                       *err_Q20,           /* O    Weighted quantization errors  [N*K]         */
    const SKP_int                   *in_Q15,            /* I    Input vectors to be quantized [N*LPC_order] */
    const SKP_int                   *w_Q6,              /* I    Weighting vectors             [N*LPC_order] */
    const SKP_int16                 *pCB_Q15,           /* I    Codebook vectors              [K*LPC_order] */
    const SKP_int                   N,                  /* I    Number of input vectors                     */
    const SKP_int                   K,                  /* I    Number of codebook vectors                  */
    const SKP_int                   LPC_order           /* I    Number of LPCs                              */
)
{
    SKP_int         i, n, m;
    SKP_int32       diff_Q15, sum_error, Wtmp_Q6;
    SKP_int32       Wcpy_Q6[ MAX_LPC_ORDER / 2 ];
    const SKP_int16 *cb_vec_Q15;

    SKP_assert( LPC_order <= 16 );
    SKP_assert( ( LPC_order & 1 ) == 0 );

    /* Copy to local stack and pack two weights per int32 */
    for( m = 0; m < SKP_RSHIFT( LPC_order, 1 ); m++ ) {
        Wcpy_Q6[ m ] = w_Q6[ 2 * m ] | SKP_LSHIFT( ( SKP_int32 )w_Q6[ 2 * m + 1 ], 16 );
    }

    /* Loop over input vectors */
    for( n = 0; n < N; n++ ) {
        /* Loop over codebook */
        cb_vec_Q15 = pCB_Q15;
        for( i = 0; i < K; i++ ) {
            sum_error = 0;
            for( m = 0; m < LPC_order; m += 2 ) {
                /* Get two weights packed in an int32 */
                Wtmp_Q6 = Wcpy_Q6[ SKP_RSHIFT( m, 1 ) ];

                /* Compute weighted squared quantization error for index m */
                diff_Q15 = in_Q15[ m ] - *cb_vec_Q15++; // range: [ -32767 : 32767 ]
                sum_error = SKP_SMLAWB( sum_error, SKP_SMULBB( diff_Q15, diff_Q15 ), Wtmp_Q6 );

                /* Compute weighted squared quantization error for index m + 1 */
                diff_Q15 = in_Q15[m + 1] - *cb_vec_Q15++; // range: [ -32767 : 32767 ]
                sum_error = SKP_SMLAWT( sum_error, SKP_SMULBB( diff_Q15, diff_Q15 ), Wtmp_Q6 );
            }
            SKP_assert( sum_error >= 0 );
            err_Q20[ i ] = sum_error;
        }
        err_Q20 += K;
        in_Q15 += LPC_order;
    }
}

#endif



================================================
FILE: app/jni/SKP_Silk_NLSF_VQ_weights_laroia.c
================================================
/***********************************************************************
Copyright (c) 2006-2012, Skype Limited. All rights reserved. 
Redistribution and use in source and binary forms, with or without 
modification, (subject to the limitations in the disclaimer below) 
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.
- Neither the name of Skype Limited, nor the names of specific 
contributors, may be used to endorse or promote products derived from 
this software without specific prior written permission.
NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED 
BY THIS LICENSE. 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.
***********************************************************************/

#include "SKP_Silk_SigProc_FIX.h"

/* 
R. Laroia, N. Phamdo and N. Farvardin, "Robust and Efficient Quantization of Speech LSP
Parameters Using Structured Vector Quantization", Proc. IEEE Int. Conf. Acoust., Speech,
Signal Processing, pp. 641-644, 1991.
*/

#define Q_OUT                       6
#define MIN_NDELTA                  3

/* Laroia low complexity NLSF weights */
void SKP_Silk_NLSF_VQ_weights_laroia(
    SKP_int             *pNLSFW_Q6,         /* O: Pointer to input vector weights           [D x 1]     */
    const SKP_int       *pNLSF_Q15,         /* I: Pointer to input vector                   [D x 1]     */ 
    const SKP_int       D                   /* I: Input vector dimension (even)                         */
)
{
    SKP_int   k;
    SKP_int32 tmp1_int, tmp2_int;
    
    /* Check that we are guaranteed to end up within the required range */
    SKP_assert( D > 0 );
    SKP_assert( ( D & 1 ) == 0 );
    
    /* First value */
    tmp1_int = SKP_max_int( pNLSF_Q15[ 0 ], MIN_NDELTA );
    tmp1_int = SKP_DIV32_16( 1 << ( 15 + Q_OUT ), tmp1_int );
    tmp2_int = SKP_max_int( pNLSF_Q15[ 1 ] - pNLSF_Q15[ 0 ], MIN_NDELTA );
    tmp2_int = SKP_DIV32_16( 1 << ( 15 + Q_OUT ), tmp2_int );
    pNLSFW_Q6[ 0 ] = (SKP_int)SKP_min_int( tmp1_int + tmp2_int, SKP_int16_MAX );
    SKP_assert( pNLSFW_Q6[ 0 ] > 0 );
    
    /* Main loop */
    for( k = 1; k < D - 1; k += 2 ) {
        tmp1_int = SKP_max_int( pNLSF_Q15[ k + 1 ] - pNLSF_Q15[ k ], MIN_NDELTA );
        tmp1_int = SKP_DIV32_16( 1 << ( 15 + Q_OUT ), tmp1_int );
        pNLSFW_Q6[ k ] = (SKP_int)SKP_min_int( tmp1_int + tmp2_int, SKP_int16_MAX );
        SKP_assert( pNLSFW_Q6[ k ] > 0 );

        tmp2_int = SKP_max_int( pNLSF_Q15[ k + 2 ] - pNLSF_Q15[ k + 1 ], MIN_NDELTA );
        tmp2_int = SKP_DIV32_16( 1 << ( 15 + Q_OUT ), tmp2_int );
        pNLSFW_Q6[ k + 1 ] = (SKP_int)SKP_min_int( tmp1_int + tmp2_int, SKP_int16_MAX );
        SKP_assert( pNLSFW_Q6[ k + 1 ] > 0 );
    }
    
    /* Last value */
    tmp1_int = SKP_max_int( ( 1 << 15 ) - pNLSF_Q15[ D - 1 ], MIN_NDELTA );
    tmp1_int = SKP_DIV32_16( 1 << ( 15 + Q_OUT ), tmp1_int );
    pNLSFW_Q6[ D - 1 ] = (SKP_int)SKP_min_int( tmp1_int + tmp2_int, SKP_int16_MAX );
    SKP_assert( pNLSFW_Q6[ D - 1 ] > 0 );
}


================================================
FILE: app/jni/SKP_Silk_NLSF_stabilize.c
================================================
/***********************************************************************
Copyright (c) 2006-2012, Skype Limited. All rights reserved. 
Redistribution and use in source and binary forms, with or without 
modification, (subject to the limitations in the disclaimer below) 
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.
- Neither the name of Skype Limited, nor the names of specific 
contributors, may be used to endorse or promote products derived from 
this software without specific prior written permission.
NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED 
BY THIS LICENSE. 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.
***********************************************************************/

/* NLSF stabilizer:                                         */
/*                                                          */
/* - Moves NLSFs futher apart if they are too close         */
/* - Moves NLSFs away from borders if they are too close    */
/* - High effort to achieve a modification with minimum     */
/*     Euclidean distance to input vector                   */
/* - Output are sorted NLSF coefficients                    */
/*                                                          */
#include "SKP_Silk_SigProc_FIX.h"

/* Constant Definitions */
#define MAX_LOOPS        20

/* NLSF stabilizer, for a single input data vector */
void SKP_Silk_NLSF_stabilize(
          SKP_int    *NLSF_Q15,            /* I/O:  Unstable/stabilized normalized LSF vector in Q15 [L]                    */
    const SKP_int    *NDeltaMin_Q15,       /* I:    Normalized delta min vector in Q15, NDeltaMin_Q15[L] must be >= 1 [L+1] */
    const SKP_int     L                    /* I:    Number of NLSF parameters in the input vector                           */
)
{
    SKP_int        center_freq_Q15, diff_Q15, min_center_Q15, max_center_Q15;
    SKP_int32    min_diff_Q15;
    SKP_int        loops;
    SKP_int        i, I=0, k;

    /* This is necessary to ensure an output within range of a SKP_int16 */
    SKP_assert( NDeltaMin_Q15[L] >= 1 );

    for( loops = 0; loops < MAX_LOOPS; loops++ ) {
        /**************************/
        /* Find smallest distance */
        /**************************/
        /* First element */
        min_diff_Q15 = NLSF_Q15[0] - NDeltaMin_Q15[0];
        I = 0;
        /* Middle elements */
        for( i = 1; i <= L-1; i++ ) {
            diff_Q15 = NLSF_Q15[i] - ( NLSF_Q15[i-1] + NDeltaMin_Q15[i] );
            if( diff_Q15 < min_diff_Q15 ) {
                min_diff_Q15 = diff_Q15;
                I = i;
            }
        }
        /* Last element */
        diff_Q15 = (1<<15) - ( NLSF_Q15[L-1] + NDeltaMin_Q15[L] );
        if( diff_Q15 < min_diff_Q15 ) {
            min_diff_Q15 = diff_Q15;
            I = L;
        }

        /***************************************************/
        /* Now check if the smallest distance non-negative */
        /***************************************************/
        if (min_diff_Q15 >= 0) {
            return;
        }

        if( I == 0 ) {
            /* Move away from lower limit */
            NLSF_Q15[0] = NDeltaMin_Q15[0];
        
        } else if( I == L) {
            /* Move away from higher limit */
            NLSF_Q15[L-1] = (1<<15) - NDeltaMin_Q15[L];
        
        } else {
            /* Find the lower extreme for the location of the current center frequency */ 
            min_center_Q15 = 0;
            for( k = 0; k < I; k++ ) {
                min_center_Q15 += NDeltaMin_Q15[k];
            }
            min_center_Q15 += SKP_RSHIFT( NDeltaMin_Q15[I], 1 );

            /* Find the upper extreme for the location of the current center frequency */
            max_center_Q15 = (1<<15);
            for( k = L; k > I; k-- ) {
                max_center_Q15 -= NDeltaMin_Q15[k];
            }
            max_center_Q15 -= ( NDeltaMin_Q15[I] - SKP_RSHIFT( NDeltaMin_Q15[I], 1 ) );

            /* Move apart, sorted by value, keeping the same center frequency */
            center_freq_Q15 = SKP_LIMIT_32( SKP_RSHIFT_ROUND( (SKP_int32)NLSF_Q15[I-1] + (SKP_int32)NLSF_Q15[I], 1 ),
                min_center_Q15, max_center_Q15 );
            NLSF_Q15[I-1] = center_freq_Q15 - SKP_RSHIFT( NDeltaMin_Q15[I], 1 );
            NLSF_Q15[I] = NLSF_Q15[I-1] + NDeltaMin_Q15[I];
        }
    }

    /* Safe and simple fall back method, which is less ideal than the above */
    if( loops == MAX_LOOPS )
    {
        /* Insertion sort (fast for already almost sorted arrays):   */
        /* Best case:  O(n)   for an already sorted array            */
        /* Worst case: O(n^2) for an inversely sorted array          */
        SKP_Silk_insertion_sort_increasing_all_values(&NLSF_Q15[0], L);
            
        /* First NLSF should be no less than NDeltaMin[0] */
        NLSF_Q15[0] = SKP_max_int( NLSF_Q15[0], NDeltaMin_Q15[0] );
        
        /* Keep delta_min distance between the NLSFs */
        for( i = 1; i < L; i++ )
            NLSF_Q15[i] = SKP_max_int( NLSF_Q15[i], NLSF_Q15[i-1] + NDeltaMin_Q15[i] );

        /* Last NLSF should be no higher than 1 - NDeltaMin[L] */
        NLSF_Q15[L-1] = SKP_min_int( NLSF_Q15[L-1], (1<<15) - NDeltaMin_Q15[L] );

        /* Keep NDeltaMin distance between the NLSFs */
        for( i = L-2; i >= 0; i-- ) 
            NLSF_Q15[i] = SKP_min_int( NLSF_Q15[i], NLSF_Q15[i+1] - NDeltaMin_Q15[i+1] );
    }
}



================================================
FILE: app/jni/SKP_Silk_NSQ.c
================================================
/***********************************************************************
Copyright (c) 2006-2012, Skype Limited. All rights reserved. 
Redistribution and use in source and binary forms, with or without 
modification, (subject to the limitations in the disclaimer below) 
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.
- Neither the name of Skype Limited, nor the names of specific 
contributors, may be used to endorse or promote products derived from 
this software without specific prior written permission.
NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED 
BY THIS LICENSE. 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.
***********************************************************************/

#include "SKP_Silk_main.h"

SKP_INLINE void SKP_Silk_nsq_scale_states(
    SKP_Silk_nsq_state  *NSQ,               /* I/O NSQ state                        */
    const SKP_int16     x[],                /* I input in Q0                        */
    SKP_int32           x_sc_Q10[],         /* O input scaled with 1/Gain           */
    SKP_int             subfr_length,       /* I length of input                    */
    const SKP_int16     sLTP[],             /* I re-whitened LTP state in Q0        */
    SKP_int32           sLTP_Q16[],         /* O LTP state matching scaled input    */
    SKP_int             subfr,              /* I subframe number                    */
    const SKP_int       LTP_scale_Q14,      /* I                                    */
    const SKP_int32     Gains_Q16[ NB_SUBFR ], /* I                                 */
    const SKP_int       pitchL[ NB_SUBFR ]  /* I                                    */
);

SKP_INLINE void SKP_Silk_noise_shape_quantizer(
    SKP_Silk_nsq_state  *NSQ,               /* I/O  NSQ state                       */
    SKP_int             sigtype,            /* I    Signal type                     */
    const SKP_int32     x_sc_Q10[],         /* I                                    */
    SKP_int8            q[],                /* O                                    */
    SKP_int16           xq[],               /* O                                    */
    SKP_int32           sLTP_Q16[],         /* I/O  LTP state                       */
    const SKP_int16     a_Q12[],            /* I    Short term prediction coefs     */
    const SKP_int16     b_Q14[],            /* I    Long term prediction coefs      */
    const SKP_int16     AR_shp_Q13[],       /* I    Noise shaping AR coefs          */
    SKP_int             lag,                /* I    Pitch lag                       */
    SKP_int32           HarmShapeFIRPacked_Q14, /* I                                */
    SKP_int             Tilt_Q14,           /* I    Spectral tilt                   */
    SKP_int32           LF_shp_Q14,         /* I                                    */
    SKP_int32           Gain_Q16,           /* I                                    */
    SKP_int             Lambda_Q10,         /* I                                    */
    SKP_int             offset_Q10,         /* I                                    */
    SKP_int             length,             /* I    Input length                    */
    SKP_int             shapingLPCOrder,    /* I    Noise shaping AR filter order   */
    SKP_int             predictLPCOrder     /* I    Prediction filter order         */
);

void SKP_Silk_NSQ(
    SKP_Silk_encoder_state          *psEncC,                                    /* I/O  Encoder State                       */
    SKP_Silk_encoder_control        *psEncCtrlC,                                /* I    Encoder Control                     */
    SKP_Silk_nsq_state              *NSQ,                                       /* I/O  NSQ state                           */
    const SKP_int16                 x[],                                        /* I    prefiltered input signal            */
    SKP_int8                        q[],                                        /* O    quantized qulse signal              */
    const SKP_int                   LSFInterpFactor_Q2,                         /* I    LSF interpolation factor in Q2      */
    const SKP_int16                 PredCoef_Q12[ 2 * MAX_LPC_ORDER ],          /* I    Short term prediction coefficients  */
    const SKP_int16                 LTPCoef_Q14[ LTP_ORDER * NB_SUBFR ],        /* I    Long term prediction coefficients   */
    const SKP_int16                 AR2_Q13[ NB_SUBFR * MAX_SHAPE_LPC_ORDER ],  /* I                                        */
    const SKP_int                   HarmShapeGain_Q14[ NB_SUBFR ],              /* I                                        */
    const SKP_int                   Tilt_Q14[ NB_SUBFR ],                       /* I    Spectral tilt                       */
    const SKP_int32                 LF_shp_Q14[ NB_SUBFR ],                     /* I                                        */
    const SKP_int32                 Gains_Q16[ NB_SUBFR ],                      /* I                                        */
    const SKP_int                   Lambda_Q10,                                 /* I                                        */
    const SKP_int                   LTP_scale_Q14                               /* I    LTP state scaling                   */
)
{
    SKP_int     k, lag, start_idx, LSF_interpolation_flag;
    const SKP_int16 *A_Q12, *B_Q14, *AR_shp_Q13;
    SKP_int16   *pxq;
    SKP_int32   sLTP_Q16[ 2 * MAX_FRAME_LENGTH ];
    SKP_int16   sLTP[     2 * MAX_FRAME_LENGTH ];
    SKP_int32   HarmShapeFIRPacked_Q14;
    SKP_int     offset_Q10;
    SKP_int32   FiltState[ MAX_LPC_ORDER ];
    SKP_int32   x_sc_Q10[ MAX_FRAME_LENGTH / NB_SUBFR ];

    NSQ->rand_seed  =  psEncCtrlC->Seed;
    /* Set unvoiced lag to the previous one, overwrite later for voiced */
    lag             = NSQ->lagPrev;

    SKP_assert( NSQ->prev_inv_gain_Q16 != 0 );

    offset_Q10 = SKP_Silk_Quantization_Offsets_Q10[ psEncCtrlC->sigtype ][ psEncCtrlC->QuantOffsetType ];

    if( LSFInterpFactor_Q2 == ( 1 << 2 ) ) {
        LSF_interpolation_flag = 0;
    } else {
        LSF_interpolation_flag = 1;
    }

    /* Setup pointers to start of sub frame */
    NSQ->sLTP_shp_buf_idx = psEncC->frame_length;
    NSQ->sLTP_buf_idx     = psEncC->frame_length;
    pxq                   = &NSQ->xq[ psEncC->frame_length ];
    for( k = 0; k < NB_SUBFR; k++ ) {
        A_Q12      = &PredCoef_Q12[ (( k >> 1 ) | ( 1 - LSF_interpolation_flag )) * MAX_LPC_ORDER ];
        B_Q14      = &LTPCoef_Q14[ k * LTP_ORDER ];
        AR_shp_Q13 = &AR2_Q13[     k * MAX_SHAPE_LPC_ORDER ];

        /* Noise shape parameters */
        SKP_assert( HarmShapeGain_Q14[ k ] >= 0 );
        HarmShapeFIRPacked_Q14  =                          SKP_RSHIFT( HarmShapeGain_Q14[ k ], 2 );
        HarmShapeFIRPacked_Q14 |= SKP_LSHIFT( ( SKP_int32 )SKP_RSHIFT( HarmShapeGain_Q14[ k ], 1 ), 16 );

        NSQ->rewhite_flag = 0;
        if( psEncCtrlC->sigtype == SIG_TYPE_VOICED ) {
            /* Voiced */
            lag = psEncCtrlC->pitchL[ k ];

            /* Re-whitening */
            if( ( k & ( 3 - SKP_LSHIFT( LSF_interpolation_flag, 1 ) ) ) == 0 ) {

                /* Rewhiten with new A coefs */
                start_idx = psEncC->frame_length - lag - psEncC->predictLPCOrder - LTP_ORDER / 2;
                SKP_assert( start_idx >= 0 );
                SKP_assert( start_idx <= psEncC->frame_length - psEncC->predictLPCOrder );

                SKP_memset( FiltState, 0, psEncC->predictLPCOrder * sizeof( SKP_int32 ) );
                SKP_Silk_MA_Prediction( &NSQ->xq[ start_idx + k * ( psEncC->frame_length >> 2 ) ], 
                    A_Q12, FiltState, sLTP + start_idx, psEncC->frame_length - start_idx, psEncC->predictLPCOrder );

                NSQ->rewhite_flag = 1;
                NSQ->sLTP_buf_idx = psEncC->frame_length;
            }
        }
        
        SKP_Silk_nsq_scale_states( NSQ, x, x_sc_Q10, psEncC->subfr_length, sLTP, 
            sLTP_Q16, k, LTP_scale_Q14, Gains_Q16, psEncCtrlC->pitchL );

        SKP_Silk_noise_shape_quantizer( NSQ, psEncCtrlC->sigtype, x_sc_Q10, q, pxq, sLTP_Q16, A_Q12, B_Q14, 
            AR_shp_Q13, lag, HarmShapeFIRPacked_Q14, Tilt_Q14[ k ], LF_shp_Q14[ k ], Gains_Q16[ k ], Lambda_Q10, 
            offset_Q10, psEncC->subfr_length, psEncC->shapingLPCOrder, psEncC->predictLPCOrder
        );

        x          += psEncC->subfr_length;
        q          += psEncC->subfr_length;
        pxq        += psEncC->subfr_length;
    }

    /* Update lagPrev for next frame */
    NSQ->lagPrev = psEncCtrlC->pitchL[ NB_SUBFR - 1 ];

    /* Save quantized speech and noise shaping signals */
    SKP_memcpy( NSQ->xq,           &NSQ->xq[           psEncC->frame_length ], psEncC->frame_length * sizeof( SKP_int16 ) );
    SKP_memcpy( NSQ->sLTP_shp_Q10, &NSQ->sLTP_shp_Q10[ psEncC->frame_length ], psEncC->frame_length * sizeof( SKP_int32 ) );

#ifdef USE_UNQUANTIZED_LSFS
    DEBUG_STORE_DATA( xq_unq_lsfs.pcm, NSQ->xq, psEncC->frame_length * sizeof( SKP_int16 ) );
#endif

}

/***********************************/
/* SKP_Silk_noise_shape_quantizer  */
/***********************************/
SKP_INLINE void SKP_Silk_noise_shape_quantizer(
    SKP_Silk_nsq_state  *NSQ,               /* I/O  NSQ state                       */
    SKP_int             sigtype,            /* I    Signal type                     */
    const SKP_int32     x_sc_Q10[],         /* I                                    */
    SKP_int8            q[],                /* O                                    */
    SKP_int16           xq[],               /* O                                    */
    SKP_int32           sLTP_Q16[],         /* I/O  LTP state                       */
    const SKP_int16     a_Q12[],            /* I    Short term prediction coefs     */
    const SKP_int16     b_Q14[],            /* I    Long term prediction coefs      */
    const SKP_int16     AR_shp_Q13[],       /* I    Noise shaping AR coefs          */
    SKP_int             lag,                /* I    Pitch lag                       */
    SKP_int32           HarmShapeFIRPacked_Q14, /* I                                */
    SKP_int             Tilt_Q14,           /* I    Spectral tilt                   */
    SKP_int32           LF_shp_Q14,         /* I                                    */
    SKP_int32           Gain_Q16,           /* I                                    */
    SKP_int             Lambda_Q10,         /* I                                    */
    SKP_int             offset_Q10,         /* I                                    */
    SKP_int             length,             /* I    Input length                    */
    SKP_int             shapingLPCOrder,    /* I    Noise shaping AR filter order   */
    SKP_int             predictLPCOrder     /* I    Prediction filter order         */
)
{
    SKP_int     i, j;
    SKP_int32   LTP_pred_Q14, LPC_pred_Q10, n_AR_Q10, n_LTP_Q14;
    SKP_int32   n_LF_Q10, r_Q10, q_Q0, q_Q10;
    SKP_int32   thr1_Q10, thr2_Q10, thr3_Q10;
    SKP_int32   dither, exc_Q10, LPC_exc_Q10, xq_Q10;
    SKP_int32   tmp1, tmp2, sLF_AR_shp_Q10;
    SKP_int32   *psLPC_Q14, *shp_lag_ptr, *pred_lag_ptr;
#if !defined(_SYSTEM_IS_BIG_ENDIAN)
    SKP_int32   a_Q12_tmp[ MAX_LPC_ORDER / 2 ], Atmp;
    /* Preload LPC coefficients to array on stack. Gives small performance gain */
    SKP_memcpy( a_Q12_tmp, a_Q12, predictLPCOrder * sizeof( SKP_int16 ) );
#endif

    shp_lag_ptr  = &NSQ->sLTP_shp_Q10[ NSQ->sLTP_shp_buf_idx - lag + HARM_SHAPE_FIR_TAPS / 2 ];
    pred_lag_ptr = &sLTP_Q16[ NSQ->sLTP_buf_idx - lag + LTP_ORDER / 2 ];
    
    /* Setup short term AR state */
    psLPC_Q14 = &NSQ->sLPC_Q14[ NSQ_LPC_BUF_LENGTH - 1 ];

    /* Quantization thresholds */
    thr1_Q10 = SKP_SUB_RSHIFT32( -1536, Lambda_Q10, 1 );
    thr2_Q10 = SKP_SUB_RSHIFT32(  -512, Lambda_Q10, 1 );
    thr2_Q10 = SKP_ADD_RSHIFT32( thr2_Q10, SKP_SMULBB( offset_Q10, Lambda_Q10 ), 10 );
    thr3_Q10 = SKP_ADD_RSHIFT32(   512, Lambda_Q10, 1 );

    for( i = 0; i < length; i++ ) {
        /* Generate dither */
        NSQ->rand_seed = SKP_RAND( NSQ->rand_seed );

        /* dither = rand_seed < 0 ? 0xFFFFFFFF : 0; */
        dither = SKP_RSHIFT( NSQ->rand_seed, 31 );
                
        /* Short-term prediction */
        SKP_assert( ( predictLPCOrder  & 1 ) == 0 );    /* check that order is even */
        /* check that array starts at 4-byte aligned address */
        SKP_assert( ( ( SKP_int64 )( ( SKP_int8* )a_Q12 - ( SKP_int8* )0 ) & 3 ) == 0 );
        SKP_assert( predictLPCOrder >= 10 );            /* check that unrolling works */
#if !defined(_SYSTEM_IS_BIG_ENDIAN)
        /* NOTE: the code below loads two int16 values in an int32, and multiplies each using the   */
        /* SMLAWB and SMLAWT instructions. On a big-endian CPU the two int16 variables would be     */
        /* loaded in reverse order and the code will give the wrong result. In that case swapping   */
        /* the SMLAWB and SMLAWT instructions should solve the problem.                             */
        /* Partially unrolled */
        Atmp = a_Q12_tmp[ 0 ];      /* read two coefficients at once */
        LPC_pred_Q10 = SKP_SMULWB(               psLPC_Q14[  0 ], Atmp );
        LPC_pred_Q10 = SKP_SMLAWT( LPC_pred_Q10, psLPC_Q14[ -1 ], Atmp );
        Atmp = a_Q12_tmp[ 1 ];
        LPC_pred_Q10 = SKP_SMLAWB( LPC_pred_Q10, psLPC_Q14[ -2 ], Atmp );
        LPC_pred_Q10 = SKP_SMLAWT( LPC_pred_Q10, psLPC_Q14[ -3 ], Atmp );
        Atmp = a_Q12_tmp[ 2 ];
        LPC_pred_Q10 = SKP_SMLAWB( LPC_pred_Q10, psLPC_Q14[ -4 ], Atmp );
        LPC_pred_Q10 = SKP_SMLAWT( LPC_pred_Q10, psLPC_Q14[ -5 ], Atmp );
        Atmp = a_Q12_tmp[ 3 ];
        LPC_pred_Q10 = SKP_SMLAWB( LPC_pred_Q10, psLPC_Q14[ -6 ], Atmp );
        LPC_pred_Q10 = SKP_SMLAWT( LPC_pred_Q10, psLPC_Q14[ -7 ], Atmp );
        Atmp = a_Q12_tmp[ 4 ];
        LPC_pred_Q10 = SKP_SMLAWB( LPC_pred_Q10, psLPC_Q14[ -8 ], Atmp );
        LPC_pred_Q10 = SKP_SMLAWT( LPC_pred_Q10, psLPC_Q14[ -9 ], Atmp );
        for( j = 10; j < predictLPCOrder; j += 2 ) {
            Atmp = a_Q12_tmp[ j >> 1 ];     /* read two coefficients at once */
            LPC_pred_Q10 = SKP_SMLAWB( LPC_pred_Q10, psLPC_Q14[ -j     ], Atmp );
            LPC_pred_Q10 = SKP_SMLAWT( LPC_pred_Q10, psLPC_Q14[ -j - 1 ], Atmp );
        }
#else
        /* Partially unrolled */
        LPC_pred_Q10 = SKP_SMULWB(               psLPC_Q14[  0 ], a_Q12[ 0 ] );
        LPC_pred_Q10 = SKP_SMLAWB( LPC_pred_Q10, psLPC_Q14[ -1 ], a_Q12[ 1 ] );
        LPC_pred_Q10 = SKP_SMLAWB( LPC_pred_Q10, psLPC_Q14[ -2 ], a_Q12[ 2 ] );
        LPC_pred_Q10 = SKP_SMLAWB( LPC_pred_Q10, psLPC_Q14[ -3 ], a_Q12[ 3 ] );
        LPC_pred_Q10 = SKP_SMLAWB( LPC_pred_Q10, psLPC_Q14[ -4 ], a_Q12[ 4 ] );
        LPC_pred_Q10 = SKP_SMLAWB( LPC_pred_Q10, psLPC_Q14[ -5 ], a_Q12[ 5 ] );
        LPC_pred_Q10 = SKP_SMLAWB( LPC_pred_Q10, psLPC_Q14[ -6 ], a_Q12[ 6 ] );
        LPC_pred_Q10 = SKP_SMLAWB( LPC_pred_Q10, psLPC_Q14[ -7 ], a_Q12[ 7 ] );
        LPC_pred_Q10 = SKP_SMLAWB( LPC_pred_Q10, psLPC_Q14[ -8 ], a_Q12[ 8 ] );
        LPC_pred_Q10 = SKP_SMLAWB( LPC_pred_Q10, psLPC_Q14[ -9 ], a_Q12[ 9 ] );
        for( j = 10; j < predictLPCOrder; j ++ ) {
            LPC_pred_Q10 = SKP_SMLAWB( LPC_pred_Q10, psLPC_Q14[ -j ], a_Q12[ j ] );
        }
#endif
        /* Long-term prediction */
        if( sigtype == SIG_TYPE_VOICED ) {
            /* Unrolled loop */
            LTP_pred_Q14 = SKP_SMULWB(               pred_lag_ptr[  0 ], b_Q14[ 0 ] );
            LTP_pred_Q14 = SKP_SMLAWB( LTP_pred_Q14, pred_lag_ptr[ -1 ], b_Q14[ 1 ] );
            LTP_pred_Q14 = SKP_SMLAWB( LTP_pred_Q14, pred_lag_ptr[ -2 ], b_Q14[ 2 ] );
            LTP_pred_Q14 = SKP_SMLAWB( LTP_pred_Q14, pred_lag_ptr[ -3 ], b_Q14[ 3 ] );
            LTP_pred_Q14 = SKP_SMLAWB( LTP_pred_Q14, pred_lag_ptr[ -4 ], b_Q14[ 4 ] );
            pred_lag_ptr++;
        } else {
            LTP_pred_Q14 = 0;
        }

        /* Noise shape feedback */
        SKP_assert( ( shapingLPCOrder & 1 ) == 0 );   /* check that order is even */
        tmp2 = psLPC_Q14[ 0 ];
        tmp1 = NSQ->sAR2_Q14[ 0 ];
        NSQ->sAR2_Q14[ 0 ] = tmp2;
        n_AR_Q10 = SKP_SMULWB( tmp2, AR_shp_Q13[ 0 ] );
        for( j = 2; j < shapingLPCOrder; j += 2 ) {
            tmp2 = NSQ->sAR2_Q14[ j - 1 ];
            NSQ->sAR2_Q14[ j - 1 ] = tmp1;
            n_AR_Q10 = SKP_SMLAWB( n_AR_Q10, tmp1, AR_shp_Q13[ j - 1 ] );
            tmp1 = NSQ->sAR2_Q14[ j + 0 ];
            NSQ->sAR2_Q14[ j + 0 ] = tmp2;
            n_AR_Q10 = SKP_SMLAWB( n_AR_Q10, tmp2, AR_shp_Q13[ j ] );
        }
        NSQ->sAR2_Q14[ shapingLPCOrder - 1 ] = tmp1;
        n_AR_Q10 = SKP_SMLAWB( n_AR_Q10, tmp1, AR_shp_Q13[ shapingLPCOrder - 1 ] );

        n_AR_Q10 = SKP_RSHIFT( n_AR_Q10, 1 );   /* Q11 -> Q10 */
        n_AR_Q10 = SKP_SMLAWB( n_AR_Q10, NSQ->sLF_AR_shp_Q12, Tilt_Q14 );

        n_LF_Q10 = SKP_LSHIFT( SKP_SMULWB( NSQ->sLTP_shp_Q10[ NSQ->sLTP_shp_buf_idx - 1 ], LF_shp_Q14 ), 2 ); 
        n_LF_Q10 = SKP_SMLAWT( n_LF_Q10, NSQ->sLF_AR_shp_Q12, LF_shp_Q14 );

        SKP_assert( lag > 0 || sigtype == SIG_TYPE_UNVOICED );

        /* Long-term shaping */
        if( lag > 0 ) {
            /* Symmetric, packed FIR coefficients */
            n_LTP_Q14 = SKP_SMULWB( SKP_ADD32( shp_lag_ptr[ 0 ], shp_lag_ptr[ -2 ] ), HarmShapeFIRPacked_Q14 );
            n_LTP_Q14 = SKP_SMLAWT( n_LTP_Q14, shp_lag_ptr[ -1 ],                     HarmShapeFIRPacked_Q14 );
            n_LTP_Q14 = SKP_LSHIFT( n_LTP_Q14, 6 );
            shp_lag_ptr++;
        } else {
            n_LTP_Q14 = 0;
        }

        /* Input minus prediction plus noise feedback  */
        //r = x[ i ] - LTP_pred - LPC_pred + n_AR + n_Tilt + n_LF + n_LTP;
        tmp1  = SKP_SUB32( LTP_pred_Q14, n_LTP_Q14 );                       /* Add Q14 stuff */
        tmp1  = SKP_RSHIFT( tmp1, 4 );                                      /* convert to Q10  */
        tmp1  = SKP_ADD32( tmp1, LPC_pred_Q10 );                            /* add Q10 stuff */ 
        tmp1  = SKP_SUB32( tmp1, n_AR_Q10 );                                /* subtract Q10 stuff */ 
        tmp1  = SKP_SUB32( tmp1, n_LF_Q10 );                                /* subtract Q10 stuff */ 
        r_Q10 = SKP_SUB32( x_sc_Q10[ i ], tmp1 );

        /* Flip sign depending on dither */
        r_Q10 = ( r_Q10 ^ dither ) - dither;
        r_Q10 = SKP_SUB32( r_Q10, offset_Q10 );
        r_Q10 = SKP_LIMIT_32( r_Q10, -64 << 10, 64 << 10 );

        /* Quantize */
        q_Q0 = 0;
        q_Q10 = 0;
        if( r_Q10 < thr2_Q10 ) {
            if( r_Q10 < thr1_Q10 ) {
                q_Q0 = SKP_RSHIFT_ROUND( SKP_ADD_RSHIFT32( r_Q10, Lambda_Q10, 1 ), 10 );
                q_Q10 = SKP_LSHIFT( q_Q0, 10 );
            } else {
                q_Q0 = -1;
                q_Q10 = -1024;
            }
        } else {
            if( r_Q10 > thr3_Q10 ) {
                q_Q0 = SKP_RSHIFT_ROUND( SKP_SUB_RSHIFT32( r_Q10, Lambda_Q10, 1 ), 10 );
                q_Q10 = SKP_LSHIFT( q_Q0, 10 );
            }
        }
        q[ i ] = ( SKP_int8 )q_Q0; /* No saturation needed because max is 64 */

        /* Excitation */
        exc_Q10 = SKP_ADD32( q_Q10, offset_Q10 );
        exc_Q10 = ( exc_Q10 ^ dither ) - dither;

        /* Add predictions */
        LPC_exc_Q10 = SKP_ADD32( exc_Q10, SKP_RSHIFT_ROUND( LTP_pred_Q14, 4 ) );
        xq_Q10      = SKP_ADD32( LPC_exc_Q10, LPC_pred_Q10 );
        
        /* Scale XQ back to normal level before saving */
        xq[ i ] = ( SKP_int16 )SKP_SAT16( SKP_RSHIFT_ROUND( SKP_SMULWW( xq_Q10, Gain_Q16 ), 10 ) );
        
        
        /* Update states */
        psLPC_Q14++;
        *psLPC_Q14 = SKP_LSHIFT( xq_Q10, 4 );
        sLF_AR_shp_Q10 = SKP_SUB32( xq_Q10, n_AR_Q10 );
        NSQ->sLF_AR_shp_Q12 = SKP_LSHIFT( sLF_AR_shp_Q10, 2 );

        NSQ->sLTP_shp_Q10[ NSQ->sLTP_shp_buf_idx ] = SKP_SUB32( sLF_AR_shp_Q10, n_LF_Q10 );
        sLTP_Q16[ NSQ->sLTP_buf_idx ] = SKP_LSHIFT( LPC_exc_Q10, 6 );
        NSQ->sLTP_shp_buf_idx++;
        NSQ->sLTP_buf_idx++;

        /* Make dither dependent on quantized signal */
        NSQ->rand_seed += q[ i ];
    }

    /* Update LPC synth buffer */
    SKP_memcpy( NSQ->sLPC_Q14, &NSQ->sLPC_Q14[ length ], NSQ_LPC_BUF_LENGTH * sizeof( SKP_int32 ) );
}

SKP_INLINE void SKP_Silk_nsq_scale_states(
    SKP_Silk_nsq_state  *NSQ,               /* I/O NSQ state                        */
    const SKP_int16     x[],                /* I input in Q0                        */
    SKP_int32           x_sc_Q10[],         /* O input scaled with 1/Gain           */
    SKP_int             subfr_length,       /* I length of input                    */
    const SKP_int16     sLTP[],             /* I re-whitened LTP state in Q0        */
    SKP_int32           sLTP_Q16[],         /* O LTP state matching scaled input    */
    SKP_int             subfr,              /* I subframe number                    */
    const SKP_int       LTP_scale_Q14,      /* I                                    */
    const SKP_int32     Gains_Q16[ NB_SUBFR ], /* I                                 */
    const SKP_int       pitchL[ NB_SUBFR ]  /* I                                    */
)
{
    SKP_int   i, lag;
    SKP_int32 inv_gain_Q16, gain_adj_Q16, inv_gain_Q32;

    inv_gain_Q16 = SKP_INVERSE32_varQ( SKP_max( Gains_Q16[ subfr ], 1 ), 32 );
    inv_gain_Q16 = SKP_min( inv_gain_Q16, SKP_int16_MAX );
    lag          = pitchL[ subfr ];

    /* After rewhitening the LTP state is un-scaled, so scale with inv_gain_Q16 */
    if( NSQ->rewhite_flag ) {
        inv_gain_Q32 = SKP_LSHIFT( inv_gain_Q16, 16 );
        if( subfr == 0 ) {
            /* Do LTP downscaling */
            inv_gain_Q32 = SKP_LSHIFT( SKP_SMULWB( inv_gain_Q32, LTP_scale_Q14 ), 2 );
        }
        for( i = NSQ->sLTP_buf_idx - lag - LTP_ORDER / 2; i < NSQ->sLTP_buf_idx; i++ ) {
            SKP_assert( i < MAX_FRAME_LENGTH );
            sLTP_Q16[ i ] = SKP_SMULWB( inv_gain_Q32, sLTP[ i ] );
        }
    }

    /* Adjust for changing gain */
    if( inv_gain_Q16 != NSQ->prev_inv_gain_Q16 ) {
        gain_adj_Q16 = SKP_DIV32_varQ( inv_gain_Q16, NSQ->prev_inv_gain_Q16, 16 );

        /* Scale long-term shaping state */
        for( i = NSQ->sLTP_shp_buf_idx - subfr_length * NB_SUBFR; i < NSQ->sLTP_shp_buf_idx; i++ ) {
            NSQ->sLTP_shp_Q10[ i ] = SKP_SMULWW( gain_adj_Q16, NSQ->sLTP_shp_Q10[ i ] );
        }

        /* Scale long-term prediction state */
        if( NSQ->rewhite_flag == 0 ) {
            for( i = NSQ->sLTP_buf_idx - lag - LTP_ORDER / 2; i < NSQ->sLTP_buf_idx; i++ ) {
                sLTP_Q16[ i ] = SKP_SMULWW( gain_adj_Q16, sLTP_Q16[ i ] );
            }
        }

        NSQ->sLF_AR_shp_Q12 = SKP_SMULWW( gain_adj_Q16, NSQ->sLF_AR_shp_Q12 );

        /* Scale short-term prediction and shaping states */
        for( i = 0; i < NSQ_LPC_BUF_LENGTH; i++ ) {
            NSQ->sLPC_Q14[ i ] = SKP_SMULWW( gain_adj_Q16, NSQ->sLPC_Q14[ i ] );
        }
        for( i = 0; i < MAX_SHAPE_LPC_ORDER; i++ ) {
            NSQ->sAR2_Q14[ i ] = SKP_SMULWW( gain_adj_Q16, NSQ->sAR2_Q14[ i ] );
        }
    }

    /* Scale input */
    for( i = 0; i < subfr_length; i++ ) {
        x_sc_Q10[ i ] = SKP_RSHIFT( SKP_SMULBB( x[ i ], ( SKP_int16 )inv_gain_Q16 ), 6 );
    }

    /* save inv_gain */
    SKP_assert( inv_gain_Q16 != 0 );
    NSQ->prev_inv_gain_Q16 = inv_gain_Q16;
}


================================================
FILE: app/jni/SKP_Silk_NSQ_del_dec.c
================================================
/***********************************************************************
Copyright (c) 2006-2012, Skype Limited. All rights reserved. 
Redistribution and use in source and binary forms, with or without 
modification, (subject to the limitations in the disclaimer below) 
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.
- Neither the name of Skype Limited, nor the names of specific 
contributors, may be used to endorse or promote products derived from 
this software without specific prior written permission.
NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED 
BY THIS LICENSE. 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.
***********************************************************************/

#include "SKP_Silk_main.h"

typedef struct {
    SKP_int32 RandState[ DECISION_DELAY ];
    SKP_int32 Q_Q10[     DECISION_DELAY ];
    SKP_int32 Xq_Q10[    DECISION_DELAY ];
    SKP_int32 Pred_Q16[  DECISION_DELAY ];
    SKP_int32 Shape_Q10[ DECISION_DELAY ];
    SKP_int32 Gain_Q16[  DECISION_DELAY ];
    SKP_int32 sAR2_Q14[ MAX_SHAPE_LPC_ORDER ];
    SKP_int32 sLPC_Q14[ MAX_FRAME_LENGTH / NB_SUBFR + NSQ_LPC_BUF_LENGTH ];
    SKP_int32 LF_AR_Q12;
    SKP_int32 Seed;
    SKP_int32 SeedInit;
    SKP_int32 RD_Q10;
} NSQ_del_dec_struct;

typedef struct {
    SKP_int32 Q_Q10;
    SKP_int32 RD_Q10;
    SKP_int32 xq_Q14;
    SKP_int32 LF_AR_Q12;
    SKP_int32 sLTP_shp_Q10;
    SKP_int32 LPC_exc_Q16;
} NSQ_sample_struct;

SKP_INLINE void SKP_Silk_copy_del_dec_state(
    NSQ_del_dec_struct  *DD_dst,                /* I    Dst del dec state                   */
    NSQ_del_dec_struct  *DD_src,                /* I    Src del dec state                   */
    SKP_int             LPC_state_idx           /* I    Index to LPC buffer                 */
);

SKP_INLINE void SKP_Silk_nsq_del_dec_scale_states(
    SKP_Silk_nsq_state  *NSQ,                   /* I/O  NSQ state                           */
    NSQ_del_dec_struct  psDelDec[],             /* I/O  Delayed decision states             */
    const SKP_int16     x[],                    /* I    Input in Q0                         */
    SKP_int32           x_sc_Q10[],             /* O    Input scaled with 1/Gain in Q10     */
    SKP_int             subfr_length,           /* I    Length of input                     */
    const SKP_int16     sLTP[],                 /* I    Re-whitened LTP state in Q0         */
    SKP_int32           sLTP_Q16[],             /* O    LTP state matching scaled input     */
    SKP_int             subfr,                  /* I    Subframe number                     */
    SKP_int             nStatesDelayedDecision, /* I    Number of del dec states            */
    SKP_int             smpl_buf_idx,           /* I    Index to newest samples in buffers  */
    const SKP_int       LTP_scale_Q14,          /* I    LTP state scaling                   */
    const SKP_int32     Gains_Q16[ NB_SUBFR ],  /* I                                        */
    const SKP_int       pitchL[ NB_SUBFR ]      /* I    Pitch lag                           */
);

/******************************************/
/* Noise shape quantizer for one subframe */
/******************************************/
SKP_INLINE void SKP_Silk_noise_shape_quantizer_del_dec(
    SKP_Silk_nsq_state  *NSQ,                   /* I/O  NSQ state                           */
    NSQ_del_dec_struct  psDelDec[],             /* I/O  Delayed decision states             */
    SKP_int             sigtype,                /* I    Signal type                         */
    const SKP_int32     x_Q10[],                /* I                                        */
    SKP_int8            q[],                    /* O                                        */
    SKP_int16           xq[],                   /* O                                        */
    SKP_int32           sLTP_Q16[],             /* I/O  LTP filter state                    */
    const SKP_int16     a_Q12[],                /* I    Short term prediction coefs         */
    const SKP_int16     b_Q14[],                /* I    Long term prediction coefs          */
    const SKP_int16     AR_shp_Q13[],           /* I    Noise shaping coefs                 */
    SKP_int             lag,                    /* I    Pitch lag                           */
    SKP_int32           HarmShapeFIRPacked_Q14, /* I                                        */
    SKP_int             Tilt_Q14,               /* I    Spectral tilt                       */
    SKP_int32           LF_shp_Q14,             /* I                                        */
    SKP_int32           Gain_Q16,               /* I                                        */
    SKP_int             Lambda_Q10,             /* I                                        */
    SKP_int             offset_Q10,             /* I                                        */
    SKP_int             length,                 /* I    Input length                        */
    SKP_int             subfr,                  /* I    Subframe number                     */
    SKP_int             shapingLPCOrder,        /* I    Shaping LPC filter order            */
    SKP_int             predictLPCOrder,        /* I    Prediction filter order             */
    SKP_int             warping_Q16,            /* I                                        */
    SKP_int             nStatesDelayedDecision, /* I    Number of states in decision tree   */
    SKP_int             *smpl_buf_idx,          /* I    Index to newest samples in buffers  */
    SKP_int             decisionDelay           /* I                                        */
);

void SKP_Silk_NSQ_del_dec(
    SKP_Silk_encoder_state          *psEncC,                                    /* I/O  Encoder State                       */
    SKP_Silk_encoder_control        *psEncCtrlC,                                /* I    Encoder Control                     */
    SKP_Silk_nsq_state              *NSQ,                                       /* I/O  NSQ state                           */
    const SKP_int16                 x[],                                        /* I    Prefiltered input signal            */
    SKP_int8                        q[],                                        /* O    Quantized pulse signal              */
    const SKP_int                   LSFInterpFactor_Q2,                         /* I    LSF interpolation factor in Q2      */
    const SKP_int16                 PredCoef_Q12[ 2 * MAX_LPC_ORDER ],          /* I    Prediction coefs                    */
    const SKP_int16                 LTPCoef_Q14[ LTP_ORDER * NB_SUBFR ],        /* I    LT prediction coefs                 */
    const SKP_int16                 AR2_Q13[ NB_SUBFR * MAX_SHAPE_LPC_ORDER ],  /* I                                        */
    const SKP_int                   HarmShapeGain_Q14[ NB_SUBFR ],              /* I                                        */
    const SKP_int                   Tilt_Q14[ NB_SUBFR ],                       /* I    Spectral tilt                       */
    const SKP_int32                 LF_shp_Q14[ NB_SUBFR ],                     /* I                                        */
    const SKP_int32                 Gains_Q16[ NB_SUBFR ],                      /* I                                        */
    const SKP_int                   Lambda_Q10,                                 /* I                                        */
    const SKP_int                   LTP_scale_Q14                               /* I    LTP state scaling                   */
)
{
    SKP_int     i, k, lag, start_idx, LSF_interpolation_flag, Winner_ind, subfr;
    SKP_int     last_smple_idx, smpl_buf_idx, decisionDelay, subfr_length;
    const SKP_int16 *A_Q12, *B_Q14, *AR_shp_Q13;
    SKP_int16   *pxq;
    SKP_int32   sLTP_Q16[ 2 * MAX_FRAME_LENGTH ];
    SKP_int16   sLTP[     2 * MAX_FRAME_LENGTH ];
    SKP_int32   HarmShapeFIRPacked_Q14;
    SKP_int     offset_Q10;
    SKP_int32   FiltState[ MAX_LPC_ORDER ], RDmin_Q10;
    SKP_int32   x_sc_Q10[ MAX_FRAME_LENGTH / NB_SUBFR ];
    NSQ_del_dec_struct psDelDec[ MAX_DEL_DEC_STATES ];
    NSQ_del_dec_struct *psDD;

    subfr_length = psEncC->frame_length / NB_SUBFR;

    /* Set unvoiced lag to the previous one, overwrite later for voiced */
    lag = NSQ->lagPrev;

    SKP_assert( NSQ->prev_inv_gain_Q16 != 0 );

    /* Initialize delayed decision states */
    SKP_memset( psDelDec, 0, psEncC->nStatesDelayedDecision * sizeof( NSQ_del_dec_struct ) );
    for( k = 0; k < psEncC->nStatesDelayedDecision; k++ ) {
        psDD                 = &psDelDec[ k ];
        psDD->Seed           = ( k + psEncCtrlC->Seed ) & 3;
        psDD->SeedInit       = psDD->Seed;
        psDD->RD_Q10         = 0;
        psDD->LF_AR_Q12      = NSQ->sLF_AR_shp_Q12;
        psDD->Shape_Q10[ 0 ] = NSQ->sLTP_shp_Q10[ psEncC->frame_length - 1 ];
        SKP_memcpy( psDD->sLPC_Q14, NSQ->sLPC_Q14, NSQ_LPC_BUF_LENGTH * sizeof( SKP_int32 ) );
        SKP_memcpy( psDD->sAR2_Q14, NSQ->sAR2_Q14, sizeof( NSQ->sAR2_Q14 ) );
    }

    offset_Q10   = SKP_Silk_Quantization_Offsets_Q10[ psEncCtrlC->sigtype ][ psEncCtrlC->QuantOffsetType ];
    smpl_buf_idx = 0; /* index of oldest samples */

    decisionDelay = SKP_min_int( DECISION_DELAY, subfr_length );

    /* For voiced frames limit the decision delay to lower than the pitch lag */
    if( psEncCtrlC->sigtype == SIG_TYPE_VOICED ) {
        for( k = 0; k < NB_SUBFR; k++ ) {
            decisionDelay = SKP_min_int( decisionDelay, psEncCtrlC->pitchL[ k ] - LTP_ORDER / 2 - 1 );
        }
    } else {
        if( lag > 0 ) {
            decisionDelay = SKP_min_int( decisionDelay, lag - LTP_ORDER / 2 - 1 );
        }
    }

    if( LSFInterpFactor_Q2 == ( 1 << 2 ) ) {
        LSF_interpolation_flag = 0;
    } else {
        LSF_interpolation_flag = 1;
    }

    /* Setup pointers to start of sub frame */
    pxq                   = &NSQ->xq[ psEncC->frame_length ];
    NSQ->sLTP_shp_buf_idx = psEncC->frame_length;
    NSQ->sLTP_buf_idx     = psEncC->frame_length;
    subfr = 0;
    for( k = 0; k < NB_SUBFR; k++ ) {
        A_Q12      = &PredCoef_Q12[ ( ( k >> 1 ) | ( 1 - LSF_interpolation_flag ) ) * MAX_LPC_ORDER ];
        B_Q14      = &LTPCoef_Q14[ k * LTP_ORDER           ];
        AR_shp_Q13 = &AR2_Q13[     k * MAX_SHAPE_LPC_ORDER ];

        /* Noise shape parameters */
        SKP_assert( HarmShapeGain_Q14[ k ] >= 0 );
        HarmShapeFIRPacked_Q14  =                          SKP_RSHIFT( HarmShapeGain_Q14[ k ], 2 );
        HarmShapeFIRPacked_Q14 |= SKP_LSHIFT( ( SKP_int32 )SKP_RSHIFT( HarmShapeGain_Q14[ k ], 1 ), 16 );

        NSQ->rewhite_flag = 0;
        if( psEncCtrlC->sigtype == SIG_TYPE_VOICED ) {
            /* Voiced */
            lag = psEncCtrlC->pitchL[ k ];

            /* Re-whitening */
            if( ( k & ( 3 - SKP_LSHIFT( LSF_interpolation_flag, 1 ) ) ) == 0 ) {
                if( k == 2 ) {
                    /* RESET DELAYED DECISIONS */
                    /* Find winner */
                    RDmin_Q10 = psDelDec[ 0 ].RD_Q10;
                    Winner_ind = 0;
                    for( i = 1; i < psEncC->nStatesDelayedDecision; i++ ) {
                        if( psDelDec[ i ].RD_Q10 < RDmin_Q10 ) {
                            RDmin_Q10 = psDelDec[ i ].RD_Q10;
                            Winner_ind = i;
                        }
                    }
                    for( i = 0; i < psEncC->nStatesDelayedDecision; i++ ) {
                        if( i != Winner_ind ) {
                            psDelDec[ i ].RD_Q10 += ( SKP_int32_MAX >> 4 );
                            SKP_assert( psDelDec[ i ].RD_Q10 >= 0 );
                        }
                    }
                    
                    /* Copy final part of signals from winner state to output and long-term filter states */
                    psDD = &psDelDec[ Winner_ind ];
                    last_smple_idx = smpl_buf_idx + decisionDelay;
                    for( i = 0; i < decisionDelay; i++ ) {
                        last_smple_idx = ( last_smple_idx - 1 ) & DECISION_DELAY_MASK;
                        q[   i - decisionDelay ] = ( SKP_int8 )SKP_RSHIFT( psDD->Q_Q10[ last_smple_idx ], 10 );
                        pxq[ i - decisionDelay ] = ( SKP_int16 )SKP_SAT16( SKP_RSHIFT_ROUND( 
                            SKP_SMULWW( psDD->Xq_Q10[ last_smple_idx ], 
                            psDD->Gain_Q16[ last_smple_idx ] ), 10 ) );
                        NSQ->sLTP_shp_Q10[ NSQ->sLTP_shp_buf_idx - decisionDelay + i ] = psDD->Shape_Q10[ last_smple_idx ];
                    }

                    subfr = 0;
                }

                /* Rewhiten with new A coefs */
                start_idx = psEncC->frame_length - lag - psEncC->predictLPCOrder - LTP_ORDER / 2;
                SKP_assert( start_idx >= 0 );
                SKP_assert( start_idx <= psEncC->frame_length - psEncC->predictLPCOrder );

                SKP_memset( FiltState, 0, psEncC->predictLPCOrder * sizeof( SKP_int32 ) );
                SKP_Silk_MA_Prediction( &NSQ->xq[ start_idx + k * psEncC->subfr_length ], 
                    A_Q12, FiltState, sLTP + start_idx, psEncC->frame_length - start_idx, psEncC->predictLPCOrder );

                NSQ->sLTP_buf_idx = psEncC->frame_length;
                NSQ->rewhite_flag = 1;
            }
        }

        SKP_Silk_nsq_del_dec_scale_states( NSQ, psDelDec, x, x_sc_Q10, 
            subfr_length, sLTP, sLTP_Q16, k, psEncC->nStatesDelayedDecision, smpl_buf_idx,
            LTP_scale_Q14, Gains_Q16, psEncCtrlC->pitchL );

        SKP_Silk_noise_shape_quantizer_del_dec( NSQ, psDelDec, psEncCtrlC->sigtype, x_sc_Q10, q, pxq, sLTP_Q16,
            A_Q12, B_Q14, AR_shp_Q13, lag, HarmShapeFIRPacked_Q14, Tilt_Q14[ k ], LF_shp_Q14[ k ], Gains_Q16[ k ], 
            Lambda_Q10, offset_Q10, psEncC->subfr_length, subfr++, psEncC->shapingLPCOrder, psEncC->predictLPCOrder, 
            psEncC->warping_Q16, psEncC->nStatesDelayedDecision, &smpl_buf_idx, decisionDelay );
        
        x   += psEncC->subfr_length;
        q   += psEncC->subfr_length;
        pxq += psEncC->subfr_length;
    }

    /* Find winner */
    RDmin_Q10 = psDelDec[ 0 ].RD_Q10;
    Winner_ind = 0;
    for( k = 1; k < psEncC->nStatesDelayedDecision; k++ ) {
        if( psDelDec[ k ].RD_Q10 < RDmin_Q10 ) {
            RDmin_Q10 = psDelDec[ k ].RD_Q10;
            Winner_ind = k;
        }
    }
    
    /* Copy final part of signals from winner state to output and long-term filter states */
    psDD = &psDelDec[ Winner_ind ];
    psEncCtrlC->Seed = psDD->SeedInit;
    last_smple_idx = smpl_buf_idx + decisionDelay;
    for( i = 0; i < decisionDelay; i++ ) {
        last_smple_idx = ( last_smple_idx - 1 ) & DECISION_DELAY_MASK;
        q[   i - decisionDelay ] = ( SKP_int8 )SKP_RSHIFT( psDD->Q_Q10[ last_smple_idx ], 10 );
        pxq[ i - decisionDelay ] = ( SKP_int16 )SKP_SAT16( SKP_RSHIFT_ROUND( 
            SKP_SMULWW( psDD->Xq_Q10[ last_smple_idx ], psDD->Gain_Q16[ last_smple_idx ] ), 10 ) );
        NSQ->sLTP_shp_Q10[ NSQ->sLTP_shp_buf_idx - decisionDelay + i ] = psDD->Shape_Q10[ last_smple_idx ];
        sLTP_Q16[          NSQ->sLTP_buf_idx     - decisionDelay + i ] = psDD->Pred_Q16[  last_smple_idx ];
    }
    SKP_memcpy( NSQ->sLPC_Q14, &psDD->sLPC_Q14[ psEncC->subfr_length ], NSQ_LPC_BUF_LENGTH * sizeof( SKP_int32 ) );
    SKP_memcpy( NSQ->sAR2_Q14, psDD->sAR2_Q14, sizeof( psDD->sAR2_Q14 ) );

    /* Update states */
    NSQ->sLF_AR_shp_Q12 = psDD->LF_AR_Q12;
    NSQ->lagPrev        = psEncCtrlC->pitchL[ NB_SUBFR - 1 ];

    /* Save quantized speech and noise shaping signals */
    SKP_memcpy( NSQ->xq,           &NSQ->xq[           psEncC->frame_length ], psEncC->frame_length * sizeof( SKP_int16 ) );
    SKP_memcpy( NSQ->sLTP_shp_Q10, &NSQ->sLTP_shp_Q10[ psEncC->frame_length ], psEncC->frame_length * sizeof( SKP_int32 ) );

#ifdef USE_UNQUANTIZED_LSFS
    DEBUG_STORE_DATA( xq_unq_lsfs.pcm, NSQ->xq, psEncC->frame_length * sizeof( SKP_int16 ) );
#endif

}

/******************************************/
/* Noise shape quantizer for one subframe */
/******************************************/
SKP_INLINE void SKP_Silk_noise_shape_quantizer_del_dec(
    SKP_Silk_nsq_state  *NSQ,                   /* I/O  NSQ state                           */
    NSQ_del_dec_struct  psDelDec[],             /* I/O  Delayed decision states             */
    SKP_int             sigtype,                /* I    Signal type                         */
    const SKP_int32     x_Q10[],                /* I                                        */
    SKP_int8            q[],                    /* O                                        */
    SKP_int16           xq[],                   /* O                                        */
    SKP_int32           sLTP_Q16[],             /* I/O  LTP filter state                    */
    const SKP_int16     a_Q12[],                /* I    Short term prediction coefs         */
    const SKP_int16     b_Q14[],                /* I    Long term prediction coefs          */
    const SKP_int16     AR_shp_Q13[],           /* I    Noise shaping coefs                 */
    SKP_int             lag,                    /* I    Pitch lag                           */
    SKP_int32           HarmShapeFIRPacked_Q14, /* I                                        */
    SKP_int             Tilt_Q14,               /* I    Spectral tilt                       */
    SKP_int32           LF_shp_Q14,             /* I                                        */
    SKP_int32           Gain_Q16,               /* I                                        */
    SKP_int             Lambda_Q10,             /* I                                        */
    SKP_int             offset_Q10,             /* I                                        */
    SKP_int             length,                 /* I    Input length                        */
    SKP_int             subfr,                  /* I    Subframe number                     */
    SKP_int             shapingLPCOrder,        /* I    Shaping LPC filter order            */
    SKP_int             predictLPCOrder,        /* I    Prediction filter order             */
    SKP_int             warping_Q16,            /* I                                        */
    SKP_int             nStatesDelayedDecision, /* I    Number of states in decision tree   */
    SKP_int             *smpl_buf_idx,          /* I    Index to newest samples in buffers  */
    SKP_int             decisionDelay           /* I                                        */
)
{
    SKP_int     i, j, k, Winner_ind, RDmin_ind, RDmax_ind, last_smple_idx;
    SKP_int32   Winner_rand_state;
    SKP_int32   LTP_pred_Q14, LPC_pred_Q10, n_AR_Q10, n_LTP_Q14;
    SKP_int32   n_LF_Q10, r_Q10, rr_Q20, rd1_Q10, rd2_Q10, RDmin_Q10, RDmax_Q10;
    SKP_int32   q1_Q10, q2_Q10, dither, exc_Q10, LPC_exc_Q10, xq_Q10;
    SKP_int32   tmp1, tmp2, sLF_AR_shp_Q10;
    SKP_int32   *pred_lag_ptr, *shp_lag_ptr, *psLPC_Q14;
    NSQ_sample_struct  psSampleState[ MAX_DEL_DEC_STATES ][ 2 ];
    NSQ_del_dec_struct *psDD;
    NSQ_sample_struct  *psSS;
#if !defined(_SYSTEM_IS_BIG_ENDIAN)
    SKP_int32   a_Q12_tmp[ MAX_LPC_ORDER / 2 ], Atmp;

    /* Preload LPC coeficients to array on stack. Gives small performance gain */
    SKP_memcpy( a_Q12_tmp, a_Q12, predictLPCOrder * sizeof( SKP_int16 ) );
#endif

    shp_lag_ptr  = &NSQ->sLTP_shp_Q10[ NSQ->sLTP_shp_buf_idx - lag + HARM_SHAPE_FIR_TAPS / 2 ];
    pred_lag_ptr = &sLTP_Q16[ NSQ->sLTP_buf_idx - lag + LTP_ORDER / 2 ];

    for( i = 0; i < length; i++ ) {
        /* Perform common calculations used in all states */

        /* Long-term prediction */
        if( sigtype == SIG_TYPE_VOICED ) {
            /* Unrolled loop */
            LTP_pred_Q14 = SKP_SMULWB(               pred_lag_ptr[  0 ], b_Q14[ 0 ] );
            LTP_pred_Q14 = SKP_SMLAWB( LTP_pred_Q14, pred_lag_ptr[ -1 ], b_Q14[ 1 ] );
            LTP_pred_Q14 = SKP_SMLAWB( LTP_pred_Q14, pred_lag_ptr[ -2 ], b_Q14[ 2 ] );
            LTP_pred_Q14 = SKP_SMLAWB( LTP_pred_Q14, pred_lag_ptr[ -3 ], b_Q14[ 3 ] );
            LTP_pred_Q14 = SKP_SMLAWB( LTP_pred_Q14, pred_lag_ptr[ -4 ], b_Q14[ 4 ] );
            pred_lag_ptr++;
        } else {
            LTP_pred_Q14 = 0;
        }

        /* Long-term shaping */
        if( lag > 0 ) {
            /* Symmetric, packed FIR coefficients */
            n_LTP_Q14 = SKP_SMULWB( SKP_ADD32( shp_lag_ptr[ 0 ], shp_lag_ptr[ -2 ] ), HarmShapeFIRPacked_Q14 );
            n_LTP_Q14 = SKP_SMLAWT( n_LTP_Q14, shp_lag_ptr[ -1 ],                     HarmShapeFIRPacked_Q14 );
            n_LTP_Q14 = SKP_LSHIFT( n_LTP_Q14, 6 );
            shp_lag_ptr++;
        } else {
            n_LTP_Q14 = 0;
        }

        for( k = 0; k < nStatesDelayedDecision; k++ ) {
            /* Delayed decision state */
            psDD = &psDelDec[ k ];

            /* Sample state */
            psSS = psSampleState[ k ];

            /* Generate dither */
            psDD->Seed = SKP_RAND( psDD->Seed );

            /* dither = rand_seed < 0 ? 0xFFFFFFFF : 0; */
            dither = SKP_RSHIFT( psDD->Seed, 31 );
            
            /* Pointer used in short term prediction and shaping */
            psLPC_Q14 = &psDD->sLPC_Q14[ NSQ_LPC_BUF_LENGTH - 1 + i ];
            /* Short-term prediction */
            SKP_assert( predictLPCOrder >= 10 );            /* check that unrolling works */
            SKP_assert( ( predictLPCOrder  & 1 ) == 0 );    /* check that order is even */
            SKP_assert( ( ( ( int )( ( char* )( a_Q12 ) - ( ( char* ) 0 ) ) ) & 3 ) == 0 );    /* check that array starts at 4-byte aligned address */
#if !defined(_SYSTEM_IS_BIG_ENDIAN)
            /* Partially unrolled */
            Atmp = a_Q12_tmp[ 0 ];          /* read two coefficients at once */
            LPC_pred_Q10 = SKP_SMULWB(               psLPC_Q14[  0 ], Atmp );
            LPC_pred_Q10 = SKP_SMLAWT( LPC_pred_Q10, psLPC_Q14[ -1 ], Atmp );
            Atmp = a_Q12_tmp[ 1 ];
            LPC_pred_Q10 = SKP_SMLAWB( LPC_pred_Q10, psLPC_Q14[ -2 ], Atmp );
            LPC_pred_Q10 = SKP_SMLAWT( LPC_pred_Q10, psLPC_Q14[ -3 ], Atmp );
            Atmp = a_Q12_tmp[ 2 ];
            LPC_pred_Q10 = SKP_SMLAWB( LPC_pred_Q10, psLPC_Q14[ -4 ], Atmp );
            LPC_pred_Q10 = SKP_SMLAWT( LPC_pred_Q10, psLPC_Q14[ -5 ], Atmp );
            Atmp = a_Q12_tmp[ 3 ];
            LPC_pred_Q10 = SKP_SMLAWB( LPC_pred_Q10, psLPC_Q14[ -6 ], Atmp );
            LPC_pred_Q10 = SKP_SMLAWT( LPC_pred_Q10, psLPC_Q14[ -7 ], Atmp );
            Atmp = a_Q12_tmp[ 4 ];
            LPC_pred_Q10 = SKP_SMLAWB( LPC_pred_Q10, psLPC_Q14[ -8 ], Atmp );
            LPC_pred_Q10 = SKP_SMLAWT( LPC_pred_Q10, psLPC_Q14[ -9 ], Atmp );
            for( j = 10; j < predictLPCOrder; j += 2 ) {
                Atmp = a_Q12_tmp[ j >> 1 ]; /* read two coefficients at once */
                LPC_pred_Q10 = SKP_SMLAWB( LPC_pred_Q10, psLPC_Q14[ -j     ], Atmp );
                LPC_pred_Q10 = SKP_SMLAWT( LPC_pred_Q10, psLPC_Q14[ -j - 1 ], Atmp );
            }
#else
            /* Partially unrolled */
            LPC_pred_Q10 = SKP_SMULWB(               psLPC_Q14[  0 ], a_Q12[ 0 ] );
            LPC_pred_Q10 = SKP_SMLAWB( LPC_pred_Q10, psLPC_Q14[ -1 ], a_Q12[ 1 ] );
            LPC_pred_Q10 = SKP_SMLAWB( LPC_pred_Q10, psLPC_Q14[ -2 ], a_Q12[ 2 ] );
            LPC_pred_Q10 = SKP_SMLAWB( LPC_pred_Q10, psLPC_Q14[ -3 ], a_Q12[ 3 ] );
            LPC_pred_Q10 = SKP_SMLAWB( LPC_pred_Q10, psLPC_Q14[ -4 ], a_Q12[ 4 ] );
            LPC_pred_Q10 = SKP_SMLAWB( LPC_pred_Q10, psLPC_Q14[ -5 ], a_Q12[ 5 ] );
            LPC_pred_Q10 = SKP_SMLAWB( LPC_pred_Q10, psLPC_Q14[ -6 ], a_Q12[ 6 ] );
            LPC_pred_Q10 = SKP_SMLAWB( LPC_pred_Q10, psLPC_Q14[ -7 ], a_Q12[ 7 ] );
            LPC_pred_Q10 = SKP_SMLAWB( LPC_pred_Q10, psLPC_Q14[ -8 ], a_Q12[ 8 ] );
            LPC_pred_Q10 = SKP_SMLAWB( LPC_pred_Q10, psLPC_Q14[ -9 ], a_Q12[ 9 ] );
            for( j = 10; j < predictLPCOrder; j ++ ) {
                LPC_pred_Q10 = SKP_SMLAWB( LPC_pred_Q10, psLPC_Q14[ -j ], a_Q12[ j ] );
            }
#endif

            /* Noise shape feedback */
            SKP_assert( ( shapingLPCOrder & 1 ) == 0 );   /* check that order is even */
            /* Output of lowpass section */
            tmp2 = SKP_SMLAWB( psLPC_Q14[ 0 ], psDD->sAR2_Q14[ 0 ], warping_Q16 );
            /* Output of allpass section */
            tmp1 = SKP_SMLAWB( psDD->sAR2_Q14[ 0 ], psDD->sAR2_Q14[ 1 ] - tmp2, warping_Q16 );
            psDD->sAR2_Q14[ 0 ] = tmp2;
            n_AR_Q10 = SKP_SMULWB( tmp2, AR_shp_Q13[ 0 ] );
            /* Loop over allpass sections */
            for( j = 2; j < shapingLPCOrder; j += 2 ) {
                /* Output of allpass section */
                tmp2 = SKP_SMLAWB( psDD->sAR2_Q14[ j - 1 ], psDD->sAR2_Q14[ j + 0 ] - tmp1, warping_Q16 );
                psDD->sAR2_Q14[ j - 1 ] = tmp1;
                n_AR_Q10 = SKP_SMLAWB( n_AR_Q10, tmp1, AR_shp_Q13[ j - 1 ] );
                /* Output of allpass section */
                tmp1 = SKP_SMLAWB( psDD->sAR2_Q14[ j + 0 ], psDD->sAR2_Q14[ j + 1 ] - tmp2, warping_Q16 );
                psDD->sAR2_Q14[ j + 0 ] = tmp2;
                n_AR_Q10 = SKP_SMLAWB( n_AR_Q10, tmp2, AR_shp_Q13[ j ] );
            }
            psDD->sAR2_Q14[ shapingLPCOrder - 1 ] = tmp1;
            n_AR_Q10 = SKP_SMLAWB( n_AR_Q10, tmp1, AR_shp_Q13[ shapingLPCOrder - 1 ] );

            n_AR_Q10 = SKP_RSHIFT( n_AR_Q10, 1 );           /* Q11 -> Q10 */
            n_AR_Q10 = SKP_SMLAWB( n_AR_Q10, psDD->LF_AR_Q12, Tilt_Q14 );

            n_LF_Q10 = SKP_LSHIFT( SKP_SMULWB( psDD->Shape_Q10[ *smpl_buf_idx ], LF_shp_Q14 ), 2 ); 
            n_LF_Q10 = SKP_SMLAWT( n_LF_Q10, psDD->LF_AR_Q12, LF_shp_Q14 );       

            /* Input minus prediction plus noise feedback                       */
            /* r = x[ i ] - LTP_pred - LPC_pred + n_AR + n_Tilt + n_LF + n_LTP  */
            tmp1  = SKP_SUB32( LTP_pred_Q14, n_LTP_Q14 );                       /* Add Q14 stuff */
            tmp1  = SKP_RSHIFT( tmp1, 4 );                                      /* convert to Q10 */
            tmp1  = SKP_ADD32( tmp1, LPC_pred_Q10 );                            /* add Q10 stuff */ 
            tmp1  = SKP_SUB32( tmp1, n_AR_Q10 );                                /* subtract Q10 stuff */ 
            tmp1  = SKP_SUB32( tmp1, n_LF_Q10 );                                /* subtract Q10 stuff */ 
            r_Q10 = SKP_SUB32( x_Q10[ i ], tmp1 );                              /* residual error Q10 */
            
            /* Flip sign depending on dither */
            r_Q10 = ( r_Q10 ^ dither ) - dither;
            r_Q10 = SKP_SUB32( r_Q10, offset_Q10 );
            r_Q10 = SKP_LIMIT_32( r_Q10, -64 << 10, 64 << 10 );

            /* Find two quantization level candidates and measure their rate-distortion */
            if( r_Q10 < -1536 ) {
                q1_Q10  = SKP_LSHIFT( SKP_RSHIFT_ROUND( r_Q10, 10 ), 10 );
                r_Q10   = SKP_SUB32( r_Q10, q1_Q10 );
                rd1_Q10 = SKP_RSHIFT( SKP_SMLABB( SKP_MUL( -SKP_ADD32( q1_Q10, offset_Q10 ), Lambda_Q10 ), r_Q10, r_Q10 ), 10 );
                rd2_Q10 = SKP_ADD32( rd1_Q10, 1024 );
                rd2_Q10 = SKP_SUB32( rd2_Q10, SKP_ADD_LSHIFT32( Lambda_Q10, r_Q10, 1 ) );
                q2_Q10  = SKP_ADD32( q1_Q10, 1024 );
            } else if( r_Q10 > 512 ) {
                q1_Q10  = SKP_LSHIFT( SKP_RSHIFT_ROUND( r_Q10, 10 ), 10 );
                r_Q10   = SKP_SUB32( r_Q10, q1_Q10 );
                rd1_Q10 = SKP_RSHIFT( SKP_SMLABB( SKP_MUL( SKP_ADD32( q1_Q10, offset_Q10 ), Lambda_Q10 ), r_Q10, r_Q10 ), 10 );
                rd2_Q10 = SKP_ADD32( rd1_Q10, 1024 );
                rd2_Q10 = SKP_SUB32( rd2_Q10, SKP_SUB_LSHIFT32( Lambda_Q10, r_Q10, 1 ) );
                q2_Q10  = SKP_SUB32( q1_Q10, 1024 );
            } else {            /* r_Q10 >= -1536 && q1_Q10 <= 512 */
                rr_Q20  = SKP_SMULBB( offset_Q10, Lambda_Q10 );
                rd2_Q10 = SKP_RSHIFT( SKP_SMLABB( rr_Q20, r_Q10, r_Q10 ), 10 );
                rd1_Q10 = SKP_ADD32( rd2_Q10, 1024 );
                rd1_Q10 = SKP_ADD32( rd1_Q10, SKP_SUB_RSHIFT32( SKP_ADD_LSHIFT32( Lambda_Q10, r_Q10, 1 ), rr_Q20, 9 ) );
                q1_Q10  = -1024;
                q2_Q10  = 0;
            }

            if( rd1_Q10 < rd2_Q10 ) {
                psSS[ 0 ].RD_Q10 = SKP_ADD32( psDD->RD_Q10, rd1_Q10 ); 
                psSS[ 1 ].RD_Q10 = SKP_ADD32( psDD->RD_Q10, rd2_Q10 );
                psSS[ 0 ].Q_Q10 = q1_Q10;
                psSS[ 1 ].Q_Q10 = q2_Q10;
            } else {
                psSS[ 0 ].RD_Q10 = SKP_ADD32( psDD->RD_Q10, rd2_Q10 );
                psSS[ 1 ].RD_Q10 = SKP_ADD32( psDD->RD_Q10, rd1_Q10 );
                psSS[ 0 ].Q_Q10 = q2_Q10;
                psSS[ 1 ].Q_Q10 = q1_Q10;
            }

            /* Update states for best quantization */

            /* Quantized excitation */
            exc_Q10 = SKP_ADD32( offset_Q10, psSS[ 0 ].Q_Q10 );
            exc_Q10 = ( exc_Q10 ^ dither ) - dither;

            /* Add predictions */
            LPC_exc_Q10 = exc_Q10 + SKP_RSHIFT_ROUND( LTP_pred_Q14, 4 );
            xq_Q10      = SKP_ADD32( LPC_exc_Q10, LPC_pred_Q10 );

            /* Update states */
            sLF_AR_shp_Q10         = SKP_SUB32(  xq_Q10, n_AR_Q10 );
            psSS[ 0 ].sLTP_shp_Q10 = SKP_SUB32(  sLF_AR_shp_Q10, n_LF_Q10 );
            psSS[ 0 ].LF_AR_Q12    = SKP_LSHIFT( sLF_AR_shp_Q10, 2 );
            psSS[ 0 ].xq_Q14       = SKP_LSHIFT( xq_Q10,         4 );
            psSS[ 0 ].LPC_exc_Q16  = SKP_LSHIFT( LPC_exc_Q10,    6 );

            /* Update states for second best quantization */

            /* Quantized excitation */
            exc_Q10 = SKP_ADD32( offset_Q10, psSS[ 1 ].Q_Q10 );
            exc_Q10 = ( exc_Q10 ^ dither ) - dither;

            /* Add predictions */
            LPC_exc_Q10 = exc_Q10 + SKP_RSHIFT_ROUND( LTP_pred_Q14, 4 );
            xq_Q10      = SKP_ADD32( LPC_exc_Q10, LPC_pred_Q10 );

            /* Update states */
            sLF_AR_shp_Q10         = SKP_SUB32(  xq_Q10, n_AR_Q10 );
            psSS[ 1 ].sLTP_shp_Q10 = SKP_SUB32(  sLF_AR_shp_Q10, n_LF_Q10 );
            psSS[ 1 ].LF_AR_Q12    = SKP_LSHIFT( sLF_AR_shp_Q10, 2 );
            psSS[ 1 ].xq_Q14       = SKP_LSHIFT( xq_Q10,         4 );
            psSS[ 1 ].LPC_exc_Q16  = SKP_LSHIFT( LPC_exc_Q10,    6 );
        }

        *smpl_buf_idx  = ( *smpl_buf_idx - 1 ) & DECISION_DELAY_MASK;                   /* Index to newest samples              */
        last_smple_idx = ( *smpl_buf_idx + decisionDelay ) & DECISION_DELAY_MASK;       /* Index to decisionDelay old samples   */

        /* Find winner */
        RDmin_Q10 = psSampleState[ 0 ][ 0 ].RD_Q10;
        Winner_ind = 0;
        for( k = 1; k < nStatesDelayedDecision; k++ ) {
            if( psSampleState[ k ][ 0 ].RD_Q10 < RDmin_Q10 ) {
                RDmin_Q10   = psSampleState[ k ][ 0 ].RD_Q10;
                Winner_ind = k;
            }
        }

        /* Increase RD values of expired states */
        Winner_rand_state = psDelDec[ Winner_ind ].RandState[ last_smple_idx ];
        for( k = 0; k < nStatesDelayedDecision; k++ ) {
            if( psDelDec[ k ].RandState[ last_smple_idx ] != Winner_rand_state ) {
                psSampleState[ k ][ 0 ].RD_Q10 = SKP_ADD32( psSampleState[ k ][ 0 ].RD_Q10, ( SKP_int32_MAX >> 4 ) );
                psSampleState[ k ][ 1 ].RD_Q10 = SKP_ADD32( psSampleState[ k ][ 1 ].RD_Q10, ( SKP_int32_MAX >> 4 ) );
                SKP_assert( psSampleState[ k ][ 0 ].RD_Q10 >= 0 );
            }
        }

        /* Find worst in first set and best in second set */
        RDmax_Q10  = psSampleState[ 0 ][ 0 ].RD_Q10;
        RDmin_Q10  = psSampleState[ 0 ][ 1 ].RD_Q10;
        RDmax_ind = 0;
        RDmin_ind = 0;
        for( k = 1; k < nStatesDelayedDecision; k++ ) {
            /* find worst in first set */
            if( psSampleState[ k ][ 0 ].RD_Q10 > RDmax_Q10 ) {
                RDmax_Q10  = psSampleState[ k ][ 0 ].RD_Q10;
                RDmax_ind = k;
            }
            /* find best in second set */
            if( psSampleState[ k ][ 1 ].RD_Q10 < RDmin_Q10 ) {
                RDmin_Q10  = psSampleState[ k ][ 1 ].RD_Q10;
                RDmin_ind = k;
            }
        }

        /* Replace a state if best from second set outperforms worst in first set */
        if( RDmin_Q10 < RDmax_Q10 ) {
            SKP_Silk_copy_del_dec_state( &psDelDec[ RDmax_ind ], &psDelDec[ RDmin_ind ], i ); 
            SKP_memcpy( &psSampleState[ RDmax_ind ][ 0 ], &psSampleState[ RDmin_ind ][ 1 ], sizeof( NSQ_sample_struct ) );
        }

        /* Write samples from winner to output and long-term filter states */
        psDD = &psDelDec[ Winner_ind ];
        if( subfr > 0 || i >= decisionDelay ) {
            q[  i - decisionDelay ] = ( SKP_int8 )SKP_RSHIFT( psDD->Q_Q10[ last_smple_idx ], 10 );
            xq[ i - decisionDelay ] = ( SKP_int16 )SKP_SAT16( SKP_RSHIFT_ROUND( 
                SKP_SMULWW( psDD->Xq_Q10[ last_smple_idx ], psDD->Gain_Q16[ last_smple_idx ] ), 10 ) );
            NSQ->sLTP_shp_Q10[ NSQ->sLTP_shp_buf_idx - decisionDelay ] = psDD->Shape_Q10[ last_smple_idx ];
            sLTP_Q16[          NSQ->sLTP_buf_idx     - decisionDelay ] = psDD->Pred_Q16[  last_smple_idx ];
        }
        NSQ->sLTP_shp_buf_idx++;
        NSQ->sLTP_buf_idx++;

        /* Update states */
        for( k = 0; k < nStatesDelayedDecision; k++ ) {
            psDD                                     = &psDelDec[ k ];
            psSS                                     = &psSampleState[ k ][ 0 ];
            psDD->LF_AR_Q12                          = psSS->LF_AR_Q12;
            psDD->sLPC_Q14[ NSQ_LPC_BUF_LENGTH + i ] = psSS->xq_Q14;
            psDD->Xq_Q10[    *smpl_buf_idx ]         = SKP_RSHIFT( psSS->xq_Q14, 4 );
            psDD->Q_Q10[     *smpl_buf_idx ]         = psSS->Q_Q10;
            psDD->Pred_Q16[  *smpl_buf_idx ]         = psSS->LPC_exc_Q16;
            psDD->Shape_Q10[ *smpl_buf_idx ]         = psSS->sLTP_shp_Q10;
            psDD->Seed                               = SKP_ADD_RSHIFT32( psDD->Seed, psSS->Q_Q10, 10 );
            psDD->RandState[ *smpl_buf_idx ]         = psDD->Seed;
            psDD->RD_Q10                             = psSS->RD_Q10;
            psDD->Gain_Q16[  *smpl_buf_idx ]         = Gain_Q16;
        }
    }
    /* Update LPC states */
    for( k = 0; k < nStatesDelayedDecision; k++ ) {
        psDD = &psDelDec[ k ];
        SKP_memcpy( psDD->sLPC_Q14, &psDD->sLPC_Q14[ length ], NSQ_LPC_BUF_LENGTH * sizeof( SKP_int32 ) );
    }
}

SKP_INLINE void SKP_Silk_nsq_del_dec_scale_states(
    SKP_Silk_nsq_state  *NSQ,                   /* I/O  NSQ state                           */
    NSQ_del_dec_struct  psDelDec[],             /* I/O  Delayed decision states             */
    const SKP_int16     x[],                    /* I    Input in Q0                         */
    SKP_int32           x_sc_Q10[],             /* O    Input scaled with 1/Gain in Q10     */
    SKP_int             subfr_length,           /* I    Length of input                     */
    const SKP_int16     sLTP[],                 /* I    Re-whitened LTP state in Q0         */
    SKP_int32           sLTP_Q16[],             /* O    LTP state matching scaled input     */
    SKP_int             subfr,                  /* I    Subframe number                     */
    SKP_int             nStatesDelayedDecision, /* I    Number of del dec states            */
    SKP_int             smpl_buf_idx,           /* I    Index to newest samples in buffers  */
    const SKP_int       LTP_scale_Q14,          /* I    LTP state scaling                   */
    const SKP_int32     Gains_Q16[ NB_SUBFR ],  /* I                                        */
    const SKP_int       pitchL[ NB_SUBFR ]      /* I    Pitch lag                           */
)
{
    SKP_int            i, k, lag;
    SKP_int32          inv_gain_Q16, gain_adj_Q16, inv_gain_Q32;
    NSQ_del_dec_struct *psDD;

    inv_gain_Q16 = SKP_INVERSE32_varQ( SKP_max( Gains_Q16[ subfr ], 1 ), 32 );
    inv_gain_Q16 = SKP_min( inv_gain_Q16, SKP_int16_MAX );
    lag          = pitchL[ subfr ];

    /* After rewhitening the LTP state is un-scaled, so scale with inv_gain_Q16 */
    if( NSQ->rewhite_flag ) {
        inv_gain_Q32 = SKP_LSHIFT( inv_gain_Q16, 16 );
        if( subfr == 0 ) {
            /* Do LTP downscaling */
            inv_gain_Q32 = SKP_LSHIFT( SKP_SMULWB( inv_gain_Q32, LTP_scale_Q14 ), 2 );
        }
        for( i = NSQ->sLTP_buf_idx - lag - LTP_ORDER / 2; i < NSQ->sLTP_buf_idx; i++ ) {
            SKP_assert( i < MAX_FRAME_LENGTH );
            sLTP_Q16[ i ] = SKP_SMULWB( inv_gain_Q32, sLTP[ i ] );
        }
    }

    /* Adjust for changing gain */
    if( inv_gain_Q16 != NSQ->prev_inv_gain_Q16 ) {
        gain_adj_Q16 = SKP_DIV32_varQ( inv_gain_Q16, NSQ->prev_inv_gain_Q16, 16 );

        /* Scale long-term shaping state */
        for( i = NSQ->sLTP_shp_buf_idx - subfr_length * NB_SUBFR; i < NSQ->sLTP_shp_buf_idx; i++ ) {
            NSQ->sLTP_shp_Q10[ i ] = SKP_SMULWW( gain_adj_Q16, NSQ->sLTP_shp_Q10[ i ] );
        }

        /* Scale long-term prediction state */
        if( NSQ->rewhite_flag == 0 ) {
            for( i = NSQ->sLTP_buf_idx - lag - LTP_ORDER / 2; i < NSQ->sLTP_buf_idx; i++ ) {
                sLTP_Q16[ i ] = SKP_SMULWW( gain_adj_Q16, sLTP_Q16[ i ] );
            }
        }

        for( k = 0; k < nStatesDelayedDecision; k++ ) {
            psDD = &psDelDec[ k ];
            
            /* Scale scalar states */
            psDD->LF_AR_Q12 = SKP_SMULWW( gain_adj_Q16, psDD->LF_AR_Q12 );
            
	        /* Scale short-term prediction and shaping states */
            for( i = 0; i < NSQ_LPC_BUF_LENGTH; i++ ) {
                psDD->sLPC_Q14[ i ] = SKP_SMULWW( gain_adj_Q16, psDD->sLPC_Q14[ i ] );
            }
            for( i = 0; i < MAX_SHAPE_LPC_ORDER; i++ ) {
                psDD->sAR2_Q14[ i ] = SKP_SMULWW( gain_adj_Q16, psDD->sAR2_Q14[ i ] );
            }
            for( i = 0; i < DECISION_DELAY; i++ ) {
                psDD->Pred_Q16[  i ] = SKP_SMULWW( gain_adj_Q16, psDD->Pred_Q16[  i ] );
                psDD->Shape_Q10[ i ] = SKP_SMULWW( gain_adj_Q16, psDD->Shape_Q10[ i ] );
            }
        }
    }

    /* Scale input */
    for( i = 0; i < subfr_length; i++ ) {
        x_sc_Q10[ i ] = SKP_RSHIFT( SKP_SMULBB( x[ i ], ( SKP_int16 )inv_gain_Q16 ), 6 );
    }

    /* save inv_gain */
    SKP_assert( inv_gain_Q16 != 0 );
    NSQ->prev_inv_gain_Q16 = inv_gain_Q16;
}

SKP_INLINE void SKP_Silk_copy_del_dec_state(
    NSQ_del_dec_struct  *DD_dst,                /* I    Dst del dec state                   */
    NSQ_del_dec_struct  *DD_src,                /* I    Src del dec state                   */
    SKP_int             LPC_state_idx           /* I    Index to LPC buffer                 */
)
{
    SKP_memcpy( DD_dst->RandState, DD_src->RandState, sizeof( DD_src->RandState ) );
    SKP_memcpy( DD_dst->Q_Q10,     DD_src->Q_Q10,     sizeof( DD_src->Q_Q10     ) );
    SKP_memcpy( DD_dst->Pred_Q16,  DD_src->Pred_Q16,  sizeof( DD_src->Pred_Q16  ) );
    SKP_memcpy( DD_dst->Shape_Q10, DD_src->Shape_Q10, sizeof( DD_src->Shape_Q10 ) );
    SKP_memcpy( DD_dst->Xq_Q10,    DD_src->Xq_Q10,    sizeof( DD_src->Xq_Q10    ) );
    SKP_memcpy( DD_dst->sAR2_Q14,  DD_src->sAR2_Q14,  sizeof( DD_src->sAR2_Q14  ) );
    SKP_memcpy( &DD_dst->sLPC_Q14[ LPC_state_idx ], &DD_src->sLPC_Q14[ LPC_state_idx ], NSQ_LPC_BUF_LENGTH * sizeof( SKP_int32 ) );
    DD_dst->LF_AR_Q12 = DD_src->LF_AR_Q12;
    DD_dst->Seed      = DD_src->Seed;
    DD_dst->SeedInit  = DD_src->SeedInit;
    DD_dst->RD_Q10    = DD_src->RD_Q10;
}


================================================
FILE: app/jni/SKP_Silk_PLC.c
================================================
/***********************************************************************
Copyright (c) 2006-2012, Skype Limited. All rights reserved. 
Redistribution and use in source and binary forms, with or without 
modification, (subject to the limitations in the disclaimer below) 
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.
- Neither the name of Skype Limited, nor the names of specific 
contributors, may be used to endorse or promote products derived from 
this software without specific prior written permission.
NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED 
BY THIS LICENSE. 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.
***********************************************************************/

#include "SKP_Silk_main.h"
#include "SKP_Silk_PLC.h"

#define NB_ATT 2
static const SKP_int16 HARM_ATT_Q15[NB_ATT]              = { 32440, 31130 }; /* 0.99, 0.95 */
static const SKP_int16 PLC_RAND_ATTENUATE_V_Q15[NB_ATT]  = { 31130, 26214 }; /* 0.95, 0.8 */
static const SKP_int16 PLC_RAND_ATTENUATE_UV_Q15[NB_ATT] = { 32440, 29491 }; /* 0.99, 0.9 */

void SKP_Silk_PLC_Reset(
    SKP_Silk_decoder_state      *psDec              /* I/O Decoder state        */
)
{
    psDec->sPLC.pitchL_Q8 = SKP_RSHIFT( psDec->frame_length, 1 );
}

void SKP_Silk_PLC(
    SKP_Silk_decoder_state      *psDec,             /* I Decoder state          */
    SKP_Silk_decoder_control    *psDecCtrl,         /* I Decoder control        */
    SKP_int16                   signal[],           /* O Concealed signal       */
    SKP_int                     length,             /* I length of residual     */
    SKP_int                     lost                /* I Loss flag              */
)
{
    /* PLC control function */
    if( psDec->fs_kHz != psDec->sPLC.fs_kHz ) {
        SKP_Silk_PLC_Reset( psDec );
        psDec->sPLC.fs_kHz = psDec->fs_kHz;
    }

    if( lost ) {
        /****************************/
        /* Generate Signal          */
        /****************************/
        SKP_Silk_PLC_conceal( psDec, psDecCtrl, signal, length );

        psDec->lossCnt++;
    } else {
        /****************************/
        /* Update state             */
        /****************************/
        SKP_Silk_PLC_update( psDec, psDecCtrl, signal, length );
    }
}

/**************************************************/
/* Update state of PLC                            */
/**************************************************/
void SKP_Silk_PLC_update(
    SKP_Silk_decoder_state      *psDec,             /* (I/O) Decoder state          */
    SKP_Silk_decoder_control    *psDecCtrl,         /* (I/O) Decoder control        */
    SKP_int16                   signal[],
    SKP_int  
Download .txt
gitextract_cflykvbw/

├── .gitignore
├── README.md
├── app/
│   ├── .gitignore
│   ├── CMakeLists.txt
│   ├── build.gradle
│   ├── jni/
│   │   ├── SKP_Silk_A2NLSF.c
│   │   ├── SKP_Silk_CNG.c
│   │   ├── SKP_Silk_HP_variable_cutoff_FIX.c
│   │   ├── SKP_Silk_LBRR_reset.c
│   │   ├── SKP_Silk_LPC_inv_pred_gain.c
│   │   ├── SKP_Silk_LPC_synthesis_filter.c
│   │   ├── SKP_Silk_LPC_synthesis_order16.c
│   │   ├── SKP_Silk_LP_variable_cutoff.c
│   │   ├── SKP_Silk_LSF_cos_table.c
│   │   ├── SKP_Silk_LTP_analysis_filter_FIX.c
│   │   ├── SKP_Silk_LTP_scale_ctrl_FIX.c
│   │   ├── SKP_Silk_MA.c
│   │   ├── SKP_Silk_NLSF2A.c
│   │   ├── SKP_Silk_NLSF2A_stable.c
│   │   ├── SKP_Silk_NLSF_MSVQ_decode.c
│   │   ├── SKP_Silk_NLSF_MSVQ_encode_FIX.c
│   │   ├── SKP_Silk_NLSF_VQ_rate_distortion_FIX.c
│   │   ├── SKP_Silk_NLSF_VQ_sum_error_FIX.c
│   │   ├── SKP_Silk_NLSF_VQ_weights_laroia.c
│   │   ├── SKP_Silk_NLSF_stabilize.c
│   │   ├── SKP_Silk_NSQ.c
│   │   ├── SKP_Silk_NSQ_del_dec.c
│   │   ├── SKP_Silk_PLC.c
│   │   ├── SKP_Silk_VAD.c
│   │   ├── SKP_Silk_VQ_nearest_neighbor_FIX.c
│   │   ├── SKP_Silk_ana_filt_bank_1.c
│   │   ├── SKP_Silk_apply_sine_window.c
│   │   ├── SKP_Silk_array_maxabs.c
│   │   ├── SKP_Silk_autocorr.c
│   │   ├── SKP_Silk_biquad.c
│   │   ├── SKP_Silk_biquad_alt.c
│   │   ├── SKP_Silk_burg_modified.c
│   │   ├── SKP_Silk_bwexpander.c
│   │   ├── SKP_Silk_bwexpander_32.c
│   │   ├── SKP_Silk_code_signs.c
│   │   ├── SKP_Silk_control_audio_bandwidth.c
│   │   ├── SKP_Silk_control_codec_FIX.c
│   │   ├── SKP_Silk_corrMatrix_FIX.c
│   │   ├── SKP_Silk_create_init_destroy.c
│   │   ├── SKP_Silk_dec_API.c
│   │   ├── SKP_Silk_decode_core.c
│   │   ├── SKP_Silk_decode_frame.c
│   │   ├── SKP_Silk_decode_parameters.c
│   │   ├── SKP_Silk_decode_pitch.c
│   │   ├── SKP_Silk_decode_pulses.c
│   │   ├── SKP_Silk_decoder_set_fs.c
│   │   ├── SKP_Silk_detect_SWB_input.c
│   │   ├── SKP_Silk_div_oabi.c
│   │   ├── SKP_Silk_enc_API.c
│   │   ├── SKP_Silk_encode_frame_FIX.c
│   │   ├── SKP_Silk_encode_parameters.c
│   │   ├── SKP_Silk_encode_pulses.c
│   │   ├── SKP_Silk_find_LPC_FIX.c
│   │   ├── SKP_Silk_find_LTP_FIX.c
│   │   ├── SKP_Silk_find_pitch_lags_FIX.c
│   │   ├── SKP_Silk_find_pred_coefs_FIX.c
│   │   ├── SKP_Silk_gain_quant.c
│   │   ├── SKP_Silk_init_encoder_FIX.c
│   │   ├── SKP_Silk_inner_prod_aligned.c
│   │   ├── SKP_Silk_interpolate.c
│   │   ├── SKP_Silk_k2a.c
│   │   ├── SKP_Silk_k2a_Q16.c
│   │   ├── SKP_Silk_lin2log.c
│   │   ├── SKP_Silk_log2lin.c
│   │   ├── SKP_Silk_noise_shape_analysis_FIX.c
│   │   ├── SKP_Silk_pitch_analysis_core.c
│   │   ├── SKP_Silk_pitch_est_tables.c
│   │   ├── SKP_Silk_prefilter_FIX.c
│   │   ├── SKP_Silk_process_NLSFs_FIX.c
│   │   ├── SKP_Silk_process_gains_FIX.c
│   │   ├── SKP_Silk_quant_LTP_gains_FIX.c
│   │   ├── SKP_Silk_range_coder.c
│   │   ├── SKP_Silk_regularize_correlations_FIX.c
│   │   ├── SKP_Silk_resampler.c
│   │   ├── SKP_Silk_resampler_down2.c
│   │   ├── SKP_Silk_resampler_down2_3.c
│   │   ├── SKP_Silk_resampler_down3.c
│   │   ├── SKP_Silk_resampler_private_AR2.c
│   │   ├── SKP_Silk_resampler_private_ARMA4.c
│   │   ├── SKP_Silk_resampler_private_IIR_FIR.c
│   │   ├── SKP_Silk_resampler_private_copy.c
│   │   ├── SKP_Silk_resampler_private_down4.c
│   │   ├── SKP_Silk_resampler_private_down_FIR.c
│   │   ├── SKP_Silk_resampler_private_up2_HQ.c
│   │   ├── SKP_Silk_resampler_private_up4.c
│   │   ├── SKP_Silk_resampler_rom.c
│   │   ├── SKP_Silk_resampler_up2.c
│   │   ├── SKP_Silk_residual_energy16_FIX.c
│   │   ├── SKP_Silk_residual_energy_FIX.c
│   │   ├── SKP_Silk_scale_copy_vector16.c
│   │   ├── SKP_Silk_scale_vector.c
│   │   ├── SKP_Silk_schur.c
│   │   ├── SKP_Silk_schur64.c
│   │   ├── SKP_Silk_shell_coder.c
│   │   ├── SKP_Silk_sigm_Q15.c
│   │   ├── SKP_Silk_solve_LS_FIX.c
│   │   ├── SKP_Silk_sort.c
│   │   ├── SKP_Silk_sum_sqr_shift.c
│   │   ├── SKP_Silk_tables_LTP.c
│   │   ├── SKP_Silk_tables_NLSF_CB0_10.c
│   │   ├── SKP_Silk_tables_NLSF_CB0_16.c
│   │   ├── SKP_Silk_tables_NLSF_CB1_10.c
│   │   ├── SKP_Silk_tables_NLSF_CB1_16.c
│   │   ├── SKP_Silk_tables_gain.c
│   │   ├── SKP_Silk_tables_other.c
│   │   ├── SKP_Silk_tables_pitch_lag.c
│   │   ├── SKP_Silk_tables_pulses_per_block.c
│   │   ├── SKP_Silk_tables_sign.c
│   │   ├── SKP_Silk_tables_type_offset.c
│   │   ├── SKP_Silk_warped_autocorrelation_FIX.c
│   │   ├── decoder.c
│   │   ├── decoder.cpp
│   │   ├── include/
│   │   │   ├── SKP_Silk_AsmHelper.h
│   │   │   ├── SKP_Silk_AsmPreproc.h
│   │   │   ├── SKP_Silk_Inlines.h
│   │   │   ├── SKP_Silk_PLC.h
│   │   │   ├── SKP_Silk_SDK_API.h
│   │   │   ├── SKP_Silk_SigProc_FIX.h
│   │   │   ├── SKP_Silk_common_pitch_est_defines.h
│   │   │   ├── SKP_Silk_control.h
│   │   │   ├── SKP_Silk_define.h
│   │   │   ├── SKP_Silk_errors.h
│   │   │   ├── SKP_Silk_macros.h
│   │   │   ├── SKP_Silk_macros_arm.h
│   │   │   ├── SKP_Silk_main.h
│   │   │   ├── SKP_Silk_main_FIX.h
│   │   │   ├── SKP_Silk_pitch_est_defines.h
│   │   │   ├── SKP_Silk_resampler_private.h
│   │   │   ├── SKP_Silk_resampler_rom.h
│   │   │   ├── SKP_Silk_resampler_structs.h
│   │   │   ├── SKP_Silk_setup_complexity.h
│   │   │   ├── SKP_Silk_structs.h
│   │   │   ├── SKP_Silk_structs_FIX.h
│   │   │   ├── SKP_Silk_tables.h
│   │   │   ├── SKP_Silk_tables_NLSF_CB0_10.h
│   │   │   ├── SKP_Silk_tables_NLSF_CB0_16.h
│   │   │   ├── SKP_Silk_tables_NLSF_CB1_10.h
│   │   │   ├── SKP_Silk_tables_NLSF_CB1_16.h
│   │   │   ├── SKP_Silk_tuning_parameters.h
│   │   │   ├── SKP_Silk_typedef.h
│   │   │   ├── lame.h
│   │   │   └── silk.h
│   │   ├── libmp3lame/
│   │   │   ├── VbrTag.c
│   │   │   ├── VbrTag.h
│   │   │   ├── bitstream.c
│   │   │   ├── bitstream.h
│   │   │   ├── encoder.c
│   │   │   ├── encoder.h
│   │   │   ├── fft.c
│   │   │   ├── fft.h
│   │   │   ├── gain_analysis.c
│   │   │   ├── gain_analysis.h
│   │   │   ├── id3tag.c
│   │   │   ├── id3tag.h
│   │   │   ├── l3side.h
│   │   │   ├── lame-analysis.h
│   │   │   ├── lame.c
│   │   │   ├── lame_global_flags.h
│   │   │   ├── lameerror.h
│   │   │   ├── machine.h
│   │   │   ├── mpglib_interface.c
│   │   │   ├── newmdct.c
│   │   │   ├── newmdct.h
│   │   │   ├── presets.c
│   │   │   ├── psymodel.c
│   │   │   ├── psymodel.h
│   │   │   ├── quantize.c
│   │   │   ├── quantize.h
│   │   │   ├── quantize_pvt.c
│   │   │   ├── quantize_pvt.h
│   │   │   ├── reservoir.c
│   │   │   ├── reservoir.h
│   │   │   ├── set_get.c
│   │   │   ├── set_get.h
│   │   │   ├── tables.c
│   │   │   ├── tables.h
│   │   │   ├── takehiro.c
│   │   │   ├── util.c
│   │   │   ├── util.h
│   │   │   ├── vbrquantize.c
│   │   │   ├── vbrquantize.h
│   │   │   ├── vector/
│   │   │   │   ├── Makefile.am
│   │   │   │   ├── Makefile.in
│   │   │   │   ├── lame_intrin.h
│   │   │   │   └── xmm_quantize_sub.c
│   │   │   ├── version.c
│   │   │   └── version.h
│   │   └── silk.c
│   ├── proguard-rules.pro
│   └── src/
│       └── main/
│           ├── AndroidManifest.xml
│           ├── java/
│           │   └── com/
│           │       └── ketian/
│           │           └── android/
│           │               └── silkv3/
│           │                   ├── App.kt
│           │                   ├── ExportFragment.kt
│           │                   ├── MainActivity.kt
│           │                   ├── PathUtils.kt
│           │                   ├── VoiceFragment.kt
│           │                   └── jni/
│           │                       └── JNI.kt
│           └── res/
│               ├── layout/
│               │   ├── activity_main.xml
│               │   ├── export_item_layout.xml
│               │   ├── fragment_export.xml
│               │   ├── fragment_voice.xml
│               │   └── item_layout.xml
│               ├── values/
│               │   ├── colors.xml
│               │   ├── dimens.xml
│               │   ├── strings.xml
│               │   └── styles.xml
│               └── values-w820dp/
│                   └── dimens.xml
├── build.gradle
├── gradle/
│   └── wrapper/
│       ├── gradle-wrapper.jar
│       └── gradle-wrapper.properties
├── gradle.properties
├── gradlew
├── gradlew.bat
└── settings.gradle
Download .txt
SYMBOL INDEX (860 symbols across 142 files)

FILE: app/jni/SKP_Silk_A2NLSF.c
  function SKP_INLINE (line 46) | SKP_INLINE void SKP_Silk_A2NLSF_trans_poly(
  function SKP_INLINE (line 63) | SKP_INLINE SKP_int32 SKP_Silk_A2NLSF_eval_poly(    /* return the polynom...
  function SKP_INLINE (line 87) | SKP_INLINE void SKP_Silk_A2NLSF_init(
  function SKP_Silk_A2NLSF (line 127) | void SKP_Silk_A2NLSF(

FILE: app/jni/SKP_Silk_CNG.c
  function SKP_INLINE (line 31) | SKP_INLINE void SKP_Silk_CNG_exc(
  function SKP_Silk_CNG_Reset (line 58) | void SKP_Silk_CNG_Reset(
  function SKP_Silk_CNG (line 75) | void SKP_Silk_CNG(

FILE: app/jni/SKP_Silk_HP_variable_cutoff_FIX.c
  function SKP_Silk_HP_variable_cutoff_FIX (line 37) | void SKP_Silk_HP_variable_cutoff_FIX(

FILE: app/jni/SKP_Silk_LBRR_reset.c
  function SKP_Silk_LBRR_reset (line 31) | void SKP_Silk_LBRR_reset(

FILE: app/jni/SKP_Silk_LPC_inv_pred_gain.c
  function SKP_int (line 43) | static SKP_int LPC_inverse_pred_gain_QA(        /* O:   Returns 1 if uns...
  function SKP_int (line 113) | SKP_int SKP_Silk_LPC_inverse_pred_gain(       /* O:   Returns 1 if unsta...
  function SKP_int (line 134) | SKP_int SKP_Silk_LPC_inverse_pred_gain_Q24(   /* O:   Returns 1 if unsta...

FILE: app/jni/SKP_Silk_LPC_synthesis_filter.c
  function SKP_Silk_LPC_synthesis_filter (line 37) | void SKP_Silk_LPC_synthesis_filter(

FILE: app/jni/SKP_Silk_LPC_synthesis_order16.c
  function SKP_Silk_LPC_synthesis_order16 (line 37) | void SKP_Silk_LPC_synthesis_order16(const SKP_int16 *in,          /* I: ...

FILE: app/jni/SKP_Silk_LP_variable_cutoff.c
  function SKP_INLINE (line 40) | SKP_INLINE void SKP_Silk_LP_interpolate_filter_taps(
  function SKP_Silk_LP_variable_cutoff (line 115) | void SKP_Silk_LP_variable_cutoff(

FILE: app/jni/SKP_Silk_LTP_analysis_filter_FIX.c
  function SKP_Silk_LTP_analysis_filter_FIX (line 30) | void SKP_Silk_LTP_analysis_filter_FIX(

FILE: app/jni/SKP_Silk_LTP_scale_ctrl_FIX.c
  function SKP_Silk_LTP_scale_ctrl_FIX (line 39) | void SKP_Silk_LTP_scale_ctrl_FIX(

FILE: app/jni/SKP_Silk_MA.c
  function SKP_Silk_MA_Prediction (line 40) | void SKP_Silk_MA_Prediction(
  function SKP_Silk_LPC_analysis_filter (line 70) | void SKP_Silk_LPC_analysis_filter(

FILE: app/jni/SKP_Silk_NLSF2A.c
  function SKP_INLINE (line 37) | SKP_INLINE void SKP_Silk_NLSF2A_find_poly(
  function SKP_Silk_NLSF2A (line 59) | void SKP_Silk_NLSF2A(

FILE: app/jni/SKP_Silk_NLSF2A_stable.c
  function SKP_Silk_NLSF2A_stable (line 31) | void SKP_Silk_NLSF2A_stable(

FILE: app/jni/SKP_Silk_NLSF_MSVQ_decode.c
  function SKP_Silk_NLSF_MSVQ_decode (line 31) | void SKP_Silk_NLSF_MSVQ_decode(

FILE: app/jni/SKP_Silk_NLSF_MSVQ_encode_FIX.c
  function SKP_Silk_NLSF_MSVQ_encode_FIX (line 33) | void SKP_Silk_NLSF_MSVQ_encode_FIX(

FILE: app/jni/SKP_Silk_NLSF_VQ_rate_distortion_FIX.c
  function SKP_Silk_NLSF_VQ_rate_distortion_FIX (line 31) | void SKP_Silk_NLSF_VQ_rate_distortion_FIX(

FILE: app/jni/SKP_Silk_NLSF_VQ_sum_error_FIX.c
  function SKP_Silk_NLSF_VQ_sum_error_FIX (line 33) | void SKP_Silk_NLSF_VQ_sum_error_FIX(

FILE: app/jni/SKP_Silk_NLSF_VQ_weights_laroia.c
  function SKP_Silk_NLSF_VQ_weights_laroia (line 40) | void SKP_Silk_NLSF_VQ_weights_laroia(

FILE: app/jni/SKP_Silk_NLSF_stabilize.c
  function SKP_Silk_NLSF_stabilize (line 42) | void SKP_Silk_NLSF_stabilize(

FILE: app/jni/SKP_Silk_NSQ.c
  function SKP_Silk_NSQ (line 65) | void SKP_Silk_NSQ(
  function SKP_INLINE (line 172) | SKP_INLINE void SKP_Silk_noise_shape_quantizer(
  function SKP_INLINE (line 386) | SKP_INLINE void SKP_Silk_nsq_scale_states(

FILE: app/jni/SKP_Silk_NSQ_del_dec.c
  type NSQ_del_dec_struct (line 30) | typedef struct {
  type NSQ_sample_struct (line 45) | typedef struct {
  function SKP_Silk_NSQ_del_dec (line 107) | void SKP_Silk_NSQ_del_dec(
  function SKP_INLINE (line 305) | SKP_INLINE void SKP_Silk_noise_shape_quantizer_del_dec(
  function SKP_INLINE (line 633) | SKP_INLINE void SKP_Silk_nsq_del_dec_scale_states(
  function SKP_INLINE (line 716) | SKP_INLINE void SKP_Silk_copy_del_dec_state(

FILE: app/jni/SKP_Silk_PLC.c
  function SKP_Silk_PLC_Reset (line 36) | void SKP_Silk_PLC_Reset(
  function SKP_Silk_PLC (line 43) | void SKP_Silk_PLC(
  function SKP_Silk_PLC_update (line 75) | void SKP_Silk_PLC_update(
  function SKP_Silk_PLC_conceal (line 146) | void SKP_Silk_PLC_conceal(
  function SKP_Silk_PLC_glue_frames (line 363) | void SKP_Silk_PLC_glue_frames(

FILE: app/jni/SKP_Silk_VAD.c
  function SKP_int (line 39) | SKP_int SKP_Silk_VAD_Init(                              /* O    Return v...
  function SKP_int (line 75) | SKP_int SKP_Silk_VAD_GetSA_Q8(                                      /* O...
  function SKP_Silk_VAD_GetNoiseLevels (line 262) | void SKP_Silk_VAD_GetNoiseLevels(

FILE: app/jni/SKP_Silk_VQ_nearest_neighbor_FIX.c
  function SKP_Silk_VQ_WMat_EC_FIX (line 31) | void SKP_Silk_VQ_WMat_EC_FIX(

FILE: app/jni/SKP_Silk_ana_filt_bank_1.c
  function SKP_Silk_ana_filt_bank_1 (line 45) | void SKP_Silk_ana_filt_bank_1(

FILE: app/jni/SKP_Silk_apply_sine_window.c
  function SKP_Silk_apply_sine_window (line 47) | void SKP_Silk_apply_sine_window(

FILE: app/jni/SKP_Silk_array_maxabs.c
  function SKP_int16 (line 41) | SKP_int16 SKP_Silk_int16_array_maxabs(    /* O    Maximum absolute value...

FILE: app/jni/SKP_Silk_autocorr.c
  function SKP_Silk_autocorr (line 40) | void SKP_Silk_autocorr(

FILE: app/jni/SKP_Silk_biquad.c
  function SKP_Silk_biquad (line 41) | void SKP_Silk_biquad(

FILE: app/jni/SKP_Silk_biquad_alt.c
  function SKP_Silk_biquad_alt (line 38) | void SKP_Silk_biquad_alt(

FILE: app/jni/SKP_Silk_burg_modified.c
  function SKP_Silk_burg_modified (line 49) | void SKP_Silk_burg_modified(

FILE: app/jni/SKP_Silk_bwexpander.c
  function SKP_Silk_bwexpander (line 31) | void SKP_Silk_bwexpander(

FILE: app/jni/SKP_Silk_bwexpander_32.c
  function SKP_Silk_bwexpander_32 (line 31) | void SKP_Silk_bwexpander_32(

FILE: app/jni/SKP_Silk_code_signs.c
  function SKP_Silk_encode_signs (line 37) | void SKP_Silk_encode_signs(
  function SKP_Silk_decode_signs (line 64) | void SKP_Silk_decode_signs(

FILE: app/jni/SKP_Silk_control_codec_FIX.c
  function SKP_int (line 56) | SKP_int SKP_Silk_control_encoder_FIX(
  function SKP_Silk_LBRR_ctrl_FIX (line 133) | void SKP_Silk_LBRR_ctrl_FIX(
  function SKP_INLINE (line 155) | SKP_INLINE SKP_int SKP_Silk_setup_resamplers_FIX(
  function SKP_INLINE (line 207) | SKP_INLINE SKP_int SKP_Silk_setup_packetsize_FIX(
  function SKP_INLINE (line 232) | SKP_INLINE SKP_int SKP_Silk_setup_fs_FIX(
  function SKP_INLINE (line 317) | SKP_INLINE SKP_int SKP_Silk_setup_rate_FIX(
  function SKP_INLINE (line 353) | SKP_INLINE SKP_int SKP_Silk_setup_LBRR_FIX(

FILE: app/jni/SKP_Silk_corrMatrix_FIX.c
  function SKP_Silk_corrVector_FIX (line 35) | void SKP_Silk_corrVector_FIX(
  function SKP_Silk_corrMatrix_FIX (line 71) | void SKP_Silk_corrMatrix_FIX(

FILE: app/jni/SKP_Silk_create_init_destroy.c
  function SKP_int (line 34) | SKP_int SKP_Silk_init_decoder(

FILE: app/jni/SKP_Silk_dec_API.c
  function SKP_int (line 35) | SKP_int SKP_Silk_SDK_Get_Decoder_Size( SKP_int32 *decSizeBytes )
  function SKP_int (line 45) | SKP_int SKP_Silk_SDK_InitDecoder(
  function SKP_int (line 60) | SKP_int SKP_Silk_SDK_Decode(
  function SKP_Silk_SDK_search_for_LBRR (line 173) | void SKP_Silk_SDK_search_for_LBRR(
  function SKP_Silk_SDK_get_TOC (line 222) | void SKP_Silk_SDK_get_TOC(

FILE: app/jni/SKP_Silk_decode_core.c
  function SKP_Silk_decode_core (line 44) | void SKP_Silk_decode_core(
  function SKP_Silk_decode_short_term_prediction (line 205) | void SKP_Silk_decode_short_term_prediction(

FILE: app/jni/SKP_Silk_decode_frame.c
  function SKP_int (line 35) | SKP_int SKP_Silk_decode_frame(

FILE: app/jni/SKP_Silk_decode_parameters.c
  function SKP_Silk_decode_parameters (line 31) | void SKP_Silk_decode_parameters(

FILE: app/jni/SKP_Silk_decode_pitch.c
  function SKP_Silk_decode_pitch (line 34) | void SKP_Silk_decode_pitch(

FILE: app/jni/SKP_Silk_decode_pulses.c
  function SKP_Silk_decode_pulses (line 33) | void SKP_Silk_decode_pulses(

FILE: app/jni/SKP_Silk_decoder_set_fs.c
  function SKP_Silk_decoder_set_fs (line 31) | void SKP_Silk_decoder_set_fs(

FILE: app/jni/SKP_Silk_detect_SWB_input.c
  function SKP_Silk_detect_SWB_input (line 34) | void SKP_Silk_detect_SWB_input(

FILE: app/jni/SKP_Silk_div_oabi.c
  function SKP_int32 (line 30) | SKP_int32 SKP_DIV32_arm( SKP_int32 a32, SKP_int32 b32 ) {

FILE: app/jni/SKP_Silk_enc_API.c
  function SKP_int (line 41) | SKP_int SKP_Silk_SDK_Get_Encoder_Size( SKP_int32 *encSizeBytes )
  function SKP_int (line 54) | SKP_int SKP_Silk_SDK_QueryEncoder(
  function SKP_int (line 78) | SKP_int SKP_Silk_SDK_InitEncoder(
  function SKP_int (line 106) | SKP_int SKP_Silk_SDK_Encode(

FILE: app/jni/SKP_Silk_encode_frame_FIX.c
  function SKP_int (line 34) | SKP_int SKP_Silk_encode_frame_FIX(
  function SKP_Silk_LBRR_encode_FIX (line 279) | void SKP_Silk_LBRR_encode_FIX(

FILE: app/jni/SKP_Silk_encode_parameters.c
  function SKP_Silk_encode_parameters (line 33) | void SKP_Silk_encode_parameters(

FILE: app/jni/SKP_Silk_encode_pulses.c
  function SKP_INLINE (line 34) | SKP_INLINE SKP_int combine_and_check(       /* return ok */
  function SKP_Silk_encode_pulses (line 55) | void SKP_Silk_encode_pulses(

FILE: app/jni/SKP_Silk_find_LPC_FIX.c
  function SKP_Silk_find_LPC_FIX (line 32) | void SKP_Silk_find_LPC_FIX(

FILE: app/jni/SKP_Silk_find_LTP_FIX.c
  function SKP_Silk_find_LTP_FIX (line 39) | void SKP_Silk_find_LTP_FIX(
  function SKP_Silk_fit_LTP (line 233) | void SKP_Silk_fit_LTP(

FILE: app/jni/SKP_Silk_find_pitch_lags_FIX.c
  function SKP_Silk_find_pitch_lags_FIX (line 32) | void SKP_Silk_find_pitch_lags_FIX(

FILE: app/jni/SKP_Silk_find_pred_coefs_FIX.c
  function SKP_Silk_find_pred_coefs_FIX (line 31) | void SKP_Silk_find_pred_coefs_FIX(

FILE: app/jni/SKP_Silk_gain_quant.c
  function SKP_Silk_gains_quant (line 35) | void SKP_Silk_gains_quant(
  function SKP_Silk_gains_dequant (line 74) | void SKP_Silk_gains_dequant(

FILE: app/jni/SKP_Silk_init_encoder_FIX.c
  function SKP_int (line 33) | SKP_int SKP_Silk_init_encoder_FIX(

FILE: app/jni/SKP_Silk_inner_prod_aligned.c
  function SKP_int32 (line 44) | SKP_int32 SKP_Silk_inner_prod_aligned(
  function SKP_int64 (line 60) | SKP_int64 SKP_Silk_inner_prod16_aligned_64(

FILE: app/jni/SKP_Silk_interpolate.c
  function SKP_Silk_interpolate (line 31) | void SKP_Silk_interpolate(

FILE: app/jni/SKP_Silk_k2a.c
  function SKP_Silk_k2a (line 40) | void SKP_Silk_k2a(

FILE: app/jni/SKP_Silk_k2a_Q16.c
  function SKP_Silk_k2a_Q16 (line 40) | void SKP_Silk_k2a_Q16(

FILE: app/jni/SKP_Silk_lin2log.c
  function SKP_int32 (line 41) | SKP_int32 SKP_Silk_lin2log( const SKP_int32 inLin )    /* I:    Input in...

FILE: app/jni/SKP_Silk_log2lin.c
  function SKP_int32 (line 40) | SKP_int32 SKP_Silk_log2lin( const SKP_int32 inLog_Q7 )    /* I:    Input...

FILE: app/jni/SKP_Silk_noise_shape_analysis_FIX.c
  function SKP_INLINE (line 33) | SKP_INLINE SKP_int32 warped_gain( // gain in Q16
  function SKP_INLINE (line 52) | SKP_INLINE void limit_warped_coefs(
  function SKP_Silk_noise_shape_analysis_FIX (line 137) | void SKP_Silk_noise_shape_analysis_FIX(

FILE: app/jni/SKP_Silk_pitch_analysis_core.c
  function SKP_int (line 65) | SKP_int SKP_Silk_pitch_analysis_core(  /* O    Voicing estimate: 0 voice...
  function SKP_FIX_P_Ana_calc_corr_st3 (line 569) | void SKP_FIX_P_Ana_calc_corr_st3(
  function SKP_FIX_P_Ana_calc_energy_st3 (line 621) | void SKP_FIX_P_Ana_calc_energy_st3(
  function SKP_int32 (line 681) | SKP_int32 SKP_FIX_P_Ana_find_scaling(

FILE: app/jni/SKP_Silk_prefilter_FIX.c
  function SKP_Silk_warped_LPC_analysis_filter_FIX (line 43) | void SKP_Silk_warped_LPC_analysis_filter_FIX(
  function SKP_Silk_prefilter_FIX (line 85) | void SKP_Silk_prefilter_FIX(
  function SKP_INLINE (line 174) | SKP_INLINE void SKP_Silk_prefilt_FIX(

FILE: app/jni/SKP_Silk_process_NLSFs_FIX.c
  function SKP_Silk_process_NLSFs_FIX (line 31) | void SKP_Silk_process_NLSFs_FIX(

FILE: app/jni/SKP_Silk_process_gains_FIX.c
  function SKP_Silk_process_gains_FIX (line 32) | void SKP_Silk_process_gains_FIX(

FILE: app/jni/SKP_Silk_quant_LTP_gains_FIX.c
  function SKP_Silk_quant_LTP_gains_FIX (line 30) | void SKP_Silk_quant_LTP_gains_FIX(

FILE: app/jni/SKP_Silk_range_coder.c
  function SKP_Silk_range_encoder (line 31) | void SKP_Silk_range_encoder(
  function SKP_Silk_range_encoder_multi (line 101) | void SKP_Silk_range_encoder_multi(
  function SKP_Silk_range_decoder (line 115) | void SKP_Silk_range_decoder(
  function SKP_Silk_range_decoder_multi (line 234) | void SKP_Silk_range_decoder_multi(
  function SKP_Silk_range_enc_init (line 249) | void SKP_Silk_range_enc_init(
  function SKP_Silk_range_dec_init (line 262) | void SKP_Silk_range_dec_init(
  function SKP_int (line 288) | SKP_int SKP_Silk_range_coder_get_length(                /* O    returns ...
  function SKP_Silk_range_enc_wrap_up (line 305) | void SKP_Silk_range_enc_wrap_up(
  function SKP_Silk_range_coder_check_after_decoding (line 350) | void SKP_Silk_range_coder_check_after_decoding(

FILE: app/jni/SKP_Silk_regularize_correlations_FIX.c
  function SKP_Silk_regularize_correlations_FIX (line 31) | void SKP_Silk_regularize_correlations_FIX(

FILE: app/jni/SKP_Silk_resampler.c
  function SKP_int32 (line 66) | static SKP_int32 gcd(
  function SKP_int (line 255) | SKP_int SKP_Silk_resampler_clear(
  function SKP_int (line 271) | SKP_int SKP_Silk_resampler(

FILE: app/jni/SKP_Silk_resampler_down2.c
  function SKP_Silk_resampler_down2 (line 41) | void SKP_Silk_resampler_down2(

FILE: app/jni/SKP_Silk_resampler_down2_3.c
  function SKP_Silk_resampler_down2_3 (line 42) | void SKP_Silk_resampler_down2_3(

FILE: app/jni/SKP_Silk_resampler_down3.c
  function SKP_Silk_resampler_down3 (line 42) | void SKP_Silk_resampler_down3(

FILE: app/jni/SKP_Silk_resampler_private_AR2.c
  function SKP_Silk_resampler_private_AR2 (line 41) | void SKP_Silk_resampler_private_AR2(

FILE: app/jni/SKP_Silk_resampler_private_ARMA4.c
  function SKP_Silk_resampler_private_ARMA4 (line 46) | void SKP_Silk_resampler_private_ARMA4(

FILE: app/jni/SKP_Silk_resampler_private_IIR_FIR.c
  function SKP_INLINE (line 40) | SKP_INLINE SKP_int16 *SKP_Silk_resampler_private_IIR_FIR_INTERPOL(
  function SKP_Silk_resampler_private_IIR_FIR (line 65) | void SKP_Silk_resampler_private_IIR_FIR(

FILE: app/jni/SKP_Silk_resampler_private_copy.c
  function SKP_Silk_resampler_private_copy (line 41) | void SKP_Silk_resampler_private_copy(

FILE: app/jni/SKP_Silk_resampler_private_down4.c
  function SKP_Silk_resampler_private_down4 (line 40) | void SKP_Silk_resampler_private_down4(

FILE: app/jni/SKP_Silk_resampler_private_down_FIR.c
  function SKP_INLINE (line 40) | SKP_INLINE SKP_int16 *SKP_Silk_resampler_private_down_FIR_INTERPOL0(
  function SKP_INLINE (line 63) | SKP_INLINE SKP_int16 *SKP_Silk_resampler_private_down_FIR_INTERPOL1(
  function SKP_Silk_resampler_private_down_FIR (line 107) | void SKP_Silk_resampler_private_down_FIR(

FILE: app/jni/SKP_Silk_resampler_private_up2_HQ.c
  function SKP_Silk_resampler_private_up2_HQ (line 43) | void SKP_Silk_resampler_private_up2_HQ(
  function SKP_Silk_resampler_private_up2_HQ_wrapper (line 111) | void SKP_Silk_resampler_private_up2_HQ_wrapper(

FILE: app/jni/SKP_Silk_resampler_private_up4.c
  function SKP_Silk_resampler_private_up4 (line 40) | void SKP_Silk_resampler_private_up4(

FILE: app/jni/SKP_Silk_resampler_up2.c
  function SKP_Silk_resampler_up2 (line 41) | void SKP_Silk_resampler_up2(

FILE: app/jni/SKP_Silk_residual_energy16_FIX.c
  function SKP_int32 (line 31) | SKP_int32 SKP_Silk_residual_energy16_covar_FIX(

FILE: app/jni/SKP_Silk_residual_energy_FIX.c
  function SKP_Silk_residual_energy_FIX (line 32) | void SKP_Silk_residual_energy_FIX(

FILE: app/jni/SKP_Silk_scale_copy_vector16.c
  function SKP_Silk_scale_copy_vector16 (line 31) | void SKP_Silk_scale_copy_vector16(

FILE: app/jni/SKP_Silk_scale_vector.c
  function SKP_Silk_scale_vector32_Q26_lshift_18 (line 31) | void SKP_Silk_scale_vector32_Q26_lshift_18(

FILE: app/jni/SKP_Silk_schur.c
  function SKP_int32 (line 40) | SKP_int32 SKP_Silk_schur(                     /* O:    Returns residual ...

FILE: app/jni/SKP_Silk_schur64.c
  function SKP_int32 (line 42) | SKP_int32 SKP_Silk_schur64(                    /* O:    Returns residual...

FILE: app/jni/SKP_Silk_shell_coder.c
  function SKP_INLINE (line 32) | SKP_INLINE void combine_pulses(
  function SKP_INLINE (line 44) | SKP_INLINE void encode_split(
  function SKP_INLINE (line 59) | SKP_INLINE void decode_split(
  function SKP_Silk_shell_encoder (line 82) | void SKP_Silk_shell_encoder(
  function SKP_Silk_shell_decoder (line 123) | void SKP_Silk_shell_decoder(

FILE: app/jni/SKP_Silk_sigm_Q15.c
  function SKP_int (line 54) | SKP_int SKP_Silk_sigm_Q15( SKP_int in_Q5 )

FILE: app/jni/SKP_Silk_solve_LS_FIX.c
  type inv_D_t (line 35) | typedef struct {
  function SKP_Silk_solve_LDL_FIX (line 71) | void SKP_Silk_solve_LDL_FIX(
  function SKP_INLINE (line 108) | SKP_INLINE void SKP_Silk_LDL_factorize_FIX(
  function SKP_INLINE (line 180) | SKP_INLINE void SKP_Silk_LS_divide_Q16_FIX(
  function SKP_INLINE (line 200) | SKP_INLINE void SKP_Silk_LS_SolveFirst_FIX(
  function SKP_INLINE (line 222) | SKP_INLINE void SKP_Silk_LS_SolveLast_FIX(

FILE: app/jni/SKP_Silk_sort.c
  function SKP_Silk_insertion_sort_increasing (line 34) | void SKP_Silk_insertion_sort_increasing(
  function SKP_Silk_insertion_sort_decreasing_int16 (line 80) | void SKP_Silk_insertion_sort_decreasing_int16(
  function SKP_Silk_insertion_sort_increasing_all_values (line 126) | void SKP_Silk_insertion_sort_increasing_all_values(

FILE: app/jni/SKP_Silk_sum_sqr_shift.c
  function SKP_Silk_sum_sqr_shift (line 40) | void SKP_Silk_sum_sqr_shift(

FILE: app/jni/SKP_Silk_warped_autocorrelation_FIX.c
  function SKP_Silk_warped_autocorrelation_FIX (line 36) | void SKP_Silk_warped_autocorrelation_FIX(

FILE: app/jni/decoder.c
  function print_usage (line 5) | static void print_usage(char* argv[]) {
  function main (line 16) | int main( int argc, char* argv[] )

FILE: app/jni/decoder.cpp
  function JNIEXPORT (line 16) | JNIEXPORT jint JNICALL

FILE: app/jni/include/SKP_Silk_Inlines.h
  function SKP_INLINE (line 43) | SKP_INLINE SKP_int32 SKP_Silk_CLZ64(SKP_int64 in)
  function SKP_INLINE (line 58) | SKP_INLINE void SKP_Silk_CLZ_FRAC(SKP_int32 in,            /* I: input */
  function SKP_INLINE (line 71) | SKP_INLINE SKP_int32 SKP_Silk_SQRT_APPROX(SKP_int32 x)
  function SKP_INLINE (line 97) | SKP_INLINE SKP_int32 SKP_Silk_norm16(SKP_int16 a) {
  function SKP_INLINE (line 112) | SKP_INLINE SKP_int32 SKP_Silk_norm32(SKP_int32 a) {
  function SKP_INLINE (line 124) | SKP_INLINE SKP_int32 SKP_DIV32_varQ(    /* O    returns a good approxima...
  function SKP_INLINE (line 169) | SKP_INLINE SKP_int32 SKP_INVERSE32_varQ(    /* O    returns a good appro...
  function SKP_INLINE (line 219) | SKP_INLINE SKP_int32 SKP_Silk_SIN_APPROX_Q24(        /* O    returns app...
  function SKP_INLINE (line 267) | SKP_INLINE SKP_int32 SKP_Silk_COS_APPROX_Q24(        /* O    returns app...

FILE: app/jni/include/SKP_Silk_SDK_API.h
  type SKP_Silk_TOC_struct (line 43) | typedef struct {

FILE: app/jni/include/SKP_Silk_SigProc_FIX.h
  function SKP_INLINE (line 446) | SKP_INLINE SKP_int32 SKP_ROR32(SKP_int32 a32, SKP_int rot)
  function SKP_INLINE (line 454) | SKP_INLINE SKP_int32 SKP_ROR32( SKP_int32 a32, SKP_int rot )
  function SKP_INLINE (line 577) | SKP_INLINE SKP_int SKP_min_int(SKP_int a, SKP_int b)
  function SKP_INLINE (line 582) | SKP_INLINE SKP_int32 SKP_min_32(SKP_int32 a, SKP_int32 b)
  function SKP_INLINE (line 588) | SKP_INLINE SKP_int SKP_max_int(SKP_int a, SKP_int b)
  function SKP_INLINE (line 592) | SKP_INLINE SKP_int16 SKP_max_16(SKP_int16 a, SKP_int16 b)
  function SKP_INLINE (line 596) | SKP_INLINE SKP_int32 SKP_max_32(SKP_int32 a, SKP_int32 b)

FILE: app/jni/include/SKP_Silk_control.h
  type SKP_SILK_SDK_EncControlStruct (line 41) | typedef struct {
  type SKP_SILK_SDK_DecControlStruct (line 70) | typedef struct {

FILE: app/jni/include/SKP_Silk_macros.h
  function SKP_INLINE (line 78) | SKP_INLINE SKP_int32 SKP_Silk_CLZ16(SKP_int16 in16)
  function SKP_INLINE (line 114) | SKP_INLINE SKP_int32 SKP_Silk_CLZ32(SKP_int32 in32)

FILE: app/jni/include/SKP_Silk_macros_arm.h
  function SKP_INLINE (line 72) | SKP_INLINE SKP_int64 SKP_SMLAL(SKP_int64 a64, SKP_int32 b32, SKP_int32 c32)
  function SKP_INLINE (line 103) | SKP_INLINE SKP_int32 SKP_SMULWB(SKP_int32 a32, SKP_int32 b32) {
  function SKP_INLINE (line 110) | SKP_INLINE SKP_int32 SKP_SMLAWB(SKP_int32 a32, SKP_int32 b32, SKP_int32 ...
  function SKP_INLINE (line 116) | SKP_INLINE SKP_int32 SKP_SMULWT(SKP_int32 a32, SKP_int32 b32)
  function SKP_INLINE (line 123) | SKP_INLINE SKP_int32 SKP_SMLAWT(SKP_int32 a32, SKP_int32 b32, SKP_int32 ...
  function SKP_INLINE (line 130) | SKP_INLINE SKP_int32 SKP_SMULBB(SKP_int32 a32, SKP_int32 b32) {
  function SKP_INLINE (line 136) | SKP_INLINE SKP_int32 SKP_SMLABB(SKP_int32 a32, SKP_int32 b32, SKP_int32 ...
  function SKP_INLINE (line 142) | SKP_INLINE SKP_int32 SKP_SMLABB_ovflw(SKP_int32 a32, SKP_int32 b32, SKP_...
  function SKP_INLINE (line 148) | SKP_INLINE SKP_int32 SKP_SMULBT(SKP_int32 a32, SKP_int32 b32) {
  function SKP_INLINE (line 154) | SKP_INLINE SKP_int32 SKP_SMLABT(SKP_int32 a32, SKP_int32 b32, SKP_int32 ...
  function SKP_INLINE (line 160) | SKP_INLINE SKP_int64 SKP_SMLAL(SKP_int64 a64, SKP_int32 b32, SKP_int32 c32)
  function SKP_INLINE (line 189) | SKP_INLINE SKP_int32 SKP_ADD_SAT32(SKP_int32 a32, SKP_int32 b32) {
  function SKP_INLINE (line 195) | SKP_INLINE SKP_int32 SKP_SUB_SAT32(SKP_int32 a32, SKP_int32 b32) {
  function SKP_INLINE (line 201) | SKP_INLINE SKP_int32 SKP_Silk_CLZ16(SKP_int16 in16)
  function SKP_INLINE (line 208) | SKP_INLINE SKP_int32 SKP_Silk_CLZ32(SKP_int32 in32)
  function SKP_INLINE (line 223) | SKP_INLINE SKP_int32 SKP_SMMUL(SKP_int32 a32, SKP_int32 b32){
  function SKP_INLINE (line 229) | SKP_INLINE SKP_int32 SKP_SMUAD(SKP_int32 a32, SKP_int32 b32)
  function SKP_INLINE (line 236) | SKP_INLINE SKP_int32 SKP_SMLAD(SKP_int32 a32, SKP_int32 b32, SKP_int32 c32)

FILE: app/jni/include/SKP_Silk_resampler_structs.h
  type SKP_Silk_resampler_state_struct (line 52) | typedef struct _SKP_Silk_resampler_state_struct{

FILE: app/jni/include/SKP_Silk_setup_complexity.h
  function SKP_INLINE (line 31) | SKP_INLINE SKP_int SKP_Silk_setup_complexity(

FILE: app/jni/include/SKP_Silk_structs.h
  type SKP_Silk_nsq_state (line 44) | typedef struct {
  type SKP_SILK_LBRR_struct (line 59) | typedef struct {
  type SKP_Silk_VAD_state (line 68) | typedef struct {
  type SKP_Silk_range_coder_state (line 84) | typedef struct {
  type SKP_Silk_detect_SWB_state (line 94) | typedef struct {
  type SKP_Silk_LP_state (line 104) | typedef struct {
  type SKP_Silk_NLSF_CBS (line 112) | typedef struct {
  type SKP_Silk_NLSF_CB_struct (line 119) | typedef struct {
  type SKP_Silk_encoder_state (line 135) | typedef struct {
  type SKP_Silk_encoder_control (line 227) | typedef struct {
  type SKP_Silk_PLC_struct (line 249) | typedef struct {
  type SKP_Silk_CNG_struct (line 264) | typedef struct {
  type SKP_Silk_decoder_state (line 276) | typedef struct {
  type SKP_Silk_decoder_control (line 331) | typedef struct {

FILE: app/jni/include/SKP_Silk_structs_FIX.h
  type SKP_Silk_shape_state_FIX (line 44) | typedef struct {
  type SKP_Silk_prefilter_state_FIX (line 54) | typedef struct {
  type SKP_Silk_predict_state_FIX (line 68) | typedef struct {
  type SKP_Silk_encoder_state_FIX (line 79) | typedef struct {
  type SKP_Silk_encoder_control_FIX (line 111) | typedef struct {

FILE: app/jni/include/lame.h
  type vbr_mode (line 55) | typedef enum vbr_mode_e {
  type MPEG_mode (line 67) | typedef enum MPEG_mode_e {
  type Padding_type (line 77) | typedef enum Padding_type_e {
  type preset_mode (line 87) | typedef enum preset_mode_e {
  type asm_optimizations (line 129) | typedef enum asm_optimizations_e {
  type Psy_model (line 137) | typedef enum Psy_model_e {
  type buffer_constraint (line 144) | typedef enum buffer_constraint_e {
  type lame_global_struct (line 151) | struct lame_global_struct
  type lame_global_flags (line 152) | typedef struct lame_global_struct lame_global_flags;
  type lame_global_flags (line 153) | typedef lame_global_flags *lame_t;
  type lame_version_t (line 661) | typedef struct {
  type hip_global_struct (line 1014) | struct hip_global_struct
  type hip_global_flags (line 1015) | typedef struct hip_global_struct hip_global_flags;
  type hip_global_flags (line 1016) | typedef hip_global_flags *hip_t;
  type mp3data_struct (line 1019) | typedef struct {
  type lame_errorcodes_t (line 1310) | typedef enum {

FILE: app/jni/libmp3lame/VbrTag.c
  function addVbr (line 126) | static void
  function Xing_seek_table (line 153) | static void
  function print_seeking (line 177) | static void
  function AddVbrFrame (line 198) | void
  function ExtractI4 (line 208) | static int
  function CreateI4 (line 223) | static void
  function CreateI2 (line 235) | static void
  function IsVbrTag (line 244) | static int
  function setLameTagFrameHeader (line 259) | static void
  function CheckVbrTag (line 335) | int
  function GetVbrTag (line 364) | int
  function InitVbrTag (line 494) | int
  function CRC_update_lookup (line 585) | static uint16_t
  function UpdateMusicCRC (line 594) | void
  function PutLameVBR (line 617) | static int
  function skipId3v2 (line 867) | static long
  function lame_get_lametag_frame (line 902) | size_t
  function PutVbrTag (line 1032) | int

FILE: app/jni/libmp3lame/VbrTag.h
  type lame_internal_flags (line 52) | struct lame_internal_flags
  type lame_internal_flags (line 53) | typedef struct lame_internal_flags lame_internal_flags;
  type VBRTAGDATA (line 59) | typedef struct {

FILE: app/jni/libmp3lame/bitstream.c
  function calcFrameLength (line 62) | static int
  function getframebits (line 72) | int
  function get_max_frame_buffer_size_by_constraint (line 92) | int
  function putheader_bits (line 134) | static void
  function putbits2 (line 153) | inline static void
  function putbits_noheaders (line 189) | inline static void
  function drain_into_ancillary (line 227) | inline static void
  function writeheader (line 271) | inline static void
  function CRC_update (line 289) | static int
  function CRC_writeheader (line 305) | void
  function encodeSideInfo2 (line 322) | inline static void
  function huffman_coder_count1 (line 492) | inline static int
  function Huffmancode (line 562) | inline static int
  function ShortHuffmancodebits (line 640) | static int
  function LongHuffmancodebits (line 656) | static int
  function writeMainData (line 687) | inline static int
  function compute_flushbits (line 803) | int
  function flush_bitstream (line 864) | void
  function add_dummy_byte (line 894) | void
  function format_bitstream (line 919) | int
  function do_gain_analysis (line 989) | static int
  function do_copy_buffer (line 1057) | static int
  function copy_buffer (line 1083) | int
  function init_bit_stream_w (line 1101) | void

FILE: app/jni/libmp3lame/encoder.c
  function adjust_ATH (line 57) | static void
  function updateStats (line 156) | static void
  function lame_encode_frame_init (line 190) | static void
  type FLOAT (line 303) | typedef FLOAT chgrdata[2][2];
  function lame_encode_mp3_frame (line 306) | int

FILE: app/jni/libmp3lame/encoder.h
  type MPEGChannelMode (line 139) | enum MPEGChannelMode
  type lame_internal_flags (line 148) | struct lame_internal_flags
  type lame_internal_flags (line 149) | typedef struct lame_internal_flags lame_internal_flags;

FILE: app/jni/libmp3lame/fft.c
  function fht (line 63) | static void
  function fft_short (line 193) | void
  function fft_long (line 245) | void
  function init_fft (line 296) | void

FILE: app/jni/libmp3lame/gain_analysis.c
  function filterYule (line 180) | static void
  function filterButter (line 214) | static void
  function ResetSampleFrequency (line 236) | int
  function InitGainAnalysis (line 294) | int
  function fsqr (line 315) | static inline double
  function AnalyzeSamples (line 321) | int
  function Float_t (line 457) | static  Float_t
  function Float_t (line 484) | Float_t
  function Float_t (line 512) | Float_t

FILE: app/jni/libmp3lame/gain_analysis.h
  type sample_t (line 44) | typedef sample_t Float_t;
  type replaygain_data (line 69) | struct replaygain_data {
  type replaygain_t (line 94) | typedef struct replaygain_data replaygain_t;

FILE: app/jni/libmp3lame/id3tag.c
  type UsualStringIDs (line 128) | typedef enum UsualStringIDs { ID_TITLE = FRAME_ID('T', 'I', 'T', '2')
  type NumericStringIDs (line 137) | typedef enum NumericStringIDs { ID_DATE = FRAME_ID('T', 'D', 'A', 'T') /...
  type MiscIDs (line 144) | typedef enum MiscIDs { ID_TXXX = FRAME_ID('T', 'X', 'X', 'X')
  function frame_id_matches (line 162) | static int
  function isFrameIdMatching (line 176) | static int
  function test_tag_spec_flags (line 182) | static int
  function debug_tag_spec_flags (line 189) | static void
  function copyV1ToV2 (line 209) | static void
  function id3v2AddLameVersion (line 224) | static void
  function id3v2AddAudioDuration (line 242) | static void
  function id3tag_genre_list (line 266) | void
  function id3tag_init (line 284) | void
  function id3tag_add_v2 (line 297) | void
  function id3tag_v1_only (line 305) | void
  function id3tag_v2_only (line 313) | void
  function id3tag_space_v1 (line 321) | void
  function id3tag_pad_v2 (line 329) | void
  function id3tag_set_pad (line 335) | void
  function hasUcs2ByteOrderMarker (line 345) | static int
  function swap_bytes (line 355) | static unsigned short
  function toLittleEndian (line 362) | static unsigned short
  function fromLatin1Char (line 371) | static unsigned short
  function local_strdup (line 381) | static  size_t
  function local_ucs2_strdup (line 406) | static  size_t
  function local_ucs2_strlen (line 433) | static  size_t
  function local_ucs2_substr (line 446) | static size_t
  function local_ucs2_pos (line 469) | static int
  function local_char_pos (line 481) | static int
  function maybeLatin1 (line 493) | static int
  function lookupGenre (line 509) | static int
  function id3tag_set_genre_utf16 (line 545) | static int
  function id3tag_set_albumart (line 587) | int
  function toID3v2TagId (line 638) | static uint32_t
  function toID3v2TagId_ucs2 (line 659) | static uint32_t
  function isNumericString (line 685) | static int
  function isMultiFrame (line 700) | static int
  function isFullTextString (line 722) | static int
  function FrameDataNode (line 734) | static FrameDataNode *
  function appendNode (line 747) | static void
  function setLang (line 760) | static void
  function isSameLang (line 779) | static int
  function isSameDescriptor (line 799) | static int
  function isSameDescriptorUcs2 (line 814) | static int
  function id3v2_add_ucs2 (line 829) | static int
  function id3v2_add_latin1 (line 864) | static int
  function id3tag_set_userinfo_latin1 (line 900) | static int
  function id3tag_set_userinfo_ucs2 (line 916) | static int
  function id3tag_set_textinfo_utf16 (line 934) | int
  function id3tag_set_textinfo_ucs2 (line 977) | int
  function id3tag_set_textinfo_latin1 (line 983) | int
  function id3tag_set_comment_latin1 (line 1016) | int
  function id3tag_set_comment_utf16 (line 1023) | int
  function id3tag_set_comment_ucs2 (line 1033) | int
  function id3tag_set_title (line 1040) | void
  function id3tag_set_artist (line 1051) | void
  function id3tag_set_album (line 1062) | void
  function id3tag_set_year (line 1073) | void
  function id3tag_set_comment (line 1094) | void
  function id3tag_set_track (line 1109) | int
  function local_strcasecmp (line 1139) | static int
  function sloppyCompared (line 1172) | static int
  function sloppySearchGenre (line 1197) | static int
  function searchGenre (line 1210) | static int
  function id3tag_set_genre (line 1223) | int
  function sizeOfNode (line 1246) | static  size_t
  function sizeOfCommentNode (line 1272) | static  size_t
  function sizeOfWxxxNode (line 1302) | static size_t
  function id3tag_set_fieldvalue (line 1518) | int
  function id3tag_set_fieldvalue_utf16 (line 1530) | int
  function id3tag_set_fieldvalue_ucs2 (line 1560) | int
  function lame_get_id3v2_tag (line 1566) | size_t
  function id3tag_write_v2 (line 1715) | int
  function lame_get_id3v1_tag (line 1766) | size_t
  function id3tag_write_v1 (line 1816) | int

FILE: app/jni/libmp3lame/id3tag.h
  type FrameDataNode (line 20) | typedef struct FrameDataNode {
  type id3tag_spec (line 36) | typedef struct id3tag_spec {

FILE: app/jni/libmp3lame/l3side.h
  type scalefac_struct (line 29) | typedef struct {
  type III_psy_xmin (line 37) | typedef struct {
  type III_psy_ratio (line 42) | typedef struct {
  type gr_info (line 47) | typedef struct {
  type III_side_info_t (line 86) | typedef struct {

FILE: app/jni/libmp3lame/lame-analysis.h
  type plotting_data (line 34) | struct plotting_data {
  type plotting_data (line 91) | typedef struct plotting_data plotting_data;

FILE: app/jni/libmp3lame/lame.c
  function is_lame_global_flags_valid (line 68) | int
  function is_lame_internal_flags_valid (line 79) | int
  function FLOAT (line 91) | static  FLOAT
  function lame_init_params_ppflt (line 102) | static void
  function optimum_bandwidth (line 193) | static void
  function optimum_samplefreq (line 273) | static int
  function lame_init_qval (line 362) | static void
  function linear_int (line 481) | static double
  function lame_init_params (line 537) | int
  function concatSep (line 1307) | static void
  function lame_print_config (line 1323) | void
  function lame_print_internals (line 1414) | void
  function save_gain_values (line 1587) | static void
  function update_inbuffer_size (line 1618) | static int
  function calcNeeded (line 1650) | static int
  function lame_encode_buffer_sample_t (line 1694) | static int
  type PCMSampleType (line 1800) | enum PCMSampleType
  function lame_copy_inbuffer (line 1808) | static void
  function lame_encode_buffer_template (line 1861) | static int
  function lame_encode_buffer (line 1897) | int
  function lame_encode_buffer_float (line 1906) | int
  function lame_encode_buffer_ieee_float (line 1916) | int
  function lame_encode_buffer_interleaved_ieee_float (line 1926) | int
  function lame_encode_buffer_ieee_double (line 1936) | int
  function lame_encode_buffer_interleaved_ieee_double (line 1946) | int
  function lame_encode_buffer_int (line 1956) | int
  function lame_encode_buffer_long2 (line 1967) | int
  function lame_encode_buffer_long (line 1978) | int
  function lame_encode_buffer_interleaved (line 1989) | int
  function lame_encode_flush_nogap (line 2010) | int
  function lame_init_bitstream (line 2028) | int
  function lame_encode_flush (line 2064) | int
  function lame_close (line 2208) | int
  function lame_encode_finish (line 2241) | int
  function lame_mp3_tags_fid (line 2256) | void
  function lame_init_old (line 2302) | int
  function lame_global_flags (line 2419) | lame_global_flags *
  function lame_bitrate_kbps (line 2467) | void
  function lame_bitrate_hist (line 2489) | void
  function lame_stereo_mode_hist (line 2515) | void
  function lame_bitrate_stereo_mode_hist (line 2533) | void
  function lame_block_type_hist (line 2565) | void
  function lame_bitrate_block_type_hist (line 2583) | void

FILE: app/jni/libmp3lame/lame_global_flags.h
  type lame_internal_flags (line 6) | struct lame_internal_flags
  type lame_internal_flags (line 7) | typedef struct lame_internal_flags lame_internal_flags;
  type short_block_t (line 11) | typedef enum short_block_e {
  type lame_global_struct (line 27) | struct lame_global_struct {

FILE: app/jni/libmp3lame/lameerror.h
  type lame_errorcodes_t (line 11) | typedef enum {

FILE: app/jni/libmp3lame/machine.h
  type FLOAT (line 136) | typedef float FLOAT;
  type FLOAT8 (line 146) | typedef double FLOAT8;
  type FLOAT (line 161) | typedef FLOAT sample_t;

FILE: app/jni/libmp3lame/mpglib_interface.c
  function lame_decode_exit (line 85) | int
  function lame_decode_init (line 93) | int
  function decode1_headersB_clipchoice (line 128) | static int
  function lame_decode1_headersB (line 247) | int
  function lame_decode1_headers (line 272) | int
  function lame_decode1 (line 281) | int
  function lame_decode_headers (line 297) | int
  function lame_decode (line 319) | int
  function hip_t (line 330) | hip_t hip_decode_init(void)
  function hip_decode_exit (line 338) | int hip_decode_exit(hip_t hip)
  function hip_decode1_unclipped (line 351) | int
  function hip_decode1_headers (line 374) | int
  function hip_decode1 (line 383) | int
  function hip_decode_headers (line 398) | int
  function hip_decode (line 420) | int
  function hip_decode1_headersB (line 428) | int
  function hip_set_pinfo (line 444) | void hip_set_pinfo(hip_t hip, plotting_data* pinfo)
  function hip_set_errorf (line 453) | void hip_set_errorf(hip_t hip, lame_report_function func)
  function hip_set_debugf (line 460) | void hip_set_debugf(hip_t hip, lame_report_function func)
  function hip_set_msgf (line 467) | void hip_set_msgf  (hip_t hip, lame_report_function func)

FILE: app/jni/libmp3lame/newmdct.c
  function window_subband (line 432) | inline static void
  function mdct_short (line 834) | inline static void
  function mdct_long (line 871) | inline static void
  function mdct_sub48 (line 946) | void

FILE: app/jni/libmp3lame/presets.c
  function min_int (line 50) | static inline int
  function max_int (line 59) | static inline int
  type vbr_presets_t (line 70) | typedef struct {
  function vbr_presets_t (line 130) | static vbr_presets_t const*
  function apply_vbr_preset (line 145) | static void
  function apply_abr_preset (line 220) | static int
  function apply_preset (line 324) | int

FILE: app/jni/libmp3lame/psymodel.c
  function FLOAT (line 215) | static  FLOAT
  function mask_add_delta (line 275) | inline static int
  function init_mask_add_max_values (line 284) | static void
  function FLOAT (line 296) | inline static FLOAT
  function convert_partition2scalefac (line 352) | static void
  function convert_partition2scalefac_s (line 397) | static void
  function convert_partition2scalefac_l (line 413) | static void
  function convert_partition2scalefac_l_to_s (line 423) | static void
  function FLOAT (line 445) | static inline FLOAT
  function FLOAT (line 460) | static  FLOAT
  function FLOAT (line 505) | static  FLOAT
  function calc_energy (line 558) | static void
  function calc_mask_index_l (line 585) | static void
  function vbrpsy_compute_fft_l (line 657) | static void
  function vbrpsy_compute_fft_s (line 709) | static void
  function vbrpsy_compute_loudness_approximation_l (line 745) | static void
  function vbrpsy_attack_detection (line 761) | static void
  function vbrpsy_skip_masking_s (line 945) | static void
  function vbrpsy_calc_mask_index_s (line 960) | static void
  function vbrpsy_compute_masking_s (line 1033) | static void
  function vbrpsy_compute_masking_l (line 1136) | static void
  function vbrpsy_compute_block_type (line 1267) | static void
  function vbrpsy_apply_block_type (line 1291) | static void
  function vbrpsy_compute_MS_thresholds (line 1328) | static void
  function L3psycho_anal_vbr (line 1399) | int
  function FLOAT (line 1607) | static  FLOAT
  function FLOAT (line 1643) | static  FLOAT
  function FLOAT (line 1692) | static  FLOAT
  function init_numline (line 1703) | static void
  function compute_bark_values (line 1796) | static void
  function init_s3_values (line 1818) | static int
  function psymodel_init (line 1869) | int

FILE: app/jni/libmp3lame/quantize.c
  function ms_convert (line 51) | static void
  function init_xrpow_core_c (line 75) | static void
  function init_xrpow_core_init (line 95) | void
  function init_xrpow (line 113) | static int
  function psfb21_analogsilence (line 162) | static void
  function init_outer_loop (line 229) | static void
  type binsearchDirection_t (line 364) | typedef enum {
  function bin_search_StepSize (line 370) | static int
  function floatcompare (line 446) | static int
  function trancate_smallspectrums (line 457) | static void
  function loop_break (line 543) | inline static int
  function penalties (line 571) | static double
  function get_klemm_noise (line 577) | static double
  function quant_compare (line 588) | inline static int
  function amp_scalefac_bands (line 723) | static void
  function inc_scalefac_scale (line 811) | static void
  function inc_subblock_gain (line 850) | static int
  function balance_noise (line 943) | inline static int
  function outer_loop (line 1013) | static int
  function iteration_finish_one (line 1216) | static void
  function VBR_encode_granule (line 1247) | static void
  function get_framebits (line 1343) | static void
  function VBR_old_prepare (line 1392) | static int
  function bitpressure_strategy (line 1456) | static void
  function VBR_old_iteration_loop (line 1493) | void
  function VBR_new_prepare (line 1585) | static int
  function VBR_new_iteration_loop (line 1648) | void
  function calc_target_bits (line 1770) | static void
  function ABR_iteration_loop (line 1903) | void
  function CBR_iteration_loop (line 1991) | void

FILE: app/jni/libmp3lame/quantize_pvt.c
  function FLOAT (line 211) | static  FLOAT
  function compute_ath (line 231) | static void
  function iteration_init (line 337) | void
  function on_pe (line 429) | int
  function reduce_side (line 493) | void
  function FLOAT (line 555) | FLOAT
  function calc_xmin (line 590) | int
  function FLOAT (line 751) | static  FLOAT
  function calc_noise (line 816) | int
  function set_pinfo (line 935) | static void
  function set_frame_pinfo (line 1045) | void

FILE: app/jni/libmp3lame/quantize_pvt.h
  type calc_noise_result (line 61) | typedef struct calc_noise_result_t {
  type calc_noise_data (line 75) | typedef struct calc_noise_data_t {

FILE: app/jni/libmp3lame/reservoir.c
  function ResvFrameBegin (line 82) | int
  function ResvMaxBits (line 174) | void
  function ResvAdjust (line 225) | void
  function ResvFrameEnd (line 238) | void

FILE: app/jni/libmp3lame/set_get.c
  function lame_set_num_samples (line 45) | int
  function lame_get_num_samples (line 56) | unsigned long
  function lame_set_in_samplerate (line 67) | int
  function lame_get_in_samplerate (line 78) | int
  function lame_set_num_channels (line 89) | int
  function lame_get_num_channels (line 103) | int
  function lame_set_scale (line 114) | int
  function lame_get_scale (line 125) | float
  function lame_set_scale_left (line 137) | int
  function lame_get_scale_left (line 148) | float
  function lame_set_scale_right (line 160) | int
  function lame_get_scale_right (line 171) | float
  function lame_set_out_samplerate (line 182) | int
  function lame_get_out_samplerate (line 202) | int
  function lame_set_analysis (line 219) | int
  function lame_get_analysis (line 236) | int
  function lame_set_bWriteVbrTag (line 248) | int
  function lame_get_bWriteVbrTag (line 265) | int
  function lame_set_decode_only (line 278) | int
  function lame_get_decode_only (line 295) | int
  function lame_set_ogg (line 316) | int
  function lame_get_ogg (line 324) | int
  function lame_set_quality (line 341) | int
  function lame_get_quality (line 359) | int
  function lame_set_mode (line 370) | int
  function MPEG_mode (line 384) | MPEG_mode
  function lame_set_mode_automs (line 408) | int
  function lame_get_mode_automs (line 425) | int
  function lame_set_force_ms (line 437) | int
  function lame_get_force_ms (line 454) | int
  function lame_set_free_format (line 466) | int
  function lame_get_free_format (line 483) | int
  function lame_set_findReplayGain (line 496) | int
  function lame_get_findReplayGain (line 513) | int
  function lame_set_decode_on_the_fly (line 526) | int
  function lame_get_decode_on_the_fly (line 549) | int
  function lame_set_findPeakSample (line 579) | int
  function lame_get_findPeakSample (line 585) | int
  function lame_set_ReplayGain_input (line 592) | int
  function lame_get_ReplayGain_input (line 598) | int
  function lame_set_ReplayGain_decode (line 606) | int
  function lame_get_ReplayGain_decode (line 615) | int
  function lame_set_nogap_total (line 627) | int
  function lame_get_nogap_total (line 637) | int
  function lame_set_nogap_currentindex (line 646) | int
  function lame_get_nogap_currentindex (line 656) | int
  function lame_set_errorf (line 667) | int
  function lame_set_debugf (line 677) | int
  function lame_set_msgf (line 687) | int
  function lame_set_brate (line 705) | int
  function lame_get_brate (line 718) | int
  function lame_set_compression_ratio (line 727) | int
  function lame_get_compression_ratio (line 737) | float
  function lame_set_copyright (line 754) | int
  function lame_get_copyright (line 771) | int
  function lame_set_original (line 783) | int
  function lame_get_original (line 800) | int
  function lame_set_error_protection (line 815) | int
  function lame_get_error_protection (line 832) | int
  function lame_set_padding_type (line 856) | int
  function Padding_type (line 864) | Padding_type
  function lame_set_extension (line 873) | int
  function lame_get_extension (line 889) | int
  function lame_set_strict_ISO (line 901) | int
  function lame_get_strict_ISO (line 917) | int
  function lame_set_disable_reservoir (line 934) | int
  function lame_get_disable_reservoir (line 951) | int
  function lame_set_experimentalX (line 964) | int
  function lame_get_experimentalX (line 975) | int
  function lame_set_quant_comp (line 983) | int
  function lame_get_quant_comp (line 993) | int
  function lame_set_quant_comp_short (line 1004) | int
  function lame_get_quant_comp_short (line 1014) | int
  function lame_set_experimentalY (line 1025) | int
  function lame_get_experimentalY (line 1035) | int
  function lame_set_experimentalZ (line 1045) | int
  function lame_get_experimentalZ (line 1055) | int
  function lame_set_exp_nspsytune (line 1066) | int
  function lame_get_exp_nspsytune (line 1077) | int
  function lame_set_VBR (line 1094) | int
  function vbr_mode (line 1107) | vbr_mode
  function lame_set_VBR_q (line 1123) | int
  function lame_get_VBR_q (line 1144) | int
  function lame_set_VBR_quality (line 1154) | int
  function lame_get_VBR_quality (line 1177) | float
  function lame_set_VBR_mean_bitrate_kbps (line 1188) | int
  function lame_get_VBR_mean_bitrate_kbps (line 1198) | int
  function lame_set_VBR_min_bitrate_kbps (line 1207) | int
  function lame_get_VBR_min_bitrate_kbps (line 1217) | int
  function lame_set_VBR_max_bitrate_kbps (line 1226) | int
  function lame_get_VBR_max_bitrate_kbps (line 1236) | int
  function lame_set_VBR_hard_min (line 1250) | int
  function lame_get_VBR_hard_min (line 1269) | int
  function lame_set_lowpassfreq (line 1289) | int
  function lame_get_lowpassfreq (line 1299) | int
  function lame_set_lowpasswidth (line 1313) | int
  function lame_get_lowpasswidth (line 1323) | int
  function lame_set_highpassfreq (line 1338) | int
  function lame_get_highpassfreq (line 1348) | int
  function lame_set_highpasswidth (line 1362) | int
  function lame_get_highpasswidth (line 1372) | int
  function lame_set_maskingadjust (line 1391) | int
  function lame_get_maskingadjust (line 1401) | float
  function lame_set_maskingadjust_short (line 1410) | int
  function lame_get_maskingadjust_short (line 1420) | float
  function lame_set_ATHonly (line 1430) | int
  function lame_get_ATHonly (line 1440) | int
  function lame_set_ATHshort (line 1451) | int
  function lame_get_ATHshort (line 1461) | int
  function lame_set_noATH (line 1472) | int
  function lame_get_noATH (line 1482) | int
  function lame_set_ATHtype (line 1493) | int
  function lame_get_ATHtype (line 1504) | int
  function lame_set_ATHcurve (line 1515) | int
  function lame_get_ATHcurve (line 1525) | float
  function lame_set_ATHlower (line 1536) | int
  function lame_get_ATHlower (line 1546) | float
  function lame_set_athaa_type (line 1557) | int
  function lame_get_athaa_type (line 1567) | int
  function lame_set_athaa_loudapprox (line 1584) | int
  function lame_get_athaa_loudapprox (line 1592) | int
  function lame_set_athaa_sensitivity (line 1602) | int
  function lame_get_athaa_sensitivity (line 1612) | float
  function lame_set_cwlimit (line 1626) | int
  function lame_get_cwlimit (line 1634) | int
  function lame_set_allow_diff_short (line 1649) | int
  function lame_get_allow_diff_short (line 1659) | int
  function lame_set_useTemporal (line 1673) | int
  function lame_get_useTemporal (line 1690) | int
  function lame_set_interChRatio (line 1702) | int
  function lame_get_interChRatio (line 1715) | float
  function lame_set_substep (line 1727) | int
  function lame_get_substep (line 1740) | int
  function lame_set_sfscale (line 1751) | int
  function lame_get_sfscale (line 1761) | int
  function lame_set_subblock_gain (line 1771) | int
  function lame_get_subblock_gain (line 1781) | int
  function lame_set_no_short_blocks (line 1792) | int
  function lame_get_no_short_blocks (line 1807) | int
  function lame_set_force_short_blocks (line 1828) | int
  function lame_get_force_short_blocks (line 1848) | int
  function lame_set_short_threshold_lrm (line 1867) | int
  function lame_get_short_threshold_lrm (line 1877) | float
  function lame_set_short_threshold_s (line 1886) | int
  function lame_get_short_threshold_s (line 1896) | float
  function lame_set_short_threshold (line 1905) | int
  function lame_set_emphasis (line 1925) | int
  function lame_get_emphasis (line 1938) | int
  function lame_get_version (line 1961) | int
  function lame_get_encoder_delay (line 1975) | int
  function lame_get_encoder_padding (line 1988) | int
  function lame_get_framesize (line 2002) | int
  function lame_get_frameNum (line 2017) | int
  function lame_get_mf_samples_to_encode (line 2029) | int
  function lame_get_size_mp3buffer (line 2041) | int     CDECL
  function lame_get_RadioGain (line 2055) | int
  function lame_get_AudiophileGain (line 2067) | int
  function lame_get_PeakSample (line 2079) | float
  function lame_get_noclipGainChange (line 2091) | int
  function lame_get_noclipScale (line 2103) | float
  function lame_get_totalframes (line 2120) | int
  function lame_set_preset (line 2158) | int
  function lame_set_asm_optimizations (line 2170) | int
  function lame_set_write_id3tag_automatic (line 2196) | void
  function lame_get_write_id3tag_automatic (line 2205) | int
  function lame_set_tune (line 2229) | void
  function lame_set_msfix (line 2239) | void
  function lame_get_msfix (line 2248) | float
  function lame_set_preset_expopts (line 2262) | int
  function lame_set_preset_notune (line 2271) | int

FILE: app/jni/libmp3lame/tables.c
  type huffcodetab (line 409) | struct huffcodetab
  type MPEG_t (line 520) | typedef enum {
  function lame_get_bitrate (line 538) | int
  function lame_get_samplerate (line 549) | int

FILE: app/jni/libmp3lame/tables.h
  type type1_t (line 26) | typedef struct {
  type type2_t (line 35) | typedef struct {
  type type34_t (line 44) | typedef struct {
  type type5_t (line 53) | typedef struct {
  type huffcodetab (line 70) | struct huffcodetab {
  type huffcodetab (line 77) | struct huffcodetab

FILE: app/jni/libmp3lame/takehiro.c
  function quantize_lines_xrpow_01 (line 115) | static void
  type fi_union (line 137) | typedef union {
  function quantize_lines_xrpow (line 146) | static void
  function quantize_lines_xrpow (line 224) | static void
  function quantize_xrpow (line 283) | static void
  function ix_max (line 425) | static int
  function count_bit_ESC (line 451) | static int
  function count_bit_noESC (line 488) | static int
  function count_bit_noESC_from2 (line 512) | static int
  function count_bit_noESC_from3 (line 540) | inline static int
  function count_bit_null (line 590) | static int count_bit_null(const int* ix, const int* end, int max, unsign...
  function choose_table_nonMMX (line 620) | static int
  function noquant_count_bits (line 656) | int
  function count_bits (line 769) | int
  function recalc_divide_init (line 811) | inline static void
  function recalc_divide_sub (line 849) | inline static void
  function best_huffman_divide (line 886) | void
  function scfsi_calc (line 966) | static void
  function best_scalefac_store (line 1023) | void
  function all_scalefactors_not_negative (line 1100) | static int
  function mpeg1_scale_bitcount (line 1137) | static int
  function mpeg2_scale_bitcount (line 1219) | static int
  function scale_bitcount (line 1320) | int
  function huffman_init (line 1336) | void

FILE: app/jni/libmp3lame/util.c
  function free_id3tag (line 50) | void
  function free_global_data (line 93) | static void
  function freegfc (line 111) | void
  function malloc_aligned (line 167) | void
  function free_aligned (line 183) | void
  function FLOAT (line 198) | static  FLOAT
  function FLOAT (line 242) | FLOAT
  function FLOAT (line 273) | FLOAT
  function FLOAT (line 287) | FLOAT
  function FindNearestBitrate (line 302) | int
  function nearestBitrateFullIndex (line 343) | int
  function map2MP3Frequency (line 392) | int
  function BitrateIndex (line 415) | int
  function SmpFrqIndex (line 435) | int
  function FLOAT (line 489) | inline static FLOAT
  function gcd (line 521) | static int
  function fill_buffer_resample (line 530) | static int
  function isResamplingNecessary (line 653) | int
  function fill_buffer (line 665) | void
  function lame_report_def (line 706) | void
  function lame_report_fnc (line 713) | void
  function lame_debugf (line 725) | void
  function lame_msgf (line 737) | void
  function lame_errorf (line 749) | void
  function has_MMX (line 778) | int
  function has_3DNow (line 788) | int
  function has_SSE (line 798) | int
  function has_SSE2 (line 812) | int
  function disable_FPE (line 826) | void
  function init_log_table (line 958) | void
  function ieee754_float32_t (line 976) | ieee754_float32_t
  function init_log_table (line 1003) | void

FILE: app/jni/libmp3lame/util.h
  type replaygain_data (line 108) | struct replaygain_data
  type replaygain_t (line 111) | typedef struct replaygain_data replaygain_t;
  type plotting_data (line 113) | struct plotting_data
  type plotting_data (line 116) | typedef struct plotting_data plotting_data;
  type aligned_pointer_t (line 125) | typedef struct {
  type Bit_stream_struc (line 140) | typedef struct bit_stream_struc {
  type VBR_seek_info_t (line 152) | typedef struct {
  type ATH_t (line 170) | typedef struct {
  type PsyConst_CB2SB_t (line 192) | typedef struct {
  type PsyConst_t (line 213) | typedef struct {
  type PsyStateVar_t (line 223) | typedef struct {
  type PsyResult_t (line 243) | typedef struct {
  type EncStateVar_t (line 250) | typedef struct {
  type EncResult_t (line 307) | typedef struct {
  type QntStateVar_t (line 322) | typedef struct {
  type RpgStateVar_t (line 345) | typedef struct {
  type RpgResult_t (line 351) | typedef struct {
  type SessionConfig_t (line 359) | typedef struct {
  type lame_internal_flags (line 466) | struct lame_internal_flags {
  type lame_internal_flags (line 552) | typedef struct lame_internal_flags lame_internal_flags;

FILE: app/jni/libmp3lame/vbrquantize.c
  type algo_s (line 42) | struct algo_s
  type algo_t (line 43) | typedef struct algo_s algo_t;
  type algo_s (line 48) | struct algo_s {
  type VOLATILE (line 79) | typedef VOLATILE union
  function vec_max_c (line 117) | inline static  float
  function find_lowest_scalefac (line 149) | inline static  uint8_t
  function k_34_4 (line 171) | inline static void
  function FLOAT (line 219) | static  FLOAT
  type calc_noise_cache (line 271) | struct calc_noise_cache {
  type calc_noise_cache_t (line 276) | typedef struct calc_noise_cache calc_noise_cache_t;
  function tri_calc_sfb_noise_x34 (line 279) | static  uint8_t
  function calc_scalefac (line 318) | static int
  function guess_scalefac_x34 (line 325) | static uint8_t
  function find_scalefac_x34 (line 348) | static  uint8_t
  function block_sf (line 396) | static int
  function quantize_x34 (line 502) | static void
  function set_subblock_gain (line 597) | static void
  function set_scalefacs (line 690) | static void
  function checkScalefactor (line 734) | static int
  function short_block_constrain (line 771) | static void
  function long_block_constrain (line 849) | static void
  function bitcount (line 986) | static void
  function quantizeAndCountBits (line 1001) | static int
  function tryGlobalStepsize (line 1013) | static int
  function searchGlobalStepsizeMax (line 1042) | static void
  function sfDepth (line 1076) | static int
  function cutDistribution (line 1095) | static void
  function flattenDistribution (line 1106) | static int
  function tryThatOne (line 1142) | static int
  function outOfBitsStrategy (line 1156) | static void
  function reduce_bit_usage (line 1233) | static int
  function VBR_encode_frame (line 1256) | int

FILE: app/jni/libmp3lame/vector/xmm_quantize_sub.c
  type vecfloat_union (line 39) | typedef union {
  function init_xrpow_core_sse (line 55) | void
  function store4 (line 116) | static void store4(__m128 v, float* f0, float* f1, float* f2, float* f3)
  function fht_SSE2 (line 127) | void

FILE: app/jni/libmp3lame/version.c
  function get_lame_version_numerical (line 203) | void

FILE: app/jni/silk.c
  function swap_endian (line 28) | void swap_endian(
  function GetHighResolutionTime (line 53) | unsigned long GetHighResolutionTime() /* O: time in usec*/
  function GetHighResolutionTime (line 65) | unsigned long GetHighResolutionTime() /* O: time in usec*/
  function convertSilk2PCM (line 76) | int convertSilk2PCM(const char* src, const FILE* destFile) {
Condensed preview — 218 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (2,145K chars).
[
  {
    "path": ".gitignore",
    "chars": 569,
    "preview": "*.iml\n.gradle\n/local.properties\n/.idea/workspace.xml\n/.idea/libraries\n.DS_Store\n/build\n/captures\n.idea\n\n# Built applicat"
  },
  {
    "path": "README.md",
    "chars": 449,
    "preview": "# android_silk_v3_decoder\nConvert silk v3 audio files (QQ &amp; WeChat voice files) to mp3 files on android.\n\nplease ref"
  },
  {
    "path": "app/.gitignore",
    "chars": 67,
    "preview": "/build\n*.iml\n.gradle\n.idea\n.DS_Store\n/captures\n.externalNativeBuild"
  },
  {
    "path": "app/CMakeLists.txt",
    "chars": 3763,
    "preview": "# documentation: https://d.android.com/studio/projects/add-native-code.html\ncmake_minimum_required(VERSION 3.4.1)\nSET(CM"
  },
  {
    "path": "app/build.gradle",
    "chars": 1443,
    "preview": "apply plugin: 'com.android.application'\napply plugin: 'kotlin-android-extensions'\napply plugin: 'kotlin-android'\n\nandroi"
  },
  {
    "path": "app/jni/SKP_Silk_A2NLSF.c",
    "chars": 11860,
    "preview": "/***********************************************************************\nCopyright (c) 2006-2012, Skype Limited. All rig"
  },
  {
    "path": "app/jni/SKP_Silk_CNG.c",
    "chars": 6867,
    "preview": "/***********************************************************************\nCopyright (c) 2006-2012, Skype Limited. All rig"
  },
  {
    "path": "app/jni/SKP_Silk_HP_variable_cutoff_FIX.c",
    "chars": 6490,
    "preview": "/***********************************************************************\nCopyright (c) 2006-2012, Skype Limited. All rig"
  },
  {
    "path": "app/jni/SKP_Silk_LBRR_reset.c",
    "chars": 2135,
    "preview": "/***********************************************************************\nCopyright (c) 2006-2012, Skype Limited. All rig"
  },
  {
    "path": "app/jni/SKP_Silk_LPC_inv_pred_gain.c",
    "chars": 6972,
    "preview": "/***********************************************************************\nCopyright (c) 2006-2012, Skype Limited. All rig"
  },
  {
    "path": "app/jni/SKP_Silk_LPC_synthesis_filter.c",
    "chars": 5643,
    "preview": "/***********************************************************************\nCopyright (c) 2006-2012, Skype Limited. All rig"
  },
  {
    "path": "app/jni/SKP_Silk_LPC_synthesis_order16.c",
    "chars": 8684,
    "preview": "/***********************************************************************\nCopyright (c) 2006-2012, Skype Limited. All rig"
  },
  {
    "path": "app/jni/SKP_Silk_LP_variable_cutoff.c",
    "chars": 9548,
    "preview": "/***********************************************************************\nCopyright (c) 2006-2012, Skype Limited. All rig"
  },
  {
    "path": "app/jni/SKP_Silk_LSF_cos_table.c",
    "chars": 4397,
    "preview": "/***********************************************************************\nCopyright (c) 2006-2012, Skype Limited. All rig"
  },
  {
    "path": "app/jni/SKP_Silk_LTP_analysis_filter_FIX.c",
    "chars": 4154,
    "preview": "/***********************************************************************\nCopyright (c) 2006-2012, Skype Limited. All rig"
  },
  {
    "path": "app/jni/SKP_Silk_LTP_scale_ctrl_FIX.c",
    "chars": 3926,
    "preview": "/***********************************************************************\nCopyright (c) 2006-2012, Skype Limited. All rig"
  },
  {
    "path": "app/jni/SKP_Silk_MA.c",
    "chars": 5503,
    "preview": "/***********************************************************************\nCopyright (c) 2006-2012, Skype Limited. All rig"
  },
  {
    "path": "app/jni/SKP_Silk_NLSF2A.c",
    "chars": 6430,
    "preview": "/***********************************************************************\nCopyright (c) 2006-2012, Skype Limited. All rig"
  },
  {
    "path": "app/jni/SKP_Silk_NLSF2A_stable.c",
    "chars": 2892,
    "preview": "/***********************************************************************\nCopyright (c) 2006-2012, Skype Limited. All rig"
  },
  {
    "path": "app/jni/SKP_Silk_NLSF_MSVQ_decode.c",
    "chars": 4632,
    "preview": "/***********************************************************************\nCopyright (c) 2006-2012, Skype Limited. All rig"
  },
  {
    "path": "app/jni/SKP_Silk_NLSF_MSVQ_encode_FIX.c",
    "chars": 12040,
    "preview": "/***********************************************************************\nCopyright (c) 2006-2012, Skype Limited. All rig"
  },
  {
    "path": "app/jni/SKP_Silk_NLSF_VQ_rate_distortion_FIX.c",
    "chars": 3731,
    "preview": "/***********************************************************************\nCopyright (c) 2006-2012, Skype Limited. All rig"
  },
  {
    "path": "app/jni/SKP_Silk_NLSF_VQ_sum_error_FIX.c",
    "chars": 4298,
    "preview": "/***********************************************************************\nCopyright (c) 2006-2012, Skype Limited. All rig"
  },
  {
    "path": "app/jni/SKP_Silk_NLSF_VQ_weights_laroia.c",
    "chars": 4048,
    "preview": "/***********************************************************************\nCopyright (c) 2006-2012, Skype Limited. All rig"
  },
  {
    "path": "app/jni/SKP_Silk_NLSF_stabilize.c",
    "chars": 6495,
    "preview": "/***********************************************************************\nCopyright (c) 2006-2012, Skype Limited. All rig"
  },
  {
    "path": "app/jni/SKP_Silk_NSQ.c",
    "chars": 24508,
    "preview": "/***********************************************************************\nCopyright (c) 2006-2012, Skype Limited. All rig"
  },
  {
    "path": "app/jni/SKP_Silk_NSQ_del_dec.c",
    "chars": 40858,
    "preview": "/***********************************************************************\nCopyright (c) 2006-2012, Skype Limited. All rig"
  },
  {
    "path": "app/jni/SKP_Silk_PLC.c",
    "chars": 20279,
    "preview": "/***********************************************************************\nCopyright (c) 2006-2012, Skype Limited. All rig"
  },
  {
    "path": "app/jni/SKP_Silk_VAD.c",
    "chars": 13915,
    "preview": "/***********************************************************************\nCopyright (c) 2006-2012, Skype Limited. All rig"
  },
  {
    "path": "app/jni/SKP_Silk_VQ_nearest_neighbor_FIX.c",
    "chars": 8315,
    "preview": "/***********************************************************************\nCopyright (c) 2006-2012, Skype Limited. All rig"
  },
  {
    "path": "app/jni/SKP_Silk_ana_filt_bank_1.c",
    "chars": 4378,
    "preview": "/***********************************************************************\nCopyright (c) 2006-2012, Skype Limited. All rig"
  },
  {
    "path": "app/jni/SKP_Silk_apply_sine_window.c",
    "chars": 5973,
    "preview": "/***********************************************************************\nCopyright (c) 2006-2012, Skype Limited. All rig"
  },
  {
    "path": "app/jni/SKP_Silk_array_maxabs.c",
    "chars": 3534,
    "preview": "/***********************************************************************\nCopyright (c) 2006-2012, Skype Limited. All rig"
  },
  {
    "path": "app/jni/SKP_Silk_autocorr.c",
    "chars": 4379,
    "preview": "/***********************************************************************\nCopyright (c) 2006-2012, Skype Limited. All rig"
  },
  {
    "path": "app/jni/SKP_Silk_biquad.c",
    "chars": 3704,
    "preview": "/***********************************************************************\nCopyright (c) 2006-2012, Skype Limited. All rig"
  },
  {
    "path": "app/jni/SKP_Silk_biquad_alt.c",
    "chars": 4055,
    "preview": "/***********************************************************************\nCopyright (c) 2006-2012, Skype Limited. All rig"
  },
  {
    "path": "app/jni/SKP_Silk_burg_modified.c",
    "chars": 13965,
    "preview": "/***********************************************************************\nCopyright (c) 2006-2012, Skype Limited. All rig"
  },
  {
    "path": "app/jni/SKP_Silk_bwexpander.c",
    "chars": 2792,
    "preview": "/***********************************************************************\nCopyright (c) 2006-2012, Skype Limited. All rig"
  },
  {
    "path": "app/jni/SKP_Silk_bwexpander_32.c",
    "chars": 2486,
    "preview": "/***********************************************************************\nCopyright (c) 2006-2012, Skype Limited. All rig"
  },
  {
    "path": "app/jni/SKP_Silk_code_signs.c",
    "chars": 4529,
    "preview": "/***********************************************************************\nCopyright (c) 2006-2012, Skype Limited. All rig"
  },
  {
    "path": "app/jni/SKP_Silk_control_audio_bandwidth.c",
    "chars": 7085,
    "preview": "/***********************************************************************\nCopyright (c) 2006-2012, Skype Limited. All rig"
  },
  {
    "path": "app/jni/SKP_Silk_control_codec_FIX.c",
    "chars": 18829,
    "preview": "/***********************************************************************\nCopyright (c) 2006-2012, Skype Limited. All rig"
  },
  {
    "path": "app/jni/SKP_Silk_corrMatrix_FIX.c",
    "chars": 7868,
    "preview": "/***********************************************************************\nCopyright (c) 2006-2012, Skype Limited. All rig"
  },
  {
    "path": "app/jni/SKP_Silk_create_init_destroy.c",
    "chars": 2482,
    "preview": "/***********************************************************************\nCopyright (c) 2006-2012, Skype Limited. All rig"
  },
  {
    "path": "app/jni/SKP_Silk_dec_API.c",
    "chars": 12287,
    "preview": "/***********************************************************************\nCopyright (c) 2006-2012, Skype Limited. All rig"
  },
  {
    "path": "app/jni/SKP_Silk_decode_core.c",
    "chars": 16135,
    "preview": "/***********************************************************************\nCopyright (c) 2006-2012, Skype Limited. All rig"
  },
  {
    "path": "app/jni/SKP_Silk_decode_frame.c",
    "chars": 6995,
    "preview": "/***********************************************************************\nCopyright (c) 2006-2012, Skype Limited. All rig"
  },
  {
    "path": "app/jni/SKP_Silk_decode_parameters.c",
    "chars": 11628,
    "preview": "/***********************************************************************\nCopyright (c) 2006-2012, Skype Limited. All rig"
  },
  {
    "path": "app/jni/SKP_Silk_decode_pitch.c",
    "chars": 2956,
    "preview": "/***********************************************************************\nCopyright (c) 2006-2012, Skype Limited. All rig"
  },
  {
    "path": "app/jni/SKP_Silk_decode_pulses.c",
    "chars": 5238,
    "preview": "/***********************************************************************\nCopyright (c) 2006-2012, Skype Limited. All rig"
  },
  {
    "path": "app/jni/SKP_Silk_decoder_set_fs.c",
    "chars": 3951,
    "preview": "/***********************************************************************\nCopyright (c) 2006-2012, Skype Limited. All rig"
  },
  {
    "path": "app/jni/SKP_Silk_detect_SWB_input.c",
    "chars": 3951,
    "preview": "/***********************************************************************\nCopyright (c) 2006-2012, Skype Limited. All rig"
  },
  {
    "path": "app/jni/SKP_Silk_div_oabi.c",
    "chars": 1930,
    "preview": "/***********************************************************************\nCopyright (c) 2006-2012, Skype Limited. All rig"
  },
  {
    "path": "app/jni/SKP_Silk_enc_API.c",
    "chars": 10875,
    "preview": "/***********************************************************************\nCopyright (c) 2006-2012, Skype Limited. All rig"
  },
  {
    "path": "app/jni/SKP_Silk_encode_frame_FIX.c",
    "chars": 20263,
    "preview": "/***********************************************************************\nCopyright (c) 2006-2012, Skype Limited. All rig"
  },
  {
    "path": "app/jni/SKP_Silk_encode_parameters.c",
    "chars": 7020,
    "preview": "/***********************************************************************\nCopyright (c) 2006-2012, Skype Limited. All rig"
  },
  {
    "path": "app/jni/SKP_Silk_encode_pulses.c",
    "chars": 8143,
    "preview": "/***********************************************************************\nCopyright (c) 2006-2012, Skype Limited. All rig"
  },
  {
    "path": "app/jni/SKP_Silk_find_LPC_FIX.c",
    "chars": 7472,
    "preview": "/***********************************************************************\nCopyright (c) 2006-2012, Skype Limited. All rig"
  },
  {
    "path": "app/jni/SKP_Silk_find_LTP_FIX.c",
    "chars": 12797,
    "preview": "/***********************************************************************\nCopyright (c) 2006-2012, Skype Limited. All rig"
  },
  {
    "path": "app/jni/SKP_Silk_find_pitch_lags_FIX.c",
    "chars": 6758,
    "preview": "/***********************************************************************\nCopyright (c) 2006-2012, Skype Limited. All rig"
  },
  {
    "path": "app/jni/SKP_Silk_find_pred_coefs_FIX.c",
    "chars": 6599,
    "preview": "/***********************************************************************\nCopyright (c) 2006-2012, Skype Limited. All rig"
  },
  {
    "path": "app/jni/SKP_Silk_gain_quant.c",
    "chars": 4827,
    "preview": "/***********************************************************************\nCopyright (c) 2006-2012, Skype Limited. All rig"
  },
  {
    "path": "app/jni/SKP_Silk_init_encoder_FIX.c",
    "chars": 2736,
    "preview": "/***********************************************************************\nCopyright (c) 2006-2012, Skype Limited. All rig"
  },
  {
    "path": "app/jni/SKP_Silk_inner_prod_aligned.c",
    "chars": 3701,
    "preview": "/***********************************************************************\nCopyright (c) 2006-2012, Skype Limited. All rig"
  },
  {
    "path": "app/jni/SKP_Silk_interpolate.c",
    "chars": 2702,
    "preview": "/***********************************************************************\nCopyright (c) 2006-2012, Skype Limited. All rig"
  },
  {
    "path": "app/jni/SKP_Silk_k2a.c",
    "chars": 3309,
    "preview": "/***********************************************************************\nCopyright (c) 2006-2012, Skype Limited. All rig"
  },
  {
    "path": "app/jni/SKP_Silk_k2a_Q16.c",
    "chars": 3285,
    "preview": "/***********************************************************************\nCopyright (c) 2006-2012, Skype Limited. All rig"
  },
  {
    "path": "app/jni/SKP_Silk_lin2log.c",
    "chars": 2949,
    "preview": "/***********************************************************************\nCopyright (c) 2006-2012, Skype Limited. All rig"
  },
  {
    "path": "app/jni/SKP_Silk_log2lin.c",
    "chars": 3309,
    "preview": "/***********************************************************************\nCopyright (c) 2006-2012, Skype Limited. All rig"
  },
  {
    "path": "app/jni/SKP_Silk_noise_shape_analysis_FIX.c",
    "chars": 25529,
    "preview": "/***********************************************************************\nCopyright (c) 2006-2012, Skype Limited. All rig"
  },
  {
    "path": "app/jni/SKP_Silk_pitch_analysis_core.c",
    "chars": 34681,
    "preview": "/***********************************************************************\nCopyright (c) 2006-2012, Skype Limited. All rig"
  },
  {
    "path": "app/jni/SKP_Silk_pitch_est_tables.c",
    "chars": 3776,
    "preview": "/***********************************************************************\nCopyright (c) 2006-2012, Skype Limited. All rig"
  },
  {
    "path": "app/jni/SKP_Silk_prefilter_FIX.c",
    "chars": 12337,
    "preview": "/***********************************************************************\nCopyright (c) 2006-2012, Skype Limited. All rig"
  },
  {
    "path": "app/jni/SKP_Silk_process_NLSFs_FIX.c",
    "chars": 6754,
    "preview": "/***********************************************************************\nCopyright (c) 2006-2012, Skype Limited. All rig"
  },
  {
    "path": "app/jni/SKP_Silk_process_gains_FIX.c",
    "chars": 6088,
    "preview": "/***********************************************************************\nCopyright (c) 2006-2012, Skype Limited. All rig"
  },
  {
    "path": "app/jni/SKP_Silk_quant_LTP_gains_FIX.c",
    "chars": 5172,
    "preview": "/***********************************************************************\nCopyright (c) 2006-2012, Skype Limited. All rig"
  },
  {
    "path": "app/jni/SKP_Silk_range_coder.c",
    "chars": 14380,
    "preview": "/***********************************************************************\nCopyright (c) 2006-2012, Skype Limited. All rig"
  },
  {
    "path": "app/jni/SKP_Silk_regularize_correlations_FIX.c",
    "chars": 2517,
    "preview": "/***********************************************************************\nCopyright (c) 2006-2012, Skype Limited. All rig"
  },
  {
    "path": "app/jni/SKP_Silk_resampler.c",
    "chars": 14265,
    "preview": "/***********************************************************************\nCopyright (c) 2006-2012, Skype Limited. All rig"
  },
  {
    "path": "app/jni/SKP_Silk_resampler_down2.c",
    "chars": 4048,
    "preview": "/***********************************************************************\nCopyright (c) 2006-2012, Skype Limited. All rig"
  },
  {
    "path": "app/jni/SKP_Silk_resampler_down2_3.c",
    "chars": 5061,
    "preview": "/***********************************************************************\nCopyright (c) 2006-2012, Skype Limited. All rig"
  },
  {
    "path": "app/jni/SKP_Silk_resampler_down3.c",
    "chars": 4568,
    "preview": "/***********************************************************************\nCopyright (c) 2006-2012, Skype Limited. All rig"
  },
  {
    "path": "app/jni/SKP_Silk_resampler_private_AR2.c",
    "chars": 3051,
    "preview": "/***********************************************************************\nCopyright (c) 2006-2012, Skype Limited. All rig"
  },
  {
    "path": "app/jni/SKP_Silk_resampler_private_ARMA4.c",
    "chars": 4126,
    "preview": "/***********************************************************************\nCopyright (c) 2006-2012, Skype Limited. All rig"
  },
  {
    "path": "app/jni/SKP_Silk_resampler_private_IIR_FIR.c",
    "chars": 5685,
    "preview": "/***********************************************************************\nCopyright (c) 2006-2012, Skype Limited. All rig"
  },
  {
    "path": "app/jni/SKP_Silk_resampler_private_copy.c",
    "chars": 2688,
    "preview": "/***********************************************************************\nCopyright (c) 2006-2012, Skype Limited. All rig"
  },
  {
    "path": "app/jni/SKP_Silk_resampler_private_down4.c",
    "chars": 4196,
    "preview": "/***********************************************************************\nCopyright (c) 2006-2012, Skype Limited. All rig"
  },
  {
    "path": "app/jni/SKP_Silk_resampler_private_down_FIR.c",
    "chars": 8103,
    "preview": "/***********************************************************************\nCopyright (c) 2006-2012, Skype Limited. All rig"
  },
  {
    "path": "app/jni/SKP_Silk_resampler_private_up2_HQ.c",
    "chars": 6299,
    "preview": "/***********************************************************************\nCopyright (c) 2006-2012, Skype Limited. All rig"
  },
  {
    "path": "app/jni/SKP_Silk_resampler_private_up4.c",
    "chars": 4171,
    "preview": "/***********************************************************************\nCopyright (c) 2006-2012, Skype Limited. All rig"
  },
  {
    "path": "app/jni/SKP_Silk_resampler_rom.c",
    "chars": 9277,
    "preview": "/***********************************************************************\nCopyright (c) 2006-2012, Skype Limited. All rig"
  },
  {
    "path": "app/jni/SKP_Silk_resampler_up2.c",
    "chars": 3967,
    "preview": "/***********************************************************************\nCopyright (c) 2006-2012, Skype Limited. All rig"
  },
  {
    "path": "app/jni/SKP_Silk_residual_energy16_FIX.c",
    "chars": 4601,
    "preview": "/***********************************************************************\nCopyright (c) 2006-2012, Skype Limited. All rig"
  },
  {
    "path": "app/jni/SKP_Silk_residual_energy_FIX.c",
    "chars": 4598,
    "preview": "/***********************************************************************\nCopyright (c) 2006-2012, Skype Limited. All rig"
  },
  {
    "path": "app/jni/SKP_Silk_scale_copy_vector16.c",
    "chars": 2338,
    "preview": "/***********************************************************************\nCopyright (c) 2006-2012, Skype Limited. All rig"
  },
  {
    "path": "app/jni/SKP_Silk_scale_vector.c",
    "chars": 2330,
    "preview": "/***********************************************************************\nCopyright (c) 2006-2012, Skype Limited. All rig"
  },
  {
    "path": "app/jni/SKP_Silk_schur.c",
    "chars": 4550,
    "preview": "/***********************************************************************\nCopyright (c) 2006-2012, Skype Limited. All rig"
  },
  {
    "path": "app/jni/SKP_Silk_schur64.c",
    "chars": 4198,
    "preview": "/***********************************************************************\nCopyright (c) 2006-2012, Skype Limited. All rig"
  },
  {
    "path": "app/jni/SKP_Silk_shell_coder.c",
    "chars": 7834,
    "preview": "/***********************************************************************\nCopyright (c) 2006-2012, Skype Limited. All rig"
  },
  {
    "path": "app/jni/SKP_Silk_sigm_Q15.c",
    "chars": 3835,
    "preview": "/***********************************************************************\nCopyright (c) 2006-2012, Skype Limited. All rig"
  },
  {
    "path": "app/jni/SKP_Silk_solve_LS_FIX.c",
    "chars": 10369,
    "preview": "/***********************************************************************\nCopyright (c) 2006-2012, Skype Limited. All rig"
  },
  {
    "path": "app/jni/SKP_Silk_sort.c",
    "chars": 5986,
    "preview": "/***********************************************************************\nCopyright (c) 2006-2012, Skype Limited. All rig"
  },
  {
    "path": "app/jni/SKP_Silk_sum_sqr_shift.c",
    "chars": 4654,
    "preview": "/***********************************************************************\nCopyright (c) 2006-2012, Skype Limited. All rig"
  },
  {
    "path": "app/jni/SKP_Silk_tables_LTP.c",
    "chars": 7829,
    "preview": "/***********************************************************************\nCopyright (c) 2006-2012, Skype Limited. All rig"
  },
  {
    "path": "app/jni/SKP_Silk_tables_NLSF_CB0_10.c",
    "chars": 30558,
    "preview": "/***********************************************************************\nCopyright (c) 2006-2012, Skype Limited. All rig"
  },
  {
    "path": "app/jni/SKP_Silk_tables_NLSF_CB0_16.c",
    "chars": 75456,
    "preview": "/***********************************************************************\nCopyright (c) 2006-2012, Skype Limited. All rig"
  },
  {
    "path": "app/jni/SKP_Silk_tables_NLSF_CB1_10.c",
    "chars": 20070,
    "preview": "/***********************************************************************\nCopyright (c) 2006-2012, Skype Limited. All rig"
  },
  {
    "path": "app/jni/SKP_Silk_tables_NLSF_CB1_16.c",
    "chars": 39000,
    "preview": "/***********************************************************************\nCopyright (c) 2006-2012, Skype Limited. All rig"
  },
  {
    "path": "app/jni/SKP_Silk_tables_gain.c",
    "chars": 3604,
    "preview": "/***********************************************************************\nCopyright (c) 2006-2012, Skype Limited. All rig"
  },
  {
    "path": "app/jni/SKP_Silk_tables_other.c",
    "chars": 6978,
    "preview": "/***********************************************************************\nCopyright (c) 2006-2012, Skype Limited. All rig"
  },
  {
    "path": "app/jni/SKP_Silk_tables_pitch_lag.c",
    "chars": 11652,
    "preview": "/***********************************************************************\nCopyright (c) 2006-2012, Skype Limited. All rig"
  },
  {
    "path": "app/jni/SKP_Silk_tables_pulses_per_block.c",
    "chars": 9867,
    "preview": "/***********************************************************************\nCopyright (c) 2006-2012, Skype Limited. All rig"
  },
  {
    "path": "app/jni/SKP_Silk_tables_sign.c",
    "chars": 2228,
    "preview": "/***********************************************************************\nCopyright (c) 2006-2012, Skype Limited. All rig"
  },
  {
    "path": "app/jni/SKP_Silk_tables_type_offset.c",
    "chars": 2227,
    "preview": "/***********************************************************************\nCopyright (c) 2006-2012, Skype Limited. All rig"
  },
  {
    "path": "app/jni/SKP_Silk_warped_autocorrelation_FIX.c",
    "chars": 4381,
    "preview": "/***********************************************************************\nCopyright (c) 2006-2012, Skype Limited. All rig"
  },
  {
    "path": "app/jni/decoder.c",
    "chars": 989,
    "preview": "#include \"silk.h\"\n#include \"lame.h\"\n#include <stdio.h>\n\nstatic void print_usage(char* argv[]) {\n    printf( \"\\nusage: %s"
  },
  {
    "path": "app/jni/decoder.cpp",
    "chars": 2033,
    "preview": "//\n// Created by ketian on 16-9-23.\n//\n\n#include <jni.h>\n#include <unistd.h>\n\n#ifdef __cplusplus\nextern \"C\"\n{\n#endif\n\n#i"
  },
  {
    "path": "app/jni/include/SKP_Silk_AsmHelper.h",
    "chars": 4048,
    "preview": "/***********************************************************************\nCopyright (c) 2006-2012, Skype Limited. All rig"
  },
  {
    "path": "app/jni/include/SKP_Silk_AsmPreproc.h",
    "chars": 6187,
    "preview": "/***********************************************************************\nCopyright (c) 2006-2012, Skype Limited. All rig"
  },
  {
    "path": "app/jni/include/SKP_Silk_Inlines.h",
    "chars": 10447,
    "preview": "/***********************************************************************\nCopyright (c) 2006-2012, Skype Limited. All rig"
  },
  {
    "path": "app/jni/include/SKP_Silk_PLC.h",
    "chars": 4239,
    "preview": "/***********************************************************************\nCopyright (c) 2006-2012, Skype Limited. All rig"
  },
  {
    "path": "app/jni/include/SKP_Silk_SDK_API.h",
    "chars": 7819,
    "preview": "/***********************************************************************\nCopyright (c) 2006-2012, Skype Limited. All rig"
  },
  {
    "path": "app/jni/include/SKP_Silk_SigProc_FIX.h",
    "chars": 34294,
    "preview": "/***********************************************************************\nCopyright (c) 2006-2012, Skype Limited. All rig"
  },
  {
    "path": "app/jni/include/SKP_Silk_common_pitch_est_defines.h",
    "chars": 3942,
    "preview": "/***********************************************************************\nCopyright (c) 2006-2012, Skype Limited. All rig"
  },
  {
    "path": "app/jni/include/SKP_Silk_control.h",
    "chars": 4075,
    "preview": "/***********************************************************************\nCopyright (c) 2006-2012, Skype Limited. All rig"
  },
  {
    "path": "app/jni/include/SKP_Silk_define.h",
    "chars": 14142,
    "preview": "/***********************************************************************\nCopyright (c) 2006-2012, Skype Limited. All rig"
  },
  {
    "path": "app/jni/include/SKP_Silk_errors.h",
    "chars": 3559,
    "preview": "/***********************************************************************\nCopyright (c) 2006-2012, Skype Limited. All rig"
  },
  {
    "path": "app/jni/include/SKP_Silk_macros.h",
    "chars": 5657,
    "preview": "/***********************************************************************\nCopyright (c) 2006-2012, Skype Limited. All rig"
  },
  {
    "path": "app/jni/include/SKP_Silk_macros_arm.h",
    "chars": 9484,
    "preview": "/***********************************************************************\nCopyright (c) 2006-2012, Skype Limited. All rig"
  },
  {
    "path": "app/jni/include/SKP_Silk_main.h",
    "chars": 23061,
    "preview": "/***********************************************************************\nCopyright (c) 2006-2012, Skype Limited. All rig"
  },
  {
    "path": "app/jni/include/SKP_Silk_main_FIX.h",
    "chars": 22553,
    "preview": "/***********************************************************************\nCopyright (c) 2006-2012, Skype Limited. All rig"
  },
  {
    "path": "app/jni/include/SKP_Silk_pitch_est_defines.h",
    "chars": 2298,
    "preview": "/***********************************************************************\nCopyright (c) 2006-2012, Skype Limited. All rig"
  },
  {
    "path": "app/jni/include/SKP_Silk_resampler_private.h",
    "chars": 6446,
    "preview": "/***********************************************************************\nCopyright (c) 2006-2012, Skype Limited. All rig"
  },
  {
    "path": "app/jni/include/SKP_Silk_resampler_rom.h",
    "chars": 4892,
    "preview": "/***********************************************************************\nCopyright (c) 2006-2012, Skype Limited. All rig"
  },
  {
    "path": "app/jni/include/SKP_Silk_resampler_structs.h",
    "chars": 3770,
    "preview": "/***********************************************************************\nCopyright (c) 2006-2012, Skype Limited. All rig"
  },
  {
    "path": "app/jni/include/SKP_Silk_setup_complexity.h",
    "chars": 5700,
    "preview": "/***********************************************************************\nCopyright (c) 2006-2012, Skype Limited. All rig"
  },
  {
    "path": "app/jni/include/SKP_Silk_structs.h",
    "chars": 20574,
    "preview": "/***********************************************************************\nCopyright (c) 2006-2012, Skype Limited. All rig"
  },
  {
    "path": "app/jni/include/SKP_Silk_structs_FIX.h",
    "chars": 7339,
    "preview": "/***********************************************************************\nCopyright (c) 2006-2012, Skype Limited. All rig"
  },
  {
    "path": "app/jni/include/SKP_Silk_tables.h",
    "chars": 9806,
    "preview": "/***********************************************************************\nCopyright (c) 2006-2012, Skype Limited. All rig"
  },
  {
    "path": "app/jni/include/SKP_Silk_tables_NLSF_CB0_10.h",
    "chars": 2449,
    "preview": "/***********************************************************************\nCopyright (c) 2006-2012, Skype Limited. All rig"
  },
  {
    "path": "app/jni/include/SKP_Silk_tables_NLSF_CB0_16.h",
    "chars": 2450,
    "preview": "/***********************************************************************\nCopyright (c) 2006-2012, Skype Limited. All rig"
  },
  {
    "path": "app/jni/include/SKP_Silk_tables_NLSF_CB1_10.h",
    "chars": 2448,
    "preview": "/***********************************************************************\nCopyright (c) 2006-2012, Skype Limited. All rig"
  },
  {
    "path": "app/jni/include/SKP_Silk_tables_NLSF_CB1_16.h",
    "chars": 2450,
    "preview": "/***********************************************************************\nCopyright (c) 2006-2012, Skype Limited. All rig"
  },
  {
    "path": "app/jni/include/SKP_Silk_tuning_parameters.h",
    "chars": 7914,
    "preview": "/***********************************************************************\nCopyright (c) 2006-2012, Skype Limited. All rig"
  },
  {
    "path": "app/jni/include/SKP_Silk_typedef.h",
    "chars": 4109,
    "preview": "/***********************************************************************\nCopyright (c) 2006-2012, Skype Limited. All rig"
  },
  {
    "path": "app/jni/include/lame.h",
    "chars": 48952,
    "preview": "/*\n *\tInterface to MP3 LAME encoding engine\n *\n *\tCopyright (c) 1999 Mark Taylor\n *\n * This library is free software; yo"
  },
  {
    "path": "app/jni/include/silk.h",
    "chars": 386,
    "preview": "//\n// Created by ketian on 16-9-23.\n//\n\n#ifndef JNI_SILK_H\n#define JNI_SILK_H\n\n#include <android/log.h>\n#include <stdio."
  },
  {
    "path": "app/jni/libmp3lame/VbrTag.c",
    "chars": 31722,
    "preview": "/*\n *      Xing VBR tagging for LAME.\n *\n *      Copyright (c) 1999 A.L. Faber\n *      Copyright (c) 2001 Jonathan Dee\n "
  },
  {
    "path": "app/jni/libmp3lame/VbrTag.h",
    "chars": 2929,
    "preview": "/*\n *      Xing VBR tagging for LAME.\n *\n *      Copyright (c) 1999 A.L. Faber\n *\n * This library is free software; you "
  },
  {
    "path": "app/jni/libmp3lame/bitstream.c",
    "chars": 36204,
    "preview": "/*\n *      MP3 bitstream Output interface for LAME\n *\n *      Copyright (c) 1999-2000 Mark Taylor\n *      Copyright (c) "
  },
  {
    "path": "app/jni/libmp3lame/bitstream.h",
    "chars": 1563,
    "preview": "/*\n *\tMP3 bitstream Output interface for LAME\n *\n *\tCopyright (c) 1999 Takehiro TOMINAGA\n *\n * This library is free soft"
  },
  {
    "path": "app/jni/libmp3lame/encoder.c",
    "chars": 18096,
    "preview": "/*\n *      LAME MP3 encoding engine\n *\n *      Copyright (c) 1999 Mark Taylor\n *      Copyright (c) 2000-2002 Takehiro T"
  },
  {
    "path": "app/jni/libmp3lame/encoder.h",
    "chars": 4096,
    "preview": "/*\n *      encoder.h include file\n *\n *      Copyright (c) 2000 Mark Taylor\n *\n * This library is free software; you can"
  },
  {
    "path": "app/jni/libmp3lame/fft.c",
    "chars": 9759,
    "preview": "/*\n** FFT and FHT routines\n**  Copyright 1988, 1993; Ron Mayer\n**      Copyright (c) 1999-2000 Takehiro Tominaga\n**\n**  "
  },
  {
    "path": "app/jni/libmp3lame/fft.h",
    "chars": 1227,
    "preview": "/*\n *\tFast Fourier Transform include file\n *\n *\tCopyright (c) 2000 Mark Taylor\n *\n * This library is free software; you "
  },
  {
    "path": "app/jni/libmp3lame/gain_analysis.c",
    "chars": 19507,
    "preview": "/*\n *  ReplayGainAnalysis - analyzes input samples and give the recommended dB change\n *  Copyright (C) 2001 David Robin"
  },
  {
    "path": "app/jni/libmp3lame/gain_analysis.h",
    "chars": 4202,
    "preview": "/*\n *  ReplayGainAnalysis - analyzes input samples and give the recommended dB change\n *  Copyright (C) 2001 David Robin"
  },
  {
    "path": "app/jni/libmp3lame/id3tag.c",
    "chars": 51773,
    "preview": "/*\n * id3tag.c -- Write ID3 version 1 and 2 tags.\n *\n * Copyright (C) 2000 Don Melton\n * Copyright (C) 2011-2012 Robert "
  },
  {
    "path": "app/jni/libmp3lame/id3tag.h",
    "chars": 1714,
    "preview": "\n#ifndef LAME_ID3_H\n#define LAME_ID3_H\n\n\n#define CHANGED_FLAG    (1U << 0)\n#define ADD_V2_FLAG     (1U << 1)\n#define V1_"
  },
  {
    "path": "app/jni/libmp3lame/l3side.h",
    "chars": 2414,
    "preview": "/*\n *\tLayer 3 side include file\n *\n *\tCopyright (c) 1999 Mark Taylor\n *\n * This library is free software; you can redist"
  },
  {
    "path": "app/jni/libmp3lame/lame-analysis.h",
    "chars": 3077,
    "preview": "/*\n *      GTK plotting routines source file\n *\n *      Copyright (c) 1999 Mark Taylor\n *\n * This library is free softwa"
  },
  {
    "path": "app/jni/libmp3lame/lame.c",
    "chars": 82637,
    "preview": "/* -*- mode: C; mode: fold -*- */\n/*\n *      LAME MP3 encoding engine\n *\n *      Copyright (c) 1999-2000 Mark Taylor\n * "
  },
  {
    "path": "app/jni/libmp3lame/lame_global_flags.h",
    "chars": 8165,
    "preview": "#ifndef LAME_GLOBAL_FLAGS_H\n#define LAME_GLOBAL_FLAGS_H\n\n#ifndef lame_internal_flags_defined\n#define lame_internal_flags"
  },
  {
    "path": "app/jni/libmp3lame/lameerror.h",
    "chars": 637,
    "preview": "/*\n *  A collection of LAME Error Codes\n *\n *  Please use the constants defined here instead of some arbitrary\n *  value"
  },
  {
    "path": "app/jni/libmp3lame/machine.h",
    "chars": 4403,
    "preview": "/*\n *      Machine dependent defines/includes for LAME.\n *\n *      Copyright (c) 1999 A.L. Faber\n *\n * This library is f"
  },
  {
    "path": "app/jni/libmp3lame/mpglib_interface.c",
    "chars": 13828,
    "preview": "/* -*- mode: C; mode: fold -*- */\n/*\n *      LAME MP3 encoding engine\n *\n *      Copyright (c) 1999-2000 Mark Taylor\n * "
  },
  {
    "path": "app/jni/libmp3lame/newmdct.c",
    "chars": 37165,
    "preview": "/*\n *      MP3 window subband -> subband filtering -> mdct routine\n *\n *      Copyright (c) 1999-2000 Takehiro Tominaga\n"
  },
  {
    "path": "app/jni/libmp3lame/newmdct.h",
    "chars": 993,
    "preview": "/*\n *\tNew Modified DCT include file\n *\n *\tCopyright (c) 1999 Takehiro TOMINAGA\n *\n * This library is free software; you "
  },
  {
    "path": "app/jni/libmp3lame/presets.c",
    "chars": 15636,
    "preview": "/*\n * presets.c -- Apply presets\n *\n *\tCopyright (c) 2002-2008 Gabriel Bouvigne\n *\tCopyright (c) 2007-2011 Robert Hegema"
  },
  {
    "path": "app/jni/libmp3lame/psymodel.c",
    "chars": 70683,
    "preview": "/*\n *      psymodel.c\n *\n *      Copyright (c) 1999-2000 Mark Taylor\n *      Copyright (c) 2001-2002 Naoki Shibata\n *   "
  },
  {
    "path": "app/jni/libmp3lame/psymodel.h",
    "chars": 2024,
    "preview": "/*\n *\tpsymodel.h\n *\n *\tCopyright (c) 1999 Mark Taylor\n *\n * This library is free software; you can redistribute it and/o"
  },
  {
    "path": "app/jni/libmp3lame/quantize.c",
    "chars": 65835,
    "preview": "/*\n * MP3 quantization\n *\n *      Copyright (c) 1999-2000 Mark Taylor\n *      Copyright (c) 1999-2003 Takehiro Tominaga\n"
  },
  {
    "path": "app/jni/libmp3lame/quantize.h",
    "chars": 1556,
    "preview": "/*\n * MP3 quantization\n *\n * Copyright (c) 1999 Mark Taylor\n *\n * This library is free software; you can redistribute it"
  },
  {
    "path": "app/jni/libmp3lame/quantize_pvt.c",
    "chars": 34082,
    "preview": "/*\n *      quantize_pvt source file\n *\n *      Copyright (c) 1999-2002 Takehiro Tominaga\n *      Copyright (c) 2000-2012"
  },
  {
    "path": "app/jni/libmp3lame/quantize_pvt.h",
    "chars": 4263,
    "preview": "/*\n *\tquantize_pvt include file\n *\n *\tCopyright (c) 1999 Takehiro TOMINAGA\n *\n * This library is free software; you can "
  },
  {
    "path": "app/jni/libmp3lame/reservoir.c",
    "chars": 10263,
    "preview": "/*\n *      bit reservoir source file\n *\n *      Copyright (c) 1999-2000 Mark Taylor\n *\n * This library is free software;"
  },
  {
    "path": "app/jni/libmp3lame/reservoir.h",
    "chars": 1221,
    "preview": "/*\n *\tbit reservoir include file\n *\n *\tCopyright (c) 1999 Mark Taylor\n *\n * This library is free software; you can redis"
  },
  {
    "path": "app/jni/libmp3lame/set_get.c",
    "chars": 51612,
    "preview": "/* -*- mode: C; mode: fold -*- */\n/*\n * set/get functions for lame_global_flags\n *\n * Copyright (c) 2001-2005 Alexander "
  },
  {
    "path": "app/jni/libmp3lame/set_get.h",
    "chars": 2587,
    "preview": "/*\n * set_get.h -- Internal set/get definitions\n *\n * Copyright (C) 2003 Gabriel Bouvigne / Lame project\n *\n * This libr"
  },
  {
    "path": "app/jni/libmp3lame/tables.c",
    "chars": 21364,
    "preview": "/*\n *\tMPEG layer 3 tables source file\n *\n *\tCopyright (c) 1999 Albert L Faber\n *\n * This library is free software; you c"
  },
  {
    "path": "app/jni/libmp3lame/tables.h",
    "chars": 2473,
    "preview": "/*\n *\tMPEG layer 3 tables include file\n *\n *\tCopyright (c) 1999 Albert L Faber\n *\n * This library is free software; you "
  },
  {
    "path": "app/jni/libmp3lame/takehiro.c",
    "chars": 38227,
    "preview": "/*\n *\tMP3 huffman table selecting and bit counting\n *\n *\tCopyright (c) 1999-2005 Takehiro TOMINAGA\n *\tCopyright (c) 2002"
  },
  {
    "path": "app/jni/libmp3lame/util.c",
    "chars": 25641,
    "preview": "/*\n *\tlame utility library source file\n *\n *\tCopyright (c) 1999 Albert L Faber\n *\tCopyright (c) 2000-2005 Alexander Leid"
  },
  {
    "path": "app/jni/libmp3lame/util.h",
    "chars": 22031,
    "preview": "/*\n *      lame utility library include file\n *\n *      Copyright (c) 1999 Albert L Faber\n *      Copyright (c) 2008 Rob"
  },
  {
    "path": "app/jni/libmp3lame/vbrquantize.c",
    "chars": 46768,
    "preview": "/*\n *\tMP3 quantization\n *\n *\tCopyright (c) 1999-2000 Mark Taylor\n *\tCopyright (c) 2000-2012 Robert Hegemann\n *\n * This l"
  },
  {
    "path": "app/jni/libmp3lame/vbrquantize.h",
    "chars": 1072,
    "preview": "/*\n * MP3 VBR quantization\n *\n * Copyright (c) 1999 Mark Taylor\n *\n * This library is free software; you can redistribut"
  },
  {
    "path": "app/jni/libmp3lame/vector/Makefile.am",
    "chars": 1026,
    "preview": "## $Id: Makefile.am,v 1.1 2007/01/09 10:15:53 aleidinger Exp $\n\ninclude $(top_srcdir)/Makefile.am.global\n\nif WITH_XMM\nno"
  },
  {
    "path": "app/jni/libmp3lame/vector/Makefile.in",
    "chars": 16910,
    "preview": "# Makefile.in generated by automake 1.11.1 from Makefile.am.\n# @configure_input@\n\n# Copyright (C) 1994, 1995, 1996, 1997"
  },
  {
    "path": "app/jni/libmp3lame/vector/lame_intrin.h",
    "chars": 1013,
    "preview": "/*\n *      lame_intrin.h include file\n *\n *      Copyright (c) 2006 Gabriel Bouvigne\n *\n * This library is free software"
  },
  {
    "path": "app/jni/libmp3lame/vector/xmm_quantize_sub.c",
    "chars": 8146,
    "preview": "/*\n * MP3 quantization, intrinsics functions\n *\n *      Copyright (c) 2005-2006 Gabriel Bouvigne\n *\n * This library is f"
  },
  {
    "path": "app/jni/libmp3lame/version.c",
    "chars": 6885,
    "preview": "/*\n *      Version numbering for LAME.\n *\n *      Copyright (c) 1999 A.L. Faber\n *\n * This library is free software; you"
  },
  {
    "path": "app/jni/libmp3lame/version.h",
    "chars": 2306,
    "preview": "/*\n *      Version numbering for LAME.\n *\n *      Copyright (c) 1999 A.L. Faber\n *\n * This library is free software; you"
  },
  {
    "path": "app/jni/silk.c",
    "chars": 13399,
    "preview": "//\n// Created by ketian on 16-9-23.\n//\n\n#include \"silk.h\"\n\n#ifdef _WIN32\n#define _CRT_SECURE_NO_DEPRECATE    1\n#endif\n\n#"
  },
  {
    "path": "app/proguard-rules.pro",
    "chars": 686,
    "preview": "# Add project specific ProGuard rules here.\n# By default, the flags in this file are appended to flags specified\n# in /h"
  },
  {
    "path": "app/src/main/AndroidManifest.xml",
    "chars": 855,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<manifest xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    package="
  },
  {
    "path": "app/src/main/java/com/ketian/android/silkv3/App.kt",
    "chars": 189,
    "preview": "package com.ketian.android.silkv3\n\nimport android.app.Application\n\n/**\n * Created by ketian.\n */\nclass App : Application"
  },
  {
    "path": "app/src/main/java/com/ketian/android/silkv3/ExportFragment.kt",
    "chars": 458,
    "preview": "package com.ketian.android.silkv3\n\nimport android.os.Bundle\nimport androidx.fragment.app.Fragment\nimport android.view.La"
  },
  {
    "path": "app/src/main/java/com/ketian/android/silkv3/MainActivity.kt",
    "chars": 3034,
    "preview": "package com.ketian.android.silkv3\n\nimport android.Manifest\nimport android.content.pm.PackageManager\nimport android.os.Bu"
  },
  {
    "path": "app/src/main/java/com/ketian/android/silkv3/PathUtils.kt",
    "chars": 2192,
    "preview": "package com.ketian.android.silkv3\n\nimport android.content.Context\nimport android.os.Environment\nimport android.util.Log\n"
  },
  {
    "path": "app/src/main/java/com/ketian/android/silkv3/VoiceFragment.kt",
    "chars": 5441,
    "preview": "package com.ketian.android.silkv3\n\nimport android.content.Context\nimport android.os.AsyncTask\nimport android.os.Bundle\ni"
  }
]

// ... and 18 more files (download for full content)

About this extraction

This page contains the full source code of the ketn4391/android_silk_v3_decoder GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 218 files (2.0 MB), approximately 529.1k tokens, and a symbol index with 860 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!