Skip to content

Commit 93397b7

Browse files
committed
integrate ggml's excellent and amazing whisper.cpp to kantv ---- step5
refine whispercpp's JNI code and native code finish whispercpp inference benchmark refine the ASRFragment.java(more make sense with UI status) I successfully integrated FFmpeg into whisper.cpp for the first time
1 parent 2d7febb commit 93397b7

File tree

178 files changed

+36702
-655
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

178 files changed

+36702
-655
lines changed

build/public.sh

+1
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ function dump_global_envs()
149149
if [ "${BUILD_TARGET}" = "android" ]; then
150150
echo -e "\n"
151151
echo -e "ANDROID_NDK: ${ANDROID_NDK}"
152+
echo -e "LOCAL_WHISPERCPP_PATH: ${LOCAL_WHISPERCPP_PATH}"
152153
echo -e "UPSTREAM_WHISPERCPP_PATH: ${UPSTREAM_WHISPERCPP_PATH}"
153154
echo -e "\n"
154155
fi

cdeosplayer/cdeosplayer-lib/src/main/java/cdeos/media/player/CDEUtils.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -812,7 +812,7 @@ public static String getDataPath() {
812812
CDELog.j(TAG, "sdcard free size:" + mKANTVDRM.ANDROID_JNI_GetDiskFreeSize(sdcardPath.getAbsolutePath()));
813813
String dataDirectoryPath = null;
814814
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.LOLLIPOP_MR1) {
815-
dataDirectoryPath = Environment.getExternalStorageDirectory().getAbsolutePath() + File.separator + "kantv";
815+
dataDirectoryPath = Environment.getExternalStorageDirectory().getAbsolutePath() + File.separator + "kantv" + File.separator;
816816
} else {
817817
dataDirectoryPath = Environment.getExternalStorageDirectory().getAbsolutePath() +
818818
File.separator + "Android" + File.separator + "data" + File.separator + "com.cdeos.kantv" + File.separator + "files" + File.separator + "kantv";
@@ -2217,7 +2217,7 @@ public static String formatedDurationMilli(long duration) {
22172217
}
22182218
}
22192219

2220-
public static String formatedSize(long bytes) {
2220+
public static String formattedSize(long bytes) {
22212221

22222222
if (bytes <= 0) {
22232223
return "0 Bytes";

cdeosplayer/cdeosplayer-lib/src/main/java/cdeos/media/player/KANTVBenchmarkType.java

+1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ public class KANTVBenchmarkType
2727
public static final int BENCHMARK_SVT_AV1 = 4;
2828

2929

30+
//borrow from FFmpeg
3031
public static final int AV_PIX_FMT_YUV420P = 0; ///< planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
3132
public static final int AV_PIX_FMT_YUYV422 = 1; ///< packed YUV 4:2:2, 16bpp, Y0 Cb Y1 Cr
3233
public static final int AV_PIX_FMT_RGB24 = 2; ///< packed RGB 8:8:8, 24bpp, RGBRGB...

cdeosplayer/cdeosplayer-lib/src/main/java/cdeos/media/player/KANTVEvent.java

+7-5
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,13 @@ final public class KANTVEvent {
3939
public final static int KANTV_INFO_STATUS = 14;
4040

4141
public final static int KANTV_INFO_ASR_INIT = 15;
42-
public final static int KANTV_INFO_ASR_FINALiZE = 16;
42+
public final static int KANTV_INFO_ASR_FINALIZE = 16;
4343

4444
public final static int KANTV_INFO_ASR_START = 17;
4545
public final static int KANTV_INFO_ASR_STOP = 18;
46-
public final static int KANTV_INFO_GGML_INTERNAL = 19;
47-
public final static int KANTV_INFO_WHISPERCPP_INTERNAL = 20;
46+
public final static int KANTV_INFO_ASR_GGML_INTERNAL = 19;
47+
public final static int KANTV_INFO_ASR_WHISPERCPP_INTERNAL = 20;
48+
public final static int KANTV_INFO_ASR_RESULT = 21;
4849

4950
public final static int KANTV_ERROR_PREVIEW_START = 0;
5051
public final static int KANTV_ERROR_PREVIEW_STOP = 1;
@@ -60,8 +61,9 @@ final public class KANTVEvent {
6061
public final static int KANTV_ERROR_ASR_FINALiZE = 12;
6162
public final static int KANTV_ERROR_ASR_START = 13;
6263
public final static int KANTV_ERROR_ASR_STOP = 14;
63-
public final static int KANTV_ERROR_GGML_INTERNAL = 15;
64-
public final static int KANTV_ERROR_WHISPERCPP_INTERNAL = 16;
64+
public final static int KANTV_ERROR_ASR_GGML_INTERNAL = 15;
65+
public final static int KANTV_ERROR_ASR_WHISPERCPP_INTERNAL = 16;
66+
public final static int KANTV_ERROR_ASR_RESULT = 17;
6567

6668
public static native int kantv_anti_tamper();
6769
}

cdeosplayer/cdeosplayer-lib/src/main/java/cdeos/media/player/KANTVMgr.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ public void handleMessage(Message msg)
153153
}
154154
catch (Exception e)
155155
{
156-
CDELog.j(TAG, "exception occured in event handler");
156+
CDELog.j(TAG, "exception occurred in event handler");
157157
}
158158
}
159159
}
@@ -235,6 +235,7 @@ public void close()
235235
catch (Exception e)
236236
{
237237
e.printStackTrace();
238+
CDELog.j(TAG, "failed to initialize KANTVMgr: " + e.toString());
238239
}
239240
}
240241

cdeosplayer/cdeosplayer-lib/src/main/java/org/ggml/whispercpp/CpuInfo.java

-125
This file was deleted.

cdeosplayer/cdeosplayer-lib/src/main/java/org/ggml/whispercpp/WhisperContext.java

-112
This file was deleted.

cdeosplayer/cdeosplayer-lib/src/main/java/org/ggml/whispercpp/WhisperCpuConfig.java

-14
This file was deleted.

cdeosplayer/cdeosplayer-lib/src/main/java/org/ggml/whispercpp/WhisperLib.java

-44
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
//TODO: re-write entire whispercpp.java with standard Android JNI specification
2+
// interaction between KANTVMgr.java and whispercpp.java
3+
4+
package org.ggml.whispercpp;
5+
6+
public class whispercpp {
7+
private static final String TAG = whispercpp.class.getName();
8+
9+
public static native String getSystemInfo();
10+
11+
public static native String benchMemcpy(int nThreadCounts);
12+
13+
public static native String benchMulMat(int nThreadCounts);
14+
15+
public static native void set_mulmat_benchmark_status(int bExitBenchmark);
16+
17+
public static native String transcribe_from_file(String modelPath, String audioFile, int nThreadCounts);
18+
}

0 commit comments

Comments
 (0)