QT,使用硬件加速(gpu)将原始图像转换为jpg [英] QT, convert raw image to jpg using Hardware acceleration (gpu)

查看:1380
本文介绍了QT,使用硬件加速(gpu)将原始图像转换为jpg的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要将Raw图像缓冲区转换为jpg图像缓冲区.

I need to convert an Raw image buffer into a jpg image buffer.

目前,我通过以下方式执行此操作:

At the moment, I do this operation in the following way:

QImage tmpImage 
         = QImage(rawImgBuffer, img_width, img_height, image.format ); //image.format=RGB888 
QBuffer bufferJpeg(&ba);
bufferJpeg.open(QIODevice::WriteOnly);
tmpImage.save(&bufferJpeg, "JPG");
QByteArray finalJpgBuffer = bufferJpeg.data();

它工作正常,但是cpu负载太高(我有很多线程每秒执行很多次此操作). 阅读Qt文档后,我发现了这篇文章:硬件加速和嵌入式平台. 如果我理解的话,我可以使用QPainter类执行gpu操作... 是否可以使用此类进行这种转换(从原始到jpg)? (或另一个使用硬件加速(gpu)的类似Qt类)!

It works fine but the cpu load is too high (I have a lot of threads that do this operation a lot of time each second). Reading the Qt documentation I found this article: Hardware Acceleration &amp Embedded Platforms. If i understood, I can use the QPainter class to execute gpu operations... Is it possible to do this convertion (from raw to jpg) using this class? (or another similar Qt class that use hardware acceleration (gpu))!!

我的应用程序必须与平台无关.

My application need to be platform indipendent.

非常感谢.

推荐答案

我不认为QImage使用GPU生成jpeg.
这可能无济于事(除非在非常有限的CPU上),因为通常会将数据从GPU中取出的传输时间占主导.使用硬件加速进行显示的原因是,结果已经在GPU中可供显示了.

I don't think QImage uses the GPU to generate a jpeg.
This probably wouldn't help (except on very limited CPUs) since the transfer time of getting the data back out of the GPU would normally dominate. The reason for using hardware acceleration for display is that the result is then already in the GPU ready for display.

这篇关于QT,使用硬件加速(gpu)将原始图像转换为jpg的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆