Changeset 1344 in SHVCSoftware for branches/SHM-dev
- Timestamp:
- 22 Jul 2015, 03:01:47 (9 years ago)
- Location:
- branches/SHM-dev/source/Lib
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/SHM-dev/source/Lib/TLibCommon/TypeDef.h
r1342 r1344 163 163 164 164 #define DECODER_CHECK_SUBSTREAM_AND_SLICE_TRAILING_BYTES 1 165 #define SAO_ENCODE_ALLOW_USE_PREDEBLOCK 1166 165 #define T0196_SELECTIVE_RDOQ 1 ///< selective RDOQ 167 166 -
branches/SHM-dev/source/Lib/TLibEncoder/TEncGOP.cpp
r1336 r1344 2605 2605 m_pcEncTop->getRDGoOnSbacCoder()->setBitstream(&tempBitCounter); 2606 2606 m_pcSAO->initRDOCabacCoder(m_pcEncTop->getRDGoOnSbacCoder(), pcSlice); 2607 m_pcSAO->SAOProcess(pcPic, sliceEnabled, pcPic->getSlice(0)->getLambdas(), m_pcCfg->getTestSAODisableAtPictureLevel(), m_pcCfg->getSaoEncodingRate(), m_pcCfg->getSaoEncodingRateChroma() 2608 #if SAO_ENCODE_ALLOW_USE_PREDEBLOCK 2609 , m_pcCfg->getSaoCtuBoundary() 2610 #endif 2611 ); 2607 m_pcSAO->SAOProcess(pcPic, sliceEnabled, pcPic->getSlice(0)->getLambdas(), m_pcCfg->getTestSAODisableAtPictureLevel(), m_pcCfg->getSaoEncodingRate(), m_pcCfg->getSaoEncodingRateChroma(), m_pcCfg->getSaoCtuBoundary()); 2612 2608 m_pcSAO->PCMLFDisableProcess(pcPic); 2613 2609 m_pcEncTop->getRDGoOnSbacCoder()->setBitstream(NULL); -
branches/SHM-dev/source/Lib/TLibEncoder/TEncSampleAdaptiveOffset.cpp
r1332 r1344 64 64 m_pppcBinCoderCABAC = NULL; 65 65 m_statData = NULL; 66 #if SAO_ENCODE_ALLOW_USE_PREDEBLOCK67 66 m_preDBFstatData = NULL; 68 #endif69 67 } 70 68 … … 74 72 } 75 73 76 #if SAO_ENCODE_ALLOW_USE_PREDEBLOCK77 74 Void TEncSampleAdaptiveOffset::createEncData(Bool isPreDBFSamplesUsed) 78 #else79 Void TEncSampleAdaptiveOffset::createEncData()80 #endif81 75 { 82 76 … … 111 105 } 112 106 } 113 #if SAO_ENCODE_ALLOW_USE_PREDEBLOCK114 107 if(isPreDBFSamplesUsed) 115 108 { … … 125 118 126 119 } 127 #endif128 120 129 121 ::memset(m_saoDisabledRate, 0, sizeof(m_saoDisabledRate)); … … 137 129 m_skipLinesB[COMPONENT_Cb][typeIdc]= m_skipLinesB[COMPONENT_Cr][typeIdc]= 2; 138 130 139 #if SAO_ENCODE_ALLOW_USE_PREDEBLOCK140 131 if(isPreDBFSamplesUsed) 141 132 { … … 187 178 } 188 179 } 189 #endif190 180 } 191 181 … … 224 214 delete[] m_statData; m_statData = NULL; 225 215 } 226 #if SAO_ENCODE_ALLOW_USE_PREDEBLOCK227 216 if(m_preDBFstatData != NULL) 228 217 { … … 237 226 delete[] m_preDBFstatData; m_preDBFstatData = NULL; 238 227 } 239 240 #endif241 228 } 242 229 … … 252 239 253 240 254 Void TEncSampleAdaptiveOffset::SAOProcess(TComPic* pPic, Bool* sliceEnabled, const Double *lambdas, const Bool bTestSAODisableAtPictureLevel, const Double saoEncodingRate, const Double saoEncodingRateChroma 255 #if SAO_ENCODE_ALLOW_USE_PREDEBLOCK 256 , Bool isPreDBFSamplesUsed 257 #endif 258 ) 241 Void TEncSampleAdaptiveOffset::SAOProcess(TComPic* pPic, Bool* sliceEnabled, const Double *lambdas, const Bool bTestSAODisableAtPictureLevel, const Double saoEncodingRate, const Double saoEncodingRateChroma, Bool isPreDBFSamplesUsed ) 259 242 { 260 243 TComPicYuv* orgYuv= pPic->getPicYuvOrg(); … … 268 251 //collect statistics 269 252 getStatistics(m_statData, orgYuv, srcYuv, pPic); 270 #if SAO_ENCODE_ALLOW_USE_PREDEBLOCK271 253 if(isPreDBFSamplesUsed) 272 254 { 273 255 addPreDBFStatistics(m_statData); 274 256 } 275 #endif276 257 //slice on/off 277 258 decidePicParams(sliceEnabled, pPic->getSlice(0)->getDepth(), saoEncodingRate, saoEncodingRateChroma); … … 283 264 } 284 265 285 #if SAO_ENCODE_ALLOW_USE_PREDEBLOCK286 266 Void TEncSampleAdaptiveOffset::getPreDBFStatistics(TComPic* pPic) 287 267 { … … 303 283 } 304 284 305 #endif 306 307 Void TEncSampleAdaptiveOffset::getStatistics(SAOStatData*** blkStats, TComPicYuv* orgYuv, TComPicYuv* srcYuv, TComPic* pPic 308 #if SAO_ENCODE_ALLOW_USE_PREDEBLOCK 309 , Bool isCalculatePreDeblockSamples 310 #endif 311 ) 285 Void TEncSampleAdaptiveOffset::getStatistics(SAOStatData*** blkStats, TComPicYuv* orgYuv, TComPicYuv* srcYuv, TComPic* pPic, Bool isCalculatePreDeblockSamples) 312 286 { 313 287 Bool isLeftAvail,isRightAvail,isAboveAvail,isBelowAvail,isAboveLeftAvail,isAboveRightAvail,isBelowLeftAvail,isBelowRightAvail; … … 353 327 , srcBlk, orgBlk, srcStride, orgStride, (width >> componentScaleX), (height >> componentScaleY) 354 328 , isLeftAvail, isRightAvail, isAboveAvail, isBelowAvail, isAboveLeftAvail, isAboveRightAvail 355 #if SAO_ENCODE_ALLOW_USE_PREDEBLOCK356 329 , isCalculatePreDeblockSamples 357 #endif358 330 ); 359 331 … … 933 905 , Pel* srcBlk, Pel* orgBlk, Int srcStride, Int orgStride, Int width, Int height 934 906 , Bool isLeftAvail, Bool isRightAvail, Bool isAboveAvail, Bool isBelowAvail, Bool isAboveLeftAvail, Bool isAboveRightAvail 935 #if SAO_ENCODE_ALLOW_USE_PREDEBLOCK936 907 , Bool isCalculatePreDeblockSamples 937 #endif938 908 ) 939 909 { … … 980 950 count+=2; 981 951 endY = (isBelowAvail) ? (height - skipLinesB[typeIdx]) : height; 982 #if SAO_ENCODE_ALLOW_USE_PREDEBLOCK983 952 startX = (!isCalculatePreDeblockSamples) ? (isLeftAvail ? 0 : 1) 984 953 : (isRightAvail ? (width - skipLinesR[typeIdx]) : (width - 1)) 985 954 ; 986 #else987 startX = isLeftAvail ? 0 : 1;988 #endif989 #if SAO_ENCODE_ALLOW_USE_PREDEBLOCK990 955 endX = (!isCalculatePreDeblockSamples) ? (isRightAvail ? (width - skipLinesR[typeIdx]) : (width - 1)) 991 956 : (isRightAvail ? width : (width - 1)) 992 957 ; 993 #else994 endX = isRightAvail ? (width - skipLinesR[typeIdx]): (width - 1);995 #endif996 958 for (y=0; y<endY; y++) 997 959 { … … 1009 971 orgLine += orgStride; 1010 972 } 1011 #if SAO_ENCODE_ALLOW_USE_PREDEBLOCK1012 973 if(isCalculatePreDeblockSamples) 1013 974 { … … 1034 995 } 1035 996 } 1036 #endif1037 997 } 1038 998 break; … … 1043 1003 Char *signUpLine = m_signLineBuf1; 1044 1004 1045 #if SAO_ENCODE_ALLOW_USE_PREDEBLOCK1046 1005 startX = (!isCalculatePreDeblockSamples) ? 0 1047 1006 : (isRightAvail ? (width - skipLinesR[typeIdx]) : width) 1048 1007 ; 1049 #endif1050 1008 startY = isAboveAvail ? 0 : 1; 1051 #if SAO_ENCODE_ALLOW_USE_PREDEBLOCK1052 1009 endX = (!isCalculatePreDeblockSamples) ? (isRightAvail ? (width - skipLinesR[typeIdx]) : width) 1053 1010 : width 1054 1011 ; 1055 #else1056 endX = isRightAvail ? (width - skipLinesR[typeIdx]) : width ;1057 #endif1058 1012 endY = isBelowAvail ? (height - skipLinesB[typeIdx]) : (height - 1); 1059 1013 if (!isAboveAvail) … … 1064 1018 1065 1019 Pel* srcLineAbove = srcLine - srcStride; 1066 #if SAO_ENCODE_ALLOW_USE_PREDEBLOCK1067 1020 for (x=startX; x<endX; x++) 1068 #else1069 for (x=0; x< endX; x++)1070 #endif1071 1021 { 1072 1022 signUpLine[x] = (Char)sgn(srcLine[x] - srcLineAbove[x]); … … 1078 1028 srcLineBelow = srcLine + srcStride; 1079 1029 1080 #if SAO_ENCODE_ALLOW_USE_PREDEBLOCK1081 1030 for (x=startX; x<endX; x++) 1082 #else1083 for (x=0; x<endX; x++)1084 #endif1085 1031 { 1086 1032 signDown = (Char)sgn(srcLine[x] - srcLineBelow[x]); … … 1094 1040 orgLine += orgStride; 1095 1041 } 1096 #if SAO_ENCODE_ALLOW_USE_PREDEBLOCK1097 1042 if(isCalculatePreDeblockSamples) 1098 1043 { … … 1118 1063 } 1119 1064 } 1120 #endif1121 1065 1122 1066 } … … 1131 1075 signDownLine= m_signLineBuf2; 1132 1076 1133 #if SAO_ENCODE_ALLOW_USE_PREDEBLOCK1134 1077 startX = (!isCalculatePreDeblockSamples) ? (isLeftAvail ? 0 : 1) 1135 1078 : (isRightAvail ? (width - skipLinesR[typeIdx]) : (width - 1)) 1136 1079 ; 1137 #else 1138 startX = isLeftAvail ? 0 : 1 ; 1139 #endif 1140 1141 #if SAO_ENCODE_ALLOW_USE_PREDEBLOCK 1080 1142 1081 endX = (!isCalculatePreDeblockSamples) ? (isRightAvail ? (width - skipLinesR[typeIdx]): (width - 1)) 1143 1082 : (isRightAvail ? width : (width - 1)) 1144 1083 ; 1145 #else1146 endX = isRightAvail ? (width - skipLinesR[typeIdx]): (width - 1);1147 #endif1148 1084 endY = isBelowAvail ? (height - skipLinesB[typeIdx]) : (height - 1); 1149 1085 … … 1157 1093 //1st line 1158 1094 Pel* srcLineAbove = srcLine - srcStride; 1159 #if SAO_ENCODE_ALLOW_USE_PREDEBLOCK1160 1095 firstLineStartX = (!isCalculatePreDeblockSamples) ? (isAboveLeftAvail ? 0 : 1) : startX; 1161 1096 firstLineEndX = (!isCalculatePreDeblockSamples) ? (isAboveAvail ? endX : 1) : endX; 1162 #else1163 firstLineStartX = isAboveLeftAvail ? 0 : 1;1164 firstLineEndX = isAboveAvail ? endX : 1;1165 #endif1166 1097 for(x=firstLineStartX; x<firstLineEndX; x++) 1167 1098 { … … 1197 1128 orgLine += orgStride; 1198 1129 } 1199 #if SAO_ENCODE_ALLOW_USE_PREDEBLOCK1200 1130 if(isCalculatePreDeblockSamples) 1201 1131 { … … 1221 1151 } 1222 1152 } 1223 #endif1224 1153 } 1225 1154 break; … … 1230 1159 Char *signUpLine = m_signLineBuf1+1; 1231 1160 1232 #if SAO_ENCODE_ALLOW_USE_PREDEBLOCK1233 1161 startX = (!isCalculatePreDeblockSamples) ? (isLeftAvail ? 0 : 1) 1234 1162 : (isRightAvail ? (width - skipLinesR[typeIdx]) : (width - 1)) 1235 1163 ; 1236 #else1237 startX = isLeftAvail ? 0 : 1;1238 #endif1239 #if SAO_ENCODE_ALLOW_USE_PREDEBLOCK1240 1164 endX = (!isCalculatePreDeblockSamples) ? (isRightAvail ? (width - skipLinesR[typeIdx]) : (width - 1)) 1241 1165 : (isRightAvail ? width : (width - 1)) 1242 1166 ; 1243 #else1244 endX = isRightAvail ? (width - skipLinesR[typeIdx]) : (width - 1);1245 #endif1246 1167 endY = isBelowAvail ? (height - skipLinesB[typeIdx]) : (height - 1); 1247 1168 … … 1256 1177 //first line 1257 1178 Pel* srcLineAbove = srcLine - srcStride; 1258 #if SAO_ENCODE_ALLOW_USE_PREDEBLOCK1259 1179 firstLineStartX = (!isCalculatePreDeblockSamples) ? (isAboveAvail ? startX : endX) 1260 1180 : startX … … 1263 1183 : endX 1264 1184 ; 1265 #else1266 firstLineStartX = isAboveAvail ? startX : endX;1267 firstLineEndX = (!isRightAvail && isAboveRightAvail) ? width : endX;1268 #endif1269 1185 for(x=firstLineStartX; x<firstLineEndX; x++) 1270 1186 { … … 1296 1212 orgLine += orgStride; 1297 1213 } 1298 #if SAO_ENCODE_ALLOW_USE_PREDEBLOCK1299 1214 if(isCalculatePreDeblockSamples) 1300 1215 { … … 1320 1235 } 1321 1236 } 1322 #endif1323 1237 } 1324 1238 break; 1325 1239 case SAO_TYPE_BO: 1326 1240 { 1327 #if SAO_ENCODE_ALLOW_USE_PREDEBLOCK1328 1241 startX = (!isCalculatePreDeblockSamples)?0 1329 1242 :( isRightAvail?(width- skipLinesR[typeIdx]):width) … … 1332 1245 :width 1333 1246 ; 1334 #else1335 endX = isRightAvail ? (width- skipLinesR[typeIdx]) : width;1336 #endif1337 1247 endY = isBelowAvail ? (height- skipLinesB[typeIdx]) : height; 1338 1248 Int shiftBits = channelBitDepth - NUM_SAO_BO_CLASSES_LOG2; 1339 1249 for (y=0; y< endY; y++) 1340 1250 { 1341 #if SAO_ENCODE_ALLOW_USE_PREDEBLOCK1342 1251 for (x=startX; x< endX; x++) 1343 #else1344 for (x=0; x< endX; x++)1345 #endif1346 1252 { 1347 1253 … … 1353 1259 orgLine += orgStride; 1354 1260 } 1355 #if SAO_ENCODE_ALLOW_USE_PREDEBLOCK1356 1261 if(isCalculatePreDeblockSamples) 1357 1262 { … … 1376 1281 } 1377 1282 } 1378 #endif1379 1283 } 1380 1284 break; -
branches/SHM-dev/source/Lib/TLibEncoder/TEncSampleAdaptiveOffset.h
r1332 r1344 82 82 return *this; 83 83 } 84 #if SAO_ENCODE_ALLOW_USE_PREDEBLOCK85 84 const SAOStatData& operator+= (const SAOStatData& src) 86 85 { … … 92 91 return *this; 93 92 } 94 #endif95 93 }; 96 94 … … 102 100 103 101 //interface 104 #if SAO_ENCODE_ALLOW_USE_PREDEBLOCK105 102 Void createEncData(Bool isPreDBFSamplesUsed); 106 #else107 Void createEncData();108 #endif109 103 Void destroyEncData(); 110 104 Void initRDOCabacCoder(TEncSbac* pcRDGoOnSbacCoder, TComSlice* pcSlice) ; 111 Void SAOProcess(TComPic* pPic, Bool* sliceEnabled, const Double *lambdas, const Bool bTestSAODisableAtPictureLevel, const Double saoEncodingRate, const Double saoEncodingRateChroma 112 #if SAO_ENCODE_ALLOW_USE_PREDEBLOCK 113 , Bool isPreDBFSamplesUsed 114 #endif 115 ); 105 Void SAOProcess(TComPic* pPic, Bool* sliceEnabled, const Double *lambdas, const Bool bTestSAODisableAtPictureLevel, const Double saoEncodingRate, const Double saoEncodingRateChroma, Bool isPreDBFSamplesUsed); 116 106 public: //methods 117 #if SAO_ENCODE_ALLOW_USE_PREDEBLOCK118 107 Void getPreDBFStatistics(TComPic* pPic); 119 #endif120 108 private: //methods 121 Void getStatistics(SAOStatData*** blkStats, TComPicYuv* orgYuv, TComPicYuv* srcYuv,TComPic* pPic 122 #if SAO_ENCODE_ALLOW_USE_PREDEBLOCK 123 , Bool isCalculatePreDeblockSamples = false 124 #endif 125 ); 109 Void getStatistics(SAOStatData*** blkStats, TComPicYuv* orgYuv, TComPicYuv* srcYuv,TComPic* pPic, Bool isCalculatePreDeblockSamples = false); 126 110 Void decidePicParams(Bool* sliceEnabled, Int picTempLayer, const Double saoEncodingRate, const Double saoEncodingRateChroma); 127 111 Void decideBlkParams(TComPic* pic, Bool* sliceEnabled, SAOStatData*** blkStats, TComPicYuv* srcYuv, TComPicYuv* resYuv, SAOBlkParam* reconParams, SAOBlkParam* codedParams, const Bool bTestSAODisableAtPictureLevel, const Double saoEncodingRate, const Double saoEncodingRateChroma); 128 Void getBlkStats(const ComponentID compIdx, const Int channelBitDepth, SAOStatData* statsDataTypes, Pel* srcBlk, Pel* orgBlk, Int srcStride, Int orgStride, Int width, Int height, Bool isLeftAvail, Bool isRightAvail, Bool isAboveAvail, Bool isBelowAvail, Bool isAboveLeftAvail, Bool isAboveRightAvail 129 #if SAO_ENCODE_ALLOW_USE_PREDEBLOCK 130 , Bool isCalculatePreDeblockSamples 131 #endif 132 ); 112 Void getBlkStats(const ComponentID compIdx, const Int channelBitDepth, SAOStatData* statsDataTypes, Pel* srcBlk, Pel* orgBlk, Int srcStride, Int orgStride, Int width, Int height, Bool isLeftAvail, Bool isRightAvail, Bool isAboveAvail, Bool isBelowAvail, Bool isAboveLeftAvail, Bool isAboveRightAvail, Bool isCalculatePreDeblockSamples); 133 113 Void deriveModeNewRDO(const BitDepths &bitDepths, Int ctuRsAddr, SAOBlkParam* mergeList[NUM_SAO_MERGE_TYPES], Bool* sliceEnabled, SAOStatData*** blkStats, SAOBlkParam& modeParam, Double& modeNormCost, TEncSbac** cabacCoderRDO, Int inCabacLabel); 134 114 Void deriveModeMergeRDO(const BitDepths &bitDepths, Int ctuRsAddr, SAOBlkParam* mergeList[NUM_SAO_MERGE_TYPES], Bool* sliceEnabled, SAOStatData*** blkStats, SAOBlkParam& modeParam, Double& modeNormCost, TEncSbac** cabacCoderRDO, Int inCabacLabel); … … 137 117 inline Int64 estSaoDist(Int64 count, Int64 offset, Int64 diffSum, Int shift); 138 118 inline Int estIterOffset(Int typeIdx, Double lambda, Int offsetInput, Int64 count, Int64 diffSum, Int shift, Int bitIncrease, Int64& bestDist, Double& bestCost, Int offsetTh ); 139 #if SAO_ENCODE_ALLOW_USE_PREDEBLOCK140 119 Void addPreDBFStatistics(SAOStatData*** blkStats); 141 #endif142 120 private: //members 143 121 //for RDO … … 153 131 //statistics 154 132 SAOStatData*** m_statData; //[ctu][comp][classes] 155 #if SAO_ENCODE_ALLOW_USE_PREDEBLOCK156 133 SAOStatData*** m_preDBFstatData; 157 #endif158 134 Double m_saoDisabledRate[MAX_NUM_COMPONENT][MAX_TLAYER]; 159 135 Int m_skipLinesR[MAX_NUM_COMPONENT][NUM_SAO_NEW_TYPES]; -
branches/SHM-dev/source/Lib/TLibEncoder/TEncTop.cpp
r1339 r1344 122 122 { 123 123 m_cEncSAO.create( getSourceWidth(), getSourceHeight(), m_chromaFormatIDC, m_maxCUWidth, m_maxCUHeight, m_maxTotalCUDepth, m_log2SaoOffsetScale[CHANNEL_TYPE_LUMA], m_log2SaoOffsetScale[CHANNEL_TYPE_CHROMA] ); 124 #if SAO_ENCODE_ALLOW_USE_PREDEBLOCK125 124 m_cEncSAO.createEncData(getSaoCtuBoundary()); 126 #else127 m_cEncSAO.createEncData();128 #endif129 125 } 130 126 #if ADAPTIVE_QP_SELECTION
Note: See TracChangeset for help on using the changeset viewer.