├── Amr2Mp3.iml
├── AmrToMp3.iml
├── README.md
├── XwzsAndroid.iml
├── amrconvert
├── .gitignore
├── amrconvert.iml
├── build.gradle
├── libs
│ ├── arm64-v8a
│ │ └── libamrconvert.so
│ ├── armeabi-v7a
│ │ └── libamrconvert.so
│ ├── armeabi
│ │ └── libamrconvert.so
│ └── x86
│ │ └── libamrconvert.so
├── proguard-rules.pro
└── src
│ └── main
│ ├── AndroidManifest.xml
│ ├── java
│ └── com
│ │ └── weicheng
│ │ └── amrconvert
│ │ └── AmrConvertUtils.java
│ └── res
│ └── values
│ └── strings.xml
├── app
├── .gitignore
├── app.iml
├── build.gradle
├── proguard-rules.pro
└── src
│ └── main
│ ├── AndroidManifest.xml
│ ├── java
│ └── com
│ │ └── weicheng
│ │ └── test
│ │ └── MainActivity.java
│ └── res
│ ├── drawable-v24
│ └── ic_launcher_foreground.xml
│ ├── drawable
│ └── ic_launcher_background.xml
│ ├── layout
│ └── activity_main.xml
│ ├── mipmap-anydpi-v26
│ ├── ic_launcher.xml
│ └── ic_launcher_round.xml
│ ├── mipmap-hdpi
│ ├── ic_launcher.png
│ └── ic_launcher_round.png
│ ├── mipmap-mdpi
│ ├── ic_launcher.png
│ └── ic_launcher_round.png
│ ├── mipmap-xhdpi
│ ├── ic_launcher.png
│ └── ic_launcher_round.png
│ ├── mipmap-xxhdpi
│ ├── ic_launcher.png
│ └── ic_launcher_round.png
│ ├── mipmap-xxxhdpi
│ ├── ic_launcher.png
│ └── ic_launcher_round.png
│ ├── values
│ ├── colors.xml
│ ├── strings.xml
│ └── styles.xml
│ └── xml
│ └── authenticator.xml
├── build.gradle
├── gradle.properties
├── gradle
└── wrapper
│ └── gradle-wrapper.properties
├── jni
├── Android.mk
├── Application.mk
├── CMakeLists.txt
├── 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
├── keystore
├── ceshi.jks
└── xwzs_prod.jks
├── local.properties
├── settings.gradle
└── testfile
├── 1.amr
├── 1.mp3
└── t2.pcm
/Amr2Mp3.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/AmrToMp3.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | jni用jdk 1.6,ndk版本是19或者17
2 | 进入jni目录执行ndk-build命令
3 |
4 |
5 |
6 | 1.使用lame和silk开源代码在silk转换成mp3时候,微信中在silk文件头添加0x02
7 |
8 |
9 |
10 | 2.使用mad和silk开源代码在mp3转换成silk时候,这里要
11 |
12 | 2.1.使用https://github.com/zhangchenghai2015/silk-v3-decoder/tree/master/silk/test中的Encoder.c中
13 |
14 | 转换成pcm,
15 |
16 | 2.2.然后再用mad库使用https://blog.csdn.net/gepanqiang3020/article/details/73695483实例代码,libmad库代码
17 |
18 | 链接:http://www.linuxfromscratch.org/blfs/view/svn/multimedia/libmad.html
19 |
20 | 2.3.要把android.mk中的silk 的encode对应的文件都去掉注释
21 |
22 | 2.4.把libmad中的调用的mad的api放到include中
23 |
24 | 微信号:zch-qiuye 如有不明可以加我微信,浏览后请给个star,谢谢
25 |
--------------------------------------------------------------------------------
/XwzsAndroid.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/amrconvert/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/amrconvert/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 |
3 | android {
4 | compileSdkVersion 28
5 |
6 |
7 |
8 | defaultConfig {
9 | minSdkVersion 18
10 | targetSdkVersion 28
11 | versionCode 1
12 | versionName "1.0"
13 | ndk {
14 | //选择对应cpu类型的.so库。
15 | abiFilters 'armeabi', 'armeabi-v7a', 'x86'
16 | }
17 | }
18 |
19 | buildTypes {
20 | release {
21 | minifyEnabled false
22 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
23 | }
24 | }
25 | sourceSets {
26 | main {
27 | jniLibs.srcDirs = ['libs']
28 | }
29 | }
30 |
31 | }
32 |
33 | repositories {
34 | flatDir {
35 | dirs 'libs' //this way we can find the .aar file in libs folder
36 | }
37 | }
38 |
39 | dependencies {
40 | implementation fileTree(dir: 'libs', include: ['*.jar'])
41 | }
42 |
--------------------------------------------------------------------------------
/amrconvert/libs/arm64-v8a/libamrconvert.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhangchenghai2015/weixin_silk_2_mp3/31e4c642c13d8dd8ba070b1b20c0855afa67c477/amrconvert/libs/arm64-v8a/libamrconvert.so
--------------------------------------------------------------------------------
/amrconvert/libs/armeabi-v7a/libamrconvert.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhangchenghai2015/weixin_silk_2_mp3/31e4c642c13d8dd8ba070b1b20c0855afa67c477/amrconvert/libs/armeabi-v7a/libamrconvert.so
--------------------------------------------------------------------------------
/amrconvert/libs/armeabi/libamrconvert.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhangchenghai2015/weixin_silk_2_mp3/31e4c642c13d8dd8ba070b1b20c0855afa67c477/amrconvert/libs/armeabi/libamrconvert.so
--------------------------------------------------------------------------------
/amrconvert/libs/x86/libamrconvert.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhangchenghai2015/weixin_silk_2_mp3/31e4c642c13d8dd8ba070b1b20c0855afa67c477/amrconvert/libs/x86/libamrconvert.so
--------------------------------------------------------------------------------
/amrconvert/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
22 |
23 | -keep class com.weicheng.amrconvert.AmrConvertUtils
24 |
--------------------------------------------------------------------------------
/amrconvert/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
--------------------------------------------------------------------------------
/amrconvert/src/main/java/com/weicheng/amrconvert/AmrConvertUtils.java:
--------------------------------------------------------------------------------
1 | package com.weicheng.amrconvert;
2 |
3 | import android.content.Context;
4 | import android.util.Log;
5 |
6 | import java.io.File;
7 |
8 | public class AmrConvertUtils {
9 | private static final String TAG = "AmrConvertUtils";
10 |
11 | static {
12 | System.loadLibrary("amrconvert");
13 | }
14 |
15 | /**
16 | *
17 | * @param src amr的绝对路径
18 | * @param dest mp3的绝对路经
19 | * @param tmp pcm的绝对路径
20 | * @return -1是失败,0是成功
21 | */
22 | private static native int amr2Mp3(String src, String dest, String tmp);
23 |
24 | /**
25 | *
26 | * @param src mp3的绝对路经
27 | * @param dest amr的绝对路径
28 | * @param tmp pcm的绝对路径
29 | * @return -1是失败,0是成功
30 | */
31 | private static native int mp32Amr(String src, String dest, String tmp);
32 |
33 | /**
34 | *
35 | * @param context 上下文对象
36 | * @param src amr的绝对路径
37 | * @param dest mp3的绝对路径
38 | * @return -1是失败,0是成功
39 | */
40 |
41 | private static native int mp32MultAmr(String src, String dest, String tmp);
42 |
43 | /**
44 | *
45 | * @param context 上下文对象
46 | * @param src amr的绝对路径
47 | * @param dest mp3的绝对路径
48 | * @return -1是失败,0是成功
49 | */
50 |
51 | public static boolean amr2Mp3(Context context, String src, String dest) {
52 |
53 | String tmp = "/data/data/" + context.getPackageName() + File.separator + "t.t";
54 | File f = new File(tmp);
55 | if(!f.exists()) {
56 | try {
57 | f.createNewFile();
58 | } catch (Exception e) {
59 | Log.v(TAG, "createNewFile mp32Amr :" + e.toString());
60 | return false;
61 | }
62 | }
63 | if (f.exists()) {
64 | int ret = amr2Mp3(src, dest, tmp);
65 | f.delete();
66 | return ret == 0;
67 | }
68 |
69 | return false;
70 | }
71 |
72 | /**
73 | *
74 | * @param context 上下文对象
75 | * @param src mp3的绝对路径
76 | * @param dest amr的绝对路径
77 | * @return -1是失败,0是成功
78 | */
79 |
80 | public static boolean mp32Amr(Context context, String src, String dest) {
81 | String tmp = "/data/data/" + context.getPackageName() + File.separator + "t1.t";
82 | File f = new File(tmp);
83 | if(!f.exists()) {
84 | try {
85 | f.createNewFile();
86 | } catch (Exception e) {
87 | Log.v(TAG, "createNewFile mp32Amr :" + e.toString());
88 | return false;
89 | }
90 | }
91 | if (f.exists()) {
92 | int ret = mp32Amr(src, dest, tmp);
93 | f.delete();
94 | return ret == 0;
95 | }
96 | return false;
97 | }
98 |
99 | public static boolean mp32MultAmr(Context context, String src, String dest) {
100 | String tmp = "/data/data/" + context.getPackageName() + File.separator + "t0.pcm";
101 | File f = new File(tmp);
102 | if(!f.exists()) {
103 | try {
104 | f.createNewFile();
105 | } catch (Exception e) {
106 | Log.v(TAG, "createNewFile mp32MultAmr :" + e.toString());
107 | return false;
108 | }
109 | }
110 | if (f.exists()) {
111 | int ret = mp32MultAmr(src, dest, tmp);
112 | //f.delete();
113 | return ret == 0;
114 | }
115 | return false;
116 | }
117 | }
118 |
--------------------------------------------------------------------------------
/amrconvert/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | amrconvert
3 |
4 |
--------------------------------------------------------------------------------
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 | android {
3 | compileSdkVersion 27
4 | defaultConfig {
5 | applicationId "com.weicheng.test"
6 | minSdkVersion 18
7 | targetSdkVersion 27
8 | versionCode 1
9 | versionName "1.1.3"
10 | multiDexEnabled true
11 | ndk {
12 | //选择对应cpu类型的.so库。
13 | abiFilters 'armeabi', 'armeabi-v7a', 'x86'
14 | }
15 | }
16 |
17 | signingConfigs {
18 | release {
19 | storeFile file('../keystore/xwzs_prod.jks')
20 | storePassword 'xwzs2018'
21 | keyAlias 'xwzs_prod'
22 | keyPassword 'xwzs2018'
23 | }
24 | debug {
25 | storeFile file('../keystore/ceshi.jks')
26 | storePassword '111111'
27 | keyAlias 'key0'
28 | keyPassword '111111'
29 | }
30 | }
31 | buildTypes {
32 | release {
33 | signingConfig signingConfigs.release
34 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
35 | buildConfigField 'String', 'BASE_URL', BASE_URL_FORMAL
36 | }
37 | debug {
38 | signingConfig signingConfigs.debug
39 | buildConfigField 'String', 'BASE_URL', BASE_URL_TEST
40 | }
41 | }
42 | lintOptions {
43 | abortOnError false
44 | }
45 | sourceSets {
46 | main {
47 | jniLibs.srcDirs = ['libs']
48 | }
49 | }
50 | }
51 | repositories {
52 | flatDir {
53 | dirs 'libs' //this way we can find the .aar file in libs folder
54 | }
55 | }
56 |
57 |
58 |
59 | dependencies {
60 | implementation fileTree(include: ['*.jar'], dir: 'libs')
61 | implementation 'com.android.support:appcompat-v7:27.1.1'
62 | api project(':amrconvert')
63 | }
64 | def SDK_NAME = "AmrConvert"; //sdk的名字
65 | def SDK_VERSION = "_V1.0"; //版本
66 | def sdkDestinationPath = "build";
67 | def zipFile = file('build/intermediates/bundles/release/classes.jar')//注意这里的release可能是debug或者是default
68 |
69 | task deleteBuild(type: Delete) {
70 | //最终生成的jar的名字
71 | delete sdkDestinationPath + SDK_NAME + SDK_VERSION + ".jar"
72 | }
73 |
74 | task makeJar(type: Jar) {
75 | from zipTree(zipFile)
76 | from fileTree(dir: 'src/main',includes: ['assets/**'])
77 | baseName = SDK_NAME + SDK_VERSION
78 | destinationDir = file(sdkDestinationPath)
79 | }
80 |
81 | makeJar.dependsOn(deleteBuild, build)
82 |
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 |
9 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v24/ic_launcher_foreground.xml:
--------------------------------------------------------------------------------
1 |
7 |
12 |
13 |
19 |
22 |
25 |
26 |
27 |
28 |
34 |
35 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhangchenghai2015/weixin_silk_2_mp3/31e4c642c13d8dd8ba070b1b20c0855afa67c477/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhangchenghai2015/weixin_silk_2_mp3/31e4c642c13d8dd8ba070b1b20c0855afa67c477/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhangchenghai2015/weixin_silk_2_mp3/31e4c642c13d8dd8ba070b1b20c0855afa67c477/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhangchenghai2015/weixin_silk_2_mp3/31e4c642c13d8dd8ba070b1b20c0855afa67c477/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhangchenghai2015/weixin_silk_2_mp3/31e4c642c13d8dd8ba070b1b20c0855afa67c477/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhangchenghai2015/weixin_silk_2_mp3/31e4c642c13d8dd8ba070b1b20c0855afa67c477/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhangchenghai2015/weixin_silk_2_mp3/31e4c642c13d8dd8ba070b1b20c0855afa67c477/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhangchenghai2015/weixin_silk_2_mp3/31e4c642c13d8dd8ba070b1b20c0855afa67c477/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhangchenghai2015/weixin_silk_2_mp3/31e4c642c13d8dd8ba070b1b20c0855afa67c477/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhangchenghai2015/weixin_silk_2_mp3/31e4c642c13d8dd8ba070b1b20c0855afa67c477/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3F51B5
4 | #303F9F
5 | #FF4081
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | amr转换mp3
3 |
4 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/xml/authenticator.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 |
5 | repositories {
6 | mavenCentral()
7 | google()
8 | jcenter()
9 | }
10 | dependencies {
11 | classpath 'com.android.tools.build:gradle:3.2.0'
12 |
13 | // NOTE: Do not place your application dependencies here; they belong
14 | // in the individual module build.gradle files
15 | }
16 | }
17 |
18 | allprojects {
19 | repositories {
20 | mavenCentral()
21 | google()
22 | jcenter()
23 | }
24 | }
25 |
26 | task clean(type: Delete) {
27 | delete rootProject.buildDir
28 | }
29 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 | # IDE (e.g. Android Studio) users:
3 | # Gradle settings configured through the IDE *will override*
4 | # any settings specified in this file.
5 | # For more details on how to configure your build environment visit
6 | # http://www.gradle.org/docs/current/userguide/build_environment.html
7 | # Specifies the JVM arguments used for the daemon process.
8 | # The setting is particularly useful for tweaking memory settings.
9 | org.gradle.jvmargs=-Xmx1536m
10 | # When configured, Gradle will run in incubating parallel mode.
11 | # This option should only be used with decoupled projects. More details, visit
12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
13 | # org.gradle.parallel=true
14 | BASE_URL_FORMAL="https://xwzs.tigerschool.cn"
15 | BASE_URL_TEST="http://xwzstest.tigerschool.cn"
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Wed Oct 10 13:45:50 CST 2018
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip
7 |
--------------------------------------------------------------------------------
/jni/Android.mk:
--------------------------------------------------------------------------------
1 | LOCAL_PATH := $(call my-dir)
2 |
3 | C_INCLUDES = $(LOCAL_PATH)/include
4 | include $(CLEAR_VARS)
5 |
6 | LOCAL_MODULE := libmp3lame
7 | LOCAL_SRC_FILES := libmp3lame/bitstream.c \
8 | libmp3lame/fft.c \
9 | libmp3lame/id3tag.c \
10 | libmp3lame/mpglib_interface.c \
11 | libmp3lame/presets.c \
12 | libmp3lame/quantize.c \
13 | libmp3lame/reservoir.c \
14 | libmp3lame/tables.c \
15 | libmp3lame/util.c \
16 | libmp3lame/VbrTag.c \
17 | libmp3lame/encoder.c \
18 | libmp3lame/gain_analysis.c \
19 | libmp3lame/lame.c \
20 | libmp3lame/newmdct.c \
21 | libmp3lame/psymodel.c \
22 | libmp3lame/quantize_pvt.c \
23 | libmp3lame/set_get.c \
24 | libmp3lame/takehiro.c \
25 | libmp3lame/vbrquantize.c \
26 | libmp3lame/version.c
27 |
28 | LOCAL_C_INCLUDES += $(C_INCLUDES)
29 | include $(BUILD_STATIC_LIBRARY)
30 |
31 |
32 | # second lib, which will depend on and include the first one
33 | #
34 | include $(CLEAR_VARS)
35 |
36 | LOCAL_MODULE := libsilkx
37 | LOCAL_SRC_FILES := SKP_Silk_dec_API.c \
38 | SKP_Silk_create_init_destroy.c \
39 | SKP_Silk_decoder_set_fs.c \
40 | SKP_Silk_tables_NLSF_CB0_10.c \
41 | SKP_Silk_tables_NLSF_CB1_10.c \
42 | SKP_Silk_tables_NLSF_CB0_16.c \
43 | SKP_Silk_tables_NLSF_CB1_16.c \
44 | SKP_Silk_tables_other.c \
45 | SKP_Silk_CNG.c \
46 | SKP_Silk_NLSF2A_stable.c \
47 | SKP_Silk_NLSF2A.c \
48 | SKP_Silk_bwexpander_32.c \
49 | SKP_Silk_LSF_cos_table.c \
50 | SKP_Silk_bwexpander.c \
51 | SKP_Silk_LPC_inv_pred_gain.c \
52 | SKP_Silk_LPC_synthesis_filter.c \
53 | SKP_Silk_LPC_synthesis_order16.c \
54 | SKP_Silk_PLC.c \
55 | SKP_Silk_sum_sqr_shift.c \
56 | SKP_Silk_decode_frame.c \
57 | SKP_Silk_range_coder.c \
58 | SKP_Silk_decode_parameters.c \
59 | SKP_Silk_tables_pitch_lag.c \
60 | SKP_Silk_tables_type_offset.c \
61 | SKP_Silk_gain_quant.c \
62 | SKP_Silk_lin2log.c \
63 | SKP_Silk_NLSF_MSVQ_decode.c \
64 | SKP_Silk_NLSF_stabilize.c \
65 | SKP_Silk_sort.c \
66 | SKP_Silk_decode_pitch.c \
67 | SKP_Silk_pitch_est_tables.c \
68 | SKP_Silk_tables_LTP.c \
69 | SKP_Silk_tables_gain.c \
70 | SKP_Silk_decode_pulses.c \
71 | SKP_Silk_tables_pulses_per_block.c \
72 | SKP_Silk_code_signs.c \
73 | SKP_Silk_tables_sign.c \
74 | SKP_Silk_shell_coder.c \
75 | SKP_Silk_biquad.c \
76 | SKP_Silk_decode_core.c \
77 | SKP_Silk_MA.c \
78 | SKP_Silk_resampler.c \
79 | SKP_Silk_resampler_private_down4.c \
80 | SKP_Silk_resampler_rom.c \
81 | SKP_Silk_resampler_private_copy.c \
82 | SKP_Silk_resampler_private_down_FIR.c \
83 | SKP_Silk_resampler_private_AR2.c \
84 | SKP_Silk_resampler_down2.c \
85 | SKP_Silk_resampler_private_up2_HQ.c \
86 | SKP_Silk_resampler_private_IIR_FIR.c \
87 | SKP_Silk_resampler_private_ARMA4.c \
88 | SKP_Silk_resampler_private_up4.c \
89 | SKP_Silk_resampler_up2.c \
90 | SKP_Silk_log2lin.c \
91 | silk.c \
92 | decoder.cpp
93 |
94 |
95 | LOCAL_C_INCLUDES += $(C_INCLUDES)
96 | LOCAL_LDLIBS += -llog
97 |
98 | LOCAL_STATIC_LIBRARIES := libmp3lame
99 |
100 | include $(BUILD_SHARED_LIBRARY)
101 |
--------------------------------------------------------------------------------
/jni/Application.mk:
--------------------------------------------------------------------------------
1 | APP_ABI := armeabi-v7a x86
2 | APP_PLATFORM := android-14
3 | APP_CFLAGS += -DSTDC_HEADERS
--------------------------------------------------------------------------------
/jni/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 2.8.4)
2 | project(com.ketian.android.silkv3.jni)
3 |
4 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
5 | include_directories("/Users/tian.ke/Library/Android/sdk/android-ndk-r16b/sysroot/usr/include")
6 | include_directories("include")
7 | include_directories("libmp3lame")
8 |
9 | file(GLOB foo_sources decoder.cpp *.c *.h include/*.h libmp3lame/*.h libmp3lame/*.c)
10 |
11 | set(SOURCE_FILES ${foo_sources})
12 | add_executable(com.ketian.android.silkv3.jni ${SOURCE_FILES})
--------------------------------------------------------------------------------
/jni/SKP_Silk_LBRR_reset.c:
--------------------------------------------------------------------------------
1 | /***********************************************************************
2 | Copyright (c) 2006-2012, Skype Limited. All rights reserved.
3 | Redistribution and use in source and binary forms, with or without
4 | modification, (subject to the limitations in the disclaimer below)
5 | are permitted provided that the following conditions are met:
6 | - Redistributions of source code must retain the above copyright notice,
7 | this list of conditions and the following disclaimer.
8 | - Redistributions in binary form must reproduce the above copyright
9 | notice, this list of conditions and the following disclaimer in the
10 | documentation and/or other materials provided with the distribution.
11 | - Neither the name of Skype Limited, nor the names of specific
12 | contributors, may be used to endorse or promote products derived from
13 | this software without specific prior written permission.
14 | NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED
15 | BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
16 | CONTRIBUTORS ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
17 | BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
18 | FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
19 | COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
20 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
22 | USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
23 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | ***********************************************************************/
27 |
28 | #include "SKP_Silk_main.h"
29 |
30 | /* Resets LBRR buffer, used if packet size changes */
31 | void SKP_Silk_LBRR_reset(
32 | SKP_Silk_encoder_state *psEncC /* I/O state */
33 | )
34 | {
35 | SKP_int i;
36 |
37 | for( i = 0; i < MAX_LBRR_DELAY; i++ ) {
38 | psEncC->LBRR_buffer[ i ].usage = SKP_SILK_NO_LBRR;
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/jni/SKP_Silk_LTP_analysis_filter_FIX.c:
--------------------------------------------------------------------------------
1 | /***********************************************************************
2 | Copyright (c) 2006-2012, Skype Limited. All rights reserved.
3 | Redistribution and use in source and binary forms, with or without
4 | modification, (subject to the limitations in the disclaimer below)
5 | are permitted provided that the following conditions are met:
6 | - Redistributions of source code must retain the above copyright notice,
7 | this list of conditions and the following disclaimer.
8 | - Redistributions in binary form must reproduce the above copyright
9 | notice, this list of conditions and the following disclaimer in the
10 | documentation and/or other materials provided with the distribution.
11 | - Neither the name of Skype Limited, nor the names of specific
12 | contributors, may be used to endorse or promote products derived from
13 | this software without specific prior written permission.
14 | NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED
15 | BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
16 | CONTRIBUTORS ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
17 | BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
18 | FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
19 | COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
20 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
22 | USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
23 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | ***********************************************************************/
27 |
28 | #include "SKP_Silk_main_FIX.h"
29 |
30 | void SKP_Silk_LTP_analysis_filter_FIX(
31 | SKP_int16 *LTP_res, /* O: LTP residual signal of length NB_SUBFR * ( pre_length + subfr_length ) */
32 | const SKP_int16 *x, /* I: Pointer to input signal with at least max( pitchL ) preceeding samples */
33 | const SKP_int16 LTPCoef_Q14[ LTP_ORDER * NB_SUBFR ],/* I: LTP_ORDER LTP coefficients for each NB_SUBFR subframe */
34 | const SKP_int pitchL[ NB_SUBFR ], /* I: Pitch lag, one for each subframe */
35 | const SKP_int32 invGains_Q16[ NB_SUBFR ], /* I: Inverse quantization gains, one for each subframe */
36 | const SKP_int subfr_length, /* I: Length of each subframe */
37 | const SKP_int pre_length /* I: Length of the preceeding samples starting at &x[0] for each subframe */
38 | )
39 | {
40 | const SKP_int16 *x_ptr, *x_lag_ptr;
41 | SKP_int16 Btmp_Q14[ LTP_ORDER ];
42 | SKP_int16 *LTP_res_ptr;
43 | SKP_int k, i, j;
44 | SKP_int32 LTP_est;
45 |
46 | x_ptr = x;
47 | LTP_res_ptr = LTP_res;
48 | for( k = 0; k < NB_SUBFR; k++ ) {
49 |
50 | x_lag_ptr = x_ptr - pitchL[ k ];
51 | for( i = 0; i < LTP_ORDER; i++ ) {
52 | Btmp_Q14[ i ] = LTPCoef_Q14[ k * LTP_ORDER + i ];
53 | }
54 |
55 | /* LTP analysis FIR filter */
56 | for( i = 0; i < subfr_length + pre_length; i++ ) {
57 | LTP_res_ptr[ i ] = x_ptr[ i ];
58 |
59 | /* Long-term prediction */
60 | LTP_est = SKP_SMULBB( x_lag_ptr[ LTP_ORDER / 2 ], Btmp_Q14[ 0 ] );
61 | for( j = 1; j < LTP_ORDER; j++ ) {
62 | LTP_est = SKP_SMLABB_ovflw( LTP_est, x_lag_ptr[ LTP_ORDER / 2 - j ], Btmp_Q14[ j ] );
63 | }
64 | LTP_est = SKP_RSHIFT_ROUND( LTP_est, 14 ); // round and -> Q0
65 |
66 | /* Subtract long-term prediction */
67 | LTP_res_ptr[ i ] = ( SKP_int16 )SKP_SAT16( ( SKP_int32 )x_ptr[ i ] - LTP_est );
68 |
69 | /* Scale residual */
70 | LTP_res_ptr[ i ] = SKP_SMULWB( invGains_Q16[ k ], LTP_res_ptr[ i ] );
71 |
72 | x_lag_ptr++;
73 | }
74 |
75 | /* Update pointers */
76 | LTP_res_ptr += subfr_length + pre_length;
77 | x_ptr += subfr_length;
78 | }
79 | }
80 |
81 |
--------------------------------------------------------------------------------
/jni/SKP_Silk_LTP_scale_ctrl_FIX.c:
--------------------------------------------------------------------------------
1 | /***********************************************************************
2 | Copyright (c) 2006-2012, Skype Limited. All rights reserved.
3 | Redistribution and use in source and binary forms, with or without
4 | modification, (subject to the limitations in the disclaimer below)
5 | are permitted provided that the following conditions are met:
6 | - Redistributions of source code must retain the above copyright notice,
7 | this list of conditions and the following disclaimer.
8 | - Redistributions in binary form must reproduce the above copyright
9 | notice, this list of conditions and the following disclaimer in the
10 | documentation and/or other materials provided with the distribution.
11 | - Neither the name of Skype Limited, nor the names of specific
12 | contributors, may be used to endorse or promote products derived from
13 | this software without specific prior written permission.
14 | NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED
15 | BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
16 | CONTRIBUTORS ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
17 | BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
18 | FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
19 | COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
20 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
22 | USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
23 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | ***********************************************************************/
27 |
28 | #include "SKP_Silk_main_FIX.h"
29 |
30 | #define NB_THRESHOLDS 11
31 |
32 | /* Table containing trained thresholds for LTP scaling */
33 | static const SKP_int16 LTPScaleThresholds_Q15[ NB_THRESHOLDS ] =
34 | {
35 | 31129, 26214, 16384, 13107, 9830, 6554,
36 | 4915, 3276, 2621, 2458, 0
37 | };
38 |
39 | void SKP_Silk_LTP_scale_ctrl_FIX(
40 | SKP_Silk_encoder_state_FIX *psEnc, /* I/O encoder state FIX */
41 | SKP_Silk_encoder_control_FIX *psEncCtrl /* I/O encoder control FIX */
42 | )
43 | {
44 | SKP_int round_loss, frames_per_packet;
45 | SKP_int g_out_Q5, g_limit_Q15, thrld1_Q15, thrld2_Q15;
46 |
47 | /* 1st order high-pass filter */
48 | psEnc->HPLTPredCodGain_Q7 = SKP_max_int( psEncCtrl->LTPredCodGain_Q7 - psEnc->prevLTPredCodGain_Q7, 0 )
49 | + SKP_RSHIFT_ROUND( psEnc->HPLTPredCodGain_Q7, 1 );
50 |
51 | psEnc->prevLTPredCodGain_Q7 = psEncCtrl->LTPredCodGain_Q7;
52 |
53 | /* combine input and filtered input */
54 | g_out_Q5 = SKP_RSHIFT_ROUND( SKP_RSHIFT( psEncCtrl->LTPredCodGain_Q7, 1 ) + SKP_RSHIFT( psEnc->HPLTPredCodGain_Q7, 1 ), 3 );
55 | g_limit_Q15 = SKP_Silk_sigm_Q15( g_out_Q5 - ( 3 << 5 ) );
56 |
57 | /* Default is minimum scaling */
58 | psEncCtrl->sCmn.LTP_scaleIndex = 0;
59 |
60 | /* Round the loss measure to whole pct */
61 | round_loss = ( SKP_int )psEnc->sCmn.PacketLoss_perc;
62 |
63 | /* Only scale if first frame in packet 0% */
64 | if( psEnc->sCmn.nFramesInPayloadBuf == 0 ) {
65 |
66 | frames_per_packet = SKP_DIV32_16( psEnc->sCmn.PacketSize_ms, FRAME_LENGTH_MS );
67 |
68 | round_loss += frames_per_packet - 1;
69 | thrld1_Q15 = LTPScaleThresholds_Q15[ SKP_min_int( round_loss, NB_THRESHOLDS - 1 ) ];
70 | thrld2_Q15 = LTPScaleThresholds_Q15[ SKP_min_int( round_loss + 1, NB_THRESHOLDS - 1 ) ];
71 |
72 | if( g_limit_Q15 > thrld1_Q15 ) {
73 | /* Maximum scaling */
74 | psEncCtrl->sCmn.LTP_scaleIndex = 2;
75 | } else if( g_limit_Q15 > thrld2_Q15 ) {
76 | /* Medium scaling */
77 | psEncCtrl->sCmn.LTP_scaleIndex = 1;
78 | }
79 | }
80 | psEncCtrl->LTP_scale_Q14 = SKP_Silk_LTPScales_table_Q14[ psEncCtrl->sCmn.LTP_scaleIndex ];
81 | }
82 |
--------------------------------------------------------------------------------
/jni/SKP_Silk_NLSF2A_stable.c:
--------------------------------------------------------------------------------
1 | /***********************************************************************
2 | Copyright (c) 2006-2012, Skype Limited. All rights reserved.
3 | Redistribution and use in source and binary forms, with or without
4 | modification, (subject to the limitations in the disclaimer below)
5 | are permitted provided that the following conditions are met:
6 | - Redistributions of source code must retain the above copyright notice,
7 | this list of conditions and the following disclaimer.
8 | - Redistributions in binary form must reproduce the above copyright
9 | notice, this list of conditions and the following disclaimer in the
10 | documentation and/or other materials provided with the distribution.
11 | - Neither the name of Skype Limited, nor the names of specific
12 | contributors, may be used to endorse or promote products derived from
13 | this software without specific prior written permission.
14 | NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED
15 | BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
16 | CONTRIBUTORS ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
17 | BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
18 | FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
19 | COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
20 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
22 | USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
23 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | ***********************************************************************/
27 |
28 | #include "SKP_Silk_main.h"
29 |
30 | /* Convert NLSF parameters to stable AR prediction filter coefficients */
31 | void SKP_Silk_NLSF2A_stable(
32 | SKP_int16 pAR_Q12[ MAX_LPC_ORDER ], /* O Stabilized AR coefs [LPC_order] */
33 | const SKP_int pNLSF[ MAX_LPC_ORDER ], /* I NLSF vector [LPC_order] */
34 | const SKP_int LPC_order /* I LPC/LSF order */
35 | )
36 | {
37 | SKP_int i;
38 | SKP_int32 invGain_Q30;
39 |
40 | SKP_Silk_NLSF2A( pAR_Q12, pNLSF, LPC_order );
41 |
42 | /* Ensure stable LPCs */
43 | for( i = 0; i < MAX_LPC_STABILIZE_ITERATIONS; i++ ) {
44 | if( SKP_Silk_LPC_inverse_pred_gain( &invGain_Q30, pAR_Q12, LPC_order ) == 1 ) {
45 | SKP_Silk_bwexpander( pAR_Q12, LPC_order, 65536 - SKP_SMULBB( 10 + i, i ) ); /* 10_Q16 = 0.00015 */
46 | } else {
47 | break;
48 | }
49 | }
50 |
51 | /* Reached the last iteration */
52 | if( i == MAX_LPC_STABILIZE_ITERATIONS ) {
53 | SKP_assert( 0 );
54 | for( i = 0; i < LPC_order; i++ ) {
55 | pAR_Q12[ i ] = 0;
56 | }
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/jni/SKP_Silk_NLSF_VQ_rate_distortion_FIX.c:
--------------------------------------------------------------------------------
1 | /***********************************************************************
2 | Copyright (c) 2006-2012, Skype Limited. All rights reserved.
3 | Redistribution and use in source and binary forms, with or without
4 | modification, (subject to the limitations in the disclaimer below)
5 | are permitted provided that the following conditions are met:
6 | - Redistributions of source code must retain the above copyright notice,
7 | this list of conditions and the following disclaimer.
8 | - Redistributions in binary form must reproduce the above copyright
9 | notice, this list of conditions and the following disclaimer in the
10 | documentation and/or other materials provided with the distribution.
11 | - Neither the name of Skype Limited, nor the names of specific
12 | contributors, may be used to endorse or promote products derived from
13 | this software without specific prior written permission.
14 | NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED
15 | BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
16 | CONTRIBUTORS ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
17 | BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
18 | FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
19 | COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
20 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
22 | USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
23 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | ***********************************************************************/
27 |
28 | #include "SKP_Silk_main_FIX.h"
29 |
30 | /* Rate-Distortion calculations for multiple input data vectors */
31 | void SKP_Silk_NLSF_VQ_rate_distortion_FIX(
32 | SKP_int32 *pRD_Q20, /* O Rate-distortion values [psNLSF_CBS->nVectors*N] */
33 | const SKP_Silk_NLSF_CBS *psNLSF_CBS, /* I NLSF codebook stage struct */
34 | const SKP_int *in_Q15, /* I Input vectors to be quantized */
35 | const SKP_int *w_Q6, /* I Weight vector */
36 | const SKP_int32 *rate_acc_Q5, /* I Accumulated rates from previous stage */
37 | const SKP_int mu_Q15, /* I Weight between weighted error and rate */
38 | const SKP_int N, /* I Number of input vectors to be quantized */
39 | const SKP_int LPC_order /* I LPC order */
40 | )
41 | {
42 | SKP_int i, n;
43 | SKP_int32 *pRD_vec_Q20;
44 |
45 | /* Compute weighted quantization errors for all input vectors over one codebook stage */
46 | SKP_Silk_NLSF_VQ_sum_error_FIX( pRD_Q20, in_Q15, w_Q6, psNLSF_CBS->CB_NLSF_Q15,
47 | N, psNLSF_CBS->nVectors, LPC_order );
48 |
49 | /* Loop over input vectors */
50 | pRD_vec_Q20 = pRD_Q20;
51 | for( n = 0; n < N; n++ ) {
52 | /* Add rate cost to error for each codebook vector */
53 | for( i = 0; i < psNLSF_CBS->nVectors; i++ ) {
54 | SKP_assert( rate_acc_Q5[ n ] + psNLSF_CBS->Rates_Q5[ i ] >= 0 );
55 | SKP_assert( rate_acc_Q5[ n ] + psNLSF_CBS->Rates_Q5[ i ] <= SKP_int16_MAX );
56 | pRD_vec_Q20[ i ] = SKP_SMLABB( pRD_vec_Q20[ i ], rate_acc_Q5[ n ] + psNLSF_CBS->Rates_Q5[ i ], mu_Q15 );
57 | SKP_assert( pRD_vec_Q20[ i ] >= 0 );
58 | }
59 | pRD_vec_Q20 += psNLSF_CBS->nVectors;
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/jni/SKP_Silk_NLSF_VQ_weights_laroia.c:
--------------------------------------------------------------------------------
1 | /***********************************************************************
2 | Copyright (c) 2006-2012, Skype Limited. All rights reserved.
3 | Redistribution and use in source and binary forms, with or without
4 | modification, (subject to the limitations in the disclaimer below)
5 | are permitted provided that the following conditions are met:
6 | - Redistributions of source code must retain the above copyright notice,
7 | this list of conditions and the following disclaimer.
8 | - Redistributions in binary form must reproduce the above copyright
9 | notice, this list of conditions and the following disclaimer in the
10 | documentation and/or other materials provided with the distribution.
11 | - Neither the name of Skype Limited, nor the names of specific
12 | contributors, may be used to endorse or promote products derived from
13 | this software without specific prior written permission.
14 | NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED
15 | BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
16 | CONTRIBUTORS ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
17 | BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
18 | FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
19 | COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
20 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
22 | USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
23 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | ***********************************************************************/
27 |
28 | #include "SKP_Silk_SigProc_FIX.h"
29 |
30 | /*
31 | R. Laroia, N. Phamdo and N. Farvardin, "Robust and Efficient Quantization of Speech LSP
32 | Parameters Using Structured Vector Quantization", Proc. IEEE Int. Conf. Acoust., Speech,
33 | Signal Processing, pp. 641-644, 1991.
34 | */
35 |
36 | #define Q_OUT 6
37 | #define MIN_NDELTA 3
38 |
39 | /* Laroia low complexity NLSF weights */
40 | void SKP_Silk_NLSF_VQ_weights_laroia(
41 | SKP_int *pNLSFW_Q6, /* O: Pointer to input vector weights [D x 1] */
42 | const SKP_int *pNLSF_Q15, /* I: Pointer to input vector [D x 1] */
43 | const SKP_int D /* I: Input vector dimension (even) */
44 | )
45 | {
46 | SKP_int k;
47 | SKP_int32 tmp1_int, tmp2_int;
48 |
49 | /* Check that we are guaranteed to end up within the required range */
50 | SKP_assert( D > 0 );
51 | SKP_assert( ( D & 1 ) == 0 );
52 |
53 | /* First value */
54 | tmp1_int = SKP_max_int( pNLSF_Q15[ 0 ], MIN_NDELTA );
55 | tmp1_int = SKP_DIV32_16( 1 << ( 15 + Q_OUT ), tmp1_int );
56 | tmp2_int = SKP_max_int( pNLSF_Q15[ 1 ] - pNLSF_Q15[ 0 ], MIN_NDELTA );
57 | tmp2_int = SKP_DIV32_16( 1 << ( 15 + Q_OUT ), tmp2_int );
58 | pNLSFW_Q6[ 0 ] = (SKP_int)SKP_min_int( tmp1_int + tmp2_int, SKP_int16_MAX );
59 | SKP_assert( pNLSFW_Q6[ 0 ] > 0 );
60 |
61 | /* Main loop */
62 | for( k = 1; k < D - 1; k += 2 ) {
63 | tmp1_int = SKP_max_int( pNLSF_Q15[ k + 1 ] - pNLSF_Q15[ k ], MIN_NDELTA );
64 | tmp1_int = SKP_DIV32_16( 1 << ( 15 + Q_OUT ), tmp1_int );
65 | pNLSFW_Q6[ k ] = (SKP_int)SKP_min_int( tmp1_int + tmp2_int, SKP_int16_MAX );
66 | SKP_assert( pNLSFW_Q6[ k ] > 0 );
67 |
68 | tmp2_int = SKP_max_int( pNLSF_Q15[ k + 2 ] - pNLSF_Q15[ k + 1 ], MIN_NDELTA );
69 | tmp2_int = SKP_DIV32_16( 1 << ( 15 + Q_OUT ), tmp2_int );
70 | pNLSFW_Q6[ k + 1 ] = (SKP_int)SKP_min_int( tmp1_int + tmp2_int, SKP_int16_MAX );
71 | SKP_assert( pNLSFW_Q6[ k + 1 ] > 0 );
72 | }
73 |
74 | /* Last value */
75 | tmp1_int = SKP_max_int( ( 1 << 15 ) - pNLSF_Q15[ D - 1 ], MIN_NDELTA );
76 | tmp1_int = SKP_DIV32_16( 1 << ( 15 + Q_OUT ), tmp1_int );
77 | pNLSFW_Q6[ D - 1 ] = (SKP_int)SKP_min_int( tmp1_int + tmp2_int, SKP_int16_MAX );
78 | SKP_assert( pNLSFW_Q6[ D - 1 ] > 0 );
79 | }
80 |
--------------------------------------------------------------------------------
/jni/SKP_Silk_array_maxabs.c:
--------------------------------------------------------------------------------
1 | /***********************************************************************
2 | Copyright (c) 2006-2012, Skype Limited. All rights reserved.
3 | Redistribution and use in source and binary forms, with or without
4 | modification, (subject to the limitations in the disclaimer below)
5 | are permitted provided that the following conditions are met:
6 | - Redistributions of source code must retain the above copyright notice,
7 | this list of conditions and the following disclaimer.
8 | - Redistributions in binary form must reproduce the above copyright
9 | notice, this list of conditions and the following disclaimer in the
10 | documentation and/or other materials provided with the distribution.
11 | - Neither the name of Skype Limited, nor the names of specific
12 | contributors, may be used to endorse or promote products derived from
13 | this software without specific prior written permission.
14 | NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED
15 | BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
16 | CONTRIBUTORS ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
17 | BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
18 | FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
19 | COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
20 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
22 | USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
23 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | ***********************************************************************/
27 |
28 | /* *
29 | * SKP_Silk_int16_array_maxabs.c *
30 | * *
31 | * Function that returns the maximum absolut value of *
32 | * the input vector *
33 | * *
34 | * Copyright 2006 (c), Skype Limited *
35 | * Date: 060221 *
36 | * */
37 | #include "SKP_Silk_SigProc_FIX.h"
38 |
39 | /* Function that returns the maximum absolut value of the input vector */
40 | #if (EMBEDDED_ARM<4)
41 | SKP_int16 SKP_Silk_int16_array_maxabs( /* O Maximum absolute value, max: 2^15-1 */
42 | const SKP_int16 *vec, /* I Input vector [len] */
43 | const SKP_int32 len /* I Length of input vector */
44 | )
45 | {
46 | SKP_int32 max = 0, i, lvl = 0, ind;
47 | if( len == 0 ) return 0;
48 |
49 | ind = len - 1;
50 | max = SKP_SMULBB( vec[ ind ], vec[ ind ] );
51 | for( i = len - 2; i >= 0; i-- ) {
52 | lvl = SKP_SMULBB( vec[ i ], vec[ i ] );
53 | if( lvl > max ) {
54 | max = lvl;
55 | ind = i;
56 | }
57 | }
58 |
59 | /* Do not return 32768, as it will not fit in an int16 so may lead to problems later on */
60 | if( max >= 1073676289 ) { // (2^15-1)^2 = 1073676289
61 | return( SKP_int16_MAX );
62 | } else {
63 | if( vec[ ind ] < 0 ) {
64 | return( -vec[ ind ] );
65 | } else {
66 | return( vec[ ind ] );
67 | }
68 | }
69 | }
70 | #endif
71 |
--------------------------------------------------------------------------------
/jni/SKP_Silk_biquad.c:
--------------------------------------------------------------------------------
1 | /***********************************************************************
2 | Copyright (c) 2006-2012, Skype Limited. All rights reserved.
3 | Redistribution and use in source and binary forms, with or without
4 | modification, (subject to the limitations in the disclaimer below)
5 | are permitted provided that the following conditions are met:
6 | - Redistributions of source code must retain the above copyright notice,
7 | this list of conditions and the following disclaimer.
8 | - Redistributions in binary form must reproduce the above copyright
9 | notice, this list of conditions and the following disclaimer in the
10 | documentation and/or other materials provided with the distribution.
11 | - Neither the name of Skype Limited, nor the names of specific
12 | contributors, may be used to endorse or promote products derived from
13 | this software without specific prior written permission.
14 | NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED
15 | BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
16 | CONTRIBUTORS ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
17 | BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
18 | FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
19 | COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
20 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
22 | USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
23 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | ***********************************************************************/
27 |
28 | /* *
29 | * SKP_Silk_biquad.c *
30 | * *
31 | * Second order ARMA filter *
32 | * Can handle slowly varying filter coefficients *
33 | * *
34 | * Copyright 2006 (c), Skype Limited *
35 | * Date: 060221 *
36 | * */
37 | #include "SKP_Silk_SigProc_FIX.h"
38 |
39 | /* Second order ARMA filter */
40 | /* Can handle slowly varying filter coefficients */
41 | void SKP_Silk_biquad(
42 | const SKP_int16 *in, /* I: input signal */
43 | const SKP_int16 *B, /* I: MA coefficients, Q13 [3] */
44 | const SKP_int16 *A, /* I: AR coefficients, Q13 [2] */
45 | SKP_int32 *S, /* I/O: state vector [2] */
46 | SKP_int16 *out, /* O: output signal */
47 | const SKP_int32 len /* I: signal length */
48 | )
49 | {
50 | SKP_int k, in16;
51 | SKP_int32 A0_neg, A1_neg, S0, S1, out32, tmp32;
52 |
53 | S0 = S[ 0 ];
54 | S1 = S[ 1 ];
55 | A0_neg = -A[ 0 ];
56 | A1_neg = -A[ 1 ];
57 | for( k = 0; k < len; k++ ) {
58 | /* S[ 0 ], S[ 1 ]: Q13 */
59 | in16 = in[ k ];
60 | out32 = SKP_SMLABB( S0, in16, B[ 0 ] );
61 |
62 | S0 = SKP_SMLABB( S1, in16, B[ 1 ] );
63 | S0 += SKP_LSHIFT( SKP_SMULWB( out32, A0_neg ), 3 );
64 |
65 | S1 = SKP_LSHIFT( SKP_SMULWB( out32, A1_neg ), 3 );
66 | S1 = SKP_SMLABB( S1, in16, B[ 2 ] );
67 | tmp32 = SKP_RSHIFT_ROUND( out32, 13 ) + 1;
68 | out[ k ] = (SKP_int16)SKP_SAT16( tmp32 );
69 | }
70 | S[ 0 ] = S0;
71 | S[ 1 ] = S1;
72 | }
73 |
--------------------------------------------------------------------------------
/jni/SKP_Silk_biquad_alt.c:
--------------------------------------------------------------------------------
1 | /***********************************************************************
2 | Copyright (c) 2006-2012, Skype Limited. All rights reserved.
3 | Redistribution and use in source and binary forms, with or without
4 | modification, (subject to the limitations in the disclaimer below)
5 | are permitted provided that the following conditions are met:
6 | - Redistributions of source code must retain the above copyright notice,
7 | this list of conditions and the following disclaimer.
8 | - Redistributions in binary form must reproduce the above copyright
9 | notice, this list of conditions and the following disclaimer in the
10 | documentation and/or other materials provided with the distribution.
11 | - Neither the name of Skype Limited, nor the names of specific
12 | contributors, may be used to endorse or promote products derived from
13 | this software without specific prior written permission.
14 | NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED
15 | BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
16 | CONTRIBUTORS ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
17 | BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
18 | FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
19 | COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
20 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
22 | USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
23 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | ***********************************************************************/
27 |
28 | /* *
29 | * SKP_Silk_biquad_alt.c *
30 | * *
31 | * Second order ARMA filter *
32 | * Can handle slowly varying filter coefficients *
33 | * */
34 | #include "SKP_Silk_SigProc_FIX.h"
35 |
36 |
37 | /* Second order ARMA filter, alternative implementation */
38 | void SKP_Silk_biquad_alt(
39 | const SKP_int16 *in, /* I: Input signal */
40 | const SKP_int32 *B_Q28, /* I: MA coefficients [3] */
41 | const SKP_int32 *A_Q28, /* I: AR coefficients [2] */
42 | SKP_int32 *S, /* I/O: State vector [2] */
43 | SKP_int16 *out, /* O: Output signal */
44 | const SKP_int32 len /* I: Signal length (must be even) */
45 | )
46 | {
47 | /* DIRECT FORM II TRANSPOSED (uses 2 element state vector) */
48 | SKP_int k;
49 | SKP_int32 inval, A0_U_Q28, A0_L_Q28, A1_U_Q28, A1_L_Q28, out32_Q14;
50 |
51 | /* Negate A_Q28 values and split in two parts */
52 | A0_L_Q28 = ( -A_Q28[ 0 ] ) & 0x00003FFF; /* lower part */
53 | A0_U_Q28 = SKP_RSHIFT( -A_Q28[ 0 ], 14 ); /* upper part */
54 | A1_L_Q28 = ( -A_Q28[ 1 ] ) & 0x00003FFF; /* lower part */
55 | A1_U_Q28 = SKP_RSHIFT( -A_Q28[ 1 ], 14 ); /* upper part */
56 |
57 | for( k = 0; k < len; k++ ) {
58 | /* S[ 0 ], S[ 1 ]: Q12 */
59 | inval = in[ k ];
60 | out32_Q14 = SKP_LSHIFT( SKP_SMLAWB( S[ 0 ], B_Q28[ 0 ], inval ), 2 );
61 |
62 | S[ 0 ] = S[1] + SKP_RSHIFT_ROUND( SKP_SMULWB( out32_Q14, A0_L_Q28 ), 14 );
63 | S[ 0 ] = SKP_SMLAWB( S[ 0 ], out32_Q14, A0_U_Q28 );
64 | S[ 0 ] = SKP_SMLAWB( S[ 0 ], B_Q28[ 1 ], inval);
65 |
66 | S[ 1 ] = SKP_RSHIFT_ROUND( SKP_SMULWB( out32_Q14, A1_L_Q28 ), 14 );
67 | S[ 1 ] = SKP_SMLAWB( S[ 1 ], out32_Q14, A1_U_Q28 );
68 | S[ 1 ] = SKP_SMLAWB( S[ 1 ], B_Q28[ 2 ], inval );
69 |
70 | /* Scale back to Q0 and saturate */
71 | out[ k ] = (SKP_int16)SKP_SAT16( SKP_RSHIFT( out32_Q14 + (1<<14) - 1, 14 ) );
72 | }
73 | }
74 |
--------------------------------------------------------------------------------
/jni/SKP_Silk_bwexpander.c:
--------------------------------------------------------------------------------
1 | /***********************************************************************
2 | Copyright (c) 2006-2012, Skype Limited. All rights reserved.
3 | Redistribution and use in source and binary forms, with or without
4 | modification, (subject to the limitations in the disclaimer below)
5 | are permitted provided that the following conditions are met:
6 | - Redistributions of source code must retain the above copyright notice,
7 | this list of conditions and the following disclaimer.
8 | - Redistributions in binary form must reproduce the above copyright
9 | notice, this list of conditions and the following disclaimer in the
10 | documentation and/or other materials provided with the distribution.
11 | - Neither the name of Skype Limited, nor the names of specific
12 | contributors, may be used to endorse or promote products derived from
13 | this software without specific prior written permission.
14 | NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED
15 | BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
16 | CONTRIBUTORS ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
17 | BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
18 | FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
19 | COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
20 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
22 | USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
23 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | ***********************************************************************/
27 |
28 | #include "SKP_Silk_SigProc_FIX.h"
29 |
30 | /* Chirp (bandwidth expand) LP AR filter */
31 | void SKP_Silk_bwexpander(
32 | SKP_int16 *ar, /* I/O AR filter to be expanded (without leading 1) */
33 | const SKP_int d, /* I Length of ar */
34 | SKP_int32 chirp_Q16 /* I Chirp factor (typically in the range 0 to 1) */
35 | )
36 | {
37 | SKP_int i;
38 | SKP_int32 chirp_minus_one_Q16;
39 |
40 | chirp_minus_one_Q16 = chirp_Q16 - 65536;
41 |
42 | /* NB: Dont use SKP_SMULWB, instead of SKP_RSHIFT_ROUND( SKP_MUL() , 16 ), below. */
43 | /* Bias in SKP_SMULWB can lead to unstable filters */
44 | for( i = 0; i < d - 1; i++ ) {
45 | ar[ i ] = (SKP_int16)SKP_RSHIFT_ROUND( SKP_MUL( chirp_Q16, ar[ i ] ), 16 );
46 | chirp_Q16 += SKP_RSHIFT_ROUND( SKP_MUL( chirp_Q16, chirp_minus_one_Q16 ), 16 );
47 | }
48 | ar[ d - 1 ] = (SKP_int16)SKP_RSHIFT_ROUND( SKP_MUL( chirp_Q16, ar[ d - 1 ] ), 16 );
49 | }
50 |
--------------------------------------------------------------------------------
/jni/SKP_Silk_bwexpander_32.c:
--------------------------------------------------------------------------------
1 | /***********************************************************************
2 | Copyright (c) 2006-2012, Skype Limited. All rights reserved.
3 | Redistribution and use in source and binary forms, with or without
4 | modification, (subject to the limitations in the disclaimer below)
5 | are permitted provided that the following conditions are met:
6 | - Redistributions of source code must retain the above copyright notice,
7 | this list of conditions and the following disclaimer.
8 | - Redistributions in binary form must reproduce the above copyright
9 | notice, this list of conditions and the following disclaimer in the
10 | documentation and/or other materials provided with the distribution.
11 | - Neither the name of Skype Limited, nor the names of specific
12 | contributors, may be used to endorse or promote products derived from
13 | this software without specific prior written permission.
14 | NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED
15 | BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
16 | CONTRIBUTORS ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
17 | BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
18 | FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
19 | COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
20 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
22 | USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
23 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | ***********************************************************************/
27 |
28 | #include "SKP_Silk_SigProc_FIX.h"
29 |
30 | /* Chirp (bandwidth expand) LP AR filter */
31 | void SKP_Silk_bwexpander_32(
32 | SKP_int32 *ar, /* I/O AR filter to be expanded (without leading 1) */
33 | const SKP_int d, /* I Length of ar */
34 | SKP_int32 chirp_Q16 /* I Chirp factor in Q16 */
35 | )
36 | {
37 | SKP_int i;
38 | SKP_int32 tmp_chirp_Q16;
39 |
40 | tmp_chirp_Q16 = chirp_Q16;
41 | for( i = 0; i < d - 1; i++ ) {
42 | ar[ i ] = SKP_SMULWW( ar[ i ], tmp_chirp_Q16 );
43 | tmp_chirp_Q16 = SKP_SMULWW( chirp_Q16, tmp_chirp_Q16 );
44 | }
45 | ar[ d - 1 ] = SKP_SMULWW( ar[ d - 1 ], tmp_chirp_Q16 );
46 | }
47 |
--------------------------------------------------------------------------------
/jni/SKP_Silk_create_init_destroy.c:
--------------------------------------------------------------------------------
1 | /***********************************************************************
2 | Copyright (c) 2006-2012, Skype Limited. All rights reserved.
3 | Redistribution and use in source and binary forms, with or without
4 | modification, (subject to the limitations in the disclaimer below)
5 | are permitted provided that the following conditions are met:
6 | - Redistributions of source code must retain the above copyright notice,
7 | this list of conditions and the following disclaimer.
8 | - Redistributions in binary form must reproduce the above copyright
9 | notice, this list of conditions and the following disclaimer in the
10 | documentation and/or other materials provided with the distribution.
11 | - Neither the name of Skype Limited, nor the names of specific
12 | contributors, may be used to endorse or promote products derived from
13 | this software without specific prior written permission.
14 | NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED
15 | BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
16 | CONTRIBUTORS ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
17 | BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
18 | FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
19 | COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
20 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
22 | USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
23 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | ***********************************************************************/
27 |
28 | #include "SKP_Silk_main.h"
29 |
30 |
31 | /************************/
32 | /* Init Decoder State */
33 | /************************/
34 | SKP_int SKP_Silk_init_decoder(
35 | SKP_Silk_decoder_state *psDec /* I/O Decoder state pointer */
36 | )
37 | {
38 | SKP_memset( psDec, 0, sizeof( SKP_Silk_decoder_state ) );
39 | /* Set sampling rate to 24 kHz, and init non-zero values */
40 | SKP_Silk_decoder_set_fs( psDec, 24 );
41 |
42 | /* Used to deactivate e.g. LSF interpolation and fluctuation reduction */
43 | psDec->first_frame_after_reset = 1;
44 | psDec->prev_inv_gain_Q16 = 65536;
45 |
46 | /* Reset CNG state */
47 | SKP_Silk_CNG_Reset( psDec );
48 |
49 | SKP_Silk_PLC_Reset( psDec );
50 |
51 | return(0);
52 | }
53 |
54 |
--------------------------------------------------------------------------------
/jni/SKP_Silk_decode_pitch.c:
--------------------------------------------------------------------------------
1 | /***********************************************************************
2 | Copyright (c) 2006-2012, Skype Limited. All rights reserved.
3 | Redistribution and use in source and binary forms, with or without
4 | modification, (subject to the limitations in the disclaimer below)
5 | are permitted provided that the following conditions are met:
6 | - Redistributions of source code must retain the above copyright notice,
7 | this list of conditions and the following disclaimer.
8 | - Redistributions in binary form must reproduce the above copyright
9 | notice, this list of conditions and the following disclaimer in the
10 | documentation and/or other materials provided with the distribution.
11 | - Neither the name of Skype Limited, nor the names of specific
12 | contributors, may be used to endorse or promote products derived from
13 | this software without specific prior written permission.
14 | NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED
15 | BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
16 | CONTRIBUTORS ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
17 | BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
18 | FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
19 | COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
20 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
22 | USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
23 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | ***********************************************************************/
27 |
28 | /***********************************************************
29 | * Pitch analyser function
30 | ********************************************************** */
31 | #include "SKP_Silk_SigProc_FIX.h"
32 | #include "SKP_Silk_common_pitch_est_defines.h"
33 |
34 | void SKP_Silk_decode_pitch(
35 | SKP_int lagIndex, /* I */
36 | SKP_int contourIndex, /* O */
37 | SKP_int pitch_lags[], /* O 4 pitch values */
38 | SKP_int Fs_kHz /* I sampling frequency (kHz) */
39 | )
40 | {
41 | SKP_int lag, i, min_lag;
42 |
43 | min_lag = SKP_SMULBB( PITCH_EST_MIN_LAG_MS, Fs_kHz );
44 |
45 | /* Only for 24 / 16 kHz version for now */
46 | lag = min_lag + lagIndex;
47 | if( Fs_kHz == 8 ) {
48 | /* Only a small codebook for 8 khz */
49 | for( i = 0; i < PITCH_EST_NB_SUBFR; i++ ) {
50 | pitch_lags[ i ] = lag + SKP_Silk_CB_lags_stage2[ i ][ contourIndex ];
51 | }
52 | } else {
53 | for( i = 0; i < PITCH_EST_NB_SUBFR; i++ ) {
54 | pitch_lags[ i ] = lag + SKP_Silk_CB_lags_stage3[ i ][ contourIndex ];
55 | }
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/jni/SKP_Silk_decoder_set_fs.c:
--------------------------------------------------------------------------------
1 | /***********************************************************************
2 | Copyright (c) 2006-2012, Skype Limited. All rights reserved.
3 | Redistribution and use in source and binary forms, with or without
4 | modification, (subject to the limitations in the disclaimer below)
5 | are permitted provided that the following conditions are met:
6 | - Redistributions of source code must retain the above copyright notice,
7 | this list of conditions and the following disclaimer.
8 | - Redistributions in binary form must reproduce the above copyright
9 | notice, this list of conditions and the following disclaimer in the
10 | documentation and/or other materials provided with the distribution.
11 | - Neither the name of Skype Limited, nor the names of specific
12 | contributors, may be used to endorse or promote products derived from
13 | this software without specific prior written permission.
14 | NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED
15 | BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
16 | CONTRIBUTORS ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
17 | BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
18 | FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
19 | COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
20 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
22 | USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
23 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | ***********************************************************************/
27 |
28 | #include "SKP_Silk_main.h"
29 |
30 | /* Set decoder sampling rate */
31 | void SKP_Silk_decoder_set_fs(
32 | SKP_Silk_decoder_state *psDec, /* I/O Decoder state pointer */
33 | SKP_int fs_kHz /* I Sampling frequency (kHz) */
34 | )
35 | {
36 | if( psDec->fs_kHz != fs_kHz ) {
37 | psDec->fs_kHz = fs_kHz;
38 | psDec->frame_length = SKP_SMULBB( FRAME_LENGTH_MS, fs_kHz );
39 | psDec->subfr_length = SKP_SMULBB( FRAME_LENGTH_MS / NB_SUBFR, fs_kHz );
40 | if( psDec->fs_kHz == 8 ) {
41 | psDec->LPC_order = MIN_LPC_ORDER;
42 | psDec->psNLSF_CB[ 0 ] = &SKP_Silk_NLSF_CB0_10;
43 | psDec->psNLSF_CB[ 1 ] = &SKP_Silk_NLSF_CB1_10;
44 | } else {
45 | psDec->LPC_order = MAX_LPC_ORDER;
46 | psDec->psNLSF_CB[ 0 ] = &SKP_Silk_NLSF_CB0_16;
47 | psDec->psNLSF_CB[ 1 ] = &SKP_Silk_NLSF_CB1_16;
48 | }
49 | /* Reset part of the decoder state */
50 | SKP_memset( psDec->sLPC_Q14, 0, MAX_LPC_ORDER * sizeof( SKP_int32 ) );
51 | SKP_memset( psDec->outBuf, 0, MAX_FRAME_LENGTH * sizeof( SKP_int16 ) );
52 | SKP_memset( psDec->prevNLSF_Q15, 0, MAX_LPC_ORDER * sizeof( SKP_int ) );
53 |
54 | psDec->lagPrev = 100;
55 | psDec->LastGainIndex = 1;
56 | psDec->prev_sigtype = 0;
57 | psDec->first_frame_after_reset = 1;
58 |
59 | if( fs_kHz == 24 ) {
60 | psDec->HP_A = SKP_Silk_Dec_A_HP_24;
61 | psDec->HP_B = SKP_Silk_Dec_B_HP_24;
62 | } else if( fs_kHz == 16 ) {
63 | psDec->HP_A = SKP_Silk_Dec_A_HP_16;
64 | psDec->HP_B = SKP_Silk_Dec_B_HP_16;
65 | } else if( fs_kHz == 12 ) {
66 | psDec->HP_A = SKP_Silk_Dec_A_HP_12;
67 | psDec->HP_B = SKP_Silk_Dec_B_HP_12;
68 | } else if( fs_kHz == 8 ) {
69 | psDec->HP_A = SKP_Silk_Dec_A_HP_8;
70 | psDec->HP_B = SKP_Silk_Dec_B_HP_8;
71 | } else {
72 | /* unsupported sampling rate */
73 | SKP_assert( 0 );
74 | }
75 | }
76 |
77 | /* Check that settings are valid */
78 | SKP_assert( psDec->frame_length > 0 && psDec->frame_length <= MAX_FRAME_LENGTH );
79 | }
80 |
81 |
--------------------------------------------------------------------------------
/jni/SKP_Silk_detect_SWB_input.c:
--------------------------------------------------------------------------------
1 | /***********************************************************************
2 | Copyright (c) 2006-2012, Skype Limited. All rights reserved.
3 | Redistribution and use in source and binary forms, with or without
4 | modification, (subject to the limitations in the disclaimer below)
5 | are permitted provided that the following conditions are met:
6 | - Redistributions of source code must retain the above copyright notice,
7 | this list of conditions and the following disclaimer.
8 | - Redistributions in binary form must reproduce the above copyright
9 | notice, this list of conditions and the following disclaimer in the
10 | documentation and/or other materials provided with the distribution.
11 | - Neither the name of Skype Limited, nor the names of specific
12 | contributors, may be used to endorse or promote products derived from
13 | this software without specific prior written permission.
14 | NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED
15 | BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
16 | CONTRIBUTORS ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
17 | BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
18 | FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
19 | COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
20 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
22 | USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
23 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | ***********************************************************************/
27 |
28 | /*
29 | * Detect SWB input by measuring energy above 8 kHz.
30 | */
31 |
32 | #include "SKP_Silk_main.h"
33 |
34 | void SKP_Silk_detect_SWB_input(
35 | SKP_Silk_detect_SWB_state *psSWBdetect, /* (I/O) encoder state */
36 | const SKP_int16 samplesIn[], /* (I) input to encoder */
37 | SKP_int nSamplesIn /* (I) length of input */
38 | )
39 | {
40 | SKP_int HP_8_kHz_len, i, shift;
41 | SKP_int16 in_HP_8_kHz[ MAX_FRAME_LENGTH ];
42 | SKP_int32 energy_32;
43 |
44 | /* High pass filter with cutoff at 8 khz */
45 | HP_8_kHz_len = SKP_min_int( nSamplesIn, MAX_FRAME_LENGTH );
46 | HP_8_kHz_len = SKP_max_int( HP_8_kHz_len, 0 );
47 |
48 | /* Cutoff around 9 khz */
49 | /* A = conv(conv([8192,14613, 6868], [8192,12883, 7337]), [8192,11586, 7911]); */
50 | /* B = conv(conv([575, -948, 575], [575, -221, 575]), [575, 104, 575]); */
51 | SKP_Silk_biquad( samplesIn, SKP_Silk_SWB_detect_B_HP_Q13[ 0 ], SKP_Silk_SWB_detect_A_HP_Q13[ 0 ],
52 | psSWBdetect->S_HP_8_kHz[ 0 ], in_HP_8_kHz, HP_8_kHz_len );
53 | for( i = 1; i < NB_SOS; i++ ) {
54 | SKP_Silk_biquad( in_HP_8_kHz, SKP_Silk_SWB_detect_B_HP_Q13[ i ], SKP_Silk_SWB_detect_A_HP_Q13[ i ],
55 | psSWBdetect->S_HP_8_kHz[ i ], in_HP_8_kHz, HP_8_kHz_len );
56 | }
57 |
58 | /* Calculate energy in HP signal */
59 | SKP_Silk_sum_sqr_shift( &energy_32, &shift, in_HP_8_kHz, HP_8_kHz_len );
60 |
61 | /* Count concecutive samples above threshold, after adjusting threshold for number of input samples and shift */
62 | if( energy_32 > SKP_RSHIFT( SKP_SMULBB( HP_8_KHZ_THRES, HP_8_kHz_len ), shift ) ) {
63 | psSWBdetect->ConsecSmplsAboveThres += nSamplesIn;
64 | if( psSWBdetect->ConsecSmplsAboveThres > CONCEC_SWB_SMPLS_THRES ) {
65 | psSWBdetect->SWB_detected = 1;
66 | }
67 | } else {
68 | psSWBdetect->ConsecSmplsAboveThres -= nSamplesIn;
69 | psSWBdetect->ConsecSmplsAboveThres = SKP_max( psSWBdetect->ConsecSmplsAboveThres, 0 );
70 | }
71 |
72 | /* If sufficient speech activity and no SWB detected, we detect the signal as being WB */
73 | if( ( psSWBdetect->ActiveSpeech_ms > WB_DETECT_ACTIVE_SPEECH_MS_THRES ) && ( psSWBdetect->SWB_detected == 0 ) ) {
74 | psSWBdetect->WB_detected = 1;
75 | }
76 | }
77 |
--------------------------------------------------------------------------------
/jni/SKP_Silk_div_oabi.c:
--------------------------------------------------------------------------------
1 | /***********************************************************************
2 | Copyright (c) 2006-2012, Skype Limited. All rights reserved.
3 | Redistribution and use in source and binary forms, with or without
4 | modification, (subject to the limitations in the disclaimer below)
5 | are permitted provided that the following conditions are met:
6 | - Redistributions of source code must retain the above copyright notice,
7 | this list of conditions and the following disclaimer.
8 | - Redistributions in binary form must reproduce the above copyright
9 | notice, this list of conditions and the following disclaimer in the
10 | documentation and/or other materials provided with the distribution.
11 | - Neither the name of Skype Limited, nor the names of specific
12 | contributors, may be used to endorse or promote products derived from
13 | this software without specific prior written permission.
14 | NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED
15 | BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
16 | CONTRIBUTORS ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
17 | BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
18 | FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
19 | COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
20 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
22 | USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
23 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | ***********************************************************************/
27 |
28 | #include "SKP_Silk_typedef.h"
29 |
30 | SKP_int32 SKP_DIV32_arm( SKP_int32 a32, SKP_int32 b32 ) {
31 | return ( ( SKP_int32 )( ( a32 ) / ( b32 ) ) );
32 | }
33 |
34 |
35 |
36 |
--------------------------------------------------------------------------------
/jni/SKP_Silk_init_encoder_FIX.c:
--------------------------------------------------------------------------------
1 | /***********************************************************************
2 | Copyright (c) 2006-2012, Skype Limited. All rights reserved.
3 | Redistribution and use in source and binary forms, with or without
4 | modification, (subject to the limitations in the disclaimer below)
5 | are permitted provided that the following conditions are met:
6 | - Redistributions of source code must retain the above copyright notice,
7 | this list of conditions and the following disclaimer.
8 | - Redistributions in binary form must reproduce the above copyright
9 | notice, this list of conditions and the following disclaimer in the
10 | documentation and/or other materials provided with the distribution.
11 | - Neither the name of Skype Limited, nor the names of specific
12 | contributors, may be used to endorse or promote products derived from
13 | this software without specific prior written permission.
14 | NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED
15 | BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
16 | CONTRIBUTORS ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
17 | BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
18 | FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
19 | COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
20 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
22 | USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
23 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | ***********************************************************************/
27 |
28 | #include "SKP_Silk_main_FIX.h"
29 |
30 | /*********************************/
31 | /* Initialize Silk Encoder state */
32 | /*********************************/
33 | SKP_int SKP_Silk_init_encoder_FIX(
34 | SKP_Silk_encoder_state_FIX *psEnc /* I/O Pointer to Silk FIX encoder state */
35 | ) {
36 | SKP_int ret = 0;
37 | /* Clear the entire encoder state */
38 | SKP_memset( psEnc, 0, sizeof( SKP_Silk_encoder_state_FIX ) );
39 |
40 | #if HIGH_PASS_INPUT
41 | psEnc->variable_HP_smth1_Q15 = 200844; /* = SKP_Silk_log2(70)_Q0; */
42 | psEnc->variable_HP_smth2_Q15 = 200844; /* = SKP_Silk_log2(70)_Q0; */
43 | #endif
44 |
45 | /* Used to deactivate e.g. LSF interpolation and fluctuation reduction */
46 | psEnc->sCmn.first_frame_after_reset = 1;
47 |
48 | /* Initialize Silk VAD */
49 | ret += SKP_Silk_VAD_Init( &psEnc->sCmn.sVAD );
50 |
51 | /* Initialize NSQ */
52 | psEnc->sCmn.sNSQ.prev_inv_gain_Q16 = 65536;
53 | psEnc->sCmn.sNSQ_LBRR.prev_inv_gain_Q16 = 65536;
54 |
55 | return( ret );
56 | }
57 |
--------------------------------------------------------------------------------
/jni/SKP_Silk_inner_prod_aligned.c:
--------------------------------------------------------------------------------
1 | /***********************************************************************
2 | Copyright (c) 2006-2012, Skype Limited. All rights reserved.
3 | Redistribution and use in source and binary forms, with or without
4 | modification, (subject to the limitations in the disclaimer below)
5 | are permitted provided that the following conditions are met:
6 | - Redistributions of source code must retain the above copyright notice,
7 | this list of conditions and the following disclaimer.
8 | - Redistributions in binary form must reproduce the above copyright
9 | notice, this list of conditions and the following disclaimer in the
10 | documentation and/or other materials provided with the distribution.
11 | - Neither the name of Skype Limited, nor the names of specific
12 | contributors, may be used to endorse or promote products derived from
13 | this software without specific prior written permission.
14 | NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED
15 | BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
16 | CONTRIBUTORS ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
17 | BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
18 | FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
19 | COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
20 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
22 | USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
23 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | ***********************************************************************/
27 |
28 | /* *
29 | * SKP_Silk_inner_prod_aligned.c *
30 | * *
31 | * *
32 | * Copyright 2008-2010 (c), Skype Limited *
33 | * Date: 080601 *
34 | * */
35 | #include "SKP_Silk_SigProc_FIX.h"
36 |
37 | /* sum= for(i=0;i6, memory access can be reduced by half. */
42 |
43 | #if (EMBEDDED_ARM<5)
44 | SKP_int32 SKP_Silk_inner_prod_aligned(
45 | const SKP_int16* const inVec1, /* I input vector 1 */
46 | const SKP_int16* const inVec2, /* I input vector 2 */
47 | const SKP_int len /* I vector lengths */
48 | )
49 | {
50 | SKP_int i;
51 | SKP_int32 sum = 0;
52 | for( i = 0; i < len; i++ ) {
53 | sum = SKP_SMLABB( sum, inVec1[ i ], inVec2[ i ] );
54 | }
55 | return sum;
56 | }
57 | #endif
58 |
59 | #if (EMBEDDED_ARM<5)
60 | SKP_int64 SKP_Silk_inner_prod16_aligned_64(
61 | const SKP_int16 *inVec1, /* I input vector 1 */
62 | const SKP_int16 *inVec2, /* I input vector 2 */
63 | const SKP_int len /* I vector lengths */
64 | )
65 | {
66 | SKP_int i;
67 | SKP_int64 sum = 0;
68 | for( i = 0; i < len; i++ ) {
69 | sum = SKP_SMLALBB( sum, inVec1[ i ], inVec2[ i ] );
70 | }
71 | return sum;
72 | }
73 | #endif
74 |
--------------------------------------------------------------------------------
/jni/SKP_Silk_interpolate.c:
--------------------------------------------------------------------------------
1 | /***********************************************************************
2 | Copyright (c) 2006-2012, Skype Limited. All rights reserved.
3 | Redistribution and use in source and binary forms, with or without
4 | modification, (subject to the limitations in the disclaimer below)
5 | are permitted provided that the following conditions are met:
6 | - Redistributions of source code must retain the above copyright notice,
7 | this list of conditions and the following disclaimer.
8 | - Redistributions in binary form must reproduce the above copyright
9 | notice, this list of conditions and the following disclaimer in the
10 | documentation and/or other materials provided with the distribution.
11 | - Neither the name of Skype Limited, nor the names of specific
12 | contributors, may be used to endorse or promote products derived from
13 | this software without specific prior written permission.
14 | NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED
15 | BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
16 | CONTRIBUTORS ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
17 | BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
18 | FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
19 | COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
20 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
22 | USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
23 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | ***********************************************************************/
27 |
28 | #include "SKP_Silk_main.h"
29 |
30 | /* Interpolate two vectors */
31 | void SKP_Silk_interpolate(
32 | SKP_int xi[ MAX_LPC_ORDER ], /* O interpolated vector */
33 | const SKP_int x0[ MAX_LPC_ORDER ], /* I first vector */
34 | const SKP_int x1[ MAX_LPC_ORDER ], /* I second vector */
35 | const SKP_int ifact_Q2, /* I interp. factor, weight on 2nd vector */
36 | const SKP_int d /* I number of parameters */
37 | )
38 | {
39 | SKP_int i;
40 |
41 | SKP_assert( ifact_Q2 >= 0 );
42 | SKP_assert( ifact_Q2 <= ( 1 << 2 ) );
43 |
44 | for( i = 0; i < d; i++ ) {
45 | xi[ i ] = ( SKP_int )( ( SKP_int32 )x0[ i ] + SKP_RSHIFT( SKP_MUL( ( SKP_int32 )x1[ i ] - ( SKP_int32 )x0[ i ], ifact_Q2 ), 2 ) );
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/jni/SKP_Silk_k2a.c:
--------------------------------------------------------------------------------
1 | /***********************************************************************
2 | Copyright (c) 2006-2012, Skype Limited. All rights reserved.
3 | Redistribution and use in source and binary forms, with or without
4 | modification, (subject to the limitations in the disclaimer below)
5 | are permitted provided that the following conditions are met:
6 | - Redistributions of source code must retain the above copyright notice,
7 | this list of conditions and the following disclaimer.
8 | - Redistributions in binary form must reproduce the above copyright
9 | notice, this list of conditions and the following disclaimer in the
10 | documentation and/or other materials provided with the distribution.
11 | - Neither the name of Skype Limited, nor the names of specific
12 | contributors, may be used to endorse or promote products derived from
13 | this software without specific prior written permission.
14 | NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED
15 | BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
16 | CONTRIBUTORS ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
17 | BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
18 | FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
19 | COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
20 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
22 | USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
23 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | ***********************************************************************/
27 |
28 | /* *
29 | * SKP_Silk_k2a.c *
30 | * *
31 | * Step up function, converts reflection coefficients to prediction *
32 | * coefficients *
33 | * *
34 | * Copyright 2008 (c), Skype Limited *
35 | * Date: 080103 *
36 | * */
37 | #include "SKP_Silk_SigProc_FIX.h"
38 |
39 | /* Step up function, converts reflection coefficients to prediction coefficients */
40 | void SKP_Silk_k2a(
41 | SKP_int32 *A_Q24, /* O: Prediction coefficients [order] Q24 */
42 | const SKP_int16 *rc_Q15, /* I: Reflection coefficients [order] Q15 */
43 | const SKP_int32 order /* I: Prediction order */
44 | )
45 | {
46 | SKP_int k, n;
47 | SKP_int32 Atmp[ SKP_Silk_MAX_ORDER_LPC ];
48 |
49 | for( k = 0; k < order; k++ ) {
50 | for( n = 0; n < k; n++ ) {
51 | Atmp[ n ] = A_Q24[ n ];
52 | }
53 | for( n = 0; n < k; n++ ) {
54 | A_Q24[ n ] = SKP_SMLAWB( A_Q24[ n ], SKP_LSHIFT( Atmp[ k - n - 1 ], 1 ), rc_Q15[ k ] );
55 | }
56 | A_Q24[ k ] = -SKP_LSHIFT( (SKP_int32)rc_Q15[ k ], 9 );
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/jni/SKP_Silk_k2a_Q16.c:
--------------------------------------------------------------------------------
1 | /***********************************************************************
2 | Copyright (c) 2006-2012, Skype Limited. All rights reserved.
3 | Redistribution and use in source and binary forms, with or without
4 | modification, (subject to the limitations in the disclaimer below)
5 | are permitted provided that the following conditions are met:
6 | - Redistributions of source code must retain the above copyright notice,
7 | this list of conditions and the following disclaimer.
8 | - Redistributions in binary form must reproduce the above copyright
9 | notice, this list of conditions and the following disclaimer in the
10 | documentation and/or other materials provided with the distribution.
11 | - Neither the name of Skype Limited, nor the names of specific
12 | contributors, may be used to endorse or promote products derived from
13 | this software without specific prior written permission.
14 | NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED
15 | BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
16 | CONTRIBUTORS ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
17 | BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
18 | FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
19 | COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
20 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
22 | USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
23 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | ***********************************************************************/
27 |
28 | /* *
29 | * SKP_Silk_k2a.c *
30 | * *
31 | * Step up function, converts reflection coefficients to prediction *
32 | * coefficients *
33 | * *
34 | * Copyright 2008 (c), Skype Limited *
35 | * Date: 080103 *
36 | * */
37 | #include "SKP_Silk_SigProc_FIX.h"
38 |
39 | /* Step up function, converts reflection coefficients to prediction coefficients */
40 | void SKP_Silk_k2a_Q16(
41 | SKP_int32 *A_Q24, /* O: Prediction coefficients [order] Q24 */
42 | const SKP_int32 *rc_Q16, /* I: Reflection coefficients [order] Q16 */
43 | const SKP_int32 order /* I: Prediction order */
44 | )
45 | {
46 | SKP_int k, n;
47 | SKP_int32 Atmp[ SKP_Silk_MAX_ORDER_LPC ];
48 |
49 | for( k = 0; k < order; k++ ) {
50 | for( n = 0; n < k; n++ ) {
51 | Atmp[ n ] = A_Q24[ n ];
52 | }
53 | for( n = 0; n < k; n++ ) {
54 | A_Q24[ n ] = SKP_SMLAWW( A_Q24[ n ], Atmp[ k - n - 1 ], rc_Q16[ k ] );
55 | }
56 | A_Q24[ k ] = -SKP_LSHIFT( rc_Q16[ k ], 8 );
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/jni/SKP_Silk_lin2log.c:
--------------------------------------------------------------------------------
1 | /***********************************************************************
2 | Copyright (c) 2006-2012, Skype Limited. All rights reserved.
3 | Redistribution and use in source and binary forms, with or without
4 | modification, (subject to the limitations in the disclaimer below)
5 | are permitted provided that the following conditions are met:
6 | - Redistributions of source code must retain the above copyright notice,
7 | this list of conditions and the following disclaimer.
8 | - Redistributions in binary form must reproduce the above copyright
9 | notice, this list of conditions and the following disclaimer in the
10 | documentation and/or other materials provided with the distribution.
11 | - Neither the name of Skype Limited, nor the names of specific
12 | contributors, may be used to endorse or promote products derived from
13 | this software without specific prior written permission.
14 | NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED
15 | BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
16 | CONTRIBUTORS ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
17 | BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
18 | FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
19 | COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
20 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
22 | USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
23 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | ***********************************************************************/
27 |
28 | /* *
29 | * SKP_Silk_lin2log.c *
30 | * *
31 | * Convert input to a log scale *
32 | * Approximation of 128 * log2() *
33 | * *
34 | * Copyright 2006 (c), Skype Limited *
35 | * Date: 060221 *
36 | * */
37 | #include "SKP_Silk_SigProc_FIX.h"
38 | #if EMBEDDED_ARM<4
39 | /* Approximation of 128 * log2() (very close inverse of approx 2^() below) */
40 | /* Convert input to a log scale */
41 | SKP_int32 SKP_Silk_lin2log( const SKP_int32 inLin ) /* I: Input in linear scale */
42 | {
43 | SKP_int32 lz, frac_Q7;
44 |
45 | SKP_Silk_CLZ_FRAC( inLin, &lz, &frac_Q7 );
46 |
47 | /* Piece-wise parabolic approximation */
48 | return( SKP_LSHIFT( 31 - lz, 7 ) + SKP_SMLAWB( frac_Q7, SKP_MUL( frac_Q7, 128 - frac_Q7 ), 179 ) );
49 | }
50 | #endif
51 |
52 |
--------------------------------------------------------------------------------
/jni/SKP_Silk_log2lin.c:
--------------------------------------------------------------------------------
1 | /***********************************************************************
2 | Copyright (c) 2006-2012, Skype Limited. All rights reserved.
3 | Redistribution and use in source and binary forms, with or without
4 | modification, (subject to the limitations in the disclaimer below)
5 | are permitted provided that the following conditions are met:
6 | - Redistributions of source code must retain the above copyright notice,
7 | this list of conditions and the following disclaimer.
8 | - Redistributions in binary form must reproduce the above copyright
9 | notice, this list of conditions and the following disclaimer in the
10 | documentation and/or other materials provided with the distribution.
11 | - Neither the name of Skype Limited, nor the names of specific
12 | contributors, may be used to endorse or promote products derived from
13 | this software without specific prior written permission.
14 | NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED
15 | BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
16 | CONTRIBUTORS ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
17 | BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
18 | FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
19 | COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
20 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
22 | USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
23 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | ***********************************************************************/
27 |
28 | /* *
29 | * SKP_Silk_log2lin.c *
30 | * *
31 | * Convert input to a linear scale *
32 | * *
33 | * Copyright 2006 (c), Skype Limited *
34 | * Date: 060221 *
35 | * */
36 | #include "SKP_Silk_SigProc_FIX.h"
37 |
38 | /* Approximation of 2^() (very close inverse of SKP_Silk_lin2log()) */
39 | /* Convert input to a linear scale */
40 | SKP_int32 SKP_Silk_log2lin( const SKP_int32 inLog_Q7 ) /* I: Input on log scale */
41 | {
42 | SKP_int32 out, frac_Q7;
43 |
44 | if( inLog_Q7 < 0 ) {
45 | return( 0 );
46 | } else if( inLog_Q7 >= ( 31 << 7 ) ) {
47 | /* Saturate, and prevent wrap-around */
48 | return( SKP_int32_MAX );
49 | }
50 |
51 | out = SKP_LSHIFT( 1, SKP_RSHIFT( inLog_Q7, 7 ) );
52 | frac_Q7 = inLog_Q7 & 0x7F;
53 | if( inLog_Q7 < 2048 ) {
54 | /* Piece-wise parabolic approximation */
55 | out = SKP_ADD_RSHIFT( out, SKP_MUL( out, SKP_SMLAWB( frac_Q7, SKP_MUL( frac_Q7, 128 - frac_Q7 ), -174 ) ), 7 );
56 | } else {
57 | /* Piece-wise parabolic approximation */
58 | out = SKP_MLA( out, SKP_RSHIFT( out, 7 ), SKP_SMLAWB( frac_Q7, SKP_MUL( frac_Q7, 128 - frac_Q7 ), -174 ) );
59 | }
60 | return out;
61 | }
62 |
--------------------------------------------------------------------------------
/jni/SKP_Silk_pitch_est_tables.c:
--------------------------------------------------------------------------------
1 | /***********************************************************************
2 | Copyright (c) 2006-2012, Skype Limited. All rights reserved.
3 | Redistribution and use in source and binary forms, with or without
4 | modification, (subject to the limitations in the disclaimer below)
5 | are permitted provided that the following conditions are met:
6 | - Redistributions of source code must retain the above copyright notice,
7 | this list of conditions and the following disclaimer.
8 | - Redistributions in binary form must reproduce the above copyright
9 | notice, this list of conditions and the following disclaimer in the
10 | documentation and/or other materials provided with the distribution.
11 | - Neither the name of Skype Limited, nor the names of specific
12 | contributors, may be used to endorse or promote products derived from
13 | this software without specific prior written permission.
14 | NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED
15 | BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
16 | CONTRIBUTORS ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
17 | BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
18 | FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
19 | COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
20 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
22 | USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
23 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | ***********************************************************************/
27 |
28 | #include "SKP_Silk_typedef.h"
29 | #include "SKP_Silk_common_pitch_est_defines.h"
30 |
31 | /********************************************************/
32 | /* Auto Generated File from generate_pitch_est_tables.m */
33 | /********************************************************/
34 |
35 | const SKP_int16 SKP_Silk_CB_lags_stage2[PITCH_EST_NB_SUBFR][PITCH_EST_NB_CBKS_STAGE2_EXT] =
36 | {
37 | {0, 2,-1,-1,-1, 0, 0, 1, 1, 0, 1},
38 | {0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0},
39 | {0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0},
40 | {0,-1, 2, 1, 0, 1, 1, 0, 0,-1,-1}
41 | };
42 |
43 | const SKP_int16 SKP_Silk_CB_lags_stage3[PITCH_EST_NB_SUBFR][PITCH_EST_NB_CBKS_STAGE3_MAX] =
44 | {
45 | {-9,-7,-6,-5,-5,-4,-4,-3,-3,-2,-2,-2,-1,-1,-1, 0, 0, 0, 1, 1, 0, 1, 2, 2, 2, 3, 3, 4, 4, 5, 6, 5, 6, 8},
46 | {-3,-2,-2,-2,-1,-1,-1,-1,-1, 0, 0,-1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 1, 1, 2, 1, 2, 2, 2, 2, 3},
47 | { 3, 3, 2, 2, 2, 2, 1, 2, 1, 1, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0,-1, 0, 0,-1,-1,-1,-1,-1,-2,-2,-2},
48 | { 9, 8, 6, 5, 6, 5, 4, 4, 3, 3, 2, 2, 2, 1, 0, 1, 1, 0, 0, 0,-1,-1,-1,-2,-2,-2,-3,-3,-4,-4,-5,-5,-6,-7}
49 | };
50 |
51 | const SKP_int16 SKP_Silk_Lag_range_stage3[ SKP_Silk_PITCH_EST_MAX_COMPLEX + 1 ] [ PITCH_EST_NB_SUBFR ][ 2 ] =
52 | {
53 | /* Lags to search for low number of stage3 cbks */
54 | {
55 | {-2,6},
56 | {-1,5},
57 | {-1,5},
58 | {-2,7}
59 | },
60 | /* Lags to search for middle number of stage3 cbks */
61 | {
62 | {-4,8},
63 | {-1,6},
64 | {-1,6},
65 | {-4,9}
66 | },
67 | /* Lags to search for max number of stage3 cbks */
68 | {
69 | {-9,12},
70 | {-3,7},
71 | {-2,7},
72 | {-7,13}
73 | }
74 | };
75 |
76 | const SKP_int16 SKP_Silk_cbk_sizes_stage3[SKP_Silk_PITCH_EST_MAX_COMPLEX + 1] =
77 | {
78 | PITCH_EST_NB_CBKS_STAGE3_MIN,
79 | PITCH_EST_NB_CBKS_STAGE3_MID,
80 | PITCH_EST_NB_CBKS_STAGE3_MAX
81 | };
82 |
83 | const SKP_int16 SKP_Silk_cbk_offsets_stage3[SKP_Silk_PITCH_EST_MAX_COMPLEX + 1] =
84 | {
85 | ((PITCH_EST_NB_CBKS_STAGE3_MAX - PITCH_EST_NB_CBKS_STAGE3_MIN) >> 1),
86 | ((PITCH_EST_NB_CBKS_STAGE3_MAX - PITCH_EST_NB_CBKS_STAGE3_MID) >> 1),
87 | 0
88 | };
89 |
90 |
--------------------------------------------------------------------------------
/jni/SKP_Silk_regularize_correlations_FIX.c:
--------------------------------------------------------------------------------
1 | /***********************************************************************
2 | Copyright (c) 2006-2012, Skype Limited. All rights reserved.
3 | Redistribution and use in source and binary forms, with or without
4 | modification, (subject to the limitations in the disclaimer below)
5 | are permitted provided that the following conditions are met:
6 | - Redistributions of source code must retain the above copyright notice,
7 | this list of conditions and the following disclaimer.
8 | - Redistributions in binary form must reproduce the above copyright
9 | notice, this list of conditions and the following disclaimer in the
10 | documentation and/or other materials provided with the distribution.
11 | - Neither the name of Skype Limited, nor the names of specific
12 | contributors, may be used to endorse or promote products derived from
13 | this software without specific prior written permission.
14 | NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED
15 | BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
16 | CONTRIBUTORS ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
17 | BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
18 | FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
19 | COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
20 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
22 | USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
23 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | ***********************************************************************/
27 |
28 | #include "SKP_Silk_main_FIX.h"
29 |
30 | /* Add noise to matrix diagonal */
31 | void SKP_Silk_regularize_correlations_FIX(
32 | SKP_int32 *XX, /* I/O Correlation matrices */
33 | SKP_int32 *xx, /* I/O Correlation values */
34 | SKP_int32 noise, /* I Noise to add */
35 | SKP_int D /* I Dimension of XX */
36 | )
37 | {
38 | SKP_int i;
39 | for( i = 0; i < D; i++ ) {
40 | matrix_ptr( &XX[ 0 ], i, i, D ) = SKP_ADD32( matrix_ptr( &XX[ 0 ], i, i, D ), noise );
41 | }
42 | xx[ 0 ] += noise;
43 | }
44 |
--------------------------------------------------------------------------------
/jni/SKP_Silk_resampler_down2.c:
--------------------------------------------------------------------------------
1 | /***********************************************************************
2 | Copyright (c) 2006-2012, Skype Limited. All rights reserved.
3 | Redistribution and use in source and binary forms, with or without
4 | modification, (subject to the limitations in the disclaimer below)
5 | are permitted provided that the following conditions are met:
6 | - Redistributions of source code must retain the above copyright notice,
7 | this list of conditions and the following disclaimer.
8 | - Redistributions in binary form must reproduce the above copyright
9 | notice, this list of conditions and the following disclaimer in the
10 | documentation and/or other materials provided with the distribution.
11 | - Neither the name of Skype Limited, nor the names of specific
12 | contributors, may be used to endorse or promote products derived from
13 | this software without specific prior written permission.
14 | NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED
15 | BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
16 | CONTRIBUTORS ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
17 | BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
18 | FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
19 | COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
20 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
22 | USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
23 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | ***********************************************************************/
27 |
28 | /* *
29 | * SKP_Silk_resampler_down2.c *
30 | * *
31 | * Downsample by a factor 2, mediocre quality *
32 | * *
33 | * Copyright 2010 (c), Skype Limited *
34 | * */
35 |
36 | #include "SKP_Silk_SigProc_FIX.h"
37 | #include "SKP_Silk_resampler_rom.h"
38 |
39 | #if (EMBEDDED_ARM<5)
40 | /* Downsample by a factor 2, mediocre quality */
41 | void SKP_Silk_resampler_down2(
42 | SKP_int32 *S, /* I/O: State vector [ 2 ] */
43 | SKP_int16 *out, /* O: Output signal [ len ] */
44 | const SKP_int16 *in, /* I: Input signal [ floor(len/2) ] */
45 | SKP_int32 inLen /* I: Number of input samples */
46 | )
47 | {
48 | SKP_int32 k, len2 = SKP_RSHIFT32( inLen, 1 );
49 | SKP_int32 in32, out32, Y, X;
50 |
51 | SKP_assert( SKP_Silk_resampler_down2_0 > 0 );
52 | SKP_assert( SKP_Silk_resampler_down2_1 < 0 );
53 |
54 | /* Internal variables and state are in Q10 format */
55 | for( k = 0; k < len2; k++ ) {
56 | /* Convert to Q10 */
57 | in32 = SKP_LSHIFT( (SKP_int32)in[ 2 * k ], 10 );
58 |
59 | /* All-pass section for even input sample */
60 | Y = SKP_SUB32( in32, S[ 0 ] );
61 | X = SKP_SMLAWB( Y, Y, SKP_Silk_resampler_down2_1 );
62 | out32 = SKP_ADD32( S[ 0 ], X );
63 | S[ 0 ] = SKP_ADD32( in32, X );
64 |
65 | /* Convert to Q10 */
66 | in32 = SKP_LSHIFT( (SKP_int32)in[ 2 * k + 1 ], 10 );
67 |
68 | /* All-pass section for odd input sample, and add to output of previous section */
69 | Y = SKP_SUB32( in32, S[ 1 ] );
70 | X = SKP_SMULWB( Y, SKP_Silk_resampler_down2_0 );
71 | out32 = SKP_ADD32( out32, S[ 1 ] );
72 | out32 = SKP_ADD32( out32, X );
73 | S[ 1 ] = SKP_ADD32( in32, X );
74 |
75 | /* Add, convert back to int16 and store to output */
76 | out[ k ] = (SKP_int16)SKP_SAT16( SKP_RSHIFT_ROUND( out32, 11 ) );
77 | }
78 | }
79 | #endif
80 |
--------------------------------------------------------------------------------
/jni/SKP_Silk_resampler_private_AR2.c:
--------------------------------------------------------------------------------
1 | /***********************************************************************
2 | Copyright (c) 2006-2012, Skype Limited. All rights reserved.
3 | Redistribution and use in source and binary forms, with or without
4 | modification, (subject to the limitations in the disclaimer below)
5 | are permitted provided that the following conditions are met:
6 | - Redistributions of source code must retain the above copyright notice,
7 | this list of conditions and the following disclaimer.
8 | - Redistributions in binary form must reproduce the above copyright
9 | notice, this list of conditions and the following disclaimer in the
10 | documentation and/or other materials provided with the distribution.
11 | - Neither the name of Skype Limited, nor the names of specific
12 | contributors, may be used to endorse or promote products derived from
13 | this software without specific prior written permission.
14 | NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED
15 | BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
16 | CONTRIBUTORS ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
17 | BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
18 | FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
19 | COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
20 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
22 | USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
23 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | ***********************************************************************/
27 |
28 | /* *
29 | * SKP_Silk_resampler_private_AR2. c *
30 | * *
31 | * Second order AR filter with single delay elements *
32 | * *
33 | * Copyright 2010 (c), Skype Limited *
34 | * */
35 |
36 | #include "SKP_Silk_SigProc_FIX.h"
37 | #include "SKP_Silk_resampler_private.h"
38 |
39 | #if (EMBEDDED_ARM<5)
40 | /* Second order AR filter with single delay elements */
41 | void SKP_Silk_resampler_private_AR2(
42 | SKP_int32 S[], /* I/O: State vector [ 2 ] */
43 | SKP_int32 out_Q8[], /* O: Output signal */
44 | const SKP_int16 in[], /* I: Input signal */
45 | const SKP_int16 A_Q14[], /* I: AR coefficients, Q14 */
46 | SKP_int32 len /* I: Signal length */
47 | )
48 | {
49 | SKP_int32 k;
50 | SKP_int32 out32;
51 |
52 | for( k = 0; k < len; k++ ) {
53 | out32 = SKP_ADD_LSHIFT32( S[ 0 ], (SKP_int32)in[ k ], 8 );
54 | out_Q8[ k ] = out32;
55 | out32 = SKP_LSHIFT( out32, 2 );
56 | S[ 0 ] = SKP_SMLAWB( S[ 1 ], out32, A_Q14[ 0 ] );
57 | S[ 1 ] = SKP_SMULWB( out32, A_Q14[ 1 ] );
58 | }
59 | }
60 | #endif
61 |
--------------------------------------------------------------------------------
/jni/SKP_Silk_resampler_private_ARMA4.c:
--------------------------------------------------------------------------------
1 | /***********************************************************************
2 | Copyright (c) 2006-2012, Skype Limited. All rights reserved.
3 | Redistribution and use in source and binary forms, with or without
4 | modification, (subject to the limitations in the disclaimer below)
5 | are permitted provided that the following conditions are met:
6 | - Redistributions of source code must retain the above copyright notice,
7 | this list of conditions and the following disclaimer.
8 | - Redistributions in binary form must reproduce the above copyright
9 | notice, this list of conditions and the following disclaimer in the
10 | documentation and/or other materials provided with the distribution.
11 | - Neither the name of Skype Limited, nor the names of specific
12 | contributors, may be used to endorse or promote products derived from
13 | this software without specific prior written permission.
14 | NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED
15 | BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
16 | CONTRIBUTORS ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
17 | BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
18 | FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
19 | COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
20 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
22 | USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
23 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | ***********************************************************************/
27 |
28 | /* *
29 | * SKP_Silk_resampler_private_ARMA4.c *
30 | * *
31 | * Fourth order ARMA filter, applies 64x gain *
32 | * *
33 | * Copyright 2010 (c), Skype Limited *
34 | * */
35 |
36 | #include "SKP_Silk_SigProc_FIX.h"
37 | #include "SKP_Silk_resampler_private.h"
38 |
39 | /* Fourth order ARMA filter */
40 | /* Internally operates as two biquad filters in sequence. */
41 |
42 | /* Coeffients are stored in a packed format: */
43 | /* { B1_Q14[1], B2_Q14[1], -A1_Q14[1], -A1_Q14[2], -A2_Q14[1], -A2_Q14[2], gain_Q16 } */
44 | /* where it is assumed that B*_Q14[0], B*_Q14[2], A*_Q14[0] are all 16384 */
45 | #if (EMBEDDED_ARM<5)
46 | void SKP_Silk_resampler_private_ARMA4(
47 | SKP_int32 S[], /* I/O: State vector [ 4 ] */
48 | SKP_int16 out[], /* O: Output signal */
49 | const SKP_int16 in[], /* I: Input signal */
50 | const SKP_int16 Coef[], /* I: ARMA coefficients [ 7 ] */
51 | SKP_int32 len /* I: Signal length */
52 | )
53 | {
54 | SKP_int32 k;
55 | SKP_int32 in_Q8, out1_Q8, out2_Q8, X;
56 |
57 | for( k = 0; k < len; k++ ) {
58 | in_Q8 = SKP_LSHIFT32( (SKP_int32)in[ k ], 8 );
59 |
60 | /* Outputs of first and second biquad */
61 | out1_Q8 = SKP_ADD_LSHIFT32( in_Q8, S[ 0 ], 2 );
62 | out2_Q8 = SKP_ADD_LSHIFT32( out1_Q8, S[ 2 ], 2 );
63 |
64 | /* Update states, which are stored in Q6. Coefficients are in Q14 here */
65 | X = SKP_SMLAWB( S[ 1 ], in_Q8, Coef[ 0 ] );
66 | S[ 0 ] = SKP_SMLAWB( X, out1_Q8, Coef[ 2 ] );
67 |
68 | X = SKP_SMLAWB( S[ 3 ], out1_Q8, Coef[ 1 ] );
69 | S[ 2 ] = SKP_SMLAWB( X, out2_Q8, Coef[ 4 ] );
70 |
71 | S[ 1 ] = SKP_SMLAWB( SKP_RSHIFT32( in_Q8, 2 ), out1_Q8, Coef[ 3 ] );
72 | S[ 3 ] = SKP_SMLAWB( SKP_RSHIFT32( out1_Q8, 2 ), out2_Q8, Coef[ 5 ] );
73 |
74 | /* Apply gain and store to output. The coefficient is in Q16 */
75 | out[ k ] = (SKP_int16)SKP_SAT16( SKP_RSHIFT32( SKP_SMLAWB( 128, out2_Q8, Coef[ 6 ] ), 8 ) );
76 | }
77 | }
78 | #endif
79 |
80 |
--------------------------------------------------------------------------------
/jni/SKP_Silk_resampler_private_copy.c:
--------------------------------------------------------------------------------
1 | /***********************************************************************
2 | Copyright (c) 2006-2012, Skype Limited. All rights reserved.
3 | Redistribution and use in source and binary forms, with or without
4 | modification, (subject to the limitations in the disclaimer below)
5 | are permitted provided that the following conditions are met:
6 | - Redistributions of source code must retain the above copyright notice,
7 | this list of conditions and the following disclaimer.
8 | - Redistributions in binary form must reproduce the above copyright
9 | notice, this list of conditions and the following disclaimer in the
10 | documentation and/or other materials provided with the distribution.
11 | - Neither the name of Skype Limited, nor the names of specific
12 | contributors, may be used to endorse or promote products derived from
13 | this software without specific prior written permission.
14 | NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED
15 | BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
16 | CONTRIBUTORS ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
17 | BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
18 | FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
19 | COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
20 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
22 | USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
23 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | ***********************************************************************/
27 |
28 | /* *
29 | * File Name: SKP_Silk_resampler_private_copy.c *
30 | * *
31 | * Description: Copy. *
32 | * *
33 | * Copyright 2010 (c), Skype Limited *
34 | * All rights reserved. *
35 | * */
36 |
37 | #include "SKP_Silk_SigProc_FIX.h"
38 | #include "SKP_Silk_resampler_private.h"
39 |
40 | /* Copy */
41 | void SKP_Silk_resampler_private_copy(
42 | void *SS, /* I/O: Resampler state (unused) */
43 | SKP_int16 out[], /* O: Output signal */
44 | const SKP_int16 in[], /* I: Input signal */
45 | SKP_int32 inLen /* I: Number of input samples */
46 | )
47 | {
48 | SKP_memcpy( out, in, inLen * sizeof( SKP_int16 ) );
49 | }
50 |
--------------------------------------------------------------------------------
/jni/SKP_Silk_resampler_private_up4.c:
--------------------------------------------------------------------------------
1 | /***********************************************************************
2 | Copyright (c) 2006-2012, Skype Limited. All rights reserved.
3 | Redistribution and use in source and binary forms, with or without
4 | modification, (subject to the limitations in the disclaimer below)
5 | are permitted provided that the following conditions are met:
6 | - Redistributions of source code must retain the above copyright notice,
7 | this list of conditions and the following disclaimer.
8 | - Redistributions in binary form must reproduce the above copyright
9 | notice, this list of conditions and the following disclaimer in the
10 | documentation and/or other materials provided with the distribution.
11 | - Neither the name of Skype Limited, nor the names of specific
12 | contributors, may be used to endorse or promote products derived from
13 | this software without specific prior written permission.
14 | NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED
15 | BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
16 | CONTRIBUTORS ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
17 | BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
18 | FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
19 | COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
20 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
22 | USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
23 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | ***********************************************************************/
27 |
28 | /* *
29 | * SKP_Silk_resampler_private_up4.c *
30 | * *
31 | * Upsample by a factor 4, low quality *
32 | * *
33 | * Copyright 2010 (c), Skype Limited *
34 | * */
35 |
36 | #include "SKP_Silk_SigProc_FIX.h"
37 | #include "SKP_Silk_resampler_private.h"
38 |
39 | /* Upsample by a factor 4, Note: very low quality, only use with output sampling rates above 96 kHz. */
40 | void SKP_Silk_resampler_private_up4(
41 | SKP_int32 *S, /* I/O: State vector [ 2 ] */
42 | SKP_int16 *out, /* O: Output signal [ 4 * len ] */
43 | const SKP_int16 *in, /* I: Input signal [ len ] */
44 | SKP_int32 len /* I: Number of INPUT samples */
45 | )
46 | {
47 | SKP_int32 k;
48 | SKP_int32 in32, out32, Y, X;
49 | SKP_int16 out16;
50 |
51 | SKP_assert( SKP_Silk_resampler_up2_lq_0 > 0 );
52 | SKP_assert( SKP_Silk_resampler_up2_lq_1 < 0 );
53 |
54 | /* Internal variables and state are in Q10 format */
55 | for( k = 0; k < len; k++ ) {
56 | /* Convert to Q10 */
57 | in32 = SKP_LSHIFT( (SKP_int32)in[ k ], 10 );
58 |
59 | /* All-pass section for even output sample */
60 | Y = SKP_SUB32( in32, S[ 0 ] );
61 | X = SKP_SMULWB( Y, SKP_Silk_resampler_up2_lq_0 );
62 | out32 = SKP_ADD32( S[ 0 ], X );
63 | S[ 0 ] = SKP_ADD32( in32, X );
64 |
65 | /* Convert back to int16 and store to output */
66 | out16 = (SKP_int16)SKP_SAT16( SKP_RSHIFT_ROUND( out32, 10 ) );
67 | out[ 4 * k ] = out16;
68 | out[ 4 * k + 1 ] = out16;
69 |
70 | /* All-pass section for odd output sample */
71 | Y = SKP_SUB32( in32, S[ 1 ] );
72 | X = SKP_SMLAWB( Y, Y, SKP_Silk_resampler_up2_lq_1 );
73 | out32 = SKP_ADD32( S[ 1 ], X );
74 | S[ 1 ] = SKP_ADD32( in32, X );
75 |
76 | /* Convert back to int16 and store to output */
77 | out16 = (SKP_int16)SKP_SAT16( SKP_RSHIFT_ROUND( out32, 10 ) );
78 | out[ 4 * k + 2 ] = out16;
79 | out[ 4 * k + 3 ] = out16;
80 | }
81 | }
82 |
--------------------------------------------------------------------------------
/jni/SKP_Silk_resampler_up2.c:
--------------------------------------------------------------------------------
1 | /***********************************************************************
2 | Copyright (c) 2006-2012, Skype Limited. All rights reserved.
3 | Redistribution and use in source and binary forms, with or without
4 | modification, (subject to the limitations in the disclaimer below)
5 | are permitted provided that the following conditions are met:
6 | - Redistributions of source code must retain the above copyright notice,
7 | this list of conditions and the following disclaimer.
8 | - Redistributions in binary form must reproduce the above copyright
9 | notice, this list of conditions and the following disclaimer in the
10 | documentation and/or other materials provided with the distribution.
11 | - Neither the name of Skype Limited, nor the names of specific
12 | contributors, may be used to endorse or promote products derived from
13 | this software without specific prior written permission.
14 | NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED
15 | BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
16 | CONTRIBUTORS ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
17 | BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
18 | FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
19 | COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
20 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
22 | USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
23 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | ***********************************************************************/
27 |
28 | /* *
29 | * SKP_Silk_resampler_up2.c *
30 | * *
31 | * Upsample by a factor 2, low quality *
32 | * *
33 | * Copyright 2010 (c), Skype Limited *
34 | * */
35 |
36 | #include "SKP_Silk_SigProc_FIX.h"
37 | #include "SKP_Silk_resampler_rom.h"
38 |
39 | /* Upsample by a factor 2, low quality */
40 | #if EMBEDDED_ARM<5
41 | void SKP_Silk_resampler_up2(
42 | SKP_int32 *S, /* I/O: State vector [ 2 ] */
43 | SKP_int16 *out, /* O: Output signal [ 2 * len ] */
44 | const SKP_int16 *in, /* I: Input signal [ len ] */
45 | SKP_int32 len /* I: Number of input samples */
46 | )
47 | {
48 | SKP_int32 k;
49 | SKP_int32 in32, out32, Y, X;
50 |
51 | SKP_assert( SKP_Silk_resampler_up2_lq_0 > 0 );
52 | SKP_assert( SKP_Silk_resampler_up2_lq_1 < 0 );
53 | /* Internal variables and state are in Q10 format */
54 | for( k = 0; k < len; k++ ) {
55 | /* Convert to Q10 */
56 | in32 = SKP_LSHIFT( (SKP_int32)in[ k ], 10 );
57 |
58 | /* All-pass section for even output sample */
59 | Y = SKP_SUB32( in32, S[ 0 ] );
60 | X = SKP_SMULWB( Y, SKP_Silk_resampler_up2_lq_0 );
61 | out32 = SKP_ADD32( S[ 0 ], X );
62 | S[ 0 ] = SKP_ADD32( in32, X );
63 |
64 | /* Convert back to int16 and store to output */
65 | out[ 2 * k ] = (SKP_int16)SKP_SAT16( SKP_RSHIFT_ROUND( out32, 10 ) );
66 |
67 | /* All-pass section for odd output sample */
68 | Y = SKP_SUB32( in32, S[ 1 ] );
69 | X = SKP_SMLAWB( Y, Y, SKP_Silk_resampler_up2_lq_1 );
70 | out32 = SKP_ADD32( S[ 1 ], X );
71 | S[ 1 ] = SKP_ADD32( in32, X );
72 |
73 | /* Convert back to int16 and store to output */
74 | out[ 2 * k + 1 ] = (SKP_int16)SKP_SAT16( SKP_RSHIFT_ROUND( out32, 10 ) );
75 | }
76 | }
77 | #endif
78 |
--------------------------------------------------------------------------------
/jni/SKP_Silk_scale_copy_vector16.c:
--------------------------------------------------------------------------------
1 | /***********************************************************************
2 | Copyright (c) 2006-2012, Skype Limited. All rights reserved.
3 | Redistribution and use in source and binary forms, with or without
4 | modification, (subject to the limitations in the disclaimer below)
5 | are permitted provided that the following conditions are met:
6 | - Redistributions of source code must retain the above copyright notice,
7 | this list of conditions and the following disclaimer.
8 | - Redistributions in binary form must reproduce the above copyright
9 | notice, this list of conditions and the following disclaimer in the
10 | documentation and/or other materials provided with the distribution.
11 | - Neither the name of Skype Limited, nor the names of specific
12 | contributors, may be used to endorse or promote products derived from
13 | this software without specific prior written permission.
14 | NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED
15 | BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
16 | CONTRIBUTORS ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
17 | BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
18 | FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
19 | COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
20 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
22 | USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
23 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | ***********************************************************************/
27 |
28 | #include "SKP_Silk_SigProc_FIX.h"
29 |
30 | /* Copy and multiply a vector by a constant */
31 | void SKP_Silk_scale_copy_vector16(
32 | SKP_int16 *data_out,
33 | const SKP_int16 *data_in,
34 | SKP_int32 gain_Q16, /* (I): gain in Q16 */
35 | const SKP_int dataSize /* (I): length */
36 | )
37 | {
38 | SKP_int i;
39 | SKP_int32 tmp32;
40 |
41 | for( i = 0; i < dataSize; i++ ) {
42 | tmp32 = SKP_SMULWB( gain_Q16, data_in[ i ] );
43 | data_out[ i ] = (SKP_int16)SKP_CHECK_FIT16( tmp32 );
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/jni/SKP_Silk_scale_vector.c:
--------------------------------------------------------------------------------
1 | /***********************************************************************
2 | Copyright (c) 2006-2012, Skype Limited. All rights reserved.
3 | Redistribution and use in source and binary forms, with or without
4 | modification, (subject to the limitations in the disclaimer below)
5 | are permitted provided that the following conditions are met:
6 | - Redistributions of source code must retain the above copyright notice,
7 | this list of conditions and the following disclaimer.
8 | - Redistributions in binary form must reproduce the above copyright
9 | notice, this list of conditions and the following disclaimer in the
10 | documentation and/or other materials provided with the distribution.
11 | - Neither the name of Skype Limited, nor the names of specific
12 | contributors, may be used to endorse or promote products derived from
13 | this software without specific prior written permission.
14 | NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED
15 | BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
16 | CONTRIBUTORS ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
17 | BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
18 | FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
19 | COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
20 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
22 | USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
23 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | ***********************************************************************/
27 |
28 | #include "SKP_Silk_SigProc_FIX.h"
29 |
30 | /* Multiply a vector by a constant */
31 | void SKP_Silk_scale_vector32_Q26_lshift_18(
32 | SKP_int32 *data1, /* (I/O): Q0/Q18 */
33 | SKP_int32 gain_Q26, /* (I): Q26 */
34 | SKP_int dataSize /* (I): length */
35 | )
36 | {
37 | SKP_int i;
38 |
39 | for( i = 0; i < dataSize; i++ ) {
40 | data1[ i ] = (SKP_int32)SKP_CHECK_FIT32( SKP_RSHIFT64( SKP_SMULL( data1[ i ], gain_Q26 ), 8 ) );// OUTPUT: Q18
41 | }
42 | }
43 |
44 |
--------------------------------------------------------------------------------
/jni/SKP_Silk_sigm_Q15.c:
--------------------------------------------------------------------------------
1 | /***********************************************************************
2 | Copyright (c) 2006-2012, Skype Limited. All rights reserved.
3 | Redistribution and use in source and binary forms, with or without
4 | modification, (subject to the limitations in the disclaimer below)
5 | are permitted provided that the following conditions are met:
6 | - Redistributions of source code must retain the above copyright notice,
7 | this list of conditions and the following disclaimer.
8 | - Redistributions in binary form must reproduce the above copyright
9 | notice, this list of conditions and the following disclaimer in the
10 | documentation and/or other materials provided with the distribution.
11 | - Neither the name of Skype Limited, nor the names of specific
12 | contributors, may be used to endorse or promote products derived from
13 | this software without specific prior written permission.
14 | NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED
15 | BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
16 | CONTRIBUTORS ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
17 | BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
18 | FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
19 | COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
20 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
22 | USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
23 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | ***********************************************************************/
27 |
28 | /* *
29 | * SKP_sigm_Q15.c *
30 | * *
31 | * Approximate sigmoid function *
32 | * *
33 | * Copyright 2006 (c), Skype Limited *
34 | * Date: 060221 *
35 | * */
36 | #include "SKP_Silk_SigProc_FIX.h"
37 | #if EMBEDDED_ARM<4
38 | /********************************/
39 | /* approximate sigmoid function */
40 | /********************************/
41 | /* fprintf(1, '%d, ', round(1024 * ([1 ./ (1 + exp(-(1:5))), 1] - 1 ./ (1 + exp(-(0:5)))))); */
42 | static const SKP_int32 sigm_LUT_slope_Q10[ 6 ] = {
43 | 237, 153, 73, 30, 12, 7
44 | };
45 | /* fprintf(1, '%d, ', round(32767 * 1 ./ (1 + exp(-(0:5))))); */
46 | static const SKP_int32 sigm_LUT_pos_Q15[ 6 ] = {
47 | 16384, 23955, 28861, 31213, 32178, 32548
48 | };
49 | /* fprintf(1, '%d, ', round(32767 * 1 ./ (1 + exp((0:5))))); */
50 | static const SKP_int32 sigm_LUT_neg_Q15[ 6 ] = {
51 | 16384, 8812, 3906, 1554, 589, 219
52 | };
53 |
54 | SKP_int SKP_Silk_sigm_Q15( SKP_int in_Q5 )
55 | {
56 | SKP_int ind;
57 |
58 | if( in_Q5 < 0 ) {
59 | /* Negative input */
60 | in_Q5 = -in_Q5;
61 | if( in_Q5 >= 6 * 32 ) {
62 | return 0; /* Clip */
63 | } else {
64 | /* Linear interpolation of look up table */
65 | ind = SKP_RSHIFT( in_Q5, 5 );
66 | return( sigm_LUT_neg_Q15[ ind ] - SKP_SMULBB( sigm_LUT_slope_Q10[ ind ], in_Q5 & 0x1F ) );
67 | }
68 | } else {
69 | /* Positive input */
70 | if( in_Q5 >= 6 * 32 ) {
71 | return 32767; /* clip */
72 | } else {
73 | /* Linear interpolation of look up table */
74 | ind = SKP_RSHIFT( in_Q5, 5 );
75 | return( sigm_LUT_pos_Q15[ ind ] + SKP_SMULBB( sigm_LUT_slope_Q10[ ind ], in_Q5 & 0x1F ) );
76 | }
77 | }
78 | }
79 | #endif
80 |
81 |
--------------------------------------------------------------------------------
/jni/SKP_Silk_tables_gain.c:
--------------------------------------------------------------------------------
1 | /***********************************************************************
2 | Copyright (c) 2006-2012, Skype Limited. All rights reserved.
3 | Redistribution and use in source and binary forms, with or without
4 | modification, (subject to the limitations in the disclaimer below)
5 | are permitted provided that the following conditions are met:
6 | - Redistributions of source code must retain the above copyright notice,
7 | this list of conditions and the following disclaimer.
8 | - Redistributions in binary form must reproduce the above copyright
9 | notice, this list of conditions and the following disclaimer in the
10 | documentation and/or other materials provided with the distribution.
11 | - Neither the name of Skype Limited, nor the names of specific
12 | contributors, may be used to endorse or promote products derived from
13 | this software without specific prior written permission.
14 | NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED
15 | BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
16 | CONTRIBUTORS ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
17 | BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
18 | FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
19 | COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
20 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
22 | USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
23 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | ***********************************************************************/
27 |
28 | #include "SKP_Silk_tables.h"
29 |
30 | #ifdef __cplusplus
31 | extern "C"
32 | {
33 | #endif
34 |
35 | const SKP_uint16 SKP_Silk_gain_CDF[ 2 ][ 65 ] =
36 | {
37 | {
38 | 0, 18, 45, 94, 181, 320, 519, 777,
39 | 1093, 1468, 1909, 2417, 2997, 3657, 4404, 5245,
40 | 6185, 7228, 8384, 9664, 11069, 12596, 14244, 16022,
41 | 17937, 19979, 22121, 24345, 26646, 29021, 31454, 33927,
42 | 36438, 38982, 41538, 44068, 46532, 48904, 51160, 53265,
43 | 55184, 56904, 58422, 59739, 60858, 61793, 62568, 63210,
44 | 63738, 64165, 64504, 64769, 64976, 65133, 65249, 65330,
45 | 65386, 65424, 65451, 65471, 65487, 65501, 65513, 65524,
46 | 65535
47 | },
48 | {
49 | 0, 214, 581, 1261, 2376, 3920, 5742, 7632,
50 | 9449, 11157, 12780, 14352, 15897, 17427, 18949, 20462,
51 | 21957, 23430, 24889, 26342, 27780, 29191, 30575, 31952,
52 | 33345, 34763, 36200, 37642, 39083, 40519, 41930, 43291,
53 | 44602, 45885, 47154, 48402, 49619, 50805, 51959, 53069,
54 | 54127, 55140, 56128, 57101, 58056, 58979, 59859, 60692,
55 | 61468, 62177, 62812, 63368, 63845, 64242, 64563, 64818,
56 | 65023, 65184, 65306, 65391, 65447, 65482, 65505, 65521,
57 | 65535
58 | }
59 | };
60 |
61 | const SKP_int SKP_Silk_gain_CDF_offset = 32;
62 |
63 |
64 | const SKP_uint16 SKP_Silk_delta_gain_CDF[ 46 ] = {
65 | 0, 2358, 3856, 7023, 15376, 53058, 59135, 61555,
66 | 62784, 63498, 63949, 64265, 64478, 64647, 64783, 64894,
67 | 64986, 65052, 65113, 65169, 65213, 65252, 65284, 65314,
68 | 65338, 65359, 65377, 65392, 65403, 65415, 65424, 65432,
69 | 65440, 65448, 65455, 65462, 65470, 65477, 65484, 65491,
70 | 65499, 65506, 65513, 65521, 65528, 65535
71 | };
72 |
73 | const SKP_int SKP_Silk_delta_gain_CDF_offset = 5;
74 |
75 | #ifdef __cplusplus
76 | }
77 | #endif
78 |
--------------------------------------------------------------------------------
/jni/SKP_Silk_tables_sign.c:
--------------------------------------------------------------------------------
1 | /***********************************************************************
2 | Copyright (c) 2006-2012, Skype Limited. All rights reserved.
3 | Redistribution and use in source and binary forms, with or without
4 | modification, (subject to the limitations in the disclaimer below)
5 | are permitted provided that the following conditions are met:
6 | - Redistributions of source code must retain the above copyright notice,
7 | this list of conditions and the following disclaimer.
8 | - Redistributions in binary form must reproduce the above copyright
9 | notice, this list of conditions and the following disclaimer in the
10 | documentation and/or other materials provided with the distribution.
11 | - Neither the name of Skype Limited, nor the names of specific
12 | contributors, may be used to endorse or promote products derived from
13 | this software without specific prior written permission.
14 | NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED
15 | BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
16 | CONTRIBUTORS ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
17 | BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
18 | FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
19 | COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
20 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
22 | USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
23 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | ***********************************************************************/
27 |
28 | #include "SKP_Silk_tables.h"
29 |
30 | const SKP_uint16 SKP_Silk_sign_CDF[ 36 ] =
31 | {
32 | 37840, 36944, 36251, 35304,
33 | 34715, 35503, 34529, 34296,
34 | 34016, 47659, 44945, 42503,
35 | 40235, 38569, 40254, 37851,
36 | 37243, 36595, 43410, 44121,
37 | 43127, 40978, 38845, 40433,
38 | 38252, 37795, 36637, 59159,
39 | 55630, 51806, 48073, 45036,
40 | 48416, 43857, 42678, 41146,
41 | };
42 |
43 |
--------------------------------------------------------------------------------
/jni/SKP_Silk_tables_type_offset.c:
--------------------------------------------------------------------------------
1 | /***********************************************************************
2 | Copyright (c) 2006-2012, Skype Limited. All rights reserved.
3 | Redistribution and use in source and binary forms, with or without
4 | modification, (subject to the limitations in the disclaimer below)
5 | are permitted provided that the following conditions are met:
6 | - Redistributions of source code must retain the above copyright notice,
7 | this list of conditions and the following disclaimer.
8 | - Redistributions in binary form must reproduce the above copyright
9 | notice, this list of conditions and the following disclaimer in the
10 | documentation and/or other materials provided with the distribution.
11 | - Neither the name of Skype Limited, nor the names of specific
12 | contributors, may be used to endorse or promote products derived from
13 | this software without specific prior written permission.
14 | NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED
15 | BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
16 | CONTRIBUTORS ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
17 | BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
18 | FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
19 | COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
20 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
22 | USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
23 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | ***********************************************************************/
27 |
28 | #include "SKP_Silk_tables.h"
29 |
30 | const SKP_uint16 SKP_Silk_type_offset_CDF[ 5 ] = {
31 | 0, 37522, 41030, 44212, 65535
32 | };
33 |
34 | const SKP_int SKP_Silk_type_offset_CDF_offset = 2;
35 |
36 |
37 | const SKP_uint16 SKP_Silk_type_offset_joint_CDF[ 4 ][ 5 ] =
38 | {
39 | {
40 | 0, 57686, 61230, 62358, 65535
41 | },
42 | {
43 | 0, 18346, 40067, 43659, 65535
44 | },
45 | {
46 | 0, 22694, 24279, 35507, 65535
47 | },
48 | {
49 | 0, 6067, 7215, 13010, 65535
50 | }
51 | };
52 |
53 |
--------------------------------------------------------------------------------
/jni/decoder.c:
--------------------------------------------------------------------------------
1 | #include "silk.h"
2 | #include "lame.h"
3 | #include
4 |
5 | static void print_usage(char* argv[]) {
6 | printf( "\nusage: %s in.bit out.pcm [settings]\n", argv[ 0 ] );
7 | printf( "\nin.bit : Bitstream input to decoder" );
8 | printf( "\nout.pcm : Speech output from decoder" );
9 | printf( "\n settings:" );
10 | printf( "\n-Fs_API : Sampling rate of output signal in Hz; default: 24000" );
11 | printf( "\n-loss : Simulated packet loss percentage (0-100); default: 0" );
12 | printf( "\n-quiet : Print out just some basic values" );
13 | printf( "\n" );
14 | }
15 |
16 | int main( int argc, char* argv[] )
17 | {
18 | // print_usage(argv);
19 |
20 | const char *src = "/home/ketian/silk_project/silk/msg_3910190915165fe46499e0f103.amr";
21 | const char *dest = "/home/ketian/silk_project/silk/out2.pcm";
22 | return x(src, dest);
23 | }
24 |
--------------------------------------------------------------------------------
/jni/decoder.cpp:
--------------------------------------------------------------------------------
1 | //
2 | // Created by ketian on 16-9-23.
3 | //
4 |
5 | #include
6 |
7 | #ifdef __cplusplus
8 | extern "C"
9 | {
10 | #endif
11 |
12 | #include "silk.h"
13 | #include "lame.h"
14 |
15 | JNIEXPORT jint JNICALL
16 | Java_com_kgo_silk_JNI_convert(JNIEnv *env, jclass clazz, jstring src, jstring dest, jstring tmpfile) {
17 | const char *str_c = env->GetStringUTFChars(src, 0);
18 | const char *dest_c = env->GetStringUTFChars(dest, 0);
19 |
20 | const char *tmp = env->GetStringUTFChars(tmpfile, 0);
21 |
22 | LOGD("libsilkx is developed by tian.ke, any question, please email to ketn4391@gmail.com");
23 | LOGD("convert %s to %s", str_c, dest_c);
24 |
25 | FILE *tempFile = fopen(tmp, "wb+");
26 | if (tempFile == 0) {
27 | LOGD("open tempFile %s failed", tmp);
28 | return -1;
29 | }
30 |
31 | if (convertSilk2PCM(str_c, tempFile) != 0) {
32 | LOGD("convert silk to pcm failed");
33 | fclose(tempFile);
34 | return -1;
35 | }
36 |
37 | lame_t lame = lame_init();
38 | lame_set_in_samplerate(lame, 24000);
39 |
40 | lame_set_num_channels(lame, 1);
41 | lame_set_mode(lame, MONO);
42 | lame_set_quality(lame, 5);
43 | lame_init_params(lame);
44 |
45 | FILE *pcm = tempFile;
46 | fseek(pcm, 0, SEEK_SET);
47 |
48 | FILE *mp3 = fopen(dest_c, "wb");
49 | int read, write;
50 |
51 | const int PCM_SIZE = 8192;
52 | const int MP3_SIZE = 8192;
53 | short int pcm_buffer[PCM_SIZE];
54 | unsigned char mp3_buffer[MP3_SIZE];
55 |
56 | do {
57 | read = fread(pcm_buffer, sizeof(short int), PCM_SIZE, pcm);
58 | if (read == 0) {
59 | write = lame_encode_flush(lame, mp3_buffer, MP3_SIZE);
60 | } else {
61 | write = lame_encode_buffer(lame, pcm_buffer, NULL, read, mp3_buffer, MP3_SIZE);
62 | }
63 |
64 | fwrite(mp3_buffer, 1, write, mp3);
65 | } while (read != 0);
66 |
67 | lame_close(lame);
68 | fclose(mp3);
69 | fclose(pcm);
70 |
71 | return 0;
72 | }
73 |
74 | #ifdef __cplusplus
75 | }
76 | #endif
--------------------------------------------------------------------------------
/jni/include/SKP_Silk_common_pitch_est_defines.h:
--------------------------------------------------------------------------------
1 | /***********************************************************************
2 | Copyright (c) 2006-2012, Skype Limited. All rights reserved.
3 | Redistribution and use in source and binary forms, with or without
4 | modification, (subject to the limitations in the disclaimer below)
5 | are permitted provided that the following conditions are met:
6 | - Redistributions of source code must retain the above copyright notice,
7 | this list of conditions and the following disclaimer.
8 | - Redistributions in binary form must reproduce the above copyright
9 | notice, this list of conditions and the following disclaimer in the
10 | documentation and/or other materials provided with the distribution.
11 | - Neither the name of Skype Limited, nor the names of specific
12 | contributors, may be used to endorse or promote products derived from
13 | this software without specific prior written permission.
14 | NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED
15 | BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
16 | CONTRIBUTORS ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
17 | BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
18 | FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
19 | COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
20 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
22 | USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
23 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | ***********************************************************************/
27 |
28 | #ifndef SIGPROC_COMMON_PITCH_EST_DEFINES_H
29 | #define SIGPROC_COMMON_PITCH_EST_DEFINES_H
30 |
31 | #include "SKP_Silk_SigProc_FIX.h"
32 |
33 | /************************************************************/
34 | /* Definitions For Fix pitch estimator */
35 | /************************************************************/
36 |
37 | #define PITCH_EST_MAX_FS_KHZ 24 /* Maximum sampling frequency used */
38 |
39 | #define PITCH_EST_FRAME_LENGTH_MS 40 /* 40 ms */
40 |
41 | #define PITCH_EST_MAX_FRAME_LENGTH (PITCH_EST_FRAME_LENGTH_MS * PITCH_EST_MAX_FS_KHZ)
42 | #define PITCH_EST_MAX_FRAME_LENGTH_ST_1 (PITCH_EST_MAX_FRAME_LENGTH >> 2)
43 | #define PITCH_EST_MAX_FRAME_LENGTH_ST_2 (PITCH_EST_MAX_FRAME_LENGTH >> 1)
44 | #define PITCH_EST_MAX_SF_FRAME_LENGTH (PITCH_EST_SUB_FRAME * PITCH_EST_MAX_FS_KHZ)
45 |
46 | #define PITCH_EST_MAX_LAG_MS 18 /* 18 ms -> 56 Hz */
47 | #define PITCH_EST_MIN_LAG_MS 2 /* 2 ms -> 500 Hz */
48 | #define PITCH_EST_MAX_LAG (PITCH_EST_MAX_LAG_MS * PITCH_EST_MAX_FS_KHZ)
49 | #define PITCH_EST_MIN_LAG (PITCH_EST_MIN_LAG_MS * PITCH_EST_MAX_FS_KHZ)
50 |
51 | #define PITCH_EST_NB_SUBFR 4
52 |
53 | #define PITCH_EST_D_SRCH_LENGTH 24
54 |
55 | #define PITCH_EST_MAX_DECIMATE_STATE_LENGTH 7
56 |
57 | #define PITCH_EST_NB_STAGE3_LAGS 5
58 |
59 | #define PITCH_EST_NB_CBKS_STAGE2 3
60 | #define PITCH_EST_NB_CBKS_STAGE2_EXT 11
61 |
62 | #define PITCH_EST_CB_mn2 1
63 | #define PITCH_EST_CB_mx2 2
64 |
65 | #define PITCH_EST_NB_CBKS_STAGE3_MAX 34
66 | #define PITCH_EST_NB_CBKS_STAGE3_MID 24
67 | #define PITCH_EST_NB_CBKS_STAGE3_MIN 16
68 |
69 | extern const SKP_int16 SKP_Silk_CB_lags_stage2[PITCH_EST_NB_SUBFR][PITCH_EST_NB_CBKS_STAGE2_EXT];
70 | extern const SKP_int16 SKP_Silk_CB_lags_stage3[PITCH_EST_NB_SUBFR][PITCH_EST_NB_CBKS_STAGE3_MAX];
71 | extern const SKP_int16 SKP_Silk_Lag_range_stage3[ SKP_Silk_PITCH_EST_MAX_COMPLEX + 1 ] [ PITCH_EST_NB_SUBFR ][ 2 ];
72 | extern const SKP_int16 SKP_Silk_cbk_sizes_stage3[ SKP_Silk_PITCH_EST_MAX_COMPLEX + 1 ];
73 | extern const SKP_int16 SKP_Silk_cbk_offsets_stage3[ SKP_Silk_PITCH_EST_MAX_COMPLEX + 1 ];
74 |
75 | #endif
76 |
77 |
--------------------------------------------------------------------------------
/jni/include/SKP_Silk_control.h:
--------------------------------------------------------------------------------
1 | /***********************************************************************
2 | Copyright (c) 2006-2012, Skype Limited. All rights reserved.
3 | Redistribution and use in source and binary forms, with or without
4 | modification, (subject to the limitations in the disclaimer below)
5 | are permitted provided that the following conditions are met:
6 | - Redistributions of source code must retain the above copyright notice,
7 | this list of conditions and the following disclaimer.
8 | - Redistributions in binary form must reproduce the above copyright
9 | notice, this list of conditions and the following disclaimer in the
10 | documentation and/or other materials provided with the distribution.
11 | - Neither the name of Skype Limited, nor the names of specific
12 | contributors, may be used to endorse or promote products derived from
13 | this software without specific prior written permission.
14 | NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED
15 | BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
16 | CONTRIBUTORS ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
17 | BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
18 | FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
19 | COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
20 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
22 | USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
23 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | ***********************************************************************/
27 |
28 | #ifndef SKP_SILK_CONTROL_H
29 | #define SKP_SILK_CONTROL_H
30 |
31 | #include "SKP_Silk_typedef.h"
32 |
33 | #ifdef __cplusplus
34 | extern "C"
35 | {
36 | #endif
37 |
38 | /***********************************************/
39 | /* Structure for controlling encoder operation */
40 | /***********************************************/
41 | typedef struct {
42 | /* I: Input signal sampling rate in Hertz; 8000/12000/16000/24000 */
43 | SKP_int32 API_sampleRate;
44 |
45 | /* I: Maximum internal sampling rate in Hertz; 8000/12000/16000/24000 */
46 | SKP_int32 maxInternalSampleRate;
47 |
48 | /* I: Number of samples per packet; must be equivalent of 20, 40, 60, 80 or 100 ms */
49 | SKP_int packetSize;
50 |
51 | /* I: Bitrate during active speech in bits/second; internally limited */
52 | SKP_int32 bitRate;
53 |
54 | /* I: Uplink packet loss in percent (0-100) */
55 | SKP_int packetLossPercentage;
56 |
57 | /* I: Complexity mode; 0 is lowest; 1 is medium and 2 is highest complexity */
58 | SKP_int complexity;
59 |
60 | /* I: Flag to enable in-band Forward Error Correction (FEC); 0/1 */
61 | SKP_int useInBandFEC;
62 |
63 | /* I: Flag to enable discontinuous transmission (DTX); 0/1 */
64 | SKP_int useDTX;
65 | } SKP_SILK_SDK_EncControlStruct;
66 |
67 | /**************************************************************************/
68 | /* Structure for controlling decoder operation and reading decoder status */
69 | /**************************************************************************/
70 | typedef struct {
71 | /* I: Output signal sampling rate in Hertz; 8000/12000/16000/24000 */
72 | SKP_int32 API_sampleRate;
73 |
74 | /* O: Number of samples per frame */
75 | SKP_int frameSize;
76 |
77 | /* O: Frames per packet 1, 2, 3, 4, 5 */
78 | SKP_int framesPerPacket;
79 |
80 | /* O: Flag to indicate that the decoder has remaining payloads internally */
81 | SKP_int moreInternalDecoderFrames;
82 |
83 | /* O: Distance between main payload and redundant payload in packets */
84 | SKP_int inBandFECOffset;
85 | } SKP_SILK_SDK_DecControlStruct;
86 |
87 | #ifdef __cplusplus
88 | }
89 | #endif
90 |
91 | #endif
92 |
--------------------------------------------------------------------------------
/jni/include/SKP_Silk_errors.h:
--------------------------------------------------------------------------------
1 | /***********************************************************************
2 | Copyright (c) 2006-2012, Skype Limited. All rights reserved.
3 | Redistribution and use in source and binary forms, with or without
4 | modification, (subject to the limitations in the disclaimer below)
5 | are permitted provided that the following conditions are met:
6 | - Redistributions of source code must retain the above copyright notice,
7 | this list of conditions and the following disclaimer.
8 | - Redistributions in binary form must reproduce the above copyright
9 | notice, this list of conditions and the following disclaimer in the
10 | documentation and/or other materials provided with the distribution.
11 | - Neither the name of Skype Limited, nor the names of specific
12 | contributors, may be used to endorse or promote products derived from
13 | this software without specific prior written permission.
14 | NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED
15 | BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
16 | CONTRIBUTORS ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
17 | BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
18 | FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
19 | COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
20 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
22 | USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
23 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | ***********************************************************************/
27 |
28 | #ifndef SKP_SILK_ERRORS_H
29 | #define SKP_SILK_ERRORS_H
30 |
31 | #ifdef __cplusplus
32 | extern "C"
33 | {
34 | #endif
35 |
36 | /******************/
37 | /* Error messages */
38 | /******************/
39 | #define SKP_SILK_NO_ERROR 0
40 |
41 | /**************************/
42 | /* Encoder error messages */
43 | /**************************/
44 |
45 | /* Input length is not a multiplum of 10 ms, or length is longer than the packet length */
46 | #define SKP_SILK_ENC_INPUT_INVALID_NO_OF_SAMPLES -1
47 |
48 | /* Sampling frequency not 8000, 12000, 16000 or 24000 Hertz */
49 | #define SKP_SILK_ENC_FS_NOT_SUPPORTED -2
50 |
51 | /* Packet size not 20, 40, 60, 80 or 100 ms */
52 | #define SKP_SILK_ENC_PACKET_SIZE_NOT_SUPPORTED -3
53 |
54 | /* Allocated payload buffer too short */
55 | #define SKP_SILK_ENC_PAYLOAD_BUF_TOO_SHORT -4
56 |
57 | /* Loss rate not between 0 and 100 percent */
58 | #define SKP_SILK_ENC_INVALID_LOSS_RATE -5
59 |
60 | /* Complexity setting not valid, use 0, 1 or 2 */
61 | #define SKP_SILK_ENC_INVALID_COMPLEXITY_SETTING -6
62 |
63 | /* Inband FEC setting not valid, use 0 or 1 */
64 | #define SKP_SILK_ENC_INVALID_INBAND_FEC_SETTING -7
65 |
66 | /* DTX setting not valid, use 0 or 1 */
67 | #define SKP_SILK_ENC_INVALID_DTX_SETTING -8
68 |
69 | /* Internal encoder error */
70 | #define SKP_SILK_ENC_INTERNAL_ERROR -9
71 |
72 | /**************************/
73 | /* Decoder error messages */
74 | /**************************/
75 |
76 | /* Output sampling frequency lower than internal decoded sampling frequency */
77 | #define SKP_SILK_DEC_INVALID_SAMPLING_FREQUENCY -10
78 |
79 | /* Payload size exceeded the maximum allowed 1024 bytes */
80 | #define SKP_SILK_DEC_PAYLOAD_TOO_LARGE -11
81 |
82 | /* Payload has bit errors */
83 | #define SKP_SILK_DEC_PAYLOAD_ERROR -12
84 |
85 | #ifdef __cplusplus
86 | }
87 | #endif
88 |
89 | #endif
90 |
--------------------------------------------------------------------------------
/jni/include/SKP_Silk_pitch_est_defines.h:
--------------------------------------------------------------------------------
1 | /***********************************************************************
2 | Copyright (c) 2006-2012, Skype Limited. All rights reserved.
3 | Redistribution and use in source and binary forms, with or without
4 | modification, (subject to the limitations in the disclaimer below)
5 | are permitted provided that the following conditions are met:
6 | - Redistributions of source code must retain the above copyright notice,
7 | this list of conditions and the following disclaimer.
8 | - Redistributions in binary form must reproduce the above copyright
9 | notice, this list of conditions and the following disclaimer in the
10 | documentation and/or other materials provided with the distribution.
11 | - Neither the name of Skype Limited, nor the names of specific
12 | contributors, may be used to endorse or promote products derived from
13 | this software without specific prior written permission.
14 | NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED
15 | BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
16 | CONTRIBUTORS ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
17 | BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
18 | FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
19 | COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
20 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
22 | USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
23 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | ***********************************************************************/
27 |
28 | #ifndef SIGPROCFIX_PITCH_EST_DEFINES_H
29 | #define SIGPROCFIX_PITCH_EST_DEFINES_H
30 |
31 | /************************************************************/
32 | /* Definitions For Fix pitch estimator */
33 | /************************************************************/
34 |
35 | #define PITCH_EST_SHORTLAG_BIAS_Q15 6554 /* 0.2f. for logarithmic weighting */
36 | #define PITCH_EST_PREVLAG_BIAS_Q15 6554 /* Prev lag bias */
37 | #define PITCH_EST_FLATCONTOUR_BIAS_Q20 52429 /* 0.05f */
38 |
39 | #endif
40 |
41 |
--------------------------------------------------------------------------------
/jni/include/SKP_Silk_resampler_structs.h:
--------------------------------------------------------------------------------
1 | /***********************************************************************
2 | Copyright (c) 2006-2012, Skype Limited. All rights reserved.
3 | Redistribution and use in source and binary forms, with or without
4 | modification, (subject to the limitations in the disclaimer below)
5 | are permitted provided that the following conditions are met:
6 | - Redistributions of source code must retain the above copyright notice,
7 | this list of conditions and the following disclaimer.
8 | - Redistributions in binary form must reproduce the above copyright
9 | notice, this list of conditions and the following disclaimer in the
10 | documentation and/or other materials provided with the distribution.
11 | - Neither the name of Skype Limited, nor the names of specific
12 | contributors, may be used to endorse or promote products derived from
13 | this software without specific prior written permission.
14 | NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED
15 | BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
16 | CONTRIBUTORS ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
17 | BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
18 | FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
19 | COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
20 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
22 | USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
23 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | ***********************************************************************/
27 |
28 | /* *
29 | * File Name: SKP_Silk_resampler_structs.h *
30 | * *
31 | * Description: Structs for IIR/FIR resamplers *
32 | * *
33 | * Copyright 2010 (c), Skype Limited *
34 | * All rights reserved. *
35 | * *
36 | * */
37 |
38 | #ifndef SKP_Silk_RESAMPLER_STRUCTS_H
39 | #define SKP_Silk_RESAMPLER_STRUCTS_H
40 |
41 | #ifdef __cplusplus
42 | extern "C" {
43 | #endif
44 |
45 | /* Flag to enable support for input/output sampling rates above 48 kHz. Turn off for embedded devices */
46 | #define RESAMPLER_SUPPORT_ABOVE_48KHZ 1
47 |
48 | #define SKP_Silk_RESAMPLER_MAX_FIR_ORDER 16
49 | #define SKP_Silk_RESAMPLER_MAX_IIR_ORDER 6
50 |
51 |
52 | typedef struct _SKP_Silk_resampler_state_struct{
53 | SKP_int32 sIIR[ SKP_Silk_RESAMPLER_MAX_IIR_ORDER ]; /* this must be the first element of this struct */
54 | SKP_int32 sFIR[ SKP_Silk_RESAMPLER_MAX_FIR_ORDER ];
55 | SKP_int32 sDown2[ 2 ];
56 | void (*resampler_function)( void *, SKP_int16 *, const SKP_int16 *, SKP_int32 );
57 | void (*up2_function)( SKP_int32 *, SKP_int16 *, const SKP_int16 *, SKP_int32 );
58 | SKP_int32 batchSize;
59 | SKP_int32 invRatio_Q16;
60 | SKP_int32 FIR_Fracs;
61 | SKP_int32 input2x;
62 | const SKP_int16 *Coefs;
63 | #if RESAMPLER_SUPPORT_ABOVE_48KHZ
64 | SKP_int32 sDownPre[ 2 ];
65 | SKP_int32 sUpPost[ 2 ];
66 | void (*down_pre_function)( SKP_int32 *, SKP_int16 *, const SKP_int16 *, SKP_int32 );
67 | void (*up_post_function)( SKP_int32 *, SKP_int16 *, const SKP_int16 *, SKP_int32 );
68 | SKP_int32 batchSizePrePost;
69 | SKP_int32 ratio_Q16;
70 | SKP_int32 nPreDownsamplers;
71 | SKP_int32 nPostUpsamplers;
72 | #endif
73 | SKP_int32 magic_number;
74 | } SKP_Silk_resampler_state_struct;
75 |
76 | #ifdef __cplusplus
77 | }
78 | #endif
79 | #endif /* SKP_Silk_RESAMPLER_STRUCTS_H */
80 |
81 |
--------------------------------------------------------------------------------
/jni/include/SKP_Silk_tables_NLSF_CB0_10.h:
--------------------------------------------------------------------------------
1 | /***********************************************************************
2 | Copyright (c) 2006-2012, Skype Limited. All rights reserved.
3 | Redistribution and use in source and binary forms, with or without
4 | modification, (subject to the limitations in the disclaimer below)
5 | are permitted provided that the following conditions are met:
6 | - Redistributions of source code must retain the above copyright notice,
7 | this list of conditions and the following disclaimer.
8 | - Redistributions in binary form must reproduce the above copyright
9 | notice, this list of conditions and the following disclaimer in the
10 | documentation and/or other materials provided with the distribution.
11 | - Neither the name of Skype Limited, nor the names of specific
12 | contributors, may be used to endorse or promote products derived from
13 | this software without specific prior written permission.
14 | NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED
15 | BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
16 | CONTRIBUTORS ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
17 | BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
18 | FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
19 | COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
20 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
22 | USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
23 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | ***********************************************************************/
27 |
28 | #ifndef SKP_SILK_TABLES_NLSF_CB0_10_H
29 | #define SKP_SILK_TABLES_NLSF_CB0_10_H
30 |
31 | #include "SKP_Silk_define.h"
32 |
33 | #ifdef __cplusplus
34 | extern "C"
35 | {
36 | #endif
37 |
38 | #define NLSF_MSVQ_CB0_10_STAGES 6
39 | #define NLSF_MSVQ_CB0_10_VECTORS 120
40 |
41 | /* NLSF codebook entropy coding tables */
42 | extern const SKP_uint16 SKP_Silk_NLSF_MSVQ_CB0_10_CDF[ NLSF_MSVQ_CB0_10_VECTORS + NLSF_MSVQ_CB0_10_STAGES ];
43 | extern const SKP_uint16 * const SKP_Silk_NLSF_MSVQ_CB0_10_CDF_start_ptr[ NLSF_MSVQ_CB0_10_STAGES ];
44 | extern const SKP_int SKP_Silk_NLSF_MSVQ_CB0_10_CDF_middle_idx[ NLSF_MSVQ_CB0_10_STAGES ];
45 |
46 | #ifdef __cplusplus
47 | }
48 | #endif
49 |
50 | #endif
51 |
52 |
--------------------------------------------------------------------------------
/jni/include/SKP_Silk_tables_NLSF_CB0_16.h:
--------------------------------------------------------------------------------
1 | /***********************************************************************
2 | Copyright (c) 2006-2012, Skype Limited. All rights reserved.
3 | Redistribution and use in source and binary forms, with or without
4 | modification, (subject to the limitations in the disclaimer below)
5 | are permitted provided that the following conditions are met:
6 | - Redistributions of source code must retain the above copyright notice,
7 | this list of conditions and the following disclaimer.
8 | - Redistributions in binary form must reproduce the above copyright
9 | notice, this list of conditions and the following disclaimer in the
10 | documentation and/or other materials provided with the distribution.
11 | - Neither the name of Skype Limited, nor the names of specific
12 | contributors, may be used to endorse or promote products derived from
13 | this software without specific prior written permission.
14 | NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED
15 | BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
16 | CONTRIBUTORS ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
17 | BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
18 | FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
19 | COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
20 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
22 | USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
23 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | ***********************************************************************/
27 |
28 | #ifndef SKP_SILK_TABLES_NLSF_CB0_16_H
29 | #define SKP_SILK_TABLES_NLSF_CB0_16_H
30 |
31 | #include "SKP_Silk_define.h"
32 |
33 | #ifdef __cplusplus
34 | extern "C"
35 | {
36 | #endif
37 |
38 | #define NLSF_MSVQ_CB0_16_STAGES 10
39 | #define NLSF_MSVQ_CB0_16_VECTORS 216
40 |
41 | /* NLSF codebook entropy coding tables */
42 | extern const SKP_uint16 SKP_Silk_NLSF_MSVQ_CB0_16_CDF[ NLSF_MSVQ_CB0_16_VECTORS + NLSF_MSVQ_CB0_16_STAGES ];
43 | extern const SKP_uint16 * const SKP_Silk_NLSF_MSVQ_CB0_16_CDF_start_ptr[ NLSF_MSVQ_CB0_16_STAGES ];
44 | extern const SKP_int SKP_Silk_NLSF_MSVQ_CB0_16_CDF_middle_idx[ NLSF_MSVQ_CB0_16_STAGES ];
45 |
46 | #ifdef __cplusplus
47 | }
48 | #endif
49 |
50 | #endif
51 |
52 |
--------------------------------------------------------------------------------
/jni/include/SKP_Silk_tables_NLSF_CB1_10.h:
--------------------------------------------------------------------------------
1 | /***********************************************************************
2 | Copyright (c) 2006-2012, Skype Limited. All rights reserved.
3 | Redistribution and use in source and binary forms, with or without
4 | modification, (subject to the limitations in the disclaimer below)
5 | are permitted provided that the following conditions are met:
6 | - Redistributions of source code must retain the above copyright notice,
7 | this list of conditions and the following disclaimer.
8 | - Redistributions in binary form must reproduce the above copyright
9 | notice, this list of conditions and the following disclaimer in the
10 | documentation and/or other materials provided with the distribution.
11 | - Neither the name of Skype Limited, nor the names of specific
12 | contributors, may be used to endorse or promote products derived from
13 | this software without specific prior written permission.
14 | NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED
15 | BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
16 | CONTRIBUTORS ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
17 | BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
18 | FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
19 | COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
20 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
22 | USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
23 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | ***********************************************************************/
27 |
28 | #ifndef SKP_SILK_TABLES_NLSF_CB1_10_H
29 | #define SKP_SILK_TABLES_NLSF_CB1_10_H
30 |
31 | #include "SKP_Silk_define.h"
32 |
33 | #ifdef __cplusplus
34 | extern "C"
35 | {
36 | #endif
37 |
38 | #define NLSF_MSVQ_CB1_10_STAGES 6
39 | #define NLSF_MSVQ_CB1_10_VECTORS 72
40 |
41 | /* NLSF codebook entropy coding tables */
42 | extern const SKP_uint16 SKP_Silk_NLSF_MSVQ_CB1_10_CDF[ NLSF_MSVQ_CB1_10_VECTORS + NLSF_MSVQ_CB1_10_STAGES ];
43 | extern const SKP_uint16 * const SKP_Silk_NLSF_MSVQ_CB1_10_CDF_start_ptr[ NLSF_MSVQ_CB1_10_STAGES ];
44 | extern const SKP_int SKP_Silk_NLSF_MSVQ_CB1_10_CDF_middle_idx[ NLSF_MSVQ_CB1_10_STAGES ];
45 |
46 | #ifdef __cplusplus
47 | }
48 | #endif
49 |
50 | #endif
51 |
52 |
--------------------------------------------------------------------------------
/jni/include/SKP_Silk_tables_NLSF_CB1_16.h:
--------------------------------------------------------------------------------
1 | /***********************************************************************
2 | Copyright (c) 2006-2012, Skype Limited. All rights reserved.
3 | Redistribution and use in source and binary forms, with or without
4 | modification, (subject to the limitations in the disclaimer below)
5 | are permitted provided that the following conditions are met:
6 | - Redistributions of source code must retain the above copyright notice,
7 | this list of conditions and the following disclaimer.
8 | - Redistributions in binary form must reproduce the above copyright
9 | notice, this list of conditions and the following disclaimer in the
10 | documentation and/or other materials provided with the distribution.
11 | - Neither the name of Skype Limited, nor the names of specific
12 | contributors, may be used to endorse or promote products derived from
13 | this software without specific prior written permission.
14 | NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED
15 | BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
16 | CONTRIBUTORS ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
17 | BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
18 | FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
19 | COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
20 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
22 | USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
23 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | ***********************************************************************/
27 |
28 | #ifndef SKP_SILK_TABLES_NLSF_CB1_16_H
29 | #define SKP_SILK_TABLES_NLSF_CB1_16_H
30 |
31 | #include "SKP_Silk_define.h"
32 |
33 | #ifdef __cplusplus
34 | extern "C"
35 | {
36 | #endif
37 |
38 | #define NLSF_MSVQ_CB1_16_STAGES 10
39 | #define NLSF_MSVQ_CB1_16_VECTORS 104
40 |
41 | /* NLSF codebook entropy coding tables */
42 | extern const SKP_uint16 SKP_Silk_NLSF_MSVQ_CB1_16_CDF[ NLSF_MSVQ_CB1_16_VECTORS + NLSF_MSVQ_CB1_16_STAGES ];
43 | extern const SKP_uint16 * const SKP_Silk_NLSF_MSVQ_CB1_16_CDF_start_ptr[ NLSF_MSVQ_CB1_16_STAGES ];
44 | extern const SKP_int SKP_Silk_NLSF_MSVQ_CB1_16_CDF_middle_idx[ NLSF_MSVQ_CB1_16_STAGES ];
45 |
46 | #ifdef __cplusplus
47 | }
48 | #endif
49 |
50 | #endif
51 |
52 |
--------------------------------------------------------------------------------
/jni/include/silk.h:
--------------------------------------------------------------------------------
1 | //
2 | // Created by ketian on 16-9-23.
3 | //
4 |
5 | #ifndef JNI_SILK_H
6 | #define JNI_SILK_H
7 |
8 | #include
9 | #include
10 |
11 | int convertSilk2PCM(const char *src, const FILE *dest);
12 |
13 | #define LOG_TAG "tian.ke"
14 | #define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG, LOG_TAG, __VA_ARGS__)
15 |
16 | #endif //JNI_SILK_H
17 |
--------------------------------------------------------------------------------
/jni/libmp3lame/VbrTag.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Xing VBR tagging for LAME.
3 | *
4 | * Copyright (c) 1999 A.L. Faber
5 | *
6 | * This library is free software; you can redistribute it and/or
7 | * modify it under the terms of the GNU Library General Public
8 | * License as published by the Free Software Foundation; either
9 | * version 2 of the License, or (at your option) any later version.
10 | *
11 | * This library is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 | * Library General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Library General Public
17 | * License along with this library; if not, write to the
18 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 | * Boston, MA 02111-1307, USA.
20 | */
21 |
22 | #ifndef LAME_VRBTAG_H
23 | #define LAME_VRBTAG_H
24 |
25 |
26 | /* -----------------------------------------------------------
27 | * A Vbr header may be present in the ancillary
28 | * data field of the first frame of an mp3 bitstream
29 | * The Vbr header (optionally) contains
30 | * frames total number of audio frames in the bitstream
31 | * bytes total number of bytes in the bitstream
32 | * toc table of contents
33 |
34 | * toc (table of contents) gives seek points
35 | * for random access
36 | * the ith entry determines the seek point for
37 | * i-percent duration
38 | * seek point in bytes = (toc[i]/256.0) * total_bitstream_bytes
39 | * e.g. half duration seek point = (toc[50]/256.0) * total_bitstream_bytes
40 | */
41 |
42 |
43 | #define FRAMES_FLAG 0x0001
44 | #define BYTES_FLAG 0x0002
45 | #define TOC_FLAG 0x0004
46 | #define VBR_SCALE_FLAG 0x0008
47 |
48 | #define NUMTOCENTRIES 100
49 |
50 | #ifndef lame_internal_flags_defined
51 | #define lame_internal_flags_defined
52 | struct lame_internal_flags;
53 | typedef struct lame_internal_flags lame_internal_flags;
54 | #endif
55 |
56 |
57 | /*structure to receive extracted header */
58 | /* toc may be NULL*/
59 | typedef struct {
60 | int h_id; /* from MPEG header, 0=MPEG2, 1=MPEG1 */
61 | int samprate; /* determined from MPEG header */
62 | int flags; /* from Vbr header data */
63 | int frames; /* total bit stream frames from Vbr header data */
64 | int bytes; /* total bit stream bytes from Vbr header data */
65 | int vbr_scale; /* encoded vbr scale from Vbr header data */
66 | unsigned char toc[NUMTOCENTRIES]; /* may be NULL if toc not desired */
67 | int headersize; /* size of VBR header, in bytes */
68 | int enc_delay; /* encoder delay */
69 | int enc_padding; /* encoder paddign added at end of stream */
70 | } VBRTAGDATA;
71 |
72 | int GetVbrTag(VBRTAGDATA * pTagData, const unsigned char *buf);
73 |
74 | int InitVbrTag(lame_global_flags * gfp);
75 | int PutVbrTag(lame_global_flags const *gfp, FILE * fid);
76 | void AddVbrFrame(lame_internal_flags * gfc);
77 | void UpdateMusicCRC(uint16_t * crc, const unsigned char *buffer, int size);
78 |
79 | #endif
80 |
--------------------------------------------------------------------------------
/jni/libmp3lame/bitstream.h:
--------------------------------------------------------------------------------
1 | /*
2 | * MP3 bitstream Output interface for LAME
3 | *
4 | * Copyright (c) 1999 Takehiro TOMINAGA
5 | *
6 | * This library is free software; you can redistribute it and/or
7 | * modify it under the terms of the GNU Library General Public
8 | * License as published by the Free Software Foundation; either
9 | * version 2 of the License, or (at your option) any later version.
10 | *
11 | * This library is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 | * Library General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Library General Public
17 | * License along with this library; if not, write to the
18 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 | * Boston, MA 02111-1307, USA.
20 | */
21 |
22 | #ifndef LAME_BITSTREAM_H
23 | #define LAME_BITSTREAM_H
24 |
25 | int getframebits(const lame_internal_flags * gfc);
26 |
27 | int format_bitstream(lame_internal_flags * gfc);
28 |
29 | void flush_bitstream(lame_internal_flags * gfc);
30 | void add_dummy_byte(lame_internal_flags * gfc, unsigned char val, unsigned int n);
31 |
32 | int copy_buffer(lame_internal_flags * gfc, unsigned char *buffer, int buffer_size,
33 | int update_crc);
34 | void init_bit_stream_w(lame_internal_flags * gfc);
35 | void CRC_writeheader(lame_internal_flags const *gfc, char *buffer);
36 | int compute_flushbits(const lame_internal_flags * gfp, int *nbytes);
37 |
38 | int get_max_frame_buffer_size_by_constraint(SessionConfig_t const * cfg, int constraint);
39 |
40 | #endif
41 |
--------------------------------------------------------------------------------
/jni/libmp3lame/fft.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Fast Fourier Transform include file
3 | *
4 | * Copyright (c) 2000 Mark Taylor
5 | *
6 | * This library is free software; you can redistribute it and/or
7 | * modify it under the terms of the GNU Library General Public
8 | * License as published by the Free Software Foundation; either
9 | * version 2 of the License, or (at your option) any later version.
10 | *
11 | * This library is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 | * Library General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Library General Public
17 | * License along with this library; if not, write to the
18 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 | * Boston, MA 02111-1307, USA.
20 | */
21 |
22 | #ifndef LAME_FFT_H
23 | #define LAME_FFT_H
24 |
25 | void fft_long(lame_internal_flags const *const gfc, FLOAT x_real[BLKSIZE],
26 | int chn, const sample_t *const data[2]);
27 |
28 | void fft_short(lame_internal_flags const *const gfc, FLOAT x_real[3][BLKSIZE_s],
29 | int chn, const sample_t *const data[2]);
30 |
31 | void init_fft(lame_internal_flags * const gfc);
32 |
33 | #endif
34 |
35 | /* End of fft.h */
36 |
--------------------------------------------------------------------------------
/jni/libmp3lame/id3tag.h:
--------------------------------------------------------------------------------
1 |
2 | #ifndef LAME_ID3_H
3 | #define LAME_ID3_H
4 |
5 |
6 | #define CHANGED_FLAG (1U << 0)
7 | #define ADD_V2_FLAG (1U << 1)
8 | #define V1_ONLY_FLAG (1U << 2)
9 | #define V2_ONLY_FLAG (1U << 3)
10 | #define SPACE_V1_FLAG (1U << 4)
11 | #define PAD_V2_FLAG (1U << 5)
12 |
13 | enum {
14 | MIMETYPE_NONE = 0,
15 | MIMETYPE_JPEG,
16 | MIMETYPE_PNG,
17 | MIMETYPE_GIF,
18 | };
19 |
20 | typedef struct FrameDataNode {
21 | struct FrameDataNode *nxt;
22 | uint32_t fid; /* Frame Identifier */
23 | char lng[4]; /* 3-character language descriptor */
24 | struct {
25 | union {
26 | char *l; /* ptr to Latin-1 chars */
27 | unsigned short *u; /* ptr to UCS-2 text */
28 | unsigned char *b; /* ptr to raw bytes */
29 | } ptr;
30 | size_t dim;
31 | int enc; /* 0:Latin-1, 1:UCS-2, 2:RAW */
32 | } dsc , txt;
33 | } FrameDataNode;
34 |
35 |
36 | typedef struct id3tag_spec {
37 | /* private data members */
38 | unsigned int flags;
39 | int year;
40 | char *title;
41 | char *artist;
42 | char *album;
43 | char *comment;
44 | int track_id3v1;
45 | int genre_id3v1;
46 | unsigned char *albumart;
47 | unsigned int albumart_size;
48 | unsigned int padding_size;
49 | int albumart_mimetype;
50 | FrameDataNode *v2_head, *v2_tail;
51 | } id3tag_spec;
52 |
53 |
54 | /* write tag into stream at current position */
55 | extern int id3tag_write_v2(lame_global_flags * gfp);
56 | extern int id3tag_write_v1(lame_global_flags * gfp);
57 | /*
58 | * NOTE: A version 2 tag will NOT be added unless one of the text fields won't
59 | * fit in a version 1 tag (e.g. the title string is longer than 30 characters),
60 | * or the "id3tag_add_v2" or "id3tag_v2_only" functions are used.
61 | */
62 |
63 | #endif
64 |
--------------------------------------------------------------------------------
/jni/libmp3lame/l3side.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Layer 3 side include file
3 | *
4 | * Copyright (c) 1999 Mark Taylor
5 | *
6 | * This library is free software; you can redistribute it and/or
7 | * modify it under the terms of the GNU Library General Public
8 | * License as published by the Free Software Foundation; either
9 | * version 2 of the License, or (at your option) any later version.
10 | *
11 | * This library is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 | * Library General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Library General Public
17 | * License along with this library; if not, write to the
18 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 | * Boston, MA 02111-1307, USA.
20 | */
21 |
22 | #ifndef LAME_L3SIDE_H
23 | #define LAME_L3SIDE_H
24 |
25 | /* max scalefactor band, max(SBMAX_l, SBMAX_s*3, (SBMAX_s-3)*3+8) */
26 | #define SFBMAX (SBMAX_s*3)
27 |
28 | /* Layer III side information. */
29 | typedef struct {
30 | int l[1 + SBMAX_l];
31 | int s[1 + SBMAX_s];
32 | int psfb21[1 + PSFB21];
33 | int psfb12[1 + PSFB12];
34 | } scalefac_struct;
35 |
36 |
37 | typedef struct {
38 | FLOAT l[SBMAX_l];
39 | FLOAT s[SBMAX_s][3];
40 | } III_psy_xmin;
41 |
42 | typedef struct {
43 | III_psy_xmin thm;
44 | III_psy_xmin en;
45 | } III_psy_ratio;
46 |
47 | typedef struct {
48 | FLOAT xr[576];
49 | int l3_enc[576];
50 | int scalefac[SFBMAX];
51 | FLOAT xrpow_max;
52 |
53 | int part2_3_length;
54 | int big_values;
55 | int count1;
56 | int global_gain;
57 | int scalefac_compress;
58 | int block_type;
59 | int mixed_block_flag;
60 | int table_select[3];
61 | int subblock_gain[3 + 1];
62 | int region0_count;
63 | int region1_count;
64 | int preflag;
65 | int scalefac_scale;
66 | int count1table_select;
67 |
68 | int part2_length;
69 | int sfb_lmax;
70 | int sfb_smin;
71 | int psy_lmax;
72 | int sfbmax;
73 | int psymax;
74 | int sfbdivide;
75 | int width[SFBMAX];
76 | int window[SFBMAX];
77 | int count1bits;
78 | /* added for LSF */
79 | const int *sfb_partition_table;
80 | int slen[4];
81 |
82 | int max_nonzero_coeff;
83 | char energy_above_cutoff[SFBMAX];
84 | } gr_info;
85 |
86 | typedef struct {
87 | gr_info tt[2][2];
88 | int main_data_begin;
89 | int private_bits;
90 | int resvDrain_pre;
91 | int resvDrain_post;
92 | int scfsi[2][4];
93 | } III_side_info_t;
94 |
95 | #endif
96 |
--------------------------------------------------------------------------------
/jni/libmp3lame/lame-analysis.h:
--------------------------------------------------------------------------------
1 | /*
2 | * GTK plotting routines source file
3 | *
4 | * Copyright (c) 1999 Mark Taylor
5 | *
6 | * This library is free software; you can redistribute it and/or
7 | * modify it under the terms of the GNU Library General Public
8 | * License as published by the Free Software Foundation; either
9 | * version 2 of the License, or (at your option) any later version.
10 | *
11 | * This library is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 | * Library General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Library General Public
17 | * License along with this library; if not, write to the
18 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 | * Boston, MA 02111-1307, USA.
20 | */
21 |
22 | #ifndef LAME_GTKANAL_H
23 | #define LAME_GTKANAL_H
24 |
25 |
26 | #define READ_AHEAD 40 /* number of frames to read ahead */
27 | #define MAXMPGLAG READ_AHEAD /* if the mpg123 lag becomes bigger than this
28 | we have to stop */
29 | #define NUMBACK 6 /* number of frames we can back up */
30 | #define NUMPINFO (NUMBACK+READ_AHEAD+1)
31 |
32 |
33 |
34 | struct plotting_data {
35 | int frameNum; /* current frame number */
36 | int frameNum123;
37 | int num_samples; /* number of pcm samples read for this frame */
38 | double frametime; /* starting time of frame, in seconds */
39 | double pcmdata[2][1600];
40 | double pcmdata2[2][1152 + 1152 - DECDELAY];
41 | double xr[2][2][576];
42 | double mpg123xr[2][2][576];
43 | double ms_ratio[2];
44 | double ms_ener_ratio[2];
45 |
46 | /* L,R, M and S values */
47 | double energy_save[4][BLKSIZE]; /* psymodel is one ahead */
48 | double energy[2][4][BLKSIZE];
49 | double pe[2][4];
50 | double thr[2][4][SBMAX_l];
51 | double en[2][4][SBMAX_l];
52 | double thr_s[2][4][3 * SBMAX_s];
53 | double en_s[2][4][3 * SBMAX_s];
54 | double ers_save[4]; /* psymodel is one ahead */
55 | double ers[2][4];
56 |
57 | double sfb[2][2][SBMAX_l];
58 | double sfb_s[2][2][3 * SBMAX_s];
59 | double LAMEsfb[2][2][SBMAX_l];
60 | double LAMEsfb_s[2][2][3 * SBMAX_s];
61 |
62 | int LAMEqss[2][2];
63 | int qss[2][2];
64 | int big_values[2][2];
65 | int sub_gain[2][2][3];
66 |
67 | double xfsf[2][2][SBMAX_l];
68 | double xfsf_s[2][2][3 * SBMAX_s];
69 |
70 | int over[2][2];
71 | double tot_noise[2][2];
72 | double max_noise[2][2];
73 | double over_noise[2][2];
74 | int over_SSD[2][2];
75 | int blocktype[2][2];
76 | int scalefac_scale[2][2];
77 | int preflag[2][2];
78 | int mpg123blocktype[2][2];
79 | int mixed[2][2];
80 | int mainbits[2][2];
81 | int sfbits[2][2];
82 | int LAMEmainbits[2][2];
83 | int LAMEsfbits[2][2];
84 | int framesize, stereo, js, ms_stereo, i_stereo, emph, bitrate, sampfreq, maindata;
85 | int crc, padding;
86 | int scfsi[2], mean_bits, resvsize;
87 | int totbits;
88 | };
89 | #ifndef plotting_data_defined
90 | #define plotting_data_defined
91 | typedef struct plotting_data plotting_data;
92 | #endif
93 | #if 0
94 | extern plotting_data *pinfo;
95 | #endif
96 | #endif
97 |
--------------------------------------------------------------------------------
/jni/libmp3lame/lameerror.h:
--------------------------------------------------------------------------------
1 | /*
2 | * A collection of LAME Error Codes
3 | *
4 | * Please use the constants defined here instead of some arbitrary
5 | * values. Currently the values starting at -10 to avoid intersection
6 | * with the -1, -2, -3 and -4 used in the current code.
7 | *
8 | * May be this should be a part of the include/lame.h.
9 | */
10 |
11 | typedef enum {
12 | LAME_OKAY = 0,
13 | LAME_NOERROR = 0,
14 | LAME_GENERICERROR = -1,
15 | LAME_NOMEM = -10,
16 | LAME_BADBITRATE = -11,
17 | LAME_BADSAMPFREQ = -12,
18 | LAME_INTERNALERROR = -13,
19 |
20 | FRONTEND_READERROR = -80,
21 | FRONTEND_WRITEERROR = -81,
22 | FRONTEND_FILETOOLARGE = -82,
23 |
24 | } lame_errorcodes_t;
25 |
26 | /* end of lameerror.h */
27 |
--------------------------------------------------------------------------------
/jni/libmp3lame/newmdct.h:
--------------------------------------------------------------------------------
1 | /*
2 | * New Modified DCT include file
3 | *
4 | * Copyright (c) 1999 Takehiro TOMINAGA
5 | *
6 | * This library is free software; you can redistribute it and/or
7 | * modify it under the terms of the GNU Library General Public
8 | * License as published by the Free Software Foundation; either
9 | * version 2 of the License, or (at your option) any later version.
10 | *
11 | * This library is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 | * Library General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Library General Public
17 | * License along with this library; if not, write to the
18 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 | * Boston, MA 02111-1307, USA.
20 | */
21 |
22 | #ifndef LAME_NEWMDCT_H
23 | #define LAME_NEWMDCT_H
24 |
25 | void mdct_sub48(lame_internal_flags * gfc, const sample_t * w0, const sample_t * w1);
26 |
27 | #endif /* LAME_NEWMDCT_H */
28 |
--------------------------------------------------------------------------------
/jni/libmp3lame/psymodel.h:
--------------------------------------------------------------------------------
1 | /*
2 | * psymodel.h
3 | *
4 | * Copyright (c) 1999 Mark Taylor
5 | *
6 | * This library is free software; you can redistribute it and/or
7 | * modify it under the terms of the GNU Library General Public
8 | * License as published by the Free Software Foundation; either
9 | * version 2 of the License, or (at your option) any later version.
10 | *
11 | * This library is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 | * Library General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Library General Public
17 | * License along with this library; if not, write to the
18 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 | * Boston, MA 02111-1307, USA.
20 | */
21 |
22 | #ifndef LAME_PSYMODEL_H
23 | #define LAME_PSYMODEL_H
24 |
25 |
26 | int L3psycho_anal_ns(lame_internal_flags * gfc,
27 | const sample_t *const buffer[2], int gr,
28 | III_psy_ratio ratio[2][2],
29 | III_psy_ratio MS_ratio[2][2],
30 | FLOAT pe[2], FLOAT pe_MS[2], FLOAT ener[2], int blocktype_d[2]);
31 |
32 | int L3psycho_anal_vbr(lame_internal_flags * gfc,
33 | const sample_t *const buffer[2], int gr,
34 | III_psy_ratio ratio[2][2],
35 | III_psy_ratio MS_ratio[2][2],
36 | FLOAT pe[2], FLOAT pe_MS[2], FLOAT ener[2], int blocktype_d[2]);
37 |
38 |
39 | int psymodel_init(lame_global_flags const* gfp);
40 |
41 |
42 | #define rpelev 2
43 | #define rpelev2 16
44 | #define rpelev_s 2
45 | #define rpelev2_s 16
46 |
47 | /* size of each partition band, in barks: */
48 | #define DELBARK .34
49 |
50 |
51 | /* tuned for output level (sensitive to energy scale) */
52 | #define VO_SCALE (1./( 14752*14752 )/(BLKSIZE/2))
53 |
54 | #define temporalmask_sustain_sec 0.01
55 |
56 | #define NS_PREECHO_ATT0 0.8
57 | #define NS_PREECHO_ATT1 0.6
58 | #define NS_PREECHO_ATT2 0.3
59 |
60 | #define NS_MSFIX 3.5
61 | #define NSATTACKTHRE 4.4
62 | #define NSATTACKTHRE_S 25
63 |
64 | #endif /* LAME_PSYMODEL_H */
65 |
--------------------------------------------------------------------------------
/jni/libmp3lame/quantize.h:
--------------------------------------------------------------------------------
1 | /*
2 | * MP3 quantization
3 | *
4 | * Copyright (c) 1999 Mark Taylor
5 | *
6 | * This library is free software; you can redistribute it and/or
7 | * modify it under the terms of the GNU Library General Public
8 | * License as published by the Free Software Foundation; either
9 | * version 2 of the License, or (at your option) any later version.
10 | *
11 | * This library is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 | * Library General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Library General Public
17 | * License along with this library; if not, write to the
18 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 | * Boston, MA 02111-1307, USA.
20 | */
21 |
22 | #ifndef LAME_QUANTIZE_H
23 | #define LAME_QUANTIZE_H
24 |
25 | void CBR_iteration_loop(lame_internal_flags * gfc, const FLOAT pe[2][2],
26 | const FLOAT ms_ratio[2], const III_psy_ratio ratio[2][2]);
27 |
28 | void VBR_old_iteration_loop(lame_internal_flags * gfc, const FLOAT pe[2][2],
29 | const FLOAT ms_ratio[2], const III_psy_ratio ratio[2][2]);
30 |
31 | void VBR_new_iteration_loop(lame_internal_flags * gfc, const FLOAT pe[2][2],
32 | const FLOAT ms_ratio[2], const III_psy_ratio ratio[2][2]);
33 |
34 | void ABR_iteration_loop(lame_internal_flags * gfc, const FLOAT pe[2][2],
35 | const FLOAT ms_ratio[2], const III_psy_ratio ratio[2][2]);
36 |
37 |
38 | #endif /* LAME_QUANTIZE_H */
39 |
--------------------------------------------------------------------------------
/jni/libmp3lame/reservoir.h:
--------------------------------------------------------------------------------
1 | /*
2 | * bit reservoir include file
3 | *
4 | * Copyright (c) 1999 Mark Taylor
5 | *
6 | * This library is free software; you can redistribute it and/or
7 | * modify it under the terms of the GNU Library General Public
8 | * License as published by the Free Software Foundation; either
9 | * version 2 of the License, or (at your option) any later version.
10 | *
11 | * This library is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 | * Library General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Library General Public
17 | * License along with this library; if not, write to the
18 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 | * Boston, MA 02111-1307, USA.
20 | */
21 |
22 | #ifndef LAME_RESERVOIR_H
23 | #define LAME_RESERVOIR_H
24 |
25 | int ResvFrameBegin(lame_internal_flags * gfc, int *mean_bits);
26 | void ResvMaxBits(lame_internal_flags * gfc, int mean_bits, int *targ_bits, int *max_bits,
27 | int cbr);
28 | void ResvAdjust(lame_internal_flags * gfc, gr_info const *gi);
29 | void ResvFrameEnd(lame_internal_flags * gfc, int mean_bits);
30 |
31 | #endif /* LAME_RESERVOIR_H */
32 |
--------------------------------------------------------------------------------
/jni/libmp3lame/set_get.h:
--------------------------------------------------------------------------------
1 | /*
2 | * set_get.h -- Internal set/get definitions
3 | *
4 | * Copyright (C) 2003 Gabriel Bouvigne / Lame project
5 | *
6 | * This library is free software; you can redistribute it and/or
7 | * modify it under the terms of the GNU Library General Public
8 | * License as published by the Free Software Foundation; either
9 | * version 2 of the License, or (at your option) any later version.
10 | *
11 | * This library is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 | * Library General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Library General Public
17 | * License along with this library; if not, write to the Free Software
18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
19 | */
20 |
21 | #ifndef __SET_GET_H__
22 | #define __SET_GET_H__
23 |
24 | #include
25 |
26 | #if defined(__cplusplus)
27 | extern "C" {
28 | #endif
29 |
30 | /* select psychoacoustic model */
31 |
32 | /* manage short blocks */
33 | int CDECL lame_set_short_threshold(lame_global_flags *, float, float);
34 | int CDECL lame_set_short_threshold_lrm(lame_global_flags *, float);
35 | float CDECL lame_get_short_threshold_lrm(const lame_global_flags *);
36 | int CDECL lame_set_short_threshold_s(lame_global_flags *, float);
37 | float CDECL lame_get_short_threshold_s(const lame_global_flags *);
38 |
39 |
40 | int CDECL lame_set_maskingadjust(lame_global_flags *, float);
41 | float CDECL lame_get_maskingadjust(const lame_global_flags *);
42 |
43 | int CDECL lame_set_maskingadjust_short(lame_global_flags *, float);
44 | float CDECL lame_get_maskingadjust_short(const lame_global_flags *);
45 |
46 | /* select ATH formula 4 shape */
47 | int CDECL lame_set_ATHcurve(lame_global_flags *, float);
48 | float CDECL lame_get_ATHcurve(const lame_global_flags *);
49 |
50 | int CDECL lame_set_preset_notune(lame_global_flags *, int);
51 |
52 | /* substep shaping method */
53 | int CDECL lame_set_substep(lame_global_flags *, int);
54 | int CDECL lame_get_substep(const lame_global_flags *);
55 |
56 | /* scalefactors scale */
57 | int CDECL lame_set_sfscale(lame_global_flags *, int);
58 | int CDECL lame_get_sfscale(const lame_global_flags *);
59 |
60 | /* subblock gain */
61 | int CDECL lame_set_subblock_gain(lame_global_flags *, int);
62 | int CDECL lame_get_subblock_gain(const lame_global_flags *);
63 |
64 |
65 |
66 | /*presets*/
67 | int apply_preset(lame_global_flags *, int preset, int enforce);
68 |
69 | void CDECL lame_set_tune(lame_t, float); /* FOR INTERNAL USE ONLY */
70 | void CDECL lame_set_msfix(lame_t gfp, double msfix);
71 |
72 |
73 | #if defined(__cplusplus)
74 | }
75 | #endif
76 | #endif
77 |
--------------------------------------------------------------------------------
/jni/libmp3lame/tables.h:
--------------------------------------------------------------------------------
1 | /*
2 | * MPEG layer 3 tables include file
3 | *
4 | * Copyright (c) 1999 Albert L Faber
5 | *
6 | * This library is free software; you can redistribute it and/or
7 | * modify it under the terms of the GNU Library General Public
8 | * License as published by the Free Software Foundation; either
9 | * version 2 of the License, or (at your option) any later version.
10 | *
11 | * This library is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 | * Library General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Library General Public
17 | * License along with this library; if not, write to the
18 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 | * Boston, MA 02111-1307, USA.
20 | */
21 |
22 | #ifndef LAME_TABLES_H
23 | #define LAME_TABLES_H
24 |
25 | #if 0
26 | typedef struct {
27 | unsigned char no;
28 | unsigned char width;
29 | unsigned char minval_2;
30 | float quiet_thr;
31 | float norm;
32 | float bark;
33 | } type1_t;
34 |
35 | typedef struct {
36 | unsigned char no;
37 | unsigned char width;
38 | float quiet_thr;
39 | float norm;
40 | float SNR;
41 | float bark;
42 | } type2_t;
43 |
44 | typedef struct {
45 | unsigned int no:5;
46 | unsigned int cbw:3;
47 | unsigned int bu:6;
48 | unsigned int bo:6;
49 | unsigned int w1_576:10;
50 | unsigned int w2_576:10;
51 | } type34_t;
52 |
53 | typedef struct {
54 | size_t len1;
55 | const type1_t *const tab1;
56 | size_t len2;
57 | const type2_t *const tab2;
58 | size_t len3;
59 | const type34_t *const tab3;
60 | size_t len4;
61 | const type34_t *const tab4;
62 | } type5_t;
63 |
64 | extern const type5_t table5[6];
65 |
66 | #endif
67 |
68 | #define HTN 34
69 |
70 | struct huffcodetab {
71 | const unsigned int xlen; /* max. x-index+ */
72 | const unsigned int linmax; /* max number to be stored in linbits */
73 | const uint16_t *table; /* pointer to array[xlen][ylen] */
74 | const uint8_t *hlen; /* pointer to array[xlen][ylen] */
75 | };
76 |
77 | extern const struct huffcodetab ht[HTN];
78 | /* global memory block */
79 | /* array of all huffcodtable headers */
80 | /* 0..31 Huffman code table 0..31 */
81 | /* 32,33 count1-tables */
82 |
83 | extern const uint8_t t32l[];
84 | extern const uint8_t t33l[];
85 |
86 | extern const uint32_t largetbl[16 * 16];
87 | extern const uint32_t table23[3 * 3];
88 | extern const uint32_t table56[4 * 4];
89 |
90 | extern const int scfsi_band[5];
91 |
92 | extern const int bitrate_table [3][16];
93 | extern const int samplerate_table [3][ 4];
94 |
95 | #endif /* LAME_TABLES_H */
96 |
--------------------------------------------------------------------------------
/jni/libmp3lame/vbrquantize.h:
--------------------------------------------------------------------------------
1 | /*
2 | * MP3 VBR quantization
3 | *
4 | * Copyright (c) 1999 Mark Taylor
5 | *
6 | * This library is free software; you can redistribute it and/or
7 | * modify it under the terms of the GNU Library General Public
8 | * License as published by the Free Software Foundation; either
9 | * version 2 of the License, or (at your option) any later version.
10 | *
11 | * This library is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 | * Library General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Library General Public
17 | * License along with this library; if not, write to the
18 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 | * Boston, MA 02111-1307, USA.
20 | */
21 |
22 | #ifndef LAME_VBRQUANTIZE_H
23 | #define LAME_VBRQUANTIZE_H
24 |
25 | int VBR_encode_frame(lame_internal_flags * gfc, const FLOAT xr34orig[2][2][576],
26 | const FLOAT l3_xmin[2][2][SFBMAX], const int maxbits[2][2]);
27 |
28 | #endif /* LAME_VBRQUANTIZE_H */
29 |
--------------------------------------------------------------------------------
/jni/libmp3lame/vector/Makefile.am:
--------------------------------------------------------------------------------
1 | ## $Id: Makefile.am,v 1.1 2007/01/09 10:15:53 aleidinger Exp $
2 |
3 | include $(top_srcdir)/Makefile.am.global
4 |
5 | if WITH_XMM
6 | noinst_LTLIBRARIES = liblamevectorroutines.la
7 | endif
8 |
9 | ##liblamecpuroutines_la_LIBADD =
10 | ##liblamecpuroutines_la_LDFLAGS =
11 |
12 | INCLUDES = @INCLUDES@ \
13 | -I$(top_srcdir)/libmp3lame \
14 | -I$(top_srcdir)/mpglib \
15 | -I$(top_builddir)
16 |
17 | DEFS = @DEFS@ @CONFIG_DEFS@
18 |
19 | xmm_sources = xmm_quantize_sub.c
20 |
21 | if WITH_XMM
22 | liblamevectorroutines_la_SOURCES = $(xmm_sources)
23 | endif
24 |
25 | noinst_HEADERS = lame_intrin.h
26 |
27 | EXTRA_liblamevectorroutines_la_SOURCES = $(xmm_sources)
28 |
29 | CLEANFILES = lclint.txt
30 |
31 | LCLINTFLAGS= \
32 | +posixlib \
33 | +showsummary \
34 | +showalluses \
35 | +whichlib \
36 | +forcehints \
37 | -fixedformalarray \
38 | +matchanyintegral \
39 | -Dlint
40 |
41 | lclint.txt: ${liblamecpuroutines_la_SOURCES} ${noinst_HEADERS}
42 | @lclint ${LCLINTFLAGS} ${INCLUDES} ${DEFS} ${liblamecpuroutines_la_SOURCES} 2>&1 >lclint.txt || true
43 |
44 | lclint: lclint.txt
45 | more lclint.txt
46 |
47 | #$(OBJECTS): libtool
48 | #libtool: $(LIBTOOL_DEPS)
49 | # $(SHELL) $(top_builddir)/config.status --recheck
50 |
--------------------------------------------------------------------------------
/jni/libmp3lame/vector/lame_intrin.h:
--------------------------------------------------------------------------------
1 | /*
2 | * lame_intrin.h include file
3 | *
4 | * Copyright (c) 2006 Gabriel Bouvigne
5 | *
6 | * This library is free software; you can redistribute it and/or
7 | * modify it under the terms of the GNU Library General Public
8 | * License as published by the Free Software Foundation; either
9 | * version 2 of the License, or (at your option) any later version.
10 | *
11 | * This library is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 | * Library General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Library General Public
17 | * License along with this library; if not, write to the
18 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 | * Boston, MA 02111-1307, USA.
20 | */
21 |
22 |
23 | #ifndef LAME_INTRIN_H
24 | #define LAME_INTRIN_H
25 |
26 |
27 | void
28 | init_xrpow_core_sse(gr_info * const cod_info, FLOAT xrpow[576], int upper, FLOAT * sum);
29 |
30 | void
31 | fht_SSE2(FLOAT* , int);
32 |
33 | #endif
34 |
--------------------------------------------------------------------------------
/jni/libmp3lame/version.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Version numbering for LAME.
3 | *
4 | * Copyright (c) 1999 A.L. Faber
5 | *
6 | * This library is free software; you can redistribute it and/or
7 | * modify it under the terms of the GNU Library General Public
8 | * License as published by the Free Software Foundation; either
9 | * version 2 of the License, or (at your option) any later version.
10 | *
11 | * This library is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 | * Library General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Library General Public
17 | * License along with this library; if not, write to the
18 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 | * Boston, MA 02111-1307, USA.
20 | */
21 |
22 | #ifndef LAME_VERSION_H
23 | #define LAME_VERSION_H
24 |
25 |
26 | /*
27 | * To make a string from a token, use the # operator:
28 | */
29 | #ifndef STR
30 | # define __STR(x) #x
31 | # define STR(x) __STR(x)
32 | #endif
33 |
34 | # define LAME_URL "http://lame.sf.net"
35 |
36 |
37 | # define LAME_MAJOR_VERSION 3 /* Major version number */
38 | # define LAME_MINOR_VERSION 99 /* Minor version number */
39 | # define LAME_TYPE_VERSION 2 /* 0:alpha 1:beta 2:release */
40 | # define LAME_PATCH_VERSION 5 /* Patch level */
41 | # define LAME_ALPHA_VERSION (LAME_TYPE_VERSION==0)
42 | # define LAME_BETA_VERSION (LAME_TYPE_VERSION==1)
43 | # define LAME_RELEASE_VERSION (LAME_TYPE_VERSION==2)
44 |
45 | # define PSY_MAJOR_VERSION 1 /* Major version number */
46 | # define PSY_MINOR_VERSION 0 /* Minor version number */
47 | # define PSY_ALPHA_VERSION 0 /* Set number if this is an alpha version, otherwise zero */
48 | # define PSY_BETA_VERSION 0 /* Set number if this is a beta version, otherwise zero */
49 |
50 | #if LAME_ALPHA_VERSION
51 | #define LAME_PATCH_LEVEL_STRING " alpha " STR(LAME_PATCH_VERSION)
52 | #endif
53 | #if LAME_BETA_VERSION
54 | #define LAME_PATCH_LEVEL_STRING " beta " STR(LAME_PATCH_VERSION)
55 | #endif
56 | #if LAME_RELEASE_VERSION
57 | #if LAME_PATCH_VERSION
58 | #define LAME_PATCH_LEVEL_STRING " release " STR(LAME_PATCH_VERSION)
59 | #else
60 | #define LAME_PATCH_LEVEL_STRING ""
61 | #endif
62 | #endif
63 |
64 | # define LAME_VERSION_STRING STR(LAME_MAJOR_VERSION) "." STR(LAME_MINOR_VERSION) LAME_PATCH_LEVEL_STRING
65 |
66 | #endif /* LAME_VERSION_H */
67 |
68 | /* End of version.h */
69 |
--------------------------------------------------------------------------------
/keystore/ceshi.jks:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhangchenghai2015/weixin_silk_2_mp3/31e4c642c13d8dd8ba070b1b20c0855afa67c477/keystore/ceshi.jks
--------------------------------------------------------------------------------
/keystore/xwzs_prod.jks:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhangchenghai2015/weixin_silk_2_mp3/31e4c642c13d8dd8ba070b1b20c0855afa67c477/keystore/xwzs_prod.jks
--------------------------------------------------------------------------------
/local.properties:
--------------------------------------------------------------------------------
1 | ## This file must *NOT* be checked into Version Control Systems,
2 | # as it contains information specific to your local configuration.
3 | #
4 | # Location of the SDK. This is only used by Gradle.
5 | # For customization when using a Version Control System, please read the
6 | # header note.
7 | #Sat Sep 29 13:27:25 CST 2018
8 | ndk.dir=D\:\\android_sdk\\ndk-bundle
9 | sdk.dir=D\:\\android_sdk
10 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app', ':amrconvert'
--------------------------------------------------------------------------------
/testfile/1.amr:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhangchenghai2015/weixin_silk_2_mp3/31e4c642c13d8dd8ba070b1b20c0855afa67c477/testfile/1.amr
--------------------------------------------------------------------------------
/testfile/1.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhangchenghai2015/weixin_silk_2_mp3/31e4c642c13d8dd8ba070b1b20c0855afa67c477/testfile/1.mp3
--------------------------------------------------------------------------------
/testfile/t2.pcm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhangchenghai2015/weixin_silk_2_mp3/31e4c642c13d8dd8ba070b1b20c0855afa67c477/testfile/t2.pcm
--------------------------------------------------------------------------------