[Ffmpeg-devel] Motion Estimation in snow.c for DWT frames.
Aniket Joshi
aniketj
Sun Mar 25 23:20:39 CEST 2007
Hi,
I am working on implementing a motion estimation algorithm for DWT encoded
frames. The command that I use for encoding a raw frame is:
ffmpeg -t 60 -s 176x144 -i formulaone_64kbps_5fps.yuv -f rawvideo -pix_fmt
yuv420p -strict -2 -vcodec snow -b 600 -an -f mp4 play.mp4
I suspect that much of the motion estimation for a DWT encoded frame takes
place in the encode_q_branch function in the following lines:
ref_score= ff_epzs_motion_search
<http://cekirdek.pardus.org.tr/%7Eismail/ffmpeg-docs/motion__est__template_8c.html#987dca9837be0b1508be2bf16636050f>(&s->m
<http://cekirdek.pardus.org.tr/%7Eismail/ffmpeg-docs/structSnowContext.html#382468c556dbbe3870de7edf2756d3e3>,
&ref_mx, &ref_my, P, 0, /*ref_index*/ 0, last_mv,
02094 (1<<16)>>shift,
level-LOG2_MB_SIZE
<http://cekirdek.pardus.org.tr/%7Eismail/ffmpeg-docs/snow_8c.html#04bac03c3f19f10fcd8c3ae6465fea97>+4,
block_w);
02095
02096 assert(ref_mx >= c
<http://cekirdek.pardus.org.tr/%7Eismail/ffmpeg-docs/fdctref_8c.html#a4dc129ffed9a7dff1acd9d2ce02dc94>->xmin);
02097 assert(ref_mx <= c->xmax);
02098 assert(ref_my >= c
<http://cekirdek.pardus.org.tr/%7Eismail/ffmpeg-docs/fdctref_8c.html#a4dc129ffed9a7dff1acd9d2ce02dc94>->ymin);
02099 assert(ref_my <= c->ymax);
02100
02101 ref_score= c
<http://cekirdek.pardus.org.tr/%7Eismail/ffmpeg-docs/fdctref_8c.html#a4dc129ffed9a7dff1acd9d2ce02dc94>->sub_motion_search(&s->m
<http://cekirdek.pardus.org.tr/%7Eismail/ffmpeg-docs/structSnowContext.html#382468c556dbbe3870de7edf2756d3e3>,
&ref_mx, &ref_my, ref_score, 0, 0, level-LOG2_MB_SIZE
<http://cekirdek.pardus.org.tr/%7Eismail/ffmpeg-docs/snow_8c.html#04bac03c3f19f10fcd8c3ae6465fea97>+4,
block_w);
02102 ref_score= ff_get_mb_score
<http://cekirdek.pardus.org.tr/%7Eismail/ffmpeg-docs/motion__est__template_8c.html#82eb9cdac225c827a8f7c6dff9b25ebb>(&s->m
<http://cekirdek.pardus.org.tr/%7Eismail/ffmpeg-docs/structSnowContext.html#382468c556dbbe3870de7edf2756d3e3>,
ref_mx, ref_my, 0, 0, level-LOG2_MB_SIZE
<http://cekirdek.pardus.org.tr/%7Eismail/ffmpeg-docs/snow_8c.html#04bac03c3f19f10fcd8c3ae6465fea97>+4,
block_w, 0);
02103 ref_score+= 2*av_log2
<http://cekirdek.pardus.org.tr/%7Eismail/ffmpeg-docs/common_8h.html#91c1e948410d8ccf85a664c5154d31e8>(2*ref)*c
<http://cekirdek.pardus.org.tr/%7Eismail/ffmpeg-docs/fdctref_8c.html#a4dc129ffed9a7dff1acd9d2ce02dc94>->penalty_factor;
Could anyone please correct me if my assumption that motion estimation
takes place here is wrong? Also, more importantly can anyone
tell me how to access the reference frame and the current frame, and
how/where the difference between current & ref frames
(i.e., the motion vectors) is calculated.
Thanks,
Aniket.
More information about the ffmpeg-devel
mailing list