Lines Matching defs:fout
206 static int WritePPM(FILE* fout, const WebPDecBuffer* const buffer, int alpha) {
215 fprintf(fout, "P7\nWIDTH %d\nHEIGHT %d\nDEPTH 4\nMAXVAL 255\n"
218 fprintf(fout, "P6\n%d %d\n255\n", width, height);
221 if (fwrite(rgb + y * stride, width, bytes_per_px, fout) != bytes_per_px) {
228 static int WriteAlphaPlane(FILE* fout, const WebPDecBuffer* const buffer) {
235 fprintf(fout, "P5\n%d %d\n255\n", width, height);
237 if (fwrite(a + y * a_stride, width, 1, fout) != 1) {
248 static int WritePGMOrYUV(FILE* fout, const WebPDecBuffer* const buffer,
261 fprintf(fout, "P5\n%d %d\n255\n",
265 ok &= (fwrite(yuv->y + y * yuv->y_stride, width, 1, fout) == 1);
267 if (width & 1) fputc(0, fout); // padding byte
272 ok &= (fwrite(yuv->u + y * yuv->u_stride, uv_width, 1, fout) == 1);
273 ok &= (fwrite(yuv->v + y * yuv->v_stride, uv_width, 1, fout) == 1);
277 ok &= (fwrite(yuv->u + y * yuv->u_stride, uv_width, 1, fout) == 1);
280 ok &= (fwrite(yuv->v + y * yuv->v_stride, uv_width, 1, fout) == 1);
284 ok &= (fwrite(yuv->a + y * yuv->a_stride, width, 1, fout) == 1);
286 if (width & 1) fputc(0, fout); // padding byte
294 FILE* fout = NULL;
306 fout = fopen(out_file, "wb");
307 if (!fout) {
317 ok &= WritePNG(fout, buffer);
320 ok &= WritePPM(fout, buffer, 1);
322 ok &= WritePPM(fout, buffer, 0);
324 ok &= WritePGMOrYUV(fout, buffer, format);
326 ok &= WriteAlphaPlane(fout, buffer);
328 if (fout) {
329 fclose(fout);