Lines Matching defs:cinfo
122 emit_byte(int val, j_compress_ptr cinfo)
125 struct jpeg_destination_mgr *dest = cinfo->dest;
129 if (!(*dest->empty_output_buffer) (cinfo))
130 ERREXIT(cinfo, JERR_CANT_SUSPEND);
139 finish_pass(j_compress_ptr cinfo)
141 arith_entropy_ptr e = (arith_entropy_ptr)cinfo->entropy;
158 do emit_byte(0x00, cinfo);
160 emit_byte(e->buffer + 1, cinfo);
162 emit_byte(0x00, cinfo);
171 do emit_byte(0x00, cinfo);
173 emit_byte(e->buffer, cinfo);
177 do emit_byte(0x00, cinfo);
180 emit_byte(0xFF, cinfo);
181 emit_byte(0x00, cinfo);
188 do emit_byte(0x00, cinfo);
190 emit_byte((e->c >> 19) & 0xFF, cinfo);
192 emit_byte(0x00, cinfo);
194 emit_byte((e->c >> 11) & 0xFF, cinfo);
196 emit_byte(0x00, cinfo);
225 arith_encode(j_compress_ptr cinfo, unsigned char *st, int val)
227 register arith_entropy_ptr e = (arith_entropy_ptr)cinfo->entropy;
278 do emit_byte(0x00, cinfo);
280 emit_byte(e->buffer + 1, cinfo);
282 emit_byte(0x00, cinfo);
298 do emit_byte(0x00, cinfo);
300 emit_byte(e->buffer, cinfo);
304 do emit_byte(0x00, cinfo);
307 emit_byte(0xFF, cinfo);
308 emit_byte(0x00, cinfo);
325 emit_restart(j_compress_ptr cinfo, int restart_num)
327 arith_entropy_ptr entropy = (arith_entropy_ptr)cinfo->entropy;
331 finish_pass(cinfo);
333 emit_byte(0xFF, cinfo);
334 emit_byte(JPEG_RST0 + restart_num, cinfo);
337 for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
338 compptr = cinfo->cur_comp_info[ci];
340 if (cinfo->progressive_mode == 0 || (cinfo->Ss == 0 && cinfo->Ah == 0)) {
347 if (cinfo->progressive_mode == 0 || cinfo->Se) {
368 encode_mcu_DC_first(j_compress_ptr cinfo, JBLOCKROW *MCU_data)
370 arith_entropy_ptr entropy = (arith_entropy_ptr)cinfo->entropy;
378 if (cinfo->restart_interval) {
380 emit_restart(cinfo, entropy->next_restart_num);
381 entropy->restarts_to_go = cinfo->restart_interval;
389 for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
391 ci = cinfo->MCU_membership[blkn];
392 tbl = cinfo->cur_comp_info[ci]->dc_tbl_no;
397 m = IRIGHT_SHIFT((int)((*block)[0]), cinfo->Al);
406 arith_encode(cinfo, st, 0);
410 arith_encode(cinfo, st, 1);
414 arith_encode(cinfo, st + 1, 0); /* Table F.4: SS = S0 + 1 */
419 arith_encode(cinfo, st + 1, 1); /* Table F.4: SS = S0 + 1 */
426 arith_encode(cinfo, st, 1);
431 arith_encode(cinfo, st, 1);
436 arith_encode(cinfo, st, 0);
438 if (m < (int)((1L << cinfo->arith_dc_L[tbl]) >> 1))
440 else if (m > (int)((1L << cinfo->arith_dc_U[tbl]) >> 1))
445 arith_encode(cinfo, st, (m & v) ? 1 : 0);
459 encode_mcu_AC_first(j_compress_ptr cinfo, JBLOCKROW *MCU_data)
461 arith_entropy_ptr entropy = (arith_entropy_ptr)cinfo->entropy;
468 if (cinfo->restart_interval) {
470 emit_restart(cinfo, entropy->next_restart_num);
471 entropy->restarts_to_go = cinfo->restart_interval;
480 tbl = cinfo->cur_comp_info[0]->ac_tbl_no;
485 for (ke = cinfo->Se; ke > 0; ke--)
491 if (v >>= cinfo->Al) break;
494 if (v >>= cinfo->Al) break;
498 for (k = cinfo->Ss; k <= ke; k++) {
500 arith_encode(cinfo, st, 0); /* EOB decision */
503 if (v >>= cinfo->Al) {
504 arith_encode(cinfo, st + 1, 1);
505 arith_encode(cinfo, entropy->fixed_bin, 0);
510 if (v >>= cinfo->Al) {
511 arith_encode(cinfo, st + 1, 1);
512 arith_encode(cinfo, entropy->fixed_bin, 1);
516 arith_encode(cinfo, st + 1, 0); st += 3; k++;
522 arith_encode(cinfo, st, 1);
526 arith_encode(cinfo, st, 1);
529 (k <= cinfo->arith_ac_K[tbl] ? 189 : 217);
531 arith_encode(cinfo, st, 1);
537 arith_encode(cinfo, st, 0);
541 arith_encode(cinfo, st, (m & v) ? 1 : 0);
543 /* Encode EOB decision only if k <= cinfo->Se */
544 if (k <= cinfo->Se) {
546 arith_encode(cinfo, st, 1);
558 encode_mcu_DC_refine(j_compress_ptr cinfo, JBLOCKROW *MCU_data)
560 arith_entropy_ptr entropy = (arith_entropy_ptr)cinfo->entropy;
565 if (cinfo->restart_interval) {
567 emit_restart(cinfo, entropy->next_restart_num);
568 entropy->restarts_to_go = cinfo->restart_interval;
576 Al = cinfo->Al;
579 for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
581 arith_encode(cinfo, st, (MCU_data[blkn][0][0] >> Al) & 1);
593 encode_mcu_AC_refine(j_compress_ptr cinfo, JBLOCKROW *MCU_data)
595 arith_entropy_ptr entropy = (arith_entropy_ptr)cinfo->entropy;
602 if (cinfo->restart_interval) {
604 emit_restart(cinfo, entropy->next_restart_num);
605 entropy->restarts_to_go = cinfo->restart_interval;
614 tbl = cinfo->cur_comp_info[0]->ac_tbl_no;
619 for (ke = cinfo->Se; ke > 0; ke--)
625 if (v >>= cinfo->Al) break;
628 if (v >>= cinfo->Al) break;
634 if (v >>= cinfo->Ah) break;
637 if (v >>= cinfo->Ah) break;
641 for (k = cinfo->Ss; k <= ke; k++) {
644 arith_encode(cinfo, st, 0); /* EOB decision */
647 if (v >>= cinfo->Al) {
649 arith_encode(cinfo, st + 2, (v & 1));
651 arith_encode(cinfo, st + 1, 1);
652 arith_encode(cinfo, entropy->fixed_bin, 0);
658 if (v >>= cinfo->Al) {
660 arith_encode(cinfo, st + 2, (v & 1));
662 arith_encode(cinfo, st + 1, 1);
663 arith_encode(cinfo, entropy->fixed_bin, 1);
668 arith_encode(cinfo, st + 1, 0); st += 3; k++;
671 /* Encode EOB decision only if k <= cinfo->Se */
672 if (k <= cinfo->Se) {
674 arith_encode(cinfo, st, 1);
686 encode_mcu(j_compress_ptr cinfo, JBLOCKROW *MCU_data)
688 arith_entropy_ptr entropy = (arith_entropy_ptr)cinfo->entropy;
696 if (cinfo->restart_interval) {
698 emit_restart(cinfo, entropy->next_restart_num);
699 entropy->restarts_to_go = cinfo->restart_interval;
707 for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
709 ci = cinfo->MCU_membership[blkn];
710 compptr = cinfo->cur_comp_info[ci];
721 arith_encode(cinfo, st, 0);
725 arith_encode(cinfo, st, 1);
729 arith_encode(cinfo, st + 1, 0); /* Table F.4: SS = S0 + 1 */
734 arith_encode(cinfo, st + 1, 1); /* Table F.4: SS = S0 + 1 */
741 arith_encode(cinfo, st, 1);
746 arith_encode(cinfo, st, 1);
751 arith_encode(cinfo, st, 0);
753 if (m < (int)((1L << cinfo->arith_dc_L[tbl]) >> 1))
755 else if (m > (int)((1L << cinfo->arith_dc_U[tbl]) >> 1))
760 arith_encode(cinfo, st, (m & v) ? 1 : 0);
774 arith_encode(cinfo, st, 0); /* EOB decision */
776 arith_encode(cinfo, st + 1, 0); st += 3; k++;
778 arith_encode(cinfo, st + 1, 1);
782 arith_encode(cinfo, entropy->fixed_bin, 0);
785 arith_encode(cinfo, entropy->fixed_bin, 1);
791 arith_encode(cinfo, st, 1);
795 arith_encode(cinfo, st, 1);
798 (k <= cinfo->arith_ac_K[tbl] ? 189 : 217);
800 arith_encode(cinfo, st, 1);
806 arith_encode(cinfo, st, 0);
810 arith_encode(cinfo, st, (m & v) ? 1 : 0);
815 arith_encode(cinfo, st, 1);
828 start_pass(j_compress_ptr cinfo, boolean gather_statistics)
830 arith_entropy_ptr entropy = (arith_entropy_ptr)cinfo->entropy;
839 ERREXIT(cinfo, JERR_NOT_COMPILED);
844 if (cinfo->progressive_mode) {
845 if (cinfo->Ah == 0) {
846 if (cinfo->Ss == 0)
851 if (cinfo->Ss == 0)
860 for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
861 compptr = cinfo->cur_comp_info[ci];
863 if (cinfo->progressive_mode == 0 || (cinfo->Ss == 0 && cinfo->Ah == 0)) {
866 ERREXIT1(cinfo, JERR_NO_ARITH_TABLE, tbl);
868 entropy->dc_stats[tbl] = (unsigned char *)(*cinfo->mem->alloc_small)
869 ((j_common_ptr)cinfo, JPOOL_IMAGE, DC_STAT_BINS);
876 if (cinfo->progressive_mode == 0 || cinfo->Se) {
879 ERREXIT1(cinfo, JERR_NO_ARITH_TABLE, tbl);
881 entropy->ac_stats[tbl] = (unsigned char *)(*cinfo->mem->alloc_small)
882 ((j_common_ptr)cinfo, JPOOL_IMAGE, AC_STAT_BINS);
885 if (cinfo->progressive_mode)
887 cinfo->arith_ac_K[tbl] = cinfo->Ss +
888 ((8 + cinfo->Se - cinfo->Ss) >> 4);
902 entropy->restarts_to_go = cinfo->restart_interval;
912 jinit_arith_encoder(j_compress_ptr cinfo)
918 (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
920 cinfo->entropy = (struct jpeg_entropy_encoder *)entropy;