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

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/media/omx-plugin/include/froyo/pixelflinger/format.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,136 @@
     1.4 +/*
     1.5 + * Copyright (C) 2005 The Android Open Source Project
     1.6 + *
     1.7 + * Licensed under the Apache License, Version 2.0 (the "License");
     1.8 + * you may not use this file except in compliance with the License.
     1.9 + * You may obtain a copy of the License at
    1.10 + *
    1.11 + *      http://www.apache.org/licenses/LICENSE-2.0
    1.12 + *
    1.13 + * Unless required by applicable law or agreed to in writing, software
    1.14 + * distributed under the License is distributed on an "AS IS" BASIS,
    1.15 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    1.16 + * See the License for the specific language governing permissions and
    1.17 + * limitations under the License.
    1.18 + */
    1.19 +
    1.20 +#ifndef ANDROID_PIXELFLINGER_FORMAT_H
    1.21 +#define ANDROID_PIXELFLINGER_FORMAT_H
    1.22 +
    1.23 +#include <stdint.h>
    1.24 +#include <sys/types.h>
    1.25 +
    1.26 +enum GGLPixelFormat {
    1.27 +    // these constants need to match those
    1.28 +    // in graphics/PixelFormat.java, ui/PixelFormat.h, BlitHardware.h
    1.29 +    GGL_PIXEL_FORMAT_UNKNOWN    =   0,
    1.30 +    GGL_PIXEL_FORMAT_NONE       =   0,
    1.31 +
    1.32 +    GGL_PIXEL_FORMAT_RGBA_8888   =   1,  // 4x8-bit ARGB
    1.33 +    GGL_PIXEL_FORMAT_RGBX_8888   =   2,  // 3x8-bit RGB stored in 32-bit chunks
    1.34 +    GGL_PIXEL_FORMAT_RGB_888     =   3,  // 3x8-bit RGB
    1.35 +    GGL_PIXEL_FORMAT_RGB_565     =   4,  // 16-bit RGB
    1.36 +    GGL_PIXEL_FORMAT_BGRA_8888   =   5,  // 4x8-bit BGRA
    1.37 +    GGL_PIXEL_FORMAT_RGBA_5551   =   6,  // 16-bit RGBA
    1.38 +    GGL_PIXEL_FORMAT_RGBA_4444   =   7,  // 16-bit RGBA
    1.39 +
    1.40 +    GGL_PIXEL_FORMAT_A_8         =   8,  // 8-bit A
    1.41 +    GGL_PIXEL_FORMAT_L_8         =   9,  // 8-bit L (R=G=B = L)
    1.42 +    GGL_PIXEL_FORMAT_LA_88       = 0xA,  // 16-bit LA
    1.43 +    GGL_PIXEL_FORMAT_RGB_332     = 0xB,  // 8-bit RGB (non paletted)
    1.44 +
    1.45 +    // reserved range. don't use.
    1.46 +    GGL_PIXEL_FORMAT_RESERVED_10 = 0x10,
    1.47 +    GGL_PIXEL_FORMAT_RESERVED_11 = 0x11,
    1.48 +    GGL_PIXEL_FORMAT_RESERVED_12 = 0x12,
    1.49 +    GGL_PIXEL_FORMAT_RESERVED_13 = 0x13,
    1.50 +    GGL_PIXEL_FORMAT_RESERVED_14 = 0x14,
    1.51 +    GGL_PIXEL_FORMAT_RESERVED_15 = 0x15,
    1.52 +    GGL_PIXEL_FORMAT_RESERVED_16 = 0x16,
    1.53 +    GGL_PIXEL_FORMAT_RESERVED_17 = 0x17,
    1.54 +
    1.55 +    // reserved/special formats
    1.56 +    GGL_PIXEL_FORMAT_Z_16       =  0x18,
    1.57 +    GGL_PIXEL_FORMAT_S_8        =  0x19,
    1.58 +    GGL_PIXEL_FORMAT_SZ_24      =  0x1A,
    1.59 +    GGL_PIXEL_FORMAT_SZ_8       =  0x1B,
    1.60 +
    1.61 +    // reserved range. don't use.
    1.62 +    GGL_PIXEL_FORMAT_RESERVED_20 = 0x20,
    1.63 +    GGL_PIXEL_FORMAT_RESERVED_21 = 0x21,
    1.64 +};
    1.65 +
    1.66 +enum GGLFormatComponents {
    1.67 +	GGL_STENCIL_INDEX		= 0x1901,
    1.68 +	GGL_DEPTH_COMPONENT		= 0x1902,
    1.69 +	GGL_ALPHA				= 0x1906,
    1.70 +	GGL_RGB					= 0x1907,
    1.71 +	GGL_RGBA				= 0x1908,
    1.72 +	GGL_LUMINANCE			= 0x1909,
    1.73 +	GGL_LUMINANCE_ALPHA		= 0x190A,
    1.74 +};
    1.75 +
    1.76 +enum GGLFormatComponentIndex {
    1.77 +    GGL_INDEX_ALPHA   = 0,
    1.78 +    GGL_INDEX_RED     = 1,
    1.79 +    GGL_INDEX_GREEN   = 2,
    1.80 +    GGL_INDEX_BLUE    = 3,
    1.81 +    GGL_INDEX_STENCIL = 0,
    1.82 +    GGL_INDEX_DEPTH   = 1,
    1.83 +    GGL_INDEX_Y       = 0,
    1.84 +    GGL_INDEX_CB      = 1,
    1.85 +    GGL_INDEX_CR      = 2,
    1.86 +};
    1.87 +
    1.88 +typedef struct {
    1.89 +#ifdef __cplusplus
    1.90 +    enum {
    1.91 +        ALPHA   = GGL_INDEX_ALPHA,
    1.92 +        RED     = GGL_INDEX_RED,
    1.93 +        GREEN   = GGL_INDEX_GREEN,
    1.94 +        BLUE    = GGL_INDEX_BLUE,
    1.95 +        STENCIL = GGL_INDEX_STENCIL,
    1.96 +        DEPTH   = GGL_INDEX_DEPTH,
    1.97 +        LUMA    = GGL_INDEX_Y,
    1.98 +        CHROMAB = GGL_INDEX_CB,
    1.99 +        CHROMAR = GGL_INDEX_CR,
   1.100 +    };
   1.101 +    inline uint32_t mask(int i) const {
   1.102 +            return ((1<<(c[i].h-c[i].l))-1)<<c[i].l;
   1.103 +    }
   1.104 +    inline uint32_t bits(int i) const {
   1.105 +            return c[i].h - c[i].l;
   1.106 +    }
   1.107 +#endif
   1.108 +	uint8_t     size;	// bytes per pixel
   1.109 +    uint8_t     bitsPerPixel;
   1.110 +    union {    
   1.111 +        struct {
   1.112 +            uint8_t     ah;		// alpha high bit position + 1
   1.113 +            uint8_t     al;		// alpha low bit position
   1.114 +            uint8_t     rh;		// red high bit position + 1
   1.115 +            uint8_t     rl;		// red low bit position
   1.116 +            uint8_t     gh;		// green high bit position + 1
   1.117 +            uint8_t     gl;		// green low bit position
   1.118 +            uint8_t     bh;		// blue high bit position + 1
   1.119 +            uint8_t     bl;		// blue low bit position
   1.120 +        };
   1.121 +        struct {
   1.122 +            uint8_t h;
   1.123 +            uint8_t l;
   1.124 +        } __attribute__((__packed__)) c[4];        
   1.125 +    } __attribute__((__packed__));
   1.126 +	uint16_t    components;	// GGLFormatComponents
   1.127 +} GGLFormat;
   1.128 +
   1.129 +
   1.130 +#ifdef __cplusplus
   1.131 +extern "C" const GGLFormat* gglGetPixelFormatTable(size_t* numEntries = 0);
   1.132 +#else
   1.133 +const GGLFormat* gglGetPixelFormatTable(size_t* numEntries);
   1.134 +#endif
   1.135 +
   1.136 +
   1.137 +// ----------------------------------------------------------------------------
   1.138 +
   1.139 +#endif // ANDROID_PIXELFLINGER_FORMAT_H

mercurial