Skip to content

Commit

Permalink
Remove more templates
Browse files Browse the repository at this point in the history
  • Loading branch information
xelatihy committed Jul 8, 2023
1 parent 670c13c commit 76162da
Show file tree
Hide file tree
Showing 6 changed files with 321 additions and 350 deletions.
6 changes: 3 additions & 3 deletions apps/ycolorgrade.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ void run(const vector<string>& args) {
// switch between interactive and offline
if (!interactive) {
// apply color grade
image = colorgrade_image(image, params);
image = colorgrade_image(image, true, params);

// save image
save_image(outname, image, true);
Expand All @@ -84,7 +84,7 @@ void run(const vector<string>& args) {

// display image
auto display = array2d<vec4f>{image.extents()};
colorgrade_image(display, image, params);
colorgrade_image(display, image, true, params);

// opengl image
auto glimage = glimage_state{};
Expand Down Expand Up @@ -126,7 +126,7 @@ void run(const vector<string>& args) {
"highlights color", params.highlights_color);
end_gui_header();
if (edited > 0) {
colorgrade_image(display, image, params);
colorgrade_image(display, image, true, params);
set_image(glimage, display);
}
}
Expand Down
2 changes: 1 addition & 1 deletion libs/yocto/yocto_geometry.h
Original file line number Diff line number Diff line change
Expand Up @@ -658,7 +658,7 @@ constexpr kernel pair<vec3f, vec3f> quad_tangents_fromuv(
namespace yocto {

// Computes the aspect ratio.
constexpr kernel float aspect_ratio(const vec2f& size) {
constexpr kernel float aspect_ratio(const vec2i& size) {
return size.x / size.y;
}

Expand Down
20 changes: 10 additions & 10 deletions libs/yocto/yocto_image.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ namespace yocto {
// Resize an image.
template <size_t N>
array2d<vec<float, N>> resize_image(
const array2d<vec<float, N>>& image, const vec2s& extents_) {
const array2d<vec<float, N>>& image, const vec2i& extents_) {
// determine new size
auto extents = extents_;
auto aspect = (double)image.extent(0) / (double)image.extent(1);
Expand All @@ -68,15 +68,15 @@ array2d<vec<float, N>> resize_image(
}

// Explicit instantiations
template array2d<vec1f> resize_image(const array2d<vec1f>&, const vec2s&);
template array2d<vec2f> resize_image(const array2d<vec2f>&, const vec2s&);
template array2d<vec3f> resize_image(const array2d<vec3f>&, const vec2s&);
template array2d<vec4f> resize_image(const array2d<vec4f>&, const vec2s&);
template array2d<vec1f> resize_image(const array2d<vec1f>&, const vec2i&);
template array2d<vec2f> resize_image(const array2d<vec2f>&, const vec2i&);
template array2d<vec3f> resize_image(const array2d<vec3f>&, const vec2i&);
template array2d<vec4f> resize_image(const array2d<vec4f>&, const vec2i&);

// Resize an image.
template <size_t N>
array2d<vec<byte, N>> resize_image(
const array2d<vec<byte, N>>& image, const vec2s& extents_) {
const array2d<vec<byte, N>>& image, const vec2i& extents_) {
// determine new size
auto extents = extents_;
auto aspect = (double)image.extent(0) / (double)image.extent(1);
Expand All @@ -102,9 +102,9 @@ array2d<vec<byte, N>> resize_image(
}

// Explicit instantiations
template array2d<vec1b> resize_image(const array2d<vec1b>&, const vec2s&);
template array2d<vec2b> resize_image(const array2d<vec2b>&, const vec2s&);
template array2d<vec3b> resize_image(const array2d<vec3b>&, const vec2s&);
template array2d<vec4b> resize_image(const array2d<vec4b>&, const vec2s&);
template array2d<vec1b> resize_image(const array2d<vec1b>&, const vec2i&);
template array2d<vec2b> resize_image(const array2d<vec2b>&, const vec2i&);
template array2d<vec3b> resize_image(const array2d<vec3b>&, const vec2i&);
template array2d<vec4b> resize_image(const array2d<vec4b>&, const vec2i&);

} // namespace yocto
Loading

0 comments on commit 76162da

Please sign in to comment.