| 148 | */ |
| 149 | |
| 150 | METHODDEF(void) |
| 151 | int_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr, |
| 152 | JSAMPARRAY input_data, JSAMPARRAY output_data) |
| 153 | { |
| 154 | my_downsample_ptr downsample = (my_downsample_ptr) cinfo->downsample; |
| 155 | int inrow, outrow, h_expand, v_expand, numpix, numpix2, h, v; |
| 156 | JDIMENSION outcol, outcol_h; /* outcol_h == outcol*h_expand */ |
| 157 | JDIMENSION output_cols = compptr->width_in_blocks * compptr->DCT_h_scaled_size; |
| 158 | JSAMPROW inptr, outptr; |
| 159 | INT32 outvalue; |
| 160 | |
| 161 | h_expand = downsample->h_expand[compptr->component_index]; |
| 162 | v_expand = downsample->v_expand[compptr->component_index]; |
| 163 | numpix = h_expand * v_expand; |
| 164 | numpix2 = numpix/2; |
| 165 | |
| 166 | /* Expand input data enough to let all the output samples be generated |
| 167 | * by the standard loop. Special-casing padded output would be more |
| 168 | * efficient. |
| 169 | */ |
| 170 | expand_right_edge(input_data, cinfo->max_v_samp_factor, |
| 171 | cinfo->image_width, output_cols * h_expand); |
| 172 | |
| 173 | inrow = outrow = 0; |
| 174 | while (inrow < cinfo->max_v_samp_factor) { |
| 175 | outptr = output_data[outrow]; |
| 176 | for (outcol = 0, outcol_h = 0; outcol < output_cols; |
| 177 | outcol++, outcol_h += h_expand) { |
| 178 | outvalue = 0; |
| 179 | for (v = 0; v < v_expand; v++) { |
| 180 | inptr = input_data[inrow+v] + outcol_h; |
| 181 | for (h = 0; h < h_expand; h++) { |
| 182 | outvalue += (INT32) GETJSAMPLE(*inptr++); |
| 183 | } |
| 184 | } |
| 185 | *outptr++ = (JSAMPLE) ((outvalue + numpix2) / numpix); |
| 186 | } |
| 187 | inrow += v_expand; |
| 188 | outrow++; |
| 189 | } |
| 190 | } |
| 191 | |
| 192 | |
| 193 | /* |
nothing calls this directly
no test coverage detected