xref: /rockchip-linux_mpp/mpp/hal/vpu/mpg4d/hal_m4vd_com.h (revision 437bfbeb9567cca9cd9080e3f6954aa9d6a94f18)
1 /*
2  * Copyright 2017 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_M4VD_COM_H__
18 #define __HAL_M4VD_COM_H__
19 
20 #include "mpp_hal.h"
21 #include "mpp_device.h"
22 
23 #include "mpg4d_syntax.h"
24 
25 #define MPG4D_HAL_DBG_REG_PUT       (0x00000001)
26 #define MPG4D_HAL_DBG_REG_GET       (0x00000002)
27 
28 extern RK_U32 hal_mpg4d_debug;
29 
30 #define MPEG4_MAX_MV_BUF_SIZE       ((1920/16)*(1088/16)*4*sizeof(RK_U32))
31 
32 typedef struct mpeg4d_reg_context {
33     MppBufSlots         frm_slots;
34     MppBufSlots         pkt_slots;
35     MppBufferGroup      group;
36     MppCbCtx            *dec_cb;
37     MppDev              dev;
38     // save fd for curr/ref0/ref1 for reg_gen
39     RK_S32              fd_curr;
40     RK_S32              fd_ref0;
41     RK_S32              fd_ref1;
42     RK_U32              bitstrm_len;
43     // mv info buffer
44     // NOTE: mv buffer fix to 1080p size for convenience
45     MppBuffer           mv_buf;
46     MppBuffer           qp_table;
47 
48     void*               regs;
49     MppHalApi           hal_api;
50 } hal_mpg4_ctx;
51 
52 extern RK_U8 default_inter_matrix[64];
53 extern RK_U8 default_intra_matrix[64];
54 
55 extern void vpu_mpg4d_get_buffer_by_index(hal_mpg4_ctx *ctx, RK_S32 index, MppBuffer *buffer);
56 
57 #endif /*__HAL_M4VD_COM_H__*/
58