Main MRPT website > C++ reference for MRPT 1.9.9
jdhuff.cpp
Go to the documentation of this file.
1 /* +------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | http://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2017, Individual contributors, see AUTHORS file |
6  | See: http://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See details in http://www.mrpt.org/License |
8  +------------------------------------------------------------------------+ */
9 
10 #define JPEG_INTERNALS
11 #include "jinclude.h"
12 #include "mrpt_jpeglib.h"
13 #include "jdhuff.h" /* Declarations shared with jdphuff.c */
14 
15 /*
16  * Expanded entropy decoder object for Huffman decoding.
17  *
18  * The savable_state subrecord contains fields that change within an MCU,
19  * but must not be updated permanently until we complete the MCU.
20  */
21 
22 typedef struct
23 {
24  int last_dc_val[MAX_COMPS_IN_SCAN]; /* last DC coef for each component */
26 
27 /* This macro is to work around compilers with missing or broken
28  * structure assignment. You'll need to fix this code if you have
29  * such a compiler and you change MAX_COMPS_IN_SCAN.
30  */
31 
32 #ifndef NO_STRUCT_ASSIGN
33 #define ASSIGN_STATE(dest, src) ((dest) = (src))
34 #else
35 #if MAX_COMPS_IN_SCAN == 4
36 #define ASSIGN_STATE(dest, src) \
37  ((dest).last_dc_val[0] = (src).last_dc_val[0], \
38  (dest).last_dc_val[1] = (src).last_dc_val[1], \
39  (dest).last_dc_val[2] = (src).last_dc_val[2], \
40  (dest).last_dc_val[3] = (src).last_dc_val[3])
41 #endif
42 #endif
43 
44 typedef struct
45 {
46  struct jpeg_entropy_decoder pub; /* public fields */
47 
48  /* These fields are loaded into local variables at start of each MCU.
49  * In case of suspension, we exit WITHOUT updating them.
50  */
51  bitread_perm_state bitstate; /* Bit buffer at start of MCU */
52  savable_state saved; /* Other state at start of MCU */
53 
54  /* These fields are NOT loaded into local working state. */
55  unsigned int restarts_to_go; /* MCUs left in this restart interval */
56 
57  /* Pointers to derived tables (these workspaces have image lifespan) */
58  d_derived_tbl* dc_derived_tbls[NUM_HUFF_TBLS];
59  d_derived_tbl* ac_derived_tbls[NUM_HUFF_TBLS];
60 
61  /* Precalculated info set up by start_pass for use in decode_mcu: */
62 
63  /* Pointers to derived tables to be used for each block within an MCU */
66  /* Whether we care about the DC and AC coefficient values for each block */
67  boolean dc_needed[D_MAX_BLOCKS_IN_MCU];
68  boolean ac_needed[D_MAX_BLOCKS_IN_MCU];
70 
72 
73 /*
74  * Initialize for a Huffman-compressed scan.
75  */
76 
77 METHODDEF(void)
79 {
80  huff_entropy_ptr entropy = (huff_entropy_ptr)cinfo->entropy;
81  int ci, blkn, dctbl, actbl;
83 
84  /* Check that the scan parameters Ss, Se, Ah/Al are OK for sequential JPEG.
85  * This ought to be an error condition, but we make it a warning because
86  * there are some baseline files out there with all zeroes in these bytes.
87  */
88  if (cinfo->Ss != 0 || cinfo->Se != DCTSIZE2 - 1 || cinfo->Ah != 0 ||
89  cinfo->Al != 0)
90  WARNMS(cinfo, JWRN_NOT_SEQUENTIAL);
91 
92  for (ci = 0; ci < cinfo->comps_in_scan; ci++)
93  {
94  compptr = cinfo->cur_comp_info[ci];
95  dctbl = compptr->dc_tbl_no;
96  actbl = compptr->ac_tbl_no;
97  /* Compute derived values for Huffman tables */
98  /* We may do this more than once for a table, but it's not expensive */
100  cinfo, TRUE, dctbl, &entropy->dc_derived_tbls[dctbl]);
102  cinfo, FALSE, actbl, &entropy->ac_derived_tbls[actbl]);
103  /* Initialize DC predictions to 0 */
104  entropy->saved.last_dc_val[ci] = 0;
105  }
106 
107  /* Precalculate decoding info for each block in an MCU of this scan */
108  for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++)
109  {
110  ci = cinfo->MCU_membership[blkn];
111  compptr = cinfo->cur_comp_info[ci];
112  /* Precalculate which table to use for each block */
113  entropy->dc_cur_tbls[blkn] =
114  entropy->dc_derived_tbls[compptr->dc_tbl_no];
115  entropy->ac_cur_tbls[blkn] =
116  entropy->ac_derived_tbls[compptr->ac_tbl_no];
117  /* Decide whether we really care about the coefficient values */
119  {
120  entropy->dc_needed[blkn] = TRUE;
121  /* we don't need the ACs if producing a 1/8th-size image */
122  entropy->ac_needed[blkn] = (compptr->DCT_scaled_size > 1);
123  }
124  else
125  {
126  entropy->dc_needed[blkn] = entropy->ac_needed[blkn] = FALSE;
127  }
128  }
129 
130  /* Initialize bitread state variables */
131  entropy->bitstate.bits_left = 0;
132  entropy->bitstate.get_buffer = 0; /* unnecessary, but keeps Purify quiet */
133  entropy->pub.insufficient_data = FALSE;
134 
135  /* Initialize restart counter */
136  entropy->restarts_to_go = cinfo->restart_interval;
137 }
138 
139 /*
140  * Compute the derived values for a Huffman table.
141  * This routine also performs some validation checks on the table.
142  *
143  * Note this is also used by jdphuff.c.
144  */
145 
146 GLOBAL(void)
148  j_decompress_ptr cinfo, boolean isDC, int tblno, d_derived_tbl** pdtbl)
149 {
150  JHUFF_TBL* htbl;
151  d_derived_tbl* dtbl;
152  int p, i, l, si, numsymbols;
153  int lookbits, ctr;
154  char huffsize[257];
155  unsigned int huffcode[257];
156  unsigned int code;
157 
158  /* Note that huffsize[] and huffcode[] are filled in code-length order,
159  * paralleling the order of the symbols themselves in htbl->huffval[].
160  */
161 
162  /* Find the input Huffman table */
163  if (tblno < 0 || tblno >= NUM_HUFF_TBLS)
164  ERREXIT1(cinfo, JERR_NO_HUFF_TABLE, tblno);
165  htbl =
166  isDC ? cinfo->dc_huff_tbl_ptrs[tblno] : cinfo->ac_huff_tbl_ptrs[tblno];
167  if (htbl == nullptr) ERREXIT1(cinfo, JERR_NO_HUFF_TABLE, tblno);
168 
169  /* Allocate a workspace if we haven't already done so. */
170  if (*pdtbl == nullptr)
171  *pdtbl = (d_derived_tbl*)(*cinfo->mem->alloc_small)(
173  dtbl = *pdtbl;
174  dtbl->pub = htbl; /* fill in back link */
175 
176  /* Figure C.1: make table of Huffman code length for each symbol */
177 
178  p = 0;
179  for (l = 1; l <= 16; l++)
180  {
181  i = (int)htbl->bits[l];
182  if (i < 0 || p + i > 256) /* protect against table overrun */
183  ERREXIT(cinfo, JERR_BAD_HUFF_TABLE);
184  while (i--) huffsize[p++] = (char)l;
185  }
186  huffsize[p] = 0;
187  numsymbols = p;
188 
189  /* Figure C.2: generate the codes themselves */
190  /* We also validate that the counts represent a legal Huffman code tree. */
191 
192  code = 0;
193  si = huffsize[0];
194  p = 0;
195  while (huffsize[p])
196  {
197  while (((int)huffsize[p]) == si)
198  {
199  huffcode[p++] = code;
200  code++;
201  }
202  /* code is now 1 more than the last code used for codelength si; but
203  * it must still fit in si bits, since no code is allowed to be all
204  * ones.
205  */
206  if (((INT32)code) >= (((INT32)1) << si))
207  ERREXIT(cinfo, JERR_BAD_HUFF_TABLE);
208  code <<= 1;
209  si++;
210  }
211 
212  /* Figure F.15: generate decoding tables for bit-sequential decoding */
213 
214  p = 0;
215  for (l = 1; l <= 16; l++)
216  {
217  if (htbl->bits[l])
218  {
219  /* valoffset[l] = huffval[] index of 1st symbol of code length l,
220  * minus the minimum code of length l
221  */
222  dtbl->valoffset[l] = (INT32)p - (INT32)huffcode[p];
223  p += htbl->bits[l];
224  dtbl->maxcode[l] = huffcode[p - 1]; /* maximum code of length l */
225  }
226  else
227  {
228  dtbl->maxcode[l] = -1; /* -1 if no codes of this length */
229  }
230  }
231  dtbl->maxcode[17] = 0xFFFFFL; /* ensures jpeg_huff_decode terminates */
232 
233  /* Compute lookahead tables to speed up decoding.
234  * First we set all the table entries to 0, indicating "too long";
235  * then we iterate through the Huffman codes that are short enough and
236  * fill in all the entries that correspond to bit sequences starting
237  * with that code.
238  */
239 
240  MEMZERO(dtbl->look_nbits, SIZEOF(dtbl->look_nbits));
241 
242  p = 0;
243  for (l = 1; l <= HUFF_LOOKAHEAD; l++)
244  {
245  for (i = 1; i <= (int)htbl->bits[l]; i++, p++)
246  {
247  /* l = current code's length, p = its index in huffcode[] &
248  * huffval[]. */
249  /* Generate left-justified code followed by all possible bit
250  * sequences */
251  lookbits = huffcode[p] << (HUFF_LOOKAHEAD - l);
252  for (ctr = 1 << (HUFF_LOOKAHEAD - l); ctr > 0; ctr--)
253  {
254  dtbl->look_nbits[lookbits] = l;
255  dtbl->look_sym[lookbits] = htbl->huffval[p];
256  lookbits++;
257  }
258  }
259  }
260 
261  /* Validate symbols as being reasonable.
262  * For AC tables, we make no check, but accept all byte values 0..255.
263  * For DC tables, we require the symbols to be in range 0..15.
264  * (Tighter bounds could be applied depending on the data depth and mode,
265  * but this is sufficient to ensure safe decoding.)
266  */
267  if (isDC)
268  {
269  for (i = 0; i < numsymbols; i++)
270  {
271  int sym = htbl->huffval[i];
272  if (sym < 0 || sym > 15) ERREXIT(cinfo, JERR_BAD_HUFF_TABLE);
273  }
274  }
275 }
276 
277 /*
278  * Out-of-line code for bit fetching (shared with jdphuff.c).
279  * See jdhuff.h for info about usage.
280  * Note: current values of get_buffer and bits_left are passed as parameters,
281  * but are returned in the corresponding fields of the state struct.
282  *
283  * On most machines MIN_GET_BITS should be 25 to allow the full 32-bit width
284  * of get_buffer to be used. (On machines with wider words, an even larger
285  * buffer could be used.) However, on some machines 32-bit shifts are
286  * quite slow and take time proportional to the number of places shifted.
287  * (This is true with most PC compilers, for instance.) In this case it may
288  * be a win to set MIN_GET_BITS to the minimum value of 15. This reduces the
289  * average shift distance at the cost of more calls to jpeg_fill_bit_buffer.
290  */
291 
292 #ifdef SLOW_SHIFT_32
293 #define MIN_GET_BITS 15 /* minimum allowable value */
294 #else
295 #define MIN_GET_BITS (BIT_BUF_SIZE - 7)
296 #endif
297 
298 GLOBAL(boolean)
300  bitread_working_state* state, bit_buf_type get_buffer, int bits_left,
301  int nbits)
302 /* Load up the bit buffer to a depth of at least nbits */
303 {
304  /* Copy heavily used state fields into locals (hopefully registers) */
305  const JOCTET* next_input_byte = state->next_input_byte;
306  size_t bytes_in_buffer = state->bytes_in_buffer;
307  j_decompress_ptr cinfo = state->cinfo;
308 
309  /* Attempt to load at least MIN_GET_BITS bits into get_buffer. */
310  /* (It is assumed that no request will be for more than that many bits.) */
311  /* We fail to do so only if we hit a marker or are forced to suspend. */
312 
313  if (cinfo->unread_marker == 0)
314  { /* cannot advance past a marker */
315  while (bits_left < MIN_GET_BITS)
316  {
317  int c;
318 
319  /* Attempt to read a byte */
320  if (bytes_in_buffer == 0)
321  {
322  if (!(*cinfo->src->fill_input_buffer)(cinfo)) return FALSE;
323  next_input_byte = cinfo->src->next_input_byte;
324  bytes_in_buffer = cinfo->src->bytes_in_buffer;
325  }
326  bytes_in_buffer--;
327  c = GETJOCTET(*next_input_byte++);
328 
329  /* If it's 0xFF, check and discard stuffed zero byte */
330  if (c == 0xFF)
331  {
332  /* Loop here to discard any padding FF's on terminating marker,
333  * so that we can save a valid unread_marker value. NOTE: we
334  * will
335  * accept multiple FF's followed by a 0 as meaning a single FF
336  * data
337  * byte. This data pattern is not valid according to the
338  * standard.
339  */
340  do
341  {
342  if (bytes_in_buffer == 0)
343  {
344  if (!(*cinfo->src->fill_input_buffer)(cinfo))
345  return FALSE;
346  next_input_byte = cinfo->src->next_input_byte;
347  bytes_in_buffer = cinfo->src->bytes_in_buffer;
348  }
349  bytes_in_buffer--;
350  c = GETJOCTET(*next_input_byte++);
351  } while (c == 0xFF);
352 
353  if (c == 0)
354  {
355  /* Found FF/00, which represents an FF data byte */
356  c = 0xFF;
357  }
358  else
359  {
360  /* Oops, it's actually a marker indicating end of compressed
361  * data.
362  * Save the marker code for later use.
363  * Fine point: it might appear that we should save the
364  * marker into
365  * bitread working state, not straight into permanent state.
366  * But
367  * once we have hit a marker, we cannot need to suspend
368  * within the
369  * current MCU, because we will read no more bytes from the
370  * data
371  * source. So it is OK to update permanent state right
372  * away.
373  */
374  cinfo->unread_marker = c;
375  /* See if we need to insert some fake zero bits. */
376  goto no_more_bytes;
377  }
378  }
379 
380  /* OK, load c into get_buffer */
381  get_buffer = (get_buffer << 8) | c;
382  bits_left += 8;
383  } /* end while */
384  }
385  else
386  {
387  no_more_bytes:
388  /* We get here if we've read the marker that terminates the compressed
389  * data segment. There should be enough bits in the buffer register
390  * to satisfy the request; if so, no problem.
391  */
392  if (nbits > bits_left)
393  {
394  /* Uh-oh. Report corrupted data to user and stuff zeroes into
395  * the data stream, so that we can produce some kind of image.
396  * We use a nonvolatile flag to ensure that only one warning message
397  * appears per data segment.
398  */
399  if (!cinfo->entropy->insufficient_data)
400  {
401  WARNMS(cinfo, JWRN_HIT_MARKER);
402  cinfo->entropy->insufficient_data = TRUE;
403  }
404  /* Fill the buffer with zero bits */
405  get_buffer <<= MIN_GET_BITS - bits_left;
406  bits_left = MIN_GET_BITS;
407  }
408  }
409 
410  /* Unload the local registers */
411  state->next_input_byte = next_input_byte;
412  state->bytes_in_buffer = bytes_in_buffer;
413  state->get_buffer = get_buffer;
414  state->bits_left = bits_left;
415 
416  return TRUE;
417 }
418 
419 /*
420  * Out-of-line code for Huffman code decoding.
421  * See jdhuff.h for info about usage.
422  */
423 
424 GLOBAL(int)
426  bitread_working_state* state, bit_buf_type get_buffer, int bits_left,
427  d_derived_tbl* htbl, int min_bits)
428 {
429  int l = min_bits;
430  INT32 code;
431 
432  /* HUFF_DECODE has determined that the code is at least min_bits */
433  /* bits long, so fetch that many bits in one swoop. */
434 
435  CHECK_BIT_BUFFER(*state, l, return -1);
436  code = GET_BITS(l);
437 
438  /* Collect the rest of the Huffman code one bit at a time. */
439  /* This is per Figure F.16 in the JPEG spec. */
440 
441  while (code > htbl->maxcode[l])
442  {
443  code <<= 1;
444  CHECK_BIT_BUFFER(*state, 1, return -1);
445  code |= GET_BITS(1);
446  l++;
447  }
448 
449  /* Unload the local registers */
450  state->get_buffer = get_buffer;
451  state->bits_left = bits_left;
452 
453  /* With garbage input we may reach the sentinel value l = 17. */
454 
455  if (l > 16)
456  {
457  WARNMS(state->cinfo, JWRN_HUFF_BAD_CODE);
458  return 0; /* fake a zero as the safest result */
459  }
460 
461  return htbl->pub->huffval[(int)(code + htbl->valoffset[l])];
462 }
463 
464 /*
465  * Figure F.12: extend sign bit.
466  * On some machines, a shift and add will be faster than a table lookup.
467  */
468 
469 #ifdef AVOID_TABLES
470 
471 #define HUFF_EXTEND(x, s) \
472  ((x) < (1 << ((s)-1)) ? (x) + (((-1) << (s)) + 1) : (x))
473 
474 #else
475 
476 #define HUFF_EXTEND(x, s) ((x) < extend_test[s] ? (x) + extend_offset[s] : (x))
477 
478 static const int extend_test[16] = /* entry n is 2**(n-1) */
479  {0, 0x0001, 0x0002, 0x0004, 0x0008, 0x0010, 0x0020, 0x0040,
480  0x0080, 0x0100, 0x0200, 0x0400, 0x0800, 0x1000, 0x2000, 0x4000};
481 
482 static const int extend_offset[16] = /* entry n is (-1 << n) + 1 */
483  {0, -1, -3, -7, -15, -31, -63, -127,
484  -255, -511, -1023, -2047, -4095, -8191, -16383, -32767};
485 
486 #endif /* AVOID_TABLES */
487 
488 /*
489  * Check for a restart marker & resynchronize decoder.
490  * Returns FALSE if must suspend.
491  */
492 
493 LOCAL(boolean)
495 {
496  huff_entropy_ptr entropy = (huff_entropy_ptr)cinfo->entropy;
497  int ci;
498 
499  /* Throw away any unused bits remaining in bit buffer; */
500  /* include any full bytes in next_marker's count of discarded bytes */
501  cinfo->marker->discarded_bytes += entropy->bitstate.bits_left / 8;
502  entropy->bitstate.bits_left = 0;
503 
504  /* Advance past the RSTn marker */
505  if (!(*cinfo->marker->read_restart_marker)(cinfo)) return FALSE;
506 
507  /* Re-initialize DC predictions to 0 */
508  for (ci = 0; ci < cinfo->comps_in_scan; ci++)
509  entropy->saved.last_dc_val[ci] = 0;
510 
511  /* Reset restart counter */
512  entropy->restarts_to_go = cinfo->restart_interval;
513 
514  /* Reset out-of-data flag, unless read_restart_marker left us smack up
515  * against a marker. In that case we will end up treating the next data
516  * segment as empty, and we can avoid producing bogus output pixels by
517  * leaving the flag set.
518  */
519  if (cinfo->unread_marker == 0) entropy->pub.insufficient_data = FALSE;
520 
521  return TRUE;
522 }
523 
524 /*
525  * Decode and return one MCU's worth of Huffman-compressed coefficients.
526  * The coefficients are reordered from zigzag order into natural array order,
527  * but are not dequantized.
528  *
529  * The i'th block of the MCU is stored into the block pointed to by
530  * MCU_data[i]. WE ASSUME THIS AREA HAS BEEN ZEROED BY THE CALLER.
531  * (Wholesale zeroing is usually a little faster than retail...)
532  *
533  * Returns FALSE if data source requested suspension. In that case no
534  * changes have been made to permanent state. (Exception: some output
535  * coefficients may already have been assigned. This is harmless for
536  * this module, since we'll just re-assign them on the next call.)
537  */
538 
539 METHODDEF(boolean)
541 {
542  huff_entropy_ptr entropy = (huff_entropy_ptr)cinfo->entropy;
543  int blkn;
545  savable_state state;
546 
547  /* Process restart marker if needed; may have to suspend */
548  if (cinfo->restart_interval)
549  {
550  if (entropy->restarts_to_go == 0)
551  if (!process_restart(cinfo)) return FALSE;
552  }
553 
554  /* If we've run out of data, just leave the MCU set to zeroes.
555  * This way, we return uniform gray for the remainder of the segment.
556  */
557  if (!entropy->pub.insufficient_data)
558  {
559  /* Load up working state */
560  BITREAD_LOAD_STATE(cinfo, entropy->bitstate);
561  ASSIGN_STATE(state, entropy->saved);
562 
563  /* Outer loop handles each block in the MCU */
564 
565  for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++)
566  {
567  JBLOCKROW block = MCU_data[blkn];
568  d_derived_tbl* dctbl = entropy->dc_cur_tbls[blkn];
569  d_derived_tbl* actbl = entropy->ac_cur_tbls[blkn];
570  int s, k, r;
571 
572  /* Decode a single block's worth of coefficients */
573 
574  /* Section F.2.2.1: decode the DC coefficient difference */
575  HUFF_DECODE(s, br_state, dctbl, return FALSE, label1);
576  if (s)
577  {
578  CHECK_BIT_BUFFER(br_state, s, return FALSE);
579  r = GET_BITS(s);
580  s = HUFF_EXTEND(r, s);
581  }
582 
583  if (entropy->dc_needed[blkn])
584  {
585  /* Convert DC difference to actual value, update last_dc_val */
586  int ci = cinfo->MCU_membership[blkn];
587  s += state.last_dc_val[ci];
588  state.last_dc_val[ci] = s;
589  /* Output the DC coefficient (assumes jpeg_natural_order[0] = 0)
590  */
591  (*block)[0] = (JCOEF)s;
592  }
593 
594  if (entropy->ac_needed[blkn])
595  {
596  /* Section F.2.2.2: decode the AC coefficients */
597  /* Since zeroes are skipped, output area must be cleared
598  * beforehand */
599  for (k = 1; k < DCTSIZE2; k++)
600  {
601  HUFF_DECODE(s, br_state, actbl, return FALSE, label2);
602 
603  r = s >> 4;
604  s &= 15;
605 
606  if (s)
607  {
608  k += r;
609  CHECK_BIT_BUFFER(br_state, s, return FALSE);
610  r = GET_BITS(s);
611  s = HUFF_EXTEND(r, s);
612  /* Output coefficient in natural (dezigzagged) order.
613  * Note: the extra entries in jpeg_natural_order[] will
614  * save us
615  * if k >= DCTSIZE2, which could happen if the data is
616  * corrupted.
617  */
618  (*block)[jpeg_natural_order[k]] = (JCOEF)s;
619  }
620  else
621  {
622  if (r != 15) break;
623  k += 15;
624  }
625  }
626  }
627  else
628  {
629  /* Section F.2.2.2: decode the AC coefficients */
630  /* In this path we just discard the values */
631  for (k = 1; k < DCTSIZE2; k++)
632  {
633  HUFF_DECODE(s, br_state, actbl, return FALSE, label3);
634 
635  r = s >> 4;
636  s &= 15;
637 
638  if (s)
639  {
640  k += r;
641  CHECK_BIT_BUFFER(br_state, s, return FALSE);
642  DROP_BITS(s);
643  }
644  else
645  {
646  if (r != 15) break;
647  k += 15;
648  }
649  }
650  }
651  }
652 
653  /* Completed MCU, so update state */
654  BITREAD_SAVE_STATE(cinfo, entropy->bitstate);
655  ASSIGN_STATE(entropy->saved, state);
656  }
657 
658  /* Account for restart interval (no-op if not using restarts) */
659  entropy->restarts_to_go--;
660 
661  return TRUE;
662 }
663 
664 /*
665  * Module initialization routine for Huffman entropy decoding.
666  */
667 
668 GLOBAL(void)
670 {
671  huff_entropy_ptr entropy;
672  int i;
673 
674  entropy = (huff_entropy_ptr)(*cinfo->mem->alloc_small)(
676  cinfo->entropy = (struct jpeg_entropy_decoder*)entropy;
677  entropy->pub.start_pass = start_pass_huff_decoder;
678  entropy->pub.decode_mcu = decode_mcu;
679 
680  /* Mark tables unallocated */
681  for (i = 0; i < NUM_HUFF_TBLS; i++)
682  {
683  entropy->dc_derived_tbls[i] = entropy->ac_derived_tbls[i] = nullptr;
684  }
685 }
savable_state saved
Definition: jdhuff.cpp:52
#define HUFF_EXTEND(x, s)
Definition: jdhuff.cpp:476
#define BITREAD_STATE_VARS
Definition: jdhuff.h:101
#define ASSIGN_STATE(dest, src)
Definition: jdhuff.cpp:33
unsigned int restarts_to_go
Definition: jdhuff.cpp:55
UINT8 look_sym[1<< HUFF_LOOKAHEAD]
Definition: jdhuff.h:42
static const int extend_test[16]
Definition: jdhuff.cpp:478
#define DROP_BITS(nbits)
Definition: jdhuff.h:156
jpeg_huff_decode(bitread_working_state *state, bit_buf_type get_buffer, int bits_left, d_derived_tbl *htbl, int min_bits)
Definition: jdhuff.cpp:425
INT32 valoffset[17]
Definition: jdhuff.h:27
#define GETJOCTET(value)
Definition: jmorecfg.h:110
int look_nbits[1<< HUFF_LOOKAHEAD]
Definition: jdhuff.h:41
#define MAX_COMPS_IN_SCAN
Definition: mrpt_jpeglib.h:41
jpeg_fill_bit_buffer(bitread_working_state *state, bit_buf_type get_buffer, int bits_left, int nbits)
Definition: jdhuff.cpp:299
static const int extend_offset[16]
Definition: jdhuff.cpp:482
#define D_MAX_BLOCKS_IN_MCU
Definition: mrpt_jpeglib.h:52
const int jpeg_natural_order[]
Definition: jutils.cpp:48
start_pass_huff_decoder(j_decompress_ptr cinfo)
Definition: jdhuff.cpp:78
struct jpeg_common_struct * j_common_ptr
Definition: mrpt_jpeglib.h:258
savable_state saved
Definition: jchuff.cpp:50
#define ERREXIT(cinfo, code)
Definition: jerror.h:451
#define SIZEOF(object)
Definition: jinclude.h:74
#define MIN_GET_BITS
Definition: jdhuff.cpp:295
short JCOEF
Definition: jmorecfg.h:91
long INT32
Definition: jmorecfg.h:151
#define HUFF_DECODE(result, state, htbl, failaction, slowlabel)
Definition: jdhuff.h:181
GLdouble s
Definition: glext.h:3676
bitread_perm_state bitstate
Definition: jdhuff.cpp:51
#define GET_BITS(nbits)
Definition: jdhuff.h:150
c_derived_tbl * ac_derived_tbls[NUM_HUFF_TBLS]
Definition: jchuff.cpp:58
jinit_huff_decoder(j_decompress_ptr cinfo)
Definition: jdhuff.cpp:669
const GLubyte * c
Definition: glext.h:6313
#define FALSE
Definition: jmorecfg.h:216
#define JPOOL_IMAGE
Definition: mrpt_jpeglib.h:750
#define LOCAL(type)
Definition: jmorecfg.h:175
#define CHECK_BIT_BUFFER(state, nbits, action)
Definition: jdhuff.h:137
#define DCTSIZE2
Definition: mrpt_jpeglib.h:37
struct jpeg_entropy_encoder pub
Definition: jchuff.cpp:48
size_t bytes_in_buffer
Definition: mrpt_jpeglib.h:729
#define NUM_HUFF_TBLS
Definition: mrpt_jpeglib.h:39
#define WARNMS(cinfo, code)
Definition: jerror.h:482
#define TRUE
Definition: jmorecfg.h:219
INT32 maxcode[18]
Definition: jdhuff.h:25
INT32 bit_buf_type
Definition: jdhuff.h:68
huff_entropy_decoder * huff_entropy_ptr
Definition: jdhuff.cpp:71
#define HUFF_LOOKAHEAD
Definition: jdhuff.h:20
#define ERREXIT1(cinfo, code, p1)
Definition: jerror.h:454
UINT8 bits[17]
Definition: mrpt_jpeglib.h:95
#define BITREAD_SAVE_STATE(cinfop, permstate)
Definition: jdhuff.h:113
GLdouble GLdouble GLdouble r
Definition: glext.h:3705
Definition: inftrees.h:28
struct jpeg_source_mgr * src
Definition: mrpt_jpeglib.h:415
#define GLOBAL(type)
Definition: jmorecfg.h:177
#define METHODDEF(type)
Definition: jmorecfg.h:173
decode_mcu(j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
Definition: jdhuff.cpp:540
UINT8 huffval[256]
Definition: mrpt_jpeglib.h:97
jpeg_make_d_derived_tbl(j_decompress_ptr cinfo, boolean isDC, int tblno, d_derived_tbl **pdtbl)
Definition: jdhuff.cpp:147
JBLOCK FAR * JBLOCKROW
Definition: mrpt_jpeglib.h:65
int last_dc_val[MAX_COMPS_IN_SCAN]
Definition: jchuff.cpp:25
#define BITREAD_LOAD_STATE(cinfop, permstate)
Definition: jdhuff.h:106
int ctr
Definition: jidctflt.cpp:47
unsigned int restarts_to_go
Definition: jchuff.cpp:53
char JOCTET
Definition: jmorecfg.h:106
boolean insufficient_data
Definition: jpegint.h:227
const JOCTET * next_input_byte
Definition: mrpt_jpeglib.h:728
c_derived_tbl * dc_derived_tbls[NUM_HUFF_TBLS]
Definition: jchuff.cpp:57
JHUFF_TBL * pub
Definition: jdhuff.h:34
GLfloat GLfloat p
Definition: glext.h:6305
struct jpeg_entropy_decoder * entropy
Definition: mrpt_jpeglib.h:628
process_restart(j_decompress_ptr cinfo)
Definition: jdhuff.cpp:494
#define MEMZERO(target, size)
Definition: jinclude.h:60
jpeg_component_info * compptr
Definition: jidctflt.cpp:36



Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: ae4571287 Thu Nov 23 00:06:53 2017 +0100 at dom oct 27 23:51:55 CET 2019