1 /** 2 * Mandelbulber v2, a 3D fractal generator ,=#MKNmMMKmmßMNWy, 3 * ,B" ]L,,p%%%,,,§;, "K 4 * Copyright (C) 2021 Mandelbulber Team §R-==%w["'~5]m%=L.=~5N 5 * ,=mm=§M ]=4 yJKA"/-Nsaj "Bw,==,, 6 * This file is part of Mandelbulber. §R.r= jw",M Km .mM FW ",§=ß., ,TN 7 * ,4R =%["w[N=7]J '"5=],""]]M,w,-; T=]M 8 * Mandelbulber is free software: §R.ß~-Q/M=,=5"v"]=Qf,'§"M= =,M.§ Rz]M"Kw 9 * you can redistribute it and/or §w "xDY.J ' -"m=====WeC=\ ""%""y=%"]"" § 10 * modify it under the terms of the "§M=M =D=4"N #"%==A%p M§ M6 R' #"=~.4M 11 * GNU General Public License as §W =, ][T"]C § § '§ e===~ U !§[Z ]N 12 * published by the 4M",,Jm=,"=e~ § § j]]""N BmM"py=ßM 13 * Free Software Foundation, ]§ T,M=& 'YmMMpM9MMM%=w=,,=MT]M m§;'§, 14 * either version 3 of the License, TWw [.j"5=~N[=§%=%W,T ]R,"=="Y[LFT ]N 15 * or (at your option) TW=,-#"%=;[ =Q:["V"" ],,M.m == ]N 16 * any later version. J§"mr"] ,=,," =="""J]= M"M"]==ß" 17 * §= "=C=4 §"eM "=B:m|4"]#F,§~ 18 * Mandelbulber is distributed in "9w=,,]w em%wJ '"~" ,=,,ß" 19 * the hope that it will be useful, . "K= ,=RMMMßM""" 20 * but WITHOUT ANY WARRANTY; .''' 21 * without even the implied warranty 22 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 23 * 24 * See the GNU General Public License for more details. 25 * You should have received a copy of the GNU General Public License 26 * along with Mandelbulber. If not, see <http://www.gnu.org/licenses/>. 27 * 28 * ########################################################################### 29 * 30 * Authors: Krzysztof Marczak (buddhi1980@gmail.com) 31 * 32 * c++ - render post filers with OpenCL 33 */ 34 35 #ifndef MANDELBULBER2_SRC_OPENCL_ENGINE_RENDER_POST_FILTER_H_ 36 #define MANDELBULBER2_SRC_OPENCL_ENGINE_RENDER_POST_FILTER_H_ 37 38 #include <memory> 39 40 #include "color_structures.hpp" 41 #include "include_header_wrapper.hpp" 42 #include "opencl_engine.h" 43 #include "region.hpp" 44 45 // custom includes 46 #ifdef USE_OPENCL 47 #include "opencl/hdr_blur_cl.h" 48 #include "opencl/chromatic_aberration_cl.h" 49 #endif // USE_OPENCL 50 51 struct sParamRender; 52 class cImage; 53 54 class cOpenClEngineRenderPostFilter : public cOpenClEngine 55 { 56 Q_OBJECT 57 58 public: 59 cOpenClEngineRenderPostFilter(cOpenClHardware *hardware); 60 ~cOpenClEngineRenderPostFilter() override; 61 62 #ifdef USE_OPENCL 63 enum enumPostEffectType 64 { 65 hdrBlur = 0, 66 chromaticAberration = 1 67 }; 68 69 void SetParameters( 70 const sParamRender *paramRender, const cRegion<int> ®ion, enumPostEffectType _effectType); 71 bool LoadSourcesAndCompile(std::shared_ptr<const cParameterContainer> params, 72 QString *compilerErrorOutput = nullptr) override; 73 void RegisterInputOutputBuffers(std::shared_ptr<const cParameterContainer> params) override; 74 bool AssignParametersToKernelAdditional(uint argIterator, int deviceIndex) override; 75 bool ProcessQueue(quint64 pixelsLeft, quint64 pixelIndex); 76 bool Render(std::shared_ptr<cImage> image, bool *stopRequest); 77 size_t CalcNeededMemory() override; 78 79 private: 80 const int inputImageIndex = 0; 81 const int outputIndex = 0; 82 83 QString GetKernelName() override; 84 85 enumPostEffectType effectType; 86 QString effectName; 87 88 sParamsHDRBlurCl paramsHDRBlur; 89 sParamsChromaticAberrationCl paramsChromaticAberration; 90 cRegion<int> imageRegion; 91 sRGBFloat aoColor; 92 quint64 numberOfPixels; 93 #endif 94 95 signals: 96 void updateProgressAndStatus(const QString &text, const QString &progressText, double progress); 97 void updateImage(); 98 }; 99 100 #endif /* MANDELBULBER2_SRC_OPENCL_ENGINE_RENDER_POST_FILTER_H_ */ 101