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