diff --git a/source/Lib/CommonLib/TrQuant.cpp b/source/Lib/CommonLib/TrQuant.cpp
index 2327718..69451f7 100644
a
|
b
|
void TrQuant::xT( const TransformUnit &tu, const ComponentID &compID, const CPel |
396 | 396 | const unsigned maxLog2TrDynamicRange = tu.cs->sps->getMaxLog2TrDynamicRange( toChannelType( compID ) ); |
397 | 397 | const unsigned bitDepth = tu.cs->sps->getBitDepth( toChannelType( compID ) ); |
398 | 398 | const int TRANSFORM_MATRIX_SHIFT = g_transformMatrixShift[TRANSFORM_FORWARD]; |
| 399 | #if !JVET_M0102_INTRA_SUBPARTITIONS |
399 | 400 | const int shift_1st = ((g_aucLog2[width ]) + bitDepth + TRANSFORM_MATRIX_SHIFT) - maxLog2TrDynamicRange + COM16_C806_TRANS_PREC; |
400 | 401 | const int shift_2nd = (g_aucLog2[height]) + TRANSFORM_MATRIX_SHIFT + COM16_C806_TRANS_PREC; |
| 402 | #endif |
401 | 403 | const uint32_t transformWidthIndex = g_aucLog2[width ] - 1; // nLog2WidthMinus1, since transform start from 2-point |
402 | 404 | const uint32_t transformHeightIndex = g_aucLog2[height] - 1; // nLog2HeightMinus1, since transform start from 2-point |
403 | 405 | #if !JVET_M0297_32PT_MTS_ZERO_OUT |
… |
… |
void TrQuant::xT( const TransformUnit &tu, const ComponentID &compID, const CPel |
405 | 407 | const int skipHeight = height > JVET_C0024_ZERO_OUT_TH ? height - JVET_C0024_ZERO_OUT_TH : 0; |
406 | 408 | #endif |
407 | 409 | |
| 410 | #if !JVET_M0102_INTRA_SUBPARTITIONS |
408 | 411 | CHECK( shift_1st < 0, "Negative shift" ); |
409 | 412 | CHECK( shift_2nd < 0, "Negative shift" ); |
| 413 | #endif |
410 | 414 | |
411 | 415 | int trTypeHor = DCT2; |
412 | 416 | int trTypeVer = DCT2; |
… |
… |
void TrQuant::xT( const TransformUnit &tu, const ComponentID &compID, const CPel |
441 | 445 | #if JVET_M0102_INTRA_SUBPARTITIONS |
442 | 446 | if( width > 1 && height > 1 ) // 2-D transform |
443 | 447 | { |
| 448 | const int shift_1st = ((g_aucLog2[width ]) + bitDepth + TRANSFORM_MATRIX_SHIFT) - maxLog2TrDynamicRange + COM16_C806_TRANS_PREC; |
| 449 | const int shift_2nd = (g_aucLog2[height]) + TRANSFORM_MATRIX_SHIFT + COM16_C806_TRANS_PREC; |
| 450 | CHECK( shift_1st < 0, "Negative shift" ); |
| 451 | CHECK( shift_2nd < 0, "Negative shift" ); |
444 | 452 | #endif |
445 | 453 | TCoeff *tmp = ( TCoeff * ) alloca( width * height * sizeof( TCoeff ) ); |
446 | 454 | |
… |
… |
void TrQuant::xT( const TransformUnit &tu, const ComponentID &compID, const CPel |
450 | 458 | } |
451 | 459 | else if( height == 1 ) //1-D horizontal transform |
452 | 460 | { |
| 461 | const int shift = ((g_aucLog2[width ]) + bitDepth + TRANSFORM_MATRIX_SHIFT) - maxLog2TrDynamicRange + COM16_C806_TRANS_PREC; |
| 462 | CHECK( shift < 0, "Negative shift" ); |
453 | 463 | CHECKD( ( transformWidthIndex < 0 ), "There is a problem with the width." ); |
454 | | fastFwdTrans[trTypeHor][transformWidthIndex]( block, dstCoeff.buf, shift_1st, 1, 0, skipWidth ); |
| 464 | fastFwdTrans[trTypeHor][transformWidthIndex]( block, dstCoeff.buf, shift, 1, 0, skipWidth ); |
455 | 465 | } |
456 | 466 | else //if (iWidth == 1) //1-D vertical transform |
457 | 467 | { |
| 468 | int shift = ( ( g_aucLog2[height] ) + bitDepth + TRANSFORM_MATRIX_SHIFT ) - maxLog2TrDynamicRange + COM16_C806_TRANS_PREC; |
| 469 | CHECK( shift < 0, "Negative shift" ); |
458 | 470 | CHECKD( ( transformHeightIndex < 0 ), "There is a problem with the height." ); |
459 | | int newShift = ( ( g_aucLog2[height] ) + bitDepth + TRANSFORM_MATRIX_SHIFT ) - maxLog2TrDynamicRange + COM16_C806_TRANS_PREC; |
460 | | fastFwdTrans[trTypeVer][transformHeightIndex]( block, dstCoeff.buf, newShift, 1, 0, skipHeight ); |
| 471 | fastFwdTrans[trTypeVer][transformHeightIndex]( block, dstCoeff.buf, shift, 1, 0, skipHeight ); |
461 | 472 | } |
462 | 473 | #endif |
463 | 474 | } |
… |
… |
void TrQuant::xIT( const TransformUnit &tu, const ComponentID &compID, const CCo |
471 | 482 | const int TRANSFORM_MATRIX_SHIFT = g_transformMatrixShift[TRANSFORM_INVERSE]; |
472 | 483 | const TCoeff clipMinimum = -( 1 << maxLog2TrDynamicRange ); |
473 | 484 | const TCoeff clipMaximum = ( 1 << maxLog2TrDynamicRange ) - 1; |
| 485 | #if !JVET_M0102_INTRA_SUBPARTITIONS |
474 | 486 | const int shift_1st = TRANSFORM_MATRIX_SHIFT + 1 + COM16_C806_TRANS_PREC; // 1 has been added to shift_1st at the expense of shift_2nd |
475 | 487 | const int shift_2nd = ( TRANSFORM_MATRIX_SHIFT + maxLog2TrDynamicRange - 1 ) - bitDepth + COM16_C806_TRANS_PREC; |
| 488 | #endif |
476 | 489 | const uint32_t transformWidthIndex = g_aucLog2[width ] - 1; // nLog2WidthMinus1, since transform start from 2-point |
477 | 490 | const uint32_t transformHeightIndex = g_aucLog2[height] - 1; // nLog2HeightMinus1, since transform start from 2-point |
478 | 491 | #if !JVET_M0297_32PT_MTS_ZERO_OUT |
… |
… |
void TrQuant::xIT( const TransformUnit &tu, const ComponentID &compID, const CCo |
480 | 493 | const int skipHeight = height > JVET_C0024_ZERO_OUT_TH ? height - JVET_C0024_ZERO_OUT_TH : 0; |
481 | 494 | #endif |
482 | 495 | |
| 496 | #if !JVET_M0102_INTRA_SUBPARTITIONS |
483 | 497 | CHECK( shift_1st < 0, "Negative shift" ); |
484 | 498 | CHECK( shift_2nd < 0, "Negative shift" ); |
485 | | |
| 499 | #endif |
| 500 | |
486 | 501 | int trTypeHor = DCT2; |
487 | 502 | int trTypeVer = DCT2; |
488 | 503 | |
… |
… |
void TrQuant::xIT( const TransformUnit &tu, const ComponentID &compID, const CCo |
501 | 516 | #if JVET_M0102_INTRA_SUBPARTITIONS |
502 | 517 | if( width > 1 && height > 1 ) //2-D transform |
503 | 518 | { |
| 519 | const int shift_1st = TRANSFORM_MATRIX_SHIFT + 1 + COM16_C806_TRANS_PREC; // 1 has been added to shift_1st at the expense of shift_2nd |
| 520 | const int shift_2nd = ( TRANSFORM_MATRIX_SHIFT + maxLog2TrDynamicRange - 1 ) - bitDepth + COM16_C806_TRANS_PREC; |
| 521 | CHECK( shift_1st < 0, "Negative shift" ); |
| 522 | CHECK( shift_2nd < 0, "Negative shift" ); |
504 | 523 | TCoeff *tmp = ( TCoeff * ) alloca( width * height * sizeof( TCoeff ) ); |
505 | 524 | #endif |
506 | 525 | fastInvTrans[trTypeVer][transformHeightIndex](pCoeff.buf, tmp, shift_1st, width, skipWidth, skipHeight, clipMinimum, clipMaximum); |
… |
… |
void TrQuant::xIT( const TransformUnit &tu, const ComponentID &compID, const CCo |
509 | 528 | } |
510 | 529 | else if( width == 1 ) //1-D vertical transform |
511 | 530 | { |
| 531 | int shift = ( TRANSFORM_MATRIX_SHIFT + maxLog2TrDynamicRange - 1 ) - bitDepth + COM16_C806_TRANS_PREC; |
| 532 | CHECK( shift < 0, "Negative shift" ); |
512 | 533 | CHECK( ( transformHeightIndex < 0 ), "There is a problem with the height." ); |
513 | | int newShift = ( TRANSFORM_MATRIX_SHIFT + maxLog2TrDynamicRange - 1 ) - bitDepth + COM16_C806_TRANS_PREC; |
514 | | fastInvTrans[trTypeVer][transformHeightIndex]( pCoeff.buf, block, newShift + 1, 1, 0, skipHeight, clipMinimum, clipMaximum ); |
| 534 | fastInvTrans[trTypeVer][transformHeightIndex]( pCoeff.buf, block, shift + 1, 1, 0, skipHeight, clipMinimum, clipMaximum ); |
515 | 535 | } |
516 | 536 | else //if(iHeight == 1) //1-D horizontal transform |
517 | 537 | { |
| 538 | const int shift = ( TRANSFORM_MATRIX_SHIFT + maxLog2TrDynamicRange - 1 ) - bitDepth + COM16_C806_TRANS_PREC; |
| 539 | CHECK( shift < 0, "Negative shift" ); |
518 | 540 | CHECK( ( transformWidthIndex < 0 ), "There is a problem with the width." ); |
519 | | fastInvTrans[trTypeHor][transformWidthIndex]( pCoeff.buf, block, shift_2nd + 1, 1, 0, skipWidth, clipMinimum, clipMaximum ); |
| 541 | fastInvTrans[trTypeHor][transformWidthIndex]( pCoeff.buf, block, shift + 1, 1, 0, skipWidth, clipMinimum, clipMaximum ); |
520 | 542 | } |
521 | 543 | #endif |
522 | 544 | |