• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright (C) 2022 Beken Corporation
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 //     http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #pragma once
16 
17 #include <common/bk_err.h>
18 
19 
20 #ifdef __cplusplus
21 extern "C" {
22 #endif
23 int jpg_decoder_fun(unsigned char *jpg_buf, unsigned char ** Y_buf, int pic_size);
24 void jpg_get_pic_size(int *width, int *heigth);
25 
26 
27 typedef struct _JPG_DECODER_ST
28 {
29 	int width;
30 	int heigth;
31 	int scale_ratio;//0,1
32 	int line_wbyte;
33 	int rd_ptr;
34 	int jpg_file_size;//jpg file size
35 	unsigned char *outputbuf;//y data
36 	unsigned char *inputbuf;//jpg data
37 	unsigned char *workbuf;
38 
39 }JPG_DECODER_ST;
40 
41 #define AUTO_DEC 1
42 
43 
44 /**<jpeg dec input size*/
45 #define V1080P_RD_LEN   (20480*16-1)  //320k
46 #define V720P_RD_LEN    (20480*12-1)  //240K
47 #define VGA_RD_LEN      (20480*5-1)  //100k
48 #define HVGA_RD_LEN     (20480*4-1)  //80k
49 
50 /**<jpeg dec output size*/
51 #define PIXEL_320_480    (320 * 480 * 2)
52 #define PIXEL_480_272    261120
53 #define PIXEL_640_480    614400
54 #define PIXEL_1280_720   1843200
55 #define PIXEL_1920_1080  4147200
56 
57 /**<jpeg dec block num*/
58 #define X_PIXEL_320_BLOCK    4800
59 #define X_PIXEL_480_BLOCK    4080
60 #define X_PIXEL_640_BLOCK    9600
61 #define X_PIXEL_1280_BLOCK   28800
62 #define X_PIXEL_1920_BLOCK   64800
63 
64 #define JPEGDEC_START    1
65 #define JPEGDEC_DC_CLEAR 4
66 
67 
68 /*
69  * @}
70  */
71 
72 #ifdef __cplusplus
73 }
74 #endif
75 
76 
77