![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Final 350 project
Dependencies: uzair Camera_LS_Y201 F7_Ethernet LCD_DISCO_F746NG NetworkAPI SDFileSystem mbed
includes/cdjpeg.h@0:791a779d6220, 2017-07-31 (annotated)
- Committer:
- shoaib_ahmed
- Date:
- Mon Jul 31 09:16:35 2017 +0000
- Revision:
- 0:791a779d6220
final project;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
shoaib_ahmed | 0:791a779d6220 | 1 | /* |
shoaib_ahmed | 0:791a779d6220 | 2 | * cdjpeg.h |
shoaib_ahmed | 0:791a779d6220 | 3 | * |
shoaib_ahmed | 0:791a779d6220 | 4 | * Copyright (C) 1994-1997, Thomas G. Lane. |
shoaib_ahmed | 0:791a779d6220 | 5 | * This file is part of the Independent JPEG Group's software. |
shoaib_ahmed | 0:791a779d6220 | 6 | * For conditions of distribution and use, see the accompanying README file. |
shoaib_ahmed | 0:791a779d6220 | 7 | * |
shoaib_ahmed | 0:791a779d6220 | 8 | * This file contains common declarations for the sample applications |
shoaib_ahmed | 0:791a779d6220 | 9 | * cjpeg and djpeg. It is NOT used by the core JPEG library. |
shoaib_ahmed | 0:791a779d6220 | 10 | */ |
shoaib_ahmed | 0:791a779d6220 | 11 | |
shoaib_ahmed | 0:791a779d6220 | 12 | #define JPEG_CJPEG_DJPEG /* define proper options in jconfig.h */ |
shoaib_ahmed | 0:791a779d6220 | 13 | #define JPEG_INTERNAL_OPTIONS /* cjpeg.c,djpeg.c need to see xxx_SUPPORTED */ |
shoaib_ahmed | 0:791a779d6220 | 14 | #include "jinclude.h" |
shoaib_ahmed | 0:791a779d6220 | 15 | #include "jpeglib.h" |
shoaib_ahmed | 0:791a779d6220 | 16 | #include "jerror.h" /* get library error codes too */ |
shoaib_ahmed | 0:791a779d6220 | 17 | #include "cderror.h" /* get application-specific error codes */ |
shoaib_ahmed | 0:791a779d6220 | 18 | |
shoaib_ahmed | 0:791a779d6220 | 19 | |
shoaib_ahmed | 0:791a779d6220 | 20 | /* |
shoaib_ahmed | 0:791a779d6220 | 21 | * Object interface for cjpeg's source file decoding modules |
shoaib_ahmed | 0:791a779d6220 | 22 | */ |
shoaib_ahmed | 0:791a779d6220 | 23 | |
shoaib_ahmed | 0:791a779d6220 | 24 | typedef struct cjpeg_source_struct * cjpeg_source_ptr; |
shoaib_ahmed | 0:791a779d6220 | 25 | |
shoaib_ahmed | 0:791a779d6220 | 26 | struct cjpeg_source_struct { |
shoaib_ahmed | 0:791a779d6220 | 27 | JMETHOD(void, start_input, (j_compress_ptr cinfo, |
shoaib_ahmed | 0:791a779d6220 | 28 | cjpeg_source_ptr sinfo)); |
shoaib_ahmed | 0:791a779d6220 | 29 | JMETHOD(JDIMENSION, get_pixel_rows, (j_compress_ptr cinfo, |
shoaib_ahmed | 0:791a779d6220 | 30 | cjpeg_source_ptr sinfo)); |
shoaib_ahmed | 0:791a779d6220 | 31 | JMETHOD(void, finish_input, (j_compress_ptr cinfo, |
shoaib_ahmed | 0:791a779d6220 | 32 | cjpeg_source_ptr sinfo)); |
shoaib_ahmed | 0:791a779d6220 | 33 | |
shoaib_ahmed | 0:791a779d6220 | 34 | FILE *input_file; |
shoaib_ahmed | 0:791a779d6220 | 35 | |
shoaib_ahmed | 0:791a779d6220 | 36 | JSAMPARRAY buffer; |
shoaib_ahmed | 0:791a779d6220 | 37 | JDIMENSION buffer_height; |
shoaib_ahmed | 0:791a779d6220 | 38 | }; |
shoaib_ahmed | 0:791a779d6220 | 39 | |
shoaib_ahmed | 0:791a779d6220 | 40 | |
shoaib_ahmed | 0:791a779d6220 | 41 | /* |
shoaib_ahmed | 0:791a779d6220 | 42 | * Object interface for djpeg's output file encoding modules |
shoaib_ahmed | 0:791a779d6220 | 43 | */ |
shoaib_ahmed | 0:791a779d6220 | 44 | |
shoaib_ahmed | 0:791a779d6220 | 45 | typedef struct djpeg_dest_struct * djpeg_dest_ptr; |
shoaib_ahmed | 0:791a779d6220 | 46 | |
shoaib_ahmed | 0:791a779d6220 | 47 | struct djpeg_dest_struct { |
shoaib_ahmed | 0:791a779d6220 | 48 | /* start_output is called after jpeg_start_decompress finishes. |
shoaib_ahmed | 0:791a779d6220 | 49 | * The color map will be ready at this time, if one is needed. |
shoaib_ahmed | 0:791a779d6220 | 50 | */ |
shoaib_ahmed | 0:791a779d6220 | 51 | JMETHOD(void, start_output, (j_decompress_ptr cinfo, |
shoaib_ahmed | 0:791a779d6220 | 52 | djpeg_dest_ptr dinfo)); |
shoaib_ahmed | 0:791a779d6220 | 53 | /* Emit the specified number of pixel rows from the buffer. */ |
shoaib_ahmed | 0:791a779d6220 | 54 | JMETHOD(void, put_pixel_rows, (j_decompress_ptr cinfo, |
shoaib_ahmed | 0:791a779d6220 | 55 | djpeg_dest_ptr dinfo, |
shoaib_ahmed | 0:791a779d6220 | 56 | JDIMENSION rows_supplied)); |
shoaib_ahmed | 0:791a779d6220 | 57 | /* Finish up at the end of the image. */ |
shoaib_ahmed | 0:791a779d6220 | 58 | JMETHOD(void, finish_output, (j_decompress_ptr cinfo, |
shoaib_ahmed | 0:791a779d6220 | 59 | djpeg_dest_ptr dinfo)); |
shoaib_ahmed | 0:791a779d6220 | 60 | |
shoaib_ahmed | 0:791a779d6220 | 61 | /* Target file spec; filled in by djpeg.c after object is created. */ |
shoaib_ahmed | 0:791a779d6220 | 62 | FILE * output_file; |
shoaib_ahmed | 0:791a779d6220 | 63 | |
shoaib_ahmed | 0:791a779d6220 | 64 | /* Output pixel-row buffer. Created by module init or start_output. |
shoaib_ahmed | 0:791a779d6220 | 65 | * Width is cinfo->output_width * cinfo->output_components; |
shoaib_ahmed | 0:791a779d6220 | 66 | * height is buffer_height. |
shoaib_ahmed | 0:791a779d6220 | 67 | */ |
shoaib_ahmed | 0:791a779d6220 | 68 | JSAMPARRAY buffer; |
shoaib_ahmed | 0:791a779d6220 | 69 | JDIMENSION buffer_height; |
shoaib_ahmed | 0:791a779d6220 | 70 | }; |
shoaib_ahmed | 0:791a779d6220 | 71 | |
shoaib_ahmed | 0:791a779d6220 | 72 | |
shoaib_ahmed | 0:791a779d6220 | 73 | /* |
shoaib_ahmed | 0:791a779d6220 | 74 | * cjpeg/djpeg may need to perform extra passes to convert to or from |
shoaib_ahmed | 0:791a779d6220 | 75 | * the source/destination file format. The JPEG library does not know |
shoaib_ahmed | 0:791a779d6220 | 76 | * about these passes, but we'd like them to be counted by the progress |
shoaib_ahmed | 0:791a779d6220 | 77 | * monitor. We use an expanded progress monitor object to hold the |
shoaib_ahmed | 0:791a779d6220 | 78 | * additional pass count. |
shoaib_ahmed | 0:791a779d6220 | 79 | */ |
shoaib_ahmed | 0:791a779d6220 | 80 | |
shoaib_ahmed | 0:791a779d6220 | 81 | struct cdjpeg_progress_mgr { |
shoaib_ahmed | 0:791a779d6220 | 82 | struct jpeg_progress_mgr pub; /* fields known to JPEG library */ |
shoaib_ahmed | 0:791a779d6220 | 83 | int completed_extra_passes; /* extra passes completed */ |
shoaib_ahmed | 0:791a779d6220 | 84 | int total_extra_passes; /* total extra */ |
shoaib_ahmed | 0:791a779d6220 | 85 | /* last printed percentage stored here to avoid multiple printouts */ |
shoaib_ahmed | 0:791a779d6220 | 86 | int percent_done; |
shoaib_ahmed | 0:791a779d6220 | 87 | }; |
shoaib_ahmed | 0:791a779d6220 | 88 | |
shoaib_ahmed | 0:791a779d6220 | 89 | typedef struct cdjpeg_progress_mgr * cd_progress_ptr; |
shoaib_ahmed | 0:791a779d6220 | 90 | |
shoaib_ahmed | 0:791a779d6220 | 91 | |
shoaib_ahmed | 0:791a779d6220 | 92 | /* Short forms of external names for systems with brain-damaged linkers. */ |
shoaib_ahmed | 0:791a779d6220 | 93 | |
shoaib_ahmed | 0:791a779d6220 | 94 | #ifdef NEED_SHORT_EXTERNAL_NAMES |
shoaib_ahmed | 0:791a779d6220 | 95 | #define jinit_read_bmp jIRdBMP |
shoaib_ahmed | 0:791a779d6220 | 96 | #define jinit_write_bmp jIWrBMP |
shoaib_ahmed | 0:791a779d6220 | 97 | #define jinit_read_gif jIRdGIF |
shoaib_ahmed | 0:791a779d6220 | 98 | #define jinit_write_gif jIWrGIF |
shoaib_ahmed | 0:791a779d6220 | 99 | #define jinit_read_ppm jIRdPPM |
shoaib_ahmed | 0:791a779d6220 | 100 | #define jinit_write_ppm jIWrPPM |
shoaib_ahmed | 0:791a779d6220 | 101 | #define jinit_read_rle jIRdRLE |
shoaib_ahmed | 0:791a779d6220 | 102 | #define jinit_write_rle jIWrRLE |
shoaib_ahmed | 0:791a779d6220 | 103 | #define jinit_read_targa jIRdTarga |
shoaib_ahmed | 0:791a779d6220 | 104 | #define jinit_write_targa jIWrTarga |
shoaib_ahmed | 0:791a779d6220 | 105 | #define read_quant_tables RdQTables |
shoaib_ahmed | 0:791a779d6220 | 106 | #define read_scan_script RdScnScript |
shoaib_ahmed | 0:791a779d6220 | 107 | #define set_quality_ratings SetQRates |
shoaib_ahmed | 0:791a779d6220 | 108 | #define set_quant_slots SetQSlots |
shoaib_ahmed | 0:791a779d6220 | 109 | #define set_sample_factors SetSFacts |
shoaib_ahmed | 0:791a779d6220 | 110 | #define read_color_map RdCMap |
shoaib_ahmed | 0:791a779d6220 | 111 | #define enable_signal_catcher EnSigCatcher |
shoaib_ahmed | 0:791a779d6220 | 112 | #define start_progress_monitor StProgMon |
shoaib_ahmed | 0:791a779d6220 | 113 | #define end_progress_monitor EnProgMon |
shoaib_ahmed | 0:791a779d6220 | 114 | #define read_stdin RdStdin |
shoaib_ahmed | 0:791a779d6220 | 115 | #define write_stdout WrStdout |
shoaib_ahmed | 0:791a779d6220 | 116 | #endif /* NEED_SHORT_EXTERNAL_NAMES */ |
shoaib_ahmed | 0:791a779d6220 | 117 | |
shoaib_ahmed | 0:791a779d6220 | 118 | /* Module selection routines for I/O modules. */ |
shoaib_ahmed | 0:791a779d6220 | 119 | |
shoaib_ahmed | 0:791a779d6220 | 120 | EXTERN(cjpeg_source_ptr) jinit_read_bmp JPP((j_compress_ptr cinfo)); |
shoaib_ahmed | 0:791a779d6220 | 121 | EXTERN(djpeg_dest_ptr) jinit_write_bmp JPP((j_decompress_ptr cinfo, |
shoaib_ahmed | 0:791a779d6220 | 122 | boolean is_os2)); |
shoaib_ahmed | 0:791a779d6220 | 123 | EXTERN(cjpeg_source_ptr) jinit_read_gif JPP((j_compress_ptr cinfo)); |
shoaib_ahmed | 0:791a779d6220 | 124 | EXTERN(djpeg_dest_ptr) jinit_write_gif JPP((j_decompress_ptr cinfo)); |
shoaib_ahmed | 0:791a779d6220 | 125 | EXTERN(cjpeg_source_ptr) jinit_read_ppm JPP((j_compress_ptr cinfo)); |
shoaib_ahmed | 0:791a779d6220 | 126 | EXTERN(djpeg_dest_ptr) jinit_write_ppm JPP((j_decompress_ptr cinfo)); |
shoaib_ahmed | 0:791a779d6220 | 127 | EXTERN(cjpeg_source_ptr) jinit_read_rle JPP((j_compress_ptr cinfo)); |
shoaib_ahmed | 0:791a779d6220 | 128 | EXTERN(djpeg_dest_ptr) jinit_write_rle JPP((j_decompress_ptr cinfo)); |
shoaib_ahmed | 0:791a779d6220 | 129 | EXTERN(cjpeg_source_ptr) jinit_read_targa JPP((j_compress_ptr cinfo)); |
shoaib_ahmed | 0:791a779d6220 | 130 | EXTERN(djpeg_dest_ptr) jinit_write_targa JPP((j_decompress_ptr cinfo)); |
shoaib_ahmed | 0:791a779d6220 | 131 | |
shoaib_ahmed | 0:791a779d6220 | 132 | /* cjpeg support routines (in rdswitch.c) */ |
shoaib_ahmed | 0:791a779d6220 | 133 | |
shoaib_ahmed | 0:791a779d6220 | 134 | EXTERN(boolean) read_quant_tables JPP((j_compress_ptr cinfo, char * filename, |
shoaib_ahmed | 0:791a779d6220 | 135 | boolean force_baseline)); |
shoaib_ahmed | 0:791a779d6220 | 136 | EXTERN(boolean) read_scan_script JPP((j_compress_ptr cinfo, char * filename)); |
shoaib_ahmed | 0:791a779d6220 | 137 | EXTERN(boolean) set_quality_ratings JPP((j_compress_ptr cinfo, char *arg, |
shoaib_ahmed | 0:791a779d6220 | 138 | boolean force_baseline)); |
shoaib_ahmed | 0:791a779d6220 | 139 | EXTERN(boolean) set_quant_slots JPP((j_compress_ptr cinfo, char *arg)); |
shoaib_ahmed | 0:791a779d6220 | 140 | EXTERN(boolean) set_sample_factors JPP((j_compress_ptr cinfo, char *arg)); |
shoaib_ahmed | 0:791a779d6220 | 141 | |
shoaib_ahmed | 0:791a779d6220 | 142 | /* djpeg support routines (in rdcolmap.c) */ |
shoaib_ahmed | 0:791a779d6220 | 143 | |
shoaib_ahmed | 0:791a779d6220 | 144 | EXTERN(void) read_color_map JPP((j_decompress_ptr cinfo, FILE * infile)); |
shoaib_ahmed | 0:791a779d6220 | 145 | |
shoaib_ahmed | 0:791a779d6220 | 146 | /* common support routines (in cdjpeg.c) */ |
shoaib_ahmed | 0:791a779d6220 | 147 | |
shoaib_ahmed | 0:791a779d6220 | 148 | EXTERN(void) enable_signal_catcher JPP((j_common_ptr cinfo)); |
shoaib_ahmed | 0:791a779d6220 | 149 | EXTERN(void) start_progress_monitor JPP((j_common_ptr cinfo, |
shoaib_ahmed | 0:791a779d6220 | 150 | cd_progress_ptr progress)); |
shoaib_ahmed | 0:791a779d6220 | 151 | EXTERN(void) end_progress_monitor JPP((j_common_ptr cinfo)); |
shoaib_ahmed | 0:791a779d6220 | 152 | EXTERN(boolean) keymatch JPP((char * arg, const char * keyword, int minchars)); |
shoaib_ahmed | 0:791a779d6220 | 153 | EXTERN(FILE *) read_stdin JPP((void)); |
shoaib_ahmed | 0:791a779d6220 | 154 | EXTERN(FILE *) write_stdout JPP((void)); |
shoaib_ahmed | 0:791a779d6220 | 155 | |
shoaib_ahmed | 0:791a779d6220 | 156 | /* miscellaneous useful macros */ |
shoaib_ahmed | 0:791a779d6220 | 157 | |
shoaib_ahmed | 0:791a779d6220 | 158 | #ifdef DONT_USE_B_MODE /* define mode parameters for fopen() */ |
shoaib_ahmed | 0:791a779d6220 | 159 | #define READ_BINARY "r" |
shoaib_ahmed | 0:791a779d6220 | 160 | #define WRITE_BINARY "w" |
shoaib_ahmed | 0:791a779d6220 | 161 | #else |
shoaib_ahmed | 0:791a779d6220 | 162 | #ifdef VMS /* VMS is very nonstandard */ |
shoaib_ahmed | 0:791a779d6220 | 163 | #define READ_BINARY "rb", "ctx=stm" |
shoaib_ahmed | 0:791a779d6220 | 164 | #define WRITE_BINARY "wb", "ctx=stm" |
shoaib_ahmed | 0:791a779d6220 | 165 | #else /* standard ANSI-compliant case */ |
shoaib_ahmed | 0:791a779d6220 | 166 | #define READ_BINARY "rb" |
shoaib_ahmed | 0:791a779d6220 | 167 | #define WRITE_BINARY "wb" |
shoaib_ahmed | 0:791a779d6220 | 168 | #endif |
shoaib_ahmed | 0:791a779d6220 | 169 | #endif |
shoaib_ahmed | 0:791a779d6220 | 170 | |
shoaib_ahmed | 0:791a779d6220 | 171 | #ifndef EXIT_FAILURE /* define exit() codes if not provided */ |
shoaib_ahmed | 0:791a779d6220 | 172 | #define EXIT_FAILURE 1 |
shoaib_ahmed | 0:791a779d6220 | 173 | #endif |
shoaib_ahmed | 0:791a779d6220 | 174 | #ifndef EXIT_SUCCESS |
shoaib_ahmed | 0:791a779d6220 | 175 | #ifdef VMS |
shoaib_ahmed | 0:791a779d6220 | 176 | #define EXIT_SUCCESS 1 /* VMS is very nonstandard */ |
shoaib_ahmed | 0:791a779d6220 | 177 | #else |
shoaib_ahmed | 0:791a779d6220 | 178 | #define EXIT_SUCCESS 0 |
shoaib_ahmed | 0:791a779d6220 | 179 | #endif |
shoaib_ahmed | 0:791a779d6220 | 180 | #endif |
shoaib_ahmed | 0:791a779d6220 | 181 | #ifndef EXIT_WARNING |
shoaib_ahmed | 0:791a779d6220 | 182 | #ifdef VMS |
shoaib_ahmed | 0:791a779d6220 | 183 | #define EXIT_WARNING 1 /* VMS is very nonstandard */ |
shoaib_ahmed | 0:791a779d6220 | 184 | #else |
shoaib_ahmed | 0:791a779d6220 | 185 | #define EXIT_WARNING 2 |
shoaib_ahmed | 0:791a779d6220 | 186 | #endif |
shoaib_ahmed | 0:791a779d6220 | 187 | #endif |