void ff_jpegls_init_state(JLSState *state){

    int i;



    state->twonear = state->near * 2 + 1;

    state->range = ((state->maxval + state->twonear - 1) / state->twonear) + 1;



    // QBPP = ceil(log2(RANGE))

    for(state->qbpp = 0; (1 << state->qbpp) < state->range; state->qbpp++);



    if(state->bpp < 8)

        state->limit = 16 + 2 * state->bpp - state->qbpp;

    else

        state->limit = (4 * state->bpp) - state->qbpp;



    for(i = 0; i < 367; i++) {

        state->A[i] = FFMAX((state->range + 32) >> 6, 2);

        state->N[i] = 1;

    }



}

void ff_jpegls_init_state(JLSState *state){

    int i;



    state->twonear = state->near * 2 + 1;

    state->range = ((state->maxval + state->twonear - 1) / state->twonear) + 1;



    

    for(state->qbpp = 0; (1 << state->qbpp) < state->range; state->qbpp++);



    if(state->bpp < 8)

        state->limit = 16 + 2 * state->bpp - state->qbpp;

    else

        state->limit = (4 * state->bpp) - state->qbpp;



    for(i = 0; i < 367; i++) {

        state->A[i] = FFMAX((state->range + 32) >> 6, 2);

        state->N[i] = 1;

    }



}

void FUNC_0(JLSState *VAR_0){

    int VAR_1;



    VAR_0->twonear = VAR_0->near * 2 + 1;

    VAR_0->range = ((VAR_0->maxval + VAR_0->twonear - 1) / VAR_0->twonear) + 1;



    

    for(VAR_0->qbpp = 0; (1 << VAR_0->qbpp) < VAR_0->range; VAR_0->qbpp++);



    if(VAR_0->bpp < 8)

        VAR_0->limit = 16 + 2 * VAR_0->bpp - VAR_0->qbpp;

    else

        VAR_0->limit = (4 * VAR_0->bpp) - VAR_0->qbpp;



    for(VAR_1 = 0; VAR_1 < 367; VAR_1++) {

        VAR_0->A[VAR_1] = FFMAX((VAR_0->range + 32) >> 6, 2);

        VAR_0->N[VAR_1] = 1;

    }



}

void FUNC_0(JLSState *VAR_0){ int VAR_1; VAR_0->twonear = VAR_0->near * 2 + 1; VAR_0->range = ((VAR_0->maxval + VAR_0->twonear - 1) / VAR_0->twonear) + 1; for(VAR_0->qbpp = 0; (1 << VAR_0->qbpp) < VAR_0->range; VAR_0->qbpp++); if(VAR_0->bpp < 8)
VAR_0->limit = 16 + 2 * VAR_0->bpp - VAR_0->qbpp; else
VAR_0->limit = (4 * VAR_0->bpp) - VAR_0->qbpp; for(VAR_1 = 0; VAR_1 < 367; VAR_1++) { VAR_0->A[VAR_1] = FFMAX((VAR_0->range + 32) >> 6, 2); VAR_0->N[VAR_1] = 1; } }