]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Include/Protocol/ImageDecoder.h
MdeModulePkg/PciSioSerialDxe: Remove unused global variables
[mirror_edk2.git] / MdePkg / Include / Protocol / ImageDecoder.h
1 /** @file
2 This protocol provides generic image decoder interfaces to various image formats.
3
4 (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>
5
6 This program and the accompanying materials are licensed and made available under
7 the terms and conditions of the BSD License that accompanies this distribution.
8 The full text of the license may be found at
9 http://opensource.org/licenses/bsd-license.php.
10
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
13
14 **/
15 #ifndef __EFI_IMAGE_DECODER_PROTOCOL_H__
16 #define __EFI_IMAGE_DECODER_PROTOCOL_H__
17
18 #include <Protocol/HiiImage.h>
19
20
21 //
22 // In UEFI 2.6 spec,this guid value is duplicate with
23 // EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_GUID. Now update this guid value to
24 // avoid the duplicate guid issue. So its value is not consistent with
25 // UEFI spec definition now. We have proposed to update UEFI spec to
26 // use this new guid. After new spec released, we will remove this
27 // comments.
28 //
29 #define EFI_HII_IMAGE_DECODER_PROTOCOL_GUID \
30 {0x9e66f251, 0x727c, 0x418c, { 0xbf, 0xd6, 0xc2, 0xb4, 0x25, 0x28, 0x18, 0xea }}
31
32
33 #define EFI_HII_IMAGE_DECODER_NAME_JPEG_GUID \
34 {0xefefd093, 0xd9b, 0x46eb, { 0xa8, 0x56, 0x48, 0x35, 0x7, 0x0, 0xc9, 0x8 }}
35
36 #define EFI_HII_IMAGE_DECODER_NAME_PNG_GUID \
37 {0xaf060190, 0x5e3a, 0x4025, { 0xaf, 0xbd, 0xe1, 0xf9, 0x5, 0xbf, 0xaa, 0x4c }}
38
39 typedef struct _EFI_HII_IMAGE_DECODER_PROTOCOL EFI_HII_IMAGE_DECODER_PROTOCOL;
40
41 typedef enum {
42 EFI_HII_IMAGE_DECODER_COLOR_TYPE_RGB = 0x0,
43 EFI_HII_IMAGE_DECODER_COLOR_TYPE_RGBA = 0x1,
44 EFI_HII_IMAGE_DECODER_COLOR_TYPE_CMYK = 0x2,
45 EFI_HII_IMAGE_DECODER_COLOR_TYPE_UNKNOWN = 0xFF
46 } EFI_HII_IMAGE_DECODER_COLOR_TYPE;
47
48 //
49 // EFI_HII_IMAGE_DECODER_IMAGE_INFO_HEADER
50 //
51 // DecoderName Name of the decoder
52 // ImageInfoSize The size of entire image information structure in bytes
53 // ImageWidth The image width
54 // ImageHeight The image height
55 // ColorType The color type, see EFI_HII_IMAGE_DECODER_COLOR_TYPE.
56 // ColorDepthInBits The color depth in bits
57 //
58 typedef struct _EFI_HII_IMAGE_DECODER_IMAGE_INFO_HEADER {
59 EFI_GUID DecoderName;
60 UINT16 ImageInfoSize;
61 UINT16 ImageWidth;
62 UINT16 ImageHeight;
63 EFI_HII_IMAGE_DECODER_COLOR_TYPE ColorType;
64 UINT8 ColorDepthInBits;
65 } EFI_HII_IMAGE_DECODER_IMAGE_INFO_HEADER;
66
67 //
68 // EFI_HII_IMAGE_DECODER_JPEG_INFO
69 // Header The common header
70 // ScanType The scan type of JPEG image
71 // Reserved Reserved
72 //
73 typedef struct _EFI_HII_IMAGE_DECODER_JPEG_INFO {
74 EFI_HII_IMAGE_DECODER_IMAGE_INFO_HEADER Header;
75
76 #define EFI_IMAGE_JPEG_SCANTYPE_PROGREESSIVE 0x01
77 #define EFI_IMAGE_JPEG_SCANTYPE_INTERLACED 0x02
78 UINT16 ScanType;
79 UINT64 Reserved;
80 } EFI_HII_IMAGE_DECODER_JPEG_INFO;
81
82 //
83 // EFI_HII_IMAGE_DECODER_PNG_INFO
84 // Header The common header
85 // Channels Number of channels in the PNG image
86 // Reserved Reserved
87 //
88 typedef struct _EFI_HII_IMAGE_DECODER_PNG_INFO {
89 EFI_HII_IMAGE_DECODER_IMAGE_INFO_HEADER Header;
90 UINT16 Channels;
91 UINT64 Reserved;
92 } EFI_HII_IMAGE_DECODER_PNG_INFO;
93
94 /**
95 There could be more than one EFI_HII_IMAGE_DECODER_PROTOCOL instances installed
96 in the system for different image formats. This function returns the decoder
97 name which callers can use to find the proper image decoder for the image. It
98 is possible to support multiple image formats in one EFI_HII_IMAGE_DECODER_PROTOCOL.
99 The capability of the supported image formats is returned in DecoderName and
100 NumberOfDecoderName.
101
102 @param This EFI_HII_IMAGE_DECODER_PROTOCOL instance.
103 @param DecoderName Pointer to a dimension to retrieve the decoder
104 names in EFI_GUID format. The number of the
105 decoder names is returned in NumberOfDecoderName.
106 @param NumberofDecoderName Pointer to retrieve the number of decoders which
107 supported by this decoder driver.
108
109 @retval EFI_SUCCESS Get decoder name success.
110 @retval EFI_UNSUPPORTED Get decoder name fail.
111
112 **/
113 typedef
114 EFI_STATUS
115 (EFIAPI *EFI_HII_IMAGE_DECODER_GET_DECODER_NAME)(
116 IN EFI_HII_IMAGE_DECODER_PROTOCOL *This,
117 IN OUT EFI_GUID **DecoderName,
118 IN OUT UINT16 *NumberofDecoderName
119 );
120
121 /**
122 This function returns the image information of the given image raw data. This
123 function first checks whether the image raw data is supported by this decoder
124 or not. This function may go through the first few bytes in the image raw data
125 for the specific data structure or the image signature. If the image is not supported
126 by this image decoder, this function returns EFI_UNSUPPORTED to the caller.
127 Otherwise, this function returns the proper image information to the caller.
128 It is the caller?s responsibility to free the ImageInfo.
129
130 @param This EFI_HII_IMAGE_DECODER_PROTOCOL instance.
131 @param Image Pointer to the image raw data.
132 @param SizeOfImage Size of the entire image raw data.
133 @param ImageInfo Pointer to recieve EFI_HII_IMAGE_DECODER_IMAGE_INFO_HEADER.
134
135 @retval EFI_SUCCESS Get image info success.
136 @retval EFI_UNSUPPORTED Unsupported format of image.
137 @retval EFI_INVALID_PARAMETER Incorrect parameter.
138 @retval EFI_BAD_BUFFER_SIZE Not enough memory.
139
140 **/
141 typedef
142 EFI_STATUS
143 (EFIAPI *EFI_HII_IMAGE_DECODER_GET_IMAGE_INFO)(
144 IN EFI_HII_IMAGE_DECODER_PROTOCOL *This,
145 IN VOID *Image,
146 IN UINTN SizeOfImage,
147 IN OUT EFI_HII_IMAGE_DECODER_IMAGE_INFO_HEADER **ImageInfo
148 );
149
150 /**
151 This function decodes the image which the image type of this image is supported
152 by this EFI_HII_IMAGE_DECODER_PROTOCOL. If **Bitmap is not NULL, the caller intends
153 to put the image in the given image buffer. That allows the caller to put an
154 image overlap on the original image. The transparency is handled by the image
155 decoder because the transparency capability depends on the image format. Callers
156 can set Transparent to FALSE to force disabling the transparency process on the
157 image. Forcing Transparent to FALSE may also improve the performance of the image
158 decoding because the image decoder can skip the transparency processing. If **Bitmap
159 is NULL, the image decoder allocates the memory buffer for the EFI_IMAGE_OUTPUT
160 and decodes the image to the image buffer. It is the caller?s responsibility to
161 free the memory for EFI_IMAGE_OUTPUT. Image decoder doesn?t have to handle the
162 transparency in this case because there is no background image given by the caller.
163 The background color in this case is all black (#00000000).
164
165 @param This EFI_HII_IMAGE_DECODER_PROTOCOL instance.
166 @param Image Pointer to the image raw data.
167 @param ImageRawDataSize Size of the entire image raw data.
168 @param Blt EFI_IMAGE_OUTPUT to receive the image or overlap
169 the image on the original buffer.
170 @param Transparent BOOLEAN value indicates whether the image decoder
171 has to handle the transparent image or not.
172
173
174 @retval EFI_SUCCESS Image decode success.
175 @retval EFI_UNSUPPORTED Unsupported format of image.
176 @retval EFI_INVALID_PARAMETER Incorrect parameter.
177 @retval EFI_BAD_BUFFER_SIZE Not enough memory.
178
179 **/
180 typedef
181 EFI_STATUS
182 (EFIAPI *EFI_HII_IMAGE_DECODER_DECODE)(
183 IN EFI_HII_IMAGE_DECODER_PROTOCOL *This,
184 IN VOID *Image,
185 IN UINTN ImageRawDataSize,
186 IN OUT EFI_IMAGE_OUTPUT **BitMap OPTIONAL,
187 IN BOOLEAN Transparent
188 );
189
190 struct _EFI_HII_IMAGE_DECODER_PROTOCOL {
191 EFI_HII_IMAGE_DECODER_GET_DECODER_NAME GetImageDecoderName;
192 EFI_HII_IMAGE_DECODER_GET_IMAGE_INFO GetImageInfo;
193 EFI_HII_IMAGE_DECODER_DECODE DecodeImage;
194 };
195
196 extern EFI_GUID gEfiHiiImageDecoderProtocolGuid;
197 extern EFI_GUID gEfiHiiImageDecoderNameJpegGuid;
198 extern EFI_GUID gEfiHiiImageDecoderNamePngGuid;
199
200 #endif