Skip to content

Commit

Permalink
Bug fix in convert_components (#1048)
Browse files Browse the repository at this point in the history
  • Loading branch information
xelatihy authored Aug 26, 2020
1 parent e36d19d commit f692239
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions libs/yocto/yocto_image.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1459,8 +1459,8 @@ static vector<float> convert_components(
throw std::invalid_argument{"components not supported"};
if (components == components_to) return pixels;

auto cpixels = vector<float>((size_t)components_to * pixels.size());
for (auto i = 0ull; i < pixels.size(); i++) {
auto cpixels = vector<float>((size_t)components_to * pixels.size() / components);
for (auto i = 0ull; i < pixels.size() / components; i++) {
auto vp = pixels.data() + i * components;
auto cp = cpixels.data() + i * components_to;
if (components_to > 0) cp[0] = (components > 0) ? vp[0] : 0;
Expand Down

0 comments on commit f692239

Please sign in to comment.