Home | History | Annotate | Download | only in libjpeg-turbo

Lines Matching refs:entropy

10  * This file contains portable arithmetic entropy encoding routines for JPEG
23 /* Expanded entropy encoder object for arithmetic encoding. */
137 arith_entropy_ptr e = (arith_entropy_ptr) cinfo->entropy;
223 register arith_entropy_ptr e = (arith_entropy_ptr) cinfo->entropy;
323 arith_entropy_ptr entropy = (arith_entropy_ptr) cinfo->entropy;
337 MEMZERO(entropy->dc_stats[compptr->dc_tbl_no], DC_STAT_BINS);
339 entropy->last_dc_val[ci] = 0;
340 entropy->dc_context[ci] = 0;
344 MEMZERO(entropy->ac_stats[compptr->ac_tbl_no], AC_STAT_BINS);
349 entropy->c = 0;
350 entropy->a = 0x10000L;
351 entropy->sc = 0;
352 entropy->zc = 0;
353 entropy->ct = 11;
354 entropy->buffer = -1; /* empty */
366 arith_entropy_ptr entropy = (arith_entropy_ptr) cinfo->entropy;
375 if (entropy->restarts_to_go == 0) {
376 emit_restart(cinfo, entropy->next_restart_num);
377 entropy->restarts_to_go = cinfo->restart_interval;
378 entropy->next_restart_num++;
379 entropy->next_restart_num &= 7;
381 entropy->restarts_to_go--;
398 st = entropy->dc_stats[tbl] + entropy->dc_context[ci];
401 if ((v = m - entropy->last_dc_val[ci]) == 0) {
403 entropy->dc_context[ci] = 0; /* zero diff category */
405 entropy->last_dc_val[ci] = m;
412 entropy->dc_context[ci] = 4; /* small positive diff category */
417 entropy->dc_context[ci] = 8; /* small negative diff category */
425 st = entropy->dc_stats[tbl] + 20; /* Table F.4: X1 = 20 */
435 entropy->dc_context[ci] = 0; /* zero diff category */
437 entropy->dc_context[ci] += 8; /* large diff category */
457 arith_entropy_ptr entropy = (arith_entropy_ptr) cinfo->entropy;
465 if (entropy->restarts_to_go == 0) {
466 emit_restart(cinfo, entropy->next_restart_num);
467 entropy->restarts_to_go = cinfo->restart_interval;
468 entropy->next_restart_num++;
469 entropy->next_restart_num &= 7;
471 entropy->restarts_to_go--;
495 st = entropy->ac_stats[tbl] + 3 * (k - 1);
501 arith_encode(cinfo, entropy->fixed_bin, 0);
508 arith_encode(cinfo, entropy->fixed_bin, 1);
524 st = entropy->ac_stats[tbl] +
541 st = entropy->ac_stats[tbl] + 3 * (k - 1);
556 arith_entropy_ptr entropy = (arith_entropy_ptr) cinfo->entropy;
562 if (entropy->restarts_to_go == 0) {
563 emit_restart(cinfo, entropy->next_restart_num);
564 entropy->restarts_to_go = cinfo->restart_interval;
565 entropy->next_restart_num++;
566 entropy->next_restart_num &= 7;
568 entropy->restarts_to_go--;
571 st = entropy->fixed_bin; /* use fixed probability estimation */
591 arith_entropy_ptr entropy = (arith_entropy_ptr) cinfo->entropy;
599 if (entropy->restarts_to_go == 0) {
600 emit_restart(cinfo, entropy->next_restart_num);
601 entropy->restarts_to_go = cinfo->restart_interval;
602 entropy->next_restart_num++;
603 entropy->next_restart_num &= 7;
605 entropy->restarts_to_go--;
638 st = entropy->ac_stats[tbl] + 3 * (k - 1);
648 arith_encode(cinfo, entropy->fixed_bin, 0);
659 arith_encode(cinfo, entropy->fixed_bin, 1);
669 st = entropy->ac_stats[tbl] + 3 * (k - 1);
684 arith_entropy_ptr entropy = (arith_entropy_ptr) cinfo->entropy;
693 if (entropy->restarts_to_go == 0) {
694 emit_restart(cinfo, entropy->next_restart_num);
695 entropy->restarts_to_go = cinfo->restart_interval;
696 entropy->next_restart_num++;
697 entropy->next_restart_num &= 7;
699 entropy->restarts_to_go--;
713 st = entropy->dc_stats[tbl] + entropy->dc_context[ci];
716 if ((v = (*block)[0] - entropy->last_dc_val[ci]) == 0) {
718 entropy->dc_context[ci] = 0; /* zero diff category */
720 entropy->last_dc_val[ci] = (*block)[0];
727 entropy->dc_context[ci] = 4; /* small positive diff category */
732 entropy->dc_context[ci] = 8; /* small negative diff category */
740 st = entropy->dc_stats[tbl] + 20; /* Table F.4: X1 = 20 */
750 entropy->dc_context[ci] = 0; /* zero diff category */
752 entropy->dc_context[ci] += 8; /* large diff category */
769 st = entropy->ac_stats[tbl] + 3 * (k - 1);
778 arith_encode(cinfo, entropy->fixed_bin, 0);
781 arith_encode(cinfo, entropy->fixed_bin, 1);
793 st = entropy->ac_stats[tbl] +
810 st = entropy->ac_stats[tbl] + 3 * (k - 1);
826 arith_entropy_ptr entropy = (arith_entropy_ptr) cinfo->entropy;
843 entropy->pub.encode_mcu = encode_mcu_DC_first;
845 entropy->pub.encode_mcu = encode_mcu_AC_first;
848 entropy->pub.encode_mcu = encode_mcu_DC_refine;
850 entropy->pub.encode_mcu = encode_mcu_AC_refine;
853 entropy->pub.encode_mcu = encode_mcu;
863 if (entropy->dc_stats[tbl] == NULL)
864 entropy->dc_stats[tbl] = (unsigned char *) (*cinfo->mem->alloc_small)
866 MEMZERO(entropy->dc_stats[tbl], DC_STAT_BINS);
868 entropy->last_dc_val[ci] = 0;
869 entropy->dc_context[ci] = 0;
876 if (entropy->ac_stats[tbl] == NULL)
877 entropy->ac_stats[tbl] = (unsigned char *) (*cinfo->mem->alloc_small)
879 MEMZERO(entropy->ac_stats[tbl], AC_STAT_BINS);
889 entropy->c = 0;
890 entropy->a = 0x10000L;
891 entropy->sc = 0;
892 entropy->zc = 0;
893 entropy->ct = 11;
894 entropy->buffer = -1; /* empty */
897 entropy->restarts_to_go = cinfo->restart_interval;
898 entropy->next_restart_num = 0;
903 * Module initialization routine for arithmetic entropy encoding.
909 arith_entropy_ptr entropy;
912 entropy = (arith_entropy_ptr)
915 cinfo->entropy = (struct jpeg_entropy_encoder *) entropy;
916 entropy->pub.start_pass = start_pass;
917 entropy->pub.finish_pass = finish_pass;
921 entropy->dc_stats[i] = NULL;
922 entropy->ac_stats[i] = NULL;
926 entropy->fixed_bin[0] = 113;