MCPcopy Create free account
hub / github.com/davisking/dlib / create_context_buffer

Function create_context_buffer

dlib/external/libjpeg/jcprepct.c:270–309  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

268 */
269
270LOCAL(void)
271create_context_buffer (j_compress_ptr cinfo)
272{
273 my_prep_ptr prep = (my_prep_ptr) cinfo->prep;
274 int rgroup_height = cinfo->max_v_samp_factor;
275 int ci, i;
276 jpeg_component_info * compptr;
277 JSAMPARRAY true_buffer, fake_buffer;
278
279 /* Grab enough space for fake row pointers for all the components;
280 * we need five row groups' worth of pointers for each component.
281 */
282 fake_buffer = (JSAMPARRAY) (*cinfo->mem->alloc_small)
283 ((j_common_ptr) cinfo, JPOOL_IMAGE,
284 (cinfo->num_components * 5 * rgroup_height) * SIZEOF(JSAMPROW));
285
286 for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
287 ci++, compptr++) {
288 /* Allocate the actual buffer space (3 row groups) for this component.
289 * We make the buffer wide enough to allow the downsampler to edge-expand
290 * horizontally within the buffer, if it so chooses.
291 */
292 true_buffer = (*cinfo->mem->alloc_sarray)
293 ((j_common_ptr) cinfo, JPOOL_IMAGE,
294 (JDIMENSION) (((long) compptr->width_in_blocks *
295 cinfo->min_DCT_h_scaled_size *
296 cinfo->max_h_samp_factor) / compptr->h_samp_factor),
297 (JDIMENSION) (3 * rgroup_height));
298 /* Copy true buffer row pointers into the middle of the fake row array */
299 MEMCOPY(fake_buffer + rgroup_height, true_buffer,
300 3 * rgroup_height * SIZEOF(JSAMPROW));
301 /* Fill in the above and below wraparound pointers */
302 for (i = 0; i < rgroup_height; i++) {
303 fake_buffer[i] = true_buffer[2 * rgroup_height + i];
304 fake_buffer[4 * rgroup_height + i] = true_buffer[i];
305 }
306 prep->color_buf[ci] = fake_buffer + rgroup_height;
307 fake_buffer += 5 * rgroup_height; /* point to space for next component */
308 }
309}
310
311#endif /* CONTEXT_ROWS_SUPPORTED */
312

Callers 1

jinit_c_prep_controllerFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected