Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce guetzli memory usage by 30% #156

Merged
merged 8 commits into from
Mar 31, 2017
Prev Previous commit
Next Next commit
Clear the global_order vector after it is not used in the current ite…
…ration.
  • Loading branch information
szabadka committed Mar 31, 2017
commit 23be8a8e7f18954e2bea57bfbdb8c4f5c959b499
4 changes: 3 additions & 1 deletion guetzli/processor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -719,6 +719,8 @@ void Processor::SelectFrequencyMasking(const JPEGData& jpg, OutputImage* img,
break;
}
}
size_t global_order_size = global_order.size();
std::vector<std::pair<int, float>>().swap(global_order);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So maybe merge this with the commit that added the clear?


for (int i = 0; i < num_blocks; ++i) {
max_block_error[i] += block_weight[i] * val_threshold * direction;
Expand All @@ -737,7 +739,7 @@ void Processor::SelectFrequencyMasking(const JPEGData& jpg, OutputImage* img,
"Blocks[%zd/%d/%d] ValThres[%.4f] Out[%7zd] EstErr[%.2f%%]",
stats_->counters[kNumItersCnt], img->FrameTypeStr().c_str(),
comp_mask, direction > 0 ? "up" : "down", changed_coeffs,
global_order.size(), changed_blocks.size(),
global_order_size, changed_blocks.size(),
blocks_to_change, num_blocks, val_threshold,
encoded_jpg.size(),
100.0 - (100.0 * est_jpg_size) / encoded_jpg.size());
Expand Down