Changeset 389 in SHVCSoftware for branches/SHM-3.1-dev/source/Lib/TLibEncoder
- Timestamp:
- 10 Sep 2013, 17:27:55 (11 years ago)
- 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 423 423 #endif 424 424 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 435 446 Window conf = pcSPS->getConformanceWindow(); 436 447 … … 444 455 } 445 456 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 449 468 WRITE_UVLC( pcSPS->getBitsForPOC()-4, "log2_max_pic_order_cnt_lsb_minus4" ); 450 469 … … 863 882 #endif 864 883 #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 865 910 #if JCTVC_M0458_INTERLAYER_RPS_SIG 866 911 WRITE_FLAG(vps->getMaxOneActiveRefLayerFlag(), "max_one_active_ref_layer_flag"); … … 909 954 } 910 955 #endif 911 956 #if REPN_FORMAT_IN_VPS 957 Void 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 912 976 #if VPS_VUI 913 977 Void TEncCavlc::codeVPSVUI (TComVPS *vps) … … 1052 1116 } 1053 1117 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 1054 1122 // in the first version chroma_format_idc is equal to one, thus colour_plane_id will not be present 1055 1123 assert (pcSlice->getSPS()->getChromaFormatIdc() == 1 ); 1124 #endif 1056 1125 // if( separate_colour_plane_flag == 1 ) 1057 1126 // colour_plane_id u(2) … … 1653 1722 Int iDQp = pcCU->getQP( uiAbsPartIdx ) - pcCU->getRefQP( uiAbsPartIdx ); 1654 1723 1724 #if REPN_FORMAT_IN_VPS 1725 Int qpBdOffsetY = pcCU->getSlice()->getQpBDOffsetY(); 1726 #else 1655 1727 Int qpBdOffsetY = pcCU->getSlice()->getSPS()->getQpBDOffsetY(); 1728 #endif 1656 1729 iDQp = (iDQp + 78 + qpBdOffsetY + (qpBdOffsetY/2)) % (52 + qpBdOffsetY) - 26 - (qpBdOffsetY/2); 1657 1730 -
branches/SHM-3.1-dev/source/Lib/TLibEncoder/TEncCavlc.h
r382 r389 90 90 Void codeVPSVUI (TComVPS *vps); 91 91 #endif 92 #if REPN_FORMAT_IN_VPS 93 Void codeRepFormat ( RepFormat *repFormat ); 94 #endif 92 95 Void codeVUI ( TComVUI *pcVUI, TComSPS* pcSPS ); 93 96 Void codeSPS ( TComSPS* pcSPS ); -
branches/SHM-3.1-dev/source/Lib/TLibEncoder/TEncCfg.h
r377 r389 101 101 102 102 std::istringstream &operator>>(std::istringstream &in, GOPEntry &entry); //input 103 104 #if REPN_FORMAT_IN_VPS 105 struct 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 }; 122 std::istringstream &operator>>(std::istringstream &in, RepFormatCfg &repFormatCfg); 123 #endif 124 103 125 //! \ingroup TLibEncoder 104 126 //! \{ -
branches/SHM-3.1-dev/source/Lib/TLibEncoder/TEncCu.cpp
r345 r389 412 412 Int iMaxQP; 413 413 Bool isAddLowestQP = false; 414 #if REPN_FORMAT_IN_VPS 415 Int lowestQP = -rpcTempCU->getSlice()->getQpBDOffsetY(); 416 #else 414 417 Int lowestQP = -rpcTempCU->getSlice()->getSPS()->getQpBDOffsetY(); 418 #endif 415 419 416 420 if( (g_uiMaxCUWidth>>uiDepth) >= rpcTempCU->getSlice()->getPPS()->getMinCuDQPSize() ) 417 421 { 418 422 Int idQP = m_pcEncCfg->getMaxDeltaQP(); 423 #if REPN_FORMAT_IN_VPS 419 424 iMinQP = Clip3( -rpcTempCU->getSlice()->getSPS()->getQpBDOffsetY(), MAX_QP, iBaseQP-idQP ); 420 425 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 421 430 if ( (rpcTempCU->getSlice()->getSPS()->getUseLossless()) && (lowestQP < iMinQP) && rpcTempCU->getSlice()->getPPS()->getUseDQP() ) 422 431 { … … 450 459 Bool bSliceStart = pcSlice->getSliceSegmentCurStartCUAddr()>rpcTempCU->getSCUAddr()&&pcSlice->getSliceSegmentCurStartCUAddr()<rpcTempCU->getSCUAddr()+rpcTempCU->getTotalNumPart(); 451 460 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 452 464 Bool bInsidePicture = ( uiRPelX < rpcBestCU->getSlice()->getSPS()->getPicWidthInLumaSamples() ) && ( uiBPelY < rpcBestCU->getSlice()->getSPS()->getPicHeightInLumaSamples() ); 465 #endif 453 466 // We need to split, so don't try these modes. 454 467 if(!bSliceEnd && !bSliceStart && bInsidePicture ) … … 827 840 { 828 841 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 829 846 iMinQP = Clip3( -rpcTempCU->getSlice()->getSPS()->getQpBDOffsetY(), MAX_QP, iBaseQP-idQP ); 830 847 iMaxQP = Clip3( -rpcTempCU->getSlice()->getSPS()->getQpBDOffsetY(), MAX_QP, iBaseQP+idQP ); 848 #endif 831 849 if ( (rpcTempCU->getSlice()->getSPS()->getUseLossless()) && (lowestQP < iMinQP) && rpcTempCU->getSlice()->getPPS()->getUseDQP() ) 832 850 { … … 890 908 891 909 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 892 913 if(bInSlice && ( pcSubBestPartCU->getCUPelX() < pcSlice->getSPS()->getPicWidthInLumaSamples() ) && ( pcSubBestPartCU->getCUPelY() < pcSlice->getSPS()->getPicHeightInLumaSamples() ) ) 914 #endif 893 915 { 894 916 if( m_bUseSBACRD ) … … 1038 1060 UInt uiPosX = ( uiExternalAddress % pcPic->getFrameWidthInCU() ) * g_uiMaxCUWidth+ g_auiRasterToPelX[ g_auiZscanToRaster[uiInternalAddress] ]; 1039 1061 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 1040 1066 UInt uiWidth = pcSlice->getSPS()->getPicWidthInLumaSamples(); 1041 1067 UInt uiHeight = pcSlice->getSPS()->getPicHeightInLumaSamples(); 1068 #endif 1042 1069 while(uiPosX>=uiWidth||uiPosY>=uiHeight) 1043 1070 { … … 1136 1163 iQpOffset = Int(floor( dQpOffset + 0.49999 )); 1137 1164 } 1165 #if REPN_FORMAT_IN_VPS 1166 return Clip3(-pcCU->getSlice()->getQpBDOffsetY(), MAX_QP, iBaseQp+iQpOffset ); 1167 #else 1138 1168 return Clip3(-pcCU->getSlice()->getSPS()->getQpBDOffsetY(), MAX_QP, iBaseQp+iQpOffset ); 1169 #endif 1139 1170 } 1140 1171 … … 1160 1191 pcSlice->getSliceSegmentCurStartCUAddr() < pcPic->getPicSym()->getInverseCUOrderMap(pcCU->getAddr())*pcCU->getPic()->getNumPartInCU()+uiAbsPartIdx+( pcPic->getNumPartInCU() >> (uiDepth<<1) ); 1161 1192 // 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 1162 1196 if(!bSliceStart&&( uiRPelX < pcSlice->getSPS()->getPicWidthInLumaSamples() ) && ( uiBPelY < pcSlice->getSPS()->getPicHeightInLumaSamples() ) ) 1197 #endif 1163 1198 { 1164 1199 m_pcEntropyCoder->encodeSplitFlag( pcCU, uiAbsPartIdx, uiDepth ); … … 1181 1216 uiTPelY = pcCU->getCUPelY() + g_auiRasterToPelY[ g_auiZscanToRaster[uiAbsPartIdx] ]; 1182 1217 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 1183 1221 if(bInSlice&&( uiLPelX < pcSlice->getSPS()->getPicWidthInLumaSamples() ) && ( uiTPelY < pcSlice->getSPS()->getPicHeightInLumaSamples() ) ) 1222 #endif 1184 1223 { 1185 1224 xEncodeCU( pcCU, uiAbsPartIdx, uiDepth+1 ); … … 1706 1745 Bool bSliceEnd = pcSlice->getSliceSegmentCurEndCUAddr() > rpcPic->getPicSym()->getInverseCUOrderMap(pcCU->getAddr())*pcCU->getPic()->getNumPartInCU()+uiAbsPartIdx && 1707 1746 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 1708 1750 if(!bSliceEnd && !bSliceStart && ( uiRPelX < pcSlice->getSPS()->getPicWidthInLumaSamples() ) && ( uiBPelY < pcSlice->getSPS()->getPicHeightInLumaSamples() ) ) 1751 #endif 1709 1752 { 1710 1753 UInt uiAbsPartIdxInRaster = g_auiZscanToRaster[uiAbsPartIdx]; … … 1727 1770 Bool bInSlice = rpcPic->getPicSym()->getInverseCUOrderMap(pcCU->getAddr())*pcCU->getPic()->getNumPartInCU()+uiAbsPartIdx+uiQNumParts > pcSlice->getSliceSegmentCurStartCUAddr() && 1728 1771 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 1729 1775 if(bInSlice&&( uiSubCULPelX < pcSlice->getSPS()->getPicWidthInLumaSamples() ) && ( uiSubCUTPelY < pcSlice->getSPS()->getPicHeightInLumaSamples() ) ) 1776 #endif 1730 1777 { 1731 1778 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 1095 1095 } 1096 1096 1097 #if REPN_FORMAT_IN_VPS 1098 sliceQP = Clip3( -pcSlice->getQpBDOffsetY(), MAX_QP, sliceQP ); 1099 #else 1097 1100 sliceQP = Clip3( -pcSlice->getSPS()->getQpBDOffsetY(), MAX_QP, sliceQP ); 1101 #endif 1098 1102 m_pcRateCtrl->getRCPic()->setPicEstQP( sliceQP ); 1099 1103 … … 1108 1112 UInt uiPosX = ( uiExternalAddress % pcPic->getFrameWidthInCU() ) * g_uiMaxCUWidth+ g_auiRasterToPelX[ g_auiZscanToRaster[uiInternalAddress] ]; 1109 1113 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 1110 1118 UInt uiWidth = pcSlice->getSPS()->getPicWidthInLumaSamples(); 1111 1119 UInt uiHeight = pcSlice->getSPS()->getPicHeightInLumaSamples(); 1120 #endif 1112 1121 while(uiPosX>=uiWidth||uiPosY>=uiHeight) 1113 1122 { … … 1656 1665 uiPosX = ( uiExternalAddress % pcPic->getFrameWidthInCU() ) * g_uiMaxCUWidth+ g_auiRasterToPelX[ g_auiZscanToRaster[uiInternalAddress] ]; 1657 1666 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 1658 1672 uiWidth = pcSlice->getSPS()->getPicWidthInLumaSamples(); 1659 1673 uiHeight = pcSlice->getSPS()->getPicHeightInLumaSamples(); 1674 #endif 1660 1675 while(uiPosX>=uiWidth||uiPosY>=uiHeight) 1661 1676 { -
branches/SHM-3.1-dev/source/Lib/TLibEncoder/TEncSbac.cpp
r345 r389 804 804 Int iDQp = pcCU->getQP( uiAbsPartIdx ) - pcCU->getRefQP( uiAbsPartIdx ); 805 805 806 #if REPN_FORMAT_IN_VPS 807 Int qpBdOffsetY = pcCU->getSlice()->getQpBDOffsetY(); 808 #else 806 809 Int qpBdOffsetY = pcCU->getSlice()->getSPS()->getQpBDOffsetY(); 810 #endif 807 811 iDQp = (iDQp + 78 + qpBdOffsetY + (qpBdOffsetY/2)) % (52 + qpBdOffsetY) - 26 - (qpBdOffsetY/2); 808 812 -
branches/SHM-3.1-dev/source/Lib/TLibEncoder/TEncSearch.cpp
r345 r389 1104 1104 pcCU ->setTrIdxSubParts ( uiTrDepth, uiAbsPartIdx, uiFullDepth ); 1105 1105 1106 #if REPN_FORMAT_IN_VPS 1107 m_pcTrQuant->setQPforQuant ( pcCU->getQP( 0 ), TEXT_LUMA, pcCU->getSlice()->getQpBDOffsetY(), 0 ); 1108 #else 1106 1109 m_pcTrQuant->setQPforQuant ( pcCU->getQP( 0 ), TEXT_LUMA, pcCU->getSlice()->getSPS()->getQpBDOffsetY(), 0 ); 1110 #endif 1107 1111 1108 1112 #if RDOQ_CHROMA_LAMBDA … … 4610 4614 while((uiWidth>>uiMaxTrMode) < (g_uiMaxCUWidth>>g_uiMaxCUDepth)) uiMaxTrMode--; 4611 4615 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 4612 4620 qpMin = bHighPass ? Clip3( -pcCU->getSlice()->getSPS()->getQpBDOffsetY(), MAX_QP, pcCU->getQP(0) - m_iMaxDeltaQP ) : pcCU->getQP( 0 ); 4613 4621 qpMax = bHighPass ? Clip3( -pcCU->getSlice()->getSPS()->getQpBDOffsetY(), MAX_QP, pcCU->getQP(0) + m_iMaxDeltaQP ) : pcCU->getQP( 0 ); 4622 #endif 4614 4623 4615 4624 rpcYuvResi->subtract( pcYuvOrg, pcYuvPred, 0, uiWidth ); … … 4860 4869 } 4861 4870 4871 #if REPN_FORMAT_IN_VPS 4872 m_pcTrQuant->setQPforQuant( pcCU->getQP( 0 ), TEXT_LUMA, pcCU->getSlice()->getQpBDOffsetY(), 0 ); 4873 #else 4862 4874 m_pcTrQuant->setQPforQuant( pcCU->getQP( 0 ), TEXT_LUMA, pcCU->getSlice()->getSPS()->getQpBDOffsetY(), 0 ); 4875 #endif 4863 4876 4864 4877 #if RDOQ_CHROMA_LAMBDA … … 4946 4959 Pel *pcResiCurrY = m_pcQTTempTComYuv[ uiQTTempAccessLayer ].getLumaAddr( absTUPartIdx ); 4947 4960 4961 #if REPN_FORMAT_IN_VPS 4948 4962 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 4949 4966 4950 4967 Int scalingListType = 3 + g_eTTable[(Int)TEXT_LUMA]; … … 5195 5212 } 5196 5213 5214 #if REPN_FORMAT_IN_VPS 5215 m_pcTrQuant->setQPforQuant( pcCU->getQP( 0 ), TEXT_LUMA, pcCU->getSlice()->getQpBDOffsetY(), 0 ); 5216 #else 5197 5217 m_pcTrQuant->setQPforQuant( pcCU->getQP( 0 ), TEXT_LUMA, pcCU->getSlice()->getSPS()->getQpBDOffsetY(), 0 ); 5218 #endif 5198 5219 5199 5220 #if RDOQ_CHROMA_LAMBDA … … 5214 5235 const UInt uiTsSingleBitsY = m_pcEntropyCoder->getNumberOfWrittenBits(); 5215 5236 5237 #if REPN_FORMAT_IN_VPS 5238 m_pcTrQuant->setQPforQuant( pcCU->getQP( 0 ), TEXT_LUMA, pcCU->getSlice()->getQpBDOffsetY(), 0 ); 5239 #else 5216 5240 m_pcTrQuant->setQPforQuant( pcCU->getQP( 0 ), TEXT_LUMA, pcCU->getSlice()->getSPS()->getQpBDOffsetY(), 0 ); 5241 #endif 5217 5242 5218 5243 Int scalingListType = 3 + g_eTTable[(Int)TEXT_LUMA]; -
branches/SHM-3.1-dev/source/Lib/TLibEncoder/TEncSlice.cpp
r377 r389 260 260 if(eSliceType!=I_SLICE) 261 261 { 262 #if REPN_FORMAT_IN_VPS 263 if (!(( m_pcCfg->getMaxDeltaQP() == 0 ) && (dQP == -rpcSlice->getQpBDOffsetY() ) && (rpcSlice->getSPS()->getUseLossless()))) 264 #else 262 265 if (!(( m_pcCfg->getMaxDeltaQP() == 0 ) && (dQP == -rpcSlice->getSPS()->getQpBDOffsetY() ) && (rpcSlice->getSPS()->getUseLossless()))) 266 #endif 263 267 { 264 268 dQP += m_pcCfg->getGOPEntry(iGOPid).m_QPOffset; … … 327 331 } 328 332 333 #if REPN_FORMAT_IN_VPS 334 iQP = max( -rpcSlice->getQpBDOffsetY(), min( MAX_QP, (Int) floor( dQP + 0.5 ) ) ); 335 #else 329 336 iQP = max( -pSPS->getQpBDOffsetY(), min( MAX_QP, (Int) floor( dQP + 0.5 ) ) ); 337 #endif 330 338 331 339 m_pdRdPicLambda[iDQpIdx] = dLambda; … … 412 420 { 413 421 dQP = xGetQPValueAccordingToLambda( dLambda ); 422 #if REPN_FORMAT_IN_VPS 423 iQP = max( -rpcSlice->getQpBDOffsetY(), min( MAX_QP, (Int) floor( dQP + 0.5 ) ) ); 424 #else 414 425 iQP = max( -pSPS->getQpBDOffsetY(), min( MAX_QP, (Int) floor( dQP + 0.5 ) ) ); 426 #endif 415 427 } 416 428 … … 606 618 } 607 619 620 #if REPN_FORMAT_IN_VPS 621 qp = max( -pcSlice->getQpBDOffsetY(), min( MAX_QP, (Int) floor( recalQP + 0.5 ) ) ); 622 #else 608 623 qp = max( -pcSPS->getQpBDOffsetY(), min( MAX_QP, (Int) floor( recalQP + 0.5 ) ) ); 624 #endif 609 625 610 626 m_pdRdPicLambda[deltqQpIdx] = lambda; … … 849 865 pcCU->initCU( rpcPic, uiCUAddr ); 850 866 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 851 871 Int height = min( pcSlice->getSPS()->getMaxCUHeight(),pcSlice->getSPS()->getPicHeightInLumaSamples() - uiCUAddr / rpcPic->getFrameWidthInCU() * pcSlice->getSPS()->getMaxCUHeight() ); 852 872 Int width = min( pcSlice->getSPS()->getMaxCUWidth(),pcSlice->getSPS()->getPicWidthInLumaSamples() - uiCUAddr % rpcPic->getFrameWidthInCU() * pcSlice->getSPS()->getMaxCUWidth() ); 873 #endif 853 874 854 875 iSumHad = m_pcCuEncoder->updateLCUDataISlice(pcCU, uiCUAddr, width, height); … … 1148 1169 #endif 1149 1170 1171 #if REPN_FORMAT_IN_VPS 1172 estQP = Clip3( -pcSlice->getQpBDOffsetY(), MAX_QP, estQP ); 1173 #else 1150 1174 estQP = Clip3( -pcSlice->getSPS()->getQpBDOffsetY(), MAX_QP, estQP ); 1175 #endif 1151 1176 1152 1177 m_pcRdCost->setLambda(estLambda); … … 1176 1201 #if !M0036_RC_IMPROVEMENT 1177 1202 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 1178 1207 Int height = min( pcSlice->getSPS()->getMaxCUHeight(),pcSlice->getSPS()->getPicHeightInLumaSamples() - uiCUAddr / rpcPic->getFrameWidthInCU() * pcSlice->getSPS()->getMaxCUHeight() ); 1179 1208 Int width = min( pcSlice->getSPS()->getMaxCUWidth(),pcSlice->getSPS()->getPicWidthInLumaSamples() - uiCUAddr % rpcPic->getFrameWidthInCU() * pcSlice->getSPS()->getMaxCUWidth() ); 1209 #endif 1180 1210 Double MAD = (Double)SAD / (Double)(height * width); 1181 1211 MAD = MAD * MAD; … … 1253 1283 #if !M0036_RC_IMPROVEMENT 1254 1284 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 1255 1289 Int height = min( pcSlice->getSPS()->getMaxCUHeight(),pcSlice->getSPS()->getPicHeightInLumaSamples() - uiCUAddr / rpcPic->getFrameWidthInCU() * pcSlice->getSPS()->getMaxCUHeight() ); 1256 1290 Int width = min( pcSlice->getSPS()->getMaxCUWidth(),pcSlice->getSPS()->getPicWidthInLumaSamples() - uiCUAddr % rpcPic->getFrameWidthInCU() * pcSlice->getSPS()->getMaxCUWidth() ); 1291 #endif 1257 1292 Double MAD = (Double)SAD / (Double)(height * width); 1258 1293 MAD = MAD * MAD; … … 1919 1954 UInt uiPosX = ( uiExternalAddress % rpcPic->getFrameWidthInCU() ) * g_uiMaxCUWidth+ g_auiRasterToPelX[ g_auiZscanToRaster[uiInternalAddress] ]; 1920 1955 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 1921 1960 UInt uiWidth = pcSlice->getSPS()->getPicWidthInLumaSamples(); 1922 1961 UInt uiHeight = pcSlice->getSPS()->getPicHeightInLumaSamples(); 1962 #endif 1923 1963 while((uiPosX>=uiWidth||uiPosY>=uiHeight)&&!(uiPosX>=uiWidth&&uiPosY>=uiHeight)) 1924 1964 { … … 1942 1982 uiPosX = ( uiExternalAddress % rpcPic->getFrameWidthInCU() ) * g_uiMaxCUWidth+ g_auiRasterToPelX[ g_auiZscanToRaster[uiInternalAddress] ]; 1943 1983 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 1944 1988 uiWidth = pcSlice->getSPS()->getPicWidthInLumaSamples(); 1945 1989 uiHeight = pcSlice->getSPS()->getPicHeightInLumaSamples(); 1990 #endif 1946 1991 while((uiPosX>=uiWidth||uiPosY>=uiHeight)&&!(uiPosX>=uiWidth&&uiPosY>=uiHeight)) 1947 1992 { -
branches/SHM-3.1-dev/source/Lib/TLibEncoder/TEncTop.cpp
r377 r389 679 679 } 680 680 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 681 688 m_cSPS.setBitDepthY( g_bitDepthY ); 682 689 m_cSPS.setBitDepthC( g_bitDepthC ); … … 684 691 m_cSPS.setQpBDOffsetY ( 6*(g_bitDepthY - 8) ); 685 692 m_cSPS.setQpBDOffsetC ( 6*(g_bitDepthC - 8) ); 693 #endif 686 694 687 695 m_cSPS.setUseSAO( m_bUseSAO ); … … 745 753 Bool bUseDQP = (getMaxCuDQPDepth() > 0)? true : false; 746 754 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 747 766 Int lowestQP = - m_cSPS.getQpBDOffsetY(); 767 #endif 748 768 749 769 if(getUseLossless()) … … 1212 1232 1213 1233 #if SVC_EXTENSION 1234 #if !REPN_FORMAT_IN_VPS 1214 1235 Void TEncTop::xInitILRP() 1215 1236 { … … 1245 1266 } 1246 1267 } 1247 1268 #else 1269 Void 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 1248 1321 Void TEncTop::setILRPic(TComPic *pcPic) 1249 1322 {
Note: See TracChangeset for help on using the changeset viewer.