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