Commit b538791b authored by Michael Niedermayer's avatar Michael Niedermayer

use more bits on the encoder side

negligible increase in quality

Originally committed as revision 10195 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent 277bb936
...@@ -393,6 +393,7 @@ static const BlockNode null_block= { //FIXME add border maybe ...@@ -393,6 +393,7 @@ static const BlockNode null_block= { //FIXME add border maybe
#define LOG2_MB_SIZE 4 #define LOG2_MB_SIZE 4
#define MB_SIZE (1<<LOG2_MB_SIZE) #define MB_SIZE (1<<LOG2_MB_SIZE)
#define ENCODER_EXTRA_BITS 4
typedef struct x_and_coeff{ typedef struct x_and_coeff{
int16_t x; int16_t x;
...@@ -3402,7 +3403,7 @@ static void quantize(SnowContext *s, SubBand *b, DWTELEM *src, int stride, int b ...@@ -3402,7 +3403,7 @@ static void quantize(SnowContext *s, SubBand *b, DWTELEM *src, int stride, int b
const int w= b->width; const int w= b->width;
const int h= b->height; const int h= b->height;
const int qlog= av_clip(s->qlog + b->qlog, 0, QROOT*16); 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; int x,y, thres1, thres2;
// START_TIMER // START_TIMER
...@@ -4194,6 +4195,12 @@ redo_frame: ...@@ -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; 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); ff_spatial_dwt(s->spatial_dwt_buffer, w, h, w, s->spatial_decomposition_type, s->spatial_decomposition_count);
......
...@@ -141,9 +141,9 @@ f8f51fa737add17f7fecaefa118b57ed *./tests/data/a-ffv1.avi ...@@ -141,9 +141,9 @@ f8f51fa737add17f7fecaefa118b57ed *./tests/data/a-ffv1.avi
2654678 ./tests/data/a-ffv1.avi 2654678 ./tests/data/a-ffv1.avi
799d3db687f6cdd7a837ec156efc171f *./tests/data/out.yuv 799d3db687f6cdd7a837ec156efc171f *./tests/data/out.yuv
stddev: 0.00 PSNR:99.99 bytes:7602176 stddev: 0.00 PSNR:99.99 bytes:7602176
958d649d09b7361d5f00b5b3fcccbcd2 *./tests/data/a-snow.avi 19c377580ec83d0c5fc4da0740dec278 *./tests/data/a-snow.avi
156606 ./tests/data/a-snow.avi 156532 ./tests/data/a-snow.avi
b19cb7f9134f922326028c6bb44e96de *./tests/data/out.yuv 64282679f712a2b09cde43edb18a6fb0 *./tests/data/out.yuv
stddev: 23.14 PSNR:20.83 bytes:7602176 stddev: 23.14 PSNR:20.83 bytes:7602176
ba999e86070aa971376e7f317a022c37 *./tests/data/a-snow53.avi ba999e86070aa971376e7f317a022c37 *./tests/data/a-snow53.avi
3519486 ./tests/data/a-snow53.avi 3519486 ./tests/data/a-snow53.avi
......
...@@ -141,9 +141,9 @@ d72b0960e162d4998b9acbabb07e99ab *./tests/data/a-ffv1.avi ...@@ -141,9 +141,9 @@ d72b0960e162d4998b9acbabb07e99ab *./tests/data/a-ffv1.avi
3525804 ./tests/data/a-ffv1.avi 3525804 ./tests/data/a-ffv1.avi
dde5895817ad9d219f79a52d0bdfb001 *./tests/data/out.yuv dde5895817ad9d219f79a52d0bdfb001 *./tests/data/out.yuv
stddev: 0.00 PSNR:99.99 bytes:7602176 stddev: 0.00 PSNR:99.99 bytes:7602176
2cfa1bdb443d04a890208a83fd239461 *./tests/data/a-snow.avi 213abed95d2e43cf7d2c9e1921779e6d *./tests/data/a-snow.avi
68872 ./tests/data/a-snow.avi 68852 ./tests/data/a-snow.avi
64a0495b7ab53509d3b791465262795c *./tests/data/out.yuv f3ab734e188a8e2af7b89e0f101bd7a1 *./tests/data/out.yuv
stddev: 10.86 PSNR:27.40 bytes:7602176 stddev: 10.86 PSNR:27.40 bytes:7602176
3d0da6aeec9b80c6ee0ff4b747bdd0f0 *./tests/data/a-snow53.avi 3d0da6aeec9b80c6ee0ff4b747bdd0f0 *./tests/data/a-snow53.avi
2721980 ./tests/data/a-snow53.avi 2721980 ./tests/data/a-snow53.avi
......
...@@ -2050,47 +2050,47 @@ ret: 0 st: 0 dts:0.000000 pts:0.000000 pos:5660 size:2987 flags:1 ...@@ -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:-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: 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:-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 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: 0 ts:-0.320000 flags:1
ret:-1 st:-1 ts:2.576668 flags:0 ret:-1 st:-1 ts:2.576668 flags:0
ret: 0 st:-1 ts:1.470835 flags:1 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 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: 0 ts:-0.760000 flags:1
ret:-1 st:-1 ts:2.153336 flags:0 ret:-1 st:-1 ts:2.153336 flags:0
ret: 0 st:-1 ts:1.047503 flags:1 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 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 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 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:-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:-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 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 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 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:-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:-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 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 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 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 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:-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:-1 ts:-0.222493 flags:1
ret:-1 st: 0 ts:2.680000 flags:0 ret:-1 st: 0 ts:2.680000 flags:0
ret: 0 st: 0 ts:1.560000 flags:1 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:-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 ret:-1 st:-1 ts:-0.645825 flags:1
---------------- ----------------
tests/data/a-snow53.avi tests/data/a-snow53.avi
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment