-
Notifications
You must be signed in to change notification settings - Fork 2
/
SegaPVRImage.h
59 lines (51 loc) · 1.8 KB
/
SegaPVRImage.h
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
//
// SegaPVRImage.h
// SEGAPVR
//
// Created by Yevgeniy Logachev on 4/13/14.
// Copyright (c) 2014 yev. All rights reserved.
//
#ifndef SEGAPVRIMAGE_H
#define SEGAPVRIMAGE_H
enum TextureTypeMasks
{
TTM_Twiddled = 0x01,
TTM_TwiddledMipMaps = 0x02,
TTM_VectorQuantized = 0x03,
TTM_VectorQuantizedMipMaps = 0x04,
TTM_VectorQuantizedCustomCodeBook = 0x10,
TTM_VectorQuantizedCustomCodeBookMipMaps = 0x11,
TTM_Raw = 0x0B,
TTM_RawNonSquare = 0x09,
TTM_TwiddledNonSquare = 0x0D
};
enum TextureFormatMasks
{
TFM_ARGB1555 = 0x00,
TFM_RGB565,
TFM_ARGB4444,
TFM_YUV422
};
#pragma pack(push,1)
struct GBIXHeader // Global index header
{
unsigned int version; // ID, "GBIX" in ASCII
unsigned int nextTagOffset; // Bytes number to the next tag
unsigned long long globalIndex;
};
#pragma pack(pop)
#pragma pack(push,1)
struct PVRTHeader
{
unsigned int version; // ID, "PVRT" in ASCII
unsigned int textureDataSize;
unsigned int textureAttributes;
unsigned short width; // Width of the texture.
unsigned short height; // Height of the texture.
};
#pragma pack(pop)
extern void BuildTwiddleTable();
extern int LoadPVRFromFile(const char* filename, unsigned char** image, unsigned long int* imageSize, struct PVRTHeader* outPvrtHeader);
extern unsigned int ReadPVRHeader(unsigned char* srcData, struct PVRTHeader* pvrtHeader);
extern int DecodePVR(unsigned char* srcData, const struct PVRTHeader* pvrtHeader, unsigned char* dstData);
#endif