xref: /rockchip-linux_mpp/mpp/base/inc/mpp_bitput.h (revision 437bfbeb9567cca9cd9080e3f6954aa9d6a94f18)
1*437bfbebSnyanmisaka /*
2*437bfbebSnyanmisaka  *
3*437bfbebSnyanmisaka  * Copyright 2015 Rockchip Electronics Co. LTD
4*437bfbebSnyanmisaka  *
5*437bfbebSnyanmisaka  * Licensed under the Apache License, Version 2.0 (the "License");
6*437bfbebSnyanmisaka  * you may not use this file except in compliance with the License.
7*437bfbebSnyanmisaka  * You may obtain a copy of the License at
8*437bfbebSnyanmisaka  *
9*437bfbebSnyanmisaka  *      http://www.apache.org/licenses/LICENSE-2.0
10*437bfbebSnyanmisaka  *
11*437bfbebSnyanmisaka  * Unless required by applicable law or agreed to in writing, software
12*437bfbebSnyanmisaka  * distributed under the License is distributed on an "AS IS" BASIS,
13*437bfbebSnyanmisaka  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14*437bfbebSnyanmisaka  * See the License for the specific language governing permissions and
15*437bfbebSnyanmisaka  * limitations under the License.
16*437bfbebSnyanmisaka  */
17*437bfbebSnyanmisaka 
18*437bfbebSnyanmisaka #ifndef __MPP_BITPUT_H__
19*437bfbebSnyanmisaka #define __MPP_BITPUT_H__
20*437bfbebSnyanmisaka 
21*437bfbebSnyanmisaka #include "rk_type.h"
22*437bfbebSnyanmisaka #include "mpp_err.h"
23*437bfbebSnyanmisaka #include "mpp_common.h"
24*437bfbebSnyanmisaka 
25*437bfbebSnyanmisaka typedef struct bitput_ctx_t {
26*437bfbebSnyanmisaka     RK_U32          buflen;         //!< max buf length, 64bit uint
27*437bfbebSnyanmisaka     RK_U32          index;           //!< current uint position
28*437bfbebSnyanmisaka     RK_U64          *pbuf;          //!< outpacket data
29*437bfbebSnyanmisaka     RK_U64          bvalue;         //!< buffer value, 64 bit
30*437bfbebSnyanmisaka     RK_U8           bitpos;         //!< bit pos in 64bit
31*437bfbebSnyanmisaka     RK_U32          size;           //!< data size,except header
32*437bfbebSnyanmisaka } BitputCtx_t;
33*437bfbebSnyanmisaka 
34*437bfbebSnyanmisaka #ifdef  __cplusplus
35*437bfbebSnyanmisaka extern "C" {
36*437bfbebSnyanmisaka #endif
37*437bfbebSnyanmisaka 
38*437bfbebSnyanmisaka RK_S32 mpp_set_bitput_ctx(BitputCtx_t *bp, RK_U64 *data, RK_U32 len);
39*437bfbebSnyanmisaka void mpp_put_bits(BitputCtx_t *bp, RK_U64 invalue, RK_S32 lbits);
40*437bfbebSnyanmisaka void mpp_put_align(BitputCtx_t *bp, RK_S32 align_bits, int flag);
41*437bfbebSnyanmisaka 
42*437bfbebSnyanmisaka #ifdef  __cplusplus
43*437bfbebSnyanmisaka }
44*437bfbebSnyanmisaka #endif
45*437bfbebSnyanmisaka 
46*437bfbebSnyanmisaka #endif
47