libaom: remove references to RGB pixfmts
[libav.git] / libavcodec / libaom.c
1 /*
2 * Copyright (c) 2013 Guillaume Martres <smarter@ubuntu.com>
3 *
4 * This file is part of Libav.
5 *
6 * Libav is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * Libav is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with Libav; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20
21 #include <aom/aom_image.h>
22
23 #include "libaom.h"
24
25 #define HIGH_DEPTH(fmt) \
26 case AOM_IMG_FMT_I ## fmt ## 16: \
27 switch (depth) { \
28 case 8: \
29 return AV_PIX_FMT_YUV ## fmt ## P; \
30 case 10: \
31 return AV_PIX_FMT_YUV ## fmt ## P10; \
32 case 12: \
33 return AV_PIX_FMT_YUV ## fmt ## P12; \
34 default: \
35 return AV_PIX_FMT_NONE; \
36 }
37
38 enum AVPixelFormat ff_aom_imgfmt_to_pixfmt(aom_img_fmt_t img, int depth)
39 {
40 switch (img) {
41 case AOM_IMG_FMT_I420:
42 return AV_PIX_FMT_YUV420P;
43 case AOM_IMG_FMT_I422:
44 return AV_PIX_FMT_YUV422P;
45 case AOM_IMG_FMT_I444:
46 return AV_PIX_FMT_YUV444P;
47 case AOM_IMG_FMT_444A:
48 return AV_PIX_FMT_YUVA444P;
49 HIGH_DEPTH(420)
50 HIGH_DEPTH(422)
51 HIGH_DEPTH(444)
52 default:
53 return AV_PIX_FMT_NONE;
54 }
55 }
56
57 #undef HIGH_DEPTH
58
59 aom_img_fmt_t ff_aom_pixfmt_to_imgfmt(enum AVPixelFormat pix)
60 {
61 switch (pix) {
62 case AV_PIX_FMT_YUV420P:
63 return AOM_IMG_FMT_I420;
64 case AV_PIX_FMT_YUV422P:
65 return AOM_IMG_FMT_I422;
66 case AV_PIX_FMT_YUV444P:
67 return AOM_IMG_FMT_I444;
68 case AV_PIX_FMT_YUVA444P:
69 return AOM_IMG_FMT_444A;
70 case AV_PIX_FMT_YUV420P10:
71 return AOM_IMG_FMT_I42016;
72 case AV_PIX_FMT_YUV422P10:
73 return AOM_IMG_FMT_I42216;
74 case AV_PIX_FMT_YUV444P10:
75 return AOM_IMG_FMT_I44416;
76 case AV_PIX_FMT_YUV420P12:
77 return AOM_IMG_FMT_I42016;
78 case AV_PIX_FMT_YUV422P12:
79 return AOM_IMG_FMT_I42216;
80 case AV_PIX_FMT_YUV444P12:
81 return AOM_IMG_FMT_I44416;
82 default:
83 return AOM_IMG_FMT_NONE;
84 }
85 }