summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOliver Schinagl <oliver@schinagl.nl>2005-05-17 12:23:14 (GMT)
committerOliver Schinagl <oliver@schinagl.nl>2005-05-17 12:23:14 (GMT)
commitccbd56786e0f18b1601302413d0b88636d9bf467 (patch)
tree6148a9500740012216aff8f59c725167303fa0ed
parentc5c10395e4a8233c2ed9d5ba3897d97b9c32deac (diff)
download5kk53-ccbd56786e0f18b1601302413d0b88636d9bf467.zip
5kk53-ccbd56786e0f18b1601302413d0b88636d9bf467.tar.gz
5kk53-ccbd56786e0f18b1601302413d0b88636d9bf467.tar.bz2
DCT finished
-rw-r--r--src/main.c33
1 files changed, 32 insertions, 1 deletions
diff --git a/src/main.c b/src/main.c
index 1b25658..3867112 100644
--- a/src/main.c
+++ b/src/main.c
@@ -36,6 +36,19 @@ void quanize_data(int * data,int * qdata)
}
}
+void dequanize_data(DCTELEM * data,DCTELEM * qdata)
+{
+ int i,j;
+ for (i = 0; i < 8; i++)
+ {
+ for(j=0;j < 8;j++)
+ {
+ *(data + ((i * 8) + j)) =( *(data + ((i * 8) + j))) *( *(qdata + ((i * 8) + j))) ;
+ }
+ }
+}
+
+
void scale_data(DCTELEM * data, DCTELEM scale)
{
int i,j;
@@ -48,6 +61,20 @@ void scale_data(DCTELEM * data, DCTELEM scale)
}
}
+
+void scaleDownData(DCTELEM * data,int scale)
+{
+ int i,j;
+ for (i = 0; i < 8; i++)
+ {
+ for(j=0;j < 8;j++)
+ {
+ *(data + ((i * 8) + j)) =( *(data + ((i * 8) + j))) /scale ;
+ }
+ }
+}
+
+
/*void dump_data(DCTELEM * data )
{
int i,j;
@@ -151,12 +178,16 @@ int main(int argc, char *argv[]) {
//dump_data(blok8x8);
//printf("\nafter DCT\n");
jpeg_fdct_ifast(blok8x8);
+ // Scaling after DCT
+ scaleDownData(blok8x8,8);
+
+
// After dct
//dump_data(blok8x8);
-
quanize_data(blok8x8,quan_data);
//printf("\nafter quantize\n");
//dump_data(blok8x8);
+ dequanize_data(blok8x8,quan_data);
IDCT(blok8x8, blok8x8_2);
//printf("\nafter idct\n");