Hey~I wrote a simple program to convert yuv to dat in which ccs probe can use.
However there is something wrong with it, the generated .dat is alway 0kb, it seems that the
data were not wrote into .dat.
Anyone help ?
#include <stdio.h>
#include <string.h>
#include <conio.h>
#define WIDTH 352
#define HEIGHT 288
typedef unsigned char uint8_t;
main()
{
FILE *fp;
FILE *fd;
uint8_t *plane[4];
plane[0] = NULL;
plane[1] = NULL;
plane[2] = NULL;
plane[3] = NULL;
if ((fp = fopen(\"foreman.yuv\",\"rb\")) == 0)
{
printf(\"Error when open input file\\n\");
}
if (fread( plane[0], 1, WIDTH * HEIGHT, fp ) < 0
|| fread( plane[1], 1, WIDTH * HEIGHT / 4, fp ) <0
|| fread( plane[2], 1, WIDTH * HEIGHT / 4, fp ) < 0)
{
printf(\"Error when read yuv file\\n\");
}
if ( (fd = fopen(\"f.dat\", \"wb\")) == 0)
{
printf(\"Error when open output file\\n\");
}
if (fwrite( plane[0], 1, WIDTH * HEIGHT, fd ) < 0
|| fwrite( plane[1], 1, WIDTH * HEIGHT / 4, fd ) < 0
|| fwrite( plane[2], 1, WIDTH * HEIGHT / 4, fd ) < 0)
{
printf(\"Error when write dat file\\n\");
}
fclose(fp);
fclose(fd);
getche();
}

(You need to be a member of code-comp -- send a blank email to code-comp-subscribe@yahoogroups.com )