cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

tak
Journeyman III

how to describe program for 8bit/16bit calculation on brook

I wat to calculate 8bit/16bit element.

follow that

void sum(char a<>, char b<>, out short c<>
{
 c = a + b;
}

please show me the example on brook.

0 Likes
4 Replies

Tak,
There currently is no support for char or short data types in the Brook+ language, see brookspec-v1.pdf section 3.1 and 3.2 for available primitive types. If you wish to have 8bit or 16bit data types you would have to do the manual packing into the int data type, do your calculations, and mask off the upper 16/24 bits when you repack your data.

0 Likes

Hi

Thank for your comment.

I want to inplement Video encoder (input is yuv that each parameter is 8bit) on the brook+. It's slower than cpu that I use your idea.

Please tell me that How to describe on the brook+. 

0 Likes

Why would it be slower on the GPU to use ints than on the CPU using chars??

The precision via conversion wouldn't be a problem I would imagine.
0 Likes

I found out a reason why it's slower, because "streamRead" and "streamWrite" are slow.

I described follow like that codes. Is it the specification about proccesing speed for "streamRead/Write" ?

 int *a, *b, *c;
 int out_c<1088, 480 >;
 int in_a< 1088, 480 >;
 int in_b< 1088, 480 >;

 a = (int*)malloc(sizeof(int)*1088*480);
 b = (int*)malloc(sizeof(int)*1088*480);
 c = (int*)malloc(sizeof(int)*1088*480);

 // CPU -> GPU
 streamRead( in_a, a);
 streamRead( in_b, b);

 // involving kernel
 StartKernel(in_a, in_b, out_c);

 // GPU -> CPU
 streamWrite( out_c, c);

 free(a);
 free(b);
 free(c);
 

0 Likes