1/* NEON optimized code (C) COPYRIGHT 2009 Motorola
2 *
3 * Use of this source code is governed by a BSD-style license that can be
4 * found in the LICENSE file.
5 */
6
7/*
8 * Modifications done in-house at Motorola
9 *
10 * this is a clone of SkBitmapProcState_matrix.h
11 * and has been tuned to work with the NEON unit.
12 *
13 * Still going back and forth between whether this approach
14 * (clone the entire SkBitmapProcState_matrix.h file or
15 * if I should put just the modified routines in here and
16 * then use a construct like #define DONT_DO_THIS_FUNCTION or
17 * something like that...
18 *
19 * This is for the RepeatX_RepeatY part of the world
20 */
21
22
23#if	!defined(__ARM_HAVE_NEON)
24#error	this file can be used only when the NEON unit is enabled
25#endif
26
27#include <arm_neon.h>
28
29/*
30 * This has been modified on the knowledge that (at the time)
31 * we had the following macro definitions in the parent file
32 *
33 * #define MAKENAME(suffix)        RepeatX_RepeatY ## suffix
34 * #define TILEX_PROCF(fx, max)    (((fx) & 0xFFFF) * ((max) + 1) >> 16)
35 * #define TILEY_PROCF(fy, max)    (((fy) & 0xFFFF) * ((max) + 1) >> 16)
36 * #define TILEX_LOW_BITS(fx, max) ((((fx) & 0xFFFF) * ((max) + 1) >> 12) & 0xF)
37 * #define TILEY_LOW_BITS(fy, max) ((((fy) & 0xFFFF) * ((max) + 1) >> 12) & 0xF)
38 */
39
40/* SkClampMax(val,max) -- bound to 0..max */
41
42#define SCALE_NOFILTER_NAME     MAKENAME(_nofilter_scale_neon)
43#define SCALE_FILTER_NAME       MAKENAME(_filter_scale)
44#define AFFINE_NOFILTER_NAME    MAKENAME(_nofilter_affine_neon)
45#define AFFINE_FILTER_NAME      MAKENAME(_filter_affine)
46#define PERSP_NOFILTER_NAME     MAKENAME(_nofilter_persp_neon)
47#define PERSP_FILTER_NAME       MAKENAME(_filter_persp)
48
49#define PACK_FILTER_X_NAME  MAKENAME(_pack_filter_x)
50#define PACK_FILTER_Y_NAME  MAKENAME(_pack_filter_y)
51
52#ifndef PREAMBLE
53    #define PREAMBLE(state)
54    #define PREAMBLE_PARAM_X
55    #define PREAMBLE_PARAM_Y
56    #define PREAMBLE_ARG_X
57    #define PREAMBLE_ARG_Y
58#endif
59
60static void SCALE_NOFILTER_NAME(const SkBitmapProcState& s,
61                                uint32_t xy[], int count, int x, int y) {
62    SkASSERT((s.fInvType & ~(SkMatrix::kTranslate_Mask |
63                             SkMatrix::kScale_Mask)) == 0);
64
65    PREAMBLE(s);
66    // we store y, x, x, x, x, x
67
68    const unsigned maxX = s.fBitmap->width() - 1;
69    SkFixed fx;
70    {
71        SkPoint pt;
72        s.fInvProc(*s.fInvMatrix, SkIntToScalar(x) + SK_ScalarHalf,
73                                  SkIntToScalar(y) + SK_ScalarHalf, &pt);
74        fx = SkScalarToFixed(pt.fY);
75        const unsigned maxY = s.fBitmap->height() - 1;
76        *xy++ = TILEY_PROCF(fx, maxY);
77        fx = SkScalarToFixed(pt.fX);
78    }
79
80    if (0 == maxX) {
81        // all of the following X values must be 0
82        memset(xy, 0, count * sizeof(uint16_t));
83        return;
84    }
85
86    const SkFixed dx = s.fInvSx;
87
88#ifdef CHECK_FOR_DECAL
89    // test if we don't need to apply the tile proc
90    if ((unsigned)(fx >> 16) <= maxX &&
91        (unsigned)((fx + dx * (count - 1)) >> 16) <= maxX) {
92        decal_nofilter_scale(xy, fx, dx, count);
93    } else
94#endif
95    {
96        int i;
97
98#if	defined(__ARM_HAVE_NEON)
99	/* RBE: very much like done in decal_nofilter ,
100	 * but some processing of the 'fx' information
101         * TILEX_PROCF(fx, max)    (((fx) & 0xFFFF) * ((max) + 1) >> 16)
102	 */
103	if (count >= 8) {
104	    /* SkFixed is 16.16 fixed point */
105	    SkFixed dx2 = dx+dx;
106	    SkFixed dx4 = dx2+dx2;
107	    SkFixed dx8 = dx4+dx4;
108
109	    /* now build fx/fx+dx/fx+2dx/fx+3dx */
110	    SkFixed fx1, fx2, fx3;
111	    int32x2_t lower, upper;
112	    int32x4_t lbase, hbase;
113	    int16_t *dst16 = (int16_t *)xy;
114
115	    fx1 = fx+dx;
116	    fx2 = fx1+dx;
117	    fx3 = fx2+dx;
118
119	    lbase = vdupq_n_s32(fx);
120	    lbase = vsetq_lane_s32(fx1, lbase, 1);
121	    lbase = vsetq_lane_s32(fx2, lbase, 2);
122	    lbase = vsetq_lane_s32(fx3, lbase, 3);
123	    hbase = vaddq_s32(lbase, vdupq_n_s32(dx4));
124
125	    /* store & bump */
126	    do
127	    {
128	        int32x4_t lout;
129		int32x4_t hout;
130		int16x8_t hi16;
131
132         	/* TILEX_PROCF(fx, max) (((fx)&0xFFFF)*((max)+1)>> 16) */
133		/* mask to low 16 [would like to use uzp tricks) */
134	        lout = vandq_s32(lbase, vdupq_n_s32(0xffff));
135	        hout = vandq_s32(hbase, vdupq_n_s32(0xffff));
136		/* bare multiplication, not SkFixedMul */
137		lout = vmulq_s32(lout, vdupq_n_s32(maxX+1));
138		hout = vmulq_s32(hout, vdupq_n_s32(maxX+1));
139
140		/* extraction, using uzp */
141		/* this is ok -- we want all hi(lout)s then all hi(hout)s */
142		asm ("vuzpq.16 %q0, %q1" : "+w" (lout), "+w" (hout));
143		hi16 = vreinterpretq_s16_s32(hout);
144		vst1q_s16(dst16, hi16);
145
146		/* bump our base on to the next */
147		lbase = vaddq_s32 (lbase, vdupq_n_s32(dx8));
148		hbase = vaddq_s32 (hbase, vdupq_n_s32(dx8));
149		dst16 += 8;
150		count -= 8;
151		fx += dx8;
152	    } while (count >= 8);
153	    xy = (uint32_t *) dst16;
154	}
155#else
156	/* simple, portable way of looking at 4 at a crack;
157	 * so gets some loop unrolling, but not full SIMD speed
158	 */
159        for (i = (count >> 2); i > 0; --i) {
160            unsigned a, b;
161            a = TILEX_PROCF(fx, maxX); fx += dx;
162            b = TILEX_PROCF(fx, maxX); fx += dx;
163#ifdef SK_CPU_BENDIAN
164            *xy++ = (a << 16) | b;
165#else
166            *xy++ = (b << 16) | a;
167#endif
168            a = TILEX_PROCF(fx, maxX); fx += dx;
169            b = TILEX_PROCF(fx, maxX); fx += dx;
170#ifdef SK_CPU_BENDIAN
171            *xy++ = (a << 16) | b;
172#else
173            *xy++ = (b << 16) | a;
174#endif
175        }
176	/* loop doesn't adjust count */
177	count -= (count>>2);
178#endif
179        uint16_t* xx = (uint16_t*)xy;
180        for (i = count; i > 0; --i) {
181            *xx++ = TILEX_PROCF(fx, maxX); fx += dx;
182        }
183    }
184}
185
186// note: we could special-case on a matrix which is skewed in X but not Y.
187// this would require a more general setup thatn SCALE does, but could use
188// SCALE's inner loop that only looks at dx
189
190
191static void AFFINE_NOFILTER_NAME(const SkBitmapProcState& s,
192                                 uint32_t xy[], int count, int x, int y) {
193    SkASSERT(s.fInvType & SkMatrix::kAffine_Mask);
194    SkASSERT((s.fInvType & ~(SkMatrix::kTranslate_Mask |
195                             SkMatrix::kScale_Mask |
196                             SkMatrix::kAffine_Mask)) == 0);
197
198    PREAMBLE(s);
199    SkPoint srcPt;
200    s.fInvProc(*s.fInvMatrix,
201               SkIntToScalar(x) + SK_ScalarHalf,
202               SkIntToScalar(y) + SK_ScalarHalf, &srcPt);
203
204    SkFixed fx = SkScalarToFixed(srcPt.fX);
205    SkFixed fy = SkScalarToFixed(srcPt.fY);
206    SkFixed dx = s.fInvSx;
207    SkFixed dy = s.fInvKy;
208    int maxX = s.fBitmap->width() - 1;
209    int maxY = s.fBitmap->height() - 1;
210
211#if 1
212    int ocount = count;
213    uint32_t *oxy = xy;
214    SkFixed bfx = fx, bfy=fy, bdx=dx, bdy=dy;
215#endif
216
217#if	defined(__ARM_HAVE_NEON)
218
219	if (0) { extern void rbe(void); rbe(); }
220
221	/* RBE: benchmarks show this eats up time; can we neonize it? */
222	/* RBE: very much like done in decal_nofilter ,
223	 * but some processing of the 'fx' information
224         * TILEX_PROCF(fx, max)    (((fx) & 0xFFFF) * ((max) + 1) >> 16)
225	 */
226	if (count >= 4) {
227	    /* SkFixed is 16.16 fixed point */
228	    SkFixed dx4 = dx*4;
229	    SkFixed dy4 = dy*4;
230
231	    /* now build fx/fx+dx/fx+2dx/fx+3dx */
232	    int32x2_t lower, upper;
233	    int32x4_t xbase, ybase;
234	    int16_t *dst16 = (int16_t *)xy;
235
236	    /* synthesize 4x for both X and Y */
237	    xbase = vdupq_n_s32(fx);
238	    xbase = vsetq_lane_s32(fx+dx, xbase, 1);
239	    xbase = vsetq_lane_s32(fx+dx+dx, xbase, 2);
240	    xbase = vsetq_lane_s32(fx+dx+dx+dx, xbase, 3);
241
242	    ybase = vdupq_n_s32(fy);
243	    ybase = vsetq_lane_s32(fy+dy, ybase, 1);
244	    ybase = vsetq_lane_s32(fy+dy+dy, ybase, 2);
245	    ybase = vsetq_lane_s32(fy+dy+dy+dy, ybase, 3);
246
247	    /* store & bump */
248	    do {
249	        int32x4_t xout;
250            int32x4_t yout;
251            int16x8_t hi16;
252
253         	/* TILEX_PROCF(fx, max) (((fx)&0xFFFF)*((max)+1)>> 16) */
254		/* mask to low 16 [would like to use uzp tricks) */
255	        xout = vandq_s32(xbase, vdupq_n_s32(0xffff));
256	        yout = vandq_s32(ybase, vdupq_n_s32(0xffff));
257		/* bare multiplication, not SkFixedMul */
258		xout = vmulq_s32(xout, vdupq_n_s32(maxX+1));
259		yout = vmulq_s32(yout, vdupq_n_s32(maxY+1));
260
261		/* put hi16 from xout over low16 from yout */
262		yout = vsriq_n_s32(yout, xout, 16);
263
264		/* and then yout has the interleaved upper 16's */
265		hi16 = vreinterpretq_s16_s32(yout);
266		vst1q_s16(dst16, hi16);
267
268		/* bump preserved base & on to the next */
269		xbase = vaddq_s32 (xbase, vdupq_n_s32(dx4));
270		ybase = vaddq_s32 (ybase, vdupq_n_s32(dy4));
271		dst16 += 8;	/* 8 x16 aka 4x32 */
272		count -= 4;
273		fx += dx4;
274		fy += dy4;
275	    } while (count >= 4);
276	    xy = (uint32_t *) dst16;
277	}
278
279#if 0
280    /* diagnostics... see whether we agree with the NEON code */
281    int bad = 0;
282    uint32_t *myxy = oxy;
283    int myi = (-1);
284    SkFixed ofx = bfx, ofy= bfy, odx= bdx, ody= bdy;
285    for (myi = ocount; myi > 0; --myi) {
286	uint32_t val = (TILEY_PROCF(ofy, maxY) << 16) | TILEX_PROCF(ofx, maxX);
287	if (val != *myxy++) {
288		bad++;
289		break;
290	}
291        ofx += odx; ofy += ody;
292    }
293    if (bad) {
294        SkDebugf("repeat-nofilter-affine fails\n");
295        SkDebugf("count %d myi %d\n", ocount, myi);
296        SkDebugf(" bfx %08x, bdx %08x, bfy %08x bdy %08x\n",
297                bfx, bdx, bfy, bdy);
298        SkDebugf("maxX %08x maxY %08x\n", maxX, maxY);
299    }
300#endif
301#endif
302
303    for (int i = count; i > 0; --i) {
304	/* fx, fy, dx, dy are all 32 bit 16.16 fixed point */
305	/* (((fx) & 0xFFFF) * ((max) + 1) >> 16) */
306        *xy++ = (TILEY_PROCF(fy, maxY) << 16) | TILEX_PROCF(fx, maxX);
307        fx += dx; fy += dy;
308    }
309}
310
311static void PERSP_NOFILTER_NAME(const SkBitmapProcState& s,
312                                uint32_t* SK_RESTRICT xy,
313                                int count, int x, int y) {
314    SkASSERT(s.fInvType & SkMatrix::kPerspective_Mask);
315
316    PREAMBLE(s);
317    int maxX = s.fBitmap->width() - 1;
318    int maxY = s.fBitmap->height() - 1;
319
320    SkPerspIter   iter(*s.fInvMatrix,
321                       SkIntToScalar(x) + SK_ScalarHalf,
322                       SkIntToScalar(y) + SK_ScalarHalf, count);
323
324    while ((count = iter.next()) != 0) {
325        const SkFixed* SK_RESTRICT srcXY = iter.getXY();
326
327#if	defined(__ARM_HAVE_NEON)
328	/* RBE: */
329	/* TILEX_PROCF(fx, max) (((fx) & 0xFFFF) * ((max) + 1) >> 16) */
330	/* it's a little more complicated than what I did for the
331	 * clamp case -- where I could immediately snip to the top
332	 * 16 bits and do my min/max games there.
333	 * ... might only be able to get 4x unrolling here
334	 */
335
336	/* vld2 to get a set of 32x4's ... */
337	/* do the tile[xy]_procf operations */
338	/* which includes doing vuzp to get hi16's */
339	/* store it */
340	/* -- inner loop (other than vld2) can be had from above */
341
342	/* srcXY is a batch of 32 bit numbers X0,Y0,X1,Y1...
343	 * but we immediately discard the low 16 bits...
344	 * so what we're going to do is vld4, which will give us
345	 * xlo,xhi,ylo,yhi distribution and we can ignore the 'lo'
346	 * parts....
347	 */
348	if (0) { extern void rbe(void); rbe(); }
349	if (count >= 8) {
350	    int32_t *mysrc = (int32_t *) srcXY;
351	    int16_t *mydst = (int16_t *) xy;
352	    do {
353		int32x4_t x, y, x2, y2;
354		int16x8_t hi, hi2;
355
356		/* read array of x,y,x,y,x,y */
357	        /* vld2 does the de-interleaving for us */
358		/* isolate reg-bound scopes; gcc will minimize register
359		 * motion if possible; this ensures that we don't lose
360		 * a register across a debugging call because it happens
361		 * to be bound into a call-clobbered register
362		 */
363		{
364		    register int32x4_t q0 asm("q0");
365		    register int32x4_t q1 asm("q1");
366		    asm ("vld2.32	{q0-q1},[%2]  /* x=%q0 y=%q1 */"
367		        : "=w" (q0), "=w" (q1)
368		        : "r" (mysrc)
369		        );
370		    x = q0; y = q1;
371		}
372
373		/* offset == 256 bits == 32 bytes == 8 longs */
374		{
375		    register int32x4_t q2 asm("q2");
376		    register int32x4_t q3 asm("q3");
377		    asm ("vld2.32	{q2-q3},[%2]  /* x=%q0 y=%q1 */"
378		        : "=w" (q2), "=w" (q3)
379		        : "r" (mysrc+8)
380		        );
381		    x2 = q2; y2 = q3;
382		}
383
384         	/* TILEX_PROCF(fx, max) (((fx)&0xFFFF)*((max)+1)>> 16) */
385		/* mask to low 16 [would like to use uzp tricks) */
386		/* bare multiplication, not SkFixedMul */
387	        x = vandq_s32(x, vdupq_n_s32(0xffff));
388		x = vmulq_s32(x, vdupq_n_s32(maxX+1));
389	        y = vandq_s32(y, vdupq_n_s32(0xffff));
390		y = vmulq_s32(y, vdupq_n_s32(maxY+1));
391
392	        x2 = vandq_s32(x2, vdupq_n_s32(0xffff));
393		x2 = vmulq_s32(x2, vdupq_n_s32(maxX+1));
394	        y2 = vandq_s32(y2, vdupq_n_s32(0xffff));
395		y2 = vmulq_s32(y2, vdupq_n_s32(maxY+1));
396
397		/* now collect interleaved high 16's */
398		/* (hi-x, hi-y)4  (hi-x2; hi-y2)4 */
399
400		/* extraction, using uzp, leaves hi16's in y */
401		y = vsriq_n_s32(y, x, 16);
402		hi = vreinterpretq_s16_s32(y);
403		vst1q_s16(mydst, hi);
404
405		/* and likewise for the second 8 entries */
406		y2 = vsriq_n_s32(y2, x2, 16);
407		hi2 = vreinterpretq_s16_s32(y2);
408		vst1q_s16(mydst+8, hi2);
409
410		/* XXX: gcc isn't interleaving these with the NEON ops
411		 * but i think that all the scoreboarding works out */
412		count -= 8;	/* 8 iterations */
413		mysrc += 16;	/* 16 longs */
414		mydst += 16;	/* 16 shorts, aka 8 longs */
415	    } while (count >= 8);
416	    /* get xy and srcXY fixed up */
417	    srcXY = (const SkFixed *) mysrc;
418	    xy = (uint32_t *) mydst;
419	}
420#endif
421        while (--count >= 0) {
422            *xy++ = (TILEY_PROCF(srcXY[1], maxY) << 16) |
423                     TILEX_PROCF(srcXY[0], maxX);
424            srcXY += 2;
425        }
426    }
427}
428
429//////////////////////////////////////////////////////////////////////////////
430
431static inline uint32_t PACK_FILTER_Y_NAME(SkFixed f, unsigned max,
432                                          SkFixed one PREAMBLE_PARAM_Y) {
433    unsigned i = TILEY_PROCF(f, max);
434    i = (i << 4) | TILEY_LOW_BITS(f, max);
435    return (i << 14) | (TILEY_PROCF((f + one), max));
436}
437
438static inline uint32_t PACK_FILTER_X_NAME(SkFixed f, unsigned max,
439                                          SkFixed one PREAMBLE_PARAM_X) {
440    unsigned i = TILEX_PROCF(f, max);
441    i = (i << 4) | TILEX_LOW_BITS(f, max);
442    return (i << 14) | (TILEX_PROCF((f + one), max));
443}
444
445static void SCALE_FILTER_NAME(const SkBitmapProcState& s,
446                              uint32_t xy[], int count, int x, int y) {
447    SkASSERT((s.fInvType & ~(SkMatrix::kTranslate_Mask |
448                             SkMatrix::kScale_Mask)) == 0);
449    SkASSERT(s.fInvKy == 0);
450
451    PREAMBLE(s);
452
453    const unsigned maxX = s.fBitmap->width() - 1;
454    const SkFixed one = s.fFilterOneX;
455    const SkFixed dx = s.fInvSx;
456    SkFixed fx;
457
458    {
459        SkPoint pt;
460        s.fInvProc(*s.fInvMatrix, SkIntToScalar(x) + SK_ScalarHalf,
461                                  SkIntToScalar(y) + SK_ScalarHalf, &pt);
462        const SkFixed fy = SkScalarToFixed(pt.fY) - (s.fFilterOneY >> 1);
463        const unsigned maxY = s.fBitmap->height() - 1;
464        // compute our two Y values up front
465        *xy++ = PACK_FILTER_Y_NAME(fy, maxY, s.fFilterOneY PREAMBLE_ARG_Y);
466        // now initialize fx
467        fx = SkScalarToFixed(pt.fX) - (one >> 1);
468    }
469
470#ifdef CHECK_FOR_DECAL
471    // test if we don't need to apply the tile proc
472    if (dx > 0 &&
473            (unsigned)(fx >> 16) <= maxX &&
474            (unsigned)((fx + dx * (count - 1)) >> 16) < maxX) {
475        decal_filter_scale(xy, fx, dx, count);
476    } else
477#endif
478    {
479        do {
480            *xy++ = PACK_FILTER_X_NAME(fx, maxX, one PREAMBLE_ARG_X);
481            fx += dx;
482        } while (--count != 0);
483    }
484}
485
486static void AFFINE_FILTER_NAME(const SkBitmapProcState& s,
487                               uint32_t xy[], int count, int x, int y) {
488    SkASSERT(s.fInvType & SkMatrix::kAffine_Mask);
489    SkASSERT((s.fInvType & ~(SkMatrix::kTranslate_Mask |
490                             SkMatrix::kScale_Mask |
491                             SkMatrix::kAffine_Mask)) == 0);
492
493    PREAMBLE(s);
494    SkPoint srcPt;
495    s.fInvProc(*s.fInvMatrix,
496               SkIntToScalar(x) + SK_ScalarHalf,
497               SkIntToScalar(y) + SK_ScalarHalf, &srcPt);
498
499    SkFixed oneX = s.fFilterOneX;
500    SkFixed oneY = s.fFilterOneY;
501    SkFixed fx = SkScalarToFixed(srcPt.fX) - (oneX >> 1);
502    SkFixed fy = SkScalarToFixed(srcPt.fY) - (oneY >> 1);
503    SkFixed dx = s.fInvSx;
504    SkFixed dy = s.fInvKy;
505    unsigned maxX = s.fBitmap->width() - 1;
506    unsigned maxY = s.fBitmap->height() - 1;
507
508    do {
509        *xy++ = PACK_FILTER_Y_NAME(fy, maxY, oneY PREAMBLE_ARG_Y);
510        fy += dy;
511        *xy++ = PACK_FILTER_X_NAME(fx, maxX, oneX PREAMBLE_ARG_X);
512        fx += dx;
513    } while (--count != 0);
514}
515
516static void PERSP_FILTER_NAME(const SkBitmapProcState& s,
517                              uint32_t* SK_RESTRICT xy, int count,
518                              int x, int y) {
519    SkASSERT(s.fInvType & SkMatrix::kPerspective_Mask);
520
521    extern void rbe(void);
522
523    PREAMBLE(s);
524    unsigned maxX = s.fBitmap->width() - 1;
525    unsigned maxY = s.fBitmap->height() - 1;
526    SkFixed oneX = s.fFilterOneX;
527    SkFixed oneY = s.fFilterOneY;
528
529
530
531    SkPerspIter   iter(*s.fInvMatrix,
532                       SkIntToScalar(x) + SK_ScalarHalf,
533                       SkIntToScalar(y) + SK_ScalarHalf, count);
534
535    while ((count = iter.next()) != 0) {
536        const SkFixed* SK_RESTRICT srcXY = iter.getXY();
537        do {
538            *xy++ = PACK_FILTER_Y_NAME(srcXY[1] - (oneY >> 1), maxY,
539                                       oneY PREAMBLE_ARG_Y);
540            *xy++ = PACK_FILTER_X_NAME(srcXY[0] - (oneX >> 1), maxX,
541                                       oneX PREAMBLE_ARG_X);
542            srcXY += 2;
543        } while (--count != 0);
544    }
545}
546
547static SkBitmapProcState::MatrixProc MAKENAME(_Procs)[] = {
548    SCALE_NOFILTER_NAME,
549    SCALE_FILTER_NAME,
550    AFFINE_NOFILTER_NAME,
551    AFFINE_FILTER_NAME,
552    PERSP_NOFILTER_NAME,
553    PERSP_FILTER_NAME
554};
555
556#undef MAKENAME
557#undef TILEX_PROCF
558#undef TILEY_PROCF
559#ifdef CHECK_FOR_DECAL
560    #undef CHECK_FOR_DECAL
561#endif
562
563#undef SCALE_NOFILTER_NAME
564#undef SCALE_FILTER_NAME
565#undef AFFINE_NOFILTER_NAME
566#undef AFFINE_FILTER_NAME
567#undef PERSP_NOFILTER_NAME
568#undef PERSP_FILTER_NAME
569
570#undef PREAMBLE
571#undef PREAMBLE_PARAM_X
572#undef PREAMBLE_PARAM_Y
573#undef PREAMBLE_ARG_X
574#undef PREAMBLE_ARG_Y
575
576#undef TILEX_LOW_BITS
577#undef TILEY_LOW_BITS
578