Add sse2 dc, dc_left, dc_top, dc_128, v, h
[aom.git] / y4menc.c
blobb094f74fed0186575a37dbfeef5ee1d4d5d57391
1 /*
2 * Copyright (c) 2016, Alliance for Open Media. All rights reserved
4 * This source code is subject to the terms of the BSD 2 Clause License and
5 * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
6 * was not distributed with this source code in the LICENSE file, you can
7 * obtain it at www.aomedia.org/license/software. If the Alliance for Open
8 * Media Patent License 1.0 was not distributed with this source code in the
9 * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
12 #include <assert.h>
13 #include "./y4menc.h"
15 int y4m_write_file_header(char *buf, size_t len, int width, int height,
16 const struct AvxRational *framerate,
17 aom_img_fmt_t fmt, unsigned int bit_depth) {
18 const char *color;
19 switch (bit_depth) {
20 case 8:
21 color = fmt == AOM_IMG_FMT_444A
22 ? "C444alpha\n"
23 : fmt == AOM_IMG_FMT_I444
24 ? "C444\n"
25 : fmt == AOM_IMG_FMT_I422 ? "C422\n" : "C420jpeg\n";
26 break;
27 case 9:
28 color = fmt == AOM_IMG_FMT_I44416
29 ? "C444p9 XYSCSS=444P9\n"
30 : fmt == AOM_IMG_FMT_I42216 ? "C422p9 XYSCSS=422P9\n"
31 : "C420p9 XYSCSS=420P9\n";
32 break;
33 case 10:
34 color = fmt == AOM_IMG_FMT_I44416
35 ? "C444p10 XYSCSS=444P10\n"
36 : fmt == AOM_IMG_FMT_I42216 ? "C422p10 XYSCSS=422P10\n"
37 : "C420p10 XYSCSS=420P10\n";
38 break;
39 case 12:
40 color = fmt == AOM_IMG_FMT_I44416
41 ? "C444p12 XYSCSS=444P12\n"
42 : fmt == AOM_IMG_FMT_I42216 ? "C422p12 XYSCSS=422P12\n"
43 : "C420p12 XYSCSS=420P12\n";
44 break;
45 case 14:
46 color = fmt == AOM_IMG_FMT_I44416
47 ? "C444p14 XYSCSS=444P14\n"
48 : fmt == AOM_IMG_FMT_I42216 ? "C422p14 XYSCSS=422P14\n"
49 : "C420p14 XYSCSS=420P14\n";
50 break;
51 case 16:
52 color = fmt == AOM_IMG_FMT_I44416
53 ? "C444p16 XYSCSS=444P16\n"
54 : fmt == AOM_IMG_FMT_I42216 ? "C422p16 XYSCSS=422P16\n"
55 : "C420p16 XYSCSS=420P16\n";
56 break;
57 default: color = NULL; assert(0);
59 return snprintf(buf, len, "YUV4MPEG2 W%u H%u F%u:%u I%c %s", width, height,
60 framerate->numerator, framerate->denominator, 'p', color);
63 int y4m_write_frame_header(char *buf, size_t len) {
64 return snprintf(buf, len, "FRAME\n");