Home | History | Annotate | Download | only in libjpeg

Lines Matching refs:entropy

8  * This file contains portable arithmetic entropy encoding routines for JPEG
21 /* Expanded entropy encoder object for arithmetic encoding. */
135 arith_entropy_ptr e = (arith_entropy_ptr) cinfo->entropy;
221 register arith_entropy_ptr e = (arith_entropy_ptr) cinfo->entropy;
321 arith_entropy_ptr entropy = (arith_entropy_ptr) cinfo->entropy;
335 MEMZERO(entropy->dc_stats[compptr->dc_tbl_no], DC_STAT_BINS);
337 entropy->last_dc_val[ci] = 0;
338 entropy->dc_context[ci] = 0;
342 MEMZERO(entropy->ac_stats[compptr->ac_tbl_no], AC_STAT_BINS);
347 entropy->c = 0;
348 entropy->a = 0x10000L;
349 entropy->sc = 0;
350 entropy->zc = 0;
351 entropy->ct = 11;
352 entropy->buffer = -1; /* empty */
364 arith_entropy_ptr entropy = (arith_entropy_ptr) cinfo->entropy;
373 if (entropy->restarts_to_go == 0) {
374 emit_restart(cinfo, entropy->next_restart_num);
375 entropy->restarts_to_go = cinfo->restart_interval;
376 entropy->next_restart_num++;
377 entropy->next_restart_num &= 7;
379 entropy->restarts_to_go--;
396 st = entropy->dc_stats[tbl] + entropy->dc_context[ci];
399 if ((v = m - entropy->last_dc_val[ci]) == 0) {
401 entropy->dc_context[ci] = 0; /* zero diff category */
403 entropy->last_dc_val[ci] = m;
410 entropy->dc_context[ci] = 4; /* small positive diff category */
415 entropy->dc_context[ci] = 8; /* small negative diff category */
423 st = entropy->dc_stats[tbl] + 20; /* Table F.4: X1 = 20 */
433 entropy->dc_context[ci] = 0; /* zero diff category */
435 entropy->dc_context[ci] += 8; /* large diff category */
455 arith_entropy_ptr entropy = (arith_entropy_ptr) cinfo->entropy;
464 if (entropy->restarts_to_go == 0) {
465 emit_restart(cinfo, entropy->next_restart_num);
466 entropy->restarts_to_go = cinfo->restart_interval;
467 entropy->next_restart_num++;
468 entropy->next_restart_num &= 7;
470 entropy->restarts_to_go--;
498 st = entropy->ac_stats[tbl] + 3 * k;
504 arith_encode(cinfo, entropy->fixed_bin, 0);
511 arith_encode(cinfo, entropy->fixed_bin, 1);
528 st = entropy->ac_stats[tbl] +
545 st = entropy->ac_stats[tbl] + 3 * k;
560 arith_entropy_ptr entropy = (arith_entropy_ptr) cinfo->entropy;
566 if (entropy->restarts_to_go == 0) {
567 emit_restart(cinfo, entropy->next_restart_num);
568 entropy->restarts_to_go = cinfo->restart_interval;
569 entropy->next_restart_num++;
570 entropy->next_restart_num &= 7;
572 entropy->restarts_to_go--;
575 st = entropy->fixed_bin; /* use fixed probability estimation */
595 arith_entropy_ptr entropy = (arith_entropy_ptr) cinfo->entropy;
604 if (entropy->restarts_to_go == 0) {
605 emit_restart(cinfo, entropy->next_restart_num);
606 entropy->restarts_to_go = cinfo->restart_interval;
607 entropy->next_restart_num++;
608 entropy->next_restart_num &= 7;
610 entropy->restarts_to_go--;
647 st = entropy->ac_stats[tbl] + 3 * k;
657 arith_encode(cinfo, entropy->fixed_bin, 0);
668 arith_encode(cinfo, entropy->fixed_bin, 1);
679 st = entropy->ac_stats[tbl] + 3 * k;
694 arith_entropy_ptr entropy = (arith_entropy_ptr) cinfo->entropy;
704 if (entropy->restarts_to_go == 0) {
705 emit_restart(cinfo, entropy->next_restart_num);
706 entropy->restarts_to_go = cinfo->restart_interval;
707 entropy->next_restart_num++;
708 entropy->next_restart_num &= 7;
710 entropy->restarts_to_go--;
726 st = entropy->dc_stats[tbl] + entropy->dc_context[ci];
729 if ((v = (*block)[0] - entropy->last_dc_val[ci]) == 0) {
731 entropy->dc_context[ci] = 0; /* zero diff category */
733 entropy->last_dc_val[ci] = (*block)[0];
740 entropy->dc_context[ci] = 4; /* small positive diff category */
745 entropy->dc_context[ci] = 8; /* small negative diff category */
753 st = entropy->dc_stats[tbl] + 20; /* Table F.4: X1 = 20 */
763 entropy->dc_context[ci] = 0; /* zero diff category */
765 entropy->dc_context[ci] += 8; /* large diff category */
784 st = entropy->ac_stats[tbl] + 3 * k;
794 arith_encode(cinfo, entropy->fixed_bin, 0);
797 arith_encode(cinfo, entropy->fixed_bin, 1);
809 st = entropy->ac_stats[tbl] +
826 st = entropy->ac_stats[tbl] + 3 * k;
842 arith_entropy_ptr entropy = (arith_entropy_ptr) cinfo->entropy;
859 entropy->pub.encode_mcu = encode_mcu_DC_first;
861 entropy->pub.encode_mcu = encode_mcu_AC_first;
864 entropy->pub.encode_mcu = encode_mcu_DC_refine;
866 entropy->pub.encode_mcu = encode_mcu_AC_refine;
869 entropy->pub.encode_mcu = encode_mcu;
879 if (entropy->dc_stats[tbl] == NULL)
880 entropy->dc_stats[tbl] = (unsigned char *) (*cinfo->mem->alloc_small)
882 MEMZERO(entropy->dc_stats[tbl], DC_STAT_BINS);
884 entropy->last_dc_val[ci] = 0;
885 entropy->dc_context[ci] = 0;
892 if (entropy->ac_stats[tbl] == NULL)
893 entropy->ac_stats[tbl] = (unsigned char *) (*cinfo->mem->alloc_small)
895 MEMZERO(entropy->ac_stats[tbl], AC_STAT_BINS);
905 entropy->c = 0;
906 entropy->a = 0x10000L;
907 entropy->sc = 0;
908 entropy->zc = 0;
909 entropy->ct = 11;
910 entropy->buffer = -1; /* empty */
913 entropy->restarts_to_go = cinfo->restart_interval;
914 entropy->next_restart_num = 0;
919 * Module initialization routine for arithmetic entropy encoding.
925 arith_entropy_ptr entropy;
928 entropy = (arith_entropy_ptr)
931 cinfo->entropy = &entropy->pub;
932 entropy->pub.start_pass = start_pass;
933 entropy->pub.finish_pass = finish_pass;
937 entropy->dc_stats[i] = NULL;
938 entropy->ac_stats[i] = NULL;
942 entropy->fixed_bin[0] = 113;