blob: ce70a309401192d6e2945aa30519a8bc1ba2cc82 [file] [log] [blame]
Thomas G. Lanebc79e061995-08-02 00:00:00 +00001/*
2 * jctrans.c
3 *
DRC5033f3e2014-05-18 18:33:44 +00004 * This file was part of the Independent JPEG Group's software:
Thomas G. Lane5ead57a1998-03-27 00:00:00 +00005 * Copyright (C) 1995-1998, Thomas G. Lane.
Guido Vollbeding989630f2010-01-10 00:00:00 +00006 * Modified 2000-2009 by Guido Vollbeding.
DRC5033f3e2014-05-18 18:33:44 +00007 * It was modified by The libjpeg-turbo Project to include only code relevant
8 * to libjpeg-turbo.
Alex Naidis6eb7d372016-10-16 23:10:08 +02009 * For conditions of distribution and use, see the accompanying README.ijg
10 * file.
Thomas G. Lanebc79e061995-08-02 00:00:00 +000011 *
12 * This file contains library routines for transcoding compression,
13 * that is, writing raw DCT coefficient arrays to an output JPEG file.
14 * The routines in jcapimin.c will also be needed by a transcoder.
15 */
16
17#define JPEG_INTERNALS
18#include "jinclude.h"
19#include "jpeglib.h"
20
21
22/* Forward declarations */
Leon Scroggins III3993b372018-07-16 10:43:45 -040023LOCAL(void) transencode_master_selection(j_compress_ptr cinfo,
24 jvirt_barray_ptr *coef_arrays);
25LOCAL(void) transencode_coef_controller(j_compress_ptr cinfo,
26 jvirt_barray_ptr *coef_arrays);
Thomas G. Lanebc79e061995-08-02 00:00:00 +000027
28
29/*
30 * Compression initialization for writing raw-coefficient data.
31 * Before calling this, all parameters and a data destination must be set up.
32 * Call jpeg_finish_compress() to actually write the data.
33 *
34 * The number of passed virtual arrays must match cinfo->num_components.
35 * Note that the virtual arrays need not be filled or even realized at
36 * the time write_coefficients is called; indeed, if the virtual arrays
37 * were requested from this compression object's memory manager, they
38 * typically will be realized during this routine and filled afterwards.
39 */
40
Thomas G. Lane489583f1996-02-07 00:00:00 +000041GLOBAL(void)
Leon Scroggins III3993b372018-07-16 10:43:45 -040042jpeg_write_coefficients(j_compress_ptr cinfo, jvirt_barray_ptr *coef_arrays)
Thomas G. Lanebc79e061995-08-02 00:00:00 +000043{
44 if (cinfo->global_state != CSTATE_START)
45 ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
46 /* Mark all tables to be written */
47 jpeg_suppress_tables(cinfo, FALSE);
48 /* (Re)initialize error mgr and destination modules */
Leon Scroggins III3993b372018-07-16 10:43:45 -040049 (*cinfo->err->reset_error_mgr) ((j_common_ptr)cinfo);
Thomas G. Lanebc79e061995-08-02 00:00:00 +000050 (*cinfo->dest->init_destination) (cinfo);
51 /* Perform master selection of active modules */
52 transencode_master_selection(cinfo, coef_arrays);
53 /* Wait for jpeg_finish_compress() call */
DRCe5eaf372014-05-09 18:00:32 +000054 cinfo->next_scanline = 0; /* so jpeg_write_marker works */
Thomas G. Lanebc79e061995-08-02 00:00:00 +000055 cinfo->global_state = CSTATE_WRCOEFS;
56}
57
58
59/*
60 * Initialize the compression object with default parameters,
61 * then copy from the source object all parameters needed for lossless
62 * transcoding. Parameters that can be varied without loss (such as
63 * scan script and Huffman optimization) are left in their default states.
64 */
65
Thomas G. Lane489583f1996-02-07 00:00:00 +000066GLOBAL(void)
Leon Scroggins III3993b372018-07-16 10:43:45 -040067jpeg_copy_critical_parameters(j_decompress_ptr srcinfo, j_compress_ptr dstinfo)
Thomas G. Lanebc79e061995-08-02 00:00:00 +000068{
Alex Naidis6eb7d372016-10-16 23:10:08 +020069 JQUANT_TBL **qtblptr;
Thomas G. Lanebc79e061995-08-02 00:00:00 +000070 jpeg_component_info *incomp, *outcomp;
71 JQUANT_TBL *c_quant, *slot_quant;
72 int tblno, ci, coefi;
73
74 /* Safety check to ensure start_compress not called yet. */
75 if (dstinfo->global_state != CSTATE_START)
76 ERREXIT1(dstinfo, JERR_BAD_STATE, dstinfo->global_state);
77 /* Copy fundamental image dimensions */
78 dstinfo->image_width = srcinfo->image_width;
79 dstinfo->image_height = srcinfo->image_height;
80 dstinfo->input_components = srcinfo->num_components;
81 dstinfo->in_color_space = srcinfo->jpeg_color_space;
DRC36a6eec2010-10-08 08:05:44 +000082#if JPEG_LIB_VERSION >= 70
Guido Vollbeding989630f2010-01-10 00:00:00 +000083 dstinfo->jpeg_width = srcinfo->output_width;
84 dstinfo->jpeg_height = srcinfo->output_height;
85 dstinfo->min_DCT_h_scaled_size = srcinfo->min_DCT_h_scaled_size;
86 dstinfo->min_DCT_v_scaled_size = srcinfo->min_DCT_v_scaled_size;
DRC36a6eec2010-10-08 08:05:44 +000087#endif
Thomas G. Lanebc79e061995-08-02 00:00:00 +000088 /* Initialize all parameters to default values */
89 jpeg_set_defaults(dstinfo);
90 /* jpeg_set_defaults may choose wrong colorspace, eg YCbCr if input is RGB.
91 * Fix it to get the right header markers for the image colorspace.
92 */
93 jpeg_set_colorspace(dstinfo, srcinfo->jpeg_color_space);
94 dstinfo->data_precision = srcinfo->data_precision;
95 dstinfo->CCIR601_sampling = srcinfo->CCIR601_sampling;
96 /* Copy the source's quantization tables. */
97 for (tblno = 0; tblno < NUM_QUANT_TBLS; tblno++) {
98 if (srcinfo->quant_tbl_ptrs[tblno] != NULL) {
Leon Scroggins III3993b372018-07-16 10:43:45 -040099 qtblptr = &dstinfo->quant_tbl_ptrs[tblno];
Thomas G. Lanebc79e061995-08-02 00:00:00 +0000100 if (*qtblptr == NULL)
Leon Scroggins III3993b372018-07-16 10:43:45 -0400101 *qtblptr = jpeg_alloc_quant_table((j_common_ptr)dstinfo);
102 MEMCOPY((*qtblptr)->quantval, srcinfo->quant_tbl_ptrs[tblno]->quantval,
DRC5de454b2014-05-18 19:04:03 +0000103 sizeof((*qtblptr)->quantval));
Thomas G. Lanebc79e061995-08-02 00:00:00 +0000104 (*qtblptr)->sent_table = FALSE;
105 }
106 }
107 /* Copy the source's per-component info.
108 * Note we assume jpeg_set_defaults has allocated the dest comp_info array.
109 */
110 dstinfo->num_components = srcinfo->num_components;
111 if (dstinfo->num_components < 1 || dstinfo->num_components > MAX_COMPONENTS)
112 ERREXIT2(dstinfo, JERR_COMPONENT_COUNT, dstinfo->num_components,
DRCe5eaf372014-05-09 18:00:32 +0000113 MAX_COMPONENTS);
Thomas G. Lanebc79e061995-08-02 00:00:00 +0000114 for (ci = 0, incomp = srcinfo->comp_info, outcomp = dstinfo->comp_info;
115 ci < dstinfo->num_components; ci++, incomp++, outcomp++) {
116 outcomp->component_id = incomp->component_id;
117 outcomp->h_samp_factor = incomp->h_samp_factor;
118 outcomp->v_samp_factor = incomp->v_samp_factor;
119 outcomp->quant_tbl_no = incomp->quant_tbl_no;
120 /* Make sure saved quantization table for component matches the qtable
121 * slot. If not, the input file re-used this qtable slot.
122 * IJG encoder currently cannot duplicate this.
123 */
124 tblno = outcomp->quant_tbl_no;
125 if (tblno < 0 || tblno >= NUM_QUANT_TBLS ||
DRCe5eaf372014-05-09 18:00:32 +0000126 srcinfo->quant_tbl_ptrs[tblno] == NULL)
Thomas G. Lanebc79e061995-08-02 00:00:00 +0000127 ERREXIT1(dstinfo, JERR_NO_QUANT_TABLE, tblno);
128 slot_quant = srcinfo->quant_tbl_ptrs[tblno];
129 c_quant = incomp->quant_table;
130 if (c_quant != NULL) {
131 for (coefi = 0; coefi < DCTSIZE2; coefi++) {
DRCe5eaf372014-05-09 18:00:32 +0000132 if (c_quant->quantval[coefi] != slot_quant->quantval[coefi])
133 ERREXIT1(dstinfo, JERR_MISMATCHED_QUANT_TABLE, tblno);
Thomas G. Lanebc79e061995-08-02 00:00:00 +0000134 }
135 }
136 /* Note: we do not copy the source's Huffman table assignments;
137 * instead we rely on jpeg_set_colorspace to have made a suitable choice.
138 */
139 }
Thomas G. Lane5ead57a1998-03-27 00:00:00 +0000140 /* Also copy JFIF version and resolution information, if available.
141 * Strictly speaking this isn't "critical" info, but it's nearly
142 * always appropriate to copy it if available. In particular,
143 * if the application chooses to copy JFIF 1.02 extension markers from
144 * the source file, we need to copy the version to make sure we don't
145 * emit a file that has 1.02 extensions but a claimed version of 1.01.
146 * We will *not*, however, copy version info from mislabeled "2.01" files.
147 */
148 if (srcinfo->saw_JFIF_marker) {
149 if (srcinfo->JFIF_major_version == 1) {
150 dstinfo->JFIF_major_version = srcinfo->JFIF_major_version;
151 dstinfo->JFIF_minor_version = srcinfo->JFIF_minor_version;
152 }
153 dstinfo->density_unit = srcinfo->density_unit;
154 dstinfo->X_density = srcinfo->X_density;
155 dstinfo->Y_density = srcinfo->Y_density;
156 }
Thomas G. Lanebc79e061995-08-02 00:00:00 +0000157}
158
159
160/*
161 * Master selection of compression modules for transcoding.
162 * This substitutes for jcinit.c's initialization of the full compressor.
163 */
164
Thomas G. Lane489583f1996-02-07 00:00:00 +0000165LOCAL(void)
Leon Scroggins III3993b372018-07-16 10:43:45 -0400166transencode_master_selection(j_compress_ptr cinfo,
167 jvirt_barray_ptr *coef_arrays)
Thomas G. Lanebc79e061995-08-02 00:00:00 +0000168{
169 /* Although we don't actually use input_components for transcoding,
170 * jcmaster.c's initial_setup will complain if input_components is 0.
171 */
172 cinfo->input_components = 1;
173 /* Initialize master control (includes parameter checking/processing) */
174 jinit_c_master_control(cinfo, TRUE /* transcode only */);
175
176 /* Entropy encoding: either Huffman or arithmetic coding. */
177 if (cinfo->arith_code) {
DRC66f97e62010-11-23 05:49:54 +0000178#ifdef C_ARITH_CODING_SUPPORTED
Guido Vollbeding1e247ac1998-03-28 00:00:00 +0000179 jinit_arith_encoder(cinfo);
DRC66f97e62010-11-23 05:49:54 +0000180#else
Thomas G. Lanebc79e061995-08-02 00:00:00 +0000181 ERREXIT(cinfo, JERR_ARITH_NOTIMPL);
DRC66f97e62010-11-23 05:49:54 +0000182#endif
Thomas G. Lanebc79e061995-08-02 00:00:00 +0000183 } else {
184 if (cinfo->progressive_mode) {
185#ifdef C_PROGRESSIVE_SUPPORTED
186 jinit_phuff_encoder(cinfo);
187#else
188 ERREXIT(cinfo, JERR_NOT_COMPILED);
189#endif
190 } else
191 jinit_huff_encoder(cinfo);
192 }
193
194 /* We need a special coefficient buffer controller. */
195 transencode_coef_controller(cinfo, coef_arrays);
196
197 jinit_marker_writer(cinfo);
198
199 /* We can now tell the memory manager to allocate virtual arrays. */
Leon Scroggins III3993b372018-07-16 10:43:45 -0400200 (*cinfo->mem->realize_virt_arrays) ((j_common_ptr)cinfo);
Thomas G. Lanebc79e061995-08-02 00:00:00 +0000201
Thomas G. Lane5ead57a1998-03-27 00:00:00 +0000202 /* Write the datastream header (SOI, JFIF) immediately.
Thomas G. Lanebc79e061995-08-02 00:00:00 +0000203 * Frame and scan headers are postponed till later.
204 * This lets application insert special markers after the SOI.
205 */
206 (*cinfo->marker->write_file_header) (cinfo);
207}
208
209
210/*
211 * The rest of this file is a special implementation of the coefficient
212 * buffer controller. This is similar to jccoefct.c, but it handles only
213 * output from presupplied virtual arrays. Furthermore, we generate any
214 * dummy padding blocks on-the-fly rather than expecting them to be present
215 * in the arrays.
216 */
217
218/* Private buffer controller object */
219
220typedef struct {
221 struct jpeg_c_coef_controller pub; /* public fields */
222
DRCe5eaf372014-05-09 18:00:32 +0000223 JDIMENSION iMCU_row_num; /* iMCU row # within image */
224 JDIMENSION mcu_ctr; /* counts MCUs processed in current row */
225 int MCU_vert_offset; /* counts MCU rows within iMCU row */
226 int MCU_rows_per_iMCU_row; /* number of such rows needed */
Thomas G. Lanebc79e061995-08-02 00:00:00 +0000227
228 /* Virtual block array for each component. */
Alex Naidis6eb7d372016-10-16 23:10:08 +0200229 jvirt_barray_ptr *whole_image;
Thomas G. Lanebc79e061995-08-02 00:00:00 +0000230
231 /* Workspace for constructing dummy blocks at right/bottom edges. */
232 JBLOCKROW dummy_buffer[C_MAX_BLOCKS_IN_MCU];
233} my_coef_controller;
234
Alex Naidis6eb7d372016-10-16 23:10:08 +0200235typedef my_coef_controller *my_coef_ptr;
Thomas G. Lanebc79e061995-08-02 00:00:00 +0000236
237
Thomas G. Lane489583f1996-02-07 00:00:00 +0000238LOCAL(void)
Leon Scroggins III3993b372018-07-16 10:43:45 -0400239start_iMCU_row(j_compress_ptr cinfo)
Thomas G. Lanebc79e061995-08-02 00:00:00 +0000240/* Reset within-iMCU-row counters for a new row */
241{
Leon Scroggins III3993b372018-07-16 10:43:45 -0400242 my_coef_ptr coef = (my_coef_ptr)cinfo->coef;
Thomas G. Lanebc79e061995-08-02 00:00:00 +0000243
244 /* In an interleaved scan, an MCU row is the same as an iMCU row.
245 * In a noninterleaved scan, an iMCU row has v_samp_factor MCU rows.
246 * But at the bottom of the image, process only what's left.
247 */
248 if (cinfo->comps_in_scan > 1) {
249 coef->MCU_rows_per_iMCU_row = 1;
250 } else {
Leon Scroggins III3993b372018-07-16 10:43:45 -0400251 if (coef->iMCU_row_num < (cinfo->total_iMCU_rows - 1))
Thomas G. Lanebc79e061995-08-02 00:00:00 +0000252 coef->MCU_rows_per_iMCU_row = cinfo->cur_comp_info[0]->v_samp_factor;
253 else
254 coef->MCU_rows_per_iMCU_row = cinfo->cur_comp_info[0]->last_row_height;
255 }
256
257 coef->mcu_ctr = 0;
258 coef->MCU_vert_offset = 0;
259}
260
261
262/*
263 * Initialize for a processing pass.
264 */
265
Thomas G. Lane489583f1996-02-07 00:00:00 +0000266METHODDEF(void)
Leon Scroggins III3993b372018-07-16 10:43:45 -0400267start_pass_coef(j_compress_ptr cinfo, J_BUF_MODE pass_mode)
Thomas G. Lanebc79e061995-08-02 00:00:00 +0000268{
Leon Scroggins III3993b372018-07-16 10:43:45 -0400269 my_coef_ptr coef = (my_coef_ptr)cinfo->coef;
Thomas G. Lanebc79e061995-08-02 00:00:00 +0000270
271 if (pass_mode != JBUF_CRANK_DEST)
272 ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
273
274 coef->iMCU_row_num = 0;
275 start_iMCU_row(cinfo);
276}
277
278
279/*
280 * Process some data.
281 * We process the equivalent of one fully interleaved MCU row ("iMCU" row)
282 * per call, ie, v_samp_factor block rows for each component in the scan.
283 * The data is obtained from the virtual arrays and fed to the entropy coder.
284 * Returns TRUE if the iMCU row is completed, FALSE if suspended.
285 *
286 * NB: input_buf is ignored; it is likely to be a NULL pointer.
287 */
288
Thomas G. Lane489583f1996-02-07 00:00:00 +0000289METHODDEF(boolean)
Leon Scroggins III3993b372018-07-16 10:43:45 -0400290compress_output(j_compress_ptr cinfo, JSAMPIMAGE input_buf)
Thomas G. Lanebc79e061995-08-02 00:00:00 +0000291{
Leon Scroggins III3993b372018-07-16 10:43:45 -0400292 my_coef_ptr coef = (my_coef_ptr)cinfo->coef;
DRCe5eaf372014-05-09 18:00:32 +0000293 JDIMENSION MCU_col_num; /* index of current MCU within row */
Thomas G. Lanebc79e061995-08-02 00:00:00 +0000294 JDIMENSION last_MCU_col = cinfo->MCUs_per_row - 1;
295 JDIMENSION last_iMCU_row = cinfo->total_iMCU_rows - 1;
296 int blkn, ci, xindex, yindex, yoffset, blockcnt;
297 JDIMENSION start_col;
298 JBLOCKARRAY buffer[MAX_COMPS_IN_SCAN];
299 JBLOCKROW MCU_buffer[C_MAX_BLOCKS_IN_MCU];
300 JBLOCKROW buffer_ptr;
301 jpeg_component_info *compptr;
302
303 /* Align the virtual buffers for the components used in this scan. */
304 for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
305 compptr = cinfo->cur_comp_info[ci];
306 buffer[ci] = (*cinfo->mem->access_virt_barray)
Leon Scroggins III3993b372018-07-16 10:43:45 -0400307 ((j_common_ptr)cinfo, coef->whole_image[compptr->component_index],
Thomas G. Lanebc79e061995-08-02 00:00:00 +0000308 coef->iMCU_row_num * compptr->v_samp_factor,
Leon Scroggins III3993b372018-07-16 10:43:45 -0400309 (JDIMENSION)compptr->v_samp_factor, FALSE);
Thomas G. Lanebc79e061995-08-02 00:00:00 +0000310 }
311
312 /* Loop to process one whole iMCU row */
313 for (yoffset = coef->MCU_vert_offset; yoffset < coef->MCU_rows_per_iMCU_row;
314 yoffset++) {
315 for (MCU_col_num = coef->mcu_ctr; MCU_col_num < cinfo->MCUs_per_row;
DRCe5eaf372014-05-09 18:00:32 +0000316 MCU_col_num++) {
Thomas G. Lanebc79e061995-08-02 00:00:00 +0000317 /* Construct list of pointers to DCT blocks belonging to this MCU */
DRCe5eaf372014-05-09 18:00:32 +0000318 blkn = 0; /* index of current DCT block within MCU */
Thomas G. Lanebc79e061995-08-02 00:00:00 +0000319 for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
DRCe5eaf372014-05-09 18:00:32 +0000320 compptr = cinfo->cur_comp_info[ci];
321 start_col = MCU_col_num * compptr->MCU_width;
Leon Scroggins III3993b372018-07-16 10:43:45 -0400322 blockcnt = (MCU_col_num < last_MCU_col) ? compptr->MCU_width :
323 compptr->last_col_width;
DRCe5eaf372014-05-09 18:00:32 +0000324 for (yindex = 0; yindex < compptr->MCU_height; yindex++) {
325 if (coef->iMCU_row_num < last_iMCU_row ||
Leon Scroggins III3993b372018-07-16 10:43:45 -0400326 yindex + yoffset < compptr->last_row_height) {
DRCe5eaf372014-05-09 18:00:32 +0000327 /* Fill in pointers to real blocks in this row */
Leon Scroggins III3993b372018-07-16 10:43:45 -0400328 buffer_ptr = buffer[ci][yindex + yoffset] + start_col;
DRCe5eaf372014-05-09 18:00:32 +0000329 for (xindex = 0; xindex < blockcnt; xindex++)
330 MCU_buffer[blkn++] = buffer_ptr++;
331 } else {
332 /* At bottom of image, need a whole row of dummy blocks */
333 xindex = 0;
334 }
335 /* Fill in any dummy blocks needed in this row.
336 * Dummy blocks are filled in the same way as in jccoefct.c:
337 * all zeroes in the AC entries, DC entries equal to previous
338 * block's DC value. The init routine has already zeroed the
339 * AC entries, so we need only set the DC entries correctly.
340 */
341 for (; xindex < compptr->MCU_width; xindex++) {
342 MCU_buffer[blkn] = coef->dummy_buffer[blkn];
Leon Scroggins III3993b372018-07-16 10:43:45 -0400343 MCU_buffer[blkn][0][0] = MCU_buffer[blkn - 1][0][0];
DRCe5eaf372014-05-09 18:00:32 +0000344 blkn++;
345 }
346 }
Thomas G. Lanebc79e061995-08-02 00:00:00 +0000347 }
348 /* Try to write the MCU. */
Leon Scroggins III3993b372018-07-16 10:43:45 -0400349 if (!(*cinfo->entropy->encode_mcu) (cinfo, MCU_buffer)) {
DRCe5eaf372014-05-09 18:00:32 +0000350 /* Suspension forced; update state counters and exit */
351 coef->MCU_vert_offset = yoffset;
352 coef->mcu_ctr = MCU_col_num;
353 return FALSE;
Thomas G. Lanebc79e061995-08-02 00:00:00 +0000354 }
355 }
356 /* Completed an MCU row, but perhaps not an iMCU row */
357 coef->mcu_ctr = 0;
358 }
359 /* Completed the iMCU row, advance counters for next one */
360 coef->iMCU_row_num++;
361 start_iMCU_row(cinfo);
362 return TRUE;
363}
364
365
366/*
367 * Initialize coefficient buffer controller.
368 *
369 * Each passed coefficient array must be the right size for that
370 * coefficient: width_in_blocks wide and height_in_blocks high,
371 * with unitheight at least v_samp_factor.
372 */
373
Thomas G. Lane489583f1996-02-07 00:00:00 +0000374LOCAL(void)
Leon Scroggins III3993b372018-07-16 10:43:45 -0400375transencode_coef_controller(j_compress_ptr cinfo,
376 jvirt_barray_ptr *coef_arrays)
Thomas G. Lanebc79e061995-08-02 00:00:00 +0000377{
378 my_coef_ptr coef;
379 JBLOCKROW buffer;
380 int i;
381
382 coef = (my_coef_ptr)
Leon Scroggins III3993b372018-07-16 10:43:45 -0400383 (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
DRC5de454b2014-05-18 19:04:03 +0000384 sizeof(my_coef_controller));
Leon Scroggins III3993b372018-07-16 10:43:45 -0400385 cinfo->coef = (struct jpeg_c_coef_controller *)coef;
Thomas G. Lanebc79e061995-08-02 00:00:00 +0000386 coef->pub.start_pass = start_pass_coef;
387 coef->pub.compress_data = compress_output;
388
389 /* Save pointer to virtual arrays */
390 coef->whole_image = coef_arrays;
391
392 /* Allocate and pre-zero space for dummy DCT blocks. */
393 buffer = (JBLOCKROW)
Leon Scroggins III3993b372018-07-16 10:43:45 -0400394 (*cinfo->mem->alloc_large) ((j_common_ptr)cinfo, JPOOL_IMAGE,
DRC5de454b2014-05-18 19:04:03 +0000395 C_MAX_BLOCKS_IN_MCU * sizeof(JBLOCK));
Leon Scroggins III3993b372018-07-16 10:43:45 -0400396 jzero_far((void *)buffer, C_MAX_BLOCKS_IN_MCU * sizeof(JBLOCK));
Thomas G. Lanebc79e061995-08-02 00:00:00 +0000397 for (i = 0; i < C_MAX_BLOCKS_IN_MCU; i++) {
398 coef->dummy_buffer[i] = buffer + i;
399 }
400}