First off, are you sure that imageData_in is "length" long? My JNI is a little rusty, but I recall that some of the JNI array ops "memory map" the arrays (on some platforms), tying up considerable additional pieces of address space. But I can't offhand think how that might factor in here.
On Jul 15, 1:56 pm, philip hays <[email protected]> wrote: > Temporary purpose of method is to take in a fixed byte array (Which is > a 8bit grey scale image) only take a region of the byte array, then > return that region. I have successfully used setByteArrayRegion to > take the incoming array(From Java code) and assign it to the outgoing > "imageData" with the correct size(back to Java code). BUT: I desire > to use getByteArrayRegion so i can choose a starting point on the > Incoming array, nto a starting point on the outgoing array. There is > a few bytes of an artifact in the beginning of the image i would like > to avoid. > > Errors: When used in this way currently, imageData_out becomes much > larger than originally assigned, 10 to 20 times larger. ALSO, I do > get a Seg fault at the same time (See bottom). this is likely what is > causing the issue. Its been frustrating me for days because it makes > no sense for it to do this when the other method works perfect. > > If anyone has any idea or place i could look....Thanks in advance. I > have dug through many sites and forums and i cant understand how i > could be using it wrong. Eventually the byte data will be operated on > in the c code. > > Code Snippet containing Issue: > > JNIEXPORT jbyteArray JNICALL > Java_com_android_CameraView_CameraView_sendByteData( JNIEnv* env, > jobject obj, jbyteArray imageData_in, jint width, jint height) > { > jint length = width * height; > __android_log_write(ANDROID_LOG_DEBUG, LOG_TAG, "arraysize created > %d"); > > jbyte* imageData_out = (*env)->NewByteArray(env, length); > if((*env)->GetArrayLength(env, imageData_out) > length){ > __android_log_write(ANDROID_LOG_DEBUG, LOG_TAG, > "Array is too large > 1"); > } > __android_log_write(ANDROID_LOG_DEBUG, LOG_TAG, "New byte array to > buffer input created"); > > (*env)->GetByteArrayRegion(env, imageData_in, 0, length, > (jbyte*)imageData_out); > __android_log_write(ANDROID_LOG_DEBUG, LOG_TAG, "Using > GetByteArrayRegion"); > > if((*env)->GetArrayLength(env, imageData_out) > length){ > __android_log_write(ANDROID_LOG_DEBUG, LOG_TAG, "Array is too > large > 2"); > } > > return imageData_out; > > } > > 07-15 14:47:43.412: DEBUG/TIOMX_CORE(987): Found component > OMX.TI.JPEG.Encoder with refCount 0 > 07-15 14:47:43.545: INFO/DEBUG(5756): *** *** *** *** *** *** *** *** > *** *** *** *** *** *** *** *** > 07-15 14:47:43.545: INFO/DEBUG(5756): Build fingerprint: 'verizon/ > voles/sholes/sholes:2.1-update1/ESE81/29593:user/release-keys' > 07-15 14:47:43.545: INFO/DEBUG(5756): pid: 6120, tid: 6125 >>> > com.android.CameraView <<< > 07-15 14:47:43.545: INFO/DEBUG(5756): signal 11 (SIGSEGV), fault addr > 251a082a > 07-15 14:47:43.553: INFO/DEBUG(5756): r0 00000000 r1 45ebe808 r2 > 251a082a r3 dead10cc > 07-15 14:47:43.553: INFO/DEBUG(5756): r4 251a0812 r5 0000003b r6 > 44827fb8 r7 45ebe808 > 07-15 14:47:43.553: INFO/DEBUG(5756): r8 40009408 r9 42c0f000 10 > 0000001b fp 45ebea64 > 07-15 14:47:43.553: INFO/DEBUG(5756): ip ad082080 sp 45ebe7d8 lr > ad0405cd pc afe0e9c4 cpsr 20000010 > 07-15 14:47:43.670: INFO/DEBUG(5756): #00 pc 0000e9c4 / > system/lib/libc.so > 07-15 14:47:43.670: INFO/DEBUG(5756): #01 pc 000405ca / > system/lib/libdvm.so > 07-15 14:47:43.670: INFO/DEBUG(5756): #02 pc 000170b8 / > system/lib/libdvm.so > 07-15 14:47:43.670: INFO/DEBUG(5756): #03 pc 00015a98 / > system/lib/libdvm.so > 07-15 14:47:43.686: INFO/DEBUG(5756): #04 pc 00015d94 / > system/lib/libdvm.so > 07-15 14:47:43.686: INFO/DEBUG(5756): #05 pc 00016ff4 / > system/lib/libdvm.so > 07-15 14:47:43.686: INFO/DEBUG(5756): #06 pc 000163a4 / > system/lib/libdvm.so > 07-15 14:47:43.686: INFO/DEBUG(5756): #07 pc 00016b60 / > system/lib/libdvm.so > 07-15 14:47:43.686: INFO/DEBUG(5756): #08 pc 00016ce0 / > system/lib/libdvm.so > 07-15 14:47:43.686: INFO/DEBUG(5756): #09 pc 00057b64 / > system/lib/libdvm.so > 07-15 14:47:43.686: INFO/DEBUG(5756): #10 pc 00057cc0 / > system/lib/libdvm.so > 07-15 14:47:43.693: INFO/DEBUG(5756): #11 pc 0003ad66 / > system/lib/libdvm.so > 07-15 14:47:43.693: INFO/DEBUG(5756): #12 pc 0004c402 / > system/lib/libandroid_runtime.so > 07-15 14:47:43.701: INFO/DEBUG(5756): #13 pc 0004c5de / > system/lib/libandroid_runtime.so > 07-15 14:47:43.701: INFO/DEBUG(5756): #14 pc 0001c3b2 / > system/lib/libui.so > 07-15 14:47:43.701: INFO/DEBUG(5756): #15 pc 00022ed4 / > system/lib/libui.so > 07-15 14:47:43.701: INFO/DEBUG(5756): code around pc: > 07-15 14:47:43.701: INFO/DEBUG(5756): afe0e9b4 e1a02000 e30130cc > e34d3ead e3a00000 > 07-15 14:47:43.701: INFO/DEBUG(5756): afe0e9c4 e5823000 e12fff1e > e1a02000 e3a03000 > 07-15 14:47:43.701: INFO/DEBUG(5756): afe0e9d4 e1a00003 e5823000 > e12fff1e e1a02000 > 07-15 14:47:43.701: INFO/DEBUG(5756): code around lr: > 07-15 14:47:43.701: INFO/DEBUG(5756): ad0405bc 6804b570 60032301 > 0018f104 e8a2f7ce > 07-15 14:47:43.709: INFO/DEBUG(5756): ad0405cc 001cf104 ea8af7ce > 46206a25 22242100 > 07-15 14:47:43.709: INFO/DEBUG(5756): ad0405dc e9a6f7ce bd706225 > bf004808 4a08a100 > 07-15 14:47:43.709: INFO/DEBUG(5756): stack: > 07-15 14:47:43.709: INFO/DEBUG(5756): 45ebe798 ad067770 /system/ > lib/libdvm.so > 07-15 14:47:43.709: INFO/DEBUG(5756): 45ebe79c 0000000e > 07-15 14:47:43.709: INFO/DEBUG(5756): 45ebe7a0 45ebe7c4 > 07-15 14:47:43.709: INFO/DEBUG(5756): 45ebe7a4 0000003d > 07-15 14:47:43.709: INFO/DEBUG(5756): 45ebe7a8 4479f018 /dev/ > ashmem/mspace/dalvik-heap/2 (deleted) > 07-15 14:47:43.709: INFO/DEBUG(5756): 45ebe7ac 447b6978 /dev/ > ashmem/mspace/dalvik-heap/2 (deleted) > 07-15 14:47:43.709: INFO/DEBUG(5756): 45ebe7b0 00000020 > 07-15 14:47:43.709: INFO/DEBUG(5756): 45ebe7b4 45ebe99c > 07-15 14:47:43.709: INFO/DEBUG(5756): 45ebe7b8 400092e0 /dev/ > ashmem/mspace/dalvik-heap/zygote/0 (deleted) > 07-15 14:47:43.709: INFO/DEBUG(5756): 45ebe7bc 447b6978 /dev/ > ashmem/mspace/dalvik-heap/2 (deleted) > 07-15 14:47:43.709: INFO/DEBUG(5756): 45ebe7c0 00000066 > 07-15 14:47:43.717: INFO/DEBUG(5756): 45ebe7c4 ad04488f /system/ > lib/libdvm.so > 07-15 14:47:43.717: INFO/DEBUG(5756): 45ebe7c8 00000065 > 07-15 14:47:43.717: INFO/DEBUG(5756): 45ebe7cc 4479f018 /dev/ > ashmem/mspace/dalvik-heap/2 (deleted) > 07-15 14:47:43.717: INFO/DEBUG(5756): 45ebe7d0 df002777 > 07-15 14:47:43.717: INFO/DEBUG(5756): 45ebe7d4 e3a070ad > 07-15 14:47:43.717: INFO/DEBUG(5756): #01 45ebe7d8 00000065 > 07-15 14:47:43.717: INFO/DEBUG(5756): 45ebe7dc 0000003b > 07-15 14:47:43.717: INFO/DEBUG(5756): 45ebe7e0 44827fb8 /dev/ > ashmem/mspace/dalvik-heap/2 (deleted) > 07-15 14:47:43.717: INFO/DEBUG(5756): 45ebe7e4 ad0170bc /system/ > lib/libdvm.so > 07-15 14:47:43.881: DEBUG/(987): JpegEncLCML_Callback():2951 in > EMMCodecDspError EMMCodec Args -> 1, 500 > 07-15 14:47:43.897: DEBUG/TIOMX_CORE(987): Found matching > pHandle(0x80520) at index 0 with refCount 1 > 07-15 14:47:43.897: DEBUG/TIOMX_CORE(987): deinit count = 0 > 07-15 14:47:43.904: DEBUG/CameraHal(987): Received jpg 0x43734000 size > 1322010 > 07-15 14:47:44.154: DEBUG/Zygote(986): Process 6120 terminated by > signal (11) > 07-15 14:47:44.178: INFO/WindowManager(1033): WIN DEATH: > Window{448de0a0 com.android.CameraView/ > com.android.CameraView.CameraView paused=false} > 07-15 14:47:44.186: INFO/ActivityManager(1033): Process > com.android.CameraView (pid 6120) has died. > 07-15 14:47:44.196: DEBUG/CameraService(987): Client::~Client E (pid > 987, client 0x83088) > 07-15 14:47:44.209: INFO/WindowManager(1033): WIN DEATH: > Window{449291d8 SurfaceView paused=false} > 07-15 14:47:44.209: DEBUG/CameraService(987): Client::disconnect() E > (pid 987 client 0x83088) -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

