#include #include #include #include typedef uint8_t uint8; typedef uint32_t uint32; const int bytesPerPixel = 3; void usage(); uint32 averagergb(png_image *, uint8 *); int main(int argc, char **argv){ if(argc == 1) usage(); char *imageFileName = "output.png"; int height = 1080; int width = argc-1; int percent = 0; uint32 *frames = malloc(width*sizeof(uint32)); #pragma omp parallel for for(int i =1;i> 16)&0xff); imgPointer[j*3+i*width*3+1] = ((frames[j] >> 8)&0xff); imgPointer[j*3+i*width*3+0] = ((frames[j])&0xff); } } png_image output = {0}; output.format = PNG_FORMAT_RGB; output.version = PNG_IMAGE_VERSION; output.width = width; output.height = height; png_image_write_to_file(&output, imageFileName, 0, imgPointer, 0, NULL); free(imgPointer); free(frames); } void usage() { fprintf(stderr, "USAGE: ./frames2img PNGs..."); exit(1); } uint32 averagergb(png_image *img, uint8 *buffer) { png_image image = *img; double sumR = 0; double sumG = 0; double sumB = 0; double fact = image.width * image.height; for(int y =0;y