-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.c
55 lines (38 loc) · 892 Bytes
/
main.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#include <stdio.h>
#include <stdint.h>
#include <malloc.h>
#include "definitions.h"
#include "readfile.h"
#include "parsejpeg.h"
#include "decodejpeg.h"
int main(int argc, char* argv[])
{
(void)argc;
(void)argv;
printf("Starting...\n");
uint8_t *fileContents = NULL;
//char fileName[] = "imgs/speedy.jpg";
//char fileName[] = "imgs/huff_simple0.jpg";
char fileName[] = "imgs/tiny.jpg";
//read file
uint32_t fileSize = read(&fileContents, fileName);
if ( (fileSize == 0) || !(fileContents) )
{
return 1;
}
//parse file
jpeg_t *jpeg = jpegParse(fileContents, fileSize);
free(fileContents);
if(!jpeg)
{
fprintf(stderr, "ERROR: jpeg not parsed\n");
return 1;
}
//decode jpeg
//decode(jpeg);
//write file
//write(jpeg, type)
freeJpeg(jpeg);
printf("Finished.\n");
return 0;
}