Skip to content

Commit

Permalink
Fix pixel value overflow
Browse files Browse the repository at this point in the history
  • Loading branch information
HolyWu committed Dec 24, 2014
1 parent 3405e36 commit 896fc86
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion AddGrain/AddGrain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,8 @@ static void UpdateFrame(T1 * dstp, const int width, const int height, const int
T2 val = (dstp[x] << shift1) ^ lower;
const T2 nz = pNW2[x] >> shift2;
val = std::min(std::max(val + nz, lower), upper);
dstp[x] = (val ^ lower) >> shift1;
dstp[x] = val ^ lower;
dstp[x] >>= shift1;
}
dstp += stride;
pNW2 += d->nPitch[plane];
Expand Down

0 comments on commit 896fc86

Please sign in to comment.