📄 motion_detect.c
字号:
/********************************************************************
Function: motion_detect
Description: Every macro-block of size 16*16 in the current frame is
compared with the past_frame over a range of 3 macro-blocks
i.e. 3*16*16. The Y component is sub-sampled to 1/4.
********************************************************************/
#include <services/services.h>
#include <ezkitutilities.h>
#include <drivers/adi_dev.h>
#include <drivers/ppi/adi_ppi.h>
#include "../Buffer.h"
void motion_detect(unsigned char *ref_frame, unsigned char* curr_frame,unsigned int width, unsigned char* curr_out_frame)
{
unsigned int i,j,k;
int change=0;
unsigned int W;
W=1716;//width-5;
char temp,temp1,temp2;
for(k=18;k<104;k++)
{
change=0;
for(j=0;j<L2NUMROWS;j++)
{
for (i=0;i<48;i+=8)
{
if(curr_frame[k*16+j*W+i+1]!=ref_frame[k*16+j*W+i+1])
change++;
}
}
if(change>47)
{
for(j=0;j<L2NUMROWS;j++)
{
for (i=0;i<16;i++)
{
curr_out_frame[k*16+j*W+i]=curr_frame[k*16+j*W+i];
}
}
}//end of if
else
{
for(j=0;j<L2NUMROWS;j++)
{
for (i=0;i<15;i+=2)
{
curr_out_frame[k*16+j*W+i+1]=0x10;
curr_out_frame[k*16+j*W+i]=0x80;
}
}
}//end of else
}//end of k
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -