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 * jdpostct.c
shoaib_ahmed 0:791a779d6220 3 *
shoaib_ahmed 0:791a779d6220 4 * Copyright (C) 1994-1996, 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 the decompression postprocessing controller.
shoaib_ahmed 0:791a779d6220 9 * This controller manages the upsampling, color conversion, and color
shoaib_ahmed 0:791a779d6220 10 * quantization/reduction steps; specifically, it controls the buffering
shoaib_ahmed 0:791a779d6220 11 * between upsample/color conversion and color quantization/reduction.
shoaib_ahmed 0:791a779d6220 12 *
shoaib_ahmed 0:791a779d6220 13 * If no color quantization/reduction is required, then this module has no
shoaib_ahmed 0:791a779d6220 14 * work to do, and it just hands off to the upsample/color conversion code.
shoaib_ahmed 0:791a779d6220 15 * An integrated upsample/convert/quantize process would replace this module
shoaib_ahmed 0:791a779d6220 16 * entirely.
shoaib_ahmed 0:791a779d6220 17 */
shoaib_ahmed 0:791a779d6220 18
shoaib_ahmed 0:791a779d6220 19 #define JPEG_INTERNALS
shoaib_ahmed 0:791a779d6220 20 #include "jinclude.h"
shoaib_ahmed 0:791a779d6220 21 #include "jpeglib.h"
shoaib_ahmed 0:791a779d6220 22
shoaib_ahmed 0:791a779d6220 23
shoaib_ahmed 0:791a779d6220 24 /* Private buffer controller object */
shoaib_ahmed 0:791a779d6220 25
shoaib_ahmed 0:791a779d6220 26 typedef struct {
shoaib_ahmed 0:791a779d6220 27 struct jpeg_d_post_controller pub; /* public fields */
shoaib_ahmed 0:791a779d6220 28
shoaib_ahmed 0:791a779d6220 29 /* Color quantization source buffer: this holds output data from
shoaib_ahmed 0:791a779d6220 30 * the upsample/color conversion step to be passed to the quantizer.
shoaib_ahmed 0:791a779d6220 31 * For two-pass color quantization, we need a full-image buffer;
shoaib_ahmed 0:791a779d6220 32 * for one-pass operation, a strip buffer is sufficient.
shoaib_ahmed 0:791a779d6220 33 */
shoaib_ahmed 0:791a779d6220 34 jvirt_sarray_ptr whole_image; /* virtual array, or NULL if one-pass */
shoaib_ahmed 0:791a779d6220 35 JSAMPARRAY buffer; /* strip buffer, or current strip of virtual */
shoaib_ahmed 0:791a779d6220 36 JDIMENSION strip_height; /* buffer size in rows */
shoaib_ahmed 0:791a779d6220 37 /* for two-pass mode only: */
shoaib_ahmed 0:791a779d6220 38 JDIMENSION starting_row; /* row # of first row in current strip */
shoaib_ahmed 0:791a779d6220 39 JDIMENSION next_row; /* index of next row to fill/empty in strip */
shoaib_ahmed 0:791a779d6220 40 } my_post_controller;
shoaib_ahmed 0:791a779d6220 41
shoaib_ahmed 0:791a779d6220 42 typedef my_post_controller * my_post_ptr;
shoaib_ahmed 0:791a779d6220 43
shoaib_ahmed 0:791a779d6220 44
shoaib_ahmed 0:791a779d6220 45 /* Forward declarations */
shoaib_ahmed 0:791a779d6220 46 METHODDEF(void) post_process_1pass
shoaib_ahmed 0:791a779d6220 47 JPP((j_decompress_ptr cinfo,
shoaib_ahmed 0:791a779d6220 48 JSAMPIMAGE input_buf, JDIMENSION *in_row_group_ctr,
shoaib_ahmed 0:791a779d6220 49 JDIMENSION in_row_groups_avail,
shoaib_ahmed 0:791a779d6220 50 JSAMPARRAY output_buf, JDIMENSION *out_row_ctr,
shoaib_ahmed 0:791a779d6220 51 JDIMENSION out_rows_avail));
shoaib_ahmed 0:791a779d6220 52 #ifdef QUANT_2PASS_SUPPORTED
shoaib_ahmed 0:791a779d6220 53 METHODDEF(void) post_process_prepass
shoaib_ahmed 0:791a779d6220 54 JPP((j_decompress_ptr cinfo,
shoaib_ahmed 0:791a779d6220 55 JSAMPIMAGE input_buf, JDIMENSION *in_row_group_ctr,
shoaib_ahmed 0:791a779d6220 56 JDIMENSION in_row_groups_avail,
shoaib_ahmed 0:791a779d6220 57 JSAMPARRAY output_buf, JDIMENSION *out_row_ctr,
shoaib_ahmed 0:791a779d6220 58 JDIMENSION out_rows_avail));
shoaib_ahmed 0:791a779d6220 59 METHODDEF(void) post_process_2pass
shoaib_ahmed 0:791a779d6220 60 JPP((j_decompress_ptr cinfo,
shoaib_ahmed 0:791a779d6220 61 JSAMPIMAGE input_buf, JDIMENSION *in_row_group_ctr,
shoaib_ahmed 0:791a779d6220 62 JDIMENSION in_row_groups_avail,
shoaib_ahmed 0:791a779d6220 63 JSAMPARRAY output_buf, JDIMENSION *out_row_ctr,
shoaib_ahmed 0:791a779d6220 64 JDIMENSION out_rows_avail));
shoaib_ahmed 0:791a779d6220 65 #endif
shoaib_ahmed 0:791a779d6220 66
shoaib_ahmed 0:791a779d6220 67
shoaib_ahmed 0:791a779d6220 68 /*
shoaib_ahmed 0:791a779d6220 69 * Initialize for a processing pass.
shoaib_ahmed 0:791a779d6220 70 */
shoaib_ahmed 0:791a779d6220 71
shoaib_ahmed 0:791a779d6220 72 METHODDEF(void)
shoaib_ahmed 0:791a779d6220 73 start_pass_dpost (j_decompress_ptr cinfo, J_BUF_MODE pass_mode)
shoaib_ahmed 0:791a779d6220 74 {
shoaib_ahmed 0:791a779d6220 75 my_post_ptr post = (my_post_ptr) cinfo->post;
shoaib_ahmed 0:791a779d6220 76
shoaib_ahmed 0:791a779d6220 77 switch (pass_mode) {
shoaib_ahmed 0:791a779d6220 78 case JBUF_PASS_THRU:
shoaib_ahmed 0:791a779d6220 79 if (cinfo->quantize_colors) {
shoaib_ahmed 0:791a779d6220 80 /* Single-pass processing with color quantization. */
shoaib_ahmed 0:791a779d6220 81 post->pub.post_process_data = post_process_1pass;
shoaib_ahmed 0:791a779d6220 82 /* We could be doing buffered-image output before starting a 2-pass
shoaib_ahmed 0:791a779d6220 83 * color quantization; in that case, jinit_d_post_controller did not
shoaib_ahmed 0:791a779d6220 84 * allocate a strip buffer. Use the virtual-array buffer as workspace.
shoaib_ahmed 0:791a779d6220 85 */
shoaib_ahmed 0:791a779d6220 86 if (post->buffer == NULL) {
shoaib_ahmed 0:791a779d6220 87 post->buffer = (*cinfo->mem->access_virt_sarray)
shoaib_ahmed 0:791a779d6220 88 ((j_common_ptr) cinfo, post->whole_image,
shoaib_ahmed 0:791a779d6220 89 (JDIMENSION) 0, post->strip_height, TRUE);
shoaib_ahmed 0:791a779d6220 90 }
shoaib_ahmed 0:791a779d6220 91 } else {
shoaib_ahmed 0:791a779d6220 92 /* For single-pass processing without color quantization,
shoaib_ahmed 0:791a779d6220 93 * I have no work to do; just call the upsampler directly.
shoaib_ahmed 0:791a779d6220 94 */
shoaib_ahmed 0:791a779d6220 95 post->pub.post_process_data = cinfo->upsample->upsample;
shoaib_ahmed 0:791a779d6220 96 }
shoaib_ahmed 0:791a779d6220 97 break;
shoaib_ahmed 0:791a779d6220 98 #ifdef QUANT_2PASS_SUPPORTED
shoaib_ahmed 0:791a779d6220 99 case JBUF_SAVE_AND_PASS:
shoaib_ahmed 0:791a779d6220 100 /* First pass of 2-pass quantization */
shoaib_ahmed 0:791a779d6220 101 if (post->whole_image == NULL)
shoaib_ahmed 0:791a779d6220 102 ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
shoaib_ahmed 0:791a779d6220 103 post->pub.post_process_data = post_process_prepass;
shoaib_ahmed 0:791a779d6220 104 break;
shoaib_ahmed 0:791a779d6220 105 case JBUF_CRANK_DEST:
shoaib_ahmed 0:791a779d6220 106 /* Second pass of 2-pass quantization */
shoaib_ahmed 0:791a779d6220 107 if (post->whole_image == NULL)
shoaib_ahmed 0:791a779d6220 108 ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
shoaib_ahmed 0:791a779d6220 109 post->pub.post_process_data = post_process_2pass;
shoaib_ahmed 0:791a779d6220 110 break;
shoaib_ahmed 0:791a779d6220 111 #endif /* QUANT_2PASS_SUPPORTED */
shoaib_ahmed 0:791a779d6220 112 default:
shoaib_ahmed 0:791a779d6220 113 ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
shoaib_ahmed 0:791a779d6220 114 break;
shoaib_ahmed 0:791a779d6220 115 }
shoaib_ahmed 0:791a779d6220 116 post->starting_row = post->next_row = 0;
shoaib_ahmed 0:791a779d6220 117 }
shoaib_ahmed 0:791a779d6220 118
shoaib_ahmed 0:791a779d6220 119
shoaib_ahmed 0:791a779d6220 120 /*
shoaib_ahmed 0:791a779d6220 121 * Process some data in the one-pass (strip buffer) case.
shoaib_ahmed 0:791a779d6220 122 * This is used for color precision reduction as well as one-pass quantization.
shoaib_ahmed 0:791a779d6220 123 */
shoaib_ahmed 0:791a779d6220 124
shoaib_ahmed 0:791a779d6220 125 METHODDEF(void)
shoaib_ahmed 0:791a779d6220 126 post_process_1pass (j_decompress_ptr cinfo,
shoaib_ahmed 0:791a779d6220 127 JSAMPIMAGE input_buf, JDIMENSION *in_row_group_ctr,
shoaib_ahmed 0:791a779d6220 128 JDIMENSION in_row_groups_avail,
shoaib_ahmed 0:791a779d6220 129 JSAMPARRAY output_buf, JDIMENSION *out_row_ctr,
shoaib_ahmed 0:791a779d6220 130 JDIMENSION out_rows_avail)
shoaib_ahmed 0:791a779d6220 131 {
shoaib_ahmed 0:791a779d6220 132 my_post_ptr post = (my_post_ptr) cinfo->post;
shoaib_ahmed 0:791a779d6220 133 JDIMENSION num_rows, max_rows;
shoaib_ahmed 0:791a779d6220 134
shoaib_ahmed 0:791a779d6220 135 /* Fill the buffer, but not more than what we can dump out in one go. */
shoaib_ahmed 0:791a779d6220 136 /* Note we rely on the upsampler to detect bottom of image. */
shoaib_ahmed 0:791a779d6220 137 max_rows = out_rows_avail - *out_row_ctr;
shoaib_ahmed 0:791a779d6220 138 if (max_rows > post->strip_height)
shoaib_ahmed 0:791a779d6220 139 max_rows = post->strip_height;
shoaib_ahmed 0:791a779d6220 140 num_rows = 0;
shoaib_ahmed 0:791a779d6220 141 (*cinfo->upsample->upsample) (cinfo,
shoaib_ahmed 0:791a779d6220 142 input_buf, in_row_group_ctr, in_row_groups_avail,
shoaib_ahmed 0:791a779d6220 143 post->buffer, &num_rows, max_rows);
shoaib_ahmed 0:791a779d6220 144 /* Quantize and emit data. */
shoaib_ahmed 0:791a779d6220 145 (*cinfo->cquantize->color_quantize) (cinfo,
shoaib_ahmed 0:791a779d6220 146 post->buffer, output_buf + *out_row_ctr, (int) num_rows);
shoaib_ahmed 0:791a779d6220 147 *out_row_ctr += num_rows;
shoaib_ahmed 0:791a779d6220 148 }
shoaib_ahmed 0:791a779d6220 149
shoaib_ahmed 0:791a779d6220 150
shoaib_ahmed 0:791a779d6220 151 #ifdef QUANT_2PASS_SUPPORTED
shoaib_ahmed 0:791a779d6220 152
shoaib_ahmed 0:791a779d6220 153 /*
shoaib_ahmed 0:791a779d6220 154 * Process some data in the first pass of 2-pass quantization.
shoaib_ahmed 0:791a779d6220 155 */
shoaib_ahmed 0:791a779d6220 156
shoaib_ahmed 0:791a779d6220 157 METHODDEF(void)
shoaib_ahmed 0:791a779d6220 158 post_process_prepass (j_decompress_ptr cinfo,
shoaib_ahmed 0:791a779d6220 159 JSAMPIMAGE input_buf, JDIMENSION *in_row_group_ctr,
shoaib_ahmed 0:791a779d6220 160 JDIMENSION in_row_groups_avail,
shoaib_ahmed 0:791a779d6220 161 JSAMPARRAY output_buf, JDIMENSION *out_row_ctr,
shoaib_ahmed 0:791a779d6220 162 JDIMENSION out_rows_avail)
shoaib_ahmed 0:791a779d6220 163 {
shoaib_ahmed 0:791a779d6220 164 my_post_ptr post = (my_post_ptr) cinfo->post;
shoaib_ahmed 0:791a779d6220 165 JDIMENSION old_next_row, num_rows;
shoaib_ahmed 0:791a779d6220 166
shoaib_ahmed 0:791a779d6220 167 /* Reposition virtual buffer if at start of strip. */
shoaib_ahmed 0:791a779d6220 168 if (post->next_row == 0) {
shoaib_ahmed 0:791a779d6220 169 post->buffer = (*cinfo->mem->access_virt_sarray)
shoaib_ahmed 0:791a779d6220 170 ((j_common_ptr) cinfo, post->whole_image,
shoaib_ahmed 0:791a779d6220 171 post->starting_row, post->strip_height, TRUE);
shoaib_ahmed 0:791a779d6220 172 }
shoaib_ahmed 0:791a779d6220 173
shoaib_ahmed 0:791a779d6220 174 /* Upsample some data (up to a strip height's worth). */
shoaib_ahmed 0:791a779d6220 175 old_next_row = post->next_row;
shoaib_ahmed 0:791a779d6220 176 (*cinfo->upsample->upsample) (cinfo,
shoaib_ahmed 0:791a779d6220 177 input_buf, in_row_group_ctr, in_row_groups_avail,
shoaib_ahmed 0:791a779d6220 178 post->buffer, &post->next_row, post->strip_height);
shoaib_ahmed 0:791a779d6220 179
shoaib_ahmed 0:791a779d6220 180 /* Allow quantizer to scan new data. No data is emitted, */
shoaib_ahmed 0:791a779d6220 181 /* but we advance out_row_ctr so outer loop can tell when we're done. */
shoaib_ahmed 0:791a779d6220 182 if (post->next_row > old_next_row) {
shoaib_ahmed 0:791a779d6220 183 num_rows = post->next_row - old_next_row;
shoaib_ahmed 0:791a779d6220 184 (*cinfo->cquantize->color_quantize) (cinfo, post->buffer + old_next_row,
shoaib_ahmed 0:791a779d6220 185 (JSAMPARRAY) NULL, (int) num_rows);
shoaib_ahmed 0:791a779d6220 186 *out_row_ctr += num_rows;
shoaib_ahmed 0:791a779d6220 187 }
shoaib_ahmed 0:791a779d6220 188
shoaib_ahmed 0:791a779d6220 189 /* Advance if we filled the strip. */
shoaib_ahmed 0:791a779d6220 190 if (post->next_row >= post->strip_height) {
shoaib_ahmed 0:791a779d6220 191 post->starting_row += post->strip_height;
shoaib_ahmed 0:791a779d6220 192 post->next_row = 0;
shoaib_ahmed 0:791a779d6220 193 }
shoaib_ahmed 0:791a779d6220 194 }
shoaib_ahmed 0:791a779d6220 195
shoaib_ahmed 0:791a779d6220 196
shoaib_ahmed 0:791a779d6220 197 /*
shoaib_ahmed 0:791a779d6220 198 * Process some data in the second pass of 2-pass quantization.
shoaib_ahmed 0:791a779d6220 199 */
shoaib_ahmed 0:791a779d6220 200
shoaib_ahmed 0:791a779d6220 201 METHODDEF(void)
shoaib_ahmed 0:791a779d6220 202 post_process_2pass (j_decompress_ptr cinfo,
shoaib_ahmed 0:791a779d6220 203 JSAMPIMAGE input_buf, JDIMENSION *in_row_group_ctr,
shoaib_ahmed 0:791a779d6220 204 JDIMENSION in_row_groups_avail,
shoaib_ahmed 0:791a779d6220 205 JSAMPARRAY output_buf, JDIMENSION *out_row_ctr,
shoaib_ahmed 0:791a779d6220 206 JDIMENSION out_rows_avail)
shoaib_ahmed 0:791a779d6220 207 {
shoaib_ahmed 0:791a779d6220 208 my_post_ptr post = (my_post_ptr) cinfo->post;
shoaib_ahmed 0:791a779d6220 209 JDIMENSION num_rows, max_rows;
shoaib_ahmed 0:791a779d6220 210
shoaib_ahmed 0:791a779d6220 211 /* Reposition virtual buffer if at start of strip. */
shoaib_ahmed 0:791a779d6220 212 if (post->next_row == 0) {
shoaib_ahmed 0:791a779d6220 213 post->buffer = (*cinfo->mem->access_virt_sarray)
shoaib_ahmed 0:791a779d6220 214 ((j_common_ptr) cinfo, post->whole_image,
shoaib_ahmed 0:791a779d6220 215 post->starting_row, post->strip_height, FALSE);
shoaib_ahmed 0:791a779d6220 216 }
shoaib_ahmed 0:791a779d6220 217
shoaib_ahmed 0:791a779d6220 218 /* Determine number of rows to emit. */
shoaib_ahmed 0:791a779d6220 219 num_rows = post->strip_height - post->next_row; /* available in strip */
shoaib_ahmed 0:791a779d6220 220 max_rows = out_rows_avail - *out_row_ctr; /* available in output area */
shoaib_ahmed 0:791a779d6220 221 if (num_rows > max_rows)
shoaib_ahmed 0:791a779d6220 222 num_rows = max_rows;
shoaib_ahmed 0:791a779d6220 223 /* We have to check bottom of image here, can't depend on upsampler. */
shoaib_ahmed 0:791a779d6220 224 max_rows = cinfo->output_height - post->starting_row;
shoaib_ahmed 0:791a779d6220 225 if (num_rows > max_rows)
shoaib_ahmed 0:791a779d6220 226 num_rows = max_rows;
shoaib_ahmed 0:791a779d6220 227
shoaib_ahmed 0:791a779d6220 228 /* Quantize and emit data. */
shoaib_ahmed 0:791a779d6220 229 (*cinfo->cquantize->color_quantize) (cinfo,
shoaib_ahmed 0:791a779d6220 230 post->buffer + post->next_row, output_buf + *out_row_ctr,
shoaib_ahmed 0:791a779d6220 231 (int) num_rows);
shoaib_ahmed 0:791a779d6220 232 *out_row_ctr += num_rows;
shoaib_ahmed 0:791a779d6220 233
shoaib_ahmed 0:791a779d6220 234 /* Advance if we filled the strip. */
shoaib_ahmed 0:791a779d6220 235 post->next_row += num_rows;
shoaib_ahmed 0:791a779d6220 236 if (post->next_row >= post->strip_height) {
shoaib_ahmed 0:791a779d6220 237 post->starting_row += post->strip_height;
shoaib_ahmed 0:791a779d6220 238 post->next_row = 0;
shoaib_ahmed 0:791a779d6220 239 }
shoaib_ahmed 0:791a779d6220 240 }
shoaib_ahmed 0:791a779d6220 241
shoaib_ahmed 0:791a779d6220 242 #endif /* QUANT_2PASS_SUPPORTED */
shoaib_ahmed 0:791a779d6220 243
shoaib_ahmed 0:791a779d6220 244
shoaib_ahmed 0:791a779d6220 245 /*
shoaib_ahmed 0:791a779d6220 246 * Initialize postprocessing controller.
shoaib_ahmed 0:791a779d6220 247 */
shoaib_ahmed 0:791a779d6220 248
shoaib_ahmed 0:791a779d6220 249 GLOBAL(void)
shoaib_ahmed 0:791a779d6220 250 jinit_d_post_controller (j_decompress_ptr cinfo, boolean need_full_buffer)
shoaib_ahmed 0:791a779d6220 251 {
shoaib_ahmed 0:791a779d6220 252 my_post_ptr post;
shoaib_ahmed 0:791a779d6220 253
shoaib_ahmed 0:791a779d6220 254 post = (my_post_ptr)
shoaib_ahmed 0:791a779d6220 255 (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
shoaib_ahmed 0:791a779d6220 256 SIZEOF(my_post_controller));
shoaib_ahmed 0:791a779d6220 257 cinfo->post = (struct jpeg_d_post_controller *) post;
shoaib_ahmed 0:791a779d6220 258 post->pub.start_pass = start_pass_dpost;
shoaib_ahmed 0:791a779d6220 259 post->whole_image = NULL; /* flag for no virtual arrays */
shoaib_ahmed 0:791a779d6220 260 post->buffer = NULL; /* flag for no strip buffer */
shoaib_ahmed 0:791a779d6220 261
shoaib_ahmed 0:791a779d6220 262 /* Create the quantization buffer, if needed */
shoaib_ahmed 0:791a779d6220 263 if (cinfo->quantize_colors) {
shoaib_ahmed 0:791a779d6220 264 /* The buffer strip height is max_v_samp_factor, which is typically
shoaib_ahmed 0:791a779d6220 265 * an efficient number of rows for upsampling to return.
shoaib_ahmed 0:791a779d6220 266 * (In the presence of output rescaling, we might want to be smarter?)
shoaib_ahmed 0:791a779d6220 267 */
shoaib_ahmed 0:791a779d6220 268 post->strip_height = (JDIMENSION) cinfo->max_v_samp_factor;
shoaib_ahmed 0:791a779d6220 269 if (need_full_buffer) {
shoaib_ahmed 0:791a779d6220 270 /* Two-pass color quantization: need full-image storage. */
shoaib_ahmed 0:791a779d6220 271 /* We round up the number of rows to a multiple of the strip height. */
shoaib_ahmed 0:791a779d6220 272 #ifdef QUANT_2PASS_SUPPORTED
shoaib_ahmed 0:791a779d6220 273 post->whole_image = (*cinfo->mem->request_virt_sarray)
shoaib_ahmed 0:791a779d6220 274 ((j_common_ptr) cinfo, JPOOL_IMAGE, FALSE,
shoaib_ahmed 0:791a779d6220 275 cinfo->output_width * cinfo->out_color_components,
shoaib_ahmed 0:791a779d6220 276 (JDIMENSION) jround_up((long) cinfo->output_height,
shoaib_ahmed 0:791a779d6220 277 (long) post->strip_height),
shoaib_ahmed 0:791a779d6220 278 post->strip_height);
shoaib_ahmed 0:791a779d6220 279 #else
shoaib_ahmed 0:791a779d6220 280 ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
shoaib_ahmed 0:791a779d6220 281 #endif /* QUANT_2PASS_SUPPORTED */
shoaib_ahmed 0:791a779d6220 282 } else {
shoaib_ahmed 0:791a779d6220 283 /* One-pass color quantization: just make a strip buffer. */
shoaib_ahmed 0:791a779d6220 284 post->buffer = (*cinfo->mem->alloc_sarray)
shoaib_ahmed 0:791a779d6220 285 ((j_common_ptr) cinfo, JPOOL_IMAGE,
shoaib_ahmed 0:791a779d6220 286 cinfo->output_width * cinfo->out_color_components,
shoaib_ahmed 0:791a779d6220 287 post->strip_height);
shoaib_ahmed 0:791a779d6220 288 }
shoaib_ahmed 0:791a779d6220 289 }
shoaib_ahmed 0:791a779d6220 290 }