Definition at line 219 of file jcarith.c.
Referenced by encode_mcu(), encode_mcu_AC_first(), encode_mcu_AC_refine(), encode_mcu_DC_first(), and encode_mcu_DC_refine().
{
register arith_entropy_ptr e = (arith_entropy_ptr) cinfo->entropy;
register unsigned char nl, nm;
register INT32 qe, temp;
register int sv;
sv = *st;
qe = jpeg_aritab[sv & 0x7F];
nl = qe & 0xFF; qe >>= 8;
nm = qe & 0xFF; qe >>= 8;
e->a -= qe;
if (val != (sv >> 7)) {
if (e->a >= qe) {
e->c += e->a;
e->a = qe;
}
*st = (sv & 0x80) ^ nl;
} else {
if (e->a >= 0x8000L)
return;
if (e->a < qe) {
e->c += e->a;
e->a = qe;
}
*st = (sv & 0x80) ^ nm;
}
do {
e->a <<= 1;
e->c <<= 1;
if (--e->ct == 0) {
temp = e->c >> 19;
if (temp > 0xFF) {
if (e->buffer >= 0) {
if (e->zc)
do emit_byte(0x00, cinfo);
while (--e->zc);
emit_byte(e->buffer + 1, cinfo);
if (e->buffer + 1 == 0xFF)
emit_byte(0x00, cinfo);
}
e->zc += e->sc;
e->sc = 0;
e->buffer = temp & 0xFF;
} else if (temp == 0xFF) {
++e->sc;
} else {
if (e->buffer == 0)
++e->zc;
else if (e->buffer >= 0) {
if (e->zc)
do emit_byte(0x00, cinfo);
while (--e->zc);
emit_byte(e->buffer, cinfo);
}
if (e->sc) {
if (e->zc)
do emit_byte(0x00, cinfo);
while (--e->zc);
do {
emit_byte(0xFF, cinfo);
emit_byte(0x00, cinfo);
} while (--e->sc);
}
e->buffer = temp & 0xFF;
}
e->c &= 0x7FFFFL;
e->ct += 8;
}
} while (e->a < 0x8000L);
}