Changeset 1232 in SHVCSoftware for branches/SHM-dev/source


Ignore:
Timestamp:
9 Jul 2015, 00:59:44 (9 years ago)
Author:
seregin
Message:

port rev 4184

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/SHM-dev/source/Lib/TLibEncoder/TEncGOP.cpp

    r1228 r1232  
    27132713
    27142714    // pcSlice is currently slice 0.
    2715     Int64 binCountsInNalUnits   = 0; // For implementation of cabac_zero_word stuffing (section 7.4.3.10)
    2716     Int64 numBytesInVclNalUnits = 0; // For implementation of cabac_zero_word stuffing (section 7.4.3.10)
     2715    std::size_t binCountsInNalUnits   = 0; // For implementation of cabac_zero_word stuffing (section 7.4.3.10)
     2716    std::size_t numBytesInVclNalUnits = 0; // For implementation of cabac_zero_word stuffing (section 7.4.3.10)
    27172717
    27182718    for( UInt sliceSegmentStartCtuTsAddr = 0, sliceIdxCount=0; sliceSegmentStartCtuTsAddr < pcPic->getPicSym()->getNumberOfCtusInFrame(); sliceIdxCount++, sliceSegmentStartCtuTsAddr=pcSlice->getSliceSegmentCurEndCtuTsAddr() )
     
    28292829      accessUnit.push_back(new NALUnitEBSP(nalu));
    28302830      actualTotalBits += UInt(accessUnit.back()->m_nalUnitData.str().size()) * 8;
    2831       numBytesInVclNalUnits += Int64(accessUnit.back()->m_nalUnitData.str().size());
     2831      numBytesInVclNalUnits += (std::size_t)(accessUnit.back()->m_nalUnitData.str().size());
    28322832      bNALUAlignedWrittenToList = true;
    28332833
     
    28742874      const Int rawBits = paddedWidth * paddedHeight *
    28752875                             (g_bitDepth[CHANNEL_TYPE_LUMA] + 2*(g_bitDepth[CHANNEL_TYPE_CHROMA]>>log2subWidthCxsubHeightC));
    2876       const Int64 threshold = (32LL/3)*numBytesInVclNalUnits + (rawBits/32);
     2876      const std::size_t threshold = (32/3)*numBytesInVclNalUnits + (rawBits/32);
    28772877      if (binCountsInNalUnits >= threshold)
    28782878      {
    28792879        // need to add additional cabac zero words (each one accounts for 3 bytes (=00 00 03)) to increase numBytesInVclNalUnits
    2880         const Int64 targetNumBytesInVclNalUnits = ((binCountsInNalUnits - (rawBits/32))*3+31)/32;
    2881         const Int64 numberOfAdditionalBytesNeeded=targetNumBytesInVclNalUnits - numBytesInVclNalUnits;
    2882 
    2883         if (numberOfAdditionalBytesNeeded>0) // It should be!
    2884         {
    2885           const Int64 numberOfAdditionalCabacZeroWords=(numberOfAdditionalBytesNeeded+2)/3;
    2886           const Int64 numberOfAdditionalCabacZeroBytes=numberOfAdditionalCabacZeroWords*3;
     2880        const std::size_t targetNumBytesInVclNalUnits = ((binCountsInNalUnits - (rawBits/32))*3+31)/32;
     2881
     2882        if (targetNumBytesInVclNalUnits>numBytesInVclNalUnits) // It should be!
     2883        {
     2884          const std::size_t numberOfAdditionalBytesNeeded=targetNumBytesInVclNalUnits - numBytesInVclNalUnits;
     2885          const std::size_t numberOfAdditionalCabacZeroWords=(numberOfAdditionalBytesNeeded+2)/3;
     2886          const std::size_t numberOfAdditionalCabacZeroBytes=numberOfAdditionalCabacZeroWords*3;
    28872887          if (m_pcCfg->getCabacZeroWordPaddingEnabled())
    28882888          {
    28892889            std::vector<Char> zeroBytesPadding((size_t)numberOfAdditionalCabacZeroBytes, Char(0));
    2890             for(size_t i=0; i<numberOfAdditionalCabacZeroWords; i++)
     2890            for(std::size_t i=0; i<numberOfAdditionalCabacZeroWords; i++)
    28912891            {
    28922892              zeroBytesPadding[i*3+2]=3;  // 00 00 03
    28932893            }
    28942894            accessUnit.back()->m_nalUnitData.write(&(zeroBytesPadding[0]), (size_t)numberOfAdditionalCabacZeroBytes);
    2895             printf("Adding %lld bytes of padding\n", numberOfAdditionalCabacZeroWords*3);
     2895            printf("Adding %d bytes of padding\n", UInt(numberOfAdditionalCabacZeroWords*3));
    28962896          }
    28972897          else
    28982898          {
    2899             printf("Standard would normally require adding %lld bytes of padding\n", numberOfAdditionalCabacZeroWords*3);
     2899            printf("Standard would normally require adding %d bytes of padding\n", UInt(numberOfAdditionalCabacZeroWords*3));
    29002900          }
    29012901        }
Note: See TracChangeset for help on using the changeset viewer.