Changeset 652 in SHVCSoftware for branches/SHM-6-dev/source/Lib/TLibEncoder


Ignore:
Timestamp:
7 Apr 2014, 23:08:52 (12 years ago)
Author:
seregin
Message:

update to HM-14.0

Location:
branches/SHM-6-dev/source/Lib/TLibEncoder
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • branches/SHM-6-dev/source/Lib/TLibEncoder/AnnexBwrite.h

    r595 r652  
    5858
    5959    static const Char start_code_prefix[] = {0,0,0,1};
    60     if (it == au.begin() || nalu.m_nalUnitType == NAL_UNIT_SPS || nalu.m_nalUnitType == NAL_UNIT_PPS)
     60    if (it == au.begin() || nalu.m_nalUnitType == NAL_UNIT_VPS || nalu.m_nalUnitType == NAL_UNIT_SPS || nalu.m_nalUnitType == NAL_UNIT_PPS)
    6161    {
    6262      /* From AVC, When any of the following conditions are fulfilled, the
  • branches/SHM-6-dev/source/Lib/TLibEncoder/NALwrite.cpp

    r595 r652  
    9191  vector<uint8_t>& rbsp   = nalu.m_Bitstream.getFIFO();
    9292
    93 #if P0130_EOB
    94   if (rbsp.size() == 0) return;
    95 #endif
     93  if (rbsp.size() == 0)
     94  {
     95    return;
     96  }
    9697
    9798  for (vector<uint8_t>::iterator it = rbsp.begin(); it != rbsp.end();)
  • branches/SHM-6-dev/source/Lib/TLibEncoder/SEIwrite.cpp

    r644 r652  
    333333Void SEIWriter::xWriteSEIActiveParameterSets(const SEIActiveParameterSets& sei)
    334334{
    335   WRITE_CODE(sei.activeVPSId,     4, "active_vps_id");
    336   WRITE_FLAG(sei.m_fullRandomAccessFlag, "full_random_access_flag");
    337   WRITE_FLAG(sei.m_noParamSetUpdateFlag, "no_param_set_update_flag");
     335  WRITE_CODE(sei.activeVPSId,     4,         "active_video_parameter_set_id");
     336  WRITE_FLAG(sei.m_selfContainedCvsFlag,     "self_contained_cvs_flag");
     337  WRITE_FLAG(sei.m_noParameterSetUpdateFlag, "no_parameter_set_update_flag");
    338338  WRITE_UVLC(sei.numSpsIdsMinus1,    "num_sps_ids_minus1");
    339339
    340   assert (sei.activeSeqParamSetId.size() == (sei.numSpsIdsMinus1 + 1));
    341 
    342   for (Int i = 0; i < sei.activeSeqParamSetId.size(); i++)
    343   {
    344     WRITE_UVLC(sei.activeSeqParamSetId[i], "active_seq_param_set_id");
    345   }
    346 
    347   UInt uiBits = m_pcBitIf->getNumberOfWrittenBits();
    348   UInt uiAlignedBits = ( 8 - (uiBits&7) ) % 8; 
    349   if(uiAlignedBits)
    350   {
    351     WRITE_FLAG(1, "alignment_bit" );
    352     uiAlignedBits--;
    353     while(uiAlignedBits--)
    354     {
    355       WRITE_FLAG(0, "alignment_bit" );
    356     }
    357   }
     340  assert (sei.activeSeqParameterSetId.size() == (sei.numSpsIdsMinus1 + 1));
     341
     342  for (Int i = 0; i < sei.activeSeqParameterSetId.size(); i++)
     343  {
     344    WRITE_UVLC(sei.activeSeqParameterSetId[i], "active_seq_parameter_set_id");
     345  }
     346  xWriteByteAlign();
    358347}
    359348
     
    550539        {
    551540          WRITE_CODE( sei.m_cameraIsoSpeedValue,    32,    "camera_iso_speed_value" );
     541        }
     542        WRITE_CODE( sei.m_exposureIndexIdc,     8,    "exposure_index_idc" );
     543        if( sei.m_exposureIndexIdc == 255) //Extended_ISO
     544        {
     545          WRITE_CODE( sei.m_exposureIndexValue,     32,    "exposure_index_value" );
    552546        }
    553547        WRITE_FLAG( sei.m_exposureCompensationValueSignFlag,           "exposure_compensation_value_sign_flag" );
     
    633627    for (UInt i = (sei.m_defaultOpFlag ? 1 : 0); i <= sei.m_nestingNumOpsMinus1; i++)
    634628    {
     629      WRITE_CODE( sei.m_nestingNoOpMaxTemporalIdPlus1, 3, "nesting_no_op_max_temporal_id" );
    635630      WRITE_CODE( sei.m_nestingMaxTemporalIdPlus1[i], 3,  "nesting_max_temporal_id"       );
    636631      WRITE_UVLC( sei.m_nestingOpIdx[i],                  "nesting_op_idx"                );
  • branches/SHM-6-dev/source/Lib/TLibEncoder/TEncCavlc.cpp

    r649 r652  
    16121612  if ( pcSlice->getRapPicFlag() )
    16131613  {
    1614 #if NO_OUTPUT_OF_PRIOR_PICS
    1615     WRITE_FLAG( pcSlice->getNoOutputOfPriorPicsFlag(), "no_output_of_prior_pics_flag" );
     1614#if SETTING_NO_OUT_PIC_PRIOR
     1615    WRITE_FLAG( pcSlice->getNoOutputPriorPicsFlag() ? 1 : 0, "no_output_of_prior_pics_flag" );
    16161616#else
    16171617    WRITE_FLAG( 0, "no_output_of_prior_pics_flag" );
  • branches/SHM-6-dev/source/Lib/TLibEncoder/TEncCfg.h

    r644 r652  
    235235  Int       m_cameraIsoSpeedIdc;
    236236  Int       m_cameraIsoSpeedValue;
     237  Int       m_exposureIndexIdc;
     238  Int       m_exposureIndexValue;
    237239  Int       m_exposureCompensationValueSignFlag;
    238240  Int       m_exposureCompensationValueNumerator;
     
    639641  Void  setTMISEICameraIsoSpeedValue(Int b)                  {  m_cameraIsoSpeedValue = b;  }
    640642  Int   getTMISEICameraIsoSpeedValue()                       {  return m_cameraIsoSpeedValue;  }
     643  Void  setTMISEIExposureIndexIdc(Int b)                     {  m_exposureIndexIdc = b;  }
     644  Int   getTMISEIExposurIndexIdc()                           {  return m_exposureIndexIdc;  }
     645  Void  setTMISEIExposureIndexValue(Int b)                   {  m_exposureIndexValue = b;  }
     646  Int   getTMISEIExposurIndexValue()                         {  return m_exposureIndexValue;  }
    641647  Void  setTMISEIExposureCompensationValueSignFlag(Int b)    {  m_exposureCompensationValueSignFlag = b;  }
    642648  Int   getTMISEIExposureCompensationValueSignFlag()         {  return m_exposureCompensationValueSignFlag;  }
  • branches/SHM-6-dev/source/Lib/TLibEncoder/TEncGOP.cpp

    r644 r652  
    7575  m_iNumPicCoded        = 0; //Niko
    7676  m_bFirst              = true;
     77#if ALLOW_RECOVERY_POINT_AS_RAP
     78  m_iLastRecoveryPicPOC = 0;
     79#endif
    7780 
    7881  m_pcCfg               = NULL;
     
    163166  SEIActiveParameterSets *seiActiveParameterSets = new SEIActiveParameterSets();
    164167  seiActiveParameterSets->activeVPSId = m_pcCfg->getVPS()->getVPSId();
    165   seiActiveParameterSets->m_fullRandomAccessFlag = false;
    166   seiActiveParameterSets->m_noParamSetUpdateFlag = false;
     168  seiActiveParameterSets->m_selfContainedCvsFlag = false;
     169  seiActiveParameterSets->m_noParameterSetUpdateFlag = false;
    167170  seiActiveParameterSets->numSpsIdsMinus1 = 0;
    168   seiActiveParameterSets->activeSeqParamSetId.resize(seiActiveParameterSets->numSpsIdsMinus1 + 1);
    169   seiActiveParameterSets->activeSeqParamSetId[0] = sps->getSPSId();
     171  seiActiveParameterSets->activeSeqParameterSetId.resize(seiActiveParameterSets->numSpsIdsMinus1 + 1);
     172  seiActiveParameterSets->activeSeqParameterSetId[0] = sps->getSPSId();
    170173  return seiActiveParameterSets;
    171174}
    172 
    173175
    174176SEIFramePacking* TEncGOP::xCreateSEIFramePacking()
     
    271273       seiToneMappingInfo->m_cameraIsoSpeedValue = m_pcCfg->getTMISEICameraIsoSpeedValue();
    272274       assert( seiToneMappingInfo->m_cameraIsoSpeedValue !=0 );
     275       seiToneMappingInfo->m_exposureIndexIdc = m_pcCfg->getTMISEIExposurIndexIdc();
     276       seiToneMappingInfo->m_exposureIndexValue = m_pcCfg->getTMISEIExposurIndexValue();
     277       assert( seiToneMappingInfo->m_exposureIndexValue !=0 );
    273278       seiToneMappingInfo->m_exposureCompensationValueSignFlag = m_pcCfg->getTMISEIExposureCompensationValueSignFlag();
    274279       seiToneMappingInfo->m_exposureCompensationValueNumerator = m_pcCfg->getTMISEIExposureCompensationValueNumerator();
     
    435440  UInt *accumNalsDU = NULL;
    436441  SEIDecodingUnitInfo decodingUnitInfoSEI;
     442#if EFFICIENT_FIELD_IRAP
     443  Int IRAPGOPid = -1;
     444  Bool IRAPtoReorder = false;
     445  Bool swapIRAPForward = false;
     446  if(isField)
     447  {
     448    Int pocCurr;
     449#if SVC_EXTENSION
     450    for ( Int iGOPid=iPicIdInGOP; iGOPid < iPicIdInGOP+1; iGOPid++ )
     451#else
     452    for ( Int iGOPid=0; iGOPid < m_iGopSize; iGOPid++ )
     453#endif   
     454    {
     455      // determine actual POC
     456      if(iPOCLast == 0) //case first frame or first top field
     457      {
     458        pocCurr=0;
     459      }
     460      else if(iPOCLast == 1 && isField) //case first bottom field, just like the first frame, the poc computation is not right anymore, we set the right value
     461      {
     462        pocCurr = 1;
     463      }
     464      else
     465      {
     466        pocCurr = iPOCLast - iNumPicRcvd + m_pcCfg->getGOPEntry(iGOPid).m_POC - isField;
     467      }
     468
     469      // check if POC corresponds to IRAP
     470      NalUnitType tmpUnitType = getNalUnitType(pocCurr, m_iLastIDR, isField);
     471      if(tmpUnitType >= NAL_UNIT_CODED_SLICE_BLA_W_LP && tmpUnitType <= NAL_UNIT_CODED_SLICE_CRA) // if picture is an IRAP
     472      {
     473        if(pocCurr%2 == 0 && iGOPid < m_iGopSize-1 && m_pcCfg->getGOPEntry(iGOPid).m_POC == m_pcCfg->getGOPEntry(iGOPid+1).m_POC-1)
     474        { // if top field and following picture in enc order is associated bottom field
     475          IRAPGOPid = iGOPid;
     476          IRAPtoReorder = true;
     477          swapIRAPForward = true;
     478          break;
     479        }
     480        if(pocCurr%2 != 0 && iGOPid > 0 && m_pcCfg->getGOPEntry(iGOPid).m_POC == m_pcCfg->getGOPEntry(iGOPid-1).m_POC+1)
     481        {
     482          // if picture is an IRAP remember to process it first
     483          IRAPGOPid = iGOPid;
     484          IRAPtoReorder = true;
     485          swapIRAPForward = false;
     486          break;
     487        }
     488      }
     489    }
     490  }
     491#endif
    437492#if SVC_EXTENSION
    438493  for ( Int iGOPid=iPicIdInGOP; iGOPid < iPicIdInGOP+1; iGOPid++ )
     
    441496#endif
    442497  {
     498#if EFFICIENT_FIELD_IRAP
     499    if(IRAPtoReorder)
     500    {
     501      if(swapIRAPForward)
     502      {
     503        if(iGOPid == IRAPGOPid)
     504        {
     505          iGOPid = IRAPGOPid +1;
     506        }
     507        else if(iGOPid == IRAPGOPid +1)
     508        {
     509          iGOPid = IRAPGOPid;
     510        }
     511      }
     512      else
     513      {
     514        if(iGOPid == IRAPGOPid -1)
     515        {
     516          iGOPid = IRAPGOPid;
     517        }
     518        else if(iGOPid == IRAPGOPid)
     519        {
     520          iGOPid = IRAPGOPid -1;
     521        }
     522      }
     523    }
     524#endif
    443525    UInt uiColDir = 1;
    444526    //-- For time output for each slice
     
    510592    if(pocCurr>=m_pcCfg->getFramesToBeEncoded())
    511593    {
     594#if EFFICIENT_FIELD_IRAP
     595      if(IRAPtoReorder)
     596      {
     597        if(swapIRAPForward)
     598        {
     599          if(iGOPid == IRAPGOPid)
     600          {
     601            iGOPid = IRAPGOPid +1;
     602            IRAPtoReorder = false;
     603          }
     604          else if(iGOPid == IRAPGOPid +1)
     605          {
     606            iGOPid --;
     607          }
     608        }
     609        else
     610        {
     611          if(iGOPid == IRAPGOPid)
     612          {
     613            iGOPid = IRAPGOPid -1;
     614          }
     615          else if(iGOPid == IRAPGOPid -1)
     616          {
     617            iGOPid = IRAPGOPid;
     618            IRAPtoReorder = false;
     619          }
     620        }
     621      }
     622#endif
    512623      continue;
    513624    }
     
    9321043    }
    9331044
    934     // Do decoding refresh marking if any
    935 #if NO_CLRAS_OUTPUT_FLAG
    936     pcSlice->decodingRefreshMarking(m_pocCRA, m_bRefreshPending, rcListPic, m_pcEncTop->getNoClrasOutputFlag());
    937 #else
    938     pcSlice->decodingRefreshMarking(m_pocCRA, m_bRefreshPending, rcListPic);
    939 #endif
    940     m_pcEncTop->selectReferencePictureSet(pcSlice, pocCurr, iGOPid);
    941     pcSlice->getRPS()->setNumberOfLongtermPictures(0);
     1045#if EFFICIENT_FIELD_IRAP
    9421046#if FIX1172
    9431047    if ( pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP
     
    9541058    pcSlice->setAssociatedIRAPPOC(m_associatedIRAPPOC);
    9551059#endif
    956 
     1060#endif
     1061    // Do decoding refresh marking if any
     1062#if NO_CLRAS_OUTPUT_FLAG
     1063    pcSlice->decodingRefreshMarking(m_pocCRA, m_bRefreshPending, rcListPic, m_pcEncTop->getNoClrasOutputFlag());
     1064#else
     1065    pcSlice->decodingRefreshMarking(m_pocCRA, m_bRefreshPending, rcListPic);
     1066#endif
     1067    m_pcEncTop->selectReferencePictureSet(pcSlice, pocCurr, iGOPid);
     1068    pcSlice->getRPS()->setNumberOfLongtermPictures(0);
     1069#if EFFICIENT_FIELD_IRAP
     1070#else
     1071#if FIX1172
     1072    if ( pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP
     1073      || pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL
     1074      || pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_N_LP
     1075      || pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_W_RADL
     1076      || pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP
     1077      || pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA )  // IRAP picture
     1078    {
     1079      m_associatedIRAPType = pcSlice->getNalUnitType();
     1080      m_associatedIRAPPOC = pocCurr;
     1081    }
     1082    pcSlice->setAssociatedIRAPType(m_associatedIRAPType);
     1083    pcSlice->setAssociatedIRAPPOC(m_associatedIRAPPOC);
     1084#endif
     1085#endif
     1086
     1087#if ALLOW_RECOVERY_POINT_AS_RAP
     1088    if ((pcSlice->checkThatAllRefPicsAreAvailable(rcListPic, pcSlice->getRPS(), false, m_iLastRecoveryPicPOC, m_pcCfg->getDecodingRefreshType() == 3) != 0) || (pcSlice->isIRAP())
     1089#if EFFICIENT_FIELD_IRAP
     1090      || (isField && pcSlice->getAssociatedIRAPType() >= NAL_UNIT_CODED_SLICE_BLA_W_LP && pcSlice->getAssociatedIRAPType() <= NAL_UNIT_CODED_SLICE_CRA && pcSlice->getAssociatedIRAPPOC() == pcSlice->getPOC()+1)
     1091#endif
     1092      )
     1093    {
     1094      pcSlice->createExplicitReferencePictureSetFromReference(rcListPic, pcSlice->getRPS(), pcSlice->isIRAP(), m_iLastRecoveryPicPOC, m_pcCfg->getDecodingRefreshType() == 3);
     1095    }
     1096#else
    9571097    if ((pcSlice->checkThatAllRefPicsAreAvailable(rcListPic, pcSlice->getRPS(), false) != 0) || (pcSlice->isIRAP()))
    9581098    {
    9591099      pcSlice->createExplicitReferencePictureSetFromReference(rcListPic, pcSlice->getRPS(), pcSlice->isIRAP());
    9601100    }
     1101#endif
    9611102#if ALIGNED_BUMPING
    9621103    pcSlice->checkLeadingPictureRestrictions(rcListPic);
     
    18491990      pictureTimingSEI.m_auCpbRemovalDelay = std::min<Int>(std::max<Int>(1, m_totalCoded - m_lastBPSEI), static_cast<Int>(pow(2, static_cast<double>(pcSlice->getSPS()->getVuiParameters()->getHrdParameters()->getCpbRemovalDelayLengthMinus1()+1)))); // Syntax element signalled as minus, hence the .
    18501991#if POC_RESET_FLAG
    1851       pictureTimingSEI.m_picDpbOutputDelay = pcSlice->getSPS()->getNumReorderPics(0) + pocCurr - m_totalCoded;
    1852 #else
    1853       pictureTimingSEI.m_picDpbOutputDelay = pcSlice->getSPS()->getNumReorderPics(0) + pcSlice->getPOC() - m_totalCoded;
     1992      pictureTimingSEI.m_picDpbOutputDelay = pcSlice->getSPS()->getNumReorderPics(pcSlice->getSPS()->getMaxTLayers()-1) + pocCurr - m_totalCoded;
     1993#else
     1994      pictureTimingSEI.m_picDpbOutputDelay = pcSlice->getSPS()->getNumReorderPics(pcSlice->getSPS()->getMaxTLayers()-1) + pcSlice->getPOC() - m_totalCoded;
     1995#endif
     1996#if EFFICIENT_FIELD_IRAP
     1997      if(IRAPGOPid > 0 && IRAPGOPid < m_iGopSize)
     1998      {
     1999        // if pictures have been swapped there is likely one more picture delay on their tid. Very rough approximation
     2000        pictureTimingSEI.m_picDpbOutputDelay ++;
     2001      }
    18542002#endif
    18552003      Int factor = pcSlice->getSPS()->getVuiParameters()->getHrdParameters()->getTickDivisorMinus2() + 2;
     
    19752123#endif
    19762124      sei_recovery_point.m_brokenLinkFlag    = false;
     2125#if ALLOW_RECOVERY_POINT_AS_RAP
     2126      if(m_pcCfg->getDecodingRefreshType() == 3)
     2127      {
     2128        m_iLastRecoveryPicPOC = pocCurr;
     2129      }
     2130#endif
    19772131
    19782132#if O0164_MULTI_LAYER_HRD
     
    21102264          }
    21112265          m_pcEntropyCoder->setBitstream(&nalu.m_Bitstream);
     2266
     2267#if SETTING_NO_OUT_PIC_PRIOR
     2268          if (pcSlice->isIRAP())
     2269          {
     2270            if (pcSlice->getNalUnitType() >= NAL_UNIT_CODED_SLICE_BLA_W_LP && pcSlice->getNalUnitType() <= NAL_UNIT_CODED_SLICE_IDR_N_LP)
     2271            {
     2272              pcSlice->setNoRaslOutputFlag(true);
     2273            }
     2274            //the inference for NoOutputPriorPicsFlag
     2275            if (!m_bFirst && pcSlice->isIRAP() && pcSlice->getNoRaslOutputFlag())
     2276            {
     2277              if (pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA)
     2278              {
     2279                pcSlice->setNoOutputPriorPicsFlag(true);
     2280              }
     2281            }
     2282          }
     2283#endif
     2284
    21122285          tmpBitsBeforeWriting = m_pcEntropyCoder->getNumberOfWrittenBits();
    21132286          m_pcEntropyCoder->encodeSliceHeader(pcSlice);
     
    26572830
    26582831      delete[] pcSubstreamsOut;
     2832
     2833#if EFFICIENT_FIELD_IRAP
     2834    if(IRAPtoReorder)
     2835    {
     2836      if(swapIRAPForward)
     2837      {
     2838        if(iGOPid == IRAPGOPid)
     2839        {
     2840          iGOPid = IRAPGOPid +1;
     2841          IRAPtoReorder = false;
     2842        }
     2843        else if(iGOPid == IRAPGOPid +1)
     2844        {
     2845          iGOPid --;
     2846        }
     2847      }
     2848      else
     2849      {
     2850        if(iGOPid == IRAPGOPid)
     2851        {
     2852          iGOPid = IRAPGOPid -1;
     2853        }
     2854        else if(iGOPid == IRAPGOPid -1)
     2855        {
     2856          iGOPid = IRAPGOPid;
     2857          IRAPtoReorder = false;
     2858        }
     2859      }
     2860    }
     2861#endif
    26592862  }
    26602863  delete pcBitstreamRedirect;
     
    29183121    case NAL_UNIT_CODED_SLICE_CRA:        return "CRA";
    29193122    case NAL_UNIT_CODED_SLICE_RADL_R:     return "RADL_R";
     3123    case NAL_UNIT_CODED_SLICE_RADL_N:     return "RADL_N";
    29203124    case NAL_UNIT_CODED_SLICE_RASL_R:     return "RASL_R";
     3125    case NAL_UNIT_CODED_SLICE_RASL_N:     return "RASL_N";
    29213126    case NAL_UNIT_VPS:                    return "VPS";
    29223127    case NAL_UNIT_SPS:                    return "SPS";
     
    33163521    return NAL_UNIT_CODED_SLICE_IDR_W_RADL;
    33173522  }
     3523#if EFFICIENT_FIELD_IRAP
     3524  if(isField && pocCurr == 1)
     3525  {
     3526    // to avoid the picture becoming an IRAP
     3527    return NAL_UNIT_CODED_SLICE_TRAIL_R;
     3528  }
     3529#endif
     3530
     3531#if ALLOW_RECOVERY_POINT_AS_RAP
     3532  if(m_pcCfg->getDecodingRefreshType() != 3 && (pocCurr - isField) % m_pcCfg->getIntraPeriod() == 0)
     3533#else
    33183534  if ((pocCurr - isField) % m_pcCfg->getIntraPeriod() == 0)
     3535#endif
    33193536  {
    33203537    if (m_pcCfg->getDecodingRefreshType() == 1)
  • branches/SHM-6-dev/source/Lib/TLibEncoder/TEncGOP.h

    r644 r652  
    8282  Int                     m_iNumPicCoded;
    8383  Bool                    m_bFirst;
     84#if ALLOW_RECOVERY_POINT_AS_RAP
     85  Int                     m_iLastRecoveryPicPOC;
     86#endif
    8487 
    8588  //  Access channel
  • branches/SHM-6-dev/source/Lib/TLibEncoder/TEncSampleAdaptiveOffset.cpp

    r644 r652  
    952952        for (y=0; y<endY; y++)
    953953        {
     954#if SAO_SGN_FUNC
     955          signLeft = (Char)sgn(srcLine[startX] - srcLine[startX-1]);
     956#else
    954957          signLeft = (Char)m_sign[srcLine[startX] - srcLine[startX-1]];
     958#endif
    955959          for (x=startX; x<endX; x++)
    956960          {
     961#if SAO_SGN_FUNC
     962            signRight =  (Char)sgn(srcLine[x] - srcLine[x+1]);
     963#else
    957964            signRight =  (Char)m_sign[srcLine[x] - srcLine[x+1]];
     965#endif
    958966            edgeType  =  signRight + signLeft;
    959967            signLeft  = -signRight;
     
    975983            for(y=0; y<skipLinesB[typeIdx]; y++)
    976984            {
     985#if SAO_SGN_FUNC
     986              signLeft = (Char)sgn(srcLine[startX] - srcLine[startX-1]);
     987#else
    977988              signLeft = (Char)m_sign[srcLine[startX] - srcLine[startX-1]];
     989#endif
    978990              for (x=startX; x<endX; x++)
    979991              {
     992#if SAO_SGN_FUNC
     993                signRight =  (Char)sgn(srcLine[x] - srcLine[x+1]);
     994#else
    980995                signRight =  (Char)m_sign[srcLine[x] - srcLine[x+1]];
     996#endif
    981997                edgeType  =  signRight + signLeft;
    982998                signLeft  = -signRight;
     
    10261042#endif
    10271043        {
     1044#if SAO_SGN_FUNC
     1045          signUpLine[x] = (Char)sgn(srcLine[x] - srcLineAbove[x]);
     1046#else
    10281047          signUpLine[x] = (Char)m_sign[srcLine[x] - srcLineAbove[x]];
     1048#endif
    10291049        }
    10301050
     
    10401060#endif
    10411061          {
     1062#if SAO_SGN_FUNC
     1063            signDown  = (Char)sgn(srcLine[x] - srcLineBelow[x]);
     1064#else
    10421065            signDown  = (Char)m_sign[srcLine[x] - srcLineBelow[x]];
     1066#endif
    10431067            edgeType  = signDown + signUpLine[x];
    10441068            signUpLine[x]= -signDown;
     
    10651089              for (x=startX; x<endX; x++)
    10661090              {
     1091#if SAO_SGN_FUNC
     1092                edgeType = sgn(srcLine[x] - srcLineBelow[x]) + sgn(srcLine[x] - srcLineAbove[x]);
     1093#else
    10671094                edgeType = m_sign[srcLine[x] - srcLineBelow[x]] + m_sign[srcLine[x] - srcLineAbove[x]];
     1095#endif
    10681096                diff [edgeType] += (orgLine[x] - srcLine[x]);
    10691097                count[edgeType] ++;
     
    11081136        for (x=startX; x<endX+1; x++)
    11091137        {
     1138#if SAO_SGN_FUNC
     1139          signUpLine[x] = (Char)sgn(srcLineBelow[x] - srcLine[x-1]);
     1140#else
    11101141          signUpLine[x] = (Char)m_sign[srcLineBelow[x] - srcLine[x-1]];
     1142#endif
    11111143        }
    11121144
     
    11221154        for(x=firstLineStartX; x<firstLineEndX; x++)
    11231155        {
     1156#if SAO_SGN_FUNC
     1157          edgeType = sgn(srcLine[x] - srcLineAbove[x-1]) - signUpLine[x+1];
     1158#else
    11241159          edgeType = m_sign[srcLine[x] - srcLineAbove[x-1]] - signUpLine[x+1];
     1160#endif
    11251161          diff [edgeType] += (orgLine[x] - srcLine[x]);
    11261162          count[edgeType] ++;
     
    11371173          for (x=startX; x<endX; x++)
    11381174          {
     1175#if SAO_SGN_FUNC
     1176            signDown = (Char)sgn(srcLine[x] - srcLineBelow[x+1]);
     1177#else
    11391178            signDown = (Char)m_sign[srcLine[x] - srcLineBelow[x+1]] ;
     1179#endif
    11401180            edgeType = signDown + signUpLine[x];
    11411181            diff [edgeType] += (orgLine[x] - srcLine[x]);
     
    11441184            signDownLine[x+1] = -signDown;
    11451185          }
     1186#if SAO_SGN_FUNC
     1187          signDownLine[startX] = (Char)sgn(srcLineBelow[startX] - srcLine[startX-1]);
     1188#else
    11461189          signDownLine[startX] = (Char)m_sign[srcLineBelow[startX] - srcLine[startX-1]];
     1190#endif
    11471191
    11481192          signTmpLine  = signUpLine;
     
    11681212              for (x=startX; x< endX; x++)
    11691213              {
     1214#if SAO_SGN_FUNC
     1215                edgeType = sgn(srcLine[x] - srcLineBelow[x+1]) + sgn(srcLine[x] - srcLineAbove[x-1]);
     1216#else
    11701217                edgeType = m_sign[srcLine[x] - srcLineBelow[x+1]] + m_sign[srcLine[x] - srcLineAbove[x-1]];
     1218#endif
    11711219                diff [edgeType] += (orgLine[x] - srcLine[x]);
    11721220                count[edgeType] ++;
     
    12061254        for (x=startX-1; x<endX; x++)
    12071255        {
     1256#if SAO_SGN_FUNC
     1257          signUpLine[x] = (Char)sgn(srcLineBelow[x] - srcLine[x+1]);
     1258#else
    12081259          signUpLine[x] = (Char)m_sign[srcLineBelow[x] - srcLine[x+1]];
     1260#endif
    12091261        }
    12101262
     
    12251277        for(x=firstLineStartX; x<firstLineEndX; x++)
    12261278        {
     1279#if SAO_SGN_FUNC
     1280          edgeType = sgn(srcLine[x] - srcLineAbove[x+1]) - signUpLine[x-1];
     1281#else
    12271282          edgeType = m_sign[srcLine[x] - srcLineAbove[x+1]] - signUpLine[x-1];
     1283#endif
    12281284          diff [edgeType] += (orgLine[x] - srcLine[x]);
    12291285          count[edgeType] ++;
     
    12401296          for(x=startX; x<endX; x++)
    12411297          {
     1298#if SAO_SGN_FUNC
     1299            signDown = (Char)sgn(srcLine[x] - srcLineBelow[x-1]);
     1300#else
    12421301            signDown = (Char)m_sign[srcLine[x] - srcLineBelow[x-1]] ;
     1302#endif
    12431303            edgeType = signDown + signUpLine[x];
    12441304
     
    12481308            signUpLine[x-1] = -signDown;
    12491309          }
     1310#if SAO_SGN_FUNC
     1311          signUpLine[endX-1] = (Char)sgn(srcLineBelow[endX-1] - srcLine[endX]);
     1312#else
    12501313          signUpLine[endX-1] = (Char)m_sign[srcLineBelow[endX-1] - srcLine[endX]];
     1314#endif
    12511315          srcLine  += srcStride;
    12521316          orgLine  += orgStride;
     
    12671331              for (x=startX; x<endX; x++)
    12681332              {
     1333#if SAO_SGN_FUNC
     1334                edgeType = sgn(srcLine[x] - srcLineBelow[x-1]) + sgn(srcLine[x] - srcLineAbove[x+1]);
     1335#else
    12691336                edgeType = m_sign[srcLine[x] - srcLineBelow[x-1]] + m_sign[srcLine[x] - srcLineAbove[x+1]];
     1337#endif
    12701338                diff [edgeType] += (orgLine[x] - srcLine[x]);
    12711339                count[edgeType] ++;
  • branches/SHM-6-dev/source/Lib/TLibEncoder/TEncSbac.h

    r644 r652  
    9595  Void  codeSliceHeader         ( TComSlice* pcSlice );
    9696  Void  codeTilesWPPEntryPoint( TComSlice* pSlice );
    97 #if POC_RESET_IDC_SIGNALLING
    98   Void  codeSliceHeaderExtn     ( TComSlice* pSlice, Int shBitsWrittenTillNow );
    99 #endif
    10097  Void  codeTerminatingBit      ( UInt uilsLast      );
    10198  Void  codeSliceFinish         ();
     
    108105
    109106#if SVC_EXTENSION
     107#if POC_RESET_IDC_SIGNALLING
     108  Void  codeSliceHeaderExtn     ( TComSlice* pSlice, Int shBitsWrittenTillNow );
     109#endif
    110110  Void codeSAOOffsetParam(Int compIdx, SAOOffset& ctbParam, Bool sliceEnabled, UInt* saoMaxOffsetQVal);
    111111  Void codeSAOBlkParam(SAOBlkParam& saoBlkParam
  • branches/SHM-6-dev/source/Lib/TLibEncoder/TEncSearch.cpp

    r595 r652  
    23982398{
    23992399  UInt    uiDepth        = pcCU->getDepth(0);
    2400   UInt    uiNumPU        = pcCU->getNumPartInter();
     2400  UInt    uiNumPU        = pcCU->getNumPartitions();
    24012401  UInt    uiInitTrDepth  = pcCU->getPartitionSize(0) == SIZE_2Nx2N ? 0 : 1;
    24022402  UInt    uiWidth        = pcCU->getWidth (0) >> uiInitTrDepth;
     
    31303130  TComMv        cMvTemp[2][33];
    31313131 
    3132   Int           iNumPart    = pcCU->getNumPartInter();
     3132  Int           iNumPart    = pcCU->getNumPartitions();
    31333133  Int           iNumPredDir = pcCU->getSlice()->isInterP() ? 1 : 2;
    31343134 
     
    46124612   
    46134613    m_pcRDGoOnSbacCoder->load( m_pppcRDSbacCoder[pcCU->getDepth(0)][CI_CURR_BEST] );
    4614 #if 0 // check
    4615     {
    4616       m_pcEntropyCoder->resetBits();
    4617       m_pcEntropyCoder->encodeCoeff( pcCU, 0, pcCU->getDepth(0), pcCU->getWidth(0), pcCU->getHeight(0) );
    4618       const UInt uiBitsForCoeff = m_pcEntropyCoder->getNumberOfWrittenBits();
    4619       m_pcRDGoOnSbacCoder->load( m_pppcRDSbacCoder[pcCU->getDepth(0)][CI_CURR_BEST] );
    4620       if( uiBitsForCoeff != uiBits )
    4621         assert( 0 );
    4622     }
    4623 #endif
     4614   
    46244615    uiBits = 0;
    46254616    {
  • branches/SHM-6-dev/source/Lib/TLibEncoder/TEncSlice.cpp

    r644 r652  
    225225  Int depth;
    226226  {
     227#if FIX_FIELD_DEPTH   
     228    Int poc = rpcSlice->getPOC();
     229    if(isField)
     230    {
     231      poc = (poc/2)%(m_pcCfg->getGOPSize()/2);
     232    }
     233    else
     234    {
     235      poc = poc%m_pcCfg->getGOPSize();   
     236    }
     237#else
    227238    Int poc = rpcSlice->getPOC()%m_pcCfg->getGOPSize();
     239#endif
    228240    if ( poc == 0 )
    229241    {
     
    248260      }
    249261    }
     262#if FIX_FIELD_DEPTH 
     263#if HARMONIZE_GOP_FIRST_FIELD_COUPLE
     264    if(poc != 0)
     265    {
     266#endif
     267    if(isField && rpcSlice->getPOC()%2 == 1)
     268    {
     269      depth ++;
     270    }
     271#if HARMONIZE_GOP_FIRST_FIELD_COUPLE
     272  }
     273#endif
     274#endif
    250275  }
    251276
     
    254279
    255280  eSliceType=B_SLICE;
     281#if EFFICIENT_FIELD_IRAP
     282  if(!(isField && pocLast == 1))
     283  {
     284#endif // EFFICIENT_FIELD_IRAP
     285#if ALLOW_RECOVERY_POINT_AS_RAP
     286  if(m_pcCfg->getDecodingRefreshType() == 3)
     287  {
     288    eSliceType = (pocLast == 0 || pocCurr % m_pcCfg->getIntraPeriod() == 0             || m_pcGOPEncoder->getGOPSize() == 0) ? I_SLICE : eSliceType;
     289  }
     290  else
     291  {
    256292  eSliceType = (pocLast == 0 || (pocCurr - isField) % m_pcCfg->getIntraPeriod() == 0 || m_pcGOPEncoder->getGOPSize() == 0) ? I_SLICE : eSliceType;
     293  }
     294#else
     295  eSliceType = (pocLast == 0 || (pocCurr - isField) % m_pcCfg->getIntraPeriod() == 0 || m_pcGOPEncoder->getGOPSize() == 0) ? I_SLICE : eSliceType;
     296#endif
     297#if EFFICIENT_FIELD_IRAP
     298  }
     299#endif
    257300
    258301  rpcSlice->setSliceType    ( eSliceType );
     
    423466#if HB_LAMBDA_FOR_LDC
    424467  // restore original slice type
     468 
     469#if EFFICIENT_FIELD_IRAP
     470  if(!(isField && pocLast == 1))
     471  {
     472#endif // EFFICIENT_FIELD_IRAP
     473#if ALLOW_RECOVERY_POINT_AS_RAP
     474  if(m_pcCfg->getDecodingRefreshType() == 3)
     475  {
     476    eSliceType = (pocLast == 0 || (pocCurr)           % m_pcCfg->getIntraPeriod() == 0 || m_pcGOPEncoder->getGOPSize() == 0) ? I_SLICE : eSliceType;
     477
     478  }
     479  else
     480  {
    425481  eSliceType = (pocLast == 0 || (pocCurr - isField) % m_pcCfg->getIntraPeriod() == 0 || m_pcGOPEncoder->getGOPSize() == 0) ? I_SLICE : eSliceType;
     482  }
     483#else
     484  eSliceType = (pocLast == 0 || (pocCurr - isField) % m_pcCfg->getIntraPeriod() == 0 || m_pcGOPEncoder->getGOPSize() == 0) ? I_SLICE : eSliceType;
     485#endif
     486#if EFFICIENT_FIELD_IRAP
     487  }
     488#endif // EFFICIENT_FIELD_IRAP
    426489
    427490#if SVC_EXTENSION
     
    544607  // store lambda
    545608  slice->setSliceQp( sliceQP );
     609#if ADAPTIVE_QP_SELECTION
    546610  slice->setSliceQpBase ( sliceQP );
     611#endif
    547612  m_pcRdCost ->setLambda( lambda );
    548613  // for RDO
     
    10411106
    10421107      m_pcRateCtrl->setRCQP( estQP );
     1108#if ADAPTIVE_QP_SELECTION
    10431109      pcCU->getSlice()->setSliceQpBase( estQP );
     1110#endif
    10441111    }
    10451112
  • branches/SHM-6-dev/source/Lib/TLibEncoder/TEncTop.h

    r644 r652  
    273273
    274274  /// encode several number of pictures until end-of-sequence
    275   Void encode( bool bEos, TComPicYuv* pcPicYuvOrg, TComList<TComPicYuv*>& rcListPicYuvRecOut,
     275  Void encode( Bool bEos, TComPicYuv* pcPicYuvOrg, TComList<TComPicYuv*>& rcListPicYuvRecOut,
    276276              std::list<AccessUnit>& accessUnitsOut, Int& iNumEncoded, Bool isTff);
    277277
Note: See TracChangeset for help on using the changeset viewer.