Mercurial > libavcodec.hg
changeset 2195:df3079d7806f libavcodec
merge decode_subband() and dequantize()
author | michael |
---|---|
date | Fri, 27 Aug 2004 21:16:51 +0000 |
parents | d29037435955 |
children | 3eae46c131a3 |
files | snow.c |
diffstat | 1 files changed, 22 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/snow.c Fri Aug 27 20:33:16 2004 +0000 +++ b/snow.c Fri Aug 27 21:16:51 2004 +0000 @@ -1902,6 +1902,14 @@ const int w= b->width; const int h= b->height; int x,y; + const int qlog= clip(s->qlog + b->qlog, 0, 128); + int qmul= qexp[qlog&7]<<(qlog>>3); + int qadd= (s->qbias*qmul)>>QBIAS_SHIFT; + + if(b->buf == s->spatial_dwt_buffer || s->qlog == LOSSLESS_QLOG){ + qadd= 0; + qmul= 1<<QEXPSHIFT; + } START_TIMER @@ -1931,7 +1939,7 @@ lt= t; t= rt; if(y){ - if(b->x[prev_index] <= x) //FIXME if + if(b->x[prev_index] <= x) prev_index++; if(b->x[prev_index] == x + 1) rt= b->coeff[prev_index]; @@ -1971,9 +1979,12 @@ if(v){ int context= av_log2(/*ABS(ll) + */3*ABS(l) + ABS(lt) + 2*ABS(t) + ABS(rt) + ABS(p)); v= get_symbol2(&s->c, b->state[context + 2], context-4) + 1; - if(get_cabac(&s->c, &b->state[0][16 + 1 + 3 + quant3b[l&0xFF] + 3*quant3b[t&0xFF]])) + if(get_cabac(&s->c, &b->state[0][16 + 1 + 3 + quant3b[l&0xFF] + 3*quant3b[t&0xFF]])){ + src[x + y*stride]=-(( v*qmul + qadd)>>(QEXPSHIFT)); v= -v; - src[x + y*stride]= v; + }else{ + src[x + y*stride]= (( v*qmul + qadd)>>(QEXPSHIFT)); + } b->x[index]=x; //FIXME interleave x/coeff b->coeff[index++]= v; } @@ -2667,6 +2678,7 @@ const int qmul= qexp[qlog&7]<<(qlog>>3); const int qadd= (s->qbias*qmul)>>QBIAS_SHIFT; int x,y; + START_TIMER if(s->qlog == LOSSLESS_QLOG) return; @@ -2682,6 +2694,9 @@ } } } + if(w > 200 /*level+1 == s->spatial_decomposition_count*/){ + STOP_TIMER("dquant") + } } static void decorrelate(SnowContext *s, SubBand *b, DWTELEM *src, int stride, int inverse, int use_median){ @@ -3293,16 +3308,11 @@ SubBand *b= &p->band[level][orientation]; decode_subband(s, b, b->buf, b->parent ? b->parent->buf : NULL, b->stride, orientation); - if(orientation==0) + if(orientation==0){ correlate(s, b, b->buf, b->stride, 1, 0); - } - } -if(!(s->avctx->debug&1024)) - for(level=0; level<s->spatial_decomposition_count; level++){ - for(orientation=level ? 1 : 0; orientation<4; orientation++){ - SubBand *b= &p->band[level][orientation]; - - dequantize(s, b, b->buf, b->stride); + dequantize(s, b, b->buf, b->stride); + assert(b->buf == s->spatial_dwt_buffer); + } } }