media/omx-plugin/include/gb/pixelflinger/format.h

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 /*
michael@0 2 * Copyright (C) 2005 The Android Open Source Project
michael@0 3 *
michael@0 4 * Licensed under the Apache License, Version 2.0 (the "License");
michael@0 5 * you may not use this file except in compliance with the License.
michael@0 6 * You may obtain a copy of the License at
michael@0 7 *
michael@0 8 * http://www.apache.org/licenses/LICENSE-2.0
michael@0 9 *
michael@0 10 * Unless required by applicable law or agreed to in writing, software
michael@0 11 * distributed under the License is distributed on an "AS IS" BASIS,
michael@0 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
michael@0 13 * See the License for the specific language governing permissions and
michael@0 14 * limitations under the License.
michael@0 15 */
michael@0 16
michael@0 17 #ifndef ANDROID_PIXELFLINGER_FORMAT_H
michael@0 18 #define ANDROID_PIXELFLINGER_FORMAT_H
michael@0 19
michael@0 20 #include <stdint.h>
michael@0 21 #include <sys/types.h>
michael@0 22
michael@0 23 enum GGLPixelFormat {
michael@0 24 // these constants need to match those
michael@0 25 // in graphics/PixelFormat.java, ui/PixelFormat.h, BlitHardware.h
michael@0 26 GGL_PIXEL_FORMAT_UNKNOWN = 0,
michael@0 27 GGL_PIXEL_FORMAT_NONE = 0,
michael@0 28
michael@0 29 GGL_PIXEL_FORMAT_RGBA_8888 = 1, // 4x8-bit ARGB
michael@0 30 GGL_PIXEL_FORMAT_RGBX_8888 = 2, // 3x8-bit RGB stored in 32-bit chunks
michael@0 31 GGL_PIXEL_FORMAT_RGB_888 = 3, // 3x8-bit RGB
michael@0 32 GGL_PIXEL_FORMAT_RGB_565 = 4, // 16-bit RGB
michael@0 33 GGL_PIXEL_FORMAT_BGRA_8888 = 5, // 4x8-bit BGRA
michael@0 34 GGL_PIXEL_FORMAT_RGBA_5551 = 6, // 16-bit RGBA
michael@0 35 GGL_PIXEL_FORMAT_RGBA_4444 = 7, // 16-bit RGBA
michael@0 36
michael@0 37 GGL_PIXEL_FORMAT_A_8 = 8, // 8-bit A
michael@0 38 GGL_PIXEL_FORMAT_L_8 = 9, // 8-bit L (R=G=B = L)
michael@0 39 GGL_PIXEL_FORMAT_LA_88 = 0xA, // 16-bit LA
michael@0 40 GGL_PIXEL_FORMAT_RGB_332 = 0xB, // 8-bit RGB (non paletted)
michael@0 41
michael@0 42 // reserved range. don't use.
michael@0 43 GGL_PIXEL_FORMAT_RESERVED_10 = 0x10,
michael@0 44 GGL_PIXEL_FORMAT_RESERVED_11 = 0x11,
michael@0 45 GGL_PIXEL_FORMAT_RESERVED_12 = 0x12,
michael@0 46 GGL_PIXEL_FORMAT_RESERVED_13 = 0x13,
michael@0 47 GGL_PIXEL_FORMAT_RESERVED_14 = 0x14,
michael@0 48 GGL_PIXEL_FORMAT_RESERVED_15 = 0x15,
michael@0 49 GGL_PIXEL_FORMAT_RESERVED_16 = 0x16,
michael@0 50 GGL_PIXEL_FORMAT_RESERVED_17 = 0x17,
michael@0 51
michael@0 52 // reserved/special formats
michael@0 53 GGL_PIXEL_FORMAT_Z_16 = 0x18,
michael@0 54 GGL_PIXEL_FORMAT_S_8 = 0x19,
michael@0 55 GGL_PIXEL_FORMAT_SZ_24 = 0x1A,
michael@0 56 GGL_PIXEL_FORMAT_SZ_8 = 0x1B,
michael@0 57
michael@0 58 // reserved range. don't use.
michael@0 59 GGL_PIXEL_FORMAT_RESERVED_20 = 0x20,
michael@0 60 GGL_PIXEL_FORMAT_RESERVED_21 = 0x21,
michael@0 61 };
michael@0 62
michael@0 63 enum GGLFormatComponents {
michael@0 64 GGL_STENCIL_INDEX = 0x1901,
michael@0 65 GGL_DEPTH_COMPONENT = 0x1902,
michael@0 66 GGL_ALPHA = 0x1906,
michael@0 67 GGL_RGB = 0x1907,
michael@0 68 GGL_RGBA = 0x1908,
michael@0 69 GGL_LUMINANCE = 0x1909,
michael@0 70 GGL_LUMINANCE_ALPHA = 0x190A,
michael@0 71 };
michael@0 72
michael@0 73 enum GGLFormatComponentIndex {
michael@0 74 GGL_INDEX_ALPHA = 0,
michael@0 75 GGL_INDEX_RED = 1,
michael@0 76 GGL_INDEX_GREEN = 2,
michael@0 77 GGL_INDEX_BLUE = 3,
michael@0 78 GGL_INDEX_STENCIL = 0,
michael@0 79 GGL_INDEX_DEPTH = 1,
michael@0 80 GGL_INDEX_Y = 0,
michael@0 81 GGL_INDEX_CB = 1,
michael@0 82 GGL_INDEX_CR = 2,
michael@0 83 };
michael@0 84
michael@0 85 typedef struct {
michael@0 86 #ifdef __cplusplus
michael@0 87 enum {
michael@0 88 ALPHA = GGL_INDEX_ALPHA,
michael@0 89 RED = GGL_INDEX_RED,
michael@0 90 GREEN = GGL_INDEX_GREEN,
michael@0 91 BLUE = GGL_INDEX_BLUE,
michael@0 92 STENCIL = GGL_INDEX_STENCIL,
michael@0 93 DEPTH = GGL_INDEX_DEPTH,
michael@0 94 LUMA = GGL_INDEX_Y,
michael@0 95 CHROMAB = GGL_INDEX_CB,
michael@0 96 CHROMAR = GGL_INDEX_CR,
michael@0 97 };
michael@0 98 inline uint32_t mask(int i) const {
michael@0 99 return ((1<<(c[i].h-c[i].l))-1)<<c[i].l;
michael@0 100 }
michael@0 101 inline uint32_t bits(int i) const {
michael@0 102 return c[i].h - c[i].l;
michael@0 103 }
michael@0 104 #endif
michael@0 105 uint8_t size; // bytes per pixel
michael@0 106 uint8_t bitsPerPixel;
michael@0 107 union {
michael@0 108 struct {
michael@0 109 uint8_t ah; // alpha high bit position + 1
michael@0 110 uint8_t al; // alpha low bit position
michael@0 111 uint8_t rh; // red high bit position + 1
michael@0 112 uint8_t rl; // red low bit position
michael@0 113 uint8_t gh; // green high bit position + 1
michael@0 114 uint8_t gl; // green low bit position
michael@0 115 uint8_t bh; // blue high bit position + 1
michael@0 116 uint8_t bl; // blue low bit position
michael@0 117 };
michael@0 118 struct {
michael@0 119 uint8_t h;
michael@0 120 uint8_t l;
michael@0 121 } __attribute__((__packed__)) c[4];
michael@0 122 } __attribute__((__packed__));
michael@0 123 uint16_t components; // GGLFormatComponents
michael@0 124 } GGLFormat;
michael@0 125
michael@0 126
michael@0 127 #ifdef __cplusplus
michael@0 128 extern "C" const GGLFormat* gglGetPixelFormatTable(size_t* numEntries = 0);
michael@0 129 #else
michael@0 130 const GGLFormat* gglGetPixelFormatTable(size_t* numEntries);
michael@0 131 #endif
michael@0 132
michael@0 133
michael@0 134 // ----------------------------------------------------------------------------
michael@0 135
michael@0 136 #endif // ANDROID_PIXELFLINGER_FORMAT_H

mercurial