18 #ifndef PIC_UTIL_GL_BICUBIC_HPP 19 #define PIC_UTIL_GL_BICUBIC_HPP 21 #include "../../base.hpp" 23 #include "../../util/string.hpp" 41 return (3.0 * y_sq * y - 6.0 * y_sq + 4.0) / 6.0;
45 return (-1.0 * y_sq * y + 6.0 * y_sq - 12.0 * y + 8.0) / 6.0;
66 vec4 textureBicubic(sampler2D u_tex, vec2 coords)
68 ivec2 tSize_u = textureSize(u_tex, 0) - ivec2(1, 1);
69 vec2 tSize = vec2(tSize_u);
70 vec2 coords_uc = vec2(coords * tSize);
71 vec2 d = fract(coords_uc);
73 ivec2 coords_i = ivec2(floor(coords_uc));
78 for(
int j = -1; j < 3; j++) {
80 e.y = clamp(coords_i.y + j, 0, tSize_u.y);
82 for(
int i = -1; i < 3; i++) {
83 r.x =
Bicubic(-(
float(i) - d.x));
84 e.x = clamp(coords_i.x + i, 0, tSize_u.x);
87 ret += r.x * texelFetch(u_tex, e, 0);
#define MAKE_STRING(input_string)
float Bicubic(float x)
Bicubic.
Definition: image_sampler.hpp:129
PIC_INLINE std::string GLSL_TEXTURE_BICUBIC()
GLSL_TEXTURE_BICUBIC.
Definition: bicubic.hpp:60
#define PIC_INLINE
Definition: base.hpp:33
PIC_INLINE std::string GLSL_BICUBIC()
GLSL_BICUBIC returns bicubic sample.
Definition: bicubic.hpp:31
Definition: bilateral_separation.hpp:25