In Twain the capability ICAP_BITDEPTH defines the number of bits to transfer per pixel during a scan. So for an RGB image with 8 bit per color channel, ICAP_BITDEPTH is 24.
In Sane the depth is defined as the number of bits per color channel, so for an RGB image with 8 bit per color channel, depth is 8.
See Page 10-132 (PDF Page 550) if the Twain 2.5 Spec. Obviously older spec versions where not as exact, so there were misunderstandings.
The existing code to handle ICAP_BITDEPTH did not consider this difference and returned the sane depth value.
This merge request fixes this and adds the ability to set the depth to 16 bit per color channel for those sane backends that support the "depth" option.
-- v2: dlls/sane.ds: Refuse native transfer mode with depth 16 bit dlls/sane.ds: Fix ICAP_BITDEPTH semantics, allow setting it