Hi ,
I have a very basic question, still and since i am just getting started in the C6000 DSP world i am going to post it.
I have a C64x+ DSP, and i want to perform an image multiplication by a scaler.
I know the result will never be bigger than 255, and my image is an unsigned char.
This is what i have done:
void IMG_mulS_8
(
unsigned char * restrict imgR, /* Read pointer for the input image */
unsigned char * restrict imgW, /* Write pointer for the output image */
unsigned char constData, /* Constant data */
int count /* Number of samples in the image */
)
{
int i;
long long p7_p6_p5_p4_p3_p2_p1_p0;
int p7_p6_p5_p4, p3_p2_p1_p0;
double rp3_rp2_rp1_rp0, rp7_rp6_rp5_rp4;
int cD_cD_cD_cD;
cD_cD_cD_cD = (constData << 24) | (constData << 16) |
(constData << 8) | (constData);
for (i = 0; i < count >> 4; i++) {
p7_p6_p5_p4_p3_p2_p1_p0 = _amem8(imgR); //Read 8 bytes from meomory
p7_p6_p5_p4 = _hill (p7_p6_p5_p4_p3_p2_p1_p0);//Grab the MSBytes part
p3_p2_p1_p0 = _loll (p7_p6_p5_p4_p3_p2_p1_p0);//Grab the LSBytes part
imgR += 8; //Increase pointer
rp3_rp2_rp1_rp0 = _mpyu4 (cD_cD_cD_cD, p7_p6_p5_p4); //multyply 4 bytes at a time
rp7_rp6_rp5_rp4 = _mpyu4 (cD_cD_cD_cD, p3_p2_p1_p0);
*((double *)imgW) = rp3_rp2_rp1_rp0;
imgW += 4;
*((double *)imgW) = rp7_rp6_rp5_rp4;
imgW += 4;
//Do again for another 8
p7_p6_p5_p4_p3_p2_p1_p0 = _amem8(imgR);
p7_p6_p5_p4 = _hill (p7_p6_p5_p4_p3_p2_p1_p0);
p3_p2_p1_p0 = _loll (p7_p6_p5_p4_p3_p2_p1_p0);
imgR += 8;
rp3_rp2_rp1_rp0 = _mpyu4 (cD_cD_cD_cD, p7_p6_p5_p4);
rp7_rp6_rp5_rp4 = _mpyu4 (cD_cD_cD_cD, p3_p2_p1_p0);
*((double *)imgW) = rp3_rp2_rp1_rp0;
imgW += 4;
*((double *)imgW) = rp7_rp6_rp5_rp4;
imgW += 4;
}
}
But this is not working, can you give me a tip of what is wrong?
Best Regards
Filipe Alves