Changeset 389 in SHVCSoftware for branches/SHM-3.1-dev/source/Lib/TLibEncoder


Ignore:
Timestamp:
10 Sep 2013, 17:27:55 (11 years ago)
Author:
qualcomm
Message:

Signaling representation format in VPS (MACRO: REPN_FORMAT_IN_VPS)

Includes signaling of representation format - including picture resolution, bit depth, chroma format - in the VPS, with the option of updating them in the SPS. The configuration file has "RepFormatIdx%d" added to indicate for each layer which representation format is used. The rep_format() structures are automatically created by the encoder. If the bit depth and the chroma format are also changed across layers, some more configuration support would be needed.

From: Adarsh K. Ramasubramonian <aramasub@…>

Location:
branches/SHM-3.1-dev/source/Lib/TLibEncoder
Files:
9 edited

Legend:

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

    r386 r389  
    423423#endif
    424424  WRITE_UVLC( pcSPS->getSPSId (),                   "sps_seq_parameter_set_id" );
    425   WRITE_UVLC( pcSPS->getChromaFormatIdc (),         "chroma_format_idc" );
    426   assert(pcSPS->getChromaFormatIdc () == 1);
    427   // in the first version chroma_format_idc can only be equal to 1 (4:2:0)
    428   if( pcSPS->getChromaFormatIdc () == 3 )
    429   {
    430     WRITE_FLAG( 0,                                  "separate_colour_plane_flag");
    431   }
    432 
    433   WRITE_UVLC( pcSPS->getPicWidthInLumaSamples (),   "pic_width_in_luma_samples" );
    434   WRITE_UVLC( pcSPS->getPicHeightInLumaSamples(),   "pic_height_in_luma_samples" );
     425#if REPN_FORMAT_IN_VPS
     426  if( pcSPS->getLayerId() > 0 )
     427  {
     428    WRITE_FLAG( pcSPS->getUpdateRepFormatFlag(), "update_rep_format_flag" );
     429  }
     430  if( pcSPS->getLayerId() == 0 || pcSPS->getUpdateRepFormatFlag() )
     431  {
     432#endif
     433    WRITE_UVLC( pcSPS->getChromaFormatIdc (),         "chroma_format_idc" );
     434    assert(pcSPS->getChromaFormatIdc () == 1);
     435    // in the first version chroma_format_idc can only be equal to 1 (4:2:0)
     436    if( pcSPS->getChromaFormatIdc () == 3 )
     437    {
     438      WRITE_FLAG( 0,                                  "separate_colour_plane_flag");
     439    }
     440
     441    WRITE_UVLC( pcSPS->getPicWidthInLumaSamples (),   "pic_width_in_luma_samples" );
     442    WRITE_UVLC( pcSPS->getPicHeightInLumaSamples(),   "pic_height_in_luma_samples" );
     443#if REPN_FORMAT_IN_VPS
     444  }
     445#endif
    435446  Window conf = pcSPS->getConformanceWindow();
    436447
     
    444455  }
    445456
    446   WRITE_UVLC( pcSPS->getBitDepthY() - 8,             "bit_depth_luma_minus8" );
    447   WRITE_UVLC( pcSPS->getBitDepthC() - 8,             "bit_depth_chroma_minus8" );
    448 
     457#if REPN_FORMAT_IN_VPS
     458  if( pcSPS->getLayerId() == 0 || pcSPS->getUpdateRepFormatFlag() )
     459  {
     460    assert( pcSPS->getBitDepthY() >= 8 );
     461    assert( pcSPS->getBitDepthC() >= 8 );
     462#endif
     463    WRITE_UVLC( pcSPS->getBitDepthY() - 8,             "bit_depth_luma_minus8" );
     464    WRITE_UVLC( pcSPS->getBitDepthC() - 8,             "bit_depth_chroma_minus8" );
     465#if REPN_FORMAT_IN_VPS
     466  }
     467#endif
    449468  WRITE_UVLC( pcSPS->getBitsForPOC()-4,                 "log2_max_pic_order_cnt_lsb_minus4" );
    450469
     
    863882#endif
    864883#endif
     884
     885#if REPN_FORMAT_IN_VPS
     886  WRITE_FLAG( vps->getRepFormatIdxPresentFlag(), "rep_format_idx_present_flag");
     887
     888  if( vps->getRepFormatIdxPresentFlag() )
     889  {
     890    WRITE_CODE( vps->getVpsNumRepFormats() - 1, 4, "vps_num_rep_formats_minus1" );
     891  }
     892  for(Int i = 0; i < vps->getVpsNumRepFormats(); i++)
     893  {
     894    // Read rep_format_structures
     895    codeRepFormat( vps->getVpsRepFormat(i) );
     896  }
     897 
     898  if( vps->getRepFormatIdxPresentFlag() )
     899  {
     900    for(Int i = 1; i < vps->getMaxLayers(); i++)
     901    {
     902      if( vps->getVpsNumRepFormats() > 1 )
     903      {
     904        WRITE_CODE( vps->getVpsRepFormatIdx(i), 4, "vps_rep_format_idx[i]" );
     905      }
     906    }
     907  }
     908#endif
     909
    865910#if JCTVC_M0458_INTERLAYER_RPS_SIG
    866911      WRITE_FLAG(vps->getMaxOneActiveRefLayerFlag(), "max_one_active_ref_layer_flag");
     
    909954}
    910955#endif
    911 
     956#if REPN_FORMAT_IN_VPS
     957Void  TEncCavlc::codeRepFormat      ( RepFormat *repFormat )
     958{
     959  WRITE_CODE( repFormat->getChromaFormatVpsIdc(), 2, "chroma_format_idc" );   
     960 
     961  if( repFormat->getChromaFormatVpsIdc() == 3 )
     962  {
     963    WRITE_FLAG( repFormat->getSeparateColourPlaneVpsFlag(), "separate_colour_plane_flag");     
     964  }
     965
     966  WRITE_CODE ( repFormat->getPicWidthVpsInLumaSamples (), 16, "pic_width_in_luma_samples" );   
     967  WRITE_CODE ( repFormat->getPicHeightVpsInLumaSamples(), 16, "pic_height_in_luma_samples" );   
     968 
     969  assert( repFormat->getBitDepthVpsLuma() >= 8 );
     970  assert( repFormat->getBitDepthVpsChroma() >= 8 );
     971  WRITE_CODE( repFormat->getBitDepthVpsLuma() - 8,   4, "bit_depth_luma_minus8" );           
     972  WRITE_CODE( repFormat->getBitDepthVpsChroma() - 8, 4, "bit_depth_chroma_minus8" );         
     973
     974}
     975#endif
    912976#if VPS_VUI
    913977Void TEncCavlc::codeVPSVUI (TComVPS *vps)
     
    10521116    }
    10531117
     1118#if REPN_FORMAT_IN_VPS
     1119    // in the first version chroma_format_idc is equal to one, thus colour_plane_id will not be present
     1120    assert( pcSlice->getChromaFormatIdc() == 1 );
     1121#else
    10541122    // in the first version chroma_format_idc is equal to one, thus colour_plane_id will not be present
    10551123    assert (pcSlice->getSPS()->getChromaFormatIdc() == 1 );
     1124#endif
    10561125    // if( separate_colour_plane_flag  ==  1 )
    10571126    //   colour_plane_id                                      u(2)
     
    16531722  Int iDQp  = pcCU->getQP( uiAbsPartIdx ) - pcCU->getRefQP( uiAbsPartIdx );
    16541723
     1724#if REPN_FORMAT_IN_VPS
     1725  Int qpBdOffsetY =  pcCU->getSlice()->getQpBDOffsetY();
     1726#else
    16551727  Int qpBdOffsetY =  pcCU->getSlice()->getSPS()->getQpBDOffsetY();
     1728#endif
    16561729  iDQp = (iDQp + 78 + qpBdOffsetY + (qpBdOffsetY/2)) % (52 + qpBdOffsetY) - 26 - (qpBdOffsetY/2);
    16571730
  • branches/SHM-3.1-dev/source/Lib/TLibEncoder/TEncCavlc.h

    r382 r389  
    9090  Void codeVPSVUI               (TComVPS *vps);
    9191#endif
     92#if REPN_FORMAT_IN_VPS
     93  Void  codeRepFormat           ( RepFormat *repFormat );
     94#endif
    9295  Void  codeVUI                 ( TComVUI *pcVUI, TComSPS* pcSPS );
    9396  Void  codeSPS                 ( TComSPS* pcSPS );
  • branches/SHM-3.1-dev/source/Lib/TLibEncoder/TEncCfg.h

    r377 r389  
    101101
    102102std::istringstream &operator>>(std::istringstream &in, GOPEntry &entry);     //input
     103
     104#if REPN_FORMAT_IN_VPS
     105struct RepFormatCfg
     106{
     107  Int   m_chromaFormatIdc;
     108  Bool  m_separateColourPlaneFlag;
     109  Int   m_picWidthInLumaSamples;
     110  Int   m_picHeightInLumaSamples;
     111  Int   m_bitDepthLuma;
     112  Int   m_bitDepthChroma;
     113  RepFormatCfg()
     114    : m_chromaFormatIdc         (CHROMA_420)
     115    , m_separateColourPlaneFlag (0)
     116    , m_picWidthInLumaSamples   (352)
     117    , m_picHeightInLumaSamples  (288)
     118    , m_bitDepthLuma            (8)
     119    , m_bitDepthChroma          (8)
     120  {}
     121};
     122std::istringstream &operator>>(std::istringstream &in, RepFormatCfg &repFormatCfg);
     123#endif
     124
    103125//! \ingroup TLibEncoder
    104126//! \{
  • branches/SHM-3.1-dev/source/Lib/TLibEncoder/TEncCu.cpp

    r345 r389  
    412412  Int iMaxQP;
    413413  Bool isAddLowestQP = false;
     414#if REPN_FORMAT_IN_VPS
     415  Int lowestQP = -rpcTempCU->getSlice()->getQpBDOffsetY();
     416#else
    414417  Int lowestQP = -rpcTempCU->getSlice()->getSPS()->getQpBDOffsetY();
     418#endif
    415419
    416420  if( (g_uiMaxCUWidth>>uiDepth) >= rpcTempCU->getSlice()->getPPS()->getMinCuDQPSize() )
    417421  {
    418422    Int idQP = m_pcEncCfg->getMaxDeltaQP();
     423#if REPN_FORMAT_IN_VPS
    419424    iMinQP = Clip3( -rpcTempCU->getSlice()->getSPS()->getQpBDOffsetY(), MAX_QP, iBaseQP-idQP );
    420425    iMaxQP = Clip3( -rpcTempCU->getSlice()->getSPS()->getQpBDOffsetY(), MAX_QP, iBaseQP+idQP );
     426#else
     427    iMinQP = Clip3( -rpcTempCU->getSlice()->getSPS()->getQpBDOffsetY(), MAX_QP, iBaseQP-idQP );
     428    iMaxQP = Clip3( -rpcTempCU->getSlice()->getSPS()->getQpBDOffsetY(), MAX_QP, iBaseQP+idQP );
     429#endif
    421430    if ( (rpcTempCU->getSlice()->getSPS()->getUseLossless()) && (lowestQP < iMinQP) && rpcTempCU->getSlice()->getPPS()->getUseDQP() )
    422431    {
     
    450459  Bool bSliceStart = pcSlice->getSliceSegmentCurStartCUAddr()>rpcTempCU->getSCUAddr()&&pcSlice->getSliceSegmentCurStartCUAddr()<rpcTempCU->getSCUAddr()+rpcTempCU->getTotalNumPart();
    451460  Bool bSliceEnd = (pcSlice->getSliceSegmentCurEndCUAddr()>rpcTempCU->getSCUAddr()&&pcSlice->getSliceSegmentCurEndCUAddr()<rpcTempCU->getSCUAddr()+rpcTempCU->getTotalNumPart());
     461#if REPN_FORMAT_IN_VPS
     462  Bool bInsidePicture = ( uiRPelX < rpcBestCU->getSlice()->getPicWidthInLumaSamples()           ) && ( uiBPelY < rpcBestCU->getSlice()->getPicHeightInLumaSamples()           );
     463#else
    452464  Bool bInsidePicture = ( uiRPelX < rpcBestCU->getSlice()->getSPS()->getPicWidthInLumaSamples() ) && ( uiBPelY < rpcBestCU->getSlice()->getSPS()->getPicHeightInLumaSamples() );
     465#endif
    453466  // We need to split, so don't try these modes.
    454467  if(!bSliceEnd && !bSliceStart && bInsidePicture )
     
    827840  {
    828841    Int idQP = m_pcEncCfg->getMaxDeltaQP();
     842#if REPN_FORMAT_IN_VPS
     843    iMinQP = Clip3( -rpcTempCU->getSlice()->getQpBDOffsetY(), MAX_QP, iBaseQP-idQP );
     844    iMaxQP = Clip3( -rpcTempCU->getSlice()->getQpBDOffsetY(), MAX_QP, iBaseQP+idQP );
     845#else
    829846    iMinQP = Clip3( -rpcTempCU->getSlice()->getSPS()->getQpBDOffsetY(), MAX_QP, iBaseQP-idQP );
    830847    iMaxQP = Clip3( -rpcTempCU->getSlice()->getSPS()->getQpBDOffsetY(), MAX_QP, iBaseQP+idQP );
     848#endif
    831849    if ( (rpcTempCU->getSlice()->getSPS()->getUseLossless()) && (lowestQP < iMinQP) && rpcTempCU->getSlice()->getPPS()->getUseDQP() )
    832850    {
     
    890908
    891909        Bool bInSlice = pcSubBestPartCU->getSCUAddr()+pcSubBestPartCU->getTotalNumPart()>pcSlice->getSliceSegmentCurStartCUAddr()&&pcSubBestPartCU->getSCUAddr()<pcSlice->getSliceSegmentCurEndCUAddr();
     910#if REPN_FORMAT_IN_VPS
     911        if(bInSlice && ( pcSubBestPartCU->getCUPelX() < pcSlice->getPicWidthInLumaSamples()           ) && ( pcSubBestPartCU->getCUPelY() < pcSlice->getPicHeightInLumaSamples()           ) )
     912#else
    892913        if(bInSlice && ( pcSubBestPartCU->getCUPelX() < pcSlice->getSPS()->getPicWidthInLumaSamples() ) && ( pcSubBestPartCU->getCUPelY() < pcSlice->getSPS()->getPicHeightInLumaSamples() ) )
     914#endif
    893915        {
    894916          if( m_bUseSBACRD )
     
    10381060  UInt uiPosX = ( uiExternalAddress % pcPic->getFrameWidthInCU() ) * g_uiMaxCUWidth+ g_auiRasterToPelX[ g_auiZscanToRaster[uiInternalAddress] ];
    10391061  UInt uiPosY = ( uiExternalAddress / pcPic->getFrameWidthInCU() ) * g_uiMaxCUHeight+ g_auiRasterToPelY[ g_auiZscanToRaster[uiInternalAddress] ];
     1062#if REPN_FORMAT_IN_VPS
     1063  UInt uiWidth =  pcSlice->getPicWidthInLumaSamples();
     1064  UInt uiHeight = pcSlice->getPicHeightInLumaSamples();
     1065#else
    10401066  UInt uiWidth = pcSlice->getSPS()->getPicWidthInLumaSamples();
    10411067  UInt uiHeight = pcSlice->getSPS()->getPicHeightInLumaSamples();
     1068#endif
    10421069  while(uiPosX>=uiWidth||uiPosY>=uiHeight)
    10431070  {
     
    11361163    iQpOffset = Int(floor( dQpOffset + 0.49999 ));
    11371164  }
     1165#if REPN_FORMAT_IN_VPS
     1166  return Clip3(-pcCU->getSlice()->getQpBDOffsetY(), MAX_QP, iBaseQp+iQpOffset );
     1167#else
    11381168  return Clip3(-pcCU->getSlice()->getSPS()->getQpBDOffsetY(), MAX_QP, iBaseQp+iQpOffset );
     1169#endif
    11391170}
    11401171
     
    11601191    pcSlice->getSliceSegmentCurStartCUAddr() < pcPic->getPicSym()->getInverseCUOrderMap(pcCU->getAddr())*pcCU->getPic()->getNumPartInCU()+uiAbsPartIdx+( pcPic->getNumPartInCU() >> (uiDepth<<1) );
    11611192  // We need to split, so don't try these modes.
     1193#if REPN_FORMAT_IN_VPS
     1194  if(!bSliceStart&&( uiRPelX < pcSlice->getPicWidthInLumaSamples()           ) && ( uiBPelY < pcSlice->getPicHeightInLumaSamples()           ) )
     1195#else
    11621196  if(!bSliceStart&&( uiRPelX < pcSlice->getSPS()->getPicWidthInLumaSamples() ) && ( uiBPelY < pcSlice->getSPS()->getPicHeightInLumaSamples() ) )
     1197#endif
    11631198  {
    11641199    m_pcEntropyCoder->encodeSplitFlag( pcCU, uiAbsPartIdx, uiDepth );
     
    11811216      uiTPelY   = pcCU->getCUPelY() + g_auiRasterToPelY[ g_auiZscanToRaster[uiAbsPartIdx] ];
    11821217      Bool bInSlice = pcCU->getSCUAddr()+uiAbsPartIdx+uiQNumParts>pcSlice->getSliceSegmentCurStartCUAddr()&&pcCU->getSCUAddr()+uiAbsPartIdx<pcSlice->getSliceSegmentCurEndCUAddr();
     1218#if REPN_FORMAT_IN_VPS
     1219      if(bInSlice&&( uiLPelX < pcSlice->getPicWidthInLumaSamples()           ) && ( uiTPelY < pcSlice->getPicHeightInLumaSamples()           ) )
     1220#else
    11831221      if(bInSlice&&( uiLPelX < pcSlice->getSPS()->getPicWidthInLumaSamples() ) && ( uiTPelY < pcSlice->getSPS()->getPicHeightInLumaSamples() ) )
     1222#endif
    11841223      {
    11851224        xEncodeCU( pcCU, uiAbsPartIdx, uiDepth+1 );
     
    17061745  Bool bSliceEnd   = pcSlice->getSliceSegmentCurEndCUAddr() > rpcPic->getPicSym()->getInverseCUOrderMap(pcCU->getAddr())*pcCU->getPic()->getNumPartInCU()+uiAbsPartIdx &&
    17071746    pcSlice->getSliceSegmentCurEndCUAddr() < rpcPic->getPicSym()->getInverseCUOrderMap(pcCU->getAddr())*pcCU->getPic()->getNumPartInCU()+uiAbsPartIdx+( pcCU->getPic()->getNumPartInCU() >> (uiDepth<<1) );
     1747#if REPN_FORMAT_IN_VPS
     1748  if(!bSliceEnd && !bSliceStart && ( uiRPelX < pcSlice->getPicWidthInLumaSamples()           ) && ( uiBPelY < pcSlice->getPicHeightInLumaSamples()           ) )
     1749#else
    17081750  if(!bSliceEnd && !bSliceStart && ( uiRPelX < pcSlice->getSPS()->getPicWidthInLumaSamples() ) && ( uiBPelY < pcSlice->getSPS()->getPicHeightInLumaSamples() ) )
     1751#endif
    17091752  {
    17101753    UInt uiAbsPartIdxInRaster = g_auiZscanToRaster[uiAbsPartIdx];
     
    17271770      Bool bInSlice = rpcPic->getPicSym()->getInverseCUOrderMap(pcCU->getAddr())*pcCU->getPic()->getNumPartInCU()+uiAbsPartIdx+uiQNumParts > pcSlice->getSliceSegmentCurStartCUAddr() &&
    17281771        rpcPic->getPicSym()->getInverseCUOrderMap(pcCU->getAddr())*pcCU->getPic()->getNumPartInCU()+uiAbsPartIdx < pcSlice->getSliceSegmentCurEndCUAddr();
     1772#if REPN_FORMAT_IN_VPS
     1773      if(bInSlice&&( uiSubCULPelX < pcSlice->getPicWidthInLumaSamples()           ) && ( uiSubCUTPelY < pcSlice->getPicHeightInLumaSamples()           ) )
     1774#else
    17291775      if(bInSlice&&( uiSubCULPelX < pcSlice->getSPS()->getPicWidthInLumaSamples() ) && ( uiSubCUTPelY < pcSlice->getSPS()->getPicHeightInLumaSamples() ) )
     1776#endif
    17301777      {
    17311778        xCopyYuv2Pic( rpcPic, uiCUAddr, uiAbsPartIdx, uiDepth+1, uiSrcDepth, pcCU, uiSubCULPelX, uiSubCUTPelY );   // Copy Yuv data to picture Yuv
  • branches/SHM-3.1-dev/source/Lib/TLibEncoder/TEncGOP.cpp

    r379 r389  
    10951095      }
    10961096
     1097#if REPN_FORMAT_IN_VPS
     1098      sliceQP = Clip3( -pcSlice->getQpBDOffsetY(), MAX_QP, sliceQP );
     1099#else
    10971100      sliceQP = Clip3( -pcSlice->getSPS()->getQpBDOffsetY(), MAX_QP, sliceQP );
     1101#endif
    10981102      m_pcRateCtrl->getRCPic()->setPicEstQP( sliceQP );
    10991103
     
    11081112    UInt uiPosX = ( uiExternalAddress % pcPic->getFrameWidthInCU() ) * g_uiMaxCUWidth+ g_auiRasterToPelX[ g_auiZscanToRaster[uiInternalAddress] ];
    11091113    UInt uiPosY = ( uiExternalAddress / pcPic->getFrameWidthInCU() ) * g_uiMaxCUHeight+ g_auiRasterToPelY[ g_auiZscanToRaster[uiInternalAddress] ];
     1114#if REPN_FORMAT_IN_VPS
     1115    UInt uiWidth = pcSlice->getPicWidthInLumaSamples();
     1116    UInt uiHeight = pcSlice->getPicHeightInLumaSamples();
     1117#else
    11101118    UInt uiWidth = pcSlice->getSPS()->getPicWidthInLumaSamples();
    11111119    UInt uiHeight = pcSlice->getSPS()->getPicHeightInLumaSamples();
     1120#endif
    11121121    while(uiPosX>=uiWidth||uiPosY>=uiHeight)
    11131122    {
     
    16561665          uiPosX = ( uiExternalAddress % pcPic->getFrameWidthInCU() ) * g_uiMaxCUWidth+ g_auiRasterToPelX[ g_auiZscanToRaster[uiInternalAddress] ];
    16571666          uiPosY = ( uiExternalAddress / pcPic->getFrameWidthInCU() ) * g_uiMaxCUHeight+ g_auiRasterToPelY[ g_auiZscanToRaster[uiInternalAddress] ];
     1667
     1668#if REPN_FORMAT_IN_VPS
     1669          uiWidth = pcSlice->getPicWidthInLumaSamples();
     1670          uiHeight = pcSlice->getPicHeightInLumaSamples();
     1671#else
    16581672          uiWidth = pcSlice->getSPS()->getPicWidthInLumaSamples();
    16591673          uiHeight = pcSlice->getSPS()->getPicHeightInLumaSamples();
     1674#endif
    16601675          while(uiPosX>=uiWidth||uiPosY>=uiHeight)
    16611676          {
  • branches/SHM-3.1-dev/source/Lib/TLibEncoder/TEncSbac.cpp

    r345 r389  
    804804  Int iDQp  = pcCU->getQP( uiAbsPartIdx ) - pcCU->getRefQP( uiAbsPartIdx );
    805805 
     806#if REPN_FORMAT_IN_VPS
     807  Int qpBdOffsetY =  pcCU->getSlice()->getQpBDOffsetY();
     808#else
    806809  Int qpBdOffsetY =  pcCU->getSlice()->getSPS()->getQpBDOffsetY();
     810#endif
    807811  iDQp = (iDQp + 78 + qpBdOffsetY + (qpBdOffsetY/2)) % (52 + qpBdOffsetY) - 26 - (qpBdOffsetY/2);
    808812
  • branches/SHM-3.1-dev/source/Lib/TLibEncoder/TEncSearch.cpp

    r345 r389  
    11041104  pcCU       ->setTrIdxSubParts ( uiTrDepth, uiAbsPartIdx, uiFullDepth );
    11051105
     1106#if REPN_FORMAT_IN_VPS
     1107  m_pcTrQuant->setQPforQuant    ( pcCU->getQP( 0 ), TEXT_LUMA, pcCU->getSlice()->getQpBDOffsetY(), 0 );
     1108#else
    11061109  m_pcTrQuant->setQPforQuant    ( pcCU->getQP( 0 ), TEXT_LUMA, pcCU->getSlice()->getSPS()->getQpBDOffsetY(), 0 );
     1110#endif
    11071111
    11081112#if RDOQ_CHROMA_LAMBDA
     
    46104614  while((uiWidth>>uiMaxTrMode) < (g_uiMaxCUWidth>>g_uiMaxCUDepth)) uiMaxTrMode--;
    46114615 
     4616#if REPN_FORMAT_IN_VPS
     4617  qpMin =  bHighPass ? Clip3( -pcCU->getSlice()->getQpBDOffsetY(), MAX_QP, pcCU->getQP(0) - m_iMaxDeltaQP ) : pcCU->getQP( 0 );
     4618  qpMax =  bHighPass ? Clip3( -pcCU->getSlice()->getQpBDOffsetY(), MAX_QP, pcCU->getQP(0) + m_iMaxDeltaQP ) : pcCU->getQP( 0 );
     4619#else
    46124620  qpMin =  bHighPass ? Clip3( -pcCU->getSlice()->getSPS()->getQpBDOffsetY(), MAX_QP, pcCU->getQP(0) - m_iMaxDeltaQP ) : pcCU->getQP( 0 );
    46134621  qpMax =  bHighPass ? Clip3( -pcCU->getSlice()->getSPS()->getQpBDOffsetY(), MAX_QP, pcCU->getQP(0) + m_iMaxDeltaQP ) : pcCU->getQP( 0 );
     4622#endif
    46144623
    46154624  rpcYuvResi->subtract( pcYuvOrg, pcYuvPred, 0, uiWidth );
     
    48604869    }
    48614870
     4871#if REPN_FORMAT_IN_VPS
     4872    m_pcTrQuant->setQPforQuant( pcCU->getQP( 0 ), TEXT_LUMA, pcCU->getSlice()->getQpBDOffsetY(), 0 );
     4873#else
    48624874    m_pcTrQuant->setQPforQuant( pcCU->getQP( 0 ), TEXT_LUMA, pcCU->getSlice()->getSPS()->getQpBDOffsetY(), 0 );
     4875#endif
    48634876
    48644877#if RDOQ_CHROMA_LAMBDA
     
    49464959      Pel *pcResiCurrY = m_pcQTTempTComYuv[ uiQTTempAccessLayer ].getLumaAddr( absTUPartIdx );
    49474960
     4961#if REPN_FORMAT_IN_VPS
    49484962      m_pcTrQuant->setQPforQuant( pcCU->getQP( 0 ), TEXT_LUMA, pcCU->getSlice()->getSPS()->getQpBDOffsetY(), 0 );
     4963#else
     4964      m_pcTrQuant->setQPforQuant( pcCU->getQP( 0 ), TEXT_LUMA, pcCU->getSlice()->getSPS()->getQpBDOffsetY(), 0 );
     4965#endif
    49494966
    49504967      Int scalingListType = 3 + g_eTTable[(Int)TEXT_LUMA];
     
    51955212      }
    51965213
     5214#if REPN_FORMAT_IN_VPS
     5215      m_pcTrQuant->setQPforQuant( pcCU->getQP( 0 ), TEXT_LUMA, pcCU->getSlice()->getQpBDOffsetY(), 0 );
     5216#else
    51975217      m_pcTrQuant->setQPforQuant( pcCU->getQP( 0 ), TEXT_LUMA, pcCU->getSlice()->getSPS()->getQpBDOffsetY(), 0 );
     5218#endif
    51985219
    51995220#if RDOQ_CHROMA_LAMBDA
     
    52145235        const UInt uiTsSingleBitsY = m_pcEntropyCoder->getNumberOfWrittenBits();
    52155236
     5237#if REPN_FORMAT_IN_VPS
     5238        m_pcTrQuant->setQPforQuant( pcCU->getQP( 0 ), TEXT_LUMA, pcCU->getSlice()->getQpBDOffsetY(), 0 );
     5239#else
    52165240        m_pcTrQuant->setQPforQuant( pcCU->getQP( 0 ), TEXT_LUMA, pcCU->getSlice()->getSPS()->getQpBDOffsetY(), 0 );
     5241#endif
    52175242
    52185243        Int scalingListType = 3 + g_eTTable[(Int)TEXT_LUMA];
  • branches/SHM-3.1-dev/source/Lib/TLibEncoder/TEncSlice.cpp

    r377 r389  
    260260  if(eSliceType!=I_SLICE)
    261261  {
     262#if REPN_FORMAT_IN_VPS
     263    if (!(( m_pcCfg->getMaxDeltaQP() == 0 ) && (dQP == -rpcSlice->getQpBDOffsetY() ) && (rpcSlice->getSPS()->getUseLossless())))
     264#else
    262265    if (!(( m_pcCfg->getMaxDeltaQP() == 0 ) && (dQP == -rpcSlice->getSPS()->getQpBDOffsetY() ) && (rpcSlice->getSPS()->getUseLossless())))
     266#endif
    263267    {
    264268      dQP += m_pcCfg->getGOPEntry(iGOPid).m_QPOffset;
     
    327331    }
    328332   
     333#if REPN_FORMAT_IN_VPS
     334    iQP = max( -rpcSlice->getQpBDOffsetY(), min( MAX_QP, (Int) floor( dQP + 0.5 ) ) );
     335#else
    329336    iQP = max( -pSPS->getQpBDOffsetY(), min( MAX_QP, (Int) floor( dQP + 0.5 ) ) );
     337#endif
    330338
    331339    m_pdRdPicLambda[iDQpIdx] = dLambda;
     
    412420  {
    413421    dQP = xGetQPValueAccordingToLambda( dLambda );
     422#if REPN_FORMAT_IN_VPS
     423    iQP = max( -rpcSlice->getQpBDOffsetY(), min( MAX_QP, (Int) floor( dQP + 0.5 ) ) );   
     424#else
    414425    iQP = max( -pSPS->getQpBDOffsetY(), min( MAX_QP, (Int) floor( dQP + 0.5 ) ) );   
     426#endif
    415427  }
    416428
     
    606618    }
    607619
     620#if REPN_FORMAT_IN_VPS
     621    qp = max( -pcSlice->getQpBDOffsetY(), min( MAX_QP, (Int) floor( recalQP + 0.5 ) ) );
     622#else
    608623    qp = max( -pcSPS->getQpBDOffsetY(), min( MAX_QP, (Int) floor( recalQP + 0.5 ) ) );
     624#endif
    609625
    610626    m_pdRdPicLambda[deltqQpIdx] = lambda;
     
    849865    pcCU->initCU( rpcPic, uiCUAddr );
    850866
     867#if REPN_FORMAT_IN_VPS
     868    Int height  = min( pcSlice->getSPS()->getMaxCUHeight(),pcSlice->getPicHeightInLumaSamples() - uiCUAddr / rpcPic->getFrameWidthInCU() * pcSlice->getSPS()->getMaxCUHeight() );
     869    Int width   = min( pcSlice->getSPS()->getMaxCUWidth(), pcSlice->getPicWidthInLumaSamples() - uiCUAddr % rpcPic->getFrameWidthInCU() * pcSlice->getSPS()->getMaxCUWidth() );
     870#else
    851871    Int height  = min( pcSlice->getSPS()->getMaxCUHeight(),pcSlice->getSPS()->getPicHeightInLumaSamples() - uiCUAddr / rpcPic->getFrameWidthInCU() * pcSlice->getSPS()->getMaxCUHeight() );
    852872    Int width   = min( pcSlice->getSPS()->getMaxCUWidth(),pcSlice->getSPS()->getPicWidthInLumaSamples() - uiCUAddr % rpcPic->getFrameWidthInCU() * pcSlice->getSPS()->getMaxCUWidth() );
     873#endif
    853874
    854875    iSumHad = m_pcCuEncoder->updateLCUDataISlice(pcCU, uiCUAddr, width, height);
     
    11481169#endif
    11491170
     1171#if REPN_FORMAT_IN_VPS
     1172          estQP     = Clip3( -pcSlice->getQpBDOffsetY(), MAX_QP, estQP );
     1173#else
    11501174          estQP     = Clip3( -pcSlice->getSPS()->getQpBDOffsetY(), MAX_QP, estQP );
     1175#endif
    11511176
    11521177          m_pcRdCost->setLambda(estLambda);
     
    11761201#if !M0036_RC_IMPROVEMENT
    11771202        UInt SAD    = m_pcCuEncoder->getLCUPredictionSAD();
     1203#if REPN_FORMAT_IN_VPS
     1204        Int height  = min( pcSlice->getSPS()->getMaxCUHeight(),pcSlice->getPicHeightInLumaSamples() - uiCUAddr / rpcPic->getFrameWidthInCU() * pcSlice->getSPS()->getMaxCUHeight() );
     1205        Int width   = min( pcSlice->getSPS()->getMaxCUWidth(),pcSlice->>getPicWidthInLumaSamples() - uiCUAddr % rpcPic->getFrameWidthInCU() * pcSlice->getSPS()->getMaxCUWidth() );
     1206#else
    11781207        Int height  = min( pcSlice->getSPS()->getMaxCUHeight(),pcSlice->getSPS()->getPicHeightInLumaSamples() - uiCUAddr / rpcPic->getFrameWidthInCU() * pcSlice->getSPS()->getMaxCUHeight() );
    11791208        Int width   = min( pcSlice->getSPS()->getMaxCUWidth(),pcSlice->getSPS()->getPicWidthInLumaSamples() - uiCUAddr % rpcPic->getFrameWidthInCU() * pcSlice->getSPS()->getMaxCUWidth() );
     1209#endif
    11801210        Double MAD = (Double)SAD / (Double)(height * width);
    11811211        MAD = MAD * MAD;
     
    12531283#if !M0036_RC_IMPROVEMENT
    12541284        UInt SAD    = m_pcCuEncoder->getLCUPredictionSAD();
     1285#if REPN_FORMAT_IN_VPS
     1286        Int height  = min( pcSlice->getSPS()->getMaxCUHeight(),pcSlice->getPicHeightInLumaSamples() - uiCUAddr / rpcPic->getFrameWidthInCU() * pcSlice->getSPS()->getMaxCUHeight() );
     1287        Int width   = min( pcSlice->getSPS()->getMaxCUWidth(),pcSlice->getPicWidthInLumaSamples() - uiCUAddr % rpcPic->getFrameWidthInCU() * pcSlice->getSPS()->getMaxCUWidth() );
     1288#else
    12551289        Int height  = min( pcSlice->getSPS()->getMaxCUHeight(),pcSlice->getSPS()->getPicHeightInLumaSamples() - uiCUAddr / rpcPic->getFrameWidthInCU() * pcSlice->getSPS()->getMaxCUHeight() );
    12561290        Int width   = min( pcSlice->getSPS()->getMaxCUWidth(),pcSlice->getSPS()->getPicWidthInLumaSamples() - uiCUAddr % rpcPic->getFrameWidthInCU() * pcSlice->getSPS()->getMaxCUWidth() );
     1291#endif
    12571292        Double MAD = (Double)SAD / (Double)(height * width);
    12581293        MAD = MAD * MAD;
     
    19191954  UInt uiPosX = ( uiExternalAddress % rpcPic->getFrameWidthInCU() ) * g_uiMaxCUWidth+ g_auiRasterToPelX[ g_auiZscanToRaster[uiInternalAddress] ];
    19201955  UInt uiPosY = ( uiExternalAddress / rpcPic->getFrameWidthInCU() ) * g_uiMaxCUHeight+ g_auiRasterToPelY[ g_auiZscanToRaster[uiInternalAddress] ];
     1956#if REPN_FORMAT_IN_VPS
     1957  UInt uiWidth = pcSlice->getPicWidthInLumaSamples();
     1958  UInt uiHeight = pcSlice->getPicHeightInLumaSamples();
     1959#else
    19211960  UInt uiWidth = pcSlice->getSPS()->getPicWidthInLumaSamples();
    19221961  UInt uiHeight = pcSlice->getSPS()->getPicHeightInLumaSamples();
     1962#endif
    19231963  while((uiPosX>=uiWidth||uiPosY>=uiHeight)&&!(uiPosX>=uiWidth&&uiPosY>=uiHeight))
    19241964  {
     
    19421982  uiPosX = ( uiExternalAddress % rpcPic->getFrameWidthInCU() ) * g_uiMaxCUWidth+ g_auiRasterToPelX[ g_auiZscanToRaster[uiInternalAddress] ];
    19431983  uiPosY = ( uiExternalAddress / rpcPic->getFrameWidthInCU() ) * g_uiMaxCUHeight+ g_auiRasterToPelY[ g_auiZscanToRaster[uiInternalAddress] ];
     1984#if REPN_FORMAT_IN_VPS
     1985  uiWidth = pcSlice->getPicWidthInLumaSamples();
     1986  uiHeight = pcSlice->getPicHeightInLumaSamples();
     1987#else
    19441988  uiWidth = pcSlice->getSPS()->getPicWidthInLumaSamples();
    19451989  uiHeight = pcSlice->getSPS()->getPicHeightInLumaSamples();
     1990#endif
    19461991  while((uiPosX>=uiWidth||uiPosY>=uiHeight)&&!(uiPosX>=uiWidth&&uiPosY>=uiHeight))
    19471992  {
  • branches/SHM-3.1-dev/source/Lib/TLibEncoder/TEncTop.cpp

    r377 r389  
    679679  }
    680680
     681#if REPN_FORMAT_IN_VPS
     682  m_cSPS.setBitDepthY( m_cVPS.getVpsRepFormat( m_cVPS.getVpsRepFormatIdx( m_layerId ) )->getBitDepthVpsLuma() );
     683  m_cSPS.setBitDepthC( m_cVPS.getVpsRepFormat( m_cVPS.getVpsRepFormatIdx( m_layerId ) )->getBitDepthVpsChroma()  );
     684
     685  m_cSPS.setQpBDOffsetY ( 6*(m_cVPS.getVpsRepFormat( m_cVPS.getVpsRepFormatIdx( m_layerId ) )->getBitDepthVpsLuma()  - 8) );
     686  m_cSPS.setQpBDOffsetC ( 6*(m_cVPS.getVpsRepFormat( m_cVPS.getVpsRepFormatIdx( m_layerId ) )->getBitDepthVpsChroma()  - 8) );
     687#else
    681688  m_cSPS.setBitDepthY( g_bitDepthY );
    682689  m_cSPS.setBitDepthC( g_bitDepthC );
     
    684691  m_cSPS.setQpBDOffsetY ( 6*(g_bitDepthY - 8) );
    685692  m_cSPS.setQpBDOffsetC ( 6*(g_bitDepthC - 8) );
     693#endif
    686694
    687695  m_cSPS.setUseSAO( m_bUseSAO );
     
    745753  Bool bUseDQP = (getMaxCuDQPDepth() > 0)? true : false;
    746754
     755#if REPN_FORMAT_IN_VPS
     756  Int lowestQP;
     757  if( m_layerId == 0 || m_cSPS.getUpdateRepFormatFlag() )
     758  {
     759    lowestQP = - m_cSPS.getQpBDOffsetY();
     760  }
     761  else
     762  {
     763    lowestQP = - (m_cVPS.getVpsRepFormat( m_cVPS.getVpsRepFormatIdx( m_layerId ) )->getBitDepthVpsLuma() - 8) * 6;
     764  }
     765#else
    747766  Int lowestQP = - m_cSPS.getQpBDOffsetY();
     767#endif
    748768
    749769  if(getUseLossless())
     
    12121232
    12131233#if SVC_EXTENSION
     1234#if !REPN_FORMAT_IN_VPS
    12141235Void TEncTop::xInitILRP()
    12151236{
     
    12451266  }
    12461267}
    1247 
     1268#else
     1269Void TEncTop::xInitILRP()
     1270{
     1271  RepFormat *repFormat = m_cVPS.getVpsRepFormat( m_cVPS.getVpsRepFormatIdx( m_layerId ) );
     1272  Int bitDepthY,bitDepthC,picWidth,picHeight;
     1273
     1274  if( m_cSPS.getUpdateRepFormatFlag() )
     1275  {
     1276    bitDepthY   = m_cSPS.getBitDepthY();
     1277    bitDepthC   = m_cSPS.getBitDepthC();
     1278    picWidth    = m_cSPS.getPicWidthInLumaSamples();
     1279    picHeight   = m_cSPS.getPicHeightInLumaSamples();
     1280  }
     1281  else
     1282  {
     1283    bitDepthY   = repFormat->getBitDepthVpsLuma();
     1284    bitDepthC   = repFormat->getBitDepthVpsChroma();
     1285    picWidth    = repFormat->getPicWidthVpsInLumaSamples();
     1286    picHeight   = repFormat->getPicHeightVpsInLumaSamples();
     1287  }
     1288 
     1289  if(m_layerId > 0)
     1290  {
     1291    g_bitDepthY     = bitDepthY;
     1292    g_bitDepthC     = bitDepthC;
     1293    g_uiMaxCUWidth  = m_cSPS.getMaxCUWidth();
     1294    g_uiMaxCUHeight = m_cSPS.getMaxCUHeight();
     1295    g_uiMaxCUDepth  = m_cSPS.getMaxCUDepth();
     1296    g_uiAddCUDepth  = max (0, m_cSPS.getLog2MinCodingBlockSize() - (Int)m_cSPS.getQuadtreeTULog2MinSize() );
     1297
     1298    Int  numReorderPics[MAX_TLAYER];
     1299    Window &conformanceWindow = m_cSPS.getConformanceWindow();
     1300    Window defaultDisplayWindow = m_cSPS.getVuiParametersPresentFlag() ? m_cSPS.getVuiParameters()->getDefaultDisplayWindow() : Window();
     1301
     1302    if (m_cIlpPic[0] == NULL)
     1303    {
     1304      for (Int j=0; j < MAX_LAYERS /*MAX_NUM_REF*/; j++) // consider to set to NumDirectRefLayers[LayerIdInVps[nuh_layer_id]]
     1305      {
     1306        m_cIlpPic[j] = new  TComPic;
     1307#if SVC_UPSAMPLING
     1308        m_cIlpPic[j]->create(picWidth, picHeight, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, conformanceWindow, defaultDisplayWindow, numReorderPics, &m_cSPS, true);
     1309#else
     1310        m_cIlpPic[j]->create(m_iSourceWidth, m_iSourceHeight, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, conformanceWindow, defaultDisplayWindow, numReorderPics, true);
     1311#endif
     1312        for (Int i=0; i<m_cIlpPic[j]->getPicSym()->getNumberOfCUsInFrame(); i++)
     1313        {
     1314          m_cIlpPic[j]->getPicSym()->getCU(i)->initCU(m_cIlpPic[j], i);
     1315        }
     1316      }
     1317    }
     1318  }
     1319}
     1320#endif
    12481321Void TEncTop::setILRPic(TComPic *pcPic)
    12491322{
Note: See TracChangeset for help on using the changeset viewer.