[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 | |
---|
[1335] | 251 | UInt g_auiZscanToRaster [ MAX_NUM_PART_IDXS_IN_CTU_WIDTH*MAX_NUM_PART_IDXS_IN_CTU_WIDTH ] = { 0, }; |
---|
| 252 | UInt g_auiRasterToZscan [ MAX_NUM_PART_IDXS_IN_CTU_WIDTH*MAX_NUM_PART_IDXS_IN_CTU_WIDTH ] = { 0, }; |
---|
| 253 | UInt g_auiRasterToPelX [ MAX_NUM_PART_IDXS_IN_CTU_WIDTH*MAX_NUM_PART_IDXS_IN_CTU_WIDTH ] = { 0, }; |
---|
| 254 | UInt g_auiRasterToPelY [ MAX_NUM_PART_IDXS_IN_CTU_WIDTH*MAX_NUM_PART_IDXS_IN_CTU_WIDTH ] = { 0, }; |
---|
[313] | 255 | |
---|
[1292] | 256 | const UInt g_auiPUOffset[NUMBER_OF_PART_SIZES] = { 0, 8, 4, 4, 2, 10, 1, 5}; |
---|
[313] | 257 | |
---|
| 258 | Void initZscanToRaster ( Int iMaxDepth, Int iDepth, UInt uiStartVal, UInt*& rpuiCurrIdx ) |
---|
| 259 | { |
---|
| 260 | Int iStride = 1 << ( iMaxDepth - 1 ); |
---|
[1029] | 261 | |
---|
[313] | 262 | if ( iDepth == iMaxDepth ) |
---|
| 263 | { |
---|
| 264 | rpuiCurrIdx[0] = uiStartVal; |
---|
| 265 | rpuiCurrIdx++; |
---|
| 266 | } |
---|
| 267 | else |
---|
| 268 | { |
---|
| 269 | Int iStep = iStride >> iDepth; |
---|
| 270 | initZscanToRaster( iMaxDepth, iDepth+1, uiStartVal, rpuiCurrIdx ); |
---|
| 271 | initZscanToRaster( iMaxDepth, iDepth+1, uiStartVal+iStep, rpuiCurrIdx ); |
---|
| 272 | initZscanToRaster( iMaxDepth, iDepth+1, uiStartVal+iStep*iStride, rpuiCurrIdx ); |
---|
| 273 | initZscanToRaster( iMaxDepth, iDepth+1, uiStartVal+iStep*iStride+iStep, rpuiCurrIdx ); |
---|
| 274 | } |
---|
| 275 | } |
---|
| 276 | |
---|
| 277 | Void initRasterToZscan ( UInt uiMaxCUWidth, UInt uiMaxCUHeight, UInt uiMaxDepth ) |
---|
| 278 | { |
---|
| 279 | UInt uiMinCUWidth = uiMaxCUWidth >> ( uiMaxDepth - 1 ); |
---|
| 280 | UInt uiMinCUHeight = uiMaxCUHeight >> ( uiMaxDepth - 1 ); |
---|
[1029] | 281 | |
---|
[313] | 282 | UInt uiNumPartInWidth = (UInt)uiMaxCUWidth / uiMinCUWidth; |
---|
| 283 | UInt uiNumPartInHeight = (UInt)uiMaxCUHeight / uiMinCUHeight; |
---|
[1029] | 284 | |
---|
[313] | 285 | for ( UInt i = 0; i < uiNumPartInWidth*uiNumPartInHeight; i++ ) |
---|
| 286 | { |
---|
| 287 | g_auiRasterToZscan[ g_auiZscanToRaster[i] ] = i; |
---|
| 288 | } |
---|
| 289 | } |
---|
| 290 | |
---|
| 291 | Void initRasterToPelXY ( UInt uiMaxCUWidth, UInt uiMaxCUHeight, UInt uiMaxDepth ) |
---|
| 292 | { |
---|
| 293 | UInt i; |
---|
[1029] | 294 | |
---|
[313] | 295 | UInt* uiTempX = &g_auiRasterToPelX[0]; |
---|
| 296 | UInt* uiTempY = &g_auiRasterToPelY[0]; |
---|
[1029] | 297 | |
---|
[313] | 298 | UInt uiMinCUWidth = uiMaxCUWidth >> ( uiMaxDepth - 1 ); |
---|
| 299 | UInt uiMinCUHeight = uiMaxCUHeight >> ( uiMaxDepth - 1 ); |
---|
[1029] | 300 | |
---|
[313] | 301 | UInt uiNumPartInWidth = uiMaxCUWidth / uiMinCUWidth; |
---|
| 302 | UInt uiNumPartInHeight = uiMaxCUHeight / uiMinCUHeight; |
---|
[1029] | 303 | |
---|
[313] | 304 | uiTempX[0] = 0; uiTempX++; |
---|
| 305 | for ( i = 1; i < uiNumPartInWidth; i++ ) |
---|
| 306 | { |
---|
| 307 | uiTempX[0] = uiTempX[-1] + uiMinCUWidth; uiTempX++; |
---|
| 308 | } |
---|
| 309 | for ( i = 1; i < uiNumPartInHeight; i++ ) |
---|
| 310 | { |
---|
| 311 | memcpy(uiTempX, uiTempX-uiNumPartInWidth, sizeof(UInt)*uiNumPartInWidth); |
---|
| 312 | uiTempX += uiNumPartInWidth; |
---|
| 313 | } |
---|
[1029] | 314 | |
---|
[313] | 315 | for ( i = 1; i < uiNumPartInWidth*uiNumPartInHeight; i++ ) |
---|
| 316 | { |
---|
| 317 | uiTempY[i] = ( i / uiNumPartInWidth ) * uiMinCUWidth; |
---|
| 318 | } |
---|
[1029] | 319 | } |
---|
[313] | 320 | |
---|
[1292] | 321 | const Int g_quantScales[SCALING_LIST_REM_NUM] = |
---|
[313] | 322 | { |
---|
| 323 | 26214,23302,20560,18396,16384,14564 |
---|
[1029] | 324 | }; |
---|
[313] | 325 | |
---|
[1292] | 326 | const Int g_invQuantScales[SCALING_LIST_REM_NUM] = |
---|
[313] | 327 | { |
---|
| 328 | 40,45,51,57,64,72 |
---|
| 329 | }; |
---|
| 330 | |
---|
[1029] | 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 | { |
---|
[1029] | 426 | DEFINE_DCT4x4_MATRIX (16384, 21266, 9224), |
---|
| 427 | DEFINE_DCT4x4_MATRIX ( 64, 83, 36) |
---|
[313] | 428 | }; |
---|
| 429 | |
---|
[1029] | 430 | const TMatrixCoeff g_aiT8 [TRANSFORM_NUMBER_OF_DIRECTIONS][8][8] = |
---|
[313] | 431 | { |
---|
[1029] | 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 | |
---|
[1029] | 436 | const TMatrixCoeff g_aiT16[TRANSFORM_NUMBER_OF_DIRECTIONS][16][16] = |
---|
[313] | 437 | { |
---|
[1029] | 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 | |
---|
[1029] | 442 | const TMatrixCoeff g_aiT32[TRANSFORM_NUMBER_OF_DIRECTIONS][32][32] = |
---|
[313] | 443 | { |
---|
[1029] | 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 | |
---|
[1029] | 448 | const TMatrixCoeff g_as_DST_MAT_4[TRANSFORM_NUMBER_OF_DIRECTIONS][4][4] = |
---|
[313] | 449 | { |
---|
[1029] | 450 | DEFINE_DST4x4_MATRIX( 7424, 14081, 18893, 21505), |
---|
| 451 | DEFINE_DST4x4_MATRIX( 29, 55, 74, 84) |
---|
[313] | 452 | }; |
---|
| 453 | |
---|
[1029] | 454 | #else |
---|
[313] | 455 | |
---|
[1029] | 456 | const TMatrixCoeff g_aiT4 [TRANSFORM_NUMBER_OF_DIRECTIONS][4][4] = |
---|
[313] | 457 | { |
---|
[1029] | 458 | DEFINE_DCT4x4_MATRIX ( 64, 83, 36), |
---|
| 459 | DEFINE_DCT4x4_MATRIX ( 64, 83, 36) |
---|
[313] | 460 | }; |
---|
| 461 | |
---|
[1029] | 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 | |
---|
[1029] | 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 | // ==================================================================================================================== |
---|
[1315] | 509 | // Intra prediction |
---|
[313] | 510 | // ==================================================================================================================== |
---|
| 511 | |
---|
[1327] | 512 | const UChar g_aucIntraModeNumFast_UseMPM[MAX_CU_DEPTH] = |
---|
[313] | 513 | { |
---|
| 514 | 3, // 2x2 |
---|
| 515 | 8, // 4x4 |
---|
| 516 | 8, // 8x8 |
---|
[1029] | 517 | 3, // 16x16 |
---|
| 518 | 3, // 32x32 |
---|
| 519 | 3 // 64x64 |
---|
[313] | 520 | }; |
---|
[1327] | 521 | const UChar g_aucIntraModeNumFast_NotUseMPM[MAX_CU_DEPTH] = |
---|
[313] | 522 | { |
---|
| 523 | 3, // 2x2 |
---|
| 524 | 9, // 4x4 |
---|
| 525 | 9, // 8x8 |
---|
| 526 | 4, // 16x16 33 |
---|
| 527 | 4, // 32x32 33 |
---|
[442] | 528 | 5 // 64x64 33 |
---|
[313] | 529 | }; |
---|
| 530 | |
---|
[1029] | 531 | const UChar g_chroma422IntraAngleMappingTable[NUM_INTRA_MODE] = |
---|
| 532 | //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 |
---|
| 533 | { 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] | 534 | |
---|
| 535 | // ==================================================================================================================== |
---|
| 536 | // Misc. |
---|
| 537 | // ==================================================================================================================== |
---|
| 538 | |
---|
| 539 | Char g_aucConvertToBit [ MAX_CU_SIZE+1 ]; |
---|
| 540 | |
---|
| 541 | #if ENC_DEC_TRACE |
---|
[1029] | 542 | FILE* g_hTrace = NULL; // Set to NULL to open up a file. Set to stdout to use the current output |
---|
[313] | 543 | const Bool g_bEncDecTraceEnable = true; |
---|
| 544 | const Bool g_bEncDecTraceDisable = false; |
---|
| 545 | Bool g_HLSTraceEnable = true; |
---|
| 546 | Bool g_bJustDoIt = false; |
---|
| 547 | UInt64 g_nSymbolCounter = 0; |
---|
| 548 | #endif |
---|
| 549 | // ==================================================================================================================== |
---|
| 550 | // Scanning order & context model mapping |
---|
| 551 | // ==================================================================================================================== |
---|
| 552 | |
---|
| 553 | // scanning order table |
---|
[1029] | 554 | UInt* g_scanOrder[SCAN_NUMBER_OF_GROUP_TYPES][SCAN_NUMBER_OF_TYPES][ MAX_CU_DEPTH ][ MAX_CU_DEPTH ]; |
---|
[313] | 555 | |
---|
[1029] | 556 | const UInt ctxIndMap4x4[4*4] = |
---|
[313] | 557 | { |
---|
[1029] | 558 | 0, 1, 4, 5, |
---|
| 559 | 2, 3, 4, 5, |
---|
| 560 | 6, 6, 8, 8, |
---|
| 561 | 7, 7, 8, 8 |
---|
[313] | 562 | }; |
---|
| 563 | |
---|
[1029] | 564 | const UInt g_uiMinInGroup[ LAST_SIGNIFICANT_GROUPS ] = {0,1,2,3,4,6,8,12,16,24}; |
---|
| 565 | 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] | 566 | |
---|
[1029] | 567 | const Char *MatrixType[SCALING_LIST_SIZE_NUM][SCALING_LIST_NUM] = |
---|
[313] | 568 | { |
---|
| 569 | { |
---|
[1029] | 570 | "INTRA4X4_LUMA", |
---|
| 571 | "INTRA4X4_CHROMAU", |
---|
| 572 | "INTRA4X4_CHROMAV", |
---|
| 573 | "INTER4X4_LUMA", |
---|
| 574 | "INTER4X4_CHROMAU", |
---|
| 575 | "INTER4X4_CHROMAV" |
---|
| 576 | }, |
---|
[313] | 577 | { |
---|
[1029] | 578 | "INTRA8X8_LUMA", |
---|
| 579 | "INTRA8X8_CHROMAU", |
---|
| 580 | "INTRA8X8_CHROMAV", |
---|
| 581 | "INTER8X8_LUMA", |
---|
| 582 | "INTER8X8_CHROMAU", |
---|
| 583 | "INTER8X8_CHROMAV" |
---|
| 584 | }, |
---|
[313] | 585 | { |
---|
[1029] | 586 | "INTRA16X16_LUMA", |
---|
| 587 | "INTRA16X16_CHROMAU", |
---|
| 588 | "INTRA16X16_CHROMAV", |
---|
| 589 | "INTER16X16_LUMA", |
---|
| 590 | "INTER16X16_CHROMAU", |
---|
| 591 | "INTER16X16_CHROMAV" |
---|
| 592 | }, |
---|
[313] | 593 | { |
---|
[1029] | 594 | "INTRA32X32_LUMA", |
---|
| 595 | "INTRA32X32_CHROMAU_FROM16x16_CHROMAU", |
---|
| 596 | "INTRA32X32_CHROMAV_FROM16x16_CHROMAV", |
---|
| 597 | "INTER32X32_LUMA", |
---|
| 598 | "INTER32X32_CHROMAU_FROM16x16_CHROMAU", |
---|
| 599 | "INTER32X32_CHROMAV_FROM16x16_CHROMAV" |
---|
| 600 | }, |
---|
| 601 | }; |
---|
[313] | 602 | |
---|
[1029] | 603 | const Char *MatrixType_DC[SCALING_LIST_SIZE_NUM][SCALING_LIST_NUM] = |
---|
| 604 | { |
---|
[313] | 605 | { |
---|
[1029] | 606 | }, |
---|
[313] | 607 | { |
---|
[1029] | 608 | }, |
---|
[313] | 609 | { |
---|
[1029] | 610 | "INTRA16X16_LUMA_DC", |
---|
| 611 | "INTRA16X16_CHROMAU_DC", |
---|
| 612 | "INTRA16X16_CHROMAV_DC", |
---|
| 613 | "INTER16X16_LUMA_DC", |
---|
| 614 | "INTER16X16_CHROMAU_DC", |
---|
| 615 | "INTER16X16_CHROMAV_DC" |
---|
| 616 | }, |
---|
[313] | 617 | { |
---|
[1029] | 618 | "INTRA32X32_LUMA_DC", |
---|
| 619 | "INTRA32X32_CHROMAU_DC_FROM16x16_CHROMAU", |
---|
| 620 | "INTRA32X32_CHROMAV_DC_FROM16x16_CHROMAV", |
---|
| 621 | "INTER32X32_LUMA_DC", |
---|
| 622 | "INTER32X32_CHROMAU_DC_FROM16x16_CHROMAU", |
---|
| 623 | "INTER32X32_CHROMAV_DC_FROM16x16_CHROMAV" |
---|
| 624 | }, |
---|
| 625 | }; |
---|
[313] | 626 | |
---|
[1292] | 627 | const Int g_quantTSDefault4x4[4*4] = |
---|
[313] | 628 | { |
---|
| 629 | 16,16,16,16, |
---|
| 630 | 16,16,16,16, |
---|
| 631 | 16,16,16,16, |
---|
| 632 | 16,16,16,16 |
---|
| 633 | }; |
---|
| 634 | |
---|
[1292] | 635 | const Int g_quantIntraDefault8x8[8*8] = |
---|
[313] | 636 | { |
---|
| 637 | 16,16,16,16,17,18,21,24, |
---|
| 638 | 16,16,16,16,17,19,22,25, |
---|
| 639 | 16,16,17,18,20,22,25,29, |
---|
| 640 | 16,16,18,21,24,27,31,36, |
---|
| 641 | 17,17,20,24,30,35,41,47, |
---|
| 642 | 18,19,22,27,35,44,54,65, |
---|
| 643 | 21,22,25,31,41,54,70,88, |
---|
| 644 | 24,25,29,36,47,65,88,115 |
---|
| 645 | }; |
---|
| 646 | |
---|
[1292] | 647 | const Int g_quantInterDefault8x8[8*8] = |
---|
[313] | 648 | { |
---|
| 649 | 16,16,16,16,17,18,20,24, |
---|
| 650 | 16,16,16,17,18,20,24,25, |
---|
| 651 | 16,16,17,18,20,24,25,28, |
---|
| 652 | 16,17,18,20,24,25,28,33, |
---|
| 653 | 17,18,20,24,25,28,33,41, |
---|
| 654 | 18,20,24,25,28,33,41,54, |
---|
| 655 | 20,24,25,28,33,41,54,71, |
---|
| 656 | 24,25,28,33,41,54,71,91 |
---|
| 657 | }; |
---|
| 658 | |
---|
[1292] | 659 | const UInt g_scalingListSize [SCALING_LIST_SIZE_NUM] = {16,64,256,1024}; |
---|
| 660 | const UInt g_scalingListSizeX [SCALING_LIST_SIZE_NUM] = { 4, 8, 16, 32}; |
---|
[1029] | 661 | |
---|
[442] | 662 | #if SVC_EXTENSION |
---|
[595] | 663 | #if FAST_INTRA_SHVC |
---|
| 664 | 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 }; |
---|
| 665 | 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}; |
---|
| 666 | #endif |
---|
[313] | 667 | Int g_mvScalingFactor [MAX_LAYERS][2] = {{0,0}, {0,0}}; |
---|
| 668 | Int g_posScalingFactor [MAX_LAYERS][2] = {{0,0}, {0,0}}; |
---|
[588] | 669 | |
---|
[1335] | 670 | std::string NaluToStr( NalUnitType type ) |
---|
[588] | 671 | { |
---|
[1335] | 672 | switch (type) |
---|
[588] | 673 | { |
---|
[1335] | 674 | case NAL_UNIT_CODED_SLICE_TRAIL_R: return " TRAIL_R"; |
---|
| 675 | case NAL_UNIT_CODED_SLICE_TRAIL_N: return " TRAIL_N"; |
---|
| 676 | case NAL_UNIT_CODED_SLICE_TSA_R: return " TSA_R"; |
---|
| 677 | case NAL_UNIT_CODED_SLICE_TSA_N: return " TSA_N"; |
---|
| 678 | case NAL_UNIT_CODED_SLICE_STSA_R: return " STSA_R"; |
---|
| 679 | case NAL_UNIT_CODED_SLICE_STSA_N: return " STSA_N"; |
---|
| 680 | case NAL_UNIT_CODED_SLICE_BLA_W_LP: return " BLA_W_LP"; |
---|
| 681 | case NAL_UNIT_CODED_SLICE_BLA_W_RADL: return "BLA_W_RADL"; |
---|
| 682 | case NAL_UNIT_CODED_SLICE_BLA_N_LP: return " BLA_N_LP"; |
---|
| 683 | case NAL_UNIT_CODED_SLICE_IDR_W_RADL: return "IDR_W_RADL"; |
---|
| 684 | case NAL_UNIT_CODED_SLICE_IDR_N_LP: return " IDR_N_LP"; |
---|
| 685 | case NAL_UNIT_CODED_SLICE_CRA: return " CRA"; |
---|
| 686 | case NAL_UNIT_CODED_SLICE_RADL_R: return " RADL_R"; |
---|
| 687 | case NAL_UNIT_CODED_SLICE_RADL_N: return " RADL_N"; |
---|
| 688 | case NAL_UNIT_CODED_SLICE_RASL_R: return " RASL_R"; |
---|
| 689 | case NAL_UNIT_CODED_SLICE_RASL_N: return " RASL_N"; |
---|
| 690 | case NAL_UNIT_VPS: return " VPS"; |
---|
| 691 | case NAL_UNIT_SPS: return " SPS"; |
---|
| 692 | case NAL_UNIT_PPS: return " PPS"; |
---|
| 693 | case NAL_UNIT_ACCESS_UNIT_DELIMITER: return " AUD"; |
---|
| 694 | case NAL_UNIT_EOS: return " EOS"; |
---|
| 695 | case NAL_UNIT_EOB: return " EOB"; |
---|
| 696 | case NAL_UNIT_FILLER_DATA: return " FILLER"; |
---|
| 697 | case NAL_UNIT_PREFIX_SEI: return " SEI"; |
---|
| 698 | case NAL_UNIT_SUFFIX_SEI: return " SEI"; |
---|
| 699 | default: return " UNK"; |
---|
| 700 | } |
---|
[588] | 701 | } |
---|
[595] | 702 | #if LAYER_CTB |
---|
| 703 | UInt g_auiLayerZscanToRaster[MAX_LAYERS][ MAX_NUM_SPU_W*MAX_NUM_SPU_W ]; |
---|
| 704 | UInt g_auiLayerRasterToZscan[MAX_LAYERS][ MAX_NUM_SPU_W*MAX_NUM_SPU_W ]; |
---|
| 705 | UInt g_auiLayerRasterToPelX[MAX_LAYERS][ MAX_NUM_SPU_W*MAX_NUM_SPU_W ]; |
---|
| 706 | UInt g_auiLayerRasterToPelY[MAX_LAYERS][ MAX_NUM_SPU_W*MAX_NUM_SPU_W ]; |
---|
[313] | 707 | #endif |
---|
[595] | 708 | #endif //SVC_EXTENSION |
---|
[313] | 709 | |
---|
| 710 | //! \} |
---|