Commit Graph

6 Commits

Author SHA1 Message Date
simon gladman
b93479c455 Fix arrayFromBuffer
A buffer's `data` may contain padding when the `rowBytes` isn't equal to the number of chanels * width * size of the element. I've updated arrayFromBuffer to return an array that excludes any `rowByte` padding.
2019-05-01 13:47:55 +01:00
simon gladman
96e181c53e update test image size 2019-04-30 18:13:43 +01:00
simon gladman
a55641a1b2 [vImage] Don't Infer Pixel Size in Buffer Copy
A buffer's `rowBytes` doesn't have a direct relationship with its `height`, so `rowBytes / Int(width)` isn't a good way to calculate pixel size. To resolve this, I've added `pixelSize` as a parameter to `vImage_Buffer.copy`.
2019-04-30 17:50:10 +01:00
Steve (Numerics) Canon
4dc72c7df9 XFAIL the vImage test, as it's falling over for arm64. 2019-04-26 11:59:04 -04:00
Steve (Numerics) Canon
4c7027c038 Temporarily disable a new vImage test that's failing for some platforms. 2019-04-25 14:01:46 -04:00
simon gladman
5936a04510 [Accelerate] [vImage] Swift Overlays (#23592)
* Accelerate vImage Swift Overlays

A suite of functions, enumerations, and option sets to make working with vImage in Swift simpler.

* vImage_Buffer - new initializers to instantiate and initialize buffers with a single function call.
* vImage_Buffer - new functions to copy buffers and create CGImage instances from contents.
* vImage_CGImageFormat - new initializers.
* vImage_CGImageFormat - new equivalence operator.
* vImageConverter - methods to wrap free functions.
* vImageConverter - new make and convert functions.
* vImageCVImageFormat - new make functions.
* vImageCVImageFormat - methods to wrap free functions.
* vImage_Error - errorDescription function.
* vImage flags as an option set.

* Add new methods for generating CV -> CG and CG -> CV converters.

* update comments: `height` and `width` to `size`.

* `vImage_CGImageFormat.componentCount` should be `Int`.

* `vImage_CGImageFormat.componentCount` should be `Int`

* Move `self.init()` to after the size check for kvImageNoAllocate init.

* Buffer initializers to width and height rather than size.

* change vImage_CGImageFormat lightweight initializer to accept Int for `bitsPerComponent` and `bitsPerPixel`.

* Flesh out docs for vImage_Buffer.size

* Remove faux initializer in favor of new static function: `preferredAlignmentAndRowBytes`.

* Change functions to use proper error handling rather than inout error codes.

* Removed `flags` from basic init.

The only real flag to pass here is print diagnostics to console, and I now throw proper errors.

* Tests to check error throwing for buffer copy.

* remove unnecessary import, add missing docs.

* Add comments to error enums.

* Fix bug creating string from format code.

* Make `vImageCVImageFormat.formatCode` a `UInt32`.

* Remove equivalence operator from `CGImageFormat`.
2019-04-25 08:40:45 -04:00