This patch implements the Anisotropic Kuwahara filter for the Realtime compositor and replaces the existing CPU implementation with a new one to be compatible with the GPU implementation. The implementation is based on three papers on Anisotropic Kuwahara filtering, presented and detailed in the code. The new implementation exposes two extra parameters that control the sharpness and directionality of the output, giving more artistic freedom. While the implementation is different from the existing CPU implementation, it is a higher quality one that is also faster and conforms better to the methods described in the papers. Examples can be seen in the pull request description. Pull Request: https://projects.blender.org/blender/blender/pulls/110786
26 lines
759 B
C++
26 lines
759 B
C++
/* SPDX-FileCopyrightText: 2023 Blender Foundation
|
|
*
|
|
* SPDX-License-Identifier: GPL-2.0-or-later */
|
|
|
|
#pragma once
|
|
|
|
#include "COM_MultiThreadedOperation.h"
|
|
|
|
namespace blender::compositor {
|
|
|
|
class KuwaharaAnisotropicStructureTensorOperation : public MultiThreadedOperation {
|
|
SocketReader *image_reader_;
|
|
|
|
public:
|
|
KuwaharaAnisotropicStructureTensorOperation();
|
|
|
|
void init_execution() override;
|
|
void deinit_execution() override;
|
|
void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override;
|
|
void update_memory_buffer_partial(MemoryBuffer *output,
|
|
const rcti &area,
|
|
Span<MemoryBuffer *> inputs) override;
|
|
};
|
|
|
|
} // namespace blender::compositor
|