1 /* 2 * Copyright 2021 Rockchip Electronics Co. LTD 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 * 16 */ 17 18 #ifndef SRC_TESTS_RT_MPI_COMMON_TEST_COMM_BMP_H_ 19 #define SRC_TESTS_RT_MPI_COMMON_TEST_COMM_BMP_H_ 20 21 #include "rk_type.h" 22 23 #ifdef __cplusplus 24 #if __cplusplus 25 extern "C" { 26 #endif 27 #endif /* End of #ifdef __cplusplus */ 28 29 30 /* the color format OSD supported */ 31 typedef enum rkOSD_COLOR_FMT_E { 32 OSD_COLOR_FMT_RGB444 = 0, 33 OSD_COLOR_FMT_ARGB4444 = 1, 34 OSD_COLOR_FMT_BGRA4444 = 2, 35 OSD_COLOR_FMT_RGB555 = 3, 36 OSD_COLOR_FMT_RGB565 = 4, 37 OSD_COLOR_FMT_ARGB1555 = 5, 38 OSD_COLOR_FMT_BGRA5551 = 6, 39 OSD_COLOR_FMT_RGB888 = 7, 40 OSD_COLOR_FMT_BGR888 = 8, 41 OSD_COLOR_FMT_ARGB8888 = 9, 42 OSD_COLOR_FMT_BGRA8888 = 10, 43 OSD_COLOR_FMT_BUTT 44 } OSD_COLOR_FMT_E; 45 46 typedef struct rkOSD_RGB_S { 47 RK_U8 u8B; 48 RK_U8 u8G; 49 RK_U8 u8R; 50 RK_U8 u8Reserved; 51 } OSD_RGB_S; 52 53 typedef struct rkOSD_SURFACE_S { 54 OSD_COLOR_FMT_E enColorFmt; /* color format */ 55 RK_U8 *pu8PhyAddr; /* physical address */ 56 RK_U16 u16Height; /* operation height */ 57 RK_U16 u16Width; /* operation width */ 58 RK_U16 u16Stride; /* surface stride */ 59 RK_U16 u16Reserved; 60 } OSD_SURFACE_S; 61 62 typedef struct tag_OSD_Logo { 63 RK_U32 width; /* out */ 64 RK_U32 height; /* out */ 65 RK_U32 stride; /* in */ 66 RK_U8 * pRGBBuffer; /* in/out */ 67 } OSD_LOGO_T; 68 69 typedef struct tag_OSD_BITMAPINFOHEADER { 70 RK_U16 biSize; 71 RK_U32 biWidth; 72 RK_S32 biHeight; 73 RK_U16 biPlanes; 74 RK_U16 biBitCount; 75 RK_U32 biCompression; 76 RK_U32 biSizeImage; 77 RK_U32 biXPelsPerMeter; 78 RK_U32 biYPelsPerMeter; 79 RK_U32 biClrUsed; 80 RK_U32 biClrImportant; 81 } OSD_BITMAPINFOHEADER; 82 83 typedef struct tag_OSD_BITMAPFILEHEADER { 84 RK_U32 bfSize; 85 RK_U16 bfReserved1; 86 RK_U16 bfReserved2; 87 RK_U32 bfOffBits; 88 } OSD_BITMAPFILEHEADER; 89 90 typedef struct tag_OSD_RGBQUAD { 91 RK_U8 rgbBlue; 92 RK_U8 rgbGreen; 93 RK_U8 rgbRed; 94 RK_U8 rgbReserved; 95 } OSD_RGBQUAD; 96 97 typedef struct tag_OSD_BITMAPINFO { 98 OSD_BITMAPINFOHEADER bmiHeader; 99 OSD_RGBQUAD bmiColors[1]; 100 } OSD_BITMAPINFO; 101 102 typedef struct rkOSD_COMPONENT_INFO_S { 103 RK_S32 alen; 104 RK_S32 rlen; 105 RK_S32 glen; 106 RK_S32 blen; 107 } OSD_COMP_INFO; 108 109 RK_S32 TEST_COMM_LoadImage(const char *filename, OSD_LOGO_T *pVideoLogo); 110 RK_S32 TEST_COMM_LoadBitmap2Surface(const char *pstFileName, const OSD_SURFACE_S *pstSurface, RK_U8 *pu8Virt); 111 RK_S32 TEST_COMM_CreateSurfaceByBitmap(const char *pstFileName, OSD_SURFACE_S *pstSurface, RK_U8 *pu8Virt); 112 RK_S32 TEST_COMM_GetBmpInfo(const char *filename, OSD_BITMAPFILEHEADER *pBmpFileHeader, OSD_BITMAPINFO *pBmpInfo); 113 114 #ifdef __cplusplus 115 #if __cplusplus 116 } 117 #endif 118 #endif /* End of #ifdef __cplusplus */ 119 120 #endif // SRC_TESTS_RT_MPI_COMMON_TEST_COMM_BMP_H_ 121