aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/snow.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2007-09-09 18:28:36 +0000
committerMichael Niedermayer <michaelni@gmx.at>2007-09-09 18:28:36 +0000
commit8db13728149c57bdbb5e84ae9bea96513f25c6da (patch)
tree79ccee9252eb8b14491496ab72299842f8320b50 /libavcodec/snow.c
parentba430e0cfac25a2605b938b94f4a3b6c1a77e1d8 (diff)
downloadffmpeg-8db13728149c57bdbb5e84ae9bea96513f25c6da.tar.gz
make changing spatial_decomposition_count per frame work
Originally committed as revision 10464 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/snow.c')
-rw-r--r--libavcodec/snow.c29
1 files changed, 19 insertions, 10 deletions
diff --git a/libavcodec/snow.c b/libavcodec/snow.c
index b24cbb5def..0300e58c7c 100644
--- a/libavcodec/snow.c
+++ b/libavcodec/snow.c
@@ -454,6 +454,7 @@ typedef struct SnowContext{
int last_spatial_decomposition_type;
int temporal_decomposition_type;
int spatial_decomposition_count;
+ int last_spatial_decomposition_count;
int temporal_decomposition_count;
int max_ref_frames;
int ref_frames;
@@ -3588,11 +3589,12 @@ 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){
+ if(s->last_spatial_decomposition_count != s->spatial_decomposition_count){
+ put_rac(&s->c, s->header_state, 1);
put_symbol(&s->c, s->header_state, s->spatial_decomposition_count, 0);
encode_qlogs(s);
- }
+ }else
+ put_rac(&s->c, s->header_state, 0);
}
put_symbol(&s->c, s->header_state, s->spatial_decomposition_type - s->last_spatial_decomposition_type, 1);
@@ -3606,6 +3608,7 @@ static void encode_header(SnowContext *s){
s->last_qbias = s->qbias;
s->last_mv_scale = s->mv_scale;
s->last_block_max_depth = s->block_max_depth;
+ s->last_spatial_decomposition_count= s->spatial_decomposition_count;
}
static void decode_qlogs(SnowContext *s){
@@ -3937,7 +3940,6 @@ static int encode_init(AVCodecContext *avctx)
return -1;
}
- s->spatial_decomposition_count= 5;
s->spatial_decomposition_type= avctx->prediction_method; //FIXME add decorrelator type r transform_type
s->chroma_h_shift= 1; //FIXME XXX
@@ -3956,7 +3958,6 @@ static int encode_init(AVCodecContext *avctx)
}
common_init(avctx);
- common_init_after_header(avctx);
alloc_blocks(s);
s->version=0;
@@ -3983,11 +3984,6 @@ static int encode_init(AVCodecContext *avctx)
}
s->pass1_rc= !(avctx->flags & (CODEC_FLAG_QSCALE|CODEC_FLAG_PASS2));
- for(plane_index=0; plane_index<3; plane_index++){
- calculate_vissual_weight(s, &s->plane[plane_index]);
- }
-
-
avctx->coded_frame= &s->current_picture;
switch(avctx->pix_fmt){
// case PIX_FMT_YUV444P:
@@ -4213,9 +4209,22 @@ static int encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_size,
redo_frame:
+ if(pict->pict_type == I_TYPE)
+ s->spatial_decomposition_count= 5;
+ else
+ s->spatial_decomposition_count= 5;
+
s->m.pict_type = pict->pict_type;
s->qbias= pict->pict_type == P_TYPE ? 2 : 0;
+ common_init_after_header(avctx);
+
+ if(s->last_spatial_decomposition_count != s->spatial_decomposition_count){
+ for(plane_index=0; plane_index<3; plane_index++){
+ calculate_vissual_weight(s, &s->plane[plane_index]);
+ }
+ }
+
encode_header(s);
s->m.misc_bits = 8*(s->c.bytestream - s->c.bytestream_start);
encode_blocks(s, 1);