Final 350 project

Dependencies:   uzair Camera_LS_Y201 F7_Ethernet LCD_DISCO_F746NG NetworkAPI SDFileSystem mbed

Committer:
shoaib_ahmed
Date:
Mon Jul 31 09:16:35 2017 +0000
Revision:
0:791a779d6220
final project;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
shoaib_ahmed 0:791a779d6220 1 /*
shoaib_ahmed 0:791a779d6220 2 * jpegint.h
shoaib_ahmed 0:791a779d6220 3 *
shoaib_ahmed 0:791a779d6220 4 * Copyright (C) 1991-1997, Thomas G. Lane.
shoaib_ahmed 0:791a779d6220 5 * Modified 1997-2013 by Guido Vollbeding.
shoaib_ahmed 0:791a779d6220 6 * This file is part of the Independent JPEG Group's software.
shoaib_ahmed 0:791a779d6220 7 * For conditions of distribution and use, see the accompanying README file.
shoaib_ahmed 0:791a779d6220 8 *
shoaib_ahmed 0:791a779d6220 9 * This file provides common declarations for the various JPEG modules.
shoaib_ahmed 0:791a779d6220 10 * These declarations are considered internal to the JPEG library; most
shoaib_ahmed 0:791a779d6220 11 * applications using the library shouldn't need to include this file.
shoaib_ahmed 0:791a779d6220 12 */
shoaib_ahmed 0:791a779d6220 13
shoaib_ahmed 0:791a779d6220 14
shoaib_ahmed 0:791a779d6220 15 /* Declarations for both compression & decompression */
shoaib_ahmed 0:791a779d6220 16
shoaib_ahmed 0:791a779d6220 17 typedef enum { /* Operating modes for buffer controllers */
shoaib_ahmed 0:791a779d6220 18 JBUF_PASS_THRU, /* Plain stripwise operation */
shoaib_ahmed 0:791a779d6220 19 /* Remaining modes require a full-image buffer to have been created */
shoaib_ahmed 0:791a779d6220 20 JBUF_SAVE_SOURCE, /* Run source subobject only, save output */
shoaib_ahmed 0:791a779d6220 21 JBUF_CRANK_DEST, /* Run dest subobject only, using saved data */
shoaib_ahmed 0:791a779d6220 22 JBUF_SAVE_AND_PASS /* Run both subobjects, save output */
shoaib_ahmed 0:791a779d6220 23 } J_BUF_MODE;
shoaib_ahmed 0:791a779d6220 24
shoaib_ahmed 0:791a779d6220 25 /* Values of global_state field (jdapi.c has some dependencies on ordering!) */
shoaib_ahmed 0:791a779d6220 26 #define CSTATE_START 100 /* after create_compress */
shoaib_ahmed 0:791a779d6220 27 #define CSTATE_SCANNING 101 /* start_compress done, write_scanlines OK */
shoaib_ahmed 0:791a779d6220 28 #define CSTATE_RAW_OK 102 /* start_compress done, write_raw_data OK */
shoaib_ahmed 0:791a779d6220 29 #define CSTATE_WRCOEFS 103 /* jpeg_write_coefficients done */
shoaib_ahmed 0:791a779d6220 30 #define DSTATE_START 200 /* after create_decompress */
shoaib_ahmed 0:791a779d6220 31 #define DSTATE_INHEADER 201 /* reading header markers, no SOS yet */
shoaib_ahmed 0:791a779d6220 32 #define DSTATE_READY 202 /* found SOS, ready for start_decompress */
shoaib_ahmed 0:791a779d6220 33 #define DSTATE_PRELOAD 203 /* reading multiscan file in start_decompress*/
shoaib_ahmed 0:791a779d6220 34 #define DSTATE_PRESCAN 204 /* performing dummy pass for 2-pass quant */
shoaib_ahmed 0:791a779d6220 35 #define DSTATE_SCANNING 205 /* start_decompress done, read_scanlines OK */
shoaib_ahmed 0:791a779d6220 36 #define DSTATE_RAW_OK 206 /* start_decompress done, read_raw_data OK */
shoaib_ahmed 0:791a779d6220 37 #define DSTATE_BUFIMAGE 207 /* expecting jpeg_start_output */
shoaib_ahmed 0:791a779d6220 38 #define DSTATE_BUFPOST 208 /* looking for SOS/EOI in jpeg_finish_output */
shoaib_ahmed 0:791a779d6220 39 #define DSTATE_RDCOEFS 209 /* reading file in jpeg_read_coefficients */
shoaib_ahmed 0:791a779d6220 40 #define DSTATE_STOPPING 210 /* looking for EOI in jpeg_finish_decompress */
shoaib_ahmed 0:791a779d6220 41
shoaib_ahmed 0:791a779d6220 42
shoaib_ahmed 0:791a779d6220 43 /* Declarations for compression modules */
shoaib_ahmed 0:791a779d6220 44
shoaib_ahmed 0:791a779d6220 45 /* Master control module */
shoaib_ahmed 0:791a779d6220 46 struct jpeg_comp_master {
shoaib_ahmed 0:791a779d6220 47 JMETHOD(void, prepare_for_pass, (j_compress_ptr cinfo));
shoaib_ahmed 0:791a779d6220 48 JMETHOD(void, pass_startup, (j_compress_ptr cinfo));
shoaib_ahmed 0:791a779d6220 49 JMETHOD(void, finish_pass, (j_compress_ptr cinfo));
shoaib_ahmed 0:791a779d6220 50
shoaib_ahmed 0:791a779d6220 51 /* State variables made visible to other modules */
shoaib_ahmed 0:791a779d6220 52 boolean call_pass_startup; /* True if pass_startup must be called */
shoaib_ahmed 0:791a779d6220 53 boolean is_last_pass; /* True during last pass */
shoaib_ahmed 0:791a779d6220 54 };
shoaib_ahmed 0:791a779d6220 55
shoaib_ahmed 0:791a779d6220 56 /* Main buffer control (downsampled-data buffer) */
shoaib_ahmed 0:791a779d6220 57 struct jpeg_c_main_controller {
shoaib_ahmed 0:791a779d6220 58 JMETHOD(void, start_pass, (j_compress_ptr cinfo, J_BUF_MODE pass_mode));
shoaib_ahmed 0:791a779d6220 59 JMETHOD(void, process_data, (j_compress_ptr cinfo,
shoaib_ahmed 0:791a779d6220 60 JSAMPARRAY input_buf, JDIMENSION *in_row_ctr,
shoaib_ahmed 0:791a779d6220 61 JDIMENSION in_rows_avail));
shoaib_ahmed 0:791a779d6220 62 };
shoaib_ahmed 0:791a779d6220 63
shoaib_ahmed 0:791a779d6220 64 /* Compression preprocessing (downsampling input buffer control) */
shoaib_ahmed 0:791a779d6220 65 struct jpeg_c_prep_controller {
shoaib_ahmed 0:791a779d6220 66 JMETHOD(void, start_pass, (j_compress_ptr cinfo, J_BUF_MODE pass_mode));
shoaib_ahmed 0:791a779d6220 67 JMETHOD(void, pre_process_data, (j_compress_ptr cinfo,
shoaib_ahmed 0:791a779d6220 68 JSAMPARRAY input_buf,
shoaib_ahmed 0:791a779d6220 69 JDIMENSION *in_row_ctr,
shoaib_ahmed 0:791a779d6220 70 JDIMENSION in_rows_avail,
shoaib_ahmed 0:791a779d6220 71 JSAMPIMAGE output_buf,
shoaib_ahmed 0:791a779d6220 72 JDIMENSION *out_row_group_ctr,
shoaib_ahmed 0:791a779d6220 73 JDIMENSION out_row_groups_avail));
shoaib_ahmed 0:791a779d6220 74 };
shoaib_ahmed 0:791a779d6220 75
shoaib_ahmed 0:791a779d6220 76 /* Coefficient buffer control */
shoaib_ahmed 0:791a779d6220 77 struct jpeg_c_coef_controller {
shoaib_ahmed 0:791a779d6220 78 JMETHOD(void, start_pass, (j_compress_ptr cinfo, J_BUF_MODE pass_mode));
shoaib_ahmed 0:791a779d6220 79 JMETHOD(boolean, compress_data, (j_compress_ptr cinfo,
shoaib_ahmed 0:791a779d6220 80 JSAMPIMAGE input_buf));
shoaib_ahmed 0:791a779d6220 81 };
shoaib_ahmed 0:791a779d6220 82
shoaib_ahmed 0:791a779d6220 83 /* Colorspace conversion */
shoaib_ahmed 0:791a779d6220 84 struct jpeg_color_converter {
shoaib_ahmed 0:791a779d6220 85 JMETHOD(void, start_pass, (j_compress_ptr cinfo));
shoaib_ahmed 0:791a779d6220 86 JMETHOD(void, color_convert, (j_compress_ptr cinfo,
shoaib_ahmed 0:791a779d6220 87 JSAMPARRAY input_buf, JSAMPIMAGE output_buf,
shoaib_ahmed 0:791a779d6220 88 JDIMENSION output_row, int num_rows));
shoaib_ahmed 0:791a779d6220 89 };
shoaib_ahmed 0:791a779d6220 90
shoaib_ahmed 0:791a779d6220 91 /* Downsampling */
shoaib_ahmed 0:791a779d6220 92 struct jpeg_downsampler {
shoaib_ahmed 0:791a779d6220 93 JMETHOD(void, start_pass, (j_compress_ptr cinfo));
shoaib_ahmed 0:791a779d6220 94 JMETHOD(void, downsample, (j_compress_ptr cinfo,
shoaib_ahmed 0:791a779d6220 95 JSAMPIMAGE input_buf, JDIMENSION in_row_index,
shoaib_ahmed 0:791a779d6220 96 JSAMPIMAGE output_buf,
shoaib_ahmed 0:791a779d6220 97 JDIMENSION out_row_group_index));
shoaib_ahmed 0:791a779d6220 98
shoaib_ahmed 0:791a779d6220 99 boolean need_context_rows; /* TRUE if need rows above & below */
shoaib_ahmed 0:791a779d6220 100 };
shoaib_ahmed 0:791a779d6220 101
shoaib_ahmed 0:791a779d6220 102 /* Forward DCT (also controls coefficient quantization) */
shoaib_ahmed 0:791a779d6220 103 typedef JMETHOD(void, forward_DCT_ptr,
shoaib_ahmed 0:791a779d6220 104 (j_compress_ptr cinfo, jpeg_component_info * compptr,
shoaib_ahmed 0:791a779d6220 105 JSAMPARRAY sample_data, JBLOCKROW coef_blocks,
shoaib_ahmed 0:791a779d6220 106 JDIMENSION start_row, JDIMENSION start_col,
shoaib_ahmed 0:791a779d6220 107 JDIMENSION num_blocks));
shoaib_ahmed 0:791a779d6220 108
shoaib_ahmed 0:791a779d6220 109 struct jpeg_forward_dct {
shoaib_ahmed 0:791a779d6220 110 JMETHOD(void, start_pass, (j_compress_ptr cinfo));
shoaib_ahmed 0:791a779d6220 111 /* It is useful to allow each component to have a separate FDCT method. */
shoaib_ahmed 0:791a779d6220 112 forward_DCT_ptr forward_DCT[MAX_COMPONENTS];
shoaib_ahmed 0:791a779d6220 113 };
shoaib_ahmed 0:791a779d6220 114
shoaib_ahmed 0:791a779d6220 115 /* Entropy encoding */
shoaib_ahmed 0:791a779d6220 116 struct jpeg_entropy_encoder {
shoaib_ahmed 0:791a779d6220 117 JMETHOD(void, start_pass, (j_compress_ptr cinfo, boolean gather_statistics));
shoaib_ahmed 0:791a779d6220 118 JMETHOD(boolean, encode_mcu, (j_compress_ptr cinfo, JBLOCKROW *MCU_data));
shoaib_ahmed 0:791a779d6220 119 JMETHOD(void, finish_pass, (j_compress_ptr cinfo));
shoaib_ahmed 0:791a779d6220 120 };
shoaib_ahmed 0:791a779d6220 121
shoaib_ahmed 0:791a779d6220 122 /* Marker writing */
shoaib_ahmed 0:791a779d6220 123 struct jpeg_marker_writer {
shoaib_ahmed 0:791a779d6220 124 JMETHOD(void, write_file_header, (j_compress_ptr cinfo));
shoaib_ahmed 0:791a779d6220 125 JMETHOD(void, write_frame_header, (j_compress_ptr cinfo));
shoaib_ahmed 0:791a779d6220 126 JMETHOD(void, write_scan_header, (j_compress_ptr cinfo));
shoaib_ahmed 0:791a779d6220 127 JMETHOD(void, write_file_trailer, (j_compress_ptr cinfo));
shoaib_ahmed 0:791a779d6220 128 JMETHOD(void, write_tables_only, (j_compress_ptr cinfo));
shoaib_ahmed 0:791a779d6220 129 /* These routines are exported to allow insertion of extra markers */
shoaib_ahmed 0:791a779d6220 130 /* Probably only COM and APPn markers should be written this way */
shoaib_ahmed 0:791a779d6220 131 JMETHOD(void, write_marker_header, (j_compress_ptr cinfo, int marker,
shoaib_ahmed 0:791a779d6220 132 unsigned int datalen));
shoaib_ahmed 0:791a779d6220 133 JMETHOD(void, write_marker_byte, (j_compress_ptr cinfo, int val));
shoaib_ahmed 0:791a779d6220 134 };
shoaib_ahmed 0:791a779d6220 135
shoaib_ahmed 0:791a779d6220 136
shoaib_ahmed 0:791a779d6220 137 /* Declarations for decompression modules */
shoaib_ahmed 0:791a779d6220 138
shoaib_ahmed 0:791a779d6220 139 /* Master control module */
shoaib_ahmed 0:791a779d6220 140 struct jpeg_decomp_master {
shoaib_ahmed 0:791a779d6220 141 JMETHOD(void, prepare_for_output_pass, (j_decompress_ptr cinfo));
shoaib_ahmed 0:791a779d6220 142 JMETHOD(void, finish_output_pass, (j_decompress_ptr cinfo));
shoaib_ahmed 0:791a779d6220 143
shoaib_ahmed 0:791a779d6220 144 /* State variables made visible to other modules */
shoaib_ahmed 0:791a779d6220 145 boolean is_dummy_pass; /* True during 1st pass for 2-pass quant */
shoaib_ahmed 0:791a779d6220 146 };
shoaib_ahmed 0:791a779d6220 147
shoaib_ahmed 0:791a779d6220 148 /* Input control module */
shoaib_ahmed 0:791a779d6220 149 struct jpeg_input_controller {
shoaib_ahmed 0:791a779d6220 150 JMETHOD(int, consume_input, (j_decompress_ptr cinfo));
shoaib_ahmed 0:791a779d6220 151 JMETHOD(void, reset_input_controller, (j_decompress_ptr cinfo));
shoaib_ahmed 0:791a779d6220 152 JMETHOD(void, start_input_pass, (j_decompress_ptr cinfo));
shoaib_ahmed 0:791a779d6220 153 JMETHOD(void, finish_input_pass, (j_decompress_ptr cinfo));
shoaib_ahmed 0:791a779d6220 154
shoaib_ahmed 0:791a779d6220 155 /* State variables made visible to other modules */
shoaib_ahmed 0:791a779d6220 156 boolean has_multiple_scans; /* True if file has multiple scans */
shoaib_ahmed 0:791a779d6220 157 boolean eoi_reached; /* True when EOI has been consumed */
shoaib_ahmed 0:791a779d6220 158 };
shoaib_ahmed 0:791a779d6220 159
shoaib_ahmed 0:791a779d6220 160 /* Main buffer control (downsampled-data buffer) */
shoaib_ahmed 0:791a779d6220 161 struct jpeg_d_main_controller {
shoaib_ahmed 0:791a779d6220 162 JMETHOD(void, start_pass, (j_decompress_ptr cinfo, J_BUF_MODE pass_mode));
shoaib_ahmed 0:791a779d6220 163 JMETHOD(void, process_data, (j_decompress_ptr cinfo,
shoaib_ahmed 0:791a779d6220 164 JSAMPARRAY output_buf, JDIMENSION *out_row_ctr,
shoaib_ahmed 0:791a779d6220 165 JDIMENSION out_rows_avail));
shoaib_ahmed 0:791a779d6220 166 };
shoaib_ahmed 0:791a779d6220 167
shoaib_ahmed 0:791a779d6220 168 /* Coefficient buffer control */
shoaib_ahmed 0:791a779d6220 169 struct jpeg_d_coef_controller {
shoaib_ahmed 0:791a779d6220 170 JMETHOD(void, start_input_pass, (j_decompress_ptr cinfo));
shoaib_ahmed 0:791a779d6220 171 JMETHOD(int, consume_data, (j_decompress_ptr cinfo));
shoaib_ahmed 0:791a779d6220 172 JMETHOD(void, start_output_pass, (j_decompress_ptr cinfo));
shoaib_ahmed 0:791a779d6220 173 JMETHOD(int, decompress_data, (j_decompress_ptr cinfo,
shoaib_ahmed 0:791a779d6220 174 JSAMPIMAGE output_buf));
shoaib_ahmed 0:791a779d6220 175 /* Pointer to array of coefficient virtual arrays, or NULL if none */
shoaib_ahmed 0:791a779d6220 176 jvirt_barray_ptr *coef_arrays;
shoaib_ahmed 0:791a779d6220 177 };
shoaib_ahmed 0:791a779d6220 178
shoaib_ahmed 0:791a779d6220 179 /* Decompression postprocessing (color quantization buffer control) */
shoaib_ahmed 0:791a779d6220 180 struct jpeg_d_post_controller {
shoaib_ahmed 0:791a779d6220 181 JMETHOD(void, start_pass, (j_decompress_ptr cinfo, J_BUF_MODE pass_mode));
shoaib_ahmed 0:791a779d6220 182 JMETHOD(void, post_process_data, (j_decompress_ptr cinfo,
shoaib_ahmed 0:791a779d6220 183 JSAMPIMAGE input_buf,
shoaib_ahmed 0:791a779d6220 184 JDIMENSION *in_row_group_ctr,
shoaib_ahmed 0:791a779d6220 185 JDIMENSION in_row_groups_avail,
shoaib_ahmed 0:791a779d6220 186 JSAMPARRAY output_buf,
shoaib_ahmed 0:791a779d6220 187 JDIMENSION *out_row_ctr,
shoaib_ahmed 0:791a779d6220 188 JDIMENSION out_rows_avail));
shoaib_ahmed 0:791a779d6220 189 };
shoaib_ahmed 0:791a779d6220 190
shoaib_ahmed 0:791a779d6220 191 /* Marker reading & parsing */
shoaib_ahmed 0:791a779d6220 192 struct jpeg_marker_reader {
shoaib_ahmed 0:791a779d6220 193 JMETHOD(void, reset_marker_reader, (j_decompress_ptr cinfo));
shoaib_ahmed 0:791a779d6220 194 /* Read markers until SOS or EOI.
shoaib_ahmed 0:791a779d6220 195 * Returns same codes as are defined for jpeg_consume_input:
shoaib_ahmed 0:791a779d6220 196 * JPEG_SUSPENDED, JPEG_REACHED_SOS, or JPEG_REACHED_EOI.
shoaib_ahmed 0:791a779d6220 197 */
shoaib_ahmed 0:791a779d6220 198 JMETHOD(int, read_markers, (j_decompress_ptr cinfo));
shoaib_ahmed 0:791a779d6220 199 /* Read a restart marker --- exported for use by entropy decoder only */
shoaib_ahmed 0:791a779d6220 200 jpeg_marker_parser_method read_restart_marker;
shoaib_ahmed 0:791a779d6220 201
shoaib_ahmed 0:791a779d6220 202 /* State of marker reader --- nominally internal, but applications
shoaib_ahmed 0:791a779d6220 203 * supplying COM or APPn handlers might like to know the state.
shoaib_ahmed 0:791a779d6220 204 */
shoaib_ahmed 0:791a779d6220 205 boolean saw_SOI; /* found SOI? */
shoaib_ahmed 0:791a779d6220 206 boolean saw_SOF; /* found SOF? */
shoaib_ahmed 0:791a779d6220 207 int next_restart_num; /* next restart number expected (0-7) */
shoaib_ahmed 0:791a779d6220 208 unsigned int discarded_bytes; /* # of bytes skipped looking for a marker */
shoaib_ahmed 0:791a779d6220 209 };
shoaib_ahmed 0:791a779d6220 210
shoaib_ahmed 0:791a779d6220 211 /* Entropy decoding */
shoaib_ahmed 0:791a779d6220 212 struct jpeg_entropy_decoder {
shoaib_ahmed 0:791a779d6220 213 JMETHOD(void, start_pass, (j_decompress_ptr cinfo));
shoaib_ahmed 0:791a779d6220 214 JMETHOD(boolean, decode_mcu, (j_decompress_ptr cinfo, JBLOCKROW *MCU_data));
shoaib_ahmed 0:791a779d6220 215 JMETHOD(void, finish_pass, (j_decompress_ptr cinfo));
shoaib_ahmed 0:791a779d6220 216 };
shoaib_ahmed 0:791a779d6220 217
shoaib_ahmed 0:791a779d6220 218 /* Inverse DCT (also performs dequantization) */
shoaib_ahmed 0:791a779d6220 219 typedef JMETHOD(void, inverse_DCT_method_ptr,
shoaib_ahmed 0:791a779d6220 220 (j_decompress_ptr cinfo, jpeg_component_info * compptr,
shoaib_ahmed 0:791a779d6220 221 JCOEFPTR coef_block,
shoaib_ahmed 0:791a779d6220 222 JSAMPARRAY output_buf, JDIMENSION output_col));
shoaib_ahmed 0:791a779d6220 223
shoaib_ahmed 0:791a779d6220 224 struct jpeg_inverse_dct {
shoaib_ahmed 0:791a779d6220 225 JMETHOD(void, start_pass, (j_decompress_ptr cinfo));
shoaib_ahmed 0:791a779d6220 226 /* It is useful to allow each component to have a separate IDCT method. */
shoaib_ahmed 0:791a779d6220 227 inverse_DCT_method_ptr inverse_DCT[MAX_COMPONENTS];
shoaib_ahmed 0:791a779d6220 228 };
shoaib_ahmed 0:791a779d6220 229
shoaib_ahmed 0:791a779d6220 230 /* Upsampling (note that upsampler must also call color converter) */
shoaib_ahmed 0:791a779d6220 231 struct jpeg_upsampler {
shoaib_ahmed 0:791a779d6220 232 JMETHOD(void, start_pass, (j_decompress_ptr cinfo));
shoaib_ahmed 0:791a779d6220 233 JMETHOD(void, upsample, (j_decompress_ptr cinfo,
shoaib_ahmed 0:791a779d6220 234 JSAMPIMAGE input_buf,
shoaib_ahmed 0:791a779d6220 235 JDIMENSION *in_row_group_ctr,
shoaib_ahmed 0:791a779d6220 236 JDIMENSION in_row_groups_avail,
shoaib_ahmed 0:791a779d6220 237 JSAMPARRAY output_buf,
shoaib_ahmed 0:791a779d6220 238 JDIMENSION *out_row_ctr,
shoaib_ahmed 0:791a779d6220 239 JDIMENSION out_rows_avail));
shoaib_ahmed 0:791a779d6220 240
shoaib_ahmed 0:791a779d6220 241 boolean need_context_rows; /* TRUE if need rows above & below */
shoaib_ahmed 0:791a779d6220 242 };
shoaib_ahmed 0:791a779d6220 243
shoaib_ahmed 0:791a779d6220 244 /* Colorspace conversion */
shoaib_ahmed 0:791a779d6220 245 struct jpeg_color_deconverter {
shoaib_ahmed 0:791a779d6220 246 JMETHOD(void, start_pass, (j_decompress_ptr cinfo));
shoaib_ahmed 0:791a779d6220 247 JMETHOD(void, color_convert, (j_decompress_ptr cinfo,
shoaib_ahmed 0:791a779d6220 248 JSAMPIMAGE input_buf, JDIMENSION input_row,
shoaib_ahmed 0:791a779d6220 249 JSAMPARRAY output_buf, int num_rows));
shoaib_ahmed 0:791a779d6220 250 };
shoaib_ahmed 0:791a779d6220 251
shoaib_ahmed 0:791a779d6220 252 /* Color quantization or color precision reduction */
shoaib_ahmed 0:791a779d6220 253 struct jpeg_color_quantizer {
shoaib_ahmed 0:791a779d6220 254 JMETHOD(void, start_pass, (j_decompress_ptr cinfo, boolean is_pre_scan));
shoaib_ahmed 0:791a779d6220 255 JMETHOD(void, color_quantize, (j_decompress_ptr cinfo,
shoaib_ahmed 0:791a779d6220 256 JSAMPARRAY input_buf, JSAMPARRAY output_buf,
shoaib_ahmed 0:791a779d6220 257 int num_rows));
shoaib_ahmed 0:791a779d6220 258 JMETHOD(void, finish_pass, (j_decompress_ptr cinfo));
shoaib_ahmed 0:791a779d6220 259 JMETHOD(void, new_color_map, (j_decompress_ptr cinfo));
shoaib_ahmed 0:791a779d6220 260 };
shoaib_ahmed 0:791a779d6220 261
shoaib_ahmed 0:791a779d6220 262
shoaib_ahmed 0:791a779d6220 263 /* Miscellaneous useful macros */
shoaib_ahmed 0:791a779d6220 264
shoaib_ahmed 0:791a779d6220 265 #undef MAX
shoaib_ahmed 0:791a779d6220 266 #define MAX(a,b) ((a) > (b) ? (a) : (b))
shoaib_ahmed 0:791a779d6220 267 #undef MIN
shoaib_ahmed 0:791a779d6220 268 #define MIN(a,b) ((a) < (b) ? (a) : (b))
shoaib_ahmed 0:791a779d6220 269
shoaib_ahmed 0:791a779d6220 270
shoaib_ahmed 0:791a779d6220 271 /* We assume that right shift corresponds to signed division by 2 with
shoaib_ahmed 0:791a779d6220 272 * rounding towards minus infinity. This is correct for typical "arithmetic
shoaib_ahmed 0:791a779d6220 273 * shift" instructions that shift in copies of the sign bit. But some
shoaib_ahmed 0:791a779d6220 274 * C compilers implement >> with an unsigned shift. For these machines you
shoaib_ahmed 0:791a779d6220 275 * must define RIGHT_SHIFT_IS_UNSIGNED.
shoaib_ahmed 0:791a779d6220 276 * RIGHT_SHIFT provides a proper signed right shift of an INT32 quantity.
shoaib_ahmed 0:791a779d6220 277 * It is only applied with constant shift counts. SHIFT_TEMPS must be
shoaib_ahmed 0:791a779d6220 278 * included in the variables of any routine using RIGHT_SHIFT.
shoaib_ahmed 0:791a779d6220 279 */
shoaib_ahmed 0:791a779d6220 280
shoaib_ahmed 0:791a779d6220 281 #ifdef RIGHT_SHIFT_IS_UNSIGNED
shoaib_ahmed 0:791a779d6220 282 #define SHIFT_TEMPS INT32 shift_temp;
shoaib_ahmed 0:791a779d6220 283 #define RIGHT_SHIFT(x,shft) \
shoaib_ahmed 0:791a779d6220 284 ((shift_temp = (x)) < 0 ? \
shoaib_ahmed 0:791a779d6220 285 (shift_temp >> (shft)) | ((~((INT32) 0)) << (32-(shft))) : \
shoaib_ahmed 0:791a779d6220 286 (shift_temp >> (shft)))
shoaib_ahmed 0:791a779d6220 287 #else
shoaib_ahmed 0:791a779d6220 288 #define SHIFT_TEMPS
shoaib_ahmed 0:791a779d6220 289 #define RIGHT_SHIFT(x,shft) ((x) >> (shft))
shoaib_ahmed 0:791a779d6220 290 #endif
shoaib_ahmed 0:791a779d6220 291
shoaib_ahmed 0:791a779d6220 292
shoaib_ahmed 0:791a779d6220 293 /* Short forms of external names for systems with brain-damaged linkers. */
shoaib_ahmed 0:791a779d6220 294
shoaib_ahmed 0:791a779d6220 295 #ifdef NEED_SHORT_EXTERNAL_NAMES
shoaib_ahmed 0:791a779d6220 296 #define jinit_compress_master jICompress
shoaib_ahmed 0:791a779d6220 297 #define jinit_c_master_control jICMaster
shoaib_ahmed 0:791a779d6220 298 #define jinit_c_main_controller jICMainC
shoaib_ahmed 0:791a779d6220 299 #define jinit_c_prep_controller jICPrepC
shoaib_ahmed 0:791a779d6220 300 #define jinit_c_coef_controller jICCoefC
shoaib_ahmed 0:791a779d6220 301 #define jinit_color_converter jICColor
shoaib_ahmed 0:791a779d6220 302 #define jinit_downsampler jIDownsampler
shoaib_ahmed 0:791a779d6220 303 #define jinit_forward_dct jIFDCT
shoaib_ahmed 0:791a779d6220 304 #define jinit_huff_encoder jIHEncoder
shoaib_ahmed 0:791a779d6220 305 #define jinit_arith_encoder jIAEncoder
shoaib_ahmed 0:791a779d6220 306 #define jinit_marker_writer jIMWriter
shoaib_ahmed 0:791a779d6220 307 #define jinit_master_decompress jIDMaster
shoaib_ahmed 0:791a779d6220 308 #define jinit_d_main_controller jIDMainC
shoaib_ahmed 0:791a779d6220 309 #define jinit_d_coef_controller jIDCoefC
shoaib_ahmed 0:791a779d6220 310 #define jinit_d_post_controller jIDPostC
shoaib_ahmed 0:791a779d6220 311 #define jinit_input_controller jIInCtlr
shoaib_ahmed 0:791a779d6220 312 #define jinit_marker_reader jIMReader
shoaib_ahmed 0:791a779d6220 313 #define jinit_huff_decoder jIHDecoder
shoaib_ahmed 0:791a779d6220 314 #define jinit_arith_decoder jIADecoder
shoaib_ahmed 0:791a779d6220 315 #define jinit_inverse_dct jIIDCT
shoaib_ahmed 0:791a779d6220 316 #define jinit_upsampler jIUpsampler
shoaib_ahmed 0:791a779d6220 317 #define jinit_color_deconverter jIDColor
shoaib_ahmed 0:791a779d6220 318 #define jinit_1pass_quantizer jI1Quant
shoaib_ahmed 0:791a779d6220 319 #define jinit_2pass_quantizer jI2Quant
shoaib_ahmed 0:791a779d6220 320 #define jinit_merged_upsampler jIMUpsampler
shoaib_ahmed 0:791a779d6220 321 #define jinit_memory_mgr jIMemMgr
shoaib_ahmed 0:791a779d6220 322 #define jdiv_round_up jDivRound
shoaib_ahmed 0:791a779d6220 323 #define jround_up jRound
shoaib_ahmed 0:791a779d6220 324 #define jzero_far jZeroFar
shoaib_ahmed 0:791a779d6220 325 #define jcopy_sample_rows jCopySamples
shoaib_ahmed 0:791a779d6220 326 #define jcopy_block_row jCopyBlocks
shoaib_ahmed 0:791a779d6220 327 #define jpeg_zigzag_order jZIGTable
shoaib_ahmed 0:791a779d6220 328 #define jpeg_natural_order jZAGTable
shoaib_ahmed 0:791a779d6220 329 #define jpeg_natural_order7 jZAG7Table
shoaib_ahmed 0:791a779d6220 330 #define jpeg_natural_order6 jZAG6Table
shoaib_ahmed 0:791a779d6220 331 #define jpeg_natural_order5 jZAG5Table
shoaib_ahmed 0:791a779d6220 332 #define jpeg_natural_order4 jZAG4Table
shoaib_ahmed 0:791a779d6220 333 #define jpeg_natural_order3 jZAG3Table
shoaib_ahmed 0:791a779d6220 334 #define jpeg_natural_order2 jZAG2Table
shoaib_ahmed 0:791a779d6220 335 #define jpeg_aritab jAriTab
shoaib_ahmed 0:791a779d6220 336 #endif /* NEED_SHORT_EXTERNAL_NAMES */
shoaib_ahmed 0:791a779d6220 337
shoaib_ahmed 0:791a779d6220 338
shoaib_ahmed 0:791a779d6220 339 /* On normal machines we can apply MEMCOPY() and MEMZERO() to sample arrays
shoaib_ahmed 0:791a779d6220 340 * and coefficient-block arrays. This won't work on 80x86 because the arrays
shoaib_ahmed 0:791a779d6220 341 * are FAR and we're assuming a small-pointer memory model. However, some
shoaib_ahmed 0:791a779d6220 342 * DOS compilers provide far-pointer versions of memcpy() and memset() even
shoaib_ahmed 0:791a779d6220 343 * in the small-model libraries. These will be used if USE_FMEM is defined.
shoaib_ahmed 0:791a779d6220 344 * Otherwise, the routines in jutils.c do it the hard way.
shoaib_ahmed 0:791a779d6220 345 */
shoaib_ahmed 0:791a779d6220 346
shoaib_ahmed 0:791a779d6220 347 #ifndef NEED_FAR_POINTERS /* normal case, same as regular macro */
shoaib_ahmed 0:791a779d6220 348 #define FMEMZERO(target,size) MEMZERO(target,size)
shoaib_ahmed 0:791a779d6220 349 #else /* 80x86 case */
shoaib_ahmed 0:791a779d6220 350 #ifdef USE_FMEM
shoaib_ahmed 0:791a779d6220 351 #define FMEMZERO(target,size) _fmemset((void FAR *)(target), 0, (size_t)(size))
shoaib_ahmed 0:791a779d6220 352 #else
shoaib_ahmed 0:791a779d6220 353 EXTERN(void) jzero_far JPP((void FAR * target, size_t bytestozero));
shoaib_ahmed 0:791a779d6220 354 #define FMEMZERO(target,size) jzero_far(target, size)
shoaib_ahmed 0:791a779d6220 355 #endif
shoaib_ahmed 0:791a779d6220 356 #endif
shoaib_ahmed 0:791a779d6220 357
shoaib_ahmed 0:791a779d6220 358
shoaib_ahmed 0:791a779d6220 359 /* Compression module initialization routines */
shoaib_ahmed 0:791a779d6220 360 EXTERN(void) jinit_compress_master JPP((j_compress_ptr cinfo));
shoaib_ahmed 0:791a779d6220 361 EXTERN(void) jinit_c_master_control JPP((j_compress_ptr cinfo,
shoaib_ahmed 0:791a779d6220 362 boolean transcode_only));
shoaib_ahmed 0:791a779d6220 363 EXTERN(void) jinit_c_main_controller JPP((j_compress_ptr cinfo,
shoaib_ahmed 0:791a779d6220 364 boolean need_full_buffer));
shoaib_ahmed 0:791a779d6220 365 EXTERN(void) jinit_c_prep_controller JPP((j_compress_ptr cinfo,
shoaib_ahmed 0:791a779d6220 366 boolean need_full_buffer));
shoaib_ahmed 0:791a779d6220 367 EXTERN(void) jinit_c_coef_controller JPP((j_compress_ptr cinfo,
shoaib_ahmed 0:791a779d6220 368 boolean need_full_buffer));
shoaib_ahmed 0:791a779d6220 369 EXTERN(void) jinit_color_converter JPP((j_compress_ptr cinfo));
shoaib_ahmed 0:791a779d6220 370 EXTERN(void) jinit_downsampler JPP((j_compress_ptr cinfo));
shoaib_ahmed 0:791a779d6220 371 EXTERN(void) jinit_forward_dct JPP((j_compress_ptr cinfo));
shoaib_ahmed 0:791a779d6220 372 EXTERN(void) jinit_huff_encoder JPP((j_compress_ptr cinfo));
shoaib_ahmed 0:791a779d6220 373 EXTERN(void) jinit_arith_encoder JPP((j_compress_ptr cinfo));
shoaib_ahmed 0:791a779d6220 374 EXTERN(void) jinit_marker_writer JPP((j_compress_ptr cinfo));
shoaib_ahmed 0:791a779d6220 375 /* Decompression module initialization routines */
shoaib_ahmed 0:791a779d6220 376 EXTERN(void) jinit_master_decompress JPP((j_decompress_ptr cinfo));
shoaib_ahmed 0:791a779d6220 377 EXTERN(void) jinit_d_main_controller JPP((j_decompress_ptr cinfo,
shoaib_ahmed 0:791a779d6220 378 boolean need_full_buffer));
shoaib_ahmed 0:791a779d6220 379 EXTERN(void) jinit_d_coef_controller JPP((j_decompress_ptr cinfo,
shoaib_ahmed 0:791a779d6220 380 boolean need_full_buffer));
shoaib_ahmed 0:791a779d6220 381 EXTERN(void) jinit_d_post_controller JPP((j_decompress_ptr cinfo,
shoaib_ahmed 0:791a779d6220 382 boolean need_full_buffer));
shoaib_ahmed 0:791a779d6220 383 EXTERN(void) jinit_input_controller JPP((j_decompress_ptr cinfo));
shoaib_ahmed 0:791a779d6220 384 EXTERN(void) jinit_marker_reader JPP((j_decompress_ptr cinfo));
shoaib_ahmed 0:791a779d6220 385 EXTERN(void) jinit_huff_decoder JPP((j_decompress_ptr cinfo));
shoaib_ahmed 0:791a779d6220 386 EXTERN(void) jinit_arith_decoder JPP((j_decompress_ptr cinfo));
shoaib_ahmed 0:791a779d6220 387 EXTERN(void) jinit_inverse_dct JPP((j_decompress_ptr cinfo));
shoaib_ahmed 0:791a779d6220 388 EXTERN(void) jinit_upsampler JPP((j_decompress_ptr cinfo));
shoaib_ahmed 0:791a779d6220 389 EXTERN(void) jinit_color_deconverter JPP((j_decompress_ptr cinfo));
shoaib_ahmed 0:791a779d6220 390 EXTERN(void) jinit_1pass_quantizer JPP((j_decompress_ptr cinfo));
shoaib_ahmed 0:791a779d6220 391 EXTERN(void) jinit_2pass_quantizer JPP((j_decompress_ptr cinfo));
shoaib_ahmed 0:791a779d6220 392 EXTERN(void) jinit_merged_upsampler JPP((j_decompress_ptr cinfo));
shoaib_ahmed 0:791a779d6220 393 /* Memory manager initialization */
shoaib_ahmed 0:791a779d6220 394 EXTERN(void) jinit_memory_mgr JPP((j_common_ptr cinfo));
shoaib_ahmed 0:791a779d6220 395
shoaib_ahmed 0:791a779d6220 396 /* Utility routines in jutils.c */
shoaib_ahmed 0:791a779d6220 397 EXTERN(long) jdiv_round_up JPP((long a, long b));
shoaib_ahmed 0:791a779d6220 398 EXTERN(long) jround_up JPP((long a, long b));
shoaib_ahmed 0:791a779d6220 399 EXTERN(void) jcopy_sample_rows JPP((JSAMPARRAY input_array, int source_row,
shoaib_ahmed 0:791a779d6220 400 JSAMPARRAY output_array, int dest_row,
shoaib_ahmed 0:791a779d6220 401 int num_rows, JDIMENSION num_cols));
shoaib_ahmed 0:791a779d6220 402 EXTERN(void) jcopy_block_row JPP((JBLOCKROW input_row, JBLOCKROW output_row,
shoaib_ahmed 0:791a779d6220 403 JDIMENSION num_blocks));
shoaib_ahmed 0:791a779d6220 404 /* Constant tables in jutils.c */
shoaib_ahmed 0:791a779d6220 405 #if 0 /* This table is not actually needed in v6a */
shoaib_ahmed 0:791a779d6220 406 extern const int jpeg_zigzag_order[]; /* natural coef order to zigzag order */
shoaib_ahmed 0:791a779d6220 407 #endif
shoaib_ahmed 0:791a779d6220 408 extern const int jpeg_natural_order[]; /* zigzag coef order to natural order */
shoaib_ahmed 0:791a779d6220 409 extern const int jpeg_natural_order7[]; /* zz to natural order for 7x7 block */
shoaib_ahmed 0:791a779d6220 410 extern const int jpeg_natural_order6[]; /* zz to natural order for 6x6 block */
shoaib_ahmed 0:791a779d6220 411 extern const int jpeg_natural_order5[]; /* zz to natural order for 5x5 block */
shoaib_ahmed 0:791a779d6220 412 extern const int jpeg_natural_order4[]; /* zz to natural order for 4x4 block */
shoaib_ahmed 0:791a779d6220 413 extern const int jpeg_natural_order3[]; /* zz to natural order for 3x3 block */
shoaib_ahmed 0:791a779d6220 414 extern const int jpeg_natural_order2[]; /* zz to natural order for 2x2 block */
shoaib_ahmed 0:791a779d6220 415
shoaib_ahmed 0:791a779d6220 416 /* Arithmetic coding probability estimation tables in jaricom.c */
shoaib_ahmed 0:791a779d6220 417 extern const INT32 jpeg_aritab[];
shoaib_ahmed 0:791a779d6220 418
shoaib_ahmed 0:791a779d6220 419 /* Suppress undefined-structure complaints if necessary. */
shoaib_ahmed 0:791a779d6220 420
shoaib_ahmed 0:791a779d6220 421 #ifdef INCOMPLETE_TYPES_BROKEN
shoaib_ahmed 0:791a779d6220 422 #ifndef AM_MEMORY_MANAGER /* only jmemmgr.c defines these */
shoaib_ahmed 0:791a779d6220 423 struct jvirt_sarray_control { long dummy; };
shoaib_ahmed 0:791a779d6220 424 struct jvirt_barray_control { long dummy; };
shoaib_ahmed 0:791a779d6220 425 #endif
shoaib_ahmed 0:791a779d6220 426 #endif /* INCOMPLETE_TYPES_BROKEN */