[5] | 1 | /* The copyright in this software is being made available under the BSD |
---|
| 2 | * License, included below. This software may be subject to other third party |
---|
| 3 | * and contributor rights, including patent rights, and no such rights are |
---|
[56] | 4 | * granted under this license. |
---|
[5] | 5 | * |
---|
[56] | 6 | * Copyright (c) 2010-2012, ITU/ISO/IEC |
---|
[5] | 7 | * All rights reserved. |
---|
| 8 | * |
---|
| 9 | * Redistribution and use in source and binary forms, with or without |
---|
| 10 | * modification, are permitted provided that the following conditions are met: |
---|
| 11 | * |
---|
| 12 | * * Redistributions of source code must retain the above copyright notice, |
---|
| 13 | * this list of conditions and the following disclaimer. |
---|
| 14 | * * Redistributions in binary form must reproduce the above copyright notice, |
---|
| 15 | * this list of conditions and the following disclaimer in the documentation |
---|
| 16 | * and/or other materials provided with the distribution. |
---|
[56] | 17 | * * Neither the name of the ITU/ISO/IEC nor the names of its contributors may |
---|
[5] | 18 | * be used to endorse or promote products derived from this software without |
---|
| 19 | * specific prior written permission. |
---|
| 20 | * |
---|
| 21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
---|
| 22 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
---|
| 23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
---|
| 24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS |
---|
| 25 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
---|
| 26 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
---|
| 27 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
---|
| 28 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
---|
| 29 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
---|
| 30 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF |
---|
| 31 | * THE POSSIBILITY OF SUCH DAMAGE. |
---|
| 32 | */ |
---|
[2] | 33 | |
---|
| 34 | /** \file 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> |
---|
| 42 | // ==================================================================================================================== |
---|
| 43 | // Initialize / destroy functions |
---|
| 44 | // ==================================================================================================================== |
---|
| 45 | |
---|
[56] | 46 | //! \ingroup TLibCommon |
---|
| 47 | //! \{ |
---|
| 48 | |
---|
[2] | 49 | // initialize ROM variables |
---|
| 50 | Void initROM() |
---|
| 51 | { |
---|
| 52 | Int i, c; |
---|
| 53 | |
---|
| 54 | // g_aucConvertToBit[ x ]: log2(x/4), if x=4 -> 0, x=8 -> 1, x=16 -> 2, ... |
---|
| 55 | ::memset( g_aucConvertToBit, -1, sizeof( g_aucConvertToBit ) ); |
---|
| 56 | c=0; |
---|
| 57 | for ( i=4; i<MAX_CU_SIZE; i*=2 ) |
---|
| 58 | { |
---|
| 59 | g_aucConvertToBit[ i ] = c; |
---|
| 60 | c++; |
---|
| 61 | } |
---|
| 62 | g_aucConvertToBit[ i ] = c; |
---|
| 63 | |
---|
| 64 | // g_auiFrameScanXY[ g_aucConvertToBit[ transformSize ] ]: zigzag scan array for transformSize |
---|
| 65 | c=2; |
---|
| 66 | for ( i=0; i<MAX_CU_DEPTH; i++ ) |
---|
| 67 | { |
---|
| 68 | g_auiFrameScanXY[ i ] = new UInt[ c*c ]; |
---|
| 69 | g_auiFrameScanX [ i ] = new UInt[ c*c ]; |
---|
| 70 | g_auiFrameScanY [ i ] = new UInt[ c*c ]; |
---|
| 71 | initFrameScanXY( g_auiFrameScanXY[i], g_auiFrameScanX[i], g_auiFrameScanY[i], c, c ); |
---|
| 72 | g_auiSigLastScan[0][i] = new UInt[ c*c ]; |
---|
| 73 | g_auiSigLastScan[1][i] = new UInt[ c*c ]; |
---|
| 74 | g_auiSigLastScan[2][i] = new UInt[ c*c ]; |
---|
[56] | 75 | g_auiSigLastScan[3][i] = new UInt[ c*c ]; |
---|
| 76 | initSigLastScan( g_auiSigLastScan[0][i], g_auiSigLastScan[1][i], g_auiSigLastScan[2][i], g_auiSigLastScan[3][i], c, c, i); |
---|
[2] | 77 | |
---|
| 78 | c <<= 1; |
---|
| 79 | } |
---|
[56] | 80 | |
---|
| 81 | g_sigScanNSQT[0] = new UInt[ 64 ]; // 4x16 |
---|
| 82 | g_sigScanNSQT[1] = new UInt[ 256 ]; // 8x32 |
---|
| 83 | g_sigScanNSQT[2] = new UInt[ 64 ]; // 16x4 |
---|
| 84 | g_sigScanNSQT[3] = new UInt[ 256 ]; // 32x8 |
---|
| 85 | |
---|
| 86 | static int diagScanX[ 16 ] = |
---|
| 87 | { |
---|
| 88 | 0, 0, 1, 0, 1, 2, 0, 1, 2, 3, 1, 2, 3, 2, 3, 3 |
---|
| 89 | }; |
---|
| 90 | static int diagScanY[ 16 ] = |
---|
| 91 | { |
---|
| 92 | 0, 1, 0, 2, 1, 0, 3, 2, 1, 0, 3, 2, 1, 3, 2, 3 |
---|
| 93 | }; |
---|
| 94 | |
---|
| 95 | Int j; |
---|
| 96 | // 4x16 scan |
---|
| 97 | for (i = 0; i < 4; i++) |
---|
| 98 | { |
---|
| 99 | for (j = 0; j < 16; j++) |
---|
| 100 | { |
---|
| 101 | g_sigScanNSQT[ 0 ][ 16 * i + j ] = 16 * i + 4 * diagScanY[ j ] + diagScanX[ j ]; |
---|
| 102 | } |
---|
| 103 | } |
---|
| 104 | |
---|
| 105 | // 8x32 scan |
---|
| 106 | for (i = 0; i < 16; i++) |
---|
| 107 | { |
---|
| 108 | Int x = g_sigCGScanNSQT[ 1 ][ i ] & 1; |
---|
| 109 | Int y = g_sigCGScanNSQT[ 1 ][ i ] >> 1; |
---|
| 110 | |
---|
| 111 | for (j = 0; j < 16; j++) |
---|
| 112 | { |
---|
| 113 | g_sigScanNSQT[ 1 ][ 16 * i + j ] = 32 * y + 4 * x + 8 * diagScanY[ j ] + diagScanX[ j ]; |
---|
| 114 | } |
---|
| 115 | } |
---|
| 116 | |
---|
| 117 | // 16x4 scan |
---|
| 118 | for (i = 0; i < 4; i++) |
---|
| 119 | { |
---|
| 120 | for (j = 0; j < 16; j++) |
---|
| 121 | { |
---|
| 122 | g_sigScanNSQT[ 2 ][ 16 * i + j ] = 4 * i + 16 * diagScanY[ j ] + diagScanX[ j ]; |
---|
| 123 | } |
---|
| 124 | } |
---|
| 125 | |
---|
| 126 | // 32x8 scan |
---|
| 127 | for (i = 0; i < 16; i++) |
---|
| 128 | { |
---|
| 129 | Int x = g_sigCGScanNSQT[ 3 ][ i ] & 7; |
---|
| 130 | Int y = g_sigCGScanNSQT[ 3 ][ i ] >> 3; |
---|
| 131 | |
---|
| 132 | for (j = 0; j < 16; j++) |
---|
| 133 | { |
---|
| 134 | g_sigScanNSQT[ 3 ][ 16 * i + j ] = 128 * y + 4 * x + 32 * diagScanY[ j ] + diagScanX[ j ]; |
---|
| 135 | } |
---|
| 136 | } |
---|
[2] | 137 | } |
---|
| 138 | |
---|
| 139 | Void destroyROM() |
---|
| 140 | { |
---|
| 141 | Int i; |
---|
| 142 | |
---|
| 143 | for ( i=0; i<MAX_CU_DEPTH; i++ ) |
---|
| 144 | { |
---|
| 145 | delete[] g_auiFrameScanXY[i]; |
---|
| 146 | delete[] g_auiFrameScanX [i]; |
---|
| 147 | delete[] g_auiFrameScanY [i]; |
---|
| 148 | delete[] g_auiSigLastScan[0][i]; |
---|
| 149 | delete[] g_auiSigLastScan[1][i]; |
---|
| 150 | delete[] g_auiSigLastScan[2][i]; |
---|
[56] | 151 | delete[] g_auiSigLastScan[3][i]; |
---|
[2] | 152 | } |
---|
[56] | 153 | for (i = 0; i < 4; i++) |
---|
| 154 | { |
---|
| 155 | delete[] g_sigScanNSQT[ i ]; |
---|
| 156 | } |
---|
[2] | 157 | |
---|
[5] | 158 | #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX |
---|
[2] | 159 | if ( !g_aacWedgeLists.empty() ) |
---|
| 160 | { |
---|
| 161 | for ( UInt ui = 0; ui < g_aacWedgeLists.size(); ui++ ) |
---|
| 162 | { |
---|
| 163 | g_aacWedgeLists[ui].clear(); |
---|
| 164 | } |
---|
| 165 | g_aacWedgeLists.clear(); |
---|
| 166 | } |
---|
| 167 | |
---|
| 168 | if ( !g_aacWedgeRefLists.empty() ) |
---|
| 169 | { |
---|
| 170 | for ( UInt ui = 0; ui < g_aacWedgeRefLists.size(); ui++ ) |
---|
| 171 | { |
---|
| 172 | g_aacWedgeRefLists[ui].clear(); |
---|
| 173 | } |
---|
| 174 | g_aacWedgeRefLists.clear(); |
---|
| 175 | } |
---|
[213] | 176 | #if HHIQC_DMMFASTSEARCH_B0039 |
---|
| 177 | if ( !g_aacWedgeNodeLists.empty() ) |
---|
| 178 | { |
---|
| 179 | for ( UInt ui = 0; ui < g_aacWedgeNodeLists.size(); ui++ ) |
---|
| 180 | { |
---|
| 181 | g_aacWedgeNodeLists[ui].clear(); |
---|
| 182 | } |
---|
| 183 | g_aacWedgeNodeLists.clear(); |
---|
| 184 | } |
---|
[2] | 185 | #endif |
---|
[213] | 186 | #endif |
---|
[2] | 187 | } |
---|
| 188 | |
---|
| 189 | // ==================================================================================================================== |
---|
| 190 | // Data structure related table & variable |
---|
| 191 | // ==================================================================================================================== |
---|
| 192 | |
---|
| 193 | UInt g_uiMaxCUWidth = MAX_CU_SIZE; |
---|
| 194 | UInt g_uiMaxCUHeight = MAX_CU_SIZE; |
---|
| 195 | UInt g_uiMaxCUDepth = MAX_CU_DEPTH; |
---|
| 196 | UInt g_uiAddCUDepth = 0; |
---|
| 197 | |
---|
| 198 | UInt g_auiZscanToRaster [ MAX_NUM_SPU_W*MAX_NUM_SPU_W ] = { 0, }; |
---|
| 199 | UInt g_auiRasterToZscan [ MAX_NUM_SPU_W*MAX_NUM_SPU_W ] = { 0, }; |
---|
| 200 | UInt g_auiRasterToPelX [ MAX_NUM_SPU_W*MAX_NUM_SPU_W ] = { 0, }; |
---|
| 201 | UInt g_auiRasterToPelY [ MAX_NUM_SPU_W*MAX_NUM_SPU_W ] = { 0, }; |
---|
[56] | 202 | UInt g_motionRefer [ MAX_NUM_SPU_W*MAX_NUM_SPU_W ] = { 0, }; |
---|
[2] | 203 | |
---|
[56] | 204 | UInt g_auiPUOffset[8] = { 0, 8, 4, 4, 2, 10, 1, 5}; |
---|
[2] | 205 | |
---|
| 206 | Void initZscanToRaster ( Int iMaxDepth, Int iDepth, UInt uiStartVal, UInt*& rpuiCurrIdx ) |
---|
| 207 | { |
---|
| 208 | Int iStride = 1 << ( iMaxDepth - 1 ); |
---|
| 209 | |
---|
| 210 | if ( iDepth == iMaxDepth ) |
---|
| 211 | { |
---|
| 212 | rpuiCurrIdx[0] = uiStartVal; |
---|
| 213 | rpuiCurrIdx++; |
---|
| 214 | } |
---|
| 215 | else |
---|
| 216 | { |
---|
| 217 | Int iStep = iStride >> iDepth; |
---|
| 218 | initZscanToRaster( iMaxDepth, iDepth+1, uiStartVal, rpuiCurrIdx ); |
---|
| 219 | initZscanToRaster( iMaxDepth, iDepth+1, uiStartVal+iStep, rpuiCurrIdx ); |
---|
| 220 | initZscanToRaster( iMaxDepth, iDepth+1, uiStartVal+iStep*iStride, rpuiCurrIdx ); |
---|
| 221 | initZscanToRaster( iMaxDepth, iDepth+1, uiStartVal+iStep*iStride+iStep, rpuiCurrIdx ); |
---|
| 222 | } |
---|
| 223 | } |
---|
| 224 | |
---|
| 225 | Void initRasterToZscan ( UInt uiMaxCUWidth, UInt uiMaxCUHeight, UInt uiMaxDepth ) |
---|
| 226 | { |
---|
| 227 | UInt uiMinCUWidth = uiMaxCUWidth >> ( uiMaxDepth - 1 ); |
---|
| 228 | UInt uiMinCUHeight = uiMaxCUHeight >> ( uiMaxDepth - 1 ); |
---|
| 229 | |
---|
| 230 | UInt uiNumPartInWidth = (UInt)uiMaxCUWidth / uiMinCUWidth; |
---|
| 231 | UInt uiNumPartInHeight = (UInt)uiMaxCUHeight / uiMinCUHeight; |
---|
| 232 | |
---|
| 233 | for ( UInt i = 0; i < uiNumPartInWidth*uiNumPartInHeight; i++ ) |
---|
| 234 | { |
---|
| 235 | g_auiRasterToZscan[ g_auiZscanToRaster[i] ] = i; |
---|
| 236 | } |
---|
| 237 | } |
---|
| 238 | |
---|
[56] | 239 | /** generate motion data compression mapping table |
---|
| 240 | * \param uiMaxCUWidth, width of LCU |
---|
| 241 | * \param uiMaxCUHeight, hight of LCU |
---|
| 242 | * \param uiMaxDepth, max depth of LCU |
---|
| 243 | * \returns Void |
---|
| 244 | */ |
---|
| 245 | Void initMotionReferIdx ( UInt uiMaxCUWidth, UInt uiMaxCUHeight, UInt uiMaxDepth ) |
---|
| 246 | { |
---|
| 247 | Int minCUWidth = (Int)uiMaxCUWidth >> ( (Int)uiMaxDepth - 1 ); |
---|
| 248 | Int minCUHeight = (Int)uiMaxCUHeight >> ( (Int)uiMaxDepth - 1 ); |
---|
| 249 | |
---|
| 250 | Int numPartInWidth = (Int)uiMaxCUWidth / (Int)minCUWidth; |
---|
| 251 | Int numPartInHeight = (Int)uiMaxCUHeight / (Int)minCUHeight; |
---|
| 252 | |
---|
| 253 | for ( Int i = 0; i < numPartInWidth*numPartInHeight; i++ ) |
---|
| 254 | { |
---|
| 255 | g_motionRefer[i] = i; |
---|
| 256 | } |
---|
| 257 | |
---|
| 258 | Int compressionNum = 2; |
---|
| 259 | |
---|
| 260 | for ( Int i = numPartInWidth*(numPartInHeight-1); i < numPartInWidth*numPartInHeight; i += compressionNum*2) |
---|
| 261 | { |
---|
| 262 | for ( Int j = 1; j < compressionNum; j++ ) |
---|
| 263 | { |
---|
| 264 | g_motionRefer[g_auiRasterToZscan[i+j]] = g_auiRasterToZscan[i]; |
---|
| 265 | } |
---|
| 266 | } |
---|
| 267 | |
---|
| 268 | for ( Int i = numPartInWidth*(numPartInHeight-1)+compressionNum*2-1; i < numPartInWidth*numPartInHeight; i += compressionNum*2) |
---|
| 269 | { |
---|
| 270 | for ( Int j = 1; j < compressionNum; j++ ) |
---|
| 271 | { |
---|
| 272 | g_motionRefer[g_auiRasterToZscan[i-j]] = g_auiRasterToZscan[i]; |
---|
| 273 | } |
---|
| 274 | } |
---|
| 275 | } |
---|
| 276 | |
---|
[2] | 277 | Void initRasterToPelXY ( UInt uiMaxCUWidth, UInt uiMaxCUHeight, UInt uiMaxDepth ) |
---|
| 278 | { |
---|
| 279 | UInt i; |
---|
| 280 | |
---|
| 281 | UInt* uiTempX = &g_auiRasterToPelX[0]; |
---|
| 282 | UInt* uiTempY = &g_auiRasterToPelY[0]; |
---|
| 283 | |
---|
| 284 | UInt uiMinCUWidth = uiMaxCUWidth >> ( uiMaxDepth - 1 ); |
---|
| 285 | UInt uiMinCUHeight = uiMaxCUHeight >> ( uiMaxDepth - 1 ); |
---|
| 286 | |
---|
| 287 | UInt uiNumPartInWidth = uiMaxCUWidth / uiMinCUWidth; |
---|
| 288 | UInt uiNumPartInHeight = uiMaxCUHeight / uiMinCUHeight; |
---|
| 289 | |
---|
| 290 | uiTempX[0] = 0; uiTempX++; |
---|
| 291 | for ( i = 1; i < uiNumPartInWidth; i++ ) |
---|
| 292 | { |
---|
| 293 | uiTempX[0] = uiTempX[-1] + uiMinCUWidth; uiTempX++; |
---|
| 294 | } |
---|
| 295 | for ( i = 1; i < uiNumPartInHeight; i++ ) |
---|
| 296 | { |
---|
| 297 | memcpy(uiTempX, uiTempX-uiNumPartInWidth, sizeof(UInt)*uiNumPartInWidth); |
---|
| 298 | uiTempX += uiNumPartInWidth; |
---|
| 299 | } |
---|
| 300 | |
---|
| 301 | for ( i = 1; i < uiNumPartInWidth*uiNumPartInHeight; i++ ) |
---|
| 302 | { |
---|
| 303 | uiTempY[i] = ( i / uiNumPartInWidth ) * uiMinCUWidth; |
---|
| 304 | } |
---|
| 305 | }; |
---|
| 306 | |
---|
[213] | 307 | #if RWTH_SDC_DLT_B0036 |
---|
| 308 | UInt g_auiSDCPredModes[RWTH_SDC_NUM_PRED_MODES] = { DC_IDX, DMM_WEDGE_FULL_IDX, DMM_WEDGE_PREDDIR_IDX, PLANAR_IDX }; |
---|
| 309 | #endif |
---|
[2] | 310 | |
---|
[56] | 311 | Int g_quantScales[6] = |
---|
[2] | 312 | { |
---|
[56] | 313 | 26214,23302,20560,18396,16384,14564 |
---|
| 314 | }; |
---|
[2] | 315 | |
---|
[56] | 316 | Int g_invQuantScales[6] = |
---|
[2] | 317 | { |
---|
[56] | 318 | 40,45,51,57,64,72 |
---|
[2] | 319 | }; |
---|
| 320 | |
---|
[56] | 321 | const short g_aiT4[4][4] = |
---|
[2] | 322 | { |
---|
[56] | 323 | { 64, 64, 64, 64}, |
---|
| 324 | { 83, 36,-36,-83}, |
---|
| 325 | { 64,-64,-64, 64}, |
---|
| 326 | { 36,-83, 83,-36} |
---|
[2] | 327 | }; |
---|
| 328 | |
---|
[56] | 329 | const short g_aiT8[8][8] = |
---|
[2] | 330 | { |
---|
[56] | 331 | { 64, 64, 64, 64, 64, 64, 64, 64}, |
---|
| 332 | { 89, 75, 50, 18,-18,-50,-75,-89}, |
---|
| 333 | { 83, 36,-36,-83,-83,-36, 36, 83}, |
---|
| 334 | { 75,-18,-89,-50, 50, 89, 18,-75}, |
---|
| 335 | { 64,-64,-64, 64, 64,-64,-64, 64}, |
---|
| 336 | { 50,-89, 18, 75,-75,-18, 89,-50}, |
---|
| 337 | { 36,-83, 83,-36,-36, 83,-83, 36}, |
---|
| 338 | { 18,-50, 75,-89, 89,-75, 50,-18} |
---|
[2] | 339 | }; |
---|
| 340 | |
---|
[56] | 341 | const short g_aiT16[16][16] = |
---|
[2] | 342 | { |
---|
[56] | 343 | { 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64}, |
---|
| 344 | { 90, 87, 80, 70, 57, 43, 25, 9, -9,-25,-43,-57,-70,-80,-87,-90}, |
---|
| 345 | { 89, 75, 50, 18,-18,-50,-75,-89,-89,-75,-50,-18, 18, 50, 75, 89}, |
---|
| 346 | { 87, 57, 9,-43,-80,-90,-70,-25, 25, 70, 90, 80, 43, -9,-57,-87}, |
---|
| 347 | { 83, 36,-36,-83,-83,-36, 36, 83, 83, 36,-36,-83,-83,-36, 36, 83}, |
---|
| 348 | { 80, 9,-70,-87,-25, 57, 90, 43,-43,-90,-57, 25, 87, 70, -9,-80}, |
---|
| 349 | { 75,-18,-89,-50, 50, 89, 18,-75,-75, 18, 89, 50,-50,-89,-18, 75}, |
---|
| 350 | { 70,-43,-87, 9, 90, 25,-80,-57, 57, 80,-25,-90, -9, 87, 43,-70}, |
---|
| 351 | { 64,-64,-64, 64, 64,-64,-64, 64, 64,-64,-64, 64, 64,-64,-64, 64}, |
---|
| 352 | { 57,-80,-25, 90, -9,-87, 43, 70,-70,-43, 87, 9,-90, 25, 80,-57}, |
---|
| 353 | { 50,-89, 18, 75,-75,-18, 89,-50,-50, 89,-18,-75, 75, 18,-89, 50}, |
---|
| 354 | { 43,-90, 57, 25,-87, 70, 9,-80, 80, -9,-70, 87,-25,-57, 90,-43}, |
---|
| 355 | { 36,-83, 83,-36,-36, 83,-83, 36, 36,-83, 83,-36,-36, 83,-83, 36}, |
---|
| 356 | { 25,-70, 90,-80, 43, 9,-57, 87,-87, 57, -9,-43, 80,-90, 70,-25}, |
---|
| 357 | { 18,-50, 75,-89, 89,-75, 50,-18,-18, 50,-75, 89,-89, 75,-50, 18}, |
---|
| 358 | { 9,-25, 43,-57, 70,-80, 87,-90, 90,-87, 80,-70, 57,-43, 25, -9} |
---|
[2] | 359 | }; |
---|
| 360 | |
---|
[56] | 361 | const short g_aiT32[32][32] = |
---|
[2] | 362 | { |
---|
[56] | 363 | { 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64}, |
---|
| 364 | { 90, 90, 88, 85, 82, 78, 73, 67, 61, 54, 46, 38, 31, 22, 13, 4, -4,-13,-22,-31,-38,-46,-54,-61,-67,-73,-78,-82,-85,-88,-90,-90}, |
---|
| 365 | { 90, 87, 80, 70, 57, 43, 25, 9, -9,-25,-43,-57,-70,-80,-87,-90,-90,-87,-80,-70,-57,-43,-25, -9, 9, 25, 43, 57, 70, 80, 87, 90}, |
---|
| 366 | { 90, 82, 67, 46, 22, -4,-31,-54,-73,-85,-90,-88,-78,-61,-38,-13, 13, 38, 61, 78, 88, 90, 85, 73, 54, 31, 4,-22,-46,-67,-82,-90}, |
---|
| 367 | { 89, 75, 50, 18,-18,-50,-75,-89,-89,-75,-50,-18, 18, 50, 75, 89, 89, 75, 50, 18,-18,-50,-75,-89,-89,-75,-50,-18, 18, 50, 75, 89}, |
---|
| 368 | { 88, 67, 31,-13,-54,-82,-90,-78,-46, -4, 38, 73, 90, 85, 61, 22,-22,-61,-85,-90,-73,-38, 4, 46, 78, 90, 82, 54, 13,-31,-67,-88}, |
---|
| 369 | { 87, 57, 9,-43,-80,-90,-70,-25, 25, 70, 90, 80, 43, -9,-57,-87,-87,-57, -9, 43, 80, 90, 70, 25,-25,-70,-90,-80,-43, 9, 57, 87}, |
---|
| 370 | { 85, 46,-13,-67,-90,-73,-22, 38, 82, 88, 54, -4,-61,-90,-78,-31, 31, 78, 90, 61, 4,-54,-88,-82,-38, 22, 73, 90, 67, 13,-46,-85}, |
---|
| 371 | { 83, 36,-36,-83,-83,-36, 36, 83, 83, 36,-36,-83,-83,-36, 36, 83, 83, 36,-36,-83,-83,-36, 36, 83, 83, 36,-36,-83,-83,-36, 36, 83}, |
---|
| 372 | { 82, 22,-54,-90,-61, 13, 78, 85, 31,-46,-90,-67, 4, 73, 88, 38,-38,-88,-73, -4, 67, 90, 46,-31,-85,-78,-13, 61, 90, 54,-22,-82}, |
---|
| 373 | { 80, 9,-70,-87,-25, 57, 90, 43,-43,-90,-57, 25, 87, 70, -9,-80,-80, -9, 70, 87, 25,-57,-90,-43, 43, 90, 57,-25,-87,-70, 9, 80}, |
---|
| 374 | { 78, -4,-82,-73, 13, 85, 67,-22,-88,-61, 31, 90, 54,-38,-90,-46, 46, 90, 38,-54,-90,-31, 61, 88, 22,-67,-85,-13, 73, 82, 4,-78}, |
---|
| 375 | { 75,-18,-89,-50, 50, 89, 18,-75,-75, 18, 89, 50,-50,-89,-18, 75, 75,-18,-89,-50, 50, 89, 18,-75,-75, 18, 89, 50,-50,-89,-18, 75}, |
---|
| 376 | { 73,-31,-90,-22, 78, 67,-38,-90,-13, 82, 61,-46,-88, -4, 85, 54,-54,-85, 4, 88, 46,-61,-82, 13, 90, 38,-67,-78, 22, 90, 31,-73}, |
---|
| 377 | { 70,-43,-87, 9, 90, 25,-80,-57, 57, 80,-25,-90, -9, 87, 43,-70,-70, 43, 87, -9,-90,-25, 80, 57,-57,-80, 25, 90, 9,-87,-43, 70}, |
---|
| 378 | { 67,-54,-78, 38, 85,-22,-90, 4, 90, 13,-88,-31, 82, 46,-73,-61, 61, 73,-46,-82, 31, 88,-13,-90, -4, 90, 22,-85,-38, 78, 54,-67}, |
---|
| 379 | { 64,-64,-64, 64, 64,-64,-64, 64, 64,-64,-64, 64, 64,-64,-64, 64, 64,-64,-64, 64, 64,-64,-64, 64, 64,-64,-64, 64, 64,-64,-64, 64}, |
---|
| 380 | { 61,-73,-46, 82, 31,-88,-13, 90, -4,-90, 22, 85,-38,-78, 54, 67,-67,-54, 78, 38,-85,-22, 90, 4,-90, 13, 88,-31,-82, 46, 73,-61}, |
---|
| 381 | { 57,-80,-25, 90, -9,-87, 43, 70,-70,-43, 87, 9,-90, 25, 80,-57,-57, 80, 25,-90, 9, 87,-43,-70, 70, 43,-87, -9, 90,-25,-80, 57}, |
---|
| 382 | { 54,-85, -4, 88,-46,-61, 82, 13,-90, 38, 67,-78,-22, 90,-31,-73, 73, 31,-90, 22, 78,-67,-38, 90,-13,-82, 61, 46,-88, 4, 85,-54}, |
---|
| 383 | { 50,-89, 18, 75,-75,-18, 89,-50,-50, 89,-18,-75, 75, 18,-89, 50, 50,-89, 18, 75,-75,-18, 89,-50,-50, 89,-18,-75, 75, 18,-89, 50}, |
---|
| 384 | { 46,-90, 38, 54,-90, 31, 61,-88, 22, 67,-85, 13, 73,-82, 4, 78,-78, -4, 82,-73,-13, 85,-67,-22, 88,-61,-31, 90,-54,-38, 90,-46}, |
---|
| 385 | { 43,-90, 57, 25,-87, 70, 9,-80, 80, -9,-70, 87,-25,-57, 90,-43,-43, 90,-57,-25, 87,-70, -9, 80,-80, 9, 70,-87, 25, 57,-90, 43}, |
---|
| 386 | { 38,-88, 73, -4,-67, 90,-46,-31, 85,-78, 13, 61,-90, 54, 22,-82, 82,-22,-54, 90,-61,-13, 78,-85, 31, 46,-90, 67, 4,-73, 88,-38}, |
---|
| 387 | { 36,-83, 83,-36,-36, 83,-83, 36, 36,-83, 83,-36,-36, 83,-83, 36, 36,-83, 83,-36,-36, 83,-83, 36, 36,-83, 83,-36,-36, 83,-83, 36}, |
---|
| 388 | { 31,-78, 90,-61, 4, 54,-88, 82,-38,-22, 73,-90, 67,-13,-46, 85,-85, 46, 13,-67, 90,-73, 22, 38,-82, 88,-54, -4, 61,-90, 78,-31}, |
---|
| 389 | { 25,-70, 90,-80, 43, 9,-57, 87,-87, 57, -9,-43, 80,-90, 70,-25,-25, 70,-90, 80,-43, -9, 57,-87, 87,-57, 9, 43,-80, 90,-70, 25}, |
---|
| 390 | { 22,-61, 85,-90, 73,-38, -4, 46,-78, 90,-82, 54,-13,-31, 67,-88, 88,-67, 31, 13,-54, 82,-90, 78,-46, 4, 38,-73, 90,-85, 61,-22}, |
---|
| 391 | { 18,-50, 75,-89, 89,-75, 50,-18,-18, 50,-75, 89,-89, 75,-50, 18, 18,-50, 75,-89, 89,-75, 50,-18,-18, 50,-75, 89,-89, 75,-50, 18}, |
---|
| 392 | { 13,-38, 61,-78, 88,-90, 85,-73, 54,-31, 4, 22,-46, 67,-82, 90,-90, 82,-67, 46,-22, -4, 31,-54, 73,-85, 90,-88, 78,-61, 38,-13}, |
---|
| 393 | { 9,-25, 43,-57, 70,-80, 87,-90, 90,-87, 80,-70, 57,-43, 25, -9, -9, 25,-43, 57,-70, 80,-87, 90,-90, 87,-80, 70,-57, 43,-25, 9}, |
---|
| 394 | { 4,-13, 22,-31, 38,-46, 54,-61, 67,-73, 78,-82, 85,-88, 90,-90, 90,-90, 88,-85, 82,-78, 73,-67, 61,-54, 46,-38, 31,-22, 13, -4} |
---|
[2] | 395 | }; |
---|
| 396 | |
---|
| 397 | const UChar g_aucChromaScale[52]= |
---|
| 398 | { |
---|
| 399 | 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11, |
---|
| 400 | 12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27, |
---|
| 401 | 28,29,29,30,31,32,32,33,34,34,35,35,36,36,37,37, |
---|
| 402 | 37,38,38,38,39,39,39,39 |
---|
| 403 | }; |
---|
| 404 | |
---|
| 405 | |
---|
| 406 | // Mode-Dependent DCT/DST |
---|
| 407 | const short g_as_DST_MAT_4 [4][4]= |
---|
| 408 | { |
---|
| 409 | {29, 55, 74, 84}, |
---|
| 410 | {74, 74, 0 , -74}, |
---|
| 411 | {84, -29, -74, 55}, |
---|
| 412 | {55, -84, 74, -29}, |
---|
| 413 | }; |
---|
[56] | 414 | |
---|
| 415 | #if !LOGI_INTRA_NAME_3MPM |
---|
[2] | 416 | // Mapping each Unified Directional Intra prediction direction to DCT/DST transform |
---|
| 417 | // 0 implies use DCT, 1 implies DST |
---|
[56] | 418 | |
---|
| 419 | #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX |
---|
| 420 | const UChar g_aucDCTDSTMode_Vert[NUM_INTRA_MODE+NUM_DMM_MODE] = |
---|
[5] | 421 | #else |
---|
[2] | 422 | const UChar g_aucDCTDSTMode_Vert[NUM_INTRA_MODE] = |
---|
[5] | 423 | #endif |
---|
[56] | 424 | { //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 |
---|
| 425 | 1, 1, 0, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0 |
---|
[5] | 426 | #if HHI_DMM_WEDGE_INTRA && HHI_DMM_PRED_TEX |
---|
[56] | 427 | , 0, 0, 0, 0, 0, 0, 0, 0 |
---|
[5] | 428 | #elif HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX |
---|
[56] | 429 | , 0, 0, 0, 0 |
---|
[2] | 430 | #endif |
---|
| 431 | }; |
---|
[56] | 432 | #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX |
---|
| 433 | const UChar g_aucDCTDSTMode_Hor[NUM_INTRA_MODE+NUM_DMM_MODE] = |
---|
[5] | 434 | #else |
---|
[2] | 435 | const UChar g_aucDCTDSTMode_Hor[NUM_INTRA_MODE] = |
---|
[5] | 436 | #endif |
---|
[56] | 437 | { //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 |
---|
| 438 | 1, 0, 1, 0, 1, 1, 0, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0 |
---|
[5] | 439 | #if HHI_DMM_WEDGE_INTRA && HHI_DMM_PRED_TEX |
---|
[56] | 440 | , 0, 0, 0, 0, 0, 0, 0, 0 |
---|
[5] | 441 | #elif HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX |
---|
[56] | 442 | , 0, 0, 0, 0 |
---|
[2] | 443 | #endif |
---|
| 444 | }; |
---|
[56] | 445 | #endif |
---|
[2] | 446 | |
---|
| 447 | |
---|
| 448 | // ==================================================================================================================== |
---|
| 449 | // ADI |
---|
| 450 | // ==================================================================================================================== |
---|
| 451 | |
---|
| 452 | #if FAST_UDI_USE_MPM |
---|
| 453 | const UChar g_aucIntraModeNumFast[7] = |
---|
| 454 | { |
---|
| 455 | 3, // 2x2 |
---|
| 456 | 8, // 4x4 |
---|
| 457 | 8, // 8x8 |
---|
| 458 | 3, // 16x16 |
---|
| 459 | 3, // 32x32 |
---|
| 460 | 3, // 64x64 |
---|
| 461 | 3 // 128x128 |
---|
| 462 | }; |
---|
| 463 | #else // FAST_UDI_USE_MPM |
---|
| 464 | const UChar g_aucIntraModeNumFast[7] = |
---|
| 465 | { |
---|
| 466 | 3, // 2x2 |
---|
| 467 | 9, // 4x4 |
---|
| 468 | 9, // 8x8 |
---|
| 469 | 4, // 16x16 33 |
---|
| 470 | 4, // 32x32 33 |
---|
| 471 | 5, // 64x64 33 |
---|
| 472 | 4 // 128x128 33 |
---|
| 473 | }; |
---|
| 474 | #endif // FAST_UDI_USE_MPM |
---|
| 475 | |
---|
| 476 | // chroma |
---|
| 477 | |
---|
| 478 | const UChar g_aucConvertTxtTypeToIdx[4] = { 0, 1, 1, 2 }; |
---|
| 479 | |
---|
[56] | 480 | #if !LOGI_INTRA_NAME_3MPM |
---|
[2] | 481 | // ==================================================================================================================== |
---|
| 482 | // Angular Intra prediction |
---|
| 483 | // ==================================================================================================================== |
---|
| 484 | |
---|
| 485 | // g_aucAngIntraModeOrder |
---|
| 486 | // Indexing this array with the mode indicated in the bitstream |
---|
| 487 | // gives a logical index used in the prediction functions. |
---|
| 488 | const UChar g_aucAngIntraModeOrder[NUM_INTRA_MODE] = |
---|
| 489 | { // ModeOrder LogicalOrderInPredFunctions |
---|
[56] | 490 | 34, // PLANAR_IDX PLANAR PLANAR |
---|
[2] | 491 | 9, // 0 VER DC |
---|
| 492 | 25, // 1 HOR VER-8 (diagonal from top-left to bottom-right = HOR-8) |
---|
| 493 | 0, // 2 DC VER-7 |
---|
[56] | 494 | 1, // 4 VER-8 VER-6 |
---|
| 495 | 5, // 5 VER-4 VER-5 |
---|
| 496 | 13, // 6 VER+4 VER-4 |
---|
| 497 | 17, // 7 VER+8 VER-3 |
---|
| 498 | 21, // 8 HOR-4 VER-2 |
---|
| 499 | 29, // 9 HOR+4 VER-1 |
---|
| 500 | 33, // 10 HOR+8 VER |
---|
| 501 | 3, // 11 VER-6 VER+1 |
---|
| 502 | 7, // 12 VER-2 VER+2 |
---|
| 503 | 11, // 13 VER+2 VER+3 |
---|
| 504 | 15, // 14 VER+6 VER+4 |
---|
| 505 | 19, // 15 HOR-6 VER+5 |
---|
| 506 | 23, // 16 HOR-2 VER+6 |
---|
| 507 | 27, // 17 HOR+2 VER+7 |
---|
| 508 | 31, // 18 HOR+6 VER+8 |
---|
| 509 | 2, // 19 VER-7 HOR-7 |
---|
| 510 | 4, // 20 VER-5 HOR-6 |
---|
| 511 | 6, // 21 VER-3 HOR-5 |
---|
| 512 | 8, // 22 VER-1 HOR-4 |
---|
| 513 | 10, // 23 VER+1 HOR-3 |
---|
| 514 | 12, // 24 VER+3 HOR-2 |
---|
| 515 | 14, // 25 VER+5 HOR-1 |
---|
| 516 | 16, // 26 VER+7 HOR |
---|
| 517 | 18, // 27 HOR-7 HOR+1 |
---|
| 518 | 20, // 28 HOR-5 HOR+2 |
---|
| 519 | 22, // 29 HOR-3 HOR+3 |
---|
| 520 | 24, // 30 HOR-1 HOR+4 |
---|
| 521 | 26, // 31 HOR+1 HOR+5 |
---|
| 522 | 28, // 32 HOR+3 HOR+6 |
---|
| 523 | 30, // 33 HOR+5 HOR+7 |
---|
| 524 | 32, // 34 HOR+7 HOR+8 |
---|
| 525 | 0, // LM_CHROMA_IDX |
---|
[2] | 526 | }; |
---|
| 527 | |
---|
| 528 | const UChar g_aucIntraModeNumAng[7] = |
---|
| 529 | { |
---|
[56] | 530 | 4, // 2x2 |
---|
| 531 | 18, // 4x4 |
---|
| 532 | 35, // 8x8 |
---|
| 533 | 35, // 16x16 |
---|
| 534 | 35, // 32x32 |
---|
| 535 | 35, // 64x64 |
---|
| 536 | 6 // 128x128 |
---|
[2] | 537 | }; |
---|
| 538 | |
---|
| 539 | const UChar g_aucIntraModeBitsAng[7] = |
---|
| 540 | { |
---|
| 541 | 2, // 2x2 3 1+1 |
---|
| 542 | 5, // 4x4 17 4+1 |
---|
| 543 | 6, // 8x8 34 5+esc |
---|
| 544 | 6, // 16x16 34 5+esc |
---|
| 545 | 6, // 32x32 34 5+esc |
---|
[56] | 546 | 6, // 64x64 34 5+esc |
---|
[2] | 547 | 3 // 128x128 5 2+1 |
---|
| 548 | }; |
---|
[56] | 549 | #endif |
---|
[2] | 550 | |
---|
[56] | 551 | // ==================================================================================================================== |
---|
| 552 | // Bit-depth |
---|
| 553 | // ==================================================================================================================== |
---|
[2] | 554 | |
---|
[56] | 555 | UInt g_uiBitDepth = 8; // base bit-depth |
---|
| 556 | UInt g_uiBitIncrement = 0; // increments |
---|
| 557 | UInt g_uiIBDI_MAX = 255; // max. value after IBDI |
---|
| 558 | UInt g_uiBASE_MAX = 255; // max. value before IBDI |
---|
| 559 | |
---|
| 560 | UInt g_uiPCMBitDepthLuma = 8; // PCM bit-depth |
---|
| 561 | UInt g_uiPCMBitDepthChroma = 8; // PCM bit-depth |
---|
| 562 | |
---|
| 563 | // ==================================================================================================================== |
---|
| 564 | // Depth model modes |
---|
| 565 | // ==================================================================================================================== |
---|
[5] | 566 | #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX |
---|
[56] | 567 | Int g_iDeltaDCsQuantOffset = 0; |
---|
| 568 | |
---|
[2] | 569 | const WedgeResolution g_aeWedgeResolutionList[5] = |
---|
| 570 | { |
---|
| 571 | HALF_PEL, // 4x4 |
---|
| 572 | HALF_PEL, // 8x8 |
---|
| 573 | FULL_PEL, // 16x16 |
---|
| 574 | DOUBLE_PEL, // 32x32 |
---|
| 575 | DOUBLE_PEL // 64x64 |
---|
| 576 | }; |
---|
| 577 | |
---|
| 578 | const UChar g_aucWedgeFullBitsListIdx[7] = |
---|
| 579 | { |
---|
| 580 | 0, // 2x2 |
---|
| 581 | 7, // 4x4 WedgeListSize[ HALF_PEL] 86 |
---|
| 582 | 10, // 8x8 WedgeListSize[ HALF_PEL] 782 |
---|
| 583 | 11, // 16x16 WedgeListSize[ FULL_PEL] 1394 |
---|
| 584 | 11, // 32x32 WedgeListSize[DOUBLE_PEL] 1503 |
---|
| 585 | 13, // 64x64 WedgeListSize[DOUBLE_PEL] 6079 |
---|
| 586 | 0 // 128x128 |
---|
| 587 | }; |
---|
| 588 | |
---|
| 589 | const UChar g_aucIntraSizeIdxToWedgeSize[7] = |
---|
| 590 | { |
---|
| 591 | 2, |
---|
| 592 | 4, |
---|
| 593 | 8, |
---|
| 594 | 16, |
---|
| 595 | 32, |
---|
| 596 | 64, |
---|
[56] | 597 | 128 |
---|
[2] | 598 | }; |
---|
| 599 | #endif |
---|
| 600 | |
---|
| 601 | // ==================================================================================================================== |
---|
[56] | 602 | // Misc. |
---|
[2] | 603 | // ==================================================================================================================== |
---|
| 604 | |
---|
| 605 | Char g_aucConvertToBit [ MAX_CU_SIZE+1 ]; |
---|
| 606 | |
---|
| 607 | #if ENC_DEC_TRACE |
---|
| 608 | FILE* g_hTrace = NULL; |
---|
| 609 | const Bool g_bEncDecTraceEnable = true; |
---|
| 610 | const Bool g_bEncDecTraceDisable = false; |
---|
| 611 | Bool g_bJustDoIt = false; |
---|
| 612 | UInt64 g_nSymbolCounter = 0; |
---|
| 613 | #endif |
---|
| 614 | // ==================================================================================================================== |
---|
| 615 | // Scanning order & context model mapping |
---|
| 616 | // ==================================================================================================================== |
---|
| 617 | |
---|
| 618 | // scanning order table |
---|
| 619 | UInt* g_auiFrameScanXY[ MAX_CU_DEPTH ]; |
---|
| 620 | UInt* g_auiFrameScanX [ MAX_CU_DEPTH ]; |
---|
| 621 | UInt* g_auiFrameScanY [ MAX_CU_DEPTH ]; |
---|
[56] | 622 | UInt* g_auiSigLastScan[4][ MAX_CU_DEPTH ]; |
---|
| 623 | UInt *g_sigScanNSQT[ 4 ]; // scan for non-square partitions |
---|
| 624 | UInt g_sigCGScanNSQT[ 4 ][ 16 ] = |
---|
| 625 | { |
---|
| 626 | { 0, 1, 2, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, |
---|
| 627 | { 0, 2, 1, 4, 3, 6, 5, 8, 7, 10, 9, 12, 11, 14, 13, 15 }, |
---|
| 628 | { 0, 1, 2, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, |
---|
| 629 | { 0, 8, 1, 9, 2, 10, 3, 11, 4, 12, 5, 13, 6, 14, 7, 15 } |
---|
| 630 | }; |
---|
[2] | 631 | |
---|
[56] | 632 | #if MULTILEVEL_SIGMAP_EXT |
---|
| 633 | const UInt g_sigLastScan8x8[ 4 ][ 4 ] = |
---|
[2] | 634 | { |
---|
[56] | 635 | {0, 1, 2, 3}, |
---|
| 636 | {0, 1, 2, 3}, |
---|
| 637 | {0, 1, 2, 3}, |
---|
| 638 | {0, 2, 1, 3} |
---|
[2] | 639 | }; |
---|
[56] | 640 | UInt g_sigLastScanCG32x32[ 64 ]; |
---|
| 641 | #endif |
---|
[2] | 642 | |
---|
[56] | 643 | UInt* g_auiNonSquareSigLastScan[ 4 ]; |
---|
| 644 | |
---|
| 645 | const UInt g_uiMinInGroup[ 10 ] = {0,1,2,3,4,6,8,12,16,24}; |
---|
| 646 | const UInt g_uiGroupIdx[ 32 ] = {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}; |
---|
| 647 | #if LAST_CTX_REDUCTION |
---|
| 648 | const UInt g_uiLastCtx[ 28 ] = |
---|
[2] | 649 | { |
---|
[56] | 650 | 0, 1, 2, 2, // 4x4 4 |
---|
| 651 | 3, 4, 5, 5, 2, 2, // 8x8 6 |
---|
| 652 | 6, 7, 8, 8, 9, 9, 2, 2, // 16x16 8 |
---|
| 653 | 10, 11, 12, 12, 13, 13, 14, 14, 2, 2 // 32x32 10 |
---|
[2] | 654 | }; |
---|
[56] | 655 | #else |
---|
| 656 | const UInt g_uiLastCtx[ 28 ] = |
---|
| 657 | { |
---|
| 658 | 0, 1, 2, 2, // 4x4 4 |
---|
| 659 | 3, 4, 5, 5, 6, 6, // 8x8 6 |
---|
| 660 | 7, 8, 9, 9, 10, 10, 11, 11, // 16x16 8 |
---|
| 661 | 12, 13, 14, 14, 15, 15, 16, 16, 17, 17 // 32x32 10 |
---|
| 662 | }; |
---|
[2] | 663 | #endif |
---|
| 664 | |
---|
[56] | 665 | // Rice parameters for absolute transform levels |
---|
| 666 | #if EIGHT_BITS_RICE_CODE |
---|
| 667 | const UInt g_auiGoRiceRange[5] = |
---|
| 668 | { |
---|
| 669 | 7, 14, 26, 46, 78 |
---|
| 670 | }; |
---|
[2] | 671 | |
---|
[56] | 672 | const UInt g_auiGoRicePrefixLen[5] = |
---|
| 673 | { |
---|
| 674 | 8, 7, 6, 5, 4 |
---|
| 675 | }; |
---|
| 676 | #else |
---|
[2] | 677 | const UInt g_auiGoRiceRange[4] = |
---|
| 678 | { |
---|
| 679 | 7, 20, 42, 70 |
---|
| 680 | }; |
---|
| 681 | |
---|
| 682 | const UInt g_auiGoRicePrefixLen[4] = |
---|
| 683 | { |
---|
[56] | 684 | 8, 10, 10, 8 |
---|
[2] | 685 | }; |
---|
[56] | 686 | #endif |
---|
[2] | 687 | |
---|
[56] | 688 | #if EIGHT_BITS_RICE_CODE |
---|
| 689 | const UInt g_aauiGoRiceUpdate[5][24] = |
---|
| 690 | { |
---|
| 691 | #if RESTRICT_GR1GR2FLAG_NUMBER |
---|
| 692 | { |
---|
| 693 | 0, 0, 0, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4 |
---|
| 694 | }, |
---|
| 695 | { |
---|
| 696 | 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4 |
---|
| 697 | }, |
---|
| 698 | { |
---|
| 699 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4 |
---|
| 700 | }, |
---|
| 701 | { |
---|
| 702 | 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4 |
---|
| 703 | }, |
---|
| 704 | { |
---|
| 705 | 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4 |
---|
| 706 | } |
---|
| 707 | #else |
---|
| 708 | { |
---|
| 709 | 0, 0, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4 |
---|
| 710 | }, |
---|
| 711 | { |
---|
| 712 | 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4 |
---|
| 713 | }, |
---|
| 714 | { |
---|
| 715 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4 |
---|
| 716 | }, |
---|
| 717 | { |
---|
| 718 | 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4 |
---|
| 719 | }, |
---|
| 720 | { |
---|
| 721 | 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4 |
---|
| 722 | } |
---|
| 723 | #endif |
---|
| 724 | }; |
---|
| 725 | #else |
---|
[2] | 726 | const UInt g_aauiGoRiceUpdate[4][16] = |
---|
| 727 | { |
---|
[56] | 728 | #if RESTRICT_GR1GR2FLAG_NUMBER |
---|
[2] | 729 | { |
---|
[56] | 730 | 0, 0, 0, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, |
---|
[2] | 731 | }, |
---|
[56] | 732 | { |
---|
| 733 | 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, |
---|
| 734 | }, |
---|
| 735 | { |
---|
| 736 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, |
---|
| 737 | }, |
---|
| 738 | { |
---|
| 739 | 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, |
---|
| 740 | } |
---|
| 741 | #else |
---|
[2] | 742 | { |
---|
[56] | 743 | 0, 0, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3 |
---|
[2] | 744 | }, |
---|
| 745 | { |
---|
[56] | 746 | 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3 |
---|
[2] | 747 | }, |
---|
| 748 | { |
---|
[56] | 749 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3 |
---|
| 750 | }, |
---|
| 751 | { |
---|
[2] | 752 | 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 |
---|
| 753 | } |
---|
[56] | 754 | #endif |
---|
[2] | 755 | }; |
---|
| 756 | #endif |
---|
| 757 | |
---|
| 758 | // initialize g_auiFrameScanXY |
---|
| 759 | Void initFrameScanXY( UInt* pBuff, UInt* pBuffX, UInt* pBuffY, Int iWidth, Int iHeight ) |
---|
| 760 | { |
---|
| 761 | Int x, y, c = 0; |
---|
| 762 | |
---|
| 763 | // starting point |
---|
| 764 | pBuffX[ c ] = 0; |
---|
| 765 | pBuffY[ c ] = 0; |
---|
| 766 | pBuff[ c++ ] = 0; |
---|
| 767 | |
---|
| 768 | // loop |
---|
| 769 | x=1; y=0; |
---|
| 770 | while (1) |
---|
| 771 | { |
---|
| 772 | // decrease loop |
---|
| 773 | while ( x>=0 ) |
---|
| 774 | { |
---|
| 775 | if ( x >= 0 && x < iWidth && y >= 0 && y < iHeight ) |
---|
| 776 | { |
---|
| 777 | pBuffX[ c ] = x; |
---|
| 778 | pBuffY[ c ] = y; |
---|
| 779 | pBuff[ c++ ] = x+y*iWidth; |
---|
| 780 | } |
---|
| 781 | x--; y++; |
---|
| 782 | } |
---|
| 783 | x=0; |
---|
| 784 | |
---|
| 785 | // increase loop |
---|
| 786 | while ( y>=0 ) |
---|
| 787 | { |
---|
| 788 | if ( x >= 0 && x < iWidth && y >= 0 && y < iHeight ) |
---|
| 789 | { |
---|
| 790 | pBuffX[ c ] = x; |
---|
| 791 | pBuffY[ c ] = y; |
---|
| 792 | pBuff[ c++ ] = x+y*iWidth; |
---|
| 793 | } |
---|
| 794 | x++; y--; |
---|
| 795 | } |
---|
| 796 | y=0; |
---|
| 797 | |
---|
| 798 | // termination condition |
---|
| 799 | if ( c >= iWidth*iHeight ) break; |
---|
[56] | 800 | } |
---|
| 801 | } |
---|
| 802 | |
---|
| 803 | Void initSigLastScan(UInt* pBuffZ, UInt* pBuffH, UInt* pBuffV, UInt* pBuffD, Int iWidth, Int iHeight, Int iDepth) |
---|
| 804 | { |
---|
| 805 | const UInt uiNumScanPos = UInt( iWidth * iWidth ); |
---|
| 806 | UInt uiNextScanPos = 0; |
---|
| 807 | |
---|
| 808 | if( iWidth < 16 ) |
---|
| 809 | { |
---|
| 810 | #if MULTILEVEL_SIGMAP_EXT |
---|
| 811 | UInt* pBuffTemp = pBuffD; |
---|
| 812 | if( iWidth == 8 ) |
---|
| 813 | { |
---|
| 814 | pBuffTemp = g_sigLastScanCG32x32; |
---|
[2] | 815 | } |
---|
[56] | 816 | #endif |
---|
| 817 | for( UInt uiScanLine = 0; uiNextScanPos < uiNumScanPos; uiScanLine++ ) |
---|
| 818 | { |
---|
| 819 | int iPrimDim = int( uiScanLine ); |
---|
| 820 | int iScndDim = 0; |
---|
| 821 | while( iPrimDim >= iWidth ) |
---|
| 822 | { |
---|
| 823 | iScndDim++; |
---|
| 824 | iPrimDim--; |
---|
| 825 | } |
---|
| 826 | while( iPrimDim >= 0 && iScndDim < iWidth ) |
---|
| 827 | { |
---|
| 828 | #if MULTILEVEL_SIGMAP_EXT |
---|
| 829 | pBuffTemp[ uiNextScanPos ] = iPrimDim * iWidth + iScndDim ; |
---|
| 830 | #else |
---|
| 831 | pBuffD[ uiNextScanPos ] = iPrimDim * iWidth + iScndDim ; |
---|
| 832 | #endif |
---|
| 833 | uiNextScanPos++; |
---|
| 834 | iScndDim++; |
---|
| 835 | iPrimDim--; |
---|
| 836 | } |
---|
| 837 | } |
---|
| 838 | } |
---|
| 839 | #if MULTILEVEL_SIGMAP_EXT |
---|
| 840 | if( iWidth > 4 ) |
---|
| 841 | #else |
---|
| 842 | else |
---|
| 843 | #endif |
---|
| 844 | { |
---|
| 845 | UInt uiNumBlkSide = iWidth >> 2; |
---|
| 846 | UInt uiNumBlks = uiNumBlkSide * uiNumBlkSide; |
---|
| 847 | UInt log2Blk = g_aucConvertToBit[ uiNumBlkSide ] + 1; |
---|
| 848 | |
---|
| 849 | for( UInt uiBlk = 0; uiBlk < uiNumBlks; uiBlk++ ) |
---|
| 850 | { |
---|
| 851 | uiNextScanPos = 0; |
---|
| 852 | UInt initBlkPos = g_auiSigLastScan[ SCAN_DIAG ][ log2Blk ][ uiBlk ]; |
---|
| 853 | #if MULTILEVEL_SIGMAP_EXT |
---|
| 854 | if( iWidth == 32 ) |
---|
| 855 | { |
---|
| 856 | initBlkPos = g_sigLastScanCG32x32[ uiBlk ]; |
---|
| 857 | } |
---|
| 858 | #endif |
---|
| 859 | UInt offsetY = initBlkPos / uiNumBlkSide; |
---|
| 860 | UInt offsetX = initBlkPos - offsetY * uiNumBlkSide; |
---|
| 861 | UInt offsetD = 4 * ( offsetX + offsetY * iWidth ); |
---|
| 862 | UInt offsetScan = 16 * uiBlk; |
---|
| 863 | for( UInt uiScanLine = 0; uiNextScanPos < 16; uiScanLine++ ) |
---|
| 864 | { |
---|
| 865 | int iPrimDim = int( uiScanLine ); |
---|
| 866 | int iScndDim = 0; |
---|
| 867 | while( iPrimDim >= 4 ) |
---|
| 868 | { |
---|
| 869 | iScndDim++; |
---|
| 870 | iPrimDim--; |
---|
| 871 | } |
---|
| 872 | while( iPrimDim >= 0 && iScndDim < 4 ) |
---|
| 873 | { |
---|
| 874 | pBuffD[ uiNextScanPos + offsetScan ] = iPrimDim * iWidth + iScndDim + offsetD; |
---|
| 875 | uiNextScanPos++; |
---|
| 876 | iScndDim++; |
---|
| 877 | iPrimDim--; |
---|
| 878 | } |
---|
| 879 | } |
---|
| 880 | } |
---|
| 881 | } |
---|
[2] | 882 | |
---|
[56] | 883 | memcpy(pBuffZ, g_auiFrameScanXY[iDepth], sizeof(UInt)*iWidth*iHeight); |
---|
| 884 | |
---|
| 885 | UInt uiCnt = 0; |
---|
| 886 | for(Int iY=0; iY < iHeight; iY++) |
---|
[2] | 887 | { |
---|
[56] | 888 | for(Int iX=0; iX < iWidth; iX++) |
---|
[2] | 889 | { |
---|
[56] | 890 | pBuffH[uiCnt] = iY*iWidth + iX; |
---|
| 891 | uiCnt ++; |
---|
[2] | 892 | } |
---|
| 893 | } |
---|
[56] | 894 | |
---|
| 895 | uiCnt = 0; |
---|
| 896 | for(Int iX=0; iX < iWidth; iX++) |
---|
| 897 | { |
---|
| 898 | for(Int iY=0; iY < iHeight; iY++) |
---|
| 899 | { |
---|
| 900 | pBuffV[uiCnt] = iY*iWidth + iX; |
---|
| 901 | uiCnt ++; |
---|
| 902 | } |
---|
| 903 | } |
---|
[2] | 904 | } |
---|
| 905 | |
---|
[56] | 906 | Void initNonSquareSigLastScan(UInt* pBuffZ, UInt uiWidth, UInt uiHeight) |
---|
[2] | 907 | { |
---|
| 908 | |
---|
[56] | 909 | Int x, y, c = 0; |
---|
[2] | 910 | |
---|
[56] | 911 | // starting point |
---|
| 912 | pBuffZ[ c++ ] = 0; |
---|
| 913 | |
---|
| 914 | // loop |
---|
| 915 | if ( uiWidth > uiHeight ) |
---|
| 916 | { |
---|
| 917 | x=0; y=1; |
---|
| 918 | while (1) |
---|
[2] | 919 | { |
---|
[56] | 920 | // increase loop |
---|
| 921 | while ( y>=0 ) |
---|
[2] | 922 | { |
---|
[56] | 923 | if ( x >= 0 && x < uiWidth && y >= 0 && y < uiHeight ) |
---|
| 924 | { |
---|
| 925 | pBuffZ[ c++ ] = x + y * uiWidth; |
---|
| 926 | } |
---|
| 927 | x++; |
---|
| 928 | y--; |
---|
[2] | 929 | } |
---|
[56] | 930 | y=0; |
---|
| 931 | |
---|
| 932 | // decrease loop |
---|
| 933 | while ( x>=0 ) |
---|
| 934 | { |
---|
| 935 | if ( x >= 0 && x < uiWidth && y >= 0 && y < uiHeight ) |
---|
| 936 | { |
---|
| 937 | pBuffZ[ c++ ] = x + y * uiWidth; |
---|
| 938 | } |
---|
| 939 | x--; |
---|
| 940 | y++; |
---|
| 941 | } |
---|
| 942 | x=0; |
---|
| 943 | |
---|
| 944 | // termination condition |
---|
| 945 | if ( c >= uiWidth * uiHeight ) |
---|
| 946 | break; |
---|
[2] | 947 | } |
---|
[56] | 948 | } |
---|
| 949 | else |
---|
| 950 | { |
---|
| 951 | x=1; y=0; |
---|
| 952 | while (1) |
---|
[2] | 953 | { |
---|
[56] | 954 | // increase loop |
---|
| 955 | while ( x>=0 ) |
---|
[2] | 956 | { |
---|
[56] | 957 | if ( x >= 0 && x < uiWidth && y >= 0 && y < uiHeight ) |
---|
| 958 | { |
---|
| 959 | pBuffZ[ c++ ] = x + y * uiWidth; |
---|
| 960 | } |
---|
| 961 | x--; |
---|
| 962 | y++; |
---|
[2] | 963 | } |
---|
[56] | 964 | x=0; |
---|
| 965 | |
---|
| 966 | // decrease loop |
---|
| 967 | while ( y>=0 ) |
---|
| 968 | { |
---|
| 969 | if ( x >= 0 && x < uiWidth && y >= 0 && y < uiHeight ) |
---|
| 970 | { |
---|
| 971 | pBuffZ[ c++ ] = x + y * uiWidth; |
---|
| 972 | } |
---|
| 973 | x++; |
---|
| 974 | y--; |
---|
| 975 | } |
---|
| 976 | y=0; |
---|
| 977 | |
---|
| 978 | // termination condition |
---|
| 979 | if ( c >= uiWidth * uiHeight ) |
---|
| 980 | break; |
---|
[2] | 981 | } |
---|
[56] | 982 | } |
---|
[2] | 983 | } |
---|
| 984 | |
---|
[56] | 985 | #if SCALING_LIST |
---|
| 986 | Int g_quantIntraDefault4x4[16] = |
---|
[2] | 987 | { |
---|
[56] | 988 | 16,16,17,21, |
---|
| 989 | 16,17,20,25, |
---|
| 990 | 17,20,30,41, |
---|
| 991 | 21,25,41,70 |
---|
[2] | 992 | }; |
---|
[56] | 993 | Int g_quantInterDefault4x4[16] = |
---|
| 994 | { |
---|
| 995 | 16,16,17,21, |
---|
| 996 | 16,17,21,24, |
---|
| 997 | 17,21,24,36, |
---|
| 998 | 21,24,36,57 |
---|
| 999 | }; |
---|
| 1000 | |
---|
| 1001 | Int g_quantIntraDefault8x8[64] = |
---|
| 1002 | { |
---|
| 1003 | 16,16,16,16,17,18,21,24, |
---|
| 1004 | 16,16,16,16,17,19,22,25, |
---|
| 1005 | 16,16,17,18,20,22,25,29, |
---|
| 1006 | 16,16,18,21,24,27,31,36, |
---|
| 1007 | 17,17,20,24,30,35,41,47, |
---|
| 1008 | 18,19,22,27,35,44,54,65, |
---|
| 1009 | 21,22,25,31,41,54,70,88, |
---|
| 1010 | 24,25,29,36,47,65,88,115 |
---|
| 1011 | }; |
---|
| 1012 | |
---|
| 1013 | Int g_quantInterDefault8x8[64] = |
---|
| 1014 | { |
---|
| 1015 | 16,16,16,16,17,18,20,24, |
---|
| 1016 | 16,16,16,17,18,20,24,25, |
---|
| 1017 | 16,16,17,18,20,24,25,28, |
---|
| 1018 | 16,17,18,20,24,25,28,33, |
---|
| 1019 | 17,18,20,24,25,28,33,41, |
---|
| 1020 | 18,20,24,25,28,33,41,54, |
---|
| 1021 | 20,24,25,28,33,41,54,71, |
---|
| 1022 | 24,25,28,33,41,54,71,91 |
---|
| 1023 | }; |
---|
| 1024 | #else |
---|
| 1025 | Int g_quantIntraDefault4x4[16] = |
---|
| 1026 | { |
---|
| 1027 | 6,13,20,28, |
---|
| 1028 | 13,20,28,32, |
---|
| 1029 | 20,28,32,37, |
---|
| 1030 | 28,32,37,42 |
---|
| 1031 | }; |
---|
| 1032 | Int g_quantInterDefault4x4[16] = |
---|
| 1033 | { |
---|
| 1034 | 10,14,20,24, |
---|
| 1035 | 14,20,24,27, |
---|
| 1036 | 20,24,27,30, |
---|
| 1037 | 24,27,30,34 |
---|
| 1038 | }; |
---|
| 1039 | |
---|
| 1040 | Int g_quantIntraDefault8x8[64] = |
---|
| 1041 | { |
---|
| 1042 | 6,10,13,16,18,23,25,27, |
---|
| 1043 | 10,11,16,18,23,25,27,29, |
---|
| 1044 | 13,16,18,23,25,27,29,31, |
---|
| 1045 | 16,18,23,25,27,29,31,33, |
---|
| 1046 | 18,23,25,27,29,31,33,36, |
---|
| 1047 | 23,25,27,29,31,33,36,38, |
---|
| 1048 | 25,27,29,31,33,36,38,40, |
---|
| 1049 | 27,29,31,33,36,38,40,42 |
---|
| 1050 | }; |
---|
| 1051 | |
---|
| 1052 | Int g_quantInterDefault8x8[64] = |
---|
| 1053 | { |
---|
| 1054 | 9,13,15,17,19,21,22,24, |
---|
| 1055 | 13,13,17,19,21,22,24,25, |
---|
| 1056 | 15,17,19,21,22,24,25,27, |
---|
| 1057 | 17,19,21,22,24,25,27,28, |
---|
| 1058 | 19,21,22,24,25,27,28,30, |
---|
| 1059 | 21,22,24,25,27,28,30,32, |
---|
| 1060 | 22,24,25,27,28,30,32,33, |
---|
| 1061 | 24,25,27,28,30,32,33,35 |
---|
| 1062 | }; |
---|
| 1063 | |
---|
| 1064 | Int g_quantIntraDefault16x16[256] = |
---|
| 1065 | { |
---|
| 1066 | 16,16,16,16,16,16,16,16,17,17,18,19,21,22,24,27, |
---|
| 1067 | 16,16,16,16,16,16,16,16,17,18,18,20,21,23,25,27, |
---|
| 1068 | 16,16,16,16,16,16,16,17,17,18,19,20,22,23,25,28, |
---|
| 1069 | 16,16,16,16,16,16,17,17,18,19,20,21,23,25,27,29, |
---|
| 1070 | 16,16,16,16,17,17,18,19,20,21,22,23,25,27,29,31, |
---|
| 1071 | 16,16,16,16,17,18,19,20,22,23,24,26,27,29,32,34, |
---|
| 1072 | 16,16,16,17,18,19,21,23,24,25,27,29,31,33,36,39, |
---|
| 1073 | 16,16,17,17,19,20,23,25,27,29,31,33,35,38,41,44, |
---|
| 1074 | 17,17,17,18,20,22,24,27,30,32,35,38,41,44,47,51, |
---|
| 1075 | 17,18,18,19,21,23,25,29,32,36,40,43,47,51,55,60, |
---|
| 1076 | 18,18,19,20,22,24,27,31,35,40,44,49,54,59,65,70, |
---|
| 1077 | 19,20,20,21,23,26,29,33,38,43,49,56,62,69,75,82, |
---|
| 1078 | 21,21,22,23,25,27,31,35,41,47,54,62,70,79,88,97, |
---|
| 1079 | 22,23,23,25,27,29,33,38,44,51,59,69,79,90,101,113, |
---|
| 1080 | 24,25,25,27,29,32,36,41,47,55,65,75,88,101,115,130, |
---|
| 1081 | 27,27,28,29,31,34,39,44,51,60,70,82,97,113,130,149 |
---|
| 1082 | }; |
---|
| 1083 | |
---|
| 1084 | Int g_quantInterDefault16x16[256] = |
---|
| 1085 | { |
---|
| 1086 | 16,16,16,16,16,16,16,16,17,17,18,19,20,21,22,27, |
---|
| 1087 | 16,16,16,16,16,16,16,17,17,18,19,20,21,22,27,27, |
---|
| 1088 | 16,16,16,16,16,16,17,17,18,19,20,21,22,27,27,28, |
---|
| 1089 | 16,16,16,16,16,17,17,18,19,20,21,22,27,27,28,29, |
---|
| 1090 | 16,16,16,16,17,17,18,19,20,21,22,27,27,28,29,30, |
---|
| 1091 | 16,16,16,17,17,18,19,20,21,22,27,27,28,29,30,32, |
---|
| 1092 | 16,16,17,17,18,19,20,21,22,27,27,28,29,30,32,36, |
---|
| 1093 | 16,17,17,18,19,20,21,22,27,27,28,29,30,32,36,40, |
---|
| 1094 | 17,17,18,19,20,21,22,27,27,28,29,30,32,36,40,45, |
---|
| 1095 | 17,18,19,20,21,22,27,27,28,29,30,32,36,40,45,52, |
---|
| 1096 | 18,19,20,21,22,27,27,28,29,30,32,36,40,45,52,59, |
---|
| 1097 | 19,20,21,22,27,27,28,29,30,32,36,40,45,52,59,68, |
---|
| 1098 | 20,21,22,27,27,28,29,30,32,36,40,45,52,59,68,79, |
---|
| 1099 | 21,22,27,27,28,29,30,32,36,40,45,52,59,68,79,91, |
---|
| 1100 | 22,27,27,28,29,30,32,36,40,45,52,59,68,79,91,103, |
---|
| 1101 | 27,27,28,29,30,32,36,40,45,52,59,68,79,91,103,117 |
---|
| 1102 | }; |
---|
| 1103 | |
---|
| 1104 | Int g_quantIntraDefault32x32[1024] = |
---|
| 1105 | { |
---|
| 1106 | 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,17,17,17,18,18,19,19,20,21,22,22,23,24,25,27,28, |
---|
| 1107 | 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,17,17,17,18,18,19,19,20,21,22,23,23,24,25,27,28, |
---|
| 1108 | 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,17,17,17,18,18,18,19,20,20,21,22,23,24,25,26,27,28, |
---|
| 1109 | 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,17,17,17,18,18,19,19,20,21,21,22,23,24,25,26,27,28, |
---|
| 1110 | 16,16,16,16,16,16,16,16,16,16,16,16,16,16,17,17,17,18,18,19,19,20,20,21,22,23,23,24,25,26,28,29, |
---|
| 1111 | 16,16,16,16,16,16,16,16,16,16,16,16,16,17,17,17,18,18,18,19,19,20,21,21,22,23,24,25,26,27,28,30, |
---|
| 1112 | 16,16,16,16,16,16,16,16,16,16,16,17,17,17,17,18,18,19,19,20,20,21,21,22,23,24,25,26,27,28,29,30, |
---|
| 1113 | 16,16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,19,19,20,20,21,21,22,23,24,25,26,27,28,29,30,31, |
---|
| 1114 | 16,16,16,16,16,16,16,16,17,17,17,18,18,18,19,19,20,20,21,21,22,22,23,24,25,26,27,28,29,30,31,33, |
---|
| 1115 | 16,16,16,16,16,16,16,17,17,17,18,18,19,19,20,20,20,21,22,22,23,23,24,25,26,27,28,29,30,31,33,34, |
---|
| 1116 | 16,16,16,16,16,16,16,17,17,18,18,19,19,20,20,21,22,22,23,23,24,25,26,26,27,28,29,30,32,33,34,36, |
---|
| 1117 | 16,16,16,16,16,16,17,17,18,18,19,20,20,21,21,22,23,23,24,25,25,26,27,28,29,30,31,32,33,35,36,38, |
---|
| 1118 | 16,16,16,16,16,16,17,17,18,19,19,20,21,22,23,23,24,25,25,26,27,28,29,30,31,32,33,34,36,37,39,40, |
---|
| 1119 | 16,16,16,16,16,17,17,18,18,19,20,21,22,23,24,24,25,26,27,28,29,30,31,32,33,34,35,37,38,39,41,43, |
---|
| 1120 | 16,16,16,16,17,17,17,18,19,20,20,21,23,24,25,26,27,28,29,30,31,32,33,34,35,36,38,39,41,42,44,46, |
---|
| 1121 | 16,16,17,17,17,17,18,18,19,20,21,22,23,24,26,27,28,29,31,32,33,34,35,37,38,39,41,42,44,45,47,49, |
---|
| 1122 | 17,17,17,17,17,18,18,19,20,20,22,23,24,25,27,28,30,31,32,34,35,36,38,39,41,42,44,45,47,49,51,53, |
---|
| 1123 | 17,17,17,17,18,18,19,19,20,21,22,23,25,26,28,29,31,33,34,36,37,39,41,42,44,45,47,49,51,53,55,57, |
---|
| 1124 | 17,17,18,18,18,18,19,20,21,22,23,24,25,27,29,31,32,34,36,38,40,42,43,45,47,49,51,53,55,57,60,62, |
---|
| 1125 | 18,18,18,18,19,19,20,20,21,22,23,25,26,28,30,32,34,36,38,40,42,44,46,48,51,53,55,57,60,62,65,67, |
---|
| 1126 | 18,18,18,19,19,19,20,21,22,23,24,25,27,29,31,33,35,37,40,42,44,47,49,52,54,57,59,62,65,67,70,73, |
---|
| 1127 | 19,19,19,19,20,20,21,21,22,23,25,26,28,30,32,34,36,39,42,44,47,50,52,55,58,61,64,67,70,73,76,79, |
---|
| 1128 | 19,19,20,20,20,21,21,22,23,24,26,27,29,31,33,35,38,41,43,46,49,52,56,59,62,65,69,72,75,79,82,86, |
---|
| 1129 | 20,20,20,21,21,21,22,23,24,25,26,28,30,32,34,37,39,42,45,48,52,55,59,62,66,70,74,77,81,85,89,93, |
---|
| 1130 | 21,21,21,21,22,22,23,24,25,26,27,29,31,33,35,38,41,44,47,51,54,58,62,66,70,74,79,83,88,92,97,101, |
---|
| 1131 | 22,22,22,22,23,23,24,25,26,27,28,30,32,34,36,39,42,45,49,53,57,61,65,70,74,79,84,89,94,99,104,110, |
---|
| 1132 | 22,23,23,23,23,24,25,26,27,28,29,31,33,35,38,41,44,47,51,55,59,64,69,74,79,84,90,95,101,107,113,119, |
---|
| 1133 | 23,23,24,24,24,25,26,27,28,29,30,32,34,37,39,42,45,49,53,57,62,67,72,77,83,89,95,101,108,114,121,128, |
---|
| 1134 | 24,24,25,25,25,26,27,28,29,30,32,33,36,38,41,44,47,51,55,60,65,70,75,81,88,94,101,108,115,122,130,138, |
---|
| 1135 | 25,25,26,26,26,27,28,29,30,31,33,35,37,39,42,45,49,53,57,62,67,73,79,85,92,99,107,114,122,131,139,148, |
---|
| 1136 | 27,27,27,27,28,28,29,30,31,33,34,36,39,41,44,47,51,55,60,65,70,76,82,89,97,104,113,121,130,139,149,159, |
---|
| 1137 | 28,28,28,28,29,30,30,31,33,34,36,38,40,43,46,49,53,57,62,67,73,79,86,93,101,110,119,128,138,148,159,170 |
---|
| 1138 | }; |
---|
| 1139 | |
---|
| 1140 | Int g_quantInterDefault32x32[1024] = |
---|
| 1141 | { |
---|
| 1142 | 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,17,17,17,18,18,19,19,20,21,22,22,23,24,25,26,28, |
---|
| 1143 | 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,17,17,17,18,18,19,19,20,21,22,22,23,24,25,26,28,28, |
---|
| 1144 | 16,16,16,16,16,16,16,16,16,16,16,16,16,16,17,17,17,18,18,19,19,20,21,22,22,23,24,25,26,28,28,28, |
---|
| 1145 | 16,16,16,16,16,16,16,16,16,16,16,16,16,17,17,17,18,18,19,19,20,21,22,22,23,24,25,26,28,28,28,28, |
---|
| 1146 | 16,16,16,16,16,16,16,16,16,16,16,16,17,17,17,18,18,19,19,20,21,22,22,23,24,25,26,28,28,28,28,29, |
---|
| 1147 | 16,16,16,16,16,16,16,16,16,16,16,17,17,17,18,18,19,19,20,21,22,22,23,24,25,26,28,28,28,28,29,30, |
---|
| 1148 | 16,16,16,16,16,16,16,16,16,16,17,17,17,18,18,19,19,20,21,22,22,23,24,25,26,28,28,28,28,29,30,30, |
---|
| 1149 | 16,16,16,16,16,16,16,16,16,17,17,17,18,18,19,19,20,21,22,22,23,24,25,26,28,28,28,28,29,30,30,31, |
---|
| 1150 | 16,16,16,16,16,16,16,16,17,17,17,18,18,19,19,20,21,22,22,23,24,25,26,28,28,28,28,29,30,30,31,32, |
---|
| 1151 | 16,16,16,16,16,16,16,17,17,17,18,18,19,19,20,21,22,22,23,24,25,26,28,28,28,28,29,30,30,31,32,33, |
---|
| 1152 | 16,16,16,16,16,16,17,17,17,18,18,19,19,20,21,22,22,23,24,25,26,28,28,28,28,29,30,30,31,32,33,34, |
---|
| 1153 | 16,16,16,16,16,17,17,17,18,18,19,19,20,21,22,22,23,24,25,26,28,28,28,28,29,30,30,31,32,33,34,35, |
---|
| 1154 | 16,16,16,16,17,17,17,18,18,19,19,20,21,22,22,23,24,25,26,28,28,28,28,29,30,30,31,32,33,34,35,36, |
---|
| 1155 | 16,16,16,17,17,17,18,18,19,19,20,21,22,22,23,24,25,26,28,28,28,28,29,30,30,31,32,33,34,35,36,38, |
---|
| 1156 | 16,16,17,17,17,18,18,19,19,20,21,22,22,23,24,25,26,28,28,28,28,29,30,30,31,32,33,34,35,36,38,40, |
---|
| 1157 | 16,17,17,17,18,18,19,19,20,21,22,22,23,24,25,26,28,28,28,28,29,30,30,31,32,33,34,35,36,38,40,42, |
---|
| 1158 | 17,17,17,18,18,19,19,20,21,22,22,23,24,25,26,28,28,28,28,29,30,30,31,32,33,34,35,36,38,40,42,45, |
---|
| 1159 | 17,17,18,18,19,19,20,21,22,22,23,24,25,26,28,28,28,28,29,30,30,31,32,33,34,35,36,38,40,42,45,48, |
---|
| 1160 | 17,18,18,19,19,20,21,22,22,23,24,25,26,28,28,28,28,29,30,30,31,32,33,34,35,36,38,40,42,45,48,52, |
---|
| 1161 | 18,18,19,19,20,21,22,22,23,24,25,26,28,28,28,28,29,30,30,31,32,33,34,35,36,38,40,42,45,48,52,56, |
---|
| 1162 | 18,19,19,20,21,22,22,23,24,25,26,28,28,28,28,29,30,30,31,32,33,34,35,36,38,40,42,45,48,52,56,60, |
---|
| 1163 | 19,19,20,21,22,22,23,24,25,26,28,28,28,28,29,30,30,31,32,33,34,35,36,38,40,42,45,48,52,56,60,64, |
---|
| 1164 | 19,20,21,22,22,23,24,25,26,28,28,28,28,29,30,30,31,32,33,34,35,36,38,40,42,45,48,52,56,60,64,69, |
---|
| 1165 | 20,21,22,22,23,24,25,26,28,28,28,28,29,30,30,31,32,33,34,35,36,38,40,42,45,48,52,56,60,64,69,74, |
---|
| 1166 | 21,22,22,23,24,25,26,28,28,28,28,29,30,30,31,32,33,34,35,36,38,40,42,45,48,52,56,60,64,69,74,80, |
---|
| 1167 | 22,22,23,24,25,26,28,28,28,28,29,30,30,31,32,33,34,35,36,38,40,42,45,48,52,56,60,64,69,74,80,87, |
---|
| 1168 | 22,23,24,25,26,28,28,28,28,29,30,30,31,32,33,34,35,36,38,40,42,45,48,52,56,60,64,69,74,80,87,94, |
---|
| 1169 | 23,24,25,26,28,28,28,28,29,30,30,31,32,33,34,35,36,38,40,42,45,48,52,56,60,64,69,74,80,87,94,101, |
---|
| 1170 | 24,25,26,28,28,28,28,29,30,30,31,32,33,34,35,36,38,40,42,45,48,52,56,60,64,69,74,80,87,94,101,108, |
---|
| 1171 | 25,26,28,28,28,28,29,30,30,31,32,33,34,35,36,38,40,42,45,48,52,56,60,64,69,74,80,87,94,101,108,115, |
---|
| 1172 | 26,28,28,28,28,29,30,30,31,32,33,34,35,36,38,40,42,45,48,52,56,60,64,69,74,80,87,94,101,108,115,123, |
---|
| 1173 | 28,28,28,28,29,30,30,31,32,33,34,35,36,38,40,42,45,48,52,56,60,64,69,74,80,87,94,101,108,115,123,131 |
---|
| 1174 | }; |
---|
[2] | 1175 | #endif |
---|
[56] | 1176 | UInt g_scalingListSize [4] = {16,64,256,1024}; |
---|
| 1177 | UInt g_scalingListSizeX [4] = { 4, 8, 16, 32}; |
---|
| 1178 | UInt g_scalingListNum[SCALING_LIST_SIZE_NUM]={6,6,6,2}; |
---|
| 1179 | Int g_eTTable[4] = {0,3,1,2}; |
---|
[2] | 1180 | |
---|
[5] | 1181 | #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX |
---|
[56] | 1182 | std::vector< std::vector<TComWedgelet> > g_aacWedgeLists; |
---|
| 1183 | std::vector< std::vector<TComWedgeRef> > g_aacWedgeRefLists; |
---|
[2] | 1184 | |
---|
[213] | 1185 | #if HHIQC_DMMFASTSEARCH_B0039 |
---|
| 1186 | std::vector< std::vector< std::vector<UInt> > > g_aauiWdgLstM3; |
---|
| 1187 | std::vector< std::vector< TComWedgeNode> > g_aacWedgeNodeLists; |
---|
| 1188 | #endif |
---|
| 1189 | |
---|
[2] | 1190 | Void initWedgeLists() |
---|
| 1191 | { |
---|
| 1192 | for( UInt ui = g_aucConvertToBit[DMM_WEDGEMODEL_MIN_SIZE]; ui < (g_aucConvertToBit[DMM_WEDGEMODEL_MAX_SIZE]+1); ui++ ) |
---|
| 1193 | { |
---|
| 1194 | UInt uiWedgeBlockSize = ((UInt)DMM_WEDGEMODEL_MIN_SIZE)<<ui; |
---|
| 1195 | std::vector<TComWedgelet> acWedgeList; |
---|
| 1196 | std::vector<TComWedgeRef> acWedgeRefList; |
---|
| 1197 | createWedgeList( uiWedgeBlockSize, uiWedgeBlockSize, acWedgeList, acWedgeRefList, g_aeWedgeResolutionList[ui] ); |
---|
| 1198 | g_aacWedgeLists.push_back( acWedgeList ); |
---|
| 1199 | g_aacWedgeRefLists.push_back( acWedgeRefList ); |
---|
[213] | 1200 | |
---|
| 1201 | #if HHIQC_DMMFASTSEARCH_B0039 |
---|
| 1202 | // create WedgeNodeList |
---|
| 1203 | std::vector<TComWedgeNode> acWedgeNodeList; |
---|
| 1204 | for( UInt uiPos = 0; uiPos < acWedgeList.size(); uiPos++ ) |
---|
| 1205 | { |
---|
| 1206 | if( acWedgeList[uiPos].getIsCoarse() ) |
---|
| 1207 | { |
---|
| 1208 | TComWedgeNode cWedgeNode; |
---|
| 1209 | cWedgeNode.setPatternIdx( uiPos ); |
---|
| 1210 | |
---|
| 1211 | // set refinement idxs |
---|
| 1212 | UInt uiRefPos = 0; |
---|
| 1213 | for( Int iOffS = -1; iOffS <= 1; iOffS++ ) |
---|
| 1214 | { |
---|
| 1215 | for( Int iOffE = -1; iOffE <= 1; iOffE++ ) |
---|
| 1216 | { |
---|
| 1217 | if( iOffS == 0 && iOffE == 0 ) { continue; } |
---|
| 1218 | |
---|
| 1219 | Int iSx = (Int)acWedgeList[uiPos].getStartX(); |
---|
| 1220 | Int iSy = (Int)acWedgeList[uiPos].getStartY(); |
---|
| 1221 | Int iEx = (Int)acWedgeList[uiPos].getEndX(); |
---|
| 1222 | Int iEy = (Int)acWedgeList[uiPos].getEndY(); |
---|
| 1223 | |
---|
| 1224 | switch( acWedgeList[uiPos].getOri() ) |
---|
| 1225 | { |
---|
| 1226 | case( 0 ): { iSx += iOffS; iEy += iOffE; } break; |
---|
| 1227 | case( 1 ): { iSy += iOffS; iEx -= iOffE; } break; |
---|
| 1228 | case( 2 ): { iSx -= iOffS; iEy -= iOffE; } break; |
---|
| 1229 | case( 3 ): { iSy -= iOffS; iEx += iOffE; } break; |
---|
| 1230 | case( 4 ): { iSx += iOffS; iEx += iOffE; } break; |
---|
| 1231 | case( 5 ): { iSy += iOffS; iEy += iOffE; } break; |
---|
| 1232 | default: assert( 0 ); |
---|
| 1233 | } |
---|
| 1234 | |
---|
| 1235 | for( UInt k = 0; k < acWedgeRefList.size(); k++ ) |
---|
| 1236 | { |
---|
| 1237 | if( iSx == (Int)acWedgeRefList[k].getStartX() && |
---|
| 1238 | iSy == (Int)acWedgeRefList[k].getStartY() && |
---|
| 1239 | iEx == (Int)acWedgeRefList[k].getEndX() && |
---|
| 1240 | iEy == (Int)acWedgeRefList[k].getEndY() ) |
---|
| 1241 | { |
---|
| 1242 | if( acWedgeRefList[k].getRefIdx() != cWedgeNode.getPatternIdx() ) |
---|
| 1243 | { |
---|
| 1244 | Bool bNew = true; |
---|
| 1245 | for( UInt m = 0; m < uiRefPos; m++ ) { if( acWedgeRefList[k].getRefIdx() == cWedgeNode.getRefineIdx( m ) ) { bNew = false; break; } } |
---|
| 1246 | |
---|
| 1247 | if( bNew ) |
---|
| 1248 | { |
---|
| 1249 | cWedgeNode.setRefineIdx( acWedgeRefList[k].getRefIdx(), uiRefPos ); |
---|
| 1250 | uiRefPos++; |
---|
| 1251 | break; |
---|
| 1252 | } |
---|
| 1253 | } |
---|
| 1254 | } |
---|
| 1255 | } |
---|
| 1256 | } |
---|
| 1257 | } |
---|
| 1258 | acWedgeNodeList.push_back( cWedgeNode ); |
---|
| 1259 | } |
---|
| 1260 | } |
---|
| 1261 | g_aacWedgeNodeLists.push_back( acWedgeNodeList ); |
---|
| 1262 | #endif |
---|
[2] | 1263 | } |
---|
| 1264 | return; |
---|
| 1265 | } |
---|
| 1266 | |
---|
| 1267 | Void createWedgeList( UInt uiWidth, UInt uiHeight, std::vector<TComWedgelet> &racWedgeList, std::vector<TComWedgeRef> &racWedgeRefList, WedgeResolution eWedgeRes ) |
---|
| 1268 | { |
---|
| 1269 | assert( uiWidth == uiHeight ); |
---|
| 1270 | |
---|
[77] | 1271 | UChar uhStartX = 0, uhStartY = 0, uhEndX = 0, uhEndY = 0; |
---|
| 1272 | Int iStepStartX = 0, iStepStartY = 0, iStepEndX = 0, iStepEndY = 0; |
---|
[56] | 1273 | |
---|
[2] | 1274 | UInt uiBlockSize = 0; |
---|
| 1275 | switch( eWedgeRes ) |
---|
| 1276 | { |
---|
| 1277 | case( DOUBLE_PEL ): { uiBlockSize = (uiWidth>>1); break; } |
---|
| 1278 | case( FULL_PEL ): { uiBlockSize = uiWidth; break; } |
---|
| 1279 | case( HALF_PEL ): { uiBlockSize = (uiWidth<<1); break; } |
---|
| 1280 | } |
---|
| 1281 | |
---|
| 1282 | TComWedgelet cTempWedgelet( uiWidth, uiHeight ); |
---|
| 1283 | for( UInt uiOri = 0; uiOri < 6; uiOri++ ) |
---|
| 1284 | { |
---|
| 1285 | // init the edge line parameters for each of the 6 wedgelet types |
---|
| 1286 | switch( uiOri ) |
---|
| 1287 | { |
---|
| 1288 | case( 0 ): { uhStartX = 0; uhStartY = 0; uhEndX = 0; uhEndY = 0; iStepStartX = +1; iStepStartY = 0; iStepEndX = 0; iStepEndY = +1; break; } |
---|
| 1289 | case( 1 ): { uhStartX = (uiBlockSize-1); uhStartY = 0; uhEndX = (uiBlockSize-1); uhEndY = 0; iStepStartX = 0; iStepStartY = +1; iStepEndX = -1; iStepEndY = 0; break; } |
---|
| 1290 | case( 2 ): { uhStartX = (uiBlockSize-1); uhStartY = (uiBlockSize-1); uhEndX = (uiBlockSize-1); uhEndY = (uiBlockSize-1); iStepStartX = -1; iStepStartY = 0; iStepEndX = 0; iStepEndY = -1; break; } |
---|
| 1291 | case( 3 ): { uhStartX = 0; uhStartY = (uiBlockSize-1); uhEndX = 0; uhEndY = (uiBlockSize-1); iStepStartX = 0; iStepStartY = -1; iStepEndX = +1; iStepEndY = 0; break; } |
---|
| 1292 | case( 4 ): { uhStartX = 0; uhStartY = 0; uhEndX = 0; uhEndY = (uiBlockSize-1); iStepStartX = +1; iStepStartY = 0; iStepEndX = +1; iStepEndY = 0; break; } |
---|
| 1293 | case( 5 ): { uhStartX = (uiBlockSize-1); uhStartY = 0; uhEndX = 0; uhEndY = 0; iStepStartX = 0; iStepStartY = +1; iStepEndX = 0; iStepEndY = +1; break; } |
---|
| 1294 | } |
---|
| 1295 | |
---|
| 1296 | for( Int iK = 0; iK < uiBlockSize; iK++ ) |
---|
| 1297 | { |
---|
| 1298 | for( Int iL = 0; iL < uiBlockSize; iL++ ) |
---|
[56] | 1299 | { |
---|
[213] | 1300 | #if HHIQC_DMMFASTSEARCH_B0039 |
---|
| 1301 | cTempWedgelet.setWedgelet( uhStartX + (iK*iStepStartX) , uhStartY + (iK*iStepStartY), uhEndX + (iL*iStepEndX), uhEndY + (iL*iStepEndY), (UChar)uiOri, eWedgeRes, ((iL%2)==0 && (iK%2)==0) ); |
---|
| 1302 | #else |
---|
[2] | 1303 | cTempWedgelet.setWedgelet( uhStartX + (iK*iStepStartX) , uhStartY + (iK*iStepStartY), uhEndX + (iL*iStepEndX), uhEndY + (iL*iStepEndY), (UChar)uiOri, eWedgeRes ); |
---|
[213] | 1304 | #endif |
---|
[56] | 1305 | addWedgeletToList( cTempWedgelet, racWedgeList, racWedgeRefList ); |
---|
| 1306 | } |
---|
| 1307 | } |
---|
| 1308 | } |
---|
[213] | 1309 | #if HHIQC_DMMFASTSEARCH_B0039 |
---|
| 1310 | UInt uiThrSz = DMM3_SIMPLIFY_TR; |
---|
| 1311 | |
---|
| 1312 | std::vector< std::vector<UInt> > auiWdgListSz; |
---|
| 1313 | for( Int idxM=2; idxM<=34 ; idxM++) |
---|
| 1314 | { |
---|
| 1315 | std::vector<UInt> auiWdgList; |
---|
| 1316 | for( Int idxW=0; idxW<racWedgeList.size(); idxW++) |
---|
| 1317 | { |
---|
| 1318 | UInt uiAbsDiff = abs(idxM-(Int)racWedgeList[idxW].getAng()); |
---|
| 1319 | if( uiAbsDiff <= uiThrSz ) |
---|
| 1320 | { |
---|
| 1321 | auiWdgList.push_back(idxW); |
---|
| 1322 | } |
---|
| 1323 | } |
---|
| 1324 | auiWdgListSz.push_back(auiWdgList); |
---|
| 1325 | } |
---|
| 1326 | g_aauiWdgLstM3.push_back(auiWdgListSz); |
---|
| 1327 | #endif |
---|
[56] | 1328 | } |
---|
[2] | 1329 | |
---|
[56] | 1330 | Void addWedgeletToList( TComWedgelet cWedgelet, std::vector<TComWedgelet> &racWedgeList, std::vector<TComWedgeRef> &racWedgeRefList ) |
---|
| 1331 | { |
---|
| 1332 | Bool bValid = cWedgelet.checkNotPlain(); |
---|
| 1333 | if( bValid ) |
---|
| 1334 | { |
---|
| 1335 | for( UInt uiPos = 0; uiPos < racWedgeList.size(); uiPos++ ) |
---|
| 1336 | { |
---|
| 1337 | if( cWedgelet.checkIdentical( racWedgeList[uiPos].getPattern() ) ) |
---|
| 1338 | { |
---|
| 1339 | TComWedgeRef cWedgeRef; |
---|
| 1340 | cWedgeRef.setWedgeRef( cWedgelet.getStartX(), cWedgelet.getStartY(), cWedgelet.getEndX(), cWedgelet.getEndY(), uiPos ); |
---|
| 1341 | racWedgeRefList.push_back( cWedgeRef ); |
---|
| 1342 | bValid = false; |
---|
| 1343 | return; |
---|
[2] | 1344 | } |
---|
| 1345 | } |
---|
| 1346 | } |
---|
[56] | 1347 | if( bValid ) |
---|
| 1348 | { |
---|
| 1349 | for( UInt uiPos = 0; uiPos < racWedgeList.size(); uiPos++ ) |
---|
| 1350 | { |
---|
| 1351 | if( cWedgelet.checkInvIdentical( racWedgeList[uiPos].getPattern() ) ) |
---|
| 1352 | { |
---|
| 1353 | TComWedgeRef cWedgeRef; |
---|
| 1354 | cWedgeRef.setWedgeRef( cWedgelet.getStartX(), cWedgelet.getStartY(), cWedgelet.getEndX(), cWedgelet.getEndY(), uiPos ); |
---|
| 1355 | racWedgeRefList.push_back( cWedgeRef ); |
---|
| 1356 | bValid = false; |
---|
| 1357 | return; |
---|
| 1358 | } |
---|
| 1359 | } |
---|
| 1360 | } |
---|
| 1361 | if( bValid ) |
---|
| 1362 | { |
---|
[213] | 1363 | #if HHIQC_DMMFASTSEARCH_B0039 |
---|
| 1364 | cWedgelet.findClosetAngle(); |
---|
| 1365 | #endif |
---|
[56] | 1366 | racWedgeList.push_back( cWedgelet ); |
---|
| 1367 | TComWedgeRef cWedgeRef; |
---|
| 1368 | cWedgeRef.setWedgeRef( cWedgelet.getStartX(), cWedgelet.getStartY(), cWedgelet.getEndX(), cWedgelet.getEndY(), (UInt)(racWedgeList.size()-1) ); |
---|
| 1369 | racWedgeRefList.push_back( cWedgeRef ); |
---|
| 1370 | } |
---|
[2] | 1371 | } |
---|
| 1372 | #endif |
---|
[56] | 1373 | |
---|
| 1374 | //! \} |
---|