android-ndk

Fast way to decode JPEG image

徘徊边缘 提交于 2020-01-03 08:52:33
问题 I need to decode (unpack into bitmap) pretty small (about 1200 * 1200) JPEG. The problem is I need to do it quickly. I have tried libjpeg, and it's quite slow. I have also tried BitmapFactory.decodeByteArray - it's a bit faster, but still not fast enough. What are another options? A native (C++) library is much preferred. P.S. My JPEGs are created directly in memory. P.P.S. I wonder how come libjpeg is slower than BitmapFactory.decodeByteArray. 回答1: Try Libjpeg Turbo: http://libjpeg-turbo

Fast way to decode JPEG image

谁说胖子不能爱 提交于 2020-01-03 08:51:30
问题 I need to decode (unpack into bitmap) pretty small (about 1200 * 1200) JPEG. The problem is I need to do it quickly. I have tried libjpeg, and it's quite slow. I have also tried BitmapFactory.decodeByteArray - it's a bit faster, but still not fast enough. What are another options? A native (C++) library is much preferred. P.S. My JPEGs are created directly in memory. P.P.S. I wonder how come libjpeg is slower than BitmapFactory.decodeByteArray. 回答1: Try Libjpeg Turbo: http://libjpeg-turbo

Is this a bug in GCC or is my code wrong?

谁都会走 提交于 2020-01-03 08:49:15
问题 I have this C code: int test(signed char anim_col) { if (anim_col >= 31) { return 1; } else if (anim_col <= -15) { return -2; } return 0; } That compiles to the following thumb code with -Os -mthumb using Android NDK r4b: test: mov r3, #1 cmp r0, #30 bgt .L3 mov r3, #0 add r0, r0, #14 bge .L3 mov r3, #2 neg r3, r3 .L3: mov r0, r3 bx lr But with the latest Android NDK r5 it compiles to this broken code: test: mov r3, #1 cmp r0, #30 bgt .L3 lsl r0, r0, #24 lsr r0, r0, #24 mov r3, #0 cmp r0,

Android NDK chrono epoch is not correct (std::chrono::high_resolution_clock)

风格不统一 提交于 2020-01-03 07:15:54
问题 The code below does not print epoch. typedef std::chrono::high_resolution_clock Clock; typedef std::chrono::milliseconds Milliseconds; auto res = std::chrono::duration_cast<Milliseconds>(Clock::now().time_since_epoch()).count(); std::stringstream ss; ss << res; printf(">>>>>>>>>>> TimeUtiles::getTimestamp %s", ss.str().c_str()); I use NDK r9d and selected NDK toolchain version was 4.8 ! EDIT: Changed std::chrono::high_resolution_clock to std::chrono::system_clock and it worked. Why? 回答1:

Android NDK chrono epoch is not correct (std::chrono::high_resolution_clock)

蹲街弑〆低调 提交于 2020-01-03 07:15:10
问题 The code below does not print epoch. typedef std::chrono::high_resolution_clock Clock; typedef std::chrono::milliseconds Milliseconds; auto res = std::chrono::duration_cast<Milliseconds>(Clock::now().time_since_epoch()).count(); std::stringstream ss; ss << res; printf(">>>>>>>>>>> TimeUtiles::getTimestamp %s", ss.str().c_str()); I use NDK r9d and selected NDK toolchain version was 4.8 ! EDIT: Changed std::chrono::high_resolution_clock to std::chrono::system_clock and it worked. Why? 回答1:

High Performance Audio Cracking / Prevent a CPU core from downclocking

感情迁移 提交于 2020-01-03 05:49:27
问题 This may be very specific, still trying to ask: I'm founder of Heat Synthesizer, a software music synthesizer for Android. (https://play.google.com/store/apps/details?id=com.nilsschneider.heat.demo) This app generates audio signals in realtime and needs to do heavy math calculations to do so. Having seen the talk on Google I/O 2013 about "High Performance Audio on Android" (http://www.youtube.com/watch?v=d3kfEeMZ65c), I was excited to implement it as they suggested, but I keep having problems

Checksum value of classes.dex keep changing with Dexguard for every build

|▌冷眼眸甩不掉的悲伤 提交于 2020-01-03 05:20:39
问题 I do check sum of classes.dex in native code as indicated here: Check .apk-signature in C/native Code Calculate checksum of classes.dex compare with hardcoded value - xxx if it's true, pass and go on if it's not true, exit the app What I do is log the checksum value for the first build, then change the if (checksum == xxx) in native code to be the same as the logged value. However, with using Dexguard, the checksum is different for every different build, means that if I change xxx, and

Checksum value of classes.dex keep changing with Dexguard for every build

浪尽此生 提交于 2020-01-03 05:20:27
问题 I do check sum of classes.dex in native code as indicated here: Check .apk-signature in C/native Code Calculate checksum of classes.dex compare with hardcoded value - xxx if it's true, pass and go on if it's not true, exit the app What I do is log the checksum value for the first build, then change the if (checksum == xxx) in native code to be the same as the logged value. However, with using Dexguard, the checksum is different for every different build, means that if I change xxx, and

Android NDK The system cannot find the path specified

浪子不回头ぞ 提交于 2020-01-03 05:06:16
问题 This is a follow up question to this question: The system cannot find the path specified (ndk_build.cmd) I got the same problem - I have extracted the NDK folder, set the path in Eclipse menu: Window->Preferences->Android->NDK, but I keep getting the error "The system cannot find the path specified ". Of course the path does exist. I tried using a builder but it gave me the same result for that new builder. Even if I go to the NDK folder via CMD and try to run it directly, cmd prompts me the

Android NDK socket connect() returning 0 when it should fail whilst on 3g

橙三吉。 提交于 2020-01-03 05:00:06
问题 I have written a socket in the android NDK and a server in c. It is able to connect to the server fine. However if the server is down or I try to get it to connect to a different random IP the call to connect still returns 0 when it should return -1. Here is the code for the client: #include <stdio.h> #include <jni.h> #include <netdb.h> #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> #include <android/log.h> #include <unistd.h> #define APPNAME "MyApp" #define logcat(...