Skip to content

Commit

Permalink
fix(pixel): update convolve() for even kernel sizes
Browse files Browse the repository at this point in the history
- since even kernel sizes are more left/top centric, update
  max iteration limits to ensure right colum & bottom row
  will be processed
  • Loading branch information
postspectacular committed Mar 19, 2021
1 parent a7e1170 commit b086224
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/pixel/src/convolve.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ const convolve = ({
strideY,
}: ReturnType<typeof initConvolve>) => {
ensureChannel(src.format, channel);
const maxY = src.height - kh2;
const maxX = src.width - kw2;
const maxY = src.height - kh2 + (kh2 & 1 ? 0 : 1);
const maxX = src.width - kw2 + (kw2 & 1 ? 0 : 1);
const padX = pad && strideX === 1;
const padY = pad && strideY === 1;
const dpix = dest.pixels;
Expand Down

0 comments on commit b086224

Please sign in to comment.