2 This protocol provides generic image decoder interfaces to various image formats.
4 (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>
5 Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>
7 This program and the accompanying materials are licensed and made available under
8 the terms and conditions of the BSD License that accompanies this distribution.
9 The full text of the license may be found at
10 http://opensource.org/licenses/bsd-license.php.
12 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
13 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
16 #ifndef __HII_IMAGE_DECODER_H__
17 #define __HII_IMAGE_DECODER_H__
19 #include <Protocol/HiiImage.h>
21 #define EFI_HII_IMAGE_DECODER_PROTOCOL_GUID \
22 {0x9e66f251, 0x727c, 0x418c, { 0xbf, 0xd6, 0xc2, 0xb4, 0x25, 0x28, 0x18, 0xea }}
25 #define EFI_HII_IMAGE_DECODER_NAME_JPEG_GUID \
26 {0xefefd093, 0xd9b, 0x46eb, { 0xa8, 0x56, 0x48, 0x35, 0x7, 0x0, 0xc9, 0x8 }}
28 #define EFI_HII_IMAGE_DECODER_NAME_PNG_GUID \
29 {0xaf060190, 0x5e3a, 0x4025, { 0xaf, 0xbd, 0xe1, 0xf9, 0x5, 0xbf, 0xaa, 0x4c }}
31 typedef struct _EFI_HII_IMAGE_DECODER_PROTOCOL EFI_HII_IMAGE_DECODER_PROTOCOL
;
34 EFI_HII_IMAGE_DECODER_COLOR_TYPE_RGB
= 0x0,
35 EFI_HII_IMAGE_DECODER_COLOR_TYPE_RGBA
= 0x1,
36 EFI_HII_IMAGE_DECODER_COLOR_TYPE_CMYK
= 0x2,
37 EFI_HII_IMAGE_DECODER_COLOR_TYPE_UNKNOWN
= 0xFF
38 } EFI_HII_IMAGE_DECODER_COLOR_TYPE
;
41 // EFI_HII_IMAGE_DECODER_IMAGE_INFO_HEADER
43 // DecoderName Name of the decoder
44 // ImageInfoSize The size of entire image information structure in bytes
45 // ImageWidth The image width
46 // ImageHeight The image height
47 // ColorType The color type, see EFI_HII_IMAGE_DECODER_COLOR_TYPE.
48 // ColorDepthInBits The color depth in bits
50 typedef struct _EFI_HII_IMAGE_DECODER_IMAGE_INFO_HEADER
{
55 EFI_HII_IMAGE_DECODER_COLOR_TYPE ColorType
;
56 UINT8 ColorDepthInBits
;
57 } EFI_HII_IMAGE_DECODER_IMAGE_INFO_HEADER
;
59 #define EFI_IMAGE_JPEG_SCANTYPE_PROGREESSIVE 0x01
60 #define EFI_IMAGE_JPEG_SCANTYPE_INTERLACED 0x02
63 // EFI_HII_IMAGE_DECODER_JPEG_INFO
64 // Header The common header
65 // ScanType The scan type of JPEG image
68 typedef struct _EFI_HII_IMAGE_DECODER_JPEG_INFO
{
69 EFI_HII_IMAGE_DECODER_IMAGE_INFO_HEADER Header
;
72 } EFI_HII_IMAGE_DECODER_JPEG_INFO
;
75 // EFI_HII_IMAGE_DECODER_PNG_INFO
76 // Header The common header
77 // Channels Number of channels in the PNG image
80 typedef struct _EFI_HII_IMAGE_DECODER_PNG_INFO
{
81 EFI_HII_IMAGE_DECODER_IMAGE_INFO_HEADER Header
;
84 } EFI_HII_IMAGE_DECODER_PNG_INFO
;
87 // EFI_HII_IMAGE_DECODER_OTHER_INFO
89 typedef struct _EFI_HII_IMAGE_DECODER_OTHER_INFO
{
90 EFI_HII_IMAGE_DECODER_IMAGE_INFO_HEADER Header
;
91 CHAR16 ImageExtenion
[1];
93 // Variable length of image file extension name.
95 } EFI_HII_IMAGE_DECODER_OTHER_INFO
;
98 There could be more than one EFI_HII_IMAGE_DECODER_PROTOCOL instances installed
99 in the system for different image formats. This function returns the decoder
100 name which callers can use to find the proper image decoder for the image. It
101 is possible to support multiple image formats in one EFI_HII_IMAGE_DECODER_PROTOCOL.
102 The capability of the supported image formats is returned in DecoderName and
105 @param This EFI_HII_IMAGE_DECODER_PROTOCOL instance.
106 @param DecoderName Pointer to a dimension to retrieve the decoder
107 names in EFI_GUID format. The number of the
108 decoder names is returned in NumberOfDecoderName.
109 @param NumberofDecoderName Pointer to retrieve the number of decoders which
110 supported by this decoder driver.
112 @retval EFI_SUCCESS Get decoder name success.
113 @retval EFI_UNSUPPORTED Get decoder name fail.
118 (EFIAPI
*EFI_HII_IMAGE_DECODER_GET_NAME
)(
119 IN EFI_HII_IMAGE_DECODER_PROTOCOL
*This
,
120 IN OUT EFI_GUID
**DecoderName
,
121 IN OUT UINT16
*NumberOfDecoderName
125 This function returns the image information of the given image raw data. This
126 function first checks whether the image raw data is supported by this decoder
127 or not. This function may go through the first few bytes in the image raw data
128 for the specific data structure or the image signature. If the image is not supported
129 by this image decoder, this function returns EFI_UNSUPPORTED to the caller.
130 Otherwise, this function returns the proper image information to the caller.
131 It is the caller?s responsibility to free the ImageInfo.
133 @param This EFI_HII_IMAGE_DECODER_PROTOCOL instance.
134 @param Image Pointer to the image raw data.
135 @param SizeOfImage Size of the entire image raw data.
136 @param ImageInfo Pointer to receive EFI_HII_IMAGE_DECODER_IMAGE_INFO_HEADER.
138 @retval EFI_SUCCESS Get image info success.
139 @retval EFI_UNSUPPORTED Unsupported format of image.
140 @retval EFI_INVALID_PARAMETER Incorrect parameter.
141 @retval EFI_BAD_BUFFER_SIZE Not enough memory.
146 (EFIAPI
*EFI_HII_IMAGE_DECODER_GET_IMAGE_INFO
)(
147 IN EFI_HII_IMAGE_DECODER_PROTOCOL
*This
,
149 IN UINTN SizeOfImage
,
150 IN OUT EFI_HII_IMAGE_DECODER_IMAGE_INFO_HEADER
**ImageInfo
154 This function decodes the image which the image type of this image is supported
155 by this EFI_HII_IMAGE_DECODER_PROTOCOL. If **Bitmap is not NULL, the caller intends
156 to put the image in the given image buffer. That allows the caller to put an
157 image overlap on the original image. The transparency is handled by the image
158 decoder because the transparency capability depends on the image format. Callers
159 can set Transparent to FALSE to force disabling the transparency process on the
160 image. Forcing Transparent to FALSE may also improve the performance of the image
161 decoding because the image decoder can skip the transparency processing. If **Bitmap
162 is NULL, the image decoder allocates the memory buffer for the EFI_IMAGE_OUTPUT
163 and decodes the image to the image buffer. It is the caller?s responsibility to
164 free the memory for EFI_IMAGE_OUTPUT. Image decoder doesn?t have to handle the
165 transparency in this case because there is no background image given by the caller.
166 The background color in this case is all black (#00000000).
168 @param This EFI_HII_IMAGE_DECODER_PROTOCOL instance.
169 @param Image Pointer to the image raw data.
170 @param ImageRawDataSize Size of the entire image raw data.
171 @param Blt EFI_IMAGE_OUTPUT to receive the image or overlap
172 the image on the original buffer.
173 @param Transparent BOOLEAN value indicates whether the image decoder
174 has to handle the transparent image or not.
177 @retval EFI_SUCCESS Image decode success.
178 @retval EFI_UNSUPPORTED Unsupported format of image.
179 @retval EFI_INVALID_PARAMETER Incorrect parameter.
180 @retval EFI_BAD_BUFFER_SIZE Not enough memory.
185 (EFIAPI
*EFI_HII_IMAGE_DECODER_DECODE
)(
186 IN EFI_HII_IMAGE_DECODER_PROTOCOL
*This
,
188 IN UINTN ImageRawDataSize
,
189 IN OUT EFI_IMAGE_OUTPUT
**Bitmap
,
190 IN BOOLEAN Transparent
193 struct _EFI_HII_IMAGE_DECODER_PROTOCOL
{
194 EFI_HII_IMAGE_DECODER_GET_NAME GetImageDecoderName
;
195 EFI_HII_IMAGE_DECODER_GET_IMAGE_INFO GetImageInfo
;
196 EFI_HII_IMAGE_DECODER_DECODE DecodeImage
;
199 extern EFI_GUID gEfiHiiImageDecoderProtocolGuid
;
200 extern EFI_GUID gEfiHiiImageDecoderNameJpegGuid
;
201 extern EFI_GUID gEfiHiiImageDecoderNamePngGuid
;