--- /dev/null
+/** @file\r
+ This library provides image decoding service by managing the different\r
+ image decoding libraries.\r
+\r
+Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>\r
+This program and the accompanying materials are licensed and made available under\r
+the terms and conditions of the BSD License that accompanies this distribution.\r
+The full text of the license may be found at\r
+http://opensource.org/licenses/bsd-license.php.\r
+\r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+**/\r
+#ifndef __IMAGE_DECODER_LIB_H__\r
+#define __IMAGE_DECODER_LIB_H__\r
+#include <Protocol/PlatformLogo.h>\r
+\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *DECODE_IMAGE)(\r
+ IN IMAGE_FORMAT ImageFormat,\r
+ IN UINT8 *Image,\r
+ IN UINTN ImageSize,\r
+ OUT EFI_GRAPHICS_OUTPUT_BLT_PIXEL **GopBlt,\r
+ OUT UINTN *GopBltSize,\r
+ OUT UINTN *PixelWidth,\r
+ OUT UINTN *PixelHeight\r
+ );\r
+\r
+/**\r
+ Convert a graphics image to a callee allocated GOP blt buffer.\r
+\r
+ @param ImageFormat Format of the image file.\r
+ @param Image Pointer to image file.\r
+ @param ImageSize Number of bytes in Image.\r
+ @param GopBlt Buffer containing GOP version of Image.\r
+ @param GopBltSize Size of GopBlt in bytes.\r
+ @param PixelWidth Width of GopBlt/Image in pixels.\r
+ @param PixelHeight Height of GopBlt/Image in pixels.\r
+\r
+ @retval EFI_SUCCESS GopBlt and GopBltSize are returned.\r
+ @retval EFI_INVALID_PARAMETER GopBlt or GopBltSize is NULL.\r
+ @retval EFI_INVALID_PARAMETER Image is NULL or ImageSize is 0.\r
+ @retval EFI_UNSUPPORTED Image is not supported.\r
+ @retval EFI_OUT_OF_RESOURCES No enough buffer to allocate.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+DecodeImage (\r
+ IN IMAGE_FORMAT ImageFormat,\r
+ IN UINT8 *Image,\r
+ IN UINTN ImageSize,\r
+ OUT EFI_GRAPHICS_OUTPUT_BLT_PIXEL **GopBlt,\r
+ OUT UINTN *GopBltSize,\r
+ OUT UINTN *PixelWidth,\r
+ OUT UINTN *PixelHeight\r
+ );\r
+\r
+/**\r
+ Register an image decoder.\r
+\r
+ @param Decoder An image decoder.\r
+\r
+ @retval EFI_SUCCESS The decoder was successfully registered.\r
+ @retval EFI_OUT_OF_RESOURCES No enough resource to register the decoder.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+RegisterImageDecoder (\r
+ IN DECODE_IMAGE Decoder\r
+ );\r
+\r
+#endif\r
--- /dev/null
+/** @file\r
+ This library provides image decoding service by managing the different\r
+ image decoding libraries.\r
+\r
+Copyright (c) 2011 - 2015, Intel Corporation. All rights reserved.<BR>\r
+This program and the accompanying materials are licensed and made available under\r
+the terms and conditions of the BSD License that accompanies this distribution.\r
+The full text of the license may be found at\r
+http://opensource.org/licenses/bsd-license.php.\r
+\r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+**/\r
+\r
+#include <Uefi.h>\r
+#include <Protocol/GraphicsOutput.h>\r
+#include <Library/ImageDecoderLib.h>\r
+#include <Library/BaseLib.h>\r
+#include <Library/MemoryAllocationLib.h>\r
+#include <Library/DebugLib.h>\r
+\r
+typedef struct {\r
+ UINT32 Signature;\r
+ DECODE_IMAGE Decoder;\r
+ LIST_ENTRY Link;\r
+} IMAGE_DECODER_ENTRY;\r
+#define IMAGE_DECODER_ENTRY_SIGNATURE SIGNATURE_32 ('i', 'm', 'g', 'd')\r
+#define IMAGE_DECODER_ENTRY_FROM_LINK(Link) \\r
+ CR (Link, IMAGE_DECODER_ENTRY, Link, IMAGE_DECODER_ENTRY_SIGNATURE)\r
+\r
+LIST_ENTRY mImageDecoderLibDecoders = INITIALIZE_LIST_HEAD_VARIABLE (mImageDecoderLibDecoders);\r
+\r
+/**\r
+ Convert a graphics image to a callee allocated GOP blt buffer.\r
+\r
+ @param ImageFormat Format of the image file.\r
+ @param Image Pointer to image file.\r
+ @param ImageSize Number of bytes in Image.\r
+ @param GopBlt Buffer containing GOP version of Image.\r
+ @param GopBltSize Size of GopBlt in bytes.\r
+ @param PixelWidth Width of GopBlt/Image in pixels.\r
+ @param PixelHeight Height of GopBlt/Image in pixels.\r
+\r
+ @retval EFI_SUCCESS GopBlt and GopBltSize are returned.\r
+ @retval EFI_INVALID_PARAMETER GopBlt or GopBltSize is NULL.\r
+ @retval EFI_INVALID_PARAMETER Image is NULL or ImageSize is 0.\r
+ @retval EFI_UNSUPPORTED Image is not supported.\r
+ @retval EFI_OUT_OF_RESOURCES No enough buffer to allocate.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+DecodeImage (\r
+ IN IMAGE_FORMAT ImageFormat,\r
+ IN UINT8 *Image,\r
+ IN UINTN ImageSize,\r
+ OUT EFI_GRAPHICS_OUTPUT_BLT_PIXEL **GopBlt,\r
+ OUT UINTN *GopBltSize,\r
+ OUT UINTN *PixelWidth,\r
+ OUT UINTN *PixelHeight\r
+ )\r
+{\r
+ IMAGE_DECODER_ENTRY *Entry;\r
+ LIST_ENTRY *Link;\r
+ EFI_STATUS Status;\r
+\r
+ if ((GopBlt == NULL) || (GopBltSize == NULL)) {\r
+ return EFI_INVALID_PARAMETER;\r
+ }\r
+\r
+ if ((Image == NULL) || (ImageSize == 0)) {\r
+ return EFI_INVALID_PARAMETER;\r
+ }\r
+\r
+ for ( Link = GetFirstNode (&mImageDecoderLibDecoders)\r
+ ; !IsNull (&mImageDecoderLibDecoders, Link)\r
+ ; Link = GetNextNode (&mImageDecoderLibDecoders, Link)\r
+ ) {\r
+ Entry = IMAGE_DECODER_ENTRY_FROM_LINK (Link);\r
+ Status = Entry->Decoder (ImageFormat, Image, ImageSize, GopBlt, GopBltSize, PixelWidth, PixelHeight);\r
+ if (!EFI_ERROR (Status)) {\r
+ break;\r
+ }\r
+ }\r
+\r
+ if (IsNull (&mImageDecoderLibDecoders, Link)) {\r
+ return EFI_UNSUPPORTED;\r
+ } else {\r
+ return EFI_SUCCESS;\r
+ }\r
+}\r
+\r
+/**\r
+ Register an image decoder.\r
+\r
+ @param Decoder An image decoder.\r
+\r
+ @retval EFI_SUCCESS The decoder was successfully registered.\r
+ @retval EFI_OUT_OF_RESOURCES No enough resource to register the decoder.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+RegisterImageDecoder (\r
+ IN DECODE_IMAGE Decoder\r
+ )\r
+{\r
+ IMAGE_DECODER_ENTRY *Entry;\r
+\r
+ Entry = AllocatePool (sizeof (IMAGE_DECODER_ENTRY));\r
+ if (Entry == NULL) {\r
+ return EFI_OUT_OF_RESOURCES;\r
+ }\r
+\r
+ Entry->Signature = IMAGE_DECODER_ENTRY_SIGNATURE;\r
+ Entry->Decoder = Decoder;\r
+ InsertTailList (&mImageDecoderLibDecoders, &Entry->Link);\r
+\r
+ return EFI_SUCCESS;\r
+}
\ No newline at end of file
--- /dev/null
+## @file\r
+# This library provides image decoding service by managing the different\r
+# image decoding libraries.\r
+# \r
+# Copyright (c) 2011 - 2015, Intel Corporation. All rights reserved.<BR>\r
+# This program and the accompanying materials are licensed and made available under\r
+# the terms and conditions of the BSD License that accompanies this distribution.\r
+# The full text of the license may be found at\r
+# http://opensource.org/licenses/bsd-license.php.\r
+# \r
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+# \r
+##\r
+\r
+[Defines]\r
+ INF_VERSION = 0x00010005\r
+ BASE_NAME = ImageDecoderLib\r
+ FILE_GUID = 5ACDA5F7-AE20-4A17-90C1-7D087F730202\r
+ MODULE_TYPE = DXE_DRIVER\r
+ VERSION_STRING = 1.0\r
+ LIBRARY_CLASS = ImageDecoderLib|DXE_DRIVER UEFI_APPLICATION\r
+\r
+#\r
+# The following information is for reference only and not required by the build tools.\r
+#\r
+# VALID_ARCHITECTURES = IA32 X64 IPF EBC\r
+#\r
+\r
+[Sources]\r
+ ImageDecoderLib.c\r
+ \r
+[Packages]\r
+ MdePkg/MdePkg.dec\r
+ MdeModulePkg/MdeModulePkg.dec\r
+\r
+[LibraryClasses]\r
+ BaseLib\r
+ MemoryAllocationLib\r
+ UefiLib\r
+ BaseMemoryLib\r
+ DebugLib
\ No newline at end of file
#\r
PlatformVarCleanupLib|Include/Library/PlatformVarCleanupLib.h\r
\r
+ ## @libraryclass Provides image decoding service.\r
+ #\r
+ ImageDecoderLib|Include/Library/ImageDecoderLib.h\r
+\r
[Guids]\r
## MdeModule package token space guid\r
# Include/Guid/MdeModulePkgTokenSpace.h\r
PeCoffLib|MdePkg/Library/BasePeCoffLib/BasePeCoffLib.inf\r
PeCoffGetEntryPointLib|MdePkg/Library/BasePeCoffGetEntryPointLib/BasePeCoffGetEntryPointLib.inf\r
SortLib|MdeModulePkg/Library/BaseSortLib/BaseSortLib.inf\r
+ ImageDecoderLib|MdeModulePkg/Library/ImageDecoderLib/ImageDecoderLib.inf\r
#\r
# UEFI & PI\r
#\r
MdeModulePkg/Library/PeiDxeDebugLibReportStatusCode/PeiDxeDebugLibReportStatusCode.inf\r
MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf\r
MdeModulePkg/Library/PlatformBootManagerLibNull/PlatformBootManagerLibNull.inf\r
+ MdeModulePkg/Library/ImageDecoderLib/ImageDecoderLib.inf\r
MdeModulePkg/Library/TpmMeasurementLibNull/TpmMeasurementLibNull.inf\r
MdeModulePkg/Library/AuthVariableLibNull/AuthVariableLibNull.inf\r
MdeModulePkg/Library/VarCheckLib/VarCheckLib.inf\r