[x264-devel] How to get the mv clip range in x264?
SiPing Tao
anhuitsp at mail.ustc.edu.cn
Mon Mar 22 02:52:06 CET 2010
Dear experts,
The following x264 code makes me confuesed:
// limit motion search to a slightly smaller range than the theoretical limit,
// since the search may go a few iterations past its given range
int i_fpel_border = 6; // umh: 1 for diamond, 2 for octagon, 2 for hpel
/* Calculate max allowed MV range */
#define CLIP_FMV(mv) x264_clip3( mv, -i_fmv_range, i_fmv_range-1 )
h->mb.mv_min[0] = 4*( -16*h->mb.i_mb_x - 24 );
h->mb.mv_max[0] = 4*( 16*( h->sps->i_mb_width - h->mb.i_mb_x - 1 ) + 24 );
h->mb.mv_min_spel[0] = CLIP_FMV( h->mb.mv_min[0] );
h->mb.mv_max_spel[0] = CLIP_FMV( h->mb.mv_max[0] );
h->mb.mv_min_fpel[0] = (h->mb.mv_min_spel[0]>>2) + i_fpel_border;
h->mb.mv_max_fpel[0] = (h->mb.mv_max_spel[0]>>2) - i_fpel_border;
First, why set i_fpel_border = 6? I don't understand the comments "// umh: 1 for diamond, 2 for octagon, 2 for hpel". As I understand, sub-pixel interolation will use 3 extra pixels at edge most, I think i_fpel_border = 3 is OK.
Second, h->mb.mv_min[0] = 4*( -16*h->mb.i_mb_x - 24 ), why use 24? The padding length is 32, and DIA will iterate 16 times at most, so I think it should be h->mb.mv_min[0] = 4*( -16*h->mb.i_mb_x - 16 ).
Thanks in advance!
Best Regards,
Siping
More information about the x264-devel
mailing list