dandere2x/dandere2x_cpp/frame/Frame_Utilities.h
Tyler f636a3eeb2
cpp remaster (#211)
Co-authored-by: akai_katto <akaikatto@gmail.com>
2021-06-24 19:47:02 -07:00

40 lines
1.2 KiB
C++

//
// Created by tyler on 02/03/2021.
//
#ifndef CPP_REWORK_FRAME_UTILITIES_H
#define CPP_REWORK_FRAME_UTILITIES_H
#include "Frame.h"
class FrameUtilities{
public:
static void copy_frame_using_blocks(shared_ptr<Frame> final_frame,
shared_ptr<Frame> base_image,
const vector<vector<shared_ptr<Block>>>& matched_blocks,
const int block_size){
for (const vector<shared_ptr<Block>>& row: matched_blocks){
for (const shared_ptr<Block>& block: row) {
// todo fix this technical debt, see the issues in "Predictive Frame"
if (block == nullptr)
continue;
if (block->sum == -1) // -1 denotes an invalid block.
continue;
for (int i = 0; i < block_size; i++) {
for (int j = 0; j < block_size; j++) {
final_frame->set_color(block->x_start + i, block->y_start + j,
base_image->get_color(block->x_end + i, block->y_end + j));
}
}
}
}
}
};
#endif //CPP_REWORK_FRAME_UTILITIES_H