Technical Discussions related to Image Processing (image coding, compression, digital effects, mpeg, etc)
Hi,
I am trying to apply 8*8blockwiseDCT to raw image and reconstruct it using IDCT. I am
completely new to image processing and I am doubtful on the algorithm that I am implementing
in C. I am not been able to reconstruct image by applying the equations mentioned .Following
are snippets of my code
#define N 8
#define pi 3.141592
#define ROUND( a ) ( ( (a) < 0 ) ? (int) ( (a) - 0.5 ) :(int) ( (a) + 0.5 ) )
for(i=0;i<8;i++)
{ for(j=0;j<8;j++)
{ if(i==0)
c[i][j]=(float)(1.0/sqrt(N));
else
{ costerm= (float)(((2.0*j+1)*i*pi)/(2.0*N));
c[i][j]=(float)((sqrt(2)/sqrt(N))* costerm);
}
ct[j][i]=c[i][j]; //transpose of coefficient mat
}
}
//Forward dct=c*pixel*ct pixel is an array of grey values of 8 bit raw image
multi(temp,pix,ct);
multi(dct,c,temp);
//inverse dct=ct*dct*c
multi(temp,dct,c);
multi(idct,ct,temp);
void multi(float x[8][8], float a[8][8], float b[8][8])
{ int i,j,k;
for(i=0;i<8;i++)
{ for(j=0;j<8;j++)
{ x[i][j]=0;
for(k=0;k<8;k++)
x[i][j]+=a[i][k]*b[k][j];
}
}
I am sure that my matrix multiplication function is correct. Can any body find out my mistakes
. My pixel values and idct values are not same. Please provide me with test values to cross
check my codes.
Thanks a lot
tiya