[5] | 1 | /* The copyright in this software is being made available under the BSD |
---|
| 2 | * License, included below. This software may be subject to other third party |
---|
| 3 | * and contributor rights, including patent rights, and no such rights are |
---|
[1200] | 4 | * granted under this license. |
---|
[5] | 5 | * |
---|
[1200] | 6 | * Copyright (c) 2010-2015, ITU/ISO/IEC |
---|
[5] | 7 | * All rights reserved. |
---|
| 8 | * |
---|
| 9 | * Redistribution and use in source and binary forms, with or without |
---|
| 10 | * modification, are permitted provided that the following conditions are met: |
---|
| 11 | * |
---|
| 12 | * * Redistributions of source code must retain the above copyright notice, |
---|
| 13 | * this list of conditions and the following disclaimer. |
---|
| 14 | * * Redistributions in binary form must reproduce the above copyright notice, |
---|
| 15 | * this list of conditions and the following disclaimer in the documentation |
---|
| 16 | * and/or other materials provided with the distribution. |
---|
[56] | 17 | * * Neither the name of the ITU/ISO/IEC nor the names of its contributors may |
---|
[5] | 18 | * be used to endorse or promote products derived from this software without |
---|
| 19 | * specific prior written permission. |
---|
| 20 | * |
---|
| 21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
---|
| 22 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
---|
| 23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
---|
| 24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS |
---|
| 25 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
---|
| 26 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
---|
| 27 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
---|
| 28 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
---|
| 29 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
---|
| 30 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF |
---|
| 31 | * THE POSSIBILITY OF SUCH DAMAGE. |
---|
| 32 | */ |
---|
[2] | 33 | |
---|
| 34 | /** \file ContextTables.h |
---|
| 35 | \brief Defines constants and tables for SBAC |
---|
| 36 | \todo number of context models is not matched to actual use, should be fixed |
---|
| 37 | */ |
---|
| 38 | |
---|
| 39 | #ifndef __CONTEXTTABLES__ |
---|
| 40 | #define __CONTEXTTABLES__ |
---|
| 41 | |
---|
[56] | 42 | //! \ingroup TLibCommon |
---|
| 43 | //! \{ |
---|
| 44 | |
---|
[2] | 45 | // ==================================================================================================================== |
---|
| 46 | // Constants |
---|
| 47 | // ==================================================================================================================== |
---|
| 48 | |
---|
[56] | 49 | #define MAX_NUM_CTX_MOD 512 ///< maximum number of supported contexts |
---|
| 50 | |
---|
[2] | 51 | #define NUM_SPLIT_FLAG_CTX 3 ///< number of context models for split flag |
---|
| 52 | #define NUM_SKIP_FLAG_CTX 3 ///< number of context models for skip flag |
---|
[1196] | 53 | #if H_3D |
---|
[1179] | 54 | #define NUM_DIS_FLAG_CTX 1 |
---|
| 55 | #define NUM_DIS_TYPE_CTX 1 |
---|
[1039] | 56 | #endif |
---|
[56] | 57 | #define NUM_MERGE_FLAG_EXT_CTX 1 ///< number of context models for merge flag of merge extended |
---|
| 58 | #define NUM_MERGE_IDX_EXT_CTX 1 ///< number of context models for merge index of merge extended |
---|
[2] | 59 | |
---|
[56] | 60 | #define NUM_PART_SIZE_CTX 4 ///< number of context models for partition size |
---|
| 61 | #define NUM_PRED_MODE_CTX 1 ///< number of context models for prediction mode |
---|
[2] | 62 | |
---|
[1200] | 63 | #define NUM_INTRA_PREDICT_CTX 1 ///< number of context models for intra prediction |
---|
[56] | 64 | |
---|
| 65 | #define NUM_CHROMA_PRED_CTX 2 ///< number of context models for intra prediction (chroma) |
---|
[608] | 66 | #define NUM_INTER_DIR_CTX 5 ///< number of context models for inter prediction direction |
---|
[56] | 67 | #define NUM_MV_RES_CTX 2 ///< number of context models for motion vector difference |
---|
[1200] | 68 | #define NUM_CHROMA_QP_ADJ_FLAG_CTX 1 ///< number of context models for chroma_qp_adjustment_flag |
---|
| 69 | #define NUM_CHROMA_QP_ADJ_IDC_CTX 1 ///< number of context models for chroma_qp_adjustment_idc |
---|
[2] | 70 | |
---|
[608] | 71 | #define NUM_REF_NO_CTX 2 ///< number of context models for reference index |
---|
| 72 | #define NUM_TRANS_SUBDIV_FLAG_CTX 3 ///< number of context models for transform subdivision flags |
---|
[56] | 73 | #define NUM_QT_ROOT_CBF_CTX 1 ///< number of context models for QT ROOT CBF |
---|
| 74 | #define NUM_DELTA_QP_CTX 3 ///< number of context models for dQP |
---|
[2] | 75 | |
---|
[56] | 76 | #define NUM_SIG_CG_FLAG_CTX 2 ///< number of context models for MULTI_LEVEL_SIGNIFICANCE |
---|
[1200] | 77 | #define NUM_EXPLICIT_RDPCM_FLAG_CTX 1 ///< number of context models for the flag which specifies whether to use RDPCM on inter coded residues |
---|
| 78 | #define NUM_EXPLICIT_RDPCM_DIR_CTX 1 ///< number of context models for the flag which specifies which RDPCM direction is used on inter coded residues |
---|
[56] | 79 | |
---|
[1200] | 80 | //-------------------------------------------------------------------------------------------------- |
---|
[56] | 81 | |
---|
[1200] | 82 | // context size definitions for significance map |
---|
| 83 | |
---|
| 84 | #define NUM_SIG_FLAG_CTX_LUMA 28 ///< number of context models for luma sig flag |
---|
| 85 | #define NUM_SIG_FLAG_CTX_CHROMA 16 ///< number of context models for chroma sig flag |
---|
| 86 | |
---|
| 87 | // |----Luma-----| |---Chroma----| |
---|
| 88 | static const UInt significanceMapContextSetStart [MAX_NUM_CHANNEL_TYPE][CONTEXT_NUMBER_OF_TYPES] = { {0, 9, 21, 27}, {0, 9, 12, 15} }; |
---|
| 89 | static const UInt significanceMapContextSetSize [MAX_NUM_CHANNEL_TYPE][CONTEXT_NUMBER_OF_TYPES] = { {9, 12, 6, 1}, {9, 3, 3, 1} }; |
---|
| 90 | static const UInt nonDiagonalScan8x8ContextOffset [MAX_NUM_CHANNEL_TYPE] = { 6, 0 }; |
---|
| 91 | static const UInt notFirstGroupNeighbourhoodContextOffset[MAX_NUM_CHANNEL_TYPE] = { 3, 0 }; |
---|
| 92 | |
---|
| 93 | //------------------ |
---|
| 94 | |
---|
| 95 | #define NEIGHBOURHOOD_00_CONTEXT_1_THRESHOLD_4x4 3 |
---|
| 96 | #define NEIGHBOURHOOD_00_CONTEXT_2_THRESHOLD_4x4 1 |
---|
| 97 | |
---|
| 98 | //------------------ |
---|
| 99 | |
---|
| 100 | #define FIRST_SIG_FLAG_CTX_LUMA 0 |
---|
| 101 | #define FIRST_SIG_FLAG_CTX_CHROMA (FIRST_SIG_FLAG_CTX_LUMA + NUM_SIG_FLAG_CTX_LUMA) |
---|
| 102 | |
---|
| 103 | #define NUM_SIG_FLAG_CTX (NUM_SIG_FLAG_CTX_LUMA + NUM_SIG_FLAG_CTX_CHROMA) ///< number of context models for sig flag |
---|
| 104 | |
---|
| 105 | //-------------------------------------------------------------------------------------------------- |
---|
| 106 | |
---|
| 107 | // context size definitions for last significant coefficient position |
---|
| 108 | |
---|
| 109 | #define NUM_CTX_LAST_FLAG_SETS 2 |
---|
| 110 | |
---|
[56] | 111 | #define NUM_CTX_LAST_FLAG_XY 15 ///< number of context models for last coefficient position |
---|
[2] | 112 | |
---|
[1200] | 113 | //-------------------------------------------------------------------------------------------------- |
---|
[56] | 114 | |
---|
[1200] | 115 | // context size definitions for greater-than-one and greater-than-two maps |
---|
| 116 | |
---|
| 117 | #define NUM_ONE_FLAG_CTX_PER_SET 4 ///< number of context models for greater than 1 flag in a set |
---|
| 118 | #define NUM_ABS_FLAG_CTX_PER_SET 1 ///< number of context models for greater than 2 flag in a set |
---|
| 119 | |
---|
| 120 | //------------------ |
---|
| 121 | |
---|
| 122 | #define NUM_CTX_SETS_LUMA 4 ///< number of context model sets for luminance |
---|
| 123 | #define NUM_CTX_SETS_CHROMA 2 ///< number of context model sets for combined chrominance |
---|
| 124 | |
---|
| 125 | #define FIRST_CTX_SET_LUMA 0 ///< index of first luminance context set |
---|
| 126 | |
---|
| 127 | //------------------ |
---|
| 128 | |
---|
| 129 | #define NUM_ONE_FLAG_CTX_LUMA (NUM_ONE_FLAG_CTX_PER_SET * NUM_CTX_SETS_LUMA) ///< number of context models for greater than 1 flag of luma |
---|
| 130 | #define NUM_ONE_FLAG_CTX_CHROMA (NUM_ONE_FLAG_CTX_PER_SET * NUM_CTX_SETS_CHROMA) ///< number of context models for greater than 1 flag of chroma |
---|
| 131 | |
---|
| 132 | #define NUM_ABS_FLAG_CTX_LUMA (NUM_ABS_FLAG_CTX_PER_SET * NUM_CTX_SETS_LUMA) ///< number of context models for greater than 2 flag of luma |
---|
| 133 | #define NUM_ABS_FLAG_CTX_CHROMA (NUM_ABS_FLAG_CTX_PER_SET * NUM_CTX_SETS_CHROMA) ///< number of context models for greater than 2 flag of chroma |
---|
| 134 | |
---|
| 135 | #define NUM_ONE_FLAG_CTX (NUM_ONE_FLAG_CTX_LUMA + NUM_ONE_FLAG_CTX_CHROMA) ///< number of context models for greater than 1 flag |
---|
| 136 | #define NUM_ABS_FLAG_CTX (NUM_ABS_FLAG_CTX_LUMA + NUM_ABS_FLAG_CTX_CHROMA) ///< number of context models for greater than 2 flag |
---|
| 137 | |
---|
| 138 | #define FIRST_CTX_SET_CHROMA (FIRST_CTX_SET_LUMA + NUM_CTX_SETS_LUMA) ///< index of first chrominance context set |
---|
| 139 | |
---|
| 140 | //-------------------------------------------------------------------------------------------------- |
---|
| 141 | |
---|
| 142 | // context size definitions for CBF |
---|
| 143 | |
---|
| 144 | #define NUM_QT_CBF_CTX_SETS 2 |
---|
| 145 | |
---|
| 146 | #define NUM_QT_CBF_CTX_PER_SET 5 ///< number of context models for QT CBF |
---|
| 147 | |
---|
| 148 | #define FIRST_CBF_CTX_LUMA 0 ///< index of first luminance CBF context |
---|
| 149 | |
---|
| 150 | #define FIRST_CBF_CTX_CHROMA (FIRST_CBF_CTX_LUMA + NUM_QT_CBF_CTX_PER_SET) ///< index of first chrominance CBF context |
---|
| 151 | |
---|
| 152 | |
---|
| 153 | //-------------------------------------------------------------------------------------------------- |
---|
| 154 | |
---|
[872] | 155 | #define NUM_MVP_IDX_CTX 1 ///< number of context models for MVP index |
---|
[2] | 156 | |
---|
[443] | 157 | #define NUM_SAO_MERGE_FLAG_CTX 1 ///< number of context models for SAO merge flags |
---|
| 158 | #define NUM_SAO_TYPE_IDX_CTX 1 ///< number of context models for SAO type index |
---|
[608] | 159 | |
---|
[1200] | 160 | #define NUM_TRANSFORMSKIP_FLAG_CTX 1 ///< number of context models for transform skipping |
---|
[608] | 161 | |
---|
[1200] | 162 | #define NUM_CU_TRANSQUANT_BYPASS_FLAG_CTX 1 |
---|
| 163 | |
---|
[608] | 164 | #if H_3D_ARP |
---|
[833] | 165 | #define NUM_ARPW_CTX 3 ///< number of context models for weighting factor index used by advanced residual prediction |
---|
[443] | 166 | #endif |
---|
[608] | 167 | |
---|
| 168 | #if H_3D_IC |
---|
[833] | 169 | #define NUM_IC_FLAG_CTX 1 ///< number of context models for illumination compensation flag |
---|
[608] | 170 | #endif |
---|
[1200] | 171 | #define NUM_CROSS_COMPONENT_PREDICTION_CTX 10 |
---|
[608] | 172 | |
---|
[56] | 173 | #define CNU 154 ///< dummy initialization value for unused context models 'Context model Not Used' |
---|
[2] | 174 | |
---|
[608] | 175 | #if H_3D_DIM |
---|
[833] | 176 | #define NUM_DEPTH_INTRA_MODE_CTX 1 ///< number of context models for depth intra modes |
---|
[608] | 177 | #define NUM_DDC_FLAG_CTX 2 ///< number of context models for deltaDC flag (DMM or RBC) |
---|
[724] | 178 | #define NUM_DDC_DATA_CTX 1 ///< number of context models for deltaDC data (DMM or RBC) |
---|
[608] | 179 | #if H_3D_DIM_DMM |
---|
| 180 | #define NUM_DMM1_DATA_CTX 1 ///< number of context models for DMM1 data |
---|
[296] | 181 | #endif |
---|
[950] | 182 | #define NUM_ANGLE_FLAG_CTX 1 |
---|
[724] | 183 | #endif |
---|
[100] | 184 | |
---|
[608] | 185 | #if H_3D_DIM_SDC |
---|
[884] | 186 | #define SDC_NUM_RESIDUAL_FLAG_CTX 1 |
---|
| 187 | #define SDC_NUM_RESIDUAL_CTX 1 |
---|
[833] | 188 | #define NUM_SDC_FLAG_CTX 1 ///< number of context |
---|
| 189 | #endif |
---|
| 190 | #if H_3D_DBBP |
---|
| 191 | #define DBBP_NUM_FLAG_CTX 1 |
---|
| 192 | #endif |
---|
[2] | 193 | // ==================================================================================================================== |
---|
| 194 | // Tables |
---|
| 195 | // ==================================================================================================================== |
---|
| 196 | |
---|
[608] | 197 | // initial probability for cu_transquant_bypass flag |
---|
| 198 | static const UChar |
---|
[1200] | 199 | INIT_CU_TRANSQUANT_BYPASS_FLAG[NUMBER_OF_SLICE_TYPES][NUM_CU_TRANSQUANT_BYPASS_FLAG_CTX] = |
---|
[608] | 200 | { |
---|
[1200] | 201 | { 154 }, |
---|
| 202 | { 154 }, |
---|
| 203 | { 154 }, |
---|
[608] | 204 | }; |
---|
| 205 | |
---|
[56] | 206 | // initial probability for split flag |
---|
[1200] | 207 | static const UChar |
---|
| 208 | INIT_SPLIT_FLAG[NUMBER_OF_SLICE_TYPES][NUM_SPLIT_FLAG_CTX] = |
---|
[2] | 209 | { |
---|
[608] | 210 | { 107, 139, 126, }, |
---|
[1200] | 211 | { 107, 139, 126, }, |
---|
| 212 | { 139, 141, 157, }, |
---|
[2] | 213 | }; |
---|
| 214 | |
---|
[1200] | 215 | static const UChar |
---|
| 216 | INIT_SKIP_FLAG[NUMBER_OF_SLICE_TYPES][NUM_SKIP_FLAG_CTX] = |
---|
[2] | 217 | { |
---|
[1200] | 218 | { 197, 185, 201, }, |
---|
| 219 | { 197, 185, 201, }, |
---|
| 220 | { CNU, CNU, CNU, }, |
---|
[189] | 221 | }; |
---|
[1196] | 222 | #if H_3D |
---|
[1179] | 223 | static const UChar |
---|
| 224 | INIT_DIS_FLAG[3][NUM_DIS_FLAG_CTX] = |
---|
| 225 | { |
---|
| 226 | { 185 }, |
---|
| 227 | { 185 }, |
---|
| 228 | { 185 }, |
---|
| 229 | }; |
---|
| 230 | static const UChar |
---|
| 231 | INIT_DIS_TYPE[3][NUM_DIS_TYPE_CTX] = |
---|
| 232 | { |
---|
| 233 | { 137 }, |
---|
| 234 | { 137 }, |
---|
| 235 | { 137 }, |
---|
| 236 | }; |
---|
[1039] | 237 | #endif |
---|
| 238 | static const UChar |
---|
[1200] | 239 | INIT_MERGE_FLAG_EXT[NUMBER_OF_SLICE_TYPES][NUM_MERGE_FLAG_EXT_CTX] = |
---|
[56] | 240 | { |
---|
[1200] | 241 | { 154, }, |
---|
| 242 | { 110, }, |
---|
| 243 | { CNU, }, |
---|
[56] | 244 | }; |
---|
[2] | 245 | |
---|
[1200] | 246 | static const UChar |
---|
| 247 | INIT_MERGE_IDX_EXT[NUMBER_OF_SLICE_TYPES][NUM_MERGE_IDX_EXT_CTX] = |
---|
[2] | 248 | { |
---|
[1200] | 249 | { 137, }, |
---|
| 250 | { 122, }, |
---|
| 251 | { CNU, }, |
---|
[56] | 252 | }; |
---|
| 253 | |
---|
[1200] | 254 | static const UChar |
---|
| 255 | INIT_PART_SIZE[NUMBER_OF_SLICE_TYPES][NUM_PART_SIZE_CTX] = |
---|
[56] | 256 | { |
---|
[1200] | 257 | { 154, 139, 154, 154 }, |
---|
| 258 | { 154, 139, 154, 154 }, |
---|
| 259 | { 184, CNU, CNU, CNU }, |
---|
[56] | 260 | }; |
---|
| 261 | |
---|
[1200] | 262 | static const UChar |
---|
| 263 | INIT_PRED_MODE[NUMBER_OF_SLICE_TYPES][NUM_PRED_MODE_CTX] = |
---|
[56] | 264 | { |
---|
[1200] | 265 | { 134, }, |
---|
| 266 | { 149, }, |
---|
| 267 | { CNU, }, |
---|
[56] | 268 | }; |
---|
| 269 | |
---|
[1200] | 270 | static const UChar |
---|
| 271 | INIT_INTRA_PRED_MODE[NUMBER_OF_SLICE_TYPES][NUM_INTRA_PREDICT_CTX] = |
---|
[56] | 272 | { |
---|
[1200] | 273 | { 183, }, |
---|
| 274 | { 154, }, |
---|
| 275 | { 184, }, |
---|
[56] | 276 | }; |
---|
| 277 | |
---|
[1200] | 278 | static const UChar |
---|
| 279 | INIT_CHROMA_PRED_MODE[NUMBER_OF_SLICE_TYPES][NUM_CHROMA_PRED_CTX] = |
---|
[56] | 280 | { |
---|
[1200] | 281 | { 152, 139, }, |
---|
| 282 | { 152, 139, }, |
---|
| 283 | { 63, 139, }, |
---|
[56] | 284 | }; |
---|
| 285 | |
---|
[1200] | 286 | static const UChar |
---|
| 287 | INIT_INTER_DIR[NUMBER_OF_SLICE_TYPES][NUM_INTER_DIR_CTX] = |
---|
[56] | 288 | { |
---|
[1200] | 289 | { 95, 79, 63, 31, 31, }, |
---|
| 290 | { 95, 79, 63, 31, 31, }, |
---|
| 291 | { CNU, CNU, CNU, CNU, CNU, }, |
---|
[56] | 292 | }; |
---|
| 293 | |
---|
[1200] | 294 | static const UChar |
---|
| 295 | INIT_MVD[NUMBER_OF_SLICE_TYPES][NUM_MV_RES_CTX] = |
---|
[56] | 296 | { |
---|
[1200] | 297 | { 169, 198, }, |
---|
| 298 | { 140, 198, }, |
---|
| 299 | { CNU, CNU, }, |
---|
[56] | 300 | }; |
---|
| 301 | |
---|
[1200] | 302 | static const UChar |
---|
| 303 | INIT_REF_PIC[NUMBER_OF_SLICE_TYPES][NUM_REF_NO_CTX] = |
---|
[56] | 304 | { |
---|
[1200] | 305 | { 153, 153 }, |
---|
| 306 | { 153, 153 }, |
---|
| 307 | { CNU, CNU }, |
---|
[56] | 308 | }; |
---|
| 309 | |
---|
[1200] | 310 | static const UChar |
---|
| 311 | INIT_DQP[NUMBER_OF_SLICE_TYPES][NUM_DELTA_QP_CTX] = |
---|
[56] | 312 | { |
---|
[1200] | 313 | { 154, 154, 154, }, |
---|
| 314 | { 154, 154, 154, }, |
---|
| 315 | { 154, 154, 154, }, |
---|
[56] | 316 | }; |
---|
| 317 | |
---|
[1200] | 318 | static const UChar |
---|
| 319 | INIT_CHROMA_QP_ADJ_FLAG[NUMBER_OF_SLICE_TYPES][NUM_CHROMA_QP_ADJ_FLAG_CTX] = |
---|
[56] | 320 | { |
---|
[1200] | 321 | { 154, }, |
---|
| 322 | { 154, }, |
---|
| 323 | { 154, }, |
---|
[56] | 324 | }; |
---|
| 325 | |
---|
[1200] | 326 | static const UChar |
---|
| 327 | INIT_CHROMA_QP_ADJ_IDC[NUMBER_OF_SLICE_TYPES][NUM_CHROMA_QP_ADJ_IDC_CTX] = |
---|
[56] | 328 | { |
---|
[1200] | 329 | { 154, }, |
---|
| 330 | { 154, }, |
---|
| 331 | { 154, }, |
---|
[56] | 332 | }; |
---|
| 333 | |
---|
[1200] | 334 | //-------------------------------------------------------------------------------------------------- |
---|
| 335 | |
---|
| 336 | //Initialisation for CBF |
---|
| 337 | |
---|
| 338 | // |---------Luminance---------| |
---|
| 339 | #define BSLICE_LUMA_CBF_CONTEXT 153, 111, CNU, CNU, CNU |
---|
| 340 | #define PSLICE_LUMA_CBF_CONTEXT 153, 111, CNU, CNU, CNU |
---|
| 341 | #define ISLICE_LUMA_CBF_CONTEXT 111, 141, CNU, CNU, CNU |
---|
| 342 | // |--------Chrominance--------| |
---|
| 343 | #define BSLICE_CHROMA_CBF_CONTEXT 149, 92, 167, 154, 154 |
---|
| 344 | #define PSLICE_CHROMA_CBF_CONTEXT 149, 107, 167, 154, 154 |
---|
| 345 | #define ISLICE_CHROMA_CBF_CONTEXT 94, 138, 182, 154, 154 |
---|
| 346 | |
---|
| 347 | |
---|
| 348 | static const UChar |
---|
| 349 | INIT_QT_CBF[NUMBER_OF_SLICE_TYPES][NUM_QT_CBF_CTX_SETS * NUM_QT_CBF_CTX_PER_SET] = |
---|
[56] | 350 | { |
---|
[1200] | 351 | { BSLICE_LUMA_CBF_CONTEXT, BSLICE_CHROMA_CBF_CONTEXT }, |
---|
| 352 | { PSLICE_LUMA_CBF_CONTEXT, PSLICE_CHROMA_CBF_CONTEXT }, |
---|
| 353 | { ISLICE_LUMA_CBF_CONTEXT, ISLICE_CHROMA_CBF_CONTEXT }, |
---|
[56] | 354 | }; |
---|
| 355 | |
---|
[1200] | 356 | |
---|
| 357 | //-------------------------------------------------------------------------------------------------- |
---|
| 358 | |
---|
| 359 | static const UChar |
---|
| 360 | INIT_QT_ROOT_CBF[NUMBER_OF_SLICE_TYPES][NUM_QT_ROOT_CBF_CTX] = |
---|
[56] | 361 | { |
---|
[1200] | 362 | { 79, }, |
---|
| 363 | { 79, }, |
---|
| 364 | { CNU, }, |
---|
[56] | 365 | }; |
---|
| 366 | |
---|
[1200] | 367 | |
---|
| 368 | //-------------------------------------------------------------------------------------------------- |
---|
| 369 | |
---|
| 370 | //Initialisation for last-significant-position |
---|
| 371 | |
---|
| 372 | // |------------------------------Luminance----------------------------------| |
---|
| 373 | #define BSLICE_LUMA_LAST_POSITION_CONTEXT 125, 110, 124, 110, 95, 94, 125, 111, 111, 79, 125, 126, 111, 111, 79 |
---|
| 374 | #define PSLICE_LUMA_LAST_POSITION_CONTEXT 125, 110, 94, 110, 95, 79, 125, 111, 110, 78, 110, 111, 111, 95, 94 |
---|
| 375 | #define ISLICE_LUMA_LAST_POSITION_CONTEXT 110, 110, 124, 125, 140, 153, 125, 127, 140, 109, 111, 143, 127, 111, 79 |
---|
| 376 | // |------------------------------Chrominance--------------------------------| |
---|
| 377 | #define BSLICE_CHROMA_LAST_POSITION_CONTEXT 108, 123, 93, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU |
---|
| 378 | #define PSLICE_CHROMA_LAST_POSITION_CONTEXT 108, 123, 108, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU |
---|
| 379 | #define ISLICE_CHROMA_LAST_POSITION_CONTEXT 108, 123, 63, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU |
---|
| 380 | |
---|
| 381 | |
---|
| 382 | static const UChar |
---|
| 383 | INIT_LAST[NUMBER_OF_SLICE_TYPES][NUM_CTX_LAST_FLAG_SETS * NUM_CTX_LAST_FLAG_XY] = |
---|
[56] | 384 | { |
---|
[1200] | 385 | { BSLICE_LUMA_LAST_POSITION_CONTEXT, BSLICE_CHROMA_LAST_POSITION_CONTEXT }, |
---|
| 386 | { PSLICE_LUMA_LAST_POSITION_CONTEXT, PSLICE_CHROMA_LAST_POSITION_CONTEXT }, |
---|
| 387 | { ISLICE_LUMA_LAST_POSITION_CONTEXT, ISLICE_CHROMA_LAST_POSITION_CONTEXT }, |
---|
[56] | 388 | }; |
---|
| 389 | |
---|
[1200] | 390 | |
---|
| 391 | //-------------------------------------------------------------------------------------------------- |
---|
| 392 | |
---|
| 393 | static const UChar |
---|
| 394 | INIT_SIG_CG_FLAG[NUMBER_OF_SLICE_TYPES][2 * NUM_SIG_CG_FLAG_CTX] = |
---|
[56] | 395 | { |
---|
[1200] | 396 | { 121, 140, |
---|
| 397 | 61, 154, |
---|
| 398 | }, |
---|
| 399 | { 121, 140, |
---|
| 400 | 61, 154, |
---|
| 401 | }, |
---|
| 402 | { 91, 171, |
---|
| 403 | 134, 141, |
---|
| 404 | }, |
---|
[56] | 405 | }; |
---|
| 406 | |
---|
[1200] | 407 | |
---|
| 408 | //-------------------------------------------------------------------------------------------------- |
---|
| 409 | |
---|
| 410 | //Initialisation for significance map |
---|
| 411 | |
---|
| 412 | // |-DC-| |-----------------4x4------------------| |------8x8 Diagonal Scan------| |----8x8 Non-Diagonal Scan----| |-NxN First group-| |-NxN Other group-| |-Single context-| |
---|
| 413 | // | | | | |-First Group-| |-Other Group-| |-First Group-| |-Other Group-| | | | | | | |
---|
| 414 | #define BSLICE_LUMA_SIGNIFICANCE_CONTEXT 170, 154, 139, 153, 139, 123, 123, 63, 124, 166, 183, 140, 136, 153, 154, 166, 183, 140, 136, 153, 154, 166, 183, 140, 136, 153, 154, 140 |
---|
| 415 | #define PSLICE_LUMA_SIGNIFICANCE_CONTEXT 155, 154, 139, 153, 139, 123, 123, 63, 153, 166, 183, 140, 136, 153, 154, 166, 183, 140, 136, 153, 154, 166, 183, 140, 136, 153, 154, 140 |
---|
| 416 | #define ISLICE_LUMA_SIGNIFICANCE_CONTEXT 111, 111, 125, 110, 110, 94, 124, 108, 124, 107, 125, 141, 179, 153, 125, 107, 125, 141, 179, 153, 125, 107, 125, 141, 179, 153, 125, 141 |
---|
| 417 | |
---|
| 418 | // |-DC-| |-----------------4x4------------------| |-8x8 Any group-| |-NxN Any group-| |-Single context-| |
---|
| 419 | #define BSLICE_CHROMA_SIGNIFICANCE_CONTEXT 170, 153, 138, 138, 122, 121, 122, 121, 167, 151, 183, 140, 151, 183, 140, 140 |
---|
| 420 | #define PSLICE_CHROMA_SIGNIFICANCE_CONTEXT 170, 153, 123, 123, 107, 121, 107, 121, 167, 151, 183, 140, 151, 183, 140, 140 |
---|
| 421 | #define ISLICE_CHROMA_SIGNIFICANCE_CONTEXT 140, 139, 182, 182, 152, 136, 152, 136, 153, 136, 139, 111, 136, 139, 111, 111 |
---|
| 422 | |
---|
| 423 | //------------------------------------------------ |
---|
| 424 | |
---|
| 425 | static const UChar |
---|
| 426 | INIT_SIG_FLAG[NUMBER_OF_SLICE_TYPES][NUM_SIG_FLAG_CTX] = |
---|
[56] | 427 | { |
---|
[1200] | 428 | { BSLICE_LUMA_SIGNIFICANCE_CONTEXT, BSLICE_CHROMA_SIGNIFICANCE_CONTEXT }, |
---|
| 429 | { PSLICE_LUMA_SIGNIFICANCE_CONTEXT, PSLICE_CHROMA_SIGNIFICANCE_CONTEXT }, |
---|
| 430 | { ISLICE_LUMA_SIGNIFICANCE_CONTEXT, ISLICE_CHROMA_SIGNIFICANCE_CONTEXT }, |
---|
[56] | 431 | }; |
---|
| 432 | |
---|
[1200] | 433 | |
---|
| 434 | //-------------------------------------------------------------------------------------------------- |
---|
| 435 | |
---|
| 436 | //Initialisation for greater-than-one flags and greater-than-two flags |
---|
| 437 | |
---|
| 438 | // |------Set 0-------| |------Set 1-------| |------Set 2-------| |------Set 3-------| |
---|
| 439 | #define BSLICE_LUMA_ONE_CONTEXT 154, 196, 167, 167, 154, 152, 167, 182, 182, 134, 149, 136, 153, 121, 136, 122 |
---|
| 440 | #define PSLICE_LUMA_ONE_CONTEXT 154, 196, 196, 167, 154, 152, 167, 182, 182, 134, 149, 136, 153, 121, 136, 137 |
---|
| 441 | #define ISLICE_LUMA_ONE_CONTEXT 140, 92, 137, 138, 140, 152, 138, 139, 153, 74, 149, 92, 139, 107, 122, 152 |
---|
| 442 | |
---|
| 443 | #define BSLICE_LUMA_ABS_CONTEXT 107, 167, 91, 107 |
---|
| 444 | #define PSLICE_LUMA_ABS_CONTEXT 107, 167, 91, 122 |
---|
| 445 | #define ISLICE_LUMA_ABS_CONTEXT 138, 153, 136, 167 |
---|
| 446 | |
---|
| 447 | // |------Set 4-------| |------Set 5-------| |
---|
| 448 | #define BSLICE_CHROMA_ONE_CONTEXT 169, 208, 166, 167, 154, 152, 167, 182 |
---|
| 449 | #define PSLICE_CHROMA_ONE_CONTEXT 169, 194, 166, 167, 154, 167, 137, 182 |
---|
| 450 | #define ISLICE_CHROMA_ONE_CONTEXT 140, 179, 166, 182, 140, 227, 122, 197 |
---|
| 451 | |
---|
| 452 | #define BSLICE_CHROMA_ABS_CONTEXT 107, 167 |
---|
| 453 | #define PSLICE_CHROMA_ABS_CONTEXT 107, 167 |
---|
| 454 | #define ISLICE_CHROMA_ABS_CONTEXT 152, 152 |
---|
| 455 | |
---|
| 456 | |
---|
| 457 | //------------------------------------------------ |
---|
| 458 | |
---|
| 459 | static const UChar |
---|
| 460 | INIT_ONE_FLAG[NUMBER_OF_SLICE_TYPES][NUM_ONE_FLAG_CTX] = |
---|
[56] | 461 | { |
---|
[1200] | 462 | { BSLICE_LUMA_ONE_CONTEXT, BSLICE_CHROMA_ONE_CONTEXT }, |
---|
| 463 | { PSLICE_LUMA_ONE_CONTEXT, PSLICE_CHROMA_ONE_CONTEXT }, |
---|
| 464 | { ISLICE_LUMA_ONE_CONTEXT, ISLICE_CHROMA_ONE_CONTEXT }, |
---|
[56] | 465 | }; |
---|
| 466 | |
---|
[1200] | 467 | static const UChar |
---|
| 468 | INIT_ABS_FLAG[NUMBER_OF_SLICE_TYPES][NUM_ABS_FLAG_CTX] = |
---|
[56] | 469 | { |
---|
[1200] | 470 | { BSLICE_LUMA_ABS_CONTEXT, BSLICE_CHROMA_ABS_CONTEXT }, |
---|
| 471 | { PSLICE_LUMA_ABS_CONTEXT, PSLICE_CHROMA_ABS_CONTEXT }, |
---|
| 472 | { ISLICE_LUMA_ABS_CONTEXT, ISLICE_CHROMA_ABS_CONTEXT }, |
---|
[56] | 473 | }; |
---|
| 474 | |
---|
[1200] | 475 | |
---|
| 476 | //-------------------------------------------------------------------------------------------------- |
---|
| 477 | |
---|
| 478 | static const UChar |
---|
| 479 | INIT_MVP_IDX[NUMBER_OF_SLICE_TYPES][NUM_MVP_IDX_CTX] = |
---|
[56] | 480 | { |
---|
[1200] | 481 | { 168, }, |
---|
| 482 | { 168, }, |
---|
| 483 | { CNU, }, |
---|
| 484 | }; |
---|
| 485 | |
---|
| 486 | static const UChar |
---|
| 487 | INIT_SAO_MERGE_FLAG[NUMBER_OF_SLICE_TYPES][NUM_SAO_MERGE_FLAG_CTX] = |
---|
| 488 | { |
---|
| 489 | { 153, }, |
---|
| 490 | { 153, }, |
---|
| 491 | { 153, }, |
---|
| 492 | }; |
---|
| 493 | |
---|
| 494 | static const UChar |
---|
| 495 | INIT_SAO_TYPE_IDX[NUMBER_OF_SLICE_TYPES][NUM_SAO_TYPE_IDX_CTX] = |
---|
| 496 | { |
---|
[608] | 497 | { 160, }, |
---|
| 498 | { 185, }, |
---|
| 499 | { 200, }, |
---|
[56] | 500 | }; |
---|
| 501 | |
---|
[443] | 502 | static const UChar |
---|
[1200] | 503 | INIT_TRANS_SUBDIV_FLAG[NUMBER_OF_SLICE_TYPES][NUM_TRANS_SUBDIV_FLAG_CTX] = |
---|
[443] | 504 | { |
---|
[608] | 505 | { 224, 167, 122, }, |
---|
| 506 | { 124, 138, 94, }, |
---|
| 507 | { 153, 138, 138, }, |
---|
[56] | 508 | }; |
---|
| 509 | |
---|
[608] | 510 | static const UChar |
---|
[1200] | 511 | INIT_TRANSFORMSKIP_FLAG[NUMBER_OF_SLICE_TYPES][2*NUM_TRANSFORMSKIP_FLAG_CTX] = |
---|
[56] | 512 | { |
---|
[1200] | 513 | { 139, 139}, |
---|
| 514 | { 139, 139}, |
---|
| 515 | { 139, 139}, |
---|
[56] | 516 | }; |
---|
| 517 | |
---|
[1200] | 518 | static const UChar |
---|
| 519 | INIT_EXPLICIT_RDPCM_FLAG[NUMBER_OF_SLICE_TYPES][2*NUM_EXPLICIT_RDPCM_FLAG_CTX] = |
---|
| 520 | { |
---|
| 521 | {139, 139}, |
---|
| 522 | {139, 139}, |
---|
| 523 | {CNU, CNU} |
---|
| 524 | }; |
---|
| 525 | |
---|
| 526 | static const UChar |
---|
| 527 | INIT_EXPLICIT_RDPCM_DIR[NUMBER_OF_SLICE_TYPES][2*NUM_EXPLICIT_RDPCM_DIR_CTX] = |
---|
| 528 | { |
---|
| 529 | {139, 139}, |
---|
| 530 | {139, 139}, |
---|
| 531 | {CNU, CNU} |
---|
| 532 | }; |
---|
| 533 | |
---|
| 534 | static const UChar |
---|
| 535 | INIT_CROSS_COMPONENT_PREDICTION[NUMBER_OF_SLICE_TYPES][NUM_CROSS_COMPONENT_PREDICTION_CTX] = |
---|
| 536 | { |
---|
| 537 | { 154, 154, 154, 154, 154, 154, 154, 154, 154, 154 }, |
---|
| 538 | { 154, 154, 154, 154, 154, 154, 154, 154, 154, 154 }, |
---|
| 539 | { 154, 154, 154, 154, 154, 154, 154, 154, 154, 154 }, |
---|
| 540 | }; |
---|
| 541 | |
---|
| 542 | //! \} |
---|
| 543 | |
---|
[608] | 544 | #if H_3D_ARP |
---|
[56] | 545 | static const UChar |
---|
[608] | 546 | INIT_ARPW[3][NUM_ARPW_CTX] = |
---|
[56] | 547 | { |
---|
[833] | 548 | { 162, 153, 162 }, |
---|
| 549 | { 162, 153, 162 }, |
---|
| 550 | { 162, 153, 162 }, |
---|
| 551 | }; |
---|
[884] | 552 | |
---|
[608] | 553 | #endif |
---|
| 554 | #if H_3D_IC |
---|
[56] | 555 | static const UChar |
---|
[608] | 556 | INIT_IC_FLAG[3][NUM_IC_FLAG_CTX] = |
---|
[56] | 557 | { |
---|
[833] | 558 | { 154 }, |
---|
| 559 | { 154 }, |
---|
| 560 | { 154 }, |
---|
| 561 | }; |
---|
[884] | 562 | |
---|
[608] | 563 | #endif |
---|
| 564 | #if H_3D_DIM |
---|
| 565 | static const UChar |
---|
| 566 | INIT_DEPTH_INTRA_MODE[3][NUM_DEPTH_INTRA_MODE_CTX] = |
---|
[56] | 567 | { |
---|
[833] | 568 | { 154, }, |
---|
| 569 | { 154, }, |
---|
| 570 | { 154, } |
---|
| 571 | }; |
---|
[655] | 572 | |
---|
[56] | 573 | static const UChar |
---|
[833] | 574 | INIT_ANGLE_FLAG[3][NUM_ANGLE_FLAG_CTX] = |
---|
| 575 | { |
---|
[950] | 576 | { 154 }, |
---|
| 577 | { 141 }, |
---|
| 578 | { 155 }, |
---|
| 579 | }; |
---|
[833] | 580 | |
---|
| 581 | static const UChar |
---|
[608] | 582 | INIT_DDC_FLAG[3][NUM_DDC_FLAG_CTX] = |
---|
[56] | 583 | { |
---|
[608] | 584 | {0 , CNU}, |
---|
| 585 | {0 , CNU}, |
---|
| 586 | {64, CNU} |
---|
[56] | 587 | }; |
---|
| 588 | static const UChar |
---|
[608] | 589 | INIT_DDC_DATA[3][NUM_DDC_DATA_CTX] = |
---|
[2] | 590 | { |
---|
[724] | 591 | { 154 }, |
---|
| 592 | { 154 }, |
---|
| 593 | { 154 }, |
---|
[2] | 594 | }; |
---|
[608] | 595 | #if H_3D_DIM_DMM |
---|
[56] | 596 | static const UChar |
---|
[608] | 597 | INIT_DMM1_DATA[3][NUM_DMM1_DATA_CTX] = |
---|
[56] | 598 | { |
---|
[608] | 599 | { CNU }, |
---|
| 600 | { CNU }, |
---|
| 601 | { CNU }, |
---|
[2] | 602 | }; |
---|
| 603 | #endif |
---|
[608] | 604 | #if H_3D_DIM_SDC |
---|
| 605 | static const UChar |
---|
| 606 | INIT_SDC_RESIDUAL_FLAG[3][SDC_NUM_RESIDUAL_FLAG_CTX] = |
---|
[443] | 607 | { |
---|
[608] | 608 | { CNU }, |
---|
| 609 | { CNU }, |
---|
| 610 | { CNU }, |
---|
[443] | 611 | }; |
---|
[608] | 612 | static const UChar |
---|
| 613 | INIT_SDC_RESIDUAL[3][SDC_NUM_RESIDUAL_CTX] = |
---|
[443] | 614 | { |
---|
[608] | 615 | { 155 }, |
---|
| 616 | { 155 }, |
---|
| 617 | { 155 }, |
---|
[443] | 618 | }; |
---|
| 619 | #endif |
---|
[608] | 620 | #endif |
---|
[884] | 621 | #if H_3D_DIM_SDC |
---|
[833] | 622 | static const UChar |
---|
| 623 | INIT_SDC_FLAG[3][NUM_SDC_FLAG_CTX] = |
---|
| 624 | { |
---|
| 625 | { 154 }, |
---|
| 626 | { 154 }, |
---|
| 627 | { 154 }, |
---|
| 628 | }; |
---|
| 629 | #endif |
---|
[56] | 630 | |
---|
[833] | 631 | #if H_3D_DBBP |
---|
| 632 | static const UChar INIT_DBBP_FLAG[3][DBBP_NUM_FLAG_CTX] = |
---|
| 633 | { |
---|
[1039] | 634 | { CNU }, |
---|
| 635 | { CNU }, |
---|
| 636 | { CNU }, |
---|
[950] | 637 | }; |
---|
[833] | 638 | #endif |
---|
[608] | 639 | |
---|
[2] | 640 | #endif |
---|