changeset 5575:a6f5ed050335 libavcodec

use more bits on the encoder side negligible increase in quality
author michael
date Thu, 23 Aug 2007 10:49:14 +0000
parents 33718fb21437
children 1a92e129a679
files snow.c
diffstat 1 files changed, 8 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/snow.c	Thu Aug 23 07:02:27 2007 +0000
+++ b/snow.c	Thu Aug 23 10:49:14 2007 +0000
@@ -393,6 +393,7 @@
 
 #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 @@
     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 @@
                     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);