1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

j2k: s/ff_j2k_getsigctxno/ff_jpeg2000_getsigctxno/g

Also add a related comment

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2013-05-26 18:02:38 +02:00
parent ac325f0613
commit b4013899e2
3 changed files with 8 additions and 6 deletions

View File

@ -215,7 +215,9 @@ void ff_j2k_set_significant(Jpeg2000T1Context *t1, int x, int y, int negative);
extern uint8_t ff_jpeg2000_sigctxno_lut[256][4]; extern uint8_t ff_jpeg2000_sigctxno_lut[256][4];
static inline int ff_j2k_getsigctxno(int flag, int bandno) /* Get context label (number in range[0..8]) of a coefficient for significance
* propagation and cleanup coding passes. */
static inline int ff_jpeg2000_getsigctxno(int flag, int bandno)
{ {
return ff_jpeg2000_sigctxno_lut[flag & 255][bandno]; return ff_jpeg2000_sigctxno_lut[flag & 255][bandno];
} }

View File

@ -631,7 +631,7 @@ static void decode_sigpass(Jpeg2000T1Context *t1, int width, int height, int bpn
int flags_mask = -1; int flags_mask = -1;
if (vert_causal_ctx_csty_symbol && y == y0 + 3) if (vert_causal_ctx_csty_symbol && y == y0 + 3)
flags_mask &= ~(JPEG2000_T1_SIG_S | JPEG2000_T1_SIG_SW | JPEG2000_T1_SIG_SE); flags_mask &= ~(JPEG2000_T1_SIG_S | JPEG2000_T1_SIG_SW | JPEG2000_T1_SIG_SE);
if (ff_mqc_decode(&t1->mqc, t1->mqc.cx_states + ff_j2k_getsigctxno(t1->flags[y+1][x+1] & flags_mask, bandno))){ if (ff_mqc_decode(&t1->mqc, t1->mqc.cx_states + ff_jpeg2000_getsigctxno(t1->flags[y+1][x+1] & flags_mask, bandno))){
int xorbit, ctxno = ff_jpeg2000_getsgnctxno(t1->flags[y+1][x+1], &xorbit); int xorbit, ctxno = ff_jpeg2000_getsgnctxno(t1->flags[y+1][x+1], &xorbit);
if (bpass_csty_symbol) if (bpass_csty_symbol)
t1->data[y][x] = ff_mqc_decode(&t1->mqc, t1->mqc.cx_states + ctxno) ? -mask : mask; t1->data[y][x] = ff_mqc_decode(&t1->mqc, t1->mqc.cx_states + ctxno) ? -mask : mask;
@ -694,7 +694,7 @@ static void decode_clnpass(Jpeg2000DecoderContext *s, Jpeg2000T1Context *t1, int
int flags_mask = -1; int flags_mask = -1;
if (vert_causal_ctx_csty_symbol && y == y0 + 3) if (vert_causal_ctx_csty_symbol && y == y0 + 3)
flags_mask &= ~(JPEG2000_T1_SIG_S | JPEG2000_T1_SIG_SW | JPEG2000_T1_SIG_SE); flags_mask &= ~(JPEG2000_T1_SIG_S | JPEG2000_T1_SIG_SW | JPEG2000_T1_SIG_SE);
dec = ff_mqc_decode(&t1->mqc, t1->mqc.cx_states + ff_j2k_getsigctxno(t1->flags[y+1][x+1] & flags_mask, dec = ff_mqc_decode(&t1->mqc, t1->mqc.cx_states + ff_jpeg2000_getsigctxno(t1->flags[y+1][x+1] & flags_mask,
bandno)); bandno));
} }
} }

View File

@ -480,7 +480,7 @@ static void encode_sigpass(Jpeg2000T1Context *t1, int width, int height, int ban
for (x = 0; x < width; x++) for (x = 0; x < width; x++)
for (y = y0; y < height && y < y0+4; y++){ for (y = y0; y < height && y < y0+4; y++){
if (!(t1->flags[y+1][x+1] & JPEG2000_T1_SIG) && (t1->flags[y+1][x+1] & JPEG2000_T1_SIG_NB)){ if (!(t1->flags[y+1][x+1] & JPEG2000_T1_SIG) && (t1->flags[y+1][x+1] & JPEG2000_T1_SIG_NB)){
int ctxno = ff_j2k_getsigctxno(t1->flags[y+1][x+1], bandno), int ctxno = ff_jpeg2000_getsigctxno(t1->flags[y+1][x+1], bandno),
bit = t1->data[y][x] & mask ? 1 : 0; bit = t1->data[y][x] & mask ? 1 : 0;
ff_mqc_encode(&t1->mqc, t1->mqc.cx_states + ctxno, bit); ff_mqc_encode(&t1->mqc, t1->mqc.cx_states + ctxno, bit);
if (bit){ if (bit){
@ -532,7 +532,7 @@ static void encode_clnpass(Jpeg2000T1Context *t1, int width, int height, int ban
ff_mqc_encode(&t1->mqc, t1->mqc.cx_states + MQC_CX_UNI, rlen & 1); ff_mqc_encode(&t1->mqc, t1->mqc.cx_states + MQC_CX_UNI, rlen & 1);
for (y = y0 + rlen; y < y0 + 4; y++){ for (y = y0 + rlen; y < y0 + 4; y++){
if (!(t1->flags[y+1][x+1] & (JPEG2000_T1_SIG | JPEG2000_T1_VIS))){ if (!(t1->flags[y+1][x+1] & (JPEG2000_T1_SIG | JPEG2000_T1_VIS))){
int ctxno = ff_j2k_getsigctxno(t1->flags[y+1][x+1], bandno); int ctxno = ff_jpeg2000_getsigctxno(t1->flags[y+1][x+1], bandno);
if (y > y0 + rlen) if (y > y0 + rlen)
ff_mqc_encode(&t1->mqc, t1->mqc.cx_states + ctxno, t1->data[y][x] & mask ? 1:0); 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 if (t1->data[y][x] & mask){ // newly significant
@ -548,7 +548,7 @@ static void encode_clnpass(Jpeg2000T1Context *t1, int width, int height, int ban
} else{ } else{
for (y = y0; y < y0 + 4 && y < height; y++){ for (y = y0; y < y0 + 4 && y < height; y++){
if (!(t1->flags[y+1][x+1] & (JPEG2000_T1_SIG | JPEG2000_T1_VIS))){ if (!(t1->flags[y+1][x+1] & (JPEG2000_T1_SIG | JPEG2000_T1_VIS))){
int ctxno = ff_j2k_getsigctxno(t1->flags[y+1][x+1], bandno); int ctxno = ff_jpeg2000_getsigctxno(t1->flags[y+1][x+1], bandno);
ff_mqc_encode(&t1->mqc, t1->mqc.cx_states + ctxno, t1->data[y][x] & mask ? 1:0); 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 if (t1->data[y][x] & mask){ // newly significant
int xorbit; int xorbit;