简体   繁体   中英

How to get the jpeg image array from an unsigned char* array?

I am doing android native development using libjpeg9. The image data I get from android camera is compressed in jpeg format. Then the data is transferred to native c++ function as an unsigned char* array. As required by function jpeg_mem_src JPP((j_decompress_ptr cinfo,unsigned char * inbuffer,unsigned long insize)) of libjpeg9, the size of the array which is the 'inbuffer' parameter should be provided.

As far as I know, sizeof function cannot be used to get the size of the array because it is only a pointer. We also do not want to change the interface of our c++ function to transfer the size of the array.

So I want to get the size of the array from the header of jpeg. Does anyone know the position of the header where I can get the size of this jpeg image array size?

Any help will be appreciated!

Does anyone know the position of the header where I can get the size of this jpeg image array size?

There isn't one.

Any help will be appreciated!

Change the interface of your c++ function to transfer the size of the array.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM