Skip to content

Commit

Permalink
fixed performance bug + getting ready for master merge
Browse files Browse the repository at this point in the history
  • Loading branch information
akai-katto committed Jun 24, 2021
1 parent 491ccfe commit 633d7cd
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 22 deletions.
3 changes: 2 additions & 1 deletion cpp_rework/dandere2x_utilities.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// Created by Tyler on 5/10/2021.
//
#include "dandere2x_utilities.h"
#include "easyloggingpp/easylogging++.h"
#include "math.h"

char dandere2x_utilities::separator() {
Expand Down Expand Up @@ -40,5 +41,5 @@ void dandere2x_utilities::wait_for_file(const std::string &name) {
}

bool dandere2x_utilities::debug_enabled() {
return true;
return false;
}
4 changes: 2 additions & 2 deletions cpp_rework/frame/Frame.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,12 @@ class Frame {
void apply_noise(int range);

Frame::Color &get_color(const int x, const int y) const {
sanity_check("Frame::Color &Frame::get_color", x, y);
// sanity_check("Frame::Color &Frame::get_color", x, y);
return const_cast<Frame::Color &>(image_colors[x][y]);
}

void set_color(const int x, const int y, const Frame::Color &color) {
sanity_check("void Frame::set_color", x, y);
// sanity_check("void Frame::set_color", x, y);
image_colors[x][y] = color;
}

Expand Down
39 changes: 20 additions & 19 deletions cpp_rework/plugins/predictive_frame/PredictiveFrame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,25 +50,26 @@ void PredictiveFrame::parallel_function_call(int x, int y) {
return;
}

// // Find (x,y) in frame_2 in frame_1. Note we have to go in the reverse. We can't go frame_1 -> frame_2 since
// // the matched blocks may not be on perfect intervals of block_size.
// // Since we're going frame_2 -> frame_1, the matched block is "being matched in reverse", so flip the block
// // so we can go frame_1 -> frame_2.
// Block matched_block = this->block_matcher->match_block(x, y, block_size);
// matched_block.reverse_block();
//
// // Check to see if the current matched block produces a valid match
// if (eval->evaluate(this->current_frame,
// this->next_frame, this->next_frame_compressed,
// matched_block,
// block_size)) {
//
// matched_moving_blocks += 1;
// this->matched_blocks[x][y] = make_shared<Block>(matched_block.x_start, matched_block.y_start,
// matched_block.x_end, matched_block.y_end,
// 1);
// return;
// }
// Find (x,y) in frame_2 in frame_1. Note we have to go in the reverse. We can't go frame_1 -> frame_2 since
// the matched blocks may not be on perfect intervals of block_size.
// Since we're going frame_2 -> frame_1, the matched block is "being matched in reverse", so flip the block
// so we can go frame_1 -> frame_2.
Block matched_block = this->block_matcher->match_block(x, y, block_size);
matched_block.reverse_block();

// Check to see if the current matched block produces a valid match
if (eval->evaluate(*this->current_frame,
*this->next_frame,
*this->next_frame_compressed,
matched_block,
block_size)) {

matched_moving_blocks += 1;
this->matched_blocks[x][y] = make_shared<Block>(matched_block.x_start, matched_block.y_start,
matched_block.x_end, matched_block.y_end,
1);
return;
}

// -1 denotes an invalid block.
this->matched_blocks[x][y] = make_shared<Block>(x, y,
Expand Down

0 comments on commit 633d7cd

Please sign in to comment.