EE4115miniproject - //City University of Hong Kong...

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: //City University of Hong Kong //Department of Electronic Engineering //EE4115 Audiovisual Engineering Mini Project //CHEN Cihan 50914580 ZHOU Shufan 50913294 //May 2010 / #include "stdafx.h" #include <stdio.h> #include <stdlib.h> #include <string.h> #include <conio.h> #include <math.h> # #define ROW 512 #define COL 512 #define B_ROW 64 #define B_COL 64 #define PI 3.14159 # unsigned char image[ROW][COL]; int sub[B_ROW][B_COL][8][8], DECODE[ROW][COL], zzstring[B_ROW][B_COL][64], rlstring[B_ROW][B_COL][128]; int dc[B_ROW][B_COL], dcstring[B_ROW*B_COL*2], string[ROW*COL*2]; char infile[30], result[30], header[54]; double dsub[B_ROW][B_COL][8][8]; int crow, ccol, size, level=1; short int fakebits[ROW*COL*10]; s int quantizationtable[8][8]; int quantizationtable_level[3][8][8]= { {{1,1,1,1,1,1,1,1}, {1,1,1,1,1,1,1,1}, {1,1,1,1,1,1,1,1}, {1,1,1,1,1,1,1,1}, {1,1,1,1,1,1,1,1}, {1,1,1,1,1,1,1,1}, {1,1,1,1,1,1,1,1}, {1,1,1,1,1,1,1,1}}, {{42,29,26,42,63,105,134,160}, {32,32,37,50,68,153,158,145}, {37,34,42,63,105,150,181,147}, {37,45,58,76,134,229,210,163}, {47,58,97,147,179,287,271,203}, {63,92,145,168,213,274,297,242}, {29,168,205,229,271,318,316,266}, {89,242,250,258,295,263,271,260}}, {{100,69,63,100,150,250,319,381}, {75,75,88,119,163,363,375,344}, {88,81,100,150,250,356,431,350}, {88,106,138,181,319,544,500,388}, {113,138,231,350,425,681,644,481}, {150,219,344,400,506, 650,706,575}, {306,400,488,544,644,756,750,631}, {450,575,594,613,700,625,644,619}} }; const int path[8][8] = {{0 ,1 ,5 ,6 ,14,15,27,28}, {2 ,4 ,7 ,13,16,26,29,42}, {3 ,8 ,12,17,25,30,41,43}, {9 ,11,18,24,31,40,44,53}, {10,19,23,32,39,45,52,54}, {20,22,33,38,46,51,55,60}, {21,34,37,47,50,56,59,61}, {35,36,48,49,57,58,62,63}}; FILE *in, *res, *head; F void load_image(); void image_to_vector(); void vector_to_image(); void save_image(); void snr(); v int rs(int r, int s) { return (r*16 + s); } int cls(int input) { if(input == 0) { return 0; } else { int i=16; do{ i--; }while(pow(2.0, i)/2 > abs(input)); } return i; } } void load_image() { int row; //Input source image file printf("\nInput image name (extension not required) "); scanf("%s",infile); s /*Assign extensions to associated input and output files Input file is a raw 512 by 512 image with name: source.512 Source image: source.bmp Reconstruction output: source_res.bmp */ * strcpy(result,infile); strcat(infile,".512"); strcat(result,"_res.bmp"); s //Load BMP header file if((head=fopen("header.bmp","rb"))==NULL) { printf("\nHeader not found "); exit(0); } fread(header, sizeof(char),54,head); fclose(head); printf("\nHeader file successfully loaded "); p //Load input file to array "image" //Is file available?...
View Full Document

This note was uploaded on 01/11/2011 for the course EE 4115 taught by Professor Waimingtsang during the Spring '10 term at City University of Hong Kong.

Page1 / 13

EE4115miniproject - //City University of Hong Kong...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online