论坛

    • 登录
    • 版块
    • 最新
    • 标签
    • 热门

    使用 turbojpeg 报错 请问是什么原因

    技术交流
    1
    1
    68
    正在加载更多帖子
    • 从旧到新
    • 从新到旧
    • 最多赞同
    回复
    • 在新帖中回复
    登录后回复
    此主题已被删除。只有拥有主题管理权限的用户可以查看。
    • xiaowen0407
      xiaowen0407 最后由 编辑

      报错原因: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;
      

      }

      1 条回复 最后回复 回复 引用 0
      • First post
        Last post