[313] | 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 |
---|
[1029] | 4 | * granted under this license. |
---|
[313] | 5 | * |
---|
[1259] | 6 | * Copyright (c) 2010-2015, ITU/ISO/IEC |
---|
[313] | 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. |
---|
| 17 | * * Neither the name of the ITU/ISO/IEC nor the names of its contributors may |
---|
| 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 | */ |
---|
| 33 | |
---|
| 34 | /** \file TComRom.cpp |
---|
| 35 | \brief global variables & functions |
---|
| 36 | */ |
---|
| 37 | |
---|
| 38 | #include "TComRom.h" |
---|
| 39 | #include <memory.h> |
---|
| 40 | #include <stdlib.h> |
---|
| 41 | #include <stdio.h> |
---|
[1029] | 42 | #include <iomanip> |
---|
| 43 | #include <assert.h> |
---|
| 44 | #include "TComDataCU.h" |
---|
| 45 | #include "Debug.h" |
---|
[313] | 46 | // ==================================================================================================================== |
---|
| 47 | // Initialize / destroy functions |
---|
| 48 | // ==================================================================================================================== |
---|
| 49 | |
---|
| 50 | //! \ingroup TLibCommon |
---|
| 51 | //! \{ |
---|
| 52 | |
---|
[1029] | 53 | class ScanGenerator |
---|
| 54 | { |
---|
| 55 | private: |
---|
| 56 | UInt m_line, m_column; |
---|
| 57 | const UInt m_blockWidth, m_blockHeight; |
---|
| 58 | const UInt m_stride; |
---|
| 59 | const COEFF_SCAN_TYPE m_scanType; |
---|
| 60 | |
---|
| 61 | public: |
---|
| 62 | ScanGenerator(UInt blockWidth, UInt blockHeight, UInt stride, COEFF_SCAN_TYPE scanType) |
---|
| 63 | : m_line(0), m_column(0), m_blockWidth(blockWidth), m_blockHeight(blockHeight), m_stride(stride), m_scanType(scanType) |
---|
| 64 | { } |
---|
| 65 | |
---|
| 66 | UInt GetCurrentX() const { return m_column; } |
---|
| 67 | UInt GetCurrentY() const { return m_line; } |
---|
| 68 | |
---|
| 69 | UInt GetNextIndex(UInt blockOffsetX, UInt blockOffsetY) |
---|
| 70 | { |
---|
| 71 | Int rtn=((m_line + blockOffsetY) * m_stride) + m_column + blockOffsetX; |
---|
| 72 | |
---|
| 73 | //advance line and column to the next position |
---|
| 74 | switch (m_scanType) |
---|
| 75 | { |
---|
| 76 | //------------------------------------------------ |
---|
| 77 | |
---|
| 78 | case SCAN_DIAG: |
---|
| 79 | { |
---|
| 80 | if ((m_column == (m_blockWidth - 1)) || (m_line == 0)) //if we reach the end of a rank, go diagonally down to the next one |
---|
| 81 | { |
---|
| 82 | m_line += m_column + 1; |
---|
| 83 | m_column = 0; |
---|
| 84 | |
---|
| 85 | if (m_line >= m_blockHeight) //if that takes us outside the block, adjust so that we are back on the bottom row |
---|
| 86 | { |
---|
| 87 | m_column += m_line - (m_blockHeight - 1); |
---|
| 88 | m_line = m_blockHeight - 1; |
---|
| 89 | } |
---|
| 90 | } |
---|
| 91 | else |
---|
| 92 | { |
---|
| 93 | m_column++; |
---|
| 94 | m_line--; |
---|
| 95 | } |
---|
| 96 | } |
---|
| 97 | break; |
---|
| 98 | |
---|
| 99 | //------------------------------------------------ |
---|
| 100 | |
---|
| 101 | case SCAN_HOR: |
---|
| 102 | { |
---|
| 103 | if (m_column == (m_blockWidth - 1)) |
---|
| 104 | { |
---|
| 105 | m_line++; |
---|
| 106 | m_column = 0; |
---|
| 107 | } |
---|
[1246] | 108 | else |
---|
| 109 | { |
---|
| 110 | m_column++; |
---|
| 111 | } |
---|
[1029] | 112 | } |
---|
| 113 | break; |
---|
| 114 | |
---|
| 115 | //------------------------------------------------ |
---|
| 116 | |
---|
| 117 | case SCAN_VER: |
---|
| 118 | { |
---|
| 119 | if (m_line == (m_blockHeight - 1)) |
---|
| 120 | { |
---|
| 121 | m_column++; |
---|
| 122 | m_line = 0; |
---|
| 123 | } |
---|
[1246] | 124 | else |
---|
| 125 | { |
---|
| 126 | m_line++; |
---|
| 127 | } |
---|
[1029] | 128 | } |
---|
| 129 | break; |
---|
| 130 | |
---|
| 131 | //------------------------------------------------ |
---|
| 132 | |
---|
| 133 | default: |
---|
| 134 | { |
---|
| 135 | std::cerr << "ERROR: Unknown scan type \"" << m_scanType << "\"in ScanGenerator::GetNextIndex" << std::endl; |
---|
| 136 | exit(1); |
---|
| 137 | } |
---|
| 138 | break; |
---|
| 139 | } |
---|
| 140 | |
---|
| 141 | return rtn; |
---|
| 142 | } |
---|
| 143 | }; |
---|
| 144 | |
---|
[313] | 145 | // initialize ROM variables |
---|
| 146 | Void initROM() |
---|
| 147 | { |
---|
| 148 | Int i, c; |
---|
[1029] | 149 | |
---|
[313] | 150 | // g_aucConvertToBit[ x ]: log2(x/4), if x=4 -> 0, x=8 -> 1, x=16 -> 2, ... |
---|
| 151 | ::memset( g_aucConvertToBit, -1, sizeof( g_aucConvertToBit ) ); |
---|
| 152 | c=0; |
---|
[442] | 153 | for ( i=4; i<=MAX_CU_SIZE; i*=2 ) |
---|
[313] | 154 | { |
---|
| 155 | g_aucConvertToBit[ i ] = c; |
---|
| 156 | c++; |
---|
| 157 | } |
---|
[1029] | 158 | |
---|
| 159 | // initialise scan orders |
---|
| 160 | for(UInt log2BlockHeight = 0; log2BlockHeight < MAX_CU_DEPTH; log2BlockHeight++) |
---|
[313] | 161 | { |
---|
[1029] | 162 | for(UInt log2BlockWidth = 0; log2BlockWidth < MAX_CU_DEPTH; log2BlockWidth++) |
---|
| 163 | { |
---|
| 164 | const UInt blockWidth = 1 << log2BlockWidth; |
---|
| 165 | const UInt blockHeight = 1 << log2BlockHeight; |
---|
| 166 | const UInt totalValues = blockWidth * blockHeight; |
---|
[313] | 167 | |
---|
[1029] | 168 | //-------------------------------------------------------------------------------------------------- |
---|
| 169 | |
---|
| 170 | //non-grouped scan orders |
---|
| 171 | |
---|
| 172 | for (UInt scanTypeIndex = 0; scanTypeIndex < SCAN_NUMBER_OF_TYPES; scanTypeIndex++) |
---|
| 173 | { |
---|
| 174 | const COEFF_SCAN_TYPE scanType = COEFF_SCAN_TYPE(scanTypeIndex); |
---|
| 175 | |
---|
| 176 | g_scanOrder[SCAN_UNGROUPED][scanType][log2BlockWidth][log2BlockHeight] = new UInt[totalValues]; |
---|
| 177 | |
---|
| 178 | ScanGenerator fullBlockScan(blockWidth, blockHeight, blockWidth, scanType); |
---|
| 179 | |
---|
| 180 | for (UInt scanPosition = 0; scanPosition < totalValues; scanPosition++) |
---|
| 181 | { |
---|
| 182 | g_scanOrder[SCAN_UNGROUPED][scanType][log2BlockWidth][log2BlockHeight][scanPosition] = fullBlockScan.GetNextIndex(0, 0); |
---|
| 183 | } |
---|
| 184 | } |
---|
| 185 | |
---|
| 186 | //-------------------------------------------------------------------------------------------------- |
---|
| 187 | |
---|
| 188 | //grouped scan orders |
---|
| 189 | |
---|
| 190 | const UInt groupWidth = 1 << MLS_CG_LOG2_WIDTH; |
---|
| 191 | const UInt groupHeight = 1 << MLS_CG_LOG2_HEIGHT; |
---|
| 192 | const UInt widthInGroups = blockWidth >> MLS_CG_LOG2_WIDTH; |
---|
| 193 | const UInt heightInGroups = blockHeight >> MLS_CG_LOG2_HEIGHT; |
---|
| 194 | |
---|
| 195 | const UInt groupSize = groupWidth * groupHeight; |
---|
| 196 | const UInt totalGroups = widthInGroups * heightInGroups; |
---|
| 197 | |
---|
| 198 | for (UInt scanTypeIndex = 0; scanTypeIndex < SCAN_NUMBER_OF_TYPES; scanTypeIndex++) |
---|
| 199 | { |
---|
| 200 | const COEFF_SCAN_TYPE scanType = COEFF_SCAN_TYPE(scanTypeIndex); |
---|
| 201 | |
---|
| 202 | g_scanOrder[SCAN_GROUPED_4x4][scanType][log2BlockWidth][log2BlockHeight] = new UInt[totalValues]; |
---|
| 203 | |
---|
| 204 | ScanGenerator fullBlockScan(widthInGroups, heightInGroups, groupWidth, scanType); |
---|
| 205 | |
---|
| 206 | for (UInt groupIndex = 0; groupIndex < totalGroups; groupIndex++) |
---|
| 207 | { |
---|
| 208 | const UInt groupPositionY = fullBlockScan.GetCurrentY(); |
---|
| 209 | const UInt groupPositionX = fullBlockScan.GetCurrentX(); |
---|
| 210 | const UInt groupOffsetX = groupPositionX * groupWidth; |
---|
| 211 | const UInt groupOffsetY = groupPositionY * groupHeight; |
---|
| 212 | const UInt groupOffsetScan = groupIndex * groupSize; |
---|
| 213 | |
---|
| 214 | ScanGenerator groupScan(groupWidth, groupHeight, blockWidth, scanType); |
---|
| 215 | |
---|
| 216 | for (UInt scanPosition = 0; scanPosition < groupSize; scanPosition++) |
---|
| 217 | { |
---|
| 218 | g_scanOrder[SCAN_GROUPED_4x4][scanType][log2BlockWidth][log2BlockHeight][groupOffsetScan + scanPosition] = groupScan.GetNextIndex(groupOffsetX, groupOffsetY); |
---|
| 219 | } |
---|
| 220 | |
---|
| 221 | fullBlockScan.GetNextIndex(0,0); |
---|
| 222 | } |
---|
| 223 | } |
---|
| 224 | |
---|
| 225 | //-------------------------------------------------------------------------------------------------- |
---|
| 226 | } |
---|
| 227 | } |
---|
[313] | 228 | } |
---|
| 229 | |
---|
| 230 | Void destroyROM() |
---|
| 231 | { |
---|
[1029] | 232 | for(UInt groupTypeIndex = 0; groupTypeIndex < SCAN_NUMBER_OF_GROUP_TYPES; groupTypeIndex++) |
---|
[313] | 233 | { |
---|
[1029] | 234 | for (UInt scanOrderIndex = 0; scanOrderIndex < SCAN_NUMBER_OF_TYPES; scanOrderIndex++) |
---|
| 235 | { |
---|
| 236 | for (UInt log2BlockWidth = 0; log2BlockWidth < MAX_CU_DEPTH; log2BlockWidth++) |
---|
| 237 | { |
---|
| 238 | for (UInt log2BlockHeight = 0; log2BlockHeight < MAX_CU_DEPTH; log2BlockHeight++) |
---|
| 239 | { |
---|
| 240 | delete [] g_scanOrder[groupTypeIndex][scanOrderIndex][log2BlockWidth][log2BlockHeight]; |
---|
| 241 | } |
---|
| 242 | } |
---|
| 243 | } |
---|
[313] | 244 | } |
---|
| 245 | } |
---|
| 246 | |
---|
| 247 | // ==================================================================================================================== |
---|
| 248 | // Data structure related table & variable |
---|
| 249 | // ==================================================================================================================== |
---|
[595] | 250 | |
---|
[313] | 251 | UInt g_uiMaxCUWidth = MAX_CU_SIZE; |
---|
| 252 | UInt g_uiMaxCUHeight = MAX_CU_SIZE; |
---|
| 253 | UInt g_uiMaxCUDepth = MAX_CU_DEPTH; |
---|
| 254 | UInt g_uiAddCUDepth = 0; |
---|
| 255 | UInt g_auiZscanToRaster [ MAX_NUM_SPU_W*MAX_NUM_SPU_W ] = { 0, }; |
---|
| 256 | UInt g_auiRasterToZscan [ MAX_NUM_SPU_W*MAX_NUM_SPU_W ] = { 0, }; |
---|
| 257 | UInt g_auiRasterToPelX [ MAX_NUM_SPU_W*MAX_NUM_SPU_W ] = { 0, }; |
---|
| 258 | UInt g_auiRasterToPelY [ MAX_NUM_SPU_W*MAX_NUM_SPU_W ] = { 0, }; |
---|
| 259 | |
---|
[1029] | 260 | UInt g_auiPUOffset[NUMBER_OF_PART_SIZES] = { 0, 8, 4, 4, 2, 10, 1, 5}; |
---|
[313] | 261 | |
---|
| 262 | Void initZscanToRaster ( Int iMaxDepth, Int iDepth, UInt uiStartVal, UInt*& rpuiCurrIdx ) |
---|
| 263 | { |
---|
| 264 | Int iStride = 1 << ( iMaxDepth - 1 ); |
---|
[1029] | 265 | |
---|
[313] | 266 | if ( iDepth == iMaxDepth ) |
---|
| 267 | { |
---|
| 268 | rpuiCurrIdx[0] = uiStartVal; |
---|
| 269 | rpuiCurrIdx++; |
---|
| 270 | } |
---|
| 271 | else |
---|
| 272 | { |
---|
| 273 | Int iStep = iStride >> iDepth; |
---|
| 274 | initZscanToRaster( iMaxDepth, iDepth+1, uiStartVal, rpuiCurrIdx ); |
---|
| 275 | initZscanToRaster( iMaxDepth, iDepth+1, uiStartVal+iStep, rpuiCurrIdx ); |
---|
| 276 | initZscanToRaster( iMaxDepth, iDepth+1, uiStartVal+iStep*iStride, rpuiCurrIdx ); |
---|
| 277 | initZscanToRaster( iMaxDepth, iDepth+1, uiStartVal+iStep*iStride+iStep, rpuiCurrIdx ); |
---|
| 278 | } |
---|
| 279 | } |
---|
| 280 | |
---|
| 281 | Void initRasterToZscan ( UInt uiMaxCUWidth, UInt uiMaxCUHeight, UInt uiMaxDepth ) |
---|
| 282 | { |
---|
| 283 | UInt uiMinCUWidth = uiMaxCUWidth >> ( uiMaxDepth - 1 ); |
---|
| 284 | UInt uiMinCUHeight = uiMaxCUHeight >> ( uiMaxDepth - 1 ); |
---|
[1029] | 285 | |
---|
[313] | 286 | UInt uiNumPartInWidth = (UInt)uiMaxCUWidth / uiMinCUWidth; |
---|
| 287 | UInt uiNumPartInHeight = (UInt)uiMaxCUHeight / uiMinCUHeight; |
---|
[1029] | 288 | |
---|
[313] | 289 | for ( UInt i = 0; i < uiNumPartInWidth*uiNumPartInHeight; i++ ) |
---|
| 290 | { |
---|
| 291 | g_auiRasterToZscan[ g_auiZscanToRaster[i] ] = i; |
---|
| 292 | } |
---|
| 293 | } |
---|
| 294 | |
---|
| 295 | Void initRasterToPelXY ( UInt uiMaxCUWidth, UInt uiMaxCUHeight, UInt uiMaxDepth ) |
---|
| 296 | { |
---|
| 297 | UInt i; |
---|
[1029] | 298 | |
---|
[313] | 299 | UInt* uiTempX = &g_auiRasterToPelX[0]; |
---|
| 300 | UInt* uiTempY = &g_auiRasterToPelY[0]; |
---|
[1029] | 301 | |
---|
[313] | 302 | UInt uiMinCUWidth = uiMaxCUWidth >> ( uiMaxDepth - 1 ); |
---|
| 303 | UInt uiMinCUHeight = uiMaxCUHeight >> ( uiMaxDepth - 1 ); |
---|
[1029] | 304 | |
---|
[313] | 305 | UInt uiNumPartInWidth = uiMaxCUWidth / uiMinCUWidth; |
---|
| 306 | UInt uiNumPartInHeight = uiMaxCUHeight / uiMinCUHeight; |
---|
[1029] | 307 | |
---|
[313] | 308 | uiTempX[0] = 0; uiTempX++; |
---|
| 309 | for ( i = 1; i < uiNumPartInWidth; i++ ) |
---|
| 310 | { |
---|
| 311 | uiTempX[0] = uiTempX[-1] + uiMinCUWidth; uiTempX++; |
---|
| 312 | } |
---|
| 313 | for ( i = 1; i < uiNumPartInHeight; i++ ) |
---|
| 314 | { |
---|
| 315 | memcpy(uiTempX, uiTempX-uiNumPartInWidth, sizeof(UInt)*uiNumPartInWidth); |
---|
| 316 | uiTempX += uiNumPartInWidth; |
---|
| 317 | } |
---|
[1029] | 318 | |
---|
[313] | 319 | for ( i = 1; i < uiNumPartInWidth*uiNumPartInHeight; i++ ) |
---|
| 320 | { |
---|
| 321 | uiTempY[i] = ( i / uiNumPartInWidth ) * uiMinCUWidth; |
---|
| 322 | } |
---|
[1029] | 323 | } |
---|
[313] | 324 | |
---|
[1029] | 325 | Int g_maxTrDynamicRange[MAX_NUM_CHANNEL_TYPE]; |
---|
[313] | 326 | |
---|
[1029] | 327 | Int g_quantScales[SCALING_LIST_REM_NUM] = |
---|
[313] | 328 | { |
---|
| 329 | 26214,23302,20560,18396,16384,14564 |
---|
[1029] | 330 | }; |
---|
[313] | 331 | |
---|
[1029] | 332 | Int g_invQuantScales[SCALING_LIST_REM_NUM] = |
---|
[313] | 333 | { |
---|
| 334 | 40,45,51,57,64,72 |
---|
| 335 | }; |
---|
| 336 | |
---|
[1029] | 337 | //-------------------------------------------------------------------------------------------------- |
---|
| 338 | |
---|
| 339 | //structures |
---|
| 340 | |
---|
| 341 | #define DEFINE_DST4x4_MATRIX(a,b,c,d) \ |
---|
| 342 | { \ |
---|
| 343 | { a, b, c, d }, \ |
---|
| 344 | { c, c, 0, -c }, \ |
---|
| 345 | { d, -a, -c, b }, \ |
---|
| 346 | { b, -d, c, -a }, \ |
---|
| 347 | } |
---|
| 348 | |
---|
| 349 | #define DEFINE_DCT4x4_MATRIX(a,b,c) \ |
---|
| 350 | { \ |
---|
| 351 | { a, a, a, a}, \ |
---|
| 352 | { b, c, -c, -b}, \ |
---|
| 353 | { a, -a, -a, a}, \ |
---|
| 354 | { c, -b, b, -c} \ |
---|
| 355 | } |
---|
| 356 | |
---|
| 357 | #define DEFINE_DCT8x8_MATRIX(a,b,c,d,e,f,g) \ |
---|
| 358 | { \ |
---|
| 359 | { a, a, a, a, a, a, a, a}, \ |
---|
| 360 | { d, e, f, g, -g, -f, -e, -d}, \ |
---|
| 361 | { b, c, -c, -b, -b, -c, c, b}, \ |
---|
| 362 | { e, -g, -d, -f, f, d, g, -e}, \ |
---|
| 363 | { a, -a, -a, a, a, -a, -a, a}, \ |
---|
| 364 | { f, -d, g, e, -e, -g, d, -f}, \ |
---|
| 365 | { c, -b, b, -c, -c, b, -b, c}, \ |
---|
| 366 | { g, -f, e, -d, d, -e, f, -g} \ |
---|
| 367 | } |
---|
| 368 | |
---|
| 369 | #define DEFINE_DCT16x16_MATRIX(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o) \ |
---|
| 370 | { \ |
---|
| 371 | { a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a}, \ |
---|
| 372 | { h, i, j, k, l, m, n, o, -o, -n, -m, -l, -k, -j, -i, -h}, \ |
---|
| 373 | { d, e, f, g, -g, -f, -e, -d, -d, -e, -f, -g, g, f, e, d}, \ |
---|
| 374 | { i, l, o, -m, -j, -h, -k, -n, n, k, h, j, m, -o, -l, -i}, \ |
---|
| 375 | { b, c, -c, -b, -b, -c, c, b, b, c, -c, -b, -b, -c, c, b}, \ |
---|
| 376 | { j, o, -k, -i, -n, l, h, m, -m, -h, -l, n, i, k, -o, -j}, \ |
---|
| 377 | { e, -g, -d, -f, f, d, g, -e, -e, g, d, f, -f, -d, -g, e}, \ |
---|
| 378 | { k, -m, -i, o, h, n, -j, -l, l, j, -n, -h, -o, i, m, -k}, \ |
---|
| 379 | { a, -a, -a, a, a, -a, -a, a, a, -a, -a, a, a, -a, -a, a}, \ |
---|
| 380 | { l, -j, -n, h, -o, -i, m, k, -k, -m, i, o, -h, n, j, -l}, \ |
---|
| 381 | { f, -d, g, e, -e, -g, d, -f, -f, d, -g, -e, e, g, -d, f}, \ |
---|
| 382 | { m, -h, l, n, -i, k, o, -j, j, -o, -k, i, -n, -l, h, -m}, \ |
---|
| 383 | { c, -b, b, -c, -c, b, -b, c, c, -b, b, -c, -c, b, -b, c}, \ |
---|
| 384 | { n, -k, h, -j, m, o, -l, i, -i, l, -o, -m, j, -h, k, -n}, \ |
---|
| 385 | { g, -f, e, -d, d, -e, f, -g, -g, f, -e, d, -d, e, -f, g}, \ |
---|
| 386 | { o, -n, m, -l, k, -j, i, -h, h, -i, j, -k, l, -m, n, -o} \ |
---|
| 387 | } |
---|
| 388 | |
---|
| 389 | #define DEFINE_DCT32x32_MATRIX(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E) \ |
---|
| 390 | { \ |
---|
| 391 | { a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a}, \ |
---|
| 392 | { p, q, r, s, t, u, v, w, x, y, z, A, B, C, D, E, -E, -D, -C, -B, -A, -z, -y, -x, -w, -v, -u, -t, -s, -r, -q, -p}, \ |
---|
| 393 | { h, i, j, k, l, m, n, o, -o, -n, -m, -l, -k, -j, -i, -h, -h, -i, -j, -k, -l, -m, -n, -o, o, n, m, l, k, j, i, h}, \ |
---|
| 394 | { q, t, w, z, C, -E, -B, -y, -v, -s, -p, -r, -u, -x, -A, -D, D, A, x, u, r, p, s, v, y, B, E, -C, -z, -w, -t, -q}, \ |
---|
| 395 | { d, e, f, g, -g, -f, -e, -d, -d, -e, -f, -g, g, f, e, d, d, e, f, g, -g, -f, -e, -d, -d, -e, -f, -g, g, f, e, d}, \ |
---|
| 396 | { r, w, B, -D, -y, -t, -p, -u, -z, -E, A, v, q, s, x, C, -C, -x, -s, -q, -v, -A, E, z, u, p, t, y, D, -B, -w, -r}, \ |
---|
| 397 | { i, l, o, -m, -j, -h, -k, -n, n, k, h, j, m, -o, -l, -i, -i, -l, -o, m, j, h, k, n, -n, -k, -h, -j, -m, o, l, i}, \ |
---|
| 398 | { s, z, -D, -w, -p, -v, -C, A, t, r, y, -E, -x, -q, -u, -B, B, u, q, x, E, -y, -r, -t, -A, C, v, p, w, D, -z, -s}, \ |
---|
| 399 | { b, c, -c, -b, -b, -c, c, b, b, c, -c, -b, -b, -c, c, b, b, c, -c, -b, -b, -c, c, b, b, c, -c, -b, -b, -c, c, b}, \ |
---|
| 400 | { t, C, -y, -p, -x, D, u, s, B, -z, -q, -w, E, v, r, A, -A, -r, -v, -E, w, q, z, -B, -s, -u, -D, x, p, y, -C, -t}, \ |
---|
| 401 | { j, o, -k, -i, -n, l, h, m, -m, -h, -l, n, i, k, -o, -j, -j, -o, k, i, n, -l, -h, -m, m, h, l, -n, -i, -k, o, j}, \ |
---|
| 402 | { u, -E, -t, -v, D, s, w, -C, -r, -x, B, q, y, -A, -p, -z, z, p, A, -y, -q, -B, x, r, C, -w, -s, -D, v, t, E, -u}, \ |
---|
| 403 | { e, -g, -d, -f, f, d, g, -e, -e, g, d, f, -f, -d, -g, e, e, -g, -d, -f, f, d, g, -e, -e, g, d, f, -f, -d, -g, e}, \ |
---|
| 404 | { v, -B, -p, -C, u, w, -A, -q, -D, t, x, -z, -r, -E, s, y, -y, -s, E, r, z, -x, -t, D, q, A, -w, -u, C, p, B, -v}, \ |
---|
| 405 | { k, -m, -i, o, h, n, -j, -l, l, j, -n, -h, -o, i, m, -k, -k, m, i, -o, -h, -n, j, l, -l, -j, n, h, o, -i, -m, k}, \ |
---|
| 406 | { w, -y, -u, A, s, -C, -q, E, p, D, -r, -B, t, z, -v, -x, x, v, -z, -t, B, r, -D, -p, -E, q, C, -s, -A, u, y, -w}, \ |
---|
| 407 | { a, -a, -a, a, a, -a, -a, a, a, -a, -a, a, a, -a, -a, a, a, -a, -a, a, a, -a, -a, a, a, -a, -a, a, a, -a, -a, a}, \ |
---|
| 408 | { x, -v, -z, t, B, -r, -D, p, -E, -q, C, s, -A, -u, y, w, -w, -y, u, A, -s, -C, q, E, -p, D, r, -B, -t, z, v, -x}, \ |
---|
| 409 | { l, -j, -n, h, -o, -i, m, k, -k, -m, i, o, -h, n, j, -l, -l, j, n, -h, o, i, -m, -k, k, m, -i, -o, h, -n, -j, l}, \ |
---|
| 410 | { y, -s, -E, r, -z, -x, t, D, -q, A, w, -u, -C, p, -B, -v, v, B, -p, C, u, -w, -A, q, -D, -t, x, z, -r, E, s, -y}, \ |
---|
| 411 | { f, -d, g, e, -e, -g, d, -f, -f, d, -g, -e, e, g, -d, f, f, -d, g, e, -e, -g, d, -f, -f, d, -g, -e, e, g, -d, f}, \ |
---|
| 412 | { z, -p, A, y, -q, B, x, -r, C, w, -s, D, v, -t, E, u, -u, -E, t, -v, -D, s, -w, -C, r, -x, -B, q, -y, -A, p, -z}, \ |
---|
| 413 | { m, -h, l, n, -i, k, o, -j, j, -o, -k, i, -n, -l, h, -m, -m, h, -l, -n, i, -k, -o, j, -j, o, k, -i, n, l, -h, m}, \ |
---|
| 414 | { A, -r, v, -E, -w, q, -z, -B, s, -u, D, x, -p, y, C, -t, t, -C, -y, p, -x, -D, u, -s, B, z, -q, w, E, -v, r, -A}, \ |
---|
| 415 | { c, -b, b, -c, -c, b, -b, c, c, -b, b, -c, -c, b, -b, c, c, -b, b, -c, -c, b, -b, c, c, -b, b, -c, -c, b, -b, c}, \ |
---|
| 416 | { B, -u, q, -x, E, y, -r, t, -A, -C, v, -p, w, -D, -z, s, -s, z, D, -w, p, -v, C, A, -t, r, -y, -E, x, -q, u, -B}, \ |
---|
| 417 | { n, -k, h, -j, m, o, -l, i, -i, l, -o, -m, j, -h, k, -n, -n, k, -h, j, -m, -o, l, -i, i, -l, o, m, -j, h, -k, n}, \ |
---|
| 418 | { C, -x, s, -q, v, -A, -E, z, -u, p, -t, y, -D, -B, w, -r, r, -w, B, D, -y, t, -p, u, -z, E, A, -v, q, -s, x, -C}, \ |
---|
| 419 | { g, -f, e, -d, d, -e, f, -g, -g, f, -e, d, -d, e, -f, g, g, -f, e, -d, d, -e, f, -g, -g, f, -e, d, -d, e, -f, g}, \ |
---|
| 420 | { D, -A, x, -u, r, -p, s, -v, y, -B, E, C, -z, w, -t, q, -q, t, -w, z, -C, -E, B, -y, v, -s, p, -r, u, -x, A, -D}, \ |
---|
| 421 | { o, -n, m, -l, k, -j, i, -h, h, -i, j, -k, l, -m, n, -o, -o, n, -m, l, -k, j, -i, h, -h, i, -j, k, -l, m, -n, o}, \ |
---|
| 422 | { E, -D, C, -B, A, -z, y, -x, w, -v, u, -t, s, -r, q, -p, p, -q, r, -s, t, -u, v, -w, x, -y, z, -A, B, -C, D, -E} \ |
---|
| 423 | } |
---|
| 424 | |
---|
| 425 | //-------------------------------------------------------------------------------------------------- |
---|
| 426 | |
---|
| 427 | //coefficients |
---|
| 428 | |
---|
| 429 | #if RExt__HIGH_PRECISION_FORWARD_TRANSFORM |
---|
| 430 | const TMatrixCoeff g_aiT4 [TRANSFORM_NUMBER_OF_DIRECTIONS][4][4] = |
---|
[313] | 431 | { |
---|
[1029] | 432 | DEFINE_DCT4x4_MATRIX (16384, 21266, 9224), |
---|
| 433 | DEFINE_DCT4x4_MATRIX ( 64, 83, 36) |
---|
[313] | 434 | }; |
---|
| 435 | |
---|
[1029] | 436 | const TMatrixCoeff g_aiT8 [TRANSFORM_NUMBER_OF_DIRECTIONS][8][8] = |
---|
[313] | 437 | { |
---|
[1029] | 438 | DEFINE_DCT8x8_MATRIX (16384, 21266, 9224, 22813, 19244, 12769, 4563), |
---|
| 439 | DEFINE_DCT8x8_MATRIX ( 64, 83, 36, 89, 75, 50, 18) |
---|
[313] | 440 | }; |
---|
| 441 | |
---|
[1029] | 442 | const TMatrixCoeff g_aiT16[TRANSFORM_NUMBER_OF_DIRECTIONS][16][16] = |
---|
[313] | 443 | { |
---|
[1029] | 444 | DEFINE_DCT16x16_MATRIX(16384, 21266, 9224, 22813, 19244, 12769, 4563, 23120, 22063, 20450, 17972, 14642, 11109, 6446, 2316), |
---|
| 445 | DEFINE_DCT16x16_MATRIX( 64, 83, 36, 89, 75, 50, 18, 90, 87, 80, 70, 57, 43, 25, 9) |
---|
[313] | 446 | }; |
---|
| 447 | |
---|
[1029] | 448 | const TMatrixCoeff g_aiT32[TRANSFORM_NUMBER_OF_DIRECTIONS][32][32] = |
---|
[313] | 449 | { |
---|
[1029] | 450 | DEFINE_DCT32x32_MATRIX(16384, 21266, 9224, 22813, 19244, 12769, 4563, 23120, 22063, 20450, 17972, 14642, 11109, 6446, 2316, 23106, 22852, 22445, 21848, 20995, 19810, 18601, 17143, 15718, 13853, 11749, 9846, 7908, 5573, 3281, 946), |
---|
| 451 | DEFINE_DCT32x32_MATRIX( 64, 83, 36, 89, 75, 50, 18, 90, 87, 80, 70, 57, 43, 25, 9, 90, 90, 88, 85, 82, 78, 73, 67, 61, 54, 46, 38, 31, 22, 13, 4) |
---|
[313] | 452 | }; |
---|
| 453 | |
---|
[1029] | 454 | const TMatrixCoeff g_as_DST_MAT_4[TRANSFORM_NUMBER_OF_DIRECTIONS][4][4] = |
---|
[313] | 455 | { |
---|
[1029] | 456 | DEFINE_DST4x4_MATRIX( 7424, 14081, 18893, 21505), |
---|
| 457 | DEFINE_DST4x4_MATRIX( 29, 55, 74, 84) |
---|
[313] | 458 | }; |
---|
| 459 | |
---|
[1029] | 460 | #else |
---|
[313] | 461 | |
---|
[1029] | 462 | const TMatrixCoeff g_aiT4 [TRANSFORM_NUMBER_OF_DIRECTIONS][4][4] = |
---|
[313] | 463 | { |
---|
[1029] | 464 | DEFINE_DCT4x4_MATRIX ( 64, 83, 36), |
---|
| 465 | DEFINE_DCT4x4_MATRIX ( 64, 83, 36) |
---|
[313] | 466 | }; |
---|
| 467 | |
---|
[1029] | 468 | const TMatrixCoeff g_aiT8 [TRANSFORM_NUMBER_OF_DIRECTIONS][8][8] = |
---|
| 469 | { |
---|
| 470 | DEFINE_DCT8x8_MATRIX ( 64, 83, 36, 89, 75, 50, 18), |
---|
| 471 | DEFINE_DCT8x8_MATRIX ( 64, 83, 36, 89, 75, 50, 18) |
---|
| 472 | }; |
---|
[313] | 473 | |
---|
[1029] | 474 | const TMatrixCoeff g_aiT16[TRANSFORM_NUMBER_OF_DIRECTIONS][16][16] = |
---|
| 475 | { |
---|
| 476 | DEFINE_DCT16x16_MATRIX( 64, 83, 36, 89, 75, 50, 18, 90, 87, 80, 70, 57, 43, 25, 9), |
---|
| 477 | DEFINE_DCT16x16_MATRIX( 64, 83, 36, 89, 75, 50, 18, 90, 87, 80, 70, 57, 43, 25, 9) |
---|
| 478 | }; |
---|
| 479 | |
---|
| 480 | const TMatrixCoeff g_aiT32[TRANSFORM_NUMBER_OF_DIRECTIONS][32][32] = |
---|
| 481 | { |
---|
| 482 | DEFINE_DCT32x32_MATRIX( 64, 83, 36, 89, 75, 50, 18, 90, 87, 80, 70, 57, 43, 25, 9, 90, 90, 88, 85, 82, 78, 73, 67, 61, 54, 46, 38, 31, 22, 13, 4), |
---|
| 483 | DEFINE_DCT32x32_MATRIX( 64, 83, 36, 89, 75, 50, 18, 90, 87, 80, 70, 57, 43, 25, 9, 90, 90, 88, 85, 82, 78, 73, 67, 61, 54, 46, 38, 31, 22, 13, 4) |
---|
| 484 | }; |
---|
| 485 | |
---|
| 486 | const TMatrixCoeff g_as_DST_MAT_4[TRANSFORM_NUMBER_OF_DIRECTIONS][4][4] = |
---|
| 487 | { |
---|
| 488 | DEFINE_DST4x4_MATRIX( 29, 55, 74, 84), |
---|
| 489 | DEFINE_DST4x4_MATRIX( 29, 55, 74, 84) |
---|
| 490 | }; |
---|
| 491 | #endif |
---|
| 492 | |
---|
| 493 | |
---|
| 494 | //-------------------------------------------------------------------------------------------------- |
---|
| 495 | |
---|
| 496 | #undef DEFINE_DST4x4_MATRIX |
---|
| 497 | #undef DEFINE_DCT4x4_MATRIX |
---|
| 498 | #undef DEFINE_DCT8x8_MATRIX |
---|
| 499 | #undef DEFINE_DCT16x16_MATRIX |
---|
| 500 | #undef DEFINE_DCT32x32_MATRIX |
---|
| 501 | |
---|
| 502 | //-------------------------------------------------------------------------------------------------- |
---|
| 503 | |
---|
| 504 | |
---|
| 505 | const UChar g_aucChromaScale[NUM_CHROMA_FORMAT][chromaQPMappingTableSize]= |
---|
| 506 | { |
---|
| 507 | //0, 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 |
---|
| 508 | { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, |
---|
| 509 | { 0, 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,29,30,31,32,33,33,34,34,35,35,36,36,37,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51 }, |
---|
| 510 | { 0, 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,51,51,51,51,51,51 }, |
---|
| 511 | { 0, 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,51,51,51,51,51,51 } |
---|
| 512 | }; |
---|
| 513 | |
---|
[313] | 514 | // ==================================================================================================================== |
---|
| 515 | // ADI |
---|
| 516 | // ==================================================================================================================== |
---|
| 517 | |
---|
| 518 | #if FAST_UDI_USE_MPM |
---|
[442] | 519 | const UChar g_aucIntraModeNumFast[MAX_CU_DEPTH] = |
---|
[313] | 520 | { |
---|
| 521 | 3, // 2x2 |
---|
| 522 | 8, // 4x4 |
---|
| 523 | 8, // 8x8 |
---|
[1029] | 524 | 3, // 16x16 |
---|
| 525 | 3, // 32x32 |
---|
| 526 | 3 // 64x64 |
---|
[313] | 527 | }; |
---|
| 528 | #else // FAST_UDI_USE_MPM |
---|
[442] | 529 | const UChar g_aucIntraModeNumFast[MAX_CU_DEPTH] = |
---|
[313] | 530 | { |
---|
| 531 | 3, // 2x2 |
---|
| 532 | 9, // 4x4 |
---|
| 533 | 9, // 8x8 |
---|
| 534 | 4, // 16x16 33 |
---|
| 535 | 4, // 32x32 33 |
---|
[442] | 536 | 5 // 64x64 33 |
---|
[313] | 537 | }; |
---|
| 538 | #endif // FAST_UDI_USE_MPM |
---|
| 539 | |
---|
[1029] | 540 | const UChar g_chroma422IntraAngleMappingTable[NUM_INTRA_MODE] = |
---|
| 541 | //0, 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, DM |
---|
| 542 | { 0, 1, 2, 2, 2, 2, 3, 5, 7, 8, 10, 12, 13, 15, 17, 18, 19, 20, 21, 22, 23, 23, 24, 24, 25, 25, 26, 27, 27, 28, 28, 29, 29, 30, 31, DM_CHROMA_IDX}; |
---|
[313] | 543 | |
---|
| 544 | // ==================================================================================================================== |
---|
| 545 | // Bit-depth |
---|
| 546 | // ==================================================================================================================== |
---|
| 547 | |
---|
[1029] | 548 | Int g_bitDepth [MAX_NUM_CHANNEL_TYPE] = {8, 8}; |
---|
| 549 | #if O0043_BEST_EFFORT_DECODING |
---|
| 550 | Int g_bitDepthInStream [MAX_NUM_CHANNEL_TYPE] = {8, 8}; // In the encoder, this is the same as g_bitDepth. In the decoder, this can vary from g_bitDepth if the decoder is forced to use 'best-effort decoding' at a particular bit-depth. |
---|
| 551 | #endif |
---|
| 552 | Int g_PCMBitDepth[MAX_NUM_CHANNEL_TYPE] = {8, 8}; // PCM bit-depth |
---|
[313] | 553 | |
---|
| 554 | // ==================================================================================================================== |
---|
| 555 | // Misc. |
---|
| 556 | // ==================================================================================================================== |
---|
| 557 | |
---|
| 558 | Char g_aucConvertToBit [ MAX_CU_SIZE+1 ]; |
---|
| 559 | |
---|
| 560 | #if ENC_DEC_TRACE |
---|
[1029] | 561 | FILE* g_hTrace = NULL; // Set to NULL to open up a file. Set to stdout to use the current output |
---|
[313] | 562 | const Bool g_bEncDecTraceEnable = true; |
---|
| 563 | const Bool g_bEncDecTraceDisable = false; |
---|
| 564 | Bool g_HLSTraceEnable = true; |
---|
| 565 | Bool g_bJustDoIt = false; |
---|
| 566 | UInt64 g_nSymbolCounter = 0; |
---|
| 567 | #endif |
---|
| 568 | // ==================================================================================================================== |
---|
| 569 | // Scanning order & context model mapping |
---|
| 570 | // ==================================================================================================================== |
---|
| 571 | |
---|
| 572 | // scanning order table |
---|
[1029] | 573 | UInt* g_scanOrder[SCAN_NUMBER_OF_GROUP_TYPES][SCAN_NUMBER_OF_TYPES][ MAX_CU_DEPTH ][ MAX_CU_DEPTH ]; |
---|
[313] | 574 | |
---|
[1029] | 575 | const UInt ctxIndMap4x4[4*4] = |
---|
[313] | 576 | { |
---|
[1029] | 577 | 0, 1, 4, 5, |
---|
| 578 | 2, 3, 4, 5, |
---|
| 579 | 6, 6, 8, 8, |
---|
| 580 | 7, 7, 8, 8 |
---|
[313] | 581 | }; |
---|
| 582 | |
---|
[1029] | 583 | const UInt g_uiMinInGroup[ LAST_SIGNIFICANT_GROUPS ] = {0,1,2,3,4,6,8,12,16,24}; |
---|
| 584 | const UInt g_uiGroupIdx[ MAX_TU_SIZE ] = {0,1,2,3,4,4,5,5,6,6,6,6,7,7,7,7,8,8,8,8,8,8,8,8,9,9,9,9,9,9,9,9}; |
---|
[313] | 585 | |
---|
[1029] | 586 | const Char *MatrixType[SCALING_LIST_SIZE_NUM][SCALING_LIST_NUM] = |
---|
[313] | 587 | { |
---|
| 588 | { |
---|
[1029] | 589 | "INTRA4X4_LUMA", |
---|
| 590 | "INTRA4X4_CHROMAU", |
---|
| 591 | "INTRA4X4_CHROMAV", |
---|
| 592 | "INTER4X4_LUMA", |
---|
| 593 | "INTER4X4_CHROMAU", |
---|
| 594 | "INTER4X4_CHROMAV" |
---|
| 595 | }, |
---|
[313] | 596 | { |
---|
[1029] | 597 | "INTRA8X8_LUMA", |
---|
| 598 | "INTRA8X8_CHROMAU", |
---|
| 599 | "INTRA8X8_CHROMAV", |
---|
| 600 | "INTER8X8_LUMA", |
---|
| 601 | "INTER8X8_CHROMAU", |
---|
| 602 | "INTER8X8_CHROMAV" |
---|
| 603 | }, |
---|
[313] | 604 | { |
---|
[1029] | 605 | "INTRA16X16_LUMA", |
---|
| 606 | "INTRA16X16_CHROMAU", |
---|
| 607 | "INTRA16X16_CHROMAV", |
---|
| 608 | "INTER16X16_LUMA", |
---|
| 609 | "INTER16X16_CHROMAU", |
---|
| 610 | "INTER16X16_CHROMAV" |
---|
| 611 | }, |
---|
[313] | 612 | { |
---|
[1029] | 613 | "INTRA32X32_LUMA", |
---|
| 614 | "INTRA32X32_CHROMAU_FROM16x16_CHROMAU", |
---|
| 615 | "INTRA32X32_CHROMAV_FROM16x16_CHROMAV", |
---|
| 616 | "INTER32X32_LUMA", |
---|
| 617 | "INTER32X32_CHROMAU_FROM16x16_CHROMAU", |
---|
| 618 | "INTER32X32_CHROMAV_FROM16x16_CHROMAV" |
---|
| 619 | }, |
---|
| 620 | }; |
---|
[313] | 621 | |
---|
[1029] | 622 | const Char *MatrixType_DC[SCALING_LIST_SIZE_NUM][SCALING_LIST_NUM] = |
---|
| 623 | { |
---|
[313] | 624 | { |
---|
[1029] | 625 | }, |
---|
[313] | 626 | { |
---|
[1029] | 627 | }, |
---|
[313] | 628 | { |
---|
[1029] | 629 | "INTRA16X16_LUMA_DC", |
---|
| 630 | "INTRA16X16_CHROMAU_DC", |
---|
| 631 | "INTRA16X16_CHROMAV_DC", |
---|
| 632 | "INTER16X16_LUMA_DC", |
---|
| 633 | "INTER16X16_CHROMAU_DC", |
---|
| 634 | "INTER16X16_CHROMAV_DC" |
---|
| 635 | }, |
---|
[313] | 636 | { |
---|
[1029] | 637 | "INTRA32X32_LUMA_DC", |
---|
| 638 | "INTRA32X32_CHROMAU_DC_FROM16x16_CHROMAU", |
---|
| 639 | "INTRA32X32_CHROMAV_DC_FROM16x16_CHROMAV", |
---|
| 640 | "INTER32X32_LUMA_DC", |
---|
| 641 | "INTER32X32_CHROMAU_DC_FROM16x16_CHROMAU", |
---|
| 642 | "INTER32X32_CHROMAV_DC_FROM16x16_CHROMAV" |
---|
| 643 | }, |
---|
| 644 | }; |
---|
[313] | 645 | |
---|
[1029] | 646 | Int g_quantTSDefault4x4[4*4] = |
---|
[313] | 647 | { |
---|
| 648 | 16,16,16,16, |
---|
| 649 | 16,16,16,16, |
---|
| 650 | 16,16,16,16, |
---|
| 651 | 16,16,16,16 |
---|
| 652 | }; |
---|
| 653 | |
---|
[1029] | 654 | Int g_quantIntraDefault8x8[8*8] = |
---|
[313] | 655 | { |
---|
| 656 | 16,16,16,16,17,18,21,24, |
---|
| 657 | 16,16,16,16,17,19,22,25, |
---|
| 658 | 16,16,17,18,20,22,25,29, |
---|
| 659 | 16,16,18,21,24,27,31,36, |
---|
| 660 | 17,17,20,24,30,35,41,47, |
---|
| 661 | 18,19,22,27,35,44,54,65, |
---|
| 662 | 21,22,25,31,41,54,70,88, |
---|
| 663 | 24,25,29,36,47,65,88,115 |
---|
| 664 | }; |
---|
| 665 | |
---|
[1029] | 666 | Int g_quantInterDefault8x8[8*8] = |
---|
[313] | 667 | { |
---|
| 668 | 16,16,16,16,17,18,20,24, |
---|
| 669 | 16,16,16,17,18,20,24,25, |
---|
| 670 | 16,16,17,18,20,24,25,28, |
---|
| 671 | 16,17,18,20,24,25,28,33, |
---|
| 672 | 17,18,20,24,25,28,33,41, |
---|
| 673 | 18,20,24,25,28,33,41,54, |
---|
| 674 | 20,24,25,28,33,41,54,71, |
---|
| 675 | 24,25,28,33,41,54,71,91 |
---|
| 676 | }; |
---|
| 677 | |
---|
[1029] | 678 | UInt g_scalingListSize [SCALING_LIST_SIZE_NUM] = {16,64,256,1024}; |
---|
| 679 | UInt g_scalingListSizeX [SCALING_LIST_SIZE_NUM] = { 4, 8, 16, 32}; |
---|
| 680 | |
---|
[442] | 681 | #if SVC_EXTENSION |
---|
[595] | 682 | #if FAST_INTRA_SHVC |
---|
| 683 | UInt g_reducedSetIntraModes[NUM_INTRA_MODE-1] = { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }; |
---|
| 684 | UInt g_predefSetIntraModes[NUM_INTRA_MODE-1] = {26,10,18,34,2,22,14,30,6,24,12,28,8,20,16,32,4,17,19,15,21,13,23,11,25,9,27,7,29,5,31,3,33,0,2}; |
---|
| 685 | #endif |
---|
[1029] | 686 | Int g_bitDepthLayer[MAX_NUM_CHANNEL_TYPE][MAX_LAYERS]; |
---|
[595] | 687 | void * g_refWeightACDCParam; // type=wpACDCParam |
---|
[313] | 688 | Int g_mvScalingFactor [MAX_LAYERS][2] = {{0,0}, {0,0}}; |
---|
| 689 | Int g_posScalingFactor [MAX_LAYERS][2] = {{0,0}, {0,0}}; |
---|
[588] | 690 | |
---|
| 691 | std::string NaluToStr( NalUnitType nalu ) |
---|
| 692 | { |
---|
| 693 | switch( nalu ) |
---|
| 694 | { |
---|
| 695 | case NAL_UNIT_CODED_SLICE_TRAIL_N: |
---|
[815] | 696 | return "TRAIL_N"; |
---|
[588] | 697 | case NAL_UNIT_CODED_SLICE_TRAIL_R: |
---|
[815] | 698 | return "TRAIL_R"; |
---|
[588] | 699 | |
---|
| 700 | case NAL_UNIT_CODED_SLICE_TSA_N: |
---|
[815] | 701 | return " TSA_N"; |
---|
[588] | 702 | case NAL_UNIT_CODED_SLICE_TSA_R: |
---|
[815] | 703 | return " TSA_R"; |
---|
[588] | 704 | |
---|
| 705 | case NAL_UNIT_CODED_SLICE_STSA_N: |
---|
[815] | 706 | return " STSA_N"; |
---|
[588] | 707 | case NAL_UNIT_CODED_SLICE_STSA_R: |
---|
[815] | 708 | return " STSA_R"; |
---|
[588] | 709 | |
---|
| 710 | case NAL_UNIT_CODED_SLICE_RADL_N: |
---|
[815] | 711 | return " RADL_N"; |
---|
[588] | 712 | case NAL_UNIT_CODED_SLICE_RADL_R: |
---|
[815] | 713 | return " RADL_R"; |
---|
[588] | 714 | |
---|
| 715 | case NAL_UNIT_CODED_SLICE_RASL_N: |
---|
[815] | 716 | return " RASL_N"; |
---|
[588] | 717 | case NAL_UNIT_CODED_SLICE_RASL_R: |
---|
[815] | 718 | return " RASL_R"; |
---|
[588] | 719 | |
---|
| 720 | case NAL_UNIT_CODED_SLICE_BLA_W_LP: |
---|
| 721 | case NAL_UNIT_CODED_SLICE_BLA_W_RADL: |
---|
| 722 | case NAL_UNIT_CODED_SLICE_BLA_N_LP: |
---|
[815] | 723 | return " BLA"; |
---|
[588] | 724 | |
---|
| 725 | case NAL_UNIT_CODED_SLICE_IDR_W_RADL: |
---|
| 726 | case NAL_UNIT_CODED_SLICE_IDR_N_LP: |
---|
[815] | 727 | return " IDR"; |
---|
[588] | 728 | |
---|
| 729 | case NAL_UNIT_CODED_SLICE_CRA: |
---|
[815] | 730 | return " CRA"; |
---|
[588] | 731 | |
---|
| 732 | default: |
---|
[815] | 733 | return " "; |
---|
[588] | 734 | }; |
---|
| 735 | } |
---|
[595] | 736 | #if LAYER_CTB |
---|
| 737 | UInt g_auiLayerMaxCUWidth[MAX_LAYERS]; |
---|
| 738 | UInt g_auiLayerMaxCUHeight[MAX_LAYERS]; |
---|
| 739 | UInt g_auiLayerMaxCUDepth[MAX_LAYERS]; |
---|
| 740 | UInt g_auiLayerAddCUDepth[MAX_LAYERS]; |
---|
| 741 | UInt g_auiLayerZscanToRaster[MAX_LAYERS][ MAX_NUM_SPU_W*MAX_NUM_SPU_W ]; |
---|
| 742 | UInt g_auiLayerRasterToZscan[MAX_LAYERS][ MAX_NUM_SPU_W*MAX_NUM_SPU_W ]; |
---|
| 743 | UInt g_auiLayerRasterToPelX[MAX_LAYERS][ MAX_NUM_SPU_W*MAX_NUM_SPU_W ]; |
---|
| 744 | UInt g_auiLayerRasterToPelY[MAX_LAYERS][ MAX_NUM_SPU_W*MAX_NUM_SPU_W ]; |
---|
[313] | 745 | #endif |
---|
[595] | 746 | #endif //SVC_EXTENSION |
---|
[313] | 747 | |
---|
| 748 | //! \} |
---|