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 * jcsample.c
shoaib_ahmed 0:791a779d6220 3 *
shoaib_ahmed 0:791a779d6220 4 * Copyright (C) 1991-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 downsampling routines.
shoaib_ahmed 0:791a779d6220 9 *
shoaib_ahmed 0:791a779d6220 10 * Downsampling input data is counted in "row groups". A row group
shoaib_ahmed 0:791a779d6220 11 * is defined to be max_v_samp_factor pixel rows of each component,
shoaib_ahmed 0:791a779d6220 12 * from which the downsampler produces v_samp_factor sample rows.
shoaib_ahmed 0:791a779d6220 13 * A single row group is processed in each call to the downsampler module.
shoaib_ahmed 0:791a779d6220 14 *
shoaib_ahmed 0:791a779d6220 15 * The downsampler is responsible for edge-expansion of its output data
shoaib_ahmed 0:791a779d6220 16 * to fill an integral number of DCT blocks horizontally. The source buffer
shoaib_ahmed 0:791a779d6220 17 * may be modified if it is helpful for this purpose (the source buffer is
shoaib_ahmed 0:791a779d6220 18 * allocated wide enough to correspond to the desired output width).
shoaib_ahmed 0:791a779d6220 19 * The caller (the prep controller) is responsible for vertical padding.
shoaib_ahmed 0:791a779d6220 20 *
shoaib_ahmed 0:791a779d6220 21 * The downsampler may request "context rows" by setting need_context_rows
shoaib_ahmed 0:791a779d6220 22 * during startup. In this case, the input arrays will contain at least
shoaib_ahmed 0:791a779d6220 23 * one row group's worth of pixels above and below the passed-in data;
shoaib_ahmed 0:791a779d6220 24 * the caller will create dummy rows at image top and bottom by replicating
shoaib_ahmed 0:791a779d6220 25 * the first or last real pixel row.
shoaib_ahmed 0:791a779d6220 26 *
shoaib_ahmed 0:791a779d6220 27 * An excellent reference for image resampling is
shoaib_ahmed 0:791a779d6220 28 * Digital Image Warping, George Wolberg, 1990.
shoaib_ahmed 0:791a779d6220 29 * Pub. by IEEE Computer Society Press, Los Alamitos, CA. ISBN 0-8186-8944-7.
shoaib_ahmed 0:791a779d6220 30 *
shoaib_ahmed 0:791a779d6220 31 * The downsampling algorithm used here is a simple average of the source
shoaib_ahmed 0:791a779d6220 32 * pixels covered by the output pixel. The hi-falutin sampling literature
shoaib_ahmed 0:791a779d6220 33 * refers to this as a "box filter". In general the characteristics of a box
shoaib_ahmed 0:791a779d6220 34 * filter are not very good, but for the specific cases we normally use (1:1
shoaib_ahmed 0:791a779d6220 35 * and 2:1 ratios) the box is equivalent to a "triangle filter" which is not
shoaib_ahmed 0:791a779d6220 36 * nearly so bad. If you intend to use other sampling ratios, you'd be well
shoaib_ahmed 0:791a779d6220 37 * advised to improve this code.
shoaib_ahmed 0:791a779d6220 38 *
shoaib_ahmed 0:791a779d6220 39 * A simple input-smoothing capability is provided. This is mainly intended
shoaib_ahmed 0:791a779d6220 40 * for cleaning up color-dithered GIF input files (if you find it inadequate,
shoaib_ahmed 0:791a779d6220 41 * we suggest using an external filtering program such as pnmconvol). When
shoaib_ahmed 0:791a779d6220 42 * enabled, each input pixel P is replaced by a weighted sum of itself and its
shoaib_ahmed 0:791a779d6220 43 * eight neighbors. P's weight is 1-8*SF and each neighbor's weight is SF,
shoaib_ahmed 0:791a779d6220 44 * where SF = (smoothing_factor / 1024).
shoaib_ahmed 0:791a779d6220 45 * Currently, smoothing is only supported for 2h2v sampling factors.
shoaib_ahmed 0:791a779d6220 46 */
shoaib_ahmed 0:791a779d6220 47
shoaib_ahmed 0:791a779d6220 48 #define JPEG_INTERNALS
shoaib_ahmed 0:791a779d6220 49 #include "jinclude.h"
shoaib_ahmed 0:791a779d6220 50 #include "jpeglib.h"
shoaib_ahmed 0:791a779d6220 51
shoaib_ahmed 0:791a779d6220 52
shoaib_ahmed 0:791a779d6220 53 /* Pointer to routine to downsample a single component */
shoaib_ahmed 0:791a779d6220 54 typedef JMETHOD(void, downsample1_ptr,
shoaib_ahmed 0:791a779d6220 55 (j_compress_ptr cinfo, jpeg_component_info * compptr,
shoaib_ahmed 0:791a779d6220 56 JSAMPARRAY input_data, JSAMPARRAY output_data));
shoaib_ahmed 0:791a779d6220 57
shoaib_ahmed 0:791a779d6220 58 /* Private subobject */
shoaib_ahmed 0:791a779d6220 59
shoaib_ahmed 0:791a779d6220 60 typedef struct {
shoaib_ahmed 0:791a779d6220 61 struct jpeg_downsampler pub; /* public fields */
shoaib_ahmed 0:791a779d6220 62
shoaib_ahmed 0:791a779d6220 63 /* Downsampling method pointers, one per component */
shoaib_ahmed 0:791a779d6220 64 downsample1_ptr methods[MAX_COMPONENTS];
shoaib_ahmed 0:791a779d6220 65
shoaib_ahmed 0:791a779d6220 66 /* Height of an output row group for each component. */
shoaib_ahmed 0:791a779d6220 67 int rowgroup_height[MAX_COMPONENTS];
shoaib_ahmed 0:791a779d6220 68
shoaib_ahmed 0:791a779d6220 69 /* These arrays save pixel expansion factors so that int_downsample need not
shoaib_ahmed 0:791a779d6220 70 * recompute them each time. They are unused for other downsampling methods.
shoaib_ahmed 0:791a779d6220 71 */
shoaib_ahmed 0:791a779d6220 72 UINT8 h_expand[MAX_COMPONENTS];
shoaib_ahmed 0:791a779d6220 73 UINT8 v_expand[MAX_COMPONENTS];
shoaib_ahmed 0:791a779d6220 74 } my_downsampler;
shoaib_ahmed 0:791a779d6220 75
shoaib_ahmed 0:791a779d6220 76 typedef my_downsampler * my_downsample_ptr;
shoaib_ahmed 0:791a779d6220 77
shoaib_ahmed 0:791a779d6220 78
shoaib_ahmed 0:791a779d6220 79 /*
shoaib_ahmed 0:791a779d6220 80 * Initialize for a downsampling pass.
shoaib_ahmed 0:791a779d6220 81 */
shoaib_ahmed 0:791a779d6220 82
shoaib_ahmed 0:791a779d6220 83 METHODDEF(void)
shoaib_ahmed 0:791a779d6220 84 start_pass_downsample (j_compress_ptr cinfo)
shoaib_ahmed 0:791a779d6220 85 {
shoaib_ahmed 0:791a779d6220 86 /* no work for now */
shoaib_ahmed 0:791a779d6220 87 }
shoaib_ahmed 0:791a779d6220 88
shoaib_ahmed 0:791a779d6220 89
shoaib_ahmed 0:791a779d6220 90 /*
shoaib_ahmed 0:791a779d6220 91 * Expand a component horizontally from width input_cols to width output_cols,
shoaib_ahmed 0:791a779d6220 92 * by duplicating the rightmost samples.
shoaib_ahmed 0:791a779d6220 93 */
shoaib_ahmed 0:791a779d6220 94
shoaib_ahmed 0:791a779d6220 95 LOCAL(void)
shoaib_ahmed 0:791a779d6220 96 expand_right_edge (JSAMPARRAY image_data, int num_rows,
shoaib_ahmed 0:791a779d6220 97 JDIMENSION input_cols, JDIMENSION output_cols)
shoaib_ahmed 0:791a779d6220 98 {
shoaib_ahmed 0:791a779d6220 99 register JSAMPROW ptr;
shoaib_ahmed 0:791a779d6220 100 register JSAMPLE pixval;
shoaib_ahmed 0:791a779d6220 101 register int count;
shoaib_ahmed 0:791a779d6220 102 int row;
shoaib_ahmed 0:791a779d6220 103 int numcols = (int) (output_cols - input_cols);
shoaib_ahmed 0:791a779d6220 104
shoaib_ahmed 0:791a779d6220 105 if (numcols > 0) {
shoaib_ahmed 0:791a779d6220 106 for (row = 0; row < num_rows; row++) {
shoaib_ahmed 0:791a779d6220 107 ptr = image_data[row] + input_cols;
shoaib_ahmed 0:791a779d6220 108 pixval = ptr[-1]; /* don't need GETJSAMPLE() here */
shoaib_ahmed 0:791a779d6220 109 for (count = numcols; count > 0; count--)
shoaib_ahmed 0:791a779d6220 110 *ptr++ = pixval;
shoaib_ahmed 0:791a779d6220 111 }
shoaib_ahmed 0:791a779d6220 112 }
shoaib_ahmed 0:791a779d6220 113 }
shoaib_ahmed 0:791a779d6220 114
shoaib_ahmed 0:791a779d6220 115
shoaib_ahmed 0:791a779d6220 116 /*
shoaib_ahmed 0:791a779d6220 117 * Do downsampling for a whole row group (all components).
shoaib_ahmed 0:791a779d6220 118 *
shoaib_ahmed 0:791a779d6220 119 * In this version we simply downsample each component independently.
shoaib_ahmed 0:791a779d6220 120 */
shoaib_ahmed 0:791a779d6220 121
shoaib_ahmed 0:791a779d6220 122 METHODDEF(void)
shoaib_ahmed 0:791a779d6220 123 sep_downsample (j_compress_ptr cinfo,
shoaib_ahmed 0:791a779d6220 124 JSAMPIMAGE input_buf, JDIMENSION in_row_index,
shoaib_ahmed 0:791a779d6220 125 JSAMPIMAGE output_buf, JDIMENSION out_row_group_index)
shoaib_ahmed 0:791a779d6220 126 {
shoaib_ahmed 0:791a779d6220 127 my_downsample_ptr downsample = (my_downsample_ptr) cinfo->downsample;
shoaib_ahmed 0:791a779d6220 128 int ci;
shoaib_ahmed 0:791a779d6220 129 jpeg_component_info * compptr;
shoaib_ahmed 0:791a779d6220 130 JSAMPARRAY in_ptr, out_ptr;
shoaib_ahmed 0:791a779d6220 131
shoaib_ahmed 0:791a779d6220 132 for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
shoaib_ahmed 0:791a779d6220 133 ci++, compptr++) {
shoaib_ahmed 0:791a779d6220 134 in_ptr = input_buf[ci] + in_row_index;
shoaib_ahmed 0:791a779d6220 135 out_ptr = output_buf[ci] +
shoaib_ahmed 0:791a779d6220 136 (out_row_group_index * downsample->rowgroup_height[ci]);
shoaib_ahmed 0:791a779d6220 137 (*downsample->methods[ci]) (cinfo, compptr, in_ptr, out_ptr);
shoaib_ahmed 0:791a779d6220 138 }
shoaib_ahmed 0:791a779d6220 139 }
shoaib_ahmed 0:791a779d6220 140
shoaib_ahmed 0:791a779d6220 141
shoaib_ahmed 0:791a779d6220 142 /*
shoaib_ahmed 0:791a779d6220 143 * Downsample pixel values of a single component.
shoaib_ahmed 0:791a779d6220 144 * One row group is processed per call.
shoaib_ahmed 0:791a779d6220 145 * This version handles arbitrary integral sampling ratios, without smoothing.
shoaib_ahmed 0:791a779d6220 146 * Note that this version is not actually used for customary sampling ratios.
shoaib_ahmed 0:791a779d6220 147 */
shoaib_ahmed 0:791a779d6220 148
shoaib_ahmed 0:791a779d6220 149 METHODDEF(void)
shoaib_ahmed 0:791a779d6220 150 int_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr,
shoaib_ahmed 0:791a779d6220 151 JSAMPARRAY input_data, JSAMPARRAY output_data)
shoaib_ahmed 0:791a779d6220 152 {
shoaib_ahmed 0:791a779d6220 153 my_downsample_ptr downsample = (my_downsample_ptr) cinfo->downsample;
shoaib_ahmed 0:791a779d6220 154 int inrow, outrow, h_expand, v_expand, numpix, numpix2, h, v;
shoaib_ahmed 0:791a779d6220 155 JDIMENSION outcol, outcol_h; /* outcol_h == outcol*h_expand */
shoaib_ahmed 0:791a779d6220 156 JDIMENSION output_cols = compptr->width_in_blocks * compptr->DCT_h_scaled_size;
shoaib_ahmed 0:791a779d6220 157 JSAMPROW inptr, outptr;
shoaib_ahmed 0:791a779d6220 158 INT32 outvalue;
shoaib_ahmed 0:791a779d6220 159
shoaib_ahmed 0:791a779d6220 160 h_expand = downsample->h_expand[compptr->component_index];
shoaib_ahmed 0:791a779d6220 161 v_expand = downsample->v_expand[compptr->component_index];
shoaib_ahmed 0:791a779d6220 162 numpix = h_expand * v_expand;
shoaib_ahmed 0:791a779d6220 163 numpix2 = numpix/2;
shoaib_ahmed 0:791a779d6220 164
shoaib_ahmed 0:791a779d6220 165 /* Expand input data enough to let all the output samples be generated
shoaib_ahmed 0:791a779d6220 166 * by the standard loop. Special-casing padded output would be more
shoaib_ahmed 0:791a779d6220 167 * efficient.
shoaib_ahmed 0:791a779d6220 168 */
shoaib_ahmed 0:791a779d6220 169 expand_right_edge(input_data, cinfo->max_v_samp_factor,
shoaib_ahmed 0:791a779d6220 170 cinfo->image_width, output_cols * h_expand);
shoaib_ahmed 0:791a779d6220 171
shoaib_ahmed 0:791a779d6220 172 inrow = outrow = 0;
shoaib_ahmed 0:791a779d6220 173 while (inrow < cinfo->max_v_samp_factor) {
shoaib_ahmed 0:791a779d6220 174 outptr = output_data[outrow];
shoaib_ahmed 0:791a779d6220 175 for (outcol = 0, outcol_h = 0; outcol < output_cols;
shoaib_ahmed 0:791a779d6220 176 outcol++, outcol_h += h_expand) {
shoaib_ahmed 0:791a779d6220 177 outvalue = 0;
shoaib_ahmed 0:791a779d6220 178 for (v = 0; v < v_expand; v++) {
shoaib_ahmed 0:791a779d6220 179 inptr = input_data[inrow+v] + outcol_h;
shoaib_ahmed 0:791a779d6220 180 for (h = 0; h < h_expand; h++) {
shoaib_ahmed 0:791a779d6220 181 outvalue += (INT32) GETJSAMPLE(*inptr++);
shoaib_ahmed 0:791a779d6220 182 }
shoaib_ahmed 0:791a779d6220 183 }
shoaib_ahmed 0:791a779d6220 184 *outptr++ = (JSAMPLE) ((outvalue + numpix2) / numpix);
shoaib_ahmed 0:791a779d6220 185 }
shoaib_ahmed 0:791a779d6220 186 inrow += v_expand;
shoaib_ahmed 0:791a779d6220 187 outrow++;
shoaib_ahmed 0:791a779d6220 188 }
shoaib_ahmed 0:791a779d6220 189 }
shoaib_ahmed 0:791a779d6220 190
shoaib_ahmed 0:791a779d6220 191
shoaib_ahmed 0:791a779d6220 192 /*
shoaib_ahmed 0:791a779d6220 193 * Downsample pixel values of a single component.
shoaib_ahmed 0:791a779d6220 194 * This version handles the special case of a full-size component,
shoaib_ahmed 0:791a779d6220 195 * without smoothing.
shoaib_ahmed 0:791a779d6220 196 */
shoaib_ahmed 0:791a779d6220 197
shoaib_ahmed 0:791a779d6220 198 METHODDEF(void)
shoaib_ahmed 0:791a779d6220 199 fullsize_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr,
shoaib_ahmed 0:791a779d6220 200 JSAMPARRAY input_data, JSAMPARRAY output_data)
shoaib_ahmed 0:791a779d6220 201 {
shoaib_ahmed 0:791a779d6220 202 /* Copy the data */
shoaib_ahmed 0:791a779d6220 203 jcopy_sample_rows(input_data, 0, output_data, 0,
shoaib_ahmed 0:791a779d6220 204 cinfo->max_v_samp_factor, cinfo->image_width);
shoaib_ahmed 0:791a779d6220 205 /* Edge-expand */
shoaib_ahmed 0:791a779d6220 206 expand_right_edge(output_data, cinfo->max_v_samp_factor, cinfo->image_width,
shoaib_ahmed 0:791a779d6220 207 compptr->width_in_blocks * compptr->DCT_h_scaled_size);
shoaib_ahmed 0:791a779d6220 208 }
shoaib_ahmed 0:791a779d6220 209
shoaib_ahmed 0:791a779d6220 210
shoaib_ahmed 0:791a779d6220 211 /*
shoaib_ahmed 0:791a779d6220 212 * Downsample pixel values of a single component.
shoaib_ahmed 0:791a779d6220 213 * This version handles the common case of 2:1 horizontal and 1:1 vertical,
shoaib_ahmed 0:791a779d6220 214 * without smoothing.
shoaib_ahmed 0:791a779d6220 215 *
shoaib_ahmed 0:791a779d6220 216 * A note about the "bias" calculations: when rounding fractional values to
shoaib_ahmed 0:791a779d6220 217 * integer, we do not want to always round 0.5 up to the next integer.
shoaib_ahmed 0:791a779d6220 218 * If we did that, we'd introduce a noticeable bias towards larger values.
shoaib_ahmed 0:791a779d6220 219 * Instead, this code is arranged so that 0.5 will be rounded up or down at
shoaib_ahmed 0:791a779d6220 220 * alternate pixel locations (a simple ordered dither pattern).
shoaib_ahmed 0:791a779d6220 221 */
shoaib_ahmed 0:791a779d6220 222
shoaib_ahmed 0:791a779d6220 223 METHODDEF(void)
shoaib_ahmed 0:791a779d6220 224 h2v1_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr,
shoaib_ahmed 0:791a779d6220 225 JSAMPARRAY input_data, JSAMPARRAY output_data)
shoaib_ahmed 0:791a779d6220 226 {
shoaib_ahmed 0:791a779d6220 227 int inrow;
shoaib_ahmed 0:791a779d6220 228 JDIMENSION outcol;
shoaib_ahmed 0:791a779d6220 229 JDIMENSION output_cols = compptr->width_in_blocks * compptr->DCT_h_scaled_size;
shoaib_ahmed 0:791a779d6220 230 register JSAMPROW inptr, outptr;
shoaib_ahmed 0:791a779d6220 231 register int bias;
shoaib_ahmed 0:791a779d6220 232
shoaib_ahmed 0:791a779d6220 233 /* Expand input data enough to let all the output samples be generated
shoaib_ahmed 0:791a779d6220 234 * by the standard loop. Special-casing padded output would be more
shoaib_ahmed 0:791a779d6220 235 * efficient.
shoaib_ahmed 0:791a779d6220 236 */
shoaib_ahmed 0:791a779d6220 237 expand_right_edge(input_data, cinfo->max_v_samp_factor,
shoaib_ahmed 0:791a779d6220 238 cinfo->image_width, output_cols * 2);
shoaib_ahmed 0:791a779d6220 239
shoaib_ahmed 0:791a779d6220 240 for (inrow = 0; inrow < cinfo->max_v_samp_factor; inrow++) {
shoaib_ahmed 0:791a779d6220 241 outptr = output_data[inrow];
shoaib_ahmed 0:791a779d6220 242 inptr = input_data[inrow];
shoaib_ahmed 0:791a779d6220 243 bias = 0; /* bias = 0,1,0,1,... for successive samples */
shoaib_ahmed 0:791a779d6220 244 for (outcol = 0; outcol < output_cols; outcol++) {
shoaib_ahmed 0:791a779d6220 245 *outptr++ = (JSAMPLE) ((GETJSAMPLE(*inptr) + GETJSAMPLE(inptr[1])
shoaib_ahmed 0:791a779d6220 246 + bias) >> 1);
shoaib_ahmed 0:791a779d6220 247 bias ^= 1; /* 0=>1, 1=>0 */
shoaib_ahmed 0:791a779d6220 248 inptr += 2;
shoaib_ahmed 0:791a779d6220 249 }
shoaib_ahmed 0:791a779d6220 250 }
shoaib_ahmed 0:791a779d6220 251 }
shoaib_ahmed 0:791a779d6220 252
shoaib_ahmed 0:791a779d6220 253
shoaib_ahmed 0:791a779d6220 254 /*
shoaib_ahmed 0:791a779d6220 255 * Downsample pixel values of a single component.
shoaib_ahmed 0:791a779d6220 256 * This version handles the standard case of 2:1 horizontal and 2:1 vertical,
shoaib_ahmed 0:791a779d6220 257 * without smoothing.
shoaib_ahmed 0:791a779d6220 258 */
shoaib_ahmed 0:791a779d6220 259
shoaib_ahmed 0:791a779d6220 260 METHODDEF(void)
shoaib_ahmed 0:791a779d6220 261 h2v2_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr,
shoaib_ahmed 0:791a779d6220 262 JSAMPARRAY input_data, JSAMPARRAY output_data)
shoaib_ahmed 0:791a779d6220 263 {
shoaib_ahmed 0:791a779d6220 264 int inrow, outrow;
shoaib_ahmed 0:791a779d6220 265 JDIMENSION outcol;
shoaib_ahmed 0:791a779d6220 266 JDIMENSION output_cols = compptr->width_in_blocks * compptr->DCT_h_scaled_size;
shoaib_ahmed 0:791a779d6220 267 register JSAMPROW inptr0, inptr1, outptr;
shoaib_ahmed 0:791a779d6220 268 register int bias;
shoaib_ahmed 0:791a779d6220 269
shoaib_ahmed 0:791a779d6220 270 /* Expand input data enough to let all the output samples be generated
shoaib_ahmed 0:791a779d6220 271 * by the standard loop. Special-casing padded output would be more
shoaib_ahmed 0:791a779d6220 272 * efficient.
shoaib_ahmed 0:791a779d6220 273 */
shoaib_ahmed 0:791a779d6220 274 expand_right_edge(input_data, cinfo->max_v_samp_factor,
shoaib_ahmed 0:791a779d6220 275 cinfo->image_width, output_cols * 2);
shoaib_ahmed 0:791a779d6220 276
shoaib_ahmed 0:791a779d6220 277 inrow = outrow = 0;
shoaib_ahmed 0:791a779d6220 278 while (inrow < cinfo->max_v_samp_factor) {
shoaib_ahmed 0:791a779d6220 279 outptr = output_data[outrow];
shoaib_ahmed 0:791a779d6220 280 inptr0 = input_data[inrow];
shoaib_ahmed 0:791a779d6220 281 inptr1 = input_data[inrow+1];
shoaib_ahmed 0:791a779d6220 282 bias = 1; /* bias = 1,2,1,2,... for successive samples */
shoaib_ahmed 0:791a779d6220 283 for (outcol = 0; outcol < output_cols; outcol++) {
shoaib_ahmed 0:791a779d6220 284 *outptr++ = (JSAMPLE) ((GETJSAMPLE(*inptr0) + GETJSAMPLE(inptr0[1]) +
shoaib_ahmed 0:791a779d6220 285 GETJSAMPLE(*inptr1) + GETJSAMPLE(inptr1[1])
shoaib_ahmed 0:791a779d6220 286 + bias) >> 2);
shoaib_ahmed 0:791a779d6220 287 bias ^= 3; /* 1=>2, 2=>1 */
shoaib_ahmed 0:791a779d6220 288 inptr0 += 2; inptr1 += 2;
shoaib_ahmed 0:791a779d6220 289 }
shoaib_ahmed 0:791a779d6220 290 inrow += 2;
shoaib_ahmed 0:791a779d6220 291 outrow++;
shoaib_ahmed 0:791a779d6220 292 }
shoaib_ahmed 0:791a779d6220 293 }
shoaib_ahmed 0:791a779d6220 294
shoaib_ahmed 0:791a779d6220 295
shoaib_ahmed 0:791a779d6220 296 #ifdef INPUT_SMOOTHING_SUPPORTED
shoaib_ahmed 0:791a779d6220 297
shoaib_ahmed 0:791a779d6220 298 /*
shoaib_ahmed 0:791a779d6220 299 * Downsample pixel values of a single component.
shoaib_ahmed 0:791a779d6220 300 * This version handles the standard case of 2:1 horizontal and 2:1 vertical,
shoaib_ahmed 0:791a779d6220 301 * with smoothing. One row of context is required.
shoaib_ahmed 0:791a779d6220 302 */
shoaib_ahmed 0:791a779d6220 303
shoaib_ahmed 0:791a779d6220 304 METHODDEF(void)
shoaib_ahmed 0:791a779d6220 305 h2v2_smooth_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr,
shoaib_ahmed 0:791a779d6220 306 JSAMPARRAY input_data, JSAMPARRAY output_data)
shoaib_ahmed 0:791a779d6220 307 {
shoaib_ahmed 0:791a779d6220 308 int inrow, outrow;
shoaib_ahmed 0:791a779d6220 309 JDIMENSION colctr;
shoaib_ahmed 0:791a779d6220 310 JDIMENSION output_cols = compptr->width_in_blocks * compptr->DCT_h_scaled_size;
shoaib_ahmed 0:791a779d6220 311 register JSAMPROW inptr0, inptr1, above_ptr, below_ptr, outptr;
shoaib_ahmed 0:791a779d6220 312 INT32 membersum, neighsum, memberscale, neighscale;
shoaib_ahmed 0:791a779d6220 313
shoaib_ahmed 0:791a779d6220 314 /* Expand input data enough to let all the output samples be generated
shoaib_ahmed 0:791a779d6220 315 * by the standard loop. Special-casing padded output would be more
shoaib_ahmed 0:791a779d6220 316 * efficient.
shoaib_ahmed 0:791a779d6220 317 */
shoaib_ahmed 0:791a779d6220 318 expand_right_edge(input_data - 1, cinfo->max_v_samp_factor + 2,
shoaib_ahmed 0:791a779d6220 319 cinfo->image_width, output_cols * 2);
shoaib_ahmed 0:791a779d6220 320
shoaib_ahmed 0:791a779d6220 321 /* We don't bother to form the individual "smoothed" input pixel values;
shoaib_ahmed 0:791a779d6220 322 * we can directly compute the output which is the average of the four
shoaib_ahmed 0:791a779d6220 323 * smoothed values. Each of the four member pixels contributes a fraction
shoaib_ahmed 0:791a779d6220 324 * (1-8*SF) to its own smoothed image and a fraction SF to each of the three
shoaib_ahmed 0:791a779d6220 325 * other smoothed pixels, therefore a total fraction (1-5*SF)/4 to the final
shoaib_ahmed 0:791a779d6220 326 * output. The four corner-adjacent neighbor pixels contribute a fraction
shoaib_ahmed 0:791a779d6220 327 * SF to just one smoothed pixel, or SF/4 to the final output; while the
shoaib_ahmed 0:791a779d6220 328 * eight edge-adjacent neighbors contribute SF to each of two smoothed
shoaib_ahmed 0:791a779d6220 329 * pixels, or SF/2 overall. In order to use integer arithmetic, these
shoaib_ahmed 0:791a779d6220 330 * factors are scaled by 2^16 = 65536.
shoaib_ahmed 0:791a779d6220 331 * Also recall that SF = smoothing_factor / 1024.
shoaib_ahmed 0:791a779d6220 332 */
shoaib_ahmed 0:791a779d6220 333
shoaib_ahmed 0:791a779d6220 334 memberscale = 16384 - cinfo->smoothing_factor * 80; /* scaled (1-5*SF)/4 */
shoaib_ahmed 0:791a779d6220 335 neighscale = cinfo->smoothing_factor * 16; /* scaled SF/4 */
shoaib_ahmed 0:791a779d6220 336
shoaib_ahmed 0:791a779d6220 337 inrow = outrow = 0;
shoaib_ahmed 0:791a779d6220 338 while (inrow < cinfo->max_v_samp_factor) {
shoaib_ahmed 0:791a779d6220 339 outptr = output_data[outrow];
shoaib_ahmed 0:791a779d6220 340 inptr0 = input_data[inrow];
shoaib_ahmed 0:791a779d6220 341 inptr1 = input_data[inrow+1];
shoaib_ahmed 0:791a779d6220 342 above_ptr = input_data[inrow-1];
shoaib_ahmed 0:791a779d6220 343 below_ptr = input_data[inrow+2];
shoaib_ahmed 0:791a779d6220 344
shoaib_ahmed 0:791a779d6220 345 /* Special case for first column: pretend column -1 is same as column 0 */
shoaib_ahmed 0:791a779d6220 346 membersum = GETJSAMPLE(*inptr0) + GETJSAMPLE(inptr0[1]) +
shoaib_ahmed 0:791a779d6220 347 GETJSAMPLE(*inptr1) + GETJSAMPLE(inptr1[1]);
shoaib_ahmed 0:791a779d6220 348 neighsum = GETJSAMPLE(*above_ptr) + GETJSAMPLE(above_ptr[1]) +
shoaib_ahmed 0:791a779d6220 349 GETJSAMPLE(*below_ptr) + GETJSAMPLE(below_ptr[1]) +
shoaib_ahmed 0:791a779d6220 350 GETJSAMPLE(*inptr0) + GETJSAMPLE(inptr0[2]) +
shoaib_ahmed 0:791a779d6220 351 GETJSAMPLE(*inptr1) + GETJSAMPLE(inptr1[2]);
shoaib_ahmed 0:791a779d6220 352 neighsum += neighsum;
shoaib_ahmed 0:791a779d6220 353 neighsum += GETJSAMPLE(*above_ptr) + GETJSAMPLE(above_ptr[2]) +
shoaib_ahmed 0:791a779d6220 354 GETJSAMPLE(*below_ptr) + GETJSAMPLE(below_ptr[2]);
shoaib_ahmed 0:791a779d6220 355 membersum = membersum * memberscale + neighsum * neighscale;
shoaib_ahmed 0:791a779d6220 356 *outptr++ = (JSAMPLE) ((membersum + 32768) >> 16);
shoaib_ahmed 0:791a779d6220 357 inptr0 += 2; inptr1 += 2; above_ptr += 2; below_ptr += 2;
shoaib_ahmed 0:791a779d6220 358
shoaib_ahmed 0:791a779d6220 359 for (colctr = output_cols - 2; colctr > 0; colctr--) {
shoaib_ahmed 0:791a779d6220 360 /* sum of pixels directly mapped to this output element */
shoaib_ahmed 0:791a779d6220 361 membersum = GETJSAMPLE(*inptr0) + GETJSAMPLE(inptr0[1]) +
shoaib_ahmed 0:791a779d6220 362 GETJSAMPLE(*inptr1) + GETJSAMPLE(inptr1[1]);
shoaib_ahmed 0:791a779d6220 363 /* sum of edge-neighbor pixels */
shoaib_ahmed 0:791a779d6220 364 neighsum = GETJSAMPLE(*above_ptr) + GETJSAMPLE(above_ptr[1]) +
shoaib_ahmed 0:791a779d6220 365 GETJSAMPLE(*below_ptr) + GETJSAMPLE(below_ptr[1]) +
shoaib_ahmed 0:791a779d6220 366 GETJSAMPLE(inptr0[-1]) + GETJSAMPLE(inptr0[2]) +
shoaib_ahmed 0:791a779d6220 367 GETJSAMPLE(inptr1[-1]) + GETJSAMPLE(inptr1[2]);
shoaib_ahmed 0:791a779d6220 368 /* The edge-neighbors count twice as much as corner-neighbors */
shoaib_ahmed 0:791a779d6220 369 neighsum += neighsum;
shoaib_ahmed 0:791a779d6220 370 /* Add in the corner-neighbors */
shoaib_ahmed 0:791a779d6220 371 neighsum += GETJSAMPLE(above_ptr[-1]) + GETJSAMPLE(above_ptr[2]) +
shoaib_ahmed 0:791a779d6220 372 GETJSAMPLE(below_ptr[-1]) + GETJSAMPLE(below_ptr[2]);
shoaib_ahmed 0:791a779d6220 373 /* form final output scaled up by 2^16 */
shoaib_ahmed 0:791a779d6220 374 membersum = membersum * memberscale + neighsum * neighscale;
shoaib_ahmed 0:791a779d6220 375 /* round, descale and output it */
shoaib_ahmed 0:791a779d6220 376 *outptr++ = (JSAMPLE) ((membersum + 32768) >> 16);
shoaib_ahmed 0:791a779d6220 377 inptr0 += 2; inptr1 += 2; above_ptr += 2; below_ptr += 2;
shoaib_ahmed 0:791a779d6220 378 }
shoaib_ahmed 0:791a779d6220 379
shoaib_ahmed 0:791a779d6220 380 /* Special case for last column */
shoaib_ahmed 0:791a779d6220 381 membersum = GETJSAMPLE(*inptr0) + GETJSAMPLE(inptr0[1]) +
shoaib_ahmed 0:791a779d6220 382 GETJSAMPLE(*inptr1) + GETJSAMPLE(inptr1[1]);
shoaib_ahmed 0:791a779d6220 383 neighsum = GETJSAMPLE(*above_ptr) + GETJSAMPLE(above_ptr[1]) +
shoaib_ahmed 0:791a779d6220 384 GETJSAMPLE(*below_ptr) + GETJSAMPLE(below_ptr[1]) +
shoaib_ahmed 0:791a779d6220 385 GETJSAMPLE(inptr0[-1]) + GETJSAMPLE(inptr0[1]) +
shoaib_ahmed 0:791a779d6220 386 GETJSAMPLE(inptr1[-1]) + GETJSAMPLE(inptr1[1]);
shoaib_ahmed 0:791a779d6220 387 neighsum += neighsum;
shoaib_ahmed 0:791a779d6220 388 neighsum += GETJSAMPLE(above_ptr[-1]) + GETJSAMPLE(above_ptr[1]) +
shoaib_ahmed 0:791a779d6220 389 GETJSAMPLE(below_ptr[-1]) + GETJSAMPLE(below_ptr[1]);
shoaib_ahmed 0:791a779d6220 390 membersum = membersum * memberscale + neighsum * neighscale;
shoaib_ahmed 0:791a779d6220 391 *outptr = (JSAMPLE) ((membersum + 32768) >> 16);
shoaib_ahmed 0:791a779d6220 392
shoaib_ahmed 0:791a779d6220 393 inrow += 2;
shoaib_ahmed 0:791a779d6220 394 outrow++;
shoaib_ahmed 0:791a779d6220 395 }
shoaib_ahmed 0:791a779d6220 396 }
shoaib_ahmed 0:791a779d6220 397
shoaib_ahmed 0:791a779d6220 398
shoaib_ahmed 0:791a779d6220 399 /*
shoaib_ahmed 0:791a779d6220 400 * Downsample pixel values of a single component.
shoaib_ahmed 0:791a779d6220 401 * This version handles the special case of a full-size component,
shoaib_ahmed 0:791a779d6220 402 * with smoothing. One row of context is required.
shoaib_ahmed 0:791a779d6220 403 */
shoaib_ahmed 0:791a779d6220 404
shoaib_ahmed 0:791a779d6220 405 METHODDEF(void)
shoaib_ahmed 0:791a779d6220 406 fullsize_smooth_downsample (j_compress_ptr cinfo, jpeg_component_info *compptr,
shoaib_ahmed 0:791a779d6220 407 JSAMPARRAY input_data, JSAMPARRAY output_data)
shoaib_ahmed 0:791a779d6220 408 {
shoaib_ahmed 0:791a779d6220 409 int inrow;
shoaib_ahmed 0:791a779d6220 410 JDIMENSION colctr;
shoaib_ahmed 0:791a779d6220 411 JDIMENSION output_cols = compptr->width_in_blocks * compptr->DCT_h_scaled_size;
shoaib_ahmed 0:791a779d6220 412 register JSAMPROW inptr, above_ptr, below_ptr, outptr;
shoaib_ahmed 0:791a779d6220 413 INT32 membersum, neighsum, memberscale, neighscale;
shoaib_ahmed 0:791a779d6220 414 int colsum, lastcolsum, nextcolsum;
shoaib_ahmed 0:791a779d6220 415
shoaib_ahmed 0:791a779d6220 416 /* Expand input data enough to let all the output samples be generated
shoaib_ahmed 0:791a779d6220 417 * by the standard loop. Special-casing padded output would be more
shoaib_ahmed 0:791a779d6220 418 * efficient.
shoaib_ahmed 0:791a779d6220 419 */
shoaib_ahmed 0:791a779d6220 420 expand_right_edge(input_data - 1, cinfo->max_v_samp_factor + 2,
shoaib_ahmed 0:791a779d6220 421 cinfo->image_width, output_cols);
shoaib_ahmed 0:791a779d6220 422
shoaib_ahmed 0:791a779d6220 423 /* Each of the eight neighbor pixels contributes a fraction SF to the
shoaib_ahmed 0:791a779d6220 424 * smoothed pixel, while the main pixel contributes (1-8*SF). In order
shoaib_ahmed 0:791a779d6220 425 * to use integer arithmetic, these factors are multiplied by 2^16 = 65536.
shoaib_ahmed 0:791a779d6220 426 * Also recall that SF = smoothing_factor / 1024.
shoaib_ahmed 0:791a779d6220 427 */
shoaib_ahmed 0:791a779d6220 428
shoaib_ahmed 0:791a779d6220 429 memberscale = 65536L - cinfo->smoothing_factor * 512L; /* scaled 1-8*SF */
shoaib_ahmed 0:791a779d6220 430 neighscale = cinfo->smoothing_factor * 64; /* scaled SF */
shoaib_ahmed 0:791a779d6220 431
shoaib_ahmed 0:791a779d6220 432 for (inrow = 0; inrow < cinfo->max_v_samp_factor; inrow++) {
shoaib_ahmed 0:791a779d6220 433 outptr = output_data[inrow];
shoaib_ahmed 0:791a779d6220 434 inptr = input_data[inrow];
shoaib_ahmed 0:791a779d6220 435 above_ptr = input_data[inrow-1];
shoaib_ahmed 0:791a779d6220 436 below_ptr = input_data[inrow+1];
shoaib_ahmed 0:791a779d6220 437
shoaib_ahmed 0:791a779d6220 438 /* Special case for first column */
shoaib_ahmed 0:791a779d6220 439 colsum = GETJSAMPLE(*above_ptr++) + GETJSAMPLE(*below_ptr++) +
shoaib_ahmed 0:791a779d6220 440 GETJSAMPLE(*inptr);
shoaib_ahmed 0:791a779d6220 441 membersum = GETJSAMPLE(*inptr++);
shoaib_ahmed 0:791a779d6220 442 nextcolsum = GETJSAMPLE(*above_ptr) + GETJSAMPLE(*below_ptr) +
shoaib_ahmed 0:791a779d6220 443 GETJSAMPLE(*inptr);
shoaib_ahmed 0:791a779d6220 444 neighsum = colsum + (colsum - membersum) + nextcolsum;
shoaib_ahmed 0:791a779d6220 445 membersum = membersum * memberscale + neighsum * neighscale;
shoaib_ahmed 0:791a779d6220 446 *outptr++ = (JSAMPLE) ((membersum + 32768) >> 16);
shoaib_ahmed 0:791a779d6220 447 lastcolsum = colsum; colsum = nextcolsum;
shoaib_ahmed 0:791a779d6220 448
shoaib_ahmed 0:791a779d6220 449 for (colctr = output_cols - 2; colctr > 0; colctr--) {
shoaib_ahmed 0:791a779d6220 450 membersum = GETJSAMPLE(*inptr++);
shoaib_ahmed 0:791a779d6220 451 above_ptr++; below_ptr++;
shoaib_ahmed 0:791a779d6220 452 nextcolsum = GETJSAMPLE(*above_ptr) + GETJSAMPLE(*below_ptr) +
shoaib_ahmed 0:791a779d6220 453 GETJSAMPLE(*inptr);
shoaib_ahmed 0:791a779d6220 454 neighsum = lastcolsum + (colsum - membersum) + nextcolsum;
shoaib_ahmed 0:791a779d6220 455 membersum = membersum * memberscale + neighsum * neighscale;
shoaib_ahmed 0:791a779d6220 456 *outptr++ = (JSAMPLE) ((membersum + 32768) >> 16);
shoaib_ahmed 0:791a779d6220 457 lastcolsum = colsum; colsum = nextcolsum;
shoaib_ahmed 0:791a779d6220 458 }
shoaib_ahmed 0:791a779d6220 459
shoaib_ahmed 0:791a779d6220 460 /* Special case for last column */
shoaib_ahmed 0:791a779d6220 461 membersum = GETJSAMPLE(*inptr);
shoaib_ahmed 0:791a779d6220 462 neighsum = lastcolsum + (colsum - membersum) + colsum;
shoaib_ahmed 0:791a779d6220 463 membersum = membersum * memberscale + neighsum * neighscale;
shoaib_ahmed 0:791a779d6220 464 *outptr = (JSAMPLE) ((membersum + 32768) >> 16);
shoaib_ahmed 0:791a779d6220 465
shoaib_ahmed 0:791a779d6220 466 }
shoaib_ahmed 0:791a779d6220 467 }
shoaib_ahmed 0:791a779d6220 468
shoaib_ahmed 0:791a779d6220 469 #endif /* INPUT_SMOOTHING_SUPPORTED */
shoaib_ahmed 0:791a779d6220 470
shoaib_ahmed 0:791a779d6220 471
shoaib_ahmed 0:791a779d6220 472 /*
shoaib_ahmed 0:791a779d6220 473 * Module initialization routine for downsampling.
shoaib_ahmed 0:791a779d6220 474 * Note that we must select a routine for each component.
shoaib_ahmed 0:791a779d6220 475 */
shoaib_ahmed 0:791a779d6220 476
shoaib_ahmed 0:791a779d6220 477 GLOBAL(void)
shoaib_ahmed 0:791a779d6220 478 jinit_downsampler (j_compress_ptr cinfo)
shoaib_ahmed 0:791a779d6220 479 {
shoaib_ahmed 0:791a779d6220 480 my_downsample_ptr downsample;
shoaib_ahmed 0:791a779d6220 481 int ci;
shoaib_ahmed 0:791a779d6220 482 jpeg_component_info * compptr;
shoaib_ahmed 0:791a779d6220 483 boolean smoothok = TRUE;
shoaib_ahmed 0:791a779d6220 484 int h_in_group, v_in_group, h_out_group, v_out_group;
shoaib_ahmed 0:791a779d6220 485
shoaib_ahmed 0:791a779d6220 486 downsample = (my_downsample_ptr)
shoaib_ahmed 0:791a779d6220 487 (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
shoaib_ahmed 0:791a779d6220 488 SIZEOF(my_downsampler));
shoaib_ahmed 0:791a779d6220 489 cinfo->downsample = (struct jpeg_downsampler *) downsample;
shoaib_ahmed 0:791a779d6220 490 downsample->pub.start_pass = start_pass_downsample;
shoaib_ahmed 0:791a779d6220 491 downsample->pub.downsample = sep_downsample;
shoaib_ahmed 0:791a779d6220 492 downsample->pub.need_context_rows = FALSE;
shoaib_ahmed 0:791a779d6220 493
shoaib_ahmed 0:791a779d6220 494 if (cinfo->CCIR601_sampling)
shoaib_ahmed 0:791a779d6220 495 ERREXIT(cinfo, JERR_CCIR601_NOTIMPL);
shoaib_ahmed 0:791a779d6220 496
shoaib_ahmed 0:791a779d6220 497 /* Verify we can handle the sampling factors, and set up method pointers */
shoaib_ahmed 0:791a779d6220 498 for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
shoaib_ahmed 0:791a779d6220 499 ci++, compptr++) {
shoaib_ahmed 0:791a779d6220 500 /* Compute size of an "output group" for DCT scaling. This many samples
shoaib_ahmed 0:791a779d6220 501 * are to be converted from max_h_samp_factor * max_v_samp_factor pixels.
shoaib_ahmed 0:791a779d6220 502 */
shoaib_ahmed 0:791a779d6220 503 h_out_group = (compptr->h_samp_factor * compptr->DCT_h_scaled_size) /
shoaib_ahmed 0:791a779d6220 504 cinfo->min_DCT_h_scaled_size;
shoaib_ahmed 0:791a779d6220 505 v_out_group = (compptr->v_samp_factor * compptr->DCT_v_scaled_size) /
shoaib_ahmed 0:791a779d6220 506 cinfo->min_DCT_v_scaled_size;
shoaib_ahmed 0:791a779d6220 507 h_in_group = cinfo->max_h_samp_factor;
shoaib_ahmed 0:791a779d6220 508 v_in_group = cinfo->max_v_samp_factor;
shoaib_ahmed 0:791a779d6220 509 downsample->rowgroup_height[ci] = v_out_group; /* save for use later */
shoaib_ahmed 0:791a779d6220 510 if (h_in_group == h_out_group && v_in_group == v_out_group) {
shoaib_ahmed 0:791a779d6220 511 #ifdef INPUT_SMOOTHING_SUPPORTED
shoaib_ahmed 0:791a779d6220 512 if (cinfo->smoothing_factor) {
shoaib_ahmed 0:791a779d6220 513 downsample->methods[ci] = fullsize_smooth_downsample;
shoaib_ahmed 0:791a779d6220 514 downsample->pub.need_context_rows = TRUE;
shoaib_ahmed 0:791a779d6220 515 } else
shoaib_ahmed 0:791a779d6220 516 #endif
shoaib_ahmed 0:791a779d6220 517 downsample->methods[ci] = fullsize_downsample;
shoaib_ahmed 0:791a779d6220 518 } else if (h_in_group == h_out_group * 2 &&
shoaib_ahmed 0:791a779d6220 519 v_in_group == v_out_group) {
shoaib_ahmed 0:791a779d6220 520 smoothok = FALSE;
shoaib_ahmed 0:791a779d6220 521 downsample->methods[ci] = h2v1_downsample;
shoaib_ahmed 0:791a779d6220 522 } else if (h_in_group == h_out_group * 2 &&
shoaib_ahmed 0:791a779d6220 523 v_in_group == v_out_group * 2) {
shoaib_ahmed 0:791a779d6220 524 #ifdef INPUT_SMOOTHING_SUPPORTED
shoaib_ahmed 0:791a779d6220 525 if (cinfo->smoothing_factor) {
shoaib_ahmed 0:791a779d6220 526 downsample->methods[ci] = h2v2_smooth_downsample;
shoaib_ahmed 0:791a779d6220 527 downsample->pub.need_context_rows = TRUE;
shoaib_ahmed 0:791a779d6220 528 } else
shoaib_ahmed 0:791a779d6220 529 #endif
shoaib_ahmed 0:791a779d6220 530 downsample->methods[ci] = h2v2_downsample;
shoaib_ahmed 0:791a779d6220 531 } else if ((h_in_group % h_out_group) == 0 &&
shoaib_ahmed 0:791a779d6220 532 (v_in_group % v_out_group) == 0) {
shoaib_ahmed 0:791a779d6220 533 smoothok = FALSE;
shoaib_ahmed 0:791a779d6220 534 downsample->methods[ci] = int_downsample;
shoaib_ahmed 0:791a779d6220 535 downsample->h_expand[ci] = (UINT8) (h_in_group / h_out_group);
shoaib_ahmed 0:791a779d6220 536 downsample->v_expand[ci] = (UINT8) (v_in_group / v_out_group);
shoaib_ahmed 0:791a779d6220 537 } else
shoaib_ahmed 0:791a779d6220 538 ERREXIT(cinfo, JERR_FRACT_SAMPLE_NOTIMPL);
shoaib_ahmed 0:791a779d6220 539 }
shoaib_ahmed 0:791a779d6220 540
shoaib_ahmed 0:791a779d6220 541 #ifdef INPUT_SMOOTHING_SUPPORTED
shoaib_ahmed 0:791a779d6220 542 if (cinfo->smoothing_factor && !smoothok)
shoaib_ahmed 0:791a779d6220 543 TRACEMS(cinfo, 0, JTRC_SMOOTH_NOTIMPL);
shoaib_ahmed 0:791a779d6220 544 #endif
shoaib_ahmed 0:791a779d6220 545 }