xref: /rockchip-linux_mpp/mpp/hal/vpu/jpege/hal_jpege_base.h (revision 437bfbeb9567cca9cd9080e3f6954aa9d6a94f18)
1 /*
2  * Copyright 2015 Rockchip Electronics Co. LTD
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef __HAL_JPEGE_BASE_H__
18 #define __HAL_JPEGE_BASE_H__
19 
20 #include "mpp_device.h"
21 #include "hal_enc_task.h"
22 
23 #include "vepu_common.h"
24 
25 #include "jpege_syntax.h"
26 #include "hal_jpege_hdr.h"
27 
28 typedef struct hal_jpege_ctx_s {
29     MppDev              dev;
30     MppClientType       type;
31 
32     JpegeBits           bits;
33     /* NOTE: regs should reserve space for extra_info */
34     void                *regs;
35     void                *regs_out;
36     RK_U32              reg_size;
37     RK_S32              task_cnt;
38     RK_S32              task_idx;
39 
40     MppEncCfgSet        *cfg;
41     JpegeSyntax         syntax;
42     JpegeFeedback       feedback;
43 
44     /* For part encode mode */
45     RK_U32              mcu_h;
46     RK_U32              mcu_y;
47     RK_U8               *base;
48     size_t              size;
49     RK_U32              sw_bit;
50     RK_U32              part_bytepos;
51     RK_U32              part_x_fill;
52     RK_U32              part_y_fill;
53     RK_U32              rst_marker_idx;
54 
55     HalJpegeRc          hal_rc;
56     RK_S32              hal_start_pos;
57     VepuStrideCfg       stride_cfg;
58 
59     void                *ctx_ext;
60 } HalJpegeCtx;
61 
62 extern const RK_U32 qp_reorder_table[QUANTIZE_TABLE_SIZE];
63 extern const RK_U16 jpege_restart_marker[8];
64 
65 #ifdef __cplusplus
66 extern "C" {
67 #endif
68 
69 void get_msb_lsb_at_pos(RK_U32 *msb, RK_U32 *lsb, RK_U8 *buf, RK_U32 bytepos);
70 
71 #ifdef __cplusplus
72 }
73 #endif
74 
75 #endif /* __HAL_JPEGE_BASE_H__ */
76