Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix image plane copying in nlmeans prefilter setup
When nlmeans_prefilter() is preparing to apply a pre-filter to an image plane, it first attempts to make a copy of the mem image plane into the mem_pre plane which will hold the pre-filter's output. However, the existing logic, which mirrors the loop over all pixel rows in nlmeans_alloc(), improperly leaves the bottom 2*border rows of the mem_pre plane uninitialized. Where nlmeans_alloc() correctly copies the source image's rows into its plane, by adding the correct offset to the memcpy(3) destination to locate the image pixel data between the horizontal and vertical borders, in nlmeans_prefilter() the intention is to copy both the image and the borders. However, the current loop only iterates h times, i.e., the size of the image itself, and skips the last (bh - h) = 2*border rows. Instead, we replace the loop with a single memcpy(3) call which just duplicates the entire mem image plane, including the border data.
- Loading branch information