estimation.cpp in estimation_release08
Sponsored links
// estimation.cpp : 定义控制台应用程序的入口点。
//
#include "stdafx.h"
#include "stdio.h"
int main()
{
int row,col;
int total_no,sad;
long int sad_min;
char * src_path;
char * out_path;
int i,j,k,m,p,q,k1,m1,p1,q1;
// i=17;
// j=21;
int width = 352,mb_width=width /16;
int height = 288,mb_height= height/16;
// int a[16][16],b[16][16],c[16][16];
int sad_MATRIX[336][272];
total_no= 300; //total frame number
sad=0;
src_path = "G:\\videos\\foreman_cif.yuv";
out_path = "C:\\my_work\\sousuo\\estimation_cif_test.yuv";
int temp = 0;
int size;
FILE *in_file, *out_file;
unsigned char * buf1[3];
unsigned char * buf2[3];
unsigned char * buf3[3];
int frame_no;
size=height * width + (height * width >> 1);
unsigned char srcYBuf1[352*288];
unsigned char srcUBuf1[352/2 * 288/2];
unsigned char srcVBuf1[352/2 * 288/2];
unsigned char srcYBuf2[352*288];
unsigned char srcUBuf2[352/2 * 288/2];
unsigned char srcVBuf2[352/2 * 288/2];
unsigned char srcYBuf3[352*288];
// unsigned char srcUBuf3[width/2 * height/2];
// unsigned char srcVBuf3[width/2 * height/2];
buf1[0] = srcYBuf1;
buf1[1] = srcUBuf1;
buf1[2] = srcVBuf1;
buf2[0] = srcYBuf2;
buf2[1] = srcUBuf2;
buf2[2] = srcVBuf2;
buf3[0] = srcYBuf3;
// buf3[1] = srcUBuf3;
// buf3[2] = srcVBuf3;
in_file = fopen(src_path, "rb");
if (!in_file)
{
printf("cannot open input file.");
return 0;
}
out_file = fopen(out_path, "wb");
if (!out_file)
{
printf("cannot write file.\n");
return 0;
}
frame_no =0;
fread(buf1[0], width, height, in_file);
fread(buf1[1], (width>>1), (height>>1), in_file);
fread(buf1[2], (width>>1), (height>>1), in_file);
...
...
... to be continued.
This is a preview. To get the complete source file,
please click here to download the whole source code package.