/* Integer Multi-Dimensional Interpolation */
/* Interpolation Kernel Code */
/* Generated by cgen */
/* Copyright 2000 - 2002 Graeme W. Gill */
/* This material is licenced under the GNU GENERAL PUBLIC LICENCE :- */
/* see the Licence.txt file for licencing details.*/
/*
Interpolation kernel specs:
Input channels per pixel = 1
Input channel 0 bits = 8
Input channel 0 increment = 1
Input is channel interleaved
Input channels are separate words
Input value extraction is done in input table lookup
Output channels per pixel = 1
Output channel 0 bits = 8
Output channel 0 increment = 1
Output is channel interleaved
Output channels are separate words
Simplex table index bits = 0
Interpolation table index bits = 8
Simplex table max resolution = 1
Interpolation table max resolution = 256
*/
/*
Machine architecture specs:
Little endian
Reading and writing pixel values separately
Pointer size = 32 bits
Ordinal size 8 bits is known as 'unsigned char'
Ordinal size 16 bits is known as 'unsigned short'
Ordinal size 32 bits is known as 'unsigned int'
Natural ordinal is 'unsigned int'
Integer size 8 bits is known as 'signed char'
Integer size 16 bits is known as 'short'
Integer size 32 bits is known as 'int'
Natural integer is 'int'
*/
#ifndef IMDI_INCLUDED
#include <string.h>
#include "imdi_imp.h"
#include "imdi_gen.h"
#include "imdi_tab.h"
#define IMDI_INCLUDED
#endif /* IMDI_INCLUDED */
#ifndef DEFINED_pointer
#define DEFINED_pointer
typedef unsigned char * pointer;
#endif
/* Input table inter & simplex indexes */
#define IT_IT(p, off) *((unsigned char *)((p) + 0 + (off) * 1))
/* Simplex weighting table access */
#define SW_O(off) ((off) * 4)
/* Simplex table - get weighting/offset value */
#define SX_WO(p, v) *((unsigned short *)((p) + (v) * 2))
/* Interpolation multi-dim. table access */
#define IM_O(off) ((off) * 4)
/* Interpolation table - get vertex values */
#define IM_PE(p, v) *((unsigned int *)((p) + 0 + (v) * 4))
/* Output table indexes */
#define OT_E(p, off) *((unsigned char *)((p) + (off) * 1))
void
imdi_k1(
imdi *s, /* imdi context */
void **outp, /* pointer to output pointers */
void **inp, /* pointer to input pointers */
unsigned int npix /* Number of pixels to process */
) {
imdi_imp *p = (imdi_imp *)(s->impl);
unsigned char *ip0 = (unsigned char *)inp[0];
unsigned char *op0 = (unsigned char *)outp[0];
unsigned char *ep = ip0 + npix * 1 ;
pointer it0 = (pointer)p->in_tables[0];
pointer ot0 = (pointer)p->out_tables[0];
pointer sw_base = (pointer)p->sw_table;
pointer im_base = (pointer)p->im_table;
for(;ip0 < ep; ip0 += 1, op0 += 1) {
unsigned int ova0; /* Output value partial accumulator */
{
pointer swp;
pointer imp;
{
unsigned int ti; /* Simplex+Interpolation index variable */
ti = IT_IT(it0, ip0[0]);
imp = im_base + IM_O(ti >> 0); /* Extract interp. index and comp. entry */
swp = sw_base + SW_O(ti & 0x0); /* Extract simplex index and comp. entry */
}
{
unsigned int vowr; /* Vertex offset/weight value */
unsigned int vof; /* Vertex offset value */
unsigned int vwe; /* Vertex weighting */
vowr = SX_WO(swp, 0); /* Read vertex offset+weighting values */
vof = (vowr & 0x7f); /* Extract offset value */
vwe = (vowr >> 7); /* Extract weighting value */
ova0 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
vowr = SX_WO(swp, 1); /* Read vertex offset+weighting values */
vof = (vowr & 0x7f); /* Extract offset value */
vwe = (vowr >> 7); /* Extract weighting value */
ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
}
}
{
unsigned int oti; /* Vertex offset value */
oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
op0[0] = OT_E(ot0, oti); /* Write result */
}
}
}
#undef IT_IT
#undef SW_O
#undef SX_WO
#undef IM_O
#undef IM_PE
#undef OT_E
void
imdi_k1_gen(
genspec *g /* structure to be initialised */
) {
static unsigned char data[] = {
0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
0x54, 0xff, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00,
0x38, 0xfd, 0x12, 0x00, 0x00, 0x02, 0x00, 0x00,
0x28, 0xff, 0x12, 0x00, 0x55, 0x1f, 0xf8, 0x77,
0xd0, 0x2a, 0xf8, 0x77, 0x01, 0x00, 0x00, 0x00,
0x38, 0xff, 0x12, 0x00, 0x00, 0x00, 0x34, 0x00,
0x68, 0x51, 0x34, 0x00, 0x78, 0x01, 0x34, 0x00,
0xd3, 0x01, 0x00, 0x00, 0x03, 0xc6, 0xfc, 0x77,
0x00, 0x00, 0x34, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00,
0x00, 0x08, 0x00, 0x00, 0x64, 0x65, 0x66, 0x67,
0x68, 0x69, 0x6a, 0x6b, 0x78, 0x01, 0x13, 0x00,
0x78, 0x01, 0x13, 0x00, 0x08, 0x00, 0x00, 0x00,
0x78, 0x79, 0x7a, 0x7b, 0x40, 0x06, 0x13, 0x00,
0x80, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
0x20, 0x20, 0x20, 0x20, 0x01, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
0x78, 0x01, 0x34, 0x00, 0x78, 0x01, 0x34, 0x00,
0x20, 0x20, 0x20, 0x20, 0x01, 0x00, 0x00, 0x00,
0x08, 0x06, 0x34, 0x00, 0x20, 0x20, 0x20, 0x20,
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
0x20, 0x20, 0x20, 0x20, 0x00, 0x00, 0x00, 0x00,
0x5c, 0x7e, 0xeb, 0x77, 0x40, 0x71, 0xeb, 0x77,
0x00, 0x00, 0x00, 0x00, 0xdd, 0x01, 0x00, 0x00,
0x64, 0xfe, 0x12, 0x00, 0xc2, 0x8f, 0xf8, 0x77,
0xd2, 0xfe, 0x12, 0x00, 0x08, 0x00, 0x00, 0x00,
0x00, 0x00, 0xe6, 0x77, 0xd6, 0x84, 0xeb, 0x77,
0x5c, 0x7e, 0xeb, 0x77, 0xd0, 0xfe, 0x12, 0x00,
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xc8, 0x00, 0xe6, 0x77, 0x01, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x12, 0x00,
0x14, 0xff, 0x12, 0x00, 0xd2, 0xfe, 0x12, 0x00,
0xea, 0x8e, 0xf8, 0x77, 0x48, 0x03, 0xfd, 0x77,
0xd6, 0x8d, 0xf8, 0x77, 0x30, 0xc2, 0x40, 0x00,
0xfc, 0xf8, 0x12, 0x00, 0xff, 0xff, 0x00, 0x00,
0x00, 0xe0, 0xfd, 0x7f, 0xb8, 0xfe, 0x12, 0x00,
0x00, 0xe0, 0xfd, 0x7f, 0xd1, 0x01, 0x00, 0x00,
0x78, 0x51, 0x34, 0x00, 0x00, 0x00, 0x34, 0x00,
0x70, 0x24, 0x13, 0x00, 0x80, 0x24, 0x13, 0x00,
0x00, 0x00, 0x34, 0x00, 0x31, 0x5f, 0x31, 0x5f,
0x69, 0x38, 0x5f, 0x69, 0x38, 0x5f, 0x66, 0x00,
0x00, 0x00, 0x00, 0x00, 0x70, 0x24, 0x13, 0x00,
0x00, 0x00, 0x49, 0x73, 0x50, 0x72, 0x6f, 0x63,
0x65, 0x73, 0x73, 0x6f, 0x72, 0x46, 0x65, 0x61,
0x74, 0x75, 0x72, 0x65, 0x50, 0x72, 0x65, 0x73,
0x65, 0x6e, 0x74, 0x00, 0x55, 0x1f, 0xf8, 0x77,
0x00, 0x00, 0x34, 0x00, 0xd3, 0x01, 0x00, 0x00,
0x68, 0x49, 0x34, 0x00, 0x60, 0x49, 0x34, 0x00,
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x01, 0x01, 0x00, 0x00, 0x28, 0xff, 0x12, 0x00,
0x00, 0xff, 0xff, 0xff, 0x0a, 0xfe, 0xe6, 0x77,
0x68, 0x51, 0x34, 0x00, 0xd0, 0xfe, 0x12, 0x00,
0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x00,
0x68, 0x49, 0x34, 0x00, 0x08, 0x08, 0x00, 0x00,
0xf0, 0x8e, 0xf8, 0x77, 0x00, 0x00, 0x03, 0x00,
0x00, 0x00, 0x03, 0x00, 0xb0, 0xff, 0x12, 0x00,
0x55, 0x1f, 0xf8, 0x77, 0x18, 0x25, 0xf8, 0x77,
0xff, 0xff, 0xff, 0xff, 0xc0, 0xff, 0x12, 0x00,
0xb5, 0x5d, 0x40, 0x00, 0x00, 0x00, 0x34, 0x00,
0x09, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00,