如何从 unsigned char* 数组中获取 jpeg 图像数组?

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

我正在使用 libjpeg9 进行 android 本机开发。我从 android 相机获得的图像数据以 jpeg 格式压缩。然后将数据作为 unsigned char* 数组传输到本机 c++ 函数。根据 libjpeg9 的函数 jpeg_mem_src JPP((j_decompress_ptr cinfo,unsigned char * inbuffer,unsigned long insize)) 的要求,应提供 'inbuffer' 参数的数组大小。

据我所知,sizeof函数不能用来获取数组的大小,因为它只是一个指针。我们也不想更改我们的 c++ 函数的接口来传输数组的大小。

所以我想从jpeg的header中得到数组的大小。有谁知道 header 的位置,我可以在哪里获得这个 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!

更改 C++ 函数的接口以传输数组的大小。