Skip to content
This repository has been archived by the owner on Sep 20, 2021. It is now read-only.

Scan line padding (take 2) #7

Merged
merged 4 commits into from
Dec 3, 2016

Conversation

plumbojumbo
Copy link
Collaborator

This PR addresses two problems introduced by 19f22bf:

  • The dHash scan line size was fixed for macOS only.
  • The use of OS_ALIGN results in a 64-byte scan line (and thus 32 bytes of zero padding) in images resized for aHash/pHash whereas their OSFastGraphics implementations expect contiguous scan lines of 32 bytes.

As a fix, an inline function, used by both macOS and iOS, is introduced that forces 32 bytes per row for aHash and pHash. Also, a basic test is added to detect obvious padding misconfigurations.

19f22bf fixed this for macOS but not for iOS.
19f22bf currently breaks calculations of aHash and pHash: For an image width of 8 pixels OS_ALIGN advices a 64-byte scanline, adding 32 bytes of zero-padding, but the aHash and pHash implementations in OSFastGraphics expect 32-byte scanlines without any padding. This commit introduces an inline mediator function to force a 32-byte scanline for images with an width of 8 pixels.
@ameingast ameingast merged commit e6240a0 into ameingast:master Dec 3, 2016
@ameingast
Copy link
Owner

Great stuff, thanks again!

@plumbojumbo plumbojumbo deleted the fix-scan-line-padding branch December 3, 2016 22:35
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants