[Ffmpeg-devel] Re: tracing GOP start code
Micro Mysore
micromysore
Thu Jul 28 02:11:40 CEST 2005
Hello,
It was a good start. I finally found the code !! I was trying to find
the code which resets the GOP upon detecting a scene change. I came
across a paper published for MPEG in 1996 called SDMAD (Signed
difference of mean absolute difference). Looks like the equations used
here are way diff.
in libavcodec/motion_est.c
01179 if (vard <= 64 || vard < varc) { //FIXME
01180 c->scene_change_score+= ff_sqrt(vard) - ff_sqrt(varc);
01181 }else{
01182 c->scene_change_score+= s->qscale;
01183 }
and further used in
libavcodec/mpegvideo.c
05301 if(s->me.scene_change_score >
s->avctx->scenechange_threshold && s->pict_type == P_TYPE){
05302 s->pict_type= I_TYPE;
05303 for(i=0; i<s->mb_stride*s->mb_height; i++)
05304 s->mb_type[i]= CANDIDATE_MB_TYPE_INTRA;
05305 //printf("Scene change detected, encoding as I Frame %d %d\n",
s->current_picture.mb_var_sum, s->current_picture.mc_mb_var_sum);
05306 }
Now, what is done is clear. Is there some document which describes, why ?
-mic
---------------------------------------------
Hi
On Wednesday 27 July 2005 04:02, Micro Mysore wrote:
> Hello,
>
> I want to find the method used to determine the start of GOP ..
the code surrounding `grep -i gop mpegvideo.c` should be a start
[...]
> I am trying to find if ffmpeg uses constant length of GOP or if not,
> what algorithm it uses to find the scene change.
that depends upon various parameters
[...]
--
Michael
More information about the ffmpeg-devel
mailing list