使用 turbojpeg 报错 请问是什么原因
-
报错原因:Instance has not been initialized for decompression
但不知道到是哪个没实例化 困扰了很久
附上代码
bool MJPG2BGRA(const k4a::image&mjpgimage, k4a::image&bgraimage)
{bgraimage = k4a::image::create(K4A_IMAGE_FORMAT_COLOR_BGRA32, mjpgimage.get_width_pixels(), mjpgimage.get_height_pixels(), mjpgimage.get_width_pixels() * 4 * (int)sizeof(uint8_t)); tjhandle m_decompressor; m_decompressor = tjInitCompress(); const int decompressStatus = tjDecompress2(m_decompressor, mjpgimage.get_buffer(), static_cast<unsigned long>(mjpgimage.get_size()), bgraimage.get_buffer(), mjpgimage.get_width_pixels(), 0, mjpgimage.get_height_pixels(), TJPF_BGRA, TJFLAG_FASTDCT | TJFLAG_FASTUPSAMPLE); if (decompressStatus != 0) { printf("解压失败:\n"); printf("原因是:%s", tjGetErrorStr()); } (void)tjDestroy(m_decompressor); return true;
}