Buffer2D<Float3> Denoiser::Filter(const FrameInfo &frameInfo){ int height = frameInfo.m_beauty.m_height; int width = frameInfo.m_beauty.m_width; Buffer2D<Float3> filteredImage = CreateBuffer2D<Float3>(width, height); int kernelRadius = 32; #pragma omp parallel for for (int y = 0; y < height; y++) { for (int x = 0; x < width; x++) { // TODO: Joint bilateral filter // filteredImage(x, y) = frameInfo.m_beauty(x, y);
int x_start = std::max(0, x - kernelRadius); int x_end = std::min(width - 1, x + kernelRadius); int y_start = std::max(0, y - kernelRadius); int y_end = std::min(height - 1, y + kernelRadius);
auto center_postion = frameInfo.m_position(x, y); auto center_normal = frameInfo.m_normal(x, y); auto center_color = frameInfo.m_beauty(x, y);
Float3 final_color; auto total_weight = .0f;
for (int m = x_start; m <= x_end; m++) { for (int n = y_start; n <= y_end; n++) {
auto postion = frameInfo.m_position(m, n); auto normal = frameInfo.m_normal(m, n); auto color = frameInfo.m_beauty(m, n);