diff --git a/libavcodec/snow.c b/libavcodec/snow.c index 744d554645..4dc3392fe2 100644 --- a/libavcodec/snow.c +++ b/libavcodec/snow.c @@ -1419,7 +1419,7 @@ static void encode_subband(SnowContext *s, SubBand *b, DWTELEM *src, DWTELEM *pa for(y=0; y>1; + int py= (orientation==1 ? x : y)>>1; + if(pxparent->width && pyparent->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>1; + int py= (orientation==1 ? x : y)>>1; + if(pxparent->width && pyparent->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>1; + int py= (orientation==1 ? x : y)>>1; + if(pxparent->width && pyparent->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;