Main Page | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

jpeg.h

00001 /* jpeg.h
00002  * This code was written by Nathan Stenzel for gphoto
00003  *
00004  * This library is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU Lesser General Public
00006  * License as published by the Free Software Foundation; either
00007  * version 2 of the License, or (at your option) any later version.
00008  *
00009  * This library is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012  * Lesser General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU Lesser General Public
00015  * License along with this library; if not, write to the
00016  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00017  * Boston, MA 02111-1307, USA.
00018  */
00019 
00020 #ifndef __GPHOTO2_JPEG_H__
00021 #define __GPHOTO2_JPEG_H__
00022 
00023 #include <gphoto2-file.h>
00024 
00025 typedef enum {
00026     JPEG_START=0xD8,        JPEG_COMMENT=0xFE,      JPEG_APPO=0xE0,
00027     JPEG_QUANTIZATION=0xDB, JPEG_HUFFMAN=0xC4,      JPEG_SOFC0=0xC0,
00028     JPEG_SSSEAHAL=0xDA,     JPEG_EOI=0xD9
00029 } jpegmarker;
00030 
00031 typedef struct chunk{
00032     int size;
00033     unsigned char *data;
00034 } chunk;
00035 
00036 typedef char jpeg_quantization_table[64];
00037 
00038 typedef struct jpeg {
00039     int count;
00040     struct chunk *marker[20]; /* I think this should be big enough */
00041 }jpeg;
00042 
00043 chunk *gpi_jpeg_chunk_new(int length);
00044 chunk *gpi_jpeg_chunk_new_filled(int length, char *data);
00045 void gpi_jpeg_chunk_destroy(chunk *mychunk);
00046 void gpi_jpeg_chunk_print(chunk *mychunk);
00047 
00048 char  gpi_jpeg_findff(int *location, chunk *picture);
00049 char  gpi_jpeg_findactivemarker(char *id, int *location, chunk *picture);
00050 char *gpi_jpeg_markername(int c);
00051 
00052 jpeg *gpi_jpeg_new        (void);
00053 void  gpi_jpeg_destroy    (jpeg *myjpeg);
00054 void  gpi_jpeg_add_marker (jpeg *myjpeg, chunk *picture, int start, int end);
00055 void  gpi_jpeg_add_chunk  (jpeg *myjpeg, chunk *source);
00056 void  gpi_jpeg_parse      (jpeg *myjpeg, chunk *picture);
00057 void  gpi_jpeg_print      (jpeg *myjpeg);
00058 
00059 chunk *gpi_jpeg_make_start   (void);
00060 chunk *gpi_jpeg_make_SOFC    (int width, int height,
00061                              char vh1, char vh2, char vh3,
00062                              char q1, char q2, char q3);
00063 chunk *gpi_jpeg_makeSsSeAhAl (int huffset1, int huffset2, int huffset3);
00064 
00065 void gpi_jpeg_print_quantization_table(jpeg_quantization_table *table);
00066 chunk *gpi_jpeg_make_quantization(jpeg_quantization_table *table, char number);
00067 jpeg_quantization_table *gpi_jpeg_quantization2table(chunk *qmarker);
00068 
00069 jpeg *gpi_jpeg_header(int width, int height,
00070     char vh1, char vh2, char vh3,
00071     char q1, char q2, char q3,
00072     jpeg_quantization_table *quant1, jpeg_quantization_table *quant2,
00073     char huffset1, char huffset2, char huffset3,
00074     chunk *huff1, chunk *huff2, chunk *huff3, chunk *huff4);
00075 
00076 char gpi_jpeg_write(CameraFile *file, const char *name, jpeg *myjpeg);
00077 #endif

Generated on Thu Jun 14 21:43:51 2007 for libgphoto2 (libgphoto2) by  doxygen 1.4.2