Skip to content

Commit

Permalink
fix bottom/right using wrong sign
Browse files Browse the repository at this point in the history
  • Loading branch information
noizuy committed Feb 21, 2024
1 parent a3c1a38 commit 6e39773
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/bore.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ typedef struct {
int step;
} FixBrightnessData;

static void processRow(int row, int w, ptrdiff_t stride, float *dstp, FixBrightnessData *d) {
static void processRow(int row, int w, int h, ptrdiff_t stride, float *dstp, FixBrightnessData *d) {
int x;
float cur;
float ref;

int sign = 1;
if (row > w / 2)
if (row > h / 2)
sign = -1;

float sum = 0.f;
Expand Down Expand Up @@ -55,13 +55,13 @@ static void processRow(int row, int w, ptrdiff_t stride, float *dstp, FixBrightn
}
}

static void processColumn(int column, int h, ptrdiff_t stride, float *dstp, FixBrightnessData *d) {
static void processColumn(int column, int w, int h, ptrdiff_t stride, float *dstp, FixBrightnessData *d) {
int x;
float cur;
float ref;

int sign = 1;
if (column > h / 2)
if (column > w / 2)
sign = -1;

float sum = 0.f;
Expand Down Expand Up @@ -112,19 +112,19 @@ static const VSFrame *VS_CC fixBrightnessGetFrame(int n, int activationReason, v

if (d->top != 0) {
for (int row = d->top - 1; row > -1; --row)
processRow(row, w, stride, dstp, d);
processRow(row, w, h, stride, dstp, d);
}
if (d->bottom != 0) {
for (int row = h - d->bottom; row < h; ++row)
processRow(row, w, stride, dstp, d);
processRow(row, w, h, stride, dstp, d);
}
if (d->left != 0) {
for (int column = d->left - 1; column > -1; --column)
processColumn(column, h, stride, dstp, d);
processColumn(column, w, h, stride, dstp, d);
}
if (d->right != 0) {
for (int column = w - d->right; column < w; ++column)
processColumn(column, h, stride, dstp, d);
processColumn(column, w, h, stride, dstp, d);
}


Expand Down

0 comments on commit 6e39773

Please sign in to comment.