您的位置:首页 > 其它

A problem in function PartitionMotionSearch()

2011-10-16 11:34 204 查看
void PartitionMotionSearch (int blocktype,

int block8x8,

double lambda)

{

static int bx0[5][4] = {{0,0,0,0}, {0,0,0,0}, {0,0,0,0}, {0,2,0,0}, {0,2,0,2}};

static int by0[5][4] = {{0,0,0,0}, {0,0,0,0}, {0,2,0,0}, {0,0,0,0}, {0,0,2,2}};

……

for (v=by0[parttype][block8x8]; v<by0[parttype][block8x8]+step_v0; v+=step_v) //===== LOOP OVER SUB MACRO BLOCK partitions

for (h=bx0[parttype][block8x8]; h<bx0[parttype][block8x8]+step_h0; h+=step_h)

………………

}

那两个数组跟运动估计时的分割方式有关系吗?有关系那是什么关系呢,如没有关系那两个数组是干嘛用的呢?


自我分析:在后面引用的时候by0[parttype][block8x8]; 分别用的是parttype和block8x8控制行和列

而前面有定义int parttype = (blocktype<4?blocktype:4);所以parttype 指宏块类型,分别为0.1.2.3.4.五个值

而block8x8也有相关语句:int block8x8, // <-- block number of 8x8 block指8*8宏块数目。

后面步长为step_v0,赋值为

int step_h0 = (input->blc_size[ parttype][0]>>2);

int step_v0 = (input->blc_size[ parttype][1]>>2);

int step_h = (input->blc_size[blocktype][0]>>2);

int step_v = (input->blc_size[blocktype][1]>>2);

又找了input->blc_size[,于是又有相关定义,

int blc_size[8][2]; //!< array for different block sizes

input->blc_size[0][0]=16;

input->blc_size[0][1]=16;

input->blc_size[1][0]=16;

input->blc_size[1][1]=16;

input->blc_size[2][0]=16;

input->blc_size[2][1]= 8;

input->blc_size[3][0]= 8;

input->blc_size[3][1]=16;

input->blc_size[4][0]= 8;

input->blc_size[4][1]= 8;

input->blc_size[5][0]= 8;

input->blc_size[5][1]= 4;

input->blc_size[6][0]= 4;

input->blc_size[6][1]= 8;

input->blc_size[7][0]= 4;

input->blc_size[7][1]= 4;

…………接下去我还是不懂


明白了…………

贴张图:

(bx0,by0)是一个宏块中的某个子宏块的相对坐标,以mode 4 8*8为例


一个宏块被分为4个8*8子块,每个子块相对于宏块坐标分别如上图所示:

即数组bx0,by0的第五个一维数组{0,2,0,2},{0,0,2,2}。

后面继续跟踪:

首先处理mode 1.2.3模式,对于p8*8模式,则是把16*16分成8*8后再调用PartitionMotionSearch()

…………

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: