Skip to content

Commit 28838b4

Browse files
PinterfPinterf
authored andcommitted
SeparateFields to InitMT list, debug lines
1 parent 6d7ecf1 commit 28838b4

File tree

1 file changed

+24
-8
lines changed

1 file changed

+24
-8
lines changed

avs_core/core/avisynth.cpp

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -481,9 +481,15 @@ class MTMapState
481481

482482
std::string f = NormalizeFilterName(filter);
483483
if (!force)
484+
{
484485
PerFilterMap[f] = mode;
486+
_RPT2(0,"MT SetMode NOT FORCED for %s: %d\n", f.c_str(), (int)mode);
487+
}
485488
else
489+
{
486490
ForcedMap[f] = mode;
491+
_RPT2(0, "MT SetMode FORCED for %s: %d\n", f.c_str(), (int)mode);
492+
}
487493
}
488494

489495
MtMode GetMode(const std::string& filter, bool* is_forced, bool* found) const
@@ -499,14 +505,18 @@ class MTMapState
499505
if (it != ForcedMap.end())
500506
{
501507
*is_forced = true;
508+
_RPT2(0, "MT GetMode FORCED for %s: %d\n", f.c_str(), (int)it->second);
502509
return it->second;
503510
}
504511

505512
it = PerFilterMap.find(f);
506513
if (it != PerFilterMap.end())
514+
{
515+
_RPT2(0, "MT GetMode PER FORCED for %s: %d\n", f.c_str(), (int)it->second);
507516
return it->second;
508-
517+
}
509518
*found = false;
519+
_RPT2(0, "MT GetMode DEFAULT for %s: %d\n", f.c_str(), DefaultMode);
510520
return DefaultMode;
511521
}
512522

@@ -809,10 +819,11 @@ void ScriptEnvironment::InitMT()
809819
this->SetFilterMTMode(BUILTIN_FUNC_PREFIX "_Weave", MtMode::MT_NICE_FILTER, true);
810820
this->SetFilterMTMode(BUILTIN_FUNC_PREFIX "_Pulldown", MtMode::MT_NICE_FILTER, true);
811821
this->SetFilterMTMode(BUILTIN_FUNC_PREFIX "_SelectEvery", MtMode::MT_NICE_FILTER, true);
812-
this->SetFilterMTMode(BUILTIN_FUNC_PREFIX "_SelectEven", MtMode::MT_NICE_FILTER, true);
822+
this->SetFilterMTMode(BUILTIN_FUNC_PREFIX "_SelectEven", MtMode::MT_NICE_FILTER, true);
813823
this->SetFilterMTMode(BUILTIN_FUNC_PREFIX "_SelectOdd", MtMode::MT_NICE_FILTER, true);
814824
this->SetFilterMTMode(BUILTIN_FUNC_PREFIX "_Bob", MtMode::MT_NICE_FILTER, true);
815825
this->SetFilterMTMode(BUILTIN_FUNC_PREFIX "_SelectRangeEvery", MtMode::MT_NICE_FILTER, true);
826+
this->SetFilterMTMode(BUILTIN_FUNC_PREFIX "_SeparateFields", MtMode::MT_NICE_FILTER, true);
816827

817828
this->SetFilterMTMode(BUILTIN_FUNC_PREFIX "_Blur", MtMode::MT_NICE_FILTER, true);
818829
this->SetFilterMTMode(BUILTIN_FUNC_PREFIX "_Sharpen", MtMode::MT_NICE_FILTER, true);
@@ -1525,19 +1536,23 @@ VideoFrame* ScriptEnvironment::GetNewFrame(size_t vfb_size)
15251536
t_end = std::chrono::high_resolution_clock::now();
15261537
std::chrono::duration<double> elapsed_seconds = t_end - t_start;
15271538
it3->second = std::chrono::high_resolution_clock::now(); // refresh timestamp!
1528-
// 16.03.27 P.F. test: we dont allow vfb's frame count list to grow to many thousand. If the count reaches 100, we cut
1529-
// In a 40000 original frame QTGMC session, there are more than 600 vfb's occupied. Many of them with 4-5k parent frames!
1530-
// Let's test what happens if we free them up here. Speed?, marginally less memory?
15311539
_RPT4(0, "ScriptEnvironment::GetNewFrame NEW METHOD EXACT hit! VideoFrameListSize=%7Iu GotSize=%7Iu FrReg.Size=%6Iu Cnt=%6d CntInner=%6d vfb=%p frame=%p SeekTime:%f\n", videoFrameListSize, vfb_size, FrameRegistry2.size(), linearsearchcount, linearsearchcount_list, vfb, frame, elapsed_seconds.count()); // P.F.
15321540
_RPT4(0, " frame %p RowSize=%d Height=%d Pitch=%d Offset=%d\n", frame, frame->GetRowSize(), frame->GetHeight(), frame->GetPitch(), frame->GetOffset()); // P.F.
15331541
#endif
1534-
if (videoFrameListSize < 50) // less than 50 entry in list -> return
1542+
// 16.03.27 P.F. test: we dont allow vfb's frame count list to grow to many thousand. If the count reaches 100, we cut
1543+
// In a 40000 original frame QTGMC session, there are more than 600 vfb's occupied. Many of them with 4-5k parent frames!
1544+
// Let's test what happens if we free them up here. Speed?, marginally less memory?
1545+
// less memory!
1546+
// only 1 frame in list -> no delete
1547+
if (videoFrameListSize < 50) // less than X entry in list -> return
15351548
{
1549+
_RPT1(0, "ScriptEnvironment::GetNewFrame returning frame. VideoFrameListSize was < 50: %7zu \n", videoFrameListSize); // P.F.
15361550
return frame; // return immediately
15371551
break;
15381552
}
1553+
_RPT1(0, "ScriptEnvironment::GetNewFrame not returning frame. VideoFrameListSize was >= 50: %7zu \n", videoFrameListSize); // P.F.
15391554

1540-
// more than 150: just registered the frame found, and erase all other frames from list plus delete frame objects also
1555+
// more than X: just registered the frame found, and erase all other frames from list plus delete frame objects also
15411556
frame_found = frame;
15421557
found = true;
15431558
it3++;
@@ -1557,6 +1572,7 @@ VideoFrame* ScriptEnvironment::GetNewFrame(size_t vfb_size)
15571572
} // for it3
15581573
if (found)
15591574
{
1575+
_RPT1(0, "ScriptEnvironment::GetNewFrame returning frame_found. it2->second.size(): %7zu \n", it2->second.size()); // P.F.
15601576
return frame_found;
15611577
}
15621578
}
@@ -1579,7 +1595,7 @@ VideoFrame* ScriptEnvironment::GetNewFrame(size_t vfb_size)
15791595
// list to debugview: only frame with vfb_size size
15801596
//for (FrameRegistryType2::iterator it = FrameRegistry2.lower_bound(vfb_size), end_it = FrameRegistry2.upper_bound(vfb_size); csak az adott méretet
15811597
// list to debugview: all frames up-to vfb_size size
1582-
if (vfb_size == 645151) // P.F. 16.04.05 narrow down to the leaking size!
1598+
if (1 /*vfb_size == 645151*/) // P.F. 16.04.05 narrow down to the leaking size!
15831599
{
15841600
//for (FrameRegistryType2::iterator it = FrameRegistry2.begin(), end_it = FrameRegistry2.upper_bound(vfb_size);
15851601
for (FrameRegistryType2::iterator it = FrameRegistry2.lower_bound(vfb_size), end_it = FrameRegistry2.upper_bound(vfb_size);

0 commit comments

Comments
 (0)