summaryrefslogtreecommitdiffstats
path: root/common/ih264_cabac_tables.h
blob: 0cef51e6d461bb3c57815932ae12a8f3c550c877 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
/******************************************************************************
 *
 * Copyright (C) 2015 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at:
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 *****************************************************************************
 * Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/

/**
******************************************************************************
* @file ih264_cabac_tables.h
*
* @brief
*  This file contains enumerations, macros and extern declarations of H264
*  cabac tables
*
* @author
*  Ittiam
*
* @remarks
*  none
******************************************************************************
*/

#ifndef IH264_CABAC_TABLES_H_
#define IH264_CABAC_TABLES_H_

/*****************************************************************************/
/* Constant Macros                                                           */
/*****************************************************************************/

/**
******************************************************************************
 *  @brief  maximum range of cabac_init_idc (0-2)
******************************************************************************
 */
#define IH264_NUM_CABAC_INIT_IDC_PLUS_ONE   4

/**
******************************************************************************
 *  @brief  max range of qps in H264 (0-51)
******************************************************************************
 */
#define IH264_MAX_QP      52

/**
******************************************************************************
 *  @brief  max range of cabac contexts in H264 (0-459)
******************************************************************************
 */
#define IH264_NUM_CABAC_CTXTS 460

/*****************************************************************************/
/* Extern global declarations                                                */
/*****************************************************************************/

/**
 ******************************************************************************
 * @breif  Table for rangeTabLPS depending on pStateIdx and qCodIRangeIdx
 * input   : pStateIdx(0-63) and qCodIRangeIdx(0-3) [(Range >> 6) & 0x3]
 * output  : RLps
 *
 * @remarks See Table 9-35 of H264 spec for rangeTabLPS
 *******************************************************************************
 */
extern const UWORD8 gau1_ih264_cabac_rlps[64][4];


/**
 ******************************************************************************
 * @breif  probability+MPS state transition tables based on cur State and bin
 * input  : curpState[bits7-2]  | curMPS[bit1] | decodedBin[bit0]
 * output : nextpState[bits6-1] | nextMPS[bit0]
 * @remarks Modified form of Table-9-36 State Transition table in H264 spec
 ******************************************************************************
 */
extern const UWORD8 gau1_ih264_next_state[128*2];


/**
 ******************************************************************************
 * @brief  Init context tables for all combinations of qp and cabac_init_idc
 * @remarks Packing format MPS in lsb and pState in bits[1-6]
 ******************************************************************************
 */
extern const UWORD8 gau1_ih264_cab_ctxts[IH264_NUM_CABAC_INIT_IDC_PLUS_ONE][IH264_MAX_QP][IH264_NUM_CABAC_CTXTS];


#endif /* IH264_CABAC_TABLES_H_ */