Home | History | Annotate | Download | only in libjpeg

Lines Matching refs:entropy

8  * This file contains portable arithmetic entropy decoding routines for JPEG
21 /* Expanded entropy decoder object for arithmetic decoding. */
108 register arith_entropy_ptr e = (arith_entropy_ptr) cinfo->entropy;
192 arith_entropy_ptr entropy = (arith_entropy_ptr) cinfo->entropy;
204 MEMZERO(entropy->dc_stats[compptr->dc_tbl_no], DC_STAT_BINS);
206 entropy->last_dc_val[ci] = 0;
207 entropy->dc_context[ci] = 0;
211 MEMZERO(entropy->ac_stats[compptr->ac_tbl_no], AC_STAT_BINS);
216 entropy->c = 0;
217 entropy->a = 0;
218 entropy->ct = -16; /* force reading 2 initial bytes to fill C */
221 entropy->restarts_to_go = cinfo->restart_interval;
244 arith_entropy_ptr entropy = (arith_entropy_ptr) cinfo->entropy;
252 if (entropy->restarts_to_go == 0)
254 entropy->restarts_to_go--;
257 if (entropy->ct == -1) return TRUE; /* if error do nothing */
269 st = entropy->dc_stats[tbl] + entropy->dc_context[ci];
273 entropy->dc_context[ci] = 0;
281 st = entropy->dc_stats[tbl] + 20; /* Table F.4: X1 = 20 */
285 entropy->ct = -1; /* magnitude overflow */
293 entropy->dc_context[ci] = 0; /* zero diff category */
295 entropy->dc_context[ci] = 12 + (sign * 4); /* large diff category */
297 entropy->dc_context[ci] = 4 + (sign * 4); /* small diff category */
304 entropy->last_dc_val[ci] += v;
308 (*block)[0] = (JCOEF) (entropy->last_dc_val[ci] << cinfo->Al);
323 arith_entropy_ptr entropy = (arith_entropy_ptr) cinfo->entropy;
332 if (entropy->restarts_to_go == 0)
334 entropy->restarts_to_go--;
337 if (entropy->ct == -1) return TRUE; /* if error do nothing */
350 st = entropy->ac_stats[tbl] + 3 * k;
358 entropy->ct = -1; /* spectral overflow */
364 sign = arith_decode(cinfo, entropy->fixed_bin);
370 st = entropy->ac_stats[tbl] +
375 entropy->ct = -1; /* magnitude overflow */
403 arith_entropy_ptr entropy = (arith_entropy_ptr) cinfo->entropy;
409 if (entropy->restarts_to_go == 0)
411 entropy->restarts_to_go--;
414 st = entropy->fixed_bin; /* use fixed probability estimation */
436 arith_entropy_ptr entropy = (arith_entropy_ptr) cinfo->entropy;
446 if (entropy->restarts_to_go == 0)
448 entropy->restarts_to_go--;
451 if (entropy->ct == -1) return TRUE; /* if error do nothing */
470 st = entropy->ac_stats[tbl] + 3 * k;
485 if (arith_decode(cinfo, entropy->fixed_bin))
494 entropy->ct = -1; /* spectral overflow */
511 arith_entropy_ptr entropy = (arith_entropy_ptr) cinfo->entropy;
521 if (entropy->restarts_to_go == 0)
523 entropy->restarts_to_go--;
526 if (entropy->ct == -1) return TRUE; /* if error do nothing */
542 st = entropy->dc_stats[tbl] + entropy->dc_context[ci];
546 entropy->dc_context[ci] = 0;
554 st = entropy->dc_stats[tbl] + 20; /* Table F.4: X1 = 20 */
558 entropy->ct = -1; /* magnitude overflow */
566 entropy->dc_context[ci] = 0; /* zero diff category */
568 entropy->dc_context[ci] = 12 + (sign * 4); /* large diff category */
570 entropy->dc_context[ci] = 4 + (sign * 4); /* small diff category */
577 entropy->last_dc_val[ci] += v;
580 (*block)[0] = (JCOEF) entropy->last_dc_val[ci];
590 st = entropy->ac_stats[tbl] + 3 * k;
598 entropy->ct = -1; /* spectral overflow */
604 sign = arith_decode(cinfo, entropy->fixed_bin);
610 st = entropy->ac_stats[tbl] +
615 entropy->ct = -1; /* magnitude overflow */
643 arith_entropy_ptr entropy = (arith_entropy_ptr) cinfo->entropy;
689 entropy->pub.decode_mcu = decode_mcu_DC_first;
691 entropy->pub.decode_mcu = decode_mcu_AC_first;
694 entropy->pub.decode_mcu = decode_mcu_DC_refine;
696 entropy->pub.decode_mcu = decode_mcu_AC_refine;
706 entropy->pub.decode_mcu = decode_mcu;
716 if (entropy->dc_stats[tbl] == NULL)
717 entropy->dc_stats[tbl] = (unsigned char *) (*cinfo->mem->alloc_small)
719 MEMZERO(entropy->dc_stats[tbl], DC_STAT_BINS);
721 entropy->last_dc_val[ci] = 0;
722 entropy->dc_context[ci] = 0;
729 if (entropy->ac_stats[tbl] == NULL)
730 entropy->ac_stats[tbl] = (unsigned char *) (*cinfo->mem->alloc_small)
732 MEMZERO(entropy->ac_stats[tbl], AC_STAT_BINS);
737 entropy->c = 0;
738 entropy->a = 0;
739 entropy->ct = -16; /* force reading 2 initial bytes to fill C */
742 entropy->restarts_to_go = cinfo->restart_interval;
747 * Module initialization routine for arithmetic entropy decoding.
753 arith_entropy_ptr entropy;
756 entropy = (arith_entropy_ptr)
759 cinfo->entropy = &entropy->pub;
760 entropy->pub.start_pass = start_pass;
764 entropy->dc_stats[i] = NULL;
765 entropy->ac_stats[i] = NULL;
769 entropy->fixed_bin[0] = 113;