alexandruc / android-bpg Goto Github PK
View Code? Open in Web Editor NEWSamples of using the BPG image format on Android
License: MIT License
Samples of using the BPG image format on Android
License: MIT License
Hi,I need your help,I'm not good at clang, so I don't know what to do。
1.I test this library in my project, The vast majority of mobile phones can work. but I do monkey test on someone, it reports Native Crash.
2.I used https://github.com/nostra13/Android-Universal-Image-Loader and Customize my own Downloader(using bpg decoder https://github.com/nostra13/Android-Universal-Image-Loader/blob/master/sample/src/main/java/com/nostra13/universalimageloader/sample/ext/OkHttpImageDownloader.java )
3.I consulted a lot of information and test ,the crash line is this method(decoder.c-->bmp_save_to_buffer()-->free(rgb_line) ) , I find this https://groups.google.com/forum/#!topic/android-ndk/jQg6DM6-D6o
please help me , I don't know how to solve.
Monkey log:
// CRASH: com.xmtj.mkz (pid 24884)
// Short Msg: Native crash
// Long Msg: Native crash: Segmentation fault
// Build Label: SMARTISAN/msm8916_32:5.1.1/LMY47V/59:user/release-keys
// Build Changelist: 59
// Build Time: 1484324676000
// *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
// Build fingerprint: 'SMARTISAN/msm8916_32:5.1.1/LMY47V/59:user/release-keys'
// Revision: '0'
// ABI: 'arm'
// pid: 24884, tid: 25593, name: uil-pool-1-thre >>> com.xmtj.mkz <<<
// signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0xdeadbaad
// Abort message: 'invalid address or address of corrupt block 0xb83b4cb0 passed to dlfree'
// r0 00000000 r1 b6e89dec r2 deadbaad r3 00000000
// r4 b83b4cb0 r5 b6e8b0f8 r6 00000000 r7 00000200
// r8 00000db5 r9 98794838 sl 00001de4 fp 00000db5
// ip 00000000 sp 98794780 lr b6e5bdaf pc b6e5bdb0 cpsr 680f0030
//
// backtrace:
// #00 pc 00028db0 /system/lib/libc.so (dlfree+1239)
// #1 pc 0000f2b3 /system/lib/libc.so (free+10)
// #2 pc 00005a99 /data/app/com.xmtj.mkz-1/lib/arm/libbpg_decoder.so (decode_buffer+412)
// #3 pc 00005de5 /data/app/com.xmtj.mkz-1/lib/arm/libbpg_decoder.so (Java_com_xmtj_bpgdecoder_DecoderWrapper_decodeBuffer+108)
// #4 pc 0066c7a5 /data/dalvik-cache/arm/data@[email protected]@[email protected]
//
// Injection Failed
** Monkey aborted due to error.
Wondering if this project is going to be maintained in the future.
-----------use bpg_decoder get a bitmap:
public static Bitmap getDecodedBpgBitmap(Context context, File bpgFile) throws FileNotFoundException {
Bitmap bm = null;
try {
FileInputStream fis = new FileInputStream(bpgFile);
byte[] byteArray = toByteArray(fis);
byte[] decBuffer = null;
int decBufferSize = 0;
decBuffer = DecoderWrapper.decodeBuffer(byteArray, byteArray.length);
decBufferSize = decBuffer.length;
BitmapFactory.Options options = new BitmapFactory.Options();
options.inPreferredConfig = Bitmap.Config.ARGB_8888;
options.inDither=false;
if (decBuffer != null) {
bm = BitmapFactory.decodeByteArray(decBuffer, 0, decBufferSize,options);
}
} catch (IOException ex) {
TLog.e("getDecodedBpgBitmap", "Failed to convert image to byte array");
}
return bm;
}
--------------and save the bitmap to PNG ,but the transparent background became to black.
bpgBitmap.compress(Bitmap.CompressFormat.PNG, 100, byteArrayOutputStream)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.