1 // VaapiImageFormat.cpp: VA image format abstraction
3 // Copyright (C) 2009, 2010 Free Software Foundation, Inc.
5 // This program is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation; either version 3 of the License, or
8 // (at your option) any later version.
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software
17 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20 #include "VaapiImageFormat.h"
22 // Get colorspace for the specified image format
23 VaapiColorspace
vaapi_image_format_get_colorspace(VaapiImageFormat format
)
26 case VAAPI_IMAGE_NV12
:
27 case VAAPI_IMAGE_YV12
:
28 case VAAPI_IMAGE_I420
:
29 return VAAPI_COLORSPACE_YUV
;
30 case VAAPI_IMAGE_ARGB
:
31 case VAAPI_IMAGE_RGBA
:
32 case VAAPI_IMAGE_ABGR
:
33 case VAAPI_IMAGE_BGRA
:
34 case VAAPI_IMAGE_RGB32
:
35 case VAAPI_IMAGE_RGB24
:
36 return VAAPI_COLORSPACE_RGB
;
39 return VAAPI_COLORSPACE_UNKNOWN
;
42 // Return image format from a VA image format
43 VaapiImageFormat
vaapi_get_image_format(VAImageFormat
const &format
)
45 // XXX: check RGB formats and endianess
46 return static_cast<VaapiImageFormat
>(format
.fourcc
);
51 // indent-tabs-mode: nil