Minor efficiency fix/refactoring

This commit is contained in:
Stephen Seo 2021-12-04 09:59:05 +09:00
parent f9970025c1
commit 750e0d07bb

View file

@ -472,10 +472,12 @@ std::tuple<bool, std::vector<AVFrame *>> Video::HandleDecodingPacket(
if (output_as_pngs) { if (output_as_pngs) {
std::string out_name = "output_"; std::string out_name = "output_";
unsigned int tens = 1;
for (unsigned int i = 0; i < 9; ++i) { for (unsigned int i = 0; i < 9; ++i) {
if (frame_count_ < (unsigned int)std::pow(10, i)) { if (frame_count_ < tens) {
out_name += "0"; out_name += "0";
} }
tens *= 10;
} }
out_name += std::to_string(frame_count_); out_name += std::to_string(frame_count_);
out_name += ".png"; out_name += ".png";