|
|
|
@ -487,11 +487,12 @@ static int getnmsedec_ref(int x, int bpno) |
|
|
|
|
static void encode_sigpass(J2kT1Context *t1, int width, int height, int bandno, int *nmsedec, int bpno) |
|
|
|
|
{ |
|
|
|
|
int y0, x, y, mask = 1 << (bpno + NMSEDEC_FRACBITS); |
|
|
|
|
int vert_causal_ctx_csty_loc_symbol; |
|
|
|
|
for (y0 = 0; y0 < height; y0 += 4) |
|
|
|
|
for (x = 0; x < width; x++) |
|
|
|
|
for (y = y0; y < height && y < y0+4; y++){ |
|
|
|
|
if (!(t1->flags[y+1][x+1] & J2K_T1_SIG) && (t1->flags[y+1][x+1] & J2K_T1_SIG_NB)){ |
|
|
|
|
int ctxno = ff_j2k_getnbctxno(t1->flags[y+1][x+1], bandno), |
|
|
|
|
int ctxno = ff_j2k_getnbctxno(t1->flags[y+1][x+1], bandno, vert_causal_ctx_csty_loc_symbol), |
|
|
|
|
bit = t1->data[y][x] & mask ? 1 : 0; |
|
|
|
|
ff_mqc_encode(&t1->mqc, t1->mqc.cx_states + ctxno, bit); |
|
|
|
|
if (bit){ |
|
|
|
@ -523,6 +524,7 @@ static void encode_refpass(J2kT1Context *t1, int width, int height, int *nmsedec |
|
|
|
|
static void encode_clnpass(J2kT1Context *t1, int width, int height, int bandno, int *nmsedec, int bpno) |
|
|
|
|
{ |
|
|
|
|
int y0, x, y, mask = 1 << (bpno + NMSEDEC_FRACBITS); |
|
|
|
|
int vert_causal_ctx_csty_loc_symbol; |
|
|
|
|
for (y0 = 0; y0 < height; y0 += 4) |
|
|
|
|
for (x = 0; x < width; x++){ |
|
|
|
|
if (y0 + 3 < height && !( |
|
|
|
@ -543,7 +545,7 @@ static void encode_clnpass(J2kT1Context *t1, int width, int height, int bandno, |
|
|
|
|
ff_mqc_encode(&t1->mqc, t1->mqc.cx_states + MQC_CX_UNI, rlen & 1); |
|
|
|
|
for (y = y0 + rlen; y < y0 + 4; y++){ |
|
|
|
|
if (!(t1->flags[y+1][x+1] & (J2K_T1_SIG | J2K_T1_VIS))){ |
|
|
|
|
int ctxno = ff_j2k_getnbctxno(t1->flags[y+1][x+1], bandno); |
|
|
|
|
int ctxno = ff_j2k_getnbctxno(t1->flags[y+1][x+1], bandno, vert_causal_ctx_csty_loc_symbol); |
|
|
|
|
if (y > y0 + rlen) |
|
|
|
|
ff_mqc_encode(&t1->mqc, t1->mqc.cx_states + ctxno, t1->data[y][x] & mask ? 1:0); |
|
|
|
|
if (t1->data[y][x] & mask){ // newly significant
|
|
|
|
@ -559,7 +561,7 @@ static void encode_clnpass(J2kT1Context *t1, int width, int height, int bandno, |
|
|
|
|
} else{ |
|
|
|
|
for (y = y0; y < y0 + 4 && y < height; y++){ |
|
|
|
|
if (!(t1->flags[y+1][x+1] & (J2K_T1_SIG | J2K_T1_VIS))){ |
|
|
|
|
int ctxno = ff_j2k_getnbctxno(t1->flags[y+1][x+1], bandno); |
|
|
|
|
int ctxno = ff_j2k_getnbctxno(t1->flags[y+1][x+1], bandno, vert_causal_ctx_csty_loc_symbol); |
|
|
|
|
ff_mqc_encode(&t1->mqc, t1->mqc.cx_states + ctxno, t1->data[y][x] & mask ? 1:0); |
|
|
|
|
if (t1->data[y][x] & mask){ // newly significant
|
|
|
|
|
int xorbit; |
|
|
|
|