[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 |
---|
[56] | 53 | #define NUM_MERGE_FLAG_EXT_CTX 1 ///< number of context models for merge flag of merge extended |
---|
| 54 | #define NUM_MERGE_IDX_EXT_CTX 1 ///< number of context models for merge index of merge extended |
---|
[2] | 55 | |
---|
[56] | 56 | #define NUM_PART_SIZE_CTX 4 ///< number of context models for partition size |
---|
| 57 | #define NUM_PRED_MODE_CTX 1 ///< number of context models for prediction mode |
---|
[2] | 58 | |
---|
[1313] | 59 | #define NUM_INTRA_PREDICT_CTX 1 ///< number of context models for intra prediction |
---|
[56] | 60 | |
---|
| 61 | #define NUM_CHROMA_PRED_CTX 2 ///< number of context models for intra prediction (chroma) |
---|
[608] | 62 | #define NUM_INTER_DIR_CTX 5 ///< number of context models for inter prediction direction |
---|
[56] | 63 | #define NUM_MV_RES_CTX 2 ///< number of context models for motion vector difference |
---|
[1313] | 64 | #define NUM_CHROMA_QP_ADJ_FLAG_CTX 1 ///< number of context models for chroma_qp_adjustment_flag |
---|
| 65 | #define NUM_CHROMA_QP_ADJ_IDC_CTX 1 ///< number of context models for chroma_qp_adjustment_idc |
---|
[2] | 66 | |
---|
[608] | 67 | #define NUM_REF_NO_CTX 2 ///< number of context models for reference index |
---|
| 68 | #define NUM_TRANS_SUBDIV_FLAG_CTX 3 ///< number of context models for transform subdivision flags |
---|
[56] | 69 | #define NUM_QT_ROOT_CBF_CTX 1 ///< number of context models for QT ROOT CBF |
---|
| 70 | #define NUM_DELTA_QP_CTX 3 ///< number of context models for dQP |
---|
[2] | 71 | |
---|
[56] | 72 | #define NUM_SIG_CG_FLAG_CTX 2 ///< number of context models for MULTI_LEVEL_SIGNIFICANCE |
---|
[1313] | 73 | #define NUM_EXPLICIT_RDPCM_FLAG_CTX 1 ///< number of context models for the flag which specifies whether to use RDPCM on inter coded residues |
---|
| 74 | #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] | 75 | |
---|
[1313] | 76 | //-------------------------------------------------------------------------------------------------- |
---|
[56] | 77 | |
---|
[1313] | 78 | // context size definitions for significance map |
---|
| 79 | |
---|
| 80 | #define NUM_SIG_FLAG_CTX_LUMA 28 ///< number of context models for luma sig flag |
---|
| 81 | #define NUM_SIG_FLAG_CTX_CHROMA 16 ///< number of context models for chroma sig flag |
---|
| 82 | |
---|
| 83 | // |----Luma-----| |---Chroma----| |
---|
| 84 | static const UInt significanceMapContextSetStart [MAX_NUM_CHANNEL_TYPE][CONTEXT_NUMBER_OF_TYPES] = { {0, 9, 21, 27}, {0, 9, 12, 15} }; |
---|
| 85 | static const UInt significanceMapContextSetSize [MAX_NUM_CHANNEL_TYPE][CONTEXT_NUMBER_OF_TYPES] = { {9, 12, 6, 1}, {9, 3, 3, 1} }; |
---|
| 86 | static const UInt nonDiagonalScan8x8ContextOffset [MAX_NUM_CHANNEL_TYPE] = { 6, 0 }; |
---|
| 87 | static const UInt notFirstGroupNeighbourhoodContextOffset[MAX_NUM_CHANNEL_TYPE] = { 3, 0 }; |
---|
| 88 | |
---|
| 89 | //------------------ |
---|
| 90 | |
---|
| 91 | #define NEIGHBOURHOOD_00_CONTEXT_1_THRESHOLD_4x4 3 |
---|
| 92 | #define NEIGHBOURHOOD_00_CONTEXT_2_THRESHOLD_4x4 1 |
---|
| 93 | |
---|
| 94 | //------------------ |
---|
| 95 | |
---|
| 96 | #define FIRST_SIG_FLAG_CTX_LUMA 0 |
---|
| 97 | #define FIRST_SIG_FLAG_CTX_CHROMA (FIRST_SIG_FLAG_CTX_LUMA + NUM_SIG_FLAG_CTX_LUMA) |
---|
| 98 | |
---|
| 99 | #define NUM_SIG_FLAG_CTX (NUM_SIG_FLAG_CTX_LUMA + NUM_SIG_FLAG_CTX_CHROMA) ///< number of context models for sig flag |
---|
| 100 | |
---|
| 101 | //-------------------------------------------------------------------------------------------------- |
---|
| 102 | |
---|
| 103 | // context size definitions for last significant coefficient position |
---|
| 104 | |
---|
| 105 | #define NUM_CTX_LAST_FLAG_SETS 2 |
---|
| 106 | |
---|
[56] | 107 | #define NUM_CTX_LAST_FLAG_XY 15 ///< number of context models for last coefficient position |
---|
[2] | 108 | |
---|
[1313] | 109 | //-------------------------------------------------------------------------------------------------- |
---|
[56] | 110 | |
---|
[1313] | 111 | // context size definitions for greater-than-one and greater-than-two maps |
---|
| 112 | |
---|
| 113 | #define NUM_ONE_FLAG_CTX_PER_SET 4 ///< number of context models for greater than 1 flag in a set |
---|
| 114 | #define NUM_ABS_FLAG_CTX_PER_SET 1 ///< number of context models for greater than 2 flag in a set |
---|
| 115 | |
---|
| 116 | //------------------ |
---|
| 117 | |
---|
| 118 | #define NUM_CTX_SETS_LUMA 4 ///< number of context model sets for luminance |
---|
| 119 | #define NUM_CTX_SETS_CHROMA 2 ///< number of context model sets for combined chrominance |
---|
| 120 | |
---|
| 121 | #define FIRST_CTX_SET_LUMA 0 ///< index of first luminance context set |
---|
| 122 | |
---|
| 123 | //------------------ |
---|
| 124 | |
---|
| 125 | #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 |
---|
| 126 | #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 |
---|
| 127 | |
---|
| 128 | #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 |
---|
| 129 | #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 |
---|
| 130 | |
---|
| 131 | #define NUM_ONE_FLAG_CTX (NUM_ONE_FLAG_CTX_LUMA + NUM_ONE_FLAG_CTX_CHROMA) ///< number of context models for greater than 1 flag |
---|
| 132 | #define NUM_ABS_FLAG_CTX (NUM_ABS_FLAG_CTX_LUMA + NUM_ABS_FLAG_CTX_CHROMA) ///< number of context models for greater than 2 flag |
---|
| 133 | |
---|
| 134 | #define FIRST_CTX_SET_CHROMA (FIRST_CTX_SET_LUMA + NUM_CTX_SETS_LUMA) ///< index of first chrominance context set |
---|
| 135 | |
---|
| 136 | //-------------------------------------------------------------------------------------------------- |
---|
| 137 | |
---|
| 138 | // context size definitions for CBF |
---|
| 139 | |
---|
| 140 | #define NUM_QT_CBF_CTX_SETS 2 |
---|
| 141 | |
---|
| 142 | #define NUM_QT_CBF_CTX_PER_SET 5 ///< number of context models for QT CBF |
---|
| 143 | |
---|
| 144 | #define FIRST_CBF_CTX_LUMA 0 ///< index of first luminance CBF context |
---|
| 145 | |
---|
| 146 | #define FIRST_CBF_CTX_CHROMA (FIRST_CBF_CTX_LUMA + NUM_QT_CBF_CTX_PER_SET) ///< index of first chrominance CBF context |
---|
| 147 | |
---|
| 148 | |
---|
| 149 | //-------------------------------------------------------------------------------------------------- |
---|
| 150 | |
---|
[872] | 151 | #define NUM_MVP_IDX_CTX 1 ///< number of context models for MVP index |
---|
[2] | 152 | |
---|
[443] | 153 | #define NUM_SAO_MERGE_FLAG_CTX 1 ///< number of context models for SAO merge flags |
---|
| 154 | #define NUM_SAO_TYPE_IDX_CTX 1 ///< number of context models for SAO type index |
---|
[608] | 155 | |
---|
[1313] | 156 | #define NUM_TRANSFORMSKIP_FLAG_CTX 1 ///< number of context models for transform skipping |
---|
[608] | 157 | |
---|
[1313] | 158 | #define NUM_CU_TRANSQUANT_BYPASS_FLAG_CTX 1 |
---|
| 159 | |
---|
[608] | 160 | |
---|
[1313] | 161 | #define NUM_CROSS_COMPONENT_PREDICTION_CTX 10 |
---|
[608] | 162 | |
---|
[56] | 163 | #define CNU 154 ///< dummy initialization value for unused context models 'Context model Not Used' |
---|
[2] | 164 | |
---|
| 165 | // ==================================================================================================================== |
---|
| 166 | // Tables |
---|
| 167 | // ==================================================================================================================== |
---|
| 168 | |
---|
[608] | 169 | // initial probability for cu_transquant_bypass flag |
---|
| 170 | static const UChar |
---|
[1313] | 171 | INIT_CU_TRANSQUANT_BYPASS_FLAG[NUMBER_OF_SLICE_TYPES][NUM_CU_TRANSQUANT_BYPASS_FLAG_CTX] = |
---|
[608] | 172 | { |
---|
[1313] | 173 | { 154 }, |
---|
| 174 | { 154 }, |
---|
| 175 | { 154 }, |
---|
[608] | 176 | }; |
---|
| 177 | |
---|
[56] | 178 | // initial probability for split flag |
---|
[1313] | 179 | static const UChar |
---|
| 180 | INIT_SPLIT_FLAG[NUMBER_OF_SLICE_TYPES][NUM_SPLIT_FLAG_CTX] = |
---|
[2] | 181 | { |
---|
[608] | 182 | { 107, 139, 126, }, |
---|
[1313] | 183 | { 107, 139, 126, }, |
---|
| 184 | { 139, 141, 157, }, |
---|
[2] | 185 | }; |
---|
| 186 | |
---|
[1313] | 187 | static const UChar |
---|
| 188 | INIT_SKIP_FLAG[NUMBER_OF_SLICE_TYPES][NUM_SKIP_FLAG_CTX] = |
---|
[2] | 189 | { |
---|
[1313] | 190 | { 197, 185, 201, }, |
---|
| 191 | { 197, 185, 201, }, |
---|
| 192 | { CNU, CNU, CNU, }, |
---|
[189] | 193 | }; |
---|
[1179] | 194 | static const UChar |
---|
[1313] | 195 | INIT_MERGE_FLAG_EXT[NUMBER_OF_SLICE_TYPES][NUM_MERGE_FLAG_EXT_CTX] = |
---|
[56] | 196 | { |
---|
[1313] | 197 | { 154, }, |
---|
| 198 | { 110, }, |
---|
| 199 | { CNU, }, |
---|
[56] | 200 | }; |
---|
[2] | 201 | |
---|
[1313] | 202 | static const UChar |
---|
| 203 | INIT_MERGE_IDX_EXT[NUMBER_OF_SLICE_TYPES][NUM_MERGE_IDX_EXT_CTX] = |
---|
[2] | 204 | { |
---|
[1313] | 205 | { 137, }, |
---|
| 206 | { 122, }, |
---|
| 207 | { CNU, }, |
---|
[56] | 208 | }; |
---|
| 209 | |
---|
[1313] | 210 | static const UChar |
---|
| 211 | INIT_PART_SIZE[NUMBER_OF_SLICE_TYPES][NUM_PART_SIZE_CTX] = |
---|
[56] | 212 | { |
---|
[1313] | 213 | { 154, 139, 154, 154 }, |
---|
| 214 | { 154, 139, 154, 154 }, |
---|
| 215 | { 184, CNU, CNU, CNU }, |
---|
[56] | 216 | }; |
---|
| 217 | |
---|
[1313] | 218 | static const UChar |
---|
| 219 | INIT_PRED_MODE[NUMBER_OF_SLICE_TYPES][NUM_PRED_MODE_CTX] = |
---|
[56] | 220 | { |
---|
[1313] | 221 | { 134, }, |
---|
| 222 | { 149, }, |
---|
| 223 | { CNU, }, |
---|
[56] | 224 | }; |
---|
| 225 | |
---|
[1313] | 226 | static const UChar |
---|
| 227 | INIT_INTRA_PRED_MODE[NUMBER_OF_SLICE_TYPES][NUM_INTRA_PREDICT_CTX] = |
---|
[56] | 228 | { |
---|
[1313] | 229 | { 183, }, |
---|
| 230 | { 154, }, |
---|
| 231 | { 184, }, |
---|
[56] | 232 | }; |
---|
| 233 | |
---|
[1313] | 234 | static const UChar |
---|
| 235 | INIT_CHROMA_PRED_MODE[NUMBER_OF_SLICE_TYPES][NUM_CHROMA_PRED_CTX] = |
---|
[56] | 236 | { |
---|
[1313] | 237 | { 152, 139, }, |
---|
| 238 | { 152, 139, }, |
---|
| 239 | { 63, 139, }, |
---|
[56] | 240 | }; |
---|
| 241 | |
---|
[1313] | 242 | static const UChar |
---|
| 243 | INIT_INTER_DIR[NUMBER_OF_SLICE_TYPES][NUM_INTER_DIR_CTX] = |
---|
[56] | 244 | { |
---|
[1313] | 245 | { 95, 79, 63, 31, 31, }, |
---|
| 246 | { 95, 79, 63, 31, 31, }, |
---|
| 247 | { CNU, CNU, CNU, CNU, CNU, }, |
---|
[56] | 248 | }; |
---|
| 249 | |
---|
[1313] | 250 | static const UChar |
---|
| 251 | INIT_MVD[NUMBER_OF_SLICE_TYPES][NUM_MV_RES_CTX] = |
---|
[56] | 252 | { |
---|
[1313] | 253 | { 169, 198, }, |
---|
| 254 | { 140, 198, }, |
---|
| 255 | { CNU, CNU, }, |
---|
[56] | 256 | }; |
---|
| 257 | |
---|
[1313] | 258 | static const UChar |
---|
| 259 | INIT_REF_PIC[NUMBER_OF_SLICE_TYPES][NUM_REF_NO_CTX] = |
---|
[56] | 260 | { |
---|
[1313] | 261 | { 153, 153 }, |
---|
| 262 | { 153, 153 }, |
---|
| 263 | { CNU, CNU }, |
---|
[56] | 264 | }; |
---|
| 265 | |
---|
[1313] | 266 | static const UChar |
---|
| 267 | INIT_DQP[NUMBER_OF_SLICE_TYPES][NUM_DELTA_QP_CTX] = |
---|
[56] | 268 | { |
---|
[1313] | 269 | { 154, 154, 154, }, |
---|
| 270 | { 154, 154, 154, }, |
---|
| 271 | { 154, 154, 154, }, |
---|
[56] | 272 | }; |
---|
| 273 | |
---|
[1313] | 274 | static const UChar |
---|
| 275 | INIT_CHROMA_QP_ADJ_FLAG[NUMBER_OF_SLICE_TYPES][NUM_CHROMA_QP_ADJ_FLAG_CTX] = |
---|
[56] | 276 | { |
---|
[1313] | 277 | { 154, }, |
---|
| 278 | { 154, }, |
---|
| 279 | { 154, }, |
---|
[56] | 280 | }; |
---|
| 281 | |
---|
[1313] | 282 | static const UChar |
---|
| 283 | INIT_CHROMA_QP_ADJ_IDC[NUMBER_OF_SLICE_TYPES][NUM_CHROMA_QP_ADJ_IDC_CTX] = |
---|
[56] | 284 | { |
---|
[1313] | 285 | { 154, }, |
---|
| 286 | { 154, }, |
---|
| 287 | { 154, }, |
---|
[56] | 288 | }; |
---|
| 289 | |
---|
[1313] | 290 | //-------------------------------------------------------------------------------------------------- |
---|
| 291 | |
---|
| 292 | //Initialisation for CBF |
---|
| 293 | |
---|
| 294 | // |---------Luminance---------| |
---|
| 295 | #define BSLICE_LUMA_CBF_CONTEXT 153, 111, CNU, CNU, CNU |
---|
| 296 | #define PSLICE_LUMA_CBF_CONTEXT 153, 111, CNU, CNU, CNU |
---|
| 297 | #define ISLICE_LUMA_CBF_CONTEXT 111, 141, CNU, CNU, CNU |
---|
| 298 | // |--------Chrominance--------| |
---|
| 299 | #define BSLICE_CHROMA_CBF_CONTEXT 149, 92, 167, 154, 154 |
---|
| 300 | #define PSLICE_CHROMA_CBF_CONTEXT 149, 107, 167, 154, 154 |
---|
| 301 | #define ISLICE_CHROMA_CBF_CONTEXT 94, 138, 182, 154, 154 |
---|
| 302 | |
---|
| 303 | |
---|
| 304 | static const UChar |
---|
| 305 | INIT_QT_CBF[NUMBER_OF_SLICE_TYPES][NUM_QT_CBF_CTX_SETS * NUM_QT_CBF_CTX_PER_SET] = |
---|
[56] | 306 | { |
---|
[1313] | 307 | { BSLICE_LUMA_CBF_CONTEXT, BSLICE_CHROMA_CBF_CONTEXT }, |
---|
| 308 | { PSLICE_LUMA_CBF_CONTEXT, PSLICE_CHROMA_CBF_CONTEXT }, |
---|
| 309 | { ISLICE_LUMA_CBF_CONTEXT, ISLICE_CHROMA_CBF_CONTEXT }, |
---|
[56] | 310 | }; |
---|
| 311 | |
---|
[1313] | 312 | |
---|
| 313 | //-------------------------------------------------------------------------------------------------- |
---|
| 314 | |
---|
| 315 | static const UChar |
---|
| 316 | INIT_QT_ROOT_CBF[NUMBER_OF_SLICE_TYPES][NUM_QT_ROOT_CBF_CTX] = |
---|
[56] | 317 | { |
---|
[1313] | 318 | { 79, }, |
---|
| 319 | { 79, }, |
---|
| 320 | { CNU, }, |
---|
[56] | 321 | }; |
---|
| 322 | |
---|
[1313] | 323 | |
---|
| 324 | //-------------------------------------------------------------------------------------------------- |
---|
| 325 | |
---|
| 326 | //Initialisation for last-significant-position |
---|
| 327 | |
---|
| 328 | // |------------------------------Luminance----------------------------------| |
---|
| 329 | #define BSLICE_LUMA_LAST_POSITION_CONTEXT 125, 110, 124, 110, 95, 94, 125, 111, 111, 79, 125, 126, 111, 111, 79 |
---|
| 330 | #define PSLICE_LUMA_LAST_POSITION_CONTEXT 125, 110, 94, 110, 95, 79, 125, 111, 110, 78, 110, 111, 111, 95, 94 |
---|
| 331 | #define ISLICE_LUMA_LAST_POSITION_CONTEXT 110, 110, 124, 125, 140, 153, 125, 127, 140, 109, 111, 143, 127, 111, 79 |
---|
| 332 | // |------------------------------Chrominance--------------------------------| |
---|
| 333 | #define BSLICE_CHROMA_LAST_POSITION_CONTEXT 108, 123, 93, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU |
---|
| 334 | #define PSLICE_CHROMA_LAST_POSITION_CONTEXT 108, 123, 108, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU |
---|
| 335 | #define ISLICE_CHROMA_LAST_POSITION_CONTEXT 108, 123, 63, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU |
---|
| 336 | |
---|
| 337 | |
---|
| 338 | static const UChar |
---|
| 339 | INIT_LAST[NUMBER_OF_SLICE_TYPES][NUM_CTX_LAST_FLAG_SETS * NUM_CTX_LAST_FLAG_XY] = |
---|
[56] | 340 | { |
---|
[1313] | 341 | { BSLICE_LUMA_LAST_POSITION_CONTEXT, BSLICE_CHROMA_LAST_POSITION_CONTEXT }, |
---|
| 342 | { PSLICE_LUMA_LAST_POSITION_CONTEXT, PSLICE_CHROMA_LAST_POSITION_CONTEXT }, |
---|
| 343 | { ISLICE_LUMA_LAST_POSITION_CONTEXT, ISLICE_CHROMA_LAST_POSITION_CONTEXT }, |
---|
[56] | 344 | }; |
---|
| 345 | |
---|
[1313] | 346 | |
---|
| 347 | //-------------------------------------------------------------------------------------------------- |
---|
| 348 | |
---|
| 349 | static const UChar |
---|
| 350 | INIT_SIG_CG_FLAG[NUMBER_OF_SLICE_TYPES][2 * NUM_SIG_CG_FLAG_CTX] = |
---|
[56] | 351 | { |
---|
[1313] | 352 | { 121, 140, |
---|
| 353 | 61, 154, |
---|
| 354 | }, |
---|
| 355 | { 121, 140, |
---|
| 356 | 61, 154, |
---|
| 357 | }, |
---|
| 358 | { 91, 171, |
---|
| 359 | 134, 141, |
---|
| 360 | }, |
---|
[56] | 361 | }; |
---|
| 362 | |
---|
[1313] | 363 | |
---|
| 364 | //-------------------------------------------------------------------------------------------------- |
---|
| 365 | |
---|
| 366 | //Initialisation for significance map |
---|
| 367 | |
---|
| 368 | // |-DC-| |-----------------4x4------------------| |------8x8 Diagonal Scan------| |----8x8 Non-Diagonal Scan----| |-NxN First group-| |-NxN Other group-| |-Single context-| |
---|
| 369 | // | | | | |-First Group-| |-Other Group-| |-First Group-| |-Other Group-| | | | | | | |
---|
| 370 | #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 |
---|
| 371 | #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 |
---|
| 372 | #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 |
---|
| 373 | |
---|
| 374 | // |-DC-| |-----------------4x4------------------| |-8x8 Any group-| |-NxN Any group-| |-Single context-| |
---|
| 375 | #define BSLICE_CHROMA_SIGNIFICANCE_CONTEXT 170, 153, 138, 138, 122, 121, 122, 121, 167, 151, 183, 140, 151, 183, 140, 140 |
---|
| 376 | #define PSLICE_CHROMA_SIGNIFICANCE_CONTEXT 170, 153, 123, 123, 107, 121, 107, 121, 167, 151, 183, 140, 151, 183, 140, 140 |
---|
| 377 | #define ISLICE_CHROMA_SIGNIFICANCE_CONTEXT 140, 139, 182, 182, 152, 136, 152, 136, 153, 136, 139, 111, 136, 139, 111, 111 |
---|
| 378 | |
---|
| 379 | //------------------------------------------------ |
---|
| 380 | |
---|
| 381 | static const UChar |
---|
| 382 | INIT_SIG_FLAG[NUMBER_OF_SLICE_TYPES][NUM_SIG_FLAG_CTX] = |
---|
[56] | 383 | { |
---|
[1313] | 384 | { BSLICE_LUMA_SIGNIFICANCE_CONTEXT, BSLICE_CHROMA_SIGNIFICANCE_CONTEXT }, |
---|
| 385 | { PSLICE_LUMA_SIGNIFICANCE_CONTEXT, PSLICE_CHROMA_SIGNIFICANCE_CONTEXT }, |
---|
| 386 | { ISLICE_LUMA_SIGNIFICANCE_CONTEXT, ISLICE_CHROMA_SIGNIFICANCE_CONTEXT }, |
---|
[56] | 387 | }; |
---|
| 388 | |
---|
[1313] | 389 | |
---|
| 390 | //-------------------------------------------------------------------------------------------------- |
---|
| 391 | |
---|
| 392 | //Initialisation for greater-than-one flags and greater-than-two flags |
---|
| 393 | |
---|
| 394 | // |------Set 0-------| |------Set 1-------| |------Set 2-------| |------Set 3-------| |
---|
| 395 | #define BSLICE_LUMA_ONE_CONTEXT 154, 196, 167, 167, 154, 152, 167, 182, 182, 134, 149, 136, 153, 121, 136, 122 |
---|
| 396 | #define PSLICE_LUMA_ONE_CONTEXT 154, 196, 196, 167, 154, 152, 167, 182, 182, 134, 149, 136, 153, 121, 136, 137 |
---|
| 397 | #define ISLICE_LUMA_ONE_CONTEXT 140, 92, 137, 138, 140, 152, 138, 139, 153, 74, 149, 92, 139, 107, 122, 152 |
---|
| 398 | |
---|
| 399 | #define BSLICE_LUMA_ABS_CONTEXT 107, 167, 91, 107 |
---|
| 400 | #define PSLICE_LUMA_ABS_CONTEXT 107, 167, 91, 122 |
---|
| 401 | #define ISLICE_LUMA_ABS_CONTEXT 138, 153, 136, 167 |
---|
| 402 | |
---|
| 403 | // |------Set 4-------| |------Set 5-------| |
---|
| 404 | #define BSLICE_CHROMA_ONE_CONTEXT 169, 208, 166, 167, 154, 152, 167, 182 |
---|
| 405 | #define PSLICE_CHROMA_ONE_CONTEXT 169, 194, 166, 167, 154, 167, 137, 182 |
---|
| 406 | #define ISLICE_CHROMA_ONE_CONTEXT 140, 179, 166, 182, 140, 227, 122, 197 |
---|
| 407 | |
---|
| 408 | #define BSLICE_CHROMA_ABS_CONTEXT 107, 167 |
---|
| 409 | #define PSLICE_CHROMA_ABS_CONTEXT 107, 167 |
---|
| 410 | #define ISLICE_CHROMA_ABS_CONTEXT 152, 152 |
---|
| 411 | |
---|
| 412 | |
---|
| 413 | //------------------------------------------------ |
---|
| 414 | |
---|
| 415 | static const UChar |
---|
| 416 | INIT_ONE_FLAG[NUMBER_OF_SLICE_TYPES][NUM_ONE_FLAG_CTX] = |
---|
[56] | 417 | { |
---|
[1313] | 418 | { BSLICE_LUMA_ONE_CONTEXT, BSLICE_CHROMA_ONE_CONTEXT }, |
---|
| 419 | { PSLICE_LUMA_ONE_CONTEXT, PSLICE_CHROMA_ONE_CONTEXT }, |
---|
| 420 | { ISLICE_LUMA_ONE_CONTEXT, ISLICE_CHROMA_ONE_CONTEXT }, |
---|
[56] | 421 | }; |
---|
| 422 | |
---|
[1313] | 423 | static const UChar |
---|
| 424 | INIT_ABS_FLAG[NUMBER_OF_SLICE_TYPES][NUM_ABS_FLAG_CTX] = |
---|
[56] | 425 | { |
---|
[1313] | 426 | { BSLICE_LUMA_ABS_CONTEXT, BSLICE_CHROMA_ABS_CONTEXT }, |
---|
| 427 | { PSLICE_LUMA_ABS_CONTEXT, PSLICE_CHROMA_ABS_CONTEXT }, |
---|
| 428 | { ISLICE_LUMA_ABS_CONTEXT, ISLICE_CHROMA_ABS_CONTEXT }, |
---|
[56] | 429 | }; |
---|
| 430 | |
---|
[1313] | 431 | |
---|
| 432 | //-------------------------------------------------------------------------------------------------- |
---|
| 433 | |
---|
| 434 | static const UChar |
---|
| 435 | INIT_MVP_IDX[NUMBER_OF_SLICE_TYPES][NUM_MVP_IDX_CTX] = |
---|
[56] | 436 | { |
---|
[1313] | 437 | { 168, }, |
---|
| 438 | { 168, }, |
---|
| 439 | { CNU, }, |
---|
| 440 | }; |
---|
| 441 | |
---|
| 442 | static const UChar |
---|
| 443 | INIT_SAO_MERGE_FLAG[NUMBER_OF_SLICE_TYPES][NUM_SAO_MERGE_FLAG_CTX] = |
---|
| 444 | { |
---|
| 445 | { 153, }, |
---|
| 446 | { 153, }, |
---|
| 447 | { 153, }, |
---|
| 448 | }; |
---|
| 449 | |
---|
| 450 | static const UChar |
---|
| 451 | INIT_SAO_TYPE_IDX[NUMBER_OF_SLICE_TYPES][NUM_SAO_TYPE_IDX_CTX] = |
---|
| 452 | { |
---|
[608] | 453 | { 160, }, |
---|
| 454 | { 185, }, |
---|
| 455 | { 200, }, |
---|
[56] | 456 | }; |
---|
| 457 | |
---|
[443] | 458 | static const UChar |
---|
[1313] | 459 | INIT_TRANS_SUBDIV_FLAG[NUMBER_OF_SLICE_TYPES][NUM_TRANS_SUBDIV_FLAG_CTX] = |
---|
[443] | 460 | { |
---|
[608] | 461 | { 224, 167, 122, }, |
---|
| 462 | { 124, 138, 94, }, |
---|
| 463 | { 153, 138, 138, }, |
---|
[56] | 464 | }; |
---|
| 465 | |
---|
[608] | 466 | static const UChar |
---|
[1313] | 467 | INIT_TRANSFORMSKIP_FLAG[NUMBER_OF_SLICE_TYPES][2*NUM_TRANSFORMSKIP_FLAG_CTX] = |
---|
[56] | 468 | { |
---|
[1313] | 469 | { 139, 139}, |
---|
| 470 | { 139, 139}, |
---|
| 471 | { 139, 139}, |
---|
[56] | 472 | }; |
---|
| 473 | |
---|
[1313] | 474 | static const UChar |
---|
| 475 | INIT_EXPLICIT_RDPCM_FLAG[NUMBER_OF_SLICE_TYPES][2*NUM_EXPLICIT_RDPCM_FLAG_CTX] = |
---|
| 476 | { |
---|
| 477 | {139, 139}, |
---|
| 478 | {139, 139}, |
---|
| 479 | {CNU, CNU} |
---|
| 480 | }; |
---|
| 481 | |
---|
| 482 | static const UChar |
---|
| 483 | INIT_EXPLICIT_RDPCM_DIR[NUMBER_OF_SLICE_TYPES][2*NUM_EXPLICIT_RDPCM_DIR_CTX] = |
---|
| 484 | { |
---|
| 485 | {139, 139}, |
---|
| 486 | {139, 139}, |
---|
| 487 | {CNU, CNU} |
---|
| 488 | }; |
---|
| 489 | |
---|
| 490 | static const UChar |
---|
| 491 | INIT_CROSS_COMPONENT_PREDICTION[NUMBER_OF_SLICE_TYPES][NUM_CROSS_COMPONENT_PREDICTION_CTX] = |
---|
| 492 | { |
---|
| 493 | { 154, 154, 154, 154, 154, 154, 154, 154, 154, 154 }, |
---|
| 494 | { 154, 154, 154, 154, 154, 154, 154, 154, 154, 154 }, |
---|
| 495 | { 154, 154, 154, 154, 154, 154, 154, 154, 154, 154 }, |
---|
| 496 | }; |
---|
| 497 | |
---|
| 498 | //! \} |
---|
| 499 | |
---|
[884] | 500 | |
---|
| 501 | |
---|
[608] | 502 | #endif |
---|