summaryrefslogtreecommitdiff
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
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
-rw-r--r--libavcodec/snow.c9
-rw-r--r--tests/ffmpeg.regression.ref6
-rw-r--r--tests/rotozoom.regression.ref6
-rw-r--r--tests/seek.regression.ref28
4 files changed, 28 insertions, 21 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);
diff --git a/tests/ffmpeg.regression.ref b/tests/ffmpeg.regression.ref
index ddca176149..d436af9dff 100644
--- a/tests/ffmpeg.regression.ref
+++ b/tests/ffmpeg.regression.ref
@@ -141,9 +141,9 @@ f8f51fa737add17f7fecaefa118b57ed *./tests/data/a-ffv1.avi
2654678 ./tests/data/a-ffv1.avi
799d3db687f6cdd7a837ec156efc171f *./tests/data/out.yuv
stddev: 0.00 PSNR:99.99 bytes:7602176
-958d649d09b7361d5f00b5b3fcccbcd2 *./tests/data/a-snow.avi
-156606 ./tests/data/a-snow.avi
-b19cb7f9134f922326028c6bb44e96de *./tests/data/out.yuv
+19c377580ec83d0c5fc4da0740dec278 *./tests/data/a-snow.avi
+156532 ./tests/data/a-snow.avi
+64282679f712a2b09cde43edb18a6fb0 *./tests/data/out.yuv
stddev: 23.14 PSNR:20.83 bytes:7602176
ba999e86070aa971376e7f317a022c37 *./tests/data/a-snow53.avi
3519486 ./tests/data/a-snow53.avi
diff --git a/tests/rotozoom.regression.ref b/tests/rotozoom.regression.ref
index 21fe28bb64..9004c990c5 100644
--- a/tests/rotozoom.regression.ref
+++ b/tests/rotozoom.regression.ref
@@ -141,9 +141,9 @@ d72b0960e162d4998b9acbabb07e99ab *./tests/data/a-ffv1.avi
3525804 ./tests/data/a-ffv1.avi
dde5895817ad9d219f79a52d0bdfb001 *./tests/data/out.yuv
stddev: 0.00 PSNR:99.99 bytes:7602176
-2cfa1bdb443d04a890208a83fd239461 *./tests/data/a-snow.avi
-68872 ./tests/data/a-snow.avi
-64a0495b7ab53509d3b791465262795c *./tests/data/out.yuv
+213abed95d2e43cf7d2c9e1921779e6d *./tests/data/a-snow.avi
+68852 ./tests/data/a-snow.avi
+f3ab734e188a8e2af7b89e0f101bd7a1 *./tests/data/out.yuv
stddev: 10.86 PSNR:27.40 bytes:7602176
3d0da6aeec9b80c6ee0ff4b747bdd0f0 *./tests/data/a-snow53.avi
2721980 ./tests/data/a-snow53.avi
diff --git a/tests/seek.regression.ref b/tests/seek.regression.ref
index d9d4b05ff5..5b7bebb1e5 100644
--- a/tests/seek.regression.ref
+++ b/tests/seek.regression.ref
@@ -2050,47 +2050,47 @@ ret: 0 st: 0 dts:0.000000 pts:0.000000 pos:5660 size:2987 flags:1
ret: 0 st:-1 ts:-1.000000 flags:0
ret: 0 st: 0 dts:0.000000 pts:0.000000 pos:5660 size:2987 flags:1
ret: 0 st:-1 ts:1.894167 flags:1
-ret: 0 st: 0 dts:1.440000 pts:1.440000 pos:46908 size:3663 flags:1
+ret: 0 st: 0 dts:1.440000 pts:1.440000 pos:46872 size:3663 flags:1
ret: 0 st: 0 ts:0.800000 flags:0
-ret: 0 st: 0 dts:0.960000 pts:0.960000 pos:31690 size:3478 flags:1
+ret: 0 st: 0 dts:0.960000 pts:0.960000 pos:31656 size:3478 flags:1
ret:-1 st: 0 ts:-0.320000 flags:1
ret:-1 st:-1 ts:2.576668 flags:0
ret: 0 st:-1 ts:1.470835 flags:1
-ret: 0 st: 0 dts:1.440000 pts:1.440000 pos:46908 size:3663 flags:1
+ret: 0 st: 0 dts:1.440000 pts:1.440000 pos:46872 size:3663 flags:1
ret: 0 st: 0 ts:0.360000 flags:0
-ret: 0 st: 0 dts:0.480000 pts:0.480000 pos:17990 size:3229 flags:1
+ret: 0 st: 0 dts:0.480000 pts:0.480000 pos:17968 size:3228 flags:1
ret:-1 st: 0 ts:-0.760000 flags:1
ret:-1 st:-1 ts:2.153336 flags:0
ret: 0 st:-1 ts:1.047503 flags:1
-ret: 0 st: 0 dts:0.960000 pts:0.960000 pos:31690 size:3478 flags:1
+ret: 0 st: 0 dts:0.960000 pts:0.960000 pos:31656 size:3478 flags:1
ret: 0 st: 0 ts:-0.040000 flags:0
ret: 0 st: 0 dts:0.000000 pts:0.000000 pos:5660 size:2987 flags:1
ret: 0 st: 0 ts:2.840000 flags:1
-ret: 0 st: 0 dts:1.920000 pts:1.920000 pos:63350 size:3635 flags:1
+ret: 0 st: 0 dts:1.920000 pts:1.920000 pos:63328 size:3635 flags:1
ret: 0 st:-1 ts:1.730004 flags:0
-ret: 0 st: 0 dts:1.920000 pts:1.920000 pos:63350 size:3635 flags:1
+ret: 0 st: 0 dts:1.920000 pts:1.920000 pos:63328 size:3635 flags:1
ret: 0 st:-1 ts:0.624171 flags:1
-ret: 0 st: 0 dts:0.480000 pts:0.480000 pos:17990 size:3229 flags:1
+ret: 0 st: 0 dts:0.480000 pts:0.480000 pos:17968 size:3228 flags:1
ret: 0 st: 0 ts:-0.480000 flags:0
ret: 0 st: 0 dts:0.000000 pts:0.000000 pos:5660 size:2987 flags:1
ret: 0 st: 0 ts:2.400000 flags:1
-ret: 0 st: 0 dts:1.920000 pts:1.920000 pos:63350 size:3635 flags:1
+ret: 0 st: 0 dts:1.920000 pts:1.920000 pos:63328 size:3635 flags:1
ret: 0 st:-1 ts:1.306672 flags:0
-ret: 0 st: 0 dts:1.440000 pts:1.440000 pos:46908 size:3663 flags:1
+ret: 0 st: 0 dts:1.440000 pts:1.440000 pos:46872 size:3663 flags:1
ret: 0 st:-1 ts:0.200839 flags:1
ret: 0 st: 0 dts:0.000000 pts:0.000000 pos:5660 size:2987 flags:1
ret: 0 st: 0 ts:-0.920000 flags:0
ret: 0 st: 0 dts:0.000000 pts:0.000000 pos:5660 size:2987 flags:1
ret: 0 st: 0 ts:2.000000 flags:1
-ret: 0 st: 0 dts:1.920000 pts:1.920000 pos:63350 size:3635 flags:1
+ret: 0 st: 0 dts:1.920000 pts:1.920000 pos:63328 size:3635 flags:1
ret: 0 st:-1 ts:0.883340 flags:0
-ret: 0 st: 0 dts:0.960000 pts:0.960000 pos:31690 size:3478 flags:1
+ret: 0 st: 0 dts:0.960000 pts:0.960000 pos:31656 size:3478 flags:1
ret:-1 st:-1 ts:-0.222493 flags:1
ret:-1 st: 0 ts:2.680000 flags:0
ret: 0 st: 0 ts:1.560000 flags:1
-ret: 0 st: 0 dts:1.440000 pts:1.440000 pos:46908 size:3663 flags:1
+ret: 0 st: 0 dts:1.440000 pts:1.440000 pos:46872 size:3663 flags:1
ret: 0 st:-1 ts:0.460008 flags:0
-ret: 0 st: 0 dts:0.480000 pts:0.480000 pos:17990 size:3229 flags:1
+ret: 0 st: 0 dts:0.480000 pts:0.480000 pos:17968 size:3228 flags:1
ret:-1 st:-1 ts:-0.645825 flags:1
----------------
tests/data/a-snow53.avi