您好,欢迎访问三七文档
当前位置:首页 > 商业/管理/HR > 咨询培训 > JM86--FastIntegerPelBlockMotionSearch注释
/*!*************************************************************************\brief快速整数像素块运动搜索*FastIntegerPelBlockMotionSearch:fastpixelblockmotionsearch*thisalgrithmiscalledUMHexagonS(seeJVT-D016),whichincludes*fourstepswithdifferentkindsofsearchpatterns*\parInput:*pel_t**orig_pic,//--originalpicture*intref,//--referenceframe(0...or-1(backward))参考帧*intpic_pix_x,//--absolutex-coordinateofregardedAxBblock*intpic_pix_y,//--absolutey-coordinateofregardedAxBblock*intblocktype,//--blocktype(1-16x16...7-4x4)模块分类*intpred_mv_x,//--motionvectorpredictor(x)insub-pelunits*intpred_mv_y,//--motionvectorpredictor(y)insub-pelunits*int*mv_x,//--motionvector(x)-inpelunits*int*mv_y,//--motionvector(y)-inpelunits*intsearch_range,//--1-dsearchrangeinpelunits搜索范围*intmin_mcost,//--minimummotioncost(costforcenterorhugevalue)最小运动损耗*doublelambda//--lagrangianparameterfordeterminingmotioncost*\par*Threemacrodefinitionsdefinedinthisprogram:*1.EARLY_TERMINATION:earlyterminationalgrithm,refertoJVT-D016.doc*2.SEARCH_ONE_PIXEL:searchonepixelinsearchrange在范围内搜索像素点*3.SEARCH_ONE_PIXEL1(value_iAbort):searchonepixelinsearchrange,*butgiveaparametertoshowifmincostrefeshed在给出最小损耗的参数后进行搜索*\Maincontributors:(seecontributors.hforcopyright,addressandaffiliationdetails)*ZhiboChenchenzhibo@tsinghua.org.cn*JianFengXufenax@video.mdc.tsinghua.edu.cn*\date:2003.8*************************************************************************/int//==minimummotioncostaftersearchFastIntegerPelBlockMotionSearch(pel_t**orig_pic,//--notusedintref,//--referenceframe(0...or-1(backward))intlist,intpic_pix_x,//--absolutex-coordinateofregardedAxBblockintpic_pix_y,//--absolutey-coordinateofregardedAxBblockintblocktype,//--blocktype(1-16x16...7-4x4)intpred_mv_x,//--motionvectorpredictor(x)insub-pelunitsintpred_mv_y,//--motionvectorpredictor(y)insub-pelunitsint*mv_x,//--motionvector(x)-inpelunitsint*mv_y,//--motionvector(y)-inpelunitsintsearch_range,//--1-dsearchrangeinpelunitsintmin_mcost,//--minimummotioncost(costforcenterorhugevalue)doublelambda)//--lagrangianparameterfordeterminingmotioncost//快速整数像素块运动搜索{staticintDiamond_x[4]={-1,0,1,0};staticintDiamond_y[4]={0,1,0,-1};staticintHexagon_x[6]={2,1,-1,-2,-1,1};staticintHexagon_y[6]={0,-2,-2,0,2,2};staticintBig_Hexagon_x[16]={0,-2,-4,-4,-4,-4,-4,-2,0,2,4,4,4,4,4,2};staticintBig_Hexagon_y[16]={4,3,2,1,0,-1,-2,-3,-4,-3,-2,-1,0,1,2,3};intpos,cand_x,cand_y,mcost;pel_t*(*get_ref_line)(int,pel_t*,int,int,int,int);intlist_offset=((img-MbaffFrameFlag)&&(img-mb_data[img-current_mb_nr].mb_field))?img-current_mb_nr%2?4:2:0;pel_t*ref_pic=listX[list+list_offset][ref]-imgY_11;//参考帧亮度有边界填充//pel_t*ref_pic;//使用参考帧加权方法intbest_pos=0;//positionwithminimummotioncostintmax_pos=(2*search_range+1)*(2*search_range+1);//numberofsearchpositionsintlambda_factor=LAMBDA_FACTOR(lambda);//factorfordetermininglagragianmotioncostintmvshift=2;//motionvectorshiftforgettingsub-pelunitsintblocksize_y=input-blc_size[blocktype][1];//verticalblocksizeintblocksize_x=input-blc_size[blocktype][0];//horizontalblocksizeintblocksize_x4=blocksize_x2;//horizontalblocksizein4-pelunitsintpred_x=(pic_pix_xmvshift)+pred_mv_x;//predictedpositionx(insub-pelunits)intpred_y=(pic_pix_ymvshift)+pred_mv_y;//predictedpositiony(insub-pelunits)intcenter_x=pic_pix_x+*mv_x;//centerpositionx(inpelunits)intcenter_y=pic_pix_y+*mv_y;//centerpositiony(inpelunits)intbest_x,best_y;intcheck_for_00=(blocktype==1&&!input-rdopt&&img-type!=B_SLICE&&ref==0);//表示16*16不用率失真优化模式intsearch_step,iYMinNow,iXMinNow;inti,m,iSADLayer;intiAbort;intN_Bframe=input-successive_Bframe;floatbetaSec,betaThird;//阈值intheight=((img-MbaffFrameFlag)&&(img-mb_data[img-current_mb_nr].mb_field))?img-height/2:img-height;//在图象自适应桢场模式且宏块场编码模式下高度除2//=====setfunctionforgettingreferencepicturelines获取参考帧=====if((center_xsearch_range)&&(center_ximg-width-1-search_range-blocksize_x)&&(center_ysearch_range)&&(center_yheight-1-search_range-blocksize_y)){get_ref_line=FastLineX;//ref_line是函数指针指向FastLineX指针函数地址,FastLineX指针函数返回的是byte指针}else//当前块的左上在搜索范围内移动在不图像width*height范围内{get_ref_line=UMVLineX;//无限制运动矢量,需象素拓展}//////allocatememoryforsearchstate分配存储给搜索区域//////////////////////////memset(McostState[0],0,(2*search_range+1)*(2*search_range+1)*4);///////Thresholddefinedforearlytermination阀值的定义///////////////////if(ref0){if(pred_SAD_ref!=0){betaSec=Bsize[blocktype]/(pred_SAD_ref*pred_SAD_ref)-AlphaSec[blocktype];betaThird=Bsize[blocktype]/(pred_SAD_ref*pred_SAD_ref)-AlphaThird[blocktype];}else{betaSec=0;betaThird=0;}}else{if(blocktype==1)//若为16x16块{if(pred_SAD_space!=0)//setmitiongvectorpredictor()中计算出的值{betaSec=Bsize[blocktype]/(pred_SAD_space*pred_SAD_space)-AlphaSec[blocktype];betaThird=Bsize[blocktype]/(pred_SAD_space*pred_SAD_space)-AlphaThird[blocktype];}else{betaSec=0;betaThird=0;}}else{if(pred_SAD_uplayer!=0){betaSec=Bsize[blocktype]/(pred_SAD_uplayer*pred_SAD_uplayer)-AlphaSec[blocktype];betaThird=Bsize[blocktype]/(pred_SAD_uplayer*pred_SAD_uplayer)-AlphaThird[blocktype];}else{betaSec
本文标题:JM86--FastIntegerPelBlockMotionSearch注释
链接地址:https://www.777doc.com/doc-7094548 .html