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

Function alloc_funny_pointers

dlib/external/libjpeg/jdmainct.c:158–194  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

156
157
158LOCAL(void)
159alloc_funny_pointers (j_decompress_ptr cinfo)
160/* Allocate space for the funny pointer lists.
161 * This is done only once, not once per pass.
162 */
163{
164 my_main_ptr mainp = (my_main_ptr) cinfo->main;
165 int ci, rgroup;
166 int M = cinfo->min_DCT_v_scaled_size;
167 jpeg_component_info *compptr;
168 JSAMPARRAY xbuf;
169
170 /* Get top-level space for component array pointers.
171 * We alloc both arrays with one call to save a few cycles.
172 */
173 mainp->xbuffer[0] = (JSAMPIMAGE) (*cinfo->mem->alloc_small)
174 ((j_common_ptr) cinfo, JPOOL_IMAGE,
175 cinfo->num_components * 2 * SIZEOF(JSAMPARRAY));
176 mainp->xbuffer[1] = mainp->xbuffer[0] + cinfo->num_components;
177
178 for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
179 ci++, compptr++) {
180 if (! compptr->component_needed)
181 continue; /* skip uninteresting component */
182 rgroup = (compptr->v_samp_factor * compptr->DCT_v_scaled_size) /
183 cinfo->min_DCT_v_scaled_size; /* height of a row group of component */
184 /* Get space for pointer lists --- M+4 row groups in each list.
185 * We alloc both pointer lists with one call to save a few cycles.
186 */
187 xbuf = (JSAMPARRAY) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo,
188 JPOOL_IMAGE, 2 * (rgroup * (M + 4)) * SIZEOF(JSAMPROW));
189 xbuf += rgroup; /* want one row group at negative offsets */
190 mainp->xbuffer[0][ci] = xbuf;
191 xbuf += rgroup * (M + 4);
192 mainp->xbuffer[1][ci] = xbuf;
193 }
194}
195
196
197LOCAL(void)

Callers 1

jinit_d_main_controllerFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected