lwp_decoder.h
3.56 KB
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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
#ifndef __LWP_RAW_PARSER_H__
#define __LWP_RAW_PARSER_H__
#ifdef WIN32
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#endif
#include "fsal.h"
#include "app_zlib.h"
//#if defined(__MTK_TARGET__)
#include "fs_gprot.h"
//#endif
#define __LWP_SWLA_DEBUG__
typedef enum
{
LWP_FALSE,
LWP_TRUE
}LWP_bool;
typedef enum
{
LWP_TYPE_ZLIB_COMPRESSED = 1,
LWP_TYPE_UNCOMPRESSED,
LWP_TYPE_RSVD
}LWP_TYPE_FORMAT;
typedef enum
{
LWP_READ_FILE_SYNC = 0,
LWP_READ_FILE_ASYNC,
LWP_READ_FILE_RSVD
}LWP_READ_FILE_MODE_ENUM;
typedef enum
{
LWP_STATUS_OK,
LWP_STATUS_HANDLE_UNAVAILABLE,
LWP_STATUS_MEM_UNAVAILABLE,
LWP_STATUS_INVALID_FILE,
LWP_STATUS_INVALID_PARA,
LWP_STATUS_FS_FAIL,
LWP_STATUS_FAIL,
LWP_STATUS_RSVD
}LWP_DEC_STATUS;
typedef enum
{
LWP_DEC_RGB565,
LWP_DEC_RGB888,
LWP_DEC_FORMAT_RSVD
}LWP_DEC_COLOR_FORMAT;
typedef struct
{
unsigned int frame_offset; //respect to random access table end
unsigned int raw_data_size;
unsigned int compressed_data_size;
}LWP_RANDOM_ACCESS_TABLE_T;
typedef struct
{
unsigned int width;
unsigned int height;
unsigned int padding_count;
}LWP_FRAME_HEADER_T;
typedef void (*lwp_async_get_frame_callback)(LWP_DEC_STATUS error_code, void *callback_para);
typedef struct
{
unsigned int frame_index;
lwp_async_get_frame_callback callback; //async_get_frame_callback
void *para; //async_get_frame_callback_para
LWP_DEC_STATUS status; //async_get_frame_status
fs_overlapped_struct file_overlapped;
}LWP_ASYNC_FS_CTRL_BLOCK;
typedef struct
{
STFSAL *fsal_handle; ///< fsal handle
LWP_bool fparsed; ///< header been parsed or not?
LWP_bool fcompressed;
unsigned int frame_count;
unsigned int src_width;
unsigned int src_height;
LWP_DEC_COLOR_FORMAT format;
LWP_RANDOM_ACCESS_TABLE_T* random_access_table;
unsigned int data_trunk_start_offset;
//private data:
alloc_func gzalloc_func;
free_func gzfree_func;
LWP_ASYNC_FS_CTRL_BLOCK aysnc_fs_ctrl;
unsigned int current_dec_frame_index;
// for debug
unsigned int async_read_busy;
unsigned char* current_src_buf;
}LWP_DEC_CTRL_BLOCK;
typedef LWP_DEC_CTRL_BLOCK LWP_DECODER_HANDLE;
LWP_DEC_STATUS
lwpDecGetHandle(LWP_DECODER_HANDLE** handle);
LWP_DEC_STATUS
lwpDecReleaseHandle(LWP_DECODER_HANDLE** handle);
LWP_DEC_STATUS
lwpDecSetSrcFile(LWP_DECODER_HANDLE* handle, STFSAL *fp);
LWP_DEC_STATUS
lwpDecQuerySrcResolution(
LWP_DECODER_HANDLE* handle,
unsigned int* width,
unsigned int* height);
LWP_DEC_STATUS
lwpDecQuerySrcFormat(LWP_DECODER_HANDLE* handle, LWP_DEC_COLOR_FORMAT *srcFormat);
LWP_DEC_STATUS
lwpDecQueryFrameCount(LWP_DECODER_HANDLE* handle, unsigned int *frameCnt);
LWP_DEC_STATUS
lwpDecQuerySrcFrameBufSize(LWP_DECODER_HANDLE* handle, unsigned int frame_index, unsigned int *buf_size);
LWP_DEC_STATUS
lwpDecQueryFrameHeaderLength(LWP_DECODER_HANDLE* handle, unsigned int *frame_header_len);
LWP_DEC_STATUS
lwpDecSetAllocAndFree(
LWP_DECODER_HANDLE* handle,
alloc_func alloc_func,
free_func free_func);
LWP_DEC_STATUS
lwpDecGetFrameSrcBuf(
LWP_DECODER_HANDLE *handle,
LWP_READ_FILE_MODE_ENUM read_mode,
unsigned int frame_index,
unsigned char* src_buf,
unsigned int src_buf_size,
unsigned int *output_size,
lwp_async_get_frame_callback callback,
void *param);
LWP_DEC_STATUS
lwpDecGetFramePixelData(
LWP_DECODER_HANDLE *handle,
unsigned char *src_buf,
unsigned int src_buf_size,
unsigned char *dstBuf,
unsigned int dst_buf_size);
#endif //__LWP_RAW_PARSER_H__