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



Page generated by Doxygen 1.8.14 for MRPT 1.5.9 Git: 690a4699f Wed Apr 15 19:29:53 2020 +0200 at miƩ abr 15 19:30:12 CEST 2020