]>
Commit | Line | Data |
---|---|---|
a48d0a3d CS |
1 | /** @file\r |
2 | This protocol provides generic image decoder interfaces to various image formats.\r | |
3 | \r | |
4 | (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>\r | |
497a5fb1 | 5 | Copyright (c) 2016-2018, Intel Corporation. All rights reserved.<BR>\r |
a48d0a3d | 6 | \r |
9344f092 | 7 | SPDX-License-Identifier: BSD-2-Clause-Patent\r |
a48d0a3d | 8 | \r |
497a5fb1 SZ |
9 | @par Revision Reference:\r |
10 | This Protocol was introduced in UEFI Specification 2.6.\r | |
11 | \r | |
a48d0a3d | 12 | **/\r |
75f273d8 RN |
13 | #ifndef __HII_IMAGE_DECODER_H__\r |
14 | #define __HII_IMAGE_DECODER_H__\r | |
a48d0a3d CS |
15 | \r |
16 | #include <Protocol/HiiImage.h>\r | |
17 | \r | |
a48d0a3d | 18 | #define EFI_HII_IMAGE_DECODER_PROTOCOL_GUID \\r |
d35ec1e0 | 19 | {0x9e66f251, 0x727c, 0x418c, { 0xbf, 0xd6, 0xc2, 0xb4, 0x25, 0x28, 0x18, 0xea }}\r |
a48d0a3d CS |
20 | \r |
21 | \r | |
22 | #define EFI_HII_IMAGE_DECODER_NAME_JPEG_GUID \\r | |
23 | {0xefefd093, 0xd9b, 0x46eb, { 0xa8, 0x56, 0x48, 0x35, 0x7, 0x0, 0xc9, 0x8 }}\r | |
24 | \r | |
25 | #define EFI_HII_IMAGE_DECODER_NAME_PNG_GUID \\r | |
26 | {0xaf060190, 0x5e3a, 0x4025, { 0xaf, 0xbd, 0xe1, 0xf9, 0x5, 0xbf, 0xaa, 0x4c }}\r | |
27 | \r | |
28 | typedef struct _EFI_HII_IMAGE_DECODER_PROTOCOL EFI_HII_IMAGE_DECODER_PROTOCOL;\r | |
29 | \r | |
30 | typedef enum {\r | |
31 | EFI_HII_IMAGE_DECODER_COLOR_TYPE_RGB = 0x0,\r | |
32 | EFI_HII_IMAGE_DECODER_COLOR_TYPE_RGBA = 0x1,\r | |
33 | EFI_HII_IMAGE_DECODER_COLOR_TYPE_CMYK = 0x2,\r | |
34 | EFI_HII_IMAGE_DECODER_COLOR_TYPE_UNKNOWN = 0xFF\r | |
35 | } EFI_HII_IMAGE_DECODER_COLOR_TYPE;\r | |
36 | \r | |
37 | //\r | |
38 | // EFI_HII_IMAGE_DECODER_IMAGE_INFO_HEADER\r | |
39 | //\r | |
40 | // DecoderName Name of the decoder\r | |
41 | // ImageInfoSize The size of entire image information structure in bytes\r | |
42 | // ImageWidth The image width\r | |
43 | // ImageHeight The image height\r | |
44 | // ColorType The color type, see EFI_HII_IMAGE_DECODER_COLOR_TYPE.\r | |
45 | // ColorDepthInBits The color depth in bits\r | |
46 | //\r | |
47 | typedef struct _EFI_HII_IMAGE_DECODER_IMAGE_INFO_HEADER {\r | |
48 | EFI_GUID DecoderName;\r | |
49 | UINT16 ImageInfoSize;\r | |
50 | UINT16 ImageWidth;\r | |
51 | UINT16 ImageHeight;\r | |
52 | EFI_HII_IMAGE_DECODER_COLOR_TYPE ColorType;\r | |
53 | UINT8 ColorDepthInBits;\r | |
54 | } EFI_HII_IMAGE_DECODER_IMAGE_INFO_HEADER;\r | |
55 | \r | |
75f273d8 RN |
56 | #define EFI_IMAGE_JPEG_SCANTYPE_PROGREESSIVE 0x01\r |
57 | #define EFI_IMAGE_JPEG_SCANTYPE_INTERLACED 0x02\r | |
58 | \r | |
a48d0a3d CS |
59 | //\r |
60 | // EFI_HII_IMAGE_DECODER_JPEG_INFO\r | |
61 | // Header The common header\r | |
62 | // ScanType The scan type of JPEG image\r | |
63 | // Reserved Reserved\r | |
64 | //\r | |
65 | typedef struct _EFI_HII_IMAGE_DECODER_JPEG_INFO {\r | |
66 | EFI_HII_IMAGE_DECODER_IMAGE_INFO_HEADER Header;\r | |
a48d0a3d CS |
67 | UINT16 ScanType;\r |
68 | UINT64 Reserved;\r | |
69 | } EFI_HII_IMAGE_DECODER_JPEG_INFO;\r | |
70 | \r | |
71 | //\r | |
72 | // EFI_HII_IMAGE_DECODER_PNG_INFO\r | |
73 | // Header The common header\r | |
74 | // Channels Number of channels in the PNG image\r | |
75 | // Reserved Reserved\r | |
76 | //\r | |
77 | typedef struct _EFI_HII_IMAGE_DECODER_PNG_INFO {\r | |
78 | EFI_HII_IMAGE_DECODER_IMAGE_INFO_HEADER Header;\r | |
79 | UINT16 Channels;\r | |
80 | UINT64 Reserved;\r | |
81 | } EFI_HII_IMAGE_DECODER_PNG_INFO;\r | |
82 | \r | |
75f273d8 RN |
83 | //\r |
84 | // EFI_HII_IMAGE_DECODER_OTHER_INFO\r | |
85 | //\r | |
86 | typedef struct _EFI_HII_IMAGE_DECODER_OTHER_INFO {\r | |
87 | EFI_HII_IMAGE_DECODER_IMAGE_INFO_HEADER Header;\r | |
88 | CHAR16 ImageExtenion[1];\r | |
89 | //\r | |
90 | // Variable length of image file extension name.\r | |
91 | //\r | |
92 | } EFI_HII_IMAGE_DECODER_OTHER_INFO;\r | |
93 | \r | |
a48d0a3d CS |
94 | /**\r |
95 | There could be more than one EFI_HII_IMAGE_DECODER_PROTOCOL instances installed\r | |
96 | in the system for different image formats. This function returns the decoder\r | |
97 | name which callers can use to find the proper image decoder for the image. It\r | |
98 | is possible to support multiple image formats in one EFI_HII_IMAGE_DECODER_PROTOCOL.\r | |
99 | The capability of the supported image formats is returned in DecoderName and\r | |
100 | NumberOfDecoderName.\r | |
101 | \r | |
102 | @param This EFI_HII_IMAGE_DECODER_PROTOCOL instance.\r | |
103 | @param DecoderName Pointer to a dimension to retrieve the decoder\r | |
104 | names in EFI_GUID format. The number of the\r | |
105 | decoder names is returned in NumberOfDecoderName.\r | |
106 | @param NumberofDecoderName Pointer to retrieve the number of decoders which\r | |
107 | supported by this decoder driver.\r | |
108 | \r | |
109 | @retval EFI_SUCCESS Get decoder name success.\r | |
110 | @retval EFI_UNSUPPORTED Get decoder name fail.\r | |
111 | \r | |
112 | **/\r | |
113 | typedef\r | |
114 | EFI_STATUS\r | |
75f273d8 | 115 | (EFIAPI *EFI_HII_IMAGE_DECODER_GET_NAME)(\r |
a48d0a3d CS |
116 | IN EFI_HII_IMAGE_DECODER_PROTOCOL *This,\r |
117 | IN OUT EFI_GUID **DecoderName,\r | |
75f273d8 | 118 | IN OUT UINT16 *NumberOfDecoderName\r |
a48d0a3d CS |
119 | );\r |
120 | \r | |
121 | /**\r | |
122 | This function returns the image information of the given image raw data. This\r | |
123 | function first checks whether the image raw data is supported by this decoder\r | |
124 | or not. This function may go through the first few bytes in the image raw data\r | |
125 | for the specific data structure or the image signature. If the image is not supported\r | |
126 | by this image decoder, this function returns EFI_UNSUPPORTED to the caller.\r | |
127 | Otherwise, this function returns the proper image information to the caller.\r | |
128 | It is the caller?s responsibility to free the ImageInfo.\r | |
129 | \r | |
130 | @param This EFI_HII_IMAGE_DECODER_PROTOCOL instance.\r | |
131 | @param Image Pointer to the image raw data.\r | |
132 | @param SizeOfImage Size of the entire image raw data.\r | |
00b7cc0f | 133 | @param ImageInfo Pointer to receive EFI_HII_IMAGE_DECODER_IMAGE_INFO_HEADER.\r |
a48d0a3d CS |
134 | \r |
135 | @retval EFI_SUCCESS Get image info success.\r | |
136 | @retval EFI_UNSUPPORTED Unsupported format of image.\r | |
137 | @retval EFI_INVALID_PARAMETER Incorrect parameter.\r | |
138 | @retval EFI_BAD_BUFFER_SIZE Not enough memory.\r | |
139 | \r | |
140 | **/\r | |
141 | typedef\r | |
142 | EFI_STATUS\r | |
143 | (EFIAPI *EFI_HII_IMAGE_DECODER_GET_IMAGE_INFO)(\r | |
144 | IN EFI_HII_IMAGE_DECODER_PROTOCOL *This,\r | |
145 | IN VOID *Image,\r | |
146 | IN UINTN SizeOfImage,\r | |
147 | IN OUT EFI_HII_IMAGE_DECODER_IMAGE_INFO_HEADER **ImageInfo\r | |
148 | );\r | |
149 | \r | |
150 | /**\r | |
151 | This function decodes the image which the image type of this image is supported\r | |
152 | by this EFI_HII_IMAGE_DECODER_PROTOCOL. If **Bitmap is not NULL, the caller intends\r | |
153 | to put the image in the given image buffer. That allows the caller to put an\r | |
154 | image overlap on the original image. The transparency is handled by the image\r | |
155 | decoder because the transparency capability depends on the image format. Callers\r | |
156 | can set Transparent to FALSE to force disabling the transparency process on the\r | |
157 | image. Forcing Transparent to FALSE may also improve the performance of the image\r | |
158 | decoding because the image decoder can skip the transparency processing. If **Bitmap\r | |
159 | is NULL, the image decoder allocates the memory buffer for the EFI_IMAGE_OUTPUT\r | |
160 | and decodes the image to the image buffer. It is the caller?s responsibility to\r | |
161 | free the memory for EFI_IMAGE_OUTPUT. Image decoder doesn?t have to handle the\r | |
162 | transparency in this case because there is no background image given by the caller.\r | |
163 | The background color in this case is all black (#00000000).\r | |
164 | \r | |
165 | @param This EFI_HII_IMAGE_DECODER_PROTOCOL instance.\r | |
166 | @param Image Pointer to the image raw data.\r | |
167 | @param ImageRawDataSize Size of the entire image raw data.\r | |
168 | @param Blt EFI_IMAGE_OUTPUT to receive the image or overlap\r | |
169 | the image on the original buffer.\r | |
170 | @param Transparent BOOLEAN value indicates whether the image decoder\r | |
171 | has to handle the transparent image or not.\r | |
172 | \r | |
173 | \r | |
174 | @retval EFI_SUCCESS Image decode success.\r | |
175 | @retval EFI_UNSUPPORTED Unsupported format of image.\r | |
176 | @retval EFI_INVALID_PARAMETER Incorrect parameter.\r | |
177 | @retval EFI_BAD_BUFFER_SIZE Not enough memory.\r | |
178 | \r | |
179 | **/\r | |
180 | typedef\r | |
181 | EFI_STATUS\r | |
182 | (EFIAPI *EFI_HII_IMAGE_DECODER_DECODE)(\r | |
183 | IN EFI_HII_IMAGE_DECODER_PROTOCOL *This,\r | |
184 | IN VOID *Image,\r | |
185 | IN UINTN ImageRawDataSize,\r | |
75f273d8 | 186 | IN OUT EFI_IMAGE_OUTPUT **Bitmap,\r |
a48d0a3d CS |
187 | IN BOOLEAN Transparent\r |
188 | );\r | |
189 | \r | |
190 | struct _EFI_HII_IMAGE_DECODER_PROTOCOL {\r | |
75f273d8 | 191 | EFI_HII_IMAGE_DECODER_GET_NAME GetImageDecoderName;\r |
a48d0a3d CS |
192 | EFI_HII_IMAGE_DECODER_GET_IMAGE_INFO GetImageInfo;\r |
193 | EFI_HII_IMAGE_DECODER_DECODE DecodeImage;\r | |
194 | };\r | |
195 | \r | |
196 | extern EFI_GUID gEfiHiiImageDecoderProtocolGuid;\r | |
197 | extern EFI_GUID gEfiHiiImageDecoderNameJpegGuid;\r | |
198 | extern EFI_GUID gEfiHiiImageDecoderNamePngGuid;\r | |
199 | \r | |
200 | #endif\r |