~ubuntu-branches/ubuntu/trusty/vips/trusty-proposed

« back to all changes in this revision

Viewing changes to libvips/colour/Lab2LabQ.c

  • Committer: Package Import Robot
  • Author(s): Jay Berkenbilt
  • Date: 2014-03-29 12:29:29 UTC
  • mfrom: (1.1.21) (30.1.16 sid)
  • Revision ID: package-import@ubuntu.com-20140329122929-fvxnaann32ex0gzk
Tags: 7.38.5-2
Enable dh-autoreconf. (Closes: #742872)

Show diffs side-by-side

added added

removed removed

Lines of Context:
85
85
static void
86
86
vips_Lab2LabQ_line( VipsColour *colour, VipsPel *out, VipsPel **in, int width )
87
87
{
88
 
        float *p = (float *) in[0];
 
88
        float * restrict p = (float *) in[0];
 
89
        VipsPel * restrict q = out; 
89
90
 
90
91
        float fval;
91
92
        int lsbs;
100
101
                intv = 10.23 * p[0] + 0.5;      /* scale L up to 10 bits */
101
102
                intv = VIPS_CLIP( 0, intv, 1023 );
102
103
                lsbs = (intv & 0x3) << 6;       /* 00000011 -> 11000000 */
103
 
                out[0] = (intv >> 2);           /* drop bot 2 bits and store */
 
104
                q[0] = (intv >> 2);             /* drop bot 2 bits and store */
104
105
 
105
106
                fval = 8.0 * p[1];              /* do a */
106
107
                intv = VIPS_RINT( fval );
107
108
                intv = VIPS_CLIP( -1024, intv, 1023 );
108
109
                lsbs |= (intv & 0x7) << 3;      /* 00000111 -> 00111000 */
109
 
                out[1] = (intv >> 3);           /* drop bot 3 bits & store */
 
110
                q[1] = (intv >> 3);             /* drop bot 3 bits & store */
110
111
 
111
112
                fval = 8.0 * p[2];              /* do b */
112
113
                intv = VIPS_RINT( fval );
113
114
                intv = VIPS_CLIP( -1024, intv, 1023 );
114
115
                lsbs |= (intv & 0x7);
115
 
                out[2] = (intv >> 3);
 
116
                q[2] = (intv >> 3);
116
117
 
117
 
                out[3] = lsbs;                /* store lsb band */
 
118
                q[3] = lsbs;                    /* store lsb band */
118
119
 
119
120
                p += 3;
120
 
                out += 4;
 
121
                q += 4;
121
122
        }
122
123
}
123
124