Exemplo n.º 1
0
int jpc_mqenc_putbit_func(jpc_mqenc_t* mqenc, int bit) {
    const jpc_mqstate_t* state;
    JAS_DBGLOG(100, ("jpc_mqenc_putbit(%p, %d)\n", mqenc, bit));
    JPC_MQENC_CALL(100, jpc_mqenc_dump(mqenc, stderr));

    state = *(mqenc->curctx);

    if (state->mps == bit) {
        /* Apply the CODEMPS algorithm as defined in the standard. */
        mqenc->areg -= state->qeval;
        if (!(mqenc->areg & 0x8000)) {
            jpc_mqenc_codemps2(mqenc);
        } else {
            mqenc->creg += state->qeval;
        }
    } else {
        /* Apply the CODELPS algorithm as defined in the standard. */
        jpc_mqenc_codelps2(mqenc->areg, mqenc->creg, mqenc->ctreg, mqenc->curctx, mqenc);
    }

    return jpc_mqenc_error(mqenc) ? (-1) : 0;
}
Exemplo n.º 2
0
int jpc_mqenc_codelps(jpc_mqenc_t *mqenc)
{
	jpc_mqenc_codelps2(mqenc->areg, mqenc->creg, mqenc->ctreg, mqenc->curctx, mqenc);
	return jpc_mqenc_error(mqenc) ? (-1) : 0;
}