static void write_image(const void *data, const int size, int width, int height,
const char *name)
{
char filename[80];
static unsigned int count = 0;
size_t bytes;
FILE *fp;
snprintf(filename, sizeof(filename), "/data/shen/dump_%d_%d_%03u_%s", width,
height, count, name);
fp = fopen (filename, "w+");
if (fp == NULL) {
LOGE ("open file %s failed %s", filename, strerror (errno));
return ;
}
LOGD ("shen Begin write image %s", filename);
if ((bytes = fwrite (data, size, 1, fp)) < (size_t)size)
LOGD ("shen Write less raw bytes to %s: %d, %d", filename, size, bytes);
count++;
fclose (fp);
}