summaryrefslogtreecommitdiff
path: root/libavcodec/snow.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2007-08-23 10:49:14 +0000
committerMichael Niedermayer <michaelni@gmx.at>2007-08-23 10:49:14 +0000
commitb538791bc924e1a231adfaf0086cdb25f7dde47b (patch)
tree732381c269ad5b44d73c10831654e89a92b30d8a /libavcodec/snow.c
parent277bb93642a06d47a5fa712f52ea42328828d069 (diff)
use more bits on the encoder side
negligible increase in quality Originally committed as revision 10195 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/snow.c')
-rw-r--r--libavcodec/snow.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/libavcodec/snow.c b/libavcodec/snow.c
index 7d8fd442a1..d264bf3d5f 100644
--- a/libavcodec/snow.c
+++ b/libavcodec/snow.c
@@ -393,6 +393,7 @@ static const BlockNode null_block= { //FIXME add border maybe
#define LOG2_MB_SIZE 4
#define MB_SIZE (1<<LOG2_MB_SIZE)
+#define ENCODER_EXTRA_BITS 4
typedef struct x_and_coeff{
int16_t x;
@@ -3402,7 +3403,7 @@ static void quantize(SnowContext *s, SubBand *b, DWTELEM *src, int stride, int b
const int w= b->width;
const int h= b->height;
const int qlog= av_clip(s->qlog + b->qlog, 0, QROOT*16);
- const int qmul= qexp[qlog&(QROOT-1)]<<(qlog>>QSHIFT);
+ const int qmul= qexp[qlog&(QROOT-1)]<<((qlog>>QSHIFT) + ENCODER_EXTRA_BITS);
int x,y, thres1, thres2;
// START_TIMER
@@ -4194,6 +4195,12 @@ redo_frame:
s->spatial_dwt_buffer[y*w + x]= (s->spatial_dwt_buffer[y*w + x] + (1<<(FRAC_BITS-1))-1)>>FRAC_BITS;
}
}
+ }else{
+ for(y=0; y<h; y++){
+ for(x=0; x<w; x++){
+ s->spatial_dwt_buffer[y*w + x]<<=ENCODER_EXTRA_BITS;
+ }
+ }
}
ff_spatial_dwt(s->spatial_dwt_buffer, w, h, w, s->spatial_decomposition_type, s->spatial_decomposition_count);