00001
00006
00007
00008
00009
00010
00011
00012 #ifndef JPEG_H
00013 #define JPEG_H
00014
00015 #include <stdio.h>
00016 #include <jpeglib.h>
00017
00018 #if BITS_IN_JSAMPLE == 8
00019 #define PUTPPMSAMPLE(ptr,v) *ptr++ = (char) (v)
00020 #define BYTESPERSAMPLE 1
00021 #define PPM_MAXVAL 255
00022 #else
00023 #ifdef PPM_NORAWWORD
00024 #define PUTPPMSAMPLE(ptr,v) *ptr++ = (char) ((v) >> (BITS_IN_JSAMPLE-8))
00025 #define BYTESPERSAMPLE 1
00026 #define PPM_MAXVAL 255
00027 #else
00028
00029 #define PUTPPMSAMPLE(ptr,v) \
00030 { register int val_ = v; \
00031 *ptr++ = (char) (val_ & 0xFF); \
00032 *ptr++ = (char) ((val_ >> 8) & 0xFF); \
00033 }
00034 #define BYTESPERSAMPLE 2
00035 #define PPM_MAXVAL ((1<<BITS_IN_JSAMPLE)-1)
00036 #endif
00037 #endif
00038
00039 void write_JPEG_file (unsigned char* image, int image_width, int image_height, char* filename, int quality);
00040 unsigned char* read_JPEG_file (char * filename, int image_width, int image_height);
00041
00042
00043 #endif