Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // test dct
- image img;
- image* output;
- readPgm(args.inFilename, &img);
- output = malloc(sizeof(img));
- int j, i, l, k;
- int h = img.h;
- int w = img.w;
- float * data;
- data = malloc (sizeof(float)*8*8);
- for(i=0; i<w; i=i+8){
- for (j=0; j<h; j=j+8){
- dct(&img, data, i, j);
- for(l=0;l<8;l++)
- {
- for(k=0;k<8;k++)
- {
- output->data[(j+l)*w +(i+k)] = (pixel_t) data[j*8+k]/8.f;
- }
- }
- }
- }
- writePgm(args.outFilename, output);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement