Showing the changes to codec/encoder/core/src/encoder.cpp (1 of 54 files). Show all
Unified · Split
| @@ -240,7 +240,7 @@ void InitFrameCoding (sWelsEncCtx* pEncCtx, const EVideoFrameType keFrameType) { · 239 unmodified lines | |||
| 240 | ++pEncCtx->iFrameIndex; | 240 | ++pEncCtx->iFrameIndex; |
| 241 | 241 | ||
| 242 | if (pEncCtx->iPOC < (1 << pEncCtx->pSps->iLog2MaxPocLsb) - 2) // if iPOC type is no 0, this need be modification | 242 | if (pEncCtx->iPOC < (1 << pEncCtx->pSps->iLog2MaxPocLsb) - 2) // if iPOC type is no 0, this need be modification |
| 243 | pEncCtx->iPOC += 2; // for POC type 0 | 243 | pEncCtx->iPOC += 2; // for POC type 0 |
| 244 | else | 244 | else |
| 245 | pEncCtx->iPOC = 0; | 245 | pEncCtx->iPOC = 0; |
| 246 | 246 | ||
| @@ -248,7 +248,7 @@ void InitFrameCoding (sWelsEncCtx* pEncCtx, const EVideoFrameType keFrameType) { · 1 unmodified line | |||
| 248 | if (pEncCtx->iFrameNum < (1 << pEncCtx->pSps->uiLog2MaxFrameNum) - 1) | 248 | if (pEncCtx->iFrameNum < (1 << pEncCtx->pSps->uiLog2MaxFrameNum) - 1) |
| 249 | ++ pEncCtx->iFrameNum; | 249 | ++ pEncCtx->iFrameNum; |
| 250 | else | 250 | else |
| 251 | pEncCtx->iFrameNum = 0; // if iFrameNum overflow | 251 | pEncCtx->iFrameNum = 0; // if iFrameNum overflow |
| 252 | } | 252 | } |
| 253 | pEncCtx->eNalType = NAL_UNIT_CODED_SLICE; | 253 | pEncCtx->eNalType = NAL_UNIT_CODED_SLICE; |
| 254 | pEncCtx->eSliceType = P_SLICE; | 254 | pEncCtx->eSliceType = P_SLICE; |
| @@ -270,7 +270,7 @@ void InitFrameCoding (sWelsEncCtx* pEncCtx, const EVideoFrameType keFrameType) { · 15 unmodified lines | |||
| 270 | // rc_init_gop | 270 | // rc_init_gop |
| 271 | } else if (keFrameType == videoFrameTypeI) { | 271 | } else if (keFrameType == videoFrameTypeI) { |
| 272 | if (pEncCtx->iPOC < (1 << pEncCtx->pSps->iLog2MaxPocLsb) - 2) // if iPOC type is no 0, this need be modification | 272 | if (pEncCtx->iPOC < (1 << pEncCtx->pSps->iLog2MaxPocLsb) - 2) // if iPOC type is no 0, this need be modification |
| 273 | pEncCtx->iPOC += 2; // for POC type 0 | 273 | pEncCtx->iPOC += 2; // for POC type 0 |
| 274 | else | 274 | else |
| 275 | pEncCtx->iPOC = 0; | 275 | pEncCtx->iPOC = 0; |
| 276 | 276 | ||
| @@ -278,7 +278,7 @@ void InitFrameCoding (sWelsEncCtx* pEncCtx, const EVideoFrameType keFrameType) { · 1 unmodified line | |||
| 278 | if (pEncCtx->iFrameNum < (1 << pEncCtx->pSps->uiLog2MaxFrameNum) - 1) | 278 | if (pEncCtx->iFrameNum < (1 << pEncCtx->pSps->uiLog2MaxFrameNum) - 1) |
| 279 | ++ pEncCtx->iFrameNum; | 279 | ++ pEncCtx->iFrameNum; |
| 280 | else | 280 | else |
| 281 | pEncCtx->iFrameNum = 0; // if iFrameNum overflow | 281 | pEncCtx->iFrameNum = 0; // if iFrameNum overflow |
| 282 | } | 282 | } |
| 283 | 283 | ||
| 284 | pEncCtx->eNalType = NAL_UNIT_CODED_SLICE; | 284 | pEncCtx->eNalType = NAL_UNIT_CODED_SLICE; |
| @@ -296,7 +296,7 @@ void InitFrameCoding (sWelsEncCtx* pEncCtx, const EVideoFrameType keFrameType) { · 11 unmodified lines | |||
| 296 | } | 296 | } |
| 297 | 297 | ||
| 298 | EVideoFrameType DecideFrameType (sWelsEncCtx* pEncCtx, const int8_t kiSpatialNum) { | 298 | EVideoFrameType DecideFrameType (sWelsEncCtx* pEncCtx, const int8_t kiSpatialNum) { |
| 299 | SWelsSvcCodingParam* pSvcParam = pEncCtx->pSvcParam; | 299 | SWelsSvcCodingParam* pSvcParam = pEncCtx->pSvcParam; |
| 300 | EVideoFrameType iFrameType = videoFrameTypeInvalid; | 300 | EVideoFrameType iFrameType = videoFrameTypeInvalid; |
| 301 | bool bSceneChangeFlag = false; | 301 | bool bSceneChangeFlag = false; |
| 302 | 302 | ||
| @@ -370,7 +370,7 @@ EVideoFrameType DecideFrameType (sWelsEncCtx* pEncCtx, const int8_t kiSpatialNum · 67 unmodified lines | |||
| 370 | extern "C" void DumpDependencyRec (SPicture* pCurPicture, const char* kpFileName, const int8_t kiDid, bool bAppend, | 370 | extern "C" void DumpDependencyRec (SPicture* pCurPicture, const char* kpFileName, const int8_t kiDid, bool bAppend, |
| 371 | SDqLayer* pDqLayer) { | 371 | SDqLayer* pDqLayer) { |
| 372 | WelsFileHandle* pDumpRecFile = NULL; | 372 | WelsFileHandle* pDumpRecFile = NULL; |
| 373 | int32_t iWrittenSize = 0; | 373 | int32_t iWrittenSize = 0; |
| 374 | const char* openMode = bAppend ? "ab" : "wb"; | 374 | const char* openMode = bAppend ? "ab" : "wb"; |
| 375 | SWelsSPS* pSpsTmp = (kiDid > BASE_DEPENDENCY_ID) ? & (pDqLayer->sLayerInfo.pSubsetSpsP->pSps) : | 375 | SWelsSPS* pSpsTmp = (kiDid > BASE_DEPENDENCY_ID) ? & (pDqLayer->sLayerInfo.pSubsetSpsP->pSps) : |
| 376 | pDqLayer->sLayerInfo.pSpsP; | 376 | pDqLayer->sLayerInfo.pSpsP; |
| @@ -384,8 +384,8 @@ extern "C" void DumpDependencyRec (SPicture* pCurPicture, const char* kpFileName · 7 unmodified lines | |||
| 384 | pDumpRecFile = WelsFopen (kpFileName, openMode); | 384 | pDumpRecFile = WelsFopen (kpFileName, openMode); |
| 385 | else { | 385 | else { |
| 386 | char sDependencyRecFileName[16] = {0}; | 386 | char sDependencyRecFileName[16] = {0}; |
| 387 | WelsSnprintf (sDependencyRecFileName, 16, "rec%d.yuv", kiDid); // confirmed_safe_unsafe_usage | 387 | WelsSnprintf (sDependencyRecFileName, 16, "rec%d.yuv", kiDid); // confirmed_safe_unsafe_usage |
| 388 | pDumpRecFile = WelsFopen (sDependencyRecFileName, openMode); | 388 | pDumpRecFile = WelsFopen (sDependencyRecFileName, openMode); |
| 389 | } | 389 | } |
| 390 | if (NULL != pDumpRecFile && bAppend) | 390 | if (NULL != pDumpRecFile && bAppend) |
| 391 | WelsFseek (pDumpRecFile, 0, SEEK_END); | 391 | WelsFseek (pDumpRecFile, 0, SEEK_END); |
| @@ -437,22 +437,22 @@ extern "C" void DumpDependencyRec (SPicture* pCurPicture, const char* kpFileName · 45 unmodified lines | |||
| 437 | 437 | ||
| 438 | void DumpRecFrame (SPicture* pCurPicture, const char* kpFileName, const int8_t kiDid, bool bAppend, | 438 | void DumpRecFrame (SPicture* pCurPicture, const char* kpFileName, const int8_t kiDid, bool bAppend, |
| 439 | SDqLayer* pDqLayer) { | 439 | SDqLayer* pDqLayer) { |
| 440 | WelsFileHandle* pDumpRecFile = NULL; | 440 | WelsFileHandle* pDumpRecFile = NULL; |
| 441 | SWelsSPS* pSpsTmp = (kiDid > BASE_DEPENDENCY_ID) ? & (pDqLayer->sLayerInfo.pSubsetSpsP->pSps) : | 441 | SWelsSPS* pSpsTmp = (kiDid > BASE_DEPENDENCY_ID) ? & (pDqLayer->sLayerInfo.pSubsetSpsP->pSps) : |
| 442 | pDqLayer->sLayerInfo.pSpsP; | 442 | pDqLayer->sLayerInfo.pSpsP; |
| 443 | bool bFrameCroppingFlag = pSpsTmp->bFrameCroppingFlag; | 443 | bool bFrameCroppingFlag = pSpsTmp->bFrameCroppingFlag; |
| 444 | SCropOffset* pFrameCrop = &pSpsTmp->sFrameCrop; | 444 | SCropOffset* pFrameCrop = &pSpsTmp->sFrameCrop; |
| 445 | 445 | ||
| 446 | int32_t iWrittenSize = 0; | 446 | int32_t iWrittenSize = 0; |
| 447 | const char* openMode = bAppend ? "ab" : "wb"; | 447 | const char* openMode = bAppend ? "ab" : "wb"; |
| 448 | 448 | ||
| 449 | if (NULL == pCurPicture || NULL == kpFileName) | 449 | if (NULL == pCurPicture || NULL == kpFileName) |
| 450 | return; | 450 | return; |
| 451 | 451 | ||
| 452 | if (strlen (kpFileName) > 0) { // confirmed_safe_unsafe_usage | 452 | if (strlen (kpFileName) > 0) { // confirmed_safe_unsafe_usage |
| 453 | pDumpRecFile = WelsFopen (kpFileName, openMode); | 453 | pDumpRecFile = WelsFopen (kpFileName, openMode); |
| 454 | } else { | 454 | } else { |
| 455 | pDumpRecFile = WelsFopen ("rec.yuv", openMode); | 455 | pDumpRecFile = WelsFopen ("rec.yuv", openMode); |
| 456 | } | 456 | } |
| 457 | if (NULL != pDumpRecFile && bAppend) | 457 | if (NULL != pDumpRecFile && bAppend) |
| 458 | WelsFseek (pDumpRecFile, 0, SEEK_END); | 458 | WelsFseek (pDumpRecFile, 0, SEEK_END); |