summaryrefslogtreecommitdiff
path: root/EDK/MiniSetup/TseAdvanced/png.h
blob: 3e181322e49eee7bf55df98af5326df9bfe094b0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
//*****************************************************************//
//*****************************************************************//
//*****************************************************************//
//**                                                             **//
//**         (C)Copyright 2011, American Megatrends, Inc.        **//
//**                                                             **//
//**                     All Rights Reserved.                    **//
//**                                                             **//
//**   5555 Oakbrook Pkwy, Building 200,Norcross, Georgia 30093  **//
//**                                                             **//
//**                     Phone (770)-246-8600                    **//
//**                                                             **//
//*****************************************************************//
//*****************************************************************//
//*****************************************************************//
// $Archive: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseAdvanced/png.h $
//
// $Author: Arunsb $
//
// $Revision: 2 $
//
// $Date: 10/18/12 5:53a $
//
//*****************************************************************//
//*****************************************************************//
// Revision History
// ----------------
// $Log: /Alaska/SOURCE/Modules/AMITSE2_0/AMITSE/TseAdvanced/png.h $
// 
// 2     10/18/12 5:53a Arunsb
// Updated for 2.16.1235 QA submission
// 
// 2     10/10/12 12:35p Arunsb
// Synched the source for v2.16.1232, backup with Aptio
// 
// 1     6/13/11 12:21p Rajashakerg
// EIP:60910 -PNG image support in TSE.
// 
//
//*****************************************************************//
//*****************************************************************//

//<AMI_FHDR_START>
//----------------------------------------------------------------------------
//
// Name:		png.h
//
// Description:	Header file for png image format related code
//
//----------------------------------------------------------------------------
//<AMI_FHDR_END>


#include "MyDefs.h"

#include EFI_PROTOCOL_DEFINITION(GraphicsOutput) 
#ifndef _PNG_H_
#define _PNG_H_

EFI_STATUS ConvertPNGToBlt ( IN VOID *PNGImage, IN UINT32 PNGImageSize, IN OUT VOID **Blt, IN OUT UINTN *BltSize, OUT UINT32 *PixelHeight, OUT UINT32 *PixelWidth);

typedef struct _PngHeader //information about the PNG image
{
	unsigned int width;				//width of the image in pixels 
	unsigned int height;			//height of the image in pixels
	unsigned int bitDepth;
	unsigned int colorType;
	unsigned int compressionMethod;	//compression method of the original file
	unsigned int filterMethod;		//filter method of the original file
	unsigned int interlaceMethod;	//interlace method of the original file
} PngHeader;

typedef struct _PngPalette
{
	unsigned int nEntry;
	unsigned char *entry;
} PngPalette;

typedef struct _PngTransparency
{
	unsigned int col[3];
} PngTransparency;

enum{
	gamma_default=100000
    };

typedef struct _PngImageDecoder
{
	PngHeader hdr;
	PngPalette plt;
	PngTransparency trns;
	int wid,hei;
	unsigned char *rgba;  // Raw data of R,G,B,A
	int autoDeleteRgbaBuffer;
	int filter,x,y,firstByte;
	int inLineCount;
	int inPixelCount;
	unsigned int r,g,b,msb;  // msb for reading 16 bit depth
	unsigned int index;
	unsigned int interlacePass;
	unsigned char *twoLineBuf8,*curLine8,*prvLine8;		// For filtering
	unsigned int gamma;
}PngImageDecoder;

PngImageDecoder gPng_Info;

void Initialize(void);
	int CheckSignature(CHAR8 *PNGImage);
	EFI_STATUS ReadChunk(unsigned *length,unsigned char **buf,unsigned *chunkType,unsigned *crc);
	void Header_Decode(unsigned char dat[]);
	EFI_STATUS Palette_Decode(unsigned length,unsigned char dat[]);
	EFI_STATUS Transparency_Decode(unsigned length,unsigned char dat[],unsigned int colorType);
	EFI_STATUS Decode(unsigned char *PNGImage,UINT32 PNGImageSize);
	void ShiftTwoLineBuf(void);
	EFI_STATUS PrepareOutput(void);
	EFI_STATUS Output(unsigned char dat);
	EFI_STATUS EndOutput(void);
EFI_STATUS Uncompress(unsigned length, unsigned char dat[]);


#endif //#ifndef _PNG_H_

//**********************************************************************
//**********************************************************************
//**                                                                  **
//**           (C)Copyright 2011, American Megatrends, Inc.           **
//**                                                                  **
//**                       All Rights Reserved.                       **
//**                                                                  **
//**     5555 Oakbrook Pkwy, Building 200,Norcross, Georgia 30093     **
//**                                                                  **
//**                       Phone: (770)-246-8600                      **
//**                                                                  **
//**********************************************************************
//**********************************************************************