Showing the changes to codec/encoder/core/src/encoder.cpp (1 of 4 files). Show all
Unified · Split
| @@ -350,15 +350,14 @@ EVideoFrameType DecideFrameType (sWelsEncCtx* pEncCtx, const int8_t kiSpatialNum · 349 unmodified lines | ||
| 350 | 350 | * \brief Dump reconstruction for dependency layer |
| 351 | 351 | */ |
| 352 | 352 | |
| 353 | −extern "C" void DumpDependencyRec (SPicture* pCurPicture, const char* kpFileName, const int8_t kiDid) { | |
| 353 | +extern "C" void DumpDependencyRec (SPicture* pCurPicture, const char* kpFileName, const int8_t kiDid, bool bAppend) { | |
| 354 | 354 | WelsFileHandle* pDumpRecFile = NULL; |
| 355 | − static bool bDependencyRecFlag[MAX_DEPENDENCY_LAYER] = {0}; | |
| 356 | 355 | int32_t iWrittenSize = 0; |
| 357 | 356 | |
| 358 | 357 | if (NULL == pCurPicture || NULL == kpFileName || kiDid >= MAX_DEPENDENCY_LAYER) |
| 359 | 358 | return; |
| 360 | 359 | |
| 361 | − if (bDependencyRecFlag[kiDid]) { | |
| 360 | + if (bAppend) { | |
| 362 | 361 | if (strlen (kpFileName) > 0) // confirmed_safe_unsafe_usage |
| 363 | 362 | pDumpRecFile = WelsFopen (kpFileName, "ab"); |
| 364 | 363 | else { |
| @@ -376,7 +375,6 @@ extern "C" void DumpDependencyRec (SPicture* pCurPicture, const char* kpFileName · 11 unmodified lines | ||
| 376 | 375 | WelsSnprintf (sDependencyRecFileName, 16, "rec%d.yuv", kiDid); // confirmed_safe_unsafe_usage |
| 377 | 376 | pDumpRecFile = WelsFopen (sDependencyRecFileName, "wb"); |
| 378 | 377 | } |
| 379 | − bDependencyRecFlag[kiDid] = true; | |
| 380 | 378 | } |
| 381 | 379 | |
| 382 | 380 | if (NULL != pDumpRecFile) { |
| @@ -418,15 +416,14 @@ extern "C" void DumpDependencyRec (SPicture* pCurPicture, const char* kpFileName · 35 unmodified lines | ||
| 418 | 416 | * \brief Dump the reconstruction pictures |
| 419 | 417 | */ |
| 420 | 418 | |
| 421 | −void DumpRecFrame (SPicture* pCurPicture, const char* kpFileName) { | |
| 419 | +void DumpRecFrame (SPicture* pCurPicture, const char* kpFileName, bool bAppend) { | |
| 422 | 420 | WelsFileHandle* pDumpRecFile = NULL; |
| 423 | − static bool bRecFlag = false; | |
| 424 | 421 | int32_t iWrittenSize = 0; |
| 425 | 422 | |
| 426 | 423 | if (NULL == pCurPicture || NULL == kpFileName) |
| 427 | 424 | return; |
| 428 | 425 | |
| 429 | − if (bRecFlag) { | |
| 426 | + if (bAppend) { | |
| 430 | 427 | if (strlen (kpFileName) > 0) { // confirmed_safe_unsafe_usage |
| 431 | 428 | pDumpRecFile = WelsFopen (kpFileName, "ab"); |
| 432 | 429 | } else { |
| @@ -440,7 +437,6 @@ void DumpRecFrame (SPicture* pCurPicture, const char* kpFileName) { · 7 unmodified lines | ||
| 440 | 437 | } else { |
| 441 | 438 | pDumpRecFile = WelsFopen ("rec.yuv", "wb"); |
| 442 | 439 | } |
| 443 | − bRecFlag = true; | |
| 444 | 440 | } |
| 445 | 441 | |
| 446 | 442 | if (NULL != pDumpRecFile) { |