使用的图像处理显卡,而不是GDI +图像处理、而不是、显卡、GDI

2023-09-03 03:04:11 作者:司令爷

我有一个问题,它可能是一个管梦,但我想知道是否有我的同胞堆栈Overflow'ers的可以帮助我。

I have a question, which may be a pipe-dream, but I wanted to know if any of my fellow Stack Overflow'ers could help me with.

在我工作的公司,我们做的十亿图像操作的每一个月。基本上,我们采取了大规模的形象,它切成256像素的正方形图像,色彩量化它们,并将它们保存为PNG图像 - 并移动到下一个庞大的图像。我们聘请了一批技术,以尽可能快地做到这一点,目前它是非常快的,但我认为这是我们可以让它在高速恒星的机会。

In the company I work for, we do billions of image manipulations each month. Basically, we take a massive image, slice it into 256 pixels square images, color quantize them and save them as pngs - and move onto the next mammoth image. We employ a number techniques to do this as quickly as possible, and currently it IS very fast, but I think there is a chance we could make it stellar in speed.

应用程序本身的.Net 2.0,循环遍历的大图片的各种字节,读取字节每个更小的图像,并使用GDI保存图像后,已通过量化算法运行。我们有几十其中运行该应用程序的机器,和所有的人都有的NVIDIA GeForce 8显卡(或更好)。

The application itself is .Net 2.0, loops through the various bytes in the large image, reading the bytes for each smaller image, and use GDI to save the image after it has run through a quantization algorithm. We have dozens of machines which run this application, and all of them have Nvidia Geforce 8 Video cards (or better).

有没有办法,我可以使用CPU的GPU,而不是执行上述任何或全部任务?如果是这样,我怎么做呢?不幸的是我从来没有codeD这样的事情之前,因此,如果有人能帮助我,我可能需要相当彻底的解释(和慢)。

Is there a way in which I can use the GPU instead of the CPU to perform any or all of the tasks above? If so, how do I do this? Unfortunately I have never coded anything like this before so if anyone can help me, I might need it explained quite thoroughly (and slowly).

推荐答案

一些技术考虑:

Windows成像组件 。这不正是你后,因为我不认为它使用了GPU(虽然我可能是黄),但它应该比GDI +显著更快的东西。

Windows Imaging Components. this isn't exactly what you're after since i don't think it uses the GPU (although i could be wong) but it should be significantly faster than GDI+.

的Direct2D 。这是在利用GPU进行许多绘图操作,并与Windows图像处理组件很好地集成。但是从你的描述,目前还不清楚由GPU优化的绘图操作是否符合正是你需要的。

Direct2D. this does use the GPU for many drawing operations and integrates well with the Windows Imaging Components. but from your description it's not clear whether the drawing operations optimized by the GPU fit exactly what you need.

在那些你可以尝试使用像素着色器的图像处理上。这是我还没有深入研究,所以我会离开它给别人发表意见的地方。

On top of those you can try using pixel shaders for the image manipulation. this is an area I haven't delved into so i'll leave it for others to comment.

要换个说法,Windows图像处理组件应减少PNG加载/保存瓶颈显著。它提供的操作可能会也有利于切片的图像在一个更优化的方式比GDI +。 Direct2D和/或像素着色器应有助于与像素级操控。如果没有更直接的方式做,你需要对照片的色彩量化操作的像素着色器才有必要。

To put it another way, Windows Imaging Components should reduce the PNG load/save bottleneck significantly. the operations it provides will probably also help slice the image up in a much more optimal way than GDI+. Direct2D and/or a pixel shader should help with the pixel-level manipulation. the pixel shader should only be needed if there's no more direct way to do the color quantize operation you need on the images.