Skip to content

Commit

Permalink
Fix calculation of interpolation parameters for negative block shifts,
Browse files Browse the repository at this point in the history
  • Loading branch information
heckflosse committed Sep 12, 2018
1 parent d1f63f6 commit 7cbf1f6
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions rtengine/CA_correct_RT.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1029,11 +1029,17 @@ float* RawImageSource::CA_correct_RT(
//some parameters for the bilinear interpolation
shiftvfloor[c] = floor((float)lblockshifts[c>>1][0]);
shiftvceil[c] = ceil((float)lblockshifts[c>>1][0]);
shiftvfrac[c] = lblockshifts[c>>1][0] - shiftvfloor[c];
if (lblockshifts[c>>1][0] < 0.f) {
std::swap(shiftvfloor[c], shiftvceil[c]);
}
shiftvfrac[c] = fabs(lblockshifts[c>>1][0] - shiftvfloor[c]);

shifthfloor[c] = floor((float)lblockshifts[c>>1][1]);
shifthceil[c] = ceil((float)lblockshifts[c>>1][1]);
shifthfrac[c] = lblockshifts[c>>1][1] - shifthfloor[c];
if (lblockshifts[c>>1][1] < 0.f) {
std::swap(shifthfloor[c], shifthceil[c]);
}
shifthfrac[c] = fabs(lblockshifts[c>>1][1] - shifthfloor[c]);

GRBdir[0][c] = lblockshifts[c>>1][0] > 0 ? 2 : -2;
GRBdir[1][c] = lblockshifts[c>>1][1] > 0 ? 2 : -2;
Expand Down

0 comments on commit 7cbf1f6

Please sign in to comment.