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_CONTEXT_TABLE_H__ 18 #define __H265E_CONTEXT_TABLE_H__ 19 20 #include "rk_type.h" 21 22 #define NUM_SPLIT_FLAG_CTX 3 ///< number of context models for split flag 23 #define NUM_SKIP_FLAG_CTX 3 ///< number of context models for skip flag 24 #define NUM_MERGE_FLAG_EXT_CTX 1 ///< number of context models for merge flag of merge extended 25 #define NUM_MERGE_IDX_EXT_CTX 1 ///< number of context models for merge index of merge extended 26 27 #define OFF_SPLIT_FLAG_CTX (0) 28 #define OFF_SKIP_FLAG_CTX (OFF_SPLIT_FLAG_CTX + NUM_SPLIT_FLAG_CTX)//3 29 #define OFF_MERGE_FLAG_EXT_CTX (OFF_SKIP_FLAG_CTX + NUM_SKIP_FLAG_CTX)//3 30 #define OFF_MERGE_IDX_EXT_CTX (OFF_MERGE_FLAG_EXT_CTX + NUM_MERGE_FLAG_EXT_CTX)//1 31 #define MAX_OFF_CTX_MOD (OFF_MERGE_IDX_EXT_CTX + NUM_MERGE_IDX_EXT_CTX) 32 #define CNU 154 ///< dummy initialization value for unused context models 'Context model Not Used' 33 34 extern const uint8_t g_nextState[128][2]; 35 36 #define sbacGetMps(S) ((S) & 1) 37 #define sbacGetState(S) ((S) >> 1) 38 #define sbacNext(S, V) (g_nextState[(S)][(V)]) 39 40 static const RK_U8 INIT_SPLIT_FLAG[3][NUM_SPLIT_FLAG_CTX] = { 41 { 107, 139, 126, }, 42 { 107, 139, 126, }, 43 { 139, 141, 157, }, 44 }; 45 46 static const RK_U8 INIT_SKIP_FLAG[3][NUM_SKIP_FLAG_CTX] = { 47 { 197, 185, 201, }, 48 { 197, 185, 201, }, 49 { CNU, CNU, CNU, }, 50 }; 51 52 static const RK_U8 INIT_MERGE_FLAG_EXT[3][NUM_MERGE_FLAG_EXT_CTX] = { 53 { 154, }, 54 { 110, }, 55 { CNU, }, 56 }; 57 58 static const RK_U8 INIT_MERGE_IDX_EXT[3][NUM_MERGE_IDX_EXT_CTX] = { 59 { 137, }, 60 { 122, }, 61 { CNU, }, 62 }; 63 64 #endif /* __H265E_CONTEXT_TABLE_H__ */