what I'm trying to do is take this function call...
assign_sum_to_pixel(¤t_pixel, sum);
and replace it with the actual code that it calls which is this...
/*
* assign_ sum_ to_ pixel - Computes averaged pixel value in current_pixel
*/
static void assign_ sum_ to_ pixel (pixel *current_ pixel, pixel_ sum sum)
{
current_ pixel->red = (unsigned short) (sum.red/sum.num);
current_ pixel->green = (unsigned short) (sum.green/sum.num);
current_ pixel->blue = (unsigned short) (sum.blue/sum.num);
return;
}
What I came up with was this...
/*
* mysmooth1 - my smooth1
*/
char mysmooth1_descr[] = "my smooth1: My smooth1";
void mysmooth1(int dim, pixel *src, pixel *dst)
{
int i, j;
int ii, jj;
pixel_ sum sum;
pixel current_ pixel;
for (i = 0; i < dim; i++)
for (j = 0; j < dim; j++)
{
initialize_ pixel_ sum (&sum);
for(ii = max(i-1, 0); ii <= min(i+1, dim-1); ii++)
for(jj = max(j-1, 0); jj <= min(j+1, dim-1); jj++)
accumulate_ sum(&sum, src[RIDX(ii, jj, dim)]);
{
***current_ pixel->red = (unsigned short) (sum.red/sum.num);
current_ pixel->green = (unsigned short) (sum.green/sum.num);
current_ pixel->blue = (unsigned short) (sum.blue/sum.num);***
***(These three lines above are the lines I inserted which is where the function call use to be)***
dst[RIDX(i, j, dim)] = return;
}
}
}
but...for some reason when I run the code it fails to work giving me this error
kernels.c:456: error: invalid type argument of â->â
kernels.c:457: error: invalid type argument of â->â
kernels.c:458: error: invalid type argument of â->â
kernels.c:459: warning: statement with no effect
which is right where I added the new code ...
current_ pixel->red = (unsigned short) (sum.red/sum.num);
current_ pixel->green = (unsigned short) (sum.green/sum.num);
current_ pixel->blue = (unsigned short) (sum.blue/sum.num);
can someone tell me if I'm doing something wrong... Am I missing brackets somewhere? am I not initializing my variables correctly? is return not supposed to be at the bottom equaling to dst[RIDX(i, j, dim)]
any help, comments, suggestions would be greatly appreciated. Thank You.