├── .gitignore
├── .travis.yml
├── AndroidManifest.xml
├── README.md
├── build.gradle
├── build_jni.sh
├── default.properties
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
├── jni
├── .gitignore
├── Android.mk
├── Application.mk
├── include
│ ├── ogg
│ │ ├── config_types.h
│ │ ├── ogg.h
│ │ └── os_types.h
│ ├── stream
│ │ └── util.h
│ └── vorbis
│ │ ├── codec.h
│ │ ├── vorbisenc.h
│ │ └── vorbisfile.h
├── libogg
│ ├── Android.mk
│ ├── bitwise.c
│ └── framing.c
├── libvorbis-jni
│ ├── Android.mk
│ ├── org_xiph_vorbis_decoder_VorbisDecoder.c
│ ├── org_xiph_vorbis_decoder_VorbisDecoder.h
│ ├── org_xiph_vorbis_encoder_VorbisEncoder.c
│ └── org_xiph_vorbis_encoder_VorbisEncoder.h
├── libvorbis-stream
│ ├── Android.mk
│ ├── jni-util.c
│ ├── vorbis-fileinputstream.c
│ └── vorbis-fileoutputstream.c
└── libvorbis
│ ├── Android.mk
│ ├── analysis.c
│ ├── backends.h
│ ├── bitrate.c
│ ├── bitrate.h
│ ├── block.c
│ ├── books
│ ├── Makefile
│ ├── Makefile.am
│ ├── Makefile.in
│ ├── coupled
│ │ ├── Makefile
│ │ ├── Makefile.am
│ │ ├── Makefile.in
│ │ ├── res_books_51.h
│ │ └── res_books_stereo.h
│ ├── floor
│ │ ├── Makefile
│ │ ├── Makefile.am
│ │ ├── Makefile.in
│ │ └── floor_books.h
│ └── uncoupled
│ │ ├── Makefile
│ │ ├── Makefile.am
│ │ ├── Makefile.in
│ │ └── res_books_uncoupled.h
│ ├── codebook.c
│ ├── codebook.h
│ ├── codec_internal.h
│ ├── envelope.c
│ ├── envelope.h
│ ├── floor0.c
│ ├── floor1.c
│ ├── highlevel.h
│ ├── info.c
│ ├── lookup.c
│ ├── lookup.h
│ ├── lookup_data.h
│ ├── lpc.c
│ ├── lpc.h
│ ├── lsp.c
│ ├── lsp.h
│ ├── mapping0.c
│ ├── masking.h
│ ├── mdct.c
│ ├── mdct.h
│ ├── misc.h
│ ├── modes
│ ├── Makefile
│ ├── Makefile.am
│ ├── Makefile.in
│ ├── floor_all.h
│ ├── psych_11.h
│ ├── psych_16.h
│ ├── psych_44.h
│ ├── psych_8.h
│ ├── residue_16.h
│ ├── residue_44.h
│ ├── residue_44p51.h
│ ├── residue_44u.h
│ ├── residue_8.h
│ ├── setup_11.h
│ ├── setup_16.h
│ ├── setup_22.h
│ ├── setup_32.h
│ ├── setup_44.h
│ ├── setup_44p51.h
│ ├── setup_44u.h
│ ├── setup_8.h
│ └── setup_X.h
│ ├── os.h
│ ├── psy.c
│ ├── psy.h
│ ├── registry.c
│ ├── registry.h
│ ├── res0.c
│ ├── scales.h
│ ├── sharedbook.c
│ ├── smallft.c
│ ├── smallft.h
│ ├── synthesis.c
│ ├── vorbisenc.c
│ ├── vorbisfile.c
│ ├── window.c
│ └── window.h
├── libs
├── arm64-v8a
│ ├── libogg.so
│ ├── libvorbis-jni.so
│ ├── libvorbis-stream.so
│ └── libvorbis.so
├── armeabi-v7a
│ ├── libogg.so
│ ├── libvorbis-jni.so
│ ├── libvorbis-stream.so
│ └── libvorbis.so
├── armeabi
│ ├── libogg.so
│ ├── libvorbis-jni.so
│ ├── libvorbis-stream.so
│ └── libvorbis.so
├── mips
│ ├── libogg.so
│ ├── libvorbis-jni.so
│ ├── libvorbis-stream.so
│ └── libvorbis.so
└── x86
│ ├── libogg.so
│ ├── libvorbis-jni.so
│ ├── libvorbis-stream.so
│ └── libvorbis.so
├── proguard_libvorbis-libogg.cfg
├── project.properties
├── res
├── drawable-hdpi
│ └── icon.png
├── drawable-ldpi
│ └── icon.png
├── drawable-mdpi
│ └── icon.png
├── layout
│ └── main.xml
└── values
│ ├── arrays.xml
│ └── strings.xml
└── src
├── com
└── vorbisdemo
│ └── MainActivity.java
└── org
└── xiph
└── vorbis
├── decoder
├── DecodeFeed.java
├── DecodeStreamInfo.java
└── VorbisDecoder.java
├── encoder
├── EncodeFeed.java
└── VorbisEncoder.java
├── player
└── VorbisPlayer.java
├── recorder
└── VorbisRecorder.java
└── stream
├── AudioInputStream.java
├── AudioOutputStream.java
├── VorbisFileInputStream.java
├── VorbisFileOutputStream.java
└── VorbisInfo.java
/.gitignore:
--------------------------------------------------------------------------------
1 | local.properties
2 | .idea
3 | .gradle
4 | bin
5 | gen
6 | obj
7 | **/.DS_Store
8 | build
9 | *.iml
10 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | language: android
2 |
3 | android:
4 | components:
5 | - build-tools-28.0.3
6 | - android-28
7 | - extra-android-m2repository
8 | licenses:
9 | - 'android-sdk-license-.+'
10 |
11 | jdk:
12 | - openjdk8
13 |
14 | dist: trusty
15 |
16 | script:
17 | - ./gradlew assembleDebug testDebugUnitTest
18 |
--------------------------------------------------------------------------------
/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 |
9 |
10 |
12 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # libvorbis - Vorbis Encoder/Decoder example for Android/JNI
2 | libvorbis - Vorbis Encoder/Decoder example for Android/JNI.
3 |
4 | ## Purpose
5 | * The purpose of this project is to demonstrate how Android can use a JNI wrapper around the libvorbis library to both encode PCM data, and decode a ogg/vorbis bitstream
6 |
7 | ## Usage
8 | * Press the "Start Recording" button to start recording, then press the "Stop Recording" button to stop recording.
9 | * Recorded content is saved saveTo.ogg on the external storage location.
10 | * Press the "Start Playing" button to start playing the recorded data, then press the "Stop Playing" button to stop playing or simply wait for the playback to finish on its own.
11 | * Content is played form saveTo.ogg on the external storage location
12 |
13 | ## To Build
14 | * Verify the ndk-build tool is in your path and simply execute ./build_jni.sh from your terminal
15 |
16 | ## Library Usage
17 | * Encoder
18 | * To record to a file
19 |
20 |
21 | VorbisRecorder vorbisRecorder = new VorbisRecorder(fileToSaveTo, recordHandler);
22 |
23 | //Start recording with a sample rate of 44KHz, 2 channels (stereo), at 0.2 quality
24 | vorbisRecorder.start(44100, 2, 0.2f);
25 |
26 | //or
27 | //Start recording with a sample rate of 44KHz, 2 channels (stereo), at 128 bitrate
28 | vorbisRecorder.start(44100, 2, 128000);
29 |
30 |
31 | * To read from other input, create a custom ```EncodeFeed```
32 |
33 | EncodeFeed encodeFeed = new EncodeFeed() {
34 | @Override
35 | public long readPCMData(byte[] pcmDataBuffer, int amountToWrite) {
36 | //Read data from pcm data source
37 | }
38 |
39 | @Override
40 | public int writeVorbisData(byte[] vorbisData, int amountToRead) {
41 | //write encoded data to where ever
42 | }
43 |
44 | @Override
45 | public void stop() {
46 | //The native encoder has finished
47 | }
48 |
49 | @Override
50 | public void stopEncoding() {
51 | //The encoder should wrap up until the native encoder calls stop()
52 | }
53 |
54 | @Override
55 | public void start() {
56 | //The native encoder has started
57 | }
58 | };
59 | VorbisRecorder vorbisRecorder = new VorbisRecorder(encodeFeed, recordHandler);
60 | vorbisRecorder.start(...);
61 |
62 |
63 | * Decoder
64 | * Decode from file
65 |
66 | VorbisPlayer vorbisPlayer = new VorbisPlayer(fileToPlay, playerHandler);
67 | vorbisPlayer.start();
68 |
69 |
70 | * To write to custom output, create a custom ```DecodeFeed```
71 |
72 | DecodeFeed decodeFeed = new DecodeFeed() {
73 | @Override
74 | public int readVorbisData(byte[] buffer, int amountToWrite) {
75 | //Read from vorbis data source
76 | }
77 |
78 | @Override
79 | public void writePCMData(short[] pcmData, int amountToRead) {
80 | //Write encoded pcm data
81 | }
82 |
83 | @Override
84 | public void stop() {
85 | //Stop called from the native decoder
86 | }
87 |
88 | @Override
89 | public void startReadingHeader() {
90 | //Called from the native decoder to read header information first
91 | }
92 |
93 | @Override
94 | public void start(DecodeStreamInfo decodeStreamInfo) {
95 | //Called from the native decoder that we're ready and have processed the header information
96 | }
97 | };
98 | VorbisPlayer vorbisPlayer = new VorbisPlayer(decodeFeed);
99 | ...
100 |
101 |
102 | ## License
103 | * For simplicity sake, this code is licensed under the same license as the libvorbis library from (http://xiph.org/vorbis/)
104 |
105 | ## Others
106 | * Tested and working under the Nexus 4, feedback for other devices are welcome
107 | * Pull requests welcome
108 |
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | buildscript {
2 | repositories {
3 | google()
4 | jcenter()
5 | }
6 | dependencies {
7 | classpath 'com.android.tools.build:gradle:3.4.2'
8 | }
9 | }
10 |
11 | apply plugin: 'com.android.library'
12 |
13 | android {
14 | compileSdkVersion project.hasProperty("defaultCompileSdkVersion") ? defaultCompileSdkVersion : 28
15 | buildToolsVersion project.hasProperty("defaultBuildToolsVersion") ? defaultBuildToolsVersion : "28.0.3"
16 |
17 | defaultConfig {
18 | minSdkVersion 9
19 | targetSdkVersion project.hasProperty("defaultTargetSdkVersion") ? defaultTargetSdkVersion : 28
20 | }
21 |
22 | buildTypes {
23 | release {
24 | minifyEnabled true
25 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard_libvorbis-libogg.cfg'
26 | }
27 | }
28 |
29 | lintOptions { abortOnError false }
30 |
31 | sourceSets {
32 | main {
33 | manifest.srcFile 'AndroidManifest.xml'
34 | java.srcDirs = ['src', 'src-gen']
35 | resources.srcDirs = ['src']
36 | aidl.srcDirs = ['src']
37 | renderscript.srcDirs = ['src']
38 | res.srcDirs = ['res']
39 | assets.srcDirs = ['assets']
40 | }
41 | }
42 | }
43 |
44 |
45 | allprojects {
46 | repositories {
47 | google()
48 | jcenter()
49 | }
50 |
51 | }
52 |
53 |
--------------------------------------------------------------------------------
/build_jni.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | cd jni
3 | ndk-build
--------------------------------------------------------------------------------
/default.properties:
--------------------------------------------------------------------------------
1 | # This file is automatically generated by Android Tools.
2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED!
3 | #
4 | # This file must be checked in Version Control Systems.
5 | #
6 | # To customize properties used by the Ant build system use,
7 | # "build.properties", and override values to adapt the script to your
8 | # project structure.
9 |
10 | # Project target.
11 | target=android-7
12 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vincentjames501/libvorbis-libogg-android/f9553444b9ee55e4cbb4a748841387313a72d8e7/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Mon May 13 19:19:56 CEST 2019
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-5.5.1-all.zip
7 |
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env sh
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Attempt to set APP_HOME
10 | # Resolve links: $0 may be a link
11 | PRG="$0"
12 | # Need this for relative symlinks.
13 | while [ -h "$PRG" ] ; do
14 | ls=`ls -ld "$PRG"`
15 | link=`expr "$ls" : '.*-> \(.*\)$'`
16 | if expr "$link" : '/.*' > /dev/null; then
17 | PRG="$link"
18 | else
19 | PRG=`dirname "$PRG"`"/$link"
20 | fi
21 | done
22 | SAVED="`pwd`"
23 | cd "`dirname \"$PRG\"`/" >/dev/null
24 | APP_HOME="`pwd -P`"
25 | cd "$SAVED" >/dev/null
26 |
27 | APP_NAME="Gradle"
28 | APP_BASE_NAME=`basename "$0"`
29 |
30 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
31 | DEFAULT_JVM_OPTS=""
32 |
33 | # Use the maximum available, or set MAX_FD != -1 to use that value.
34 | MAX_FD="maximum"
35 |
36 | warn () {
37 | echo "$*"
38 | }
39 |
40 | die () {
41 | echo
42 | echo "$*"
43 | echo
44 | exit 1
45 | }
46 |
47 | # OS specific support (must be 'true' or 'false').
48 | cygwin=false
49 | msys=false
50 | darwin=false
51 | nonstop=false
52 | case "`uname`" in
53 | CYGWIN* )
54 | cygwin=true
55 | ;;
56 | Darwin* )
57 | darwin=true
58 | ;;
59 | MINGW* )
60 | msys=true
61 | ;;
62 | NONSTOP* )
63 | nonstop=true
64 | ;;
65 | esac
66 |
67 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
68 |
69 | # Determine the Java command to use to start the JVM.
70 | if [ -n "$JAVA_HOME" ] ; then
71 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
72 | # IBM's JDK on AIX uses strange locations for the executables
73 | JAVACMD="$JAVA_HOME/jre/sh/java"
74 | else
75 | JAVACMD="$JAVA_HOME/bin/java"
76 | fi
77 | if [ ! -x "$JAVACMD" ] ; then
78 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
79 |
80 | Please set the JAVA_HOME variable in your environment to match the
81 | location of your Java installation."
82 | fi
83 | else
84 | JAVACMD="java"
85 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
86 |
87 | Please set the JAVA_HOME variable in your environment to match the
88 | location of your Java installation."
89 | fi
90 |
91 | # Increase the maximum file descriptors if we can.
92 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
93 | MAX_FD_LIMIT=`ulimit -H -n`
94 | if [ $? -eq 0 ] ; then
95 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
96 | MAX_FD="$MAX_FD_LIMIT"
97 | fi
98 | ulimit -n $MAX_FD
99 | if [ $? -ne 0 ] ; then
100 | warn "Could not set maximum file descriptor limit: $MAX_FD"
101 | fi
102 | else
103 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
104 | fi
105 | fi
106 |
107 | # For Darwin, add options to specify how the application appears in the dock
108 | if $darwin; then
109 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
110 | fi
111 |
112 | # For Cygwin, switch paths to Windows format before running java
113 | if $cygwin ; then
114 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
115 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
116 | JAVACMD=`cygpath --unix "$JAVACMD"`
117 |
118 | # We build the pattern for arguments to be converted via cygpath
119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
120 | SEP=""
121 | for dir in $ROOTDIRSRAW ; do
122 | ROOTDIRS="$ROOTDIRS$SEP$dir"
123 | SEP="|"
124 | done
125 | OURCYGPATTERN="(^($ROOTDIRS))"
126 | # Add a user-defined pattern to the cygpath arguments
127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
129 | fi
130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
131 | i=0
132 | for arg in "$@" ; do
133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
135 |
136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
138 | else
139 | eval `echo args$i`="\"$arg\""
140 | fi
141 | i=$((i+1))
142 | done
143 | case $i in
144 | (0) set -- ;;
145 | (1) set -- "$args0" ;;
146 | (2) set -- "$args0" "$args1" ;;
147 | (3) set -- "$args0" "$args1" "$args2" ;;
148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
154 | esac
155 | fi
156 |
157 | # Escape application args
158 | save () {
159 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
160 | echo " "
161 | }
162 | APP_ARGS=$(save "$@")
163 |
164 | # Collect all arguments for the java command, following the shell quoting and substitution rules
165 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
166 |
167 | # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
168 | if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
169 | cd "$(dirname "$0")"
170 | fi
171 |
172 | exec "$JAVACMD" "$@"
173 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | set DIRNAME=%~dp0
12 | if "%DIRNAME%" == "" set DIRNAME=.
13 | set APP_BASE_NAME=%~n0
14 | set APP_HOME=%DIRNAME%
15 |
16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
17 | set DEFAULT_JVM_OPTS=
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windows variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 |
53 | :win9xME_args
54 | @rem Slurp the command line arguments.
55 | set CMD_LINE_ARGS=
56 | set _SKIP=2
57 |
58 | :win9xME_args_slurp
59 | if "x%~1" == "x" goto execute
60 |
61 | set CMD_LINE_ARGS=%*
62 |
63 | :execute
64 | @rem Setup the command line
65 |
66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
67 |
68 | @rem Execute Gradle
69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
70 |
71 | :end
72 | @rem End local scope for the variables with windows NT shell
73 | if "%ERRORLEVEL%"=="0" goto mainEnd
74 |
75 | :fail
76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
77 | rem the _cmd.exe /c_ return code!
78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
79 | exit /b 1
80 |
81 | :mainEnd
82 | if "%OS%"=="Windows_NT" endlocal
83 |
84 | :omega
85 |
--------------------------------------------------------------------------------
/jni/.gitignore:
--------------------------------------------------------------------------------
1 | bin
2 | gen
3 | **/.DS_Store
4 |
--------------------------------------------------------------------------------
/jni/Android.mk:
--------------------------------------------------------------------------------
1 | LOCAL_PATH := $(call my-dir)
2 |
3 | LOCAL_C_INCLUDE := $(LOCAL_PATH)/include
4 |
5 | include $(addprefix $(LOCAL_PATH)/, $(addsuffix /Android.mk, \
6 | libogg \
7 | libvorbis \
8 | libvorbis-jni \
9 | libvorbis-stream \
10 | ))
11 |
12 |
13 |
--------------------------------------------------------------------------------
/jni/Application.mk:
--------------------------------------------------------------------------------
1 | APP_ABI := armeabi armeabi-v7a x86 mips arm64-v8a
--------------------------------------------------------------------------------
/jni/include/ogg/config_types.h:
--------------------------------------------------------------------------------
1 | #ifndef __CONFIG_TYPES_H__
2 | #define __CONFIG_TYPES_H__
3 |
4 | /* these are filled in by configure */
5 | #define INCLUDE_INTTYPES_H 1
6 | #define INCLUDE_STDINT_H 1
7 | #define INCLUDE_SYS_TYPES_H 1
8 |
9 | #if INCLUDE_INTTYPES_H
10 | # include
11 | #endif
12 | #if INCLUDE_STDINT_H
13 | # include
14 | #endif
15 | #if INCLUDE_SYS_TYPES_H
16 | # include
17 | #endif
18 |
19 | typedef short ogg_int16_t;
20 | typedef unsigned short ogg_uint16_t;
21 | typedef int ogg_int32_t;
22 | typedef unsigned int ogg_uint32_t;
23 | typedef long long ogg_int64_t;
24 |
25 | #endif
26 |
--------------------------------------------------------------------------------
/jni/include/ogg/os_types.h:
--------------------------------------------------------------------------------
1 | /********************************************************************
2 | * *
3 | * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. *
4 | * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
5 | * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
6 | * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
7 | * *
8 | * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002 *
9 | * by the Xiph.Org Foundation http://www.xiph.org/ *
10 | * *
11 | ********************************************************************
12 |
13 | function: #ifdef jail to whip a few platforms into the UNIX ideal.
14 | last mod: $Id: os_types.h 17712 2010-12-03 17:10:02Z xiphmont $
15 |
16 | ********************************************************************/
17 | #ifndef _OS_TYPES_H
18 | #define _OS_TYPES_H
19 |
20 | /* make it easy on the folks that want to compile the libs with a
21 | different malloc than stdlib */
22 | #define _ogg_malloc malloc
23 | #define _ogg_calloc calloc
24 | #define _ogg_realloc realloc
25 | #define _ogg_free free
26 |
27 | #if defined(_WIN32)
28 |
29 | # if defined(__CYGWIN__)
30 | # include
31 | typedef int16_t ogg_int16_t;
32 | typedef uint16_t ogg_uint16_t;
33 | typedef int32_t ogg_int32_t;
34 | typedef uint32_t ogg_uint32_t;
35 | typedef int64_t ogg_int64_t;
36 | typedef uint64_t ogg_uint64_t;
37 | # elif defined(__MINGW32__)
38 | # include
39 | typedef short ogg_int16_t;
40 | typedef unsigned short ogg_uint16_t;
41 | typedef int ogg_int32_t;
42 | typedef unsigned int ogg_uint32_t;
43 | typedef long long ogg_int64_t;
44 | typedef unsigned long long ogg_uint64_t;
45 | # elif defined(__MWERKS__)
46 | typedef long long ogg_int64_t;
47 | typedef int ogg_int32_t;
48 | typedef unsigned int ogg_uint32_t;
49 | typedef short ogg_int16_t;
50 | typedef unsigned short ogg_uint16_t;
51 | # else
52 | /* MSVC/Borland */
53 | typedef __int64 ogg_int64_t;
54 | typedef __int32 ogg_int32_t;
55 | typedef unsigned __int32 ogg_uint32_t;
56 | typedef __int16 ogg_int16_t;
57 | typedef unsigned __int16 ogg_uint16_t;
58 | # endif
59 |
60 | #elif defined(__MACOS__)
61 |
62 | # include
63 | typedef SInt16 ogg_int16_t;
64 | typedef UInt16 ogg_uint16_t;
65 | typedef SInt32 ogg_int32_t;
66 | typedef UInt32 ogg_uint32_t;
67 | typedef SInt64 ogg_int64_t;
68 |
69 | #elif (defined(__APPLE__) && defined(__MACH__)) /* MacOS X Framework build */
70 |
71 | # include
72 | typedef int16_t ogg_int16_t;
73 | typedef uint16_t ogg_uint16_t;
74 | typedef int32_t ogg_int32_t;
75 | typedef uint32_t ogg_uint32_t;
76 | typedef int64_t ogg_int64_t;
77 |
78 | #elif defined(__HAIKU__)
79 |
80 | /* Haiku */
81 | # include
82 | typedef short ogg_int16_t;
83 | typedef unsigned short ogg_uint16_t;
84 | typedef int ogg_int32_t;
85 | typedef unsigned int ogg_uint32_t;
86 | typedef long long ogg_int64_t;
87 |
88 | #elif defined(__BEOS__)
89 |
90 | /* Be */
91 | # include
92 | typedef int16_t ogg_int16_t;
93 | typedef uint16_t ogg_uint16_t;
94 | typedef int32_t ogg_int32_t;
95 | typedef uint32_t ogg_uint32_t;
96 | typedef int64_t ogg_int64_t;
97 |
98 | #elif defined (__EMX__)
99 |
100 | /* OS/2 GCC */
101 | typedef short ogg_int16_t;
102 | typedef unsigned short ogg_uint16_t;
103 | typedef int ogg_int32_t;
104 | typedef unsigned int ogg_uint32_t;
105 | typedef long long ogg_int64_t;
106 |
107 | #elif defined (DJGPP)
108 |
109 | /* DJGPP */
110 | typedef short ogg_int16_t;
111 | typedef int ogg_int32_t;
112 | typedef unsigned int ogg_uint32_t;
113 | typedef long long ogg_int64_t;
114 |
115 | #elif defined(R5900)
116 |
117 | /* PS2 EE */
118 | typedef long ogg_int64_t;
119 | typedef int ogg_int32_t;
120 | typedef unsigned ogg_uint32_t;
121 | typedef short ogg_int16_t;
122 |
123 | #elif defined(__SYMBIAN32__)
124 |
125 | /* Symbian GCC */
126 | typedef signed short ogg_int16_t;
127 | typedef unsigned short ogg_uint16_t;
128 | typedef signed int ogg_int32_t;
129 | typedef unsigned int ogg_uint32_t;
130 | typedef long long int ogg_int64_t;
131 |
132 | #elif defined(__TMS320C6X__)
133 |
134 | /* TI C64x compiler */
135 | typedef signed short ogg_int16_t;
136 | typedef unsigned short ogg_uint16_t;
137 | typedef signed int ogg_int32_t;
138 | typedef unsigned int ogg_uint32_t;
139 | typedef long long int ogg_int64_t;
140 |
141 | #else
142 |
143 | # include
144 |
145 | #endif
146 |
147 | #endif /* _OS_TYPES_H */
148 |
--------------------------------------------------------------------------------
/jni/include/stream/util.h:
--------------------------------------------------------------------------------
1 | /* Programmer: Nicholas Wertzberger
2 | * Email: wertnick@gmail.com
3 | *
4 | * A listing of helper functions for integrating with the JNI.
5 | */
6 | #ifndef _STREAM_UTIL_H
7 | #define _STREAM_UTIL_H
8 |
9 | enum {
10 | BAD_MEM = -1,
11 | };
12 |
13 | void
14 | JNU_ThrowByName(JNIEnv *env, const char *name, const char *msg, int code);
15 |
16 | #endif
17 |
--------------------------------------------------------------------------------
/jni/include/vorbis/vorbisfile.h:
--------------------------------------------------------------------------------
1 | /********************************************************************
2 | * *
3 | * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. *
4 | * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
5 | * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
6 | * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
7 | * *
8 | * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007 *
9 | * by the Xiph.Org Foundation http://www.xiph.org/ *
10 | * *
11 | ********************************************************************
12 |
13 | function: stdio-based convenience library for opening/seeking/decoding
14 | last mod: $Id: vorbisfile.h 17182 2010-04-29 03:48:32Z xiphmont $
15 |
16 | ********************************************************************/
17 |
18 | #ifndef _OV_FILE_H_
19 | #define _OV_FILE_H_
20 |
21 | #ifdef __cplusplus
22 | extern "C"
23 | {
24 | #endif /* __cplusplus */
25 |
26 | #include
27 | #include "codec.h"
28 |
29 | /* The function prototypes for the callbacks are basically the same as for
30 | * the stdio functions fread, fseek, fclose, ftell.
31 | * The one difference is that the FILE * arguments have been replaced with
32 | * a void * - this is to be used as a pointer to whatever internal data these
33 | * functions might need. In the stdio case, it's just a FILE * cast to a void *
34 | *
35 | * If you use other functions, check the docs for these functions and return
36 | * the right values. For seek_func(), you *MUST* return -1 if the stream is
37 | * unseekable
38 | */
39 | typedef struct {
40 | size_t (*read_func) (void *ptr, size_t size, size_t nmemb, void *datasource);
41 | int (*seek_func) (void *datasource, ogg_int64_t offset, int whence);
42 | int (*close_func) (void *datasource);
43 | long (*tell_func) (void *datasource);
44 | } ov_callbacks;
45 |
46 | #ifndef OV_EXCLUDE_STATIC_CALLBACKS
47 |
48 | /* a few sets of convenient callbacks, especially for use under
49 | * Windows where ov_open_callbacks() should always be used instead of
50 | * ov_open() to avoid problems with incompatible crt.o version linking
51 | * issues. */
52 |
53 | static int _ov_header_fseek_wrap(FILE *f,ogg_int64_t off,int whence){
54 | if(f==NULL)return(-1);
55 |
56 | #ifdef __MINGW32__
57 | return fseeko64(f,off,whence);
58 | #elif defined (_WIN32)
59 | return _fseeki64(f,off,whence);
60 | #else
61 | return fseek(f,off,whence);
62 | #endif
63 | }
64 |
65 | /* These structs below (OV_CALLBACKS_DEFAULT etc) are defined here as
66 | * static data. That means that every file which includes this header
67 | * will get its own copy of these structs whether it uses them or
68 | * not unless it #defines OV_EXCLUDE_STATIC_CALLBACKS.
69 | * These static symbols are essential on platforms such as Windows on
70 | * which several different versions of stdio support may be linked to
71 | * by different DLLs, and we need to be certain we know which one
72 | * we're using (the same one as the main application).
73 | */
74 |
75 | static ov_callbacks OV_CALLBACKS_DEFAULT = {
76 | (size_t (*)(void *, size_t, size_t, void *)) fread,
77 | (int (*)(void *, ogg_int64_t, int)) _ov_header_fseek_wrap,
78 | (int (*)(void *)) fclose,
79 | (long (*)(void *)) ftell
80 | };
81 |
82 | static ov_callbacks OV_CALLBACKS_NOCLOSE = {
83 | (size_t (*)(void *, size_t, size_t, void *)) fread,
84 | (int (*)(void *, ogg_int64_t, int)) _ov_header_fseek_wrap,
85 | (int (*)(void *)) NULL,
86 | (long (*)(void *)) ftell
87 | };
88 |
89 | static ov_callbacks OV_CALLBACKS_STREAMONLY = {
90 | (size_t (*)(void *, size_t, size_t, void *)) fread,
91 | (int (*)(void *, ogg_int64_t, int)) NULL,
92 | (int (*)(void *)) fclose,
93 | (long (*)(void *)) NULL
94 | };
95 |
96 | static ov_callbacks OV_CALLBACKS_STREAMONLY_NOCLOSE = {
97 | (size_t (*)(void *, size_t, size_t, void *)) fread,
98 | (int (*)(void *, ogg_int64_t, int)) NULL,
99 | (int (*)(void *)) NULL,
100 | (long (*)(void *)) NULL
101 | };
102 |
103 | #endif
104 |
105 | #define NOTOPEN 0
106 | #define PARTOPEN 1
107 | #define OPENED 2
108 | #define STREAMSET 3
109 | #define INITSET 4
110 |
111 | typedef struct OggVorbis_File {
112 | void *datasource; /* Pointer to a FILE *, etc. */
113 | int seekable;
114 | ogg_int64_t offset;
115 | ogg_int64_t end;
116 | ogg_sync_state oy;
117 |
118 | /* If the FILE handle isn't seekable (eg, a pipe), only the current
119 | stream appears */
120 | int links;
121 | ogg_int64_t *offsets;
122 | ogg_int64_t *dataoffsets;
123 | long *serialnos;
124 | ogg_int64_t *pcmlengths; /* overloaded to maintain binary
125 | compatibility; x2 size, stores both
126 | beginning and end values */
127 | vorbis_info *vi;
128 | vorbis_comment *vc;
129 |
130 | /* Decoding working state local storage */
131 | ogg_int64_t pcm_offset;
132 | int ready_state;
133 | long current_serialno;
134 | int current_link;
135 |
136 | double bittrack;
137 | double samptrack;
138 |
139 | ogg_stream_state os; /* take physical pages, weld into a logical
140 | stream of packets */
141 | vorbis_dsp_state vd; /* central working state for the packet->PCM decoder */
142 | vorbis_block vb; /* local working space for packet->PCM decode */
143 |
144 | ov_callbacks callbacks;
145 |
146 | } OggVorbis_File;
147 |
148 |
149 | extern int ov_clear(OggVorbis_File *vf);
150 | extern int ov_fopen(const char *path,OggVorbis_File *vf);
151 | extern int ov_open(FILE *f,OggVorbis_File *vf,const char *initial,long ibytes);
152 | extern int ov_open_callbacks(void *datasource, OggVorbis_File *vf,
153 | const char *initial, long ibytes, ov_callbacks callbacks);
154 |
155 | extern int ov_test(FILE *f,OggVorbis_File *vf,const char *initial,long ibytes);
156 | extern int ov_test_callbacks(void *datasource, OggVorbis_File *vf,
157 | const char *initial, long ibytes, ov_callbacks callbacks);
158 | extern int ov_test_open(OggVorbis_File *vf);
159 |
160 | extern long ov_bitrate(OggVorbis_File *vf,int i);
161 | extern long ov_bitrate_instant(OggVorbis_File *vf);
162 | extern long ov_streams(OggVorbis_File *vf);
163 | extern long ov_seekable(OggVorbis_File *vf);
164 | extern long ov_serialnumber(OggVorbis_File *vf,int i);
165 |
166 | extern ogg_int64_t ov_raw_total(OggVorbis_File *vf,int i);
167 | extern ogg_int64_t ov_pcm_total(OggVorbis_File *vf,int i);
168 | extern double ov_time_total(OggVorbis_File *vf,int i);
169 |
170 | extern int ov_raw_seek(OggVorbis_File *vf,ogg_int64_t pos);
171 | extern int ov_pcm_seek(OggVorbis_File *vf,ogg_int64_t pos);
172 | extern int ov_pcm_seek_page(OggVorbis_File *vf,ogg_int64_t pos);
173 | extern int ov_time_seek(OggVorbis_File *vf,double pos);
174 | extern int ov_time_seek_page(OggVorbis_File *vf,double pos);
175 |
176 | extern int ov_raw_seek_lap(OggVorbis_File *vf,ogg_int64_t pos);
177 | extern int ov_pcm_seek_lap(OggVorbis_File *vf,ogg_int64_t pos);
178 | extern int ov_pcm_seek_page_lap(OggVorbis_File *vf,ogg_int64_t pos);
179 | extern int ov_time_seek_lap(OggVorbis_File *vf,double pos);
180 | extern int ov_time_seek_page_lap(OggVorbis_File *vf,double pos);
181 |
182 | extern ogg_int64_t ov_raw_tell(OggVorbis_File *vf);
183 | extern ogg_int64_t ov_pcm_tell(OggVorbis_File *vf);
184 | extern double ov_time_tell(OggVorbis_File *vf);
185 |
186 | extern vorbis_info *ov_info(OggVorbis_File *vf,int link);
187 | extern vorbis_comment *ov_comment(OggVorbis_File *vf,int link);
188 |
189 | extern long ov_read_float(OggVorbis_File *vf,float ***pcm_channels,int samples,
190 | int *bitstream);
191 | extern long ov_read_filter(OggVorbis_File *vf,char *buffer,int length,
192 | int bigendianp,int word,int sgned,int *bitstream,
193 | void (*filter)(float **pcm,long channels,long samples,void *filter_param),void *filter_param);
194 | extern long ov_read(OggVorbis_File *vf,char *buffer,int length,
195 | int bigendianp,int word,int sgned,int *bitstream);
196 | extern int ov_crosslap(OggVorbis_File *vf1,OggVorbis_File *vf2);
197 |
198 | extern int ov_halfrate(OggVorbis_File *vf,int flag);
199 | extern int ov_halfrate_p(OggVorbis_File *vf);
200 |
201 | #ifdef __cplusplus
202 | }
203 | #endif /* __cplusplus */
204 |
205 | #endif
206 |
207 |
--------------------------------------------------------------------------------
/jni/libogg/Android.mk:
--------------------------------------------------------------------------------
1 | LOCAL_PATH := $(call my-dir)
2 |
3 | include $(CLEAR_VARS)
4 |
5 | LOCAL_MODULE := libogg
6 | LOCAL_CFLAGS += -I$(LOCAL_PATH)/../include -ffast-math -fsigned-char
7 | ifeq ($(TARGET_ARCH),arm)
8 | LOCAL_CFLAGS += -march=armv6 -marm -mfloat-abi=softfp -mfpu=vfp
9 | endif
10 |
11 |
12 | LOCAL_SRC_FILES := \
13 | bitwise.c \
14 | framing.c
15 |
16 | include $(BUILD_SHARED_LIBRARY)
17 |
--------------------------------------------------------------------------------
/jni/libvorbis-jni/Android.mk:
--------------------------------------------------------------------------------
1 | LOCAL_PATH := $(call my-dir)
2 |
3 | include $(CLEAR_VARS)
4 |
5 | LOCAL_MODULE := vorbis-jni
6 | LOCAL_CFLAGS += -I$(LOCAL_PATH)/../include -fsigned-char
7 | ifeq ($(TARGET_ARCH),arm)
8 | LOCAL_CFLAGS += -march=armv6 -marm -mfloat-abi=softfp -mfpu=vfp
9 | endif
10 |
11 | LOCAL_SHARED_LIBRARIES := libogg libvorbis
12 |
13 | LOCAL_LDLIBS := -L$(SYSROOT)/usr/lib -llog
14 |
15 | LOCAL_SRC_FILES := \
16 | org_xiph_vorbis_encoder_VorbisEncoder.c \
17 | org_xiph_vorbis_decoder_VorbisDecoder.c
18 |
19 | include $(BUILD_SHARED_LIBRARY)
20 |
--------------------------------------------------------------------------------
/jni/libvorbis-jni/org_xiph_vorbis_decoder_VorbisDecoder.h:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include
4 | #include
5 | #include
6 | #include
7 | #include
8 |
9 | #ifndef _Included_org_xiph_vorbis_VorbisDecoder
10 | #define _Included_org_xiph_vorbis_VorbisDecoder
11 | #ifdef __cplusplus
12 | extern "C" {
13 | #endif
14 |
15 | //Starts the decoding from a vorbis bitstream to pcm
16 | JNIEXPORT int JNICALL Java_org_xiph_vorbis_decoder_VorbisDecoder_startDecoding
17 | (JNIEnv *env, jclass cls, jobject vorbisDataFeed);
18 |
19 | //Stops the vorbis data feed
20 | void stopDecodeFeed(JNIEnv *env, jobject* vorbisDataFeed, jmethodID* stopMethodId);
21 |
22 | //Reads raw vorbis data from the jni callback
23 | int readVorbisDataFromVorbisDataFeed(JNIEnv *env, jobject* vorbisDataFeed, jmethodID* readVorbisDataMethodId, char* buffer, jbyteArray* jByteArrayReadBuffer);
24 |
25 | //Writes the pcm data to the Java layer
26 | void writePCMDataFromVorbisDataFeed(JNIEnv *env, jobject* vorbisDataFeed, jmethodID* writePCMDataMethodId, ogg_int16_t* buffer, int bytes, jshortArray* jShortArrayWriteBuffer);
27 |
28 | //Starts the decode feed with the necessary information about sample rates, channels, etc about the stream
29 | void start(JNIEnv *env, jobject *vorbisDataFeed, jmethodID* startMethodId, long sampleRate, long channels, char* vendor);
30 |
31 | //Starts reading the header information
32 | void startReadingHeader(JNIEnv *env, jobject *vorbisDataFeed, jmethodID* startReadingHeaderMethodId);
33 |
34 | #ifdef __cplusplus
35 | }
36 | #endif
37 | #endif
--------------------------------------------------------------------------------
/jni/libvorbis-jni/org_xiph_vorbis_encoder_VorbisEncoder.h:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include
4 | #include
5 | #include
6 | #include
7 | #include
8 | #include
9 |
10 | #ifndef _Included_org_xiph_vorbis_encoder_VorbisEncoder
11 | #define _Included_org_xiph_vorbis_encoder_VorbisEncoder
12 | #ifdef __cplusplus
13 | extern "C" {
14 | #endif
15 |
16 | //Starts the encode feed
17 | void startEncodeFeed(JNIEnv *env, jobject *vorbisDataFeed, jmethodID* startMethodId);
18 |
19 | //Stops the vorbis data feed
20 | void stopEncodeFeed(JNIEnv *env, jobject* vorbisDataFeed, jmethodID* stopMethodId);
21 |
22 | //Reads pcm data from the jni callback
23 | long readPCMDataFromEncoderDataFeed(JNIEnv *env, jobject* encoderDataFeed, jmethodID* readPCMDataMethodId, char* buffer, int length, jbyteArray* jByteArrayBuffer);
24 |
25 | //Writes the vorbis data to the Java layer
26 | int writeVorbisDataToEncoderDataFeed(JNIEnv *env, jobject* encoderDataFeed, jmethodID* writeVorbisDataMethodId, char* buffer, int bytes, jbyteArray* jByteArrayWriteBuffer);
27 |
28 | //Method to start encoding
29 | int startEncoding(JNIEnv *env, jclass *cls_ptr, jlong *sampleRate_ptr, jlong *channels_ptr, jfloat *quality_ptr, jlong *bitrate_ptr, jobject *encoderDataFeed_ptr, int type);
30 |
31 | //jni method for encoding with quality
32 | JNIEXPORT int JNICALL Java_org_xiph_vorbis_encoder_VorbisEncoder_startEncodingWithQuality
33 | (JNIEnv *env, jclass cls, jlong sampleRate, jlong channels, jfloat quality, jobject encoderDataFeed);
34 |
35 | //jni method for encoding with bitrate
36 | JNIEXPORT int JNICALL Java_org_xiph_vorbis_encoder_VorbisEncoder_startEncodingWithBitrate
37 | (JNIEnv *env, jclass cls, jlong sampleRate, jlong channels, jlong bitrate, jobject encoderDataFeed);
38 | #ifdef __cplusplus
39 | }
40 | #endif
41 | #endif
--------------------------------------------------------------------------------
/jni/libvorbis-stream/Android.mk:
--------------------------------------------------------------------------------
1 | LOCAL_PATH := $(call my-dir)
2 |
3 | include $(CLEAR_VARS)
4 |
5 | LOCAL_MODULE := vorbis-stream
6 | LOCAL_CFLAGS += -I$(LOCAL_PATH)/../include -ffast-math -fsigned-char
7 | ifeq ($(TARGET_ARCH),arm)
8 | LOCAL_CFLAGS += -march=armv6 -marm -mfloat-abi=softfp -mfpu=vfp
9 | endif
10 |
11 |
12 | LOCAL_SHARED_LIBRARIES := libogg libvorbis
13 |
14 | LOCAL_SRC_FILES := \
15 | vorbis-fileoutputstream.c \
16 | vorbis-fileinputstream.c \
17 | jni-util.c
18 |
19 | include $(BUILD_SHARED_LIBRARY)
20 |
--------------------------------------------------------------------------------
/jni/libvorbis-stream/jni-util.c:
--------------------------------------------------------------------------------
1 | /* Programmer: Nicholas Wertzberger
2 | * Email: wertnick@gmail.com
3 | *
4 | */
5 |
6 | #include
7 | #include
8 | #include
9 | #include
10 |
11 | /*
12 | * http://java.sun.com/docs/books/jni/html/exceptions.html
13 | */
14 | void
15 | JNU_ThrowByName(JNIEnv *env, const char *name, const char *msg, const int code)
16 | {
17 | char buf [45];
18 |
19 | sprintf(buf, "%35s: %d", msg, code);
20 |
21 | jclass cls = (*env)->FindClass(env, name);
22 | /* if cls is NULL, an exception has already been thrown */
23 | if (cls != NULL) {
24 | (*env)->ThrowNew(env, cls, buf);
25 | }
26 | /* free the local ref */
27 | (*env)->DeleteLocalRef(env, cls);
28 | }
29 |
--------------------------------------------------------------------------------
/jni/libvorbis-stream/vorbis-fileinputstream.c:
--------------------------------------------------------------------------------
1 | /**
2 | * A java interface (a la inputstream) to read ogg vorbis files.
3 | * http://svn.xiph.org/trunk/vorbis/examples/vorbisfile_example.c
4 | */
5 |
6 | #include
7 | #include
8 | #include
9 | #include
10 | #include
11 |
12 | #include
13 | #include
14 |
15 | /* This is arbitrary, If you don't like it, change it */
16 | #define MAX_INPUTSTREAMS 8
17 |
18 | struct input_stream {
19 | FILE * fh;
20 | OggVorbis_File vf;
21 | int section;
22 | int length;
23 | };
24 | static struct input_stream input_streams[MAX_INPUTSTREAMS];
25 |
26 | jint Java_org_xiph_vorbis_stream_VorbisFileInputStream_create(
27 | JNIEnv* env,
28 | jobject this,
29 | jstring path,
30 | jobject info
31 | )
32 | {
33 | int ret; /* Debugging variable */
34 | jfieldID channels_field, sample_rate_field, length_field; /* JNI field ID */
35 | jclass cls = (*env)->GetObjectClass(env, info);
36 | int stream_idx;
37 | struct input_stream * iptr;
38 | vorbis_info * vi;
39 |
40 | /* Find an unused input_stream */
41 | for (stream_idx = 0; stream_idx < MAX_INPUTSTREAMS; stream_idx++) {
42 | if (input_streams[stream_idx].fh == NULL) {
43 | const jbyte * pchars = (*env)->GetStringUTFChars(env, path, NULL);
44 | if (pchars == NULL) {
45 | /* Exception Already thrown */
46 | return;
47 | }
48 | /* We found one! */
49 | iptr = &input_streams[stream_idx];
50 | iptr->fh = fopen(pchars, "r");
51 | if (iptr->fh == NULL) {
52 | JNU_ThrowByName(env, "java/io/IOException", "Error Creating File Handle", 0);
53 | return;
54 | }
55 | (*env)->ReleaseStringUTFChars(env, path, pchars);
56 | break;
57 | }
58 | }
59 |
60 | if (stream_idx == MAX_INPUTSTREAMS) {
61 | JNU_ThrowByName(env, "java/io/IOException",
62 | "Too Many Vorbis InputStreams", stream_idx);
63 | return;
64 | }
65 |
66 | /* Open the stream */
67 | ret = ov_open(iptr->fh, &iptr->vf, NULL, 0);
68 | if (ret < 0) {
69 | JNU_ThrowByName(env, "java/io/IOException",
70 | "Vorbis File Corrupt", ret);
71 | fclose(iptr->fh);
72 | iptr->fh = NULL;
73 | return;
74 | }
75 |
76 | channels_field = (*env)->GetFieldID(env, cls, "channels", "I");
77 | sample_rate_field = (*env)->GetFieldID(env, cls, "sampleRate", "I");
78 | length_field = (*env)->GetFieldID(env, cls, "length", "J");
79 | if (channels_field == NULL || sample_rate_field == NULL) {
80 | JNU_ThrowByName(env, "java/lang/Exception",
81 | "Native Field Misnamed", 0);
82 | ov_clear(&iptr->vf);
83 | fclose(iptr->fh);
84 | iptr->fh = NULL;
85 | return;
86 | }
87 |
88 | vi = ov_info(&iptr->vf, -1);
89 |
90 | iptr->section = 0;
91 | iptr->length = ov_pcm_total(&iptr->vf, -1);
92 |
93 | /* Populate basic stream info into the VorbisInfo object. */
94 | (*env)->SetIntField(env, info, channels_field, vi->channels);
95 | (*env)->SetIntField(env, info, sample_rate_field, vi->rate);
96 | (*env)->SetLongField(env, info, length_field, iptr->length);
97 |
98 |
99 | return stream_idx;
100 | }
101 |
102 | jint Java_org_xiph_vorbis_stream_VorbisFileInputStream_readStreamIdx(
103 | JNIEnv* env,
104 | jobject this,
105 | jint sidx,
106 | jshortArray pcm,
107 | jint offset,
108 | jint length
109 | )
110 | {
111 | long ret;
112 | struct input_stream * iptr = &input_streams[sidx];
113 |
114 | jshort * pcmShorts = (*env)->GetShortArrayElements(env, pcm, NULL);
115 | int maxLength = (*env)->GetArrayLength(env,pcm);
116 |
117 | /* Do the battery of validation checks. */
118 | if (offset + length > maxLength) {
119 | JNU_ThrowByName(env, "java/lang/ArrayIndexOutOfBoundsException",
120 | "No data was written to the buffer",
121 | offset + length - 1);
122 | return;
123 | }
124 |
125 | if (sidx >= MAX_INPUTSTREAMS || sidx < 0 || iptr->fh == NULL) {
126 | JNU_ThrowByName(env, "java/io/IOException", "Invalid Stream Index", sidx);
127 | return;
128 | }
129 |
130 | if (length > 0) {
131 | ret = ov_read(&iptr->vf, (char *)(pcmShorts + offset), length, 0, 2, 1, &iptr->section);
132 | /* -1 is EOF */
133 | if (ret == 0) {
134 | ret = -1;
135 | }
136 | else if (ret < 0) {
137 | if (ret == OV_EBADLINK) {
138 | JNU_ThrowByName(env, "java/io/IOException", "Corrupt bitstream section!", iptr->section);
139 | return;
140 | }
141 | }
142 | }
143 | else {
144 | ret = 0;
145 | }
146 | /* Apparently sample rates can change inside the stream... We may need to account for that. */
147 |
148 | (*env)->ReleaseShortArrayElements(env, pcm, pcmShorts, 0);
149 | return ret >> 1;
150 | }
151 |
152 | jlong Java_org_xiph_vorbis_stream_VorbisFileInputStream_skipStreamIdx(
153 | JNIEnv* env,
154 | jobject this,
155 | jint sidx,
156 | jlong offset
157 | )
158 | {
159 | struct input_stream * iptr = &input_streams[sidx];
160 | long ret;
161 | if (sidx >= MAX_INPUTSTREAMS || sidx < 0 || iptr->fh == NULL) {
162 | JNU_ThrowByName(env, "java/io/IOException", "Invalid Stream Index", sidx);
163 | return;
164 | }
165 |
166 | ret = ov_pcm_seek_lap(&iptr->vf, offset);
167 |
168 | if (ret == OV_EREAD) {
169 | JNU_ThrowByName(env, "java/io/IOException", "Read ERROR", ret);
170 | return;
171 | }
172 | else if (ret != 0){
173 | JNU_ThrowByName(env, "java/io/IOException", "Vorbis Seek Error code: ", ret);
174 | return;
175 | }
176 |
177 | return ret;
178 |
179 | }
180 |
181 | void Java_org_xiph_vorbis_stream_VorbisFileInputStream_closeStreamIdx(
182 | JNIEnv* env,
183 | jobject this,
184 | jint sidx
185 | )
186 | {
187 | struct input_stream * iptr = &input_streams[sidx];
188 | if (sidx >= MAX_INPUTSTREAMS || sidx < 0 || iptr->fh == NULL) {
189 | JNU_ThrowByName(env, "java/io/IOException", "Invalid Stream Index", sidx);
190 | return;
191 | }
192 | ov_clear(&iptr->vf);
193 | fclose(iptr->fh);
194 | iptr->fh = NULL;
195 | }
196 |
197 |
198 |
199 |
--------------------------------------------------------------------------------
/jni/libvorbis/Android.mk:
--------------------------------------------------------------------------------
1 | LOCAL_PATH := $(call my-dir)
2 |
3 | include $(CLEAR_VARS)
4 | LOCAL_MODULE := libvorbis
5 | LOCAL_CFLAGS += -I$(LOCAL_PATH)/../include -ffast-math -fsigned-char
6 | ifeq ($(TARGET_ARCH),arm)
7 | LOCAL_CFLAGS += -march=armv6 -marm -mfloat-abi=softfp -mfpu=vfp
8 | endif
9 | LOCAL_SHARED_LIBRARIES := libogg
10 |
11 | LOCAL_SRC_FILES := \
12 | mdct.c \
13 | smallft.c \
14 | block.c \
15 | envelope.c \
16 | window.c \
17 | lsp.c \
18 | lpc.c \
19 | analysis.c \
20 | synthesis.c \
21 | psy.c \
22 | info.c \
23 | floor1.c \
24 | floor0.c \
25 | res0.c \
26 | mapping0.c \
27 | registry.c \
28 | codebook.c \
29 | sharedbook.c \
30 | lookup.c \
31 | bitrate.c \
32 | vorbisfile.c \
33 | vorbisenc.c
34 |
35 | include $(BUILD_SHARED_LIBRARY)
36 |
--------------------------------------------------------------------------------
/jni/libvorbis/analysis.c:
--------------------------------------------------------------------------------
1 | /********************************************************************
2 | * *
3 | * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. *
4 | * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
5 | * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
6 | * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
7 | * *
8 | * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007 *
9 | * by the Xiph.Org Foundation http://www.xiph.org/ *
10 | * *
11 | ********************************************************************
12 |
13 | function: single-block PCM analysis mode dispatch
14 | last mod: $Id: analysis.c 16226 2009-07-08 06:43:49Z xiphmont $
15 |
16 | ********************************************************************/
17 |
18 | #include
19 | #include
20 | #include
21 | #include
22 | #include "vorbis/codec.h"
23 | #include "codec_internal.h"
24 | #include "registry.h"
25 | #include "scales.h"
26 | #include "os.h"
27 | #include "misc.h"
28 |
29 | /* decides between modes, dispatches to the appropriate mapping. */
30 | int vorbis_analysis(vorbis_block *vb, ogg_packet *op){
31 | int ret,i;
32 | vorbis_block_internal *vbi=vb->internal;
33 |
34 | vb->glue_bits=0;
35 | vb->time_bits=0;
36 | vb->floor_bits=0;
37 | vb->res_bits=0;
38 |
39 | /* first things first. Make sure encode is ready */
40 | for(i=0;ipacketblob[i]);
42 |
43 | /* we only have one mapping type (0), and we let the mapping code
44 | itself figure out what soft mode to use. This allows easier
45 | bitrate management */
46 |
47 | if((ret=_mapping_P[0]->forward(vb)))
48 | return(ret);
49 |
50 | if(op){
51 | if(vorbis_bitrate_managed(vb))
52 | /* The app is using a bitmanaged mode... but not using the
53 | bitrate management interface. */
54 | return(OV_EINVAL);
55 |
56 | op->packet=oggpack_get_buffer(&vb->opb);
57 | op->bytes=oggpack_bytes(&vb->opb);
58 | op->b_o_s=0;
59 | op->e_o_s=vb->eofflag;
60 | op->granulepos=vb->granulepos;
61 | op->packetno=vb->sequence; /* for sake of completeness */
62 | }
63 | return(0);
64 | }
65 |
66 | #ifdef ANALYSIS
67 | int analysis_noisy=1;
68 |
69 | /* there was no great place to put this.... */
70 | void _analysis_output_always(char *base,int i,float *v,int n,int bark,int dB,ogg_int64_t off){
71 | int j;
72 | FILE *of;
73 | char buffer[80];
74 |
75 | sprintf(buffer,"%s_%d.m",base,i);
76 | of=fopen(buffer,"w");
77 |
78 | if(!of)perror("failed to open data dump file");
79 |
80 | for(j=0;j
22 |
23 | /* This structure encapsulates huffman and VQ style encoding books; it
24 | doesn't do anything specific to either.
25 |
26 | valuelist/quantlist are nonNULL (and q_* significant) only if
27 | there's entry->value mapping to be done.
28 |
29 | If encode-side mapping must be done (and thus the entry needs to be
30 | hunted), the auxiliary encode pointer will point to a decision
31 | tree. This is true of both VQ and huffman, but is mostly useful
32 | with VQ.
33 |
34 | */
35 |
36 | typedef struct static_codebook{
37 | long dim; /* codebook dimensions (elements per vector) */
38 | long entries; /* codebook entries */
39 | long *lengthlist; /* codeword lengths in bits */
40 |
41 | /* mapping ***************************************************************/
42 | int maptype; /* 0=none
43 | 1=implicitly populated values from map column
44 | 2=listed arbitrary values */
45 |
46 | /* The below does a linear, single monotonic sequence mapping. */
47 | long q_min; /* packed 32 bit float; quant value 0 maps to minval */
48 | long q_delta; /* packed 32 bit float; val 1 - val 0 == delta */
49 | int q_quant; /* bits: 0 < quant <= 16 */
50 | int q_sequencep; /* bitflag */
51 |
52 | long *quantlist; /* map == 1: (int)(entries^(1/dim)) element column map
53 | map == 2: list of dim*entries quantized entry vals
54 | */
55 | int allocedp;
56 | } static_codebook;
57 |
58 | typedef struct codebook{
59 | long dim; /* codebook dimensions (elements per vector) */
60 | long entries; /* codebook entries */
61 | long used_entries; /* populated codebook entries */
62 | const static_codebook *c;
63 |
64 | /* for encode, the below are entry-ordered, fully populated */
65 | /* for decode, the below are ordered by bitreversed codeword and only
66 | used entries are populated */
67 | float *valuelist; /* list of dim*entries actual entry values */
68 | ogg_uint32_t *codelist; /* list of bitstream codewords for each entry */
69 |
70 | int *dec_index; /* only used if sparseness collapsed */
71 | char *dec_codelengths;
72 | ogg_uint32_t *dec_firsttable;
73 | int dec_firsttablen;
74 | int dec_maxlength;
75 |
76 | /* The current encoder uses only centered, integer-only lattice books. */
77 | int quantvals;
78 | int minval;
79 | int delta;
80 | } codebook;
81 |
82 | extern void vorbis_staticbook_destroy(static_codebook *b);
83 | extern int vorbis_book_init_encode(codebook *dest,const static_codebook *source);
84 | extern int vorbis_book_init_decode(codebook *dest,const static_codebook *source);
85 | extern void vorbis_book_clear(codebook *b);
86 |
87 | extern float *_book_unquantize(const static_codebook *b,int n,int *map);
88 | extern float *_book_logdist(const static_codebook *b,float *vals);
89 | extern float _float32_unpack(long val);
90 | extern long _float32_pack(float val);
91 | extern int _best(codebook *book, float *a, int step);
92 | extern int _ilog(unsigned int v);
93 | extern long _book_maptype1_quantvals(const static_codebook *b);
94 |
95 | extern int vorbis_book_besterror(codebook *book,float *a,int step,int addmul);
96 | extern long vorbis_book_codeword(codebook *book,int entry);
97 | extern long vorbis_book_codelen(codebook *book,int entry);
98 |
99 |
100 |
101 | extern int vorbis_staticbook_pack(const static_codebook *c,oggpack_buffer *b);
102 | extern static_codebook *vorbis_staticbook_unpack(oggpack_buffer *b);
103 |
104 | extern int vorbis_book_encode(codebook *book, int a, oggpack_buffer *b);
105 |
106 | extern long vorbis_book_decode(codebook *book, oggpack_buffer *b);
107 | extern long vorbis_book_decodevs_add(codebook *book, float *a,
108 | oggpack_buffer *b,int n);
109 | extern long vorbis_book_decodev_set(codebook *book, float *a,
110 | oggpack_buffer *b,int n);
111 | extern long vorbis_book_decodev_add(codebook *book, float *a,
112 | oggpack_buffer *b,int n);
113 | extern long vorbis_book_decodevv_add(codebook *book, float **a,
114 | long off,int ch,
115 | oggpack_buffer *b,int n);
116 |
117 |
118 |
119 | #endif
120 |
--------------------------------------------------------------------------------
/jni/libvorbis/codec_internal.h:
--------------------------------------------------------------------------------
1 | /********************************************************************
2 | * *
3 | * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. *
4 | * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
5 | * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
6 | * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
7 | * *
8 | * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 *
9 | * by the Xiph.Org Foundation http://www.xiph.org/ *
10 | * *
11 | ********************************************************************
12 |
13 | function: libvorbis codec headers
14 | last mod: $Id: codec_internal.h 16227 2009-07-08 06:58:46Z xiphmont $
15 |
16 | ********************************************************************/
17 |
18 | #ifndef _V_CODECI_H_
19 | #define _V_CODECI_H_
20 |
21 | #include "envelope.h"
22 | #include "codebook.h"
23 |
24 | #define BLOCKTYPE_IMPULSE 0
25 | #define BLOCKTYPE_PADDING 1
26 | #define BLOCKTYPE_TRANSITION 0
27 | #define BLOCKTYPE_LONG 1
28 |
29 | #define PACKETBLOBS 15
30 |
31 | typedef struct vorbis_block_internal{
32 | float **pcmdelay; /* this is a pointer into local storage */
33 | float ampmax;
34 | int blocktype;
35 |
36 | oggpack_buffer *packetblob[PACKETBLOBS]; /* initialized, must be freed;
37 | blob [PACKETBLOBS/2] points to
38 | the oggpack_buffer in the
39 | main vorbis_block */
40 | } vorbis_block_internal;
41 |
42 | typedef void vorbis_look_floor;
43 | typedef void vorbis_look_residue;
44 | typedef void vorbis_look_transform;
45 |
46 | /* mode ************************************************************/
47 | typedef struct {
48 | int blockflag;
49 | int windowtype;
50 | int transformtype;
51 | int mapping;
52 | } vorbis_info_mode;
53 |
54 | typedef void vorbis_info_floor;
55 | typedef void vorbis_info_residue;
56 | typedef void vorbis_info_mapping;
57 |
58 | #include "psy.h"
59 | #include "bitrate.h"
60 |
61 | typedef struct private_state {
62 | /* local lookup storage */
63 | envelope_lookup *ve; /* envelope lookup */
64 | int window[2];
65 | vorbis_look_transform **transform[2]; /* block, type */
66 | drft_lookup fft_look[2];
67 |
68 | int modebits;
69 | vorbis_look_floor **flr;
70 | vorbis_look_residue **residue;
71 | vorbis_look_psy *psy;
72 | vorbis_look_psy_global *psy_g_look;
73 |
74 | /* local storage, only used on the encoding side. This way the
75 | application does not need to worry about freeing some packets'
76 | memory and not others'; packet storage is always tracked.
77 | Cleared next call to a _dsp_ function */
78 | unsigned char *header;
79 | unsigned char *header1;
80 | unsigned char *header2;
81 |
82 | bitrate_manager_state bms;
83 |
84 | ogg_int64_t sample_count;
85 | } private_state;
86 |
87 | /* codec_setup_info contains all the setup information specific to the
88 | specific compression/decompression mode in progress (eg,
89 | psychoacoustic settings, channel setup, options, codebook
90 | etc).
91 | *********************************************************************/
92 |
93 | #include "highlevel.h"
94 | typedef struct codec_setup_info {
95 |
96 | /* Vorbis supports only short and long blocks, but allows the
97 | encoder to choose the sizes */
98 |
99 | long blocksizes[2];
100 |
101 | /* modes are the primary means of supporting on-the-fly different
102 | blocksizes, different channel mappings (LR or M/A),
103 | different residue backends, etc. Each mode consists of a
104 | blocksize flag and a mapping (along with the mapping setup */
105 |
106 | int modes;
107 | int maps;
108 | int floors;
109 | int residues;
110 | int books;
111 | int psys; /* encode only */
112 |
113 | vorbis_info_mode *mode_param[64];
114 | int map_type[64];
115 | vorbis_info_mapping *map_param[64];
116 | int floor_type[64];
117 | vorbis_info_floor *floor_param[64];
118 | int residue_type[64];
119 | vorbis_info_residue *residue_param[64];
120 | static_codebook *book_param[256];
121 | codebook *fullbooks;
122 |
123 | vorbis_info_psy *psy_param[4]; /* encode only */
124 | vorbis_info_psy_global psy_g_param;
125 |
126 | bitrate_manager_info bi;
127 | highlevel_encode_setup hi; /* used only by vorbisenc.c. It's a
128 | highly redundant structure, but
129 | improves clarity of program flow. */
130 | int halfrate_flag; /* painless downsample for decode */
131 | } codec_setup_info;
132 |
133 | extern vorbis_look_psy_global *_vp_global_look(vorbis_info *vi);
134 | extern void _vp_global_free(vorbis_look_psy_global *look);
135 |
136 |
137 |
138 | typedef struct {
139 | int sorted_index[VIF_POSIT+2];
140 | int forward_index[VIF_POSIT+2];
141 | int reverse_index[VIF_POSIT+2];
142 |
143 | int hineighbor[VIF_POSIT];
144 | int loneighbor[VIF_POSIT];
145 | int posts;
146 |
147 | int n;
148 | int quant_q;
149 | vorbis_info_floor1 *vi;
150 |
151 | long phrasebits;
152 | long postbits;
153 | long frames;
154 | } vorbis_look_floor1;
155 |
156 |
157 |
158 | extern int *floor1_fit(vorbis_block *vb,vorbis_look_floor1 *look,
159 | const float *logmdct, /* in */
160 | const float *logmask);
161 | extern int *floor1_interpolate_fit(vorbis_block *vb,vorbis_look_floor1 *look,
162 | int *A,int *B,
163 | int del);
164 | extern int floor1_encode(oggpack_buffer *opb,vorbis_block *vb,
165 | vorbis_look_floor1 *look,
166 | int *post,int *ilogmask);
167 | #endif
168 |
--------------------------------------------------------------------------------
/jni/libvorbis/envelope.h:
--------------------------------------------------------------------------------
1 | /********************************************************************
2 | * *
3 | * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. *
4 | * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
5 | * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
6 | * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
7 | * *
8 | * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 *
9 | * by the Xiph.Org Foundation http://www.xiph.org/ *
10 | * *
11 | ********************************************************************
12 |
13 | function: PCM data envelope analysis and manipulation
14 | last mod: $Id: envelope.h 16227 2009-07-08 06:58:46Z xiphmont $
15 |
16 | ********************************************************************/
17 |
18 | #ifndef _V_ENVELOPE_
19 | #define _V_ENVELOPE_
20 |
21 | #include "mdct.h"
22 |
23 | #define VE_PRE 16
24 | #define VE_WIN 4
25 | #define VE_POST 2
26 | #define VE_AMP (VE_PRE+VE_POST-1)
27 |
28 | #define VE_BANDS 7
29 | #define VE_NEARDC 15
30 |
31 | #define VE_MINSTRETCH 2 /* a bit less than short block */
32 | #define VE_MAXSTRETCH 12 /* one-third full block */
33 |
34 | typedef struct {
35 | float ampbuf[VE_AMP];
36 | int ampptr;
37 |
38 | float nearDC[VE_NEARDC];
39 | float nearDC_acc;
40 | float nearDC_partialacc;
41 | int nearptr;
42 |
43 | } envelope_filter_state;
44 |
45 | typedef struct {
46 | int begin;
47 | int end;
48 | float *window;
49 | float total;
50 | } envelope_band;
51 |
52 | typedef struct {
53 | int ch;
54 | int winlength;
55 | int searchstep;
56 | float minenergy;
57 |
58 | mdct_lookup mdct;
59 | float *mdct_win;
60 |
61 | envelope_band band[VE_BANDS];
62 | envelope_filter_state *filter;
63 | int stretch;
64 |
65 | int *mark;
66 |
67 | long storage;
68 | long current;
69 | long curmark;
70 | long cursor;
71 | } envelope_lookup;
72 |
73 | extern void _ve_envelope_init(envelope_lookup *e,vorbis_info *vi);
74 | extern void _ve_envelope_clear(envelope_lookup *e);
75 | extern long _ve_envelope_search(vorbis_dsp_state *v);
76 | extern void _ve_envelope_shift(envelope_lookup *e,long shift);
77 | extern int _ve_envelope_mark(vorbis_dsp_state *v);
78 |
79 |
80 | #endif
81 |
--------------------------------------------------------------------------------
/jni/libvorbis/floor0.c:
--------------------------------------------------------------------------------
1 | /********************************************************************
2 | * *
3 | * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. *
4 | * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
5 | * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
6 | * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
7 | * *
8 | * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 *
9 | * by the Xiph.Org Foundation http://www.xiph.org/ *
10 | * *
11 | ********************************************************************
12 |
13 | function: floor backend 0 implementation
14 | last mod: $Id: floor0.c 17558 2010-10-22 00:24:41Z tterribe $
15 |
16 | ********************************************************************/
17 |
18 | #include
19 | #include
20 | #include
21 | #include
22 | #include "vorbis/codec.h"
23 | #include "codec_internal.h"
24 | #include "registry.h"
25 | #include "lpc.h"
26 | #include "lsp.h"
27 | #include "codebook.h"
28 | #include "scales.h"
29 | #include "misc.h"
30 | #include "os.h"
31 |
32 | #include "misc.h"
33 | #include
34 |
35 | typedef struct {
36 | int ln;
37 | int m;
38 | int **linearmap;
39 | int n[2];
40 |
41 | vorbis_info_floor0 *vi;
42 |
43 | long bits;
44 | long frames;
45 | } vorbis_look_floor0;
46 |
47 |
48 | /***********************************************/
49 |
50 | static void floor0_free_info(vorbis_info_floor *i){
51 | vorbis_info_floor0 *info=(vorbis_info_floor0 *)i;
52 | if(info){
53 | memset(info,0,sizeof(*info));
54 | _ogg_free(info);
55 | }
56 | }
57 |
58 | static void floor0_free_look(vorbis_look_floor *i){
59 | vorbis_look_floor0 *look=(vorbis_look_floor0 *)i;
60 | if(look){
61 |
62 | if(look->linearmap){
63 |
64 | if(look->linearmap[0])_ogg_free(look->linearmap[0]);
65 | if(look->linearmap[1])_ogg_free(look->linearmap[1]);
66 |
67 | _ogg_free(look->linearmap);
68 | }
69 | memset(look,0,sizeof(*look));
70 | _ogg_free(look);
71 | }
72 | }
73 |
74 | static vorbis_info_floor *floor0_unpack (vorbis_info *vi,oggpack_buffer *opb){
75 | codec_setup_info *ci=vi->codec_setup;
76 | int j;
77 |
78 | vorbis_info_floor0 *info=_ogg_malloc(sizeof(*info));
79 | info->order=oggpack_read(opb,8);
80 | info->rate=oggpack_read(opb,16);
81 | info->barkmap=oggpack_read(opb,16);
82 | info->ampbits=oggpack_read(opb,6);
83 | info->ampdB=oggpack_read(opb,8);
84 | info->numbooks=oggpack_read(opb,4)+1;
85 |
86 | if(info->order<1)goto err_out;
87 | if(info->rate<1)goto err_out;
88 | if(info->barkmap<1)goto err_out;
89 | if(info->numbooks<1)goto err_out;
90 |
91 | for(j=0;jnumbooks;j++){
92 | info->books[j]=oggpack_read(opb,8);
93 | if(info->books[j]<0 || info->books[j]>=ci->books)goto err_out;
94 | if(ci->book_param[info->books[j]]->maptype==0)goto err_out;
95 | if(ci->book_param[info->books[j]]->dim<1)goto err_out;
96 | }
97 | return(info);
98 |
99 | err_out:
100 | floor0_free_info(info);
101 | return(NULL);
102 | }
103 |
104 | /* initialize Bark scale and normalization lookups. We could do this
105 | with static tables, but Vorbis allows a number of possible
106 | combinations, so it's best to do it computationally.
107 |
108 | The below is authoritative in terms of defining scale mapping.
109 | Note that the scale depends on the sampling rate as well as the
110 | linear block and mapping sizes */
111 |
112 | static void floor0_map_lazy_init(vorbis_block *vb,
113 | vorbis_info_floor *infoX,
114 | vorbis_look_floor0 *look){
115 | if(!look->linearmap[vb->W]){
116 | vorbis_dsp_state *vd=vb->vd;
117 | vorbis_info *vi=vd->vi;
118 | codec_setup_info *ci=vi->codec_setup;
119 | vorbis_info_floor0 *info=(vorbis_info_floor0 *)infoX;
120 | int W=vb->W;
121 | int n=ci->blocksizes[W]/2,j;
122 |
123 | /* we choose a scaling constant so that:
124 | floor(bark(rate/2-1)*C)=mapped-1
125 | floor(bark(rate/2)*C)=mapped */
126 | float scale=look->ln/toBARK(info->rate/2.f);
127 |
128 | /* the mapping from a linear scale to a smaller bark scale is
129 | straightforward. We do *not* make sure that the linear mapping
130 | does not skip bark-scale bins; the decoder simply skips them and
131 | the encoder may do what it wishes in filling them. They're
132 | necessary in some mapping combinations to keep the scale spacing
133 | accurate */
134 | look->linearmap[W]=_ogg_malloc((n+1)*sizeof(**look->linearmap));
135 | for(j=0;jrate/2.f)/n*j)
137 | *scale); /* bark numbers represent band edges */
138 | if(val>=look->ln)val=look->ln-1; /* guard against the approximation */
139 | look->linearmap[W][j]=val;
140 | }
141 | look->linearmap[W][j]=-1;
142 | look->n[W]=n;
143 | }
144 | }
145 |
146 | static vorbis_look_floor *floor0_look(vorbis_dsp_state *vd,
147 | vorbis_info_floor *i){
148 | vorbis_info_floor0 *info=(vorbis_info_floor0 *)i;
149 | vorbis_look_floor0 *look=_ogg_calloc(1,sizeof(*look));
150 | look->m=info->order;
151 | look->ln=info->barkmap;
152 | look->vi=info;
153 |
154 | look->linearmap=_ogg_calloc(2,sizeof(*look->linearmap));
155 |
156 | return look;
157 | }
158 |
159 | static void *floor0_inverse1(vorbis_block *vb,vorbis_look_floor *i){
160 | vorbis_look_floor0 *look=(vorbis_look_floor0 *)i;
161 | vorbis_info_floor0 *info=look->vi;
162 | int j,k;
163 |
164 | int ampraw=oggpack_read(&vb->opb,info->ampbits);
165 | if(ampraw>0){ /* also handles the -1 out of data case */
166 | long maxval=(1<ampbits)-1;
167 | float amp=(float)ampraw/maxval*info->ampdB;
168 | int booknum=oggpack_read(&vb->opb,_ilog(info->numbooks));
169 |
170 | if(booknum!=-1 && booknumnumbooks){ /* be paranoid */
171 | codec_setup_info *ci=vb->vd->vi->codec_setup;
172 | codebook *b=ci->fullbooks+info->books[booknum];
173 | float last=0.f;
174 |
175 | /* the additional b->dim is a guard against any possible stack
176 | smash; b->dim is provably more than we can overflow the
177 | vector */
178 | float *lsp=_vorbis_block_alloc(vb,sizeof(*lsp)*(look->m+b->dim+1));
179 |
180 | for(j=0;jm;j+=b->dim)
181 | if(vorbis_book_decodev_set(b,lsp+j,&vb->opb,b->dim)==-1)goto eop;
182 | for(j=0;jm;){
183 | for(k=0;kdim;k++,j++)lsp[j]+=last;
184 | last=lsp[j-1];
185 | }
186 |
187 | lsp[look->m]=amp;
188 | return(lsp);
189 | }
190 | }
191 | eop:
192 | return(NULL);
193 | }
194 |
195 | static int floor0_inverse2(vorbis_block *vb,vorbis_look_floor *i,
196 | void *memo,float *out){
197 | vorbis_look_floor0 *look=(vorbis_look_floor0 *)i;
198 | vorbis_info_floor0 *info=look->vi;
199 |
200 | floor0_map_lazy_init(vb,info,look);
201 |
202 | if(memo){
203 | float *lsp=(float *)memo;
204 | float amp=lsp[look->m];
205 |
206 | /* take the coefficients back to a spectral envelope curve */
207 | vorbis_lsp_to_curve(out,
208 | look->linearmap[vb->W],
209 | look->n[vb->W],
210 | look->ln,
211 | lsp,look->m,amp,(float)info->ampdB);
212 | return(1);
213 | }
214 | memset(out,0,sizeof(*out)*look->n[vb->W]);
215 | return(0);
216 | }
217 |
218 | /* export hooks */
219 | const vorbis_func_floor floor0_exportbundle={
220 | NULL,&floor0_unpack,&floor0_look,&floor0_free_info,
221 | &floor0_free_look,&floor0_inverse1,&floor0_inverse2
222 | };
223 |
--------------------------------------------------------------------------------
/jni/libvorbis/highlevel.h:
--------------------------------------------------------------------------------
1 | /********************************************************************
2 | * *
3 | * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. *
4 | * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
5 | * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
6 | * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
7 | * *
8 | * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 *
9 | * by the Xiph.Org Foundation http://www.xiph.org/ *
10 | * *
11 | ********************************************************************
12 |
13 | function: highlevel encoder setup struct separated out for vorbisenc clarity
14 | last mod: $Id: highlevel.h 17195 2010-05-05 21:49:51Z giles $
15 |
16 | ********************************************************************/
17 |
18 | typedef struct highlevel_byblocktype {
19 | double tone_mask_setting;
20 | double tone_peaklimit_setting;
21 | double noise_bias_setting;
22 | double noise_compand_setting;
23 | } highlevel_byblocktype;
24 |
25 | typedef struct highlevel_encode_setup {
26 | int set_in_stone;
27 | const void *setup;
28 | double base_setting;
29 |
30 | double impulse_noisetune;
31 |
32 | /* bitrate management below all settable */
33 | float req;
34 | int managed;
35 | long bitrate_min;
36 | long bitrate_av;
37 | double bitrate_av_damp;
38 | long bitrate_max;
39 | long bitrate_reservoir;
40 | double bitrate_reservoir_bias;
41 |
42 | int impulse_block_p;
43 | int noise_normalize_p;
44 | int coupling_p;
45 |
46 | double stereo_point_setting;
47 | double lowpass_kHz;
48 | int lowpass_altered;
49 |
50 | double ath_floating_dB;
51 | double ath_absolute_dB;
52 |
53 | double amplitude_track_dBpersec;
54 | double trigger_setting;
55 |
56 | highlevel_byblocktype block[4]; /* padding, impulse, transition, long */
57 |
58 | } highlevel_encode_setup;
59 |
--------------------------------------------------------------------------------
/jni/libvorbis/lookup.c:
--------------------------------------------------------------------------------
1 | /********************************************************************
2 | * *
3 | * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. *
4 | * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
5 | * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
6 | * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
7 | * *
8 | * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 *
9 | * by the Xiph.Org Foundation http://www.xiph.org/ *
10 | * *
11 | ********************************************************************
12 |
13 | function: lookup based functions
14 | last mod: $Id: lookup.c 16227 2009-07-08 06:58:46Z xiphmont $
15 |
16 | ********************************************************************/
17 |
18 | #include
19 | #include "lookup.h"
20 | #include "lookup_data.h"
21 | #include "os.h"
22 | #include "misc.h"
23 |
24 | #ifdef FLOAT_LOOKUP
25 |
26 | /* interpolated lookup based cos function, domain 0 to PI only */
27 | float vorbis_coslook(float a){
28 | double d=a*(.31830989*(float)COS_LOOKUP_SZ);
29 | int i=vorbis_ftoi(d-.5);
30 |
31 | return COS_LOOKUP[i]+ (d-i)*(COS_LOOKUP[i+1]-COS_LOOKUP[i]);
32 | }
33 |
34 | /* interpolated 1./sqrt(p) where .5 <= p < 1. */
35 | float vorbis_invsqlook(float a){
36 | double d=a*(2.f*(float)INVSQ_LOOKUP_SZ)-(float)INVSQ_LOOKUP_SZ;
37 | int i=vorbis_ftoi(d-.5f);
38 | return INVSQ_LOOKUP[i]+ (d-i)*(INVSQ_LOOKUP[i+1]-INVSQ_LOOKUP[i]);
39 | }
40 |
41 | /* interpolated 1./sqrt(p) where .5 <= p < 1. */
42 | float vorbis_invsq2explook(int a){
43 | return INVSQ2EXP_LOOKUP[a-INVSQ2EXP_LOOKUP_MIN];
44 | }
45 |
46 | #include
47 | /* interpolated lookup based fromdB function, domain -140dB to 0dB only */
48 | float vorbis_fromdBlook(float a){
49 | int i=vorbis_ftoi(a*((float)(-(1<=(FROMdB_LOOKUP_SZ<>FROMdB_SHIFT]*FROMdB2_LOOKUP[i&FROMdB2_MASK]);
53 | }
54 |
55 | #endif
56 |
57 | #ifdef INT_LOOKUP
58 | /* interpolated 1./sqrt(p) where .5 <= a < 1. (.100000... to .111111...) in
59 | 16.16 format
60 |
61 | returns in m.8 format */
62 | long vorbis_invsqlook_i(long a,long e){
63 | long i=(a&0x7fff)>>(INVSQ_LOOKUP_I_SHIFT-1);
64 | long d=(a&INVSQ_LOOKUP_I_MASK)<<(16-INVSQ_LOOKUP_I_SHIFT); /* 0.16 */
65 | long val=INVSQ_LOOKUP_I[i]- /* 1.16 */
66 | (((INVSQ_LOOKUP_I[i]-INVSQ_LOOKUP_I[i+1])* /* 0.16 */
67 | d)>>16); /* result 1.16 */
68 |
69 | e+=32;
70 | if(e&1)val=(val*5792)>>13; /* multiply val by 1/sqrt(2) */
71 | e=(e>>1)-8;
72 |
73 | return(val>>e);
74 | }
75 |
76 | /* interpolated lookup based fromdB function, domain -140dB to 0dB only */
77 | /* a is in n.12 format */
78 | float vorbis_fromdBlook_i(long a){
79 | int i=(-a)>>(12-FROMdB2_SHIFT);
80 | return (i<0)?1.f:
81 | ((i>=(FROMdB_LOOKUP_SZ<>FROMdB_SHIFT]*FROMdB2_LOOKUP[i&FROMdB2_MASK]);
83 | }
84 |
85 | /* interpolated lookup based cos function, domain 0 to PI only */
86 | /* a is in 0.16 format, where 0==0, 2^^16-1==PI, return 0.14 */
87 | long vorbis_coslook_i(long a){
88 | int i=a>>COS_LOOKUP_I_SHIFT;
89 | int d=a&COS_LOOKUP_I_MASK;
90 | return COS_LOOKUP_I[i]- ((d*(COS_LOOKUP_I[i]-COS_LOOKUP_I[i+1]))>>
91 | COS_LOOKUP_I_SHIFT);
92 | }
93 |
94 | #endif
95 |
--------------------------------------------------------------------------------
/jni/libvorbis/lookup.h:
--------------------------------------------------------------------------------
1 | /********************************************************************
2 | * *
3 | * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. *
4 | * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
5 | * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
6 | * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
7 | * *
8 | * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 *
9 | * by the Xiph.Org Foundation http://www.xiph.org/ *
10 | * *
11 | ********************************************************************
12 |
13 | function: lookup based functions
14 | last mod: $Id: lookup.h 16227 2009-07-08 06:58:46Z xiphmont $
15 |
16 | ********************************************************************/
17 |
18 | #ifndef _V_LOOKUP_H_
19 |
20 | #ifdef FLOAT_LOOKUP
21 | extern float vorbis_coslook(float a);
22 | extern float vorbis_invsqlook(float a);
23 | extern float vorbis_invsq2explook(int a);
24 | extern float vorbis_fromdBlook(float a);
25 | #endif
26 | #ifdef INT_LOOKUP
27 | extern long vorbis_invsqlook_i(long a,long e);
28 | extern long vorbis_coslook_i(long a);
29 | extern float vorbis_fromdBlook_i(long a);
30 | #endif
31 |
32 | #endif
33 |
--------------------------------------------------------------------------------
/jni/libvorbis/lpc.c:
--------------------------------------------------------------------------------
1 | /********************************************************************
2 | * *
3 | * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. *
4 | * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
5 | * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
6 | * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
7 | * *
8 | * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 *
9 | * by the Xiph.Org Foundation http://www.xiph.org/ *
10 | * *
11 | ********************************************************************
12 |
13 | function: LPC low level routines
14 | last mod: $Id: lpc.c 16227 2009-07-08 06:58:46Z xiphmont $
15 |
16 | ********************************************************************/
17 |
18 | /* Some of these routines (autocorrelator, LPC coefficient estimator)
19 | are derived from code written by Jutta Degener and Carsten Bormann;
20 | thus we include their copyright below. The entirety of this file
21 | is freely redistributable on the condition that both of these
22 | copyright notices are preserved without modification. */
23 |
24 | /* Preserved Copyright: *********************************************/
25 |
26 | /* Copyright 1992, 1993, 1994 by Jutta Degener and Carsten Bormann,
27 | Technische Universita"t Berlin
28 |
29 | Any use of this software is permitted provided that this notice is not
30 | removed and that neither the authors nor the Technische Universita"t
31 | Berlin are deemed to have made any representations as to the
32 | suitability of this software for any purpose nor are held responsible
33 | for any defects of this software. THERE IS ABSOLUTELY NO WARRANTY FOR
34 | THIS SOFTWARE.
35 |
36 | As a matter of courtesy, the authors request to be informed about uses
37 | this software has found, about bugs in this software, and about any
38 | improvements that may be of general interest.
39 |
40 | Berlin, 28.11.1994
41 | Jutta Degener
42 | Carsten Bormann
43 |
44 | *********************************************************************/
45 |
46 | #include
47 | #include
48 | #include
49 | #include "os.h"
50 | #include "smallft.h"
51 | #include "lpc.h"
52 | #include "scales.h"
53 | #include "misc.h"
54 |
55 | /* Autocorrelation LPC coeff generation algorithm invented by
56 | N. Levinson in 1947, modified by J. Durbin in 1959. */
57 |
58 | /* Input : n elements of time doamin data
59 | Output: m lpc coefficients, excitation energy */
60 |
61 | float vorbis_lpc_from_data(float *data,float *lpci,int n,int m){
62 | double *aut=alloca(sizeof(*aut)*(m+1));
63 | double *lpc=alloca(sizeof(*lpc)*(m));
64 | double error;
65 | double epsilon;
66 | int i,j;
67 |
68 | /* autocorrelation, p+1 lag coefficients */
69 | j=m+1;
70 | while(j--){
71 | double d=0; /* double needed for accumulator depth */
72 | for(i=j;i>TRIGBITS)
39 | #define HALVE(x) ((x)>>1)
40 |
41 | #else
42 |
43 | #define DATA_TYPE float
44 | #define REG_TYPE float
45 | #define cPI3_8 .38268343236508977175F
46 | #define cPI2_8 .70710678118654752441F
47 | #define cPI1_8 .92387953251128675613F
48 |
49 | #define FLOAT_CONV(x) (x)
50 | #define MULT_NORM(x) (x)
51 | #define HALVE(x) ((x)*.5f)
52 |
53 | #endif
54 |
55 |
56 | typedef struct {
57 | int n;
58 | int log2n;
59 |
60 | DATA_TYPE *trig;
61 | int *bitrev;
62 |
63 | DATA_TYPE scale;
64 | } mdct_lookup;
65 |
66 | extern void mdct_init(mdct_lookup *lookup,int n);
67 | extern void mdct_clear(mdct_lookup *l);
68 | extern void mdct_forward(mdct_lookup *init, DATA_TYPE *in, DATA_TYPE *out);
69 | extern void mdct_backward(mdct_lookup *init, DATA_TYPE *in, DATA_TYPE *out);
70 |
71 | #endif
72 |
--------------------------------------------------------------------------------
/jni/libvorbis/misc.h:
--------------------------------------------------------------------------------
1 | /********************************************************************
2 | * *
3 | * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. *
4 | * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
5 | * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
6 | * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
7 | * *
8 | * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 *
9 | * by the Xiph.Org Foundation http://www.xiph.org/ *
10 | * *
11 | ********************************************************************
12 |
13 | function: miscellaneous prototypes
14 | last mod: $Id: misc.h 16227 2009-07-08 06:58:46Z xiphmont $
15 |
16 | ********************************************************************/
17 |
18 | #ifndef _V_RANDOM_H_
19 | #define _V_RANDOM_H_
20 | #include "vorbis/codec.h"
21 |
22 | extern void *_vorbis_block_alloc(vorbis_block *vb,long bytes);
23 | extern void _vorbis_block_ripcord(vorbis_block *vb);
24 |
25 | #ifdef ANALYSIS
26 | extern int analysis_noisy;
27 | extern void _analysis_output(char *base,int i,float *v,int n,int bark,int dB,
28 | ogg_int64_t off);
29 | extern void _analysis_output_always(char *base,int i,float *v,int n,int bark,int dB,
30 | ogg_int64_t off);
31 | #endif
32 |
33 | #ifdef DEBUG_MALLOC
34 |
35 | #define _VDBG_GRAPHFILE "malloc.m"
36 | #undef _VDBG_GRAPHFILE
37 | extern void *_VDBG_malloc(void *ptr,long bytes,char *file,long line);
38 | extern void _VDBG_free(void *ptr,char *file,long line);
39 |
40 | #ifndef MISC_C
41 | #undef _ogg_malloc
42 | #undef _ogg_calloc
43 | #undef _ogg_realloc
44 | #undef _ogg_free
45 |
46 | #define _ogg_malloc(x) _VDBG_malloc(NULL,(x),__FILE__,__LINE__)
47 | #define _ogg_calloc(x,y) _VDBG_malloc(NULL,(x)*(y),__FILE__,__LINE__)
48 | #define _ogg_realloc(x,y) _VDBG_malloc((x),(y),__FILE__,__LINE__)
49 | #define _ogg_free(x) _VDBG_free((x),__FILE__,__LINE__)
50 | #endif
51 | #endif
52 |
53 | #endif
54 |
55 |
56 |
57 |
58 |
--------------------------------------------------------------------------------
/jni/libvorbis/modes/Makefile.am:
--------------------------------------------------------------------------------
1 | ## Process this file with automake to produce Makefile.in
2 |
3 | EXTRA_DIST = floor_all.h psych_44.h residue_44.h setup_11.h setup_32.h \
4 | setup_8.h psych_11.h psych_8.h residue_44u.h setup_16.h \
5 | setup_44.h setup_X.h psych_16.h residue_16.h residue_8.h \
6 | setup_22.h setup_44u.h setup_44p51.h residue_44p51.h
7 |
--------------------------------------------------------------------------------
/jni/libvorbis/modes/floor_all.h:
--------------------------------------------------------------------------------
1 | /********************************************************************
2 | * *
3 | * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. *
4 | * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
5 | * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
6 | * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
7 | * *
8 | * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 *
9 | * by the Xiph.Org Foundation http://www.xiph.org/ *
10 | * *
11 | ********************************************************************
12 |
13 | function: key floor settings
14 | last mod: $Id: floor_all.h 17050 2010-03-26 01:34:42Z xiphmont $
15 |
16 | ********************************************************************/
17 |
18 | #include "vorbis/codec.h"
19 | #include "backends.h"
20 | #include "books/floor/floor_books.h"
21 |
22 | static const static_codebook*const _floor_128x4_books[]={
23 | &_huff_book_line_128x4_class0,
24 | &_huff_book_line_128x4_0sub0,
25 | &_huff_book_line_128x4_0sub1,
26 | &_huff_book_line_128x4_0sub2,
27 | &_huff_book_line_128x4_0sub3,
28 | };
29 | static const static_codebook*const _floor_256x4_books[]={
30 | &_huff_book_line_256x4_class0,
31 | &_huff_book_line_256x4_0sub0,
32 | &_huff_book_line_256x4_0sub1,
33 | &_huff_book_line_256x4_0sub2,
34 | &_huff_book_line_256x4_0sub3,
35 | };
36 | static const static_codebook*const _floor_128x7_books[]={
37 | &_huff_book_line_128x7_class0,
38 | &_huff_book_line_128x7_class1,
39 |
40 | &_huff_book_line_128x7_0sub1,
41 | &_huff_book_line_128x7_0sub2,
42 | &_huff_book_line_128x7_0sub3,
43 | &_huff_book_line_128x7_1sub1,
44 | &_huff_book_line_128x7_1sub2,
45 | &_huff_book_line_128x7_1sub3,
46 | };
47 | static const static_codebook*const _floor_256x7_books[]={
48 | &_huff_book_line_256x7_class0,
49 | &_huff_book_line_256x7_class1,
50 |
51 | &_huff_book_line_256x7_0sub1,
52 | &_huff_book_line_256x7_0sub2,
53 | &_huff_book_line_256x7_0sub3,
54 | &_huff_book_line_256x7_1sub1,
55 | &_huff_book_line_256x7_1sub2,
56 | &_huff_book_line_256x7_1sub3,
57 | };
58 | static const static_codebook*const _floor_128x11_books[]={
59 | &_huff_book_line_128x11_class1,
60 | &_huff_book_line_128x11_class2,
61 | &_huff_book_line_128x11_class3,
62 |
63 | &_huff_book_line_128x11_0sub0,
64 | &_huff_book_line_128x11_1sub0,
65 | &_huff_book_line_128x11_1sub1,
66 | &_huff_book_line_128x11_2sub1,
67 | &_huff_book_line_128x11_2sub2,
68 | &_huff_book_line_128x11_2sub3,
69 | &_huff_book_line_128x11_3sub1,
70 | &_huff_book_line_128x11_3sub2,
71 | &_huff_book_line_128x11_3sub3,
72 | };
73 | static const static_codebook*const _floor_128x17_books[]={
74 | &_huff_book_line_128x17_class1,
75 | &_huff_book_line_128x17_class2,
76 | &_huff_book_line_128x17_class3,
77 |
78 | &_huff_book_line_128x17_0sub0,
79 | &_huff_book_line_128x17_1sub0,
80 | &_huff_book_line_128x17_1sub1,
81 | &_huff_book_line_128x17_2sub1,
82 | &_huff_book_line_128x17_2sub2,
83 | &_huff_book_line_128x17_2sub3,
84 | &_huff_book_line_128x17_3sub1,
85 | &_huff_book_line_128x17_3sub2,
86 | &_huff_book_line_128x17_3sub3,
87 | };
88 | static const static_codebook*const _floor_256x4low_books[]={
89 | &_huff_book_line_256x4low_class0,
90 | &_huff_book_line_256x4low_0sub0,
91 | &_huff_book_line_256x4low_0sub1,
92 | &_huff_book_line_256x4low_0sub2,
93 | &_huff_book_line_256x4low_0sub3,
94 | };
95 | static const static_codebook*const _floor_1024x27_books[]={
96 | &_huff_book_line_1024x27_class1,
97 | &_huff_book_line_1024x27_class2,
98 | &_huff_book_line_1024x27_class3,
99 | &_huff_book_line_1024x27_class4,
100 |
101 | &_huff_book_line_1024x27_0sub0,
102 | &_huff_book_line_1024x27_1sub0,
103 | &_huff_book_line_1024x27_1sub1,
104 | &_huff_book_line_1024x27_2sub0,
105 | &_huff_book_line_1024x27_2sub1,
106 | &_huff_book_line_1024x27_3sub1,
107 | &_huff_book_line_1024x27_3sub2,
108 | &_huff_book_line_1024x27_3sub3,
109 | &_huff_book_line_1024x27_4sub1,
110 | &_huff_book_line_1024x27_4sub2,
111 | &_huff_book_line_1024x27_4sub3,
112 | };
113 | static const static_codebook*const _floor_2048x27_books[]={
114 | &_huff_book_line_2048x27_class1,
115 | &_huff_book_line_2048x27_class2,
116 | &_huff_book_line_2048x27_class3,
117 | &_huff_book_line_2048x27_class4,
118 |
119 | &_huff_book_line_2048x27_0sub0,
120 | &_huff_book_line_2048x27_1sub0,
121 | &_huff_book_line_2048x27_1sub1,
122 | &_huff_book_line_2048x27_2sub0,
123 | &_huff_book_line_2048x27_2sub1,
124 | &_huff_book_line_2048x27_3sub1,
125 | &_huff_book_line_2048x27_3sub2,
126 | &_huff_book_line_2048x27_3sub3,
127 | &_huff_book_line_2048x27_4sub1,
128 | &_huff_book_line_2048x27_4sub2,
129 | &_huff_book_line_2048x27_4sub3,
130 | };
131 |
132 | static const static_codebook*const _floor_512x17_books[]={
133 | &_huff_book_line_512x17_class1,
134 | &_huff_book_line_512x17_class2,
135 | &_huff_book_line_512x17_class3,
136 |
137 | &_huff_book_line_512x17_0sub0,
138 | &_huff_book_line_512x17_1sub0,
139 | &_huff_book_line_512x17_1sub1,
140 | &_huff_book_line_512x17_2sub1,
141 | &_huff_book_line_512x17_2sub2,
142 | &_huff_book_line_512x17_2sub3,
143 | &_huff_book_line_512x17_3sub1,
144 | &_huff_book_line_512x17_3sub2,
145 | &_huff_book_line_512x17_3sub3,
146 | };
147 |
148 | static const static_codebook*const _floor_Xx0_books[]={
149 | 0
150 | };
151 |
152 | static const static_codebook*const *const _floor_books[11]={
153 | _floor_128x4_books,
154 | _floor_256x4_books,
155 | _floor_128x7_books,
156 | _floor_256x7_books,
157 | _floor_128x11_books,
158 | _floor_128x17_books,
159 | _floor_256x4low_books,
160 | _floor_1024x27_books,
161 | _floor_2048x27_books,
162 | _floor_512x17_books,
163 | _floor_Xx0_books,
164 | };
165 |
166 | static const vorbis_info_floor1 _floor[11]={
167 | /* 0: 128 x 4 */
168 | {
169 | 1,{0},{4},{2},{0},
170 | {{1,2,3,4}},
171 | 4,{0,128, 33,8,16,70},
172 |
173 | 60,30,500, 1.,18., 128
174 | },
175 | /* 1: 256 x 4 */
176 | {
177 | 1,{0},{4},{2},{0},
178 | {{1,2,3,4}},
179 | 4,{0,256, 66,16,32,140},
180 |
181 | 60,30,500, 1.,18., 256
182 | },
183 | /* 2: 128 x 7 */
184 | {
185 | 2,{0,1},{3,4},{2,2},{0,1},
186 | {{-1,2,3,4},{-1,5,6,7}},
187 | 4,{0,128, 14,4,58, 2,8,28,90},
188 |
189 | 60,30,500, 1.,18., 128
190 | },
191 | /* 3: 256 x 7 */
192 | {
193 | 2,{0,1},{3,4},{2,2},{0,1},
194 | {{-1,2,3,4},{-1,5,6,7}},
195 | 4,{0,256, 28,8,116, 4,16,56,180},
196 |
197 | 60,30,500, 1.,18., 256
198 | },
199 | /* 4: 128 x 11 */
200 | {
201 | 4,{0,1,2,3},{2,3,3,3},{0,1,2,2},{-1,0,1,2},
202 | {{3},{4,5},{-1,6,7,8},{-1,9,10,11}},
203 |
204 | 2,{0,128, 8,33, 4,16,70, 2,6,12, 23,46,90},
205 |
206 | 60,30,500, 1,18., 128
207 | },
208 | /* 5: 128 x 17 */
209 | {
210 | 6,{0,1,1,2,3,3},{2,3,3,3},{0,1,2,2},{-1,0,1,2},
211 | {{3},{4,5},{-1,6,7,8},{-1,9,10,11}},
212 | 2,{0,128, 12,46, 4,8,16, 23,33,70, 2,6,10, 14,19,28, 39,58,90},
213 |
214 | 60,30,500, 1,18., 128
215 | },
216 | /* 6: 256 x 4 (low bitrate version) */
217 | {
218 | 1,{0},{4},{2},{0},
219 | {{1,2,3,4}},
220 | 4,{0,256, 66,16,32,140},
221 |
222 | 60,30,500, 1.,18., 256
223 | },
224 | /* 7: 1024 x 27 */
225 | {
226 | 8,{0,1,2,2,3,3,4,4},{3,4,3,4,3},{0,1,1,2,2},{-1,0,1,2,3},
227 | {{4},{5,6},{7,8},{-1,9,10,11},{-1,12,13,14}},
228 | 2,{0,1024, 93,23,372, 6,46,186,750, 14,33,65, 130,260,556,
229 | 3,10,18,28, 39,55,79,111, 158,220,312, 464,650,850},
230 |
231 | 60,30,500, 3,18., 1024
232 | },
233 | /* 8: 2048 x 27 */
234 | {
235 | 8,{0,1,2,2,3,3,4,4},{3,4,3,4,3},{0,1,1,2,2},{-1,0,1,2,3},
236 | {{4},{5,6},{7,8},{-1,9,10,11},{-1,12,13,14}},
237 | 2,{0,2048, 186,46,744, 12,92,372,1500, 28,66,130, 260,520,1112,
238 | 6,20,36,56, 78,110,158,222, 316,440,624, 928,1300,1700},
239 |
240 | 60,30,500, 3,18., 2048
241 | },
242 | /* 9: 512 x 17 */
243 | {
244 | 6,{0,1,1,2,3,3},{2,3,3,3},{0,1,2,2},{-1,0,1,2},
245 | {{3},{4,5},{-1,6,7,8},{-1,9,10,11}},
246 | 2,{0,512, 46,186, 16,33,65, 93,130,278,
247 | 7,23,39, 55,79,110, 156,232,360},
248 |
249 | 60,30,500, 1,18., 512
250 | },
251 |
252 | /* 10: X x 0 (LFE floor; edge posts only) */
253 | {
254 | 0,{0}, {0},{0},{-1},
255 | {{-1}},
256 | 2,{0,12},
257 | 60,30,500, 1.,18., 10
258 | },
259 |
260 | };
261 |
--------------------------------------------------------------------------------
/jni/libvorbis/modes/psych_11.h:
--------------------------------------------------------------------------------
1 | /********************************************************************
2 | * *
3 | * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. *
4 | * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
5 | * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
6 | * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
7 | * *
8 | * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 *
9 | * by the Xiph.Org Foundation http://www.xiph.org/ *
10 | * *
11 | ********************************************************************
12 |
13 | function: 11kHz settings
14 | last mod: $Id: psych_11.h 16227 2009-07-08 06:58:46Z xiphmont $
15 |
16 | ********************************************************************/
17 |
18 | static const double _psy_lowpass_11[3]={4.5,5.5,30.,};
19 |
20 | static const att3 _psy_tone_masteratt_11[3]={
21 | {{ 30, 25, 12}, 0, 0}, /* 0 */
22 | {{ 30, 25, 12}, 0, 0}, /* 0 */
23 | {{ 20, 0, -14}, 0, 0}, /* 0 */
24 | };
25 |
26 | static const vp_adjblock _vp_tonemask_adj_11[3]={
27 | /* adjust for mode zero */
28 | /* 63 125 250 500 1 2 4 8 16 */
29 | {{-20,-20,-20,-20,-20,-16,-10, 0, 0, 0, 0,10, 2, 0,99,99,99}}, /* 0 */
30 | {{-20,-20,-20,-20,-20,-16,-10, 0, 0, 0, 0, 5, 0, 0,99,99,99}}, /* 1 */
31 | {{-20,-20,-20,-20,-20,-16,-10, 0, 0, 0, 0, 0, 0, 0,99,99,99}}, /* 2 */
32 | };
33 |
34 |
35 | static const noise3 _psy_noisebias_11[3]={
36 | /* 63 125 250 500 1k 2k 4k 8k 16k*/
37 | {{{-10,-10,-10,-10, -5, -5, -5, 0, 4, 10, 10, 12, 12, 12, 99, 99, 99},
38 | {-15,-15,-15,-15,-10,-10, -5, 0, 0, 4, 4, 5, 5, 10, 99, 99, 99},
39 | {-30,-30,-30,-30,-30,-24,-20,-14,-10, -6, -8, -8, -6, -6, 99, 99, 99}}},
40 |
41 | {{{-10,-10,-10,-10, -5, -5, -5, 0, 4, 10, 10, 12, 12, 12, 99, 99, 99},
42 | {-15,-15,-15,-15,-10,-10, -5, -5, -5, 0, 0, 0, 0, 0, 99, 99, 99},
43 | {-30,-30,-30,-30,-30,-24,-20,-14,-10, -6, -8, -8, -6, -6, 99, 99, 99}}},
44 |
45 | {{{-15,-15,-15,-15,-15,-12,-10, -8, 0, 2, 4, 4, 5, 5, 99, 99, 99},
46 | {-30,-30,-30,-30,-26,-22,-20,-14,-12,-12,-10,-10,-10,-10, 99, 99, 99},
47 | {-30,-30,-30,-30,-26,-26,-26,-26,-26,-26,-26,-26,-26,-24, 99, 99, 99}}},
48 | };
49 |
50 | static const double _noise_thresh_11[3]={ .3,.5,.5 };
51 |
52 |
--------------------------------------------------------------------------------
/jni/libvorbis/modes/psych_16.h:
--------------------------------------------------------------------------------
1 | /********************************************************************
2 | * *
3 | * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. *
4 | * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
5 | * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
6 | * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
7 | * *
8 | * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 *
9 | * by the Xiph.Org Foundation http://www.xiph.org/ *
10 | * *
11 | ********************************************************************
12 |
13 | function: 16kHz settings
14 | last mod: $Id: psych_16.h 16227 2009-07-08 06:58:46Z xiphmont $
15 |
16 | ********************************************************************/
17 |
18 | /* stereo mode by base quality level */
19 | static const adj_stereo _psy_stereo_modes_16[4]={
20 | /* 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 */
21 | {{ 4, 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3},
22 | { 6, 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4},
23 | { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 4, 4},
24 | { 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99}},
25 | {{ 4, 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3},
26 | { 6, 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4},
27 | { 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 4, 4, 4, 4, 4},
28 | { 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99}},
29 | {{ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3},
30 | { 5, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3},
31 | { 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4},
32 | { 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99}},
33 | {{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
34 | { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
35 | { 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8},
36 | { 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99}},
37 | };
38 |
39 | static const double _psy_lowpass_16[4]={6.5,8,30.,99.};
40 |
41 | static const att3 _psy_tone_masteratt_16[4]={
42 | {{ 30, 25, 12}, 0, 0}, /* 0 */
43 | {{ 25, 22, 12}, 0, 0}, /* 0 */
44 | {{ 20, 12, 0}, 0, 0}, /* 0 */
45 | {{ 15, 0, -14}, 0, 0}, /* 0 */
46 | };
47 |
48 | static const vp_adjblock _vp_tonemask_adj_16[4]={
49 | /* adjust for mode zero */
50 | /* 63 125 250 500 1 2 4 8 16 */
51 | {{-20,-20,-20,-20,-20,-16,-10, 0, 0, 0, 0,10, 0, 0, 0, 0, 0}}, /* 0 */
52 | {{-20,-20,-20,-20,-20,-16,-10, 0, 0, 0, 0,10, 0, 0, 0, 0, 0}}, /* 1 */
53 | {{-20,-20,-20,-20,-20,-16,-10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}, /* 2 */
54 | {{-30,-30,-30,-30,-30,-26,-20,-10, -5, 0, 0, 0, 0, 0, 0, 0, 0}}, /* 2 */
55 | };
56 |
57 |
58 | static const noise3 _psy_noisebias_16_short[4]={
59 | /* 63 125 250 500 1k 2k 4k 8k 16k*/
60 | {{{-15,-15,-15,-15,-15,-10,-10,-5, 4, 10, 10, 10, 10, 12, 12, 14, 20},
61 | {-15,-15,-15,-15,-15,-10,-10, -5, 0, 0, 4, 5, 5, 6, 8, 8, 15},
62 | {-30,-30,-30,-30,-30,-24,-20,-14,-10, -6, -8, -8, -6, -6, -6, -6, -6}}},
63 |
64 | {{{-15,-15,-15,-15,-15,-10,-10,-5, 4, 6, 6, 6, 6, 8, 10, 12, 20},
65 | {-15,-15,-15,-15,-15,-15,-15,-10, -5, -5, -5, 4, 5, 6, 8, 8, 15},
66 | {-30,-30,-30,-30,-30,-24,-20,-14,-10,-10,-10,-10,-10,-10,-10,-10,-10}}},
67 |
68 | {{{-15,-15,-15,-15,-15,-12,-10, -8, 0, 2, 4, 4, 5, 5, 5, 8, 12},
69 | {-20,-20,-20,-20,-16,-12,-20,-14,-10,-10, -8, 0, 0, 0, 0, 2, 5},
70 | {-30,-30,-30,-30,-26,-26,-26,-26,-26,-26,-26,-26,-26,-24,-20,-20,-20}}},
71 |
72 | {{{-15,-15,-15,-15,-15,-12,-10, -8, -5, -5, -5, -5, -5, 0, 0, 0, 6},
73 | {-30,-30,-30,-30,-26,-22,-20,-14,-12,-12,-10,-10,-10,-10,-10,-10, -6},
74 | {-30,-30,-30,-30,-26,-26,-26,-26,-26,-26,-26,-26,-26,-24,-20,-20,-20}}},
75 | };
76 |
77 | static const noise3 _psy_noisebias_16_impulse[4]={
78 | /* 63 125 250 500 1k 2k 4k 8k 16k*/
79 | {{{-15,-15,-15,-15,-15,-10,-10,-5, 4, 10, 10, 10, 10, 12, 12, 14, 20},
80 | {-15,-15,-15,-15,-15,-10,-10, -5, 0, 0, 4, 5, 5, 6, 8, 8, 15},
81 | {-30,-30,-30,-30,-30,-24,-20,-14,-10, -6, -8, -8, -6, -6, -6, -6, -6}}},
82 |
83 | {{{-15,-15,-15,-15,-15,-10,-10,-5, 4, 4, 4, 4, 5, 5, 6, 8, 15},
84 | {-15,-15,-15,-15,-15,-15,-15,-10, -5, -5, -5, 0, 0, 0, 0, 4, 10},
85 | {-30,-30,-30,-30,-30,-24,-20,-14,-10,-10,-10,-10,-10,-10,-10,-10,-10}}},
86 |
87 | {{{-15,-15,-15,-15,-15,-12,-10, -8, 0, 0, 0, 0, 0, 0, 0, 4, 10},
88 | {-20,-20,-20,-20,-16,-12,-20,-14,-10,-10,-10,-10,-10,-10,-10, -7, -5},
89 | {-30,-30,-30,-30,-26,-26,-26,-26,-26,-26,-26,-26,-26,-24,-20,-20,-20}}},
90 |
91 | {{{-15,-15,-15,-15,-15,-12,-10, -8, -5, -5, -5, -5, -5, 0, 0, 0, 6},
92 | {-30,-30,-30,-30,-26,-22,-20,-18,-18,-18,-20,-20,-20,-20,-20,-20,-16},
93 | {-30,-30,-30,-30,-26,-26,-26,-26,-26,-26,-26,-26,-26,-24,-20,-20,-20}}},
94 | };
95 |
96 | static const noise3 _psy_noisebias_16[4]={
97 | /* 63 125 250 500 1k 2k 4k 8k 16k*/
98 | {{{-10,-10,-10,-10, -5, -5, -5, 0, 4, 6, 8, 8, 10, 10, 10, 14, 20},
99 | {-10,-10,-10,-10,-10, -5, -2, -2, 0, 0, 0, 4, 5, 6, 8, 8, 15},
100 | {-30,-30,-30,-30,-30,-24,-20,-14,-10, -6, -8, -8, -6, -6, -6, -6, -6}}},
101 |
102 | {{{-10,-10,-10,-10, -5, -5, -5, 0, 4, 6, 6, 6, 6, 8, 10, 12, 20},
103 | {-15,-15,-15,-15,-15,-10, -5, -5, 0, 0, 0, 4, 5, 6, 8, 8, 15},
104 | {-30,-30,-30,-30,-30,-24,-20,-14,-10, -6, -8, -8, -6, -6, -6, -6, -6}}},
105 |
106 | {{{-15,-15,-15,-15,-15,-12,-10, -8, 0, 2, 4, 4, 5, 5, 5, 8, 12},
107 | {-20,-20,-20,-20,-16,-12,-20,-10, -5, -5, 0, 0, 0, 0, 0, 2, 5},
108 | {-30,-30,-30,-30,-26,-26,-26,-26,-26,-26,-26,-26,-26,-24,-20,-20,-20}}},
109 |
110 | {{{-15,-15,-15,-15,-15,-12,-10, -8, -5, -5, -5, -5, -5, 0, 0, 0, 6},
111 | {-30,-30,-30,-30,-26,-22,-20,-14,-12,-12,-10,-10,-10,-10,-10,-10, -6},
112 | {-30,-30,-30,-30,-26,-26,-26,-26,-26,-26,-26,-26,-26,-24,-20,-20,-20}}},
113 | };
114 |
115 | static const noiseguard _psy_noiseguards_16[4]={
116 | {10,10,-1},
117 | {10,10,-1},
118 | {20,20,-1},
119 | {20,20,-1},
120 | };
121 |
122 | static const double _noise_thresh_16[4]={ .3,.5,.5,.5 };
123 |
124 | static const int _noise_start_16[3]={ 256,256,9999 };
125 | static const int _noise_part_16[4]={ 8,8,8,8 };
126 |
127 | static const int _psy_ath_floater_16[4]={
128 | -100,-100,-100,-105,
129 | };
130 |
131 | static const int _psy_ath_abs_16[4]={
132 | -130,-130,-130,-140,
133 | };
134 |
--------------------------------------------------------------------------------
/jni/libvorbis/modes/psych_8.h:
--------------------------------------------------------------------------------
1 | /********************************************************************
2 | * *
3 | * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. *
4 | * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
5 | * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
6 | * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
7 | * *
8 | * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 *
9 | * by the Xiph.Org Foundation http://www.xiph.org/ *
10 | * *
11 | ********************************************************************
12 |
13 | function: 8kHz psychoacoustic settings
14 | last mod: $Id: psych_8.h 16227 2009-07-08 06:58:46Z xiphmont $
15 |
16 | ********************************************************************/
17 |
18 | static const att3 _psy_tone_masteratt_8[3]={
19 | {{ 32, 25, 12}, 0, 0}, /* 0 */
20 | {{ 30, 25, 12}, 0, 0}, /* 0 */
21 | {{ 20, 0, -14}, 0, 0}, /* 0 */
22 | };
23 |
24 | static const vp_adjblock _vp_tonemask_adj_8[3]={
25 | /* adjust for mode zero */
26 | /* 63 125 250 500 1 2 4 8 16 */
27 | {{-15,-15,-15,-15,-10,-10, -6, 0, 0, 0, 0,10, 0, 0,99,99,99}}, /* 1 */
28 | {{-15,-15,-15,-15,-10,-10, -6, 0, 0, 0, 0,10, 0, 0,99,99,99}}, /* 1 */
29 | {{-15,-15,-15,-15,-10,-10, -6, 0, 0, 0, 0, 0, 0, 0,99,99,99}}, /* 1 */
30 | };
31 |
32 |
33 | static const noise3 _psy_noisebias_8[3]={
34 | /* 63 125 250 500 1k 2k 4k 8k 16k*/
35 | {{{-10,-10,-10,-10, -5, -5, -5, 0, 4, 8, 8, 8, 10, 10, 99, 99, 99},
36 | {-10,-10,-10,-10, -5, -5, -5, 0, 0, 4, 4, 4, 4, 4, 99, 99, 99},
37 | {-30,-30,-30,-30,-30,-24,-20,-14,-10, -6, -8, -8, -6, -6, 99, 99, 99}}},
38 |
39 | {{{-10,-10,-10,-10, -5, -5, -5, 0, 4, 8, 8, 8, 10, 10, 99, 99, 99},
40 | {-10,-10,-10,-10,-10,-10, -5, -5, -5, 0, 0, 0, 0, 0, 99, 99, 99},
41 | {-30,-30,-30,-30,-30,-24,-20,-14,-10, -6, -8, -8, -6, -6, 99, 99, 99}}},
42 |
43 | {{{-15,-15,-15,-15,-15,-12,-10, -8, 0, 2, 4, 4, 5, 5, 99, 99, 99},
44 | {-30,-30,-30,-30,-26,-22,-20,-14,-12,-12,-10,-10,-10,-10, 99, 99, 99},
45 | {-30,-30,-30,-30,-26,-26,-26,-26,-26,-26,-26,-26,-26,-24, 99, 99, 99}}},
46 | };
47 |
48 | /* stereo mode by base quality level */
49 | static const adj_stereo _psy_stereo_modes_8[3]={
50 | /* 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 */
51 | {{ 4, 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3},
52 | { 6, 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4},
53 | { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
54 | { 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99}},
55 | {{ 4, 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3},
56 | { 6, 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4},
57 | { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
58 | { 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99}},
59 | {{ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3},
60 | { 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4},
61 | { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
62 | { 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99}},
63 | };
64 |
65 | static const noiseguard _psy_noiseguards_8[2]={
66 | {10,10,-1},
67 | {10,10,-1},
68 | };
69 |
70 | static const compandblock _psy_compand_8[2]={
71 | {{
72 | 0, 1, 2, 3, 4, 5, 6, 7, /* 7dB */
73 | 8, 8, 9, 9,10,10,11, 11, /* 15dB */
74 | 12,12,13,13,14,14,15, 15, /* 23dB */
75 | 16,16,17,17,17,18,18, 19, /* 31dB */
76 | 19,19,20,21,22,23,24, 25, /* 39dB */
77 | }},
78 | {{
79 | 0, 1, 2, 3, 4, 5, 6, 6, /* 7dB */
80 | 7, 7, 6, 6, 5, 5, 4, 4, /* 15dB */
81 | 3, 3, 3, 4, 5, 6, 7, 8, /* 23dB */
82 | 9,10,11,12,13,14,15, 16, /* 31dB */
83 | 17,18,19,20,21,22,23, 24, /* 39dB */
84 | }},
85 | };
86 |
87 | static const double _psy_lowpass_8[3]={3.,4.,4.};
88 | static const int _noise_start_8[2]={
89 | 64,64,
90 | };
91 | static const int _noise_part_8[2]={
92 | 8,8,
93 | };
94 |
95 | static const int _psy_ath_floater_8[3]={
96 | -100,-100,-105,
97 | };
98 |
99 | static const int _psy_ath_abs_8[3]={
100 | -130,-130,-140,
101 | };
102 |
--------------------------------------------------------------------------------
/jni/libvorbis/modes/residue_16.h:
--------------------------------------------------------------------------------
1 | /********************************************************************
2 | * *
3 | * This FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. *
4 | * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
5 | * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
6 | * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
7 | * *
8 | * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 *
9 | * by the Xiph.Org Foundation http://www.xiph.org/ *
10 | * *
11 | ********************************************************************
12 |
13 | function: toplevel residue templates 16/22kHz
14 | last mod: $Id: residue_16.h 16962 2010-03-11 07:30:34Z xiphmont $
15 |
16 | ********************************************************************/
17 |
18 | /***** residue backends *********************************************/
19 |
20 | static const static_bookblock _resbook_16s_0={
21 | {
22 | {0},
23 | {0,0,&_16c0_s_p1_0},
24 | {0},
25 | {0,0,&_16c0_s_p3_0},
26 | {0,0,&_16c0_s_p4_0},
27 | {0,0,&_16c0_s_p5_0},
28 | {0,0,&_16c0_s_p6_0},
29 | {&_16c0_s_p7_0,&_16c0_s_p7_1},
30 | {&_16c0_s_p8_0,&_16c0_s_p8_1},
31 | {&_16c0_s_p9_0,&_16c0_s_p9_1,&_16c0_s_p9_2}
32 | }
33 | };
34 | static const static_bookblock _resbook_16s_1={
35 | {
36 | {0},
37 | {0,0,&_16c1_s_p1_0},
38 | {0},
39 | {0,0,&_16c1_s_p3_0},
40 | {0,0,&_16c1_s_p4_0},
41 | {0,0,&_16c1_s_p5_0},
42 | {0,0,&_16c1_s_p6_0},
43 | {&_16c1_s_p7_0,&_16c1_s_p7_1},
44 | {&_16c1_s_p8_0,&_16c1_s_p8_1},
45 | {&_16c1_s_p9_0,&_16c1_s_p9_1,&_16c1_s_p9_2}
46 | }
47 | };
48 | static const static_bookblock _resbook_16s_2={
49 | {
50 | {0},
51 | {0,0,&_16c2_s_p1_0},
52 | {0,0,&_16c2_s_p2_0},
53 | {0,0,&_16c2_s_p3_0},
54 | {0,0,&_16c2_s_p4_0},
55 | {&_16c2_s_p5_0,&_16c2_s_p5_1},
56 | {&_16c2_s_p6_0,&_16c2_s_p6_1},
57 | {&_16c2_s_p7_0,&_16c2_s_p7_1},
58 | {&_16c2_s_p8_0,&_16c2_s_p8_1},
59 | {&_16c2_s_p9_0,&_16c2_s_p9_1,&_16c2_s_p9_2}
60 | }
61 | };
62 |
63 | static const vorbis_residue_template _res_16s_0[]={
64 | {2,0,32, &_residue_44_mid,
65 | &_huff_book__16c0_s_single,&_huff_book__16c0_s_single,
66 | &_resbook_16s_0,&_resbook_16s_0},
67 | };
68 | static const vorbis_residue_template _res_16s_1[]={
69 | {2,0,32, &_residue_44_mid,
70 | &_huff_book__16c1_s_short,&_huff_book__16c1_s_short,
71 | &_resbook_16s_1,&_resbook_16s_1},
72 |
73 | {2,0,32, &_residue_44_mid,
74 | &_huff_book__16c1_s_long,&_huff_book__16c1_s_long,
75 | &_resbook_16s_1,&_resbook_16s_1}
76 | };
77 | static const vorbis_residue_template _res_16s_2[]={
78 | {2,0,32, &_residue_44_high,
79 | &_huff_book__16c2_s_short,&_huff_book__16c2_s_short,
80 | &_resbook_16s_2,&_resbook_16s_2},
81 |
82 | {2,0,32, &_residue_44_high,
83 | &_huff_book__16c2_s_long,&_huff_book__16c2_s_long,
84 | &_resbook_16s_2,&_resbook_16s_2}
85 | };
86 |
87 | static const vorbis_mapping_template _mapres_template_16_stereo[3]={
88 | { _map_nominal, _res_16s_0 }, /* 0 */
89 | { _map_nominal, _res_16s_1 }, /* 1 */
90 | { _map_nominal, _res_16s_2 }, /* 2 */
91 | };
92 |
93 | static const static_bookblock _resbook_16u_0={
94 | {
95 | {0},
96 | {0,0,&_16u0__p1_0},
97 | {0,0,&_16u0__p2_0},
98 | {0,0,&_16u0__p3_0},
99 | {0,0,&_16u0__p4_0},
100 | {0,0,&_16u0__p5_0},
101 | {&_16u0__p6_0,&_16u0__p6_1},
102 | {&_16u0__p7_0,&_16u0__p7_1,&_16u0__p7_2}
103 | }
104 | };
105 | static const static_bookblock _resbook_16u_1={
106 | {
107 | {0},
108 | {0,0,&_16u1__p1_0},
109 | {0,0,&_16u1__p2_0},
110 | {0,0,&_16u1__p3_0},
111 | {0,0,&_16u1__p4_0},
112 | {0,0,&_16u1__p5_0},
113 | {0,0,&_16u1__p6_0},
114 | {&_16u1__p7_0,&_16u1__p7_1},
115 | {&_16u1__p8_0,&_16u1__p8_1},
116 | {&_16u1__p9_0,&_16u1__p9_1,&_16u1__p9_2}
117 | }
118 | };
119 | static const static_bookblock _resbook_16u_2={
120 | {
121 | {0},
122 | {0,0,&_16u2_p1_0},
123 | {0,0,&_16u2_p2_0},
124 | {0,0,&_16u2_p3_0},
125 | {0,0,&_16u2_p4_0},
126 | {&_16u2_p5_0,&_16u2_p5_1},
127 | {&_16u2_p6_0,&_16u2_p6_1},
128 | {&_16u2_p7_0,&_16u2_p7_1},
129 | {&_16u2_p8_0,&_16u2_p8_1},
130 | {&_16u2_p9_0,&_16u2_p9_1,&_16u2_p9_2}
131 | }
132 | };
133 |
134 | static const vorbis_residue_template _res_16u_0[]={
135 | {1,0,32, &_residue_44_low_un,
136 | &_huff_book__16u0__single,&_huff_book__16u0__single,
137 | &_resbook_16u_0,&_resbook_16u_0},
138 | };
139 | static const vorbis_residue_template _res_16u_1[]={
140 | {1,0,32, &_residue_44_mid_un,
141 | &_huff_book__16u1__short,&_huff_book__16u1__short,
142 | &_resbook_16u_1,&_resbook_16u_1},
143 |
144 | {1,0,32, &_residue_44_mid_un,
145 | &_huff_book__16u1__long,&_huff_book__16u1__long,
146 | &_resbook_16u_1,&_resbook_16u_1}
147 | };
148 | static const vorbis_residue_template _res_16u_2[]={
149 | {1,0,32, &_residue_44_hi_un,
150 | &_huff_book__16u2__short,&_huff_book__16u2__short,
151 | &_resbook_16u_2,&_resbook_16u_2},
152 |
153 | {1,0,32, &_residue_44_hi_un,
154 | &_huff_book__16u2__long,&_huff_book__16u2__long,
155 | &_resbook_16u_2,&_resbook_16u_2}
156 | };
157 |
158 |
159 | static const vorbis_mapping_template _mapres_template_16_uncoupled[3]={
160 | { _map_nominal_u, _res_16u_0 }, /* 0 */
161 | { _map_nominal_u, _res_16u_1 }, /* 1 */
162 | { _map_nominal_u, _res_16u_2 }, /* 2 */
163 | };
164 |
--------------------------------------------------------------------------------
/jni/libvorbis/modes/residue_8.h:
--------------------------------------------------------------------------------
1 | /********************************************************************
2 | * *
3 | * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. *
4 | * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
5 | * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
6 | * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
7 | * *
8 | * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007 *
9 | * by the Xiph.Org Foundation http://www.xiph.org/ *
10 | * *
11 | ********************************************************************
12 |
13 | function: toplevel residue templates 8/11kHz
14 | last mod: $Id: residue_8.h 16962 2010-03-11 07:30:34Z xiphmont $
15 |
16 | ********************************************************************/
17 |
18 | #include "vorbis/codec.h"
19 | #include "backends.h"
20 |
21 | /***** residue backends *********************************************/
22 |
23 | static const static_bookblock _resbook_8s_0={
24 | {
25 | {0},
26 | {0,0,&_8c0_s_p1_0},
27 | {0},
28 | {0,0,&_8c0_s_p3_0},
29 | {0,0,&_8c0_s_p4_0},
30 | {0,0,&_8c0_s_p5_0},
31 | {0,0,&_8c0_s_p6_0},
32 | {&_8c0_s_p7_0,&_8c0_s_p7_1},
33 | {&_8c0_s_p8_0,&_8c0_s_p8_1},
34 | {&_8c0_s_p9_0,&_8c0_s_p9_1,&_8c0_s_p9_2}
35 | }
36 | };
37 | static const static_bookblock _resbook_8s_1={
38 | {
39 | {0},
40 | {0,0,&_8c1_s_p1_0},
41 | {0},
42 | {0,0,&_8c1_s_p3_0},
43 | {0,0,&_8c1_s_p4_0},
44 | {0,0,&_8c1_s_p5_0},
45 | {0,0,&_8c1_s_p6_0},
46 | {&_8c1_s_p7_0,&_8c1_s_p7_1},
47 | {&_8c1_s_p8_0,&_8c1_s_p8_1},
48 | {&_8c1_s_p9_0,&_8c1_s_p9_1,&_8c1_s_p9_2}
49 | }
50 | };
51 |
52 | static const vorbis_residue_template _res_8s_0[]={
53 | {2,0,32, &_residue_44_mid,
54 | &_huff_book__8c0_s_single,&_huff_book__8c0_s_single,
55 | &_resbook_8s_0,&_resbook_8s_0},
56 | };
57 | static const vorbis_residue_template _res_8s_1[]={
58 | {2,0,32, &_residue_44_mid,
59 | &_huff_book__8c1_s_single,&_huff_book__8c1_s_single,
60 | &_resbook_8s_1,&_resbook_8s_1},
61 | };
62 |
63 | static const vorbis_mapping_template _mapres_template_8_stereo[2]={
64 | { _map_nominal, _res_8s_0 }, /* 0 */
65 | { _map_nominal, _res_8s_1 }, /* 1 */
66 | };
67 |
68 | static const static_bookblock _resbook_8u_0={
69 | {
70 | {0},
71 | {0,0,&_8u0__p1_0},
72 | {0,0,&_8u0__p2_0},
73 | {0,0,&_8u0__p3_0},
74 | {0,0,&_8u0__p4_0},
75 | {0,0,&_8u0__p5_0},
76 | {&_8u0__p6_0,&_8u0__p6_1},
77 | {&_8u0__p7_0,&_8u0__p7_1,&_8u0__p7_2}
78 | }
79 | };
80 | static const static_bookblock _resbook_8u_1={
81 | {
82 | {0},
83 | {0,0,&_8u1__p1_0},
84 | {0,0,&_8u1__p2_0},
85 | {0,0,&_8u1__p3_0},
86 | {0,0,&_8u1__p4_0},
87 | {0,0,&_8u1__p5_0},
88 | {0,0,&_8u1__p6_0},
89 | {&_8u1__p7_0,&_8u1__p7_1},
90 | {&_8u1__p8_0,&_8u1__p8_1},
91 | {&_8u1__p9_0,&_8u1__p9_1,&_8u1__p9_2}
92 | }
93 | };
94 |
95 | static const vorbis_residue_template _res_8u_0[]={
96 | {1,0,32, &_residue_44_low_un,
97 | &_huff_book__8u0__single,&_huff_book__8u0__single,
98 | &_resbook_8u_0,&_resbook_8u_0},
99 | };
100 | static const vorbis_residue_template _res_8u_1[]={
101 | {1,0,32, &_residue_44_mid_un,
102 | &_huff_book__8u1__single,&_huff_book__8u1__single,
103 | &_resbook_8u_1,&_resbook_8u_1},
104 | };
105 |
106 | static const vorbis_mapping_template _mapres_template_8_uncoupled[2]={
107 | { _map_nominal_u, _res_8u_0 }, /* 0 */
108 | { _map_nominal_u, _res_8u_1 }, /* 1 */
109 | };
110 |
--------------------------------------------------------------------------------
/jni/libvorbis/modes/setup_11.h:
--------------------------------------------------------------------------------
1 | /********************************************************************
2 | * *
3 | * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. *
4 | * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
5 | * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
6 | * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
7 | * *
8 | * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 *
9 | * by the Xiph.Org Foundation http://www.xiph.org/ *
10 | * *
11 | ********************************************************************
12 |
13 | function: 11kHz settings
14 | last mod: $Id: setup_11.h 16894 2010-02-12 20:32:12Z xiphmont $
15 |
16 | ********************************************************************/
17 |
18 | #include "psych_11.h"
19 |
20 | static const int blocksize_11[2]={
21 | 512,512
22 | };
23 |
24 | static const int _floor_mapping_11a[]={
25 | 6,6
26 | };
27 | static const int *_floor_mapping_11[]={
28 | _floor_mapping_11a
29 | };
30 |
31 | static const double rate_mapping_11[3]={
32 | 8000.,13000.,44000.,
33 | };
34 |
35 | static const double rate_mapping_11_uncoupled[3]={
36 | 12000.,20000.,50000.,
37 | };
38 |
39 | static const double quality_mapping_11[3]={
40 | -.1,.0,1.
41 | };
42 |
43 | static const ve_setup_data_template ve_setup_11_stereo={
44 | 2,
45 | rate_mapping_11,
46 | quality_mapping_11,
47 | 2,
48 | 9000,
49 | 15000,
50 |
51 | blocksize_11,
52 | blocksize_11,
53 |
54 | _psy_tone_masteratt_11,
55 | _psy_tone_0dB,
56 | _psy_tone_suppress,
57 |
58 | _vp_tonemask_adj_11,
59 | NULL,
60 | _vp_tonemask_adj_11,
61 |
62 | _psy_noiseguards_8,
63 | _psy_noisebias_11,
64 | _psy_noisebias_11,
65 | NULL,
66 | NULL,
67 | _psy_noise_suppress,
68 |
69 | _psy_compand_8,
70 | _psy_compand_8_mapping,
71 | NULL,
72 |
73 | {_noise_start_8,_noise_start_8},
74 | {_noise_part_8,_noise_part_8},
75 | _noise_thresh_11,
76 |
77 | _psy_ath_floater_8,
78 | _psy_ath_abs_8,
79 |
80 | _psy_lowpass_11,
81 |
82 | _psy_global_44,
83 | _global_mapping_8,
84 | _psy_stereo_modes_8,
85 |
86 | _floor_books,
87 | _floor,
88 | 1,
89 | _floor_mapping_11,
90 |
91 | _mapres_template_8_stereo
92 | };
93 |
94 | static const ve_setup_data_template ve_setup_11_uncoupled={
95 | 2,
96 | rate_mapping_11_uncoupled,
97 | quality_mapping_11,
98 | -1,
99 | 9000,
100 | 15000,
101 |
102 | blocksize_11,
103 | blocksize_11,
104 |
105 | _psy_tone_masteratt_11,
106 | _psy_tone_0dB,
107 | _psy_tone_suppress,
108 |
109 | _vp_tonemask_adj_11,
110 | NULL,
111 | _vp_tonemask_adj_11,
112 |
113 | _psy_noiseguards_8,
114 | _psy_noisebias_11,
115 | _psy_noisebias_11,
116 | NULL,
117 | NULL,
118 | _psy_noise_suppress,
119 |
120 | _psy_compand_8,
121 | _psy_compand_8_mapping,
122 | NULL,
123 |
124 | {_noise_start_8,_noise_start_8},
125 | {_noise_part_8,_noise_part_8},
126 | _noise_thresh_11,
127 |
128 | _psy_ath_floater_8,
129 | _psy_ath_abs_8,
130 |
131 | _psy_lowpass_11,
132 |
133 | _psy_global_44,
134 | _global_mapping_8,
135 | _psy_stereo_modes_8,
136 |
137 | _floor_books,
138 | _floor,
139 | 1,
140 | _floor_mapping_11,
141 |
142 | _mapres_template_8_uncoupled
143 | };
144 |
--------------------------------------------------------------------------------
/jni/libvorbis/modes/setup_16.h:
--------------------------------------------------------------------------------
1 | /********************************************************************
2 | * *
3 | * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. *
4 | * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
5 | * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
6 | * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
7 | * *
8 | * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 *
9 | * by the Xiph.Org Foundation http://www.xiph.org/ *
10 | * *
11 | ********************************************************************
12 |
13 | function: 16kHz settings
14 | last mod: $Id: setup_16.h 16894 2010-02-12 20:32:12Z xiphmont $
15 |
16 | ********************************************************************/
17 |
18 | #include "psych_16.h"
19 | #include "residue_16.h"
20 |
21 | static const int blocksize_16_short[3]={
22 | 1024,512,512
23 | };
24 | static const int blocksize_16_long[3]={
25 | 1024,1024,1024
26 | };
27 |
28 | static const int _floor_mapping_16a[]={
29 | 9,3,3
30 | };
31 | static const int _floor_mapping_16b[]={
32 | 9,9,9
33 | };
34 | static const int *_floor_mapping_16[]={
35 | _floor_mapping_16a,
36 | _floor_mapping_16b
37 | };
38 |
39 | static const double rate_mapping_16[4]={
40 | 12000.,20000.,44000.,86000.
41 | };
42 |
43 | static const double rate_mapping_16_uncoupled[4]={
44 | 16000.,28000.,64000.,100000.
45 | };
46 |
47 | static const double _global_mapping_16[4]={ 1., 2., 3., 4. };
48 |
49 | static const double quality_mapping_16[4]={ -.1,.05,.5,1. };
50 |
51 | static const double _psy_compand_16_mapping[4]={ 0., .8, 1., 1.};
52 |
53 | static const ve_setup_data_template ve_setup_16_stereo={
54 | 3,
55 | rate_mapping_16,
56 | quality_mapping_16,
57 | 2,
58 | 15000,
59 | 19000,
60 |
61 | blocksize_16_short,
62 | blocksize_16_long,
63 |
64 | _psy_tone_masteratt_16,
65 | _psy_tone_0dB,
66 | _psy_tone_suppress,
67 |
68 | _vp_tonemask_adj_16,
69 | _vp_tonemask_adj_16,
70 | _vp_tonemask_adj_16,
71 |
72 | _psy_noiseguards_16,
73 | _psy_noisebias_16_impulse,
74 | _psy_noisebias_16_short,
75 | _psy_noisebias_16_short,
76 | _psy_noisebias_16,
77 | _psy_noise_suppress,
78 |
79 | _psy_compand_8,
80 | _psy_compand_16_mapping,
81 | _psy_compand_16_mapping,
82 |
83 | {_noise_start_16,_noise_start_16},
84 | { _noise_part_16, _noise_part_16},
85 | _noise_thresh_16,
86 |
87 | _psy_ath_floater_16,
88 | _psy_ath_abs_16,
89 |
90 | _psy_lowpass_16,
91 |
92 | _psy_global_44,
93 | _global_mapping_16,
94 | _psy_stereo_modes_16,
95 |
96 | _floor_books,
97 | _floor,
98 | 2,
99 | _floor_mapping_16,
100 |
101 | _mapres_template_16_stereo
102 | };
103 |
104 | static const ve_setup_data_template ve_setup_16_uncoupled={
105 | 3,
106 | rate_mapping_16_uncoupled,
107 | quality_mapping_16,
108 | -1,
109 | 15000,
110 | 19000,
111 |
112 | blocksize_16_short,
113 | blocksize_16_long,
114 |
115 | _psy_tone_masteratt_16,
116 | _psy_tone_0dB,
117 | _psy_tone_suppress,
118 |
119 | _vp_tonemask_adj_16,
120 | _vp_tonemask_adj_16,
121 | _vp_tonemask_adj_16,
122 |
123 | _psy_noiseguards_16,
124 | _psy_noisebias_16_impulse,
125 | _psy_noisebias_16_short,
126 | _psy_noisebias_16_short,
127 | _psy_noisebias_16,
128 | _psy_noise_suppress,
129 |
130 | _psy_compand_8,
131 | _psy_compand_16_mapping,
132 | _psy_compand_16_mapping,
133 |
134 | {_noise_start_16,_noise_start_16},
135 | { _noise_part_16, _noise_part_16},
136 | _noise_thresh_16,
137 |
138 | _psy_ath_floater_16,
139 | _psy_ath_abs_16,
140 |
141 | _psy_lowpass_16,
142 |
143 | _psy_global_44,
144 | _global_mapping_16,
145 | _psy_stereo_modes_16,
146 |
147 | _floor_books,
148 | _floor,
149 | 2,
150 | _floor_mapping_16,
151 |
152 | _mapres_template_16_uncoupled
153 | };
154 |
--------------------------------------------------------------------------------
/jni/libvorbis/modes/setup_22.h:
--------------------------------------------------------------------------------
1 | /********************************************************************
2 | * *
3 | * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. *
4 | * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
5 | * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
6 | * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
7 | * *
8 | * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 *
9 | * by the Xiph.Org Foundation http://www.xiph.org/ *
10 | * *
11 | ********************************************************************
12 |
13 | function: 22kHz settings
14 | last mod: $Id: setup_22.h 17026 2010-03-25 05:00:27Z xiphmont $
15 |
16 | ********************************************************************/
17 |
18 | static const double rate_mapping_22[4]={
19 | 15000.,20000.,44000.,86000.
20 | };
21 |
22 | static const double rate_mapping_22_uncoupled[4]={
23 | 16000.,28000.,50000.,90000.
24 | };
25 |
26 | static const double _psy_lowpass_22[4]={9.5,11.,30.,99.};
27 |
28 | static const ve_setup_data_template ve_setup_22_stereo={
29 | 3,
30 | rate_mapping_22,
31 | quality_mapping_16,
32 | 2,
33 | 19000,
34 | 26000,
35 |
36 | blocksize_16_short,
37 | blocksize_16_long,
38 |
39 | _psy_tone_masteratt_16,
40 | _psy_tone_0dB,
41 | _psy_tone_suppress,
42 |
43 | _vp_tonemask_adj_16,
44 | _vp_tonemask_adj_16,
45 | _vp_tonemask_adj_16,
46 |
47 | _psy_noiseguards_16,
48 | _psy_noisebias_16_impulse,
49 | _psy_noisebias_16_short,
50 | _psy_noisebias_16_short,
51 | _psy_noisebias_16,
52 | _psy_noise_suppress,
53 |
54 | _psy_compand_8,
55 | _psy_compand_16_mapping,
56 | _psy_compand_16_mapping,
57 |
58 | {_noise_start_16,_noise_start_16},
59 | { _noise_part_16, _noise_part_16},
60 | _noise_thresh_16,
61 |
62 | _psy_ath_floater_16,
63 | _psy_ath_abs_16,
64 |
65 | _psy_lowpass_22,
66 |
67 | _psy_global_44,
68 | _global_mapping_16,
69 | _psy_stereo_modes_16,
70 |
71 | _floor_books,
72 | _floor,
73 | 2,
74 | _floor_mapping_16,
75 |
76 | _mapres_template_16_stereo
77 | };
78 |
79 | static const ve_setup_data_template ve_setup_22_uncoupled={
80 | 3,
81 | rate_mapping_22_uncoupled,
82 | quality_mapping_16,
83 | -1,
84 | 19000,
85 | 26000,
86 |
87 | blocksize_16_short,
88 | blocksize_16_long,
89 |
90 | _psy_tone_masteratt_16,
91 | _psy_tone_0dB,
92 | _psy_tone_suppress,
93 |
94 | _vp_tonemask_adj_16,
95 | _vp_tonemask_adj_16,
96 | _vp_tonemask_adj_16,
97 |
98 | _psy_noiseguards_16,
99 | _psy_noisebias_16_impulse,
100 | _psy_noisebias_16_short,
101 | _psy_noisebias_16_short,
102 | _psy_noisebias_16,
103 | _psy_noise_suppress,
104 |
105 | _psy_compand_8,
106 | _psy_compand_16_mapping,
107 | _psy_compand_16_mapping,
108 |
109 | {_noise_start_16,_noise_start_16},
110 | { _noise_part_16, _noise_part_16},
111 | _noise_thresh_16,
112 |
113 | _psy_ath_floater_16,
114 | _psy_ath_abs_16,
115 |
116 | _psy_lowpass_22,
117 |
118 | _psy_global_44,
119 | _global_mapping_16,
120 | _psy_stereo_modes_16,
121 |
122 | _floor_books,
123 | _floor,
124 | 2,
125 | _floor_mapping_16,
126 |
127 | _mapres_template_16_uncoupled
128 | };
129 |
--------------------------------------------------------------------------------
/jni/libvorbis/modes/setup_32.h:
--------------------------------------------------------------------------------
1 | /********************************************************************
2 | * *
3 | * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. *
4 | * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
5 | * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
6 | * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
7 | * *
8 | * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 *
9 | * by the Xiph.Org Foundation http://www.xiph.org/ *
10 | * *
11 | ********************************************************************
12 |
13 | function: toplevel settings for 32kHz
14 | last mod: $Id: setup_32.h 16894 2010-02-12 20:32:12Z xiphmont $
15 |
16 | ********************************************************************/
17 |
18 | static const double rate_mapping_32[12]={
19 | 18000.,28000.,35000.,45000.,56000.,60000.,
20 | 75000.,90000.,100000.,115000.,150000.,190000.,
21 | };
22 |
23 | static const double rate_mapping_32_un[12]={
24 | 30000.,42000.,52000.,64000.,72000.,78000.,
25 | 86000.,92000.,110000.,120000.,140000.,190000.,
26 | };
27 |
28 | static const double _psy_lowpass_32[12]={
29 | 12.3,13.,13.,14.,15.,99.,99.,99.,99.,99.,99.,99.
30 | };
31 |
32 | static const ve_setup_data_template ve_setup_32_stereo={
33 | 11,
34 | rate_mapping_32,
35 | quality_mapping_44,
36 | 2,
37 | 26000,
38 | 40000,
39 |
40 | blocksize_short_44,
41 | blocksize_long_44,
42 |
43 | _psy_tone_masteratt_44,
44 | _psy_tone_0dB,
45 | _psy_tone_suppress,
46 |
47 | _vp_tonemask_adj_otherblock,
48 | _vp_tonemask_adj_longblock,
49 | _vp_tonemask_adj_otherblock,
50 |
51 | _psy_noiseguards_44,
52 | _psy_noisebias_impulse,
53 | _psy_noisebias_padding,
54 | _psy_noisebias_trans,
55 | _psy_noisebias_long,
56 | _psy_noise_suppress,
57 |
58 | _psy_compand_44,
59 | _psy_compand_short_mapping,
60 | _psy_compand_long_mapping,
61 |
62 | {_noise_start_short_44,_noise_start_long_44},
63 | {_noise_part_short_44,_noise_part_long_44},
64 | _noise_thresh_44,
65 |
66 | _psy_ath_floater,
67 | _psy_ath_abs,
68 |
69 | _psy_lowpass_32,
70 |
71 | _psy_global_44,
72 | _global_mapping_44,
73 | _psy_stereo_modes_44,
74 |
75 | _floor_books,
76 | _floor,
77 | 2,
78 | _floor_mapping_44,
79 |
80 | _mapres_template_44_stereo
81 | };
82 |
83 | static const ve_setup_data_template ve_setup_32_uncoupled={
84 | 11,
85 | rate_mapping_32_un,
86 | quality_mapping_44,
87 | -1,
88 | 26000,
89 | 40000,
90 |
91 | blocksize_short_44,
92 | blocksize_long_44,
93 |
94 | _psy_tone_masteratt_44,
95 | _psy_tone_0dB,
96 | _psy_tone_suppress,
97 |
98 | _vp_tonemask_adj_otherblock,
99 | _vp_tonemask_adj_longblock,
100 | _vp_tonemask_adj_otherblock,
101 |
102 | _psy_noiseguards_44,
103 | _psy_noisebias_impulse,
104 | _psy_noisebias_padding,
105 | _psy_noisebias_trans,
106 | _psy_noisebias_long,
107 | _psy_noise_suppress,
108 |
109 | _psy_compand_44,
110 | _psy_compand_short_mapping,
111 | _psy_compand_long_mapping,
112 |
113 | {_noise_start_short_44,_noise_start_long_44},
114 | {_noise_part_short_44,_noise_part_long_44},
115 | _noise_thresh_44,
116 |
117 | _psy_ath_floater,
118 | _psy_ath_abs,
119 |
120 | _psy_lowpass_32,
121 |
122 | _psy_global_44,
123 | _global_mapping_44,
124 | NULL,
125 |
126 | _floor_books,
127 | _floor,
128 | 2,
129 | _floor_mapping_44,
130 |
131 | _mapres_template_44_uncoupled
132 | };
133 |
--------------------------------------------------------------------------------
/jni/libvorbis/modes/setup_44.h:
--------------------------------------------------------------------------------
1 | /********************************************************************
2 | * *
3 | * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. *
4 | * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
5 | * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
6 | * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
7 | * *
8 | * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 *
9 | * by the Xiph.Org Foundation http://www.xiph.org/ *
10 | * *
11 | ********************************************************************
12 |
13 | function: toplevel settings for 44.1/48kHz
14 | last mod: $Id: setup_44.h 16962 2010-03-11 07:30:34Z xiphmont $
15 |
16 | ********************************************************************/
17 |
18 | #include "modes/floor_all.h"
19 | #include "modes/residue_44.h"
20 | #include "modes/psych_44.h"
21 |
22 | static const double rate_mapping_44_stereo[12]={
23 | 22500.,32000.,40000.,48000.,56000.,64000.,
24 | 80000.,96000.,112000.,128000.,160000.,250001.
25 | };
26 |
27 | static const double quality_mapping_44[12]={
28 | -.1,.0,.1,.2,.3,.4,.5,.6,.7,.8,.9,1.0
29 | };
30 |
31 | static const int blocksize_short_44[11]={
32 | 512,256,256,256,256,256,256,256,256,256,256
33 | };
34 | static const int blocksize_long_44[11]={
35 | 4096,2048,2048,2048,2048,2048,2048,2048,2048,2048,2048
36 | };
37 |
38 | static const double _psy_compand_short_mapping[12]={
39 | 0.5, 1., 1., 1.3, 1.6, 2., 2., 2., 2., 2., 2., 2.
40 | };
41 | static const double _psy_compand_long_mapping[12]={
42 | 3.5, 4., 4., 4.3, 4.6, 5., 5., 5., 5., 5., 5., 5.
43 | };
44 |
45 | static const double _global_mapping_44[12]={
46 | /* 1., 1., 1.5, 2., 2., 2.5, 2.7, 3.0, 3.5, 4., 4. */
47 | 0., 1., 1., 1.5, 2., 2., 2.5, 2.7, 3.0, 3.7, 4., 4.
48 | };
49 |
50 | static const int _floor_mapping_44a[11]={
51 | 1,0,0,2,2,4,5,5,5,5,5
52 | };
53 |
54 | static const int _floor_mapping_44b[11]={
55 | 8,7,7,7,7,7,7,7,7,7,7
56 | };
57 |
58 | static const int _floor_mapping_44c[11]={
59 | 10,10,10,10,10,10,10,10,10,10,10
60 | };
61 |
62 | static const int *_floor_mapping_44[]={
63 | _floor_mapping_44a,
64 | _floor_mapping_44b,
65 | _floor_mapping_44c,
66 | };
67 |
68 | static const ve_setup_data_template ve_setup_44_stereo={
69 | 11,
70 | rate_mapping_44_stereo,
71 | quality_mapping_44,
72 | 2,
73 | 40000,
74 | 50000,
75 |
76 | blocksize_short_44,
77 | blocksize_long_44,
78 |
79 | _psy_tone_masteratt_44,
80 | _psy_tone_0dB,
81 | _psy_tone_suppress,
82 |
83 | _vp_tonemask_adj_otherblock,
84 | _vp_tonemask_adj_longblock,
85 | _vp_tonemask_adj_otherblock,
86 |
87 | _psy_noiseguards_44,
88 | _psy_noisebias_impulse,
89 | _psy_noisebias_padding,
90 | _psy_noisebias_trans,
91 | _psy_noisebias_long,
92 | _psy_noise_suppress,
93 |
94 | _psy_compand_44,
95 | _psy_compand_short_mapping,
96 | _psy_compand_long_mapping,
97 |
98 | {_noise_start_short_44,_noise_start_long_44},
99 | {_noise_part_short_44,_noise_part_long_44},
100 | _noise_thresh_44,
101 |
102 | _psy_ath_floater,
103 | _psy_ath_abs,
104 |
105 | _psy_lowpass_44,
106 |
107 | _psy_global_44,
108 | _global_mapping_44,
109 | _psy_stereo_modes_44,
110 |
111 | _floor_books,
112 | _floor,
113 | 2,
114 | _floor_mapping_44,
115 |
116 | _mapres_template_44_stereo
117 | };
118 |
--------------------------------------------------------------------------------
/jni/libvorbis/modes/setup_44p51.h:
--------------------------------------------------------------------------------
1 | /********************************************************************
2 | * *
3 | * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. *
4 | * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
5 | * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
6 | * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
7 | * *
8 | * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2010 *
9 | * by the Xiph.Org Foundation http://www.xiph.org/ *
10 | * *
11 | ********************************************************************
12 |
13 | function: toplevel settings for 44.1/48kHz 5.1 surround modes
14 | last mod: $Id$
15 |
16 | ********************************************************************/
17 |
18 | #include "modes/residue_44p51.h"
19 |
20 | static const double rate_mapping_44p51[12]={
21 | 14000.,20000.,28000.,38000.,46000.,54000.,
22 | 75000.,96000.,120000.,140000.,180000.,240001.
23 | };
24 |
25 | static const ve_setup_data_template ve_setup_44_51={
26 | 11,
27 | rate_mapping_44p51,
28 | quality_mapping_44,
29 | 6,
30 | 40000,
31 | 70000,
32 |
33 | blocksize_short_44,
34 | blocksize_long_44,
35 |
36 | _psy_tone_masteratt_44,
37 | _psy_tone_0dB,
38 | _psy_tone_suppress,
39 |
40 | _vp_tonemask_adj_otherblock,
41 | _vp_tonemask_adj_longblock,
42 | _vp_tonemask_adj_otherblock,
43 |
44 | _psy_noiseguards_44,
45 | _psy_noisebias_impulse,
46 | _psy_noisebias_padding,
47 | _psy_noisebias_trans,
48 | _psy_noisebias_long,
49 | _psy_noise_suppress,
50 |
51 | _psy_compand_44,
52 | _psy_compand_short_mapping,
53 | _psy_compand_long_mapping,
54 |
55 | {_noise_start_short_44,_noise_start_long_44},
56 | {_noise_part_short_44,_noise_part_long_44},
57 | _noise_thresh_44,
58 |
59 | _psy_ath_floater,
60 | _psy_ath_abs,
61 |
62 | _psy_lowpass_44,
63 |
64 | _psy_global_44,
65 | _global_mapping_44,
66 | _psy_stereo_modes_44,
67 |
68 | _floor_books,
69 | _floor,
70 | 3,
71 | _floor_mapping_44,
72 |
73 | _mapres_template_44_51
74 | };
75 |
--------------------------------------------------------------------------------
/jni/libvorbis/modes/setup_44u.h:
--------------------------------------------------------------------------------
1 | /********************************************************************
2 | * *
3 | * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. *
4 | * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
5 | * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
6 | * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
7 | * *
8 | * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 *
9 | * by the Xiph.Org Foundation http://www.xiph.org/ *
10 | * *
11 | ********************************************************************
12 |
13 | function: toplevel settings for 44.1/48kHz uncoupled modes
14 | last mod: $Id: setup_44u.h 16962 2010-03-11 07:30:34Z xiphmont $
15 |
16 | ********************************************************************/
17 |
18 | #include "modes/residue_44u.h"
19 |
20 | static const double rate_mapping_44_un[12]={
21 | 32000.,48000.,60000.,70000.,80000.,86000.,
22 | 96000.,110000.,120000.,140000.,160000.,240001.
23 | };
24 |
25 | static const ve_setup_data_template ve_setup_44_uncoupled={
26 | 11,
27 | rate_mapping_44_un,
28 | quality_mapping_44,
29 | -1,
30 | 40000,
31 | 50000,
32 |
33 | blocksize_short_44,
34 | blocksize_long_44,
35 |
36 | _psy_tone_masteratt_44,
37 | _psy_tone_0dB,
38 | _psy_tone_suppress,
39 |
40 | _vp_tonemask_adj_otherblock,
41 | _vp_tonemask_adj_longblock,
42 | _vp_tonemask_adj_otherblock,
43 |
44 | _psy_noiseguards_44,
45 | _psy_noisebias_impulse,
46 | _psy_noisebias_padding,
47 | _psy_noisebias_trans,
48 | _psy_noisebias_long,
49 | _psy_noise_suppress,
50 |
51 | _psy_compand_44,
52 | _psy_compand_short_mapping,
53 | _psy_compand_long_mapping,
54 |
55 | {_noise_start_short_44,_noise_start_long_44},
56 | {_noise_part_short_44,_noise_part_long_44},
57 | _noise_thresh_44,
58 |
59 | _psy_ath_floater,
60 | _psy_ath_abs,
61 |
62 | _psy_lowpass_44,
63 |
64 | _psy_global_44,
65 | _global_mapping_44,
66 | _psy_stereo_modes_44,
67 |
68 | _floor_books,
69 | _floor,
70 | 2,
71 | _floor_mapping_44,
72 |
73 | _mapres_template_44_uncoupled
74 | };
75 |
--------------------------------------------------------------------------------
/jni/libvorbis/modes/setup_8.h:
--------------------------------------------------------------------------------
1 | /********************************************************************
2 | * *
3 | * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. *
4 | * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
5 | * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
6 | * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
7 | * *
8 | * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 *
9 | * by the Xiph.Org Foundation http://www.xiph.org/ *
10 | * *
11 | ********************************************************************
12 |
13 | function: 8kHz settings
14 | last mod: $Id: setup_8.h 16894 2010-02-12 20:32:12Z xiphmont $
15 |
16 | ********************************************************************/
17 |
18 | #include "psych_8.h"
19 | #include "residue_8.h"
20 |
21 | static const int blocksize_8[2]={
22 | 512,512
23 | };
24 |
25 | static const int _floor_mapping_8a[]={
26 | 6,6
27 | };
28 |
29 | static const int *_floor_mapping_8[]={
30 | _floor_mapping_8a
31 | };
32 |
33 | static const double rate_mapping_8[3]={
34 | 6000.,9000.,32000.,
35 | };
36 |
37 | static const double rate_mapping_8_uncoupled[3]={
38 | 8000.,14000.,42000.,
39 | };
40 |
41 | static const double quality_mapping_8[3]={
42 | -.1,.0,1.
43 | };
44 |
45 | static const double _psy_compand_8_mapping[3]={ 0., 1., 1.};
46 |
47 | static const double _global_mapping_8[3]={ 1., 2., 3. };
48 |
49 | static const ve_setup_data_template ve_setup_8_stereo={
50 | 2,
51 | rate_mapping_8,
52 | quality_mapping_8,
53 | 2,
54 | 8000,
55 | 9000,
56 |
57 | blocksize_8,
58 | blocksize_8,
59 |
60 | _psy_tone_masteratt_8,
61 | _psy_tone_0dB,
62 | _psy_tone_suppress,
63 |
64 | _vp_tonemask_adj_8,
65 | NULL,
66 | _vp_tonemask_adj_8,
67 |
68 | _psy_noiseguards_8,
69 | _psy_noisebias_8,
70 | _psy_noisebias_8,
71 | NULL,
72 | NULL,
73 | _psy_noise_suppress,
74 |
75 | _psy_compand_8,
76 | _psy_compand_8_mapping,
77 | NULL,
78 |
79 | {_noise_start_8,_noise_start_8},
80 | {_noise_part_8,_noise_part_8},
81 | _noise_thresh_5only,
82 |
83 | _psy_ath_floater_8,
84 | _psy_ath_abs_8,
85 |
86 | _psy_lowpass_8,
87 |
88 | _psy_global_44,
89 | _global_mapping_8,
90 | _psy_stereo_modes_8,
91 |
92 | _floor_books,
93 | _floor,
94 | 1,
95 | _floor_mapping_8,
96 |
97 | _mapres_template_8_stereo
98 | };
99 |
100 | static const ve_setup_data_template ve_setup_8_uncoupled={
101 | 2,
102 | rate_mapping_8_uncoupled,
103 | quality_mapping_8,
104 | -1,
105 | 8000,
106 | 9000,
107 |
108 | blocksize_8,
109 | blocksize_8,
110 |
111 | _psy_tone_masteratt_8,
112 | _psy_tone_0dB,
113 | _psy_tone_suppress,
114 |
115 | _vp_tonemask_adj_8,
116 | NULL,
117 | _vp_tonemask_adj_8,
118 |
119 | _psy_noiseguards_8,
120 | _psy_noisebias_8,
121 | _psy_noisebias_8,
122 | NULL,
123 | NULL,
124 | _psy_noise_suppress,
125 |
126 | _psy_compand_8,
127 | _psy_compand_8_mapping,
128 | NULL,
129 |
130 | {_noise_start_8,_noise_start_8},
131 | {_noise_part_8,_noise_part_8},
132 | _noise_thresh_5only,
133 |
134 | _psy_ath_floater_8,
135 | _psy_ath_abs_8,
136 |
137 | _psy_lowpass_8,
138 |
139 | _psy_global_44,
140 | _global_mapping_8,
141 | _psy_stereo_modes_8,
142 |
143 | _floor_books,
144 | _floor,
145 | 1,
146 | _floor_mapping_8,
147 |
148 | _mapres_template_8_uncoupled
149 | };
150 |
--------------------------------------------------------------------------------
/jni/libvorbis/modes/setup_X.h:
--------------------------------------------------------------------------------
1 | /********************************************************************
2 | * *
3 | * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. *
4 | * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
5 | * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
6 | * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
7 | * *
8 | * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 *
9 | * by the Xiph.Org Foundation http://www.xiph.org/ *
10 | * *
11 | ********************************************************************
12 |
13 | function: catch-all toplevel settings for q modes only
14 | last mod: $Id: setup_X.h 16894 2010-02-12 20:32:12Z xiphmont $
15 |
16 | ********************************************************************/
17 |
18 | static const double rate_mapping_X[12]={
19 | -1.,-1.,-1.,-1.,-1.,-1.,
20 | -1.,-1.,-1.,-1.,-1.,-1.
21 | };
22 |
23 | static const ve_setup_data_template ve_setup_X_stereo={
24 | 11,
25 | rate_mapping_X,
26 | quality_mapping_44,
27 | 2,
28 | 50000,
29 | 200000,
30 |
31 | blocksize_short_44,
32 | blocksize_long_44,
33 |
34 | _psy_tone_masteratt_44,
35 | _psy_tone_0dB,
36 | _psy_tone_suppress,
37 |
38 | _vp_tonemask_adj_otherblock,
39 | _vp_tonemask_adj_longblock,
40 | _vp_tonemask_adj_otherblock,
41 |
42 | _psy_noiseguards_44,
43 | _psy_noisebias_impulse,
44 | _psy_noisebias_padding,
45 | _psy_noisebias_trans,
46 | _psy_noisebias_long,
47 | _psy_noise_suppress,
48 |
49 | _psy_compand_44,
50 | _psy_compand_short_mapping,
51 | _psy_compand_long_mapping,
52 |
53 | {_noise_start_short_44,_noise_start_long_44},
54 | {_noise_part_short_44,_noise_part_long_44},
55 | _noise_thresh_44,
56 |
57 | _psy_ath_floater,
58 | _psy_ath_abs,
59 |
60 | _psy_lowpass_44,
61 |
62 | _psy_global_44,
63 | _global_mapping_44,
64 | _psy_stereo_modes_44,
65 |
66 | _floor_books,
67 | _floor,
68 | 2,
69 | _floor_mapping_44,
70 |
71 | _mapres_template_44_stereo
72 | };
73 |
74 | static const ve_setup_data_template ve_setup_X_uncoupled={
75 | 11,
76 | rate_mapping_X,
77 | quality_mapping_44,
78 | -1,
79 | 50000,
80 | 200000,
81 |
82 | blocksize_short_44,
83 | blocksize_long_44,
84 |
85 | _psy_tone_masteratt_44,
86 | _psy_tone_0dB,
87 | _psy_tone_suppress,
88 |
89 | _vp_tonemask_adj_otherblock,
90 | _vp_tonemask_adj_longblock,
91 | _vp_tonemask_adj_otherblock,
92 |
93 | _psy_noiseguards_44,
94 | _psy_noisebias_impulse,
95 | _psy_noisebias_padding,
96 | _psy_noisebias_trans,
97 | _psy_noisebias_long,
98 | _psy_noise_suppress,
99 |
100 | _psy_compand_44,
101 | _psy_compand_short_mapping,
102 | _psy_compand_long_mapping,
103 |
104 | {_noise_start_short_44,_noise_start_long_44},
105 | {_noise_part_short_44,_noise_part_long_44},
106 | _noise_thresh_44,
107 |
108 | _psy_ath_floater,
109 | _psy_ath_abs,
110 |
111 | _psy_lowpass_44,
112 |
113 | _psy_global_44,
114 | _global_mapping_44,
115 | NULL,
116 |
117 | _floor_books,
118 | _floor,
119 | 2,
120 | _floor_mapping_44,
121 |
122 | _mapres_template_44_uncoupled
123 | };
124 |
125 | static const ve_setup_data_template ve_setup_XX_stereo={
126 | 2,
127 | rate_mapping_X,
128 | quality_mapping_8,
129 | 2,
130 | 0,
131 | 8000,
132 |
133 | blocksize_8,
134 | blocksize_8,
135 |
136 | _psy_tone_masteratt_8,
137 | _psy_tone_0dB,
138 | _psy_tone_suppress,
139 |
140 | _vp_tonemask_adj_8,
141 | NULL,
142 | _vp_tonemask_adj_8,
143 |
144 | _psy_noiseguards_8,
145 | _psy_noisebias_8,
146 | _psy_noisebias_8,
147 | NULL,
148 | NULL,
149 | _psy_noise_suppress,
150 |
151 | _psy_compand_8,
152 | _psy_compand_8_mapping,
153 | NULL,
154 |
155 | {_noise_start_8,_noise_start_8},
156 | {_noise_part_8,_noise_part_8},
157 | _noise_thresh_5only,
158 |
159 | _psy_ath_floater_8,
160 | _psy_ath_abs_8,
161 |
162 | _psy_lowpass_8,
163 |
164 | _psy_global_44,
165 | _global_mapping_8,
166 | _psy_stereo_modes_8,
167 |
168 | _floor_books,
169 | _floor,
170 | 1,
171 | _floor_mapping_8,
172 |
173 | _mapres_template_8_stereo
174 | };
175 |
176 | static const ve_setup_data_template ve_setup_XX_uncoupled={
177 | 2,
178 | rate_mapping_X,
179 | quality_mapping_8,
180 | -1,
181 | 0,
182 | 8000,
183 |
184 | blocksize_8,
185 | blocksize_8,
186 |
187 | _psy_tone_masteratt_8,
188 | _psy_tone_0dB,
189 | _psy_tone_suppress,
190 |
191 | _vp_tonemask_adj_8,
192 | NULL,
193 | _vp_tonemask_adj_8,
194 |
195 | _psy_noiseguards_8,
196 | _psy_noisebias_8,
197 | _psy_noisebias_8,
198 | NULL,
199 | NULL,
200 | _psy_noise_suppress,
201 |
202 | _psy_compand_8,
203 | _psy_compand_8_mapping,
204 | NULL,
205 |
206 | {_noise_start_8,_noise_start_8},
207 | {_noise_part_8,_noise_part_8},
208 | _noise_thresh_5only,
209 |
210 | _psy_ath_floater_8,
211 | _psy_ath_abs_8,
212 |
213 | _psy_lowpass_8,
214 |
215 | _psy_global_44,
216 | _global_mapping_8,
217 | _psy_stereo_modes_8,
218 |
219 | _floor_books,
220 | _floor,
221 | 1,
222 | _floor_mapping_8,
223 |
224 | _mapres_template_8_uncoupled
225 | };
226 |
--------------------------------------------------------------------------------
/jni/libvorbis/os.h:
--------------------------------------------------------------------------------
1 | #ifndef _OS_H
2 | #define _OS_H
3 | /********************************************************************
4 | * *
5 | * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. *
6 | * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
7 | * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
8 | * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
9 | * *
10 | * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 *
11 | * by the Xiph.Org Foundation http://www.xiph.org/ *
12 | * *
13 | ********************************************************************
14 |
15 | function: #ifdef jail to whip a few platforms into the UNIX ideal.
16 | last mod: $Id: os.h 16227 2009-07-08 06:58:46Z xiphmont $
17 |
18 | ********************************************************************/
19 |
20 | #ifdef HAVE_CONFIG_H
21 | #include "config.h"
22 | #endif
23 |
24 | #include
25 | #include
26 |
27 | #include "misc.h"
28 |
29 | #ifndef _V_IFDEFJAIL_H_
30 | # define _V_IFDEFJAIL_H_
31 |
32 | # ifdef __GNUC__
33 | # define STIN static __inline__
34 | # elif _WIN32
35 | # define STIN static __inline
36 | # else
37 | # define STIN static
38 | # endif
39 |
40 | #ifdef DJGPP
41 | # define rint(x) (floor((x)+0.5f))
42 | #endif
43 |
44 | #ifndef M_PI
45 | # define M_PI (3.1415926536f)
46 | #endif
47 |
48 | #if defined(_WIN32) && !defined(__SYMBIAN32__)
49 | # include
50 | # define rint(x) (floor((x)+0.5f))
51 | # define NO_FLOAT_MATH_LIB
52 | # define FAST_HYPOT(a, b) sqrt((a)*(a) + (b)*(b))
53 | #endif
54 |
55 | #if defined(__SYMBIAN32__) && defined(__WINS__)
56 | void *_alloca(size_t size);
57 | # define alloca _alloca
58 | #endif
59 |
60 | #ifndef FAST_HYPOT
61 | # define FAST_HYPOT hypot
62 | #endif
63 |
64 | #endif
65 |
66 | #ifdef HAVE_ALLOCA_H
67 | # include
68 | #endif
69 |
70 | #ifdef USE_MEMORY_H
71 | # include
72 | #endif
73 |
74 | #ifndef min
75 | # define min(x,y) ((x)>(y)?(y):(x))
76 | #endif
77 |
78 | #ifndef max
79 | # define max(x,y) ((x)<(y)?(y):(x))
80 | #endif
81 |
82 |
83 | /* Special i386 GCC implementation */
84 | #if defined(__i386__) && defined(__GNUC__) && !defined(__BEOS__)
85 | # define VORBIS_FPU_CONTROL
86 | /* both GCC and MSVC are kinda stupid about rounding/casting to int.
87 | Because of encapsulation constraints (GCC can't see inside the asm
88 | block and so we end up doing stupid things like a store/load that
89 | is collectively a noop), we do it this way */
90 |
91 | /* we must set up the fpu before this works!! */
92 |
93 | typedef ogg_int16_t vorbis_fpu_control;
94 |
95 | static inline void vorbis_fpu_setround(vorbis_fpu_control *fpu){
96 | ogg_int16_t ret;
97 | ogg_int16_t temp;
98 | __asm__ __volatile__("fnstcw %0\n\t"
99 | "movw %0,%%dx\n\t"
100 | "andw $62463,%%dx\n\t"
101 | "movw %%dx,%1\n\t"
102 | "fldcw %1\n\t":"=m"(ret):"m"(temp): "dx");
103 | *fpu=ret;
104 | }
105 |
106 | static inline void vorbis_fpu_restore(vorbis_fpu_control fpu){
107 | __asm__ __volatile__("fldcw %0":: "m"(fpu));
108 | }
109 |
110 | /* assumes the FPU is in round mode! */
111 | static inline int vorbis_ftoi(double f){ /* yes, double! Otherwise,
112 | we get extra fst/fld to
113 | truncate precision */
114 | int i;
115 | __asm__("fistl %0": "=m"(i) : "t"(f));
116 | return(i);
117 | }
118 | #endif /* Special i386 GCC implementation */
119 |
120 |
121 | /* MSVC inline assembly. 32 bit only; inline ASM isn't implemented in the
122 | * 64 bit compiler */
123 | #if defined(_MSC_VER) && !defined(_WIN64) && !defined(_WIN32_WCE)
124 | # define VORBIS_FPU_CONTROL
125 |
126 | typedef ogg_int16_t vorbis_fpu_control;
127 |
128 | static __inline int vorbis_ftoi(double f){
129 | int i;
130 | __asm{
131 | fld f
132 | fistp i
133 | }
134 | return i;
135 | }
136 |
137 | static __inline void vorbis_fpu_setround(vorbis_fpu_control *fpu){
138 | }
139 |
140 | static __inline void vorbis_fpu_restore(vorbis_fpu_control fpu){
141 | }
142 |
143 | #endif /* Special MSVC 32 bit implementation */
144 |
145 |
146 | /* Optimized code path for x86_64 builds. Uses SSE2 intrinsics. This can be
147 | done safely because all x86_64 CPUs supports SSE2. */
148 | #if (defined(_MSC_VER) && defined(_WIN64)) || (defined(__GNUC__) && defined (__x86_64__))
149 | # define VORBIS_FPU_CONTROL
150 |
151 | typedef ogg_int16_t vorbis_fpu_control;
152 |
153 | #include
154 | static __inline int vorbis_ftoi(double f){
155 | return _mm_cvtsd_si32(_mm_load_sd(&f));
156 | }
157 |
158 | static __inline void vorbis_fpu_setround(vorbis_fpu_control *fpu){
159 | }
160 |
161 | static __inline void vorbis_fpu_restore(vorbis_fpu_control fpu){
162 | }
163 |
164 | #endif /* Special MSVC x64 implementation */
165 |
166 |
167 | /* If no special implementation was found for the current compiler / platform,
168 | use the default implementation here: */
169 | #ifndef VORBIS_FPU_CONTROL
170 |
171 | typedef int vorbis_fpu_control;
172 |
173 | static int vorbis_ftoi(double f){
174 | /* Note: MSVC and GCC (at least on some systems) round towards zero, thus,
175 | the floor() call is required to ensure correct roudning of
176 | negative numbers */
177 | return (int)floor(f+.5);
178 | }
179 |
180 | /* We don't have special code for this compiler/arch, so do it the slow way */
181 | # define vorbis_fpu_setround(vorbis_fpu_control) {}
182 | # define vorbis_fpu_restore(vorbis_fpu_control) {}
183 |
184 | #endif /* default implementation */
185 |
186 | #endif /* _OS_H */
187 |
--------------------------------------------------------------------------------
/jni/libvorbis/psy.h:
--------------------------------------------------------------------------------
1 | /********************************************************************
2 | * *
3 | * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. *
4 | * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
5 | * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
6 | * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
7 | * *
8 | * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 *
9 | * by the Xiph.Org Foundation http://www.xiph.org/ *
10 | * *
11 | ********************************************************************
12 |
13 | function: random psychoacoustics (not including preecho)
14 | last mod: $Id: psy.h 16946 2010-03-03 16:12:40Z xiphmont $
15 |
16 | ********************************************************************/
17 |
18 | #ifndef _V_PSY_H_
19 | #define _V_PSY_H_
20 | #include "smallft.h"
21 |
22 | #include "backends.h"
23 | #include "envelope.h"
24 |
25 | #ifndef EHMER_MAX
26 | #define EHMER_MAX 56
27 | #endif
28 |
29 | /* psychoacoustic setup ********************************************/
30 | #define P_BANDS 17 /* 62Hz to 16kHz */
31 | #define P_LEVELS 8 /* 30dB to 100dB */
32 | #define P_LEVEL_0 30. /* 30 dB */
33 | #define P_NOISECURVES 3
34 |
35 | #define NOISE_COMPAND_LEVELS 40
36 | typedef struct vorbis_info_psy{
37 | int blockflag;
38 |
39 | float ath_adjatt;
40 | float ath_maxatt;
41 |
42 | float tone_masteratt[P_NOISECURVES];
43 | float tone_centerboost;
44 | float tone_decay;
45 | float tone_abs_limit;
46 | float toneatt[P_BANDS];
47 |
48 | int noisemaskp;
49 | float noisemaxsupp;
50 | float noisewindowlo;
51 | float noisewindowhi;
52 | int noisewindowlomin;
53 | int noisewindowhimin;
54 | int noisewindowfixed;
55 | float noiseoff[P_NOISECURVES][P_BANDS];
56 | float noisecompand[NOISE_COMPAND_LEVELS];
57 |
58 | float max_curve_dB;
59 |
60 | int normal_p;
61 | int normal_start;
62 | int normal_partition;
63 | double normal_thresh;
64 | } vorbis_info_psy;
65 |
66 | typedef struct{
67 | int eighth_octave_lines;
68 |
69 | /* for block long/short tuning; encode only */
70 | float preecho_thresh[VE_BANDS];
71 | float postecho_thresh[VE_BANDS];
72 | float stretch_penalty;
73 | float preecho_minenergy;
74 |
75 | float ampmax_att_per_sec;
76 |
77 | /* channel coupling config */
78 | int coupling_pkHz[PACKETBLOBS];
79 | int coupling_pointlimit[2][PACKETBLOBS];
80 | int coupling_prepointamp[PACKETBLOBS];
81 | int coupling_postpointamp[PACKETBLOBS];
82 | int sliding_lowpass[2][PACKETBLOBS];
83 |
84 | } vorbis_info_psy_global;
85 |
86 | typedef struct {
87 | float ampmax;
88 | int channels;
89 |
90 | vorbis_info_psy_global *gi;
91 | int coupling_pointlimit[2][P_NOISECURVES];
92 | } vorbis_look_psy_global;
93 |
94 |
95 | typedef struct {
96 | int n;
97 | struct vorbis_info_psy *vi;
98 |
99 | float ***tonecurves;
100 | float **noiseoffset;
101 |
102 | float *ath;
103 | long *octave; /* in n.ocshift format */
104 | long *bark;
105 |
106 | long firstoc;
107 | long shiftoc;
108 | int eighth_octave_lines; /* power of two, please */
109 | int total_octave_lines;
110 | long rate; /* cache it */
111 |
112 | float m_val; /* Masking compensation value */
113 |
114 | } vorbis_look_psy;
115 |
116 | extern void _vp_psy_init(vorbis_look_psy *p,vorbis_info_psy *vi,
117 | vorbis_info_psy_global *gi,int n,long rate);
118 | extern void _vp_psy_clear(vorbis_look_psy *p);
119 | extern void *_vi_psy_dup(void *source);
120 |
121 | extern void _vi_psy_free(vorbis_info_psy *i);
122 | extern vorbis_info_psy *_vi_psy_copy(vorbis_info_psy *i);
123 |
124 | extern void _vp_noisemask(vorbis_look_psy *p,
125 | float *logmdct,
126 | float *logmask);
127 |
128 | extern void _vp_tonemask(vorbis_look_psy *p,
129 | float *logfft,
130 | float *logmask,
131 | float global_specmax,
132 | float local_specmax);
133 |
134 | extern void _vp_offset_and_mix(vorbis_look_psy *p,
135 | float *noise,
136 | float *tone,
137 | int offset_select,
138 | float *logmask,
139 | float *mdct,
140 | float *logmdct);
141 |
142 | extern float _vp_ampmax_decay(float amp,vorbis_dsp_state *vd);
143 |
144 | extern void _vp_couple_quantize_normalize(int blobno,
145 | vorbis_info_psy_global *g,
146 | vorbis_look_psy *p,
147 | vorbis_info_mapping0 *vi,
148 | float **mdct,
149 | int **iwork,
150 | int *nonzero,
151 | int sliding_lowpass,
152 | int ch);
153 |
154 | #endif
155 |
--------------------------------------------------------------------------------
/jni/libvorbis/registry.c:
--------------------------------------------------------------------------------
1 | /********************************************************************
2 | * *
3 | * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. *
4 | * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
5 | * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
6 | * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
7 | * *
8 | * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 *
9 | * by the Xiph.Org Foundation http://www.xiph.org/ *
10 | * *
11 | ********************************************************************
12 |
13 | function: registry for time, floor, res backends and channel mappings
14 | last mod: $Id: registry.c 16227 2009-07-08 06:58:46Z xiphmont $
15 |
16 | ********************************************************************/
17 |
18 | #include "vorbis/codec.h"
19 | #include "codec_internal.h"
20 | #include "registry.h"
21 | #include "misc.h"
22 | /* seems like major overkill now; the backend numbers will grow into
23 | the infrastructure soon enough */
24 |
25 | extern const vorbis_func_floor floor0_exportbundle;
26 | extern const vorbis_func_floor floor1_exportbundle;
27 | extern const vorbis_func_residue residue0_exportbundle;
28 | extern const vorbis_func_residue residue1_exportbundle;
29 | extern const vorbis_func_residue residue2_exportbundle;
30 | extern const vorbis_func_mapping mapping0_exportbundle;
31 |
32 | const vorbis_func_floor *const _floor_P[]={
33 | &floor0_exportbundle,
34 | &floor1_exportbundle,
35 | };
36 |
37 | const vorbis_func_residue *const _residue_P[]={
38 | &residue0_exportbundle,
39 | &residue1_exportbundle,
40 | &residue2_exportbundle,
41 | };
42 |
43 | const vorbis_func_mapping *const _mapping_P[]={
44 | &mapping0_exportbundle,
45 | };
46 |
--------------------------------------------------------------------------------
/jni/libvorbis/registry.h:
--------------------------------------------------------------------------------
1 | /********************************************************************
2 | * *
3 | * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. *
4 | * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
5 | * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
6 | * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
7 | * *
8 | * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007 *
9 | * by the Xiph.Org Foundation http://www.xiph.org/ *
10 | * *
11 | ********************************************************************
12 |
13 | function: registry for time, floor, res backends and channel mappings
14 | last mod: $Id: registry.h 15531 2008-11-24 23:50:06Z xiphmont $
15 |
16 | ********************************************************************/
17 |
18 | #ifndef _V_REG_H_
19 | #define _V_REG_H_
20 |
21 | #define VI_TRANSFORMB 1
22 | #define VI_WINDOWB 1
23 | #define VI_TIMEB 1
24 | #define VI_FLOORB 2
25 | #define VI_RESB 3
26 | #define VI_MAPB 1
27 |
28 | extern const vorbis_func_floor *const _floor_P[];
29 | extern const vorbis_func_residue *const _residue_P[];
30 | extern const vorbis_func_mapping *const _mapping_P[];
31 |
32 | #endif
33 |
--------------------------------------------------------------------------------
/jni/libvorbis/scales.h:
--------------------------------------------------------------------------------
1 | /********************************************************************
2 | * *
3 | * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. *
4 | * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
5 | * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
6 | * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
7 | * *
8 | * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 *
9 | * by the Xiph.Org Foundation http://www.xiph.org/ *
10 | * *
11 | ********************************************************************
12 |
13 | function: linear scale -> dB, Bark and Mel scales
14 | last mod: $Id: scales.h 16227 2009-07-08 06:58:46Z xiphmont $
15 |
16 | ********************************************************************/
17 |
18 | #ifndef _V_SCALES_H_
19 | #define _V_SCALES_H_
20 |
21 | #include
22 | #include "os.h"
23 |
24 | #ifdef _MSC_VER
25 | /* MS Visual Studio doesn't have C99 inline keyword. */
26 | #define inline __inline
27 | #endif
28 |
29 | /* 20log10(x) */
30 | #define VORBIS_IEEE_FLOAT32 1
31 | #ifdef VORBIS_IEEE_FLOAT32
32 |
33 | static inline float unitnorm(float x){
34 | union {
35 | ogg_uint32_t i;
36 | float f;
37 | } ix;
38 | ix.f = x;
39 | ix.i = (ix.i & 0x80000000U) | (0x3f800000U);
40 | return ix.f;
41 | }
42 |
43 | /* Segher was off (too high) by ~ .3 decibel. Center the conversion correctly. */
44 | static inline float todB(const float *x){
45 | union {
46 | ogg_uint32_t i;
47 | float f;
48 | } ix;
49 | ix.f = *x;
50 | ix.i = ix.i&0x7fffffff;
51 | return (float)(ix.i * 7.17711438e-7f -764.6161886f);
52 | }
53 |
54 | #define todB_nn(x) todB(x)
55 |
56 | #else
57 |
58 | static float unitnorm(float x){
59 | if(x<0)return(-1.f);
60 | return(1.f);
61 | }
62 |
63 | #define todB(x) (*(x)==0?-400.f:log(*(x)**(x))*4.34294480f)
64 | #define todB_nn(x) (*(x)==0.f?-400.f:log(*(x))*8.6858896f)
65 |
66 | #endif
67 |
68 | #define fromdB(x) (exp((x)*.11512925f))
69 |
70 | /* The bark scale equations are approximations, since the original
71 | table was somewhat hand rolled. The below are chosen to have the
72 | best possible fit to the rolled tables, thus their somewhat odd
73 | appearance (these are more accurate and over a longer range than
74 | the oft-quoted bark equations found in the texts I have). The
75 | approximations are valid from 0 - 30kHz (nyquist) or so.
76 |
77 | all f in Hz, z in Bark */
78 |
79 | #define toBARK(n) (13.1f*atan(.00074f*(n))+2.24f*atan((n)*(n)*1.85e-8f)+1e-4f*(n))
80 | #define fromBARK(z) (102.f*(z)-2.f*pow(z,2.f)+.4f*pow(z,3.f)+pow(1.46f,z)-1.f)
81 | #define toMEL(n) (log(1.f+(n)*.001f)*1442.695f)
82 | #define fromMEL(m) (1000.f*exp((m)/1442.695f)-1000.f)
83 |
84 | /* Frequency to octave. We arbitrarily declare 63.5 Hz to be octave
85 | 0.0 */
86 |
87 | #define toOC(n) (log(n)*1.442695f-5.965784f)
88 | #define fromOC(o) (exp(((o)+5.965784f)*.693147f))
89 |
90 | #endif
91 |
--------------------------------------------------------------------------------
/jni/libvorbis/smallft.h:
--------------------------------------------------------------------------------
1 | /********************************************************************
2 | * *
3 | * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. *
4 | * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
5 | * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
6 | * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
7 | * *
8 | * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007 *
9 | * by the Xiph.Org Foundation http://www.xiph.org/ *
10 | * *
11 | ********************************************************************
12 |
13 | function: fft transform
14 | last mod: $Id: smallft.h 13293 2007-07-24 00:09:47Z xiphmont $
15 |
16 | ********************************************************************/
17 |
18 | #ifndef _V_SMFT_H_
19 | #define _V_SMFT_H_
20 |
21 | #include "vorbis/codec.h"
22 |
23 | typedef struct {
24 | int n;
25 | float *trigcache;
26 | int *splitcache;
27 | } drft_lookup;
28 |
29 | extern void drft_forward(drft_lookup *l,float *data);
30 | extern void drft_backward(drft_lookup *l,float *data);
31 | extern void drft_init(drft_lookup *l,int n);
32 | extern void drft_clear(drft_lookup *l);
33 |
34 | #endif
35 |
--------------------------------------------------------------------------------
/jni/libvorbis/synthesis.c:
--------------------------------------------------------------------------------
1 | /********************************************************************
2 | * *
3 | * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. *
4 | * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
5 | * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
6 | * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
7 | * *
8 | * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 *
9 | * by the Xiph.Org Foundation http://www.xiph.org/ *
10 | * *
11 | ********************************************************************
12 |
13 | function: single-block PCM synthesis
14 | last mod: $Id: synthesis.c 17474 2010-09-30 03:41:41Z gmaxwell $
15 |
16 | ********************************************************************/
17 |
18 | #include
19 | #include
20 | #include "vorbis/codec.h"
21 | #include "codec_internal.h"
22 | #include "registry.h"
23 | #include "misc.h"
24 | #include "os.h"
25 |
26 | int vorbis_synthesis(vorbis_block *vb,ogg_packet *op){
27 | vorbis_dsp_state *vd= vb ? vb->vd : 0;
28 | private_state *b= vd ? vd->backend_state : 0;
29 | vorbis_info *vi= vd ? vd->vi : 0;
30 | codec_setup_info *ci= vi ? vi->codec_setup : 0;
31 | oggpack_buffer *opb=vb ? &vb->opb : 0;
32 | int type,mode,i;
33 |
34 | if (!vd || !b || !vi || !ci || !opb) {
35 | return OV_EBADPACKET;
36 | }
37 |
38 | /* first things first. Make sure decode is ready */
39 | _vorbis_block_ripcord(vb);
40 | oggpack_readinit(opb,op->packet,op->bytes);
41 |
42 | /* Check the packet type */
43 | if(oggpack_read(opb,1)!=0){
44 | /* Oops. This is not an audio data packet */
45 | return(OV_ENOTAUDIO);
46 | }
47 |
48 | /* read our mode and pre/post windowsize */
49 | mode=oggpack_read(opb,b->modebits);
50 | if(mode==-1){
51 | return(OV_EBADPACKET);
52 | }
53 |
54 | vb->mode=mode;
55 | if(!ci->mode_param[mode]){
56 | return(OV_EBADPACKET);
57 | }
58 |
59 | vb->W=ci->mode_param[mode]->blockflag;
60 | if(vb->W){
61 |
62 | /* this doesn;t get mapped through mode selection as it's used
63 | only for window selection */
64 | vb->lW=oggpack_read(opb,1);
65 | vb->nW=oggpack_read(opb,1);
66 | if(vb->nW==-1){
67 | return(OV_EBADPACKET);
68 | }
69 | }else{
70 | vb->lW=0;
71 | vb->nW=0;
72 | }
73 |
74 | /* more setup */
75 | vb->granulepos=op->granulepos;
76 | vb->sequence=op->packetno;
77 | vb->eofflag=op->e_o_s;
78 |
79 | /* alloc pcm passback storage */
80 | vb->pcmend=ci->blocksizes[vb->W];
81 | vb->pcm=_vorbis_block_alloc(vb,sizeof(*vb->pcm)*vi->channels);
82 | for(i=0;ichannels;i++)
83 | vb->pcm[i]=_vorbis_block_alloc(vb,vb->pcmend*sizeof(*vb->pcm[i]));
84 |
85 | /* unpack_header enforces range checking */
86 | type=ci->map_type[ci->mode_param[mode]->mapping];
87 |
88 | return(_mapping_P[type]->inverse(vb,ci->map_param[ci->mode_param[mode]->
89 | mapping]));
90 | }
91 |
92 | /* used to track pcm position without actually performing decode.
93 | Useful for sequential 'fast forward' */
94 | int vorbis_synthesis_trackonly(vorbis_block *vb,ogg_packet *op){
95 | vorbis_dsp_state *vd=vb->vd;
96 | private_state *b=vd->backend_state;
97 | vorbis_info *vi=vd->vi;
98 | codec_setup_info *ci=vi->codec_setup;
99 | oggpack_buffer *opb=&vb->opb;
100 | int mode;
101 |
102 | /* first things first. Make sure decode is ready */
103 | _vorbis_block_ripcord(vb);
104 | oggpack_readinit(opb,op->packet,op->bytes);
105 |
106 | /* Check the packet type */
107 | if(oggpack_read(opb,1)!=0){
108 | /* Oops. This is not an audio data packet */
109 | return(OV_ENOTAUDIO);
110 | }
111 |
112 | /* read our mode and pre/post windowsize */
113 | mode=oggpack_read(opb,b->modebits);
114 | if(mode==-1)return(OV_EBADPACKET);
115 |
116 | vb->mode=mode;
117 | if(!ci->mode_param[mode]){
118 | return(OV_EBADPACKET);
119 | }
120 |
121 | vb->W=ci->mode_param[mode]->blockflag;
122 | if(vb->W){
123 | vb->lW=oggpack_read(opb,1);
124 | vb->nW=oggpack_read(opb,1);
125 | if(vb->nW==-1) return(OV_EBADPACKET);
126 | }else{
127 | vb->lW=0;
128 | vb->nW=0;
129 | }
130 |
131 | /* more setup */
132 | vb->granulepos=op->granulepos;
133 | vb->sequence=op->packetno;
134 | vb->eofflag=op->e_o_s;
135 |
136 | /* no pcm */
137 | vb->pcmend=0;
138 | vb->pcm=NULL;
139 |
140 | return(0);
141 | }
142 |
143 | long vorbis_packet_blocksize(vorbis_info *vi,ogg_packet *op){
144 | codec_setup_info *ci=vi->codec_setup;
145 | oggpack_buffer opb;
146 | int mode;
147 |
148 | oggpack_readinit(&opb,op->packet,op->bytes);
149 |
150 | /* Check the packet type */
151 | if(oggpack_read(&opb,1)!=0){
152 | /* Oops. This is not an audio data packet */
153 | return(OV_ENOTAUDIO);
154 | }
155 |
156 | {
157 | int modebits=0;
158 | int v=ci->modes;
159 | while(v>1){
160 | modebits++;
161 | v>>=1;
162 | }
163 |
164 | /* read our mode and pre/post windowsize */
165 | mode=oggpack_read(&opb,modebits);
166 | }
167 | if(mode==-1)return(OV_EBADPACKET);
168 | return(ci->blocksizes[ci->mode_param[mode]->blockflag]);
169 | }
170 |
171 | int vorbis_synthesis_halfrate(vorbis_info *vi,int flag){
172 | /* set / clear half-sample-rate mode */
173 | codec_setup_info *ci=vi->codec_setup;
174 |
175 | /* right now, our MDCT can't handle < 64 sample windows. */
176 | if(ci->blocksizes[0]<=64 && flag)return -1;
177 | ci->halfrate_flag=(flag?1:0);
178 | return 0;
179 | }
180 |
181 | int vorbis_synthesis_halfrate_p(vorbis_info *vi){
182 | codec_setup_info *ci=vi->codec_setup;
183 | return ci->halfrate_flag;
184 | }
185 |
--------------------------------------------------------------------------------
/jni/libvorbis/window.h:
--------------------------------------------------------------------------------
1 | /********************************************************************
2 | * *
3 | * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. *
4 | * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
5 | * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
6 | * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
7 | * *
8 | * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007 *
9 | * by the Xiph.Org Foundation http://www.xiph.org/ *
10 | * *
11 | ********************************************************************
12 |
13 | function: window functions
14 | last mod: $Id: window.h 13293 2007-07-24 00:09:47Z xiphmont $
15 |
16 | ********************************************************************/
17 |
18 | #ifndef _V_WINDOW_
19 | #define _V_WINDOW_
20 |
21 | extern float *_vorbis_window_get(int n);
22 | extern void _vorbis_apply_window(float *d,int *winno,long *blocksizes,
23 | int lW,int W,int nW);
24 |
25 |
26 | #endif
27 |
--------------------------------------------------------------------------------
/libs/arm64-v8a/libogg.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vincentjames501/libvorbis-libogg-android/f9553444b9ee55e4cbb4a748841387313a72d8e7/libs/arm64-v8a/libogg.so
--------------------------------------------------------------------------------
/libs/arm64-v8a/libvorbis-jni.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vincentjames501/libvorbis-libogg-android/f9553444b9ee55e4cbb4a748841387313a72d8e7/libs/arm64-v8a/libvorbis-jni.so
--------------------------------------------------------------------------------
/libs/arm64-v8a/libvorbis-stream.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vincentjames501/libvorbis-libogg-android/f9553444b9ee55e4cbb4a748841387313a72d8e7/libs/arm64-v8a/libvorbis-stream.so
--------------------------------------------------------------------------------
/libs/arm64-v8a/libvorbis.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vincentjames501/libvorbis-libogg-android/f9553444b9ee55e4cbb4a748841387313a72d8e7/libs/arm64-v8a/libvorbis.so
--------------------------------------------------------------------------------
/libs/armeabi-v7a/libogg.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vincentjames501/libvorbis-libogg-android/f9553444b9ee55e4cbb4a748841387313a72d8e7/libs/armeabi-v7a/libogg.so
--------------------------------------------------------------------------------
/libs/armeabi-v7a/libvorbis-jni.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vincentjames501/libvorbis-libogg-android/f9553444b9ee55e4cbb4a748841387313a72d8e7/libs/armeabi-v7a/libvorbis-jni.so
--------------------------------------------------------------------------------
/libs/armeabi-v7a/libvorbis-stream.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vincentjames501/libvorbis-libogg-android/f9553444b9ee55e4cbb4a748841387313a72d8e7/libs/armeabi-v7a/libvorbis-stream.so
--------------------------------------------------------------------------------
/libs/armeabi-v7a/libvorbis.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vincentjames501/libvorbis-libogg-android/f9553444b9ee55e4cbb4a748841387313a72d8e7/libs/armeabi-v7a/libvorbis.so
--------------------------------------------------------------------------------
/libs/armeabi/libogg.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vincentjames501/libvorbis-libogg-android/f9553444b9ee55e4cbb4a748841387313a72d8e7/libs/armeabi/libogg.so
--------------------------------------------------------------------------------
/libs/armeabi/libvorbis-jni.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vincentjames501/libvorbis-libogg-android/f9553444b9ee55e4cbb4a748841387313a72d8e7/libs/armeabi/libvorbis-jni.so
--------------------------------------------------------------------------------
/libs/armeabi/libvorbis-stream.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vincentjames501/libvorbis-libogg-android/f9553444b9ee55e4cbb4a748841387313a72d8e7/libs/armeabi/libvorbis-stream.so
--------------------------------------------------------------------------------
/libs/armeabi/libvorbis.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vincentjames501/libvorbis-libogg-android/f9553444b9ee55e4cbb4a748841387313a72d8e7/libs/armeabi/libvorbis.so
--------------------------------------------------------------------------------
/libs/mips/libogg.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vincentjames501/libvorbis-libogg-android/f9553444b9ee55e4cbb4a748841387313a72d8e7/libs/mips/libogg.so
--------------------------------------------------------------------------------
/libs/mips/libvorbis-jni.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vincentjames501/libvorbis-libogg-android/f9553444b9ee55e4cbb4a748841387313a72d8e7/libs/mips/libvorbis-jni.so
--------------------------------------------------------------------------------
/libs/mips/libvorbis-stream.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vincentjames501/libvorbis-libogg-android/f9553444b9ee55e4cbb4a748841387313a72d8e7/libs/mips/libvorbis-stream.so
--------------------------------------------------------------------------------
/libs/mips/libvorbis.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vincentjames501/libvorbis-libogg-android/f9553444b9ee55e4cbb4a748841387313a72d8e7/libs/mips/libvorbis.so
--------------------------------------------------------------------------------
/libs/x86/libogg.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vincentjames501/libvorbis-libogg-android/f9553444b9ee55e4cbb4a748841387313a72d8e7/libs/x86/libogg.so
--------------------------------------------------------------------------------
/libs/x86/libvorbis-jni.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vincentjames501/libvorbis-libogg-android/f9553444b9ee55e4cbb4a748841387313a72d8e7/libs/x86/libvorbis-jni.so
--------------------------------------------------------------------------------
/libs/x86/libvorbis-stream.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vincentjames501/libvorbis-libogg-android/f9553444b9ee55e4cbb4a748841387313a72d8e7/libs/x86/libvorbis-stream.so
--------------------------------------------------------------------------------
/libs/x86/libvorbis.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vincentjames501/libvorbis-libogg-android/f9553444b9ee55e4cbb4a748841387313a72d8e7/libs/x86/libvorbis.so
--------------------------------------------------------------------------------
/proguard_libvorbis-libogg.cfg:
--------------------------------------------------------------------------------
1 | -optimizationpasses 5
2 | -dontusemixedcaseclassnames
3 | -dontskipnonpubliclibraryclasses
4 | -dontpreverify
5 | -verbose
6 | -optimizations !code/simplification/arithmetic,!field/*,!class/merging/*
7 |
8 | -keep public class * extends android.app.Activity
9 | -keep public class * extends android.app.Application
10 | -keep public class * extends android.app.Service
11 | -keep public class * extends android.content.BroadcastReceiver
12 | -keep public class * extends android.content.ContentProvider
13 | -keep public class com.android.vending.licensing.ILicensingService
14 | -keep class org.xiph.vorbis.decoder.VorbisDecoder.** { *; }
15 | -keep class org.xiph.vorbis.encoder.VorbisEncoder.** { *; }
16 | -keep class org.xiph.vorbis.encoder.EncodeFeed.** { *; }
17 | -keep , includedescriptorclasses class org.xiph.vorbis.stream.VorbisInfo.** { *; }
18 | -keep , includedescriptorclasses class org.xiph.vorbis.stream.VorbisFileInputStream.** { *; }
19 | -keep , includedescriptorclasses class org.xiph.vorbis.stream.VorbisFileOutputStream.** { *; }
20 |
21 | -keepclasseswithmembernames class * {
22 | native ;
23 | }
24 |
25 | -keepclasseswithmembernames class * {
26 | public (android.content.Context, android.util.AttributeSet);
27 | }
28 |
29 | -keepclasseswithmembernames class * {
30 | public (android.content.Context, android.util.AttributeSet, int);
31 | }
32 |
33 | -keepclassmembers enum * {
34 | public static **[] values();
35 | public static ** valueOf(java.lang.String);
36 | }
37 |
38 | -keep class * implements android.os.Parcelable {
39 | public static final android.os.Parcelable$Creator *;
40 | }
41 |
--------------------------------------------------------------------------------
/project.properties:
--------------------------------------------------------------------------------
1 | # This file is automatically generated by Android Tools.
2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED!
3 | #
4 | # This file must be checked in Version Control Systems.
5 | #
6 | # To customize properties used by the Ant build system edit
7 | # "ant.properties", and override values to adapt the script to your
8 | # project structure.
9 | #
10 | # To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
11 | #proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
12 |
13 | # Project target.
14 | target=Google Inc.:Google APIs:10
15 |
--------------------------------------------------------------------------------
/res/drawable-hdpi/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vincentjames501/libvorbis-libogg-android/f9553444b9ee55e4cbb4a748841387313a72d8e7/res/drawable-hdpi/icon.png
--------------------------------------------------------------------------------
/res/drawable-ldpi/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vincentjames501/libvorbis-libogg-android/f9553444b9ee55e4cbb4a748841387313a72d8e7/res/drawable-ldpi/icon.png
--------------------------------------------------------------------------------
/res/drawable-mdpi/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vincentjames501/libvorbis-libogg-android/f9553444b9ee55e4cbb4a748841387313a72d8e7/res/drawable-mdpi/icon.png
--------------------------------------------------------------------------------
/res/layout/main.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
9 |
14 |
19 |
24 |
29 |
31 |
35 |
40 |
42 |
43 |
48 |
50 |
53 |
54 |
59 |
61 |
64 |
65 |
66 |
70 |
75 |
77 |
78 |
82 |
87 |
89 |
90 |
95 |
96 |
--------------------------------------------------------------------------------
/res/values/arrays.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | - 8000
5 | - 11025
6 | - 16000
7 | - 22050
8 | - 44100
9 |
10 |
11 | - Mono (1 Channel)
12 | - Stereo (2 Channels)
13 |
14 |
15 | - -0.1
16 | - 0
17 | - 0.1
18 | - 0.2
19 | - 0.3
20 | - 0.4
21 | - 0.5
22 | - 0.6
23 | - 0.7
24 | - 0.8
25 | - 0.9
26 | - 1
27 |
28 |
29 | - 32000
30 | - 96000
31 | - 128000
32 | - 160000
33 | - 192000
34 | - 256000
35 | - 320000
36 |
37 |
--------------------------------------------------------------------------------
/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | libvorbis demo
4 |
5 |
--------------------------------------------------------------------------------
/src/org/xiph/vorbis/decoder/DecodeFeed.java:
--------------------------------------------------------------------------------
1 | package org.xiph.vorbis.decoder;
2 |
3 | /**
4 | * A feed interface which raw PCM data will be written to and encoded vorbis data will be read from
5 | * User: vincent
6 | * Date: 3/27/13
7 | * Time: 2:11 PM
8 | */
9 | public interface DecodeFeed {
10 | /**
11 | * Everything was a success
12 | */
13 | public static final int SUCCESS = 0;
14 |
15 | /**
16 | * The bitstream is not ogg
17 | */
18 | public static final int INVALID_OGG_BITSTREAM = -21;
19 |
20 | /**
21 | * Failed to read first page
22 | */
23 | public static final int ERROR_READING_FIRST_PAGE = -22;
24 |
25 | /**
26 | * Failed reading the initial header packet
27 | */
28 | public static final int ERROR_READING_INITIAL_HEADER_PACKET = -23;
29 |
30 | /**
31 | * The data is not a vorbis header
32 | */
33 | public static final int NOT_VORBIS_HEADER = -24;
34 |
35 | /**
36 | * The secondary header is corrupt
37 | */
38 | public static final int CORRUPT_SECONDARY_HEADER = -25;
39 |
40 | /**
41 | * Reached a premature end of file
42 | */
43 | public static final int PREMATURE_END_OF_FILE = -26;
44 |
45 | /**
46 | * Triggered from the native {@link VorbisDecoder} that is requesting to read the next bit of vorbis data
47 | *
48 | * @param buffer the buffer to write to
49 | * @param amountToWrite the amount of vorbis data to write
50 | * @return the amount actually written
51 | */
52 | public int readVorbisData(byte[] buffer, int amountToWrite);
53 |
54 | /**
55 | * Triggered from the native {@link VorbisDecoder} that is requesting to write the next bit of raw PCM data
56 | *
57 | * @param pcmData the raw pcm data
58 | * @param amountToRead the amount available to read in the buffer
59 | */
60 | public void writePCMData(short[] pcmData, int amountToRead);
61 |
62 | /**
63 | * To be called when decoding has completed
64 | */
65 | public void stop();
66 |
67 | /**
68 | * Puts the decode feed in the reading header state
69 | */
70 | public void startReadingHeader();
71 |
72 | /**
73 | * To be called when decoding has started
74 | *
75 | * @param decodeStreamInfo the stream information of what's about to be played
76 | */
77 | public void start(DecodeStreamInfo decodeStreamInfo);
78 | }
79 |
--------------------------------------------------------------------------------
/src/org/xiph/vorbis/decoder/DecodeStreamInfo.java:
--------------------------------------------------------------------------------
1 | package org.xiph.vorbis.decoder;
2 |
3 | /**
4 | * User: vincent
5 | * Date: 3/29/13
6 | * Time: 8:17 PM
7 | */
8 | public class DecodeStreamInfo {
9 | private long sampleRate;
10 |
11 | private long channels;
12 |
13 | private String vendor;
14 |
15 | public DecodeStreamInfo(long sampleRate, long channels, String vendor) {
16 | this.sampleRate = sampleRate;
17 | this.channels = channels;
18 | this.vendor = vendor;
19 | }
20 |
21 | public long getSampleRate() {
22 | return sampleRate;
23 | }
24 |
25 | public void setSampleRate(long sampleRate) {
26 | this.sampleRate = sampleRate;
27 | }
28 |
29 | public long getChannels() {
30 | return channels;
31 | }
32 |
33 | public void setChannels(long channels) {
34 | this.channels = channels;
35 | }
36 |
37 | public String getVendor() {
38 | return vendor;
39 | }
40 |
41 | public void setVendor(String vendor) {
42 | this.vendor = vendor;
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/src/org/xiph/vorbis/decoder/VorbisDecoder.java:
--------------------------------------------------------------------------------
1 | package org.xiph.vorbis.decoder;
2 |
3 | /**
4 | * The native vorbis decoder to be used in conjunction with JNI
5 | * User: vincent
6 | * Date: 3/27/13
7 | * Time: 9:07 AM
8 | */
9 | public class VorbisDecoder {
10 |
11 | /**
12 | * Load our vorbis-jni library and other dependent libraries
13 | */
14 | static {
15 | System.loadLibrary("ogg");
16 | System.loadLibrary("vorbis");
17 | System.loadLibrary("vorbis-jni");
18 | }
19 |
20 | /**
21 | * Start decoding the data by way of a jni call
22 | *
23 | * @param decodeFeed the custom decode feed
24 | * @return the result code
25 | */
26 | public static native int startDecoding(DecodeFeed decodeFeed);
27 | }
28 |
--------------------------------------------------------------------------------
/src/org/xiph/vorbis/encoder/EncodeFeed.java:
--------------------------------------------------------------------------------
1 | package org.xiph.vorbis.encoder;
2 |
3 | /**
4 | * This feed is to be used by the native {@link VorbisEncoder} which will read raw pcm data and write encoded vorbis
5 | * data.
6 | * User: vincent
7 | * Date: 3/27/13
8 | * Time: 2:11 PM
9 | */
10 | public interface EncodeFeed {
11 | /**
12 | * Everything was a success
13 | */
14 | public static final int SUCCESS = 0;
15 |
16 | /**
17 | * If there was an error initializing the encoder
18 | */
19 | public static final int ERROR_INITIALIZING = -44;
20 |
21 | /**
22 | * Triggered by the native {@link VorbisEncoder} when it needs to read raw pcm data
23 | *
24 | * @param pcmDataBuffer the buffer to write the raw pcm data to
25 | * @param amountToWrite the amount of pcm data to write
26 | * @return how much was actually written, 0
to stop the native {@link VorbisEncoder}
27 | */
28 | public long readPCMData(byte[] pcmDataBuffer, int amountToWrite);
29 |
30 | /**
31 | * Triggered by the native {@link VorbisEncoder} when encoded vorbis data is ready to be written
32 | *
33 | * @param vorbisData the encoded vorbis data
34 | * @param amountToRead the amount of encoded vorbis data that can be read
35 | * @return how much was actually written
36 | */
37 | public int writeVorbisData(byte[] vorbisData, int amountToRead);
38 |
39 | /**
40 | * To be called by the native encoder notifying the encode feed is complete
41 | */
42 | public void stop();
43 |
44 | /**
45 | * To be called to stop the encoder
46 | */
47 | public void stopEncoding();
48 |
49 | /**
50 | * To be called when the encoding has started
51 | */
52 | public void start();
53 | }
54 |
--------------------------------------------------------------------------------
/src/org/xiph/vorbis/encoder/VorbisEncoder.java:
--------------------------------------------------------------------------------
1 | package org.xiph.vorbis.encoder;
2 |
3 | /**
4 | * The native encoder to interface via JNI
5 | * User: vincent
6 | * Date: 3/27/13
7 | * Time: 9:07 AM
8 | */
9 | public class VorbisEncoder {
10 | /**
11 | * Load our vorbis-jni library as well as the other dependent libraries
12 | */
13 | static {
14 | System.loadLibrary("ogg");
15 | System.loadLibrary("vorbis");
16 | System.loadLibrary("vorbis-jni");
17 | }
18 |
19 | /**
20 | * The native JNI method call to the encoder to start encoding raw pcm data to encoded vorbis data
21 | *
22 | * @param sampleRate the sample rate which the incoming pcm data will arrive
23 | * @param numberOfChannels the number of channels
24 | * @param quality the quality to encode the output vorbis data
25 | * @param encodeFeed the custom encoder feed
26 | */
27 | public static native int startEncodingWithQuality(long sampleRate, long numberOfChannels, float quality, EncodeFeed encodeFeed);
28 |
29 | /**
30 | * The native JNI method call to the encoder to start encoding raw pcm data to encoded vorbis data
31 | *
32 | * @param sampleRate the sample rate which the incoming pcm data will arrive
33 | * @param numberOfChannels the number of channels
34 | * @param bitrate the bitrate of the output vorbis data
35 | * @param encodeFeed the custom encoder feed
36 | */
37 | public static native int startEncodingWithBitrate(long sampleRate, long numberOfChannels, long bitrate, EncodeFeed encodeFeed);
38 | }
39 |
--------------------------------------------------------------------------------
/src/org/xiph/vorbis/stream/AudioInputStream.java:
--------------------------------------------------------------------------------
1 | package org.xiph.vorbis.stream;
2 |
3 | import java.io.Closeable;
4 | import java.io.IOException;
5 | import java.io.InputStream;
6 |
7 | public abstract class AudioInputStream extends InputStream implements Closeable {
8 | public abstract void close() throws IOException;
9 |
10 | public int read(short[] pcmBuffer) throws IOException {
11 | return this.read(pcmBuffer, 0, pcmBuffer.length);
12 | }
13 |
14 | public abstract int read(short[] pcmBuffer, int offset, int length) throws IOException;
15 |
16 |
17 | @Override
18 | public int read() throws IOException {
19 | short buf[] = new short[1];
20 | if ( this.read(buf, 0, 1) == -1) return -1;
21 | else return buf[0];
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/src/org/xiph/vorbis/stream/AudioOutputStream.java:
--------------------------------------------------------------------------------
1 | package org.xiph.vorbis.stream;
2 |
3 | import java.io.Closeable;
4 | import java.io.IOException;
5 | import java.io.OutputStream;
6 |
7 | public abstract class AudioOutputStream extends OutputStream implements Closeable {
8 |
9 | @Override
10 | public void write(final int buf) throws IOException {
11 | short[] buffer = new short[1];
12 | buffer[0] = (short) buf;
13 | this.write(buffer, 0, buffer.length);
14 | }
15 |
16 | public void write(final short[] buffer) throws IOException {
17 | this.write(buffer, 0, buffer.length);
18 | }
19 |
20 | public abstract void write(final short[] buffer, int offset, int length)
21 | throws IOException;
22 |
23 | public abstract int getSampleRate();
24 |
25 | @Override
26 | public abstract void close() throws IOException;
27 | }
28 |
--------------------------------------------------------------------------------
/src/org/xiph/vorbis/stream/VorbisFileInputStream.java:
--------------------------------------------------------------------------------
1 | package org.xiph.vorbis.stream;
2 |
3 | import java.io.IOException;
4 |
5 | public class VorbisFileInputStream extends AudioInputStream {
6 |
7 | private final VorbisInfo info;
8 |
9 | public VorbisInfo getInfo() {
10 | return info;
11 | }
12 |
13 | private final int oggStreamIdx;
14 |
15 | static {
16 | System.loadLibrary("ogg");
17 | System.loadLibrary("vorbis");
18 | System.loadLibrary("vorbis-stream");
19 | }
20 |
21 | /**
22 | * Opens a file for reading and parses any comments out of the file header.
23 | */
24 | public VorbisFileInputStream(String fname) throws IOException {
25 | info = new VorbisInfo();
26 | oggStreamIdx = this.create(fname, info);
27 | }
28 |
29 | @Override
30 | public void close() throws IOException {
31 | this.closeStreamIdx(oggStreamIdx);
32 | }
33 |
34 | /**
35 | * Returns interleaved PCM data from the vorbis stream.
36 | *
37 | * @param pcmBuffer
38 | * @param offset
39 | * @param length
40 | * @return
41 | * @throws IOException
42 | */
43 | @Override
44 | public int read(short[] pcmBuffer, int offset, int length) throws IOException {
45 | return this.readStreamIdx(oggStreamIdx, pcmBuffer, offset, length);
46 | }
47 |
48 | private native int create(String fname, VorbisInfo info) throws IOException;
49 |
50 | private native void closeStreamIdx(int sidx) throws IOException;
51 |
52 | /**
53 | * This just returns all the channels interleaved together. I assume this is how android wants it.
54 | *
55 | * @param pcm
56 | * @return
57 | * @throws IOException
58 | */
59 | private native int readStreamIdx(int sidx, short[] pcm, int offset, int size) throws IOException;
60 |
61 | /**
62 | * Skips over the number of samples specified. This skip doesn't account for channels.
63 | *
64 | * @param samples
65 | * @return
66 | * @throws IOException
67 | */
68 | private native long skipStreamIdx(int sidx, long samples) throws IOException;
69 |
70 | }
71 |
--------------------------------------------------------------------------------
/src/org/xiph/vorbis/stream/VorbisFileOutputStream.java:
--------------------------------------------------------------------------------
1 | package org.xiph.vorbis.stream;
2 |
3 | import java.io.IOException;
4 |
5 | /**
6 | * Converts incoming PCM Audio Data into OGG data into a file. This will be implemented using the open source BSD-licensed stuff from Xiph.org.
7 | *
8 | * NOTE: This implementation has a limitation of MAX_STREAMS concurrent output streams. When i wrote this, it was set to 8. Check in
9 | * vorbis-fileoutputstream.c to see what it is set to.
10 | *
11 | */
12 | public class VorbisFileOutputStream extends AudioOutputStream {
13 | // The index into native memory where the ogg stream info is stored.
14 | private final int oggStreamIdx;
15 | private VorbisInfo info;
16 | private static final int VORBIS_BLOCK_SIZE = 1024;
17 |
18 | static {
19 | System.loadLibrary("ogg");
20 | System.loadLibrary("vorbis");
21 | System.loadLibrary("vorbis-stream");
22 | }
23 |
24 | public VorbisFileOutputStream(String fname, VorbisInfo s) throws IOException {
25 | info = s;
26 | oggStreamIdx = this.create(fname, s);
27 | }
28 |
29 | public VorbisFileOutputStream(String fname) throws IOException {
30 | oggStreamIdx = this.create(fname, new VorbisInfo());
31 | }
32 |
33 | @Override
34 | public void close() throws IOException {
35 | this.closeStreamIdx(this.oggStreamIdx);
36 | }
37 |
38 | /**
39 | * Write PCM data to ogg. This assumes that you pass your streams in interleaved.
40 | *
41 | * @param buffer
42 | * @param offset
43 | * @param length
44 | * @return
45 | * @throws IOException
46 | */
47 | @Override
48 | public void write(final short[] buffer, int offset, int length) throws IOException {
49 | this.writeStreamIdx(this.oggStreamIdx, buffer, offset, length);
50 | }
51 |
52 | private native int writeStreamIdx(int idx, short[] pcmdata, int offset, int size) throws IOException;
53 |
54 | private native void closeStreamIdx(int idx) throws IOException;
55 |
56 | private native int create(String path, VorbisInfo s) throws IOException;
57 |
58 | @Override
59 | public int getSampleRate() {
60 | return info.sampleRate;
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/src/org/xiph/vorbis/stream/VorbisInfo.java:
--------------------------------------------------------------------------------
1 | package org.xiph.vorbis.stream;
2 |
3 | /**
4 | * A class used to pass vorbis file info to the encoder and find out what kind of file was received by the decoder.
5 | *
6 | * Currently, the vorbis file encoder/decoder only supports 16-bit samples. There are no plans by me to ever add 8-bit. Defaults are set to whatever I
7 | * wanted to use for the project i wrote this for.
8 | *
9 | */
10 | public class VorbisInfo {
11 | /**
12 | * The number of channels to be encoded. For your sake, here are the official channel positions for the first five according to Xiph.org. one
13 | * channel - the stream is monophonic two channels - the stream is stereo. channel order: left, right three channels - the stream is a 1d-surround
14 | * encoding. channel order: left, center, right four channels - the stream is quadraphonic surround. channel order: front left, front right, rear
15 | * left, rear right five channels - the stream is five-channel surround. channel order: front left, center, front right, rear left, rear right
16 | */
17 | public int channels = 1;
18 |
19 | /**
20 | * The number of samples per second of pcm data.
21 | */
22 | public int sampleRate = 44100;
23 |
24 | /**
25 | * The recording quality of the encoding. This is not currently set for the decoder. The range goes from -.1 (worst) to 1 (best)
26 | */
27 | public float quality = 0.4f;
28 |
29 | /**
30 | * the total number of samples from the recording. This field means nothing to the encoder.
31 | */
32 | public long length;
33 |
34 | }
35 |
--------------------------------------------------------------------------------