| 140 | } |
| 141 | |
| 142 | void Transform::ResizeLanczos(Image& Source, Image& Dest, int a, cl::NDRange Range) |
| 143 | { |
| 144 | float RatioX = Source.Width() * 1.f / Dest.Width(); |
| 145 | float RatioY = Source.Height() * 1.f / Dest.Height(); |
| 146 | |
| 147 | const SImage& SrcImg = Source; |
| 148 | const SImage& DstImg = Dest; |
| 149 | |
| 150 | uint length = max(DstImg.Width, DstImg.Height); |
| 151 | int size = find_lanczos_buffer_size(length); |
| 152 | |
| 153 | TempBuffer factors(*m_CL, size * 2 * a * 2 * sizeof(float)); // 2 lists of factors containing 2*a*size items |
| 154 | |
| 155 | cl::make_kernel<cl::Buffer, float, float, int> |
| 156 | ((cl::Program) SelectProgram(Source), "prepare_resize_lanczos" + to_string(a)) |
| 157 | (cl::EnqueueArgs(*m_CL, cl::NDRange(length, a * 2, 2)), |
| 158 | factors, RatioX, RatioY, size); |
| 159 | |
| 160 | switch (a) |
| 161 | { |
| 162 | case 2: |
| 163 | Kernel_(*m_CL, SelectProgram(Source), resize_lanczos2, Range, LOCAL_RANGE, |
| 164 | In(Source, factors), Out(Dest), SrcImg, DstImg, RatioX, RatioY, size); |
| 165 | break; |
| 166 | case 3: |
| 167 | Kernel_(*m_CL, SelectProgram(Source), resize_lanczos3, Range, LOCAL_RANGE, |
| 168 | In(Source, factors), Out(Dest), SrcImg, DstImg, RatioX, RatioY, size); |
| 169 | break; |
| 170 | default: |
| 171 | throw cl::Error(CL_INVALID_ARG_VALUE, "unsupported lanczos size"); |
| 172 | } |
| 173 | |
| 174 | } |
| 175 | |
| 176 | void Transform::Resize(Image& Source, Image& Dest, EInterpolationType Interpolation, bool KeepRatio) |
| 177 | { |
nothing calls this directly
no test coverage detected