xref: /rockchip-linux_mpp/mpp/codec/enc/h265/h265e_enctropy.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 __H265E_ENCTROPY_H__
18 #define __H265E_ENCTROPY_H__
19 
20 #include "mpp_bitwrite.h"
21 
22 typedef struct H265eContextModel {
23     RK_U8 m_state;  ///< internal state variable
24     RK_U8 bBinsCoded;
25 } H265eContextModel_t;
26 
27 typedef struct H265eCabacCtx {
28     MppWriteCtx *m_bitIf;
29     RK_U32      m_low;
30     RK_U32      m_range;
31     RK_U32      m_bufferedByte;
32     RK_S32      m_numBufferedBytes;
33     RK_S32      m_bitsLeft;
34     RK_U64      m_fracBits;
35     RK_U8       m_bIsCounter;
36 } H265eCabacCtx;
37 
38 #ifdef __cplusplus
39 extern "C" {
40 #endif
41 
42 void h265e_cabac_init(H265eCabacCtx *cabac_ctx, MppWriteCtx * bitIf);
43 void h265e_reset_enctropy(void *slice_ctx);
44 void h265e_cabac_resetBits(H265eCabacCtx *cabac_ctx);
45 void h265e_cabac_encodeBin(H265eCabacCtx *cabac_ctx, H265eContextModel_t *ctxModel, RK_U32 binValue);
46 void h265e_cabac_encodeBinTrm(H265eCabacCtx *cabac_ctx, RK_U32 binValue);
47 void h265e_cabac_start(H265eCabacCtx *cabac_ctx);
48 void h265e_cabac_finish(H265eCabacCtx *cabac_ctx);
49 void h265e_cabac_flush(H265eCabacCtx *cabac_ctx);
50 
51 #ifdef __cplusplus
52 }
53 #endif
54 
55 #endif
56