Commit | Line | Data |
---|---|---|
6fa3eb70 S |
1 | #include <linux/ioctl.h> |
2 | ||
3 | #ifndef __JPEG_DRV_H__ | |
4 | #define __JPEG_DRV_H__ | |
5 | ||
6 | ||
7 | ||
8 | #define TO_CEIL(x,a) ( ((x) + ((a)-1)) & ~((a)-1) ) | |
9 | #define TO_FLOOR(x,a) ( (x) & ~((a)-1) ) | |
10 | #define TO_MASK(x,a) ( (x) & (a) ) | |
11 | ||
12 | #define DUNUM_MAPPING(value) (((value)-1)&0x3) | |
13 | ||
14 | ||
15 | ||
16 | typedef struct | |
17 | { | |
18 | long timeout; | |
19 | unsigned int *result; | |
20 | ||
21 | }JPEG_DEC_DRV_OUT; | |
22 | ||
23 | ||
24 | //=========================================================================================== | |
25 | ||
26 | ||
27 | ||
28 | ||
29 | #define MAX_JPEG_COMPONENT 4 | |
30 | #define MAX_NUM_SCAN 32 | |
31 | ||
32 | #define D_MAX_JPEG_HW_COMP 3 | |
33 | //#define D_MAX_JPEG_HUFF_TBL 4 | |
34 | #define D_MAX_JPEG_QTBL 4 | |
35 | #define D_MAX_JPEG_HW_QTBL 2 | |
36 | #define D_MAX_JPEG_BLOCK_NUM 10 | |
37 | #define D_HUFF_LOOKAHEAD_BITS 6 /* # of bits of lookahead */ | |
38 | ||
39 | #define D_DCTSIZE 8 | |
40 | #define D_JPEG_DRAM_ALIGN_MASK 0xf | |
41 | #define D_JPEG_DRAM_ALIGN_SIZE (D_JPEG_DRAM_ALIGN_MASK + 1) | |
42 | ||
43 | #define D_JPEG_BASELINE 0 | |
44 | #define D_JPEG_DC_REFINE 1 | |
45 | #define D_JPEG_AC_FIRST 2 | |
46 | #define D_JPEG_AC_REFINE 3 | |
47 | #define D_JPEG_DC_FIRST 4 | |
48 | ||
49 | /* global data check flags */ | |
50 | #define D_FLAG_NONE (0) | |
51 | ||
52 | #define D_GLOB_PROGRESSIVE (1 << 0) | |
53 | #define D_GLOB_NCOMP (1 << 1) | |
54 | #define D_GLOB_BLK_W (1 << 2) | |
55 | #define D_GLOB_BLK_H (1 << 3) | |
56 | #define D_GLOB_PIC_W (1 << 4) | |
57 | #define D_GLOB_PIC_H (1 << 5) | |
58 | #define D_GLOB_DCHUFF (1 << 6) /* no need */ | |
59 | #define D_GLOB_ACHUFF (1 << 7) /* no need */ | |
60 | #define D_GLOB_NZBUFF (1 << 8) /* no need */ | |
61 | #define D_GLOB_QTBL (1 << 9) /* no need */ | |
62 | #define D_GLOB_RESTART (1 << 10) | |
63 | /* scan data check flags */ | |
64 | #define D_SCAN_DATASTART (1 << 0) | |
65 | #define D_SCAN_NCOMP (1 << 1) | |
66 | #define D_SCAN_COMPIN (1 << 2) | |
67 | #define D_SCAN_COMPQ (1 << 3) | |
68 | #define D_SCAN_BLKDC (1 << 4) | |
69 | #define D_SCAN_BLKAC (1 << 5) | |
70 | #define D_SCAN_ALAH (1 << 6) | |
71 | #define D_SCAN_SESS (1 << 7) | |
72 | #define D_SCAN_LAST (1 << 8) | |
73 | #define D_SCAN_ROWSTART (1 << 9) | |
74 | #define D_SCAN_ROWEND (1 << 10) | |
75 | #define D_SCAN_DCHUFF (1 << 11) | |
76 | #define D_SCAN_ACHUFF (1 << 12) | |
77 | #define D_SCAN_QTBL (1 << 13) | |
78 | #define D_SCAN_NZBUFF (1 << 14) | |
79 | /* mcu row check flags */ | |
80 | #define D_ROW_CURR (1 << 0) | |
81 | #define D_ROW_OUTBUF (1 << 1) | |
82 | #define D_ROW_OUTBUFSIZE (1 << 2) | |
83 | /* mcu check flags */ | |
84 | #define D_MCU_OUTADDR (1 << 0) | |
85 | #define D_MCU_COEFADDR (1 << 1) | |
86 | /* misc check flags */ | |
87 | #define D_MISC_ADDR_X (1 << 0) | |
88 | #define D_MISC_ADDR_Y (1 << 1) | |
89 | ||
90 | ||
91 | #define M_JPEG_INTERFACE_START() \ | |
92 | int i4Ret = (int)E_HWJPG_OK; | |
93 | ||
94 | #define M_JPEG_INTERFACE_END() \ | |
95 | return i4Ret | |
96 | ||
97 | ||
98 | #define HORI 0 | |
99 | #define VERT 1 | |
100 | ||
101 | #define JPEG_ENC_DST_ADDR_OFFSET_MASK (0x0f) | |
102 | ||
103 | ||
104 | ||
105 | ||
106 | ||
107 | typedef enum _ENUM_JPEG_RET_CODE_T | |
108 | { | |
109 | E_JPG_OK, | |
110 | E_JPG_ERR_NONFATAL, | |
111 | E_JPG_ERR_FATAL, | |
112 | E_JPG_ERR_PARAM, | |
113 | E_JPG_ERR_NOT_INITED, | |
114 | E_JPG_ERR_ALREADY, //5 | |
115 | /* markers */ | |
116 | E_JPG_ERR_NOT_JPEG_IMAGE, | |
117 | E_JPG_ERR_NOT_A_MARKER, | |
118 | E_JPG_ERR_PASS_END, | |
119 | E_JPG_ERR_MULTI_SOI, | |
120 | E_JPG_ERR_UNSUPPORT_SOF, //10 | |
121 | E_JPG_ERR_MULTI_SOF, | |
122 | E_JPG_ERR_INVALID_SOF, | |
123 | E_JPG_ERR_SOS_BEFORE_SOF, | |
124 | E_JPG_ERR_INVALID_SOS, | |
125 | E_JPG_ERR_INVALID_DHT, //15 | |
126 | E_JPG_ERR_INVALID_DRI, | |
127 | E_JPG_ERR_MULTI_APP1, | |
128 | E_JPG_ERR_INVALID_APP0, | |
129 | E_JPG_ERR_INVALID_APP1, | |
130 | E_JPG_ERR_PARSE_FAILED, //20 | |
131 | E_JPG_ERR_NOT_PARSED, | |
132 | E_JPG_ERR_MULTI_EOI, | |
133 | /* instances */ | |
134 | E_JPG_ERR_ALLOC_PARSER, | |
135 | E_JPG_ERR_ALLOC_DECODER, | |
136 | E_JPG_ERR_ALLOC_MEM, //25 | |
137 | E_JPG_ERR_ALLOC_FLOW, | |
138 | /* general */ | |
139 | E_JPG_ERR_UNSUPPORT, | |
140 | E_JPG_ERR_GENERAL, | |
141 | E_JPG_ERR_LAST, | |
142 | E_JPG_ERR_DISPLAY_ADDR, //30 | |
143 | E_JPG_ERR_INVALID_COMPONENT //code sync | |
144 | } JpegDecRetCode; | |
145 | ||
146 | ||
147 | typedef enum | |
148 | { | |
149 | E_HWJPG_OK = 0, | |
150 | E_HWJPG_BUSY, | |
151 | ||
152 | E_HWJPG_ERR_FETCH_TIMEOIT = E_JPG_ERR_LAST + 1, | |
153 | E_HWJPG_ERR_SET_BS, | |
154 | E_HWJPG_ERR_LOAD_Q, | |
155 | E_HWJPG_ERR_QTBL_INDEX, | |
156 | E_HWJPG_ERR_QTBL_NUM, | |
157 | ||
158 | E_HWJPG_ERR_PARAM, | |
159 | E_HWJPG_ERR_TIMEOUT, | |
160 | ||
161 | E_HWJPG_ERR_COMP_RANGE, | |
162 | E_HWJPG_ERR_TBL_RANGE, | |
163 | E_HWJPG_ERR_BLOCK, | |
164 | E_HWJPG_ERR_SIZE, | |
165 | E_HWJPG_ERR_OUTBUF, | |
166 | ||
167 | E_HWJPG_ERR_NULL_SCAN, | |
168 | ||
169 | E_HWJPG_ERR_GLOB_NOT_READY, | |
170 | E_HWJPG_ERR_SCAN_NOT_READY, | |
171 | E_HWJPG_ERR_ROW_NOT_READY, | |
172 | E_HWJPG_ERR_MCU_NOT_READY, | |
173 | E_HWJPG_ERR_MISC_NOT_READY, | |
174 | E_HWJPG_ERR_HUFF_ADDR, | |
175 | /* last */ | |
176 | E_HWJPG_ERR_GENERAL | |
177 | } JpegDrvDecRetCode; | |
178 | ||
179 | ||
180 | typedef enum | |
181 | { | |
182 | JDEC_HAL_DEC_MODE_NONE, | |
183 | JDEC_HAL_DEC_MODE_BASELINE_PIC, ///< Jpeg baseline picture, decode whole picture | |
184 | JDEC_HAL_DEC_MODE_BASELINE_MCU, ///< Jpeg baseline picture, decode MCU row | |
185 | JDEC_HAL_DEC_MODE_BASELINE_MCU_ROW, ///< Jpeg baseline picture, decode MCU | |
186 | JDEC_HAL_DEC_MODE_BASELINE_VIDEO_OUTPUT, | |
187 | JDEC_HAL_DEC_MODE_PROGRESSIVE_MCU_MULTI_COLLECT, ///< Jpeg progressive picture, decode MCU milti-collect | |
188 | JDEC_HAL_DEC_MODE_PROGRESSIVE_MCU_ENHANCE, ///< Jpeg progressive picture, decode MCU enhance decoding | |
189 | JDEC_HAL_DEC_MODE_PROGRESSIVE_MCU_ROW_MULTI_COLLECT, ///Jpeg progressive MCU-Row Mode | |
190 | JDEC_HAL_DEC_MODE_PROGRESSIVE_MCU_ROW_ENHANCE, | |
191 | JDEC_HAL_DEC_MODE_PROGRESSIVE_SCAN_MULTI_COLLECT, | |
192 | JDEC_HAL_DEC_MODE_PROGRESSIVE_SCAN_ENHANCE | |
193 | } JpegDrvDecMode; | |
194 | ||
195 | /* jpeg format */ | |
196 | typedef enum _JpegDecFormat | |
197 | { | |
198 | E_JPG_UNKNOWN_FORMAT, | |
199 | E_JPG_BASELINE, | |
200 | E_JPG_EX_SEQ_HUFFMAN, | |
201 | E_JPG_PROGRESSIVE_HUFFMAN, | |
202 | E_JPG_EX_SEQ_ARITHMETIC, | |
203 | E_JPG_PROGRESSIVE_ARITHMETIC, | |
204 | E_JPG_LOSSLESS_HUFFMAN, | |
205 | E_JPG_DIFFERENTIAL_SEQ_HUFFMAN, | |
206 | E_JPG_DIFF_PROG_HUFFMAN, | |
207 | E_JPG_DIFF_LLESS_HUFFMAN, | |
208 | E_JPG_RESERVED_FOR_EXTENSIONS, | |
209 | E_JPG_LOSSLESS_ARITHMETIC, | |
210 | E_JPG_DIFF_SEQ_ARITHMETIC, | |
211 | E_JPG_DIFF_PROG_ARITHMETIC, | |
212 | E_JPG_UNSUPPORT_FORMAT | |
213 | } JpegDecFormat; | |
214 | ||
215 | ||
216 | /* component info in SOF marker */ | |
217 | typedef struct _JpegDecSOFComp | |
218 | { | |
219 | unsigned char u1CompId; | |
220 | unsigned char u1HSampFactor; | |
221 | unsigned char u1VSampFactor; | |
222 | unsigned char u1QuantTblNo; | |
223 | } JpegDecSOFComp; | |
224 | ||
225 | typedef struct _JpegDecSOS | |
226 | { | |
227 | unsigned int u4ScanPass; /* scan pass */ | |
228 | unsigned char u1CompInScan; | |
229 | unsigned char au1CompNoList[MAX_JPEG_COMPONENT]; | |
230 | unsigned char au1DcId[MAX_JPEG_COMPONENT]; | |
231 | unsigned char au1AcId[MAX_JPEG_COMPONENT]; | |
232 | unsigned char u1Ss, u1Se, u1Ah, u1Al, u1AhAl; /* OT: NO USE */ | |
233 | unsigned char* pu1ScanTableStart; | |
234 | unsigned char* pu1ScanDataStart; | |
235 | } JpegDecSOS; | |
236 | ||
237 | ||
238 | /* raw de-huffman table */ | |
239 | typedef struct | |
240 | { | |
241 | unsigned char au1Bits[17]; | |
242 | unsigned char au1HuffVal[256]; | |
243 | } JpegDecDhtHuffTbl; | |
244 | ||
245 | ||
246 | ||
247 | /* SOF data */ | |
248 | typedef struct _JpegDecSOF | |
249 | { | |
250 | int fgSOF; /* indicate that already have an SOF marker */ | |
251 | JpegDecFormat eJpegFormat; | |
252 | unsigned char u1DataPrecision; | |
253 | unsigned short u2ImageHeight; | |
254 | unsigned short u2ImageWidth; | |
255 | unsigned char u1NumComponents; | |
256 | unsigned char au1MapId2Index[256]; | |
257 | JpegDecSOFComp arSofComp[MAX_JPEG_COMPONENT]; | |
258 | } JpegDecSOF; | |
259 | ||
260 | ||
261 | ||
262 | /* DHT data */ | |
263 | typedef struct | |
264 | { | |
265 | unsigned int u4NumDcTbl; | |
266 | unsigned int u4NumAcTbl; | |
267 | unsigned int fgDcTblLoaded; /* bit mask for loaded dc table */ | |
268 | unsigned int fgAcTblLoaded; /* bit mask for loaded ac table */ | |
269 | JpegDecDhtHuffTbl arDcTbl[4]; | |
270 | JpegDecDhtHuffTbl arAcTbl[4]; | |
271 | } JpegDecDHT; | |
272 | ||
273 | /* DQT data */ | |
274 | typedef struct | |
275 | { | |
276 | /* | |
277 | although we leave 2bytes * 64 space here, | |
278 | if q table precision is 8bits, we use only | |
279 | first half (1x64) of this table | |
280 | */ | |
281 | unsigned char aau1Qtbl[4][128]; | |
282 | unsigned int afgPrec[4]; | |
283 | unsigned char u1NumQ; | |
284 | unsigned int fgDQT; | |
285 | } JpegDecDQT; | |
286 | ||
287 | ||
288 | /* new types for flw2 (wired) */ | |
289 | typedef struct | |
290 | { | |
291 | void *pvFreePoint; /* OT: NO USE */ | |
292 | unsigned int u4Width; /* OT: NO USE */ | |
293 | unsigned int u4Height; /* OT: NO USE */ | |
294 | unsigned int u4McuNumInRow; /* OT: NO USE */ | |
295 | unsigned int u4McuRows; /* OT: NO USE */ | |
296 | unsigned int u4TotalMcuNum; /* OT: NO USE */ | |
297 | unsigned int aau4SampleFactor[3][2]; /* OT: NO USE */ | |
298 | unsigned int au4CompBlock[3]; /* OT: NO USE */ | |
299 | unsigned int au4MaxFactor[2]; /* OT: NO USE */ | |
300 | unsigned int outputBuffer0[3]; | |
301 | unsigned int outputBuffer1[3]; /* nouse in full frame mode, only use in PauseResume/DirectCouple mode */ | |
302 | unsigned int au1CoffBuffer[3]; /* OT: NO USE */ | |
303 | int fgProgScan; /* OT: NO USE */ | |
304 | /* temp buffers */ | |
305 | unsigned int apvNzBuffer[3]; /* OT: NO USE */ | |
306 | ||
307 | } JpegDrvDecFlow; | |
308 | ||
309 | ||
310 | ||
311 | //// jpeg decode mode | |
312 | typedef enum _JpegDecMode | |
313 | { | |
314 | JPEG_DEC_MODE_NONE, | |
315 | JPEG_DEC_MODE_FRAME, ///< Jpeg baseline picture, decode whole picture | |
316 | JPEG_DEC_MODE_DC_LINK, ///< Jpeg baseline picture, decode whole picture | |
317 | JPEG_DEC_MODE_MCU_ROW ///< Jpeg baseline picture, decode MCU row | |
318 | } JpegDecMode; | |
319 | ||
320 | ||
321 | //// JPEG Decoder Structure | |
322 | typedef struct | |
323 | { | |
324 | ||
325 | /* common */ | |
326 | unsigned int decodeMode; //OK | |
327 | unsigned int reg_OpMode ; //OK | |
328 | unsigned int regDecDumpEn; | |
329 | unsigned int totalMCU ; //OK | |
330 | unsigned int comp0_DU ; | |
331 | ||
332 | unsigned int membershipList ; //OK /* { GRAY, gmcEn, DU9, DU8,..., DU1, DU0} */ | |
333 | ||
334 | /* for BRZ (0): 1, (1): 1/2, (2): 1/4, (3): 1/8 */ | |
335 | unsigned char lumaHorDecimate; //OK | |
336 | unsigned char lumaVerDecimate; //OK | |
337 | unsigned char cbcrHorDecimate; //OK | |
338 | unsigned char cbcrVerDecimate; //OK | |
339 | ||
340 | unsigned int srcStreamAddrBase; //OK | |
341 | unsigned int srcStreamSize; //OK | |
342 | unsigned int srcStreamAddrWritePtr; //OK | |
343 | ||
344 | unsigned int outputBuffer0[3]; //OK | |
345 | unsigned int outputBuffer1[3]; //OK /* nouse in full frame mode, only use in PauseResume/DirectCouple mode */ | |
346 | ||
347 | ||
348 | // JPEG component information | |
349 | unsigned int componentNum; //OK | |
350 | unsigned int componentID[3]; //OK ///< Ci | |
351 | unsigned int hSamplingFactor[3]; //OK ///< Hi | |
352 | unsigned int vSamplingFactor[3]; //OK ///< Vi | |
353 | unsigned int qTableSelector[3]; //OK ///< Tqi (OT: need this field?) | |
354 | ||
355 | unsigned int dma_McuInGroup; //OK | |
356 | unsigned int dma_GroupNum ; //OK | |
357 | unsigned int dma_LastMcuNum ; //OK | |
358 | unsigned int gmcEn ; //OK | |
359 | ||
360 | ||
361 | //unsigned int totalMcuRows; //OK ///< number of MCU column in the JPEG file | |
362 | ||
363 | unsigned int compImgStride[D_MAX_JPEG_HW_COMP]; //OK // hSamplingFactor[n] * 8 * mcuPerRow (byte pitch of a component) | |
364 | unsigned int compMemStride[D_MAX_JPEG_HW_COMP]; //OK | |
365 | unsigned int compTileBufStride[D_MAX_JPEG_HW_COMP]; // hSamplingFactor[n] * 8 * mcuPerRow (byte pitch of a component) | |
366 | ||
367 | ||
368 | ||
369 | unsigned int mcuPerRow; //OK //move to HAL ///< number of MCU row in the JPEG file | |
370 | unsigned int pauseRow_en; //OK | |
371 | unsigned int pauseRowCnt; //move to HAL | |
372 | unsigned int pauseMCU; //OK | |
373 | unsigned int tileBufRowNum ; //move to HAL | |
374 | unsigned int buffer_Y_PA ; //move to HAL | |
375 | unsigned int buffer_Cb_PA; //move to HAL | |
376 | unsigned int buffer_Cr_PA; //move to HAL | |
377 | unsigned int buffer_Y_row_size ; //move to HAL | |
378 | unsigned int buffer_C_row_size ; //move to HAL | |
379 | ||
380 | ||
381 | //unsigned int compDU[3]; //OK ///< (required by HW decoder) number of DU for each component | |
382 | //unsigned int duPerMCURow[3]; //OK ///< (required by HW decoder) DU per MCU row for each component (MT6589_NOUSE) | |
383 | //unsigned int dummyDU[3]; //OK ///< (required by HW decoder) number of dummy DU for each component (MT6589_NOUSE) | |
384 | //unsigned int samplingFormat; //OK /// how many format? | |
385 | ||
386 | ||
387 | ||
388 | ||
389 | }JPEG_DEC_DRV_IN; | |
390 | ||
391 | ||
392 | ||
393 | ||
394 | ||
395 | typedef struct | |
396 | { | |
397 | unsigned int decRowBuf[3]; //OK | |
398 | unsigned int pauseMCU; //OK | |
399 | ||
400 | ||
401 | }JPEG_DEC_CONFIG_ROW; | |
402 | ||
403 | ||
404 | ||
405 | ||
406 | ||
407 | ||
408 | typedef struct | |
409 | { | |
410 | // from mt6575 | |
411 | unsigned int srcStreamAddrBase; | |
412 | unsigned int srcStreamSize; | |
413 | unsigned int srcStreamAddrWritePtr; | |
414 | ||
415 | unsigned int outputBuffer0[3]; | |
416 | unsigned int outputBuffer1[3]; /* nouse in full frame mode, only use in PauseResume/DirectCouple mode */ | |
417 | ||
418 | unsigned int mcuPerRow; ///< number of MCU row in the JPEG file | |
419 | unsigned int totalMcuRows; ///< number of MCU column in the JPEG file | |
420 | ||
421 | unsigned int compDU[3]; ///< (required by HW decoder) number of DU for each component | |
422 | unsigned int duPerMCURow[3]; ///< (required by HW decoder) DU per MCU row for each component (MT6589_NOUSE) | |
423 | unsigned int dummyDU[3]; ///< (required by HW decoder) number of dummy DU for each component (MT6589_NOUSE) | |
424 | ||
425 | unsigned int samplingFormat; /// how many format? | |
426 | ||
427 | // JPEG component information | |
428 | unsigned int componentNum; | |
429 | unsigned int componentID[3]; ///< Ci | |
430 | unsigned int hSamplingFactor[3]; ///< Hi | |
431 | unsigned int vSamplingFactor[3]; ///< Vi | |
432 | unsigned int qTableSelector[3]; ///< Tqi (OT: need this field?) | |
433 | ||
434 | /*********************************************************************************/ | |
435 | ||
436 | /* common */ | |
437 | unsigned int totalMCU ; | |
438 | unsigned char blkNumInMCU; //total drv no use | |
439 | ||
440 | unsigned char u1MaxHorSample, u1MaxVerSample; // widest, highest | |
441 | unsigned int u4PicWidth, u4PicHeight; // picture width and height | |
442 | unsigned int compImgStride[D_MAX_JPEG_HW_COMP]; // hSamplingFactor[n] * 8 * mcuPerRow (byte pitch of a component) | |
443 | unsigned int compTileBufStride[D_MAX_JPEG_HW_COMP]; // hSamplingFactor[n] * 8 * mcuPerRow (byte pitch of a component) | |
444 | unsigned int au4PicWidthInBuf[D_MAX_JPEG_HW_COMP]; | |
445 | ||
446 | ||
447 | // use only in look ahead table | |
448 | unsigned char au1MemberShip[D_MAX_JPEG_BLOCK_NUM]; // DU mapping to components | |
449 | unsigned char aau1Qtbl[D_MAX_JPEG_QTBL][128]; // q tables in stream | |
450 | unsigned int u4RestartInterval; | |
451 | ||
452 | /* current scan */ | |
453 | unsigned char u1NumCompsInCurrScan; // number of components in current scan | |
454 | int afgCompInScan[D_MAX_JPEG_HW_COMP + 1]; | |
455 | //unsigned char qTableSelector[D_MAX_JPEG_HW_COMP]; | |
456 | unsigned char au1BlkDc[D_MAX_JPEG_BLOCK_NUM]; | |
457 | unsigned char au1BlkAc[D_MAX_JPEG_BLOCK_NUM]; | |
458 | unsigned char u1Se; /* OT: NO USE */ | |
459 | unsigned char u1Ss; /* OT: NO USE */ | |
460 | ||
461 | /* current mcu row */ | |
462 | unsigned int u4CurrMcuRow; | |
463 | unsigned int u4ModTotalRows; | |
464 | ||
465 | ||
466 | /* for single component in p scan */ | |
467 | unsigned char u1FirstCompInScan; | |
468 | ||
469 | /* for BRZ */ | |
470 | unsigned char lumaHorDecimate; //(0): 1, (1): 1/2, (2): 1/4, (3): 1/8 | |
471 | unsigned char lumaVerDecimate; | |
472 | unsigned char cbcrHorDecimate; | |
473 | unsigned char cbcrVerDecimate; | |
474 | unsigned int srcColorFormat; | |
475 | unsigned int dstColorFormat; | |
476 | unsigned int u4isColorConv; | |
477 | unsigned int u4ds_width[3] ; | |
478 | unsigned int u4ds_height[3] ; | |
479 | ||
480 | unsigned int decodeMode; | |
481 | unsigned int gdmaBypassEn; | |
482 | unsigned int regDecDumpEn; | |
483 | ||
484 | unsigned int pauseRow_en; | |
485 | unsigned int pauseRowCnt; | |
486 | unsigned int tileBufRowNum ; | |
487 | unsigned int buffer_Y_PA ; | |
488 | unsigned int buffer_Cb_PA; | |
489 | unsigned int buffer_Cr_PA; | |
490 | unsigned int buffer_Y_row_size ; | |
491 | unsigned int buffer_C_row_size ; | |
492 | ||
493 | } JpegDrvDecConfig; | |
494 | ||
495 | typedef struct | |
496 | { | |
497 | unsigned int *pChksum; | |
498 | } JpegDrvDecResult; | |
499 | ||
500 | ||
501 | ||
502 | ||
503 | ||
504 | ||
505 | ||
506 | ||
507 | ||
508 | ||
509 | ||
510 | ||
511 | ||
512 | ||
513 | ||
514 | ||
515 | ||
516 | ||
517 | ||
518 | //========================================================================================== | |
519 | ||
520 | ||
521 | // JPEG Encoder Structure | |
522 | typedef struct | |
523 | { | |
524 | ||
525 | unsigned int dstBufferAddr; | |
526 | unsigned int dstBufferSize; | |
527 | ||
528 | unsigned int encWidth; //HW directly fill to header | |
529 | unsigned int encHeight; //HW directly fill to header | |
530 | ||
531 | unsigned char enableEXIF; | |
532 | unsigned char allocBuffer; | |
533 | //unsigned char enableSyncReset; //not use in mt6589 | |
534 | ||
535 | unsigned int encQuality; | |
536 | unsigned int encFormat; | |
537 | ||
538 | //extend in mt6589 | |
539 | unsigned int disableGMC; //TBD: not support | |
540 | unsigned int restartInterval; | |
541 | unsigned int srcBufferAddr; // YUV420: Luma | |
542 | unsigned int srcChromaAddr; | |
543 | unsigned int imgStride ; | |
544 | unsigned int memStride ; | |
545 | unsigned int totalEncDU ; | |
546 | unsigned int dstBufAddrOffset; | |
547 | unsigned int dstBufAddrOffsetMask; | |
548 | ||
549 | }JPEG_ENC_DRV_IN; | |
550 | ||
551 | ||
552 | ||
553 | ||
554 | ||
555 | typedef struct | |
556 | { | |
557 | long timeout; | |
558 | unsigned int *fileSize; | |
559 | unsigned int *result; | |
560 | unsigned int *cycleCount; | |
561 | ||
562 | }JPEG_ENC_DRV_OUT; | |
563 | ||
564 | typedef struct { | |
565 | unsigned long startAddr;//In : | |
566 | unsigned long size; | |
567 | unsigned long result;// 0 : out of pmem range, 1 : inside pmem range, 2 : partially overlap with pmem range | |
568 | } JPEG_PMEM_RANGE; | |
569 | ||
570 | //==================================================================================== | |
571 | ||
572 | ||
573 | typedef struct | |
574 | { | |
575 | long timeout; | |
576 | unsigned int *pFileSize; | |
577 | unsigned int *pResult; | |
578 | unsigned int *pCycleCount; | |
579 | ||
580 | } JpegDrvEncResult; | |
581 | ||
582 | ||
583 | ||
584 | ||
585 | ||
586 | ||
587 | //typedef struct | |
588 | //{ | |
589 | // unsigned int srcBufferAddr; // YUV420: Luma | |
590 | // unsigned int srcChromaAddr; | |
591 | // unsigned int dstBufferAddr; | |
592 | // unsigned int dstBufferSize; | |
593 | // | |
594 | // unsigned int srcWidth; | |
595 | // unsigned int srcHeight; | |
596 | // | |
597 | // unsigned char enableEXIF; | |
598 | // unsigned char disableGMC; //not support | |
599 | // | |
600 | // unsigned int restartInterval; | |
601 | // unsigned int quality; | |
602 | // unsigned int yuvFormat; | |
603 | // | |
604 | //} JpegDrvEncParam; | |
605 | ||
606 | ||
607 | ||
608 | //====================================================================================== | |
609 | ||
610 | ||
611 | ||
612 | ||
613 | ||
614 | ||
615 | ||
616 | #define JPEG_IOCTL_MAGIC 'x' | |
617 | ||
618 | #if 0 | |
619 | #define JPEG_DEC_IOCTL_INIT _IO (JPEG_IOCTL_MAGIC, 1) | |
620 | //#define JPEG_DEC_IOCTL_CONFIG _IOW (JPEG_IOCTL_MAGIC, 2, JPEG_DEC_DRV_IN) | |
621 | #define JPEG_DEC_IOCTL_START _IO (JPEG_IOCTL_MAGIC, 3) | |
622 | #define JPEG_DEC_IOCTL_WAIT _IOWR(JPEG_IOCTL_MAGIC, 6, JPEG_DEC_DRV_OUT) | |
623 | #define JPEG_DEC_IOCTL_DEINIT _IO (JPEG_IOCTL_MAGIC, 8) | |
624 | //#define JPEG_DEC_IOCTL_RESUME _IOW(JPEG_IOCTL_MAGIC, 4, JPEG_DEC_RESUME_IN) | |
625 | //#define JPEG_DEC_IOCTL_RANGE _IOWR(JPEG_IOCTL_MAGIC, 5, JPEG_DEC_RANGE_IN) | |
626 | //#define JPEG_DEC_IOCTL_COPY _IOWR(JPEG_IOCTL_MAGIC, 7, int) | |
627 | #endif | |
628 | ||
629 | ///////////////////// JPEG DEC IOCTL ///////////////////////////////////// | |
630 | #define JPEG_DEC_IOCTL_INIT _IO (JPEG_IOCTL_MAGIC, 1) | |
631 | #define JPEG_DEC_IOCTL_CONFIG _IOW (JPEG_IOCTL_MAGIC, 2, JPEG_DEC_DRV_IN) | |
632 | #define JPEG_DEC_IOCTL_FLOW _IOW (JPEG_IOCTL_MAGIC, 3, JpegDrvDecFlow) | |
633 | #define JPEG_DEC_IOCTL_START _IO (JPEG_IOCTL_MAGIC, 4) | |
634 | #define JPEG_DEC_IOCTL_WAIT _IOWR (JPEG_IOCTL_MAGIC, 5, JPEG_DEC_DRV_OUT) | |
635 | #define JPEG_DEC_IOCTL_DEINIT _IO (JPEG_IOCTL_MAGIC, 6) | |
636 | ||
637 | #define JPEG_DEC_IOCTL_RESET _IO (JPEG_IOCTL_MAGIC, 7) | |
638 | #define JPEG_DEC_IOCTL_CHKSUM _IOWR (JPEG_IOCTL_MAGIC, 8, JpegDrvDecResult) | |
639 | #define JPEG_DEC_IOCTL_BREAK _IO (JPEG_IOCTL_MAGIC, 9) | |
640 | #define JPEG_DEC_IOCTL_RW_REG _IO (JPEG_IOCTL_MAGIC, 10) | |
641 | #define JPEG_DEC_IOCTL_RESUME _IOW (JPEG_IOCTL_MAGIC, 11, JPEG_DEC_CONFIG_ROW) | |
642 | ||
643 | #define JPEG_DEC_IOCTL_DUMP_REG _IO (JPEG_IOCTL_MAGIC, 30) | |
644 | //#define JPEG_DEC_IOCTL_MAN_GDMA _IOW (JPEG_IOCTL_MAGIC, 31, unsigned char) | |
645 | ||
646 | ||
647 | ||
648 | ///////////////////// JPEG ENC IOCTL ///////////////////////////////////// | |
649 | ||
650 | ||
651 | #define JPEG_ENC_IOCTL_INIT _IO (JPEG_IOCTL_MAGIC, 11) | |
652 | #define JPEG_ENC_IOCTL_CONFIG _IOW (JPEG_IOCTL_MAGIC, 12, JPEG_ENC_DRV_IN) | |
653 | #define JPEG_ENC_IOCTL_WAIT _IOWR(JPEG_IOCTL_MAGIC, 13, JPEG_ENC_DRV_OUT) | |
654 | #define JPEG_ENC_IOCTL_DEINIT _IO (JPEG_IOCTL_MAGIC, 14) | |
655 | #define JPEG_ENC_IOCTL_START _IO (JPEG_IOCTL_MAGIC, 15) | |
656 | ||
657 | ||
658 | #define JPEG_ENC_IOCTL_WARM_RESET _IO(JPEG_IOCTL_MAGIC, 20) | |
659 | #define JPEG_ENC_IOCTL_DUMP_REG _IO(JPEG_IOCTL_MAGIC, 21) | |
660 | #define JPEG_ENC_IOCTL_RW_REG _IO(JPEG_IOCTL_MAGIC, 22) | |
661 | ||
662 | ||
663 | #endif | |
664 |