读取视频文件 并且写入新文件中。
中间有block的呼出,为了处理视频时所用。<pre name="code" class="cpp">#include <stdio.h>
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <memory.h>
#define N 8
#define PI 3.141592
int main()
{
double buffer[352*288];
int z=0;
int blocks_y,blocks_x,i,j;
double f[8*8];
//double F[8*8];
//double ref[8*8];
double buffer2[352*288];
FILE *in,*out;
in=fopen("football.yuv","rb");
out=fopen("fooballtest3.yuv","wb");
if (in==NULL)
{
printf("can't open in.yuv\n");
return 1;
}
while(1)
{
fread(buffer,352*288,1,in);
if(feof(in)!=0)
{
break;
}
for (blocks_x=0;blocks_x<44;blocks_x++)
{
for (blocks_y=0;blocks_y<36;blocks_y++)
{
for (i=0;i<8;i++) //N*N unit block
{
for (j=0;j<8;j++)
{
z=blocks_y*8*352+8*blocks_x+j+352*i;
f[j+8*i]=buffer[z]; //call the blocks one by one from vedio file(buffer)
buffer2[z]=f[j+8*i];
}
}
}
}
fwrite(buffer2,352*288,1,out);
}
fclose(in);
fclose(out);
return 0;
}