1 /* copyright (c) 2012, code aurora forum. all rights reserved. 2 * 3 * redistribution and use in source and binary forms, with or without 4 * modification, are permitted provided that the following conditions are 5 * met: 6 * * redistributions of source code must retain the above copyright 7 * notice, this list of conditions and the following disclaimer. 8 * * redistributions in binary form must reproduce the above 9 * copyright notice, this list of conditions and the following 10 * disclaimer in the documentation and/or other materials provided 11 * with the distribution. 12 * * neither the name of code aurora forum, inc. nor the names of its 13 * contributors may be used to endorse or promote products derived 14 * from this software without specific prior written permission. 15 * 16 * this software is provided "as is" and any express or implied 17 * warranties, including, but not limited to, the implied warranties of 18 * merchantability, fitness for a particular purpose and non-infringement 19 * are disclaimed. in no event shall the copyright owner or contributors 20 * be liable for any direct, indirect, incidental, special, exemplary, or 21 * consequential damages (including, but not limited to, procurement of 22 * substitute goods or services; loss of use, data, or profits; or 23 * business interruption) however caused and on any theory of liability, 24 * whether in contract, strict liability, or tort (including negligence 25 * or otherwise) arising in any way out of the use of this software, even 26 * if advised of the possibility of such damage. 27 * 28 */ 29 /*-------------------------------------------------------------------------- 30 Copyright (c) 2012 Code Aurora Forum. All rights reserved. 31 --------------------------------------------------------------------------*/ 32 33 #ifndef C2D_ColorConverter_H_ 34 #define C2D_ColorConverter_H_ 35 36 #include <c2d2.h> 37 #include <ColorConverter.h> 38 #include <sys/types.h> 39 40 typedef C2D_STATUS (*LINK_c2dCreateSurface)( uint32 *surface_id, 41 uint32 surface_bits, 42 C2D_SURFACE_TYPE surface_type, 43 void *surface_definition ); 44 45 typedef C2D_STATUS (*LINK_c2dUpdateSurface)( uint32 surface_id, 46 uint32 surface_bits, 47 C2D_SURFACE_TYPE surface_type, 48 void *surface_definition ); 49 50 typedef C2D_STATUS (*LINK_c2dReadSurface)( uint32 surface_id, 51 C2D_SURFACE_TYPE surface_type, 52 void *surface_definition, 53 int32 x, int32 y ); 54 55 typedef C2D_STATUS (*LINK_c2dDraw)( uint32 target_id, 56 uint32 target_config, C2D_RECT *target_scissor, 57 uint32 target_mask_id, uint32 target_color_key, 58 C2D_OBJECT *objects_list, uint32 num_objects ); 59 60 typedef C2D_STATUS (*LINK_c2dFlush)( uint32 target_id, c2d_ts_handle *timestamp); 61 62 typedef C2D_STATUS (*LINK_c2dFinish)( uint32 target_id); 63 64 typedef C2D_STATUS (*LINK_c2dWaitTimestamp)( c2d_ts_handle timestamp ); 65 66 typedef C2D_STATUS (*LINK_c2dDestroySurface)( uint32 surface_id ); 67 68 namespace android { 69 70 enum ColorConvertFormat { 71 RGB565 = 1, 72 YCbCr420Tile, 73 YCbCr420SP, 74 YCbCr420P, 75 YCrCb420P, 76 RGBA8888, 77 NV12_2K, 78 }; 79 80 typedef struct { 81 int32_t width; 82 int32_t height; 83 int32_t stride; 84 int32_t sliceHeight; 85 int32_t lumaAlign; 86 int32_t sizeAlign; 87 int32_t size; 88 } C2DBuffReq; 89 90 typedef enum { 91 C2D_INPUT = 0, 92 C2D_OUTPUT, 93 } C2D_PORT; 94 95 class C2DColorConverterBase { 96 97 public: 98 virtual ~C2DColorConverterBase(){}; 99 virtual int convertC2D(int srcFd, void * srcData, int dstFd, void * dstData) = 0; 100 virtual int32_t getBuffReq(int32_t port, C2DBuffReq *req) = 0; 101 virtual int32_t dumpOutput(char * filename, char mode) = 0; 102 }; 103 104 typedef C2DColorConverterBase* createC2DColorConverter_t(size_t srcWidth, size_t srcHeight, size_t dstWidth, size_t dstHeight, ColorConvertFormat srcFormat, ColorConvertFormat dstFormat, int32_t flags); 105 typedef void destroyC2DColorConverter_t(C2DColorConverterBase*); 106 107 } 108 109 #endif // C2D_ColorConverter_H_ 110