Changeset 1605 in SHVCSoftware


Ignore:
Timestamp:
10 Jan 2018, 22:45:06 (7 years ago)
Author:
seregin
Message:

fix overflow related to scalability ratio calculation

Location:
branches/SHM-dev/source/Lib
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/SHM-dev/source/Lib/TLibCommon/TComDataCU.cpp

    r1600 r1605  
    32523252
    32533253  const Window &windowRL = m_pcSlice->getPPS()->getRefLayerWindowForLayer(baseColPic->getSlice(0)->getVPS()->getRefLayerId(getSlice()->getLayerId(), refLayerIdc));
    3254   Int iBX = (((iPelX - leftStartL) * posScalingFactor[0][refLayerIdc] + (1<<15)) >> 16) + windowRL.getWindowLeftOffset();
    3255   Int iBY = (((iPelY - topStartL ) * posScalingFactor[1][refLayerIdc] + (1<<15)) >> 16) + windowRL.getWindowTopOffset();
     3254  Int iBX = Int( ( Int64( iPelX - leftStartL ) * posScalingFactor[0][refLayerIdc] + ( 1 << 15 ) ) >> 16 ) + windowRL.getWindowLeftOffset();
     3255  Int iBY = Int( ( Int64( iPelY - topStartL  ) * posScalingFactor[1][refLayerIdc] + ( 1 << 15 ) ) >> 16 ) + windowRL.getWindowTopOffset();
    32563256
    32573257  // offset for collocated block in the motion mapping
  • branches/SHM-dev/source/Lib/TLibCommon/TComUpsampleFilter.cpp

    r1503 r1605  
    271271    {
    272272      Int x = i;
    273       refPos16 = (((x - phaseXL)*scaleX - addX) >> shiftXM4) + refOffsetX;
     273      refPos16 = Int( ( Int64( x - phaseXL )*scaleX - addX ) >> shiftXM4 ) + refOffsetX;
    274274      phase    = refPos16 & 15;
    275275      refPos   = refPos16 >> 4;
     
    300300    {
    301301      Int y = j;
    302       refPos16 = ((( y - phaseYL )*scaleY - addY) >> shiftYM4) + refOffsetY;
     302      refPos16 = Int( ( Int64( y - phaseYL )*scaleY - addY ) >> shiftYM4 ) + refOffsetY;
    303303      phase    = refPos16 & 15;
    304304      refPos   = refPos16 >> 4;
     
    400400    {
    401401      Int x = i;
    402       refPos16 = (((x - srlLOffsetC)*scaleX - addX) >> shiftXM4) + refOffsetXC;
     402      refPos16 = Int( ( Int64( x - srlLOffsetC )*scaleX - addX ) >> shiftXM4 ) + refOffsetXC;
    403403      phase    = refPos16 & 15;
    404404      refPos   = refPos16 >> 4;
     
    448448    {
    449449      Int y = j;
    450       refPos16 = (((y - srlTOffsetC)*scaleY - addY) >> shiftYM4) + refOffsetYC;
     450      refPos16 = Int( ( Int64( y - srlTOffsetC )*scaleY - addY ) >> shiftYM4 ) + refOffsetYC;
    451451      phase    = refPos16 & 15;
    452452      refPos   = refPos16 >> 4;
  • branches/SHM-dev/source/Lib/TLibDecoder/TDecTop.cpp

    r1600 r1605  
    17151715                                     heightEL == heightBL ? MV_SCALING_FACTOR_1X : Clip3(-4096, 4095, ((heightEL << 8) + (heightBL >> 1)) / heightBL) );
    17161716
    1717         m_pcPic->setPosScalingFactor( refLayerIdc,
    1718                                      ((widthBL  << 16) + (widthEL  >> 1)) / widthEL,
    1719                                      ((heightBL << 16) + (heightEL >> 1)) / heightEL );
     1717        m_pcPic->setPosScalingFactor( refLayerIdc, ( ( Int64( widthBL ) << 16 ) + ( widthEL >> 1 ) ) / widthEL, ( ( Int64( heightBL ) << 16 ) + ( heightEL >> 1 ) ) / heightEL );
    17201718
    17211719        TComPicYuv* pBaseColRec = pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec();
  • branches/SHM-dev/source/Lib/TLibEncoder/TEncGOP.cpp

    r1588 r1605  
    16631663                                               heightEL == heightBL ? MV_SCALING_FACTOR_1X : Clip3(-4096, 4095, ((heightEL << 8) + (heightBL >> 1)) / heightBL) );
    16641664
    1665         pcSlice->getPic()->setPosScalingFactor( refLayerIdc,
    1666                                                 ((widthBL  << 16) + (widthEL  >> 1)) / widthEL,
    1667                                                 ((heightBL << 16) + (heightEL >> 1)) / heightEL );
     1665        pcSlice->getPic()->setPosScalingFactor( refLayerIdc, ( ( Int64( widthBL ) << 16 ) + ( widthEL >> 1 ) ) / widthEL, ( ( Int64( heightBL ) << 16 ) + ( heightEL >> 1 ) ) / heightEL );
    16681666
    16691667        TComPicYuv* pBaseColRec = pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec();
Note: See TracChangeset for help on using the changeset viewer.