History

Avoid using static arrays for keeping track of frame dumping state

Martin Storsjö committed 12 years ago

Commit 00f28cc1 parent 1888fba4 files · +18 −13Browse files

Showing the changes to codec/encoder/core/src/encoder.cpp (1 of 4 files). Show all

Unified · Split

codec/encoder/core/src/encoder.cpp+4−8
@@ -350,15 +350,14 @@ EVideoFrameType DecideFrameType (sWelsEncCtx* pEncCtx, const int8_t kiSpatialNum · 349 unmodified lines
350350 * \brief Dump reconstruction for dependency layer
351351 */
352352
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) {
354354 WelsFileHandle* pDumpRecFile = NULL;
355− static bool bDependencyRecFlag[MAX_DEPENDENCY_LAYER] = {0};
356355 int32_t iWrittenSize = 0;
357356
358357 if (NULL == pCurPicture || NULL == kpFileName || kiDid >= MAX_DEPENDENCY_LAYER)
359358 return;
360359
361− if (bDependencyRecFlag[kiDid]) {
360+ if (bAppend) {
362361 if (strlen (kpFileName) > 0) // confirmed_safe_unsafe_usage
363362 pDumpRecFile = WelsFopen (kpFileName, "ab");
364363 else {
@@ -376,7 +375,6 @@ extern "C" void DumpDependencyRec (SPicture* pCurPicture, const char* kpFileName · 11 unmodified lines
376375 WelsSnprintf (sDependencyRecFileName, 16, "rec%d.yuv", kiDid); // confirmed_safe_unsafe_usage
377376 pDumpRecFile = WelsFopen (sDependencyRecFileName, "wb");
378377 }
379− bDependencyRecFlag[kiDid] = true;
380378 }
381379
382380 if (NULL != pDumpRecFile) {
@@ -418,15 +416,14 @@ extern "C" void DumpDependencyRec (SPicture* pCurPicture, const char* kpFileName · 35 unmodified lines
418416 * \brief Dump the reconstruction pictures
419417 */
420418
421−void DumpRecFrame (SPicture* pCurPicture, const char* kpFileName) {
419+void DumpRecFrame (SPicture* pCurPicture, const char* kpFileName, bool bAppend) {
422420 WelsFileHandle* pDumpRecFile = NULL;
423− static bool bRecFlag = false;
424421 int32_t iWrittenSize = 0;
425422
426423 if (NULL == pCurPicture || NULL == kpFileName)
427424 return;
428425
429− if (bRecFlag) {
426+ if (bAppend) {
430427 if (strlen (kpFileName) > 0) { // confirmed_safe_unsafe_usage
431428 pDumpRecFile = WelsFopen (kpFileName, "ab");
432429 } else {
@@ -440,7 +437,6 @@ void DumpRecFrame (SPicture* pCurPicture, const char* kpFileName) { · 7 unmodified lines
440437 } else {
441438 pDumpRecFile = WelsFopen ("rec.yuv", "wb");
442439 }
443− bRecFlag = true;
444440 }
445441
446442 if (NULL != pDumpRecFile) {

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t