Try to add support for signed 16-bit planar; tidy a couple of C-style casts.