Mercurial > libavcodec.hg
comparison mpegvideo.c @ 608:98e39397636b libavcodec
better scene change detection
author | michaelni |
---|---|
date | Thu, 22 Aug 2002 19:41:06 +0000 |
parents | 40874804a5af |
children | 3214d3f4519e |
comparison
equal
deleted
inserted
replaced
607:5762b2d659d2 | 608:98e39397636b |
---|---|
1976 | 1976 |
1977 /* we need to initialize some time vars before we can encode b-frames */ | 1977 /* we need to initialize some time vars before we can encode b-frames */ |
1978 if (s->h263_pred && !s->h263_msmpeg4) | 1978 if (s->h263_pred && !s->h263_msmpeg4) |
1979 ff_set_mpeg4_time(s, s->picture_number); | 1979 ff_set_mpeg4_time(s, s->picture_number); |
1980 | 1980 |
1981 s->scene_change_score=0; | |
1982 | |
1981 /* Estimate motion for every MB */ | 1983 /* Estimate motion for every MB */ |
1982 if(s->pict_type != I_TYPE){ | 1984 if(s->pict_type != I_TYPE){ |
1983 for(mb_y=0; mb_y < s->mb_height; mb_y++) { | 1985 for(mb_y=0; mb_y < s->mb_height; mb_y++) { |
1984 s->block_index[0]= s->block_wrap[0]*(mb_y*2 + 1) - 1; | 1986 s->block_index[0]= s->block_wrap[0]*(mb_y*2 + 1) - 1; |
1985 s->block_index[1]= s->block_wrap[0]*(mb_y*2 + 1); | 1987 s->block_index[1]= s->block_wrap[0]*(mb_y*2 + 1); |
2007 //FIXME do we need to zero them? | 2009 //FIXME do we need to zero them? |
2008 memset(s->motion_val[0], 0, sizeof(INT16)*(s->mb_width*2 + 2)*(s->mb_height*2 + 2)*2); | 2010 memset(s->motion_val[0], 0, sizeof(INT16)*(s->mb_width*2 + 2)*(s->mb_height*2 + 2)*2); |
2009 memset(s->p_mv_table , 0, sizeof(INT16)*(s->mb_width+2)*(s->mb_height+2)*2); | 2011 memset(s->p_mv_table , 0, sizeof(INT16)*(s->mb_width+2)*(s->mb_height+2)*2); |
2010 memset(s->mb_type , MB_TYPE_INTRA, sizeof(UINT8)*s->mb_width*s->mb_height); | 2012 memset(s->mb_type , MB_TYPE_INTRA, sizeof(UINT8)*s->mb_width*s->mb_height); |
2011 } | 2013 } |
2012 | 2014 if(s->scene_change_score > 0 && s->pict_type == P_TYPE){ |
2013 if(s->mb_var_sum < s->mc_mb_var_sum && s->pict_type == P_TYPE){ //FIXME subtract MV bits | |
2014 s->pict_type= I_TYPE; | 2015 s->pict_type= I_TYPE; |
2015 memset(s->mb_type , MB_TYPE_INTRA, sizeof(UINT8)*s->mb_width*s->mb_height); | 2016 memset(s->mb_type , MB_TYPE_INTRA, sizeof(UINT8)*s->mb_width*s->mb_height); |
2016 if(s->max_b_frames==0){ | 2017 if(s->max_b_frames==0){ |
2017 s->input_pict_type= I_TYPE; | 2018 s->input_pict_type= I_TYPE; |
2018 s->input_picture_in_gop_number=0; | 2019 s->input_picture_in_gop_number=0; |