WIP: Significant code bloat in `hip`
I need to finish writing this ticket
While looking at #19474 (phash
in particular) I noticed that the majority of size of the PerceptualHash
module is due to a single binding (meanFilter
). This single binding (which merely produces a stencil
# LANGUAGE FlexibleContexts # # LANGUAGE TypeFamilies #
module PerceptualHash ( --imgHash
--, fileHash
--, hammingDistance
hello
) where
import Data.Word (Word64)
import Graphics.Image (Array, Bilinear (..), Border (Edge, Reflect), Image,
Pixel (PixelX, PixelY), RSU (..), X, Y, convolve, crop,
makeImage, readImage, resize, transpose, (|*|))
idMat :: (Fractional e, Array arr X e) => Image arr X e
idMat = makeImage (3,3) (\_ -> PixelX (1/19))
{-# INLINE meanFilter #-}
meanFilter :: (Fractional e, Array arr X e, Array arr cs e) => Image arr cs e -> Image arr cs e
meanFilter = {-# SCC "meanFilter" #-} convolve Reflect idMat
type CS = X
hello :: Image RSU CS Double -> Image RSU CS Double
hello = meanFilter
We first inline Graphics.Image.Interface.Repa.Generic.makeWindowed
: