[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 |
---|
[1313] | 4 | * granted under this license. |
---|
[5] | 5 | * |
---|
[1313] | 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 |
---|
[1313] | 53 | #if NH_3D_DIS |
---|
[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 | |
---|
[1313] | 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 |
---|
[1313] | 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 |
---|
[1313] | 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 | |
---|
[1313] | 80 | //-------------------------------------------------------------------------------------------------- |
---|
[56] | 81 | |
---|
[1313] | 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 | |
---|
[1313] | 113 | //-------------------------------------------------------------------------------------------------- |
---|
[56] | 114 | |
---|
[1313] | 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 | |
---|
[1313] | 160 | #define NUM_TRANSFORMSKIP_FLAG_CTX 1 ///< number of context models for transform skipping |
---|
[608] | 161 | |
---|
[1313] | 162 | #define NUM_CU_TRANSQUANT_BYPASS_FLAG_CTX 1 |
---|
| 163 | |
---|
| 164 | #if NH_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 | |
---|
[1313] | 168 | #if NH_3D_IC |
---|
[833] | 169 | #define NUM_IC_FLAG_CTX 1 ///< number of context models for illumination compensation flag |
---|
[608] | 170 | #endif |
---|
[1313] | 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 | |
---|
[1313] | 175 | #if NH_3D_DMM |
---|
| 176 | #define NUM_NOTDMM_FLAG_CTX 1 ///< number of context models for not-DMM flag |
---|
| 177 | #define NUM_DMM_MODE_CTX 1 ///< number of context models for DMM modes |
---|
[296] | 178 | #endif |
---|
[1313] | 179 | #if NH_3D_DMM || NH_3D_SDC_INTRA |
---|
| 180 | #define NUM_DDC_DATA_CTX 1 ///< number of context models for deltaDC data (DMM or SDC) |
---|
[724] | 181 | #endif |
---|
[1313] | 182 | #if NH_3D_SDC_INTRA |
---|
[884] | 183 | #define SDC_NUM_RESIDUAL_FLAG_CTX 1 |
---|
| 184 | #define SDC_NUM_RESIDUAL_CTX 1 |
---|
[833] | 185 | #define NUM_SDC_FLAG_CTX 1 ///< number of context |
---|
[1313] | 186 | #define NUM_DDC_FLAG_CTX 2 ///< number of context models for deltaDC flag (SDC only) |
---|
[833] | 187 | #endif |
---|
[1313] | 188 | #if NH_3D_DBBP |
---|
[833] | 189 | #define DBBP_NUM_FLAG_CTX 1 |
---|
| 190 | #endif |
---|
[2] | 191 | // ==================================================================================================================== |
---|
| 192 | // Tables |
---|
| 193 | // ==================================================================================================================== |
---|
| 194 | |
---|
[608] | 195 | // initial probability for cu_transquant_bypass flag |
---|
| 196 | static const UChar |
---|
[1313] | 197 | INIT_CU_TRANSQUANT_BYPASS_FLAG[NUMBER_OF_SLICE_TYPES][NUM_CU_TRANSQUANT_BYPASS_FLAG_CTX] = |
---|
[608] | 198 | { |
---|
[1313] | 199 | { 154 }, |
---|
| 200 | { 154 }, |
---|
| 201 | { 154 }, |
---|
[608] | 202 | }; |
---|
| 203 | |
---|
[56] | 204 | // initial probability for split flag |
---|
[1313] | 205 | static const UChar |
---|
| 206 | INIT_SPLIT_FLAG[NUMBER_OF_SLICE_TYPES][NUM_SPLIT_FLAG_CTX] = |
---|
[2] | 207 | { |
---|
[608] | 208 | { 107, 139, 126, }, |
---|
[1313] | 209 | { 107, 139, 126, }, |
---|
| 210 | { 139, 141, 157, }, |
---|
[2] | 211 | }; |
---|
| 212 | |
---|
[1313] | 213 | static const UChar |
---|
| 214 | INIT_SKIP_FLAG[NUMBER_OF_SLICE_TYPES][NUM_SKIP_FLAG_CTX] = |
---|
[2] | 215 | { |
---|
[1313] | 216 | { 197, 185, 201, }, |
---|
| 217 | { 197, 185, 201, }, |
---|
| 218 | { CNU, CNU, CNU, }, |
---|
[189] | 219 | }; |
---|
[1313] | 220 | #if NH_3D_DIS |
---|
[1179] | 221 | static const UChar |
---|
| 222 | INIT_DIS_FLAG[3][NUM_DIS_FLAG_CTX] = |
---|
| 223 | { |
---|
| 224 | { 185 }, |
---|
| 225 | { 185 }, |
---|
| 226 | { 185 }, |
---|
| 227 | }; |
---|
| 228 | static const UChar |
---|
| 229 | INIT_DIS_TYPE[3][NUM_DIS_TYPE_CTX] = |
---|
| 230 | { |
---|
| 231 | { 137 }, |
---|
| 232 | { 137 }, |
---|
| 233 | { 137 }, |
---|
| 234 | }; |
---|
[1039] | 235 | #endif |
---|
| 236 | static const UChar |
---|
[1313] | 237 | INIT_MERGE_FLAG_EXT[NUMBER_OF_SLICE_TYPES][NUM_MERGE_FLAG_EXT_CTX] = |
---|
[56] | 238 | { |
---|
[1313] | 239 | { 154, }, |
---|
| 240 | { 110, }, |
---|
| 241 | { CNU, }, |
---|
[56] | 242 | }; |
---|
[2] | 243 | |
---|
[1313] | 244 | static const UChar |
---|
| 245 | INIT_MERGE_IDX_EXT[NUMBER_OF_SLICE_TYPES][NUM_MERGE_IDX_EXT_CTX] = |
---|
[2] | 246 | { |
---|
[1313] | 247 | { 137, }, |
---|
| 248 | { 122, }, |
---|
| 249 | { CNU, }, |
---|
[56] | 250 | }; |
---|
| 251 | |
---|
[1313] | 252 | static const UChar |
---|
| 253 | INIT_PART_SIZE[NUMBER_OF_SLICE_TYPES][NUM_PART_SIZE_CTX] = |
---|
[56] | 254 | { |
---|
[1313] | 255 | { 154, 139, 154, 154 }, |
---|
| 256 | { 154, 139, 154, 154 }, |
---|
| 257 | { 184, CNU, CNU, CNU }, |
---|
[56] | 258 | }; |
---|
| 259 | |
---|
[1313] | 260 | static const UChar |
---|
| 261 | INIT_PRED_MODE[NUMBER_OF_SLICE_TYPES][NUM_PRED_MODE_CTX] = |
---|
[56] | 262 | { |
---|
[1313] | 263 | { 134, }, |
---|
| 264 | { 149, }, |
---|
| 265 | { CNU, }, |
---|
[56] | 266 | }; |
---|
| 267 | |
---|
[1313] | 268 | static const UChar |
---|
| 269 | INIT_INTRA_PRED_MODE[NUMBER_OF_SLICE_TYPES][NUM_INTRA_PREDICT_CTX] = |
---|
[56] | 270 | { |
---|
[1313] | 271 | { 183, }, |
---|
| 272 | { 154, }, |
---|
| 273 | { 184, }, |
---|
[56] | 274 | }; |
---|
| 275 | |
---|
[1313] | 276 | static const UChar |
---|
| 277 | INIT_CHROMA_PRED_MODE[NUMBER_OF_SLICE_TYPES][NUM_CHROMA_PRED_CTX] = |
---|
[56] | 278 | { |
---|
[1313] | 279 | { 152, 139, }, |
---|
| 280 | { 152, 139, }, |
---|
| 281 | { 63, 139, }, |
---|
[56] | 282 | }; |
---|
| 283 | |
---|
[1313] | 284 | static const UChar |
---|
| 285 | INIT_INTER_DIR[NUMBER_OF_SLICE_TYPES][NUM_INTER_DIR_CTX] = |
---|
[56] | 286 | { |
---|
[1313] | 287 | { 95, 79, 63, 31, 31, }, |
---|
| 288 | { 95, 79, 63, 31, 31, }, |
---|
| 289 | { CNU, CNU, CNU, CNU, CNU, }, |
---|
[56] | 290 | }; |
---|
| 291 | |
---|
[1313] | 292 | static const UChar |
---|
| 293 | INIT_MVD[NUMBER_OF_SLICE_TYPES][NUM_MV_RES_CTX] = |
---|
[56] | 294 | { |
---|
[1313] | 295 | { 169, 198, }, |
---|
| 296 | { 140, 198, }, |
---|
| 297 | { CNU, CNU, }, |
---|
[56] | 298 | }; |
---|
| 299 | |
---|
[1313] | 300 | static const UChar |
---|
| 301 | INIT_REF_PIC[NUMBER_OF_SLICE_TYPES][NUM_REF_NO_CTX] = |
---|
[56] | 302 | { |
---|
[1313] | 303 | { 153, 153 }, |
---|
| 304 | { 153, 153 }, |
---|
| 305 | { CNU, CNU }, |
---|
[56] | 306 | }; |
---|
| 307 | |
---|
[1313] | 308 | static const UChar |
---|
| 309 | INIT_DQP[NUMBER_OF_SLICE_TYPES][NUM_DELTA_QP_CTX] = |
---|
[56] | 310 | { |
---|
[1313] | 311 | { 154, 154, 154, }, |
---|
| 312 | { 154, 154, 154, }, |
---|
| 313 | { 154, 154, 154, }, |
---|
[56] | 314 | }; |
---|
| 315 | |
---|
[1313] | 316 | static const UChar |
---|
| 317 | INIT_CHROMA_QP_ADJ_FLAG[NUMBER_OF_SLICE_TYPES][NUM_CHROMA_QP_ADJ_FLAG_CTX] = |
---|
[56] | 318 | { |
---|
[1313] | 319 | { 154, }, |
---|
| 320 | { 154, }, |
---|
| 321 | { 154, }, |
---|
[56] | 322 | }; |
---|
| 323 | |
---|
[1313] | 324 | static const UChar |
---|
| 325 | INIT_CHROMA_QP_ADJ_IDC[NUMBER_OF_SLICE_TYPES][NUM_CHROMA_QP_ADJ_IDC_CTX] = |
---|
[56] | 326 | { |
---|
[1313] | 327 | { 154, }, |
---|
| 328 | { 154, }, |
---|
| 329 | { 154, }, |
---|
[56] | 330 | }; |
---|
| 331 | |
---|
[1313] | 332 | //-------------------------------------------------------------------------------------------------- |
---|
| 333 | |
---|
| 334 | //Initialisation for CBF |
---|
| 335 | |
---|
| 336 | // |---------Luminance---------| |
---|
| 337 | #define BSLICE_LUMA_CBF_CONTEXT 153, 111, CNU, CNU, CNU |
---|
| 338 | #define PSLICE_LUMA_CBF_CONTEXT 153, 111, CNU, CNU, CNU |
---|
| 339 | #define ISLICE_LUMA_CBF_CONTEXT 111, 141, CNU, CNU, CNU |
---|
| 340 | // |--------Chrominance--------| |
---|
| 341 | #define BSLICE_CHROMA_CBF_CONTEXT 149, 92, 167, 154, 154 |
---|
| 342 | #define PSLICE_CHROMA_CBF_CONTEXT 149, 107, 167, 154, 154 |
---|
| 343 | #define ISLICE_CHROMA_CBF_CONTEXT 94, 138, 182, 154, 154 |
---|
| 344 | |
---|
| 345 | |
---|
| 346 | static const UChar |
---|
| 347 | INIT_QT_CBF[NUMBER_OF_SLICE_TYPES][NUM_QT_CBF_CTX_SETS * NUM_QT_CBF_CTX_PER_SET] = |
---|
[56] | 348 | { |
---|
[1313] | 349 | { BSLICE_LUMA_CBF_CONTEXT, BSLICE_CHROMA_CBF_CONTEXT }, |
---|
| 350 | { PSLICE_LUMA_CBF_CONTEXT, PSLICE_CHROMA_CBF_CONTEXT }, |
---|
| 351 | { ISLICE_LUMA_CBF_CONTEXT, ISLICE_CHROMA_CBF_CONTEXT }, |
---|
[56] | 352 | }; |
---|
| 353 | |
---|
[1313] | 354 | |
---|
| 355 | //-------------------------------------------------------------------------------------------------- |
---|
| 356 | |
---|
| 357 | static const UChar |
---|
| 358 | INIT_QT_ROOT_CBF[NUMBER_OF_SLICE_TYPES][NUM_QT_ROOT_CBF_CTX] = |
---|
[56] | 359 | { |
---|
[1313] | 360 | { 79, }, |
---|
| 361 | { 79, }, |
---|
| 362 | { CNU, }, |
---|
[56] | 363 | }; |
---|
| 364 | |
---|
[1313] | 365 | |
---|
| 366 | //-------------------------------------------------------------------------------------------------- |
---|
| 367 | |
---|
| 368 | //Initialisation for last-significant-position |
---|
| 369 | |
---|
| 370 | // |------------------------------Luminance----------------------------------| |
---|
| 371 | #define BSLICE_LUMA_LAST_POSITION_CONTEXT 125, 110, 124, 110, 95, 94, 125, 111, 111, 79, 125, 126, 111, 111, 79 |
---|
| 372 | #define PSLICE_LUMA_LAST_POSITION_CONTEXT 125, 110, 94, 110, 95, 79, 125, 111, 110, 78, 110, 111, 111, 95, 94 |
---|
| 373 | #define ISLICE_LUMA_LAST_POSITION_CONTEXT 110, 110, 124, 125, 140, 153, 125, 127, 140, 109, 111, 143, 127, 111, 79 |
---|
| 374 | // |------------------------------Chrominance--------------------------------| |
---|
| 375 | #define BSLICE_CHROMA_LAST_POSITION_CONTEXT 108, 123, 93, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU |
---|
| 376 | #define PSLICE_CHROMA_LAST_POSITION_CONTEXT 108, 123, 108, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU |
---|
| 377 | #define ISLICE_CHROMA_LAST_POSITION_CONTEXT 108, 123, 63, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU |
---|
| 378 | |
---|
| 379 | |
---|
| 380 | static const UChar |
---|
| 381 | INIT_LAST[NUMBER_OF_SLICE_TYPES][NUM_CTX_LAST_FLAG_SETS * NUM_CTX_LAST_FLAG_XY] = |
---|
[56] | 382 | { |
---|
[1313] | 383 | { BSLICE_LUMA_LAST_POSITION_CONTEXT, BSLICE_CHROMA_LAST_POSITION_CONTEXT }, |
---|
| 384 | { PSLICE_LUMA_LAST_POSITION_CONTEXT, PSLICE_CHROMA_LAST_POSITION_CONTEXT }, |
---|
| 385 | { ISLICE_LUMA_LAST_POSITION_CONTEXT, ISLICE_CHROMA_LAST_POSITION_CONTEXT }, |
---|
[56] | 386 | }; |
---|
| 387 | |
---|
[1313] | 388 | |
---|
| 389 | //-------------------------------------------------------------------------------------------------- |
---|
| 390 | |
---|
| 391 | static const UChar |
---|
| 392 | INIT_SIG_CG_FLAG[NUMBER_OF_SLICE_TYPES][2 * NUM_SIG_CG_FLAG_CTX] = |
---|
[56] | 393 | { |
---|
[1313] | 394 | { 121, 140, |
---|
| 395 | 61, 154, |
---|
| 396 | }, |
---|
| 397 | { 121, 140, |
---|
| 398 | 61, 154, |
---|
| 399 | }, |
---|
| 400 | { 91, 171, |
---|
| 401 | 134, 141, |
---|
| 402 | }, |
---|
[56] | 403 | }; |
---|
| 404 | |
---|
[1313] | 405 | |
---|
| 406 | //-------------------------------------------------------------------------------------------------- |
---|
| 407 | |
---|
| 408 | //Initialisation for significance map |
---|
| 409 | |
---|
| 410 | // |-DC-| |-----------------4x4------------------| |------8x8 Diagonal Scan------| |----8x8 Non-Diagonal Scan----| |-NxN First group-| |-NxN Other group-| |-Single context-| |
---|
| 411 | // | | | | |-First Group-| |-Other Group-| |-First Group-| |-Other Group-| | | | | | | |
---|
| 412 | #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 |
---|
| 413 | #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 |
---|
| 414 | #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 |
---|
| 415 | |
---|
| 416 | // |-DC-| |-----------------4x4------------------| |-8x8 Any group-| |-NxN Any group-| |-Single context-| |
---|
| 417 | #define BSLICE_CHROMA_SIGNIFICANCE_CONTEXT 170, 153, 138, 138, 122, 121, 122, 121, 167, 151, 183, 140, 151, 183, 140, 140 |
---|
| 418 | #define PSLICE_CHROMA_SIGNIFICANCE_CONTEXT 170, 153, 123, 123, 107, 121, 107, 121, 167, 151, 183, 140, 151, 183, 140, 140 |
---|
| 419 | #define ISLICE_CHROMA_SIGNIFICANCE_CONTEXT 140, 139, 182, 182, 152, 136, 152, 136, 153, 136, 139, 111, 136, 139, 111, 111 |
---|
| 420 | |
---|
| 421 | //------------------------------------------------ |
---|
| 422 | |
---|
| 423 | static const UChar |
---|
| 424 | INIT_SIG_FLAG[NUMBER_OF_SLICE_TYPES][NUM_SIG_FLAG_CTX] = |
---|
[56] | 425 | { |
---|
[1313] | 426 | { BSLICE_LUMA_SIGNIFICANCE_CONTEXT, BSLICE_CHROMA_SIGNIFICANCE_CONTEXT }, |
---|
| 427 | { PSLICE_LUMA_SIGNIFICANCE_CONTEXT, PSLICE_CHROMA_SIGNIFICANCE_CONTEXT }, |
---|
| 428 | { ISLICE_LUMA_SIGNIFICANCE_CONTEXT, ISLICE_CHROMA_SIGNIFICANCE_CONTEXT }, |
---|
[56] | 429 | }; |
---|
| 430 | |
---|
[1313] | 431 | |
---|
| 432 | //-------------------------------------------------------------------------------------------------- |
---|
| 433 | |
---|
| 434 | //Initialisation for greater-than-one flags and greater-than-two flags |
---|
| 435 | |
---|
| 436 | // |------Set 0-------| |------Set 1-------| |------Set 2-------| |------Set 3-------| |
---|
| 437 | #define BSLICE_LUMA_ONE_CONTEXT 154, 196, 167, 167, 154, 152, 167, 182, 182, 134, 149, 136, 153, 121, 136, 122 |
---|
| 438 | #define PSLICE_LUMA_ONE_CONTEXT 154, 196, 196, 167, 154, 152, 167, 182, 182, 134, 149, 136, 153, 121, 136, 137 |
---|
| 439 | #define ISLICE_LUMA_ONE_CONTEXT 140, 92, 137, 138, 140, 152, 138, 139, 153, 74, 149, 92, 139, 107, 122, 152 |
---|
| 440 | |
---|
| 441 | #define BSLICE_LUMA_ABS_CONTEXT 107, 167, 91, 107 |
---|
| 442 | #define PSLICE_LUMA_ABS_CONTEXT 107, 167, 91, 122 |
---|
| 443 | #define ISLICE_LUMA_ABS_CONTEXT 138, 153, 136, 167 |
---|
| 444 | |
---|
| 445 | // |------Set 4-------| |------Set 5-------| |
---|
| 446 | #define BSLICE_CHROMA_ONE_CONTEXT 169, 208, 166, 167, 154, 152, 167, 182 |
---|
| 447 | #define PSLICE_CHROMA_ONE_CONTEXT 169, 194, 166, 167, 154, 167, 137, 182 |
---|
| 448 | #define ISLICE_CHROMA_ONE_CONTEXT 140, 179, 166, 182, 140, 227, 122, 197 |
---|
| 449 | |
---|
| 450 | #define BSLICE_CHROMA_ABS_CONTEXT 107, 167 |
---|
| 451 | #define PSLICE_CHROMA_ABS_CONTEXT 107, 167 |
---|
| 452 | #define ISLICE_CHROMA_ABS_CONTEXT 152, 152 |
---|
| 453 | |
---|
| 454 | |
---|
| 455 | //------------------------------------------------ |
---|
| 456 | |
---|
| 457 | static const UChar |
---|
| 458 | INIT_ONE_FLAG[NUMBER_OF_SLICE_TYPES][NUM_ONE_FLAG_CTX] = |
---|
[56] | 459 | { |
---|
[1313] | 460 | { BSLICE_LUMA_ONE_CONTEXT, BSLICE_CHROMA_ONE_CONTEXT }, |
---|
| 461 | { PSLICE_LUMA_ONE_CONTEXT, PSLICE_CHROMA_ONE_CONTEXT }, |
---|
| 462 | { ISLICE_LUMA_ONE_CONTEXT, ISLICE_CHROMA_ONE_CONTEXT }, |
---|
[56] | 463 | }; |
---|
| 464 | |
---|
[1313] | 465 | static const UChar |
---|
| 466 | INIT_ABS_FLAG[NUMBER_OF_SLICE_TYPES][NUM_ABS_FLAG_CTX] = |
---|
[56] | 467 | { |
---|
[1313] | 468 | { BSLICE_LUMA_ABS_CONTEXT, BSLICE_CHROMA_ABS_CONTEXT }, |
---|
| 469 | { PSLICE_LUMA_ABS_CONTEXT, PSLICE_CHROMA_ABS_CONTEXT }, |
---|
| 470 | { ISLICE_LUMA_ABS_CONTEXT, ISLICE_CHROMA_ABS_CONTEXT }, |
---|
[56] | 471 | }; |
---|
| 472 | |
---|
[1313] | 473 | |
---|
| 474 | //-------------------------------------------------------------------------------------------------- |
---|
| 475 | |
---|
| 476 | static const UChar |
---|
| 477 | INIT_MVP_IDX[NUMBER_OF_SLICE_TYPES][NUM_MVP_IDX_CTX] = |
---|
[56] | 478 | { |
---|
[1313] | 479 | { 168, }, |
---|
| 480 | { 168, }, |
---|
| 481 | { CNU, }, |
---|
| 482 | }; |
---|
| 483 | |
---|
| 484 | static const UChar |
---|
| 485 | INIT_SAO_MERGE_FLAG[NUMBER_OF_SLICE_TYPES][NUM_SAO_MERGE_FLAG_CTX] = |
---|
| 486 | { |
---|
| 487 | { 153, }, |
---|
| 488 | { 153, }, |
---|
| 489 | { 153, }, |
---|
| 490 | }; |
---|
| 491 | |
---|
| 492 | static const UChar |
---|
| 493 | INIT_SAO_TYPE_IDX[NUMBER_OF_SLICE_TYPES][NUM_SAO_TYPE_IDX_CTX] = |
---|
| 494 | { |
---|
[608] | 495 | { 160, }, |
---|
| 496 | { 185, }, |
---|
| 497 | { 200, }, |
---|
[56] | 498 | }; |
---|
| 499 | |
---|
[443] | 500 | static const UChar |
---|
[1313] | 501 | INIT_TRANS_SUBDIV_FLAG[NUMBER_OF_SLICE_TYPES][NUM_TRANS_SUBDIV_FLAG_CTX] = |
---|
[443] | 502 | { |
---|
[608] | 503 | { 224, 167, 122, }, |
---|
| 504 | { 124, 138, 94, }, |
---|
| 505 | { 153, 138, 138, }, |
---|
[56] | 506 | }; |
---|
| 507 | |
---|
[608] | 508 | static const UChar |
---|
[1313] | 509 | INIT_TRANSFORMSKIP_FLAG[NUMBER_OF_SLICE_TYPES][2*NUM_TRANSFORMSKIP_FLAG_CTX] = |
---|
[56] | 510 | { |
---|
[1313] | 511 | { 139, 139}, |
---|
| 512 | { 139, 139}, |
---|
| 513 | { 139, 139}, |
---|
[56] | 514 | }; |
---|
| 515 | |
---|
[1313] | 516 | static const UChar |
---|
| 517 | INIT_EXPLICIT_RDPCM_FLAG[NUMBER_OF_SLICE_TYPES][2*NUM_EXPLICIT_RDPCM_FLAG_CTX] = |
---|
| 518 | { |
---|
| 519 | {139, 139}, |
---|
| 520 | {139, 139}, |
---|
| 521 | {CNU, CNU} |
---|
| 522 | }; |
---|
| 523 | |
---|
| 524 | static const UChar |
---|
| 525 | INIT_EXPLICIT_RDPCM_DIR[NUMBER_OF_SLICE_TYPES][2*NUM_EXPLICIT_RDPCM_DIR_CTX] = |
---|
| 526 | { |
---|
| 527 | {139, 139}, |
---|
| 528 | {139, 139}, |
---|
| 529 | {CNU, CNU} |
---|
| 530 | }; |
---|
| 531 | |
---|
| 532 | static const UChar |
---|
| 533 | INIT_CROSS_COMPONENT_PREDICTION[NUMBER_OF_SLICE_TYPES][NUM_CROSS_COMPONENT_PREDICTION_CTX] = |
---|
| 534 | { |
---|
| 535 | { 154, 154, 154, 154, 154, 154, 154, 154, 154, 154 }, |
---|
| 536 | { 154, 154, 154, 154, 154, 154, 154, 154, 154, 154 }, |
---|
| 537 | { 154, 154, 154, 154, 154, 154, 154, 154, 154, 154 }, |
---|
| 538 | }; |
---|
| 539 | |
---|
| 540 | //! \} |
---|
| 541 | |
---|
| 542 | #if NH_3D_ARP |
---|
[56] | 543 | static const UChar |
---|
[608] | 544 | INIT_ARPW[3][NUM_ARPW_CTX] = |
---|
[56] | 545 | { |
---|
[833] | 546 | { 162, 153, 162 }, |
---|
| 547 | { 162, 153, 162 }, |
---|
| 548 | { 162, 153, 162 }, |
---|
| 549 | }; |
---|
[884] | 550 | |
---|
[608] | 551 | #endif |
---|
[1313] | 552 | #if NH_3D_IC |
---|
[56] | 553 | static const UChar |
---|
[608] | 554 | INIT_IC_FLAG[3][NUM_IC_FLAG_CTX] = |
---|
[56] | 555 | { |
---|
[833] | 556 | { 154 }, |
---|
| 557 | { 154 }, |
---|
| 558 | { 154 }, |
---|
| 559 | }; |
---|
[884] | 560 | |
---|
[608] | 561 | #endif |
---|
[655] | 562 | |
---|
[1313] | 563 | #if NH_3D_DMM |
---|
[56] | 564 | static const UChar |
---|
[1313] | 565 | INIT_NOTDMM_FLAG[3][NUM_NOTDMM_FLAG_CTX] = |
---|
[833] | 566 | { |
---|
[950] | 567 | { 154 }, |
---|
| 568 | { 141 }, |
---|
| 569 | { 155 }, |
---|
| 570 | }; |
---|
[833] | 571 | static const UChar |
---|
[1313] | 572 | INIT_DMM_MODE[3][NUM_DMM_MODE_CTX] = |
---|
[56] | 573 | { |
---|
[1313] | 574 | { CNU }, |
---|
| 575 | { CNU }, |
---|
| 576 | { CNU } |
---|
[56] | 577 | }; |
---|
[1313] | 578 | #endif |
---|
| 579 | #if NH_3D_DMM || NH_3D_SDC_INTRA |
---|
[56] | 580 | static const UChar |
---|
[608] | 581 | INIT_DDC_DATA[3][NUM_DDC_DATA_CTX] = |
---|
[2] | 582 | { |
---|
[608] | 583 | { CNU }, |
---|
| 584 | { CNU }, |
---|
| 585 | { CNU }, |
---|
[2] | 586 | }; |
---|
| 587 | #endif |
---|
[1313] | 588 | #if NH_3D_SDC_INTRA |
---|
[608] | 589 | static const UChar |
---|
| 590 | INIT_SDC_RESIDUAL_FLAG[3][SDC_NUM_RESIDUAL_FLAG_CTX] = |
---|
[443] | 591 | { |
---|
[608] | 592 | { CNU }, |
---|
| 593 | { CNU }, |
---|
| 594 | { CNU }, |
---|
[443] | 595 | }; |
---|
[608] | 596 | static const UChar |
---|
| 597 | INIT_SDC_RESIDUAL[3][SDC_NUM_RESIDUAL_CTX] = |
---|
[443] | 598 | { |
---|
[608] | 599 | { 155 }, |
---|
| 600 | { 155 }, |
---|
| 601 | { 155 }, |
---|
[443] | 602 | }; |
---|
[833] | 603 | static const UChar |
---|
| 604 | INIT_SDC_FLAG[3][NUM_SDC_FLAG_CTX] = |
---|
| 605 | { |
---|
| 606 | { 154 }, |
---|
| 607 | { 154 }, |
---|
| 608 | { 154 }, |
---|
| 609 | }; |
---|
[1313] | 610 | static const UChar |
---|
| 611 | INIT_DDC_FLAG[3][NUM_DDC_FLAG_CTX] = |
---|
| 612 | { |
---|
| 613 | {0 , CNU}, |
---|
| 614 | {0 , CNU}, |
---|
| 615 | {64, CNU} |
---|
| 616 | }; |
---|
[833] | 617 | #endif |
---|
[1313] | 618 | #if NH_3D_DBBP |
---|
[833] | 619 | static const UChar INIT_DBBP_FLAG[3][DBBP_NUM_FLAG_CTX] = |
---|
| 620 | { |
---|
[1039] | 621 | { CNU }, |
---|
| 622 | { CNU }, |
---|
| 623 | { CNU }, |
---|
[950] | 624 | }; |
---|
[833] | 625 | #endif |
---|
[608] | 626 | |
---|
[2] | 627 | #endif |
---|