Merge "Removing duplicated example file example_xma.c."
[platform/upstream/libvpx.git] / y4menc.c
1 /*
2  *  Copyright (c) 2014 The WebM project authors. All Rights Reserved.
3  *
4  *  Use of this source code is governed by a BSD-style license
5  *  that can be found in the LICENSE file in the root of the source
6  *  tree. An additional intellectual property rights grant can be found
7  *  in the file PATENTS.  All contributing project authors may
8  *  be found in the AUTHORS file in the root of the source tree.
9  */
10
11 #include "./y4menc.h"
12
13 void y4m_write_file_header(FILE *file, int width, int height,
14                            const struct VpxRational *framerate,
15                            vpx_img_fmt_t fmt) {
16   const char *color = fmt == VPX_IMG_FMT_444A ? "C444alpha\n" :
17                       fmt == VPX_IMG_FMT_I444 ? "C444\n" :
18                       fmt == VPX_IMG_FMT_I422 ? "C422\n" :
19                       "C420jpeg\n";
20
21   // Note: We can't output an aspect ratio here because IVF doesn't
22   // store one, and neither does VP8.
23   // That will have to wait until these tools support WebM natively.*/
24   fprintf(file, "YUV4MPEG2 W%u H%u F%u:%u I%c %s", width, height,
25           framerate->numerator, framerate->denominator, 'p', color);
26 }
27
28 void y4m_write_frame_header(FILE *file) {
29   fprintf(file, "FRAME\n");
30 }