From: Ruiyu Ni <ruiyu.ni@intel.com>
To: edk2-devel@lists.01.org
Cc: Liming Gao <liming.gao@intel.com>
Subject: [PATCH v2 10/19] MdePkg/HiiImageDecoder.h: Add HiiImageDecoder protocol header file
Date: Mon, 26 Sep 2016 17:30:26 +0800 [thread overview]
Message-ID: <20160926093035.350612-11-ruiyu.ni@intel.com> (raw)
In-Reply-To: <20160926093035.350612-1-ruiyu.ni@intel.com>
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=UTF-8, Size: 9017 bytes --]
Contributed-under: TianoCore Contribution Agreement 1.0
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
---
MdePkg/Include/Protocol/HiiImageDecoder.h | 200 ++++++++++++++++++++++++++++++
1 file changed, 200 insertions(+)
create mode 100644 MdePkg/Include/Protocol/HiiImageDecoder.h
diff --git a/MdePkg/Include/Protocol/HiiImageDecoder.h b/MdePkg/Include/Protocol/HiiImageDecoder.h
new file mode 100644
index 0000000..1ef48f1
--- /dev/null
+++ b/MdePkg/Include/Protocol/HiiImageDecoder.h
@@ -0,0 +1,200 @@
+/** @file
+ The file provides image decoder service for specific image file formats.
+
+ Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>
+ This program and the accompanying materials
+ are licensed and made available under the terms and conditions of the BSD License
+ which accompanies this distribution. The full text of the license may be found at
+ http://opensource.org/licenses/bsd-license.php
+
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+
+#ifndef __HII_IMAGE_DECODER_H__
+#define __HII_IMAGE_DECODER_H__
+
+#include <Protocol/HiiImage.h>
+
+#define EFI_HII_IMAGE_DECODER_PROTOCOL_GUID \
+ { 0x2F707EBB, 0x4A1A, 0x11d4, { 0x9A, 0x38, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0x4D } }
+typedef struct _EFI_HII_IMAGE_DECODER_PROTOCOL EFI_HII_IMAGE_DECODER_PROTOCOL;
+
+//
+// HII Image Decoder Guid
+//
+#define EFI_HII_IMAGE_DECODER_NAME_JPEG_GUID \
+ {0xefefd093, 0xd9b, 0x46eb, { 0xa8, 0x56, 0x48, 0x35, 0x7, 0x0, 0xc9, 0x8 } }
+
+#define EFI_HII_IMAGE_DECODER_NAME_PNG_GUID \
+ {0xaf060190, 0x5e3a, 0x4025, {0xaf, 0xbd, 0xe1, 0xf9, 0x5, 0xbf, 0xaa, 0x4c } }
+
+//
+// EFI_HII_IMAGE_DECODER_COLOR_TYPE
+//
+typedef enum {
+ EFI_HII_IMAGE_DECODER_COLOR_TYPE_RGB = 0,
+ EFI_HII_IMAGE_DECODER_COLOR_TYPE_RGBA = 1,
+ EFI_HII_IMAGE_DECODER_COLOR_TYPE_CMYK = 2,
+ EFI_HII_IMAGE_DECODER_COLOR_TYPE_UNKNOWN = 0xff,
+} EFI_HII_IMAGE_DECODER_COLOR_TYPE;
+
+//
+// EFI_HII_IMAGE_DECODER_IMAGE_INFO_HEADER
+//
+typedef struct _EFI_IMAGE_DECODER_IMAGE_INFO_HEADER {
+ EFI_GUID DecoderName;
+ UINT16 ImageInfoSize;
+ UINT16 ImageWidth;
+ UINT16 ImageHeight;
+ EFI_HII_IMAGE_DECODER_COLOR_TYPE ColorType;
+ UINT8 ColorDepthInBits;
+} EFI_HII_IMAGE_DECODER_IMAGE_INFO_HEADER;
+
+//
+// EFI_HII_IMAGE_DECODER_JPEG_INFO
+//
+typedef struct _EFI_IMAGE_DECODER_JPEG_INFO {
+ EFI_HII_IMAGE_DECODER_IMAGE_INFO_HEADER Header;
+ UINT16 ScanType;
+ UINT64 Reserved;
+} EFI_IMAGE_DECODER_JPEG_INFO;
+
+//
+// EFI_HII_IMAGE_DECODER_PNG_INFO
+//
+typedef struct _EFI_IMAGE_DECODER_PNG_INFO {
+ EFI_HII_IMAGE_DECODER_IMAGE_INFO_HEADER Header;
+ UINT16 Channels;
+ UINT64 Reserved;
+} EFI_HII_IMAGE_DECODER_PNG_INFO;
+
+//
+// EFI_HII_IMAGE_DECODER_OTHER_INFO
+//
+typedef struct _EFI_IMAGE_DECODER_OTHER_INFO {
+ EFI_HII_IMAGE_DECODER_IMAGE_INFO_HEADER Header;
+ CHAR16 ImageExtenion[1];
+ //
+ // Variable length of image file extension name.
+ //
+} EFI_HII_IMAGE_DECODER_OTHER_INFO;
+
+/**
+ This function returns the decoder name.
+
+ There could be more than one EFI_HII_IMAGE_DECODER_PROTOCOL instances installed in the
+ system for different image formats. This function returns the decoder name which callers
+ can use to find the proper image decoder for the image. It is possible to support
+ multiple image formats in one EFI_HII_IMAGE_DECODER_PROTOCOL. The capability of the
+ supported image formats is returned in DecoderName and NumberOfDecoderName.
+
+ @param This EFI_HII_IMAGE_DECODER_PROTOCOL instance.
+
+ @param DecorderName Pointer to a dimension to retrieve the decoder names in
+ EFI_GUID format. The number of the decoder names is returned
+ in NumberOfDecoderName.
+
+ @param NumberOfDecorderName Pointer to retrieve the number of decoders which supported by
+ this decoder driver.
+
+ @retval EFI_SUCCESS The decoder name was returned successfully.
+ @retval EFI_INVALID_PARAMETER DecoderName is NULL or NumberOfDecoderName is NULL.
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_HII_IMAGE_DECODER_GET_NAME)(
+ IN CONST EFI_HII_IMAGE_DECODER_PROTOCOL *This,
+ IN OUT EFI_GUID **DecorderName,
+ OUT UINT16 *NumberOfDecorderName
+ );
+
+/**
+ The function returns the EFI_HII_IMAGE_DECODER_IMAGE_INFO to the caller.
+
+ This function returns the image information of the given image raw data.
+ This function first checks whether the image raw data is supported by this
+ decoder or not. This function may go through the first few bytes in the
+ image raw data for the specific data structure or the image signature.
+ If the image is not supported by this image decoder, this function returns
+ EFI_UNSUPPORTED to the caller. Otherwise, this function returns the proper image
+ information to the caller. It is the callers responsibility to free the ImageInfo.
+
+ @param This EFI_HII_IMAGE_DECODER_PROTOCOL instance.
+ @param Image Pointer to the image raw data.
+ @param SizeOfImage Size of the entire image raw data.
+ @param ImageInfo Pointer to receive the EFI_HII_IMAGE_DECODER_IMAGE_INFO
+
+ @retval EFI_SUCCESS The image info was returned successfully.
+ @retval EFI_UNSUPPORTED The image is not supported.
+ @retval EFI_INVALID_PARAMETER Image is NULL, or ImageInfo is NULL.
+ @retval EFI_OUT_OF_RESOURCES ImageInfo cannot be returned because there was not
+ enough memory.
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_HII_IMAGE_DECODER_GET_IMAGE_INFO)(
+ IN CONST EFI_HII_IMAGE_DECODER_PROTOCOL *This,
+ IN VOID *Image,
+ IN UINTN SizeOfImage,
+ IN OUT EFI_HII_IMAGE_DECODER_IMAGE_INFO_HEADER **ImageInfo
+ );
+
+/**
+ The function decodes the image.
+
+ This function decodes the image which the image type of this image is
+ supported by this EFI_HII_IMAGE_DECODER_PROTOCOL.
+ If **Bitmap is not NULL, the caller intends to put the image in the given
+ image buffer. That allows the caller to put an image overlap on the original
+ image. The transparency is handled by the image decoder because the transparency
+ capability depends on the image format. Callers can set Transparent to FALSE to
+ force disabling the transparency process on the image. Forcing Transparent to
+ FALSE may also improve the performance of the image decoding because the image
+ decoder can skip the transparency processing.
+ If **Bitmap is NULL, the image decoder allocates the memory buffer for the
+ EFI_IMAGE_OUTPUT and decodes the image to the image buffer. It is the callers
+ responsibility to free the memory for EFI_IMAGE_OUTPUT. Image decoder doesnt
+ have to handle the transparency in this case because there is no background image
+ given by the caller. The background color in this case is all black (#00000000).
+
+ @param This EFI_HII_IMAGE_DECODER_PROTOCOL instance.
+ @param Image Pointer to the image raw data
+ @param ImageRawDataSize Size of the entire image raw data
+ @param Bitmap EFI_IMAGE_OUTPUT to receive the image or overlap the
+ image on the original buffer.
+ @param Transparent BOOLEAN value indicates whether the image decoder has to
+ handle the transparent image or not.
+
+ @retval EFI_SUCCESS The image was decoded successfully.
+ @retval EFI_UNSUPPORTED The image is not supported.
+ @retval EFI_INVALID_PARAMETER Image is NULL, or Bitmap is NULL.
+ @retval EFI_OUT_OF_RESOURCES The image cannot be decoded because there was not
+ enough memory.
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_HII_IMAGE_DECODER_DECODE)(
+ IN CONST EFI_HII_IMAGE_DECODER_PROTOCOL *This,
+ IN VOID *Image,
+ IN UINTN ImageRawDataSize,
+ IN OUT EFI_IMAGE_OUTPUT **Bitmap,
+ IN BOOLEAN Transparent
+ );
+
+
+///
+/// Services to access to images in the images database.
+///
+struct _EFI_HII_IMAGE_DECODER_PROTOCOL {
+ EFI_HII_IMAGE_DECODER_GET_NAME GetImageDecoderName;
+ EFI_HII_IMAGE_DECODER_GET_IMAGE_INFO GetImageInfo;
+ EFI_HII_IMAGE_DECODER_DECODE DecodeImage;
+};
+
+extern EFI_GUID gEfiHiiImageDecoderProtocolGuid;
+extern EFI_GUID gEfiHiiImageDecoderNameJpegGuid;
+extern EFI_GUID gEfiHiiImageDecoderNamePngGuid;
+
+#endif
--
2.9.0.windows.1
next prev parent reply other threads:[~2016-09-26 9:30 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-26 9:30 [PATCH v2 00/19] Add HiiImageEx implementations Ruiyu Ni
2016-09-26 9:30 ` [PATCH v2 01/19] MdeModulePkg/HiiDatabase: Refine GetImageIdOrAddress Ruiyu Ni
2016-09-26 9:30 ` [PATCH v2 02/19] MdeModulePkg/HiiDatabase: Move common code to LocatePackageList() Ruiyu Ni
2016-09-26 9:30 ` [PATCH v2 03/19] MdeModulePkg/HiiDatabase: Refine HiiNewImage() Ruiyu Ni
2016-09-26 9:30 ` [PATCH v2 04/19] MdeModulePkg/HiiDatabase: Refine HiiGetImage() Ruiyu Ni
2016-09-26 9:30 ` [PATCH v2 05/19] MdeModulePkg/HiiDatabase: Refine HiiSetImage() Ruiyu Ni
2016-09-26 9:30 ` [PATCH v2 06/19] MdeModulePkg/HiiDatabase: Refine HiiDrawImage() Ruiyu Ni
2016-09-26 9:30 ` [PATCH v2 07/19] MdemodulePkg/HiiDatabase: Correct typo in comments Ruiyu Ni
2016-09-26 9:30 ` [PATCH v2 08/19] MdePkg/HiiImage.h: Include GraphicsOutput.h Ruiyu Ni
2016-09-26 9:30 ` [PATCH v2 09/19] MdeModulePkg/HiiDatabase: Update HiiImage to support PNG/JPEG Ruiyu Ni
2016-09-26 9:30 ` Ruiyu Ni [this message]
2016-09-26 9:30 ` [PATCH v2 11/19] MdeModulePkg/HiiDatabase: Add HiiImageEx implementation Ruiyu Ni
2016-09-26 9:30 ` [PATCH v2 12/19] Nt32Pkg/PlatformBds: Do not call BootLogoEnableLogo Ruiyu Ni
2016-09-26 9:30 ` [PATCH v2 13/19] ArmVirtPkg/PlatformBds: " Ruiyu Ni
2016-09-26 10:06 ` Laszlo Ersek
2016-09-26 12:56 ` Ard Biesheuvel
2016-09-26 9:30 ` [PATCH v2 14/19] OvmfPkg/PlatformBds: " Ruiyu Ni
2016-09-26 10:06 ` Laszlo Ersek
2016-09-26 9:30 ` [PATCH v2 15/19] MdeModulePkg/BootLogoLib&PlatformLogo: Use HII data types in parameters Ruiyu Ni
2016-09-26 9:30 ` [PATCH v2 16/19] MdeModulePkg/Logo: Add LogoDxe module Ruiyu Ni
2016-09-26 9:30 ` [PATCH v2 17/19] Nt32Pkg: Use the new LogoDxe driver Ruiyu Ni
2016-09-26 9:30 ` [PATCH v2 18/19] ArmVirtPkg: " Ruiyu Ni
2016-09-26 10:06 ` Laszlo Ersek
2016-09-26 12:56 ` Ard Biesheuvel
2016-09-26 9:30 ` [PATCH v2 19/19] OvmfPkg: " Ruiyu Ni
2016-09-26 10:06 ` Laszlo Ersek
2016-09-28 8:12 ` [PATCH v2 00/19] Add HiiImageEx implementations Gao, Liming
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160926093035.350612-11-ruiyu.ni@intel.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox