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