|
|
|
@ -1419,7 +1419,7 @@ static void encode_subband(SnowContext *s, SubBand *b, DWTELEM *src, DWTELEM *pa |
|
|
|
|
|
|
|
|
|
for(y=0; y<h; y++){ |
|
|
|
|
for(x=0; x<w; x++){ |
|
|
|
|
int v, p; |
|
|
|
|
int v, p=0; |
|
|
|
|
int /*ll=0, */l=0, lt=0, t=0, rt=0; |
|
|
|
|
if(orientation==1) v= src[y + x*stride]; |
|
|
|
|
else v= src[x + y*stride]; |
|
|
|
@ -1444,7 +1444,13 @@ static void encode_subband(SnowContext *s, SubBand *b, DWTELEM *src, DWTELEM *pa |
|
|
|
|
else ll= src[x - 2 + y*stride]; |
|
|
|
|
}*/ |
|
|
|
|
} |
|
|
|
|
if(!(/*ll|*/l|lt|t|rt)){ |
|
|
|
|
if(parent){ |
|
|
|
|
int px= (orientation==1 ? y : x)>>1; |
|
|
|
|
int py= (orientation==1 ? x : y)>>1; |
|
|
|
|
if(px<b->parent->width && py<b->parent->height)
|
|
|
|
|
p= parent[px + py*2*stride]; |
|
|
|
|
} |
|
|
|
|
if(!(/*ll|*/l|lt|t|rt|p)){ |
|
|
|
|
if(v){ |
|
|
|
|
runs[run_index++]= run; |
|
|
|
|
run=0; |
|
|
|
@ -1462,7 +1468,7 @@ static void encode_subband(SnowContext *s, SubBand *b, DWTELEM *src, DWTELEM *pa |
|
|
|
|
|
|
|
|
|
for(y=0; y<h; y++){ |
|
|
|
|
for(x=0; x<w; x++){ |
|
|
|
|
int v, p; |
|
|
|
|
int v, p=0; |
|
|
|
|
int /*ll=0, */l=0, lt=0, t=0, rt=0; |
|
|
|
|
if(orientation==1) v= src[y + x*stride]; |
|
|
|
|
else v= src[x + y*stride]; |
|
|
|
@ -1487,8 +1493,14 @@ static void encode_subband(SnowContext *s, SubBand *b, DWTELEM *src, DWTELEM *pa |
|
|
|
|
else ll= src[x - 2 + y*stride]; |
|
|
|
|
}*/ |
|
|
|
|
} |
|
|
|
|
if(/*ll|*/l|lt|t|rt){ |
|
|
|
|
int context= av_log2(/*ABS(ll) + */3*ABS(l) + ABS(lt) + 2*ABS(t) + ABS(rt)); |
|
|
|
|
if(parent){ |
|
|
|
|
int px= (orientation==1 ? y : x)>>1; |
|
|
|
|
int py= (orientation==1 ? x : y)>>1; |
|
|
|
|
if(px<b->parent->width && py<b->parent->height)
|
|
|
|
|
p= parent[px + py*2*stride]; |
|
|
|
|
} |
|
|
|
|
if(/*ll|*/l|lt|t|rt|p){ |
|
|
|
|
int context= av_log2(/*ABS(ll) + */3*ABS(l) + ABS(lt) + 2*ABS(t) + ABS(rt) + ABS(p)); |
|
|
|
|
|
|
|
|
|
put_cabac(&s->c, &b->state[0][context], !!v); |
|
|
|
|
}else{ |
|
|
|
@ -1502,7 +1514,7 @@ static void encode_subband(SnowContext *s, SubBand *b, DWTELEM *src, DWTELEM *pa |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if(v){ |
|
|
|
|
int context= av_log2(/*ABS(ll) + */3*ABS(l) + ABS(lt) + 2*ABS(t) + ABS(rt)); |
|
|
|
|
int context= av_log2(/*ABS(ll) + */3*ABS(l) + ABS(lt) + 2*ABS(t) + ABS(rt) + ABS(p)); |
|
|
|
|
|
|
|
|
|
put_symbol(&s->c, b->state[context + 2], ABS(v)-1, 0); |
|
|
|
|
put_cabac(&s->c, &b->state[0][16 + 1 + 3 + quant3b[l&0xFF] + 3*quant3b[t&0xFF]], v<0); |
|
|
|
@ -1642,7 +1654,7 @@ static inline void decode_subbandX(SnowContext *s, SubBand *b, DWTELEM *src, DWT |
|
|
|
|
run= get_symbol(&s->c, b->state[1], 0); |
|
|
|
|
for(y=0; y<h; y++){ |
|
|
|
|
for(x=0; x<w; x++){ |
|
|
|
|
int v, p; |
|
|
|
|
int v, p=0; |
|
|
|
|
int /*ll=0, */l=0, lt=0, t=0, rt=0; |
|
|
|
|
|
|
|
|
|
if(y){ |
|
|
|
@ -1665,8 +1677,14 @@ static inline void decode_subbandX(SnowContext *s, SubBand *b, DWTELEM *src, DWT |
|
|
|
|
else ll= src[x - 2 + y*stride]; |
|
|
|
|
}*/ |
|
|
|
|
} |
|
|
|
|
if(/*ll|*/l|lt|t|rt){ |
|
|
|
|
int context= av_log2(/*ABS(ll) + */3*ABS(l) + ABS(lt) + 2*ABS(t) + ABS(rt)); |
|
|
|
|
if(parent){ |
|
|
|
|
int px= (orientation==1 ? y : x)>>1; |
|
|
|
|
int py= (orientation==1 ? x : y)>>1; |
|
|
|
|
if(px<b->parent->width && py<b->parent->height)
|
|
|
|
|
p= parent[px + py*2*stride]; |
|
|
|
|
} |
|
|
|
|
if(/*ll|*/l|lt|t|rt|p){ |
|
|
|
|
int context= av_log2(/*ABS(ll) + */3*ABS(l) + ABS(lt) + 2*ABS(t) + ABS(rt) + ABS(p)); |
|
|
|
|
|
|
|
|
|
v=get_cabac(&s->c, &b->state[0][context]); |
|
|
|
|
}else{ |
|
|
|
@ -1681,7 +1699,7 @@ static inline void decode_subbandX(SnowContext *s, SubBand *b, DWTELEM *src, DWT |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if(v){ |
|
|
|
|
int context= av_log2(/*ABS(ll) + */3*ABS(l) + ABS(lt) + 2*ABS(t) + ABS(rt)); |
|
|
|
|
int context= av_log2(/*ABS(ll) + */3*ABS(l) + ABS(lt) + 2*ABS(t) + ABS(rt) + ABS(p)); |
|
|
|
|
v= get_symbol(&s->c, b->state[context + 2], 0) + 1; |
|
|
|
|
if(get_cabac(&s->c, &b->state[0][16 + 1 + 3 + quant3b[l&0xFF] + 3*quant3b[t&0xFF]])) |
|
|
|
|
v= -v; |
|
|
|
|