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