allow changing of the spatial_decomposition_count and quantization tables
per frame (this is untested as the encoder does not use it yet) Originally committed as revision 10458 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
parent
4f90f33ab4
commit
e559c30a20
@ -3516,8 +3516,21 @@ static void correlate(SnowContext *s, SubBand *b, IDWTELEM *src, int stride, int
|
||||
}
|
||||
}
|
||||
|
||||
static void encode_qlogs(SnowContext *s){
|
||||
int plane_index, level, orientation;
|
||||
|
||||
for(plane_index=0; plane_index<2; plane_index++){
|
||||
for(level=0; level<s->spatial_decomposition_count; level++){
|
||||
for(orientation=level ? 1:0; orientation<4; orientation++){
|
||||
if(orientation==2) continue;
|
||||
put_symbol(&s->c, s->header_state, s->plane[plane_index].band[level][orientation].qlog, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void encode_header(SnowContext *s){
|
||||
int plane_index, level, orientation, i;
|
||||
int plane_index, i;
|
||||
uint8_t kstate[32];
|
||||
|
||||
memset(kstate, MID_STATE, sizeof(kstate));
|
||||
@ -3550,14 +3563,7 @@ static void encode_header(SnowContext *s){
|
||||
// put_rac(&s->c, s->header_state, s->rate_scalability);
|
||||
put_symbol(&s->c, s->header_state, s->max_ref_frames-1, 0);
|
||||
|
||||
for(plane_index=0; plane_index<2; plane_index++){
|
||||
for(level=0; level<s->spatial_decomposition_count; level++){
|
||||
for(orientation=level ? 1:0; orientation<4; orientation++){
|
||||
if(orientation==2) continue;
|
||||
put_symbol(&s->c, s->header_state, s->plane[plane_index].band[level][orientation].qlog, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
encode_qlogs(s);
|
||||
}
|
||||
|
||||
if(!s->keyframe){
|
||||
@ -3583,6 +3589,11 @@ static void encode_header(SnowContext *s){
|
||||
memcpy(p->last_hcoeff, p->hcoeff, sizeof(p->hcoeff));
|
||||
}
|
||||
}
|
||||
put_rac(&s->c, s->header_state, 0);
|
||||
if(0){
|
||||
put_symbol(&s->c, s->header_state, s->spatial_decomposition_count, 0);
|
||||
encode_qlogs(s);
|
||||
}
|
||||
}
|
||||
|
||||
put_symbol(&s->c, s->header_state, s->spatial_decomposition_type - s->last_spatial_decomposition_type, 1);
|
||||
@ -3598,8 +3609,24 @@ static void encode_header(SnowContext *s){
|
||||
s->last_block_max_depth = s->block_max_depth;
|
||||
}
|
||||
|
||||
static int decode_header(SnowContext *s){
|
||||
static void decode_qlogs(SnowContext *s){
|
||||
int plane_index, level, orientation;
|
||||
|
||||
for(plane_index=0; plane_index<3; plane_index++){
|
||||
for(level=0; level<s->spatial_decomposition_count; level++){
|
||||
for(orientation=level ? 1:0; orientation<4; orientation++){
|
||||
int q;
|
||||
if (plane_index==2) q= s->plane[1].band[level][orientation].qlog;
|
||||
else if(orientation==2) q= s->plane[plane_index].band[level][1].qlog;
|
||||
else q= get_symbol(&s->c, s->header_state, 1);
|
||||
s->plane[plane_index].band[level][orientation].qlog= q;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static int decode_header(SnowContext *s){
|
||||
int plane_index;
|
||||
uint8_t kstate[32];
|
||||
|
||||
memset(kstate, MID_STATE, sizeof(kstate));
|
||||
@ -3630,17 +3657,7 @@ static int decode_header(SnowContext *s){
|
||||
// s->rate_scalability= get_rac(&s->c, s->header_state);
|
||||
s->max_ref_frames= get_symbol(&s->c, s->header_state, 0)+1;
|
||||
|
||||
for(plane_index=0; plane_index<3; plane_index++){
|
||||
for(level=0; level<s->spatial_decomposition_count; level++){
|
||||
for(orientation=level ? 1:0; orientation<4; orientation++){
|
||||
int q;
|
||||
if (plane_index==2) q= s->plane[1].band[level][orientation].qlog;
|
||||
else if(orientation==2) q= s->plane[plane_index].band[level][1].qlog;
|
||||
else q= get_symbol(&s->c, s->header_state, 1);
|
||||
s->plane[plane_index].band[level][orientation].qlog= q;
|
||||
}
|
||||
}
|
||||
}
|
||||
decode_qlogs(s);
|
||||
}
|
||||
|
||||
if(!s->keyframe){
|
||||
@ -3663,6 +3680,10 @@ static int decode_header(SnowContext *s){
|
||||
s->plane[2].htaps = s->plane[1].htaps;
|
||||
memcpy(s->plane[2].hcoeff, s->plane[1].hcoeff, sizeof(s->plane[1].hcoeff));
|
||||
}
|
||||
if(get_rac(&s->c, s->header_state)){
|
||||
s->spatial_decomposition_count= get_symbol(&s->c, s->header_state, 0);
|
||||
decode_qlogs(s);
|
||||
}
|
||||
}
|
||||
|
||||
s->spatial_decomposition_type+= get_symbol(&s->c, s->header_state, 1);
|
||||
|
@ -141,12 +141,12 @@ 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
|
||||
2ef414dd800dcb05f032f9b0dfb4f483 *./tests/data/a-snow.avi
|
||||
156716 ./tests/data/a-snow.avi
|
||||
5b3430252fdbbc7de5ffedc36150b0bf *./tests/data/a-snow.avi
|
||||
156726 ./tests/data/a-snow.avi
|
||||
3de2b39f90fd8331f27e627e68e076f7 *./tests/data/out.yuv
|
||||
stddev: 23.15 PSNR:20.83 bytes:7602176
|
||||
5ad99548fc64ce3c83c55a37ed8f8a19 *./tests/data/a-snow53.avi
|
||||
3520688 ./tests/data/a-snow53.avi
|
||||
c7397d2ceb420f7564dcc785948bff84 *./tests/data/a-snow53.avi
|
||||
3520692 ./tests/data/a-snow53.avi
|
||||
799d3db687f6cdd7a837ec156efc171f *./tests/data/out.yuv
|
||||
stddev: 0.00 PSNR:99.99 bytes:7602176
|
||||
c299f64c3e85b928c5bfe71629cee006 *./tests/data/a-dv.dv
|
||||
|
@ -141,12 +141,12 @@ 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
|
||||
17de0c60b01a13c93aa114cfeebc10eb *./tests/data/a-snow.avi
|
||||
69060 ./tests/data/a-snow.avi
|
||||
0b404d5372a5c6c93f6087614020b096 *./tests/data/a-snow.avi
|
||||
69068 ./tests/data/a-snow.avi
|
||||
63ea1d2fe1693be57d3ab7d351af7c55 *./tests/data/out.yuv
|
||||
stddev: 10.87 PSNR:27.39 bytes:7602176
|
||||
6139224013581f63c4dd1713ed4286db *./tests/data/a-snow53.avi
|
||||
2721752 ./tests/data/a-snow53.avi
|
||||
a8fccf278bbb17d37a756ecf11672b09 *./tests/data/a-snow53.avi
|
||||
2721758 ./tests/data/a-snow53.avi
|
||||
dde5895817ad9d219f79a52d0bdfb001 *./tests/data/out.yuv
|
||||
stddev: 0.00 PSNR:99.99 bytes:7602176
|
||||
54cdeaee32d1007666a1e487e739daf6 *./tests/data/a-dv.dv
|
||||
|
@ -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:47000 size:3663 flags:1
|
||||
ret: 0 st: 0 dts:1.440000 pts:1.440000 pos:47008 size:3663 flags:1
|
||||
ret: 0 st: 0 ts:0.800000 flags:0
|
||||
ret: 0 st: 0 dts:0.960000 pts:0.960000 pos:31766 size:3478 flags:1
|
||||
ret: 0 st: 0 dts:0.960000 pts:0.960000 pos:31774 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:47000 size:3663 flags:1
|
||||
ret: 0 st: 0 dts:1.440000 pts:1.440000 pos:47008 size:3663 flags:1
|
||||
ret: 0 st: 0 ts:0.360000 flags:0
|
||||
ret: 0 st: 0 dts:0.480000 pts:0.480000 pos:18016 size:3229 flags:1
|
||||
ret: 0 st: 0 dts:0.480000 pts:0.480000 pos:18018 size:3229 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:31766 size:3478 flags:1
|
||||
ret: 0 st: 0 dts:0.960000 pts:0.960000 pos:31774 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:63536 size:3635 flags:1
|
||||
ret: 0 st: 0 dts:1.920000 pts:1.920000 pos:63544 size:3635 flags:1
|
||||
ret: 0 st:-1 ts:1.730004 flags:0
|
||||
ret: 0 st: 0 dts:1.920000 pts:1.920000 pos:63536 size:3635 flags:1
|
||||
ret: 0 st: 0 dts:1.920000 pts:1.920000 pos:63544 size:3635 flags:1
|
||||
ret: 0 st:-1 ts:0.624171 flags:1
|
||||
ret: 0 st: 0 dts:0.480000 pts:0.480000 pos:18016 size:3229 flags:1
|
||||
ret: 0 st: 0 dts:0.480000 pts:0.480000 pos:18018 size:3229 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:63536 size:3635 flags:1
|
||||
ret: 0 st: 0 dts:1.920000 pts:1.920000 pos:63544 size:3635 flags:1
|
||||
ret: 0 st:-1 ts:1.306672 flags:0
|
||||
ret: 0 st: 0 dts:1.440000 pts:1.440000 pos:47000 size:3663 flags:1
|
||||
ret: 0 st: 0 dts:1.440000 pts:1.440000 pos:47008 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:63536 size:3635 flags:1
|
||||
ret: 0 st: 0 dts:1.920000 pts:1.920000 pos:63544 size:3635 flags:1
|
||||
ret: 0 st:-1 ts:0.883340 flags:0
|
||||
ret: 0 st: 0 dts:0.960000 pts:0.960000 pos:31766 size:3478 flags:1
|
||||
ret: 0 st: 0 dts:0.960000 pts:0.960000 pos:31774 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:47000 size:3663 flags:1
|
||||
ret: 0 st: 0 dts:1.440000 pts:1.440000 pos:47008 size:3663 flags:1
|
||||
ret: 0 st:-1 ts:0.460008 flags:0
|
||||
ret: 0 st: 0 dts:0.480000 pts:0.480000 pos:18016 size:3229 flags:1
|
||||
ret: 0 st: 0 dts:0.480000 pts:0.480000 pos:18018 size:3229 flags:1
|
||||
ret:-1 st:-1 ts:-0.645825 flags:1
|
||||
----------------
|
||||
tests/data/a-snow53.avi
|
||||
@ -2098,47 +2098,47 @@ ret: 0 st: 0 dts:0.000000 pts:0.000000 pos:5660 size:72476 flags:1
|
||||
ret: 0 st:-1 ts:-1.000000 flags:0
|
||||
ret: 0 st: 0 dts:0.000000 pts:0.000000 pos:5660 size:72476 flags:1
|
||||
ret: 0 st:-1 ts:1.894167 flags:1
|
||||
ret: 0 st: 0 dts:1.440000 pts:1.440000 pos:1902794 size:78837 flags:1
|
||||
ret: 0 st: 0 dts:1.440000 pts:1.440000 pos:1902800 size:78837 flags:1
|
||||
ret: 0 st: 0 ts:0.800000 flags:0
|
||||
ret: 0 st: 0 dts:0.960000 pts:0.960000 pos:1239098 size:74994 flags:1
|
||||
ret: 0 st: 0 dts:0.960000 pts:0.960000 pos:1239102 size:74994 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:1902794 size:78837 flags:1
|
||||
ret: 0 st: 0 dts:1.440000 pts:1.440000 pos:1902800 size:78837 flags:1
|
||||
ret: 0 st: 0 ts:0.360000 flags:0
|
||||
ret: 0 st: 0 dts:0.480000 pts:0.480000 pos:605638 size:71059 flags:1
|
||||
ret: 0 st: 0 dts:0.480000 pts:0.480000 pos:605640 size:71059 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:1239098 size:74994 flags:1
|
||||
ret: 0 st: 0 dts:0.960000 pts:0.960000 pos:1239102 size:74994 flags:1
|
||||
ret: 0 st: 0 ts:-0.040000 flags:0
|
||||
ret: 0 st: 0 dts:0.000000 pts:0.000000 pos:5660 size:72476 flags:1
|
||||
ret: 0 st: 0 ts:2.840000 flags:1
|
||||
ret: 0 st: 0 dts:1.920000 pts:1.920000 pos:2585620 size:79731 flags:1
|
||||
ret: 0 st: 0 dts:1.920000 pts:1.920000 pos:2585626 size:79731 flags:1
|
||||
ret: 0 st:-1 ts:1.730004 flags:0
|
||||
ret: 0 st: 0 dts:1.920000 pts:1.920000 pos:2585620 size:79731 flags:1
|
||||
ret: 0 st: 0 dts:1.920000 pts:1.920000 pos:2585626 size:79731 flags:1
|
||||
ret: 0 st:-1 ts:0.624171 flags:1
|
||||
ret: 0 st: 0 dts:0.480000 pts:0.480000 pos:605638 size:71059 flags:1
|
||||
ret: 0 st: 0 dts:0.480000 pts:0.480000 pos:605640 size:71059 flags:1
|
||||
ret: 0 st: 0 ts:-0.480000 flags:0
|
||||
ret: 0 st: 0 dts:0.000000 pts:0.000000 pos:5660 size:72476 flags:1
|
||||
ret: 0 st: 0 ts:2.400000 flags:1
|
||||
ret: 0 st: 0 dts:1.920000 pts:1.920000 pos:2585620 size:79731 flags:1
|
||||
ret: 0 st: 0 dts:1.920000 pts:1.920000 pos:2585626 size:79731 flags:1
|
||||
ret: 0 st:-1 ts:1.306672 flags:0
|
||||
ret: 0 st: 0 dts:1.440000 pts:1.440000 pos:1902794 size:78837 flags:1
|
||||
ret: 0 st: 0 dts:1.440000 pts:1.440000 pos:1902800 size:78837 flags:1
|
||||
ret: 0 st:-1 ts:0.200839 flags:1
|
||||
ret: 0 st: 0 dts:0.000000 pts:0.000000 pos:5660 size:72476 flags:1
|
||||
ret: 0 st: 0 ts:-0.920000 flags:0
|
||||
ret: 0 st: 0 dts:0.000000 pts:0.000000 pos:5660 size:72476 flags:1
|
||||
ret: 0 st: 0 ts:2.000000 flags:1
|
||||
ret: 0 st: 0 dts:1.920000 pts:1.920000 pos:2585620 size:79731 flags:1
|
||||
ret: 0 st: 0 dts:1.920000 pts:1.920000 pos:2585626 size:79731 flags:1
|
||||
ret: 0 st:-1 ts:0.883340 flags:0
|
||||
ret: 0 st: 0 dts:0.960000 pts:0.960000 pos:1239098 size:74994 flags:1
|
||||
ret: 0 st: 0 dts:0.960000 pts:0.960000 pos:1239102 size:74994 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:1902794 size:78837 flags:1
|
||||
ret: 0 st: 0 dts:1.440000 pts:1.440000 pos:1902800 size:78837 flags:1
|
||||
ret: 0 st:-1 ts:0.460008 flags:0
|
||||
ret: 0 st: 0 dts:0.480000 pts:0.480000 pos:605638 size:71059 flags:1
|
||||
ret: 0 st: 0 dts:0.480000 pts:0.480000 pos:605640 size:71059 flags:1
|
||||
ret:-1 st:-1 ts:-0.645825 flags:1
|
||||
----------------
|
||||
tests/data/a-svq1.mov
|
||||
|
Loading…
x
Reference in New Issue
Block a user