improve export progress
This commit is contained in:
parent
4899513194
commit
5e4dbe7063
|
@ -113,13 +113,22 @@ class DivCSPlayer {
|
||||||
|
|
||||||
struct DivCSProgress {
|
struct DivCSProgress {
|
||||||
int stage, count, total;
|
int stage, count, total;
|
||||||
|
int optStage, findTotal;
|
||||||
int optCurrent, optTotal;
|
int optCurrent, optTotal;
|
||||||
|
int findCurrent, expandCurrent;
|
||||||
|
int origCurrent, origCount;
|
||||||
DivCSProgress():
|
DivCSProgress():
|
||||||
stage(0),
|
stage(0),
|
||||||
count(0),
|
count(0),
|
||||||
total(0),
|
total(0),
|
||||||
|
optStage(0),
|
||||||
|
findTotal(0),
|
||||||
optCurrent(0),
|
optCurrent(0),
|
||||||
optTotal(0) {}
|
optTotal(0),
|
||||||
|
findCurrent(0),
|
||||||
|
expandCurrent(0),
|
||||||
|
origCurrent(0),
|
||||||
|
origCount(0) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct DivCSOptions {
|
struct DivCSOptions {
|
||||||
|
|
|
@ -846,10 +846,18 @@ SafeWriter* findSubBlocks(SafeWriter* stream, std::vector<SafeWriter*>& subBlock
|
||||||
|
|
||||||
matches.clear();
|
matches.clear();
|
||||||
|
|
||||||
|
if (progress!=NULL) {
|
||||||
|
progress->findTotal=stream->size();
|
||||||
|
progress->optStage=0;
|
||||||
|
}
|
||||||
|
|
||||||
// fast match algorithm
|
// fast match algorithm
|
||||||
// search for small matches, and then find bigger ones
|
// search for small matches, and then find bigger ones
|
||||||
logD("finding possible matches");
|
logD("finding possible matches");
|
||||||
for (size_t i=0; i<stream->size(); i+=8) {
|
for (size_t i=0; i<stream->size(); i+=8) {
|
||||||
|
if (!(i&2047)) {
|
||||||
|
if (progress!=NULL) progress->findCurrent=i;
|
||||||
|
}
|
||||||
bool storedOrig=false;
|
bool storedOrig=false;
|
||||||
for (size_t j=i+matchSize; j<stream->size(); j+=8) {
|
for (size_t j=i+matchSize; j<stream->size(); j+=8) {
|
||||||
if (memcmp(&buf[i],&buf[j],matchSize)==0) {
|
if (memcmp(&buf[i],&buf[j],matchSize)==0) {
|
||||||
|
@ -870,6 +878,9 @@ SafeWriter* findSubBlocks(SafeWriter* stream, std::vector<SafeWriter*>& subBlock
|
||||||
if (progress!=NULL) {
|
if (progress!=NULL) {
|
||||||
if ((int)matches.size()>progress->optTotal) progress->optTotal=matches.size();
|
if ((int)matches.size()>progress->optTotal) progress->optTotal=matches.size();
|
||||||
progress->optCurrent=matches.size();
|
progress->optCurrent=matches.size();
|
||||||
|
progress->origCount=origs.size();
|
||||||
|
progress->findCurrent=stream->size();
|
||||||
|
progress->optStage=1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// quit if there isn't anything
|
// quit if there isn't anything
|
||||||
|
@ -877,7 +888,12 @@ SafeWriter* findSubBlocks(SafeWriter* stream, std::vector<SafeWriter*>& subBlock
|
||||||
|
|
||||||
// search for bigger matches
|
// search for bigger matches
|
||||||
for (size_t i=0; i<matches.size(); i++) {
|
for (size_t i=0; i<matches.size(); i++) {
|
||||||
if ((i&8191)==0) logV("match %d of %d",i,(int)matches.size());
|
if ((i&8191)==0) {
|
||||||
|
logV("match %d of %d",i,(int)matches.size());
|
||||||
|
}
|
||||||
|
if ((i&1023)==0) {
|
||||||
|
if (progress!=NULL) progress->expandCurrent=i;
|
||||||
|
}
|
||||||
BlockMatch& b=matches[i];
|
BlockMatch& b=matches[i];
|
||||||
|
|
||||||
size_t finalLen=b.len;
|
size_t finalLen=b.len;
|
||||||
|
@ -900,6 +916,11 @@ SafeWriter* findSubBlocks(SafeWriter* stream, std::vector<SafeWriter*>& subBlock
|
||||||
b.len=finalLen;
|
b.len=finalLen;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (progress!=NULL) {
|
||||||
|
progress->expandCurrent=matches.size();
|
||||||
|
progress->optStage=2;
|
||||||
|
}
|
||||||
|
|
||||||
// new code MAN... WHY...
|
// new code MAN... WHY...
|
||||||
// basically the workflow should be:
|
// basically the workflow should be:
|
||||||
// - test every block position
|
// - test every block position
|
||||||
|
@ -910,6 +931,7 @@ SafeWriter* findSubBlocks(SafeWriter* stream, std::vector<SafeWriter*>& subBlock
|
||||||
// - pick largest benefit from list
|
// - pick largest benefit from list
|
||||||
// - make sub-blocks!!!
|
// - make sub-blocks!!!
|
||||||
logD("testing %d match groups for benefit",(int)origs.size());
|
logD("testing %d match groups for benefit",(int)origs.size());
|
||||||
|
size_t origIndex=0;
|
||||||
for (size_t i: origs) {
|
for (size_t i: origs) {
|
||||||
size_t orig=matches[i].orig;
|
size_t orig=matches[i].orig;
|
||||||
size_t minSize=MIN_MATCH_SIZE;
|
size_t minSize=MIN_MATCH_SIZE;
|
||||||
|
@ -919,6 +941,10 @@ SafeWriter* findSubBlocks(SafeWriter* stream, std::vector<SafeWriter*>& subBlock
|
||||||
|
|
||||||
testMatches.clear();
|
testMatches.clear();
|
||||||
|
|
||||||
|
if (progress!=NULL) progress->origCurrent=origIndex;
|
||||||
|
|
||||||
|
origIndex++;
|
||||||
|
|
||||||
// collect matches with this orig value
|
// collect matches with this orig value
|
||||||
for (size_t j=i; j<matches.size(); j++) {
|
for (size_t j=i; j<matches.size(); j++) {
|
||||||
if (matches[j].orig!=orig) break;
|
if (matches[j].orig!=orig) break;
|
||||||
|
@ -1018,6 +1044,11 @@ SafeWriter* findSubBlocks(SafeWriter* stream, std::vector<SafeWriter*>& subBlock
|
||||||
size_t bestOrig=matches[bestBenefit.index].orig;
|
size_t bestOrig=matches[bestBenefit.index].orig;
|
||||||
logI("match count %d",(int)workMatches.size());
|
logI("match count %d",(int)workMatches.size());
|
||||||
|
|
||||||
|
if (progress!=NULL) {
|
||||||
|
progress->optStage=3;
|
||||||
|
progress->origCurrent=origs.size();
|
||||||
|
}
|
||||||
|
|
||||||
// make sub-block
|
// make sub-block
|
||||||
size_t subBlockID=subBlocks.size();
|
size_t subBlockID=subBlocks.size();
|
||||||
logV("new sub-block %d",(int)subBlockID);
|
logV("new sub-block %d",(int)subBlockID);
|
||||||
|
|
|
@ -6065,7 +6065,11 @@ bool FurnaceGUI::loop() {
|
||||||
} else {
|
} else {
|
||||||
WAKE_UP;
|
WAKE_UP;
|
||||||
ImGui::Text("Exporting...");
|
ImGui::Text("Exporting...");
|
||||||
ImGui::Text("%d/%d",csProgress.optCurrent,csProgress.optTotal);
|
ImGui::Text("opt stage: %d",csProgress.optStage);
|
||||||
|
ImGui::Text("pass: %d/%d",csProgress.optCurrent,csProgress.optTotal);
|
||||||
|
ImGui::Text("find: %d/%d",csProgress.findCurrent,csProgress.findTotal);
|
||||||
|
ImGui::Text("expand: %d/%d",csProgress.expandCurrent,csProgress.optCurrent);
|
||||||
|
ImGui::Text("benefit: %d/%d",csProgress.origCurrent,csProgress.origCount);
|
||||||
|
|
||||||
// check whether we're done
|
// check whether we're done
|
||||||
if (csExportDone) {
|
if (csExportDone) {
|
||||||
|
|
Loading…
Reference in a new issue