資源簡介
FS(全搜索算法)、4SS(4步搜索算法)、BBGDS(基于塊的梯度下降搜索算法)、DS(鉆石搜索)、HS六邊形搜索算法(hexagonal search, HS)、CDHS(交叉磚石六邊形搜索法)等算法的實現

代碼片段和文件信息
#include?“stdio.h“
#include?“stdlib.h“
#include?“malloc.h“
#include?“string.h“
#include?“sys/timeb.h“
#include?“math.h“
#include?“inf.h“
#define?MIN(ab)?((a)<(b))?(a):(b);
#define?MAX(ab)?((a)>(b))?(a):(b);
int?SAD(const?int?oxconst?int?oyconst?int?dxconst?int?dyconst?int?heightconst?int?widthuint32?&best_sad)
{
const?int?rx=ox+dxry=oy+dy;
if(?abs(dx)>MAX_MOTION?||?abs(dy)>MAX_MOTION?||?flag_search[dx][dy]>0?)
return?0;
if(?rx<0?||?ry<0?||?rx+height>XX?||?ry+width>YY?)
return?0;
uint32?sad=0;
frame_info.frame_pot++;
const?uint8?*p1=¤t_frame[ox][oy]*p2=&ref_frame[rx][ry];
for(int?i=0;i {
for(int?j=0;j {
sad+=abs(*(p1++)-*(p2++));
}
p1+=(YY-width);p2+=(YY-width);
}
flag_search[dx][dy]=1+sad;
if(sad>=best_sad)
return?0;
best_sad=sad;
return?1;
}
void?rebuilt(const?int?xconst?int?yconst?int?heightconst?int?width)
{
const?int?dx=frame_info.mv[x][y].dxdy=frame_info.mv[x][y].dy;
const?int?ox=x*BLOCK_HEIGTHoy=y*BLOCK_WIDTH;
const?int?rx=ox+dxry=oy+dy;
int?tmp;
const?uint8?*p1=¤t_frame[ox][oy]*p2=&ref_frame[rx][ry];
if(?abs(dx)>MAX_MOTION?||?abs(dy)>MAX_MOTION?)
exit(0);
if(?rx<0?||?ry<0?||?rx+height>XX?||?ry+width>YY?)
exit(0);
for(int?i=0;i {
for(int?j=0;j {
tmp=*(p1++)-*(p2++);
frame_info.frame_sse+=tmp*tmp;
}
p1+=(YY-width);p2+=(YY-width);
}
}
void?search_FS(const?int?xconst?int?yconst?int?heigthconst?int?width)
{
const?int?ox=x*BLOCK_HEIGTHoy=y*BLOCK_WIDTH;
uint32?sad=0xffffff;
MV?mv;
for(int?i=-MAX_MOTION;i<=MAX_MOTION;i++)
{
for(int?j=-MAX_MOTION;j<=MAX_MOTION;j++)
{
if(SAD(oxoyijheigthwidthsad)==1)
{
mv.dx=i;mv.dy=j;
}
}
}
frame_info.mv[x][y]=mv;
frame_info.sad[x][y]=sad;
frame_info.frame_sad+=sad;
}
#define?PATTERN_SEARCH(patternnumflag)?\
do\
{\
mvx=mv.dx;mvy=mv.dy;\
for(int?i=0;i {\
if(SAD(oxoymvx+pattern[i][0]mvy+pattern[i][1]heigthwidthsad)==1)\
{\
mv.dx=mvx+pattern[i][0];mv.dy=mvy+pattern[i][1];\
}\
}\
}while?(?(mv.dx!=mvx?||?mv.dy!=mvy)?&&?flag==1?);
void?search_4SS(const?int?xconst?int?yconst?int?heigthconst?int?width)
{
const?int?ox=x*BLOCK_HEIGTHoy=y*BLOCK_WIDTH;
const?int?L4SS[9][2]={{00}{02}{-22}{-20}{-2-2}{0-2}{2-2}{20}{22}};
const?int?S4SS[9][2]={{00}{01}{-11}{-10}{-1-1}{0-1}{1-1}{10}{11}};
uint32?sad=0xffffff;
MV?mv={00};int?mvxmvy;
PATTERN_SEARCH(L4SS91)
PATTERN_SEARCH(S4SS90)
frame_info.mv[x][y]=mv;
frame_info.sad[x][y]=sad;
frame_info.frame_sad+=sad;
}
void?search_BBGDS(const?int?xconst?int?yconst?int?heigthconst?int?width)
{
const?int?ox=x*BLOCK_HEIGTHoy=y*BLOCK_WIDTH;
const?int?BBGDS[9][2]={{00}{01}{-11}{-10}{-1-1}{0-1}{1-1}{10}{11}};
uint32?sad=0xffffff;
MV?mv={00};int?mvxmvy;
PATTERN_SEARCH(BBGDS91)
frame_info.mv[x][y]=mv
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件??????10312??2011-09-21?09:11??運動估計方法的比較\運動估計方法比較\Debug\BuildLog.htm
?????文件??????60828??2011-09-21?09:11??運動估計方法的比較\運動估計方法比較\Debug\main.obj
?????文件??????????0??2010-06-25?12:41??運動估計方法的比較\運動估計方法比較\Debug\main.sbr
?????文件?????????65??2011-09-21?09:11??運動估計方法的比較\運動估計方法比較\Debug\mt.dep
?????文件??????41984??2011-03-12?16:33??運動估計方法的比較\運動估計方法比較\Debug\vc60.idb
?????文件??????53248??2011-03-12?16:33??運動估計方法的比較\運動估計方法比較\Debug\vc60.pdb
?????文件??????60416??2011-09-17?16:53??運動估計方法的比較\運動估計方法比較\Debug\vc80.idb
?????文件??????61440??2011-09-17?16:53??運動估計方法的比較\運動估計方法比較\Debug\vc80.pdb
?????文件??????60416??2011-09-21?09:11??運動估計方法的比較\運動估計方法比較\Debug\vc90.idb
?????文件??????69632??2011-09-21?09:11??運動估計方法的比較\運動估計方法比較\Debug\vc90.pdb
?????文件??????82944??2010-06-25?12:41??運動估計方法的比較\運動估計方法比較\Debug\zhang.bsc
?????文件?????572928??2011-09-21?09:11??運動估計方法的比較\運動估計方法比較\Debug\zhang.exe
?????文件????????406??2011-09-19?15:16??運動估計方法的比較\運動估計方法比較\Debug\zhang.exe.em
?????文件????????472??2011-09-19?15:16??運動估計方法的比較\運動估計方法比較\Debug\zhang.exe.em
?????文件????????381??2011-09-21?09:11??運動估計方法的比較\運動估計方法比較\Debug\zhang.exe.intermediate.manifest
?????文件????1187036??2011-09-21?09:11??運動估計方法的比較\運動估計方法比較\Debug\zhang.ilk
?????文件????2468864??2011-09-21?09:11??運動估計方法的比較\運動估計方法比較\Debug\zhang.pdb
?????文件???????1118??2011-09-19?15:16??運動估計方法的比較\運動估計方法比較\inf.h
?????文件??????18260??2011-09-21?09:11??運動估計方法的比較\運動估計方法比較\main.cpp
?????文件???????2127??2011-09-19?15:15??運動估計方法的比較\運動估計方法比較\UpgradeLog.xm
?????文件???????4329??2006-05-20?14:41??運動估計方法的比較\運動估計方法比較\zhang.dsp
?????文件????????535??2006-05-20?10:07??運動估計方法的比較\運動估計方法比較\zhang.dsw
?????文件?????723968??2011-09-21?15:03??運動估計方法的比較\運動估計方法比較\zhang.ncb
?????文件??????48640??2011-01-06?13:35??運動估計方法的比較\運動估計方法比較\zhang.opt
?????文件???????3377??2011-03-12?16:33??運動估計方法的比較\運動估計方法比較\zhang.plg
?????文件????????875??2011-09-19?15:15??運動估計方法的比較\運動估計方法比較\zhang.sln
?????文件????????874??2011-09-17?14:42??運動估計方法的比較\運動估計方法比較\zhang.sln.old
????..A..H.?????11776??2011-09-21?15:03??運動估計方法的比較\運動估計方法比較\zhang.suo
????..A..H.??????9216??2011-09-19?10:49??運動估計方法的比較\運動估計方法比較\zhang.suo.old
?????文件???????5212??2011-09-19?15:15??運動估計方法的比較\運動估計方法比較\zhang.vcproj
............此處省略15個文件信息
- 上一篇:電商資質模板.zip
- 下一篇:預備工作1——了解你的編譯器
評論
共有 條評論