Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/swift/20.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ turbojpeg cpp中的realloc图像缓冲区_C++_Malloc_Free_Libjpeg Turbo_Turbojpeg - Fatal编程技术网

C++ turbojpeg cpp中的realloc图像缓冲区

C++ turbojpeg cpp中的realloc图像缓冲区,c++,malloc,free,libjpeg-turbo,turbojpeg,C++,Malloc,Free,Libjpeg Turbo,Turbojpeg,我正在使用turbojpeg读取图像 我正在做以下几点: m_data = tjAlloc(MAX_RAW_SIZE); c_jpeg_buffer = tjAlloc(MAX_RAW_SIZE); tjDecompressHeader2(jpegDecompressor, c_jpeg_buffer, _jpegSize, &tj_width, &tj_height, &jpegSubsamp); tjDecompress2(c_jpegDecompressor, m_

我正在使用turbojpeg读取图像

我正在做以下几点:

m_data = tjAlloc(MAX_RAW_SIZE);
c_jpeg_buffer = tjAlloc(MAX_RAW_SIZE);
tjDecompressHeader2(jpegDecompressor, c_jpeg_buffer, _jpegSize, &tj_width, &tj_height, &jpegSubsamp);
tjDecompress2(c_jpegDecompressor, m_data, _jpegSize, c_jpeg_buffer, tj_width, 0/*pitch*/, tj_height, TJPF_GRAY, TJFLAG_FASTDCT);
tjFree(c_jpeg_buffer);
tjFree(m_data);

我想重新锁定m_数据和c_jpeg_缓冲区,以防_jpeg大小或(tj_宽度*tj_高度)太大。turbojpeg文档表明,如果使用tjCompress2(…)或TJTTransform(…),这将自动发生。它没有说明在这种情况下会发生什么。假设我真的锁定了缓冲区-对turboJpeg的未来用户使用tjFree()是否仍然安全。。。RTFM

如果发送预分配的缓冲区,则需要传递其大小。缓冲区本身和大小都可能会更改