     [ dup ] data-map!( int -- float[2] )
 ] unit-test
 
+: float-pixels>byte-pixels* ( floats scale bias -- bytes )
+    '[
+        [ _ 255.0 * v*n _ 255.0 * v+n float-4 int-4 vconvert ] 4 napply 
+        [ int-4 short-8 vconvert ] 2bi@
+        short-8 uchar-16 vconvert
+    ] data-map( float-4[4] -- uchar-16 ) ; inline
+
+: float-pixels>byte-pixels ( floats -- bytes )
+    1.0 0.0 float-pixels>byte-pixels* ;
+
 [
     B{
         127 191 255 63

    B{  10  20  30  40  50  60  70  80  90 100 110 120 130 140 150 160 }
    B{  11  22  33  44  55  66  77  88  99 110 121 132 143 154 165 176 }
    B{  15  25  35  45  55  65  75  85  95 105 115 125 135 145 155 165 }
    [ vmerge-transpose vmerge-transpose ]
    data-map( uchar-16 uchar-16 uchar-16 uchar-16 -- uchar-16[4] )
] unit-test

! (c)Joe Groff bsd license
USING: alien.data.map fry generalizations kernel math.vectors
math.vectors.conversion math math.vectors.simd
specialized-arrays tools.test ;
FROM: alien.c-types => uchar short int float ;
SIMDS: float int short uchar ;
