#include
#include
#include
#include
#define N 8
#define PI 3.1415926
int main()
{
unsigned char *buffer=(unsigned char*) calloc(352*288,sizeof(unsigned char));
unsigned char *pad_buf=(unsigned char*) calloc(384*320, sizeof(unsigned char));
FILE *in, *out;
fopen_s(&in,"football.yuv","rb");
fopen_s(&out,"footballpad5.yuv","wb");
if (in==NULL)
{
printf("can't open in.yuv\n");
//return 1;
}
while(1)
{
fread(buffer,1,sizeof(unsigned char)*352*288,in);
if(feof(in)!=0)
{
break;
}
for (int a=0;a<16;a++){
for (int b=0;b<16;b++){
pad_buf[b+384*a]=buffer[0];
}
}
fwrite(pad_buf,1,sizeof(unsigned char)*384*320,out);
}
fclose(in);
fclose(out);
return 0;
}
我处理的的16*16的block,应该出现在最左上角,理应在每个帧的同一个位置,为什么我运行后,出现的文件,方块儿在不同的位置,奇数帧出现的是正常的,偶数帧块儿都在左侧中间位置,求高手讲解,文件不是一帧一帧处理的吗? 没有YUV文件我可以提供!
是对帧的数据解码后进行处理的?为什么都是黑的?