# HG changeset patch # User michael # Date 1113076139 0 # Node ID 2bcea6618a87a501022dfd63cdb7dbe18a90c05e # Parent 3e36a706f5b7c709010c40cb94820ee24c273ca4 fix QROOT != 8 diff -r 3e36a706f5b7 -r 2bcea6618a87 snow.c --- a/snow.c Fri Apr 08 21:34:48 2005 +0000 +++ b/snow.c Sat Apr 09 19:48:59 2005 +0000 @@ -31,7 +31,8 @@ #define MAX_DECOMPOSITIONS 8 #define MAX_PLANES 4 #define DWTELEM int -#define QROOT 8 +#define QSHIFT 3 +#define QROOT (1<width; int x,y; - const int qlog= clip(s->qlog + b->qlog, 0, 128); - int qmul= qexp[qlog&7]<<(qlog>>3); + const int qlog= clip(s->qlog + b->qlog, 0, QROOT*16); + int qmul= qexp[qlog&(QROOT-1)]<<(qlog>>QSHIFT); int qadd= (s->qbias*qmul)>>QBIAS_SHIFT; int new_index = 0; @@ -2843,13 +2838,11 @@ const int level= b->level; const int w= b->width; const int h= b->height; - const int qlog= clip(s->qlog + b->qlog, 0, 128); - const int qmul= qexp[qlog&7]<<(qlog>>3); + const int qlog= clip(s->qlog + b->qlog, 0, QROOT*16); + const int qmul= qexp[qlog&(QROOT-1)]<<(qlog>>QSHIFT); int x,y, thres1, thres2; START_TIMER - assert(QROOT==8); - if(s->qlog == LOSSLESS_QLOG) return; bias= bias ? 0 : (3*qmul)>>3; @@ -2905,16 +2898,14 @@ static void dequantize_buffered(SnowContext *s, slice_buffer * sb, SubBand *b, DWTELEM *src, int stride){ const int w= b->width; const int h= b->height; - const int qlog= clip(s->qlog + b->qlog, 0, 128); - const int qmul= qexp[qlog&7]<<(qlog>>3); + const int qlog= clip(s->qlog + b->qlog, 0, QROOT*16); + const int qmul= qexp[qlog&(QROOT-1)]<<(qlog>>QSHIFT); const int qadd= (s->qbias*qmul)>>QBIAS_SHIFT; int x,y; START_TIMER if(s->qlog == LOSSLESS_QLOG) return; - assert(QROOT==8); - for(y=0; ystride_line) + b->buf_y_offset) + b->buf_x_offset; @@ -2935,16 +2926,14 @@ static void dequantize(SnowContext *s, SubBand *b, DWTELEM *src, int stride){ const int w= b->width; const int h= b->height; - const int qlog= clip(s->qlog + b->qlog, 0, 128); - const int qmul= qexp[qlog&7]<<(qlog>>3); + const int qlog= clip(s->qlog + b->qlog, 0, QROOT*16); + const int qmul= qexp[qlog&(QROOT-1)]<<(qlog>>QSHIFT); const int qadd= (s->qbias*qmul)>>QBIAS_SHIFT; int x,y; START_TIMER if(s->qlog == LOSSLESS_QLOG) return; - assert(QROOT==8); - for(y=0; ypriv_data; int width, height; @@ -3175,7 +3174,10 @@ mcfh(8, 0) mcfh(0, 8) mcfh(8, 8) - + + if(!qexp[0]) + init_qexp(); + dec= s->spatial_decomposition_count= 5; s->spatial_decomposition_type= avctx->prediction_method; //FIXME add decorrelator type r transform_type @@ -3367,7 +3369,7 @@ if(pict->quality){ s->qlog= rint(QROOT*log(pict->quality / (float)FF_QP2LAMBDA)/log(2)); //<64 >60 - s->qlog += 61; + s->qlog += 61*QROOT/8; }else{ s->qlog= LOSSLESS_QLOG; }