Quantcast
Channel: Parallel Computing in C++ and Native Code forum
Viewing all articles
Browse latest Browse all 856

How to deal with a huge amount of RGB data using C++ AMP

$
0
0

Hi

I am now trying to use C++ AMP to speed up the image processing of a DirectShow filter. I read the tiling introductions and the examples but I think they are not quite suitable for what I am doing.

The images/video I want to filter is from a 1080*1920 at 60fps HD source, which means 2073600 pixels per frame. What I want to do is to change the RGB values of each pixel one by one and give them back to the pixel. For example:

RNew = 0.5 * ROrigin + 20;

GNew = 0.5 * GOrigin + 30;

BNew = 0.5 * BOrigin + 10;

This is not similar to the sum function in the tiling examples and it doesn't involve computation with other pixels. So I am not sure how should I do the tiling. Here are the two ways I thought of:

(1) I put the RGB values in an int vector[2073600*3] so it is like R G B R G B...R G B. I tried to tile them into 3*(256 pixels)=768/tile, but I am not sure what I should do next. The values going to RGB channels are different, and I only have one index idx to process that in parallel... If I use a for loop, it seems that it's not a parallel processing...

(2) If I make it only one pixel, which is R, G and B values in each tile, I know how to write the code. At this time, does the GPU work on one tile (one pixel) with three threads and then move on to the next tile? Or does it work on several tiles at the same time? If it works in the first way, it seems also not a parallel processing.

The data I need to process is quite a lot. I do hope I can process the pixels in parallel to increase the speed of the program. But at the moment it is slowing down the program, so I must have failed processing it in parallel. I would appreciate it if someone can help me with this problem. Thanks in advance.

kfzaer



Viewing all articles
Browse latest Browse all 856

Trending Articles