diff options
author | Marcos H. Woehrmann <marcos.woehrmann@artifex.com> | 2011-08-16 19:19:32 -0700 |
---|---|---|
committer | Marcos H. Woehrmann <marcos.woehrmann@artifex.com> | 2011-08-16 19:19:32 -0700 |
commit | a49306bd0942aaea1bd035d285977c3f1cec0c2e (patch) | |
tree | 44b2871c615fb3670a1c095349bd64141a548132 | |
parent | 781b7387334f9c9d98220567f59e5fe1843ad43d (diff) |
Bug 692400. Removed imdi and related devices (wtsimdi and wtscmyk).
Devices were example devices that have been obsoleted by ICC color
management.
34 files changed, 1 insertions, 59822 deletions
diff --git a/gs/base/Makefile.in b/gs/base/Makefile.in index cca32a0da..bbba12d38 100644 --- a/gs/base/Makefile.in +++ b/gs/base/Makefile.in @@ -301,11 +301,6 @@ LCUPSISRCDIR=cups CUPS_CC=$(CC) -# Define the directory where the imdi library source is stored. -# See devs.mak for more information. - -IMDISRCDIR=imdi - # Define how to build the library archives. (These are not used in any # standard configuration.) diff --git a/gs/base/configure.ac b/gs/base/configure.ac index 5154a8333..091b43c05 100644 --- a/gs/base/configure.ac +++ b/gs/base/configure.ac @@ -1242,8 +1242,6 @@ AC_ARG_WITH(drivers, PNG = Output to PNG PS = Output to PostScript/PDF TIFF = Output to TIFF - WTS = WTS Halftoning devices - ETS = ETS Halftoning devices You can mix both variants, e.g. --with-drivers=HP,stcolor would build HP drivers and the Epson stcolor driver. @@ -1296,7 +1294,6 @@ TIFF_DEVS='tiffs tiff12nc tiff24nc tiff48nc tiff32nc tiff64nc tiffcrle tifflzw t PCX_DEVS='pcxmono pcxgray pcx16 pcx256 pcx24b pcxcmyk pcx2up' PBM_DEVS='pbm pbmraw pgm pgmraw pgnm pgnmraw pnm pnmraw ppm ppmraw pkm pkmraw pksm pksmraw pam' PS_DEVS='psdf psdcmyk psdrgb pdfwrite pswrite ps2write epswrite psgray psmono psrgb bbox' -WTS_HALFTONING_DEVS='imdi simdi wtsimdi wtscmyk' MISC_FDEVS='ccr cgm24 cgm8 cgmmono cif inferno mag16 mag256 mgr4 mgr8 mgrgray2 mgrgray4 mgrgray8 mgrmono miff24 plan9bm sgirgb sunhmono bit bitrgb bitrgbtags bitcmyk devicen spotcmyk xcf' SVGDEV='svgwrite' @@ -1323,7 +1320,7 @@ while test -n "$drivers"; do IJS_DEVS0="$IJSDEVS" ;; FILES) - F_DEVS0="$F_DEVS0 $BMP_DEVS $FAX_DEVS $JPEG_DEVS $TIFF_DEVS $PCX_DEVS $PBM_DEVS $PS_DEVS $WTS_HALFTONING_DEVS $MISC_FDEVS" + F_DEVS0="$F_DEVS0 $BMP_DEVS $FAX_DEVS $JPEG_DEVS $TIFF_DEVS $PCX_DEVS $PBM_DEVS $PS_DEVS $MISC_FDEVS" CUPS_DEVS0="$CUPSDEV" JBIG2_DEVS="$JBIG2DEVS" PNG_DEVS0="$PNGDEVS" @@ -1416,10 +1413,6 @@ while test -n "$drivers"; do # PostScript/PDF writing SVG_DEVS0="$SVGDEV" ;; - WTS) - # WTS Halftoning devices - F_DEVS0="$F_DEVS0 $WTS_HALFTONING_DEVS" - ;; ETS) # ETS Halftoning devices F_DEVS0="$F_DEVS0 $ETS_HALFTONING_DEVS" diff --git a/gs/base/devs.mak b/gs/base/devs.mak index d20ab1850..a160388a8 100644 --- a/gs/base/devs.mak +++ b/gs/base/devs.mak @@ -1571,56 +1571,6 @@ $(DD)pngalpha.dev : $(DEVS_MAK) $(libpng_dev) $(png_) $(GLD)page.dev $(GDEV) $(SETPDEV2) $(DD)pngalpha $(png_) $(ADDMOD) $(DD)pngalpha $(png_i_) -### --------------------- WTS Halftoning drivers ---------------------- ### - -### IMDI from Argyll - -IMDISRC=$(IMDISRCDIR)$(D) - -simdi_=$(GLOBJ)imdi.$(OBJ) $(GLOBJ)imdi_tab.$(OBJ) - -$(GLOBJ)imdi.$(OBJ) : $(IMDISRC)imdi.c - $(GLCC) $(GLO_)imdi.$(OBJ) $(C_) $(IMDISRC)imdi.c - -$(GLOBJ)imdi_tab.$(OBJ) : $(IMDISRC)imdi_tab.c - $(GLCC) $(GLO_)imdi_tab.$(OBJ) $(C_) $(IMDISRC)imdi_tab.c - -$(DD)simdi.dev : $(DEVS_MAK) $(simdi_) $(GDEV) - $(SETMOD) $(DD)simdi $(simdi_) - -### WTS halftoning CMYK device - -wts_=$(GLOBJ)gdevwts.$(OBJ) - -$(GLOBJ)gdevwts.$(OBJ) : $(GLSRC)gdevwts.c $(PDEVH)\ - $(gscdefs_h) $(gscspace_h) $(gxgetbit_h) $(gxiparam_h) $(gxlum_h)\ - $(gscms_h) $(gsicc_cache_h) $(gsicc_manage_h) - $(GLCC) -I$(IMDISRCDIR) $(GLO_)gdevwts.$(OBJ) $(C_) $(GLSRC)gdevwts.c - -$(DD)wtscmyk.dev : $(DEVS_MAK) $(wts_) $(GLD)page.dev $(GDEV) - $(SETPDEV2) $(DD)wtscmyk $(wts_) - -$(DD)wtsimdi.dev : $(DEVS_MAK) $(wts_) $(GLD)sicclib.dev $(GLD)simdi.dev\ - $(GLD)page.dev $(GDEV) - $(SETPDEV2) $(DD)wtsimdi $(wts_) - $(ADDMOD) $(DD)wtsimdi -include $(GLD)sicclib - $(ADDMOD) $(DD)wtsimdi -include $(GLD)simdi - -### IMDI color converting device - -imdi_=$(GLOBJ)gdevimdi.$(OBJ) - -$(GLOBJ)gdevimdi.$(OBJ) : $(GLSRC)gdevimdi.c $(PDEVH) \ - $(gscdefs_h) $(gscspace_h) $(gxgetbit_h) $(gxiparam_h) $(gxlum_h)\ - $(gscms_h) $(gsicc_cache_h) $(gsicc_manage_h) - $(GLCC) -I$(IMDISRCDIR) $(GLO_)gdevimdi.$(OBJ) $(C_) $(GLSRC)gdevimdi.c - -$(DD)imdi.dev : $(DEVS_MAK) $(imdi_) $(GLD)page.dev $(GLD)sicclib.dev\ - $(GLD)simdi.dev $(GDEV) - $(SETPDEV2) $(DD)imdi $(imdi_) - $(ADDMOD) $(DD)imdi -include $(GLD)sicclib - $(ADDMOD) $(DD)imdi -include $(GLD)simdi - ### ---------------------- PostScript image format ---------------------- ### ### These devices make it possible to print monochrome Level 2 files on a ### ### Level 1 printer, by converting them to a bitmap in PostScript ### diff --git a/gs/base/gdevimdi.c b/gs/base/gdevimdi.c deleted file mode 100644 index 9061eeb96..000000000 --- a/gs/base/gdevimdi.c +++ /dev/null @@ -1,400 +0,0 @@ -/* Copyright (C) 1999 Aladdin Enterprises. All rights reserved. - - This software is provided AS-IS with no warranty, either express or - implied. - - This software is distributed under license and may not be copied, - modified or distributed except as expressly authorized under the terms - of the license contained in the file LICENSE in this distribution. - - For more information about licensing, please refer to - http://www.ghostscript.com/licensing/. For information on - commercial licensing, go to http://www.artifex.com/licensing/ or - contact Artifex Software, Inc., 101 Lucas Valley Road #110, - San Rafael, CA 94903, U.S.A., +1(415)492-9861. -*/ - -/* $Id$ */ -/* IMDI Device. - * - * This is an RGB contone device, that outputs the raster - * converted to CMYK using CMM API - */ - -/* TODO: this should be configurable */ -#define LINK_ICC_NAME "link.icc" - -#include "errno_.h" -#include "string_.h" - -#include "gserrors.h" -#include "gdevprn.h" -#include "gxfrac.h" -#include "gscms.h" -#include "gsicc_cache.h" -#include "gsicc_manage.h" - -#ifndef cmm_gcmmhlink_DEFINED - #define cmm_gcmmhlink_DEFINED - typedef void* gcmmhlink_t; -#endif - -#ifndef cmm_gcmmhprofile_DEFINED - #define cmm_gcmmhprofile_DEFINED - typedef void* gcmmhprofile_t; -#endif -/* - * Set up the device structures and function tables. - */ - -#ifndef X_DPI -# define X_DPI 72 -#endif -#ifndef Y_DPI -# define Y_DPI 72 -#endif - -typedef struct gx_device_imdi_s gx_device_imdi; - -static dev_proc_open_device(imdi_open_device); -static dev_proc_close_device(imdi_close_device); -static dev_proc_print_page(imdi_print_page); - -struct gx_device_imdi_s -{ - gx_device_common; - gx_prn_device_common; - - gcmmhlink_t icc_link; - cmm_profile_t *icc_link_profile; - -}; - -static const gx_device_procs imdi_procs = -{ - imdi_open_device, NULL, NULL, gdev_prn_output_page, imdi_close_device, - gx_default_rgb_map_rgb_color, gx_default_rgb_map_color_rgb, - NULL, NULL, NULL, NULL, NULL, NULL, - gdev_prn_get_params, gdev_prn_put_params, - NULL, NULL, NULL, NULL, gx_page_device_get_page_device -}; - -const gx_device_imdi gs_imdi_device = -{ - prn_device_body(gx_device_imdi, imdi_procs, "imdi", - DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS, - X_DPI, Y_DPI, - 0, 0, 0, 0, /* Margins */ - 3, 24, 255, 255, 256, 256, imdi_print_page) -}; - -/* - * Open IMDI device. - * Load ICC device link profile (to map sRGB to FOGRA CMYK). - */ - -static int -imdi_open_device(gx_device *dev) -{ - gx_device_imdi *idev = (gx_device_imdi*)dev; - gsicc_rendering_param_t rendering_params; - - /* Open and read profile */ - - idev->icc_link_profile = gsicc_get_profile_handle_file(LINK_ICC_NAME, - strlen(LINK_ICC_NAME), dev->memory); - - if (idev->icc_link_profile == NULL) - return gs_throw(-1, "Could not create link profile for imdi device"); - - if (idev->icc_link_profile->num_comps != 3) - return gs_throw1(-1, "profile must have 3 input channels. got %d.", - idev->icc_link_profile->num_comps); - if (idev->icc_link_profile->num_comps_out != 4) - return gs_throw1(-1, "profile must have 4 output channels. got %d.", - idev->icc_link_profile->num_comps_out); - - rendering_params.black_point_comp = false; - rendering_params.graphics_type_tag = GS_UNKNOWN_TAG; /* Already rendered */ - rendering_params.rendering_intent = gsPERCEPTUAL; - - idev->icc_link = gscms_get_link(idev->icc_link_profile, - NULL, &rendering_params); - - if (!idev->icc_link) - return gs_throw(-1, "could not create ICC link handle"); - - return gdev_prn_open(dev); - -} - -/* - * Close device and clean up ICC structures. - */ - -static int -imdi_close_device(gx_device *dev) -{ - gx_device_imdi *idev = (gx_device_imdi*)dev; - - gscms_release_link(idev->icc_link); - rc_decrement(idev->icc_link_profile, "imdi_close_device"); - - return gdev_prn_close(dev); -} - -/* - * Output the page raster. - */ - -static int -imdi_print_page(gx_device_printer *pdev, FILE *prn_stream) -{ - gx_device_imdi *idev = (gx_device_imdi*)pdev; - - gsicc_bufferdesc_t input_buff_desc; - gsicc_bufferdesc_t output_buff_desc; - - byte *srcbuffer = 0; - byte *dstbuffer = 0; - FILE *fp[4] = {0}; - - int srcstride; - int dststride; - int srcplanes; - int dstplanes; - - byte *srcdata; - - int code = 0; - int x, y, k; - - int nsame = 0, lsame = 0; - int ndiff = 0, ldiff = 0; - - /* - * Open auxiliary CMYK files. - */ - - fprintf(prn_stream, "P6\n%d %d\n255\n", pdev->width, pdev->height); - - for (k = 0; k < 4; k++) - { - char name[256]; - - sprintf(name, "%s.%c.pgm", pdev->fname, "cmyk"[k]); - - dprintf1("output file: %s\n", name); - - fp[k] = gp_fopen(name, "wb"); - if (!fp[k]) - { - code = gs_throw2(-1, "could not open file: %s (%s)", name, strerror(errno)); - goto cleanup; - } - - fprintf(fp[k], "P5\n%d %d\n255\n", pdev->width, pdev->height); - } - - /* - * Allocate scratch buffers. - */ - - srcplanes = pdev->color_info.num_components; - srcstride = gdev_mem_bytes_per_scan_line((gx_device*)pdev); - srcbuffer = gs_malloc(pdev->memory, srcstride, 1, "imdi_print_page(srcbuffer)"); - if (!srcbuffer) - { - code = gs_throw1(-1, "outofmem: src buffer %d", srcstride); - goto cleanup; - } - - dstplanes = 4; - dststride = dstplanes * pdev->width; - dstbuffer = gs_malloc(pdev->memory, dststride, 1, "imdi_print_page(dstbuffer)"); - if (!dstbuffer) - { - code = gs_throw1(-1, "outofmem: dst buffer %d", dststride); - goto cleanup; - } - - /* - * Extract pixels, convert colors and write data to files. - */ - - for (y = 0; y < pdev->height; y++) - { - gdev_prn_get_bits(pdev, y, srcbuffer, &srcdata); - - /* write rgb to original output file */ - fwrite(srcdata, 1, srcstride, prn_stream); - -#if 1 /* Collect runlengths */ - - { - void *inp[1]; - void *outp[1]; - int sx, ex; - int w = pdev->width; - - sx = ex = 0; - - while (sx < w) - { - inp[0] = srcdata + sx * 3; - outp[0] = dstbuffer + sx * 4; - - while (ex < w && - srcdata[ex * 3 + 0] == srcdata[sx * 3 + 0] && - srcdata[ex * 3 + 1] == srcdata[sx * 3 + 1] && - srcdata[ex * 3 + 2] == srcdata[sx * 3 + 2]) - { - ex ++; - } - - /* same-run */ - if (ex - sx > 1) - { - nsame ++; lsame += ex - sx; - - /* Transform the color */ - gscms_transform_color(idev->icc_link, inp, - outp, 1, NULL); - - for (x = sx + 1; x < ex; x++) - { - dstbuffer[x * 4 + 0] = dstbuffer[sx * 4 + 0]; - dstbuffer[x * 4 + 1] = dstbuffer[sx * 4 + 1]; - dstbuffer[x * 4 + 2] = dstbuffer[sx * 4 + 2]; - dstbuffer[x * 4 + 3] = dstbuffer[sx * 4 + 3]; - } - } - - /* diff-run */ - else - { - ndiff ++; - - while (ex < w && - srcdata[ex * 3 + 0] != srcdata[ex * 3 - 3] && - srcdata[ex * 3 + 1] != srcdata[ex * 3 - 2] && - srcdata[ex * 3 + 2] != srcdata[ex * 3 - 1]) - { - ex ++; - } - - ldiff += ex - sx; - - /* This needs to be done more efficiently */ - - gsicc_init_buffer(&input_buff_desc, 3, 1, - false, false, false, 0, (ex - sx)*3, - 1, ex - sx); - - gsicc_init_buffer(&output_buff_desc, 4, 1, - false, false, false, 0, (ex - sx)*4, - 1, ex - sx); - - gscms_transform_color_buffer(idev->icc_link, &input_buff_desc, - &output_buff_desc, inp, outp); - - } - - sx = ex; - } - } - -#endif - -#if 0 /* Call IMDI for entire scanline */ - void *inp[1]; - void *outp[1]; - - inp[0] = srcdata; - outp[0] = dstbuffer; - - gsicc_init_buffer(&input_buff_desc, 3, 1, - false, false, false, 0, width*3, - 1, width); - - gsicc_init_buffer(&output_buff_desc, 4, 1, - false, false, false, 0, width*4, - 1, width); - - gscms_transform_color_buffer(idev->icc_link, &input_buff_desc, - &output_buff_desc, inp, outp); - -#if 0 - /* output planar data to auxiliary output files */ - for (x = 0; x < pdev->width; x++) - for (k = 0; k < 4; k++) - putc(dstbuffer[x * 4 + k], fp[k]); -#endif -#endif - -#if 0 /* Call IMDI for every pixel */ - for (x = 0; x < pdev->width; x++) - { - void *inp[1]; - void *outp[1]; - - inp[0] = srcdata + x * 3; - outp[0] = dstbuffer + x * 4; - - /* Transform the color */ - gscms_transform_color(idev->icc_link, inp, - outp, 1, NULL); - - /* output planar data to auxiliary output files */ - for (k = 0; k < 4; k++) - putc(dstbuffer[x * 4 + k], fp[k]); - } -#endif - -#if 0 /* Slow but accurate every pixel */ - - for (x = 0; x < pdev->width; x++) - { - srcpixel[0] = srcdata[x * 3 + 0] / 255.0; - srcpixel[1] = srcdata[x * 3 + 1] / 255.0; - srcpixel[2] = srcdata[x * 3 + 2] / 255.0; - - code = idev->luo->lookup(idev->luo, dstpixel, srcpixel); - if (code > 1) - { - code = gs_throw1(-1, "icc lookup failed: %s", idev->icco->err); - goto cleanup; - } - - dstbuffer[x * 4 + 0] = dstpixel[0] * 255 + 0.5; - dstbuffer[x * 4 + 1] = dstpixel[1] * 255 + 0.5; - dstbuffer[x * 4 + 2] = dstpixel[2] * 255 + 0.5; - dstbuffer[x * 4 + 3] = dstpixel[3] * 255 + 0.5; - - /* output planar data to auxiliary output files */ - for (k = 0; k < 4; k++) - putc(dstbuffer[x * 4 + k], fp[k]); - } -#endif - } - - dprintf4("same=%d/%d diff=%d/%d\n", lsame, nsame, ldiff, ndiff); - - /* - * Cleanup memory and files. - */ - -cleanup: - - for (k = 0; k < 4; k++) - if (fp[k]) - fclose(fp[k]); - - if (dstbuffer) - gs_free(pdev->memory, dstbuffer, dststride, 1, "imdi_print_page(dstbuffer)"); - - if (srcbuffer) - gs_free(pdev->memory, srcbuffer, srcstride, 1, "imdi_print_page(srcbuffer)"); - - return code; -} diff --git a/gs/base/gdevwts.c b/gs/base/gdevwts.c deleted file mode 100644 index fe3e7a268..000000000 --- a/gs/base/gdevwts.c +++ /dev/null @@ -1,1129 +0,0 @@ -/* Copyright (C) 2006-2007 Artifex Software, Inc. All rights reserved. - - This software is provided AS-IS with no warranty, either express or - implied. - - This software is distributed under license and may not be copied, - modified or distributed except as expressly authorized under the terms - of the license contained in the file LICENSE in this distribution. - - For more information about licensing, please refer to - http://www.ghostscript.com/licensing/. For information on - commercial licensing, go to http://www.artifex.com/licensing/ or - contact Artifex Software, Inc., 101 Lucas Valley Road #110, - San Rafael, CA 94903, U.S.A., +1(415)492-9861. -*/ - -/* $Id$ */ -/* ALPHA: Sample Device that provides WTS screening and IMDI color management */ -/* TODO: this should be configurable */ - -#include "errno_.h" -#include "string_.h" - -#include "gdevprn.h" -#include "gdevmem.h" -#include "gsdevice.h" -#include "gxfrac.h" -#include "gsht.h" -#include "gxwts.h" -#include "gswts.h" -#include "gxgetbit.h" -#include "gscms.h" -#include "gsicc_cache.h" -#include "gsicc_manage.h" - -#ifndef cmm_gcmmhlink_DEFINED - #define cmm_gcmmhlink_DEFINED - typedef void* gcmmhlink_t; -#endif - -#ifndef cmm_gcmmhprofile_DEFINED - #define cmm_gcmmhprofile_DEFINED - typedef void* gcmmhprofile_t; -#endif - -/* Memory arg is included in ghostpcl branch but not main branch. */ -#define GS_NOTE_ERROR(m, e) gs_note_error(e) - -#ifndef X_DPI -# define X_DPI 72 -#endif -#ifndef Y_DPI -# define Y_DPI 72 -#endif - -typedef struct { - wts_screen_t *wts; - byte *cell; - int width_padded; -} wts_cooked_halftone; - -typedef struct gx_device_wts_s { - gx_device_common; - gx_prn_device_common; - wts_cooked_halftone wcooked[4]; -} gx_device_wts; - -static dev_proc_print_page(wtscmyk_print_page); - -/* 8-bit-per-plane separated CMYK color. */ - -static const gx_device_procs wtscmyk_procs = { - gdev_prn_open, NULL, NULL, gdev_prn_output_page, gdev_prn_close, - NULL, cmyk_8bit_map_color_cmyk, NULL, NULL, NULL, NULL, NULL, NULL, - gdev_prn_get_params, gdev_prn_put_params, - cmyk_8bit_map_cmyk_color, NULL, NULL, NULL, gx_page_device_get_page_device -}; - -const gx_device_wts gs_wtscmyk_device = { - prn_device_body(gx_device_wts, wtscmyk_procs, "wtscmyk", - DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS, - X_DPI, Y_DPI, - 0, 0, 0, 0, /* Margins */ - 4, 32, 255, 255, 256, 256, wtscmyk_print_page) -}; - -/* RGB with imdi conversion to CMYK and wts halftoning */ - -static dev_proc_open_device(wtsimdi_open_device); -static dev_proc_close_device(wtsimdi_close_device); -static dev_proc_print_page(wtsimdi_print_page); -static dev_proc_create_buf_device(wtsimdi_create_buf_device); -static dev_proc_get_bits(wtsimdi_get_bits); -static dev_proc_get_bits_rectangle(wtsimdi_contone_get_bits_rectangle); -static dev_proc_get_bits_rectangle(wtsimdi_halftoned_get_bits_rectangle); - -typedef struct cached_color_s { - gx_color_index color_index; - byte cmyk[4]; -} cached_color; - -#define COLOR_CACHE_SIZE 4096 -/* - * Hash function should preserve low bits (for images) and MUST map white and - * black to different slots - */ -#if COLOR_CACHE_SIZE == 256 -# define COLOR_TO_CACHE_INDEX(color) (((color + 0x000001) ^ (color >> 8) ^ (color >> 16)) & 0xff) -#elif COLOR_CACHE_SIZE == 4096 -# define COLOR_TO_CACHE_INDEX(color) ((color ^ (color>>4) ^ (color>>8)) & 0xfff) -#elif COLOR_CACHE_SIZE == 8192 -# define COLOR_TO_CACHE_INDEX(color) (((color + 0x010204) ^ (((color << 24) | color) >> 11)) & 0x1fff) -#elif COLOR_CACHE_SIZE == 16384 -# define COLOR_TO_CACHE_INDEX(color) (((color + 0x010204) ^ (((color << 24) | color) >> 10)) & 0x3fff) -#elif COLOR_CACHE_SIZE == 32768 -# define COLOR_TO_CACHE_INDEX(color) (((color + 0x010204) ^ (((color << 24) | color) >> 9)) & 0x7fff) -#elif COLOR_CACHE_SIZE == 65536 -# define COLOR_TO_CACHE_INDEX(color) (((color + 0x010204) ^ (((color << 24) | color) >> 8)) & 0xffff) -#else -# define COLOR_TO_CACHE_INDEX(color) 0 -#endif - -typedef struct gx_device_wtsimdi_s { - gx_device_common; - gx_prn_device_common; - wts_cooked_halftone wcooked[4]; - gsicc_device_cm_t *postrender_cm; - gsicc_link_t *icc_link; - cached_color *color_cache; - cached_color current_color; -#ifdef DEBUG - long color_cache_hit, color_cache_collision, cache_fill_empty, color_is_current; -#endif -} gx_device_wtsimdi; - -static const gx_device_procs wtsimdi_procs = -{ - wtsimdi_open_device, NULL, NULL, gdev_prn_output_page, wtsimdi_close_device, - gx_default_rgb_map_rgb_color, gx_default_rgb_map_color_rgb, - NULL, NULL, NULL, NULL, NULL, wtsimdi_get_bits, - gdev_prn_get_params, gdev_prn_put_params, - NULL, NULL, NULL, NULL, gx_page_device_get_page_device -}; - -const gx_device_wtsimdi gs_wtsimdi_device = { - prn_device_body(gx_device_wtsimdi, wtsimdi_procs, "wtsimdi", - DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS, - X_DPI, Y_DPI, - 0, 0, 0, 0, /* Margins */ - 3, 24, 255, 255, 256, 256, wtsimdi_print_page) -}; - -#if defined(DUMMY_WTS_HALFTONE_LINE) && DUMMY_WTS_HALFTONE_LINE == 1 -static void -wts_halftone_line(void **wts, int y, int width, int n_planes, - long band_offset_x, long band_offset_y, - byte **dst, const byte *src) -{ - int x; - int plane_ix; - - for (plane_ix = 0; plane_ix < n_planes; plane_ix++) { - byte *dline = dst[plane_ix]; - for (x = 0; x < width; x += 8) { - byte b = 0; - if (src[(x + 0) * n_planes + plane_ix] > 0x20) b |= 0x80; - if (src[(x + 1) * n_planes + plane_ix] > 0x40) b |= 0x40; - if (src[(x + 2) * n_planes + plane_ix] > 0x60) b |= 0x20; - if (src[(x + 3) * n_planes + plane_ix] > 0x80) b |= 0x10; - if (src[(x + 4) * n_planes + plane_ix] > 0xa0) b |= 0x08; - if (src[(x + 5) * n_planes + plane_ix] > 0xc0) b |= 0x04; - if (src[(x + 6) * n_planes + plane_ix] > 0xe0) b |= 0x02; - if (src[(x + 7) * n_planes + plane_ix] > 0xfe) b |= 0x01; - dline[x >> 3] = b; - } - } -} -#endif - -#if 0 -/* RJW: Not used currently */ -static void -wts_halftone_line_16(wts_cooked_halftone *wch, int y, int width, int n_planes, - long band_offset_x, long band_offset_y, - byte **dst, const byte *src) -{ - int x; - int plane_ix; - wts_screen_sample_t *samples; - - for (plane_ix = 0; plane_ix < n_planes; plane_ix++) { - wts_screen_t *w = wch[plane_ix].wts; - byte *dline = dst[plane_ix]; - int imax; - - for (x = 0; x < width;) { - int i; - int n_samples; - int cx, cy; - - wts_get_samples(w, band_offset_x + x, band_offset_y + y, &cx, &cy, &n_samples); - samples = w->samples + cy * w->cell_width + cx; - - imax = min(width - x, n_samples); - for (i = 0; i < imax; i += 8) { - byte b = 0; - int src_ix = x * 4 + plane_ix; -#if 0 - if (src[src_ix + 0 * 4] > (samples[i + 0] >> 7)) b |= 0x80; - if (src[src_ix + 1 * 4] > (samples[i + 1] >> 7)) b |= 0x40; - if (src[src_ix + 2 * 4] > (samples[i + 2] >> 7)) b |= 0x20; - if (src[src_ix + 3 * 4] > (samples[i + 3] >> 7)) b |= 0x10; - if (src[src_ix + 4 * 4] > (samples[i + 4] >> 7)) b |= 0x08; - if (src[src_ix + 5 * 4] > (samples[i + 5] >> 7)) b |= 0x04; - if (src[src_ix + 6 * 4] > (samples[i + 6] >> 7)) b |= 0x02; - if (src[src_ix + 7 * 4] > (samples[i + 7] >> 7)) b |= 0x01; -#else -#if 0 - b |= (src[src_ix + 0 * 4] > (samples[i + 0] >> 7)) << 7; - b |= (src[src_ix + 1 * 4] > (samples[i + 1] >> 7)) << 6; - b |= (src[src_ix + 2 * 4] > (samples[i + 2] >> 7)) << 5; - b |= (src[src_ix + 3 * 4] > (samples[i + 3] >> 7)) << 4; - b |= (src[src_ix + 4 * 4] > (samples[i + 4] >> 7)) << 3; - b |= (src[src_ix + 5 * 4] > (samples[i + 5] >> 7)) << 2; - b |= (src[src_ix + 6 * 4] > (samples[i + 6] >> 7)) << 1; - b |= (src[src_ix + 7 * 4] > (samples[i + 7] >> 7)) << 0; -#else - b = (((unsigned int)(((int)(samples[i + 0] >> 7)) - ((int)src[src_ix + 0 * 4]))) >> 24) & 0x80; - b |= (((unsigned int)(((int)(samples[i + 1] >> 7)) - ((int)src[src_ix + 1 * 4]))) >> 24) & 0x40; - b |= (((unsigned int)(((int)(samples[i + 2] >> 7)) - ((int)src[src_ix + 2 * 4]))) >> 24) & 0x20; - b |= (((unsigned int)(((int)(samples[i + 3] >> 7)) - ((int)src[src_ix + 3 * 4]))) >> 24) & 0x10; - b |= (((unsigned int)(((int)(samples[i + 4] >> 7)) - ((int)src[src_ix + 4 * 4]))) >> 24) & 0x08; - b |= (((unsigned int)(((int)(samples[i + 5] >> 7)) - ((int)src[src_ix + 5 * 4]))) >> 24) & 0x04; - b |= (((unsigned int)(((int)(samples[i + 6] >> 7)) - ((int)src[src_ix + 6 * 4]))) >> 24) & 0x02; - b |= (((unsigned int)(((int)(samples[i + 7] >> 7)) - ((int)src[src_ix + 7 * 4]))) >> 24) & 0x01; -#endif -#endif - dline[x >> 3] = b; - x += 8; - } - } - } -} -#endif - -static void -wts_halftone_line_8(wts_cooked_halftone *wch, int y, int width, int n_planes, - long band_offset_x, long band_offset_y, - byte * dst, const byte * src) -{ - int x; - int plane_ix; - byte *samples; - int halftoned_bytes = (width + 7) >> 3; - - for (plane_ix = 0; plane_ix < n_planes; plane_ix++) { - wts_screen_t *w = wch[plane_ix].wts; - int width_padded = wch[plane_ix].width_padded; - byte * dline = dst + plane_ix * halftoned_bytes; - /*byte * dline = dst[plane_ix];*/ - int imax; - - for (x = 0; x < width;) { - int i; - int n_samples; - int cx, cy; - - wts_get_samples(w, band_offset_x + x, band_offset_y + y, &cx, &cy, &n_samples); - samples = wch[plane_ix].cell + cy * width_padded + cx; - - imax = min(width - x, n_samples); - for (i = 0; i < imax; i += 8) { - byte b = 0; - int src_ix = x * 4 + plane_ix; - b = (((unsigned int)(((int)(samples[i + 0])) - ((int)src[src_ix + 0 * 4]))) >> 24) & 0x80; - b |= (((unsigned int)(((int)(samples[i + 1])) - ((int)src[src_ix + 1 * 4]))) >> 24) & 0x40; - b |= (((unsigned int)(((int)(samples[i + 2])) - ((int)src[src_ix + 2 * 4]))) >> 24) & 0x20; - b |= (((unsigned int)(((int)(samples[i + 3])) - ((int)src[src_ix + 3 * 4]))) >> 24) & 0x10; - b |= (((unsigned int)(((int)(samples[i + 4])) - ((int)src[src_ix + 4 * 4]))) >> 24) & 0x08; - b |= (((unsigned int)(((int)(samples[i + 5])) - ((int)src[src_ix + 5 * 4]))) >> 24) & 0x04; - b |= (((unsigned int)(((int)(samples[i + 6])) - ((int)src[src_ix + 6 * 4]))) >> 24) & 0x02; - b |= (((unsigned int)(((int)(samples[i + 7])) - ((int)src[src_ix + 7 * 4]))) >> 24) & 0x01; - *dline++ = b; - x += 8; - } - } - } -} - -static int -wts_load_halftone(gs_memory_t *mem, wts_cooked_halftone *wch, const char *fn) -{ - FILE *f = gp_fopen(fn, "rb"); - int size; - byte *buf; - wts_screen_t *wts; - int width_padded; - byte *cooked_cell; - int y; - - if (f == 0) return gs_error_undefinedfilename; - fseek(f, 0, 2); - size = ftell(f); - fseek(f, 0, 0); - buf = gs_malloc(mem, size, 1, "wts_load_halftone"); - if (buf == 0) { - return gs_error_VMerror; - } - (void)fread(buf, 1, size, f); - fclose(f); - wts = gs_wts_from_buf(buf, size); - gs_free(mem, buf, size, 1, "wts_load_halftone"); - wch->wts = wts; - width_padded = wts->cell_width + 7; - wch->width_padded = width_padded; - cooked_cell = gs_malloc(mem, width_padded * wts->cell_height, 1, - "wts_load_halftone"); - if (cooked_cell == 0) { - return gs_error_VMerror; - } - - wch->cell = cooked_cell; - for (y = 0; y < wts->cell_height; y++) { - wts_screen_sample_t *line = &wts->samples[y * wts->cell_width]; - byte *dstline = cooked_cell + y * width_padded; - int x; - for (x = 0; x < width_padded; x++) { - wts_screen_sample_t sample = line[x % wts->cell_width]; - dstline[x] = (254 * (int)sample + 0x7fc0) / 0x8ff0; - } - } - -#if 0 - /* Note: we'll need to fix the free discipline here when we change it - in gswts.c */ - free(wts->samples); - wts->samples = NULL; -#endif - - return 0; -} - -static int -wts_init_halftones(gx_device_wts *wdev, int n_planes) -{ - int i; - int code; - - for (i = 0; i < n_planes; i++) { - if (wdev->wcooked[i].wts == 0) { - char wts_fn[256]; - - sprintf(wts_fn, "wts_plane_%d", i); - { - FILE *f; - if ((f=gp_fopen(wts_fn,"r"))) { - fclose(f); - } else { - sprintf(wts_fn, "/usr/local/lib/ghostscript/wts_plane_%d", i); - } - } - code = wts_load_halftone(wdev->memory, &wdev->wcooked[i], wts_fn); - if (code < 0) - return gs_throw1(code, "could not open file '%s'", wts_fn); - } - } - return 0; -} - -static int -wtscmyk_print_page(gx_device_printer *pdev, FILE *prn_stream) -{ - gx_device_wts *wdev = (gx_device_wts *)pdev; - int cmyk_bytes = gdev_mem_bytes_per_scan_line((gx_device *)pdev); - /* Output bytes have to be padded to 16 bits. */ - int y; - byte *cmyk_line = 0; - byte *data; - int code = 0; - int pbm_bytes; - int n_planes = pdev->color_info.num_components; - byte *dst = NULL; - FILE *ostream[4] = {0}; - int i; - - /* Initialize the wts halftones. */ - code = wts_init_halftones(wdev, n_planes); - if (code < 0) goto out; - - cmyk_line = (byte *)gs_malloc(pdev->memory, cmyk_bytes, 1, "wtscmyk_print_page(in)"); - if (cmyk_line == 0) { - code = GS_NOTE_ERROR(pdev->memory, gs_error_VMerror); - goto out; - } - pbm_bytes = (pdev->width + 7) >> 3; - dst = gs_malloc(pdev->memory, pbm_bytes * n_planes, 1, - "wtscmyk_print_page"); - if (dst == 0) { - code = GS_NOTE_ERROR(pdev->memory, gs_error_VMerror); - goto out; - } - - /* Create additional output streams. */ - for (i = 0; i < n_planes; i++) { - if (i == 0) { - ostream[i] = prn_stream; - } else { - char fn[256]; - char plane_name[4] = "cmyk"; - int fname_len = strlen(pdev->fname); - - if (fname_len >= 5 && fname_len < 256) { - strcpy(fn, pdev->fname); - if (!strcmp(fn + fname_len - 5, "c.pbm")) - fn[fname_len - 5] = plane_name[i]; - } - ostream[i] = gp_fopen(fn, "wb"); - } - fprintf(ostream[i], "P4\n%d %d\n", pdev->width, pdev->height); - } -#if 0 - dprintf2(OPTIONAL_MEM(pdev->memory) "Output file name: %s %d\n", pdev->fname, sizeof(dst)); -#endif - - /* For each raster line */ - for (y = 0; y < pdev->height; y++) { - code = gdev_prn_get_bits(pdev, y, cmyk_line, &data); - if (code < 0) - break; /* return the code below after cleanup */ - wts_halftone_line_8(wdev->wcooked, y, pdev->width, n_planes, - wdev->band_offset_x, wdev->band_offset_y, dst, data); - for (i = 0; i < n_planes; i++) - if (ostream[i]) - fwrite(dst + i * pbm_bytes, 1, pbm_bytes, ostream[i]); - } -out: - /* Clean up... */ - gs_free(pdev->memory, cmyk_line, cmyk_bytes, 1, "wtscmyk_print_page(in)"); - gs_free(pdev->memory, dst, pbm_bytes, 1, "wtscmyk_print_page"); - for (i = 1; i < n_planes; i++) { - /* Don't close ostream[0], because gdev_prn_close will. */ - if (ostream[i]) - fclose(ostream[i]); - } - return code; -} - -/* - * Open IMDI device. - * Load ICC device link profile (to map sRGB to FOGRA CMYK). - */ - -static int -wtsimdi_open_device(gx_device *dev) -{ - gx_device_wtsimdi *idev = (gx_device_wtsimdi*)dev; - int i; - gsicc_rendering_param_t rendering_params; - gsicc_device_cm_t *postrender_cm; - - /* - * We replace create_buf_device so we can replace copy_alpha - * for memory device, but not clist. - */ - - idev->printer_procs.buf_procs.create_buf_device = - wtsimdi_create_buf_device; - - idev->postrender_cm = - (gsicc_device_cm_t*) gs_malloc(dev->memory->non_gc_memory, - 1, sizeof(gsicc_device_cm_t), - "wtsimdi_open_device"); - idev->icc_link = - (gsicc_link_t*) gs_malloc(dev->memory->non_gc_memory, - 1, sizeof(gsicc_link_t), - "wtsimdi_open_device"); - - idev->postrender_cm->device_link_profile = NULL; /* not used now. could be later */ - postrender_cm = idev->postrender_cm; - postrender_cm->memory = dev->memory->non_gc_memory; - if (postrender_cm == NULL) - return gs_throw(-1, "Could not create post render cm object for WTS device"); - - /* Get the profile handles and create the link. We probably want - to make this settable rather than using the defaults but that will come */ - postrender_cm->rgb_profile = gsicc_get_profile_handle_file(DEFAULT_RGB_ICC, - strlen(DEFAULT_RGB_ICC)+1, postrender_cm->memory); - if (postrender_cm->rgb_profile == NULL) - return gs_throw(-1, "Could not create RGB input profile for WTS device"); - - postrender_cm->cmyk_profile = gsicc_get_profile_handle_file(DEFAULT_CMYK_ICC, - strlen(DEFAULT_CMYK_ICC)+1, postrender_cm->memory); - if (postrender_cm->cmyk_profile == NULL) - return gs_throw(-1, "Could not create CMYK output profile for WTS device"); - - if (postrender_cm->rgb_profile->num_comps != 3) - return gs_throw1(-1, "WTS input profile must have 3 input channels. got %d.", - postrender_cm->rgb_profile->num_comps); - if (postrender_cm->cmyk_profile->num_comps != 4) - return gs_throw1(-1, "WTS output profile must have 4 output channels. got %d.", - postrender_cm->cmyk_profile->num_comps); - - /* Set up the rendering parameters */ - rendering_params.black_point_comp = true; - rendering_params.graphics_type_tag = GS_UNKNOWN_TAG; /* Already rendered */ - rendering_params.rendering_intent = gsRELATIVECOLORIMETRIC; - - idev->icc_link->link_handle = gscms_get_link(postrender_cm->rgb_profile->profile_handle, - postrender_cm->cmyk_profile->profile_handle, &rendering_params); - idev->icc_link->is_identity = 0; - idev->icc_link->contextptr = NULL; - idev->icc_link->icc_link_cache = NULL; - idev->icc_link->includes_softproof = false; - - if (idev->icc_link->link_handle == NULL) - return gs_throw(-1, "Could not create ICC link for WTS device"); - - /* Not sure this is the best way to do this with most CMMs. Since CMM has a cache usually */ - /* Allocate at least 1 for sytems that return NULL if requested count is 0 */ - idev->color_cache = (cached_color *)gs_malloc(idev->memory, max(COLOR_CACHE_SIZE, 1), - sizeof(cached_color), "wtsimdi_open_device(color_cache)"); - if (idev->color_cache == NULL) { - return_error(gs_error_VMerror); - } - for (i=0; i<COLOR_CACHE_SIZE; i++) /* clear cache to empty */ - idev->color_cache[i].color_index = gx_no_color_index; - idev->current_color.color_index = gx_no_color_index; - - /* guarantee the device bands */ - ((gx_device_printer *)dev)->space_params.banding_type = BandingAlways; - return gdev_prn_open(dev); - - return(-1); -} - -/* - * Close device and clean up ICC structures. - */ - -static int -wtsimdi_close_device(gx_device *dev) -{ - gx_device_wtsimdi *idev = (gx_device_wtsimdi*)dev; - gsicc_device_cm_t *postrender_cm = idev->postrender_cm; - - gscms_release_link(idev->icc_link); - rc_decrement(postrender_cm->rgb_profile, "wtsimdi_close_device"); - rc_decrement(postrender_cm->cmyk_profile, "wtsimdi_close_device"); - - gs_free(postrender_cm->memory, postrender_cm, 1, sizeof(gsicc_device_cm_t), - "wtsimidi_close"); - gs_free(dev->memory->non_gc_memory, idev->icc_link, 1, sizeof(gsicc_link_t), - "wtsimidi_close"); - gs_free(dev->memory, idev->color_cache, COLOR_CACHE_SIZE, - sizeof(cached_color), "wtsimdi_close_device(color_cache)"); - return gdev_prn_close(dev); -} - -/* Resolve a color to cmyk values, using the one-element cache. */ -static int -wtsimdi_resolve_one(gx_device_wtsimdi *idev, gx_color_index color) -{ - if (color != idev->current_color.color_index) { /* quick out for same color */ - int hash = COLOR_TO_CACHE_INDEX(color); /* 24 bits down to cache index */ - - if (idev->color_cache[hash].color_index == color) { - /* cache hit */ -#ifdef DEBUG - idev->color_cache_hit++; -#endif - idev->current_color = idev->color_cache[hash]; - } else { - - /* cache collision or empty, fill it */ - -#ifdef DEBUG - if (idev->color_cache[hash].color_index == gx_no_color_index) - idev->cache_fill_empty++; - else - idev->color_cache_collision++; -#endif - - /* Transform the color */ - gscms_transform_color(idev->icc_link, &color, - &(idev->current_color.cmyk), 1, NULL); - - idev->color_cache[hash] = idev->current_color; - - } - } -#ifdef DEBUG - else - idev->color_is_current++; -#endif - return 0; -} - -/* Fill a rectangle with a color. */ -static int -wtsimdi_fill_rectangle(gx_device * dev, - int x, int y, int w, int h, gx_color_index color) -{ - gx_device_memory * const mdev = (gx_device_memory *)dev; - gx_device_wtsimdi * idev = (gx_device_wtsimdi *) - ((mdev->target) ? (gx_device_wts *)(mdev->target) - : (gx_device_wts *)dev); - wts_cooked_halftone * wch = idev->wcooked; - int code, comp_value; - int halftoned_bytes = (idev-> width + 7) >> 3; - int width_padded, imax; - byte * dst, * base; - byte * samples; - uint raster, plane_ix; - int first_byte, end_x; - - fit_fill(dev, x, y, w, h); - - base = scan_line_base(mdev, y); - raster = mdev->raster; - - end_x = x + w - 1; - first_byte = x >> 3; - - /* - * Check if this is a new color. To minimize color conversion - * time, we keep a couple of values cached in the wtsimdi device. - */ - if ((code = wtsimdi_resolve_one(idev, color)) < 0) - return code; - - for (; h--; y++) { - base = scan_line_base(mdev, y); - for (plane_ix = 0; plane_ix < 4; plane_ix++) { - int nfill = (end_x >> 3) - first_byte; - - width_padded = wch[plane_ix].width_padded; - dst = base + first_byte + plane_ix * halftoned_bytes; - comp_value = idev->current_color.cmyk[plane_ix]; - if (comp_value == 0) { - if (nfill == 0) { - dst[0] &= (0xff << (8 - (x & 7))) | - ((1 << (7 - (end_x & 7))) - 1); - } else { - dst[0] &= (0xff << (8 - (x & 7))); - memset(&dst[1], 0, nfill-1); - dst[nfill] &= ((1 << (7 - (end_x & 7))) - 1); - } - } else if (comp_value == 0xff) { - if (nfill == 0) { - dst[0] |= ~((0xff << (8 - (x & 7))) | - ((1 << (7 - (end_x & 7))) - 1)); - } else { - dst[0] |= ~(0xff << (8 - (x & 7))); - memset(&dst[1], 0xff, nfill-1); - dst[nfill] |= ~((1 << (7 - (end_x & 7))) - 1); - } - } else { - byte save_left = dst[0]; - byte save_right = dst[nfill]; - int i; - - for (i = 0; i < nfill + 1;) { - int n_samples; - int cx, cy; - int j; - - wts_get_samples(wch[plane_ix].wts, ((dev->band_offset_x + x) & -8) + (i << 3), - (dev->band_offset_y + y), &cx, &cy, &n_samples); - samples = wch[plane_ix].cell + cy * width_padded + cx; - - imax = min((nfill + 1 - i) << 3, n_samples); - for (j = 0; j < imax; j += 8) { - int b; - b = (((unsigned int)(((int)(samples[j + 0])) - comp_value) >> 24)) & 0x80; - b |= (((unsigned int)(((int)(samples[j + 1])) - comp_value) >> 24)) & 0x40; - b |= (((unsigned int)(((int)(samples[j + 2])) - comp_value) >> 24)) & 0x20; - b |= (((unsigned int)(((int)(samples[j + 3])) - comp_value) >> 24)) & 0x10; - b |= (((unsigned int)(((int)(samples[j + 4])) - comp_value) >> 24)) & 0x08; - b |= (((unsigned int)(((int)(samples[j + 5])) - comp_value) >> 24)) & 0x04; - b |= (((unsigned int)(((int)(samples[j + 6])) - comp_value) >> 24)) & 0x02; - b |= (((unsigned int)(((int)(samples[j + 7])) - comp_value) >> 24)) & 0x01; - dst[i + (j >> 3)] = b; - } - dst[0] = (save_left & (0xff << (8 - (x & 7)))) | - (dst[0] & ~(0xff << (8 - (x & 7)))); - dst[nfill] = (save_right & ((1 << (7 - (end_x & 7))) - 1)) | - (dst[nfill] & ~((1 << (7 - (end_x & 7))) - 1)); - i += (j >> 3); - } - } - } - } - return 0; -} - -static int -wtsimdi_copy_mono(gx_device * dev, - const byte * data, int sourcex, int sraster, gx_bitmap_id id, - int x, int y, int w, int h, gx_color_index zero, gx_color_index one) -{ - gx_device_memory * const mdev = (gx_device_memory *)dev; - gx_device_wtsimdi * idev = (gx_device_wtsimdi *) - ((mdev->target) ? (gx_device_wts *)(mdev->target) - : (gx_device_wts *)dev); - wts_cooked_halftone * wch = idev->wcooked; - int code, comp_value; - int halftoned_bytes = (idev-> width + 7) >> 3; - int width_padded, imax; - byte * dst, * base; - byte * samples; - uint raster, plane_ix; - int first_byte, end_x; - const byte *src; - int sshift; - - if (zero != gx_no_color_index) - return gx_default_copy_mono(dev, data, sourcex, sraster, id, - x, y, w, h, zero, one); - if (x < 0) { - sourcex -= x; - w += x; - x = 0; - } - src = data + ((sourcex - (x & 7)) >> 3); - if (y < 0) { - src -= sraster * y; - h += y; - y = 0; - } - fit_fill(dev, x, y, w, h); - - base = scan_line_base(mdev, y); - raster = mdev->raster; - - end_x = x + w - 1; - first_byte = x >> 3; - - /* - * Check if this is a new color. To minimize color conversion - * time, we keep a couple of values cached in the wtsimdi device. - */ -#define COPY_MONO_BLACK_IS_K -#define COPY_MONO_OPTIMIZATION - -#ifdef COPY_MONO_BLACK_IS_K - if (one == 0) { - /* FIXME: This should rely on tag bits, but copy_mono black is (probably) only used for text */ - idev->current_color.cmyk[0] =idev->current_color.cmyk[1] = idev->current_color.cmyk[2] = 0; - idev->current_color.cmyk[3] = 0xff; /* 100% K channel, 0% C, M, Y */ - idev->current_color.color_index = 0; - } else -#endif - if ((code = wtsimdi_resolve_one(idev, one)) < 0) - return code; - - sshift = 8 - ((sourcex - x) & 7); - - for (; h--; y++) { - base = scan_line_base(mdev, y); - for (plane_ix = 0; plane_ix < 4; plane_ix++) { - int nfill = (end_x >> 3) - first_byte; - int i; - byte smask, save_left, save_right; - - width_padded = wch[plane_ix].width_padded; - dst = base + first_byte + plane_ix * halftoned_bytes; - save_left = dst[0]; - save_right = dst[nfill]; - comp_value = idev->current_color.cmyk[plane_ix]; -#ifdef COPY_MONO_OPTIMIZATION - if (comp_value == 0) { - for (i = 0; i < nfill + 1; i++) { - if ((smask = (src[i] << 8 | src[i + 1]) >> sshift) != 0) - dst[i] = dst[i] & ~smask; - } - } else if (comp_value == 0xff) { - for (i = 0; i < nfill + 1; i++) { - if ((smask = (src[i] << 8 | src[i + 1]) >> sshift) != 0) - dst[i] = smask | (dst[i] & ~smask) ; - } - } else -#endif - { - for (i = 0; i < nfill + 1;) { - int n_samples; - int cx, cy; - int j; - - wts_get_samples(wch[plane_ix].wts, ((dev->band_offset_x + x) & -8) + (i << 3), - (dev->band_offset_y + y), &cx, &cy, &n_samples); - samples = wch[plane_ix].cell + cy * width_padded + cx; - - imax = min((nfill + 1 - i) << 3, n_samples); - for (j = 0; j < imax; j += 8) { - smask = (src[i] << 8 | src[i + 1]) >> sshift; - if (smask) { - byte b; - b = (((unsigned int)(((int)(samples[j + 0])) - comp_value) >> 24)) & 0x80; - b |= (((unsigned int)(((int)(samples[j + 1])) - comp_value) >> 24)) & 0x40; - b |= (((unsigned int)(((int)(samples[j + 2])) - comp_value) >> 24)) & 0x20; - b |= (((unsigned int)(((int)(samples[j + 3])) - comp_value) >> 24)) & 0x10; - b |= (((unsigned int)(((int)(samples[j + 4])) - comp_value) >> 24)) & 0x08; - b |= (((unsigned int)(((int)(samples[j + 5])) - comp_value) >> 24)) & 0x04; - b |= (((unsigned int)(((int)(samples[j + 6])) - comp_value) >> 24)) & 0x02; - b |= (((unsigned int)(((int)(samples[j + 7])) - comp_value) >> 24)) & 0x01; - dst[i] = (b & smask) | (dst[i] & ~smask); - } - i++; - } - } - } - /* Restore edge areas on left and right that may have been overwritten */ - dst[0] = (save_left & (0xff << (8 - (x & 7)))) | - (dst[0] & ~(0xff << (8 - (x & 7)))); - dst[nfill] = (save_right & ((1 << (7 - (end_x & 7))) - 1)) | - (dst[nfill] & ~((1 << (7 - (end_x & 7))) - 1)); - } - src += sraster; - } - return 0; -} - -/* - * This is a clone of gx_default_get_bits except that we are adding - * GB_HALFTONED to the parameter options. This will tell the buffer - * device to halftone the data (if it is not already halftoned). - */ -int -wtsimdi_get_bits(gx_device * dev, int y, byte * data, byte ** actual_data) -{ /* - * Hand off to get_bits_rectangle, being careful to avoid a - * possible recursion loop. - */ - dev_proc_get_bits((*save_get_bits)) = dev_proc(dev, get_bits); - gs_int_rect rect; - gs_get_bits_params_t params; - int code; - - rect.p.x = 0, rect.p.y = y; - rect.q.x = dev->width, rect.q.y = y + 1; - params.options = - (actual_data ? GB_RETURN_POINTER : 0) | GB_RETURN_COPY | - (GB_ALIGN_STANDARD | GB_OFFSET_0 | GB_RASTER_STANDARD | - /* No depth specified, we always use native colors. */ - GB_PACKING_CHUNKY | GB_COLORS_NATIVE | GB_ALPHA_NONE | - GB_HALFTONED); - params.x_offset = 0; - params.raster = bitmap_raster(dev->width * dev->color_info.depth); - params.data[0] = data; - params.original_y = y; - set_dev_proc(dev, get_bits, gx_no_get_bits); - code = (*dev_proc(dev, get_bits_rectangle)) - (dev, &rect, ¶ms, NULL); - if (actual_data) - *actual_data = params.data[0]; - set_dev_proc(dev, get_bits, save_get_bits); - return code; -} - -int -wtsimdi_halftoned_get_bits_rectangle(gx_device * dev, const gs_int_rect * prect, - gs_get_bits_params_t * params, gs_int_rect ** unread) -{ - /* - * We should only get to this routine if the caller wants the halftoned - * version of our output. In all other cases we should be in - * wtsimdi_contone_get_bits_rectangle. - */ - if (!(params->options & GB_HALFTONED)) - return_error(gs_error_unknownerror); - return mem_get_bits_rectangle(dev, prect, params, unread); -} - -int -wtsimdi_contone_get_bits_rectangle(gx_device * dev, const gs_int_rect * prect, - gs_get_bits_params_t * params, gs_int_rect ** unread) -{ - /* - * Save the options since mem_get_bits_rectangle will change them to - * indicate what it actually did. We need the unmodified values. - */ - gs_get_bits_options_t options = params->options; - int original_y = params->original_y; - byte * buffer = params->data[0]; - int code = mem_get_bits_rectangle(dev, prect, params, unread); - - if (code < 0) - return code; - if (options & GB_HALFTONED) { - gx_device_memory * const mdev = (gx_device_memory *)dev; - gx_device_wtsimdi * idev = (gx_device_wtsimdi *) - ((mdev->target) ? (gx_device_wts *)(mdev->target) - : (gx_device_wts *)dev); - int width = dev->width; - int n_planes = 4; - int r_last = -1, g_last = -1, b_last = -1, r, g, b; - int x; - byte * src = params->data[0]; - /* Note that the following relies on objects being allocated to - * at least a 4-byte boundary for efficiency on x86 and to prevent - * alignment errors on CPU's that gripe about it. We know this is - * true due to object headers requiring alignment. In the future - * if we want to remove this invariant, we can use 'obj_align_mod' - * to allocate a slightly larger buffer and offset 'cmyk_data' - * to the proper alignment within the buffer. - */ - uint32_t * cmyk_buffer = gs_malloc(dev->memory, - (width + 7), sizeof(uint32_t), - "wtsimdi_contone_get_bits(cmyk_buffer)"); - uint32_t* cmyk_data = cmyk_buffer; - - if (cmyk_data == NULL) - return_error(gs_error_VMerror); - - for (x = 0; x < width; x++) { - r = *src++; - g = *src++; - b = *src++; - if (r != r_last || g != g_last || b != b_last) { - gx_color_index color = (((b<<8) | g) << 8) | r; - - r_last = r, g_last = g, b_last = b; - wtsimdi_resolve_one(idev, color); - } - *cmyk_data++ = *((uint32_t *)idev->current_color.cmyk); - } - wts_halftone_line_8(idev->wcooked, original_y, width, n_planes, - idev->band_offset_x, idev->band_offset_y, buffer, (const byte *)cmyk_buffer); - params->data[0] = buffer; - gs_free(dev->memory, cmyk_buffer, halftoned_bytes * n_planes, 1, - "wtsimdi_print_page(halftoned_data)"); - } - return code; -} - -/* Unfortunately there are many bugs associated with optimizing away - * raster operations to avoid creating a contone buffer (ie bug - * #691154). Until those are fixed the following should remain true. - */ - -const bool ALWAYS_CONTONE = true; - -/* - * We need to create custom memory buffer devices. We use the default - * create_buf_device routine and then we set our custom device procedures. - */ -static int -wtsimdi_create_buf_device(gx_device **pbdev, gx_device *target, int y, - const gx_render_plane_t *render_plane, gs_memory_t *mem, - gx_band_complexity_t *band_complexity) -{ - int code = gx_default_create_buf_device(pbdev, target, y, - render_plane, mem, band_complexity); - /* Now set our custom device procedures. */ - if ((band_complexity && band_complexity->nontrivial_rops) || ALWAYS_CONTONE) { - set_dev_proc(*pbdev, get_bits_rectangle, - wtsimdi_contone_get_bits_rectangle); - } else { - set_dev_proc(*pbdev, get_bits_rectangle, - wtsimdi_halftoned_get_bits_rectangle); - set_dev_proc(*pbdev, fill_rectangle, wtsimdi_fill_rectangle); - set_dev_proc(*pbdev, copy_mono, wtsimdi_copy_mono); - /* All procedures which are defined as mem_true24_* need to be either - implemented or replaced with a default implementation. The following - three don't have significant usage in testing with Altona. - */ - set_dev_proc(*pbdev, copy_alpha, gx_default_copy_alpha); - set_dev_proc(*pbdev, copy_color, gx_default_copy_color); - } - return code; -} - -/* - * Create a row of output data. The output is the same as the pkmraw - * device. This a pseudo 1 bit CMYK output. Actually the output is - * 3 byte RGB with each byte being either 0 or 255. - * - * The input data is 1 bit per component CMYK. The data is separated - * into planes. - */ -static void -write_pkmraw_row(int width, byte * data, FILE * pstream) -{ - if (pstream == NULL) - return; - { - int x, bit; - int halftoned_bytes = (width + 7) >> 3; - byte * cdata = data; - byte * mdata = data + halftoned_bytes; - byte * ydata = mdata + halftoned_bytes; - byte * kdata = ydata + halftoned_bytes; - byte c = *cdata++; - byte m = *mdata++; - byte y = *ydata++; - byte k = *kdata++; - - /* - * Contrary to what the documentation implies, gcc compiles putc - * as a procedure call. This is ridiculous, but since we can't - * change it, we buffer groups of pixels ourselves and use fwrite. - */ - for (bit = 7, x = 0; x < width;) { - byte raw[80 * 3]; /* 80 is arbitrary, must be a multiple of 8 */ - int end = min(x + sizeof(raw) / 3, width); - byte *outp = raw; - - for (; x < end; x++) { - - if ((k >> bit) & 1) { - *outp++ = 0; /* Set output color = black */ - *outp++ = 0; - *outp++ = 0; - } else { - *outp++ = 255 & (255 + ((c >> bit) & 1)); - *outp++ = 255 & (255 + ((m >> bit) & 1)); - *outp++ = 255 & (255 + ((y >> bit) & 1)); - } - if (bit == 0) { - c = *cdata++; - m = *mdata++; - y = *ydata++; - k = *kdata++; - bit = 7; - } else - bit--; - } - fwrite(raw, 1, outp - raw, pstream); - } - return; - } -} - -/* - * Output the page raster. - */ - -static int -wtsimdi_print_page(gx_device_printer *pdev, FILE *prn_stream) -{ - gx_device_wtsimdi *idev = (gx_device_wtsimdi*)pdev; - int n_planes = 4; - byte * halftoned_data; - byte * halftoned_buffer = NULL; - int halftoned_bytes, y; - int code = 0; - int width = pdev->width; - int height = pdev->height; - dev_proc_get_bits((*save_get_bits)) = dev_proc(pdev, get_bits); - int output_is_nul = !strncmp(pdev->fname, "nul:", min(strlen(pdev->fname), 4)) || - !strncmp(pdev->fname, "/dev/null", min(strlen(pdev->fname), 9)); - - /* - * The printer device setup changed the get_bits routine to - * gx_default_get_bits. We want to use our own. - */ - set_dev_proc(pdev, get_bits, wtsimdi_get_bits); - - /* - * Initialize the WTS halftones. - */ - code = wts_init_halftones((gx_device_wts *)idev, n_planes); - if (code < 0) goto cleanup; - - /* - * Allocate a buffer to hold the halftoned data. This is 1 bit per - * component CMYK data. - */ - halftoned_bytes = (width + 7) >> 3; /* bytes per component */ - halftoned_buffer = gs_malloc(pdev->memory, halftoned_bytes * n_planes, 1, - "wtsimdi_print_page(halftoned_data)"); - if (halftoned_buffer == NULL) { - code = GS_NOTE_ERROR(pdev->memory, gs_error_VMerror); - goto cleanup; - } -#ifdef DEBUG - /* Collect stats on each page. With the allocation now done once in 'open' the - * statistics won't be the same if other pages have been printed */ - idev->color_cache_hit = idev->color_cache_collision = - idev->color_is_current = idev->cache_fill_empty = 0; -#endif - - /* Initialize output file header. */ - if (!output_is_nul) { - fprintf(prn_stream, "P6\n%d %d\n", width, height); - fprintf(prn_stream, "# Image generated by %s %ld.%02ld (device=wtsimdi)\n", - gs_program_name(), gs_revision_number() / 100, - gs_revision_number() % 100); - fprintf(prn_stream, "%d\n", 255); - } - - /* - * Get raster data and then write data to output file. - */ - for (y = 0; y < height; y++) { - /* - * The get_bit routines for our device returns a halftoned copy of - * the output data. Print this data to the output file. - */ - code = gdev_prn_get_bits(pdev, y, halftoned_buffer, &halftoned_data); - if (code < 0) - break; /* return code below after cleanup */ - if (!output_is_nul) - write_pkmraw_row(width, halftoned_data, prn_stream); - } -cleanup: - if (idev->color_cache != NULL) { -#ifdef DEBUG - { - int i, unused_color_cache_slots; - - for (i=0,unused_color_cache_slots=0; i<COLOR_CACHE_SIZE; i++) - if (idev->color_cache[i].color_index == gx_no_color_index) - unused_color_cache_slots++; - if_debug5(':',"wtsimdi_print_page color cache stats:" - " current=%ld, hits=%ld," - " collisions=%ld, fill=%ld, unused_slots=%d\n", - idev->color_is_current, idev->color_cache_hit, - idev->color_cache_collision, idev->cache_fill_empty, - unused_color_cache_slots); - } -#endif - } - if (halftoned_buffer != NULL) - gs_free(pdev->memory, halftoned_buffer, halftoned_bytes * n_planes, 1, - "wtsimdi_print_page(halftoned_buffer)"); - set_dev_proc(pdev, get_bits, save_get_bits); - return code; -} diff --git a/gs/base/gs.mak b/gs/base/gs.mak index 421a0c586..b59e9486a 100644 --- a/gs/base/gs.mak +++ b/gs/base/gs.mak @@ -74,8 +74,6 @@ # e.g. 'jasper' or 'jasper-/version/' # JPX_CFLAGS - any platform-specific flags that are required # to properly compile in the jpeg2k library source -# IMDISRCDIR - the name of the IMDI lib source directory -# generally 'imdi' # SHARE_LCMS - If set to 1, asks the linker to use a separately # compiled lcms library. If set to 0, the build will compile # in the library source found in LCMSSRCDIR diff --git a/gs/base/macos-mcp.mak b/gs/base/macos-mcp.mak index bb154291f..34effe84b 100644 --- a/gs/base/macos-mcp.mak +++ b/gs/base/macos-mcp.mak @@ -140,11 +140,6 @@ WHICH_CMS=lcms #IJSSRCDIR=ijs #IJSEXECTYPE=unix -# Define the directory where the imdi library source is stored. -# See devs.mak for more information - -IMDISRCDIR=imdi - # ------ Platform-specific options ------ # # Define the name of the C compiler. diff --git a/gs/base/macosx.mak b/gs/base/macosx.mak index 1dcb5a2d7..3a5f2d088 100644 --- a/gs/base/macosx.mak +++ b/gs/base/macosx.mak @@ -189,11 +189,6 @@ IJS_NAME= IJSSRCDIR=ijs IJSEXECTYPE=unix -# Define the directory where the imdi library source is stored. -# See devs.mak for more information - -IMDISRCDIR=imdi - # Define how to build the library archives. (These are not used in any # standard configuration.) diff --git a/gs/base/msvclib.mak b/gs/base/msvclib.mak index 9dd212ff7..ffa19f087 100644 --- a/gs/base/msvclib.mak +++ b/gs/base/msvclib.mak @@ -183,13 +183,6 @@ LCMSSRCDIR=lcms LCMS2SRCDIR=lcms2 !endif -# Define the directory where the imdi library source is stored. -# See devs.mak for more information - -!ifndef IMDISRCDIR -IMDISRCDIR=imdi -!endif - # Define any other compilation flags. !ifndef CFLAGS diff --git a/gs/base/openvms.mak b/gs/base/openvms.mak index 1b1f8e20f..7626a35d3 100644 --- a/gs/base/openvms.mak +++ b/gs/base/openvms.mak @@ -154,11 +154,6 @@ WHICH_CMS=lcms #IJSSRCDIR=[.ijs] #IJSEXECTYPE=unix -# Define the directory where the imdi source are stored. -# See imdi.mak for more information - -IMDISRCDIR=[.imdi] - # Note that built-in third-party libraries aren't available. SHARE_JPEG=0 diff --git a/gs/base/ugcclib.mak b/gs/base/ugcclib.mak index ce636cce0..341c11514 100644 --- a/gs/base/ugcclib.mak +++ b/gs/base/ugcclib.mak @@ -76,11 +76,6 @@ IJS_NAME= IJSSRCDIR=ijs IJSEXECTYPE=unix -# Define the directory where the imdi library source is stored. -# See devs.mak for more information - -IMDISRCDIR=imdi - # Define how to build the library archives. (These are not used in any # standard configuration.) diff --git a/gs/base/unix-gcc.mak b/gs/base/unix-gcc.mak index 74e82bf15..5bb13c593 100644 --- a/gs/base/unix-gcc.mak +++ b/gs/base/unix-gcc.mak @@ -213,11 +213,6 @@ IJSEXECTYPE=unix # Define how to build the library archives. (These are not used in any # standard configuration.) -# Define the directory where the imdi library source is stored. -# See devs.mak for more information - -IMDISRCDIR=imdi - AR=ar ARFLAGS=qc RANLIB=ranlib diff --git a/gs/base/unixansi.mak b/gs/base/unixansi.mak index 90f463acf..a91843c5a 100644 --- a/gs/base/unixansi.mak +++ b/gs/base/unixansi.mak @@ -197,11 +197,6 @@ IJS_NAME= IJSSRCDIR=ijs IJSEXECTYPE=unix -# Define the directory where the imdi library source is stored. -# See devs.mak for more information - -IMDISRCDIR=imdi - # Define how to build the library archives. (These are not used in any # standard configuration.) diff --git a/gs/base/wtsimdi.c b/gs/base/wtsimdi.c deleted file mode 100644 index f1fa44c43..000000000 --- a/gs/base/wtsimdi.c +++ /dev/null @@ -1,79 +0,0 @@ -/* Copyright (C) 2005-2006 Artifex Software, Inc. - All Rights Reserved. - - This software is provided AS-IS with no warranty, either express or - implied. - - This software is distributed under license and may not be copied, modified - or distributed except as expressly authorized under the terms of that - license. Refer to licensing information at http://www.artifex.com/ - or contact Artifex Software, Inc., 7 Mt. Lassen Drive - Suite A-134, - San Rafael, CA 94903, U.S.A., +1(415)492-9861, for further information. -*/ - -/* $Id$ */ - -/* - * Create an imdi memory device for page or band buffering, - * possibly preceded by a plane extraction device. - */ -int -wtsimdi_create_buf_device(gx_device **pbdev, gx_device *target, - const gx_render_plane_t *render_plane, gs_memory_t *mem, bool for_band) -{ - int plane_index = (render_plane ? render_plane->index : -1); - int depth; - const gx_device_memory *mdproto; - gx_device_memory *mdev; - - if (plane_index >= 0) - depth = render_plane->depth; - else - depth = target->color_info.depth; - mdproto = gdev_mem_device_for_bits(depth); - if (mdproto == 0) - return_error(gs_error_rangecheck); - if (mem) { - mdev = gs_alloc_struct(mem, gx_device_memory, &st_device_memory, - "create_buf_device"); - if (mdev == 0) - return_error(gs_error_VMerror); - } else { - mdev = (gx_device_memory *)*pbdev; - } - if (target == (gx_device *)mdev) { - /* The following is a special hack for setting up printer devices. */ - assign_dev_procs(mdev, mdproto); - check_device_separable((gx_device *)mdev); - gx_device_fill_in_procs((gx_device *)mdev); - } else - gs_make_mem_device(mdev, mdproto, mem, (for_band ? 1 : 0), - (target == (gx_device *)mdev ? NULL : target)); - mdev->width = target->width; - /* - * The matrix in the memory device is irrelevant, - * because all we do with the device is call the device-level - * output procedures, but we may as well set it to - * something halfway reasonable. - */ - gs_deviceinitialmatrix(target, &mdev->initial_matrix); - /****** QUESTIONABLE, BUT BETTER THAN OMITTING ******/ - mdev->color_info = target->color_info; - *pbdev = (gx_device *)mdev; - return 0; -} - -#define wtsimdi_prn_procs(print_page)\ - { print_page,\ - gx_default_print_page_copies,\ - { wtsimdi_create_buf_device,\ - gx_default_size_buf_device,\ - gx_default_setup_buf_device,\ - gx_default_destroy_buf_device\ - },\ - gdev_prn_default_get_space_params,\ - gx_default_start_render_thread,\ - gx_default_open_render_device,\ - gx_default_close_render_device,\ - gx_default_buffer_page\ - } diff --git a/gs/ghostscript.vcproj b/gs/ghostscript.vcproj index 521588d47..a6c9bd188 100644 --- a/gs/ghostscript.vcproj +++ b/gs/ghostscript.vcproj @@ -1130,10 +1130,6 @@ RelativePath="base\vdtrace.c" > </File> - <File - RelativePath="base\wtsimdi.c" - > - </File> <Filter Name="rinkj" > @@ -1374,10 +1370,6 @@ > </File> <File - RelativePath="base\gdevimdi.c" - > - </File> - <File RelativePath="base\gdevimgn.c" > </File> @@ -3628,66 +3620,6 @@ </File> </Filter> <Filter - Name="imdi" - > - <File - RelativePath="imdi\arch.h" - > - </File> - <File - RelativePath="imdi\cctiff.c" - > - </File> - <File - RelativePath="imdi\cgen.c" - > - </File> - <File - RelativePath="imdi\config.h" - > - </File> - <File - RelativePath="imdi\copyright.h" - > - </File> - <File - RelativePath="imdi\imdi.c" - > - </File> - <File - RelativePath="imdi\imdi.h" - > - </File> - <File - RelativePath="imdi\imdi_gen.c" - > - </File> - <File - RelativePath="imdi\imdi_gen.h" - > - </File> - <File - RelativePath="imdi\imdi_imp.h" - > - </File> - <File - RelativePath="imdi\imdi_k.c" - > - </File> - <File - RelativePath="imdi\imdi_k.h" - > - </File> - <File - RelativePath="imdi\imdi_tab.c" - > - </File> - <File - RelativePath="imdi\imdi_tab.h" - > - </File> - </Filter> - <Filter Name="jbig2dec" > <File diff --git a/gs/imdi/Jamfile b/gs/imdi/Jamfile deleted file mode 100644 index 3963bc2ad..000000000 --- a/gs/imdi/Jamfile +++ /dev/null @@ -1,4 +0,0 @@ -LINKLIBS += -lm ; -Main imdi_gen : imdi_gen.c cgen.c ; -GenFile imdi_k.h : imdi_gen ; -# Library libimdi.lib : imdi.c imdi_tab.c ; diff --git a/gs/imdi/LICENSE b/gs/imdi/LICENSE deleted file mode 100644 index 05ca889d8..000000000 --- a/gs/imdi/LICENSE +++ /dev/null @@ -1,282 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc. - 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Library General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - - diff --git a/gs/imdi/README b/gs/imdi/README deleted file mode 100644 index ea46ab773..000000000 --- a/gs/imdi/README +++ /dev/null @@ -1,114 +0,0 @@ - -This is the development area for IMDI, the -Interger Multi-Dimensional Interpolation routines. - -They provide a flexible and high performance -system for applying color transforms to typical -raster pixel data. Because they provide a means of -applying arbitrary combination dependent mappings -of multi-channel pixel data, there are many other -possible uses for these sorts of routines as well, -including high quality matting/compositing. For instance, -one could create a smooth, proportional "chroma key" -type of matt for matting one RGB image onto another -by creating a 6 channel to 3 dimensional transform, -that its applied to each pair of pixels from the -source images and produces one combined output pixel. -Additional input or output alpha channels are easy -to add by simply adding more input and/or output -dimensions. The matting calculatons can be almost -arbitrarily complex, and the imdi will apply them -to the pixel data at very high speed. - -The system has two parts, one that generates taylored, -optimised source code for the transformation kernels, -and the run time code that matches a transform request -to a compiled kernel, and initialises the appropriate -run time lookup tables. - -The kernel source generator is intended to accomodate -various optimisations, such as assembly code, vector -instruction set (ie. MMX, AltiVec etc.) versions, but -at present only generates the more portable 'C' code -kernels. - -Both 8 bit per component and 16 bit per component -pixel data is handled, up to 8 input and output -dimensions (but this limit could be trivially raised). - -imdi_gen.exe is the module that triggers the generation of - optimised source code as configured for the color spaces - and pixel formats selected. By default creates - a single imdi_k.c and imdi_k.h file, but if - given the -i flag, creates a separate file - for each kernel variant. - -cgen.c C code generator module. - -itest.c regresion test routine. - Normally runs speed and accuracy tests for - all configured kernel variants. - The -q flag makes it run quicker, - but makes the benchmarking inacurate, - the -s flag will cause it to stop - if any routine has unexpectedly low - accuracy. - -cctiff.c is the utility that takes an ICC device - profile link, and converts a TIFF file - from the input colorspace to the output - space. Both 8 bit and 16 bit TIFF files - are handled, as well as colorspaces up to - 8 channels in and out. - This accepts either a device link ICC profile, - or links an input and output devce ICC profile - to define the color transform. - - -greytiff.c is a utility similar to cctiff, that - is an example of how to colorimetrically - convert an RGB file into a monochrome RGB file. - - - -Misc. Notes ------------ - - ITU-T Rec. T.42 specifies the ITULAB encoding in terms of a range - and offset for each component, which are related to the minimum and - maximum values as follows: - - minimum = - (range x offset) / 2^n - 1 - maximum = minimum + range - - The Decode field default values depend on the color space. For the - ITULAB color space encoding, the default values correspond to the - base range and offset, as specified in ITU-T Rec. T.42 [T.42]. The - following table gives the base range and offset values for - BitsPerSample=8 and 12, and the corresponding default minimum and - maximum default values for the Decode field, calculated using the - equations above when PhotometricInterpetation=10. - - +-----------------------------------------------+ - | ITU-T Rec. T.42 | Decode | - +---------+-----------| base values | default values | - | BitsPer + Component +------------------+----------------------------+ - | -Sample | | Range | Offset | Min | Max | - +---------+-----------+--------+---------+--------------+-------------+ - | 8 | L* | 100 | 0 | 0 | 100 | - | +-----------+--------+---------+--------------+-------------+ - | | a* | 170 | 128 | -21760/255 | 21590/255 | - | +-----------+--------+---------+--------------+-------------+ - | | b* | 200 | 96 | -19200/255 | 31800/255 | - +---------+-----------+--------+---------+--------------+-------------+ - | 12 | L* | 100 | 0 | 0 | 100 | - | +-----------+--------+---------+--------------+-------------+ - | | a* | 170 | 2048 | -348160/4095 | 347990/4095 | - | +-----------+--------+---------+--------------+-------------+ - | | b* | 200 | 1536 | -307200/4095 | 511800/4095 | - +---------+-----------+--------+---------+--------------+-------------+ - - For example, when PhotometricInterpretation=10 and BitsPerSample=8, - the default value for Decode is (0, 100, -21760/255, 21590/255, - -19200/255, 31800/255). - diff --git a/gs/imdi/arch.h b/gs/imdi/arch.h deleted file mode 100644 index 37cec0cbb..000000000 --- a/gs/imdi/arch.h +++ /dev/null @@ -1,56 +0,0 @@ -#ifndef ARCH_H -#define ARCH_H - -/* Integer Multi-Dimensional Interpolation */ -/* - * Copyright 2000 Graeme W. Gill - * - * This material is licenced under the GNU GENERAL PUBLIC LICENCE :- - * see the Licence.txt file for licencing details. - */ - -#define STR_DEF(def) #def - -#ifdef ALLOW64 - -/* Detect machine/compiler specifics here */ -#if defined(NT) || defined(__WIN32__) -#define longlong __int64 -#else /* !NT, assume standard */ -#define longlong long long -#endif /* !NT */ -#define str_longlong STR_DEF(longlong) - -#endif /* ALLOW64 */ - -/* Machine/Language architectural specifications */ -typedef struct { - int bits; /* Bits in this data type */ - char *name; /* Name used to specify this type */ - int align; /* Non-zero if this type should be accessed aligned */ -} dtypes; - -#define MXDTYPES 6 - -typedef struct { - int bigend; /* Non-zero if this is a bigendian architecture */ - int uwa; /* Use wide memory access */ - - int pbits; /* Number of bits in a pointer */ - - int nords; /* Number of ord types */ - dtypes ords[MXDTYPES]; /* Ordinal types, in size order */ - int natord; /* Index of natural machine ordinal */ - - int nints; /* Number of int types */ - dtypes ints[MXDTYPES]; /* Integer types, in size order */ - int natint; /* Index of natural machine integer */ - - /* Optimisation settings */ - int shfm; /* Non-zero to use shifts for masking */ - int oscale; /* Maximum power of 2 scaled indexing mode, 0 for none. */ - int smmul; /* Has fast small multiply for index scaling */ - -} mach_arch; - -#endif /* ARCH_H */ diff --git a/gs/imdi/cctiff.c b/gs/imdi/cctiff.c deleted file mode 100644 index 22a772158..000000000 --- a/gs/imdi/cctiff.c +++ /dev/null @@ -1,1186 +0,0 @@ -/* - * Color Correct a TIFF file, using an ICC Device link profile. - * - * Author: Graeme W. Gill - * Date: 00/3/8 - * Version: 1.30 - * - * Copyright 2000 - 2004 Graeme W. Gill - * All rights reserved. - * - * This material is licenced under the GNU GENERAL PUBLIC LICENCE :- - * see the Licence.txt file for licencing details. - */ - -/* - * Thanks to Neil Okamoto for the 16 bit TIFF mods. - */ - -/* TTBD: - */ - -/* - This program is a framework that exercises the - IMDI code, as well as a demonstration of simple - profile linking. It can also do the conversion using the - floating point code in ICCLIB as a reference. - - */ - -#include <stdio.h> -#include <stdlib.h> -#include <stdarg.h> -#include <fcntl.h> -#include <string.h> -#include <math.h> -#include "copyright.h" -#include "config.h" -#include "tiffio.h" -#include "icc.h" -#include "imdi.h" - -#undef TREAT_CMY_AS_RGB - -void error(char *fmt, ...), warning(char *fmt, ...); - -void usage(void) { - fprintf(stderr,"Color Correct a TIFF file using an ICC device link profile, V%s\n",ARGYLL_VERSION_STR); - fprintf(stderr,"Author: Graeme W. Gill, licensed under the GPL\n"); - fprintf(stderr,"usage: cctiff [-options] devlinkprofile.icm infile.tif outfile.tif\n"); - fprintf(stderr,"usage: cctiff [-options] -l inprofile.icm outprofile.icm infile.tif outfile.tif\n"); - fprintf(stderr," -v Verbose\n"); - fprintf(stderr," -c Combine linearisation curves into one transform\n"); - fprintf(stderr," -p Use slow precise correction\n"); - fprintf(stderr," -k Check fast result against precise, and report\n"); - fprintf(stderr," -l Link input and output profiles\n"); - fprintf(stderr," -i in_intent p = perceptual, r = relative colorimetric,\n"); - fprintf(stderr," s = saturation, a = absolute colorimetric\n"); - fprintf(stderr," -o out_intent p = perceptual, r = relative colorimetric,\n"); - fprintf(stderr," s = saturation, a = absolute colorimetric\n"); - exit(1); -} - -/* Convert an ICC colorspace to the corresponding possible TIFF Photometric tags. */ -/* Return the number of matching tags, and 0 if there is no corresponding tag. */ -int -ColorSpaceSignature2TiffPhotometric( -uint16 tags[10], /* Pointer to return array, up to 10 */ -icColorSpaceSignature cspace /* Input ICC colorspace */ -) { - switch(cspace) { - case icSigGrayData: - tags[0] = PHOTOMETRIC_MINISBLACK; - return 1; - case icSigRgbData: -#ifdef TREAT_CMY_AS_RGB - case icSigCmyData: -#endif - tags[0] = PHOTOMETRIC_RGB; - return 1; -#ifndef TREAT_CMY_AS_RGB - case icSigCmyData: -#endif - case icSigCmykData: - tags[0] = PHOTOMETRIC_SEPARATED; - return 1; - case icSigYCbCrData: - tags[0] = PHOTOMETRIC_YCBCR; - return 1; - case icSigLabData: - tags[0] = PHOTOMETRIC_CIELAB; -#ifdef PHOTOMETRIC_ICCLAB - tags[1] = PHOTOMETRIC_ICCLAB; - tags[2] = PHOTOMETRIC_ITULAB; -#endif - return 3; - - case icSigXYZData: - case icSigLuvData: - case icSigYxyData: - case icSigHsvData: - case icSigHlsData: - return 0; - - case icSig2colorData: - tags[0] = PHOTOMETRIC_SEPARATED; - tags[1] = 2; /* Cheat */ - return 1; - - case icSig3colorData: - tags[0] = PHOTOMETRIC_SEPARATED; - tags[1] = 3; /* Cheat */ - return 1; - - case icSig4colorData: - tags[0] = PHOTOMETRIC_SEPARATED; - tags[1] = 4; /* Cheat */ - return 1; - - case icSig5colorData: - case icSigMch5Data: - tags[0] = PHOTOMETRIC_SEPARATED; - tags[1] = 5; /* Cheat */ - return 1; - - case icSig6colorData: - case icSigMch6Data: - tags[0] = PHOTOMETRIC_SEPARATED; - tags[1] = 6; /* Cheat */ - return 1; - - case icSig7colorData: - case icSigMch7Data: - tags[0] = PHOTOMETRIC_SEPARATED; - tags[1] = 7; /* Cheat */ - return 1; - - case icSig8colorData: - case icSigMch8Data: - tags[0] = PHOTOMETRIC_SEPARATED; - tags[1] = 8; /* Cheat */ - return 1; - - case icSig9colorData: - tags[0] = PHOTOMETRIC_SEPARATED; - tags[1] = 9; /* Cheat */ - return 1; - - case icSig10colorData: - tags[0] = PHOTOMETRIC_SEPARATED; - tags[1] = 10; /* Cheat */ - return 1; - - case icSig11colorData: - tags[0] = PHOTOMETRIC_SEPARATED; - tags[1] = 11; /* Cheat */ - return 1; - - case icSig12colorData: - tags[0] = PHOTOMETRIC_SEPARATED; - tags[1] = 12; /* Cheat */ - return 1; - - case icSig13colorData: - tags[0] = PHOTOMETRIC_SEPARATED; - tags[1] = 13; /* Cheat */ - return 1; - - case icSig14colorData: - tags[0] = PHOTOMETRIC_SEPARATED; - tags[1] = 14; /* Cheat */ - return 1; - - case icSig15colorData: - tags[0] = PHOTOMETRIC_SEPARATED; - tags[1] = 15; /* Cheat */ - return 1; - - default: - return 0; - } - return 0; -} - -/* Compute the length of a double nul terminated string, including */ -/* the nuls. */ -static int zzstrlen(char *s) { - int i; - for (i = 0;; i++) { - if (s[i] == '\000' && s[i+1] == '\000') - return i+2; - } - return 0; -} - -/* Convert an ICC colorspace to the corresponding TIFF Inkset tag */ -/* return 0xffff if not possible or applicable. */ - -int -ColorSpaceSignature2TiffInkset( -icColorSpaceSignature cspace, -int *len, /* Return length of ASCII inknames */ -char **inknames /* Return ASCII inknames if non NULL */ -) { - switch(cspace) { - case icSigCmyData: - return 0xffff; /* ~~9999 */ - if (inknames != NULL) { - *inknames = "cyan\000magenta\000yellow\000\000"; - *len = zzstrlen(*inknames); - } - return 0; /* Not CMYK */ - case icSigCmykData: - if (inknames != NULL) { - *inknames = NULL; /* No inknames */ - *len = 0; - } - return INKSET_CMYK; - - case icSigGrayData: - case icSigRgbData: - case icSigYCbCrData: - case icSigLabData: - case icSigXYZData: - case icSigLuvData: - case icSigYxyData: - case icSigHsvData: - case icSigHlsData: - case icSig2colorData: - case icSig3colorData: - case icSig4colorData: - case icSig5colorData: - case icSigMch5Data: - return 0xffff; - - case icSig6colorData: - case icSigMch6Data: - /* This is a cheat and a hack. Should really make sure that icclink */ - /* transfers the right information from the destination */ - /* profile, and then copies it to the device profile, */ - /* allowing cctiff to read it. */ - if (inknames != NULL) { - *inknames = "cyan\000magenta\000yellow\000black\000orange\000green\000\000"; - *len = zzstrlen(*inknames); - } - return 0; /* Not CMYK */ - - case icSig7colorData: - case icSigMch7Data: - return 0xffff; - - case icSig8colorData: - case icSigMch8Data: - /* This is a cheat and a hack. Should really make sure that icclink */ - /* transfers the right information from the destination */ - /* profile, and then copies it to the device profile, */ - /* allowing cctiff to read it. */ - if (inknames != NULL) { - *inknames = "cyan\000magenta\000yellow\000black\000orange\000green\000lightcyan\000lightmagenta\000\000"; - *len = zzstrlen(*inknames); - } - return 0; /* Not CMYK */ - case icSig9colorData: - case icSig10colorData: - case icSig11colorData: - case icSig12colorData: - case icSig13colorData: - case icSig14colorData: - case icSig15colorData: - default: - return 0xffff; - } - return 0xffff; -} - -char * -Photometric2str( -int pmtc -) { - static char buf[80]; - switch (pmtc) { - case PHOTOMETRIC_MINISWHITE: - return "Subtractive Gray"; - case PHOTOMETRIC_MINISBLACK: - return "Additive Gray"; - case PHOTOMETRIC_RGB: - return "RGB"; - case PHOTOMETRIC_PALETTE: - return "Indexed"; - case PHOTOMETRIC_MASK: - return "Transparency Mask"; - case PHOTOMETRIC_SEPARATED: - return "Separated"; - case PHOTOMETRIC_YCBCR: - return "YCbCr"; - case PHOTOMETRIC_CIELAB: - return "CIELab"; -#ifdef PHOTOMETRIC_ICCLAB - case PHOTOMETRIC_ICCLAB: - return "ICCLab"; - case PHOTOMETRIC_ITULAB: - return "ITULab"; -#endif - case PHOTOMETRIC_LOGL: - return "CIELog2L"; - case PHOTOMETRIC_LOGLUV: - return "CIELog2Luv"; - } - sprintf(buf,"Unknonw Tag %d",pmtc); - return buf; -} - -/* Callbacks used to initialise imdi */ - -/* Information needed from a profile */ -struct _profinfo { - char name[100]; - icmFile *fp; - icc *c; - icmHeader *h; - icRenderingIntent intent; - icmLuBase *luo; /* Base Lookup type object */ - icmLuAlgType alg; /* Type of lookup algorithm */ - int chan; /* Device channels */ -}; typedef struct _profinfo profinfo; - -/* Context for imdi setup callbacks */ -typedef struct { - /* Overall parameters */ - int verb; /* Non-zero if verbose */ - icColorSpaceSignature ins, outs; /* Input/Output spaces */ - int id, od; /* Input/Output dimensions */ - int icombine; /* Non-zero if input curves are to be combined */ - int ocombine; /* Non-zero if output curves are to be combined */ - int link; /* Non-zero if input and output profiles are to be linked */ - - profinfo dev; /* Device link profile */ - profinfo in; /* Device to PCS profile */ - profinfo out; /* PCS to Device profile */ -} sucntx; - -/* Input curve function */ -double input_curve( - void *cntx, - int ch, - double in_val -) { - sucntx *rx = (sucntx *)cntx; - int i; - double vals[MAX_CHAN]; - - if (rx->icombine) - return in_val; - - if (rx->link) { - - for (i = 0; i < rx->id; i++) - vals[i] = 0.0; - vals[ch] = in_val; - - switch(rx->in.alg) { - case icmMonoFwdType: { - icmLuMono *lu = (icmLuMono *)rx->in.luo; /* Safe to coerce */ - lu->fwd_curve(lu, vals, vals); - break; - } - case icmMatrixFwdType: { - icmLuMatrix *lu = (icmLuMatrix *)rx->in.luo; /* Safe to coerce */ - lu->fwd_curve(lu, vals, vals); - break; - } - case icmLutType: { - icmLuLut *lu = (icmLuLut *)rx->in.luo; /* Safe to coerce */ - /* Since not PCS, in_abs and matrix cannot be valid, */ - /* so input curve on own is ok to use. */ - lu->input(lu, vals, vals); - break; - } - default: - error("Unexpected algorithm type in input curve"); - } - } else { - icmLuLut *lu = (icmLuLut *)rx->dev.luo; /* Safe to coerce */ - - for (i = 0; i < rx->id; i++) - vals[i] = 0.0; - vals[ch] = in_val; - - /* Since input not PCS, in_abs and matrix cannot be valid, */ - /* so input curve on own is ok to use. */ - lu->input(lu, vals, vals); - - } - return vals[ch]; -} - -/* Multi-dim table function */ -void md_table( -void *cntx, -double *out_vals, -double *in_vals -) { - sucntx *rx = (sucntx *)cntx; - double pcsv[3]; - int i; - - if (rx->link) { - double vals[MAX_CHAN]; - - switch(rx->in.alg) { - case icmMonoFwdType: { - icmLuMono *lu = (icmLuMono *)rx->in.luo; /* Safe to coerce */ - if (rx->icombine) { - lu->fwd_curve(lu, vals, in_vals); - lu->fwd_map(lu, pcsv, vals); - } else { - lu->fwd_map(lu, pcsv, in_vals); - } - lu->fwd_abs(lu, pcsv, pcsv); - break; - } - case icmMatrixFwdType: { - icmLuMatrix *lu = (icmLuMatrix *)rx->in.luo; /* Safe to coerce */ - if (rx->icombine) { - lu->fwd_curve(lu, vals, in_vals); - lu->fwd_matrix(lu, pcsv, vals); - } else { - lu->fwd_matrix(lu, pcsv, in_vals); - } - lu->fwd_abs(lu, pcsv, pcsv); - break; - } - case icmLutType: { - icmLuLut *lu = (icmLuLut *)rx->in.luo; /* Safe to coerce */ - if (rx->icombine) { - /* Since not PCS, in_abs and matrix cannot be valid, */ - /* so input curve on own is ok to use. */ - lu->input(lu, vals, in_vals); - lu->clut(lu, pcsv, vals); - } else { - lu->clut(lu, pcsv, in_vals); - } - lu->output(lu, pcsv, pcsv); - lu->out_abs(lu, pcsv, pcsv); - break; - } - default: - error("Unexpected algorithm type in clut lookup"); - } - - switch(rx->out.alg) { - case icmMonoBwdType: { - icmLuMono *lu = (icmLuMono *)rx->out.luo; /* Safe to coerce */ - lu->bwd_abs(lu, pcsv, pcsv); - lu->bwd_map(lu, out_vals, pcsv); - if (rx->ocombine) { - lu->bwd_curve(lu, out_vals, out_vals); - } - break; - } - case icmMatrixBwdType: { - icmLuMatrix *lu = (icmLuMatrix *)rx->out.luo; /* Safe to coerce */ - lu->bwd_abs(lu, pcsv, pcsv); - lu->bwd_matrix(lu, out_vals, pcsv); - if (rx->ocombine) { - lu->bwd_curve(lu, out_vals, out_vals); - } - break; - } - case icmLutType: { - icmLuLut *lu = (icmLuLut *)rx->out.luo; /* Safe to coerce */ - lu->in_abs(lu, pcsv, pcsv); - lu->matrix(lu, pcsv, pcsv); - lu->input(lu, pcsv, pcsv); - lu->clut(lu, out_vals, pcsv); - if (rx->ocombine) { - lu->output(lu, out_vals, out_vals); - /* Since not PCS, out_abs is never used */ - } - break; - } - - default: - error("Unexpected algorithm type in clut lookup"); - } - } else { - icmLuLut *lu = (icmLuLut *)rx->dev.luo; /* Safe to coerce */ - - if (rx->icombine && rx->ocombine) { - lu->lookup((icmLuBase *)lu, out_vals, in_vals); /* Do everything here */ - } else { - lu->clut(lu, out_vals, in_vals); - } - } -} - -/* Output curve function */ -double output_curve( -void *cntx, -int ch, -double in_val -) { - sucntx *rx = (sucntx *)cntx; - int i; - double vals[MAX_CHAN]; - - if (rx->ocombine) - return in_val; - - if (rx->link) { - for (i = 0; i < rx->od; i++) - vals[i] = 0.0; - vals[ch] = in_val; - - switch(rx->out.alg) { - case icmMonoBwdType: { - icmLuMono *lu = (icmLuMono *)rx->out.luo; /* Safe to coerce */ - lu->bwd_curve(lu, vals, vals); - break; - } - case icmMatrixBwdType: { - icmLuMatrix *lu = (icmLuMatrix *)rx->out.luo; /* Safe to coerce */ - lu->bwd_curve(lu, vals, vals); - break; - } - case icmLutType: { - icmLuLut *lu = (icmLuLut *)rx->out.luo; /* Safe to coerce */ - lu->output(lu, vals, vals); - /* Since not PCS, out_abs is never used */ - break; - } - default: - error("Unexpected algorithm type in devop_devo()"); - } - - } else { - icmLuLut *lu = (icmLuLut *)rx->dev.luo; /* Safe to coerce */ - - for (i = 0; i < rx->od; i++) - vals[i] = 0.0; - vals[ch] = in_val; - - /* Since output not PCS, out_abs cannot be valid, */ - lu->output(lu, vals, vals); - - } - return vals[ch]; -} - -int -main(int argc, char *argv[]) { - int fa,nfa; /* argument we're looking at */ - char in_name[100]; /* Raster file name */ - char out_name[100]; /* Raster file name */ - int slow = 0; - int check = 0; - int i, rv = 0; - - TIFF *rh = NULL, *wh = NULL; - int x, y, width, height; /* Size of image */ - uint16 samplesperpixel, bitspersample; - int no_pmtc; /* Number of input photometrics */ - uint16 photometric, pmtc[10]; /* Photometrics of input file, and input profile */ - uint16 pconfig; /* Planar configuration */ - uint16 resunits; - float resx, resy; - tdata_t *inbuf, *outbuf, *checkbuf; - - /* IMDI */ - imdi *s = NULL; - sucntx su; /* Setup context */ - unsigned char *inp[MAX_CHAN]; - unsigned char *outp[MAX_CHAN]; - int clutres = 33; - - /* Error check */ - int mxerr = 0; - double avgerr = 0.0; - double avgcount = 0.0; - - if (argc < 2) - usage(); - - su.verb = 0; - su.icombine = 0; - su.ocombine = 0; - su.link = 0; - su.in.intent = icmDefaultIntent; - su.out.intent = icmDefaultIntent; - - /* Process the arguments */ - for(fa = 1;fa < argc;fa++) { - nfa = fa; /* skip to nfa if next argument is used */ - if (argv[fa][0] == '-') { /* Look for any flags */ - char *na = NULL; /* next argument after flag, null if none */ - - if (argv[fa][2] != '\000') - na = &argv[fa][2]; /* next is directly after flag */ - else { - if ((fa+1) < argc) { - if (argv[fa+1][0] != '-') { - nfa = fa + 1; - na = argv[nfa]; /* next is seperate non-flag argument */ - } - } - } - - if (argv[fa][1] == '?') - usage(); - - /* Slow, Precise */ - else if (argv[fa][1] == 'p' || argv[fa][1] == 'P') { - slow = 1; - } - - /* Combine per channel curves */ - else if (argv[fa][1] == 'c' || argv[fa][1] == 'C') { - su.icombine = 1; - su.ocombine = 1; - } - - /* Check curves */ - else if (argv[fa][1] == 'k' || argv[fa][1] == 'K') { - check = 1; - } - - /* Link profiles */ - else if (argv[fa][1] == 'l' || argv[fa][1] == 'L') { - su.link = 1; - } - - /* Input profile Intent */ - else if (argv[fa][1] == 'i' || argv[fa][1] == 'I') { - fa = nfa; - if (na == NULL) usage(); - switch (na[0]) { - case 'p': - case 'P': - su.in.intent = icPerceptual; - break; - case 'r': - case 'R': - su.in.intent = icRelativeColorimetric; - break; - case 's': - case 'S': - su.in.intent = icSaturation; - break; - case 'a': - case 'A': - su.in.intent = icAbsoluteColorimetric; - break; - default: - usage(); - } - } - - /* Output profile Intent */ - else if (argv[fa][1] == 'o' || argv[fa][1] == 'O') { - fa = nfa; - if (na == NULL) usage(); - switch (na[0]) { - case 'p': - case 'P': - su.out.intent = icPerceptual; - break; - case 'r': - case 'R': - su.out.intent = icRelativeColorimetric; - break; - case 's': - case 'S': - su.out.intent = icSaturation; - break; - case 'a': - case 'A': - su.out.intent = icAbsoluteColorimetric; - break; - default: - usage(); - } - } - - /* Verbosity */ - else if (argv[fa][1] == 'v' || argv[fa][1] == 'V') { - su.verb = 1; - } - - else - usage(); - } else - break; - } - - if (su.link) { - if (fa >= argc || argv[fa][0] == '-') usage(); - strcpy(su.in.name,argv[fa++]); - - if (fa >= argc || argv[fa][0] == '-') usage(); - strcpy(su.out.name,argv[fa++]); - } else { - if (fa >= argc || argv[fa][0] == '-') usage(); - strcpy(su.dev.name,argv[fa++]); - } - - if (fa >= argc || argv[fa][0] == '-') usage(); - strcpy(in_name,argv[fa++]); - - if (fa >= argc || argv[fa][0] == '-') usage(); - strcpy(out_name,argv[fa++]); - - /* - - - - - - - - - - - - - - - - */ - - if (su.link) { - icColorSpaceSignature natpcs; - - /* Open up the input device profile for reading */ - if ((su.in.fp = new_icmFileStd_name(su.in.name,"r")) == NULL) - error ("Can't open file '%s'",su.in.name); - - if ((su.in.c = new_icc()) == NULL) - error ("Creation of Input profile ICC object failed"); - - /* Read header etc. */ - if ((rv = su.in.c->read(su.in.c,su.in.fp,0)) != 0) - error ("%d, %s on file '%s'",rv,su.in.c->err,su.in.name); - su.in.h = su.in.c->header; - - /* Check that it is a suitable device input icc */ - if (su.in.h->deviceClass != icSigInputClass - && su.in.h->deviceClass != icSigDisplayClass - && su.in.h->deviceClass != icSigOutputClass - && su.in.h->deviceClass != icSigColorSpaceClass) /* For sRGB etc. */ - error("Input profile isn't a device profile"); - - /* Get a conversion object */ - if ((su.in.luo = su.in.c->get_luobj(su.in.c, icmFwd, su.in.intent, - icSigLabData, icmLuOrdNorm)) == NULL) - error ("%d, %s for profile '%s'",su.in.c->errc, su.in.c->err, su.in.name); - - /* Get details of conversion (Arguments may be NULL if info not needed) */ - su.in.luo->spaces(su.in.luo, &su.ins, &su.id, NULL, NULL, &su.in.alg, NULL, NULL, NULL); - - /* Get native PCS space */ - su.in.luo->lutspaces(su.in.luo, NULL, NULL, NULL, NULL, &natpcs); - - if (natpcs == icSigXYZData) { - su.icombine = 1; /* XYZ is to non-linear to be a benefit */ - } - - /* Open up the output device profile for reading */ - if ((su.out.fp = new_icmFileStd_name(su.out.name,"r")) == NULL) - error ("Can't open file '%s'",su.out.name); - - if ((su.out.c = new_icc()) == NULL) - error ("Creation of Output profile ICC object failed"); - - /* Read header etc. */ - if ((rv = su.out.c->read(su.out.c,su.out.fp,0)) != 0) - error ("%d, %s on file '%s'",rv,su.out.c->err,su.out.name); - su.out.h = su.out.c->header; - - /* Check that it is a suitable device output icc */ - if (su.out.h->deviceClass != icSigInputClass - && su.out.h->deviceClass != icSigDisplayClass - && su.out.h->deviceClass != icSigOutputClass - && su.out.h->deviceClass != icSigColorSpaceClass) /* For sRGB etc. */ - error("Output profile isn't a device profile"); - - /* Get a conversion object */ - if ((su.out.luo = su.out.c->get_luobj(su.out.c, icmBwd, su.out.intent, - icSigLabData, icmLuOrdNorm)) == NULL) - error ("%d, %s for profile '%s'",su.out.c->errc, su.out.c->err, su.out.name); - - /* Get details of conversion (Arguments may be NULL if info not needed) */ - su.out.luo->spaces(su.out.luo, NULL, NULL, &su.outs, &su.od, &su.out.alg, NULL, NULL, NULL); - - /* Get native PCS space */ - su.out.luo->lutspaces(su.out.luo, NULL, NULL, NULL, NULL, &natpcs); - - if (natpcs == icSigXYZData) { - su.ocombine = 1; /* XYZ is to non-linear to be a benefit */ - } - - /* See discussion in imdi/imdi_gen.c for ideal numbers */ - /* Use "high quality" resolution numbers */ - switch (su.id) { - case 0: - error ("Illegal number of input chanels"); - case 1: - clutres = 256; - break; - case 2: - clutres = 256; - break; - case 3: - clutres = 33; - break; - case 4: - clutres = 18; - break; - case 5: - clutres = 16; - break; - case 6: - clutres = 9; - break; - case 7: - clutres = 7; - break; - case 8: - clutres = 6; - break; - deault: /* > 8 chan */ - clutres = 3; - break; - } - - } else { - icmLut *lut; /* ICC LUT table */ - icmLuLut *luluo; /* LUT lookup object */ - - /* Open up the device link profile for reading */ - if ((su.dev.fp = new_icmFileStd_name(su.dev.name,"r")) == NULL) - error ("Can't open file '%s'",su.dev.name); - - if ((su.dev.c = new_icc()) == NULL) - error ("Creation of ICC object failed"); - - if ((rv = su.dev.c->read(su.dev.c, su.dev.fp, 0)) != 0) - error ("%d, %s",rv,su.dev.c->err); - su.dev.h = su.dev.c->header; - - if (su.verb) { - icmFile *op; - if ((op = new_icmFileStd_fp(stdout)) == NULL) - error ("Can't open stdout"); - su.dev.h->dump(su.dev.h, op, 1); - op->del(op); - } - - /* Check that the profile is appropriate */ - if (su.dev.h->deviceClass != icSigLinkClass) - error("Profile isn't a device link profile"); - - /* Get a conversion object */ - if ((su.dev.luo = su.dev.c->get_luobj(su.dev.c, icmFwd, icmDefaultIntent, - icmSigDefaultData, icmLuOrdNorm)) == NULL) - error ("%d, %s",su.dev.c->errc, su.dev.c->err); - - /* Get details of conversion (Arguments may be NULL if info not needed) */ - su.dev.luo->spaces(su.dev.luo, &su.ins, &su.id, &su.outs, &su.od, &su.dev.alg, NULL, NULL, NULL); - - if (su.dev.alg != icmLutType) - error ("DeviceLink profile doesn't have Lut !"); - - luluo = (icmLuLut *)su.dev.luo; /* Safe to coerce */ - luluo->get_info(luluo, &lut, NULL, NULL, NULL); /* Get some details */ - clutres = lut->clutPoints; /* Desired table resolution */ - } - - /* - - - - - - - - - - - - - - - */ - /* Open up input tiff file ready for reading */ - /* Got arguments, so setup to process the file */ - if ((rh = TIFFOpen(in_name, "r")) == NULL) - error("error opening read file '%s'",in_name); - - TIFFGetField(rh, TIFFTAG_IMAGEWIDTH, &width); - TIFFGetField(rh, TIFFTAG_IMAGELENGTH, &height); - - TIFFGetField(rh, TIFFTAG_BITSPERSAMPLE, &bitspersample); - if (bitspersample != 8 && bitspersample != 16) { - error("TIFF Input file must be 8 or 16 bit/channel"); - } - - TIFFGetField(rh, TIFFTAG_PHOTOMETRIC, &photometric); - if ((no_pmtc = ColorSpaceSignature2TiffPhotometric(pmtc, su.ins)) == 0) - error("ICC input colorspace '%s' can't be handled by a TIFF file!", - icm2str(icmColorSpaceSignature, su.ins)); - for (i = 0; i < no_pmtc; i++) { - if (pmtc[i] == photometric) - break; /* Matches */ - } - if (i >= no_pmtc) { - switch (no_pmtc) { - case 1: - error("ICC input colorspace '%s' doesn't match TIFF photometric '%s'!", - icm2str(icmColorSpaceSignature, su.ins), Photometric2str(pmtc[0])); - case 2: - error("ICC input colorspace '%s' doesn't match TIFF photometric '%s' or '%s'!", - icm2str(icmColorSpaceSignature, su.ins), Photometric2str(pmtc[0]), - Photometric2str(pmtc[1])); - default: - error("ICC input colorspace '%s' doesn't match TIFF photometric '%s', '%s' or '%s'!", - icm2str(icmColorSpaceSignature, su.ins), Photometric2str(pmtc[0]), - Photometric2str(pmtc[1]), Photometric2str(pmtc[2])); - } - } - - TIFFGetField(rh, TIFFTAG_SAMPLESPERPIXEL, &samplesperpixel); - if (su.id != samplesperpixel) - error ("TIFF Input file has %d input channels mismatched to colorspace '%s'", - samplesperpixel, icm2str(icmColorSpaceSignature, su.ins)); - - TIFFGetField(rh, TIFFTAG_PLANARCONFIG, &pconfig); - if (pconfig != PLANARCONFIG_CONTIG) - error ("TIFF Input file must be planar"); - - TIFFGetField(rh, TIFFTAG_RESOLUTIONUNIT, &resunits); - TIFFGetField(rh, TIFFTAG_XRESOLUTION, &resx); - TIFFGetField(rh, TIFFTAG_YRESOLUTION, &resy); - - /* - - - - - - - - - - - - - - - */ - if ((wh = TIFFOpen(out_name, "w")) == NULL) - error("Can\'t create TIFF file '%s'!",out_name); - - TIFFSetField(wh, TIFFTAG_IMAGEWIDTH, width); - TIFFSetField(wh, TIFFTAG_IMAGELENGTH, height); - TIFFSetField(wh, TIFFTAG_ORIENTATION, ORIENTATION_TOPLEFT); - TIFFSetField(wh, TIFFTAG_SAMPLESPERPIXEL, su.od); - TIFFSetField(wh, TIFFTAG_BITSPERSAMPLE, bitspersample); - TIFFSetField(wh, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG); - if ((no_pmtc = ColorSpaceSignature2TiffPhotometric(pmtc, su.outs)) == 0) - error("TIFF file can't handle output colorspace '%s'!", - icm2str(icmColorSpaceSignature, su.outs)); - TIFFSetField(wh, TIFFTAG_PHOTOMETRIC, pmtc[0]); /* Use first returned */ - if (pmtc[0] == PHOTOMETRIC_SEPARATED) { - int iset; - int inlen; - char *inames; - iset = ColorSpaceSignature2TiffInkset(su.outs, &inlen, &inames); - if (iset != 0xffff && inlen > 0 && inames != NULL) { - TIFFSetField(wh, TIFFTAG_INKSET, iset); - if (inames != NULL) { - TIFFSetField(wh, TIFFTAG_INKNAMES, inlen, inames); - } - } - } - TIFFSetField(wh, TIFFTAG_COMPRESSION, COMPRESSION_NONE); - if (resunits) { - TIFFSetField(wh, TIFFTAG_RESOLUTIONUNIT, resunits); - TIFFSetField(wh, TIFFTAG_XRESOLUTION, resx); - TIFFSetField(wh, TIFFTAG_YRESOLUTION, resy); - } - TIFFSetField(wh, TIFFTAG_IMAGEDESCRIPTION, "Color corrected by Argyll"); - - /* - - - - - - - - - - - - - - - */ - /* Setup the imdi */ - - if (!slow) { - s = new_imdi( - su.id, /* Number of input dimensions */ - su.od, /* Number of output dimensions */ - /* Input pixel representation */ - bitspersample == 8 ? pixint8 : pixint16, - /* Output pixel representation */ - 0x0, /* Treat every channel as unsigned */ - bitspersample == 8 ? pixint8 : pixint16, - 0x0, /* Treat every channel as unsigned */ - clutres, /* Desired table resolution */ - input_curve, /* Callback functions */ - md_table, - output_curve, - (void *)&su /* Context to callbacks */ - ); - - if (s == NULL) - error("new_imdi failed"); - } - - /* - - - - - - - - - - - - - - - */ - /* Process colors to translate */ - /* (Should fix this to process a group of lines at a time ?) */ - - inbuf = _TIFFmalloc(TIFFScanlineSize(rh)); - outbuf = _TIFFmalloc(TIFFScanlineSize(wh)); - if (check) - checkbuf = _TIFFmalloc(TIFFScanlineSize(wh)); - - inp[0] = (unsigned char *)inbuf; - outp[0] = (unsigned char *)outbuf; - - if (!slow) { /* Fast */ - for (y = 0; y < height; y++) { - - /* Read in the next line */ - if (TIFFReadScanline(rh, inbuf, y, 0) < 0) - error ("Failed to read TIFF line %d",y); - - /* Do fast conversion */ - s->interp(s, (void **)outp, (void **)inp, width); - - if (check) { - /* Do floating point conversion */ - for (x = 0; x < width; x++) { - int i; - double in[MAX_CHAN], out[MAX_CHAN]; - - if (bitspersample == 8) - for (i = 0; i < su.id; i++) - in[i] = ((unsigned char *)inbuf)[x * su.id + i]/255.0; - else - for (i = 0; i < su.id; i++) - in[i] = ((unsigned short *)inbuf)[x * su.id + i]/65535.0; - - if (su.link) { - if ((rv = su.in.luo->lookup(su.in.luo, out, in)) > 1) - error ("%d, %s",su.dev.c->errc,su.dev.c->err); - if ((rv = su.out.luo->lookup(su.out.luo, out, out)) > 1) - error ("%d, %s",su.dev.c->errc,su.dev.c->err); - } else { - if ((rv = su.dev.luo->lookup(su.dev.luo, out, in)) > 1) - error ("%d, %s",su.dev.c->errc,su.dev.c->err); - } - - if (bitspersample == 8) - for (i = 0; i < su.od; i++) - ((unsigned char *)checkbuf)[x * su.od + i] = (int)(out[i] * 255.0 + 0.5); - else - for (i = 0; i < su.od; i++) - ((unsigned short *)checkbuf)[x * su.od + i] = (int)(out[i] * 65535.0 + 0.5); - } - /* Compute the errors */ - for (x = 0; x < (width * su.od); x++) { - int err; - if (bitspersample == 8) - err = ((unsigned char *)outbuf)[x] - ((unsigned char *)checkbuf)[x]; - else - err = ((unsigned short *)outbuf)[x] - ((unsigned short *)checkbuf)[x]; - if (err < 0) - err = -err; - if (err > mxerr) - mxerr = err; - avgerr += (double)err; - avgcount++; - } - } - - if (TIFFWriteScanline(wh, outbuf, y, 0) < 0) - error ("Failed to write TIFF line %d",y); - - } - - } else { /* Slow but precise */ - if (bitspersample == 8) { - for (y = 0; y < height; y++) { - - /* Read in the next line */ - if (TIFFReadScanline(rh, inbuf, y, 0) < 0) - error ("Failed to read TIFF line %d",y); - - /* Do floating point conversion */ - for (x = 0; x < width; x++) { - int i; - double in[MAX_CHAN], out[MAX_CHAN]; - - for (i = 0; i < su.id; i++) { - in[i] = ((unsigned char *)inbuf)[x * su.id + i]/255.0; - } - - if (su.link) { - if ((rv = su.in.luo->lookup(su.in.luo, out, in)) > 1) - error ("%d, %s",su.dev.c->errc,su.dev.c->err); - if ((rv = su.out.luo->lookup(su.out.luo, out, out)) > 1) - error ("%d, %s",su.dev.c->errc,su.dev.c->err); - } else { - if ((rv = su.dev.luo->lookup(su.dev.luo, out, in)) > 1) - error ("%d, %s",su.dev.c->errc,su.dev.c->err); - } - - for (i = 0; i < su.od; i++) { - double outi = out[i]; - if (outi < 0.0) /* Protect against sillies */ - outi = 0.0; - else if (outi > 1.0) - outi = 1.0; - ((unsigned char *)outbuf)[x * su.od + i] = (int)(outi * 255.0 + 0.5); - } - } - if (TIFFWriteScanline(wh, outbuf, y, 0) < 0) - error ("Failed to write TIFF line %d",y); - } - } else if (bitspersample == 16) { - for (y = 0; y < height; y++) { - - /* Read in the next line */ - if (TIFFReadScanline(rh, inbuf, y, 0) < 0) - error ("Failed to read TIFF line %d",y); - - /* Do floating point conversion */ - for (x = 0; x < width; x++) { - int i; - double in[MAX_CHAN], out[MAX_CHAN]; - - for (i = 0; i < su.id; i++) { - in[i] = ((unsigned short *)inbuf)[x * su.id + i]/65535.0; - } - - if (su.link) { - if ((rv = su.in.luo->lookup(su.in.luo, out, in)) > 1) - error ("%d, %s",su.dev.c->errc,su.dev.c->err); - if ((rv = su.out.luo->lookup(su.out.luo, out, out)) > 1) - error ("%d, %s",su.dev.c->errc,su.dev.c->err); - } else { - if ((rv = su.dev.luo->lookup(su.dev.luo, out, in)) > 1) - error ("%d, %s",su.dev.c->errc,su.dev.c->err); - } - - for (i = 0; i < su.od; i++) { - double outi = out[i]; - if (outi < 0.0) /* Protect against sillies */ - outi = 0.0; - else if (outi > 1.0) - outi = 1.0; - ((unsigned short *)outbuf)[x * su.od + i] = (int)(outi * 65535.0 + 0.5); - } - } - if (TIFFWriteScanline(wh, outbuf, y, 0) < 0) - error ("Failed to write TIFF line %d",y); - } - } - } - - if (check) { - printf("Worst error = %d bits, average error = %f bits\n", mxerr, avgerr/avgcount); - if (bitspersample == 8) - printf("Worst error = %f%%, average error = %f%%\n", - mxerr/2.55, avgerr/(2.55 * avgcount)); - else - printf("Worst error = %f%%, average error = %f%%\n", - mxerr/655.35, avgerr/(655.35 * avgcount)); - } - - /* Done with lookup object */ - if (s != NULL) - s->done(s); - - if (su.link) { - su.in.luo->del(su.in.luo); - su.in.c->del(su.in.c); - su.in.fp->del(su.in.fp); - su.out.luo->del(su.out.luo); - su.out.c->del(su.out.c); - su.out.fp->del(su.out.fp); - } else { - su.dev.luo->del(su.dev.luo); - su.dev.c->del(su.dev.c); - su.dev.fp->del(su.dev.fp); - } - - _TIFFfree(inbuf); - _TIFFfree(outbuf); - if (check) - _TIFFfree(checkbuf); - - TIFFClose(rh); /* Close Input file */ - TIFFClose(wh); /* Close Output file */ - - return 0; -} - -/* Basic printf type error() and warning() routines */ - -void -error(char *fmt, ...) -{ - va_list args; - - fprintf(stderr,"cctiff: Error - "); - va_start(args, fmt); - vfprintf(stderr, fmt, args); - va_end(args); - fprintf(stderr, "\n"); - exit (-1); -} - -void -warning(char *fmt, ...) -{ - va_list args; - - fprintf(stderr,"cctiff: Warning - "); - va_start(args, fmt); - vfprintf(stderr, fmt, args); - va_end(args); - fprintf(stderr, "\n"); -} diff --git a/gs/imdi/cgen.c b/gs/imdi/cgen.c deleted file mode 100644 index cb1bf0732..000000000 --- a/gs/imdi/cgen.c +++ /dev/null @@ -1,1848 +0,0 @@ -/* Integer Multi-Dimensional Interpolation */ - -/* - * Copyright 2000 - 2002 Graeme W. Gill - * All rights reserved. - * - * This material is licenced under the GNU GENERAL PUBLIC LICENCE :- - * see the Licence.txt file for licencing details. - */ - -/* 'C' code color transform kernel code generator. */ - -/* - This module generates C code routines which implement - an integer multi-channel transform. The input values - are read, passed through per channel lookup tables, - a multi-dimentional interpolation table, and then - a per channel output lookup table, before being written. -*/ - -#include <stdio.h> -#include <stdlib.h> -#include <math.h> -#include <stdarg.h> -#include <string.h> - -#include "imdi_imp.h" -#include "imdi_gen.h" -#include "imdi_tab.h" - -#undef VERBOSE -#undef FORCESORT /* Use sort algorithm allways */ - -/* - * TTBD: - * Need to implement g->dir - * Haven't used t->it_map[] or t->im_map[]. - * - * - */ - -/* ------------------------------------ */ -/* Context */ -typedef struct { - FILE *of; /* Output file */ - int indt; /* Indent */ - - /* Other info */ - genspec *g; /* Generation specifications */ - tabspec *t; /* Table setup data */ - mach_arch *a; /* Machine architecture and tuning data */ - - /* Code generation information */ - /* if() conditions are for entry usage */ - - /* Pixel read information */ - int ipt[IXDI]; /* Input pointer types */ - int nip; /* Actual number of input pointers, accounting for pint */ - int chv_bits; /* Bits in chv temp variable ?? */ - - /* Input table entry */ - int itet; /* Input table entry type */ - int itvt; /* Input table variable type */ - int itmnb; /* Input table minimum bits (actual is it_ab) */ - - /* Interpolation index */ - int ixet; /* Interpolation index entry type */ - int ixvt; /* Interpolation index variable type */ - int ixmnb; /* Interpolation index minimum bits (actual is ix_ab) */ - int ixmxres; /* Interpolation table maximum resolution */ - - /* Simplex index: if(!sort && it_xs) */ - int sxet; /* Simplex index entry type */ - int sxvt; /* Simplex index variable type */ - int sxmnb; /* Simplex index bits minimum (actual is sx_ab) */ - int sxmxres; /* Simplex table maximum resolution (0 if sort) */ - - /* Combination Weighting + Vertex offset values: if(it_xs && !wo_xs) */ - int woet; /* Weighting+offset entry type */ - int wovt; /* Weighting+offset variable type */ - int womnb; /* Weighting+offset index bits minimum (actual is wo_ab) */ - - /* Weighting value: if(it_xs && wo_xs) */ - int weet; /* Weighting entry type */ - int wevt; /* Weighting variable type */ - int wemnb; /* Weighting index bits minimum (actual is we_ab) */ - - /* Vertex offset value: if(it_xs && wo_xs) */ - int voet; /* Vertex offset entry type */ - int vovt; /* Vertex offset variable type */ - int vomnb; /* Vertex offset index bits minimum (actual is vo_ab) */ - - /* Interpolation table entry: */ - int imovb; /* Interpolation output value bits per channel required */ - int imfvt; /* Interpolation full entry & variable type */ - int impvt; /* Interpolation partial entry variable type */ - - /* Interpolation accumulators: */ - int iaovb; /* Interpolation output value bits per channel required */ - int iafvt; /* Interpolation full entry & variable type */ - int iapvt; /* Interpolation partial entry variable type */ - int ian; /* Total number of accumulators */ - - /* Output table lookup */ - int otit; /* Output table index type */ - int otvt; /* Output table value type (size is ot_ts bytes) */ - - /* Write information */ - int opt[IXDO]; /* Output pointer types */ - int nop; /* Actual number of output pointers, accounting for pint */ - -} fileo; - -void line(fileo *f, char *fmt, ...); /* Output one line */ -void sline(fileo *f, char *fmt, ...); /* Output start of line line */ -void mline(fileo *f, char *fmt, ...); /* Output middle of line */ -void eline(fileo *f, char *fmt, ...); /* Output end of line */ -void cr(fileo *f) { line(f,""); } /* Output a blank line */ -void inc(fileo *f) { f->indt++; } /* Increment the indent level */ -void dec(fileo *f) { f->indt--; } /* Decrement the indent level */ -/* ------------------------------------ */ - -int findord(fileo *f, int bits); /* Find ordinal with bits or more */ -int nord(fileo *f, int ov); /* Round ordinal type up to natural size */ -int findnord(fileo *f, int bits); /* Find ordinal with bits, or natural larger */ -int findint(fileo *f, int bits); /* Find integer with bits or more */ -int nint(fileo *f, int iv); /* Round integer type up to natural size */ -int findnint(fileo *f, int bits); /* Find integer with bits, or natural larger */ -static void doheader(fileo *f); - -static int calc_bits(int dim, int res); -static int calc_res(int dim, int bits); -static int calc_obits(int dim, int res, int esize); -static int calc_ores(int dim, int bits, int esize); - -/* return a hexadecimal mask string */ -/* take care of the case when bits >= 32 */ -char *hmask(int bits) { - static char buf[20]; - - if (bits < 32) { - sprintf(buf, "0x%x",(1 << bits)-1); - } else if (bits == 32) { - return "0xffffffff"; - } else if (bits == 64) { - return "0xffffffffffffffff"; - } else { /* Bits > 32 */ - sprintf(buf, "0x%xffffffff",(1 << (bits-32))-1); - } - return buf; -} - -/* Generate a source file to implement the specified */ -/* interpolation kernel. Fill in return values and return 0 if OK. */ -/* Return non-zero on error. */ -int gen_c_kernel( - genspec *g, /* Specification of what to generate */ - mach_arch *a, - FILE *fp, /* File to write to */ - int index /* Identification index, 1 = first */ -) { - unsigned char kk[] = { 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 }; - fileo f[1]; - int e, i; - tabspec tabsp, *t = &tabsp; - int timp = 0; /* Flag to use temporary imp pointer. */ - /* Seem to make x86 MSVC++ slower */ - /* Has no effect on x86 IBMCC */ - - sprintf(g->kname, "imdi_k%d",index); /* Kernel routine base name */ - strcpy(g->kkeys, kk); /* Kernel keys for this session */ - - /* Setup the file output context */ - f->of = fp; - f->indt = 0; /* Start with no indentation */ - f->g = g; - f->t = t; - f->a = a; - - if (g->prec == 8) { - if (g->id <= 4) - t->sort = 0; /* Implicit sort using simplex table lookup */ - else - t->sort = 1; /* Explicit sort */ - - } else if (g->prec == 16) { - t->sort = 1; /* Explit sort, no simplex table */ - - } else { - fprintf(stderr,"Can't cope with requested precision of %d bits\n",g->prec); - exit(-1); - } -#ifdef FORCESORT - t->sort = 1; -#endif - - /* Compute input read and input table lookup stuff */ - - /* Compute number of input pointers */ - if (g->in.pint != 0) /* Pixel interleaved */ - f->nip = 1; - else - f->nip = g->id; - - /* Figure out the input pointer types */ - for (e = 0; e < f->nip; e++) { - if ((f->ipt[e] = findord(f, g->in.bpch[e])) < 0) { - fprintf(stderr,"Input channel size can't be handled\n"); - exit(-1); - } - } - - /* Set a default input channel mapping */ - for (e = 0; e < g->id; e++) - t->it_map[e] = e; - - /* Do the rest of the input table size calculations after figuring */ - /* out simplex and interpolation table sizes. */ - - /* Figure out the interpolation multi-dimentional table structure */ - /* and output accumulation variable sizes. */ - - if (g->prec == 8 - || g->prec == 16 && a->ords[a->nords-1].bits >= (g->prec * 4)) { - int tiby; /* Total interpolation bytes needed */ - - /* We assume that we can normally compute more than one */ - /* output value at a time, so we need to hold the interpolation */ - /* output data in the expanded fixed point format in both the */ - /* table and accumulator. */ - t->im_cd = 1; - f->imovb = g->prec * 2; /* 16 bits needed for 8 bit precision, */ - f->iaovb = g->prec * 2; /* 32 bits needed for 16 bit precision */ - f->imfvt = a->nords-1; /* Full variable entry type is biggest available */ - f->iafvt = a->nords-1; /* Full variable accum. type is same */ - - if (a->ords[f->imfvt].bits < f->imovb) { - fprintf(stderr,"Interpolation table entry size can't be handled\n"); - exit(-1); - } - - /* Compute details of table entry sizes, number */ - tiby = (f->imovb * g->od)/8; /* Total table bytes needed */ - t->im_fs = a->ords[f->imfvt].bits/8; /* Full entry bytes */ - t->im_fv = (t->im_fs * 8)/f->imovb; /* output values per full entry . */ - t->im_fn = tiby/t->im_fs; /* Number of full entries (may be 0) */ - t->im_ts = t->im_fn * t->im_fs; /* Structure size so far */ - tiby -= t->im_fn * t->im_fs; /* Remaining bytes */ - - if (tiby <= 0) { - t->im_pn = 0; /* No partials */ - t->im_ps = 0; - t->im_pv = 0; - f->impvt = 0; - f->iapvt = 0; - - } else { - t->im_pn = 1; /* Must be just 1 partial */ - t->im_pv = (tiby * 8)/f->imovb; /* Partial holds remaining entries */ - - if ((f->impvt = findnord(f, tiby * 8)) < 0) { - fprintf(stderr,"Can't find partial interp table entry variable size\n"); - exit(-1); - } - f->iapvt = f->impvt; - t->im_ps = a->ords[f->impvt].bits/8;/* Partial entry bytes */ - - if (a->ords[f->imfvt].align) /* If full entry's need to be aligned */ - t->im_ts += t->im_fs; /* Round out struct size by full entry */ - else - t->im_ts += t->im_ps; /* Round out to natural size */ - } - - } else { - /* One 16 bit output value per entry + 32 bit accumulator. */ - /* We can conserve table space by not holding the table data in expanded */ - /* fixed point format, but expanding it when it is read. */ - /* Without resorting to compicated code, this restricts us */ - /* to only computing one output value per accumulator. */ - t->im_cd = 0; - f->imovb = g->prec; /* Table holds 16 bit entries with no fractions */ - f->iaovb = g->prec * 2; /* 32 bits needed for 16 bit precision in comp. */ - - if ((f->imfvt = findord(f, f->imovb)) < 0) { - fprintf(stderr,"Interpolation table entry size can't be handled\n"); - exit(-1); - } - if ((f->iafvt = findord(f, f->iaovb)) < 0) { - fprintf(stderr,"Interpolation accumulator size can't be handled\n"); - exit(-1); - } - - /* Compute details of table entry sizes, number */ - t->im_fs = a->ords[f->imfvt].bits/8; /* Full entry bytes */ - t->im_fv = 1; /* output values per full entry . */ - t->im_fn = g->od; /* Number of full entries */ - t->im_ts = t->im_fn * t->im_fs; /* Total structure size */ - - t->im_pn = 0; /* No partials */ - t->im_ps = 0; - t->im_pv = 0; - f->impvt = 0; - f->iapvt = 0; - } - f->ian = t->im_fn + t->im_pn; /* Total number of output accumulators */ - - /* Figure out how much of the interpolation entry offset to put in the */ - /* vertex offset value, and how much to make explicit in accessing the */ - /* interpolation table enty. */ - if (a->oscale > 0) { /* We have a scaled index mode */ - /* Use as much of the scaled index mode as possible */ - /* and then do the balance by scaling the simplex index entry. */ - for (t->im_oc = a->oscale; ; t->im_oc >>= 1) { - t->vo_om = t->im_ts/t->im_oc; /* Simplex index multiplier */ - if ((t->vo_om * t->im_oc) == t->im_ts) - break; /* Got appropriate offset scale */ - } - } else if (a->smmul) { /* Architecure supports fast small multiply */ - t->im_oc = t->im_ts; /* Do scale by structure size explicitly */ - t->vo_om = 1; /* Do none in the Simplex index */ - } else { /* We have no fast tricks */ - t->im_oc = 1; /* Do none explicitly */ - t->vo_om = t->im_ts; /* Do all in Simplex index */ - } - - /* Compute the number of bits needed to hold an index into */ - /* the interpolation table (index is in terms of table entry size). */ - /* This value is used to figure out the room needed in the input */ - /* table to accumulate the interpolation cube base offset value. (IM_O macro) */ - f->ixmnb = calc_bits(g->id, g->itres); - - /* Set a default output channel mapping */ - for (e = 0; e < g->od; e++) - t->im_map[e] = e; - -#ifdef VERBOSE - /* Summarise the interpolation table arrangements */ - printf("\n"); - printf("Interpolation table structure:\n"); - printf(" Minimum bits needed to index table %d\n", f->ixmnb); - printf(" Entry total size %d bytes\n", t->im_ts); - printf(" Simplex entry offset scale %d\n", t->vo_om); - printf(" Explicit entry offset scale %d\n", t->im_oc); - printf(" %d full entries, size %d bytes\n", t->im_fn, t->im_fs); - printf(" %d partial entries, size %d bytes\n", t->im_pn, t->im_ps); - printf(" to hold %d output values of %d bits\n", g->od, f->imovb); - -#endif /* VERBOSE */ - - /* Number of bits needed for the weighting value */ - f->wemnb = g->prec+1; /* Need to hold a weighting factor of 0 - 256 for 8 bits */ - /* Need to hold a weighting factor of 0 - 65536 for 16 bits */ - - /* Variable that would be used to hold it */ - if ((f->wevt = findnord(f, f->wemnb)) < 0) { - fprintf(stderr,"Can't find entry size to hold weighting variable\n"); - exit(-1); - } - - /* Number of bits needed for vertex offset value */ - f->vomnb = calc_obits(g->id, g->itres, t->vo_om); - - /* Variable that would be used to hold it */ - if ((f->vovt = findnord(f, f->vomnb)) < 0) { - fprintf(stderr,"Can't find entry size to hold vertex offset variable\n"); - exit(-1); - } - - if (t->sort) { - /* If we are using an explicit sort, we need to figure how many */ - /* separate entries we need to use to hold the interpolation index, */ - /* weighting factor and vertex offset values in the input table. */ - - /* First try all three in one entry */ - if ((f->itet = findord(f, f->ixmnb + f->wemnb + f->vomnb)) >= 0) {/* size to read */ - int rem; /* Remainder bits */ - - t->it_xs = 0; /* Combined interp+weight+offset */ - t->wo_xs = 0; - t->it_ab = a->ords[f->itet].bits; /* Bits in combined input entry */ - rem = t->it_ab - f->ixmnb - f->wemnb - f->vomnb; /* Spair bits */ - t->we_ab = f->wemnb; /* Get minimum weight bits */ - t->vo_ab = f->vomnb + rem/2; /* vertex offset index bits actually available */ - t->ix_ab = t->it_ab - t->vo_ab - t->we_ab; /* interp index bits actually available */ - t->wo_ab = t->we_ab + t->vo_ab; /* Weight & offset total bits */ - t->it_ts = a->ords[f->itet].bits/8; /* total size in bytes */ - f->itvt = nord(f, f->itet); /* Variable type */ - - if ((f->wovt = findnord(f, t->we_ab + t->vo_ab)) < 0) { - fprintf(stderr,"Can't find variable size to hold weight/offset\n"); - exit(-1); - } - if ((f->wevt = findnord(f, t->we_ab)) < 0) { - fprintf(stderr,"Can't find variable size to hold weighting factor\n"); - exit(-1); - } - if ((f->vovt = findnord(f, t->vo_ab)) < 0) { - fprintf(stderr,"Can't find variable size to hold vertex offset index\n"); - exit(-1); - } - if ((f->ixvt = findnord(f, t->ix_ab)) < 0) { - fprintf(stderr,"Interp index variable size can't be handled\n"); - exit(-1); - } - } else { /* Interp index will be a separate entry */ - int wit, oft, bigt; /* weighting type, offset type, biggest type */ - int combt; /* Combined type */ - int sepbits, combits; /* Total separate, combined bits */ - - t->it_xs = 1; /* Separate interp index and weighting+offset */ - if ((f->ixet = findord(f, f->ixmnb)) < 0) { - fprintf(stderr,"Interp index entry size can't be handled\n"); - exit(-1); - } - f->ixvt = nord(f, f->ixet); /* Variable type */ - t->ix_ab = a->ords[f->ixet].bits; - t->ix_es = t->ix_ab/8; - t->ix_eo = 0; - t->it_ts = t->ix_es; /* Input table size so far */ - - /* Now figure weighting and vertex offset */ - - /* See if we can fit them into separately readable entries, or whether */ - /* they should be combined to minimise overall table size. */ - - if ((wit = findord(f, f->wemnb)) < 0) { - fprintf(stderr,"Can't find entry size to hold weighting factor\n"); - exit(-1); - } - if ((oft = findord(f, f->vomnb)) < 0) { - fprintf(stderr,"Can't find entry size to hold vertex offset index\n"); - exit(-1); - } - bigt = wit > oft ? wit : oft; /* Bigest separate type */ - - if ((combt = findord(f, f->wemnb + f->vomnb)) < 0) {/* Combined isn't possible */ - sepbits = 2 * a->ords[bigt].bits; /* Total separate bits */ - combits = sepbits; /* Force separate entries */ - } else { - sepbits = 2 * a->ords[bigt].bits; /* Total separate bits */ - combits = a->ords[combt].bits; /* Total combined bits */ - } - - if (sepbits <= combits) { /* We will use separate entries */ - t->wo_xs = 1; - t->we_es = a->ords[bigt].bits/8; /* size in bytes for weighting entry */ - t->we_ab = a->ords[bigt].bits; /* bits available for weighting */ - t->we_eo = t->ix_es; /* Entry offset in input table */ - t->vo_es = a->ords[bigt].bits/8; /* size in bytes for vertex offset entry */ - t->vo_ab = a->ords[bigt].bits; /* bits available for vertex offset */ - t->vo_eo = t->ix_es + t->we_es; /* Entry offset in input table */ - t->wo_es = t->we_es + t->vo_es; /* Total entry size for each vertex */ - t->it_ts += t->we_es + t->vo_es; /* Total input entry size in bytes */ - - f->weet = bigt; /* Variable type for accessing weighting entry */ - f->voet = bigt; /* Variable type for accessing vertex offset entry */ - f->wevt = nord(f, wit); /* Variable type for holding weight value */ - f->vovt = nord(f, oft); /* Variable type for holding offset value */ - - } else { /* We will combine the two entries */ - t->wo_xs = 0; - t->wo_es = a->ords[combt].bits/8; /* entry size in bytes for each entry */ - t->wo_ab = a->ords[combt].bits; /* bits in weightig + offset */ - t->we_ab = f->wemnb; /* bits available for weighting */ - t->vo_ab = t->wo_ab - t->we_ab; /* Allow all spare bits to vertex offset */ - t->wo_eo = t->ix_es; /* entry offset in input table */ - t->it_ts += t->wo_es; /* Final input table size */ - - f->woet = combt; /* Variable type for accessing combined entry */ - f->wovt = nord(f, combt); /* Variable type holding weight/offset read value */ - - if ((f->wevt = findnord(f, t->we_ab)) < 0) { - fprintf(stderr,"Can't find variable size to hold weighting factor\n"); - exit(-1); - } - if ((f->vovt = findnord(f, t->vo_ab)) < 0) { - fprintf(stderr,"Can't find variable size to hold vertex offset index\n"); - exit(-1); - } - } - } -#ifdef VERBOSE - /* Summarise the input table arrangements */ - printf("\n"); - printf("Input table structure:\n"); - printf(" Input value re-ordering is ["); - for (e = 0; e < g->id; e++) - printf("%s%d",e > 0 ? " " : "", t->it_map[e]); - printf("]\n"); - printf(" Input table entry size = %d bytes\n",t->it_ts); - if (t->it_ix) { - printf(" Input table extracts value from read values\n"); - if (t->wo_xs) { - printf(" Separate Interp., Weighting and Offset values\n"); - printf(" Interp. index is at offset %d, size %d bytes\n",t->ix_eo, t->ix_es); - printf(" Weighting is at offset %d, size %d bytes\n",t->we_eo, t->we_es); - printf(" Vertex offset is at offset %d, size %d bytes\n",t->vo_eo, t->vo_es); - } else { - printf(" Separate Interp. index and Weightint+Offset value\n"); - printf(" Interp. index is at offset %d, size %d bytes\n",t->ix_eo, t->ix_es); - printf(" Weighting+Offset is at offset %d, size %d bytes\n",t->wo_eo, t->wo_es); - printf(" Weighting = %d bits\n",t->we_ab); - printf(" Vertex offset = %d bits\n",t->vo_ab); - } - } else { - printf(" Combined InterpIndex+Weighting+Voffset values\n"); - printf(" Values are stored in size %d bytes\n",t->it_ts); - printf(" Interp. index = %d bits\n",t->ix_ab); - printf(" Weighting = %d bits\n",t->we_ab); - printf(" Vertex offset = %d bits\n",t->vo_ab); - } -#endif /* VERBOSE */ - - } else { /* Simplex table */ - /* If we are going to use a simplex table, figure out how we */ - /* will store the weighting value and vertex offset values in it, */ - /* as well as the size of index we'll need to address it. */ - int wit, oft, bigt; /* weighting type, offset type, biggest type */ - int combt; /* Combined type */ - int sepbits, combits; /* Total separate, combined bits */ - - /* See if we can fit them into separately readable entries, or whether */ - /* they should be combined to minimise overall table size. */ - - if ((wit = findord(f, f->wemnb)) < 0) { - fprintf(stderr,"Can't find entry size to hold weighting factor\n"); - exit(-1); - } - if ((oft = findord(f, f->vomnb)) < 0) { - fprintf(stderr,"Can't find entry size to hold vertex offset index\n"); - exit(-1); - } - bigt = wit > oft ? wit : oft; /* Bigest separate type */ - - if ((combt = findord(f, f->wemnb + f->vomnb)) < 0) {/* Combined isn't possible */ - sepbits = 2 * a->ords[bigt].bits; /* Total separate bits */ - combits = sepbits; /* Force separate entries */ - } else { - sepbits = 2 * a->ords[bigt].bits; /* Total separate bits */ - combits = a->ords[combt].bits; /* Total combined bits */ - } - - if (sepbits <= combits) { /* We will use separate entries */ - t->wo_xs = 1; - t->we_es = a->ords[bigt].bits/8; /* size in bytes for weighting entry */ - t->we_ab = a->ords[bigt].bits; /* bits available for weighting */ - t->we_eo = 0; /* Entry offset in simplex table */ - t->vo_es = a->ords[bigt].bits/8; /* size in bytes for vertex offset entry */ - t->vo_ab = a->ords[bigt].bits; /* bits available for vertex offset */ - t->vo_eo = t->we_es; /* Entry offset in simplex table */ - t->wo_es = t->we_es + t->vo_es; /* Total entry size for each vertex */ - t->sm_ts = (g->id + 1) * (t->we_es + t->vo_es) ; /* Total size in bytes */ - - f->weet = bigt; /* Variable type for accessing weighting entry */ - f->voet = bigt; /* Variable type for accessing vertex offset entry */ - f->wevt = nord(f, wit); /* Variable type for holding weight value */ - f->vovt = nord(f, oft); /* Variable type for holding offset value */ - - } else { /* We will combine the two entries */ - t->wo_xs = 0; - t->wo_es = a->ords[combt].bits/8; /* entry size in bytes for each entry */ - t->wo_ab = a->ords[combt].bits; /* bits in weightig + offset */ - t->we_ab = f->wemnb; /* bits available for weighting */ - t->vo_ab = t->wo_ab - t->we_ab; /* Allow all spare bits to vertex offset */ - t->wo_eo = 0; /* entry offset in simplex table */ - t->sm_ts = (g->id + 1) * t->wo_es; /* Total size in bytes */ - - f->woet = combt; /* Variable type for accessing combined entry */ - f->wovt = nord(f, combt); /* Variable type holding weight/offset read value */ - - if ((f->wevt = findnord(f, t->we_ab)) < 0) { - fprintf(stderr,"Can't find variable size to hold weighting factor\n"); - exit(-1); - } - if ((f->vovt = findnord(f, t->vo_ab)) < 0) { - fprintf(stderr,"Can't find variable size to hold vertex offset index\n"); - exit(-1); - } - } - - /* Compute the number of bits needed to hold an index into */ - /* the simplex table (index is in terms of table entry size). */ - /* This value is used to figure out the room needed in the input */ - /* table to accumulate the simplex cube base offset value. (SW_O macro) */ - f->sxmnb = calc_bits(g->id, g->stres); - -#ifdef VERBOSE - /* Summarise the simplex table arrangements */ - printf("\n"); - printf("Simplex table structure:\n"); - printf(" Minimum bits needed to index table %d\n", f->sxmnb); - printf(" Total simplex entry size %d bytes to hold %d entries\n",t->sm_ts, g->id+1); - if (t->wo_xs) { - printf(" Separate entries for offset and weight\n"); - printf(" Weighting entry size %d bytes\n",t->we_es); - printf(" Offset entry size %d bytes\n",t->vo_es); - } else { - printf(" Combined offset and weight entries in %d bytes\n",t->wo_es); - printf(" Weighting entry size %d bits\n",t->we_ab); - printf(" Offset entry size %d bits\n",t->vo_ab); - } - printf(" Vertex offset scale factor %d\n", t->vo_om); -#endif /* VERBOSE */ - - /* We known how big the interpolation and simplex */ - /* tables indexes are going to be, so complete figuring out */ - /* how big the input table entries have to be. */ - if ((f->itet = findord(f, f->sxmnb + f->ixmnb)) >= 0) {/* size to read */ - int rem; /* Remainder bits */ - - t->it_xs = 0; /* Combined simplex+interp index */ - - t->it_ab = a->ords[f->itet].bits; /* Bits in combined input entry */ - rem = t->it_ab - f->sxmnb - f->ixmnb; - t->sx_ab = f->sxmnb + rem/2; /* simplex index bits actually available */ - t->ix_ab = t->it_ab - t->sx_ab; /* interp index bits actually available */ - t->it_ts = a->ords[f->itet].bits/8; /* total size in bytes */ - f->itvt = nord(f, f->itet); /* Variable type */ - - if ((f->sxvt = findnord(f, t->sx_ab)) < 0) { - fprintf(stderr,"Simplex index variable size can't be handled\n"); - exit(-1); - } - if ((f->ixvt = findnord(f, t->ix_ab)) < 0) { - fprintf(stderr,"Interp index variable size can't be handled\n"); - exit(-1); - } - } else { /* Separate entries */ - int bbits; /* Largest number of bits needed */ - - t->it_xs = 1; /* Separate simplex+interp indexes */ - bbits = f->sxmnb > f->ixmnb ? f->sxmnb : f->ixmnb; - - /* Allocate same size for both so that total structure size is power of 2 */ - if ((f->sxet = f->ixet = findord(f, bbits)) < 0) { - fprintf(stderr,"Interp/Simplex index entry size can't be handled\n"); - exit(-1); - } - - t->sx_ab = a->ords[f->sxet].bits; /* Actual bits available */ - t->sx_es = t->sx_ab/8; /* Entry size in bytes */ - t->ix_ab = a->ords[f->ixet].bits; - t->ix_es = t->sx_ab/8; - t->it_ts = t->sx_es + t->ix_es; /* total size in bytes */ - t->sx_eo = 0; /* simplex index offset in bytes */ - t->ix_eo = t->sx_es; /* interp. index offset in bytes */ - f->sxvt = nord(f, f->sxet); /* Variable type */ - f->ixvt = nord(f, f->ixet); /* Variable type */ - } - -#ifdef VERBOSE - /* Summarise the input table arrangements */ - printf("\n"); - printf("Input table structure:\n"); - if (t->it_ix) { - printf(" Input table extracts value from read values\n"); - } else { - printf(" Value extraction read values is explicit\n"); - } - printf(" Input value re-ordering is ["); - for (e = 0; e < g->id; e++) - printf("%s%d",e > 0 ? " " : "", t->it_map[e]); - printf("]\n"); - printf(" Input table entry size = %d bytes\n",t->it_ts); - if (t->it_xs) { - printf(" Separate Interp. and Simplex index values\n"); - printf(" Interp. index is at offset %d, size %d bytes\n",t->ix_eo, t->ix_es); - printf(" Simplex index is at offset %d, size %d bytes\n",t->sx_eo, t->sx_es); - } else { - printf(" Combined Interp. and Simplex index values\n"); - printf(" Values are size %d bytes\n",t->it_ts); - printf(" Interp. index = %d bits\n",t->ix_ab); - printf(" Simplex index = %d bits\n",t->sx_ab); - } -#endif /* VERBOSE */ - } - - /* Figure out output table stuff */ - { - /* A variable to hold the index into an output table */ - if ((f->otit = findord(f, g->prec)) < 0) { - fprintf(stderr,"Can't find output table index size\n"); - exit(-1); - } - f->otit = nord(f,f->otit); /* Make temp variable natural size */ - - if (g->out.pint != 0) /* Pixel interleaved */ - f->nop = 1; - else - f->nop = g->od; - - /* Figure out the output pointer types */ - f->otvt = 0; /* Output table value type */ - for (e = 0; e < f->nop; e++) { - if ((f->opt[e] = findord(f, g->out.bpch[e])) < 0) { - fprintf(stderr,"Output channel size can't be handled\n"); - exit(-1); - } - if (f->opt[e] > f->otvt) - f->otvt = f->opt[e]; /* Make value type big enough for any channel size */ - } - t->ot_ts = a->ords[f->otvt].bits/8; /* Output table entry size in bytes */ - - /* Setup information on data placement in output table enries */ - for (e = 0; e < g->od; e++) { - t->ot_off[e] = g->out.bov[e]; /* Transfer info from generation spec. */ - t->ot_bits[e] = g->out.bpv[e]; - } - } - -#ifdef VERBOSE - /* Summarise the output table arrangements */ - printf(" Output value re-ordering is ["); - for (e = 0; e < g->od; e++) - printf("%s%d",e > 0 ? " " : "", t->im_map[e]); - printf("]\n"); - printf("\n"); - - printf("Output table structure:\n"); - printf(" Entry size = %d bytes\n",t->ot_ts); - printf(" Output value placement within each enry is:\n"); - for (e = 0; e < f->nop; e++) { - printf(" %d: Offset %d bits, size %d bits\n", e, t->ot_off[e], t->ot_bits[e]); - } -#endif /* VERBOSE */ - - /* Compute the maximum interpolation table resolution we will be able to handle */ - { - int res, ores; - - res = calc_res(g->id, t->ix_ab); - ores = calc_ores(g->id, t->vo_ab, t->vo_om); - f->ixmxres = res < ores ? res : ores; - } - - /* Compute the maximum simplex table resolution we will be able to handle */ - if (t->sort) { - f->sxmxres = 0; - } else { - f->sxmxres = calc_res(g->id, t->sx_ab); - } - -#ifdef VERBOSE - printf("Emitting introductory code\n"); fflush(stdout); -#endif /* VERBOSE */ - - /* Start of code generation */ - doheader(f); /* Output the header comments */ - - /* We need an include file */ - line(f,"#ifndef IMDI_INCLUDED"); - line(f,"#include <memory.h>"); - line(f,"#include \"imdi_imp.h\""); - line(f,"#define IMDI_INCLUDED"); - line(f,"#endif /* IMDI_INCLUDED */"); - cr(f); - - /* Declare our explicit pointer type */ - line(f,"#ifndef DEFINED_pointer"); - line(f,"#define DEFINED_pointer"); - line(f,"typedef unsigned char * pointer;"); - line(f,"#endif"); - cr(f); - - /* Declare our explicit structure access macros */ - -#ifdef VERBOSE - printf("Declaring macros\n"); fflush(stdout); -#endif /* VERBOSE */ - - /* Macros for accessing input table entries */ - if (t->sort) { - if (t->it_xs) { - line(f,"/* Input table interp. index */"); - line(f,"#define IT_IX(p, off) *((%s *)((p) + %d + (off) * %d))", - a->ords[f->ixet].name, t->ix_eo, t->it_ts); - cr(f); - if (t->wo_xs) { - line(f,"/* Input table input weighting enty */"); - line(f,"#define IT_WE(p, off) *((%s *)((p) + %d + (off) * %d))", - a->ords[f->weet].name, t->we_eo, t->it_ts); - cr(f); - line(f,"/* Input table input offset value enty */"); - line(f,"#define IT_VO(p, off) *((%s *)((p) + %d + (off) * %d))", - a->ords[f->voet].name, t->vo_eo, t->it_ts); - cr(f); - } else { - line(f,"/* Input table input weighting/offset value enty */"); - line(f,"#define IT_WO(p, off) *((%s *)((p) + %d + (off) * %d))", - a->ords[f->woet].name, t->wo_eo, t->it_ts); - cr(f); - } - } else { - line(f,"/* Input table interp index, weighting and vertex offset */"); - line(f,"#define IT_IT(p, off) *((%s *)((p) + %d + (off) * %d))", - a->ords[f->itet].name, 0, t->it_ts); - cr(f); - } - - /* Macro to conditionally exchange two varibles */ - /* Doing this in place using an xor seems to be fastest */ - /* on most architectures. */ - line(f,"/* Conditional exchange for sorting */"); - if (t->wo_xs) { - line(f,"#define CEX(A, AA, B, BB) if (A < B) { \\"); - line(f," A ^= B; B ^= A; A ^= B; AA ^= BB; BB ^= AA; AA ^= BB; }"); - } else - line(f,"#define CEX(A, B) if (A < B) { A ^= B; B ^= A; A ^= B; }"); - cr(f); - - } else { /* Simplex table */ - if (t->it_xs) { - line(f,"/* Input table interp. index */"); - line(f,"#define IT_IX(p, off) *((%s *)((p) + %d + (off) * %d))", - a->ords[f->ixet].name, t->ix_eo, t->it_ts); - cr(f); - line(f,"/* Input table simplex index enty */"); - line(f,"#define IT_SX(p, off) *((%s *)((p) + %d + (off) * %d))", - a->ords[f->sxet].name, t->sx_eo, t->it_ts); - cr(f); - } else { - line(f,"/* Input table inter & simplex indexes */"); - line(f,"#define IT_IT(p, off) *((%s *)((p) + %d + (off) * %d))", - a->ords[f->itet].name, 0, t->it_ts); - cr(f); - } - } - - if (!t->sort) { - /* Macro for computing a simplex table entry */ - line(f,"/* Simplex weighting table access */"); - line(f,"#define SW_O(off) ((off) * %d)", t->sm_ts); - cr(f); - - /* Macros for accessing the contents of the simplex table */ - if (t->wo_xs) { /* If separate */ - line(f,"/* Simplex table - get weighting value */"); - line(f,"#define SX_WE(p, v) *((%s *)((p) + (v) * %d + %d))", - a->ords[f->weet].name, t->wo_es, t->we_eo); - cr(f); - - line(f,"/* Simplex table - get offset value */"); - line(f,"#define SX_VO(p, v) *((%s *)((p) + (v) * %d + %d))", - a->ords[f->voet].name, t->wo_es, t->vo_eo); - cr(f); - - } else { /* Combined */ - line(f,"/* Simplex table - get weighting/offset value */"); - line(f,"#define SX_WO(p, v) *((%s *)((p) + (v) * %d))", - a->ords[f->woet].name, t->wo_es); - cr(f); - } - } - - /* Macro for computing an interpolation table entry */ - line(f,"/* Interpolation multi-dim. table access */"); - line(f,"#define IM_O(off) ((off) * %d)", t->im_ts); - cr(f); - - /* Macro for accessing an entry in the interpolation table */ - line(f,"/* Interpolation table - get vertex values */"); - - if (t->im_fn > 0) { - /* Arguments to macro are cell base address, vertex offset, data offset */ - - if (f->imfvt == f->iafvt) { /* Table and accumulator are the same size */ - if (!timp || t->im_fn == 1) - line(f,"#define IM_FE(p, v, c) *((%s *)((p) + (v) * %d + (c) * %d))", - a->ords[f->imfvt].name, t->im_oc, t->im_fs); - else { - line(f,"#define IM_TP(p, v) ((p) + (v) * %d)", t->im_oc); - line(f,"#define IM_FE(p, c) *((%s *)((p) + (c) * %d))", - a->ords[f->imfvt].name, t->im_fs); - } - } else { /* Expand single table entry to accumulator size */ - if (!timp || t->im_fn == 1) - line(f,"#define IM_FE(p, v, c) ((%s)*((%s *)((p) + (v) * %d + (c) * %d)))", - a->ords[f->iafvt].name, - a->ords[f->imfvt].name, t->im_oc, t->im_fs); - else { - line(f,"#define IM_TP(p, v) ((p) + (v) * %d)", t->im_oc); - line(f,"#define IM_FE(p, c) ((%s)*((%s *)((p) + (c) * %d)))", - a->ords[f->iafvt].name, - a->ords[f->imfvt].name, t->im_fs); - } - } - } - if (t->im_pn > 0) { - /* Arguments to macro are cell base address, vertex offset */ - /* There is no data offset since there can be only be one partial entry */ - - if (f->imfvt == f->iafvt) /* Table and accumulator are the same size */ - line(f,"#define IM_PE(p, v) *((%s *)((p) + %d + (v) * %d))", - a->ords[f->impvt].name, t->im_fn * t->im_fs, t->im_oc); - else /* Expand single table entry to accumulator size */ - line(f,"#define IM_PE(p, v) ((%s)*((%s *)((p) + %d + (v) * %d)))", - a->ords[f->iafvt].name, - a->ords[f->impvt].name, t->im_fn * t->im_fs, t->im_oc); - } - cr(f); - - /* Macro for accessing an output table entry */ - line(f,"/* Output table indexes */"); - line(f,"#define OT_E(p, off) *((%s *)((p) + (off) * %d))", - a->ords[f->otvt].name, t->ot_ts); - cr(f); - - /* =============================================== */ - -#ifdef VERBOSE - printf("Starting interpolation function\n"); fflush(stdout); -#endif /* VERBOSE */ - - /* Declare the function */ - line(f,"static void"); - line(f, "imdi_k%d(",index); - line(f, "imdi *s, /* imdi context */"); - line(f, "void **outp, /* pointer to output pointers */"); - line(f, "void **inp, /* pointer to input pointers */"); - line(f, "unsigned int npix /* Number of pixels to process */"); - line(f, ") {"); - inc(f); - - /* We need access to the imdi_imp */ - line(f, "imdi_imp *p = (imdi_imp *)(s->impl);"); - - /* Declare the input pointers and init them */ - for (e = 0; e < f->nip; e++) { - line(f, "%s *ip%d = (%s *)inp[%d];", - a->ords[f->ipt[e]].name, e, a->ords[f->ipt[e]].name, e); - } - - /* Declare the output pointers and init them */ - for (e = 0; e < f->nop; e++) { - line(f, "%s *op%d = (%s *)outp[%d];", - a->ords[f->opt[e]].name, e, a->ords[f->opt[e]].name, e); - } - - /* Declare and intialise the end pointer */ - line(f, "%s *ep = ip0 + npix * %d ;", - a->ords[f->ipt[0]].name, g->in.chi[0]); - - /* Declare and initialise the input table pointers */ - for (e = 0; e < g->id; e++) - line(f,"pointer it%d = (pointer)p->in_tables[%d];",e,e); - - /* Declare and initialise the output table pointers */ - for (e = 0; e < g->od; e++) - line(f,"pointer ot%d = (pointer)p->out_tables[%d];",e,e); - - if (!t->sort) { - /* Declare and initialise the Simplex weighting base pointer */ - line(f,"pointer sw_base = (pointer)p->sw_table;"); - } - - /* Declare and initialise the Interpolation multidim base pointer */ - line(f,"pointer im_base = (pointer)p->im_table;"); - - /* Figure out whether input channel reads can be used directly as table offsets */ - t->it_ix = 1; /* Default use input table lookup to extract value */ - - if (g->in.packed != 0) - t->it_ix = 0; /* Extract will be done explicitly */ - - for (e = 0; e < g->id; e++) { - int ee = (g->in.pint != 0) ? 0 : e; /* bpch index */ - - if ((g->in.bov[e] + g->in.bpv[e]) <= 12) - continue; /* Table can do extract */ - - if (g->in.bov[e] != 0 || g->in.bpv[e] != g->in.bpch[ee]) { - t->it_ix = 0; /* Extract will be done explicitly */ - break; - } - } - - /* ------------------------------- */ -#ifdef VERBOSE - printf("Starting pixel processing loop\n"); fflush(stdout); -#endif /* VERBOSE */ - - /* Start the pixel processing loop */ - cr(f); - sline(f, "for(;ip0 < ep;"); - for (e = 0; e < f->nip; e++) - mline(f, " ip%d += %d,", e, g->in.chi[e]); - for (e = 0; e < f->nop; e++) - mline(f, " op%d += %d%s", e, g->out.chi[e], ((e+1) < f->nop) ? "," : ""); - eline(f, ") {"); - inc(f); - - /* Declare output value accumulator(s) */ - for (i = 0; i < t->im_fn; i++) { - line(f,"%s ova%d; /* Output value accumulator */",a->ords[f->iafvt].name,i); - } - for (; i < f->ian; i++) { - line(f,"%s ova%d; /* Output value partial accumulator */",a->ords[f->iapvt].name,i); - } - - /* Context around interp/Simplex table lookup */ - line(f, "{"); - inc(f); - - if (!t->sort) - line(f,"pointer swp;"); /* Declare Simplex weighting pointer */ - line(f,"pointer imp;"); /* Declare Interpolation multidim pointer */ - - /* Declare the input weighting/vertex offset variables */ - if (t->sort) { - for (e = 0; e < g->id; e++) { - if (t->wo_xs) { - line(f,"%s we%d; /* Weighting value variable */", - a->ords[f->wevt].name, e); - line(f,"%s vo%d; /* Vertex offset variable */", - a->ords[f->vovt].name, e); - } else { - line(f,"%s wo%d; /* Weighting value and vertex offset variable */", - a->ords[f->wovt].name, e); - } - } - } - - /* Context around input table processing */ - line(f, "{"); - inc(f); - - /* Declare the table index variables/input weighting/vertex offset variables */ - if (t->sort) { - if (!t->it_xs) - line(f,"%s ti; /* Input table entry variable */",a->ords[f->itvt].name); - line(f,"%s ti_i; /* Interpolation index variable */",a->ords[f->ixvt].name); - } else { - if (t->it_xs) { - line(f,"%s ti_s; /* Simplex index variable */",a->ords[f->sxvt].name); - line(f,"%s ti_i; /* Interpolation index variable */",a->ords[f->ixvt].name); - } else { - line(f,"%s ti; /* Simplex+Interpolation index variable */",a->ords[f->itvt].name); - } - } - - if (g->in.packed != 0) /* We need to unpack from a single read */ - line(f,"%s rdv; /* Read value */",a->ords[f->ipt[0]].name); - - if (t->it_ix == 0) { - int bv = 0; - for (e = 0; e < f->nip; e++) { /* Find largest input type */ - if (f->ipt[e] > bv) - bv = f->ipt[e]; - } - bv = nord(f, bv); - line(f,"%s chv; /* Channel value */",a->ords[bv].name); - f->chv_bits = a->ords[bv].bits; - } - cr(f); - -#ifdef VERBOSE - printf("Read code\n"); fflush(stdout); -#endif /* VERBOSE */ - - /* For all the input channels */ - for (e = 0; e < g->id; e++) { - char rde[50]; /* Read expression */ - char toff[50]; /* Table offset expression */ - int ee = (g->in.pint != 0) ? 0 : e; /* bpch index */ - - if (g->in.pint != 0) /* Pixel interleaved */ - sprintf(rde,"ip0[%d]",e); /* Offset from single pointer */ - else - sprintf(rde,"*ip%d",e); /* Pointer per channel */ - - if (g->in.packed != 0) { - if (e == 0) - line(f,"rdv = %s;",rde); /* Do single read */ - sprintf(rde,"rdv"); /* Use read value for extraction */ - } - - if (t->it_ix == 0) { - if (g->in.bov[e] == 0 ) { /* No offset */ - if (g->in.bpv[e] == g->in.bpch[ee]) /* No mask */ - line(f,"chv = %s;",rde); - else /* Just mask */ - line(f,"chv = (%s & %s);",rde, hmask(g->in.bpv[e])); - } else { /* Offset */ - if ((g->in.bov[e] + g->in.bpv[e]) == g->in.bpch[ee]) - line(f,"chv = (%s >> %d);",rde, g->in.bov[e]); - else { /* Offset and mask */ - if (a->shfm || g->in.bpv[e] > 32) { - /* Extract using just shifts */ - line(f,"chv = ((%s << %d) >> %d);", rde, - f->chv_bits - g->in.bpv[e] - g->in.bov[e], - f->chv_bits - g->in.bpv[e]); - } else { - /* Extract using shift and mask */ - line(f,"chv = ((%s >> %d) & %s);", - rde, g->in.bov[e], hmask(g->in.bpv[e])); - } - } - } - sprintf(toff,"chv"); - } else { /* No extraction */ - sprintf(toff,"%s",rde); - } - - if (t->sort) { - if (t->it_xs) { - line(f,"ti_i %s= IT_IX(it%d, %s);", e ? "+" : " ", e, toff); - if (t->wo_xs) { - line(f,"we%d = IT_WE(it%d, %s);", e, e, toff); - line(f,"vo%d = IT_VO(it%d, %s);", e, e, toff); - } else { - line(f,"wo%d = IT_WO(it%d, %s);", e, e, toff); - } - } else { /* All three combined */ - line(f,"ti = IT_IT(it%d, %s);", e, toff); - if (a->shfm || t->wo_ab > 32) { - /* Extract using just shifts */ - line(f,"wo%d = ((ti << %d) >> %d); " - "/* Extract weighting/vertex offset value */", - e, a->ords[f->wovt].bits - t->wo_ab, a->ords[f->wovt].bits - t->wo_ab); - line(f,"ti_i %s= (ti >> %d); " - "/* Extract interpolation table value */", - e ? "+" : " ", t->wo_ab); - } else { - /* Extract using shift and mask */ - line(f,"wo%d = (ti & %s); " - "/* Extract weighting/vertex offset value */", - e, hmask(t->wo_ab)); - line(f,"ti_i %s= (ti >> %d); " - "/* Extract interpolation table value */", - e ? "+" : " ", t->wo_ab); - } - } - - } else { /* Simplex */ - if (t->it_xs) { - /* ~~~~ should toff be forced to be a temp variable ?? */ - /* (ie. force use of rde (above) if t->it_xs is nonz) */ - line(f,"ti_i %s= IT_IX(it%d, %s);", e ? "+" : " ", e, toff); - line(f,"ti_s %s= IT_SX(it%d, %s);", e ? "+" : " ", e, toff); - } else { - line(f,"ti %s= IT_IT(it%d, %s);", e ? "+" : " ", e, toff); - } - } - } - -#ifdef VERBOSE - printf("Index extraction code\n"); fflush(stdout); -#endif /* VERBOSE */ - - cr(f); - - if (t->sort) { - /* Extract Simplex and Interpolation indexes from accumulator */ - line(f,"imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */"); - } else { - if (t->it_xs) { /* Extract Simplex and Interpolation indexes from accumulator */ - line(f,"swp = sw_base + SW_O(ti_s); /* Compute simplex table entry pointer */"); - line(f,"imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */"); - } else { - line(f,"imp = im_base + IM_O(ti >> %d); " - "/* Extract interp. index and comp. entry */", - t->sx_ab); - if (a->shfm || t->sx_ab > 32) { - /* Extract using just shifts */ - line(f,"swp = sw_base + SW_O((ti << %d) >> %d); " - "/* Extract simplex index & comp. entry */", - a->ords[f->itvt].bits - t->sx_ab, a->ords[f->itvt].bits - t->sx_ab); - } else { - /* Extract using shift and mask */ - line(f,"swp = sw_base + SW_O(ti & %s); " - "/* Extract simplex index and comp. entry */", - hmask(t->sx_ab)); - } - } - } - - /* Do the explicit sort now */ - if (t->sort) { - cr(f); - /* Sort from largest to smallest using a selection sort */ - /* Use simple sequence for the moment. More elaborate sequence */ - /* may allow other optimisations. */ - line(f,"/* Sort weighting values and vertex offset values */"); - for (i = 0; i < (g->id-1); i++) { - for (e = i+1; e < g->id; e++) { - if (t->wo_xs) - line(f,"CEX(we%d, vo%d, we%d, vo%d);",i,i,e,e); - else - line(f,"CEX(wo%d, wo%d);",i,e); - } - } - } - - /* End of input table processing context */ - dec(f); - line(f,"}"); - - line(f,"{"); /* Context around vertex lookup and accumulation */ - inc(f); - - /* Declare vertex offset and weight variables */ - if (t->sort && t->wo_xs == 0) { - line(f,"%s nvof; /* Next vertex offset value */",a->ords[f->vovt].name); - } else { - if (!t->wo_xs) /* If combined in table */ - line(f,"%s vowr; /* Vertex offset/weight value */",a->ords[f->wovt].name); - } - line(f,"%s vof; /* Vertex offset value */",a->ords[f->vovt].name); - line(f,"%s vwe; /* Vertex weighting */",a->ords[f->wevt].name); - if (timp && t->im_fn > 1) - line(f,"pointer timp; /* Temporary interpolation table pointer */"); - cr(f); - -#ifdef VERBOSE - printf("Vertex offset and weight code\n"); fflush(stdout); -#endif /* VERBOSE */ - - /* For each vertex in the simplex */ - for (e = 0; e < (g->id +1); e++) { - - if (t->sort) { - - if (e == 0) { - line(f,"vof = 0; /* First vertex offset is 0 */"); - } else { - if (t->wo_xs) - line(f,"vof += vo%d; /* Move to next vertex */",e-1); - else - line(f,"vof += nvof; /* Move to next vertex */"); - } - - /* Extract the vertex offset and weight values from the sorted input values */ - if (e < g->id && !t->wo_xs) { - if (a->shfm || t->vo_ab > 32) { - /* Extract using just shifts */ - line(f,"nvof = ((wo%d << %d) >> %d); " - "/* Extract offset value */", - e, a->ords[f->vovt].bits - t->vo_ab, a->ords[f->vovt].bits - t->vo_ab); - line(f,"wo%d = (wo%d >> %d); " - " /* Extract weighting value */", - e, e, t->vo_ab); - } else { - /* Extract using shift and mask */ - line(f,"nvof = (wo%d & %s); " - "/* Extract offset value */", - e, hmask(t->vo_ab)); - line(f,"wo%d = (wo%d >> %d); " - " /* Extract weighting value */", - e, e, t->vo_ab); - } - } - /* Compute the weighting value */ - if (!t->wo_xs) { - if (e == 0) { - line(f,"vwe = %d - wo%d; /* Baricentric weighting */", 1 << g->prec, e); - } else if (e < g->id) { - line(f,"vwe = wo%d - wo%d; /* Baricentric weighting */", e-1, e); - } else { - line(f,"vwe = wo%d; /* Baricentric weighting */", e-1); - } - } else { - if (e == 0) { - line(f,"vwe = %d - we%d; /* Baricentric weighting */", 1 << g->prec, e); - } else if (e < g->id) { - line(f,"vwe = we%d - we%d; /* Baricentric weighting */", e-1, e); - } else { - line(f,"vwe = we%d; /* Baricentric weighting */", e-1); - } - } - - } else { /* Not sort */ - /* Read the vertex offset and weight values from the simplex table */ - if (t->wo_xs) { /* If separate */ - line(f,"vof = SX_VO(swp, %d); /* Read vertex offset value */", e); - line(f,"vwe = SX_WE(swp, %d); /* Read vertex weighting value */", e); - } else { /* If combined in table */ - line(f,"vowr = SX_WO(swp, %d); /* Read vertex offset+weighting values */", e); - if (a->shfm || t->vo_ab > 32) { - /* Extract using just shifts */ - line(f,"vof = ((vowr << %d) >> %d); " - "/* Extract offset value */", - a->ords[f->vovt].bits - t->vo_ab, a->ords[f->vovt].bits - t->vo_ab); - line(f,"vwe = (vowr >> %d); " - "/* Extract weighting value */", - t->vo_ab); - } else { - /* Extract using shift and mask */ - line(f,"vof = (vowr & %s); " - "/* Extract offset value */", - hmask(t->vo_ab)); - line(f,"vwe = (vowr >> %d); " - "/* Extract weighting value */", - t->vo_ab); - } - } - } - - /* Lookup the vertex value, weight it, and accumulate it into output value */ - if (timp && t->im_fn > 1) - line(f,"timp = IM_TP(imp, vof); /* Vertex address */"); - for (i = 0; i < f->ian; i++) { /* For each output accumulation chunk */ - if (i < t->im_fn) { /* Full entry */ - if (!timp || t->im_fn == 1) - line(f,"ova%d %s= IM_FE(imp, vof, %d) * vwe; " - "/* Accumulate weighted output values */", - i, e ? "+" : " ", i); - else - line(f,"ova%d %s= IM_FE(timp, %d) * vwe; " - "/* Accumulate weighted output values */", - i, e ? "+" : " ", i); - } else /* One partial entry */ - line(f,"ova%d %s= IM_PE(imp, vof) * vwe; " - "/* Accumulate last weighted output values */", - i, e ? "+" : " "); - } - } - - dec(f); - line(f, "}"); /* End of output value lookup context */ - - dec(f); - line(f, "}"); /* End of output value accumulation context */ - - /* Start of output lookup and write */ - line(f,"{"); - inc(f); - -#ifdef VERBOSE - printf("Output table code\n"); fflush(stdout); -#endif /* VERBOSE */ - - { - char wre[50]; /* Write destination expression */ - - if (g->out.packed != 0) /* We need to pack results into a single write */ - line(f,"%s wrv; /* Write value */",a->ords[f->ipt[0]].name); - - /* Declare temporary to hold index into output lookup table */ - line(f,"%s oti; /* Vertex offset value */",a->ords[f->otit].name); - - /* For each accumulator value */ - /* (Assume they are in output order for the moment ?) */ - for (e = i = 0; i < f->ian; i++) { /* For each output accumulation chunk */ - int vpa = i < t->im_fn ? t->im_fv : t->im_pv; /* Chanel values per accumulator */ - int oat = i < t->im_fn ? f->iafvt : f->iapvt; /* Output accumulator type */ - int ee; /* Relative e to this accumulator */ - - /* For each output value in this accumulator */ - for (ee = 0; ee < vpa && e < g->od; ee++, e++) { - int off, size; /* Bits to be extracted */ - - /* Extract wanted 8 bits from the 8.8 bit result in accumulator */ - off = ee * f->iaovb + (f->iaovb - g->prec); - size = g->prec; - - if (e == 0 || g->out.packed == 0) { - if (g->out.pint != 0) /* Pixel interleaved */ - sprintf(wre,"op0[%d]",e); /* Offset from single pointer */ - else - sprintf(wre,"*op%d",e); /* Pointer per channel */ - } - - if (a->shfm || size > 32) { - /* Extract using just shifts */ - line(f,"oti = ((ova%d << %d) >> %d); " - "/* Extract integer part of result */", - i, a->ords[oat].bits - off - size, a->ords[oat].bits - size); - } else { - /* Extract using shift and mask */ - line(f,"oti = ((ova%d >> %d) & %s); " - "/* Extract integer part of result */", - i, off, hmask(size)); - } - - /* Lookup in output table and write to destination */ - if (g->out.packed != 0) { - line(f,"wrv %s= OT_E(ot%d, oti);", e ? "+" : "", e); - } else { - line(f,"%s = OT_E(ot%d, oti); /* Write result */", wre, e); - } - } - } - - if (g->out.packed != 0) { /* Write out the accumulated value */ - line(f,"%s = wrv; /* Write result */", wre); - } - } - - /* The end of the output lookup and write */ - dec(f); - line(f, "}"); - - /* The end of the pixel processing loop */ - dec(f); - line(f, "}"); - - /* The end of the function */ - dec(f); - line(f, "}"); - - /* Undefine all the macros */ - if (t->sort) { - if (t->it_xs) { - if (t->wo_xs) { - line(f,"#undef IT_WE"); - line(f,"#undef IT_VO"); - } else - line(f,"#undef IT_WO"); - line(f,"#undef IT_IX"); - } else { - line(f,"#undef IT_IT"); - } - line(f,"#undef CEX"); - } else { - if (t->it_xs) { - line(f,"#undef IT_IX"); - line(f,"#undef IT_SX"); - } else { - line(f,"#undef IT_IT"); - } - - line(f,"#undef SW_O"); - if (t->wo_xs) { - line(f,"#undef SX_WE"); - line(f,"#undef SX_VO"); - } else { - line(f,"#undef SX_WO"); - } - } - line(f,"#undef IM_O"); - if (t->im_fn > 0) { - if (timp && t->im_fn > 1) - line(f,"#undef IM_TP"); - line(f,"#undef IM_FE"); - } - if (t->im_pn > 0) { - line(f,"#undef IM_PE"); - } - line(f,"#undef OT_E"); - - /* =============================================== */ -#ifdef VERBOSE - printf("Done interpolation code\n"); fflush(stdout); -#endif /* VERBOSE */ - - /* =============================================== */ - - { - int sog = sizeof(genspec); /* Size of genspec structure */ - unsigned char *dp = (unsigned char *)g; - - int s_stres, s_itres; /* Save values */ - - s_stres = g->stres; - s_itres = g->itres; - g->stres = f->sxmxres; /* Set maximum values */ - g->itres = f->ixmxres; - - /* Declare the generation structure data function */ - cr(f); - line(f,"static void"); - line(f, "imdi_k%d_gen(",index); - line(f, "genspec *g /* structure to be initialised */"); - line(f, ") {"); - inc(f); - - /* Declare the genspec initialisation data */ - line(f, "static unsigned char data[] = {"); - inc(f); - for (i = 0; i < sog; i++) { - if ((i & 7) == 0) - sline(f,""); - mline(f, "0x%02x%s ", dp[i], (i+1) < sog ? "," : "", dp[i]); - if ((i & 7) == 7 || (i+1) == sog) - eline(f,""); - } - dec(f); - line(f, "}; /* Structure image */"); - - cr(f); - line(f, "memcpy(g, data, sizeof(data)); /* Initialise the structure */"); - /* The end of the function */ - dec(f); - line(f, "}"); - - g->stres = s_stres; /* Restore entry values */ - g->itres = s_itres; - } - - /* =============================================== */ - - { - int sot = sizeof(tabspec); /* Size of tabspec structure */ - unsigned char *dp = (unsigned char *)t; - - /* Declare the generation structure data function */ - cr(f); - line(f,"static void"); - line(f, "imdi_k%d_tab(",index); - line(f, "tabspec *t /* structure to be initialised */"); - line(f, ") {"); - inc(f); - - /* Declare the genspec initialisation data */ - line(f, "static unsigned char data[] = {"); - inc(f); - for (i = 0; i < sot; i++) { - if ((i & 7) == 0) - sline(f,""); - mline(f, "0x%02x%s ", dp[i], (i+1) < sot ? "," : "", dp[i]); - if ((i & 7) == 7 || (i+1) == sot) - eline(f,""); - } - dec(f); - line(f, "}; /* Structure image */"); - - cr(f); - line(f, "memcpy(t, data, sizeof(data)); /* Initialise the structure */"); - /* The end of the function */ - dec(f); - line(f, "}"); - } - - /* =============================================== */ - - cr(f); cr(f); cr(f); cr(f); cr(f); cr(f); - - return 0; -} - -/* Return bits needed to store index into table of */ -/* given resolution and dimensionality. */ -static int -calc_bits( -int dim, -int res) { - - return ceil(log((double)res) * (double)dim/log(2.0) - 1e-14); -} - -/* Return maximum resolution possible given dimensionality */ -/* and number of index bits. */ -static int -calc_res( -int dim, -int bits) { - double fres; - - fres = log(2.0) * (double)bits/(double)dim; - if (fres > 12 || (fres = exp(fres)) > 65536.0) - fres = 65536.0; /* Limit to a sane value */ - return (int)(fres + 1e-14); -} - -/* Return bits needed to store a relative offset of 1, */ -/* into a table of given resolution, dimensionality , and */ -/* entry size. */ -static int -calc_obits( -int dim, -int res, -int esize) { - double off; /* Maximum diagonal offset value */ - int bits; - - if (res == 0 || res == 1) - return 0; - if (dim == 1) - off = esize; - else { - off = (double)esize * floor(exp(log((double)res) * dim - log(res-1.0))); - } - - bits = ceil(log(off)/log(2.0) - 1e-14); - return bits; -} - -/* Return maximum resolution possible given dimensionality */ -/* number of index bits, and entry size */ -static int -calc_ores( -int dim, -int bits, -int esize) { - int res; - - /* Find resolution. Stop at arbitrary 65536 */ - for (res = 1; res < 65537; res++) { - int bn; - bn = calc_obits(dim, res, esize); - if (bn > bits) { - return res-1; - } - } - return res-1; -} - -/* Output the introductory comments */ -static void -doheader( - fileo *f -) { - genspec *g = f->g; - tabspec *t = f->t; - mach_arch *a = f->a; - int e; - - /* - - - - - - - - - - - - */ - /* Output file title block */ - line(f,"/* Integer Multi-Dimensional Interpolation */"); - line(f,"/* Interpolation Kernel Code */"); - line(f,"/* Generated by cgen */"); - line(f,"/* Copyright 2000 - 2002 Graeme W. Gill */"); - line(f,"/* This material is licenced under the GNU GENERAL PUBLIC LICENCE :- */\n"); - line(f,"/* see the Licence.txt file for licencing details.*/\n"); - cr(f); - - /* - - - - - - - - - - - - */ - /* Output the specification */ - line(f,"/*"); - line(f," Interpolation kernel specs:"); - cr(f); - line(f," Input channels per pixel = %d",g->id); - for (e = 0; e < g->id; e++) { - line(f," Input channel %d bits = %d",e, g->in.bpch[e]); - line(f," Input channel %d increment = %d",e, g->in.chi[e]); - } - if (g->in.pint != 0) - line(f," Input is channel interleaved"); - else - line(f," Input is plane interleaved"); - - if (g->in.packed != 0) - line(f," Input channels are packed into one word"); - else - line(f," Input channels are separate words"); - - if (t->it_ix) - line(f," Input value extraction is done in input table lookup"); - cr(f); - - line(f," Output channels per pixel = %d",g->od); - for (e = 0; e < g->od; e++) { - line(f," Output channel %d bits = %d",e, g->out.bpch[e]); - line(f," Output channel %d increment = %d",e, g->out.chi[e]); - } - if (g->out.pint != 0) - line(f," Output is channel interleaved"); - else - line(f," Output is plane interleaved"); - cr(f); - if (g->out.packed != 0) - line(f," Output channels are packed into one word"); - else - line(f," Output channels are separate words"); - - if (t->sort) - line(f," Weight+voffset bits = %d",t->sx_ab); - else - line(f," Simplex table index bits = %d",t->sx_ab); - line(f," Interpolation table index bits = %d",t->ix_ab); - if (!t->sort) - line(f," Simplex table max resolution = %d",f->sxmxres); - line(f," Interpolation table max resolution = %d",f->ixmxres); - line(f," */"); - cr(f); - - /* - - - - - - - - - - - - */ - line(f,"/*"); - line(f," Machine architecture specs:"); - cr(f); - if (a->bigend != 0) - line(f," Big Endian"); - else - line(f," Little endian"); - - if (a->uwa != 0) - line(f," Using maximum sized memory accesses where possible"); - else - line(f," Reading and writing pixel values separately"); - - line(f," Pointer size = %d bits",a->pbits); - cr(f); - - for (e = 0; e < a->nords; e++) { - line(f," Ordinal size %2d bits is known as '%s'", - a->ords[e].bits,a->ords[e].name); - } - line(f," Natural ordinal is '%s'", a->ords[a->natord].name); - cr(f); - - for (e = 0; e < a->nints; e++) { - line(f," Integer size %2d bits is known as '%s'", - a->ints[e].bits,a->ints[e].name); - } - line(f," Natural integer is '%s'", a->ints[a->natint].name); - cr(f); - - line(f," */"); - cr(f); -} - -/* ---------------------------------------- */ -/* Architecture support */ -/* Find an ordinal with at least bits size */ -/* Return -1 if failed */ -int findord( -fileo *f, -int bits -) { - mach_arch *a = f->a; - int i; - - for (i = 0; i < a->nords; i++) { - if (a->ords[i].bits >= bits) - return i; - } - return -1; -} - -/* Round ordinal type up to natural size */ -int nord( - fileo *f, - int ov -) { - if (ov >= 0 && ov < f->a->natord) - ov = f->a->natord; - return ov; -} - -/* Find an ordinal with at least bits size, */ -/* or natural size, whichever is greater. */ -/* Return -1 if failed */ -int findnord( - fileo *f, - int bits -) { - int ov; - - ov = findord(f, bits); - ov = nord(f, ov); - return ov; -} - -/* Find an integer with at least bits size */ -/* Return -1 if failed */ -int findint( - fileo *f, - int bits -) { - mach_arch *a = f->a; - int i; - - for (i = 0; i < a->nints; i++) { - if (a->ints[i].bits >= bits) - return i; - } - return -1; -} - -/* Round integer type up to natural size */ -int nint( - fileo *f, - int iv -) { - if (iv >= 0 && iv < f->a->natint) - iv = f->a->natint; - return iv; -} - -/* Find an interger with at least bits size, */ -/* or natural size, whichever is greater. */ -/* Return -1 if failed */ -int findnint( - fileo *f, - int bits -) { - int iv; - - iv = findint(f, bits); - iv = nint(f, iv); - return iv; -} - -/* ------------------------------------ */ -/* File output support */ - -/* Output a line to the file (including trailing \n) */ -void -line(fileo *f, char *fmt, ...) -{ - int i; - va_list args; - - /* Indent to the correct level */ - for (i = 0; i < f->indt; i++) - fprintf(f->of," "); - - va_start(args, fmt); - vfprintf(f->of, fmt, args); - va_end(args); - fprintf(f->of, "\n"); -} - -/* Output the start of a line to the file) */ -void -sline(fileo *f, char *fmt, ...) -{ - int i; - va_list args; - - /* Indent to the correct level */ - for (i = 0; i < f->indt; i++) - fprintf(f->of," "); - - va_start(args, fmt); - vfprintf(f->of, fmt, args); - va_end(args); -} - -/* Output the middle of a line to the file) */ -void -mline(fileo *f, char *fmt, ...) -{ - int i; - va_list args; - - va_start(args, fmt); - vfprintf(f->of, fmt, args); - va_end(args); -} - -/* Output the end of a line to the file (including trailing \n) */ -void -eline(fileo *f, char *fmt, ...) -{ - int i; - va_list args; - - va_start(args, fmt); - vfprintf(f->of, fmt, args); - va_end(args); - fprintf(f->of, "\n"); -} -/* ------------------------------------ */ diff --git a/gs/imdi/config.h b/gs/imdi/config.h deleted file mode 100644 index 7da9b2db5..000000000 --- a/gs/imdi/config.h +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef __CONFIG_H__ -#define __CONFIG_H__ - -/* General project wide configuration */ - -/* Version of Argyll release */ - -#define ARGYLL_VERSION 0x000503 -#define ARGYLL_VERSION_STR "0.53" - -/* Maximum file path length */ -#define MAXNAMEL 512 - -#endif /* __CONFIG_H__ */ diff --git a/gs/imdi/copyright.h b/gs/imdi/copyright.h deleted file mode 100644 index 38c2fb132..000000000 --- a/gs/imdi/copyright.h +++ /dev/null @@ -1,2 +0,0 @@ -/* Embed a copyright string */ -static char __copyright__[] = "Copyright 2005 Graeme W. Gill"; diff --git a/gs/imdi/imdi.c b/gs/imdi/imdi.c deleted file mode 100644 index 126f90e75..000000000 --- a/gs/imdi/imdi.c +++ /dev/null @@ -1,211 +0,0 @@ -/* Integer Multi-Dimensional Interpolation */ -/* - * Copyright 2000 - 2002 Graeme W. Gill - * All rights reserved. - * - * This material is licenced under the GNU GENERAL PUBLIC LICENCE :- - * see the Licence.txt file for licencing details. - */ - -/* - This is the implementation of the run time code. - */ - -#include <stdio.h> -#include <stdlib.h> -#include <math.h> -#include <stdarg.h> -#include <string.h> - -#include "imdi_imp.h" -#include "imdi_gen.h" -#include "imdi_tab.h" -#include "imdi_k.h" /* Declaration of all the kernel functions */ - -#undef VERBOSE - -static void imdi_free(imdi *im); - -/* Create a new imdi */ -/* Return NULL if request is not supported */ -imdi *new_imdi( - int id, /* Number of input dimensions */ - int od, /* Number of output dimensions */ - imdi_pixrep in, /* Input pixel representation */ - int in_signed, /* Bit flag per channel, NZ if treat as signed */ - imdi_pixrep out,/* Output pixel representation */ - int out_signed, /* Bit flag per channel, NZ if treat as signed */ - int res, /* Desired table resolution */ - - /* Callbacks to lookup the mdi table values */ - double (*input_curve) (void *cntx, int ch, double in_val), - void (*md_table) (void *cntx, double *out_vals, double *in_vals), - double (*output_curve)(void *cntx, int ch, double in_val), - void *cntx /* Context to callbacks */ -) { - int i; - int bk = -1; /* Best table */ - int bfig = 0x7fffffff; /* Best tables figure of merit */ - int bstres; /* Best tables target stres */ - genspec bgs; /* Best gen spec */ - - tabspec ts; /* Table specifications */ - imdi *im; - -#ifdef VERBOSE - printf("new_imdi called with id %d, od %d, res %d\n", id, od, res); - printf("about to checking %d kernels\n", no_kfuncs); -#endif - - /* The first thing to do is see if there is an available kernel function */ - for (i = 0; i < no_kfuncs; i++) { - genspec gs; - int stres; /* Computed stres needed */ - int fig; - ktable[i].gen(&gs); /* Get the kernel functions genspec */ - -#ifdef VERBOSE - printf("\n"); - printf("kernel %d has id %d, od %d, irep %d orep %d\n", i, gs.id, gs.od, gs.irep, gs.orep); - printf("Input req is id %d, od %d, irep %d orep %d\n", id, od, in, out); -#endif - /* First check mandatory things */ - if (id != gs.id /* Input dimension */ - || od != gs.od /* Output dimension */ - || in != gs.irep /* Input dimension */ - || out != gs.orep) { /* Output dimension */ - continue; - } - -#ifdef VERBOSE - printf(" found match\n"); -#endif - ktable[i].tab(&ts); /* Get the kernel functions tabspec */ - - if (ts.sort) { - stres = 0; -#ifdef VERBOSE - printf("gres = %d\n",res); -#endif - /* We want one that is equals or exceeds the desired */ - /* resolution, but doesn't exceed it too much, or the code */ - /* will be inefficient. */ - /* If there are no routines that can meet the desired precision, */ - /* then it is ok to use the one closest to the desired precision. */ - if (gs.itres >= res) { - fig = 10 * (gs.itres - res); - } { - fig = 0; - if (gs.itres < res) { - fig += 10000 * (res - gs.itres); - } - } - } else { - /* compute the needed stres (Assumint not sort) */ - stres = ((1 << gs.prec)-1 + res-2)/(res-1); -/* stres = ((1024)-1 + res-2)/(res-1); */ - -#ifdef VERBOSE - printf("gres = %d, sres = %d\n",res,stres); -#endif - /* We want one that is equals or exceeds the desired */ - /* resolution, but doesn't exceed it too much, or the code */ - /* will be inefficient. */ - /* If there are no routines that can meet the desired precision, */ - /* then it is ok to use the one closest to the desired precision. */ - if (gs.itres >= res && gs.stres >= stres) { - fig = 10 * (gs.itres - res) + (gs.stres - stres); - } { - fig = 0; - if (gs.itres < res) { - fig += 10000 * (res - gs.itres); - } - if (gs.stres < stres) { - fig += 1000 * (stres - gs.stres); - } - } - } - -#ifdef VERBOSE - printf(" figure of merit %d\n",fig); -#endif - /* Is this the best one so far ? */ - if (fig < bfig) { - bfig = fig; - bk = i; - bstres = stres; - bgs = gs; /* Structure copy */ -#ifdef VERBOSE - printf(" best so far\n"); -#endif - } - } - - if (bk < 0) { -#ifdef VERBOSE - printf("new_imdi failed - dimensionality or representations couldn't be matched\n"); -#endif - return NULL; /* Nothing matches */ - } - - if ((im = (imdi *)malloc(sizeof(imdi))) == NULL) { -#ifdef VERBOSE - printf("new_imdi malloc imdi failed\n"); -#endif - /* Should we return an error somehow ? */ - return NULL; - } - - /* We've decided kernel function bk is going to be the best, */ - /* so now setup the appropriate tables to use with it. */ - ktable[bk].tab(&ts); /* Get the kernel functions tabspec */ - - if (bgs.itres > res) - bgs.itres = res; /* Tell table create what the res is */ - if (bgs.stres > bstres) - bgs.stres = bstres; - - /* Tel table setup how to treat integer input in per channel lookups */ - bgs.in_signed = in_signed; - bgs.out_signed = out_signed; - -#ifdef VERBOSE - if (!ts.sort) { - if ((bgs.stres * (bgs.itres-1)) < ((1 << bgs.prec)-1)) { - printf("Warning: table chosen doesn't reach desired precision!\n"); - printf("Wanted %d, got %d\n", ((1 << bgs.prec)-1), (bgs.stres * (bgs.itres-1))); - } - } -#endif - - /* Allocate and initialise the appropriate tables */ - im->impl = (void *)imdi_tab(&bgs, &ts, input_curve, md_table, output_curve, cntx); - - if (im->impl == NULL) { -#ifdef VERBOSE - printf("imdi_tab failed\n"); -#endif - imdi_free(im); - return NULL; - } - - im->interp = ktable[bk].interp; - im->done = imdi_free; - -#ifdef VERBOSE - printf("new_imdi returning 0x%x\n", im); -#endif - return im; -} - -/* Free up the structure */ -static void imdi_free( -imdi *im -) { - /* Free all the allocated tables */ - if (im->impl != NULL) - imdi_tab_free((imdi_imp *)im->impl); - - /* Free this structure */ - free(im); -} diff --git a/gs/imdi/imdi.h b/gs/imdi/imdi.h deleted file mode 100644 index 7bbf24bed..000000000 --- a/gs/imdi/imdi.h +++ /dev/null @@ -1,67 +0,0 @@ -#ifndef IMDI_H -#define IMDI_H - -/* Integer Multi-Dimensional Interpolation */ -/* - * Copyright 2000 - 2002 Graeme W. Gill - * All rights reserved. - * - * This material is licenced under the GNU GENERAL PUBLIC LICENCE :- - * see the Licence.txt file for licencing details. - */ - -/* - * This software provides support for high speed integer - * multimensional interpolation. - */ - -/* - * This file provides the common definitions for IMDI, and - * the data structures for communcating between the client - * imdi object. -*/ - -/* Pixel representation description */ - -/* This is a high level macro desciption of the pixel layout. */ -/* It can be expanded by adding a new enumeration, and then */ -/* implementing the code in imdi_gen to translate the enumeration */ -/* into the exact pixlayout structure details. */ - -typedef enum { - invalid_rep = 0, - pixint8 = 1, /* 8 Bits per value, pixel interleaved, no padding */ - planeint8 = 2, /* 8 bits per value, plane interleaved */ - pixint16 = 3, /* 16 Bits per value, pixel interleaved, no padding */ - planeint16 = 4 /* 16 bits per value, plane interleaved */ -} imdi_pixrep; - -/* IMDI Object */ -struct _imdi { - void *impl; /* Pointer to implementation information */ - - /* Do the interpolation */ - void (*interp)(struct _imdi *s, void **inp, void **outp, unsigned int npixels); - void (*done)(struct _imdi *s); /* Done with it */ - -}; typedef struct _imdi imdi; - -/* Create a new imdi */ -/* Return NULL if request is not supported */ -imdi *new_imdi( - int id, /* Number of input dimensions */ - int od, /* Number of output dimensions */ - imdi_pixrep in, /* Input pixel representation */ - int in_signed, /* Bit flag per channel, NZ if treat as signed */ - imdi_pixrep out,/* Output pixel representation */ - int out_signed, /* Bit flag per channel, NZ if treat as signed */ - int res, /* Desired table resolution */ - - /* Callbacks to lookup the mdi table values */ - double (*input_curve) (void *cntx, int ch, double in_val), - void (*md_table) (void *cntx, double *out_vals, double *in_vals), - double (*output_curve)(void *cntx, int ch, double in_val), - void *cntx /* Context to callbacks */ -); - -#endif /* IMDI_H */ diff --git a/gs/imdi/imdi_gen.c b/gs/imdi/imdi_gen.c deleted file mode 100644 index cf5104e99..000000000 --- a/gs/imdi/imdi_gen.c +++ /dev/null @@ -1,660 +0,0 @@ -/* Integer Multi-Dimensional Interpolation */ -/* - * Copyright 2000 - 2002 Graeme W. Gill - * All rights reserved. - * - * This material is licenced under the GNU GENERAL PUBLIC LICENCE :- - * see the Licence.txt file for licencing details. - */ - -/* Top level kerenel code generator */ - -/* - * This module is invoked from the make system, - * and generates all the versions and configurations of - * the IMDI kernel code. It includes all the generated - * files in imdi_k.h, which also contains a table - * so that the run time code knows what kernels - * are available. -*/ - -/* - Ideal grid resolutions for 8/16 bit precision calculations: - - There are a limited number of grid resolution and grid cells - sub resolution values that work perfectly, and allow every possible - input value to map to a precise interpolation value. For any - system that deals with Lab data, it is also better if there is - a grid point near a,b == 0, meaning that an odd grid size is - preferable for 3 dimensional conversions. Reasonable memory - usage is usuall somewhere between 100K and 1M entries for - the grid table, limiting the maximum grid resolution. - The following lists the some of the possible grid and sub grid - resolutions in order of best to worst. (Fewer jumps is better). - - Grid Sub8 Round8 Sub16 Round16 Jumps - 4 85 85 21845 21845 0 - 6 51 51 13107 13107 0 - 16 17 17 4369 4369 0 - 18 15 15 3855 3855 0 - 52 5 5 1285 1285 0 - 86 3 3 771 771 0 - 256 1 1 257 257 0 - 258 255 255 0 - 772 85 85 0 - 1286 51 51 0 - 3856 17 17 0 - 4370 15 15 0 - 13108 5 5 0 - 21846 3 3 0 - 65536 1 1 0 - 3 127.5 128 1 - 5 63.75 64 1 - 9 31.875 32 1 - 17 15.937 16 1 - 33 7.968 8 1 - 65 3.984 4 1 - 128 2.007 2 1 - 129 1.992 2 1 - 255 1.003 1 1 - 12 23.188 23 2 - 24 11.086 11 2 - 254 1.007 1 2 - 7 42.5 43 3 - 8 36.428 36 3 - 10 28.333 28 3 - 13 21.25 21 3 - 15 18.214 18 3 - 19 14.166 14 3 - 22 12.142 12 3 - 29 9.107 9 3 - 37 7.083 7 3 - 43 6.071 6 3 - 44 5.930 6 3 - 64 4.047 4 3 - 85 3.035 3 3 - 87 2.965 3 3 - 127 2.023 2 3 - 130 1.976 2 3 - 253 1.011 1 3 - - [8 bit: sub = 255/(grid-1), jumps = abs((grid-1)*round(sub)-255)] - [16 bit: sub = 65535/(grid-1), jumps = abs((grid-1)*round(sub)-65535)] - - The above takes into consideration the mapping of the sub-cell or - simplex table resolution, but doesn't take into account the quantizing - of the sub-cell weighting values into the range 0..256 or 0..65536. - - This will be best when round(sub) divides evenly into 256 or 65536, - so grid resolutions of 3, 5, 9, 17, 33, 65, 128, 129, 255 may be the - best choice for sort algorithm grid resolutions. - - */ - -#include <stdio.h> -#include <stdlib.h> -#include <math.h> -#include <stdarg.h> -#include <string.h> -#include "copyright.h" -#include "config.h" - -#include "imdi_imp.h" -#include "imdi_gen.h" -#include "imdi_tab.h" - -#undef VERBOSE -#undef TEST1 /* Generate one test case */ -#define FULL /* Full set of combinations */ - -/* The following structure initialisations define what kernel routines should be built */ -static -gendesc descs[] = { -#ifdef TEST1 - { - { 1, 0 }, /* Input dimension combinations */ - { 256, 0 }, /* Interpolation table resolutions */ - { 1, 0 }, /* Simplex table resolutions */ - { 1, 0 }, /* Output dimension combinations */ - {pixint16, 0 }, /* Input pixel representation */ - {pixint16, 0}, /* Output pixel representation */ - {forward, 0} /* Direction (not implemented) */ - } -#else -#ifndef FULL - /* Normal */ - /* * means multiplies combination */ - /* + means lockstep with previous line */ - { - { 1, 3, 4, 8, 0 }, /* Input dimension combinations */ - { 256, 33, 18, 5, 0 }, /* + Interpolation table resolutions */ - { 1, 8, 17, 1, 0 }, /* + Simplex table resolutions */ - { 1, 3, 4, 8, 0 }, /* * Output dimension combinations */ - {pixint8, pixint8, pixint16, 0 }, - /* Input pixel representation (determines precision) */ - {pixint8, pixint16, pixint16, 0 }, - /* + Output pixel representation */ - {forward, 0} /* * Direction (not implemented) */ - } -#else - /* Full set of combinations */ - /* * means multiplies combination */ - /* + means lockstep with previous line */ - { - { 1, 3, 4, 5, 6, 7, 8, 0 }, /* Input dimension combinations */ - { 256, 33, 18, 16, 12, 8, 7, 0 }, /* + Min Interpolation table resolutions */ - { 1, 8, 17, 1, 1, 1, 1, 0 }, /* + Min Simplex table resolutions */ - { 1, 3, 4, 5, 6, 7, 8, 0 }, /* * Output dimension combinations */ - {pixint8, pixint8, pixint16, 0 }, - /* Input pixel representation (determines precision) */ - {pixint8, pixint16, pixint16, 0 }, - /* + Output pixel representation */ - {forward, 0} /* * Direction (not implemented) */ - } -#endif -#endif /* TEST1 */ -}; - -int set_genspec(genspec *gs, gendesc *gd, int comb, mach_arch *a); -void set_architecture(mach_arch *ar); - -struct _knamestr { - char name[100]; - char desc[100]; - struct _knamestr *next; -}; typedef struct _knamestr knamestr; - -knamestr * -new_knamestr(char *name, char *desc) { - knamestr *kn; - - if ((kn = (knamestr *)malloc(sizeof(knamestr))) == NULL) { - fprintf(stderr,"new_knamestr malloc failed\n"); - exit(-1); - } - strcpy(kn->name, name); - strcpy(kn->desc, desc); - kn->next = NULL; - return kn; -} - -void usage(void) { - fprintf(stderr,"Generate imdi kernel code Version %s\n",ARGYLL_VERSION_STR); - fprintf(stderr,"usage: imdi_gen [-i]\n"); - fprintf(stderr," -i Individial Files\n"); - exit(1); -} - -int -main(int argc, char *argv[]) { - int fa,nfa; /* argument we're looking at */ - int indiv = 0; /* Individual files */ - int rv; - int dn, tnd; - genspec gs; - mach_arch ar; - int ix = 1; - knamestr *list = NULL, *lp; - FILE *kcode; /* Kernel routine code file */ - FILE *kheader; /* Kernel routine header file */ - - /* Process the arguments */ - for(fa = 1;fa < argc;fa++) { - nfa = fa; /* skip to nfa if next argument is used */ - if (argv[fa][0] == '-') { /* Look for any flags */ - char *na = NULL; /* next argument after flag, null if none */ - - if (argv[fa][2] != '\000') - na = &argv[fa][2]; /* next is directly after flag */ - else { - if ((fa+1) < argc) { - if (argv[fa+1][0] != '-') { - nfa = fa + 1; - na = argv[nfa]; /* next is seperate non-flag argument */ - } - } - } - - if (argv[fa][1] == '?') - usage(); - - /* Individual files */ - else if (argv[fa][1] == 'i' || argv[fa][1] == 'I') { - indiv = 1; - } - else - usage(); - } else - break; - } - - set_architecture(&ar); - - /* Open the file for kernel routine declaration header */ - if ((kheader = fopen("imdi_k.h", "w")) == NULL) { - fprintf(stderr,"imdi_gen: unable to open file 'imdi_k.h'\n"); - exit(-1); - } - - if (!indiv) { - if ((kcode = fopen("imdi_k.c", "w")) == NULL) { - fprintf(stderr,"imdi_gen: unable to open file 'imdi_k.c'\n"); - exit(-1); - } - } - - tnd = sizeof(descs)/sizeof(gendesc); /* Total number of descriptions */ -#ifdef VERBOSE - printf("Number of descriptions = %d\n",tnd); -#endif /* VERBOSE */ - - fprintf(kheader,"/* Declarations for all the generated kernel functions */\n"); - fprintf(kheader,"/* This file is generated by imdi_gen */\n"); - fprintf(kheader,"\n"); - - /* For all the descriptions */ - for (dn = 0; dn < tnd; dn++) { - int cb, ncb; - - for (cb = 0, ncb = 1; cb < ncb; cb++) { - char ofname[100]; - - /* Compute generate spec */ - ncb = set_genspec(&gs, &descs[dn], cb, &ar); - - if (indiv) { - if ((kcode = fopen(ofname, "w")) == NULL) { - fprintf(stderr,"imdi_gen: unable to open file '%s'\n",ofname); - exit(-1); - } - } - - /* Generate it */ -#ifdef TEST1 - rv = gen_c_kernel(&gs, &ar, kcode, 99); ix++; -#else - rv = gen_c_kernel(&gs, &ar, kcode, ix++); -#endif - if (rv != 0) { - fprintf(stderr,"gen_c_kernel failed with %d\n",rv); - exit(-1); - } - - /* Add the name to the list */ - if (list == NULL) - lp = list = new_knamestr(gs.kname, gs.kdesc); - else { - lp->next = new_knamestr(gs.kname, gs.kdesc); - lp = lp->next; - } - if (indiv) { - if (fclose(kcode) != 0) { - fprintf(stderr,"imdi_gen: unable to close file '%s'\n",ofname); - exit(-1); - } - } - } - } - - /* Include the kernel functions in the header file */ - if (indiv) { - for(lp = list; lp != NULL; lp = lp->next) { - fprintf(kheader,"#include \"%s_%s.c\"\n",lp->name,lp->desc); - } - } else { - fprintf(kheader,"#include \"imdi_k.c\" /* All the kernel code */\n"); - } - fprintf(kheader,"\n"); - - /* Output function table */ - - fprintf(kheader, - "struct {\n" - " void (*interp)(imdi *s, void **outp, void **inp, unsigned int npix);\n" - " void (*gen)(genspec *g);\n" - " void (*tab)(tabspec *t);\n" - "} ktable[%d] = {\n",ix-1); - - for(lp = list; lp != NULL; lp = lp->next) { - fprintf(kheader,"\t{ %s, %s_gen, %s_tab }%s\n", lp->name, lp->name, lp->name, - lp->next != NULL ? "," : ""); - } - fprintf(kheader,"};\n"); - fprintf(kheader,"\n"); - fprintf(kheader,"int no_kfuncs = %d;\n",ix-1); - fprintf(kheader,"\n"); - - if (!indiv) { - if (fclose(kcode) != 0) { - fprintf(stderr,"imdi_gen: unable to close file 'imdi_k.c'\n"); - exit(-1); - } - } - - if (fclose(kheader) != 0) { - fprintf(stderr,"imdi_gen: unable to close file 'imdi_k.h'\n"); - exit(-1); - } - - /* Free the kname list */ - for(lp = list; lp != NULL;) { - char *p = (char *)lp; - lp = lp->next; - free(p); - } - - return 0; -} - -void translate_pixrep(pixlayout *pl, char **desc, int *prec, imdi_pixrep rep, int dim, mach_arch *a); - -/* Translate between a gendesc and genspec */ - -int /* Return number of combinations possible */ -set_genspec( -genspec *gs, /* Return specification */ -gendesc *gd, /* Input description */ -int comb, /* Combination index */ -mach_arch *a /* Machine architecture */ -) { - int nc = 1; /* Number of combinations */ - int nidc, id; /* Number of input dimension combinations, current index */ - int nodc, od; /* Number of output dimension combinations, current index */ - int nirc, ir; /* Number of input representation combinations, current index */ - int norc, or; /* Number of output representation combinations, current index */ - int ndc, dir; /* Number of direction combinations, current index */ - - /* Figure out how many combinations there are */ - for (nidc = 0; gd->idcombs[nidc] != 0; nidc++) /* Input dimension */ - ; - nc *= nidc; - for (nodc = 0; gd->odcombs[nodc] != 0; nodc++) /* Output dimension */ - ; - nc *= nodc; - for (nirc = 0; gd->incombs[nirc] != 0; nirc++) /* Input representation */ - ; - nc *= nirc; - for (norc = 0; gd->outcombs[norc] != 0; norc++) /* Output representation */ - ; - if (nirc != norc) { - fprintf(stderr,"imdi_gen: Must be equal numberof input and output representations\n"); - exit(-1); - } - - for (ndc = 0; gd->dircombs[ndc] != 0; ndc++) /* Direction */ - ; - nc *= ndc; - - if (comb < nc) { /* If we are within a legal combination */ - int iprec, oprec; - char *idesc, *odesc; /* Representation descriptions */ - char *ddesc; /* Direction description */ - - id = comb % nidc; - comb /= nidc; - od = comb % nodc; - comb /= nodc; - ir = comb % nirc; - comb /= nirc; - or = ir; /* In and out combs track together */ - dir = comb % ndc; - comb /= ndc; -#ifdef VERBOSE - printf("Combination id = %d, od = %d, ir = %d, or = %d, dir = %d\n", - id,od,ir,or,dir); -#endif /* VERBOSE */ - - gs->id = gd->idcombs[id]; /* Input dimensions */ - gs->itres = gd->itres[id]; /* Interpolation table resolution */ - gs->stres = gd->stres[id]; /* Simplex table resolution */ - gs->od = gd->odcombs[od]; /* Output dimensions */ - - if (gs->id > IXDI) { - fprintf(stderr,"imdi_gen: Input dimension %d exceeds limit %d\n",gs->id,IXDI); - exit(-1); - } - if (gs->od > IXDO) { - fprintf(stderr,"imdi_gen: Output dimension %d exceeds limit %d\n",gs->od,IXDO); - exit(-1); - } - /* Input representation */ - gs->irep = gd->incombs[ir]; /* Keep a copy of this */ - translate_pixrep(&gs->in, &idesc, &iprec, gd->incombs[ir], gs->id, a); - gs->in_signed = 0x0; /* Not used during generation, used at runtime setup */ - - /* Output representation */ - gs->orep = gd->outcombs[or]; /* Keep a copy of this */ - translate_pixrep(&gs->out, &odesc, &oprec, gd->outcombs[or], gs->od, a); - gs->out_signed = 0x0; /* Not used during generation, used at runtime setup */ - - /* Make native precision the smaller of input and output representation */ - gs->prec = iprec < oprec ? iprec : oprec; - - gs->dir = gd->dircombs[dir]; /* Direction */ - - ddesc = gs->dir == backward ? "b" : "f"; /* Direction description */ - -#ifdef VERBOSE - printf("translates to prec = %d, id = %d, od = %d, itres %d, stdres %d\n", - gs->prec,gs->id,gs->od,gs->itres,gs->stres); -#endif /* VERBOSE */ - - /* Create a concise description string */ - sprintf(gs->kdesc,"%d_%d_%s_%s_%s", gs->id, gs->od, idesc, odesc, ddesc); - } - return nc; -} - -void -translate_pixrep( -pixlayout *pl, /* pixlayout to initialise */ -char **desc, /* Return description identifier */ -int *prec, /* Return basic precision specifier (may be NULL) */ -imdi_pixrep rep, /* Representation to be translated */ -int dim, /* Number of dimensions (values/pixel) */ -mach_arch *a /* Machine architecture */ -) { - switch (rep) { - - case pixint8: { /* 8 Bits per value, pixel interleaved, no padding */ - int i; - - /* Could optimise this to packed for dim == 4 ~~~~ */ - - pl->pint = 1; /* pixel interleaved */ - pl->packed = 0; /* Not packed */ - - for (i = 0; i < dim; i++) { - pl->bpch[i] = 8; /* Bits per channel */ - pl->chi[i] = dim; /* Channel increment */ - pl->bov[i] = 0; /* Bit offset to value within channel */ - pl->bpv[i] = 8; /* Bits per value within channel */ - } - - if (prec != NULL) - *prec = 8; /* Basic 8 bit precision */ - if (desc != NULL) - *desc = "i8"; /* Interleaved 8 bit */ - } break; - - case planeint8: { /* 8 bits per value, plane interleaved */ - int i; - - pl->pint = 0; /* Not pixel interleaved */ - pl->packed = 0; /* Not packed */ - - for (i = 0; i < dim; i++) { - pl->bpch[i] = 8; /* Bits per channel */ - pl->chi[i] = 1; /* Channel increment */ - pl->bov[i] = 0; /* Bit offset to value within channel */ - pl->bpv[i] = 8; /* Bits per value within channel */ - } - - if (prec != NULL) - *prec = 8; /* Basic 8 bit precision */ - if (desc != NULL) - *desc = "p8"; /* Planar 8 bit */ - - } break; - - case pixint16: { /* 16 Bits per value, pixel interleaved, no padding */ - int i; - - /* Could optimise this to packed for dim == 4 ~~~~ */ - - pl->pint = 1; /* pixel interleaved */ - pl->packed = 0; /* Not packed */ - - for (i = 0; i < dim; i++) { - pl->bpch[i] = 16; /* Bits per channel */ - pl->chi[i] = dim; /* Channel increment */ - pl->bov[i] = 0; /* Bit offset to value within channel */ - pl->bpv[i] = 16; /* Bits per value within channel */ - } - - if (prec != NULL) - *prec = 16; /* Basic 8 bit precision */ - if (desc != NULL) - *desc = "i16"; /* Interleaved 16 bit */ - } break; - - case planeint16: { /* 16 bits per value, plane interleaved */ - int i; - - pl->pint = 0; /* Not pixel interleaved */ - pl->packed = 0; /* Not packed */ - - for (i = 0; i < dim; i++) { - pl->bpch[i] = 16; /* Bits per channel */ - pl->chi[i] = 1; /* Channel increment */ - pl->bov[i] = 0; /* Bit offset to value within channel */ - pl->bpv[i] = 16; /* Bits per value within channel */ - } - - if (prec != NULL) - *prec = 16; /* Basic 8 bit precision */ - - if (desc != NULL) - *desc = "p16"; /* Planar 8 bit */ - } break; - - default: { - fprintf(stderr,"Warning: Unknown pixel representation %d\n",rep); - } break; - } -} - -/* Initialse the aritecture structure properly */ -void -set_architecture( -mach_arch *ar -) { - unsigned long etest = 0xff; - - if (*((unsigned char *)&etest) == 0xff) { - ar->bigend = 0; /* Little endian */ - } else { - ar->bigend = 1; /* Big endian endian */ - } - -#ifdef __ppc__ /* Section tunable for PowerPC */ - - ar->uwa = 0; /* Use wide memory access */ - ar->shfm = 0; /* Use shifts to mask values */ - ar->oscale = 8; /* Has scaled indexing up to * 8 */ - ar->smmul = 0; /* Doesn't have fast small multiply for index scaling */ - ar->nords = 3; /* Number of ord types */ - ar->natord = 2; /* Most natural type (assume unsigned int) */ - ar->nints = 3; /* Number of int types */ - ar->natint = 2; /* Most natural type (assume int) */ - - ar->pbits = sizeof(void *) * 8; /* Number of bits in a pointer */ - - ar->ords[0].bits = 8 * sizeof(unsigned char); - ar->ords[0].name = "unsigned char"; - ar->ords[0].align = 1; - - ar->ords[1].bits = 8 * sizeof(unsigned short); - ar->ords[1].name = "unsigned short"; - ar->ords[1].align = 1; - - ar->ords[2].bits = 8 * sizeof(unsigned int); - ar->ords[2].name = "unsigned int"; - ar->ords[2].align = 1; - -#ifdef ALLOW64 - ar->ords[3].bits = 8 * sizeof(unsigned longlong); - ar->ords[3].name = "unsigned " str_longlong ; - ar->ords[3].align = 0; -#endif /* ALLOW64 */ - - ar->ints[0].bits = 8 * sizeof(signed char); - ar->ints[0].name = "signed char"; - ar->ints[0].align = 1; - - ar->ints[1].bits = 8 * sizeof(short); - ar->ints[1].name = "short"; - ar->ints[1].align = 1; - - ar->ints[2].bits = 8 * sizeof(int); - ar->ints[2].name = "int"; - ar->ints[2].align = 1; - -#ifdef ALLOW64 - ar->ints[3].bits = 8 * sizeof(longlong); - ar->ints[3].name = str_longlong ; - ar->ints[3].align = 0; -#endif /* ALLOW64 */ - -#else /* Currently assume x86 type */ - - ar->uwa = 0; /* Use wide memory access */ - ar->shfm = 0; /* Use shifts to mask values */ - ar->oscale = 8; /* Has scaled indexing up to * 8 */ - ar->smmul = 0; /* Doesn't have fast small multiply for index scaling */ -/* ~~99 */ - ar->nords = 3; /* Number of ord types */ - ar->natord = 2; /* Most natural type (assume unsigned int) */ - ar->nints = 3; /* Number of int types */ - ar->natint = 2; /* Most natural type (assume int) */ - - ar->pbits = sizeof(void *) * 8; /* Number of bits in a pointer */ - - ar->ords[0].bits = 8 * sizeof(unsigned char); - ar->ords[0].name = "unsigned char"; - ar->ords[0].align = 1; - - ar->ords[1].bits = 8 * sizeof(unsigned short); - ar->ords[1].name = "unsigned short"; - ar->ords[1].align = 1; - - ar->ords[2].bits = 8 * sizeof(unsigned int); - ar->ords[2].name = "unsigned int"; - ar->ords[2].align = 1; - -#ifdef ALLOW64 - ar->ords[3].bits = 8 * sizeof(unsigned longlong); - ar->ords[3].name = "unsigned " str_longlong ; - ar->ords[3].align = 0; -#endif /* ALLOW64 */ - - ar->ints[0].bits = 8 * sizeof(signed char); - ar->ints[0].name = "signed char"; - ar->ints[0].align = 1; - - ar->ints[1].bits = 8 * sizeof(short); - ar->ints[1].name = "short"; - ar->ints[1].align = 1; - - ar->ints[2].bits = 8 * sizeof(int); - ar->ints[2].name = "int"; - ar->ints[2].align = 1; - -#ifdef ALLOW64 - ar->ints[3].bits = 8 * sizeof(longlong); - ar->ints[3].name = str_longlong ; - ar->ints[3].align = 0; -#endif /* ALLOW64 */ - -#endif /* Processor Architecture */ -} diff --git a/gs/imdi/imdi_gen.h b/gs/imdi/imdi_gen.h deleted file mode 100644 index ee0fde214..000000000 --- a/gs/imdi/imdi_gen.h +++ /dev/null @@ -1,97 +0,0 @@ -#ifndef IMDI_GEN_H -#define IMDI_GEN_H - -/* Integer Multi-Dimensional Interpolation */ -/* - * Copyright 2000 - 2002 Graeme W. Gill - * All rights reserved. - * - * This material is licenced under the GNU GENERAL PUBLIC LICENCE :- - * see the Licence.txt file for licencing details. - */ - -/* Kernel code generation definitions */ - -#include "imdi.h" -#include "arch.h" - -typedef enum { - invalid_dir = 0, - forward = 1, /* 8 Bits per value, pixel interleaved, no padding */ - backward = 2 /* 8 bits per value, plane interleaved */ -} imdi_dir; - -/* -------------------------------------------------- */ -/* High level kernel generation description */ - -/* This sructure allows a series of related kernels to be generated, */ -/* the only variation being the number of input and output dimensions. */ -typedef struct { - int idcombs[10]; /* Input dimension combinations (0 at end) */ - int itres[10]; /* Interpolation table resolutions for each input dimension */ - int stres[10]; /* Simplex table resolutions for each input dimension */ - int odcombs[10]; /* Output dimensions combinations (0 at end) */ - imdi_pixrep incombs[10];/* Input pixel representation combinations */ - imdi_pixrep outcombs[10]; /* Output pixel representation combinations */ - imdi_dir dircombs[10]; /* Direction combinations (not implemented) */ -} gendesc; - -/* -------------------------------------------------- */ -/* Detailed level of generation specification */ - -/* Pixel layout: */ -/* Each channel value is assumed to be read with a */ -/* native machine single read of size bpch, */ -/* and bov and bpv being bit indexes into that value. */ -/* */ -/* If pint == 0, then each read will be of size bpch[], and will */ -/* have its own pointer, will be incremented by chi[]. */ -/* If pint != 0, then the reads will be size bpch[0], from successive */ -/* locations, chi[] apart. */ -/* */ -/* If packed == 0, then separate reads are needed for each input */ -/* channel. */ -/* If packed != 0, then the channel values will be extracted */ -/* from a single read of size bpch[0] */ -/* */ -/* Note that at all times the bit offset and size values */ -/* will be obeyed for each input value. */ - -typedef struct { - int bpch[IXDIDO]; /* Bits per channel read (must be divisible by 8) */ - int chi[IXDIDO]; /* channel increment in multiples of bpch[] (0 == dimensionality) */ - int bov[IXDIDO]; /* Bit offset to value within channel */ - int bpv[IXDIDO]; /* Bits per value within channel */ - int pint; /* Flag - nonz if pixel interleaved (ie. reads from successice locations) */ - int packed; /* Flag - nonz if all channels are packed into a single read */ -} pixlayout; - -/* Structure that specifies the configuration of a generated interpolation kernel. */ -typedef struct { - /* Input to code generator */ - int prec; /* Basic precision:- either 8 or 16 bits, determined by irep */ - int id; /* Number of input dimensions */ - int od; /* Number of output dimensions */ - imdi_pixrep irep;/* Input pixel representation */ - imdi_pixrep orep;/* Output pixel representation */ - int in_signed; /* Bit flag per channel, NZ if treat as signed (runtime setup) */ - int out_signed; /* Bit flag per channel, NZ if treat as signed (runtime setup) */ - pixlayout in; /* Input pixel layout */ - pixlayout out; /* Output pixel layout */ - int dir; /* forward or backward (not implemented */ - int itres; /* Interpolation table resolution */ - int stres; /* Simplex table resolution */ - - /* Returned value */ - char kkeys[100]; /* Kernel keys */ - char kdesc[100]; /* At genspec time */ - char kname[100]; /* At generation time */ -} genspec; - -/* Supported code generators */ - -int gen_c_kernel(genspec *g, mach_arch *a, FILE *fp, int index); /* The 'C' code generator */ - -/* asm, MMX, etc. generators declarations go here ! */ - -#endif /* IMDI_GEN_H */ diff --git a/gs/imdi/imdi_imp.h b/gs/imdi/imdi_imp.h deleted file mode 100644 index cc0b73267..000000000 --- a/gs/imdi/imdi_imp.h +++ /dev/null @@ -1,247 +0,0 @@ -#ifndef IMDI_IMP_H -#define IMDI_IMP_H - -/* Integer Multi-Dimensional Interpolation */ -/* - * Copyright 2000 - 2002 Graeme W. Gill - * All rights reserved. - * - * This material is licenced under the GNU GENERAL PUBLIC LICENCE :- - * see the Licence.txt file for licencing details. - */ - -/* Common implementation definitions */ - -#define IXDI 8 /* maximum input channels/dimensions allowed */ -#define IXDO 8 /* maximum output channels/dimensions allowed */ - -#if IXDI > IXDO /* Maximum of either DI or DO */ -# define IXDIDO IXDI -#else -# define IXDIDO IXDO -#endif - -#define ALLOW64 /* Allow declarations but not use of 64 bit types */ - /* Enabling must be done in architecture setup */ - -#undef USE64 /* Use 64 bit, even on architectures where it's */ - /* not a native size. ALLOW64 must be defined */ - -/* Private run time implementation definitions */ -typedef struct { - /* Table data */ - void *in_tables[IXDI]; /* Input dimension input lookup tables */ - void *sw_table; /* Simplex weighting lookup table */ - void *im_table; /* Interpolation Multi-dimensional lookup table */ - void *out_tables[IXDO]; /* Output dimension output lookup tables */ - int nintabs; /* Number of input tables */ - int nouttabs; /* Number of output tables */ -} imdi_imp; - -/* ------------------------------------------------------- */ -/* Macros combination counter */ -/* Declare the counter name nn, combinations out of total */ -/* Maximum combinations is DI+2 */ - -#define COMBO(nn, comb, total) \ - int nn[IXDI+2]; /* counter value */ \ - int nn##_cmb = (comb); /* number of combinations*/ \ - int nn##_tot = (total); /* out of total possible */ \ - int nn##_e /* dimension index */ - -/* Set total to new setting */ -#define CB_SETT(nn, total) \ - nn##_tot = (total) /* total possible */ - -/* Set combinations to new setting */ -#define CB_SETC(nn, comb) \ - nn##_cmb = (comb) /* number of combinations*/ - -/* Set the counter to its initial value */ -#define CB_INIT(nn) \ -{ \ - for (nn##_e = 0; nn##_e < nn##_cmb; nn##_e++) \ - nn[nn##_e] = nn##_cmb-nn##_e-1; \ - nn##_e = 0; \ -} - -/* Increment the counter value */ -#define CB_INC(nn) \ -{ \ - for (nn##_e = 0; nn##_e < nn##_cmb; nn##_e++) { \ - nn[nn##_e]++; \ - if (nn[nn##_e] < (nn##_tot-nn##_e)) { \ - int nn##_ee; /* No carry */ \ - for (nn##_ee = nn##_e-1; nn##_ee >= 0; nn##_ee--) \ - nn[nn##_ee] = nn[nn##_ee+1] + 1; \ - break; \ - } \ - } \ -} - -/* After increment, expression is TRUE if counter is done */ -#define CB_DONE(nn) \ - (nn##_e >= nn##_cmb) - -/* ------------------------------------------------------- */ -/* Macros simplex combination counter. */ -/* Based on COMBO, but skips invalid simplex combinations */ - -#define XCOMBO(nn, comb, total) \ - COMBO(nn, comb, total) - -/* Set total to new setting */ -#define XCB_SETT(nn, total) \ - CB_SETT(nn, total) - -/* Set combinations to new setting */ -#define XCB_SETC(nn, comb) \ - CB_SETC(nn, comb) - -/* Set the counter to its initial value */ -#define XCB_INIT(nn) \ -{ \ - int nn##_ii; \ - \ - for (nn##_e = 0; nn##_e < nn##_cmb; nn##_e++) \ - nn[nn##_e] = nn##_cmb-nn##_e-1; \ - for (nn##_ii = 1; nn##_ii < nn##_cmb; nn##_ii++) { \ - if ((nn[nn##_ii-1] ^ nn[nn##_ii]) & nn[nn##_ii])\ - break; /* Went from 0 to 1 */ \ - } \ - if (nn##_ii < nn##_cmb) { /* Fix invalid combination */ \ - XCB_INC(nn); \ - } \ - nn##_e = 0; \ -} - -/* Increment the counter value */ -#define XCB_INC(nn) \ -{ \ - int nn##_ii = 0; \ - \ - while (nn##_ii < nn##_cmb) { \ - for (nn##_e = 0; nn##_e < nn##_cmb; nn##_e++) { \ - nn[nn##_e]++; \ - if (nn[nn##_e] < (nn##_tot-nn##_e)) { \ - int nn##_ee; /* No carry */ \ - for (nn##_ee = nn##_e-1; nn##_ee >= 0; nn##_ee--) \ - nn[nn##_ee] = nn[nn##_ee+1] + 1; \ - break; \ - } \ - } \ - if (nn##_e >= nn##_cmb) \ - break; /* Done */ \ - \ - /* Reject invalid combinations */ \ - for (nn##_ii = 1; nn##_ii < nn##_cmb; nn##_ii++) { \ - if ((nn[nn##_ii-1] ^ nn[nn##_ii]) & nn[nn##_ii]) \ - break; /* Went from 0 to 1 */ \ - } \ - } \ -} - -/* After increment, expression is TRUE if counter is done */ -#define XCB_DONE(nn) \ - CB_DONE(nn) - -/* ------------------------------------------------------- */ -/* Macro pseudo-hilbert counter */ -/* This multi-dimensional count sequence is a distributed */ -/* Gray code sequence, with direction reversal on every */ -/* alternate power of 2 scale. */ -/* It is intended to aid cache coherence in multi-dimensional */ -/* regular sampling. It approximates the Hilbert curve sequence. */ - -#define PHILBERT(nn) \ - int nn[IXDIDO];/* counter value */ \ - int nn##di; /* Dimensionality */ \ - unsigned nn##res; /* Resolution per coordinate */ \ - unsigned nn##bits; /* Bits per coordinate */ \ - unsigned nn##ix; /* Current binary index */ \ - unsigned nn##tmask; /* Total 2^n count mask */ \ - unsigned nn##count; /* Usable count */ - -/* Init counter for dimenion di, resolution res */ -#define PH_INIT(nn, pdi, pres) \ -{ \ - int nn##e; \ - \ - nn##di = pdi; \ - nn##res = (unsigned)pres; \ - \ - /* Compute bits */ \ - for (nn##bits = 0; (1 << nn##bits) < nn##res; nn##bits++) \ - ; \ - \ - /* Compute the total count mask */ \ - nn##tmask = ((((unsigned)1) << (nn##bits * nn##di))-1); \ - \ - /* Compute usable count */ \ - nn##count = 1; \ - for (nn##e = 0; nn##e < nn##di; nn##e++) \ - nn##count *= nn##res; \ - \ - nn##ix = 0; \ - for (nn##e = 0; nn##e < nn##di; nn##e++) \ - nn[nn##e] = 0; \ -} - -/* Increment the counter value */ -#define PH_INC(nn) \ -{ \ - int nn##e; \ - do { \ - int nn##b; \ - int nn##gix; /* Gray code index */ \ - \ - nn##ix = (nn##ix + 1) & nn##tmask; \ - \ - /* Convert to gray code index */ \ - nn##gix = nn##ix ^ (nn##ix >> 1); \ - \ - for (nn##e = 0; nn##e < nn##di; nn##e++) \ - nn[nn##e] = 0; \ - \ - /* Distribute bits */ \ - for (nn##b = 0; nn##b < nn##bits; nn##b++) { \ - if (nn##b & 1) { /* In reverse order */ \ - for (nn##e = nn##di-1; nn##e >= 0; nn##e--) { \ - nn[nn##e] |= (nn##gix & 1) << nn##b; \ - nn##gix >>= 1; \ - } \ - } else { /* In normal order */ \ - for (nn##e = 0; nn##e < nn##di; nn##e++) { \ - nn[nn##e] |= (nn##gix & 1) << nn##b; \ - nn##gix >>= 1; \ - } \ - } \ - } \ - \ - /* Convert from Gray to binary coordinates */ \ - for (nn##e = 0; nn##e < nn##di; nn##e++) { \ - unsigned nn##sh, nn##tv; \ - \ - for(nn##sh = 1, nn##tv = nn[nn##e];; nn##sh <<= 1) { \ - unsigned nn##ptv = nn##tv; \ - nn##tv ^= (nn##tv >> nn##sh); \ - if (nn##ptv <= 1 || nn##sh == 16) \ - break; \ - } \ - /* Filter - increment again if outside cube range */ \ - if (nn##tv >= nn##res) \ - break; \ - nn[nn##e] = nn##tv; \ - } \ - \ - } while (nn##e < nn##di); \ - \ -} - -/* After increment, expression is TRUE if counter has looped back to start. */ -#define PH_LOOPED(nn) \ - (nn##ix == 0) \ - -/* ------------------------------------------------------- */ - -#endif /* IMDI_IMP_H */ diff --git a/gs/imdi/imdi_k.c b/gs/imdi/imdi_k.c deleted file mode 100644 index aef567b65..000000000 --- a/gs/imdi/imdi_k.c +++ /dev/null @@ -1,52298 +0,0 @@ -/* 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 = 255 - */ - -/* - 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 <memory.h> -#include "imdi_imp.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)) - -static 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 - -static 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, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x80, 0xdb, 0x83, 0xbf, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0xc0, 0xa6, 0xdc, 0xb7, - 0xff, 0xff, 0x0f, 0x00, 0x51, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x8d, 0xb7, 0xf3, 0xb7, 0xc3, 0xd1, 0xf2, 0xb7, - 0x38, 0x18, 0xf4, 0xb7, 0xc4, 0x1f, 0xf4, 0xb7, - 0xa0, 0xdc, 0x83, 0xbf, 0x08, 0x00, 0x00, 0x00, - 0x4b, 0xa5, 0xf3, 0xb7, 0x34, 0x80, 0x04, 0x08, - 0x07, 0x00, 0x00, 0x00, 0x28, 0xd9, 0x83, 0xbf, - 0x03, 0x00, 0x00, 0x00, 0xae, 0xd9, 0x83, 0xbf, - 0x00, 0xe4, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x34, 0x80, 0x04, 0x08, - 0xd0, 0x85, 0x04, 0x08, 0x4c, 0x69, 0x6e, 0x75, - 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x79, 0x72, - 0x74, 0x6c, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0xff, 0x00, 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, 0x04, 0x08, - 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08, - 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7, - 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7, - 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08, - 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00, - 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7, - 0x2c, 0xf3, 0xdc, 0xb7, 0x31, 0x5f, 0x31, 0x5f, - 0x69, 0x38, 0x5f, 0x69, 0x38, 0x5f, 0x66, 0x00, - 0x8e, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00, - 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf, - 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08, - 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf, - 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01, - 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7, - 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7, - 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08, - 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08, - 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf, - 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7, - 0x00, 0xf0, 0x04, 0x08 - }; /* Structure image */ - - memcpy(g, data, sizeof(data)); /* Initialise the structure */ -} - -static void -imdi_k1_tab( -tabspec *t /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x2c, 0xf3, 0xdc, 0xb7, - 0x08, 0xad, 0xf2, 0xb7, 0xf8, 0xac, 0xf2, 0xb7, - 0x46, 0x83, 0x04, 0x08, 0x50, 0xd5, 0x83, 0xbf, - 0x60, 0x80, 0xf3, 0xb7, 0x46, 0x83, 0x04, 0x08, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0xac, 0x53, 0xdd, 0xb7, - 0xa4, 0xd5, 0x83, 0xbf, 0x00, 0x00, 0x00, 0x00, - 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08, - 0x04, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x09, 0x00, 0x00, 0x00, 0x08, 0x06, 0x00, 0x00, - 0x4e, 0xcb, 0xdd, 0xb7, 0x07, 0x00, 0x00, 0x00, - 0x2c, 0xf3, 0xdc, 0xb7, 0x04, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0xa1, 0xd4, 0xe2, 0xb7, - 0xf4, 0xd5, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0xff, 0xff, 0xff, 0x31, 0x00, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xa0, 0xd6, 0x83, 0xbf, 0x8b, 0x22, 0xe2, 0xb7, - 0xf4, 0xd5, 0x83, 0xbf, 0x52, 0xca, 0x04, 0x08, - 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0x20, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff, - 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff - }; /* Structure image */ - - memcpy(t, data, sizeof(data)); /* Initialise the structure */ -} - -/* 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 = 3 - Input channel 0 bits = 8 - Input channel 0 increment = 3 - Input channel 1 bits = 8 - Input channel 1 increment = 3 - Input channel 2 bits = 8 - Input channel 2 increment = 3 - 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 = 12 - Interpolation table index bits = 20 - Simplex table max resolution = 16 - Interpolation table max resolution = 101 - */ - -/* - 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 <memory.h> -#include "imdi_imp.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 int *)((p) + 0 + (off) * 4)) - -/* Simplex weighting table access */ -#define SW_O(off) ((off) * 16) - -/* Simplex table - get weighting value */ -#define SX_WE(p, v) *((unsigned short *)((p) + (v) * 4 + 0)) - -/* Simplex table - get offset value */ -#define SX_VO(p, v) *((unsigned short *)((p) + (v) * 4 + 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)) - -static void -imdi_k2( -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 * 3 ; - pointer it0 = (pointer)p->in_tables[0]; - pointer it1 = (pointer)p->in_tables[1]; - pointer it2 = (pointer)p->in_tables[2]; - 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 += 3, 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]); - ti += IT_IT(it1, ip0[1]); - ti += IT_IT(it2, ip0[2]); - - imp = im_base + IM_O(ti >> 12); /* Extract interp. index and comp. entry */ - swp = sw_base + SW_O(ti & 0xfff); /* Extract simplex index and comp. entry */ - } - { - unsigned int vof; /* Vertex offset value */ - unsigned int vwe; /* Vertex weighting */ - - vof = SX_VO(swp, 0); /* Read vertex offset value */ - vwe = SX_WE(swp, 0); /* Read vertex weighting value */ - ova0 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof = SX_VO(swp, 1); /* Read vertex offset value */ - vwe = SX_WE(swp, 1); /* Read vertex weighting value */ - ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof = SX_VO(swp, 2); /* Read vertex offset value */ - vwe = SX_WE(swp, 2); /* Read vertex weighting value */ - ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof = SX_VO(swp, 3); /* Read vertex offset value */ - vwe = SX_WE(swp, 3); /* Read vertex 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_WE -#undef SX_VO -#undef IM_O -#undef IM_PE -#undef OT_E - -static void -imdi_k2_gen( -genspec *g /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x08, 0x00, 0x00, 0x00, 0x03, 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, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x80, 0xdb, 0x83, 0xbf, - 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0xff, 0xff, 0x0f, 0x00, 0x51, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x8d, 0xb7, 0xf3, 0xb7, 0xc3, 0xd1, 0xf2, 0xb7, - 0x38, 0x18, 0xf4, 0xb7, 0xc4, 0x1f, 0xf4, 0xb7, - 0xa0, 0xdc, 0x83, 0xbf, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x28, 0xd9, 0x83, 0xbf, - 0x03, 0x00, 0x00, 0x00, 0xae, 0xd9, 0x83, 0xbf, - 0x00, 0xe4, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x34, 0x80, 0x04, 0x08, - 0xd0, 0x85, 0x04, 0x08, 0x4c, 0x69, 0x6e, 0x75, - 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x79, 0x72, - 0x74, 0x6c, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x65, 0x00, 0x00, 0x00, 0x10, 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, 0x04, 0x08, - 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08, - 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7, - 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7, - 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08, - 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00, - 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7, - 0x2c, 0xf3, 0xdc, 0xb7, 0x33, 0x5f, 0x31, 0x5f, - 0x69, 0x38, 0x5f, 0x69, 0x38, 0x5f, 0x66, 0x00, - 0x8e, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00, - 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf, - 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08, - 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf, - 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x32, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01, - 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7, - 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7, - 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08, - 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08, - 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf, - 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7, - 0x00, 0xf0, 0x04, 0x08 - }; /* Structure image */ - - memcpy(g, data, sizeof(data)); /* Initialise the structure */ -} - -static void -imdi_k2_tab( -tabspec *t /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0xf8, 0xac, 0xf2, 0xb7, - 0x46, 0x83, 0x04, 0x08, 0x50, 0xd5, 0x83, 0xbf, - 0x60, 0x80, 0xf3, 0xb7, 0x46, 0x83, 0x04, 0x08, - 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x14, 0x00, 0x00, 0x00, 0xac, 0x53, 0xdd, 0xb7, - 0xa4, 0xd5, 0x83, 0xbf, 0x0c, 0x00, 0x00, 0x00, - 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0xf8, 0xac, 0xf2, 0xb7, - 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0xa1, 0xd4, 0xe2, 0xb7, - 0xf4, 0xd5, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0xff, 0xff, 0xff, 0x31, 0x00, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xa0, 0xd6, 0x83, 0xbf, 0x8b, 0x22, 0xe2, 0xb7, - 0xf4, 0xd5, 0x83, 0xbf, 0x52, 0xca, 0x04, 0x08, - 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0x20, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff, - 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff - }; /* Structure image */ - - memcpy(t, data, sizeof(data)); /* Initialise the structure */ -} - -/* 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 = 4 - Input channel 0 bits = 8 - Input channel 0 increment = 4 - Input channel 1 bits = 8 - Input channel 1 increment = 4 - Input channel 2 bits = 8 - Input channel 2 increment = 4 - Input channel 3 bits = 8 - Input channel 3 increment = 4 - 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 = 32 - Interpolation table index bits = 32 - Simplex table max resolution = 255 - Interpolation table max resolution = 39 - */ - -/* - 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 <memory.h> -#include "imdi_imp.h" -#define IMDI_INCLUDED -#endif /* IMDI_INCLUDED */ - -#ifndef DEFINED_pointer -#define DEFINED_pointer -typedef unsigned char * pointer; -#endif - -/* Input table interp. index */ -#define IT_IX(p, off) *((unsigned int *)((p) + 4 + (off) * 8)) - -/* Input table simplex index enty */ -#define IT_SX(p, off) *((unsigned int *)((p) + 0 + (off) * 8)) - -/* Simplex weighting table access */ -#define SW_O(off) ((off) * 20) - -/* Simplex table - get weighting value */ -#define SX_WE(p, v) *((unsigned short *)((p) + (v) * 4 + 0)) - -/* Simplex table - get offset value */ -#define SX_VO(p, v) *((unsigned short *)((p) + (v) * 4 + 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)) - -static void -imdi_k3( -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 * 4 ; - pointer it0 = (pointer)p->in_tables[0]; - pointer it1 = (pointer)p->in_tables[1]; - pointer it2 = (pointer)p->in_tables[2]; - pointer it3 = (pointer)p->in_tables[3]; - 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 += 4, op0 += 1) { - unsigned int ova0; /* Output value partial accumulator */ - { - pointer swp; - pointer imp; - { - unsigned int ti_s; /* Simplex index variable */ - unsigned int ti_i; /* Interpolation index variable */ - - ti_i = IT_IX(it0, ip0[0]); - ti_s = IT_SX(it0, ip0[0]); - ti_i += IT_IX(it1, ip0[1]); - ti_s += IT_SX(it1, ip0[1]); - ti_i += IT_IX(it2, ip0[2]); - ti_s += IT_SX(it2, ip0[2]); - ti_i += IT_IX(it3, ip0[3]); - ti_s += IT_SX(it3, ip0[3]); - - swp = sw_base + SW_O(ti_s); /* Compute simplex table entry pointer */ - imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */ - } - { - unsigned int vof; /* Vertex offset value */ - unsigned int vwe; /* Vertex weighting */ - - vof = SX_VO(swp, 0); /* Read vertex offset value */ - vwe = SX_WE(swp, 0); /* Read vertex weighting value */ - ova0 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof = SX_VO(swp, 1); /* Read vertex offset value */ - vwe = SX_WE(swp, 1); /* Read vertex weighting value */ - ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof = SX_VO(swp, 2); /* Read vertex offset value */ - vwe = SX_WE(swp, 2); /* Read vertex weighting value */ - ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof = SX_VO(swp, 3); /* Read vertex offset value */ - vwe = SX_WE(swp, 3); /* Read vertex weighting value */ - ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof = SX_VO(swp, 4); /* Read vertex offset value */ - vwe = SX_WE(swp, 4); /* Read vertex 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_IX -#undef IT_SX -#undef SW_O -#undef SX_WE -#undef SX_VO -#undef IM_O -#undef IM_PE -#undef OT_E - -static void -imdi_k3_gen( -genspec *g /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x08, 0x00, 0x00, 0x00, 0x04, 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, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x80, 0xdb, 0x83, 0xbf, - 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x51, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0xc3, 0xd1, 0xf2, 0xb7, - 0x38, 0x18, 0xf4, 0xb7, 0xc4, 0x1f, 0xf4, 0xb7, - 0xa0, 0xdc, 0x83, 0xbf, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x28, 0xd9, 0x83, 0xbf, - 0x03, 0x00, 0x00, 0x00, 0xae, 0xd9, 0x83, 0xbf, - 0x00, 0xe4, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x34, 0x80, 0x04, 0x08, - 0xd0, 0x85, 0x04, 0x08, 0x4c, 0x69, 0x6e, 0x75, - 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x79, 0x72, - 0x74, 0x6c, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x27, 0x00, 0x00, 0x00, 0xff, 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, 0x04, 0x08, - 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08, - 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7, - 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7, - 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08, - 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00, - 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7, - 0x2c, 0xf3, 0xdc, 0xb7, 0x34, 0x5f, 0x31, 0x5f, - 0x69, 0x38, 0x5f, 0x69, 0x38, 0x5f, 0x66, 0x00, - 0x8e, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00, - 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf, - 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08, - 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf, - 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x33, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01, - 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7, - 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7, - 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08, - 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08, - 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf, - 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7, - 0x00, 0xf0, 0x04, 0x08 - }; /* Structure image */ - - memcpy(g, data, sizeof(data)); /* Initialise the structure */ -} - -static void -imdi_k3_tab( -tabspec *t /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x46, 0x83, 0x04, 0x08, 0x50, 0xd5, 0x83, 0xbf, - 0x60, 0x80, 0xf3, 0xb7, 0x46, 0x83, 0x04, 0x08, - 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x14, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0xf8, 0xac, 0xf2, 0xb7, - 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0xa1, 0xd4, 0xe2, 0xb7, - 0xf4, 0xd5, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0xff, 0xff, 0xff, 0x31, 0x00, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xa0, 0xd6, 0x83, 0xbf, 0x8b, 0x22, 0xe2, 0xb7, - 0xf4, 0xd5, 0x83, 0xbf, 0x52, 0xca, 0x04, 0x08, - 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0x20, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff, - 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff - }; /* Structure image */ - - memcpy(t, data, sizeof(data)); /* Initialise the structure */ -} - -/* 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 = 5 - Input channel 0 bits = 8 - Input channel 0 increment = 5 - Input channel 1 bits = 8 - Input channel 1 increment = 5 - Input channel 2 bits = 8 - Input channel 2 increment = 5 - Input channel 3 bits = 8 - Input channel 3 increment = 5 - Input channel 4 bits = 8 - Input channel 4 increment = 5 - 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 - Weight+voffset bits = 32 - Interpolation table index bits = 32 - Interpolation table max resolution = 53 - */ - -/* - 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 <memory.h> -#include "imdi_imp.h" -#define IMDI_INCLUDED -#endif /* IMDI_INCLUDED */ - -#ifndef DEFINED_pointer -#define DEFINED_pointer -typedef unsigned char * pointer; -#endif - -/* Input table interp. index */ -#define IT_IX(p, off) *((unsigned int *)((p) + 0 + (off) * 8)) - -/* Input table input weighting/offset value enty */ -#define IT_WO(p, off) *((unsigned int *)((p) + 4 + (off) * 8)) - -/* Conditional exchange for sorting */ -#define CEX(A, B) if (A < B) { A ^= B; B ^= A; A ^= B; } - -/* 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)) - -static void -imdi_k4( -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 * 5 ; - pointer it0 = (pointer)p->in_tables[0]; - pointer it1 = (pointer)p->in_tables[1]; - pointer it2 = (pointer)p->in_tables[2]; - pointer it3 = (pointer)p->in_tables[3]; - pointer it4 = (pointer)p->in_tables[4]; - pointer ot0 = (pointer)p->out_tables[0]; - pointer im_base = (pointer)p->im_table; - - for(;ip0 < ep; ip0 += 5, op0 += 1) { - unsigned int ova0; /* Output value partial accumulator */ - { - pointer imp; - unsigned int wo0; /* Weighting value and vertex offset variable */ - unsigned int wo1; /* Weighting value and vertex offset variable */ - unsigned int wo2; /* Weighting value and vertex offset variable */ - unsigned int wo3; /* Weighting value and vertex offset variable */ - unsigned int wo4; /* Weighting value and vertex offset variable */ - { - unsigned int ti_i; /* Interpolation index variable */ - - ti_i = IT_IX(it0, ip0[0]); - wo0 = IT_WO(it0, ip0[0]); - ti_i += IT_IX(it1, ip0[1]); - wo1 = IT_WO(it1, ip0[1]); - ti_i += IT_IX(it2, ip0[2]); - wo2 = IT_WO(it2, ip0[2]); - ti_i += IT_IX(it3, ip0[3]); - wo3 = IT_WO(it3, ip0[3]); - ti_i += IT_IX(it4, ip0[4]); - wo4 = IT_WO(it4, ip0[4]); - - imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */ - - /* Sort weighting values and vertex offset values */ - CEX(wo0, wo1); - CEX(wo0, wo2); - CEX(wo0, wo3); - CEX(wo0, wo4); - CEX(wo1, wo2); - CEX(wo1, wo3); - CEX(wo1, wo4); - CEX(wo2, wo3); - CEX(wo2, wo4); - CEX(wo3, wo4); - } - { - unsigned int nvof; /* Next vertex offset value */ - unsigned int vof; /* Vertex offset value */ - unsigned int vwe; /* Vertex weighting */ - - vof = 0; /* First vertex offset is 0 */ - nvof = (wo0 & 0x7fffff); /* Extract offset value */ - wo0 = (wo0 >> 23); /* Extract weighting value */ - vwe = 256 - wo0; /* Baricentric weighting */ - ova0 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo1 & 0x7fffff); /* Extract offset value */ - wo1 = (wo1 >> 23); /* Extract weighting value */ - vwe = wo0 - wo1; /* Baricentric weighting */ - ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo2 & 0x7fffff); /* Extract offset value */ - wo2 = (wo2 >> 23); /* Extract weighting value */ - vwe = wo1 - wo2; /* Baricentric weighting */ - ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo3 & 0x7fffff); /* Extract offset value */ - wo3 = (wo3 >> 23); /* Extract weighting value */ - vwe = wo2 - wo3; /* Baricentric weighting */ - ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo4 & 0x7fffff); /* Extract offset value */ - wo4 = (wo4 >> 23); /* Extract weighting value */ - vwe = wo3 - wo4; /* Baricentric weighting */ - ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - vwe = wo4; /* Baricentric weighting */ - 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_WO -#undef IT_IX -#undef CEX -#undef IM_O -#undef IM_PE -#undef OT_E - -static void -imdi_k4_gen( -genspec *g /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x08, 0x00, 0x00, 0x00, 0x05, 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, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x80, 0xdb, 0x83, 0xbf, - 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x38, 0x18, 0xf4, 0xb7, 0xc4, 0x1f, 0xf4, 0xb7, - 0xa0, 0xdc, 0x83, 0xbf, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0xae, 0xd9, 0x83, 0xbf, - 0x00, 0xe4, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x34, 0x80, 0x04, 0x08, - 0xd0, 0x85, 0x04, 0x08, 0x4c, 0x69, 0x6e, 0x75, - 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x79, 0x72, - 0x74, 0x6c, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x35, 0x00, 0x00, 0x00, 0x00, 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, 0x04, 0x08, - 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08, - 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7, - 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7, - 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08, - 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00, - 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7, - 0x2c, 0xf3, 0xdc, 0xb7, 0x35, 0x5f, 0x31, 0x5f, - 0x69, 0x38, 0x5f, 0x69, 0x38, 0x5f, 0x66, 0x00, - 0x8e, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00, - 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf, - 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08, - 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf, - 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x34, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01, - 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7, - 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7, - 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08, - 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08, - 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf, - 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7, - 0x00, 0xf0, 0x04, 0x08 - }; /* Structure image */ - - memcpy(g, data, sizeof(data)); /* Initialise the structure */ -} - -static void -imdi_k4_tab( -tabspec *t /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x50, 0xd5, 0x83, 0xbf, - 0x60, 0x80, 0xf3, 0xb7, 0x46, 0x83, 0x04, 0x08, - 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0xa1, 0xd4, 0xe2, 0xb7, - 0xf4, 0xd5, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0xff, 0xff, 0xff, 0x31, 0x00, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xa0, 0xd6, 0x83, 0xbf, 0x8b, 0x22, 0xe2, 0xb7, - 0xf4, 0xd5, 0x83, 0xbf, 0x52, 0xca, 0x04, 0x08, - 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0x20, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff, - 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff - }; /* Structure image */ - - memcpy(t, data, sizeof(data)); /* Initialise the structure */ -} - -/* 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 = 6 - Input channel 0 bits = 8 - Input channel 0 increment = 6 - Input channel 1 bits = 8 - Input channel 1 increment = 6 - Input channel 2 bits = 8 - Input channel 2 increment = 6 - Input channel 3 bits = 8 - Input channel 3 increment = 6 - Input channel 4 bits = 8 - Input channel 4 increment = 6 - Input channel 5 bits = 8 - Input channel 5 increment = 6 - 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 - Weight+voffset bits = 32 - Interpolation table index bits = 32 - Interpolation table max resolution = 24 - */ - -/* - 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 <memory.h> -#include "imdi_imp.h" -#define IMDI_INCLUDED -#endif /* IMDI_INCLUDED */ - -#ifndef DEFINED_pointer -#define DEFINED_pointer -typedef unsigned char * pointer; -#endif - -/* Input table interp. index */ -#define IT_IX(p, off) *((unsigned int *)((p) + 0 + (off) * 8)) - -/* Input table input weighting/offset value enty */ -#define IT_WO(p, off) *((unsigned int *)((p) + 4 + (off) * 8)) - -/* Conditional exchange for sorting */ -#define CEX(A, B) if (A < B) { A ^= B; B ^= A; A ^= B; } - -/* 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)) - -static void -imdi_k5( -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 * 6 ; - pointer it0 = (pointer)p->in_tables[0]; - pointer it1 = (pointer)p->in_tables[1]; - pointer it2 = (pointer)p->in_tables[2]; - pointer it3 = (pointer)p->in_tables[3]; - pointer it4 = (pointer)p->in_tables[4]; - pointer it5 = (pointer)p->in_tables[5]; - pointer ot0 = (pointer)p->out_tables[0]; - pointer im_base = (pointer)p->im_table; - - for(;ip0 < ep; ip0 += 6, op0 += 1) { - unsigned int ova0; /* Output value partial accumulator */ - { - pointer imp; - unsigned int wo0; /* Weighting value and vertex offset variable */ - unsigned int wo1; /* Weighting value and vertex offset variable */ - unsigned int wo2; /* Weighting value and vertex offset variable */ - unsigned int wo3; /* Weighting value and vertex offset variable */ - unsigned int wo4; /* Weighting value and vertex offset variable */ - unsigned int wo5; /* Weighting value and vertex offset variable */ - { - unsigned int ti_i; /* Interpolation index variable */ - - ti_i = IT_IX(it0, ip0[0]); - wo0 = IT_WO(it0, ip0[0]); - ti_i += IT_IX(it1, ip0[1]); - wo1 = IT_WO(it1, ip0[1]); - ti_i += IT_IX(it2, ip0[2]); - wo2 = IT_WO(it2, ip0[2]); - ti_i += IT_IX(it3, ip0[3]); - wo3 = IT_WO(it3, ip0[3]); - ti_i += IT_IX(it4, ip0[4]); - wo4 = IT_WO(it4, ip0[4]); - ti_i += IT_IX(it5, ip0[5]); - wo5 = IT_WO(it5, ip0[5]); - - imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */ - - /* Sort weighting values and vertex offset values */ - CEX(wo0, wo1); - CEX(wo0, wo2); - CEX(wo0, wo3); - CEX(wo0, wo4); - CEX(wo0, wo5); - CEX(wo1, wo2); - CEX(wo1, wo3); - CEX(wo1, wo4); - CEX(wo1, wo5); - CEX(wo2, wo3); - CEX(wo2, wo4); - CEX(wo2, wo5); - CEX(wo3, wo4); - CEX(wo3, wo5); - CEX(wo4, wo5); - } - { - unsigned int nvof; /* Next vertex offset value */ - unsigned int vof; /* Vertex offset value */ - unsigned int vwe; /* Vertex weighting */ - - vof = 0; /* First vertex offset is 0 */ - nvof = (wo0 & 0x7fffff); /* Extract offset value */ - wo0 = (wo0 >> 23); /* Extract weighting value */ - vwe = 256 - wo0; /* Baricentric weighting */ - ova0 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo1 & 0x7fffff); /* Extract offset value */ - wo1 = (wo1 >> 23); /* Extract weighting value */ - vwe = wo0 - wo1; /* Baricentric weighting */ - ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo2 & 0x7fffff); /* Extract offset value */ - wo2 = (wo2 >> 23); /* Extract weighting value */ - vwe = wo1 - wo2; /* Baricentric weighting */ - ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo3 & 0x7fffff); /* Extract offset value */ - wo3 = (wo3 >> 23); /* Extract weighting value */ - vwe = wo2 - wo3; /* Baricentric weighting */ - ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo4 & 0x7fffff); /* Extract offset value */ - wo4 = (wo4 >> 23); /* Extract weighting value */ - vwe = wo3 - wo4; /* Baricentric weighting */ - ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo5 & 0x7fffff); /* Extract offset value */ - wo5 = (wo5 >> 23); /* Extract weighting value */ - vwe = wo4 - wo5; /* Baricentric weighting */ - ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - vwe = wo5; /* Baricentric weighting */ - 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_WO -#undef IT_IX -#undef CEX -#undef IM_O -#undef IM_PE -#undef OT_E - -static void -imdi_k5_gen( -genspec *g /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x08, 0x00, 0x00, 0x00, 0x06, 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, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x80, 0xdb, 0x83, 0xbf, - 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0xc4, 0x1f, 0xf4, 0xb7, - 0xa0, 0xdc, 0x83, 0xbf, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0xae, 0xd9, 0x83, 0xbf, - 0x00, 0xe4, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x34, 0x80, 0x04, 0x08, - 0xd0, 0x85, 0x04, 0x08, 0x4c, 0x69, 0x6e, 0x75, - 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x79, 0x72, - 0x74, 0x6c, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x18, 0x00, 0x00, 0x00, 0x00, 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, 0x04, 0x08, - 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08, - 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7, - 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7, - 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08, - 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00, - 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7, - 0x2c, 0xf3, 0xdc, 0xb7, 0x36, 0x5f, 0x31, 0x5f, - 0x69, 0x38, 0x5f, 0x69, 0x38, 0x5f, 0x66, 0x00, - 0x8e, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00, - 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf, - 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08, - 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf, - 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x35, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01, - 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7, - 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7, - 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08, - 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08, - 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf, - 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7, - 0x00, 0xf0, 0x04, 0x08 - }; /* Structure image */ - - memcpy(g, data, sizeof(data)); /* Initialise the structure */ -} - -static void -imdi_k5_tab( -tabspec *t /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x60, 0x80, 0xf3, 0xb7, 0x46, 0x83, 0x04, 0x08, - 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0xa1, 0xd4, 0xe2, 0xb7, - 0xf4, 0xd5, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0xff, 0xff, 0xff, 0x31, 0x00, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xa0, 0xd6, 0x83, 0xbf, 0x8b, 0x22, 0xe2, 0xb7, - 0xf4, 0xd5, 0x83, 0xbf, 0x52, 0xca, 0x04, 0x08, - 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0x20, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff, - 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff - }; /* Structure image */ - - memcpy(t, data, sizeof(data)); /* Initialise the structure */ -} - -/* 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 = 7 - Input channel 0 bits = 8 - Input channel 0 increment = 7 - Input channel 1 bits = 8 - Input channel 1 increment = 7 - Input channel 2 bits = 8 - Input channel 2 increment = 7 - Input channel 3 bits = 8 - Input channel 3 increment = 7 - Input channel 4 bits = 8 - Input channel 4 increment = 7 - Input channel 5 bits = 8 - Input channel 5 increment = 7 - Input channel 6 bits = 8 - Input channel 6 increment = 7 - 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 - Weight+voffset bits = 32 - Interpolation table index bits = 32 - Interpolation table max resolution = 14 - */ - -/* - 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 <memory.h> -#include "imdi_imp.h" -#define IMDI_INCLUDED -#endif /* IMDI_INCLUDED */ - -#ifndef DEFINED_pointer -#define DEFINED_pointer -typedef unsigned char * pointer; -#endif - -/* Input table interp. index */ -#define IT_IX(p, off) *((unsigned int *)((p) + 0 + (off) * 8)) - -/* Input table input weighting/offset value enty */ -#define IT_WO(p, off) *((unsigned int *)((p) + 4 + (off) * 8)) - -/* Conditional exchange for sorting */ -#define CEX(A, B) if (A < B) { A ^= B; B ^= A; A ^= B; } - -/* 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)) - -static void -imdi_k6( -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 * 7 ; - pointer it0 = (pointer)p->in_tables[0]; - pointer it1 = (pointer)p->in_tables[1]; - pointer it2 = (pointer)p->in_tables[2]; - pointer it3 = (pointer)p->in_tables[3]; - pointer it4 = (pointer)p->in_tables[4]; - pointer it5 = (pointer)p->in_tables[5]; - pointer it6 = (pointer)p->in_tables[6]; - pointer ot0 = (pointer)p->out_tables[0]; - pointer im_base = (pointer)p->im_table; - - for(;ip0 < ep; ip0 += 7, op0 += 1) { - unsigned int ova0; /* Output value partial accumulator */ - { - pointer imp; - unsigned int wo0; /* Weighting value and vertex offset variable */ - unsigned int wo1; /* Weighting value and vertex offset variable */ - unsigned int wo2; /* Weighting value and vertex offset variable */ - unsigned int wo3; /* Weighting value and vertex offset variable */ - unsigned int wo4; /* Weighting value and vertex offset variable */ - unsigned int wo5; /* Weighting value and vertex offset variable */ - unsigned int wo6; /* Weighting value and vertex offset variable */ - { - unsigned int ti_i; /* Interpolation index variable */ - - ti_i = IT_IX(it0, ip0[0]); - wo0 = IT_WO(it0, ip0[0]); - ti_i += IT_IX(it1, ip0[1]); - wo1 = IT_WO(it1, ip0[1]); - ti_i += IT_IX(it2, ip0[2]); - wo2 = IT_WO(it2, ip0[2]); - ti_i += IT_IX(it3, ip0[3]); - wo3 = IT_WO(it3, ip0[3]); - ti_i += IT_IX(it4, ip0[4]); - wo4 = IT_WO(it4, ip0[4]); - ti_i += IT_IX(it5, ip0[5]); - wo5 = IT_WO(it5, ip0[5]); - ti_i += IT_IX(it6, ip0[6]); - wo6 = IT_WO(it6, ip0[6]); - - imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */ - - /* Sort weighting values and vertex offset values */ - CEX(wo0, wo1); - CEX(wo0, wo2); - CEX(wo0, wo3); - CEX(wo0, wo4); - CEX(wo0, wo5); - CEX(wo0, wo6); - CEX(wo1, wo2); - CEX(wo1, wo3); - CEX(wo1, wo4); - CEX(wo1, wo5); - CEX(wo1, wo6); - CEX(wo2, wo3); - CEX(wo2, wo4); - CEX(wo2, wo5); - CEX(wo2, wo6); - CEX(wo3, wo4); - CEX(wo3, wo5); - CEX(wo3, wo6); - CEX(wo4, wo5); - CEX(wo4, wo6); - CEX(wo5, wo6); - } - { - unsigned int nvof; /* Next vertex offset value */ - unsigned int vof; /* Vertex offset value */ - unsigned int vwe; /* Vertex weighting */ - - vof = 0; /* First vertex offset is 0 */ - nvof = (wo0 & 0x7fffff); /* Extract offset value */ - wo0 = (wo0 >> 23); /* Extract weighting value */ - vwe = 256 - wo0; /* Baricentric weighting */ - ova0 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo1 & 0x7fffff); /* Extract offset value */ - wo1 = (wo1 >> 23); /* Extract weighting value */ - vwe = wo0 - wo1; /* Baricentric weighting */ - ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo2 & 0x7fffff); /* Extract offset value */ - wo2 = (wo2 >> 23); /* Extract weighting value */ - vwe = wo1 - wo2; /* Baricentric weighting */ - ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo3 & 0x7fffff); /* Extract offset value */ - wo3 = (wo3 >> 23); /* Extract weighting value */ - vwe = wo2 - wo3; /* Baricentric weighting */ - ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo4 & 0x7fffff); /* Extract offset value */ - wo4 = (wo4 >> 23); /* Extract weighting value */ - vwe = wo3 - wo4; /* Baricentric weighting */ - ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo5 & 0x7fffff); /* Extract offset value */ - wo5 = (wo5 >> 23); /* Extract weighting value */ - vwe = wo4 - wo5; /* Baricentric weighting */ - ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo6 & 0x7fffff); /* Extract offset value */ - wo6 = (wo6 >> 23); /* Extract weighting value */ - vwe = wo5 - wo6; /* Baricentric weighting */ - ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - vwe = wo6; /* Baricentric weighting */ - 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_WO -#undef IT_IX -#undef CEX -#undef IM_O -#undef IM_PE -#undef OT_E - -static void -imdi_k6_gen( -genspec *g /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x08, 0x00, 0x00, 0x00, 0x07, 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, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xa0, 0xdc, 0x83, 0xbf, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x00, 0xe4, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x34, 0x80, 0x04, 0x08, - 0xd0, 0x85, 0x04, 0x08, 0x4c, 0x69, 0x6e, 0x75, - 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x79, 0x72, - 0x74, 0x6c, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x0e, 0x00, 0x00, 0x00, 0x00, 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, 0x04, 0x08, - 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08, - 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7, - 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7, - 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08, - 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00, - 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7, - 0x2c, 0xf3, 0xdc, 0xb7, 0x37, 0x5f, 0x31, 0x5f, - 0x69, 0x38, 0x5f, 0x69, 0x38, 0x5f, 0x66, 0x00, - 0x8e, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00, - 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf, - 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08, - 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf, - 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x36, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01, - 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7, - 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7, - 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08, - 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08, - 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf, - 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7, - 0x00, 0xf0, 0x04, 0x08 - }; /* Structure image */ - - memcpy(g, data, sizeof(data)); /* Initialise the structure */ -} - -static void -imdi_k6_tab( -tabspec *t /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x46, 0x83, 0x04, 0x08, - 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0xa1, 0xd4, 0xe2, 0xb7, - 0xf4, 0xd5, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0xff, 0xff, 0xff, 0x31, 0x00, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xa0, 0xd6, 0x83, 0xbf, 0x8b, 0x22, 0xe2, 0xb7, - 0xf4, 0xd5, 0x83, 0xbf, 0x52, 0xca, 0x04, 0x08, - 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0x20, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff, - 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff - }; /* Structure image */ - - memcpy(t, data, sizeof(data)); /* Initialise the structure */ -} - -/* 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 = 8 - Input channel 0 bits = 8 - Input channel 0 increment = 8 - Input channel 1 bits = 8 - Input channel 1 increment = 8 - Input channel 2 bits = 8 - Input channel 2 increment = 8 - Input channel 3 bits = 8 - Input channel 3 increment = 8 - Input channel 4 bits = 8 - Input channel 4 increment = 8 - Input channel 5 bits = 8 - Input channel 5 increment = 8 - Input channel 6 bits = 8 - Input channel 6 increment = 8 - Input channel 7 bits = 8 - Input channel 7 increment = 8 - 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 - Weight+voffset bits = 32 - Interpolation table index bits = 32 - Interpolation table max resolution = 9 - */ - -/* - 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 <memory.h> -#include "imdi_imp.h" -#define IMDI_INCLUDED -#endif /* IMDI_INCLUDED */ - -#ifndef DEFINED_pointer -#define DEFINED_pointer -typedef unsigned char * pointer; -#endif - -/* Input table interp. index */ -#define IT_IX(p, off) *((unsigned int *)((p) + 0 + (off) * 8)) - -/* Input table input weighting/offset value enty */ -#define IT_WO(p, off) *((unsigned int *)((p) + 4 + (off) * 8)) - -/* Conditional exchange for sorting */ -#define CEX(A, B) if (A < B) { A ^= B; B ^= A; A ^= B; } - -/* 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)) - -static void -imdi_k7( -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 * 8 ; - pointer it0 = (pointer)p->in_tables[0]; - pointer it1 = (pointer)p->in_tables[1]; - pointer it2 = (pointer)p->in_tables[2]; - pointer it3 = (pointer)p->in_tables[3]; - pointer it4 = (pointer)p->in_tables[4]; - pointer it5 = (pointer)p->in_tables[5]; - pointer it6 = (pointer)p->in_tables[6]; - pointer it7 = (pointer)p->in_tables[7]; - pointer ot0 = (pointer)p->out_tables[0]; - pointer im_base = (pointer)p->im_table; - - for(;ip0 < ep; ip0 += 8, op0 += 1) { - unsigned int ova0; /* Output value partial accumulator */ - { - pointer imp; - unsigned int wo0; /* Weighting value and vertex offset variable */ - unsigned int wo1; /* Weighting value and vertex offset variable */ - unsigned int wo2; /* Weighting value and vertex offset variable */ - unsigned int wo3; /* Weighting value and vertex offset variable */ - unsigned int wo4; /* Weighting value and vertex offset variable */ - unsigned int wo5; /* Weighting value and vertex offset variable */ - unsigned int wo6; /* Weighting value and vertex offset variable */ - unsigned int wo7; /* Weighting value and vertex offset variable */ - { - unsigned int ti_i; /* Interpolation index variable */ - - ti_i = IT_IX(it0, ip0[0]); - wo0 = IT_WO(it0, ip0[0]); - ti_i += IT_IX(it1, ip0[1]); - wo1 = IT_WO(it1, ip0[1]); - ti_i += IT_IX(it2, ip0[2]); - wo2 = IT_WO(it2, ip0[2]); - ti_i += IT_IX(it3, ip0[3]); - wo3 = IT_WO(it3, ip0[3]); - ti_i += IT_IX(it4, ip0[4]); - wo4 = IT_WO(it4, ip0[4]); - ti_i += IT_IX(it5, ip0[5]); - wo5 = IT_WO(it5, ip0[5]); - ti_i += IT_IX(it6, ip0[6]); - wo6 = IT_WO(it6, ip0[6]); - ti_i += IT_IX(it7, ip0[7]); - wo7 = IT_WO(it7, ip0[7]); - - imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */ - - /* Sort weighting values and vertex offset values */ - CEX(wo0, wo1); - CEX(wo0, wo2); - CEX(wo0, wo3); - CEX(wo0, wo4); - CEX(wo0, wo5); - CEX(wo0, wo6); - CEX(wo0, wo7); - CEX(wo1, wo2); - CEX(wo1, wo3); - CEX(wo1, wo4); - CEX(wo1, wo5); - CEX(wo1, wo6); - CEX(wo1, wo7); - CEX(wo2, wo3); - CEX(wo2, wo4); - CEX(wo2, wo5); - CEX(wo2, wo6); - CEX(wo2, wo7); - CEX(wo3, wo4); - CEX(wo3, wo5); - CEX(wo3, wo6); - CEX(wo3, wo7); - CEX(wo4, wo5); - CEX(wo4, wo6); - CEX(wo4, wo7); - CEX(wo5, wo6); - CEX(wo5, wo7); - CEX(wo6, wo7); - } - { - unsigned int nvof; /* Next vertex offset value */ - unsigned int vof; /* Vertex offset value */ - unsigned int vwe; /* Vertex weighting */ - - vof = 0; /* First vertex offset is 0 */ - nvof = (wo0 & 0x7fffff); /* Extract offset value */ - wo0 = (wo0 >> 23); /* Extract weighting value */ - vwe = 256 - wo0; /* Baricentric weighting */ - ova0 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo1 & 0x7fffff); /* Extract offset value */ - wo1 = (wo1 >> 23); /* Extract weighting value */ - vwe = wo0 - wo1; /* Baricentric weighting */ - ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo2 & 0x7fffff); /* Extract offset value */ - wo2 = (wo2 >> 23); /* Extract weighting value */ - vwe = wo1 - wo2; /* Baricentric weighting */ - ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo3 & 0x7fffff); /* Extract offset value */ - wo3 = (wo3 >> 23); /* Extract weighting value */ - vwe = wo2 - wo3; /* Baricentric weighting */ - ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo4 & 0x7fffff); /* Extract offset value */ - wo4 = (wo4 >> 23); /* Extract weighting value */ - vwe = wo3 - wo4; /* Baricentric weighting */ - ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo5 & 0x7fffff); /* Extract offset value */ - wo5 = (wo5 >> 23); /* Extract weighting value */ - vwe = wo4 - wo5; /* Baricentric weighting */ - ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo6 & 0x7fffff); /* Extract offset value */ - wo6 = (wo6 >> 23); /* Extract weighting value */ - vwe = wo5 - wo6; /* Baricentric weighting */ - ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo7 & 0x7fffff); /* Extract offset value */ - wo7 = (wo7 >> 23); /* Extract weighting value */ - vwe = wo6 - wo7; /* Baricentric weighting */ - ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - vwe = wo7; /* Baricentric weighting */ - 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_WO -#undef IT_IX -#undef CEX -#undef IM_O -#undef IM_PE -#undef OT_E - -static void -imdi_k7_gen( -genspec *g /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x08, 0x00, 0x00, 0x00, 0x08, 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, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x34, 0x80, 0x04, 0x08, - 0xd0, 0x85, 0x04, 0x08, 0x4c, 0x69, 0x6e, 0x75, - 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x79, 0x72, - 0x74, 0x6c, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x09, 0x00, 0x00, 0x00, 0x00, 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, 0x04, 0x08, - 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08, - 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7, - 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7, - 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08, - 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00, - 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7, - 0x2c, 0xf3, 0xdc, 0xb7, 0x38, 0x5f, 0x31, 0x5f, - 0x69, 0x38, 0x5f, 0x69, 0x38, 0x5f, 0x66, 0x00, - 0x8e, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00, - 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf, - 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08, - 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf, - 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x37, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01, - 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7, - 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7, - 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08, - 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08, - 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf, - 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7, - 0x00, 0xf0, 0x04, 0x08 - }; /* Structure image */ - - memcpy(g, data, sizeof(data)); /* Initialise the structure */ -} - -static void -imdi_k7_tab( -tabspec *t /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0xa1, 0xd4, 0xe2, 0xb7, - 0xf4, 0xd5, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0xff, 0xff, 0xff, 0x31, 0x00, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xa0, 0xd6, 0x83, 0xbf, 0x8b, 0x22, 0xe2, 0xb7, - 0xf4, 0xd5, 0x83, 0xbf, 0x52, 0xca, 0x04, 0x08, - 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0x20, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff, - 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff - }; /* Structure image */ - - memcpy(t, data, sizeof(data)); /* Initialise the structure */ -} - -/* 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 = 3 - Output channel 0 bits = 8 - Output channel 0 increment = 3 - Output channel 1 bits = 8 - Output channel 1 increment = 3 - Output channel 2 bits = 8 - Output channel 2 increment = 3 - 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 = 255 - */ - -/* - 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 <memory.h> -#include "imdi_imp.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) * 8) - -/* Interpolation table - get vertex values */ -#define IM_FE(p, v, c) *((unsigned int *)((p) + (v) * 8 + (c) * 4)) -#define IM_PE(p, v) *((unsigned int *)((p) + 4 + (v) * 8)) - -/* Output table indexes */ -#define OT_E(p, off) *((unsigned char *)((p) + (off) * 1)) - -static void -imdi_k8( -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 ot1 = (pointer)p->out_tables[1]; - pointer ot2 = (pointer)p->out_tables[2]; - pointer sw_base = (pointer)p->sw_table; - pointer im_base = (pointer)p->im_table; - - for(;ip0 < ep; ip0 += 1, op0 += 3) { - unsigned int ova0; /* Output value accumulator */ - unsigned int ova1; /* 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_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 = 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_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += 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 */ - oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */ - op0[1] = OT_E(ot1, oti); /* Write result */ - oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */ - op0[2] = OT_E(ot2, oti); /* Write result */ - } - } -} -#undef IT_IT -#undef SW_O -#undef SX_WO -#undef IM_O -#undef IM_FE -#undef IM_PE -#undef OT_E - -static void -imdi_k8_gen( -genspec *g /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0xd0, 0x85, 0x04, 0x08, 0x4c, 0x69, 0x6e, 0x75, - 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x79, 0x72, - 0x74, 0x6c, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0xff, 0x00, 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, 0x04, 0x08, - 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08, - 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7, - 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7, - 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08, - 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00, - 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7, - 0x2c, 0xf3, 0xdc, 0xb7, 0x31, 0x5f, 0x33, 0x5f, - 0x69, 0x38, 0x5f, 0x69, 0x38, 0x5f, 0x66, 0x00, - 0x8e, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00, - 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf, - 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08, - 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf, - 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x38, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01, - 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7, - 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7, - 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08, - 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08, - 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf, - 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7, - 0x00, 0xf0, 0x04, 0x08 - }; /* Structure image */ - - memcpy(g, data, sizeof(data)); /* Initialise the structure */ -} - -static void -imdi_k8_tab( -tabspec *t /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf, - 0xff, 0xff, 0xff, 0x33, 0x00, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xf4, 0xd5, 0x83, 0xbf, 0x52, 0xca, 0x04, 0x08, - 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0x20, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff, - 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff - }; /* Structure image */ - - memcpy(t, data, sizeof(data)); /* Initialise the structure */ -} - -/* 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 = 3 - Input channel 0 bits = 8 - Input channel 0 increment = 3 - Input channel 1 bits = 8 - Input channel 1 increment = 3 - Input channel 2 bits = 8 - Input channel 2 increment = 3 - Input is channel interleaved - Input channels are separate words - Input value extraction is done in input table lookup - - Output channels per pixel = 3 - Output channel 0 bits = 8 - Output channel 0 increment = 3 - Output channel 1 bits = 8 - Output channel 1 increment = 3 - Output channel 2 bits = 8 - Output channel 2 increment = 3 - Output is channel interleaved - - Output channels are separate words - Simplex table index bits = 12 - Interpolation table index bits = 20 - Simplex table max resolution = 16 - Interpolation table max resolution = 101 - */ - -/* - 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 <memory.h> -#include "imdi_imp.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 int *)((p) + 0 + (off) * 4)) - -/* Simplex weighting table access */ -#define SW_O(off) ((off) * 16) - -/* Simplex table - get weighting value */ -#define SX_WE(p, v) *((unsigned short *)((p) + (v) * 4 + 0)) - -/* Simplex table - get offset value */ -#define SX_VO(p, v) *((unsigned short *)((p) + (v) * 4 + 2)) - -/* Interpolation multi-dim. table access */ -#define IM_O(off) ((off) * 8) - -/* Interpolation table - get vertex values */ -#define IM_FE(p, v, c) *((unsigned int *)((p) + (v) * 8 + (c) * 4)) -#define IM_PE(p, v) *((unsigned int *)((p) + 4 + (v) * 8)) - -/* Output table indexes */ -#define OT_E(p, off) *((unsigned char *)((p) + (off) * 1)) - -static void -imdi_k9( -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 * 3 ; - pointer it0 = (pointer)p->in_tables[0]; - pointer it1 = (pointer)p->in_tables[1]; - pointer it2 = (pointer)p->in_tables[2]; - pointer ot0 = (pointer)p->out_tables[0]; - pointer ot1 = (pointer)p->out_tables[1]; - pointer ot2 = (pointer)p->out_tables[2]; - pointer sw_base = (pointer)p->sw_table; - pointer im_base = (pointer)p->im_table; - - for(;ip0 < ep; ip0 += 3, op0 += 3) { - unsigned int ova0; /* Output value accumulator */ - unsigned int ova1; /* Output value partial accumulator */ - { - pointer swp; - pointer imp; - { - unsigned int ti; /* Simplex+Interpolation index variable */ - - ti = IT_IT(it0, ip0[0]); - ti += IT_IT(it1, ip0[1]); - ti += IT_IT(it2, ip0[2]); - - imp = im_base + IM_O(ti >> 12); /* Extract interp. index and comp. entry */ - swp = sw_base + SW_O(ti & 0xfff); /* Extract simplex index and comp. entry */ - } - { - unsigned int vof; /* Vertex offset value */ - unsigned int vwe; /* Vertex weighting */ - - vof = SX_VO(swp, 0); /* Read vertex offset value */ - vwe = SX_WE(swp, 0); /* Read vertex weighting value */ - ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof = SX_VO(swp, 1); /* Read vertex offset value */ - vwe = SX_WE(swp, 1); /* Read vertex weighting value */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof = SX_VO(swp, 2); /* Read vertex offset value */ - vwe = SX_WE(swp, 2); /* Read vertex weighting value */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof = SX_VO(swp, 3); /* Read vertex offset value */ - vwe = SX_WE(swp, 3); /* Read vertex weighting value */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += 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 */ - oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */ - op0[1] = OT_E(ot1, oti); /* Write result */ - oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */ - op0[2] = OT_E(ot2, oti); /* Write result */ - } - } -} -#undef IT_IT -#undef SW_O -#undef SX_WE -#undef SX_VO -#undef IM_O -#undef IM_FE -#undef IM_PE -#undef OT_E - -static void -imdi_k9_gen( -genspec *g /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x08, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0xd0, 0x85, 0x04, 0x08, 0x4c, 0x69, 0x6e, 0x75, - 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x79, 0x72, - 0x74, 0x6c, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x65, 0x00, 0x00, 0x00, 0x10, 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, 0x04, 0x08, - 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08, - 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7, - 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7, - 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08, - 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00, - 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7, - 0x2c, 0xf3, 0xdc, 0xb7, 0x33, 0x5f, 0x33, 0x5f, - 0x69, 0x38, 0x5f, 0x69, 0x38, 0x5f, 0x66, 0x00, - 0x8e, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00, - 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf, - 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08, - 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf, - 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x39, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01, - 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7, - 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7, - 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08, - 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08, - 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf, - 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7, - 0x00, 0xf0, 0x04, 0x08 - }; /* Structure image */ - - memcpy(g, data, sizeof(data)); /* Initialise the structure */ -} - -static void -imdi_k9_tab( -tabspec *t /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x14, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf, - 0xff, 0xff, 0xff, 0x33, 0x00, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xf4, 0xd5, 0x83, 0xbf, 0x52, 0xca, 0x04, 0x08, - 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0x20, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff, - 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff - }; /* Structure image */ - - memcpy(t, data, sizeof(data)); /* Initialise the structure */ -} - -/* 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 = 4 - Input channel 0 bits = 8 - Input channel 0 increment = 4 - Input channel 1 bits = 8 - Input channel 1 increment = 4 - Input channel 2 bits = 8 - Input channel 2 increment = 4 - Input channel 3 bits = 8 - Input channel 3 increment = 4 - Input is channel interleaved - Input channels are separate words - Input value extraction is done in input table lookup - - Output channels per pixel = 3 - Output channel 0 bits = 8 - Output channel 0 increment = 3 - Output channel 1 bits = 8 - Output channel 1 increment = 3 - Output channel 2 bits = 8 - Output channel 2 increment = 3 - Output is channel interleaved - - Output channels are separate words - Simplex table index bits = 32 - Interpolation table index bits = 32 - Simplex table max resolution = 255 - Interpolation table max resolution = 39 - */ - -/* - 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 <memory.h> -#include "imdi_imp.h" -#define IMDI_INCLUDED -#endif /* IMDI_INCLUDED */ - -#ifndef DEFINED_pointer -#define DEFINED_pointer -typedef unsigned char * pointer; -#endif - -/* Input table interp. index */ -#define IT_IX(p, off) *((unsigned int *)((p) + 4 + (off) * 8)) - -/* Input table simplex index enty */ -#define IT_SX(p, off) *((unsigned int *)((p) + 0 + (off) * 8)) - -/* Simplex weighting table access */ -#define SW_O(off) ((off) * 20) - -/* Simplex table - get weighting value */ -#define SX_WE(p, v) *((unsigned short *)((p) + (v) * 4 + 0)) - -/* Simplex table - get offset value */ -#define SX_VO(p, v) *((unsigned short *)((p) + (v) * 4 + 2)) - -/* Interpolation multi-dim. table access */ -#define IM_O(off) ((off) * 8) - -/* Interpolation table - get vertex values */ -#define IM_FE(p, v, c) *((unsigned int *)((p) + (v) * 8 + (c) * 4)) -#define IM_PE(p, v) *((unsigned int *)((p) + 4 + (v) * 8)) - -/* Output table indexes */ -#define OT_E(p, off) *((unsigned char *)((p) + (off) * 1)) - -static void -imdi_k10( -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 * 4 ; - pointer it0 = (pointer)p->in_tables[0]; - pointer it1 = (pointer)p->in_tables[1]; - pointer it2 = (pointer)p->in_tables[2]; - pointer it3 = (pointer)p->in_tables[3]; - pointer ot0 = (pointer)p->out_tables[0]; - pointer ot1 = (pointer)p->out_tables[1]; - pointer ot2 = (pointer)p->out_tables[2]; - pointer sw_base = (pointer)p->sw_table; - pointer im_base = (pointer)p->im_table; - - for(;ip0 < ep; ip0 += 4, op0 += 3) { - unsigned int ova0; /* Output value accumulator */ - unsigned int ova1; /* Output value partial accumulator */ - { - pointer swp; - pointer imp; - { - unsigned int ti_s; /* Simplex index variable */ - unsigned int ti_i; /* Interpolation index variable */ - - ti_i = IT_IX(it0, ip0[0]); - ti_s = IT_SX(it0, ip0[0]); - ti_i += IT_IX(it1, ip0[1]); - ti_s += IT_SX(it1, ip0[1]); - ti_i += IT_IX(it2, ip0[2]); - ti_s += IT_SX(it2, ip0[2]); - ti_i += IT_IX(it3, ip0[3]); - ti_s += IT_SX(it3, ip0[3]); - - swp = sw_base + SW_O(ti_s); /* Compute simplex table entry pointer */ - imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */ - } - { - unsigned int vof; /* Vertex offset value */ - unsigned int vwe; /* Vertex weighting */ - - vof = SX_VO(swp, 0); /* Read vertex offset value */ - vwe = SX_WE(swp, 0); /* Read vertex weighting value */ - ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof = SX_VO(swp, 1); /* Read vertex offset value */ - vwe = SX_WE(swp, 1); /* Read vertex weighting value */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof = SX_VO(swp, 2); /* Read vertex offset value */ - vwe = SX_WE(swp, 2); /* Read vertex weighting value */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof = SX_VO(swp, 3); /* Read vertex offset value */ - vwe = SX_WE(swp, 3); /* Read vertex weighting value */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof = SX_VO(swp, 4); /* Read vertex offset value */ - vwe = SX_WE(swp, 4); /* Read vertex weighting value */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += 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 */ - oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */ - op0[1] = OT_E(ot1, oti); /* Write result */ - oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */ - op0[2] = OT_E(ot2, oti); /* Write result */ - } - } -} -#undef IT_IX -#undef IT_SX -#undef SW_O -#undef SX_WE -#undef SX_VO -#undef IM_O -#undef IM_FE -#undef IM_PE -#undef OT_E - -static void -imdi_k10_gen( -genspec *g /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0xd0, 0x85, 0x04, 0x08, 0x4c, 0x69, 0x6e, 0x75, - 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x79, 0x72, - 0x74, 0x6c, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x27, 0x00, 0x00, 0x00, 0xff, 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, 0x04, 0x08, - 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08, - 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7, - 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7, - 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08, - 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00, - 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7, - 0x2c, 0xf3, 0xdc, 0xb7, 0x34, 0x5f, 0x33, 0x5f, - 0x69, 0x38, 0x5f, 0x69, 0x38, 0x5f, 0x66, 0x00, - 0x8e, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00, - 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf, - 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08, - 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf, - 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x30, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01, - 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7, - 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7, - 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08, - 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08, - 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf, - 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7, - 0x00, 0xf0, 0x04, 0x08 - }; /* Structure image */ - - memcpy(g, data, sizeof(data)); /* Initialise the structure */ -} - -static void -imdi_k10_tab( -tabspec *t /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x14, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf, - 0xff, 0xff, 0xff, 0x33, 0x00, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xf4, 0xd5, 0x83, 0xbf, 0x52, 0xca, 0x04, 0x08, - 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0x20, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff, - 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff - }; /* Structure image */ - - memcpy(t, data, sizeof(data)); /* Initialise the structure */ -} - -/* 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 = 5 - Input channel 0 bits = 8 - Input channel 0 increment = 5 - Input channel 1 bits = 8 - Input channel 1 increment = 5 - Input channel 2 bits = 8 - Input channel 2 increment = 5 - Input channel 3 bits = 8 - Input channel 3 increment = 5 - Input channel 4 bits = 8 - Input channel 4 increment = 5 - Input is channel interleaved - Input channels are separate words - Input value extraction is done in input table lookup - - Output channels per pixel = 3 - Output channel 0 bits = 8 - Output channel 0 increment = 3 - Output channel 1 bits = 8 - Output channel 1 increment = 3 - Output channel 2 bits = 8 - Output channel 2 increment = 3 - Output is channel interleaved - - Output channels are separate words - Weight+voffset bits = 32 - Interpolation table index bits = 32 - Interpolation table max resolution = 53 - */ - -/* - 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 <memory.h> -#include "imdi_imp.h" -#define IMDI_INCLUDED -#endif /* IMDI_INCLUDED */ - -#ifndef DEFINED_pointer -#define DEFINED_pointer -typedef unsigned char * pointer; -#endif - -/* Input table interp. index */ -#define IT_IX(p, off) *((unsigned int *)((p) + 0 + (off) * 8)) - -/* Input table input weighting/offset value enty */ -#define IT_WO(p, off) *((unsigned int *)((p) + 4 + (off) * 8)) - -/* Conditional exchange for sorting */ -#define CEX(A, B) if (A < B) { A ^= B; B ^= A; A ^= B; } - -/* Interpolation multi-dim. table access */ -#define IM_O(off) ((off) * 8) - -/* Interpolation table - get vertex values */ -#define IM_FE(p, v, c) *((unsigned int *)((p) + (v) * 8 + (c) * 4)) -#define IM_PE(p, v) *((unsigned int *)((p) + 4 + (v) * 8)) - -/* Output table indexes */ -#define OT_E(p, off) *((unsigned char *)((p) + (off) * 1)) - -static void -imdi_k11( -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 * 5 ; - pointer it0 = (pointer)p->in_tables[0]; - pointer it1 = (pointer)p->in_tables[1]; - pointer it2 = (pointer)p->in_tables[2]; - pointer it3 = (pointer)p->in_tables[3]; - pointer it4 = (pointer)p->in_tables[4]; - pointer ot0 = (pointer)p->out_tables[0]; - pointer ot1 = (pointer)p->out_tables[1]; - pointer ot2 = (pointer)p->out_tables[2]; - pointer im_base = (pointer)p->im_table; - - for(;ip0 < ep; ip0 += 5, op0 += 3) { - unsigned int ova0; /* Output value accumulator */ - unsigned int ova1; /* Output value partial accumulator */ - { - pointer imp; - unsigned int wo0; /* Weighting value and vertex offset variable */ - unsigned int wo1; /* Weighting value and vertex offset variable */ - unsigned int wo2; /* Weighting value and vertex offset variable */ - unsigned int wo3; /* Weighting value and vertex offset variable */ - unsigned int wo4; /* Weighting value and vertex offset variable */ - { - unsigned int ti_i; /* Interpolation index variable */ - - ti_i = IT_IX(it0, ip0[0]); - wo0 = IT_WO(it0, ip0[0]); - ti_i += IT_IX(it1, ip0[1]); - wo1 = IT_WO(it1, ip0[1]); - ti_i += IT_IX(it2, ip0[2]); - wo2 = IT_WO(it2, ip0[2]); - ti_i += IT_IX(it3, ip0[3]); - wo3 = IT_WO(it3, ip0[3]); - ti_i += IT_IX(it4, ip0[4]); - wo4 = IT_WO(it4, ip0[4]); - - imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */ - - /* Sort weighting values and vertex offset values */ - CEX(wo0, wo1); - CEX(wo0, wo2); - CEX(wo0, wo3); - CEX(wo0, wo4); - CEX(wo1, wo2); - CEX(wo1, wo3); - CEX(wo1, wo4); - CEX(wo2, wo3); - CEX(wo2, wo4); - CEX(wo3, wo4); - } - { - unsigned int nvof; /* Next vertex offset value */ - unsigned int vof; /* Vertex offset value */ - unsigned int vwe; /* Vertex weighting */ - - vof = 0; /* First vertex offset is 0 */ - nvof = (wo0 & 0x7fffff); /* Extract offset value */ - wo0 = (wo0 >> 23); /* Extract weighting value */ - vwe = 256 - wo0; /* Baricentric weighting */ - ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo1 & 0x7fffff); /* Extract offset value */ - wo1 = (wo1 >> 23); /* Extract weighting value */ - vwe = wo0 - wo1; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo2 & 0x7fffff); /* Extract offset value */ - wo2 = (wo2 >> 23); /* Extract weighting value */ - vwe = wo1 - wo2; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo3 & 0x7fffff); /* Extract offset value */ - wo3 = (wo3 >> 23); /* Extract weighting value */ - vwe = wo2 - wo3; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo4 & 0x7fffff); /* Extract offset value */ - wo4 = (wo4 >> 23); /* Extract weighting value */ - vwe = wo3 - wo4; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - vwe = wo4; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += 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 */ - oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */ - op0[1] = OT_E(ot1, oti); /* Write result */ - oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */ - op0[2] = OT_E(ot2, oti); /* Write result */ - } - } -} -#undef IT_WO -#undef IT_IX -#undef CEX -#undef IM_O -#undef IM_FE -#undef IM_PE -#undef OT_E - -static void -imdi_k11_gen( -genspec *g /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x08, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0xd0, 0x85, 0x04, 0x08, 0x4c, 0x69, 0x6e, 0x75, - 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x79, 0x72, - 0x74, 0x6c, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x35, 0x00, 0x00, 0x00, 0x00, 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, 0x04, 0x08, - 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08, - 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7, - 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7, - 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08, - 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00, - 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7, - 0x2c, 0xf3, 0xdc, 0xb7, 0x35, 0x5f, 0x33, 0x5f, - 0x69, 0x38, 0x5f, 0x69, 0x38, 0x5f, 0x66, 0x00, - 0x8e, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00, - 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf, - 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08, - 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf, - 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x31, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01, - 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7, - 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7, - 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08, - 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08, - 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf, - 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7, - 0x00, 0xf0, 0x04, 0x08 - }; /* Structure image */ - - memcpy(g, data, sizeof(data)); /* Initialise the structure */ -} - -static void -imdi_k11_tab( -tabspec *t /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf, - 0xff, 0xff, 0xff, 0x33, 0x00, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xf4, 0xd5, 0x83, 0xbf, 0x52, 0xca, 0x04, 0x08, - 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0x20, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff, - 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff - }; /* Structure image */ - - memcpy(t, data, sizeof(data)); /* Initialise the structure */ -} - -/* 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 = 6 - Input channel 0 bits = 8 - Input channel 0 increment = 6 - Input channel 1 bits = 8 - Input channel 1 increment = 6 - Input channel 2 bits = 8 - Input channel 2 increment = 6 - Input channel 3 bits = 8 - Input channel 3 increment = 6 - Input channel 4 bits = 8 - Input channel 4 increment = 6 - Input channel 5 bits = 8 - Input channel 5 increment = 6 - Input is channel interleaved - Input channels are separate words - Input value extraction is done in input table lookup - - Output channels per pixel = 3 - Output channel 0 bits = 8 - Output channel 0 increment = 3 - Output channel 1 bits = 8 - Output channel 1 increment = 3 - Output channel 2 bits = 8 - Output channel 2 increment = 3 - Output is channel interleaved - - Output channels are separate words - Weight+voffset bits = 32 - Interpolation table index bits = 32 - Interpolation table max resolution = 24 - */ - -/* - 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 <memory.h> -#include "imdi_imp.h" -#define IMDI_INCLUDED -#endif /* IMDI_INCLUDED */ - -#ifndef DEFINED_pointer -#define DEFINED_pointer -typedef unsigned char * pointer; -#endif - -/* Input table interp. index */ -#define IT_IX(p, off) *((unsigned int *)((p) + 0 + (off) * 8)) - -/* Input table input weighting/offset value enty */ -#define IT_WO(p, off) *((unsigned int *)((p) + 4 + (off) * 8)) - -/* Conditional exchange for sorting */ -#define CEX(A, B) if (A < B) { A ^= B; B ^= A; A ^= B; } - -/* Interpolation multi-dim. table access */ -#define IM_O(off) ((off) * 8) - -/* Interpolation table - get vertex values */ -#define IM_FE(p, v, c) *((unsigned int *)((p) + (v) * 8 + (c) * 4)) -#define IM_PE(p, v) *((unsigned int *)((p) + 4 + (v) * 8)) - -/* Output table indexes */ -#define OT_E(p, off) *((unsigned char *)((p) + (off) * 1)) - -static void -imdi_k12( -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 * 6 ; - pointer it0 = (pointer)p->in_tables[0]; - pointer it1 = (pointer)p->in_tables[1]; - pointer it2 = (pointer)p->in_tables[2]; - pointer it3 = (pointer)p->in_tables[3]; - pointer it4 = (pointer)p->in_tables[4]; - pointer it5 = (pointer)p->in_tables[5]; - pointer ot0 = (pointer)p->out_tables[0]; - pointer ot1 = (pointer)p->out_tables[1]; - pointer ot2 = (pointer)p->out_tables[2]; - pointer im_base = (pointer)p->im_table; - - for(;ip0 < ep; ip0 += 6, op0 += 3) { - unsigned int ova0; /* Output value accumulator */ - unsigned int ova1; /* Output value partial accumulator */ - { - pointer imp; - unsigned int wo0; /* Weighting value and vertex offset variable */ - unsigned int wo1; /* Weighting value and vertex offset variable */ - unsigned int wo2; /* Weighting value and vertex offset variable */ - unsigned int wo3; /* Weighting value and vertex offset variable */ - unsigned int wo4; /* Weighting value and vertex offset variable */ - unsigned int wo5; /* Weighting value and vertex offset variable */ - { - unsigned int ti_i; /* Interpolation index variable */ - - ti_i = IT_IX(it0, ip0[0]); - wo0 = IT_WO(it0, ip0[0]); - ti_i += IT_IX(it1, ip0[1]); - wo1 = IT_WO(it1, ip0[1]); - ti_i += IT_IX(it2, ip0[2]); - wo2 = IT_WO(it2, ip0[2]); - ti_i += IT_IX(it3, ip0[3]); - wo3 = IT_WO(it3, ip0[3]); - ti_i += IT_IX(it4, ip0[4]); - wo4 = IT_WO(it4, ip0[4]); - ti_i += IT_IX(it5, ip0[5]); - wo5 = IT_WO(it5, ip0[5]); - - imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */ - - /* Sort weighting values and vertex offset values */ - CEX(wo0, wo1); - CEX(wo0, wo2); - CEX(wo0, wo3); - CEX(wo0, wo4); - CEX(wo0, wo5); - CEX(wo1, wo2); - CEX(wo1, wo3); - CEX(wo1, wo4); - CEX(wo1, wo5); - CEX(wo2, wo3); - CEX(wo2, wo4); - CEX(wo2, wo5); - CEX(wo3, wo4); - CEX(wo3, wo5); - CEX(wo4, wo5); - } - { - unsigned int nvof; /* Next vertex offset value */ - unsigned int vof; /* Vertex offset value */ - unsigned int vwe; /* Vertex weighting */ - - vof = 0; /* First vertex offset is 0 */ - nvof = (wo0 & 0x7fffff); /* Extract offset value */ - wo0 = (wo0 >> 23); /* Extract weighting value */ - vwe = 256 - wo0; /* Baricentric weighting */ - ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo1 & 0x7fffff); /* Extract offset value */ - wo1 = (wo1 >> 23); /* Extract weighting value */ - vwe = wo0 - wo1; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo2 & 0x7fffff); /* Extract offset value */ - wo2 = (wo2 >> 23); /* Extract weighting value */ - vwe = wo1 - wo2; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo3 & 0x7fffff); /* Extract offset value */ - wo3 = (wo3 >> 23); /* Extract weighting value */ - vwe = wo2 - wo3; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo4 & 0x7fffff); /* Extract offset value */ - wo4 = (wo4 >> 23); /* Extract weighting value */ - vwe = wo3 - wo4; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo5 & 0x7fffff); /* Extract offset value */ - wo5 = (wo5 >> 23); /* Extract weighting value */ - vwe = wo4 - wo5; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - vwe = wo5; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += 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 */ - oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */ - op0[1] = OT_E(ot1, oti); /* Write result */ - oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */ - op0[2] = OT_E(ot2, oti); /* Write result */ - } - } -} -#undef IT_WO -#undef IT_IX -#undef CEX -#undef IM_O -#undef IM_FE -#undef IM_PE -#undef OT_E - -static void -imdi_k12_gen( -genspec *g /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x08, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0xd0, 0x85, 0x04, 0x08, 0x4c, 0x69, 0x6e, 0x75, - 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x79, 0x72, - 0x74, 0x6c, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x18, 0x00, 0x00, 0x00, 0x00, 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, 0x04, 0x08, - 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08, - 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7, - 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7, - 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08, - 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00, - 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7, - 0x2c, 0xf3, 0xdc, 0xb7, 0x36, 0x5f, 0x33, 0x5f, - 0x69, 0x38, 0x5f, 0x69, 0x38, 0x5f, 0x66, 0x00, - 0x8e, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00, - 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf, - 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08, - 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf, - 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x32, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01, - 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7, - 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7, - 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08, - 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08, - 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf, - 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7, - 0x00, 0xf0, 0x04, 0x08 - }; /* Structure image */ - - memcpy(g, data, sizeof(data)); /* Initialise the structure */ -} - -static void -imdi_k12_tab( -tabspec *t /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf, - 0xff, 0xff, 0xff, 0x33, 0x00, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xf4, 0xd5, 0x83, 0xbf, 0x52, 0xca, 0x04, 0x08, - 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0x20, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff, - 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff - }; /* Structure image */ - - memcpy(t, data, sizeof(data)); /* Initialise the structure */ -} - -/* 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 = 7 - Input channel 0 bits = 8 - Input channel 0 increment = 7 - Input channel 1 bits = 8 - Input channel 1 increment = 7 - Input channel 2 bits = 8 - Input channel 2 increment = 7 - Input channel 3 bits = 8 - Input channel 3 increment = 7 - Input channel 4 bits = 8 - Input channel 4 increment = 7 - Input channel 5 bits = 8 - Input channel 5 increment = 7 - Input channel 6 bits = 8 - Input channel 6 increment = 7 - Input is channel interleaved - Input channels are separate words - Input value extraction is done in input table lookup - - Output channels per pixel = 3 - Output channel 0 bits = 8 - Output channel 0 increment = 3 - Output channel 1 bits = 8 - Output channel 1 increment = 3 - Output channel 2 bits = 8 - Output channel 2 increment = 3 - Output is channel interleaved - - Output channels are separate words - Weight+voffset bits = 32 - Interpolation table index bits = 32 - Interpolation table max resolution = 14 - */ - -/* - 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 <memory.h> -#include "imdi_imp.h" -#define IMDI_INCLUDED -#endif /* IMDI_INCLUDED */ - -#ifndef DEFINED_pointer -#define DEFINED_pointer -typedef unsigned char * pointer; -#endif - -/* Input table interp. index */ -#define IT_IX(p, off) *((unsigned int *)((p) + 0 + (off) * 8)) - -/* Input table input weighting/offset value enty */ -#define IT_WO(p, off) *((unsigned int *)((p) + 4 + (off) * 8)) - -/* Conditional exchange for sorting */ -#define CEX(A, B) if (A < B) { A ^= B; B ^= A; A ^= B; } - -/* Interpolation multi-dim. table access */ -#define IM_O(off) ((off) * 8) - -/* Interpolation table - get vertex values */ -#define IM_FE(p, v, c) *((unsigned int *)((p) + (v) * 8 + (c) * 4)) -#define IM_PE(p, v) *((unsigned int *)((p) + 4 + (v) * 8)) - -/* Output table indexes */ -#define OT_E(p, off) *((unsigned char *)((p) + (off) * 1)) - -static void -imdi_k13( -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 * 7 ; - pointer it0 = (pointer)p->in_tables[0]; - pointer it1 = (pointer)p->in_tables[1]; - pointer it2 = (pointer)p->in_tables[2]; - pointer it3 = (pointer)p->in_tables[3]; - pointer it4 = (pointer)p->in_tables[4]; - pointer it5 = (pointer)p->in_tables[5]; - pointer it6 = (pointer)p->in_tables[6]; - pointer ot0 = (pointer)p->out_tables[0]; - pointer ot1 = (pointer)p->out_tables[1]; - pointer ot2 = (pointer)p->out_tables[2]; - pointer im_base = (pointer)p->im_table; - - for(;ip0 < ep; ip0 += 7, op0 += 3) { - unsigned int ova0; /* Output value accumulator */ - unsigned int ova1; /* Output value partial accumulator */ - { - pointer imp; - unsigned int wo0; /* Weighting value and vertex offset variable */ - unsigned int wo1; /* Weighting value and vertex offset variable */ - unsigned int wo2; /* Weighting value and vertex offset variable */ - unsigned int wo3; /* Weighting value and vertex offset variable */ - unsigned int wo4; /* Weighting value and vertex offset variable */ - unsigned int wo5; /* Weighting value and vertex offset variable */ - unsigned int wo6; /* Weighting value and vertex offset variable */ - { - unsigned int ti_i; /* Interpolation index variable */ - - ti_i = IT_IX(it0, ip0[0]); - wo0 = IT_WO(it0, ip0[0]); - ti_i += IT_IX(it1, ip0[1]); - wo1 = IT_WO(it1, ip0[1]); - ti_i += IT_IX(it2, ip0[2]); - wo2 = IT_WO(it2, ip0[2]); - ti_i += IT_IX(it3, ip0[3]); - wo3 = IT_WO(it3, ip0[3]); - ti_i += IT_IX(it4, ip0[4]); - wo4 = IT_WO(it4, ip0[4]); - ti_i += IT_IX(it5, ip0[5]); - wo5 = IT_WO(it5, ip0[5]); - ti_i += IT_IX(it6, ip0[6]); - wo6 = IT_WO(it6, ip0[6]); - - imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */ - - /* Sort weighting values and vertex offset values */ - CEX(wo0, wo1); - CEX(wo0, wo2); - CEX(wo0, wo3); - CEX(wo0, wo4); - CEX(wo0, wo5); - CEX(wo0, wo6); - CEX(wo1, wo2); - CEX(wo1, wo3); - CEX(wo1, wo4); - CEX(wo1, wo5); - CEX(wo1, wo6); - CEX(wo2, wo3); - CEX(wo2, wo4); - CEX(wo2, wo5); - CEX(wo2, wo6); - CEX(wo3, wo4); - CEX(wo3, wo5); - CEX(wo3, wo6); - CEX(wo4, wo5); - CEX(wo4, wo6); - CEX(wo5, wo6); - } - { - unsigned int nvof; /* Next vertex offset value */ - unsigned int vof; /* Vertex offset value */ - unsigned int vwe; /* Vertex weighting */ - - vof = 0; /* First vertex offset is 0 */ - nvof = (wo0 & 0x7fffff); /* Extract offset value */ - wo0 = (wo0 >> 23); /* Extract weighting value */ - vwe = 256 - wo0; /* Baricentric weighting */ - ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo1 & 0x7fffff); /* Extract offset value */ - wo1 = (wo1 >> 23); /* Extract weighting value */ - vwe = wo0 - wo1; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo2 & 0x7fffff); /* Extract offset value */ - wo2 = (wo2 >> 23); /* Extract weighting value */ - vwe = wo1 - wo2; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo3 & 0x7fffff); /* Extract offset value */ - wo3 = (wo3 >> 23); /* Extract weighting value */ - vwe = wo2 - wo3; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo4 & 0x7fffff); /* Extract offset value */ - wo4 = (wo4 >> 23); /* Extract weighting value */ - vwe = wo3 - wo4; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo5 & 0x7fffff); /* Extract offset value */ - wo5 = (wo5 >> 23); /* Extract weighting value */ - vwe = wo4 - wo5; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo6 & 0x7fffff); /* Extract offset value */ - wo6 = (wo6 >> 23); /* Extract weighting value */ - vwe = wo5 - wo6; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - vwe = wo6; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += 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 */ - oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */ - op0[1] = OT_E(ot1, oti); /* Write result */ - oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */ - op0[2] = OT_E(ot2, oti); /* Write result */ - } - } -} -#undef IT_WO -#undef IT_IX -#undef CEX -#undef IM_O -#undef IM_FE -#undef IM_PE -#undef OT_E - -static void -imdi_k13_gen( -genspec *g /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0xd0, 0x85, 0x04, 0x08, 0x4c, 0x69, 0x6e, 0x75, - 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x79, 0x72, - 0x74, 0x6c, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x0e, 0x00, 0x00, 0x00, 0x00, 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, 0x04, 0x08, - 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08, - 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7, - 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7, - 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08, - 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00, - 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7, - 0x2c, 0xf3, 0xdc, 0xb7, 0x37, 0x5f, 0x33, 0x5f, - 0x69, 0x38, 0x5f, 0x69, 0x38, 0x5f, 0x66, 0x00, - 0x8e, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00, - 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf, - 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08, - 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf, - 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x33, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01, - 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7, - 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7, - 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08, - 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08, - 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf, - 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7, - 0x00, 0xf0, 0x04, 0x08 - }; /* Structure image */ - - memcpy(g, data, sizeof(data)); /* Initialise the structure */ -} - -static void -imdi_k13_tab( -tabspec *t /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf, - 0xff, 0xff, 0xff, 0x33, 0x00, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xf4, 0xd5, 0x83, 0xbf, 0x52, 0xca, 0x04, 0x08, - 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0x20, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff, - 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff - }; /* Structure image */ - - memcpy(t, data, sizeof(data)); /* Initialise the structure */ -} - -/* 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 = 8 - Input channel 0 bits = 8 - Input channel 0 increment = 8 - Input channel 1 bits = 8 - Input channel 1 increment = 8 - Input channel 2 bits = 8 - Input channel 2 increment = 8 - Input channel 3 bits = 8 - Input channel 3 increment = 8 - Input channel 4 bits = 8 - Input channel 4 increment = 8 - Input channel 5 bits = 8 - Input channel 5 increment = 8 - Input channel 6 bits = 8 - Input channel 6 increment = 8 - Input channel 7 bits = 8 - Input channel 7 increment = 8 - Input is channel interleaved - Input channels are separate words - Input value extraction is done in input table lookup - - Output channels per pixel = 3 - Output channel 0 bits = 8 - Output channel 0 increment = 3 - Output channel 1 bits = 8 - Output channel 1 increment = 3 - Output channel 2 bits = 8 - Output channel 2 increment = 3 - Output is channel interleaved - - Output channels are separate words - Weight+voffset bits = 32 - Interpolation table index bits = 32 - Interpolation table max resolution = 9 - */ - -/* - 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 <memory.h> -#include "imdi_imp.h" -#define IMDI_INCLUDED -#endif /* IMDI_INCLUDED */ - -#ifndef DEFINED_pointer -#define DEFINED_pointer -typedef unsigned char * pointer; -#endif - -/* Input table interp. index */ -#define IT_IX(p, off) *((unsigned int *)((p) + 0 + (off) * 8)) - -/* Input table input weighting/offset value enty */ -#define IT_WO(p, off) *((unsigned int *)((p) + 4 + (off) * 8)) - -/* Conditional exchange for sorting */ -#define CEX(A, B) if (A < B) { A ^= B; B ^= A; A ^= B; } - -/* Interpolation multi-dim. table access */ -#define IM_O(off) ((off) * 8) - -/* Interpolation table - get vertex values */ -#define IM_FE(p, v, c) *((unsigned int *)((p) + (v) * 8 + (c) * 4)) -#define IM_PE(p, v) *((unsigned int *)((p) + 4 + (v) * 8)) - -/* Output table indexes */ -#define OT_E(p, off) *((unsigned char *)((p) + (off) * 1)) - -static void -imdi_k14( -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 * 8 ; - pointer it0 = (pointer)p->in_tables[0]; - pointer it1 = (pointer)p->in_tables[1]; - pointer it2 = (pointer)p->in_tables[2]; - pointer it3 = (pointer)p->in_tables[3]; - pointer it4 = (pointer)p->in_tables[4]; - pointer it5 = (pointer)p->in_tables[5]; - pointer it6 = (pointer)p->in_tables[6]; - pointer it7 = (pointer)p->in_tables[7]; - pointer ot0 = (pointer)p->out_tables[0]; - pointer ot1 = (pointer)p->out_tables[1]; - pointer ot2 = (pointer)p->out_tables[2]; - pointer im_base = (pointer)p->im_table; - - for(;ip0 < ep; ip0 += 8, op0 += 3) { - unsigned int ova0; /* Output value accumulator */ - unsigned int ova1; /* Output value partial accumulator */ - { - pointer imp; - unsigned int wo0; /* Weighting value and vertex offset variable */ - unsigned int wo1; /* Weighting value and vertex offset variable */ - unsigned int wo2; /* Weighting value and vertex offset variable */ - unsigned int wo3; /* Weighting value and vertex offset variable */ - unsigned int wo4; /* Weighting value and vertex offset variable */ - unsigned int wo5; /* Weighting value and vertex offset variable */ - unsigned int wo6; /* Weighting value and vertex offset variable */ - unsigned int wo7; /* Weighting value and vertex offset variable */ - { - unsigned int ti_i; /* Interpolation index variable */ - - ti_i = IT_IX(it0, ip0[0]); - wo0 = IT_WO(it0, ip0[0]); - ti_i += IT_IX(it1, ip0[1]); - wo1 = IT_WO(it1, ip0[1]); - ti_i += IT_IX(it2, ip0[2]); - wo2 = IT_WO(it2, ip0[2]); - ti_i += IT_IX(it3, ip0[3]); - wo3 = IT_WO(it3, ip0[3]); - ti_i += IT_IX(it4, ip0[4]); - wo4 = IT_WO(it4, ip0[4]); - ti_i += IT_IX(it5, ip0[5]); - wo5 = IT_WO(it5, ip0[5]); - ti_i += IT_IX(it6, ip0[6]); - wo6 = IT_WO(it6, ip0[6]); - ti_i += IT_IX(it7, ip0[7]); - wo7 = IT_WO(it7, ip0[7]); - - imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */ - - /* Sort weighting values and vertex offset values */ - CEX(wo0, wo1); - CEX(wo0, wo2); - CEX(wo0, wo3); - CEX(wo0, wo4); - CEX(wo0, wo5); - CEX(wo0, wo6); - CEX(wo0, wo7); - CEX(wo1, wo2); - CEX(wo1, wo3); - CEX(wo1, wo4); - CEX(wo1, wo5); - CEX(wo1, wo6); - CEX(wo1, wo7); - CEX(wo2, wo3); - CEX(wo2, wo4); - CEX(wo2, wo5); - CEX(wo2, wo6); - CEX(wo2, wo7); - CEX(wo3, wo4); - CEX(wo3, wo5); - CEX(wo3, wo6); - CEX(wo3, wo7); - CEX(wo4, wo5); - CEX(wo4, wo6); - CEX(wo4, wo7); - CEX(wo5, wo6); - CEX(wo5, wo7); - CEX(wo6, wo7); - } - { - unsigned int nvof; /* Next vertex offset value */ - unsigned int vof; /* Vertex offset value */ - unsigned int vwe; /* Vertex weighting */ - - vof = 0; /* First vertex offset is 0 */ - nvof = (wo0 & 0x7fffff); /* Extract offset value */ - wo0 = (wo0 >> 23); /* Extract weighting value */ - vwe = 256 - wo0; /* Baricentric weighting */ - ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo1 & 0x7fffff); /* Extract offset value */ - wo1 = (wo1 >> 23); /* Extract weighting value */ - vwe = wo0 - wo1; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo2 & 0x7fffff); /* Extract offset value */ - wo2 = (wo2 >> 23); /* Extract weighting value */ - vwe = wo1 - wo2; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo3 & 0x7fffff); /* Extract offset value */ - wo3 = (wo3 >> 23); /* Extract weighting value */ - vwe = wo2 - wo3; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo4 & 0x7fffff); /* Extract offset value */ - wo4 = (wo4 >> 23); /* Extract weighting value */ - vwe = wo3 - wo4; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo5 & 0x7fffff); /* Extract offset value */ - wo5 = (wo5 >> 23); /* Extract weighting value */ - vwe = wo4 - wo5; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo6 & 0x7fffff); /* Extract offset value */ - wo6 = (wo6 >> 23); /* Extract weighting value */ - vwe = wo5 - wo6; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo7 & 0x7fffff); /* Extract offset value */ - wo7 = (wo7 >> 23); /* Extract weighting value */ - vwe = wo6 - wo7; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - vwe = wo7; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += 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 */ - oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */ - op0[1] = OT_E(ot1, oti); /* Write result */ - oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */ - op0[2] = OT_E(ot2, oti); /* Write result */ - } - } -} -#undef IT_WO -#undef IT_IX -#undef CEX -#undef IM_O -#undef IM_FE -#undef IM_PE -#undef OT_E - -static void -imdi_k14_gen( -genspec *g /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0xd0, 0x85, 0x04, 0x08, 0x4c, 0x69, 0x6e, 0x75, - 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x79, 0x72, - 0x74, 0x6c, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x09, 0x00, 0x00, 0x00, 0x00, 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, 0x04, 0x08, - 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08, - 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7, - 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7, - 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08, - 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00, - 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7, - 0x2c, 0xf3, 0xdc, 0xb7, 0x38, 0x5f, 0x33, 0x5f, - 0x69, 0x38, 0x5f, 0x69, 0x38, 0x5f, 0x66, 0x00, - 0x8e, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00, - 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf, - 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08, - 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf, - 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x34, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01, - 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7, - 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7, - 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08, - 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08, - 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf, - 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7, - 0x00, 0xf0, 0x04, 0x08 - }; /* Structure image */ - - memcpy(g, data, sizeof(data)); /* Initialise the structure */ -} - -static void -imdi_k14_tab( -tabspec *t /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf, - 0xff, 0xff, 0xff, 0x33, 0x00, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xf4, 0xd5, 0x83, 0xbf, 0x52, 0xca, 0x04, 0x08, - 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0x20, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff, - 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff - }; /* Structure image */ - - memcpy(t, data, sizeof(data)); /* Initialise the structure */ -} - -/* 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 = 4 - Output channel 0 bits = 8 - Output channel 0 increment = 4 - Output channel 1 bits = 8 - Output channel 1 increment = 4 - Output channel 2 bits = 8 - Output channel 2 increment = 4 - Output channel 3 bits = 8 - Output channel 3 increment = 4 - 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 = 255 - */ - -/* - 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 <memory.h> -#include "imdi_imp.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) * 8) - -/* Interpolation table - get vertex values */ -#define IM_FE(p, v, c) *((unsigned int *)((p) + (v) * 8 + (c) * 4)) - -/* Output table indexes */ -#define OT_E(p, off) *((unsigned char *)((p) + (off) * 1)) - -static void -imdi_k15( -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 ot1 = (pointer)p->out_tables[1]; - pointer ot2 = (pointer)p->out_tables[2]; - pointer ot3 = (pointer)p->out_tables[3]; - pointer sw_base = (pointer)p->sw_table; - pointer im_base = (pointer)p->im_table; - - for(;ip0 < ep; ip0 += 1, op0 += 4) { - unsigned int ova0; /* Output value accumulator */ - unsigned int ova1; /* Output value 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_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate 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_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate 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 */ - oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */ - op0[1] = OT_E(ot1, oti); /* Write result */ - oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */ - op0[2] = OT_E(ot2, oti); /* Write result */ - oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */ - op0[3] = OT_E(ot3, oti); /* Write result */ - } - } -} -#undef IT_IT -#undef SW_O -#undef SX_WO -#undef IM_O -#undef IM_FE -#undef OT_E - -static void -imdi_k15_gen( -genspec *g /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x4c, 0x69, 0x6e, 0x75, - 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x79, 0x72, - 0x74, 0x6c, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0xff, 0x00, 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, 0x04, 0x08, - 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08, - 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7, - 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7, - 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08, - 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00, - 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7, - 0x2c, 0xf3, 0xdc, 0xb7, 0x31, 0x5f, 0x34, 0x5f, - 0x69, 0x38, 0x5f, 0x69, 0x38, 0x5f, 0x66, 0x00, - 0x8e, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00, - 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf, - 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08, - 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf, - 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x35, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01, - 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7, - 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7, - 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08, - 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08, - 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf, - 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7, - 0x00, 0xf0, 0x04, 0x08 - }; /* Structure image */ - - memcpy(g, data, sizeof(data)); /* Initialise the structure */ -} - -static void -imdi_k15_tab( -tabspec *t /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0x34, 0x00, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x52, 0xca, 0x04, 0x08, - 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf, - 0x20, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff, - 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff - }; /* Structure image */ - - memcpy(t, data, sizeof(data)); /* Initialise the structure */ -} - -/* 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 = 3 - Input channel 0 bits = 8 - Input channel 0 increment = 3 - Input channel 1 bits = 8 - Input channel 1 increment = 3 - Input channel 2 bits = 8 - Input channel 2 increment = 3 - Input is channel interleaved - Input channels are separate words - Input value extraction is done in input table lookup - - Output channels per pixel = 4 - Output channel 0 bits = 8 - Output channel 0 increment = 4 - Output channel 1 bits = 8 - Output channel 1 increment = 4 - Output channel 2 bits = 8 - Output channel 2 increment = 4 - Output channel 3 bits = 8 - Output channel 3 increment = 4 - Output is channel interleaved - - Output channels are separate words - Simplex table index bits = 12 - Interpolation table index bits = 20 - Simplex table max resolution = 16 - Interpolation table max resolution = 101 - */ - -/* - 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 <memory.h> -#include "imdi_imp.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 int *)((p) + 0 + (off) * 4)) - -/* Simplex weighting table access */ -#define SW_O(off) ((off) * 16) - -/* Simplex table - get weighting value */ -#define SX_WE(p, v) *((unsigned short *)((p) + (v) * 4 + 0)) - -/* Simplex table - get offset value */ -#define SX_VO(p, v) *((unsigned short *)((p) + (v) * 4 + 2)) - -/* Interpolation multi-dim. table access */ -#define IM_O(off) ((off) * 8) - -/* Interpolation table - get vertex values */ -#define IM_FE(p, v, c) *((unsigned int *)((p) + (v) * 8 + (c) * 4)) - -/* Output table indexes */ -#define OT_E(p, off) *((unsigned char *)((p) + (off) * 1)) - -static void -imdi_k16( -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 * 3 ; - pointer it0 = (pointer)p->in_tables[0]; - pointer it1 = (pointer)p->in_tables[1]; - pointer it2 = (pointer)p->in_tables[2]; - pointer ot0 = (pointer)p->out_tables[0]; - pointer ot1 = (pointer)p->out_tables[1]; - pointer ot2 = (pointer)p->out_tables[2]; - pointer ot3 = (pointer)p->out_tables[3]; - pointer sw_base = (pointer)p->sw_table; - pointer im_base = (pointer)p->im_table; - - for(;ip0 < ep; ip0 += 3, op0 += 4) { - unsigned int ova0; /* Output value accumulator */ - unsigned int ova1; /* Output value accumulator */ - { - pointer swp; - pointer imp; - { - unsigned int ti; /* Simplex+Interpolation index variable */ - - ti = IT_IT(it0, ip0[0]); - ti += IT_IT(it1, ip0[1]); - ti += IT_IT(it2, ip0[2]); - - imp = im_base + IM_O(ti >> 12); /* Extract interp. index and comp. entry */ - swp = sw_base + SW_O(ti & 0xfff); /* Extract simplex index and comp. entry */ - } - { - unsigned int vof; /* Vertex offset value */ - unsigned int vwe; /* Vertex weighting */ - - vof = SX_VO(swp, 0); /* Read vertex offset value */ - vwe = SX_WE(swp, 0); /* Read vertex weighting value */ - ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - vof = SX_VO(swp, 1); /* Read vertex offset value */ - vwe = SX_WE(swp, 1); /* Read vertex weighting value */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - vof = SX_VO(swp, 2); /* Read vertex offset value */ - vwe = SX_WE(swp, 2); /* Read vertex weighting value */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - vof = SX_VO(swp, 3); /* Read vertex offset value */ - vwe = SX_WE(swp, 3); /* Read vertex weighting value */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate 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 */ - oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */ - op0[1] = OT_E(ot1, oti); /* Write result */ - oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */ - op0[2] = OT_E(ot2, oti); /* Write result */ - oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */ - op0[3] = OT_E(ot3, oti); /* Write result */ - } - } -} -#undef IT_IT -#undef SW_O -#undef SX_WE -#undef SX_VO -#undef IM_O -#undef IM_FE -#undef OT_E - -static void -imdi_k16_gen( -genspec *g /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x08, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x4c, 0x69, 0x6e, 0x75, - 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x79, 0x72, - 0x74, 0x6c, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x65, 0x00, 0x00, 0x00, 0x10, 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, 0x04, 0x08, - 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08, - 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7, - 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7, - 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08, - 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00, - 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7, - 0x2c, 0xf3, 0xdc, 0xb7, 0x33, 0x5f, 0x34, 0x5f, - 0x69, 0x38, 0x5f, 0x69, 0x38, 0x5f, 0x66, 0x00, - 0x8e, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00, - 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf, - 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08, - 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf, - 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x36, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01, - 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7, - 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7, - 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08, - 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08, - 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf, - 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7, - 0x00, 0xf0, 0x04, 0x08 - }; /* Structure image */ - - memcpy(g, data, sizeof(data)); /* Initialise the structure */ -} - -static void -imdi_k16_tab( -tabspec *t /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x14, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0x34, 0x00, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x52, 0xca, 0x04, 0x08, - 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf, - 0x20, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff, - 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff - }; /* Structure image */ - - memcpy(t, data, sizeof(data)); /* Initialise the structure */ -} - -/* 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 = 4 - Input channel 0 bits = 8 - Input channel 0 increment = 4 - Input channel 1 bits = 8 - Input channel 1 increment = 4 - Input channel 2 bits = 8 - Input channel 2 increment = 4 - Input channel 3 bits = 8 - Input channel 3 increment = 4 - Input is channel interleaved - Input channels are separate words - Input value extraction is done in input table lookup - - Output channels per pixel = 4 - Output channel 0 bits = 8 - Output channel 0 increment = 4 - Output channel 1 bits = 8 - Output channel 1 increment = 4 - Output channel 2 bits = 8 - Output channel 2 increment = 4 - Output channel 3 bits = 8 - Output channel 3 increment = 4 - Output is channel interleaved - - Output channels are separate words - Simplex table index bits = 32 - Interpolation table index bits = 32 - Simplex table max resolution = 255 - Interpolation table max resolution = 39 - */ - -/* - 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 <memory.h> -#include "imdi_imp.h" -#define IMDI_INCLUDED -#endif /* IMDI_INCLUDED */ - -#ifndef DEFINED_pointer -#define DEFINED_pointer -typedef unsigned char * pointer; -#endif - -/* Input table interp. index */ -#define IT_IX(p, off) *((unsigned int *)((p) + 4 + (off) * 8)) - -/* Input table simplex index enty */ -#define IT_SX(p, off) *((unsigned int *)((p) + 0 + (off) * 8)) - -/* Simplex weighting table access */ -#define SW_O(off) ((off) * 20) - -/* Simplex table - get weighting value */ -#define SX_WE(p, v) *((unsigned short *)((p) + (v) * 4 + 0)) - -/* Simplex table - get offset value */ -#define SX_VO(p, v) *((unsigned short *)((p) + (v) * 4 + 2)) - -/* Interpolation multi-dim. table access */ -#define IM_O(off) ((off) * 8) - -/* Interpolation table - get vertex values */ -#define IM_FE(p, v, c) *((unsigned int *)((p) + (v) * 8 + (c) * 4)) - -/* Output table indexes */ -#define OT_E(p, off) *((unsigned char *)((p) + (off) * 1)) - -static void -imdi_k17( -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 * 4 ; - pointer it0 = (pointer)p->in_tables[0]; - pointer it1 = (pointer)p->in_tables[1]; - pointer it2 = (pointer)p->in_tables[2]; - pointer it3 = (pointer)p->in_tables[3]; - pointer ot0 = (pointer)p->out_tables[0]; - pointer ot1 = (pointer)p->out_tables[1]; - pointer ot2 = (pointer)p->out_tables[2]; - pointer ot3 = (pointer)p->out_tables[3]; - pointer sw_base = (pointer)p->sw_table; - pointer im_base = (pointer)p->im_table; - - for(;ip0 < ep; ip0 += 4, op0 += 4) { - unsigned int ova0; /* Output value accumulator */ - unsigned int ova1; /* Output value accumulator */ - { - pointer swp; - pointer imp; - { - unsigned int ti_s; /* Simplex index variable */ - unsigned int ti_i; /* Interpolation index variable */ - - ti_i = IT_IX(it0, ip0[0]); - ti_s = IT_SX(it0, ip0[0]); - ti_i += IT_IX(it1, ip0[1]); - ti_s += IT_SX(it1, ip0[1]); - ti_i += IT_IX(it2, ip0[2]); - ti_s += IT_SX(it2, ip0[2]); - ti_i += IT_IX(it3, ip0[3]); - ti_s += IT_SX(it3, ip0[3]); - - swp = sw_base + SW_O(ti_s); /* Compute simplex table entry pointer */ - imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */ - } - { - unsigned int vof; /* Vertex offset value */ - unsigned int vwe; /* Vertex weighting */ - - vof = SX_VO(swp, 0); /* Read vertex offset value */ - vwe = SX_WE(swp, 0); /* Read vertex weighting value */ - ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - vof = SX_VO(swp, 1); /* Read vertex offset value */ - vwe = SX_WE(swp, 1); /* Read vertex weighting value */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - vof = SX_VO(swp, 2); /* Read vertex offset value */ - vwe = SX_WE(swp, 2); /* Read vertex weighting value */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - vof = SX_VO(swp, 3); /* Read vertex offset value */ - vwe = SX_WE(swp, 3); /* Read vertex weighting value */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - vof = SX_VO(swp, 4); /* Read vertex offset value */ - vwe = SX_WE(swp, 4); /* Read vertex weighting value */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate 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 */ - oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */ - op0[1] = OT_E(ot1, oti); /* Write result */ - oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */ - op0[2] = OT_E(ot2, oti); /* Write result */ - oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */ - op0[3] = OT_E(ot3, oti); /* Write result */ - } - } -} -#undef IT_IX -#undef IT_SX -#undef SW_O -#undef SX_WE -#undef SX_VO -#undef IM_O -#undef IM_FE -#undef OT_E - -static void -imdi_k17_gen( -genspec *g /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x4c, 0x69, 0x6e, 0x75, - 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x79, 0x72, - 0x74, 0x6c, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x27, 0x00, 0x00, 0x00, 0xff, 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, 0x04, 0x08, - 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08, - 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7, - 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7, - 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08, - 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00, - 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7, - 0x2c, 0xf3, 0xdc, 0xb7, 0x34, 0x5f, 0x34, 0x5f, - 0x69, 0x38, 0x5f, 0x69, 0x38, 0x5f, 0x66, 0x00, - 0x8e, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00, - 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf, - 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08, - 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf, - 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x37, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01, - 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7, - 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7, - 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08, - 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08, - 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf, - 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7, - 0x00, 0xf0, 0x04, 0x08 - }; /* Structure image */ - - memcpy(g, data, sizeof(data)); /* Initialise the structure */ -} - -static void -imdi_k17_tab( -tabspec *t /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x14, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0x34, 0x00, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x52, 0xca, 0x04, 0x08, - 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf, - 0x20, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff, - 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff - }; /* Structure image */ - - memcpy(t, data, sizeof(data)); /* Initialise the structure */ -} - -/* 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 = 5 - Input channel 0 bits = 8 - Input channel 0 increment = 5 - Input channel 1 bits = 8 - Input channel 1 increment = 5 - Input channel 2 bits = 8 - Input channel 2 increment = 5 - Input channel 3 bits = 8 - Input channel 3 increment = 5 - Input channel 4 bits = 8 - Input channel 4 increment = 5 - Input is channel interleaved - Input channels are separate words - Input value extraction is done in input table lookup - - Output channels per pixel = 4 - Output channel 0 bits = 8 - Output channel 0 increment = 4 - Output channel 1 bits = 8 - Output channel 1 increment = 4 - Output channel 2 bits = 8 - Output channel 2 increment = 4 - Output channel 3 bits = 8 - Output channel 3 increment = 4 - Output is channel interleaved - - Output channels are separate words - Weight+voffset bits = 32 - Interpolation table index bits = 32 - Interpolation table max resolution = 53 - */ - -/* - 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 <memory.h> -#include "imdi_imp.h" -#define IMDI_INCLUDED -#endif /* IMDI_INCLUDED */ - -#ifndef DEFINED_pointer -#define DEFINED_pointer -typedef unsigned char * pointer; -#endif - -/* Input table interp. index */ -#define IT_IX(p, off) *((unsigned int *)((p) + 0 + (off) * 8)) - -/* Input table input weighting/offset value enty */ -#define IT_WO(p, off) *((unsigned int *)((p) + 4 + (off) * 8)) - -/* Conditional exchange for sorting */ -#define CEX(A, B) if (A < B) { A ^= B; B ^= A; A ^= B; } - -/* Interpolation multi-dim. table access */ -#define IM_O(off) ((off) * 8) - -/* Interpolation table - get vertex values */ -#define IM_FE(p, v, c) *((unsigned int *)((p) + (v) * 8 + (c) * 4)) - -/* Output table indexes */ -#define OT_E(p, off) *((unsigned char *)((p) + (off) * 1)) - -static void -imdi_k18( -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 * 5 ; - pointer it0 = (pointer)p->in_tables[0]; - pointer it1 = (pointer)p->in_tables[1]; - pointer it2 = (pointer)p->in_tables[2]; - pointer it3 = (pointer)p->in_tables[3]; - pointer it4 = (pointer)p->in_tables[4]; - pointer ot0 = (pointer)p->out_tables[0]; - pointer ot1 = (pointer)p->out_tables[1]; - pointer ot2 = (pointer)p->out_tables[2]; - pointer ot3 = (pointer)p->out_tables[3]; - pointer im_base = (pointer)p->im_table; - - for(;ip0 < ep; ip0 += 5, op0 += 4) { - unsigned int ova0; /* Output value accumulator */ - unsigned int ova1; /* Output value accumulator */ - { - pointer imp; - unsigned int wo0; /* Weighting value and vertex offset variable */ - unsigned int wo1; /* Weighting value and vertex offset variable */ - unsigned int wo2; /* Weighting value and vertex offset variable */ - unsigned int wo3; /* Weighting value and vertex offset variable */ - unsigned int wo4; /* Weighting value and vertex offset variable */ - { - unsigned int ti_i; /* Interpolation index variable */ - - ti_i = IT_IX(it0, ip0[0]); - wo0 = IT_WO(it0, ip0[0]); - ti_i += IT_IX(it1, ip0[1]); - wo1 = IT_WO(it1, ip0[1]); - ti_i += IT_IX(it2, ip0[2]); - wo2 = IT_WO(it2, ip0[2]); - ti_i += IT_IX(it3, ip0[3]); - wo3 = IT_WO(it3, ip0[3]); - ti_i += IT_IX(it4, ip0[4]); - wo4 = IT_WO(it4, ip0[4]); - - imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */ - - /* Sort weighting values and vertex offset values */ - CEX(wo0, wo1); - CEX(wo0, wo2); - CEX(wo0, wo3); - CEX(wo0, wo4); - CEX(wo1, wo2); - CEX(wo1, wo3); - CEX(wo1, wo4); - CEX(wo2, wo3); - CEX(wo2, wo4); - CEX(wo3, wo4); - } - { - unsigned int nvof; /* Next vertex offset value */ - unsigned int vof; /* Vertex offset value */ - unsigned int vwe; /* Vertex weighting */ - - vof = 0; /* First vertex offset is 0 */ - nvof = (wo0 & 0x7fffff); /* Extract offset value */ - wo0 = (wo0 >> 23); /* Extract weighting value */ - vwe = 256 - wo0; /* Baricentric weighting */ - ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo1 & 0x7fffff); /* Extract offset value */ - wo1 = (wo1 >> 23); /* Extract weighting value */ - vwe = wo0 - wo1; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo2 & 0x7fffff); /* Extract offset value */ - wo2 = (wo2 >> 23); /* Extract weighting value */ - vwe = wo1 - wo2; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo3 & 0x7fffff); /* Extract offset value */ - wo3 = (wo3 >> 23); /* Extract weighting value */ - vwe = wo2 - wo3; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo4 & 0x7fffff); /* Extract offset value */ - wo4 = (wo4 >> 23); /* Extract weighting value */ - vwe = wo3 - wo4; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - vwe = wo4; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate 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 */ - oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */ - op0[1] = OT_E(ot1, oti); /* Write result */ - oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */ - op0[2] = OT_E(ot2, oti); /* Write result */ - oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */ - op0[3] = OT_E(ot3, oti); /* Write result */ - } - } -} -#undef IT_WO -#undef IT_IX -#undef CEX -#undef IM_O -#undef IM_FE -#undef OT_E - -static void -imdi_k18_gen( -genspec *g /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x08, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x4c, 0x69, 0x6e, 0x75, - 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x79, 0x72, - 0x74, 0x6c, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x35, 0x00, 0x00, 0x00, 0x00, 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, 0x04, 0x08, - 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08, - 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7, - 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7, - 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08, - 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00, - 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7, - 0x2c, 0xf3, 0xdc, 0xb7, 0x35, 0x5f, 0x34, 0x5f, - 0x69, 0x38, 0x5f, 0x69, 0x38, 0x5f, 0x66, 0x00, - 0x8e, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00, - 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf, - 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08, - 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf, - 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x38, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01, - 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7, - 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7, - 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08, - 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08, - 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf, - 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7, - 0x00, 0xf0, 0x04, 0x08 - }; /* Structure image */ - - memcpy(g, data, sizeof(data)); /* Initialise the structure */ -} - -static void -imdi_k18_tab( -tabspec *t /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0x34, 0x00, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x52, 0xca, 0x04, 0x08, - 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf, - 0x20, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff, - 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff - }; /* Structure image */ - - memcpy(t, data, sizeof(data)); /* Initialise the structure */ -} - -/* 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 = 6 - Input channel 0 bits = 8 - Input channel 0 increment = 6 - Input channel 1 bits = 8 - Input channel 1 increment = 6 - Input channel 2 bits = 8 - Input channel 2 increment = 6 - Input channel 3 bits = 8 - Input channel 3 increment = 6 - Input channel 4 bits = 8 - Input channel 4 increment = 6 - Input channel 5 bits = 8 - Input channel 5 increment = 6 - Input is channel interleaved - Input channels are separate words - Input value extraction is done in input table lookup - - Output channels per pixel = 4 - Output channel 0 bits = 8 - Output channel 0 increment = 4 - Output channel 1 bits = 8 - Output channel 1 increment = 4 - Output channel 2 bits = 8 - Output channel 2 increment = 4 - Output channel 3 bits = 8 - Output channel 3 increment = 4 - Output is channel interleaved - - Output channels are separate words - Weight+voffset bits = 32 - Interpolation table index bits = 32 - Interpolation table max resolution = 24 - */ - -/* - 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 <memory.h> -#include "imdi_imp.h" -#define IMDI_INCLUDED -#endif /* IMDI_INCLUDED */ - -#ifndef DEFINED_pointer -#define DEFINED_pointer -typedef unsigned char * pointer; -#endif - -/* Input table interp. index */ -#define IT_IX(p, off) *((unsigned int *)((p) + 0 + (off) * 8)) - -/* Input table input weighting/offset value enty */ -#define IT_WO(p, off) *((unsigned int *)((p) + 4 + (off) * 8)) - -/* Conditional exchange for sorting */ -#define CEX(A, B) if (A < B) { A ^= B; B ^= A; A ^= B; } - -/* Interpolation multi-dim. table access */ -#define IM_O(off) ((off) * 8) - -/* Interpolation table - get vertex values */ -#define IM_FE(p, v, c) *((unsigned int *)((p) + (v) * 8 + (c) * 4)) - -/* Output table indexes */ -#define OT_E(p, off) *((unsigned char *)((p) + (off) * 1)) - -static void -imdi_k19( -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 * 6 ; - pointer it0 = (pointer)p->in_tables[0]; - pointer it1 = (pointer)p->in_tables[1]; - pointer it2 = (pointer)p->in_tables[2]; - pointer it3 = (pointer)p->in_tables[3]; - pointer it4 = (pointer)p->in_tables[4]; - pointer it5 = (pointer)p->in_tables[5]; - pointer ot0 = (pointer)p->out_tables[0]; - pointer ot1 = (pointer)p->out_tables[1]; - pointer ot2 = (pointer)p->out_tables[2]; - pointer ot3 = (pointer)p->out_tables[3]; - pointer im_base = (pointer)p->im_table; - - for(;ip0 < ep; ip0 += 6, op0 += 4) { - unsigned int ova0; /* Output value accumulator */ - unsigned int ova1; /* Output value accumulator */ - { - pointer imp; - unsigned int wo0; /* Weighting value and vertex offset variable */ - unsigned int wo1; /* Weighting value and vertex offset variable */ - unsigned int wo2; /* Weighting value and vertex offset variable */ - unsigned int wo3; /* Weighting value and vertex offset variable */ - unsigned int wo4; /* Weighting value and vertex offset variable */ - unsigned int wo5; /* Weighting value and vertex offset variable */ - { - unsigned int ti_i; /* Interpolation index variable */ - - ti_i = IT_IX(it0, ip0[0]); - wo0 = IT_WO(it0, ip0[0]); - ti_i += IT_IX(it1, ip0[1]); - wo1 = IT_WO(it1, ip0[1]); - ti_i += IT_IX(it2, ip0[2]); - wo2 = IT_WO(it2, ip0[2]); - ti_i += IT_IX(it3, ip0[3]); - wo3 = IT_WO(it3, ip0[3]); - ti_i += IT_IX(it4, ip0[4]); - wo4 = IT_WO(it4, ip0[4]); - ti_i += IT_IX(it5, ip0[5]); - wo5 = IT_WO(it5, ip0[5]); - - imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */ - - /* Sort weighting values and vertex offset values */ - CEX(wo0, wo1); - CEX(wo0, wo2); - CEX(wo0, wo3); - CEX(wo0, wo4); - CEX(wo0, wo5); - CEX(wo1, wo2); - CEX(wo1, wo3); - CEX(wo1, wo4); - CEX(wo1, wo5); - CEX(wo2, wo3); - CEX(wo2, wo4); - CEX(wo2, wo5); - CEX(wo3, wo4); - CEX(wo3, wo5); - CEX(wo4, wo5); - } - { - unsigned int nvof; /* Next vertex offset value */ - unsigned int vof; /* Vertex offset value */ - unsigned int vwe; /* Vertex weighting */ - - vof = 0; /* First vertex offset is 0 */ - nvof = (wo0 & 0x7fffff); /* Extract offset value */ - wo0 = (wo0 >> 23); /* Extract weighting value */ - vwe = 256 - wo0; /* Baricentric weighting */ - ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo1 & 0x7fffff); /* Extract offset value */ - wo1 = (wo1 >> 23); /* Extract weighting value */ - vwe = wo0 - wo1; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo2 & 0x7fffff); /* Extract offset value */ - wo2 = (wo2 >> 23); /* Extract weighting value */ - vwe = wo1 - wo2; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo3 & 0x7fffff); /* Extract offset value */ - wo3 = (wo3 >> 23); /* Extract weighting value */ - vwe = wo2 - wo3; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo4 & 0x7fffff); /* Extract offset value */ - wo4 = (wo4 >> 23); /* Extract weighting value */ - vwe = wo3 - wo4; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo5 & 0x7fffff); /* Extract offset value */ - wo5 = (wo5 >> 23); /* Extract weighting value */ - vwe = wo4 - wo5; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - vwe = wo5; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate 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 */ - oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */ - op0[1] = OT_E(ot1, oti); /* Write result */ - oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */ - op0[2] = OT_E(ot2, oti); /* Write result */ - oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */ - op0[3] = OT_E(ot3, oti); /* Write result */ - } - } -} -#undef IT_WO -#undef IT_IX -#undef CEX -#undef IM_O -#undef IM_FE -#undef OT_E - -static void -imdi_k19_gen( -genspec *g /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x08, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x4c, 0x69, 0x6e, 0x75, - 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x79, 0x72, - 0x74, 0x6c, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x18, 0x00, 0x00, 0x00, 0x00, 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, 0x04, 0x08, - 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08, - 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7, - 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7, - 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08, - 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00, - 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7, - 0x2c, 0xf3, 0xdc, 0xb7, 0x36, 0x5f, 0x34, 0x5f, - 0x69, 0x38, 0x5f, 0x69, 0x38, 0x5f, 0x66, 0x00, - 0x8e, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00, - 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf, - 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08, - 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf, - 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x39, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01, - 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7, - 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7, - 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08, - 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08, - 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf, - 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7, - 0x00, 0xf0, 0x04, 0x08 - }; /* Structure image */ - - memcpy(g, data, sizeof(data)); /* Initialise the structure */ -} - -static void -imdi_k19_tab( -tabspec *t /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0x34, 0x00, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x52, 0xca, 0x04, 0x08, - 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf, - 0x20, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff, - 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff - }; /* Structure image */ - - memcpy(t, data, sizeof(data)); /* Initialise the structure */ -} - -/* 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 = 7 - Input channel 0 bits = 8 - Input channel 0 increment = 7 - Input channel 1 bits = 8 - Input channel 1 increment = 7 - Input channel 2 bits = 8 - Input channel 2 increment = 7 - Input channel 3 bits = 8 - Input channel 3 increment = 7 - Input channel 4 bits = 8 - Input channel 4 increment = 7 - Input channel 5 bits = 8 - Input channel 5 increment = 7 - Input channel 6 bits = 8 - Input channel 6 increment = 7 - Input is channel interleaved - Input channels are separate words - Input value extraction is done in input table lookup - - Output channels per pixel = 4 - Output channel 0 bits = 8 - Output channel 0 increment = 4 - Output channel 1 bits = 8 - Output channel 1 increment = 4 - Output channel 2 bits = 8 - Output channel 2 increment = 4 - Output channel 3 bits = 8 - Output channel 3 increment = 4 - Output is channel interleaved - - Output channels are separate words - Weight+voffset bits = 32 - Interpolation table index bits = 32 - Interpolation table max resolution = 14 - */ - -/* - 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 <memory.h> -#include "imdi_imp.h" -#define IMDI_INCLUDED -#endif /* IMDI_INCLUDED */ - -#ifndef DEFINED_pointer -#define DEFINED_pointer -typedef unsigned char * pointer; -#endif - -/* Input table interp. index */ -#define IT_IX(p, off) *((unsigned int *)((p) + 0 + (off) * 8)) - -/* Input table input weighting/offset value enty */ -#define IT_WO(p, off) *((unsigned int *)((p) + 4 + (off) * 8)) - -/* Conditional exchange for sorting */ -#define CEX(A, B) if (A < B) { A ^= B; B ^= A; A ^= B; } - -/* Interpolation multi-dim. table access */ -#define IM_O(off) ((off) * 8) - -/* Interpolation table - get vertex values */ -#define IM_FE(p, v, c) *((unsigned int *)((p) + (v) * 8 + (c) * 4)) - -/* Output table indexes */ -#define OT_E(p, off) *((unsigned char *)((p) + (off) * 1)) - -static void -imdi_k20( -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 * 7 ; - pointer it0 = (pointer)p->in_tables[0]; - pointer it1 = (pointer)p->in_tables[1]; - pointer it2 = (pointer)p->in_tables[2]; - pointer it3 = (pointer)p->in_tables[3]; - pointer it4 = (pointer)p->in_tables[4]; - pointer it5 = (pointer)p->in_tables[5]; - pointer it6 = (pointer)p->in_tables[6]; - pointer ot0 = (pointer)p->out_tables[0]; - pointer ot1 = (pointer)p->out_tables[1]; - pointer ot2 = (pointer)p->out_tables[2]; - pointer ot3 = (pointer)p->out_tables[3]; - pointer im_base = (pointer)p->im_table; - - for(;ip0 < ep; ip0 += 7, op0 += 4) { - unsigned int ova0; /* Output value accumulator */ - unsigned int ova1; /* Output value accumulator */ - { - pointer imp; - unsigned int wo0; /* Weighting value and vertex offset variable */ - unsigned int wo1; /* Weighting value and vertex offset variable */ - unsigned int wo2; /* Weighting value and vertex offset variable */ - unsigned int wo3; /* Weighting value and vertex offset variable */ - unsigned int wo4; /* Weighting value and vertex offset variable */ - unsigned int wo5; /* Weighting value and vertex offset variable */ - unsigned int wo6; /* Weighting value and vertex offset variable */ - { - unsigned int ti_i; /* Interpolation index variable */ - - ti_i = IT_IX(it0, ip0[0]); - wo0 = IT_WO(it0, ip0[0]); - ti_i += IT_IX(it1, ip0[1]); - wo1 = IT_WO(it1, ip0[1]); - ti_i += IT_IX(it2, ip0[2]); - wo2 = IT_WO(it2, ip0[2]); - ti_i += IT_IX(it3, ip0[3]); - wo3 = IT_WO(it3, ip0[3]); - ti_i += IT_IX(it4, ip0[4]); - wo4 = IT_WO(it4, ip0[4]); - ti_i += IT_IX(it5, ip0[5]); - wo5 = IT_WO(it5, ip0[5]); - ti_i += IT_IX(it6, ip0[6]); - wo6 = IT_WO(it6, ip0[6]); - - imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */ - - /* Sort weighting values and vertex offset values */ - CEX(wo0, wo1); - CEX(wo0, wo2); - CEX(wo0, wo3); - CEX(wo0, wo4); - CEX(wo0, wo5); - CEX(wo0, wo6); - CEX(wo1, wo2); - CEX(wo1, wo3); - CEX(wo1, wo4); - CEX(wo1, wo5); - CEX(wo1, wo6); - CEX(wo2, wo3); - CEX(wo2, wo4); - CEX(wo2, wo5); - CEX(wo2, wo6); - CEX(wo3, wo4); - CEX(wo3, wo5); - CEX(wo3, wo6); - CEX(wo4, wo5); - CEX(wo4, wo6); - CEX(wo5, wo6); - } - { - unsigned int nvof; /* Next vertex offset value */ - unsigned int vof; /* Vertex offset value */ - unsigned int vwe; /* Vertex weighting */ - - vof = 0; /* First vertex offset is 0 */ - nvof = (wo0 & 0x7fffff); /* Extract offset value */ - wo0 = (wo0 >> 23); /* Extract weighting value */ - vwe = 256 - wo0; /* Baricentric weighting */ - ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo1 & 0x7fffff); /* Extract offset value */ - wo1 = (wo1 >> 23); /* Extract weighting value */ - vwe = wo0 - wo1; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo2 & 0x7fffff); /* Extract offset value */ - wo2 = (wo2 >> 23); /* Extract weighting value */ - vwe = wo1 - wo2; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo3 & 0x7fffff); /* Extract offset value */ - wo3 = (wo3 >> 23); /* Extract weighting value */ - vwe = wo2 - wo3; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo4 & 0x7fffff); /* Extract offset value */ - wo4 = (wo4 >> 23); /* Extract weighting value */ - vwe = wo3 - wo4; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo5 & 0x7fffff); /* Extract offset value */ - wo5 = (wo5 >> 23); /* Extract weighting value */ - vwe = wo4 - wo5; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo6 & 0x7fffff); /* Extract offset value */ - wo6 = (wo6 >> 23); /* Extract weighting value */ - vwe = wo5 - wo6; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - vwe = wo6; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate 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 */ - oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */ - op0[1] = OT_E(ot1, oti); /* Write result */ - oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */ - op0[2] = OT_E(ot2, oti); /* Write result */ - oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */ - op0[3] = OT_E(ot3, oti); /* Write result */ - } - } -} -#undef IT_WO -#undef IT_IX -#undef CEX -#undef IM_O -#undef IM_FE -#undef OT_E - -static void -imdi_k20_gen( -genspec *g /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x4c, 0x69, 0x6e, 0x75, - 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x79, 0x72, - 0x74, 0x6c, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x0e, 0x00, 0x00, 0x00, 0x00, 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, 0x04, 0x08, - 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08, - 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7, - 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7, - 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08, - 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00, - 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7, - 0x2c, 0xf3, 0xdc, 0xb7, 0x37, 0x5f, 0x34, 0x5f, - 0x69, 0x38, 0x5f, 0x69, 0x38, 0x5f, 0x66, 0x00, - 0x8e, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00, - 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf, - 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08, - 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf, - 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x32, 0x30, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01, - 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7, - 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7, - 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08, - 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08, - 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf, - 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7, - 0x00, 0xf0, 0x04, 0x08 - }; /* Structure image */ - - memcpy(g, data, sizeof(data)); /* Initialise the structure */ -} - -static void -imdi_k20_tab( -tabspec *t /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0x34, 0x00, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x52, 0xca, 0x04, 0x08, - 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf, - 0x20, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff, - 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff - }; /* Structure image */ - - memcpy(t, data, sizeof(data)); /* Initialise the structure */ -} - -/* 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 = 8 - Input channel 0 bits = 8 - Input channel 0 increment = 8 - Input channel 1 bits = 8 - Input channel 1 increment = 8 - Input channel 2 bits = 8 - Input channel 2 increment = 8 - Input channel 3 bits = 8 - Input channel 3 increment = 8 - Input channel 4 bits = 8 - Input channel 4 increment = 8 - Input channel 5 bits = 8 - Input channel 5 increment = 8 - Input channel 6 bits = 8 - Input channel 6 increment = 8 - Input channel 7 bits = 8 - Input channel 7 increment = 8 - Input is channel interleaved - Input channels are separate words - Input value extraction is done in input table lookup - - Output channels per pixel = 4 - Output channel 0 bits = 8 - Output channel 0 increment = 4 - Output channel 1 bits = 8 - Output channel 1 increment = 4 - Output channel 2 bits = 8 - Output channel 2 increment = 4 - Output channel 3 bits = 8 - Output channel 3 increment = 4 - Output is channel interleaved - - Output channels are separate words - Weight+voffset bits = 32 - Interpolation table index bits = 32 - Interpolation table max resolution = 9 - */ - -/* - 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 <memory.h> -#include "imdi_imp.h" -#define IMDI_INCLUDED -#endif /* IMDI_INCLUDED */ - -#ifndef DEFINED_pointer -#define DEFINED_pointer -typedef unsigned char * pointer; -#endif - -/* Input table interp. index */ -#define IT_IX(p, off) *((unsigned int *)((p) + 0 + (off) * 8)) - -/* Input table input weighting/offset value enty */ -#define IT_WO(p, off) *((unsigned int *)((p) + 4 + (off) * 8)) - -/* Conditional exchange for sorting */ -#define CEX(A, B) if (A < B) { A ^= B; B ^= A; A ^= B; } - -/* Interpolation multi-dim. table access */ -#define IM_O(off) ((off) * 8) - -/* Interpolation table - get vertex values */ -#define IM_FE(p, v, c) *((unsigned int *)((p) + (v) * 8 + (c) * 4)) - -/* Output table indexes */ -#define OT_E(p, off) *((unsigned char *)((p) + (off) * 1)) - -static void -imdi_k21( -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 * 8 ; - pointer it0 = (pointer)p->in_tables[0]; - pointer it1 = (pointer)p->in_tables[1]; - pointer it2 = (pointer)p->in_tables[2]; - pointer it3 = (pointer)p->in_tables[3]; - pointer it4 = (pointer)p->in_tables[4]; - pointer it5 = (pointer)p->in_tables[5]; - pointer it6 = (pointer)p->in_tables[6]; - pointer it7 = (pointer)p->in_tables[7]; - pointer ot0 = (pointer)p->out_tables[0]; - pointer ot1 = (pointer)p->out_tables[1]; - pointer ot2 = (pointer)p->out_tables[2]; - pointer ot3 = (pointer)p->out_tables[3]; - pointer im_base = (pointer)p->im_table; - - for(;ip0 < ep; ip0 += 8, op0 += 4) { - unsigned int ova0; /* Output value accumulator */ - unsigned int ova1; /* Output value accumulator */ - { - pointer imp; - unsigned int wo0; /* Weighting value and vertex offset variable */ - unsigned int wo1; /* Weighting value and vertex offset variable */ - unsigned int wo2; /* Weighting value and vertex offset variable */ - unsigned int wo3; /* Weighting value and vertex offset variable */ - unsigned int wo4; /* Weighting value and vertex offset variable */ - unsigned int wo5; /* Weighting value and vertex offset variable */ - unsigned int wo6; /* Weighting value and vertex offset variable */ - unsigned int wo7; /* Weighting value and vertex offset variable */ - { - unsigned int ti_i; /* Interpolation index variable */ - - ti_i = IT_IX(it0, ip0[0]); - wo0 = IT_WO(it0, ip0[0]); - ti_i += IT_IX(it1, ip0[1]); - wo1 = IT_WO(it1, ip0[1]); - ti_i += IT_IX(it2, ip0[2]); - wo2 = IT_WO(it2, ip0[2]); - ti_i += IT_IX(it3, ip0[3]); - wo3 = IT_WO(it3, ip0[3]); - ti_i += IT_IX(it4, ip0[4]); - wo4 = IT_WO(it4, ip0[4]); - ti_i += IT_IX(it5, ip0[5]); - wo5 = IT_WO(it5, ip0[5]); - ti_i += IT_IX(it6, ip0[6]); - wo6 = IT_WO(it6, ip0[6]); - ti_i += IT_IX(it7, ip0[7]); - wo7 = IT_WO(it7, ip0[7]); - - imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */ - - /* Sort weighting values and vertex offset values */ - CEX(wo0, wo1); - CEX(wo0, wo2); - CEX(wo0, wo3); - CEX(wo0, wo4); - CEX(wo0, wo5); - CEX(wo0, wo6); - CEX(wo0, wo7); - CEX(wo1, wo2); - CEX(wo1, wo3); - CEX(wo1, wo4); - CEX(wo1, wo5); - CEX(wo1, wo6); - CEX(wo1, wo7); - CEX(wo2, wo3); - CEX(wo2, wo4); - CEX(wo2, wo5); - CEX(wo2, wo6); - CEX(wo2, wo7); - CEX(wo3, wo4); - CEX(wo3, wo5); - CEX(wo3, wo6); - CEX(wo3, wo7); - CEX(wo4, wo5); - CEX(wo4, wo6); - CEX(wo4, wo7); - CEX(wo5, wo6); - CEX(wo5, wo7); - CEX(wo6, wo7); - } - { - unsigned int nvof; /* Next vertex offset value */ - unsigned int vof; /* Vertex offset value */ - unsigned int vwe; /* Vertex weighting */ - - vof = 0; /* First vertex offset is 0 */ - nvof = (wo0 & 0x7fffff); /* Extract offset value */ - wo0 = (wo0 >> 23); /* Extract weighting value */ - vwe = 256 - wo0; /* Baricentric weighting */ - ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo1 & 0x7fffff); /* Extract offset value */ - wo1 = (wo1 >> 23); /* Extract weighting value */ - vwe = wo0 - wo1; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo2 & 0x7fffff); /* Extract offset value */ - wo2 = (wo2 >> 23); /* Extract weighting value */ - vwe = wo1 - wo2; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo3 & 0x7fffff); /* Extract offset value */ - wo3 = (wo3 >> 23); /* Extract weighting value */ - vwe = wo2 - wo3; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo4 & 0x7fffff); /* Extract offset value */ - wo4 = (wo4 >> 23); /* Extract weighting value */ - vwe = wo3 - wo4; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo5 & 0x7fffff); /* Extract offset value */ - wo5 = (wo5 >> 23); /* Extract weighting value */ - vwe = wo4 - wo5; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo6 & 0x7fffff); /* Extract offset value */ - wo6 = (wo6 >> 23); /* Extract weighting value */ - vwe = wo5 - wo6; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo7 & 0x7fffff); /* Extract offset value */ - wo7 = (wo7 >> 23); /* Extract weighting value */ - vwe = wo6 - wo7; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - vwe = wo7; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate 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 */ - oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */ - op0[1] = OT_E(ot1, oti); /* Write result */ - oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */ - op0[2] = OT_E(ot2, oti); /* Write result */ - oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */ - op0[3] = OT_E(ot3, oti); /* Write result */ - } - } -} -#undef IT_WO -#undef IT_IX -#undef CEX -#undef IM_O -#undef IM_FE -#undef OT_E - -static void -imdi_k21_gen( -genspec *g /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x4c, 0x69, 0x6e, 0x75, - 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x79, 0x72, - 0x74, 0x6c, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x09, 0x00, 0x00, 0x00, 0x00, 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, 0x04, 0x08, - 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08, - 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7, - 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7, - 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08, - 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00, - 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7, - 0x2c, 0xf3, 0xdc, 0xb7, 0x38, 0x5f, 0x34, 0x5f, - 0x69, 0x38, 0x5f, 0x69, 0x38, 0x5f, 0x66, 0x00, - 0x8e, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00, - 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf, - 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08, - 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf, - 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x32, 0x31, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01, - 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7, - 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7, - 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08, - 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08, - 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf, - 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7, - 0x00, 0xf0, 0x04, 0x08 - }; /* Structure image */ - - memcpy(g, data, sizeof(data)); /* Initialise the structure */ -} - -static void -imdi_k21_tab( -tabspec *t /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0x34, 0x00, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x52, 0xca, 0x04, 0x08, - 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf, - 0x20, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff, - 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff - }; /* Structure image */ - - memcpy(t, data, sizeof(data)); /* Initialise the structure */ -} - -/* 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 = 5 - Output channel 0 bits = 8 - Output channel 0 increment = 5 - Output channel 1 bits = 8 - Output channel 1 increment = 5 - Output channel 2 bits = 8 - Output channel 2 increment = 5 - Output channel 3 bits = 8 - Output channel 3 increment = 5 - Output channel 4 bits = 8 - Output channel 4 increment = 5 - 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 = 255 - */ - -/* - 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 <memory.h> -#include "imdi_imp.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) * 12) - -/* Interpolation table - get vertex values */ -#define IM_FE(p, v, c) *((unsigned int *)((p) + (v) * 4 + (c) * 4)) -#define IM_PE(p, v) *((unsigned int *)((p) + 8 + (v) * 4)) - -/* Output table indexes */ -#define OT_E(p, off) *((unsigned char *)((p) + (off) * 1)) - -static void -imdi_k22( -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 ot1 = (pointer)p->out_tables[1]; - pointer ot2 = (pointer)p->out_tables[2]; - pointer ot3 = (pointer)p->out_tables[3]; - pointer ot4 = (pointer)p->out_tables[4]; - pointer sw_base = (pointer)p->sw_table; - pointer im_base = (pointer)p->im_table; - - for(;ip0 < ep; ip0 += 1, op0 += 5) { - unsigned int ova0; /* Output value accumulator */ - unsigned int ova1; /* Output value accumulator */ - unsigned int ova2; /* 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_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 = 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_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += 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 */ - oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */ - op0[1] = OT_E(ot1, oti); /* Write result */ - oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */ - op0[2] = OT_E(ot2, oti); /* Write result */ - oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */ - op0[3] = OT_E(ot3, oti); /* Write result */ - oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */ - op0[4] = OT_E(ot4, oti); /* Write result */ - } - } -} -#undef IT_IT -#undef SW_O -#undef SX_WO -#undef IM_O -#undef IM_FE -#undef IM_PE -#undef OT_E - -static void -imdi_k22_gen( -genspec *g /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x05, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x74, 0x6c, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0xff, 0x00, 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, 0x04, 0x08, - 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08, - 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7, - 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7, - 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08, - 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00, - 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7, - 0x2c, 0xf3, 0xdc, 0xb7, 0x31, 0x5f, 0x35, 0x5f, - 0x69, 0x38, 0x5f, 0x69, 0x38, 0x5f, 0x66, 0x00, - 0x8e, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00, - 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf, - 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08, - 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf, - 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x32, 0x32, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01, - 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7, - 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7, - 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08, - 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08, - 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf, - 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7, - 0x00, 0xf0, 0x04, 0x08 - }; /* Structure image */ - - memcpy(g, data, sizeof(data)); /* Initialise the structure */ -} - -static void -imdi_k22_tab( -tabspec *t /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x0c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x20, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff, - 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff - }; /* Structure image */ - - memcpy(t, data, sizeof(data)); /* Initialise the structure */ -} - -/* 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 = 3 - Input channel 0 bits = 8 - Input channel 0 increment = 3 - Input channel 1 bits = 8 - Input channel 1 increment = 3 - Input channel 2 bits = 8 - Input channel 2 increment = 3 - Input is channel interleaved - Input channels are separate words - Input value extraction is done in input table lookup - - Output channels per pixel = 5 - Output channel 0 bits = 8 - Output channel 0 increment = 5 - Output channel 1 bits = 8 - Output channel 1 increment = 5 - Output channel 2 bits = 8 - Output channel 2 increment = 5 - Output channel 3 bits = 8 - Output channel 3 increment = 5 - Output channel 4 bits = 8 - Output channel 4 increment = 5 - Output is channel interleaved - - Output channels are separate words - Simplex table index bits = 12 - Interpolation table index bits = 20 - Simplex table max resolution = 16 - Interpolation table max resolution = 101 - */ - -/* - 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 <memory.h> -#include "imdi_imp.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 int *)((p) + 0 + (off) * 4)) - -/* Simplex weighting table access */ -#define SW_O(off) ((off) * 16) - -/* Simplex table - get weighting value */ -#define SX_WE(p, v) *((unsigned short *)((p) + (v) * 4 + 0)) - -/* Simplex table - get offset value */ -#define SX_VO(p, v) *((unsigned short *)((p) + (v) * 4 + 2)) - -/* Interpolation multi-dim. table access */ -#define IM_O(off) ((off) * 12) - -/* Interpolation table - get vertex values */ -#define IM_FE(p, v, c) *((unsigned int *)((p) + (v) * 4 + (c) * 4)) -#define IM_PE(p, v) *((unsigned int *)((p) + 8 + (v) * 4)) - -/* Output table indexes */ -#define OT_E(p, off) *((unsigned char *)((p) + (off) * 1)) - -static void -imdi_k23( -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 * 3 ; - pointer it0 = (pointer)p->in_tables[0]; - pointer it1 = (pointer)p->in_tables[1]; - pointer it2 = (pointer)p->in_tables[2]; - pointer ot0 = (pointer)p->out_tables[0]; - pointer ot1 = (pointer)p->out_tables[1]; - pointer ot2 = (pointer)p->out_tables[2]; - pointer ot3 = (pointer)p->out_tables[3]; - pointer ot4 = (pointer)p->out_tables[4]; - pointer sw_base = (pointer)p->sw_table; - pointer im_base = (pointer)p->im_table; - - for(;ip0 < ep; ip0 += 3, op0 += 5) { - unsigned int ova0; /* Output value accumulator */ - unsigned int ova1; /* Output value accumulator */ - unsigned int ova2; /* Output value partial accumulator */ - { - pointer swp; - pointer imp; - { - unsigned int ti; /* Simplex+Interpolation index variable */ - - ti = IT_IT(it0, ip0[0]); - ti += IT_IT(it1, ip0[1]); - ti += IT_IT(it2, ip0[2]); - - imp = im_base + IM_O(ti >> 12); /* Extract interp. index and comp. entry */ - swp = sw_base + SW_O(ti & 0xfff); /* Extract simplex index and comp. entry */ - } - { - unsigned int vof; /* Vertex offset value */ - unsigned int vwe; /* Vertex weighting */ - - vof = SX_VO(swp, 0); /* Read vertex offset value */ - vwe = SX_WE(swp, 0); /* Read vertex weighting value */ - ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof = SX_VO(swp, 1); /* Read vertex offset value */ - vwe = SX_WE(swp, 1); /* Read vertex weighting value */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof = SX_VO(swp, 2); /* Read vertex offset value */ - vwe = SX_WE(swp, 2); /* Read vertex weighting value */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof = SX_VO(swp, 3); /* Read vertex offset value */ - vwe = SX_WE(swp, 3); /* Read vertex weighting value */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += 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 */ - oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */ - op0[1] = OT_E(ot1, oti); /* Write result */ - oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */ - op0[2] = OT_E(ot2, oti); /* Write result */ - oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */ - op0[3] = OT_E(ot3, oti); /* Write result */ - oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */ - op0[4] = OT_E(ot4, oti); /* Write result */ - } - } -} -#undef IT_IT -#undef SW_O -#undef SX_WE -#undef SX_VO -#undef IM_O -#undef IM_FE -#undef IM_PE -#undef OT_E - -static void -imdi_k23_gen( -genspec *g /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x08, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x05, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x74, 0x6c, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x65, 0x00, 0x00, 0x00, 0x10, 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, 0x04, 0x08, - 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08, - 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7, - 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7, - 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08, - 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00, - 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7, - 0x2c, 0xf3, 0xdc, 0xb7, 0x33, 0x5f, 0x35, 0x5f, - 0x69, 0x38, 0x5f, 0x69, 0x38, 0x5f, 0x66, 0x00, - 0x8e, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00, - 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf, - 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08, - 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf, - 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x32, 0x33, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01, - 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7, - 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7, - 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08, - 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08, - 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf, - 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7, - 0x00, 0xf0, 0x04, 0x08 - }; /* Structure image */ - - memcpy(g, data, sizeof(data)); /* Initialise the structure */ -} - -static void -imdi_k23_tab( -tabspec *t /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x14, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x0c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x20, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff, - 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff - }; /* Structure image */ - - memcpy(t, data, sizeof(data)); /* Initialise the structure */ -} - -/* 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 = 4 - Input channel 0 bits = 8 - Input channel 0 increment = 4 - Input channel 1 bits = 8 - Input channel 1 increment = 4 - Input channel 2 bits = 8 - Input channel 2 increment = 4 - Input channel 3 bits = 8 - Input channel 3 increment = 4 - Input is channel interleaved - Input channels are separate words - Input value extraction is done in input table lookup - - Output channels per pixel = 5 - Output channel 0 bits = 8 - Output channel 0 increment = 5 - Output channel 1 bits = 8 - Output channel 1 increment = 5 - Output channel 2 bits = 8 - Output channel 2 increment = 5 - Output channel 3 bits = 8 - Output channel 3 increment = 5 - Output channel 4 bits = 8 - Output channel 4 increment = 5 - Output is channel interleaved - - Output channels are separate words - Simplex table index bits = 32 - Interpolation table index bits = 32 - Simplex table max resolution = 255 - Interpolation table max resolution = 27 - */ - -/* - 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 <memory.h> -#include "imdi_imp.h" -#define IMDI_INCLUDED -#endif /* IMDI_INCLUDED */ - -#ifndef DEFINED_pointer -#define DEFINED_pointer -typedef unsigned char * pointer; -#endif - -/* Input table interp. index */ -#define IT_IX(p, off) *((unsigned int *)((p) + 4 + (off) * 8)) - -/* Input table simplex index enty */ -#define IT_SX(p, off) *((unsigned int *)((p) + 0 + (off) * 8)) - -/* Simplex weighting table access */ -#define SW_O(off) ((off) * 20) - -/* Simplex table - get weighting value */ -#define SX_WE(p, v) *((unsigned short *)((p) + (v) * 4 + 0)) - -/* Simplex table - get offset value */ -#define SX_VO(p, v) *((unsigned short *)((p) + (v) * 4 + 2)) - -/* Interpolation multi-dim. table access */ -#define IM_O(off) ((off) * 12) - -/* Interpolation table - get vertex values */ -#define IM_FE(p, v, c) *((unsigned int *)((p) + (v) * 4 + (c) * 4)) -#define IM_PE(p, v) *((unsigned int *)((p) + 8 + (v) * 4)) - -/* Output table indexes */ -#define OT_E(p, off) *((unsigned char *)((p) + (off) * 1)) - -static void -imdi_k24( -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 * 4 ; - pointer it0 = (pointer)p->in_tables[0]; - pointer it1 = (pointer)p->in_tables[1]; - pointer it2 = (pointer)p->in_tables[2]; - pointer it3 = (pointer)p->in_tables[3]; - pointer ot0 = (pointer)p->out_tables[0]; - pointer ot1 = (pointer)p->out_tables[1]; - pointer ot2 = (pointer)p->out_tables[2]; - pointer ot3 = (pointer)p->out_tables[3]; - pointer ot4 = (pointer)p->out_tables[4]; - pointer sw_base = (pointer)p->sw_table; - pointer im_base = (pointer)p->im_table; - - for(;ip0 < ep; ip0 += 4, op0 += 5) { - unsigned int ova0; /* Output value accumulator */ - unsigned int ova1; /* Output value accumulator */ - unsigned int ova2; /* Output value partial accumulator */ - { - pointer swp; - pointer imp; - { - unsigned int ti_s; /* Simplex index variable */ - unsigned int ti_i; /* Interpolation index variable */ - - ti_i = IT_IX(it0, ip0[0]); - ti_s = IT_SX(it0, ip0[0]); - ti_i += IT_IX(it1, ip0[1]); - ti_s += IT_SX(it1, ip0[1]); - ti_i += IT_IX(it2, ip0[2]); - ti_s += IT_SX(it2, ip0[2]); - ti_i += IT_IX(it3, ip0[3]); - ti_s += IT_SX(it3, ip0[3]); - - swp = sw_base + SW_O(ti_s); /* Compute simplex table entry pointer */ - imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */ - } - { - unsigned int vof; /* Vertex offset value */ - unsigned int vwe; /* Vertex weighting */ - - vof = SX_VO(swp, 0); /* Read vertex offset value */ - vwe = SX_WE(swp, 0); /* Read vertex weighting value */ - ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof = SX_VO(swp, 1); /* Read vertex offset value */ - vwe = SX_WE(swp, 1); /* Read vertex weighting value */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof = SX_VO(swp, 2); /* Read vertex offset value */ - vwe = SX_WE(swp, 2); /* Read vertex weighting value */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof = SX_VO(swp, 3); /* Read vertex offset value */ - vwe = SX_WE(swp, 3); /* Read vertex weighting value */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof = SX_VO(swp, 4); /* Read vertex offset value */ - vwe = SX_WE(swp, 4); /* Read vertex weighting value */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += 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 */ - oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */ - op0[1] = OT_E(ot1, oti); /* Write result */ - oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */ - op0[2] = OT_E(ot2, oti); /* Write result */ - oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */ - op0[3] = OT_E(ot3, oti); /* Write result */ - oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */ - op0[4] = OT_E(ot4, oti); /* Write result */ - } - } -} -#undef IT_IX -#undef IT_SX -#undef SW_O -#undef SX_WE -#undef SX_VO -#undef IM_O -#undef IM_FE -#undef IM_PE -#undef OT_E - -static void -imdi_k24_gen( -genspec *g /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x05, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x74, 0x6c, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x1b, 0x00, 0x00, 0x00, 0xff, 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, 0x04, 0x08, - 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08, - 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7, - 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7, - 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08, - 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00, - 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7, - 0x2c, 0xf3, 0xdc, 0xb7, 0x34, 0x5f, 0x35, 0x5f, - 0x69, 0x38, 0x5f, 0x69, 0x38, 0x5f, 0x66, 0x00, - 0x8e, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00, - 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf, - 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08, - 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf, - 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x32, 0x34, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01, - 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7, - 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7, - 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08, - 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08, - 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf, - 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7, - 0x00, 0xf0, 0x04, 0x08 - }; /* Structure image */ - - memcpy(g, data, sizeof(data)); /* Initialise the structure */ -} - -static void -imdi_k24_tab( -tabspec *t /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x14, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x0c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x20, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff, - 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff - }; /* Structure image */ - - memcpy(t, data, sizeof(data)); /* Initialise the structure */ -} - -/* 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 = 5 - Input channel 0 bits = 8 - Input channel 0 increment = 5 - Input channel 1 bits = 8 - Input channel 1 increment = 5 - Input channel 2 bits = 8 - Input channel 2 increment = 5 - Input channel 3 bits = 8 - Input channel 3 increment = 5 - Input channel 4 bits = 8 - Input channel 4 increment = 5 - Input is channel interleaved - Input channels are separate words - Input value extraction is done in input table lookup - - Output channels per pixel = 5 - Output channel 0 bits = 8 - Output channel 0 increment = 5 - Output channel 1 bits = 8 - Output channel 1 increment = 5 - Output channel 2 bits = 8 - Output channel 2 increment = 5 - Output channel 3 bits = 8 - Output channel 3 increment = 5 - Output channel 4 bits = 8 - Output channel 4 increment = 5 - Output is channel interleaved - - Output channels are separate words - Weight+voffset bits = 32 - Interpolation table index bits = 32 - Interpolation table max resolution = 40 - */ - -/* - 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 <memory.h> -#include "imdi_imp.h" -#define IMDI_INCLUDED -#endif /* IMDI_INCLUDED */ - -#ifndef DEFINED_pointer -#define DEFINED_pointer -typedef unsigned char * pointer; -#endif - -/* Input table interp. index */ -#define IT_IX(p, off) *((unsigned int *)((p) + 0 + (off) * 8)) - -/* Input table input weighting/offset value enty */ -#define IT_WO(p, off) *((unsigned int *)((p) + 4 + (off) * 8)) - -/* Conditional exchange for sorting */ -#define CEX(A, B) if (A < B) { A ^= B; B ^= A; A ^= B; } - -/* Interpolation multi-dim. table access */ -#define IM_O(off) ((off) * 12) - -/* Interpolation table - get vertex values */ -#define IM_FE(p, v, c) *((unsigned int *)((p) + (v) * 4 + (c) * 4)) -#define IM_PE(p, v) *((unsigned int *)((p) + 8 + (v) * 4)) - -/* Output table indexes */ -#define OT_E(p, off) *((unsigned char *)((p) + (off) * 1)) - -static void -imdi_k25( -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 * 5 ; - pointer it0 = (pointer)p->in_tables[0]; - pointer it1 = (pointer)p->in_tables[1]; - pointer it2 = (pointer)p->in_tables[2]; - pointer it3 = (pointer)p->in_tables[3]; - pointer it4 = (pointer)p->in_tables[4]; - pointer ot0 = (pointer)p->out_tables[0]; - pointer ot1 = (pointer)p->out_tables[1]; - pointer ot2 = (pointer)p->out_tables[2]; - pointer ot3 = (pointer)p->out_tables[3]; - pointer ot4 = (pointer)p->out_tables[4]; - pointer im_base = (pointer)p->im_table; - - for(;ip0 < ep; ip0 += 5, op0 += 5) { - unsigned int ova0; /* Output value accumulator */ - unsigned int ova1; /* Output value accumulator */ - unsigned int ova2; /* Output value partial accumulator */ - { - pointer imp; - unsigned int wo0; /* Weighting value and vertex offset variable */ - unsigned int wo1; /* Weighting value and vertex offset variable */ - unsigned int wo2; /* Weighting value and vertex offset variable */ - unsigned int wo3; /* Weighting value and vertex offset variable */ - unsigned int wo4; /* Weighting value and vertex offset variable */ - { - unsigned int ti_i; /* Interpolation index variable */ - - ti_i = IT_IX(it0, ip0[0]); - wo0 = IT_WO(it0, ip0[0]); - ti_i += IT_IX(it1, ip0[1]); - wo1 = IT_WO(it1, ip0[1]); - ti_i += IT_IX(it2, ip0[2]); - wo2 = IT_WO(it2, ip0[2]); - ti_i += IT_IX(it3, ip0[3]); - wo3 = IT_WO(it3, ip0[3]); - ti_i += IT_IX(it4, ip0[4]); - wo4 = IT_WO(it4, ip0[4]); - - imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */ - - /* Sort weighting values and vertex offset values */ - CEX(wo0, wo1); - CEX(wo0, wo2); - CEX(wo0, wo3); - CEX(wo0, wo4); - CEX(wo1, wo2); - CEX(wo1, wo3); - CEX(wo1, wo4); - CEX(wo2, wo3); - CEX(wo2, wo4); - CEX(wo3, wo4); - } - { - unsigned int nvof; /* Next vertex offset value */ - unsigned int vof; /* Vertex offset value */ - unsigned int vwe; /* Vertex weighting */ - - vof = 0; /* First vertex offset is 0 */ - nvof = (wo0 & 0x7fffff); /* Extract offset value */ - wo0 = (wo0 >> 23); /* Extract weighting value */ - vwe = 256 - wo0; /* Baricentric weighting */ - ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo1 & 0x7fffff); /* Extract offset value */ - wo1 = (wo1 >> 23); /* Extract weighting value */ - vwe = wo0 - wo1; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo2 & 0x7fffff); /* Extract offset value */ - wo2 = (wo2 >> 23); /* Extract weighting value */ - vwe = wo1 - wo2; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo3 & 0x7fffff); /* Extract offset value */ - wo3 = (wo3 >> 23); /* Extract weighting value */ - vwe = wo2 - wo3; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo4 & 0x7fffff); /* Extract offset value */ - wo4 = (wo4 >> 23); /* Extract weighting value */ - vwe = wo3 - wo4; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - vwe = wo4; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += 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 */ - oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */ - op0[1] = OT_E(ot1, oti); /* Write result */ - oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */ - op0[2] = OT_E(ot2, oti); /* Write result */ - oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */ - op0[3] = OT_E(ot3, oti); /* Write result */ - oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */ - op0[4] = OT_E(ot4, oti); /* Write result */ - } - } -} -#undef IT_WO -#undef IT_IX -#undef CEX -#undef IM_O -#undef IM_FE -#undef IM_PE -#undef OT_E - -static void -imdi_k25_gen( -genspec *g /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x08, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x05, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x74, 0x6c, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x28, 0x00, 0x00, 0x00, 0x00, 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, 0x04, 0x08, - 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08, - 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7, - 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7, - 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08, - 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00, - 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7, - 0x2c, 0xf3, 0xdc, 0xb7, 0x35, 0x5f, 0x35, 0x5f, - 0x69, 0x38, 0x5f, 0x69, 0x38, 0x5f, 0x66, 0x00, - 0x8e, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00, - 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf, - 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08, - 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf, - 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x32, 0x35, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01, - 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7, - 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7, - 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08, - 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08, - 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf, - 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7, - 0x00, 0xf0, 0x04, 0x08 - }; /* Structure image */ - - memcpy(g, data, sizeof(data)); /* Initialise the structure */ -} - -static void -imdi_k25_tab( -tabspec *t /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x0c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x20, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff, - 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff - }; /* Structure image */ - - memcpy(t, data, sizeof(data)); /* Initialise the structure */ -} - -/* 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 = 6 - Input channel 0 bits = 8 - Input channel 0 increment = 6 - Input channel 1 bits = 8 - Input channel 1 increment = 6 - Input channel 2 bits = 8 - Input channel 2 increment = 6 - Input channel 3 bits = 8 - Input channel 3 increment = 6 - Input channel 4 bits = 8 - Input channel 4 increment = 6 - Input channel 5 bits = 8 - Input channel 5 increment = 6 - Input is channel interleaved - Input channels are separate words - Input value extraction is done in input table lookup - - Output channels per pixel = 5 - Output channel 0 bits = 8 - Output channel 0 increment = 5 - Output channel 1 bits = 8 - Output channel 1 increment = 5 - Output channel 2 bits = 8 - Output channel 2 increment = 5 - Output channel 3 bits = 8 - Output channel 3 increment = 5 - Output channel 4 bits = 8 - Output channel 4 increment = 5 - Output is channel interleaved - - Output channels are separate words - Weight+voffset bits = 32 - Interpolation table index bits = 32 - Interpolation table max resolution = 19 - */ - -/* - 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 <memory.h> -#include "imdi_imp.h" -#define IMDI_INCLUDED -#endif /* IMDI_INCLUDED */ - -#ifndef DEFINED_pointer -#define DEFINED_pointer -typedef unsigned char * pointer; -#endif - -/* Input table interp. index */ -#define IT_IX(p, off) *((unsigned int *)((p) + 0 + (off) * 8)) - -/* Input table input weighting/offset value enty */ -#define IT_WO(p, off) *((unsigned int *)((p) + 4 + (off) * 8)) - -/* Conditional exchange for sorting */ -#define CEX(A, B) if (A < B) { A ^= B; B ^= A; A ^= B; } - -/* Interpolation multi-dim. table access */ -#define IM_O(off) ((off) * 12) - -/* Interpolation table - get vertex values */ -#define IM_FE(p, v, c) *((unsigned int *)((p) + (v) * 4 + (c) * 4)) -#define IM_PE(p, v) *((unsigned int *)((p) + 8 + (v) * 4)) - -/* Output table indexes */ -#define OT_E(p, off) *((unsigned char *)((p) + (off) * 1)) - -static void -imdi_k26( -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 * 6 ; - pointer it0 = (pointer)p->in_tables[0]; - pointer it1 = (pointer)p->in_tables[1]; - pointer it2 = (pointer)p->in_tables[2]; - pointer it3 = (pointer)p->in_tables[3]; - pointer it4 = (pointer)p->in_tables[4]; - pointer it5 = (pointer)p->in_tables[5]; - pointer ot0 = (pointer)p->out_tables[0]; - pointer ot1 = (pointer)p->out_tables[1]; - pointer ot2 = (pointer)p->out_tables[2]; - pointer ot3 = (pointer)p->out_tables[3]; - pointer ot4 = (pointer)p->out_tables[4]; - pointer im_base = (pointer)p->im_table; - - for(;ip0 < ep; ip0 += 6, op0 += 5) { - unsigned int ova0; /* Output value accumulator */ - unsigned int ova1; /* Output value accumulator */ - unsigned int ova2; /* Output value partial accumulator */ - { - pointer imp; - unsigned int wo0; /* Weighting value and vertex offset variable */ - unsigned int wo1; /* Weighting value and vertex offset variable */ - unsigned int wo2; /* Weighting value and vertex offset variable */ - unsigned int wo3; /* Weighting value and vertex offset variable */ - unsigned int wo4; /* Weighting value and vertex offset variable */ - unsigned int wo5; /* Weighting value and vertex offset variable */ - { - unsigned int ti_i; /* Interpolation index variable */ - - ti_i = IT_IX(it0, ip0[0]); - wo0 = IT_WO(it0, ip0[0]); - ti_i += IT_IX(it1, ip0[1]); - wo1 = IT_WO(it1, ip0[1]); - ti_i += IT_IX(it2, ip0[2]); - wo2 = IT_WO(it2, ip0[2]); - ti_i += IT_IX(it3, ip0[3]); - wo3 = IT_WO(it3, ip0[3]); - ti_i += IT_IX(it4, ip0[4]); - wo4 = IT_WO(it4, ip0[4]); - ti_i += IT_IX(it5, ip0[5]); - wo5 = IT_WO(it5, ip0[5]); - - imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */ - - /* Sort weighting values and vertex offset values */ - CEX(wo0, wo1); - CEX(wo0, wo2); - CEX(wo0, wo3); - CEX(wo0, wo4); - CEX(wo0, wo5); - CEX(wo1, wo2); - CEX(wo1, wo3); - CEX(wo1, wo4); - CEX(wo1, wo5); - CEX(wo2, wo3); - CEX(wo2, wo4); - CEX(wo2, wo5); - CEX(wo3, wo4); - CEX(wo3, wo5); - CEX(wo4, wo5); - } - { - unsigned int nvof; /* Next vertex offset value */ - unsigned int vof; /* Vertex offset value */ - unsigned int vwe; /* Vertex weighting */ - - vof = 0; /* First vertex offset is 0 */ - nvof = (wo0 & 0x7fffff); /* Extract offset value */ - wo0 = (wo0 >> 23); /* Extract weighting value */ - vwe = 256 - wo0; /* Baricentric weighting */ - ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo1 & 0x7fffff); /* Extract offset value */ - wo1 = (wo1 >> 23); /* Extract weighting value */ - vwe = wo0 - wo1; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo2 & 0x7fffff); /* Extract offset value */ - wo2 = (wo2 >> 23); /* Extract weighting value */ - vwe = wo1 - wo2; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo3 & 0x7fffff); /* Extract offset value */ - wo3 = (wo3 >> 23); /* Extract weighting value */ - vwe = wo2 - wo3; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo4 & 0x7fffff); /* Extract offset value */ - wo4 = (wo4 >> 23); /* Extract weighting value */ - vwe = wo3 - wo4; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo5 & 0x7fffff); /* Extract offset value */ - wo5 = (wo5 >> 23); /* Extract weighting value */ - vwe = wo4 - wo5; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - vwe = wo5; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += 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 */ - oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */ - op0[1] = OT_E(ot1, oti); /* Write result */ - oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */ - op0[2] = OT_E(ot2, oti); /* Write result */ - oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */ - op0[3] = OT_E(ot3, oti); /* Write result */ - oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */ - op0[4] = OT_E(ot4, oti); /* Write result */ - } - } -} -#undef IT_WO -#undef IT_IX -#undef CEX -#undef IM_O -#undef IM_FE -#undef IM_PE -#undef OT_E - -static void -imdi_k26_gen( -genspec *g /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x08, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x05, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x74, 0x6c, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x13, 0x00, 0x00, 0x00, 0x00, 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, 0x04, 0x08, - 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08, - 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7, - 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7, - 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08, - 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00, - 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7, - 0x2c, 0xf3, 0xdc, 0xb7, 0x36, 0x5f, 0x35, 0x5f, - 0x69, 0x38, 0x5f, 0x69, 0x38, 0x5f, 0x66, 0x00, - 0x8e, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00, - 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf, - 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08, - 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf, - 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x32, 0x36, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01, - 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7, - 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7, - 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08, - 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08, - 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf, - 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7, - 0x00, 0xf0, 0x04, 0x08 - }; /* Structure image */ - - memcpy(g, data, sizeof(data)); /* Initialise the structure */ -} - -static void -imdi_k26_tab( -tabspec *t /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x0c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x20, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff, - 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff - }; /* Structure image */ - - memcpy(t, data, sizeof(data)); /* Initialise the structure */ -} - -/* 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 = 7 - Input channel 0 bits = 8 - Input channel 0 increment = 7 - Input channel 1 bits = 8 - Input channel 1 increment = 7 - Input channel 2 bits = 8 - Input channel 2 increment = 7 - Input channel 3 bits = 8 - Input channel 3 increment = 7 - Input channel 4 bits = 8 - Input channel 4 increment = 7 - Input channel 5 bits = 8 - Input channel 5 increment = 7 - Input channel 6 bits = 8 - Input channel 6 increment = 7 - Input is channel interleaved - Input channels are separate words - Input value extraction is done in input table lookup - - Output channels per pixel = 5 - Output channel 0 bits = 8 - Output channel 0 increment = 5 - Output channel 1 bits = 8 - Output channel 1 increment = 5 - Output channel 2 bits = 8 - Output channel 2 increment = 5 - Output channel 3 bits = 8 - Output channel 3 increment = 5 - Output channel 4 bits = 8 - Output channel 4 increment = 5 - Output is channel interleaved - - Output channels are separate words - Weight+voffset bits = 32 - Interpolation table index bits = 32 - Interpolation table max resolution = 11 - */ - -/* - 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 <memory.h> -#include "imdi_imp.h" -#define IMDI_INCLUDED -#endif /* IMDI_INCLUDED */ - -#ifndef DEFINED_pointer -#define DEFINED_pointer -typedef unsigned char * pointer; -#endif - -/* Input table interp. index */ -#define IT_IX(p, off) *((unsigned int *)((p) + 0 + (off) * 8)) - -/* Input table input weighting/offset value enty */ -#define IT_WO(p, off) *((unsigned int *)((p) + 4 + (off) * 8)) - -/* Conditional exchange for sorting */ -#define CEX(A, B) if (A < B) { A ^= B; B ^= A; A ^= B; } - -/* Interpolation multi-dim. table access */ -#define IM_O(off) ((off) * 12) - -/* Interpolation table - get vertex values */ -#define IM_FE(p, v, c) *((unsigned int *)((p) + (v) * 4 + (c) * 4)) -#define IM_PE(p, v) *((unsigned int *)((p) + 8 + (v) * 4)) - -/* Output table indexes */ -#define OT_E(p, off) *((unsigned char *)((p) + (off) * 1)) - -static void -imdi_k27( -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 * 7 ; - pointer it0 = (pointer)p->in_tables[0]; - pointer it1 = (pointer)p->in_tables[1]; - pointer it2 = (pointer)p->in_tables[2]; - pointer it3 = (pointer)p->in_tables[3]; - pointer it4 = (pointer)p->in_tables[4]; - pointer it5 = (pointer)p->in_tables[5]; - pointer it6 = (pointer)p->in_tables[6]; - pointer ot0 = (pointer)p->out_tables[0]; - pointer ot1 = (pointer)p->out_tables[1]; - pointer ot2 = (pointer)p->out_tables[2]; - pointer ot3 = (pointer)p->out_tables[3]; - pointer ot4 = (pointer)p->out_tables[4]; - pointer im_base = (pointer)p->im_table; - - for(;ip0 < ep; ip0 += 7, op0 += 5) { - unsigned int ova0; /* Output value accumulator */ - unsigned int ova1; /* Output value accumulator */ - unsigned int ova2; /* Output value partial accumulator */ - { - pointer imp; - unsigned int wo0; /* Weighting value and vertex offset variable */ - unsigned int wo1; /* Weighting value and vertex offset variable */ - unsigned int wo2; /* Weighting value and vertex offset variable */ - unsigned int wo3; /* Weighting value and vertex offset variable */ - unsigned int wo4; /* Weighting value and vertex offset variable */ - unsigned int wo5; /* Weighting value and vertex offset variable */ - unsigned int wo6; /* Weighting value and vertex offset variable */ - { - unsigned int ti_i; /* Interpolation index variable */ - - ti_i = IT_IX(it0, ip0[0]); - wo0 = IT_WO(it0, ip0[0]); - ti_i += IT_IX(it1, ip0[1]); - wo1 = IT_WO(it1, ip0[1]); - ti_i += IT_IX(it2, ip0[2]); - wo2 = IT_WO(it2, ip0[2]); - ti_i += IT_IX(it3, ip0[3]); - wo3 = IT_WO(it3, ip0[3]); - ti_i += IT_IX(it4, ip0[4]); - wo4 = IT_WO(it4, ip0[4]); - ti_i += IT_IX(it5, ip0[5]); - wo5 = IT_WO(it5, ip0[5]); - ti_i += IT_IX(it6, ip0[6]); - wo6 = IT_WO(it6, ip0[6]); - - imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */ - - /* Sort weighting values and vertex offset values */ - CEX(wo0, wo1); - CEX(wo0, wo2); - CEX(wo0, wo3); - CEX(wo0, wo4); - CEX(wo0, wo5); - CEX(wo0, wo6); - CEX(wo1, wo2); - CEX(wo1, wo3); - CEX(wo1, wo4); - CEX(wo1, wo5); - CEX(wo1, wo6); - CEX(wo2, wo3); - CEX(wo2, wo4); - CEX(wo2, wo5); - CEX(wo2, wo6); - CEX(wo3, wo4); - CEX(wo3, wo5); - CEX(wo3, wo6); - CEX(wo4, wo5); - CEX(wo4, wo6); - CEX(wo5, wo6); - } - { - unsigned int nvof; /* Next vertex offset value */ - unsigned int vof; /* Vertex offset value */ - unsigned int vwe; /* Vertex weighting */ - - vof = 0; /* First vertex offset is 0 */ - nvof = (wo0 & 0x7fffff); /* Extract offset value */ - wo0 = (wo0 >> 23); /* Extract weighting value */ - vwe = 256 - wo0; /* Baricentric weighting */ - ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo1 & 0x7fffff); /* Extract offset value */ - wo1 = (wo1 >> 23); /* Extract weighting value */ - vwe = wo0 - wo1; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo2 & 0x7fffff); /* Extract offset value */ - wo2 = (wo2 >> 23); /* Extract weighting value */ - vwe = wo1 - wo2; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo3 & 0x7fffff); /* Extract offset value */ - wo3 = (wo3 >> 23); /* Extract weighting value */ - vwe = wo2 - wo3; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo4 & 0x7fffff); /* Extract offset value */ - wo4 = (wo4 >> 23); /* Extract weighting value */ - vwe = wo3 - wo4; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo5 & 0x7fffff); /* Extract offset value */ - wo5 = (wo5 >> 23); /* Extract weighting value */ - vwe = wo4 - wo5; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo6 & 0x7fffff); /* Extract offset value */ - wo6 = (wo6 >> 23); /* Extract weighting value */ - vwe = wo5 - wo6; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - vwe = wo6; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += 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 */ - oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */ - op0[1] = OT_E(ot1, oti); /* Write result */ - oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */ - op0[2] = OT_E(ot2, oti); /* Write result */ - oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */ - op0[3] = OT_E(ot3, oti); /* Write result */ - oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */ - op0[4] = OT_E(ot4, oti); /* Write result */ - } - } -} -#undef IT_WO -#undef IT_IX -#undef CEX -#undef IM_O -#undef IM_FE -#undef IM_PE -#undef OT_E - -static void -imdi_k27_gen( -genspec *g /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x05, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x74, 0x6c, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x0b, 0x00, 0x00, 0x00, 0x00, 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, 0x04, 0x08, - 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08, - 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7, - 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7, - 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08, - 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00, - 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7, - 0x2c, 0xf3, 0xdc, 0xb7, 0x37, 0x5f, 0x35, 0x5f, - 0x69, 0x38, 0x5f, 0x69, 0x38, 0x5f, 0x66, 0x00, - 0x8e, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00, - 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf, - 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08, - 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf, - 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x32, 0x37, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01, - 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7, - 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7, - 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08, - 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08, - 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf, - 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7, - 0x00, 0xf0, 0x04, 0x08 - }; /* Structure image */ - - memcpy(g, data, sizeof(data)); /* Initialise the structure */ -} - -static void -imdi_k27_tab( -tabspec *t /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x0c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x20, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff, - 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff - }; /* Structure image */ - - memcpy(t, data, sizeof(data)); /* Initialise the structure */ -} - -/* 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 = 8 - Input channel 0 bits = 8 - Input channel 0 increment = 8 - Input channel 1 bits = 8 - Input channel 1 increment = 8 - Input channel 2 bits = 8 - Input channel 2 increment = 8 - Input channel 3 bits = 8 - Input channel 3 increment = 8 - Input channel 4 bits = 8 - Input channel 4 increment = 8 - Input channel 5 bits = 8 - Input channel 5 increment = 8 - Input channel 6 bits = 8 - Input channel 6 increment = 8 - Input channel 7 bits = 8 - Input channel 7 increment = 8 - Input is channel interleaved - Input channels are separate words - Input value extraction is done in input table lookup - - Output channels per pixel = 5 - Output channel 0 bits = 8 - Output channel 0 increment = 5 - Output channel 1 bits = 8 - Output channel 1 increment = 5 - Output channel 2 bits = 8 - Output channel 2 increment = 5 - Output channel 3 bits = 8 - Output channel 3 increment = 5 - Output channel 4 bits = 8 - Output channel 4 increment = 5 - Output is channel interleaved - - Output channels are separate words - Weight+voffset bits = 32 - Interpolation table index bits = 32 - Interpolation table max resolution = 8 - */ - -/* - 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 <memory.h> -#include "imdi_imp.h" -#define IMDI_INCLUDED -#endif /* IMDI_INCLUDED */ - -#ifndef DEFINED_pointer -#define DEFINED_pointer -typedef unsigned char * pointer; -#endif - -/* Input table interp. index */ -#define IT_IX(p, off) *((unsigned int *)((p) + 0 + (off) * 8)) - -/* Input table input weighting/offset value enty */ -#define IT_WO(p, off) *((unsigned int *)((p) + 4 + (off) * 8)) - -/* Conditional exchange for sorting */ -#define CEX(A, B) if (A < B) { A ^= B; B ^= A; A ^= B; } - -/* Interpolation multi-dim. table access */ -#define IM_O(off) ((off) * 12) - -/* Interpolation table - get vertex values */ -#define IM_FE(p, v, c) *((unsigned int *)((p) + (v) * 4 + (c) * 4)) -#define IM_PE(p, v) *((unsigned int *)((p) + 8 + (v) * 4)) - -/* Output table indexes */ -#define OT_E(p, off) *((unsigned char *)((p) + (off) * 1)) - -static void -imdi_k28( -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 * 8 ; - pointer it0 = (pointer)p->in_tables[0]; - pointer it1 = (pointer)p->in_tables[1]; - pointer it2 = (pointer)p->in_tables[2]; - pointer it3 = (pointer)p->in_tables[3]; - pointer it4 = (pointer)p->in_tables[4]; - pointer it5 = (pointer)p->in_tables[5]; - pointer it6 = (pointer)p->in_tables[6]; - pointer it7 = (pointer)p->in_tables[7]; - pointer ot0 = (pointer)p->out_tables[0]; - pointer ot1 = (pointer)p->out_tables[1]; - pointer ot2 = (pointer)p->out_tables[2]; - pointer ot3 = (pointer)p->out_tables[3]; - pointer ot4 = (pointer)p->out_tables[4]; - pointer im_base = (pointer)p->im_table; - - for(;ip0 < ep; ip0 += 8, op0 += 5) { - unsigned int ova0; /* Output value accumulator */ - unsigned int ova1; /* Output value accumulator */ - unsigned int ova2; /* Output value partial accumulator */ - { - pointer imp; - unsigned int wo0; /* Weighting value and vertex offset variable */ - unsigned int wo1; /* Weighting value and vertex offset variable */ - unsigned int wo2; /* Weighting value and vertex offset variable */ - unsigned int wo3; /* Weighting value and vertex offset variable */ - unsigned int wo4; /* Weighting value and vertex offset variable */ - unsigned int wo5; /* Weighting value and vertex offset variable */ - unsigned int wo6; /* Weighting value and vertex offset variable */ - unsigned int wo7; /* Weighting value and vertex offset variable */ - { - unsigned int ti_i; /* Interpolation index variable */ - - ti_i = IT_IX(it0, ip0[0]); - wo0 = IT_WO(it0, ip0[0]); - ti_i += IT_IX(it1, ip0[1]); - wo1 = IT_WO(it1, ip0[1]); - ti_i += IT_IX(it2, ip0[2]); - wo2 = IT_WO(it2, ip0[2]); - ti_i += IT_IX(it3, ip0[3]); - wo3 = IT_WO(it3, ip0[3]); - ti_i += IT_IX(it4, ip0[4]); - wo4 = IT_WO(it4, ip0[4]); - ti_i += IT_IX(it5, ip0[5]); - wo5 = IT_WO(it5, ip0[5]); - ti_i += IT_IX(it6, ip0[6]); - wo6 = IT_WO(it6, ip0[6]); - ti_i += IT_IX(it7, ip0[7]); - wo7 = IT_WO(it7, ip0[7]); - - imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */ - - /* Sort weighting values and vertex offset values */ - CEX(wo0, wo1); - CEX(wo0, wo2); - CEX(wo0, wo3); - CEX(wo0, wo4); - CEX(wo0, wo5); - CEX(wo0, wo6); - CEX(wo0, wo7); - CEX(wo1, wo2); - CEX(wo1, wo3); - CEX(wo1, wo4); - CEX(wo1, wo5); - CEX(wo1, wo6); - CEX(wo1, wo7); - CEX(wo2, wo3); - CEX(wo2, wo4); - CEX(wo2, wo5); - CEX(wo2, wo6); - CEX(wo2, wo7); - CEX(wo3, wo4); - CEX(wo3, wo5); - CEX(wo3, wo6); - CEX(wo3, wo7); - CEX(wo4, wo5); - CEX(wo4, wo6); - CEX(wo4, wo7); - CEX(wo5, wo6); - CEX(wo5, wo7); - CEX(wo6, wo7); - } - { - unsigned int nvof; /* Next vertex offset value */ - unsigned int vof; /* Vertex offset value */ - unsigned int vwe; /* Vertex weighting */ - - vof = 0; /* First vertex offset is 0 */ - nvof = (wo0 & 0x7fffff); /* Extract offset value */ - wo0 = (wo0 >> 23); /* Extract weighting value */ - vwe = 256 - wo0; /* Baricentric weighting */ - ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo1 & 0x7fffff); /* Extract offset value */ - wo1 = (wo1 >> 23); /* Extract weighting value */ - vwe = wo0 - wo1; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo2 & 0x7fffff); /* Extract offset value */ - wo2 = (wo2 >> 23); /* Extract weighting value */ - vwe = wo1 - wo2; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo3 & 0x7fffff); /* Extract offset value */ - wo3 = (wo3 >> 23); /* Extract weighting value */ - vwe = wo2 - wo3; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo4 & 0x7fffff); /* Extract offset value */ - wo4 = (wo4 >> 23); /* Extract weighting value */ - vwe = wo3 - wo4; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo5 & 0x7fffff); /* Extract offset value */ - wo5 = (wo5 >> 23); /* Extract weighting value */ - vwe = wo4 - wo5; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo6 & 0x7fffff); /* Extract offset value */ - wo6 = (wo6 >> 23); /* Extract weighting value */ - vwe = wo5 - wo6; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo7 & 0x7fffff); /* Extract offset value */ - wo7 = (wo7 >> 23); /* Extract weighting value */ - vwe = wo6 - wo7; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - vwe = wo7; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += 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 */ - oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */ - op0[1] = OT_E(ot1, oti); /* Write result */ - oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */ - op0[2] = OT_E(ot2, oti); /* Write result */ - oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */ - op0[3] = OT_E(ot3, oti); /* Write result */ - oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */ - op0[4] = OT_E(ot4, oti); /* Write result */ - } - } -} -#undef IT_WO -#undef IT_IX -#undef CEX -#undef IM_O -#undef IM_FE -#undef IM_PE -#undef OT_E - -static void -imdi_k28_gen( -genspec *g /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x05, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x74, 0x6c, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 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, 0x04, 0x08, - 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08, - 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7, - 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7, - 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08, - 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00, - 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7, - 0x2c, 0xf3, 0xdc, 0xb7, 0x38, 0x5f, 0x35, 0x5f, - 0x69, 0x38, 0x5f, 0x69, 0x38, 0x5f, 0x66, 0x00, - 0x8e, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00, - 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf, - 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08, - 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf, - 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x32, 0x38, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01, - 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7, - 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7, - 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08, - 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08, - 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf, - 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7, - 0x00, 0xf0, 0x04, 0x08 - }; /* Structure image */ - - memcpy(g, data, sizeof(data)); /* Initialise the structure */ -} - -static void -imdi_k28_tab( -tabspec *t /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x0c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x20, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff, - 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff - }; /* Structure image */ - - memcpy(t, data, sizeof(data)); /* Initialise the structure */ -} - -/* 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 = 6 - Output channel 0 bits = 8 - Output channel 0 increment = 6 - Output channel 1 bits = 8 - Output channel 1 increment = 6 - Output channel 2 bits = 8 - Output channel 2 increment = 6 - Output channel 3 bits = 8 - Output channel 3 increment = 6 - Output channel 4 bits = 8 - Output channel 4 increment = 6 - Output channel 5 bits = 8 - Output channel 5 increment = 6 - 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 = 255 - */ - -/* - 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 <memory.h> -#include "imdi_imp.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) * 12) - -/* Interpolation table - get vertex values */ -#define IM_FE(p, v, c) *((unsigned int *)((p) + (v) * 4 + (c) * 4)) - -/* Output table indexes */ -#define OT_E(p, off) *((unsigned char *)((p) + (off) * 1)) - -static void -imdi_k29( -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 ot1 = (pointer)p->out_tables[1]; - pointer ot2 = (pointer)p->out_tables[2]; - pointer ot3 = (pointer)p->out_tables[3]; - pointer ot4 = (pointer)p->out_tables[4]; - pointer ot5 = (pointer)p->out_tables[5]; - pointer sw_base = (pointer)p->sw_table; - pointer im_base = (pointer)p->im_table; - - for(;ip0 < ep; ip0 += 1, op0 += 6) { - unsigned int ova0; /* Output value accumulator */ - unsigned int ova1; /* Output value accumulator */ - unsigned int ova2; /* Output value 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_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate 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_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate 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 */ - oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */ - op0[1] = OT_E(ot1, oti); /* Write result */ - oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */ - op0[2] = OT_E(ot2, oti); /* Write result */ - oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */ - op0[3] = OT_E(ot3, oti); /* Write result */ - oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */ - op0[4] = OT_E(ot4, oti); /* Write result */ - oti = ((ova2 >> 24) & 0xff); /* Extract integer part of result */ - op0[5] = OT_E(ot5, oti); /* Write result */ - } - } -} -#undef IT_IT -#undef SW_O -#undef SX_WO -#undef IM_O -#undef IM_FE -#undef OT_E - -static void -imdi_k29_gen( -genspec *g /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0xff, 0x00, 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, 0x04, 0x08, - 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08, - 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7, - 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7, - 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08, - 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00, - 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7, - 0x2c, 0xf3, 0xdc, 0xb7, 0x31, 0x5f, 0x36, 0x5f, - 0x69, 0x38, 0x5f, 0x69, 0x38, 0x5f, 0x66, 0x00, - 0x8e, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00, - 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf, - 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08, - 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf, - 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x32, 0x39, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01, - 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7, - 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7, - 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08, - 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08, - 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf, - 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7, - 0x00, 0xf0, 0x04, 0x08 - }; /* Structure image */ - - memcpy(g, data, sizeof(data)); /* Initialise the structure */ -} - -static void -imdi_k29_tab( -tabspec *t /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x0c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, - 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff - }; /* Structure image */ - - memcpy(t, data, sizeof(data)); /* Initialise the structure */ -} - -/* 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 = 3 - Input channel 0 bits = 8 - Input channel 0 increment = 3 - Input channel 1 bits = 8 - Input channel 1 increment = 3 - Input channel 2 bits = 8 - Input channel 2 increment = 3 - Input is channel interleaved - Input channels are separate words - Input value extraction is done in input table lookup - - Output channels per pixel = 6 - Output channel 0 bits = 8 - Output channel 0 increment = 6 - Output channel 1 bits = 8 - Output channel 1 increment = 6 - Output channel 2 bits = 8 - Output channel 2 increment = 6 - Output channel 3 bits = 8 - Output channel 3 increment = 6 - Output channel 4 bits = 8 - Output channel 4 increment = 6 - Output channel 5 bits = 8 - Output channel 5 increment = 6 - Output is channel interleaved - - Output channels are separate words - Simplex table index bits = 12 - Interpolation table index bits = 20 - Simplex table max resolution = 16 - Interpolation table max resolution = 101 - */ - -/* - 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 <memory.h> -#include "imdi_imp.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 int *)((p) + 0 + (off) * 4)) - -/* Simplex weighting table access */ -#define SW_O(off) ((off) * 16) - -/* Simplex table - get weighting value */ -#define SX_WE(p, v) *((unsigned short *)((p) + (v) * 4 + 0)) - -/* Simplex table - get offset value */ -#define SX_VO(p, v) *((unsigned short *)((p) + (v) * 4 + 2)) - -/* Interpolation multi-dim. table access */ -#define IM_O(off) ((off) * 12) - -/* Interpolation table - get vertex values */ -#define IM_FE(p, v, c) *((unsigned int *)((p) + (v) * 4 + (c) * 4)) - -/* Output table indexes */ -#define OT_E(p, off) *((unsigned char *)((p) + (off) * 1)) - -static void -imdi_k30( -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 * 3 ; - pointer it0 = (pointer)p->in_tables[0]; - pointer it1 = (pointer)p->in_tables[1]; - pointer it2 = (pointer)p->in_tables[2]; - pointer ot0 = (pointer)p->out_tables[0]; - pointer ot1 = (pointer)p->out_tables[1]; - pointer ot2 = (pointer)p->out_tables[2]; - pointer ot3 = (pointer)p->out_tables[3]; - pointer ot4 = (pointer)p->out_tables[4]; - pointer ot5 = (pointer)p->out_tables[5]; - pointer sw_base = (pointer)p->sw_table; - pointer im_base = (pointer)p->im_table; - - for(;ip0 < ep; ip0 += 3, op0 += 6) { - unsigned int ova0; /* Output value accumulator */ - unsigned int ova1; /* Output value accumulator */ - unsigned int ova2; /* Output value accumulator */ - { - pointer swp; - pointer imp; - { - unsigned int ti; /* Simplex+Interpolation index variable */ - - ti = IT_IT(it0, ip0[0]); - ti += IT_IT(it1, ip0[1]); - ti += IT_IT(it2, ip0[2]); - - imp = im_base + IM_O(ti >> 12); /* Extract interp. index and comp. entry */ - swp = sw_base + SW_O(ti & 0xfff); /* Extract simplex index and comp. entry */ - } - { - unsigned int vof; /* Vertex offset value */ - unsigned int vwe; /* Vertex weighting */ - - vof = SX_VO(swp, 0); /* Read vertex offset value */ - vwe = SX_WE(swp, 0); /* Read vertex weighting value */ - ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - vof = SX_VO(swp, 1); /* Read vertex offset value */ - vwe = SX_WE(swp, 1); /* Read vertex weighting value */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - vof = SX_VO(swp, 2); /* Read vertex offset value */ - vwe = SX_WE(swp, 2); /* Read vertex weighting value */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - vof = SX_VO(swp, 3); /* Read vertex offset value */ - vwe = SX_WE(swp, 3); /* Read vertex weighting value */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate 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 */ - oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */ - op0[1] = OT_E(ot1, oti); /* Write result */ - oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */ - op0[2] = OT_E(ot2, oti); /* Write result */ - oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */ - op0[3] = OT_E(ot3, oti); /* Write result */ - oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */ - op0[4] = OT_E(ot4, oti); /* Write result */ - oti = ((ova2 >> 24) & 0xff); /* Extract integer part of result */ - op0[5] = OT_E(ot5, oti); /* Write result */ - } - } -} -#undef IT_IT -#undef SW_O -#undef SX_WE -#undef SX_VO -#undef IM_O -#undef IM_FE -#undef OT_E - -static void -imdi_k30_gen( -genspec *g /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x08, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x65, 0x00, 0x00, 0x00, 0x10, 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, 0x04, 0x08, - 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08, - 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7, - 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7, - 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08, - 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00, - 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7, - 0x2c, 0xf3, 0xdc, 0xb7, 0x33, 0x5f, 0x36, 0x5f, - 0x69, 0x38, 0x5f, 0x69, 0x38, 0x5f, 0x66, 0x00, - 0x8e, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00, - 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf, - 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08, - 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf, - 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x33, 0x30, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01, - 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7, - 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7, - 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08, - 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08, - 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf, - 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7, - 0x00, 0xf0, 0x04, 0x08 - }; /* Structure image */ - - memcpy(g, data, sizeof(data)); /* Initialise the structure */ -} - -static void -imdi_k30_tab( -tabspec *t /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x14, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x0c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, - 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff - }; /* Structure image */ - - memcpy(t, data, sizeof(data)); /* Initialise the structure */ -} - -/* 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 = 4 - Input channel 0 bits = 8 - Input channel 0 increment = 4 - Input channel 1 bits = 8 - Input channel 1 increment = 4 - Input channel 2 bits = 8 - Input channel 2 increment = 4 - Input channel 3 bits = 8 - Input channel 3 increment = 4 - Input is channel interleaved - Input channels are separate words - Input value extraction is done in input table lookup - - Output channels per pixel = 6 - Output channel 0 bits = 8 - Output channel 0 increment = 6 - Output channel 1 bits = 8 - Output channel 1 increment = 6 - Output channel 2 bits = 8 - Output channel 2 increment = 6 - Output channel 3 bits = 8 - Output channel 3 increment = 6 - Output channel 4 bits = 8 - Output channel 4 increment = 6 - Output channel 5 bits = 8 - Output channel 5 increment = 6 - Output is channel interleaved - - Output channels are separate words - Simplex table index bits = 32 - Interpolation table index bits = 32 - Simplex table max resolution = 255 - Interpolation table max resolution = 27 - */ - -/* - 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 <memory.h> -#include "imdi_imp.h" -#define IMDI_INCLUDED -#endif /* IMDI_INCLUDED */ - -#ifndef DEFINED_pointer -#define DEFINED_pointer -typedef unsigned char * pointer; -#endif - -/* Input table interp. index */ -#define IT_IX(p, off) *((unsigned int *)((p) + 4 + (off) * 8)) - -/* Input table simplex index enty */ -#define IT_SX(p, off) *((unsigned int *)((p) + 0 + (off) * 8)) - -/* Simplex weighting table access */ -#define SW_O(off) ((off) * 20) - -/* Simplex table - get weighting value */ -#define SX_WE(p, v) *((unsigned short *)((p) + (v) * 4 + 0)) - -/* Simplex table - get offset value */ -#define SX_VO(p, v) *((unsigned short *)((p) + (v) * 4 + 2)) - -/* Interpolation multi-dim. table access */ -#define IM_O(off) ((off) * 12) - -/* Interpolation table - get vertex values */ -#define IM_FE(p, v, c) *((unsigned int *)((p) + (v) * 4 + (c) * 4)) - -/* Output table indexes */ -#define OT_E(p, off) *((unsigned char *)((p) + (off) * 1)) - -static void -imdi_k31( -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 * 4 ; - pointer it0 = (pointer)p->in_tables[0]; - pointer it1 = (pointer)p->in_tables[1]; - pointer it2 = (pointer)p->in_tables[2]; - pointer it3 = (pointer)p->in_tables[3]; - pointer ot0 = (pointer)p->out_tables[0]; - pointer ot1 = (pointer)p->out_tables[1]; - pointer ot2 = (pointer)p->out_tables[2]; - pointer ot3 = (pointer)p->out_tables[3]; - pointer ot4 = (pointer)p->out_tables[4]; - pointer ot5 = (pointer)p->out_tables[5]; - pointer sw_base = (pointer)p->sw_table; - pointer im_base = (pointer)p->im_table; - - for(;ip0 < ep; ip0 += 4, op0 += 6) { - unsigned int ova0; /* Output value accumulator */ - unsigned int ova1; /* Output value accumulator */ - unsigned int ova2; /* Output value accumulator */ - { - pointer swp; - pointer imp; - { - unsigned int ti_s; /* Simplex index variable */ - unsigned int ti_i; /* Interpolation index variable */ - - ti_i = IT_IX(it0, ip0[0]); - ti_s = IT_SX(it0, ip0[0]); - ti_i += IT_IX(it1, ip0[1]); - ti_s += IT_SX(it1, ip0[1]); - ti_i += IT_IX(it2, ip0[2]); - ti_s += IT_SX(it2, ip0[2]); - ti_i += IT_IX(it3, ip0[3]); - ti_s += IT_SX(it3, ip0[3]); - - swp = sw_base + SW_O(ti_s); /* Compute simplex table entry pointer */ - imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */ - } - { - unsigned int vof; /* Vertex offset value */ - unsigned int vwe; /* Vertex weighting */ - - vof = SX_VO(swp, 0); /* Read vertex offset value */ - vwe = SX_WE(swp, 0); /* Read vertex weighting value */ - ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - vof = SX_VO(swp, 1); /* Read vertex offset value */ - vwe = SX_WE(swp, 1); /* Read vertex weighting value */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - vof = SX_VO(swp, 2); /* Read vertex offset value */ - vwe = SX_WE(swp, 2); /* Read vertex weighting value */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - vof = SX_VO(swp, 3); /* Read vertex offset value */ - vwe = SX_WE(swp, 3); /* Read vertex weighting value */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - vof = SX_VO(swp, 4); /* Read vertex offset value */ - vwe = SX_WE(swp, 4); /* Read vertex weighting value */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate 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 */ - oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */ - op0[1] = OT_E(ot1, oti); /* Write result */ - oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */ - op0[2] = OT_E(ot2, oti); /* Write result */ - oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */ - op0[3] = OT_E(ot3, oti); /* Write result */ - oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */ - op0[4] = OT_E(ot4, oti); /* Write result */ - oti = ((ova2 >> 24) & 0xff); /* Extract integer part of result */ - op0[5] = OT_E(ot5, oti); /* Write result */ - } - } -} -#undef IT_IX -#undef IT_SX -#undef SW_O -#undef SX_WE -#undef SX_VO -#undef IM_O -#undef IM_FE -#undef OT_E - -static void -imdi_k31_gen( -genspec *g /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x1b, 0x00, 0x00, 0x00, 0xff, 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, 0x04, 0x08, - 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08, - 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7, - 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7, - 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08, - 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00, - 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7, - 0x2c, 0xf3, 0xdc, 0xb7, 0x34, 0x5f, 0x36, 0x5f, - 0x69, 0x38, 0x5f, 0x69, 0x38, 0x5f, 0x66, 0x00, - 0x8e, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00, - 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf, - 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08, - 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf, - 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x33, 0x31, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01, - 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7, - 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7, - 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08, - 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08, - 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf, - 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7, - 0x00, 0xf0, 0x04, 0x08 - }; /* Structure image */ - - memcpy(g, data, sizeof(data)); /* Initialise the structure */ -} - -static void -imdi_k31_tab( -tabspec *t /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x14, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x0c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, - 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff - }; /* Structure image */ - - memcpy(t, data, sizeof(data)); /* Initialise the structure */ -} - -/* 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 = 5 - Input channel 0 bits = 8 - Input channel 0 increment = 5 - Input channel 1 bits = 8 - Input channel 1 increment = 5 - Input channel 2 bits = 8 - Input channel 2 increment = 5 - Input channel 3 bits = 8 - Input channel 3 increment = 5 - Input channel 4 bits = 8 - Input channel 4 increment = 5 - Input is channel interleaved - Input channels are separate words - Input value extraction is done in input table lookup - - Output channels per pixel = 6 - Output channel 0 bits = 8 - Output channel 0 increment = 6 - Output channel 1 bits = 8 - Output channel 1 increment = 6 - Output channel 2 bits = 8 - Output channel 2 increment = 6 - Output channel 3 bits = 8 - Output channel 3 increment = 6 - Output channel 4 bits = 8 - Output channel 4 increment = 6 - Output channel 5 bits = 8 - Output channel 5 increment = 6 - Output is channel interleaved - - Output channels are separate words - Weight+voffset bits = 32 - Interpolation table index bits = 32 - Interpolation table max resolution = 40 - */ - -/* - 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 <memory.h> -#include "imdi_imp.h" -#define IMDI_INCLUDED -#endif /* IMDI_INCLUDED */ - -#ifndef DEFINED_pointer -#define DEFINED_pointer -typedef unsigned char * pointer; -#endif - -/* Input table interp. index */ -#define IT_IX(p, off) *((unsigned int *)((p) + 0 + (off) * 8)) - -/* Input table input weighting/offset value enty */ -#define IT_WO(p, off) *((unsigned int *)((p) + 4 + (off) * 8)) - -/* Conditional exchange for sorting */ -#define CEX(A, B) if (A < B) { A ^= B; B ^= A; A ^= B; } - -/* Interpolation multi-dim. table access */ -#define IM_O(off) ((off) * 12) - -/* Interpolation table - get vertex values */ -#define IM_FE(p, v, c) *((unsigned int *)((p) + (v) * 4 + (c) * 4)) - -/* Output table indexes */ -#define OT_E(p, off) *((unsigned char *)((p) + (off) * 1)) - -static void -imdi_k32( -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 * 5 ; - pointer it0 = (pointer)p->in_tables[0]; - pointer it1 = (pointer)p->in_tables[1]; - pointer it2 = (pointer)p->in_tables[2]; - pointer it3 = (pointer)p->in_tables[3]; - pointer it4 = (pointer)p->in_tables[4]; - pointer ot0 = (pointer)p->out_tables[0]; - pointer ot1 = (pointer)p->out_tables[1]; - pointer ot2 = (pointer)p->out_tables[2]; - pointer ot3 = (pointer)p->out_tables[3]; - pointer ot4 = (pointer)p->out_tables[4]; - pointer ot5 = (pointer)p->out_tables[5]; - pointer im_base = (pointer)p->im_table; - - for(;ip0 < ep; ip0 += 5, op0 += 6) { - unsigned int ova0; /* Output value accumulator */ - unsigned int ova1; /* Output value accumulator */ - unsigned int ova2; /* Output value accumulator */ - { - pointer imp; - unsigned int wo0; /* Weighting value and vertex offset variable */ - unsigned int wo1; /* Weighting value and vertex offset variable */ - unsigned int wo2; /* Weighting value and vertex offset variable */ - unsigned int wo3; /* Weighting value and vertex offset variable */ - unsigned int wo4; /* Weighting value and vertex offset variable */ - { - unsigned int ti_i; /* Interpolation index variable */ - - ti_i = IT_IX(it0, ip0[0]); - wo0 = IT_WO(it0, ip0[0]); - ti_i += IT_IX(it1, ip0[1]); - wo1 = IT_WO(it1, ip0[1]); - ti_i += IT_IX(it2, ip0[2]); - wo2 = IT_WO(it2, ip0[2]); - ti_i += IT_IX(it3, ip0[3]); - wo3 = IT_WO(it3, ip0[3]); - ti_i += IT_IX(it4, ip0[4]); - wo4 = IT_WO(it4, ip0[4]); - - imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */ - - /* Sort weighting values and vertex offset values */ - CEX(wo0, wo1); - CEX(wo0, wo2); - CEX(wo0, wo3); - CEX(wo0, wo4); - CEX(wo1, wo2); - CEX(wo1, wo3); - CEX(wo1, wo4); - CEX(wo2, wo3); - CEX(wo2, wo4); - CEX(wo3, wo4); - } - { - unsigned int nvof; /* Next vertex offset value */ - unsigned int vof; /* Vertex offset value */ - unsigned int vwe; /* Vertex weighting */ - - vof = 0; /* First vertex offset is 0 */ - nvof = (wo0 & 0x7fffff); /* Extract offset value */ - wo0 = (wo0 >> 23); /* Extract weighting value */ - vwe = 256 - wo0; /* Baricentric weighting */ - ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo1 & 0x7fffff); /* Extract offset value */ - wo1 = (wo1 >> 23); /* Extract weighting value */ - vwe = wo0 - wo1; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo2 & 0x7fffff); /* Extract offset value */ - wo2 = (wo2 >> 23); /* Extract weighting value */ - vwe = wo1 - wo2; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo3 & 0x7fffff); /* Extract offset value */ - wo3 = (wo3 >> 23); /* Extract weighting value */ - vwe = wo2 - wo3; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo4 & 0x7fffff); /* Extract offset value */ - wo4 = (wo4 >> 23); /* Extract weighting value */ - vwe = wo3 - wo4; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - vwe = wo4; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate 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 */ - oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */ - op0[1] = OT_E(ot1, oti); /* Write result */ - oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */ - op0[2] = OT_E(ot2, oti); /* Write result */ - oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */ - op0[3] = OT_E(ot3, oti); /* Write result */ - oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */ - op0[4] = OT_E(ot4, oti); /* Write result */ - oti = ((ova2 >> 24) & 0xff); /* Extract integer part of result */ - op0[5] = OT_E(ot5, oti); /* Write result */ - } - } -} -#undef IT_WO -#undef IT_IX -#undef CEX -#undef IM_O -#undef IM_FE -#undef OT_E - -static void -imdi_k32_gen( -genspec *g /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x08, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x28, 0x00, 0x00, 0x00, 0x00, 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, 0x04, 0x08, - 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08, - 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7, - 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7, - 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08, - 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00, - 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7, - 0x2c, 0xf3, 0xdc, 0xb7, 0x35, 0x5f, 0x36, 0x5f, - 0x69, 0x38, 0x5f, 0x69, 0x38, 0x5f, 0x66, 0x00, - 0x8e, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00, - 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf, - 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08, - 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf, - 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x33, 0x32, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01, - 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7, - 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7, - 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08, - 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08, - 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf, - 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7, - 0x00, 0xf0, 0x04, 0x08 - }; /* Structure image */ - - memcpy(g, data, sizeof(data)); /* Initialise the structure */ -} - -static void -imdi_k32_tab( -tabspec *t /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x0c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, - 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff - }; /* Structure image */ - - memcpy(t, data, sizeof(data)); /* Initialise the structure */ -} - -/* 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 = 6 - Input channel 0 bits = 8 - Input channel 0 increment = 6 - Input channel 1 bits = 8 - Input channel 1 increment = 6 - Input channel 2 bits = 8 - Input channel 2 increment = 6 - Input channel 3 bits = 8 - Input channel 3 increment = 6 - Input channel 4 bits = 8 - Input channel 4 increment = 6 - Input channel 5 bits = 8 - Input channel 5 increment = 6 - Input is channel interleaved - Input channels are separate words - Input value extraction is done in input table lookup - - Output channels per pixel = 6 - Output channel 0 bits = 8 - Output channel 0 increment = 6 - Output channel 1 bits = 8 - Output channel 1 increment = 6 - Output channel 2 bits = 8 - Output channel 2 increment = 6 - Output channel 3 bits = 8 - Output channel 3 increment = 6 - Output channel 4 bits = 8 - Output channel 4 increment = 6 - Output channel 5 bits = 8 - Output channel 5 increment = 6 - Output is channel interleaved - - Output channels are separate words - Weight+voffset bits = 32 - Interpolation table index bits = 32 - Interpolation table max resolution = 19 - */ - -/* - 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 <memory.h> -#include "imdi_imp.h" -#define IMDI_INCLUDED -#endif /* IMDI_INCLUDED */ - -#ifndef DEFINED_pointer -#define DEFINED_pointer -typedef unsigned char * pointer; -#endif - -/* Input table interp. index */ -#define IT_IX(p, off) *((unsigned int *)((p) + 0 + (off) * 8)) - -/* Input table input weighting/offset value enty */ -#define IT_WO(p, off) *((unsigned int *)((p) + 4 + (off) * 8)) - -/* Conditional exchange for sorting */ -#define CEX(A, B) if (A < B) { A ^= B; B ^= A; A ^= B; } - -/* Interpolation multi-dim. table access */ -#define IM_O(off) ((off) * 12) - -/* Interpolation table - get vertex values */ -#define IM_FE(p, v, c) *((unsigned int *)((p) + (v) * 4 + (c) * 4)) - -/* Output table indexes */ -#define OT_E(p, off) *((unsigned char *)((p) + (off) * 1)) - -static void -imdi_k33( -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 * 6 ; - pointer it0 = (pointer)p->in_tables[0]; - pointer it1 = (pointer)p->in_tables[1]; - pointer it2 = (pointer)p->in_tables[2]; - pointer it3 = (pointer)p->in_tables[3]; - pointer it4 = (pointer)p->in_tables[4]; - pointer it5 = (pointer)p->in_tables[5]; - pointer ot0 = (pointer)p->out_tables[0]; - pointer ot1 = (pointer)p->out_tables[1]; - pointer ot2 = (pointer)p->out_tables[2]; - pointer ot3 = (pointer)p->out_tables[3]; - pointer ot4 = (pointer)p->out_tables[4]; - pointer ot5 = (pointer)p->out_tables[5]; - pointer im_base = (pointer)p->im_table; - - for(;ip0 < ep; ip0 += 6, op0 += 6) { - unsigned int ova0; /* Output value accumulator */ - unsigned int ova1; /* Output value accumulator */ - unsigned int ova2; /* Output value accumulator */ - { - pointer imp; - unsigned int wo0; /* Weighting value and vertex offset variable */ - unsigned int wo1; /* Weighting value and vertex offset variable */ - unsigned int wo2; /* Weighting value and vertex offset variable */ - unsigned int wo3; /* Weighting value and vertex offset variable */ - unsigned int wo4; /* Weighting value and vertex offset variable */ - unsigned int wo5; /* Weighting value and vertex offset variable */ - { - unsigned int ti_i; /* Interpolation index variable */ - - ti_i = IT_IX(it0, ip0[0]); - wo0 = IT_WO(it0, ip0[0]); - ti_i += IT_IX(it1, ip0[1]); - wo1 = IT_WO(it1, ip0[1]); - ti_i += IT_IX(it2, ip0[2]); - wo2 = IT_WO(it2, ip0[2]); - ti_i += IT_IX(it3, ip0[3]); - wo3 = IT_WO(it3, ip0[3]); - ti_i += IT_IX(it4, ip0[4]); - wo4 = IT_WO(it4, ip0[4]); - ti_i += IT_IX(it5, ip0[5]); - wo5 = IT_WO(it5, ip0[5]); - - imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */ - - /* Sort weighting values and vertex offset values */ - CEX(wo0, wo1); - CEX(wo0, wo2); - CEX(wo0, wo3); - CEX(wo0, wo4); - CEX(wo0, wo5); - CEX(wo1, wo2); - CEX(wo1, wo3); - CEX(wo1, wo4); - CEX(wo1, wo5); - CEX(wo2, wo3); - CEX(wo2, wo4); - CEX(wo2, wo5); - CEX(wo3, wo4); - CEX(wo3, wo5); - CEX(wo4, wo5); - } - { - unsigned int nvof; /* Next vertex offset value */ - unsigned int vof; /* Vertex offset value */ - unsigned int vwe; /* Vertex weighting */ - - vof = 0; /* First vertex offset is 0 */ - nvof = (wo0 & 0x7fffff); /* Extract offset value */ - wo0 = (wo0 >> 23); /* Extract weighting value */ - vwe = 256 - wo0; /* Baricentric weighting */ - ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo1 & 0x7fffff); /* Extract offset value */ - wo1 = (wo1 >> 23); /* Extract weighting value */ - vwe = wo0 - wo1; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo2 & 0x7fffff); /* Extract offset value */ - wo2 = (wo2 >> 23); /* Extract weighting value */ - vwe = wo1 - wo2; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo3 & 0x7fffff); /* Extract offset value */ - wo3 = (wo3 >> 23); /* Extract weighting value */ - vwe = wo2 - wo3; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo4 & 0x7fffff); /* Extract offset value */ - wo4 = (wo4 >> 23); /* Extract weighting value */ - vwe = wo3 - wo4; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo5 & 0x7fffff); /* Extract offset value */ - wo5 = (wo5 >> 23); /* Extract weighting value */ - vwe = wo4 - wo5; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - vwe = wo5; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate 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 */ - oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */ - op0[1] = OT_E(ot1, oti); /* Write result */ - oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */ - op0[2] = OT_E(ot2, oti); /* Write result */ - oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */ - op0[3] = OT_E(ot3, oti); /* Write result */ - oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */ - op0[4] = OT_E(ot4, oti); /* Write result */ - oti = ((ova2 >> 24) & 0xff); /* Extract integer part of result */ - op0[5] = OT_E(ot5, oti); /* Write result */ - } - } -} -#undef IT_WO -#undef IT_IX -#undef CEX -#undef IM_O -#undef IM_FE -#undef OT_E - -static void -imdi_k33_gen( -genspec *g /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x08, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x13, 0x00, 0x00, 0x00, 0x00, 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, 0x04, 0x08, - 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08, - 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7, - 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7, - 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08, - 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00, - 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7, - 0x2c, 0xf3, 0xdc, 0xb7, 0x36, 0x5f, 0x36, 0x5f, - 0x69, 0x38, 0x5f, 0x69, 0x38, 0x5f, 0x66, 0x00, - 0x8e, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00, - 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf, - 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08, - 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf, - 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x33, 0x33, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01, - 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7, - 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7, - 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08, - 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08, - 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf, - 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7, - 0x00, 0xf0, 0x04, 0x08 - }; /* Structure image */ - - memcpy(g, data, sizeof(data)); /* Initialise the structure */ -} - -static void -imdi_k33_tab( -tabspec *t /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x0c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, - 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff - }; /* Structure image */ - - memcpy(t, data, sizeof(data)); /* Initialise the structure */ -} - -/* 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 = 7 - Input channel 0 bits = 8 - Input channel 0 increment = 7 - Input channel 1 bits = 8 - Input channel 1 increment = 7 - Input channel 2 bits = 8 - Input channel 2 increment = 7 - Input channel 3 bits = 8 - Input channel 3 increment = 7 - Input channel 4 bits = 8 - Input channel 4 increment = 7 - Input channel 5 bits = 8 - Input channel 5 increment = 7 - Input channel 6 bits = 8 - Input channel 6 increment = 7 - Input is channel interleaved - Input channels are separate words - Input value extraction is done in input table lookup - - Output channels per pixel = 6 - Output channel 0 bits = 8 - Output channel 0 increment = 6 - Output channel 1 bits = 8 - Output channel 1 increment = 6 - Output channel 2 bits = 8 - Output channel 2 increment = 6 - Output channel 3 bits = 8 - Output channel 3 increment = 6 - Output channel 4 bits = 8 - Output channel 4 increment = 6 - Output channel 5 bits = 8 - Output channel 5 increment = 6 - Output is channel interleaved - - Output channels are separate words - Weight+voffset bits = 32 - Interpolation table index bits = 32 - Interpolation table max resolution = 11 - */ - -/* - 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 <memory.h> -#include "imdi_imp.h" -#define IMDI_INCLUDED -#endif /* IMDI_INCLUDED */ - -#ifndef DEFINED_pointer -#define DEFINED_pointer -typedef unsigned char * pointer; -#endif - -/* Input table interp. index */ -#define IT_IX(p, off) *((unsigned int *)((p) + 0 + (off) * 8)) - -/* Input table input weighting/offset value enty */ -#define IT_WO(p, off) *((unsigned int *)((p) + 4 + (off) * 8)) - -/* Conditional exchange for sorting */ -#define CEX(A, B) if (A < B) { A ^= B; B ^= A; A ^= B; } - -/* Interpolation multi-dim. table access */ -#define IM_O(off) ((off) * 12) - -/* Interpolation table - get vertex values */ -#define IM_FE(p, v, c) *((unsigned int *)((p) + (v) * 4 + (c) * 4)) - -/* Output table indexes */ -#define OT_E(p, off) *((unsigned char *)((p) + (off) * 1)) - -static void -imdi_k34( -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 * 7 ; - pointer it0 = (pointer)p->in_tables[0]; - pointer it1 = (pointer)p->in_tables[1]; - pointer it2 = (pointer)p->in_tables[2]; - pointer it3 = (pointer)p->in_tables[3]; - pointer it4 = (pointer)p->in_tables[4]; - pointer it5 = (pointer)p->in_tables[5]; - pointer it6 = (pointer)p->in_tables[6]; - pointer ot0 = (pointer)p->out_tables[0]; - pointer ot1 = (pointer)p->out_tables[1]; - pointer ot2 = (pointer)p->out_tables[2]; - pointer ot3 = (pointer)p->out_tables[3]; - pointer ot4 = (pointer)p->out_tables[4]; - pointer ot5 = (pointer)p->out_tables[5]; - pointer im_base = (pointer)p->im_table; - - for(;ip0 < ep; ip0 += 7, op0 += 6) { - unsigned int ova0; /* Output value accumulator */ - unsigned int ova1; /* Output value accumulator */ - unsigned int ova2; /* Output value accumulator */ - { - pointer imp; - unsigned int wo0; /* Weighting value and vertex offset variable */ - unsigned int wo1; /* Weighting value and vertex offset variable */ - unsigned int wo2; /* Weighting value and vertex offset variable */ - unsigned int wo3; /* Weighting value and vertex offset variable */ - unsigned int wo4; /* Weighting value and vertex offset variable */ - unsigned int wo5; /* Weighting value and vertex offset variable */ - unsigned int wo6; /* Weighting value and vertex offset variable */ - { - unsigned int ti_i; /* Interpolation index variable */ - - ti_i = IT_IX(it0, ip0[0]); - wo0 = IT_WO(it0, ip0[0]); - ti_i += IT_IX(it1, ip0[1]); - wo1 = IT_WO(it1, ip0[1]); - ti_i += IT_IX(it2, ip0[2]); - wo2 = IT_WO(it2, ip0[2]); - ti_i += IT_IX(it3, ip0[3]); - wo3 = IT_WO(it3, ip0[3]); - ti_i += IT_IX(it4, ip0[4]); - wo4 = IT_WO(it4, ip0[4]); - ti_i += IT_IX(it5, ip0[5]); - wo5 = IT_WO(it5, ip0[5]); - ti_i += IT_IX(it6, ip0[6]); - wo6 = IT_WO(it6, ip0[6]); - - imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */ - - /* Sort weighting values and vertex offset values */ - CEX(wo0, wo1); - CEX(wo0, wo2); - CEX(wo0, wo3); - CEX(wo0, wo4); - CEX(wo0, wo5); - CEX(wo0, wo6); - CEX(wo1, wo2); - CEX(wo1, wo3); - CEX(wo1, wo4); - CEX(wo1, wo5); - CEX(wo1, wo6); - CEX(wo2, wo3); - CEX(wo2, wo4); - CEX(wo2, wo5); - CEX(wo2, wo6); - CEX(wo3, wo4); - CEX(wo3, wo5); - CEX(wo3, wo6); - CEX(wo4, wo5); - CEX(wo4, wo6); - CEX(wo5, wo6); - } - { - unsigned int nvof; /* Next vertex offset value */ - unsigned int vof; /* Vertex offset value */ - unsigned int vwe; /* Vertex weighting */ - - vof = 0; /* First vertex offset is 0 */ - nvof = (wo0 & 0x7fffff); /* Extract offset value */ - wo0 = (wo0 >> 23); /* Extract weighting value */ - vwe = 256 - wo0; /* Baricentric weighting */ - ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo1 & 0x7fffff); /* Extract offset value */ - wo1 = (wo1 >> 23); /* Extract weighting value */ - vwe = wo0 - wo1; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo2 & 0x7fffff); /* Extract offset value */ - wo2 = (wo2 >> 23); /* Extract weighting value */ - vwe = wo1 - wo2; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo3 & 0x7fffff); /* Extract offset value */ - wo3 = (wo3 >> 23); /* Extract weighting value */ - vwe = wo2 - wo3; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo4 & 0x7fffff); /* Extract offset value */ - wo4 = (wo4 >> 23); /* Extract weighting value */ - vwe = wo3 - wo4; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo5 & 0x7fffff); /* Extract offset value */ - wo5 = (wo5 >> 23); /* Extract weighting value */ - vwe = wo4 - wo5; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo6 & 0x7fffff); /* Extract offset value */ - wo6 = (wo6 >> 23); /* Extract weighting value */ - vwe = wo5 - wo6; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - vwe = wo6; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate 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 */ - oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */ - op0[1] = OT_E(ot1, oti); /* Write result */ - oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */ - op0[2] = OT_E(ot2, oti); /* Write result */ - oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */ - op0[3] = OT_E(ot3, oti); /* Write result */ - oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */ - op0[4] = OT_E(ot4, oti); /* Write result */ - oti = ((ova2 >> 24) & 0xff); /* Extract integer part of result */ - op0[5] = OT_E(ot5, oti); /* Write result */ - } - } -} -#undef IT_WO -#undef IT_IX -#undef CEX -#undef IM_O -#undef IM_FE -#undef OT_E - -static void -imdi_k34_gen( -genspec *g /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x0b, 0x00, 0x00, 0x00, 0x00, 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, 0x04, 0x08, - 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08, - 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7, - 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7, - 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08, - 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00, - 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7, - 0x2c, 0xf3, 0xdc, 0xb7, 0x37, 0x5f, 0x36, 0x5f, - 0x69, 0x38, 0x5f, 0x69, 0x38, 0x5f, 0x66, 0x00, - 0x8e, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00, - 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf, - 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08, - 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf, - 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x33, 0x34, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01, - 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7, - 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7, - 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08, - 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08, - 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf, - 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7, - 0x00, 0xf0, 0x04, 0x08 - }; /* Structure image */ - - memcpy(g, data, sizeof(data)); /* Initialise the structure */ -} - -static void -imdi_k34_tab( -tabspec *t /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x0c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, - 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff - }; /* Structure image */ - - memcpy(t, data, sizeof(data)); /* Initialise the structure */ -} - -/* 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 = 8 - Input channel 0 bits = 8 - Input channel 0 increment = 8 - Input channel 1 bits = 8 - Input channel 1 increment = 8 - Input channel 2 bits = 8 - Input channel 2 increment = 8 - Input channel 3 bits = 8 - Input channel 3 increment = 8 - Input channel 4 bits = 8 - Input channel 4 increment = 8 - Input channel 5 bits = 8 - Input channel 5 increment = 8 - Input channel 6 bits = 8 - Input channel 6 increment = 8 - Input channel 7 bits = 8 - Input channel 7 increment = 8 - Input is channel interleaved - Input channels are separate words - Input value extraction is done in input table lookup - - Output channels per pixel = 6 - Output channel 0 bits = 8 - Output channel 0 increment = 6 - Output channel 1 bits = 8 - Output channel 1 increment = 6 - Output channel 2 bits = 8 - Output channel 2 increment = 6 - Output channel 3 bits = 8 - Output channel 3 increment = 6 - Output channel 4 bits = 8 - Output channel 4 increment = 6 - Output channel 5 bits = 8 - Output channel 5 increment = 6 - Output is channel interleaved - - Output channels are separate words - Weight+voffset bits = 32 - Interpolation table index bits = 32 - Interpolation table max resolution = 8 - */ - -/* - 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 <memory.h> -#include "imdi_imp.h" -#define IMDI_INCLUDED -#endif /* IMDI_INCLUDED */ - -#ifndef DEFINED_pointer -#define DEFINED_pointer -typedef unsigned char * pointer; -#endif - -/* Input table interp. index */ -#define IT_IX(p, off) *((unsigned int *)((p) + 0 + (off) * 8)) - -/* Input table input weighting/offset value enty */ -#define IT_WO(p, off) *((unsigned int *)((p) + 4 + (off) * 8)) - -/* Conditional exchange for sorting */ -#define CEX(A, B) if (A < B) { A ^= B; B ^= A; A ^= B; } - -/* Interpolation multi-dim. table access */ -#define IM_O(off) ((off) * 12) - -/* Interpolation table - get vertex values */ -#define IM_FE(p, v, c) *((unsigned int *)((p) + (v) * 4 + (c) * 4)) - -/* Output table indexes */ -#define OT_E(p, off) *((unsigned char *)((p) + (off) * 1)) - -static void -imdi_k35( -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 * 8 ; - pointer it0 = (pointer)p->in_tables[0]; - pointer it1 = (pointer)p->in_tables[1]; - pointer it2 = (pointer)p->in_tables[2]; - pointer it3 = (pointer)p->in_tables[3]; - pointer it4 = (pointer)p->in_tables[4]; - pointer it5 = (pointer)p->in_tables[5]; - pointer it6 = (pointer)p->in_tables[6]; - pointer it7 = (pointer)p->in_tables[7]; - pointer ot0 = (pointer)p->out_tables[0]; - pointer ot1 = (pointer)p->out_tables[1]; - pointer ot2 = (pointer)p->out_tables[2]; - pointer ot3 = (pointer)p->out_tables[3]; - pointer ot4 = (pointer)p->out_tables[4]; - pointer ot5 = (pointer)p->out_tables[5]; - pointer im_base = (pointer)p->im_table; - - for(;ip0 < ep; ip0 += 8, op0 += 6) { - unsigned int ova0; /* Output value accumulator */ - unsigned int ova1; /* Output value accumulator */ - unsigned int ova2; /* Output value accumulator */ - { - pointer imp; - unsigned int wo0; /* Weighting value and vertex offset variable */ - unsigned int wo1; /* Weighting value and vertex offset variable */ - unsigned int wo2; /* Weighting value and vertex offset variable */ - unsigned int wo3; /* Weighting value and vertex offset variable */ - unsigned int wo4; /* Weighting value and vertex offset variable */ - unsigned int wo5; /* Weighting value and vertex offset variable */ - unsigned int wo6; /* Weighting value and vertex offset variable */ - unsigned int wo7; /* Weighting value and vertex offset variable */ - { - unsigned int ti_i; /* Interpolation index variable */ - - ti_i = IT_IX(it0, ip0[0]); - wo0 = IT_WO(it0, ip0[0]); - ti_i += IT_IX(it1, ip0[1]); - wo1 = IT_WO(it1, ip0[1]); - ti_i += IT_IX(it2, ip0[2]); - wo2 = IT_WO(it2, ip0[2]); - ti_i += IT_IX(it3, ip0[3]); - wo3 = IT_WO(it3, ip0[3]); - ti_i += IT_IX(it4, ip0[4]); - wo4 = IT_WO(it4, ip0[4]); - ti_i += IT_IX(it5, ip0[5]); - wo5 = IT_WO(it5, ip0[5]); - ti_i += IT_IX(it6, ip0[6]); - wo6 = IT_WO(it6, ip0[6]); - ti_i += IT_IX(it7, ip0[7]); - wo7 = IT_WO(it7, ip0[7]); - - imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */ - - /* Sort weighting values and vertex offset values */ - CEX(wo0, wo1); - CEX(wo0, wo2); - CEX(wo0, wo3); - CEX(wo0, wo4); - CEX(wo0, wo5); - CEX(wo0, wo6); - CEX(wo0, wo7); - CEX(wo1, wo2); - CEX(wo1, wo3); - CEX(wo1, wo4); - CEX(wo1, wo5); - CEX(wo1, wo6); - CEX(wo1, wo7); - CEX(wo2, wo3); - CEX(wo2, wo4); - CEX(wo2, wo5); - CEX(wo2, wo6); - CEX(wo2, wo7); - CEX(wo3, wo4); - CEX(wo3, wo5); - CEX(wo3, wo6); - CEX(wo3, wo7); - CEX(wo4, wo5); - CEX(wo4, wo6); - CEX(wo4, wo7); - CEX(wo5, wo6); - CEX(wo5, wo7); - CEX(wo6, wo7); - } - { - unsigned int nvof; /* Next vertex offset value */ - unsigned int vof; /* Vertex offset value */ - unsigned int vwe; /* Vertex weighting */ - - vof = 0; /* First vertex offset is 0 */ - nvof = (wo0 & 0x7fffff); /* Extract offset value */ - wo0 = (wo0 >> 23); /* Extract weighting value */ - vwe = 256 - wo0; /* Baricentric weighting */ - ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo1 & 0x7fffff); /* Extract offset value */ - wo1 = (wo1 >> 23); /* Extract weighting value */ - vwe = wo0 - wo1; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo2 & 0x7fffff); /* Extract offset value */ - wo2 = (wo2 >> 23); /* Extract weighting value */ - vwe = wo1 - wo2; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo3 & 0x7fffff); /* Extract offset value */ - wo3 = (wo3 >> 23); /* Extract weighting value */ - vwe = wo2 - wo3; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo4 & 0x7fffff); /* Extract offset value */ - wo4 = (wo4 >> 23); /* Extract weighting value */ - vwe = wo3 - wo4; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo5 & 0x7fffff); /* Extract offset value */ - wo5 = (wo5 >> 23); /* Extract weighting value */ - vwe = wo4 - wo5; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo6 & 0x7fffff); /* Extract offset value */ - wo6 = (wo6 >> 23); /* Extract weighting value */ - vwe = wo5 - wo6; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo7 & 0x7fffff); /* Extract offset value */ - wo7 = (wo7 >> 23); /* Extract weighting value */ - vwe = wo6 - wo7; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - vwe = wo7; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate 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 */ - oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */ - op0[1] = OT_E(ot1, oti); /* Write result */ - oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */ - op0[2] = OT_E(ot2, oti); /* Write result */ - oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */ - op0[3] = OT_E(ot3, oti); /* Write result */ - oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */ - op0[4] = OT_E(ot4, oti); /* Write result */ - oti = ((ova2 >> 24) & 0xff); /* Extract integer part of result */ - op0[5] = OT_E(ot5, oti); /* Write result */ - } - } -} -#undef IT_WO -#undef IT_IX -#undef CEX -#undef IM_O -#undef IM_FE -#undef OT_E - -static void -imdi_k35_gen( -genspec *g /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 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, 0x04, 0x08, - 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08, - 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7, - 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7, - 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08, - 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00, - 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7, - 0x2c, 0xf3, 0xdc, 0xb7, 0x38, 0x5f, 0x36, 0x5f, - 0x69, 0x38, 0x5f, 0x69, 0x38, 0x5f, 0x66, 0x00, - 0x8e, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00, - 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf, - 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08, - 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf, - 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x33, 0x35, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01, - 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7, - 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7, - 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08, - 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08, - 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf, - 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7, - 0x00, 0xf0, 0x04, 0x08 - }; /* Structure image */ - - memcpy(g, data, sizeof(data)); /* Initialise the structure */ -} - -static void -imdi_k35_tab( -tabspec *t /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x0c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, - 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff - }; /* Structure image */ - - memcpy(t, data, sizeof(data)); /* Initialise the structure */ -} - -/* 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 = 7 - Output channel 0 bits = 8 - Output channel 0 increment = 7 - Output channel 1 bits = 8 - Output channel 1 increment = 7 - Output channel 2 bits = 8 - Output channel 2 increment = 7 - Output channel 3 bits = 8 - Output channel 3 increment = 7 - Output channel 4 bits = 8 - Output channel 4 increment = 7 - Output channel 5 bits = 8 - Output channel 5 increment = 7 - Output channel 6 bits = 8 - Output channel 6 increment = 7 - 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 = 255 - */ - -/* - 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 <memory.h> -#include "imdi_imp.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) * 16) - -/* Interpolation table - get vertex values */ -#define IM_FE(p, v, c) *((unsigned int *)((p) + (v) * 8 + (c) * 4)) -#define IM_PE(p, v) *((unsigned int *)((p) + 12 + (v) * 8)) - -/* Output table indexes */ -#define OT_E(p, off) *((unsigned char *)((p) + (off) * 1)) - -static void -imdi_k36( -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 ot1 = (pointer)p->out_tables[1]; - pointer ot2 = (pointer)p->out_tables[2]; - pointer ot3 = (pointer)p->out_tables[3]; - pointer ot4 = (pointer)p->out_tables[4]; - pointer ot5 = (pointer)p->out_tables[5]; - pointer ot6 = (pointer)p->out_tables[6]; - pointer sw_base = (pointer)p->sw_table; - pointer im_base = (pointer)p->im_table; - - for(;ip0 < ep; ip0 += 1, op0 += 7) { - unsigned int ova0; /* Output value accumulator */ - unsigned int ova1; /* Output value accumulator */ - unsigned int ova2; /* Output value accumulator */ - unsigned int ova3; /* 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_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 = 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_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += 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 */ - oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */ - op0[1] = OT_E(ot1, oti); /* Write result */ - oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */ - op0[2] = OT_E(ot2, oti); /* Write result */ - oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */ - op0[3] = OT_E(ot3, oti); /* Write result */ - oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */ - op0[4] = OT_E(ot4, oti); /* Write result */ - oti = ((ova2 >> 24) & 0xff); /* Extract integer part of result */ - op0[5] = OT_E(ot5, oti); /* Write result */ - oti = ((ova3 >> 8) & 0xff); /* Extract integer part of result */ - op0[6] = OT_E(ot6, oti); /* Write result */ - } - } -} -#undef IT_IT -#undef SW_O -#undef SX_WO -#undef IM_O -#undef IM_FE -#undef IM_PE -#undef OT_E - -static void -imdi_k36_gen( -genspec *g /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0xff, 0x00, 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, 0x04, 0x08, - 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08, - 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7, - 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7, - 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08, - 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00, - 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7, - 0x2c, 0xf3, 0xdc, 0xb7, 0x31, 0x5f, 0x37, 0x5f, - 0x69, 0x38, 0x5f, 0x69, 0x38, 0x5f, 0x66, 0x00, - 0x8e, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00, - 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf, - 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08, - 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf, - 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x33, 0x36, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01, - 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7, - 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7, - 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08, - 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08, - 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf, - 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7, - 0x00, 0xf0, 0x04, 0x08 - }; /* Structure image */ - - memcpy(g, data, sizeof(data)); /* Initialise the structure */ -} - -static void -imdi_k36_tab( -tabspec *t /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0xdc, 0x60, 0xef, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff - }; /* Structure image */ - - memcpy(t, data, sizeof(data)); /* Initialise the structure */ -} - -/* 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 = 3 - Input channel 0 bits = 8 - Input channel 0 increment = 3 - Input channel 1 bits = 8 - Input channel 1 increment = 3 - Input channel 2 bits = 8 - Input channel 2 increment = 3 - Input is channel interleaved - Input channels are separate words - Input value extraction is done in input table lookup - - Output channels per pixel = 7 - Output channel 0 bits = 8 - Output channel 0 increment = 7 - Output channel 1 bits = 8 - Output channel 1 increment = 7 - Output channel 2 bits = 8 - Output channel 2 increment = 7 - Output channel 3 bits = 8 - Output channel 3 increment = 7 - Output channel 4 bits = 8 - Output channel 4 increment = 7 - Output channel 5 bits = 8 - Output channel 5 increment = 7 - Output channel 6 bits = 8 - Output channel 6 increment = 7 - Output is channel interleaved - - Output channels are separate words - Simplex table index bits = 12 - Interpolation table index bits = 20 - Simplex table max resolution = 16 - Interpolation table max resolution = 101 - */ - -/* - 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 <memory.h> -#include "imdi_imp.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 int *)((p) + 0 + (off) * 4)) - -/* Simplex weighting table access */ -#define SW_O(off) ((off) * 16) - -/* Simplex table - get weighting value */ -#define SX_WE(p, v) *((unsigned short *)((p) + (v) * 4 + 0)) - -/* Simplex table - get offset value */ -#define SX_VO(p, v) *((unsigned short *)((p) + (v) * 4 + 2)) - -/* Interpolation multi-dim. table access */ -#define IM_O(off) ((off) * 16) - -/* Interpolation table - get vertex values */ -#define IM_FE(p, v, c) *((unsigned int *)((p) + (v) * 8 + (c) * 4)) -#define IM_PE(p, v) *((unsigned int *)((p) + 12 + (v) * 8)) - -/* Output table indexes */ -#define OT_E(p, off) *((unsigned char *)((p) + (off) * 1)) - -static void -imdi_k37( -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 * 3 ; - pointer it0 = (pointer)p->in_tables[0]; - pointer it1 = (pointer)p->in_tables[1]; - pointer it2 = (pointer)p->in_tables[2]; - pointer ot0 = (pointer)p->out_tables[0]; - pointer ot1 = (pointer)p->out_tables[1]; - pointer ot2 = (pointer)p->out_tables[2]; - pointer ot3 = (pointer)p->out_tables[3]; - pointer ot4 = (pointer)p->out_tables[4]; - pointer ot5 = (pointer)p->out_tables[5]; - pointer ot6 = (pointer)p->out_tables[6]; - pointer sw_base = (pointer)p->sw_table; - pointer im_base = (pointer)p->im_table; - - for(;ip0 < ep; ip0 += 3, op0 += 7) { - unsigned int ova0; /* Output value accumulator */ - unsigned int ova1; /* Output value accumulator */ - unsigned int ova2; /* Output value accumulator */ - unsigned int ova3; /* Output value partial accumulator */ - { - pointer swp; - pointer imp; - { - unsigned int ti; /* Simplex+Interpolation index variable */ - - ti = IT_IT(it0, ip0[0]); - ti += IT_IT(it1, ip0[1]); - ti += IT_IT(it2, ip0[2]); - - imp = im_base + IM_O(ti >> 12); /* Extract interp. index and comp. entry */ - swp = sw_base + SW_O(ti & 0xfff); /* Extract simplex index and comp. entry */ - } - { - unsigned int vof; /* Vertex offset value */ - unsigned int vwe; /* Vertex weighting */ - - vof = SX_VO(swp, 0); /* Read vertex offset value */ - vwe = SX_WE(swp, 0); /* Read vertex weighting value */ - ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof = SX_VO(swp, 1); /* Read vertex offset value */ - vwe = SX_WE(swp, 1); /* Read vertex weighting value */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof = SX_VO(swp, 2); /* Read vertex offset value */ - vwe = SX_WE(swp, 2); /* Read vertex weighting value */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof = SX_VO(swp, 3); /* Read vertex offset value */ - vwe = SX_WE(swp, 3); /* Read vertex weighting value */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += 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 */ - oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */ - op0[1] = OT_E(ot1, oti); /* Write result */ - oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */ - op0[2] = OT_E(ot2, oti); /* Write result */ - oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */ - op0[3] = OT_E(ot3, oti); /* Write result */ - oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */ - op0[4] = OT_E(ot4, oti); /* Write result */ - oti = ((ova2 >> 24) & 0xff); /* Extract integer part of result */ - op0[5] = OT_E(ot5, oti); /* Write result */ - oti = ((ova3 >> 8) & 0xff); /* Extract integer part of result */ - op0[6] = OT_E(ot6, oti); /* Write result */ - } - } -} -#undef IT_IT -#undef SW_O -#undef SX_WE -#undef SX_VO -#undef IM_O -#undef IM_FE -#undef IM_PE -#undef OT_E - -static void -imdi_k37_gen( -genspec *g /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x08, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x65, 0x00, 0x00, 0x00, 0x10, 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, 0x04, 0x08, - 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08, - 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7, - 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7, - 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08, - 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00, - 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7, - 0x2c, 0xf3, 0xdc, 0xb7, 0x33, 0x5f, 0x37, 0x5f, - 0x69, 0x38, 0x5f, 0x69, 0x38, 0x5f, 0x66, 0x00, - 0x8e, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00, - 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf, - 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08, - 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf, - 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x33, 0x37, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01, - 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7, - 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7, - 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08, - 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08, - 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf, - 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7, - 0x00, 0xf0, 0x04, 0x08 - }; /* Structure image */ - - memcpy(g, data, sizeof(data)); /* Initialise the structure */ -} - -static void -imdi_k37_tab( -tabspec *t /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x14, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0xdc, 0x60, 0xef, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff - }; /* Structure image */ - - memcpy(t, data, sizeof(data)); /* Initialise the structure */ -} - -/* 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 = 4 - Input channel 0 bits = 8 - Input channel 0 increment = 4 - Input channel 1 bits = 8 - Input channel 1 increment = 4 - Input channel 2 bits = 8 - Input channel 2 increment = 4 - Input channel 3 bits = 8 - Input channel 3 increment = 4 - Input is channel interleaved - Input channels are separate words - Input value extraction is done in input table lookup - - Output channels per pixel = 7 - Output channel 0 bits = 8 - Output channel 0 increment = 7 - Output channel 1 bits = 8 - Output channel 1 increment = 7 - Output channel 2 bits = 8 - Output channel 2 increment = 7 - Output channel 3 bits = 8 - Output channel 3 increment = 7 - Output channel 4 bits = 8 - Output channel 4 increment = 7 - Output channel 5 bits = 8 - Output channel 5 increment = 7 - Output channel 6 bits = 8 - Output channel 6 increment = 7 - Output is channel interleaved - - Output channels are separate words - Simplex table index bits = 32 - Interpolation table index bits = 32 - Simplex table max resolution = 255 - Interpolation table max resolution = 31 - */ - -/* - 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 <memory.h> -#include "imdi_imp.h" -#define IMDI_INCLUDED -#endif /* IMDI_INCLUDED */ - -#ifndef DEFINED_pointer -#define DEFINED_pointer -typedef unsigned char * pointer; -#endif - -/* Input table interp. index */ -#define IT_IX(p, off) *((unsigned int *)((p) + 4 + (off) * 8)) - -/* Input table simplex index enty */ -#define IT_SX(p, off) *((unsigned int *)((p) + 0 + (off) * 8)) - -/* Simplex weighting table access */ -#define SW_O(off) ((off) * 20) - -/* Simplex table - get weighting value */ -#define SX_WE(p, v) *((unsigned short *)((p) + (v) * 4 + 0)) - -/* Simplex table - get offset value */ -#define SX_VO(p, v) *((unsigned short *)((p) + (v) * 4 + 2)) - -/* Interpolation multi-dim. table access */ -#define IM_O(off) ((off) * 16) - -/* Interpolation table - get vertex values */ -#define IM_FE(p, v, c) *((unsigned int *)((p) + (v) * 8 + (c) * 4)) -#define IM_PE(p, v) *((unsigned int *)((p) + 12 + (v) * 8)) - -/* Output table indexes */ -#define OT_E(p, off) *((unsigned char *)((p) + (off) * 1)) - -static void -imdi_k38( -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 * 4 ; - pointer it0 = (pointer)p->in_tables[0]; - pointer it1 = (pointer)p->in_tables[1]; - pointer it2 = (pointer)p->in_tables[2]; - pointer it3 = (pointer)p->in_tables[3]; - pointer ot0 = (pointer)p->out_tables[0]; - pointer ot1 = (pointer)p->out_tables[1]; - pointer ot2 = (pointer)p->out_tables[2]; - pointer ot3 = (pointer)p->out_tables[3]; - pointer ot4 = (pointer)p->out_tables[4]; - pointer ot5 = (pointer)p->out_tables[5]; - pointer ot6 = (pointer)p->out_tables[6]; - pointer sw_base = (pointer)p->sw_table; - pointer im_base = (pointer)p->im_table; - - for(;ip0 < ep; ip0 += 4, op0 += 7) { - unsigned int ova0; /* Output value accumulator */ - unsigned int ova1; /* Output value accumulator */ - unsigned int ova2; /* Output value accumulator */ - unsigned int ova3; /* Output value partial accumulator */ - { - pointer swp; - pointer imp; - { - unsigned int ti_s; /* Simplex index variable */ - unsigned int ti_i; /* Interpolation index variable */ - - ti_i = IT_IX(it0, ip0[0]); - ti_s = IT_SX(it0, ip0[0]); - ti_i += IT_IX(it1, ip0[1]); - ti_s += IT_SX(it1, ip0[1]); - ti_i += IT_IX(it2, ip0[2]); - ti_s += IT_SX(it2, ip0[2]); - ti_i += IT_IX(it3, ip0[3]); - ti_s += IT_SX(it3, ip0[3]); - - swp = sw_base + SW_O(ti_s); /* Compute simplex table entry pointer */ - imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */ - } - { - unsigned int vof; /* Vertex offset value */ - unsigned int vwe; /* Vertex weighting */ - - vof = SX_VO(swp, 0); /* Read vertex offset value */ - vwe = SX_WE(swp, 0); /* Read vertex weighting value */ - ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof = SX_VO(swp, 1); /* Read vertex offset value */ - vwe = SX_WE(swp, 1); /* Read vertex weighting value */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof = SX_VO(swp, 2); /* Read vertex offset value */ - vwe = SX_WE(swp, 2); /* Read vertex weighting value */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof = SX_VO(swp, 3); /* Read vertex offset value */ - vwe = SX_WE(swp, 3); /* Read vertex weighting value */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof = SX_VO(swp, 4); /* Read vertex offset value */ - vwe = SX_WE(swp, 4); /* Read vertex weighting value */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += 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 */ - oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */ - op0[1] = OT_E(ot1, oti); /* Write result */ - oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */ - op0[2] = OT_E(ot2, oti); /* Write result */ - oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */ - op0[3] = OT_E(ot3, oti); /* Write result */ - oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */ - op0[4] = OT_E(ot4, oti); /* Write result */ - oti = ((ova2 >> 24) & 0xff); /* Extract integer part of result */ - op0[5] = OT_E(ot5, oti); /* Write result */ - oti = ((ova3 >> 8) & 0xff); /* Extract integer part of result */ - op0[6] = OT_E(ot6, oti); /* Write result */ - } - } -} -#undef IT_IX -#undef IT_SX -#undef SW_O -#undef SX_WE -#undef SX_VO -#undef IM_O -#undef IM_FE -#undef IM_PE -#undef OT_E - -static void -imdi_k38_gen( -genspec *g /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x1f, 0x00, 0x00, 0x00, 0xff, 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, 0x04, 0x08, - 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08, - 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7, - 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7, - 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08, - 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00, - 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7, - 0x2c, 0xf3, 0xdc, 0xb7, 0x34, 0x5f, 0x37, 0x5f, - 0x69, 0x38, 0x5f, 0x69, 0x38, 0x5f, 0x66, 0x00, - 0x8e, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00, - 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf, - 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08, - 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf, - 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x33, 0x38, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01, - 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7, - 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7, - 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08, - 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08, - 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf, - 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7, - 0x00, 0xf0, 0x04, 0x08 - }; /* Structure image */ - - memcpy(g, data, sizeof(data)); /* Initialise the structure */ -} - -static void -imdi_k38_tab( -tabspec *t /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x14, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0xdc, 0x60, 0xef, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff - }; /* Structure image */ - - memcpy(t, data, sizeof(data)); /* Initialise the structure */ -} - -/* 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 = 5 - Input channel 0 bits = 8 - Input channel 0 increment = 5 - Input channel 1 bits = 8 - Input channel 1 increment = 5 - Input channel 2 bits = 8 - Input channel 2 increment = 5 - Input channel 3 bits = 8 - Input channel 3 increment = 5 - Input channel 4 bits = 8 - Input channel 4 increment = 5 - Input is channel interleaved - Input channels are separate words - Input value extraction is done in input table lookup - - Output channels per pixel = 7 - Output channel 0 bits = 8 - Output channel 0 increment = 7 - Output channel 1 bits = 8 - Output channel 1 increment = 7 - Output channel 2 bits = 8 - Output channel 2 increment = 7 - Output channel 3 bits = 8 - Output channel 3 increment = 7 - Output channel 4 bits = 8 - Output channel 4 increment = 7 - Output channel 5 bits = 8 - Output channel 5 increment = 7 - Output channel 6 bits = 8 - Output channel 6 increment = 7 - Output is channel interleaved - - Output channels are separate words - Weight+voffset bits = 32 - Interpolation table index bits = 32 - Interpolation table max resolution = 45 - */ - -/* - 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 <memory.h> -#include "imdi_imp.h" -#define IMDI_INCLUDED -#endif /* IMDI_INCLUDED */ - -#ifndef DEFINED_pointer -#define DEFINED_pointer -typedef unsigned char * pointer; -#endif - -/* Input table interp. index */ -#define IT_IX(p, off) *((unsigned int *)((p) + 0 + (off) * 8)) - -/* Input table input weighting/offset value enty */ -#define IT_WO(p, off) *((unsigned int *)((p) + 4 + (off) * 8)) - -/* Conditional exchange for sorting */ -#define CEX(A, B) if (A < B) { A ^= B; B ^= A; A ^= B; } - -/* Interpolation multi-dim. table access */ -#define IM_O(off) ((off) * 16) - -/* Interpolation table - get vertex values */ -#define IM_FE(p, v, c) *((unsigned int *)((p) + (v) * 8 + (c) * 4)) -#define IM_PE(p, v) *((unsigned int *)((p) + 12 + (v) * 8)) - -/* Output table indexes */ -#define OT_E(p, off) *((unsigned char *)((p) + (off) * 1)) - -static void -imdi_k39( -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 * 5 ; - pointer it0 = (pointer)p->in_tables[0]; - pointer it1 = (pointer)p->in_tables[1]; - pointer it2 = (pointer)p->in_tables[2]; - pointer it3 = (pointer)p->in_tables[3]; - pointer it4 = (pointer)p->in_tables[4]; - pointer ot0 = (pointer)p->out_tables[0]; - pointer ot1 = (pointer)p->out_tables[1]; - pointer ot2 = (pointer)p->out_tables[2]; - pointer ot3 = (pointer)p->out_tables[3]; - pointer ot4 = (pointer)p->out_tables[4]; - pointer ot5 = (pointer)p->out_tables[5]; - pointer ot6 = (pointer)p->out_tables[6]; - pointer im_base = (pointer)p->im_table; - - for(;ip0 < ep; ip0 += 5, op0 += 7) { - unsigned int ova0; /* Output value accumulator */ - unsigned int ova1; /* Output value accumulator */ - unsigned int ova2; /* Output value accumulator */ - unsigned int ova3; /* Output value partial accumulator */ - { - pointer imp; - unsigned int wo0; /* Weighting value and vertex offset variable */ - unsigned int wo1; /* Weighting value and vertex offset variable */ - unsigned int wo2; /* Weighting value and vertex offset variable */ - unsigned int wo3; /* Weighting value and vertex offset variable */ - unsigned int wo4; /* Weighting value and vertex offset variable */ - { - unsigned int ti_i; /* Interpolation index variable */ - - ti_i = IT_IX(it0, ip0[0]); - wo0 = IT_WO(it0, ip0[0]); - ti_i += IT_IX(it1, ip0[1]); - wo1 = IT_WO(it1, ip0[1]); - ti_i += IT_IX(it2, ip0[2]); - wo2 = IT_WO(it2, ip0[2]); - ti_i += IT_IX(it3, ip0[3]); - wo3 = IT_WO(it3, ip0[3]); - ti_i += IT_IX(it4, ip0[4]); - wo4 = IT_WO(it4, ip0[4]); - - imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */ - - /* Sort weighting values and vertex offset values */ - CEX(wo0, wo1); - CEX(wo0, wo2); - CEX(wo0, wo3); - CEX(wo0, wo4); - CEX(wo1, wo2); - CEX(wo1, wo3); - CEX(wo1, wo4); - CEX(wo2, wo3); - CEX(wo2, wo4); - CEX(wo3, wo4); - } - { - unsigned int nvof; /* Next vertex offset value */ - unsigned int vof; /* Vertex offset value */ - unsigned int vwe; /* Vertex weighting */ - - vof = 0; /* First vertex offset is 0 */ - nvof = (wo0 & 0x7fffff); /* Extract offset value */ - wo0 = (wo0 >> 23); /* Extract weighting value */ - vwe = 256 - wo0; /* Baricentric weighting */ - ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo1 & 0x7fffff); /* Extract offset value */ - wo1 = (wo1 >> 23); /* Extract weighting value */ - vwe = wo0 - wo1; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo2 & 0x7fffff); /* Extract offset value */ - wo2 = (wo2 >> 23); /* Extract weighting value */ - vwe = wo1 - wo2; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo3 & 0x7fffff); /* Extract offset value */ - wo3 = (wo3 >> 23); /* Extract weighting value */ - vwe = wo2 - wo3; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo4 & 0x7fffff); /* Extract offset value */ - wo4 = (wo4 >> 23); /* Extract weighting value */ - vwe = wo3 - wo4; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - vwe = wo4; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += 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 */ - oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */ - op0[1] = OT_E(ot1, oti); /* Write result */ - oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */ - op0[2] = OT_E(ot2, oti); /* Write result */ - oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */ - op0[3] = OT_E(ot3, oti); /* Write result */ - oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */ - op0[4] = OT_E(ot4, oti); /* Write result */ - oti = ((ova2 >> 24) & 0xff); /* Extract integer part of result */ - op0[5] = OT_E(ot5, oti); /* Write result */ - oti = ((ova3 >> 8) & 0xff); /* Extract integer part of result */ - op0[6] = OT_E(ot6, oti); /* Write result */ - } - } -} -#undef IT_WO -#undef IT_IX -#undef CEX -#undef IM_O -#undef IM_FE -#undef IM_PE -#undef OT_E - -static void -imdi_k39_gen( -genspec *g /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x08, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x2d, 0x00, 0x00, 0x00, 0x00, 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, 0x04, 0x08, - 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08, - 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7, - 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7, - 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08, - 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00, - 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7, - 0x2c, 0xf3, 0xdc, 0xb7, 0x35, 0x5f, 0x37, 0x5f, - 0x69, 0x38, 0x5f, 0x69, 0x38, 0x5f, 0x66, 0x00, - 0x8e, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00, - 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf, - 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08, - 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf, - 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x33, 0x39, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01, - 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7, - 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7, - 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08, - 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08, - 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf, - 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7, - 0x00, 0xf0, 0x04, 0x08 - }; /* Structure image */ - - memcpy(g, data, sizeof(data)); /* Initialise the structure */ -} - -static void -imdi_k39_tab( -tabspec *t /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0xdc, 0x60, 0xef, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff - }; /* Structure image */ - - memcpy(t, data, sizeof(data)); /* Initialise the structure */ -} - -/* 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 = 6 - Input channel 0 bits = 8 - Input channel 0 increment = 6 - Input channel 1 bits = 8 - Input channel 1 increment = 6 - Input channel 2 bits = 8 - Input channel 2 increment = 6 - Input channel 3 bits = 8 - Input channel 3 increment = 6 - Input channel 4 bits = 8 - Input channel 4 increment = 6 - Input channel 5 bits = 8 - Input channel 5 increment = 6 - Input is channel interleaved - Input channels are separate words - Input value extraction is done in input table lookup - - Output channels per pixel = 7 - Output channel 0 bits = 8 - Output channel 0 increment = 7 - Output channel 1 bits = 8 - Output channel 1 increment = 7 - Output channel 2 bits = 8 - Output channel 2 increment = 7 - Output channel 3 bits = 8 - Output channel 3 increment = 7 - Output channel 4 bits = 8 - Output channel 4 increment = 7 - Output channel 5 bits = 8 - Output channel 5 increment = 7 - Output channel 6 bits = 8 - Output channel 6 increment = 7 - Output is channel interleaved - - Output channels are separate words - Weight+voffset bits = 32 - Interpolation table index bits = 32 - Interpolation table max resolution = 20 - */ - -/* - 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 <memory.h> -#include "imdi_imp.h" -#define IMDI_INCLUDED -#endif /* IMDI_INCLUDED */ - -#ifndef DEFINED_pointer -#define DEFINED_pointer -typedef unsigned char * pointer; -#endif - -/* Input table interp. index */ -#define IT_IX(p, off) *((unsigned int *)((p) + 0 + (off) * 8)) - -/* Input table input weighting/offset value enty */ -#define IT_WO(p, off) *((unsigned int *)((p) + 4 + (off) * 8)) - -/* Conditional exchange for sorting */ -#define CEX(A, B) if (A < B) { A ^= B; B ^= A; A ^= B; } - -/* Interpolation multi-dim. table access */ -#define IM_O(off) ((off) * 16) - -/* Interpolation table - get vertex values */ -#define IM_FE(p, v, c) *((unsigned int *)((p) + (v) * 8 + (c) * 4)) -#define IM_PE(p, v) *((unsigned int *)((p) + 12 + (v) * 8)) - -/* Output table indexes */ -#define OT_E(p, off) *((unsigned char *)((p) + (off) * 1)) - -static void -imdi_k40( -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 * 6 ; - pointer it0 = (pointer)p->in_tables[0]; - pointer it1 = (pointer)p->in_tables[1]; - pointer it2 = (pointer)p->in_tables[2]; - pointer it3 = (pointer)p->in_tables[3]; - pointer it4 = (pointer)p->in_tables[4]; - pointer it5 = (pointer)p->in_tables[5]; - pointer ot0 = (pointer)p->out_tables[0]; - pointer ot1 = (pointer)p->out_tables[1]; - pointer ot2 = (pointer)p->out_tables[2]; - pointer ot3 = (pointer)p->out_tables[3]; - pointer ot4 = (pointer)p->out_tables[4]; - pointer ot5 = (pointer)p->out_tables[5]; - pointer ot6 = (pointer)p->out_tables[6]; - pointer im_base = (pointer)p->im_table; - - for(;ip0 < ep; ip0 += 6, op0 += 7) { - unsigned int ova0; /* Output value accumulator */ - unsigned int ova1; /* Output value accumulator */ - unsigned int ova2; /* Output value accumulator */ - unsigned int ova3; /* Output value partial accumulator */ - { - pointer imp; - unsigned int wo0; /* Weighting value and vertex offset variable */ - unsigned int wo1; /* Weighting value and vertex offset variable */ - unsigned int wo2; /* Weighting value and vertex offset variable */ - unsigned int wo3; /* Weighting value and vertex offset variable */ - unsigned int wo4; /* Weighting value and vertex offset variable */ - unsigned int wo5; /* Weighting value and vertex offset variable */ - { - unsigned int ti_i; /* Interpolation index variable */ - - ti_i = IT_IX(it0, ip0[0]); - wo0 = IT_WO(it0, ip0[0]); - ti_i += IT_IX(it1, ip0[1]); - wo1 = IT_WO(it1, ip0[1]); - ti_i += IT_IX(it2, ip0[2]); - wo2 = IT_WO(it2, ip0[2]); - ti_i += IT_IX(it3, ip0[3]); - wo3 = IT_WO(it3, ip0[3]); - ti_i += IT_IX(it4, ip0[4]); - wo4 = IT_WO(it4, ip0[4]); - ti_i += IT_IX(it5, ip0[5]); - wo5 = IT_WO(it5, ip0[5]); - - imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */ - - /* Sort weighting values and vertex offset values */ - CEX(wo0, wo1); - CEX(wo0, wo2); - CEX(wo0, wo3); - CEX(wo0, wo4); - CEX(wo0, wo5); - CEX(wo1, wo2); - CEX(wo1, wo3); - CEX(wo1, wo4); - CEX(wo1, wo5); - CEX(wo2, wo3); - CEX(wo2, wo4); - CEX(wo2, wo5); - CEX(wo3, wo4); - CEX(wo3, wo5); - CEX(wo4, wo5); - } - { - unsigned int nvof; /* Next vertex offset value */ - unsigned int vof; /* Vertex offset value */ - unsigned int vwe; /* Vertex weighting */ - - vof = 0; /* First vertex offset is 0 */ - nvof = (wo0 & 0x7fffff); /* Extract offset value */ - wo0 = (wo0 >> 23); /* Extract weighting value */ - vwe = 256 - wo0; /* Baricentric weighting */ - ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo1 & 0x7fffff); /* Extract offset value */ - wo1 = (wo1 >> 23); /* Extract weighting value */ - vwe = wo0 - wo1; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo2 & 0x7fffff); /* Extract offset value */ - wo2 = (wo2 >> 23); /* Extract weighting value */ - vwe = wo1 - wo2; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo3 & 0x7fffff); /* Extract offset value */ - wo3 = (wo3 >> 23); /* Extract weighting value */ - vwe = wo2 - wo3; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo4 & 0x7fffff); /* Extract offset value */ - wo4 = (wo4 >> 23); /* Extract weighting value */ - vwe = wo3 - wo4; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo5 & 0x7fffff); /* Extract offset value */ - wo5 = (wo5 >> 23); /* Extract weighting value */ - vwe = wo4 - wo5; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - vwe = wo5; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += 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 */ - oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */ - op0[1] = OT_E(ot1, oti); /* Write result */ - oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */ - op0[2] = OT_E(ot2, oti); /* Write result */ - oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */ - op0[3] = OT_E(ot3, oti); /* Write result */ - oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */ - op0[4] = OT_E(ot4, oti); /* Write result */ - oti = ((ova2 >> 24) & 0xff); /* Extract integer part of result */ - op0[5] = OT_E(ot5, oti); /* Write result */ - oti = ((ova3 >> 8) & 0xff); /* Extract integer part of result */ - op0[6] = OT_E(ot6, oti); /* Write result */ - } - } -} -#undef IT_WO -#undef IT_IX -#undef CEX -#undef IM_O -#undef IM_FE -#undef IM_PE -#undef OT_E - -static void -imdi_k40_gen( -genspec *g /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x08, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x14, 0x00, 0x00, 0x00, 0x00, 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, 0x04, 0x08, - 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08, - 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7, - 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7, - 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08, - 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00, - 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7, - 0x2c, 0xf3, 0xdc, 0xb7, 0x36, 0x5f, 0x37, 0x5f, - 0x69, 0x38, 0x5f, 0x69, 0x38, 0x5f, 0x66, 0x00, - 0x8e, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00, - 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf, - 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08, - 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf, - 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x34, 0x30, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01, - 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7, - 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7, - 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08, - 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08, - 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf, - 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7, - 0x00, 0xf0, 0x04, 0x08 - }; /* Structure image */ - - memcpy(g, data, sizeof(data)); /* Initialise the structure */ -} - -static void -imdi_k40_tab( -tabspec *t /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0xdc, 0x60, 0xef, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff - }; /* Structure image */ - - memcpy(t, data, sizeof(data)); /* Initialise the structure */ -} - -/* 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 = 7 - Input channel 0 bits = 8 - Input channel 0 increment = 7 - Input channel 1 bits = 8 - Input channel 1 increment = 7 - Input channel 2 bits = 8 - Input channel 2 increment = 7 - Input channel 3 bits = 8 - Input channel 3 increment = 7 - Input channel 4 bits = 8 - Input channel 4 increment = 7 - Input channel 5 bits = 8 - Input channel 5 increment = 7 - Input channel 6 bits = 8 - Input channel 6 increment = 7 - Input is channel interleaved - Input channels are separate words - Input value extraction is done in input table lookup - - Output channels per pixel = 7 - Output channel 0 bits = 8 - Output channel 0 increment = 7 - Output channel 1 bits = 8 - Output channel 1 increment = 7 - Output channel 2 bits = 8 - Output channel 2 increment = 7 - Output channel 3 bits = 8 - Output channel 3 increment = 7 - Output channel 4 bits = 8 - Output channel 4 increment = 7 - Output channel 5 bits = 8 - Output channel 5 increment = 7 - Output channel 6 bits = 8 - Output channel 6 increment = 7 - Output is channel interleaved - - Output channels are separate words - Weight+voffset bits = 32 - Interpolation table index bits = 32 - Interpolation table max resolution = 12 - */ - -/* - 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 <memory.h> -#include "imdi_imp.h" -#define IMDI_INCLUDED -#endif /* IMDI_INCLUDED */ - -#ifndef DEFINED_pointer -#define DEFINED_pointer -typedef unsigned char * pointer; -#endif - -/* Input table interp. index */ -#define IT_IX(p, off) *((unsigned int *)((p) + 0 + (off) * 8)) - -/* Input table input weighting/offset value enty */ -#define IT_WO(p, off) *((unsigned int *)((p) + 4 + (off) * 8)) - -/* Conditional exchange for sorting */ -#define CEX(A, B) if (A < B) { A ^= B; B ^= A; A ^= B; } - -/* Interpolation multi-dim. table access */ -#define IM_O(off) ((off) * 16) - -/* Interpolation table - get vertex values */ -#define IM_FE(p, v, c) *((unsigned int *)((p) + (v) * 8 + (c) * 4)) -#define IM_PE(p, v) *((unsigned int *)((p) + 12 + (v) * 8)) - -/* Output table indexes */ -#define OT_E(p, off) *((unsigned char *)((p) + (off) * 1)) - -static void -imdi_k41( -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 * 7 ; - pointer it0 = (pointer)p->in_tables[0]; - pointer it1 = (pointer)p->in_tables[1]; - pointer it2 = (pointer)p->in_tables[2]; - pointer it3 = (pointer)p->in_tables[3]; - pointer it4 = (pointer)p->in_tables[4]; - pointer it5 = (pointer)p->in_tables[5]; - pointer it6 = (pointer)p->in_tables[6]; - pointer ot0 = (pointer)p->out_tables[0]; - pointer ot1 = (pointer)p->out_tables[1]; - pointer ot2 = (pointer)p->out_tables[2]; - pointer ot3 = (pointer)p->out_tables[3]; - pointer ot4 = (pointer)p->out_tables[4]; - pointer ot5 = (pointer)p->out_tables[5]; - pointer ot6 = (pointer)p->out_tables[6]; - pointer im_base = (pointer)p->im_table; - - for(;ip0 < ep; ip0 += 7, op0 += 7) { - unsigned int ova0; /* Output value accumulator */ - unsigned int ova1; /* Output value accumulator */ - unsigned int ova2; /* Output value accumulator */ - unsigned int ova3; /* Output value partial accumulator */ - { - pointer imp; - unsigned int wo0; /* Weighting value and vertex offset variable */ - unsigned int wo1; /* Weighting value and vertex offset variable */ - unsigned int wo2; /* Weighting value and vertex offset variable */ - unsigned int wo3; /* Weighting value and vertex offset variable */ - unsigned int wo4; /* Weighting value and vertex offset variable */ - unsigned int wo5; /* Weighting value and vertex offset variable */ - unsigned int wo6; /* Weighting value and vertex offset variable */ - { - unsigned int ti_i; /* Interpolation index variable */ - - ti_i = IT_IX(it0, ip0[0]); - wo0 = IT_WO(it0, ip0[0]); - ti_i += IT_IX(it1, ip0[1]); - wo1 = IT_WO(it1, ip0[1]); - ti_i += IT_IX(it2, ip0[2]); - wo2 = IT_WO(it2, ip0[2]); - ti_i += IT_IX(it3, ip0[3]); - wo3 = IT_WO(it3, ip0[3]); - ti_i += IT_IX(it4, ip0[4]); - wo4 = IT_WO(it4, ip0[4]); - ti_i += IT_IX(it5, ip0[5]); - wo5 = IT_WO(it5, ip0[5]); - ti_i += IT_IX(it6, ip0[6]); - wo6 = IT_WO(it6, ip0[6]); - - imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */ - - /* Sort weighting values and vertex offset values */ - CEX(wo0, wo1); - CEX(wo0, wo2); - CEX(wo0, wo3); - CEX(wo0, wo4); - CEX(wo0, wo5); - CEX(wo0, wo6); - CEX(wo1, wo2); - CEX(wo1, wo3); - CEX(wo1, wo4); - CEX(wo1, wo5); - CEX(wo1, wo6); - CEX(wo2, wo3); - CEX(wo2, wo4); - CEX(wo2, wo5); - CEX(wo2, wo6); - CEX(wo3, wo4); - CEX(wo3, wo5); - CEX(wo3, wo6); - CEX(wo4, wo5); - CEX(wo4, wo6); - CEX(wo5, wo6); - } - { - unsigned int nvof; /* Next vertex offset value */ - unsigned int vof; /* Vertex offset value */ - unsigned int vwe; /* Vertex weighting */ - - vof = 0; /* First vertex offset is 0 */ - nvof = (wo0 & 0x7fffff); /* Extract offset value */ - wo0 = (wo0 >> 23); /* Extract weighting value */ - vwe = 256 - wo0; /* Baricentric weighting */ - ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo1 & 0x7fffff); /* Extract offset value */ - wo1 = (wo1 >> 23); /* Extract weighting value */ - vwe = wo0 - wo1; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo2 & 0x7fffff); /* Extract offset value */ - wo2 = (wo2 >> 23); /* Extract weighting value */ - vwe = wo1 - wo2; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo3 & 0x7fffff); /* Extract offset value */ - wo3 = (wo3 >> 23); /* Extract weighting value */ - vwe = wo2 - wo3; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo4 & 0x7fffff); /* Extract offset value */ - wo4 = (wo4 >> 23); /* Extract weighting value */ - vwe = wo3 - wo4; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo5 & 0x7fffff); /* Extract offset value */ - wo5 = (wo5 >> 23); /* Extract weighting value */ - vwe = wo4 - wo5; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo6 & 0x7fffff); /* Extract offset value */ - wo6 = (wo6 >> 23); /* Extract weighting value */ - vwe = wo5 - wo6; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - vwe = wo6; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += 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 */ - oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */ - op0[1] = OT_E(ot1, oti); /* Write result */ - oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */ - op0[2] = OT_E(ot2, oti); /* Write result */ - oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */ - op0[3] = OT_E(ot3, oti); /* Write result */ - oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */ - op0[4] = OT_E(ot4, oti); /* Write result */ - oti = ((ova2 >> 24) & 0xff); /* Extract integer part of result */ - op0[5] = OT_E(ot5, oti); /* Write result */ - oti = ((ova3 >> 8) & 0xff); /* Extract integer part of result */ - op0[6] = OT_E(ot6, oti); /* Write result */ - } - } -} -#undef IT_WO -#undef IT_IX -#undef CEX -#undef IM_O -#undef IM_FE -#undef IM_PE -#undef OT_E - -static void -imdi_k41_gen( -genspec *g /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x0c, 0x00, 0x00, 0x00, 0x00, 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, 0x04, 0x08, - 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08, - 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7, - 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7, - 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08, - 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00, - 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7, - 0x2c, 0xf3, 0xdc, 0xb7, 0x37, 0x5f, 0x37, 0x5f, - 0x69, 0x38, 0x5f, 0x69, 0x38, 0x5f, 0x66, 0x00, - 0x8e, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00, - 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf, - 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08, - 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf, - 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x34, 0x31, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01, - 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7, - 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7, - 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08, - 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08, - 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf, - 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7, - 0x00, 0xf0, 0x04, 0x08 - }; /* Structure image */ - - memcpy(g, data, sizeof(data)); /* Initialise the structure */ -} - -static void -imdi_k41_tab( -tabspec *t /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0xdc, 0x60, 0xef, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff - }; /* Structure image */ - - memcpy(t, data, sizeof(data)); /* Initialise the structure */ -} - -/* 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 = 8 - Input channel 0 bits = 8 - Input channel 0 increment = 8 - Input channel 1 bits = 8 - Input channel 1 increment = 8 - Input channel 2 bits = 8 - Input channel 2 increment = 8 - Input channel 3 bits = 8 - Input channel 3 increment = 8 - Input channel 4 bits = 8 - Input channel 4 increment = 8 - Input channel 5 bits = 8 - Input channel 5 increment = 8 - Input channel 6 bits = 8 - Input channel 6 increment = 8 - Input channel 7 bits = 8 - Input channel 7 increment = 8 - Input is channel interleaved - Input channels are separate words - Input value extraction is done in input table lookup - - Output channels per pixel = 7 - Output channel 0 bits = 8 - Output channel 0 increment = 7 - Output channel 1 bits = 8 - Output channel 1 increment = 7 - Output channel 2 bits = 8 - Output channel 2 increment = 7 - Output channel 3 bits = 8 - Output channel 3 increment = 7 - Output channel 4 bits = 8 - Output channel 4 increment = 7 - Output channel 5 bits = 8 - Output channel 5 increment = 7 - Output channel 6 bits = 8 - Output channel 6 increment = 7 - Output is channel interleaved - - Output channels are separate words - Weight+voffset bits = 32 - Interpolation table index bits = 32 - Interpolation table max resolution = 8 - */ - -/* - 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 <memory.h> -#include "imdi_imp.h" -#define IMDI_INCLUDED -#endif /* IMDI_INCLUDED */ - -#ifndef DEFINED_pointer -#define DEFINED_pointer -typedef unsigned char * pointer; -#endif - -/* Input table interp. index */ -#define IT_IX(p, off) *((unsigned int *)((p) + 0 + (off) * 8)) - -/* Input table input weighting/offset value enty */ -#define IT_WO(p, off) *((unsigned int *)((p) + 4 + (off) * 8)) - -/* Conditional exchange for sorting */ -#define CEX(A, B) if (A < B) { A ^= B; B ^= A; A ^= B; } - -/* Interpolation multi-dim. table access */ -#define IM_O(off) ((off) * 16) - -/* Interpolation table - get vertex values */ -#define IM_FE(p, v, c) *((unsigned int *)((p) + (v) * 8 + (c) * 4)) -#define IM_PE(p, v) *((unsigned int *)((p) + 12 + (v) * 8)) - -/* Output table indexes */ -#define OT_E(p, off) *((unsigned char *)((p) + (off) * 1)) - -static void -imdi_k42( -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 * 8 ; - pointer it0 = (pointer)p->in_tables[0]; - pointer it1 = (pointer)p->in_tables[1]; - pointer it2 = (pointer)p->in_tables[2]; - pointer it3 = (pointer)p->in_tables[3]; - pointer it4 = (pointer)p->in_tables[4]; - pointer it5 = (pointer)p->in_tables[5]; - pointer it6 = (pointer)p->in_tables[6]; - pointer it7 = (pointer)p->in_tables[7]; - pointer ot0 = (pointer)p->out_tables[0]; - pointer ot1 = (pointer)p->out_tables[1]; - pointer ot2 = (pointer)p->out_tables[2]; - pointer ot3 = (pointer)p->out_tables[3]; - pointer ot4 = (pointer)p->out_tables[4]; - pointer ot5 = (pointer)p->out_tables[5]; - pointer ot6 = (pointer)p->out_tables[6]; - pointer im_base = (pointer)p->im_table; - - for(;ip0 < ep; ip0 += 8, op0 += 7) { - unsigned int ova0; /* Output value accumulator */ - unsigned int ova1; /* Output value accumulator */ - unsigned int ova2; /* Output value accumulator */ - unsigned int ova3; /* Output value partial accumulator */ - { - pointer imp; - unsigned int wo0; /* Weighting value and vertex offset variable */ - unsigned int wo1; /* Weighting value and vertex offset variable */ - unsigned int wo2; /* Weighting value and vertex offset variable */ - unsigned int wo3; /* Weighting value and vertex offset variable */ - unsigned int wo4; /* Weighting value and vertex offset variable */ - unsigned int wo5; /* Weighting value and vertex offset variable */ - unsigned int wo6; /* Weighting value and vertex offset variable */ - unsigned int wo7; /* Weighting value and vertex offset variable */ - { - unsigned int ti_i; /* Interpolation index variable */ - - ti_i = IT_IX(it0, ip0[0]); - wo0 = IT_WO(it0, ip0[0]); - ti_i += IT_IX(it1, ip0[1]); - wo1 = IT_WO(it1, ip0[1]); - ti_i += IT_IX(it2, ip0[2]); - wo2 = IT_WO(it2, ip0[2]); - ti_i += IT_IX(it3, ip0[3]); - wo3 = IT_WO(it3, ip0[3]); - ti_i += IT_IX(it4, ip0[4]); - wo4 = IT_WO(it4, ip0[4]); - ti_i += IT_IX(it5, ip0[5]); - wo5 = IT_WO(it5, ip0[5]); - ti_i += IT_IX(it6, ip0[6]); - wo6 = IT_WO(it6, ip0[6]); - ti_i += IT_IX(it7, ip0[7]); - wo7 = IT_WO(it7, ip0[7]); - - imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */ - - /* Sort weighting values and vertex offset values */ - CEX(wo0, wo1); - CEX(wo0, wo2); - CEX(wo0, wo3); - CEX(wo0, wo4); - CEX(wo0, wo5); - CEX(wo0, wo6); - CEX(wo0, wo7); - CEX(wo1, wo2); - CEX(wo1, wo3); - CEX(wo1, wo4); - CEX(wo1, wo5); - CEX(wo1, wo6); - CEX(wo1, wo7); - CEX(wo2, wo3); - CEX(wo2, wo4); - CEX(wo2, wo5); - CEX(wo2, wo6); - CEX(wo2, wo7); - CEX(wo3, wo4); - CEX(wo3, wo5); - CEX(wo3, wo6); - CEX(wo3, wo7); - CEX(wo4, wo5); - CEX(wo4, wo6); - CEX(wo4, wo7); - CEX(wo5, wo6); - CEX(wo5, wo7); - CEX(wo6, wo7); - } - { - unsigned int nvof; /* Next vertex offset value */ - unsigned int vof; /* Vertex offset value */ - unsigned int vwe; /* Vertex weighting */ - - vof = 0; /* First vertex offset is 0 */ - nvof = (wo0 & 0x7fffff); /* Extract offset value */ - wo0 = (wo0 >> 23); /* Extract weighting value */ - vwe = 256 - wo0; /* Baricentric weighting */ - ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo1 & 0x7fffff); /* Extract offset value */ - wo1 = (wo1 >> 23); /* Extract weighting value */ - vwe = wo0 - wo1; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo2 & 0x7fffff); /* Extract offset value */ - wo2 = (wo2 >> 23); /* Extract weighting value */ - vwe = wo1 - wo2; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo3 & 0x7fffff); /* Extract offset value */ - wo3 = (wo3 >> 23); /* Extract weighting value */ - vwe = wo2 - wo3; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo4 & 0x7fffff); /* Extract offset value */ - wo4 = (wo4 >> 23); /* Extract weighting value */ - vwe = wo3 - wo4; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo5 & 0x7fffff); /* Extract offset value */ - wo5 = (wo5 >> 23); /* Extract weighting value */ - vwe = wo4 - wo5; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo6 & 0x7fffff); /* Extract offset value */ - wo6 = (wo6 >> 23); /* Extract weighting value */ - vwe = wo5 - wo6; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo7 & 0x7fffff); /* Extract offset value */ - wo7 = (wo7 >> 23); /* Extract weighting value */ - vwe = wo6 - wo7; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - vwe = wo7; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += 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 */ - oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */ - op0[1] = OT_E(ot1, oti); /* Write result */ - oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */ - op0[2] = OT_E(ot2, oti); /* Write result */ - oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */ - op0[3] = OT_E(ot3, oti); /* Write result */ - oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */ - op0[4] = OT_E(ot4, oti); /* Write result */ - oti = ((ova2 >> 24) & 0xff); /* Extract integer part of result */ - op0[5] = OT_E(ot5, oti); /* Write result */ - oti = ((ova3 >> 8) & 0xff); /* Extract integer part of result */ - op0[6] = OT_E(ot6, oti); /* Write result */ - } - } -} -#undef IT_WO -#undef IT_IX -#undef CEX -#undef IM_O -#undef IM_FE -#undef IM_PE -#undef OT_E - -static void -imdi_k42_gen( -genspec *g /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 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, 0x04, 0x08, - 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08, - 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7, - 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7, - 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08, - 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00, - 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7, - 0x2c, 0xf3, 0xdc, 0xb7, 0x38, 0x5f, 0x37, 0x5f, - 0x69, 0x38, 0x5f, 0x69, 0x38, 0x5f, 0x66, 0x00, - 0x8e, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00, - 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf, - 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08, - 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf, - 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x34, 0x32, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01, - 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7, - 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7, - 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08, - 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08, - 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf, - 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7, - 0x00, 0xf0, 0x04, 0x08 - }; /* Structure image */ - - memcpy(g, data, sizeof(data)); /* Initialise the structure */ -} - -static void -imdi_k42_tab( -tabspec *t /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0xdc, 0x60, 0xef, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff - }; /* Structure image */ - - memcpy(t, data, sizeof(data)); /* Initialise the structure */ -} - -/* 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 = 8 - Output channel 0 bits = 8 - Output channel 0 increment = 8 - Output channel 1 bits = 8 - Output channel 1 increment = 8 - Output channel 2 bits = 8 - Output channel 2 increment = 8 - Output channel 3 bits = 8 - Output channel 3 increment = 8 - Output channel 4 bits = 8 - Output channel 4 increment = 8 - Output channel 5 bits = 8 - Output channel 5 increment = 8 - Output channel 6 bits = 8 - Output channel 6 increment = 8 - Output channel 7 bits = 8 - Output channel 7 increment = 8 - 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 = 255 - */ - -/* - 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 <memory.h> -#include "imdi_imp.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) * 16) - -/* Interpolation table - get vertex values */ -#define IM_FE(p, v, c) *((unsigned int *)((p) + (v) * 8 + (c) * 4)) - -/* Output table indexes */ -#define OT_E(p, off) *((unsigned char *)((p) + (off) * 1)) - -static void -imdi_k43( -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 ot1 = (pointer)p->out_tables[1]; - pointer ot2 = (pointer)p->out_tables[2]; - pointer ot3 = (pointer)p->out_tables[3]; - pointer ot4 = (pointer)p->out_tables[4]; - pointer ot5 = (pointer)p->out_tables[5]; - pointer ot6 = (pointer)p->out_tables[6]; - pointer ot7 = (pointer)p->out_tables[7]; - pointer sw_base = (pointer)p->sw_table; - pointer im_base = (pointer)p->im_table; - - for(;ip0 < ep; ip0 += 1, op0 += 8) { - unsigned int ova0; /* Output value accumulator */ - unsigned int ova1; /* Output value accumulator */ - unsigned int ova2; /* Output value accumulator */ - unsigned int ova3; /* Output value 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_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 = IM_FE(imp, vof, 3) * vwe; /* Accumulate 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_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate 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 */ - oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */ - op0[1] = OT_E(ot1, oti); /* Write result */ - oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */ - op0[2] = OT_E(ot2, oti); /* Write result */ - oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */ - op0[3] = OT_E(ot3, oti); /* Write result */ - oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */ - op0[4] = OT_E(ot4, oti); /* Write result */ - oti = ((ova2 >> 24) & 0xff); /* Extract integer part of result */ - op0[5] = OT_E(ot5, oti); /* Write result */ - oti = ((ova3 >> 8) & 0xff); /* Extract integer part of result */ - op0[6] = OT_E(ot6, oti); /* Write result */ - oti = ((ova3 >> 24) & 0xff); /* Extract integer part of result */ - op0[7] = OT_E(ot7, oti); /* Write result */ - } - } -} -#undef IT_IT -#undef SW_O -#undef SX_WO -#undef IM_O -#undef IM_FE -#undef OT_E - -static void -imdi_k43_gen( -genspec *g /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0xff, 0x00, 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, 0x04, 0x08, - 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08, - 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7, - 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7, - 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08, - 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00, - 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7, - 0x2c, 0xf3, 0xdc, 0xb7, 0x31, 0x5f, 0x38, 0x5f, - 0x69, 0x38, 0x5f, 0x69, 0x38, 0x5f, 0x66, 0x00, - 0x8e, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00, - 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf, - 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08, - 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf, - 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x34, 0x33, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01, - 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7, - 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7, - 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08, - 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08, - 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf, - 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7, - 0x00, 0xf0, 0x04, 0x08 - }; /* Structure image */ - - memcpy(g, data, sizeof(data)); /* Initialise the structure */ -} - -static void -imdi_k43_tab( -tabspec *t /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff - }; /* Structure image */ - - memcpy(t, data, sizeof(data)); /* Initialise the structure */ -} - -/* 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 = 3 - Input channel 0 bits = 8 - Input channel 0 increment = 3 - Input channel 1 bits = 8 - Input channel 1 increment = 3 - Input channel 2 bits = 8 - Input channel 2 increment = 3 - Input is channel interleaved - Input channels are separate words - Input value extraction is done in input table lookup - - Output channels per pixel = 8 - Output channel 0 bits = 8 - Output channel 0 increment = 8 - Output channel 1 bits = 8 - Output channel 1 increment = 8 - Output channel 2 bits = 8 - Output channel 2 increment = 8 - Output channel 3 bits = 8 - Output channel 3 increment = 8 - Output channel 4 bits = 8 - Output channel 4 increment = 8 - Output channel 5 bits = 8 - Output channel 5 increment = 8 - Output channel 6 bits = 8 - Output channel 6 increment = 8 - Output channel 7 bits = 8 - Output channel 7 increment = 8 - Output is channel interleaved - - Output channels are separate words - Simplex table index bits = 12 - Interpolation table index bits = 20 - Simplex table max resolution = 16 - Interpolation table max resolution = 101 - */ - -/* - 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 <memory.h> -#include "imdi_imp.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 int *)((p) + 0 + (off) * 4)) - -/* Simplex weighting table access */ -#define SW_O(off) ((off) * 16) - -/* Simplex table - get weighting value */ -#define SX_WE(p, v) *((unsigned short *)((p) + (v) * 4 + 0)) - -/* Simplex table - get offset value */ -#define SX_VO(p, v) *((unsigned short *)((p) + (v) * 4 + 2)) - -/* Interpolation multi-dim. table access */ -#define IM_O(off) ((off) * 16) - -/* Interpolation table - get vertex values */ -#define IM_FE(p, v, c) *((unsigned int *)((p) + (v) * 8 + (c) * 4)) - -/* Output table indexes */ -#define OT_E(p, off) *((unsigned char *)((p) + (off) * 1)) - -static void -imdi_k44( -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 * 3 ; - pointer it0 = (pointer)p->in_tables[0]; - pointer it1 = (pointer)p->in_tables[1]; - pointer it2 = (pointer)p->in_tables[2]; - pointer ot0 = (pointer)p->out_tables[0]; - pointer ot1 = (pointer)p->out_tables[1]; - pointer ot2 = (pointer)p->out_tables[2]; - pointer ot3 = (pointer)p->out_tables[3]; - pointer ot4 = (pointer)p->out_tables[4]; - pointer ot5 = (pointer)p->out_tables[5]; - pointer ot6 = (pointer)p->out_tables[6]; - pointer ot7 = (pointer)p->out_tables[7]; - pointer sw_base = (pointer)p->sw_table; - pointer im_base = (pointer)p->im_table; - - for(;ip0 < ep; ip0 += 3, op0 += 8) { - unsigned int ova0; /* Output value accumulator */ - unsigned int ova1; /* Output value accumulator */ - unsigned int ova2; /* Output value accumulator */ - unsigned int ova3; /* Output value accumulator */ - { - pointer swp; - pointer imp; - { - unsigned int ti; /* Simplex+Interpolation index variable */ - - ti = IT_IT(it0, ip0[0]); - ti += IT_IT(it1, ip0[1]); - ti += IT_IT(it2, ip0[2]); - - imp = im_base + IM_O(ti >> 12); /* Extract interp. index and comp. entry */ - swp = sw_base + SW_O(ti & 0xfff); /* Extract simplex index and comp. entry */ - } - { - unsigned int vof; /* Vertex offset value */ - unsigned int vwe; /* Vertex weighting */ - - vof = SX_VO(swp, 0); /* Read vertex offset value */ - vwe = SX_WE(swp, 0); /* Read vertex weighting value */ - ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 = IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - vof = SX_VO(swp, 1); /* Read vertex offset value */ - vwe = SX_WE(swp, 1); /* Read vertex weighting value */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - vof = SX_VO(swp, 2); /* Read vertex offset value */ - vwe = SX_WE(swp, 2); /* Read vertex weighting value */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - vof = SX_VO(swp, 3); /* Read vertex offset value */ - vwe = SX_WE(swp, 3); /* Read vertex weighting value */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate 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 */ - oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */ - op0[1] = OT_E(ot1, oti); /* Write result */ - oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */ - op0[2] = OT_E(ot2, oti); /* Write result */ - oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */ - op0[3] = OT_E(ot3, oti); /* Write result */ - oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */ - op0[4] = OT_E(ot4, oti); /* Write result */ - oti = ((ova2 >> 24) & 0xff); /* Extract integer part of result */ - op0[5] = OT_E(ot5, oti); /* Write result */ - oti = ((ova3 >> 8) & 0xff); /* Extract integer part of result */ - op0[6] = OT_E(ot6, oti); /* Write result */ - oti = ((ova3 >> 24) & 0xff); /* Extract integer part of result */ - op0[7] = OT_E(ot7, oti); /* Write result */ - } - } -} -#undef IT_IT -#undef SW_O -#undef SX_WE -#undef SX_VO -#undef IM_O -#undef IM_FE -#undef OT_E - -static void -imdi_k44_gen( -genspec *g /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x08, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x65, 0x00, 0x00, 0x00, 0x10, 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, 0x04, 0x08, - 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08, - 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7, - 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7, - 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08, - 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00, - 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7, - 0x2c, 0xf3, 0xdc, 0xb7, 0x33, 0x5f, 0x38, 0x5f, - 0x69, 0x38, 0x5f, 0x69, 0x38, 0x5f, 0x66, 0x00, - 0x8e, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00, - 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf, - 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08, - 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf, - 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x34, 0x34, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01, - 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7, - 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7, - 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08, - 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08, - 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf, - 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7, - 0x00, 0xf0, 0x04, 0x08 - }; /* Structure image */ - - memcpy(g, data, sizeof(data)); /* Initialise the structure */ -} - -static void -imdi_k44_tab( -tabspec *t /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x14, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff - }; /* Structure image */ - - memcpy(t, data, sizeof(data)); /* Initialise the structure */ -} - -/* 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 = 4 - Input channel 0 bits = 8 - Input channel 0 increment = 4 - Input channel 1 bits = 8 - Input channel 1 increment = 4 - Input channel 2 bits = 8 - Input channel 2 increment = 4 - Input channel 3 bits = 8 - Input channel 3 increment = 4 - Input is channel interleaved - Input channels are separate words - Input value extraction is done in input table lookup - - Output channels per pixel = 8 - Output channel 0 bits = 8 - Output channel 0 increment = 8 - Output channel 1 bits = 8 - Output channel 1 increment = 8 - Output channel 2 bits = 8 - Output channel 2 increment = 8 - Output channel 3 bits = 8 - Output channel 3 increment = 8 - Output channel 4 bits = 8 - Output channel 4 increment = 8 - Output channel 5 bits = 8 - Output channel 5 increment = 8 - Output channel 6 bits = 8 - Output channel 6 increment = 8 - Output channel 7 bits = 8 - Output channel 7 increment = 8 - Output is channel interleaved - - Output channels are separate words - Simplex table index bits = 32 - Interpolation table index bits = 32 - Simplex table max resolution = 255 - Interpolation table max resolution = 31 - */ - -/* - 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 <memory.h> -#include "imdi_imp.h" -#define IMDI_INCLUDED -#endif /* IMDI_INCLUDED */ - -#ifndef DEFINED_pointer -#define DEFINED_pointer -typedef unsigned char * pointer; -#endif - -/* Input table interp. index */ -#define IT_IX(p, off) *((unsigned int *)((p) + 4 + (off) * 8)) - -/* Input table simplex index enty */ -#define IT_SX(p, off) *((unsigned int *)((p) + 0 + (off) * 8)) - -/* Simplex weighting table access */ -#define SW_O(off) ((off) * 20) - -/* Simplex table - get weighting value */ -#define SX_WE(p, v) *((unsigned short *)((p) + (v) * 4 + 0)) - -/* Simplex table - get offset value */ -#define SX_VO(p, v) *((unsigned short *)((p) + (v) * 4 + 2)) - -/* Interpolation multi-dim. table access */ -#define IM_O(off) ((off) * 16) - -/* Interpolation table - get vertex values */ -#define IM_FE(p, v, c) *((unsigned int *)((p) + (v) * 8 + (c) * 4)) - -/* Output table indexes */ -#define OT_E(p, off) *((unsigned char *)((p) + (off) * 1)) - -static void -imdi_k45( -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 * 4 ; - pointer it0 = (pointer)p->in_tables[0]; - pointer it1 = (pointer)p->in_tables[1]; - pointer it2 = (pointer)p->in_tables[2]; - pointer it3 = (pointer)p->in_tables[3]; - pointer ot0 = (pointer)p->out_tables[0]; - pointer ot1 = (pointer)p->out_tables[1]; - pointer ot2 = (pointer)p->out_tables[2]; - pointer ot3 = (pointer)p->out_tables[3]; - pointer ot4 = (pointer)p->out_tables[4]; - pointer ot5 = (pointer)p->out_tables[5]; - pointer ot6 = (pointer)p->out_tables[6]; - pointer ot7 = (pointer)p->out_tables[7]; - pointer sw_base = (pointer)p->sw_table; - pointer im_base = (pointer)p->im_table; - - for(;ip0 < ep; ip0 += 4, op0 += 8) { - unsigned int ova0; /* Output value accumulator */ - unsigned int ova1; /* Output value accumulator */ - unsigned int ova2; /* Output value accumulator */ - unsigned int ova3; /* Output value accumulator */ - { - pointer swp; - pointer imp; - { - unsigned int ti_s; /* Simplex index variable */ - unsigned int ti_i; /* Interpolation index variable */ - - ti_i = IT_IX(it0, ip0[0]); - ti_s = IT_SX(it0, ip0[0]); - ti_i += IT_IX(it1, ip0[1]); - ti_s += IT_SX(it1, ip0[1]); - ti_i += IT_IX(it2, ip0[2]); - ti_s += IT_SX(it2, ip0[2]); - ti_i += IT_IX(it3, ip0[3]); - ti_s += IT_SX(it3, ip0[3]); - - swp = sw_base + SW_O(ti_s); /* Compute simplex table entry pointer */ - imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */ - } - { - unsigned int vof; /* Vertex offset value */ - unsigned int vwe; /* Vertex weighting */ - - vof = SX_VO(swp, 0); /* Read vertex offset value */ - vwe = SX_WE(swp, 0); /* Read vertex weighting value */ - ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 = IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - vof = SX_VO(swp, 1); /* Read vertex offset value */ - vwe = SX_WE(swp, 1); /* Read vertex weighting value */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - vof = SX_VO(swp, 2); /* Read vertex offset value */ - vwe = SX_WE(swp, 2); /* Read vertex weighting value */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - vof = SX_VO(swp, 3); /* Read vertex offset value */ - vwe = SX_WE(swp, 3); /* Read vertex weighting value */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - vof = SX_VO(swp, 4); /* Read vertex offset value */ - vwe = SX_WE(swp, 4); /* Read vertex weighting value */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate 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 */ - oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */ - op0[1] = OT_E(ot1, oti); /* Write result */ - oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */ - op0[2] = OT_E(ot2, oti); /* Write result */ - oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */ - op0[3] = OT_E(ot3, oti); /* Write result */ - oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */ - op0[4] = OT_E(ot4, oti); /* Write result */ - oti = ((ova2 >> 24) & 0xff); /* Extract integer part of result */ - op0[5] = OT_E(ot5, oti); /* Write result */ - oti = ((ova3 >> 8) & 0xff); /* Extract integer part of result */ - op0[6] = OT_E(ot6, oti); /* Write result */ - oti = ((ova3 >> 24) & 0xff); /* Extract integer part of result */ - op0[7] = OT_E(ot7, oti); /* Write result */ - } - } -} -#undef IT_IX -#undef IT_SX -#undef SW_O -#undef SX_WE -#undef SX_VO -#undef IM_O -#undef IM_FE -#undef OT_E - -static void -imdi_k45_gen( -genspec *g /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x1f, 0x00, 0x00, 0x00, 0xff, 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, 0x04, 0x08, - 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08, - 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7, - 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7, - 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08, - 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00, - 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7, - 0x2c, 0xf3, 0xdc, 0xb7, 0x34, 0x5f, 0x38, 0x5f, - 0x69, 0x38, 0x5f, 0x69, 0x38, 0x5f, 0x66, 0x00, - 0x8e, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00, - 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf, - 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08, - 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf, - 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x34, 0x35, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01, - 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7, - 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7, - 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08, - 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08, - 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf, - 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7, - 0x00, 0xf0, 0x04, 0x08 - }; /* Structure image */ - - memcpy(g, data, sizeof(data)); /* Initialise the structure */ -} - -static void -imdi_k45_tab( -tabspec *t /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x14, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff - }; /* Structure image */ - - memcpy(t, data, sizeof(data)); /* Initialise the structure */ -} - -/* 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 = 5 - Input channel 0 bits = 8 - Input channel 0 increment = 5 - Input channel 1 bits = 8 - Input channel 1 increment = 5 - Input channel 2 bits = 8 - Input channel 2 increment = 5 - Input channel 3 bits = 8 - Input channel 3 increment = 5 - Input channel 4 bits = 8 - Input channel 4 increment = 5 - Input is channel interleaved - Input channels are separate words - Input value extraction is done in input table lookup - - Output channels per pixel = 8 - Output channel 0 bits = 8 - Output channel 0 increment = 8 - Output channel 1 bits = 8 - Output channel 1 increment = 8 - Output channel 2 bits = 8 - Output channel 2 increment = 8 - Output channel 3 bits = 8 - Output channel 3 increment = 8 - Output channel 4 bits = 8 - Output channel 4 increment = 8 - Output channel 5 bits = 8 - Output channel 5 increment = 8 - Output channel 6 bits = 8 - Output channel 6 increment = 8 - Output channel 7 bits = 8 - Output channel 7 increment = 8 - Output is channel interleaved - - Output channels are separate words - Weight+voffset bits = 32 - Interpolation table index bits = 32 - Interpolation table max resolution = 45 - */ - -/* - 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 <memory.h> -#include "imdi_imp.h" -#define IMDI_INCLUDED -#endif /* IMDI_INCLUDED */ - -#ifndef DEFINED_pointer -#define DEFINED_pointer -typedef unsigned char * pointer; -#endif - -/* Input table interp. index */ -#define IT_IX(p, off) *((unsigned int *)((p) + 0 + (off) * 8)) - -/* Input table input weighting/offset value enty */ -#define IT_WO(p, off) *((unsigned int *)((p) + 4 + (off) * 8)) - -/* Conditional exchange for sorting */ -#define CEX(A, B) if (A < B) { A ^= B; B ^= A; A ^= B; } - -/* Interpolation multi-dim. table access */ -#define IM_O(off) ((off) * 16) - -/* Interpolation table - get vertex values */ -#define IM_FE(p, v, c) *((unsigned int *)((p) + (v) * 8 + (c) * 4)) - -/* Output table indexes */ -#define OT_E(p, off) *((unsigned char *)((p) + (off) * 1)) - -static void -imdi_k46( -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 * 5 ; - pointer it0 = (pointer)p->in_tables[0]; - pointer it1 = (pointer)p->in_tables[1]; - pointer it2 = (pointer)p->in_tables[2]; - pointer it3 = (pointer)p->in_tables[3]; - pointer it4 = (pointer)p->in_tables[4]; - pointer ot0 = (pointer)p->out_tables[0]; - pointer ot1 = (pointer)p->out_tables[1]; - pointer ot2 = (pointer)p->out_tables[2]; - pointer ot3 = (pointer)p->out_tables[3]; - pointer ot4 = (pointer)p->out_tables[4]; - pointer ot5 = (pointer)p->out_tables[5]; - pointer ot6 = (pointer)p->out_tables[6]; - pointer ot7 = (pointer)p->out_tables[7]; - pointer im_base = (pointer)p->im_table; - - for(;ip0 < ep; ip0 += 5, op0 += 8) { - unsigned int ova0; /* Output value accumulator */ - unsigned int ova1; /* Output value accumulator */ - unsigned int ova2; /* Output value accumulator */ - unsigned int ova3; /* Output value accumulator */ - { - pointer imp; - unsigned int wo0; /* Weighting value and vertex offset variable */ - unsigned int wo1; /* Weighting value and vertex offset variable */ - unsigned int wo2; /* Weighting value and vertex offset variable */ - unsigned int wo3; /* Weighting value and vertex offset variable */ - unsigned int wo4; /* Weighting value and vertex offset variable */ - { - unsigned int ti_i; /* Interpolation index variable */ - - ti_i = IT_IX(it0, ip0[0]); - wo0 = IT_WO(it0, ip0[0]); - ti_i += IT_IX(it1, ip0[1]); - wo1 = IT_WO(it1, ip0[1]); - ti_i += IT_IX(it2, ip0[2]); - wo2 = IT_WO(it2, ip0[2]); - ti_i += IT_IX(it3, ip0[3]); - wo3 = IT_WO(it3, ip0[3]); - ti_i += IT_IX(it4, ip0[4]); - wo4 = IT_WO(it4, ip0[4]); - - imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */ - - /* Sort weighting values and vertex offset values */ - CEX(wo0, wo1); - CEX(wo0, wo2); - CEX(wo0, wo3); - CEX(wo0, wo4); - CEX(wo1, wo2); - CEX(wo1, wo3); - CEX(wo1, wo4); - CEX(wo2, wo3); - CEX(wo2, wo4); - CEX(wo3, wo4); - } - { - unsigned int nvof; /* Next vertex offset value */ - unsigned int vof; /* Vertex offset value */ - unsigned int vwe; /* Vertex weighting */ - - vof = 0; /* First vertex offset is 0 */ - nvof = (wo0 & 0x7fffff); /* Extract offset value */ - wo0 = (wo0 >> 23); /* Extract weighting value */ - vwe = 256 - wo0; /* Baricentric weighting */ - ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 = IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo1 & 0x7fffff); /* Extract offset value */ - wo1 = (wo1 >> 23); /* Extract weighting value */ - vwe = wo0 - wo1; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo2 & 0x7fffff); /* Extract offset value */ - wo2 = (wo2 >> 23); /* Extract weighting value */ - vwe = wo1 - wo2; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo3 & 0x7fffff); /* Extract offset value */ - wo3 = (wo3 >> 23); /* Extract weighting value */ - vwe = wo2 - wo3; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo4 & 0x7fffff); /* Extract offset value */ - wo4 = (wo4 >> 23); /* Extract weighting value */ - vwe = wo3 - wo4; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - vwe = wo4; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate 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 */ - oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */ - op0[1] = OT_E(ot1, oti); /* Write result */ - oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */ - op0[2] = OT_E(ot2, oti); /* Write result */ - oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */ - op0[3] = OT_E(ot3, oti); /* Write result */ - oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */ - op0[4] = OT_E(ot4, oti); /* Write result */ - oti = ((ova2 >> 24) & 0xff); /* Extract integer part of result */ - op0[5] = OT_E(ot5, oti); /* Write result */ - oti = ((ova3 >> 8) & 0xff); /* Extract integer part of result */ - op0[6] = OT_E(ot6, oti); /* Write result */ - oti = ((ova3 >> 24) & 0xff); /* Extract integer part of result */ - op0[7] = OT_E(ot7, oti); /* Write result */ - } - } -} -#undef IT_WO -#undef IT_IX -#undef CEX -#undef IM_O -#undef IM_FE -#undef OT_E - -static void -imdi_k46_gen( -genspec *g /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x08, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x2d, 0x00, 0x00, 0x00, 0x00, 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, 0x04, 0x08, - 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08, - 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7, - 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7, - 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08, - 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00, - 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7, - 0x2c, 0xf3, 0xdc, 0xb7, 0x35, 0x5f, 0x38, 0x5f, - 0x69, 0x38, 0x5f, 0x69, 0x38, 0x5f, 0x66, 0x00, - 0x8e, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00, - 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf, - 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08, - 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf, - 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x34, 0x36, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01, - 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7, - 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7, - 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08, - 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08, - 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf, - 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7, - 0x00, 0xf0, 0x04, 0x08 - }; /* Structure image */ - - memcpy(g, data, sizeof(data)); /* Initialise the structure */ -} - -static void -imdi_k46_tab( -tabspec *t /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff - }; /* Structure image */ - - memcpy(t, data, sizeof(data)); /* Initialise the structure */ -} - -/* 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 = 6 - Input channel 0 bits = 8 - Input channel 0 increment = 6 - Input channel 1 bits = 8 - Input channel 1 increment = 6 - Input channel 2 bits = 8 - Input channel 2 increment = 6 - Input channel 3 bits = 8 - Input channel 3 increment = 6 - Input channel 4 bits = 8 - Input channel 4 increment = 6 - Input channel 5 bits = 8 - Input channel 5 increment = 6 - Input is channel interleaved - Input channels are separate words - Input value extraction is done in input table lookup - - Output channels per pixel = 8 - Output channel 0 bits = 8 - Output channel 0 increment = 8 - Output channel 1 bits = 8 - Output channel 1 increment = 8 - Output channel 2 bits = 8 - Output channel 2 increment = 8 - Output channel 3 bits = 8 - Output channel 3 increment = 8 - Output channel 4 bits = 8 - Output channel 4 increment = 8 - Output channel 5 bits = 8 - Output channel 5 increment = 8 - Output channel 6 bits = 8 - Output channel 6 increment = 8 - Output channel 7 bits = 8 - Output channel 7 increment = 8 - Output is channel interleaved - - Output channels are separate words - Weight+voffset bits = 32 - Interpolation table index bits = 32 - Interpolation table max resolution = 20 - */ - -/* - 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 <memory.h> -#include "imdi_imp.h" -#define IMDI_INCLUDED -#endif /* IMDI_INCLUDED */ - -#ifndef DEFINED_pointer -#define DEFINED_pointer -typedef unsigned char * pointer; -#endif - -/* Input table interp. index */ -#define IT_IX(p, off) *((unsigned int *)((p) + 0 + (off) * 8)) - -/* Input table input weighting/offset value enty */ -#define IT_WO(p, off) *((unsigned int *)((p) + 4 + (off) * 8)) - -/* Conditional exchange for sorting */ -#define CEX(A, B) if (A < B) { A ^= B; B ^= A; A ^= B; } - -/* Interpolation multi-dim. table access */ -#define IM_O(off) ((off) * 16) - -/* Interpolation table - get vertex values */ -#define IM_FE(p, v, c) *((unsigned int *)((p) + (v) * 8 + (c) * 4)) - -/* Output table indexes */ -#define OT_E(p, off) *((unsigned char *)((p) + (off) * 1)) - -static void -imdi_k47( -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 * 6 ; - pointer it0 = (pointer)p->in_tables[0]; - pointer it1 = (pointer)p->in_tables[1]; - pointer it2 = (pointer)p->in_tables[2]; - pointer it3 = (pointer)p->in_tables[3]; - pointer it4 = (pointer)p->in_tables[4]; - pointer it5 = (pointer)p->in_tables[5]; - pointer ot0 = (pointer)p->out_tables[0]; - pointer ot1 = (pointer)p->out_tables[1]; - pointer ot2 = (pointer)p->out_tables[2]; - pointer ot3 = (pointer)p->out_tables[3]; - pointer ot4 = (pointer)p->out_tables[4]; - pointer ot5 = (pointer)p->out_tables[5]; - pointer ot6 = (pointer)p->out_tables[6]; - pointer ot7 = (pointer)p->out_tables[7]; - pointer im_base = (pointer)p->im_table; - - for(;ip0 < ep; ip0 += 6, op0 += 8) { - unsigned int ova0; /* Output value accumulator */ - unsigned int ova1; /* Output value accumulator */ - unsigned int ova2; /* Output value accumulator */ - unsigned int ova3; /* Output value accumulator */ - { - pointer imp; - unsigned int wo0; /* Weighting value and vertex offset variable */ - unsigned int wo1; /* Weighting value and vertex offset variable */ - unsigned int wo2; /* Weighting value and vertex offset variable */ - unsigned int wo3; /* Weighting value and vertex offset variable */ - unsigned int wo4; /* Weighting value and vertex offset variable */ - unsigned int wo5; /* Weighting value and vertex offset variable */ - { - unsigned int ti_i; /* Interpolation index variable */ - - ti_i = IT_IX(it0, ip0[0]); - wo0 = IT_WO(it0, ip0[0]); - ti_i += IT_IX(it1, ip0[1]); - wo1 = IT_WO(it1, ip0[1]); - ti_i += IT_IX(it2, ip0[2]); - wo2 = IT_WO(it2, ip0[2]); - ti_i += IT_IX(it3, ip0[3]); - wo3 = IT_WO(it3, ip0[3]); - ti_i += IT_IX(it4, ip0[4]); - wo4 = IT_WO(it4, ip0[4]); - ti_i += IT_IX(it5, ip0[5]); - wo5 = IT_WO(it5, ip0[5]); - - imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */ - - /* Sort weighting values and vertex offset values */ - CEX(wo0, wo1); - CEX(wo0, wo2); - CEX(wo0, wo3); - CEX(wo0, wo4); - CEX(wo0, wo5); - CEX(wo1, wo2); - CEX(wo1, wo3); - CEX(wo1, wo4); - CEX(wo1, wo5); - CEX(wo2, wo3); - CEX(wo2, wo4); - CEX(wo2, wo5); - CEX(wo3, wo4); - CEX(wo3, wo5); - CEX(wo4, wo5); - } - { - unsigned int nvof; /* Next vertex offset value */ - unsigned int vof; /* Vertex offset value */ - unsigned int vwe; /* Vertex weighting */ - - vof = 0; /* First vertex offset is 0 */ - nvof = (wo0 & 0x7fffff); /* Extract offset value */ - wo0 = (wo0 >> 23); /* Extract weighting value */ - vwe = 256 - wo0; /* Baricentric weighting */ - ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 = IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo1 & 0x7fffff); /* Extract offset value */ - wo1 = (wo1 >> 23); /* Extract weighting value */ - vwe = wo0 - wo1; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo2 & 0x7fffff); /* Extract offset value */ - wo2 = (wo2 >> 23); /* Extract weighting value */ - vwe = wo1 - wo2; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo3 & 0x7fffff); /* Extract offset value */ - wo3 = (wo3 >> 23); /* Extract weighting value */ - vwe = wo2 - wo3; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo4 & 0x7fffff); /* Extract offset value */ - wo4 = (wo4 >> 23); /* Extract weighting value */ - vwe = wo3 - wo4; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo5 & 0x7fffff); /* Extract offset value */ - wo5 = (wo5 >> 23); /* Extract weighting value */ - vwe = wo4 - wo5; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - vwe = wo5; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate 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 */ - oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */ - op0[1] = OT_E(ot1, oti); /* Write result */ - oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */ - op0[2] = OT_E(ot2, oti); /* Write result */ - oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */ - op0[3] = OT_E(ot3, oti); /* Write result */ - oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */ - op0[4] = OT_E(ot4, oti); /* Write result */ - oti = ((ova2 >> 24) & 0xff); /* Extract integer part of result */ - op0[5] = OT_E(ot5, oti); /* Write result */ - oti = ((ova3 >> 8) & 0xff); /* Extract integer part of result */ - op0[6] = OT_E(ot6, oti); /* Write result */ - oti = ((ova3 >> 24) & 0xff); /* Extract integer part of result */ - op0[7] = OT_E(ot7, oti); /* Write result */ - } - } -} -#undef IT_WO -#undef IT_IX -#undef CEX -#undef IM_O -#undef IM_FE -#undef OT_E - -static void -imdi_k47_gen( -genspec *g /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x08, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x14, 0x00, 0x00, 0x00, 0x00, 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, 0x04, 0x08, - 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08, - 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7, - 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7, - 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08, - 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00, - 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7, - 0x2c, 0xf3, 0xdc, 0xb7, 0x36, 0x5f, 0x38, 0x5f, - 0x69, 0x38, 0x5f, 0x69, 0x38, 0x5f, 0x66, 0x00, - 0x8e, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00, - 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf, - 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08, - 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf, - 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x34, 0x37, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01, - 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7, - 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7, - 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08, - 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08, - 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf, - 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7, - 0x00, 0xf0, 0x04, 0x08 - }; /* Structure image */ - - memcpy(g, data, sizeof(data)); /* Initialise the structure */ -} - -static void -imdi_k47_tab( -tabspec *t /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff - }; /* Structure image */ - - memcpy(t, data, sizeof(data)); /* Initialise the structure */ -} - -/* 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 = 7 - Input channel 0 bits = 8 - Input channel 0 increment = 7 - Input channel 1 bits = 8 - Input channel 1 increment = 7 - Input channel 2 bits = 8 - Input channel 2 increment = 7 - Input channel 3 bits = 8 - Input channel 3 increment = 7 - Input channel 4 bits = 8 - Input channel 4 increment = 7 - Input channel 5 bits = 8 - Input channel 5 increment = 7 - Input channel 6 bits = 8 - Input channel 6 increment = 7 - Input is channel interleaved - Input channels are separate words - Input value extraction is done in input table lookup - - Output channels per pixel = 8 - Output channel 0 bits = 8 - Output channel 0 increment = 8 - Output channel 1 bits = 8 - Output channel 1 increment = 8 - Output channel 2 bits = 8 - Output channel 2 increment = 8 - Output channel 3 bits = 8 - Output channel 3 increment = 8 - Output channel 4 bits = 8 - Output channel 4 increment = 8 - Output channel 5 bits = 8 - Output channel 5 increment = 8 - Output channel 6 bits = 8 - Output channel 6 increment = 8 - Output channel 7 bits = 8 - Output channel 7 increment = 8 - Output is channel interleaved - - Output channels are separate words - Weight+voffset bits = 32 - Interpolation table index bits = 32 - Interpolation table max resolution = 12 - */ - -/* - 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 <memory.h> -#include "imdi_imp.h" -#define IMDI_INCLUDED -#endif /* IMDI_INCLUDED */ - -#ifndef DEFINED_pointer -#define DEFINED_pointer -typedef unsigned char * pointer; -#endif - -/* Input table interp. index */ -#define IT_IX(p, off) *((unsigned int *)((p) + 0 + (off) * 8)) - -/* Input table input weighting/offset value enty */ -#define IT_WO(p, off) *((unsigned int *)((p) + 4 + (off) * 8)) - -/* Conditional exchange for sorting */ -#define CEX(A, B) if (A < B) { A ^= B; B ^= A; A ^= B; } - -/* Interpolation multi-dim. table access */ -#define IM_O(off) ((off) * 16) - -/* Interpolation table - get vertex values */ -#define IM_FE(p, v, c) *((unsigned int *)((p) + (v) * 8 + (c) * 4)) - -/* Output table indexes */ -#define OT_E(p, off) *((unsigned char *)((p) + (off) * 1)) - -static void -imdi_k48( -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 * 7 ; - pointer it0 = (pointer)p->in_tables[0]; - pointer it1 = (pointer)p->in_tables[1]; - pointer it2 = (pointer)p->in_tables[2]; - pointer it3 = (pointer)p->in_tables[3]; - pointer it4 = (pointer)p->in_tables[4]; - pointer it5 = (pointer)p->in_tables[5]; - pointer it6 = (pointer)p->in_tables[6]; - pointer ot0 = (pointer)p->out_tables[0]; - pointer ot1 = (pointer)p->out_tables[1]; - pointer ot2 = (pointer)p->out_tables[2]; - pointer ot3 = (pointer)p->out_tables[3]; - pointer ot4 = (pointer)p->out_tables[4]; - pointer ot5 = (pointer)p->out_tables[5]; - pointer ot6 = (pointer)p->out_tables[6]; - pointer ot7 = (pointer)p->out_tables[7]; - pointer im_base = (pointer)p->im_table; - - for(;ip0 < ep; ip0 += 7, op0 += 8) { - unsigned int ova0; /* Output value accumulator */ - unsigned int ova1; /* Output value accumulator */ - unsigned int ova2; /* Output value accumulator */ - unsigned int ova3; /* Output value accumulator */ - { - pointer imp; - unsigned int wo0; /* Weighting value and vertex offset variable */ - unsigned int wo1; /* Weighting value and vertex offset variable */ - unsigned int wo2; /* Weighting value and vertex offset variable */ - unsigned int wo3; /* Weighting value and vertex offset variable */ - unsigned int wo4; /* Weighting value and vertex offset variable */ - unsigned int wo5; /* Weighting value and vertex offset variable */ - unsigned int wo6; /* Weighting value and vertex offset variable */ - { - unsigned int ti_i; /* Interpolation index variable */ - - ti_i = IT_IX(it0, ip0[0]); - wo0 = IT_WO(it0, ip0[0]); - ti_i += IT_IX(it1, ip0[1]); - wo1 = IT_WO(it1, ip0[1]); - ti_i += IT_IX(it2, ip0[2]); - wo2 = IT_WO(it2, ip0[2]); - ti_i += IT_IX(it3, ip0[3]); - wo3 = IT_WO(it3, ip0[3]); - ti_i += IT_IX(it4, ip0[4]); - wo4 = IT_WO(it4, ip0[4]); - ti_i += IT_IX(it5, ip0[5]); - wo5 = IT_WO(it5, ip0[5]); - ti_i += IT_IX(it6, ip0[6]); - wo6 = IT_WO(it6, ip0[6]); - - imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */ - - /* Sort weighting values and vertex offset values */ - CEX(wo0, wo1); - CEX(wo0, wo2); - CEX(wo0, wo3); - CEX(wo0, wo4); - CEX(wo0, wo5); - CEX(wo0, wo6); - CEX(wo1, wo2); - CEX(wo1, wo3); - CEX(wo1, wo4); - CEX(wo1, wo5); - CEX(wo1, wo6); - CEX(wo2, wo3); - CEX(wo2, wo4); - CEX(wo2, wo5); - CEX(wo2, wo6); - CEX(wo3, wo4); - CEX(wo3, wo5); - CEX(wo3, wo6); - CEX(wo4, wo5); - CEX(wo4, wo6); - CEX(wo5, wo6); - } - { - unsigned int nvof; /* Next vertex offset value */ - unsigned int vof; /* Vertex offset value */ - unsigned int vwe; /* Vertex weighting */ - - vof = 0; /* First vertex offset is 0 */ - nvof = (wo0 & 0x7fffff); /* Extract offset value */ - wo0 = (wo0 >> 23); /* Extract weighting value */ - vwe = 256 - wo0; /* Baricentric weighting */ - ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 = IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo1 & 0x7fffff); /* Extract offset value */ - wo1 = (wo1 >> 23); /* Extract weighting value */ - vwe = wo0 - wo1; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo2 & 0x7fffff); /* Extract offset value */ - wo2 = (wo2 >> 23); /* Extract weighting value */ - vwe = wo1 - wo2; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo3 & 0x7fffff); /* Extract offset value */ - wo3 = (wo3 >> 23); /* Extract weighting value */ - vwe = wo2 - wo3; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo4 & 0x7fffff); /* Extract offset value */ - wo4 = (wo4 >> 23); /* Extract weighting value */ - vwe = wo3 - wo4; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo5 & 0x7fffff); /* Extract offset value */ - wo5 = (wo5 >> 23); /* Extract weighting value */ - vwe = wo4 - wo5; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo6 & 0x7fffff); /* Extract offset value */ - wo6 = (wo6 >> 23); /* Extract weighting value */ - vwe = wo5 - wo6; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - vwe = wo6; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate 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 */ - oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */ - op0[1] = OT_E(ot1, oti); /* Write result */ - oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */ - op0[2] = OT_E(ot2, oti); /* Write result */ - oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */ - op0[3] = OT_E(ot3, oti); /* Write result */ - oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */ - op0[4] = OT_E(ot4, oti); /* Write result */ - oti = ((ova2 >> 24) & 0xff); /* Extract integer part of result */ - op0[5] = OT_E(ot5, oti); /* Write result */ - oti = ((ova3 >> 8) & 0xff); /* Extract integer part of result */ - op0[6] = OT_E(ot6, oti); /* Write result */ - oti = ((ova3 >> 24) & 0xff); /* Extract integer part of result */ - op0[7] = OT_E(ot7, oti); /* Write result */ - } - } -} -#undef IT_WO -#undef IT_IX -#undef CEX -#undef IM_O -#undef IM_FE -#undef OT_E - -static void -imdi_k48_gen( -genspec *g /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x0c, 0x00, 0x00, 0x00, 0x00, 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, 0x04, 0x08, - 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08, - 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7, - 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7, - 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08, - 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00, - 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7, - 0x2c, 0xf3, 0xdc, 0xb7, 0x37, 0x5f, 0x38, 0x5f, - 0x69, 0x38, 0x5f, 0x69, 0x38, 0x5f, 0x66, 0x00, - 0x8e, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00, - 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf, - 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08, - 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf, - 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x34, 0x38, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01, - 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7, - 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7, - 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08, - 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08, - 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf, - 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7, - 0x00, 0xf0, 0x04, 0x08 - }; /* Structure image */ - - memcpy(g, data, sizeof(data)); /* Initialise the structure */ -} - -static void -imdi_k48_tab( -tabspec *t /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff - }; /* Structure image */ - - memcpy(t, data, sizeof(data)); /* Initialise the structure */ -} - -/* 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 = 8 - Input channel 0 bits = 8 - Input channel 0 increment = 8 - Input channel 1 bits = 8 - Input channel 1 increment = 8 - Input channel 2 bits = 8 - Input channel 2 increment = 8 - Input channel 3 bits = 8 - Input channel 3 increment = 8 - Input channel 4 bits = 8 - Input channel 4 increment = 8 - Input channel 5 bits = 8 - Input channel 5 increment = 8 - Input channel 6 bits = 8 - Input channel 6 increment = 8 - Input channel 7 bits = 8 - Input channel 7 increment = 8 - Input is channel interleaved - Input channels are separate words - Input value extraction is done in input table lookup - - Output channels per pixel = 8 - Output channel 0 bits = 8 - Output channel 0 increment = 8 - Output channel 1 bits = 8 - Output channel 1 increment = 8 - Output channel 2 bits = 8 - Output channel 2 increment = 8 - Output channel 3 bits = 8 - Output channel 3 increment = 8 - Output channel 4 bits = 8 - Output channel 4 increment = 8 - Output channel 5 bits = 8 - Output channel 5 increment = 8 - Output channel 6 bits = 8 - Output channel 6 increment = 8 - Output channel 7 bits = 8 - Output channel 7 increment = 8 - Output is channel interleaved - - Output channels are separate words - Weight+voffset bits = 32 - Interpolation table index bits = 32 - Interpolation table max resolution = 8 - */ - -/* - 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 <memory.h> -#include "imdi_imp.h" -#define IMDI_INCLUDED -#endif /* IMDI_INCLUDED */ - -#ifndef DEFINED_pointer -#define DEFINED_pointer -typedef unsigned char * pointer; -#endif - -/* Input table interp. index */ -#define IT_IX(p, off) *((unsigned int *)((p) + 0 + (off) * 8)) - -/* Input table input weighting/offset value enty */ -#define IT_WO(p, off) *((unsigned int *)((p) + 4 + (off) * 8)) - -/* Conditional exchange for sorting */ -#define CEX(A, B) if (A < B) { A ^= B; B ^= A; A ^= B; } - -/* Interpolation multi-dim. table access */ -#define IM_O(off) ((off) * 16) - -/* Interpolation table - get vertex values */ -#define IM_FE(p, v, c) *((unsigned int *)((p) + (v) * 8 + (c) * 4)) - -/* Output table indexes */ -#define OT_E(p, off) *((unsigned char *)((p) + (off) * 1)) - -static void -imdi_k49( -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 * 8 ; - pointer it0 = (pointer)p->in_tables[0]; - pointer it1 = (pointer)p->in_tables[1]; - pointer it2 = (pointer)p->in_tables[2]; - pointer it3 = (pointer)p->in_tables[3]; - pointer it4 = (pointer)p->in_tables[4]; - pointer it5 = (pointer)p->in_tables[5]; - pointer it6 = (pointer)p->in_tables[6]; - pointer it7 = (pointer)p->in_tables[7]; - pointer ot0 = (pointer)p->out_tables[0]; - pointer ot1 = (pointer)p->out_tables[1]; - pointer ot2 = (pointer)p->out_tables[2]; - pointer ot3 = (pointer)p->out_tables[3]; - pointer ot4 = (pointer)p->out_tables[4]; - pointer ot5 = (pointer)p->out_tables[5]; - pointer ot6 = (pointer)p->out_tables[6]; - pointer ot7 = (pointer)p->out_tables[7]; - pointer im_base = (pointer)p->im_table; - - for(;ip0 < ep; ip0 += 8, op0 += 8) { - unsigned int ova0; /* Output value accumulator */ - unsigned int ova1; /* Output value accumulator */ - unsigned int ova2; /* Output value accumulator */ - unsigned int ova3; /* Output value accumulator */ - { - pointer imp; - unsigned int wo0; /* Weighting value and vertex offset variable */ - unsigned int wo1; /* Weighting value and vertex offset variable */ - unsigned int wo2; /* Weighting value and vertex offset variable */ - unsigned int wo3; /* Weighting value and vertex offset variable */ - unsigned int wo4; /* Weighting value and vertex offset variable */ - unsigned int wo5; /* Weighting value and vertex offset variable */ - unsigned int wo6; /* Weighting value and vertex offset variable */ - unsigned int wo7; /* Weighting value and vertex offset variable */ - { - unsigned int ti_i; /* Interpolation index variable */ - - ti_i = IT_IX(it0, ip0[0]); - wo0 = IT_WO(it0, ip0[0]); - ti_i += IT_IX(it1, ip0[1]); - wo1 = IT_WO(it1, ip0[1]); - ti_i += IT_IX(it2, ip0[2]); - wo2 = IT_WO(it2, ip0[2]); - ti_i += IT_IX(it3, ip0[3]); - wo3 = IT_WO(it3, ip0[3]); - ti_i += IT_IX(it4, ip0[4]); - wo4 = IT_WO(it4, ip0[4]); - ti_i += IT_IX(it5, ip0[5]); - wo5 = IT_WO(it5, ip0[5]); - ti_i += IT_IX(it6, ip0[6]); - wo6 = IT_WO(it6, ip0[6]); - ti_i += IT_IX(it7, ip0[7]); - wo7 = IT_WO(it7, ip0[7]); - - imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */ - - /* Sort weighting values and vertex offset values */ - CEX(wo0, wo1); - CEX(wo0, wo2); - CEX(wo0, wo3); - CEX(wo0, wo4); - CEX(wo0, wo5); - CEX(wo0, wo6); - CEX(wo0, wo7); - CEX(wo1, wo2); - CEX(wo1, wo3); - CEX(wo1, wo4); - CEX(wo1, wo5); - CEX(wo1, wo6); - CEX(wo1, wo7); - CEX(wo2, wo3); - CEX(wo2, wo4); - CEX(wo2, wo5); - CEX(wo2, wo6); - CEX(wo2, wo7); - CEX(wo3, wo4); - CEX(wo3, wo5); - CEX(wo3, wo6); - CEX(wo3, wo7); - CEX(wo4, wo5); - CEX(wo4, wo6); - CEX(wo4, wo7); - CEX(wo5, wo6); - CEX(wo5, wo7); - CEX(wo6, wo7); - } - { - unsigned int nvof; /* Next vertex offset value */ - unsigned int vof; /* Vertex offset value */ - unsigned int vwe; /* Vertex weighting */ - - vof = 0; /* First vertex offset is 0 */ - nvof = (wo0 & 0x7fffff); /* Extract offset value */ - wo0 = (wo0 >> 23); /* Extract weighting value */ - vwe = 256 - wo0; /* Baricentric weighting */ - ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 = IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo1 & 0x7fffff); /* Extract offset value */ - wo1 = (wo1 >> 23); /* Extract weighting value */ - vwe = wo0 - wo1; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo2 & 0x7fffff); /* Extract offset value */ - wo2 = (wo2 >> 23); /* Extract weighting value */ - vwe = wo1 - wo2; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo3 & 0x7fffff); /* Extract offset value */ - wo3 = (wo3 >> 23); /* Extract weighting value */ - vwe = wo2 - wo3; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo4 & 0x7fffff); /* Extract offset value */ - wo4 = (wo4 >> 23); /* Extract weighting value */ - vwe = wo3 - wo4; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo5 & 0x7fffff); /* Extract offset value */ - wo5 = (wo5 >> 23); /* Extract weighting value */ - vwe = wo4 - wo5; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo6 & 0x7fffff); /* Extract offset value */ - wo6 = (wo6 >> 23); /* Extract weighting value */ - vwe = wo5 - wo6; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo7 & 0x7fffff); /* Extract offset value */ - wo7 = (wo7 >> 23); /* Extract weighting value */ - vwe = wo6 - wo7; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - vwe = wo7; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate 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 */ - oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */ - op0[1] = OT_E(ot1, oti); /* Write result */ - oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */ - op0[2] = OT_E(ot2, oti); /* Write result */ - oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */ - op0[3] = OT_E(ot3, oti); /* Write result */ - oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */ - op0[4] = OT_E(ot4, oti); /* Write result */ - oti = ((ova2 >> 24) & 0xff); /* Extract integer part of result */ - op0[5] = OT_E(ot5, oti); /* Write result */ - oti = ((ova3 >> 8) & 0xff); /* Extract integer part of result */ - op0[6] = OT_E(ot6, oti); /* Write result */ - oti = ((ova3 >> 24) & 0xff); /* Extract integer part of result */ - op0[7] = OT_E(ot7, oti); /* Write result */ - } - } -} -#undef IT_WO -#undef IT_IX -#undef CEX -#undef IM_O -#undef IM_FE -#undef OT_E - -static void -imdi_k49_gen( -genspec *g /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 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, 0x04, 0x08, - 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08, - 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7, - 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7, - 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08, - 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00, - 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7, - 0x2c, 0xf3, 0xdc, 0xb7, 0x38, 0x5f, 0x38, 0x5f, - 0x69, 0x38, 0x5f, 0x69, 0x38, 0x5f, 0x66, 0x00, - 0x8e, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00, - 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf, - 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08, - 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf, - 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x34, 0x39, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01, - 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7, - 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7, - 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08, - 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08, - 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf, - 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7, - 0x00, 0xf0, 0x04, 0x08 - }; /* Structure image */ - - memcpy(g, data, sizeof(data)); /* Initialise the structure */ -} - -static void -imdi_k49_tab( -tabspec *t /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff - }; /* Structure image */ - - memcpy(t, data, sizeof(data)); /* Initialise the structure */ -} - -/* 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 = 16 - 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 = 255 - */ - -/* - 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 <memory.h> -#include "imdi_imp.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 short *)((p) + (off) * 2)) - -static void -imdi_k50( -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 short *op0 = (unsigned short *)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 - -static void -imdi_k50_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, - 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0xff, 0x00, 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, 0x04, 0x08, - 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08, - 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7, - 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7, - 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08, - 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00, - 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7, - 0x2c, 0xf3, 0xdc, 0xb7, 0x31, 0x5f, 0x31, 0x5f, - 0x69, 0x38, 0x5f, 0x69, 0x31, 0x36, 0x5f, 0x66, - 0x00, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00, - 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf, - 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08, - 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf, - 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x35, 0x30, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01, - 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7, - 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7, - 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08, - 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08, - 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf, - 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7, - 0x00, 0xf0, 0x04, 0x08 - }; /* Structure image */ - - memcpy(g, data, sizeof(data)); /* Initialise the structure */ -} - -static void -imdi_k50_tab( -tabspec *t /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0xa1, 0xd4, 0xe2, 0xb7, - 0xf4, 0xd5, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0xff, 0xff, 0xff, 0x31, 0x00, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xa0, 0xd6, 0x83, 0xbf, 0x8b, 0x22, 0xe2, 0xb7, - 0xf4, 0xd5, 0x83, 0xbf, 0x52, 0xca, 0x04, 0x08, - 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0x21, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff, - 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff - }; /* Structure image */ - - memcpy(t, data, sizeof(data)); /* Initialise the structure */ -} - -/* 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 = 3 - Input channel 0 bits = 8 - Input channel 0 increment = 3 - Input channel 1 bits = 8 - Input channel 1 increment = 3 - Input channel 2 bits = 8 - Input channel 2 increment = 3 - 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 = 16 - Output channel 0 increment = 1 - Output is channel interleaved - - Output channels are separate words - Simplex table index bits = 12 - Interpolation table index bits = 20 - Simplex table max resolution = 16 - Interpolation table max resolution = 101 - */ - -/* - 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 <memory.h> -#include "imdi_imp.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 int *)((p) + 0 + (off) * 4)) - -/* Simplex weighting table access */ -#define SW_O(off) ((off) * 16) - -/* Simplex table - get weighting value */ -#define SX_WE(p, v) *((unsigned short *)((p) + (v) * 4 + 0)) - -/* Simplex table - get offset value */ -#define SX_VO(p, v) *((unsigned short *)((p) + (v) * 4 + 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 short *)((p) + (off) * 2)) - -static void -imdi_k51( -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 short *op0 = (unsigned short *)outp[0]; - unsigned char *ep = ip0 + npix * 3 ; - pointer it0 = (pointer)p->in_tables[0]; - pointer it1 = (pointer)p->in_tables[1]; - pointer it2 = (pointer)p->in_tables[2]; - 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 += 3, 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]); - ti += IT_IT(it1, ip0[1]); - ti += IT_IT(it2, ip0[2]); - - imp = im_base + IM_O(ti >> 12); /* Extract interp. index and comp. entry */ - swp = sw_base + SW_O(ti & 0xfff); /* Extract simplex index and comp. entry */ - } - { - unsigned int vof; /* Vertex offset value */ - unsigned int vwe; /* Vertex weighting */ - - vof = SX_VO(swp, 0); /* Read vertex offset value */ - vwe = SX_WE(swp, 0); /* Read vertex weighting value */ - ova0 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof = SX_VO(swp, 1); /* Read vertex offset value */ - vwe = SX_WE(swp, 1); /* Read vertex weighting value */ - ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof = SX_VO(swp, 2); /* Read vertex offset value */ - vwe = SX_WE(swp, 2); /* Read vertex weighting value */ - ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof = SX_VO(swp, 3); /* Read vertex offset value */ - vwe = SX_WE(swp, 3); /* Read vertex 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_WE -#undef SX_VO -#undef IM_O -#undef IM_PE -#undef OT_E - -static void -imdi_k51_gen( -genspec *g /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x08, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x65, 0x00, 0x00, 0x00, 0x10, 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, 0x04, 0x08, - 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08, - 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7, - 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7, - 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08, - 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00, - 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7, - 0x2c, 0xf3, 0xdc, 0xb7, 0x33, 0x5f, 0x31, 0x5f, - 0x69, 0x38, 0x5f, 0x69, 0x31, 0x36, 0x5f, 0x66, - 0x00, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00, - 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf, - 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08, - 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf, - 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x35, 0x31, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01, - 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7, - 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7, - 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08, - 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08, - 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf, - 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7, - 0x00, 0xf0, 0x04, 0x08 - }; /* Structure image */ - - memcpy(g, data, sizeof(data)); /* Initialise the structure */ -} - -static void -imdi_k51_tab( -tabspec *t /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x14, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0xa1, 0xd4, 0xe2, 0xb7, - 0xf4, 0xd5, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0xff, 0xff, 0xff, 0x31, 0x00, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xa0, 0xd6, 0x83, 0xbf, 0x8b, 0x22, 0xe2, 0xb7, - 0xf4, 0xd5, 0x83, 0xbf, 0x52, 0xca, 0x04, 0x08, - 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0x21, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff, - 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff - }; /* Structure image */ - - memcpy(t, data, sizeof(data)); /* Initialise the structure */ -} - -/* 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 = 4 - Input channel 0 bits = 8 - Input channel 0 increment = 4 - Input channel 1 bits = 8 - Input channel 1 increment = 4 - Input channel 2 bits = 8 - Input channel 2 increment = 4 - Input channel 3 bits = 8 - Input channel 3 increment = 4 - 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 = 16 - Output channel 0 increment = 1 - Output is channel interleaved - - Output channels are separate words - Simplex table index bits = 32 - Interpolation table index bits = 32 - Simplex table max resolution = 255 - Interpolation table max resolution = 39 - */ - -/* - 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 <memory.h> -#include "imdi_imp.h" -#define IMDI_INCLUDED -#endif /* IMDI_INCLUDED */ - -#ifndef DEFINED_pointer -#define DEFINED_pointer -typedef unsigned char * pointer; -#endif - -/* Input table interp. index */ -#define IT_IX(p, off) *((unsigned int *)((p) + 4 + (off) * 8)) - -/* Input table simplex index enty */ -#define IT_SX(p, off) *((unsigned int *)((p) + 0 + (off) * 8)) - -/* Simplex weighting table access */ -#define SW_O(off) ((off) * 20) - -/* Simplex table - get weighting value */ -#define SX_WE(p, v) *((unsigned short *)((p) + (v) * 4 + 0)) - -/* Simplex table - get offset value */ -#define SX_VO(p, v) *((unsigned short *)((p) + (v) * 4 + 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 short *)((p) + (off) * 2)) - -static void -imdi_k52( -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 short *op0 = (unsigned short *)outp[0]; - unsigned char *ep = ip0 + npix * 4 ; - pointer it0 = (pointer)p->in_tables[0]; - pointer it1 = (pointer)p->in_tables[1]; - pointer it2 = (pointer)p->in_tables[2]; - pointer it3 = (pointer)p->in_tables[3]; - 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 += 4, op0 += 1) { - unsigned int ova0; /* Output value partial accumulator */ - { - pointer swp; - pointer imp; - { - unsigned int ti_s; /* Simplex index variable */ - unsigned int ti_i; /* Interpolation index variable */ - - ti_i = IT_IX(it0, ip0[0]); - ti_s = IT_SX(it0, ip0[0]); - ti_i += IT_IX(it1, ip0[1]); - ti_s += IT_SX(it1, ip0[1]); - ti_i += IT_IX(it2, ip0[2]); - ti_s += IT_SX(it2, ip0[2]); - ti_i += IT_IX(it3, ip0[3]); - ti_s += IT_SX(it3, ip0[3]); - - swp = sw_base + SW_O(ti_s); /* Compute simplex table entry pointer */ - imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */ - } - { - unsigned int vof; /* Vertex offset value */ - unsigned int vwe; /* Vertex weighting */ - - vof = SX_VO(swp, 0); /* Read vertex offset value */ - vwe = SX_WE(swp, 0); /* Read vertex weighting value */ - ova0 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof = SX_VO(swp, 1); /* Read vertex offset value */ - vwe = SX_WE(swp, 1); /* Read vertex weighting value */ - ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof = SX_VO(swp, 2); /* Read vertex offset value */ - vwe = SX_WE(swp, 2); /* Read vertex weighting value */ - ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof = SX_VO(swp, 3); /* Read vertex offset value */ - vwe = SX_WE(swp, 3); /* Read vertex weighting value */ - ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof = SX_VO(swp, 4); /* Read vertex offset value */ - vwe = SX_WE(swp, 4); /* Read vertex 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_IX -#undef IT_SX -#undef SW_O -#undef SX_WE -#undef SX_VO -#undef IM_O -#undef IM_PE -#undef OT_E - -static void -imdi_k52_gen( -genspec *g /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x27, 0x00, 0x00, 0x00, 0xff, 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, 0x04, 0x08, - 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08, - 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7, - 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7, - 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08, - 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00, - 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7, - 0x2c, 0xf3, 0xdc, 0xb7, 0x34, 0x5f, 0x31, 0x5f, - 0x69, 0x38, 0x5f, 0x69, 0x31, 0x36, 0x5f, 0x66, - 0x00, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00, - 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf, - 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08, - 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf, - 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x35, 0x32, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01, - 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7, - 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7, - 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08, - 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08, - 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf, - 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7, - 0x00, 0xf0, 0x04, 0x08 - }; /* Structure image */ - - memcpy(g, data, sizeof(data)); /* Initialise the structure */ -} - -static void -imdi_k52_tab( -tabspec *t /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x14, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0xa1, 0xd4, 0xe2, 0xb7, - 0xf4, 0xd5, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0xff, 0xff, 0xff, 0x31, 0x00, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xa0, 0xd6, 0x83, 0xbf, 0x8b, 0x22, 0xe2, 0xb7, - 0xf4, 0xd5, 0x83, 0xbf, 0x52, 0xca, 0x04, 0x08, - 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0x21, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff, - 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff - }; /* Structure image */ - - memcpy(t, data, sizeof(data)); /* Initialise the structure */ -} - -/* 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 = 5 - Input channel 0 bits = 8 - Input channel 0 increment = 5 - Input channel 1 bits = 8 - Input channel 1 increment = 5 - Input channel 2 bits = 8 - Input channel 2 increment = 5 - Input channel 3 bits = 8 - Input channel 3 increment = 5 - Input channel 4 bits = 8 - Input channel 4 increment = 5 - 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 = 16 - Output channel 0 increment = 1 - Output is channel interleaved - - Output channels are separate words - Weight+voffset bits = 32 - Interpolation table index bits = 32 - Interpolation table max resolution = 53 - */ - -/* - 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 <memory.h> -#include "imdi_imp.h" -#define IMDI_INCLUDED -#endif /* IMDI_INCLUDED */ - -#ifndef DEFINED_pointer -#define DEFINED_pointer -typedef unsigned char * pointer; -#endif - -/* Input table interp. index */ -#define IT_IX(p, off) *((unsigned int *)((p) + 0 + (off) * 8)) - -/* Input table input weighting/offset value enty */ -#define IT_WO(p, off) *((unsigned int *)((p) + 4 + (off) * 8)) - -/* Conditional exchange for sorting */ -#define CEX(A, B) if (A < B) { A ^= B; B ^= A; A ^= B; } - -/* 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 short *)((p) + (off) * 2)) - -static void -imdi_k53( -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 short *op0 = (unsigned short *)outp[0]; - unsigned char *ep = ip0 + npix * 5 ; - pointer it0 = (pointer)p->in_tables[0]; - pointer it1 = (pointer)p->in_tables[1]; - pointer it2 = (pointer)p->in_tables[2]; - pointer it3 = (pointer)p->in_tables[3]; - pointer it4 = (pointer)p->in_tables[4]; - pointer ot0 = (pointer)p->out_tables[0]; - pointer im_base = (pointer)p->im_table; - - for(;ip0 < ep; ip0 += 5, op0 += 1) { - unsigned int ova0; /* Output value partial accumulator */ - { - pointer imp; - unsigned int wo0; /* Weighting value and vertex offset variable */ - unsigned int wo1; /* Weighting value and vertex offset variable */ - unsigned int wo2; /* Weighting value and vertex offset variable */ - unsigned int wo3; /* Weighting value and vertex offset variable */ - unsigned int wo4; /* Weighting value and vertex offset variable */ - { - unsigned int ti_i; /* Interpolation index variable */ - - ti_i = IT_IX(it0, ip0[0]); - wo0 = IT_WO(it0, ip0[0]); - ti_i += IT_IX(it1, ip0[1]); - wo1 = IT_WO(it1, ip0[1]); - ti_i += IT_IX(it2, ip0[2]); - wo2 = IT_WO(it2, ip0[2]); - ti_i += IT_IX(it3, ip0[3]); - wo3 = IT_WO(it3, ip0[3]); - ti_i += IT_IX(it4, ip0[4]); - wo4 = IT_WO(it4, ip0[4]); - - imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */ - - /* Sort weighting values and vertex offset values */ - CEX(wo0, wo1); - CEX(wo0, wo2); - CEX(wo0, wo3); - CEX(wo0, wo4); - CEX(wo1, wo2); - CEX(wo1, wo3); - CEX(wo1, wo4); - CEX(wo2, wo3); - CEX(wo2, wo4); - CEX(wo3, wo4); - } - { - unsigned int nvof; /* Next vertex offset value */ - unsigned int vof; /* Vertex offset value */ - unsigned int vwe; /* Vertex weighting */ - - vof = 0; /* First vertex offset is 0 */ - nvof = (wo0 & 0x7fffff); /* Extract offset value */ - wo0 = (wo0 >> 23); /* Extract weighting value */ - vwe = 256 - wo0; /* Baricentric weighting */ - ova0 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo1 & 0x7fffff); /* Extract offset value */ - wo1 = (wo1 >> 23); /* Extract weighting value */ - vwe = wo0 - wo1; /* Baricentric weighting */ - ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo2 & 0x7fffff); /* Extract offset value */ - wo2 = (wo2 >> 23); /* Extract weighting value */ - vwe = wo1 - wo2; /* Baricentric weighting */ - ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo3 & 0x7fffff); /* Extract offset value */ - wo3 = (wo3 >> 23); /* Extract weighting value */ - vwe = wo2 - wo3; /* Baricentric weighting */ - ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo4 & 0x7fffff); /* Extract offset value */ - wo4 = (wo4 >> 23); /* Extract weighting value */ - vwe = wo3 - wo4; /* Baricentric weighting */ - ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - vwe = wo4; /* Baricentric weighting */ - 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_WO -#undef IT_IX -#undef CEX -#undef IM_O -#undef IM_PE -#undef OT_E - -static void -imdi_k53_gen( -genspec *g /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x08, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x35, 0x00, 0x00, 0x00, 0x00, 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, 0x04, 0x08, - 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08, - 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7, - 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7, - 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08, - 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00, - 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7, - 0x2c, 0xf3, 0xdc, 0xb7, 0x35, 0x5f, 0x31, 0x5f, - 0x69, 0x38, 0x5f, 0x69, 0x31, 0x36, 0x5f, 0x66, - 0x00, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00, - 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf, - 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08, - 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf, - 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x35, 0x33, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01, - 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7, - 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7, - 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08, - 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08, - 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf, - 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7, - 0x00, 0xf0, 0x04, 0x08 - }; /* Structure image */ - - memcpy(g, data, sizeof(data)); /* Initialise the structure */ -} - -static void -imdi_k53_tab( -tabspec *t /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0xa1, 0xd4, 0xe2, 0xb7, - 0xf4, 0xd5, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0xff, 0xff, 0xff, 0x31, 0x00, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xa0, 0xd6, 0x83, 0xbf, 0x8b, 0x22, 0xe2, 0xb7, - 0xf4, 0xd5, 0x83, 0xbf, 0x52, 0xca, 0x04, 0x08, - 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0x21, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff, - 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff - }; /* Structure image */ - - memcpy(t, data, sizeof(data)); /* Initialise the structure */ -} - -/* 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 = 6 - Input channel 0 bits = 8 - Input channel 0 increment = 6 - Input channel 1 bits = 8 - Input channel 1 increment = 6 - Input channel 2 bits = 8 - Input channel 2 increment = 6 - Input channel 3 bits = 8 - Input channel 3 increment = 6 - Input channel 4 bits = 8 - Input channel 4 increment = 6 - Input channel 5 bits = 8 - Input channel 5 increment = 6 - 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 = 16 - Output channel 0 increment = 1 - Output is channel interleaved - - Output channels are separate words - Weight+voffset bits = 32 - Interpolation table index bits = 32 - Interpolation table max resolution = 24 - */ - -/* - 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 <memory.h> -#include "imdi_imp.h" -#define IMDI_INCLUDED -#endif /* IMDI_INCLUDED */ - -#ifndef DEFINED_pointer -#define DEFINED_pointer -typedef unsigned char * pointer; -#endif - -/* Input table interp. index */ -#define IT_IX(p, off) *((unsigned int *)((p) + 0 + (off) * 8)) - -/* Input table input weighting/offset value enty */ -#define IT_WO(p, off) *((unsigned int *)((p) + 4 + (off) * 8)) - -/* Conditional exchange for sorting */ -#define CEX(A, B) if (A < B) { A ^= B; B ^= A; A ^= B; } - -/* 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 short *)((p) + (off) * 2)) - -static void -imdi_k54( -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 short *op0 = (unsigned short *)outp[0]; - unsigned char *ep = ip0 + npix * 6 ; - pointer it0 = (pointer)p->in_tables[0]; - pointer it1 = (pointer)p->in_tables[1]; - pointer it2 = (pointer)p->in_tables[2]; - pointer it3 = (pointer)p->in_tables[3]; - pointer it4 = (pointer)p->in_tables[4]; - pointer it5 = (pointer)p->in_tables[5]; - pointer ot0 = (pointer)p->out_tables[0]; - pointer im_base = (pointer)p->im_table; - - for(;ip0 < ep; ip0 += 6, op0 += 1) { - unsigned int ova0; /* Output value partial accumulator */ - { - pointer imp; - unsigned int wo0; /* Weighting value and vertex offset variable */ - unsigned int wo1; /* Weighting value and vertex offset variable */ - unsigned int wo2; /* Weighting value and vertex offset variable */ - unsigned int wo3; /* Weighting value and vertex offset variable */ - unsigned int wo4; /* Weighting value and vertex offset variable */ - unsigned int wo5; /* Weighting value and vertex offset variable */ - { - unsigned int ti_i; /* Interpolation index variable */ - - ti_i = IT_IX(it0, ip0[0]); - wo0 = IT_WO(it0, ip0[0]); - ti_i += IT_IX(it1, ip0[1]); - wo1 = IT_WO(it1, ip0[1]); - ti_i += IT_IX(it2, ip0[2]); - wo2 = IT_WO(it2, ip0[2]); - ti_i += IT_IX(it3, ip0[3]); - wo3 = IT_WO(it3, ip0[3]); - ti_i += IT_IX(it4, ip0[4]); - wo4 = IT_WO(it4, ip0[4]); - ti_i += IT_IX(it5, ip0[5]); - wo5 = IT_WO(it5, ip0[5]); - - imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */ - - /* Sort weighting values and vertex offset values */ - CEX(wo0, wo1); - CEX(wo0, wo2); - CEX(wo0, wo3); - CEX(wo0, wo4); - CEX(wo0, wo5); - CEX(wo1, wo2); - CEX(wo1, wo3); - CEX(wo1, wo4); - CEX(wo1, wo5); - CEX(wo2, wo3); - CEX(wo2, wo4); - CEX(wo2, wo5); - CEX(wo3, wo4); - CEX(wo3, wo5); - CEX(wo4, wo5); - } - { - unsigned int nvof; /* Next vertex offset value */ - unsigned int vof; /* Vertex offset value */ - unsigned int vwe; /* Vertex weighting */ - - vof = 0; /* First vertex offset is 0 */ - nvof = (wo0 & 0x7fffff); /* Extract offset value */ - wo0 = (wo0 >> 23); /* Extract weighting value */ - vwe = 256 - wo0; /* Baricentric weighting */ - ova0 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo1 & 0x7fffff); /* Extract offset value */ - wo1 = (wo1 >> 23); /* Extract weighting value */ - vwe = wo0 - wo1; /* Baricentric weighting */ - ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo2 & 0x7fffff); /* Extract offset value */ - wo2 = (wo2 >> 23); /* Extract weighting value */ - vwe = wo1 - wo2; /* Baricentric weighting */ - ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo3 & 0x7fffff); /* Extract offset value */ - wo3 = (wo3 >> 23); /* Extract weighting value */ - vwe = wo2 - wo3; /* Baricentric weighting */ - ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo4 & 0x7fffff); /* Extract offset value */ - wo4 = (wo4 >> 23); /* Extract weighting value */ - vwe = wo3 - wo4; /* Baricentric weighting */ - ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo5 & 0x7fffff); /* Extract offset value */ - wo5 = (wo5 >> 23); /* Extract weighting value */ - vwe = wo4 - wo5; /* Baricentric weighting */ - ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - vwe = wo5; /* Baricentric weighting */ - 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_WO -#undef IT_IX -#undef CEX -#undef IM_O -#undef IM_PE -#undef OT_E - -static void -imdi_k54_gen( -genspec *g /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x08, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x18, 0x00, 0x00, 0x00, 0x00, 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, 0x04, 0x08, - 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08, - 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7, - 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7, - 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08, - 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00, - 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7, - 0x2c, 0xf3, 0xdc, 0xb7, 0x36, 0x5f, 0x31, 0x5f, - 0x69, 0x38, 0x5f, 0x69, 0x31, 0x36, 0x5f, 0x66, - 0x00, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00, - 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf, - 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08, - 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf, - 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x35, 0x34, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01, - 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7, - 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7, - 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08, - 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08, - 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf, - 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7, - 0x00, 0xf0, 0x04, 0x08 - }; /* Structure image */ - - memcpy(g, data, sizeof(data)); /* Initialise the structure */ -} - -static void -imdi_k54_tab( -tabspec *t /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0xa1, 0xd4, 0xe2, 0xb7, - 0xf4, 0xd5, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0xff, 0xff, 0xff, 0x31, 0x00, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xa0, 0xd6, 0x83, 0xbf, 0x8b, 0x22, 0xe2, 0xb7, - 0xf4, 0xd5, 0x83, 0xbf, 0x52, 0xca, 0x04, 0x08, - 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0x21, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff, - 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff - }; /* Structure image */ - - memcpy(t, data, sizeof(data)); /* Initialise the structure */ -} - -/* 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 = 7 - Input channel 0 bits = 8 - Input channel 0 increment = 7 - Input channel 1 bits = 8 - Input channel 1 increment = 7 - Input channel 2 bits = 8 - Input channel 2 increment = 7 - Input channel 3 bits = 8 - Input channel 3 increment = 7 - Input channel 4 bits = 8 - Input channel 4 increment = 7 - Input channel 5 bits = 8 - Input channel 5 increment = 7 - Input channel 6 bits = 8 - Input channel 6 increment = 7 - 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 = 16 - Output channel 0 increment = 1 - Output is channel interleaved - - Output channels are separate words - Weight+voffset bits = 32 - Interpolation table index bits = 32 - Interpolation table max resolution = 14 - */ - -/* - 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 <memory.h> -#include "imdi_imp.h" -#define IMDI_INCLUDED -#endif /* IMDI_INCLUDED */ - -#ifndef DEFINED_pointer -#define DEFINED_pointer -typedef unsigned char * pointer; -#endif - -/* Input table interp. index */ -#define IT_IX(p, off) *((unsigned int *)((p) + 0 + (off) * 8)) - -/* Input table input weighting/offset value enty */ -#define IT_WO(p, off) *((unsigned int *)((p) + 4 + (off) * 8)) - -/* Conditional exchange for sorting */ -#define CEX(A, B) if (A < B) { A ^= B; B ^= A; A ^= B; } - -/* 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 short *)((p) + (off) * 2)) - -static void -imdi_k55( -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 short *op0 = (unsigned short *)outp[0]; - unsigned char *ep = ip0 + npix * 7 ; - pointer it0 = (pointer)p->in_tables[0]; - pointer it1 = (pointer)p->in_tables[1]; - pointer it2 = (pointer)p->in_tables[2]; - pointer it3 = (pointer)p->in_tables[3]; - pointer it4 = (pointer)p->in_tables[4]; - pointer it5 = (pointer)p->in_tables[5]; - pointer it6 = (pointer)p->in_tables[6]; - pointer ot0 = (pointer)p->out_tables[0]; - pointer im_base = (pointer)p->im_table; - - for(;ip0 < ep; ip0 += 7, op0 += 1) { - unsigned int ova0; /* Output value partial accumulator */ - { - pointer imp; - unsigned int wo0; /* Weighting value and vertex offset variable */ - unsigned int wo1; /* Weighting value and vertex offset variable */ - unsigned int wo2; /* Weighting value and vertex offset variable */ - unsigned int wo3; /* Weighting value and vertex offset variable */ - unsigned int wo4; /* Weighting value and vertex offset variable */ - unsigned int wo5; /* Weighting value and vertex offset variable */ - unsigned int wo6; /* Weighting value and vertex offset variable */ - { - unsigned int ti_i; /* Interpolation index variable */ - - ti_i = IT_IX(it0, ip0[0]); - wo0 = IT_WO(it0, ip0[0]); - ti_i += IT_IX(it1, ip0[1]); - wo1 = IT_WO(it1, ip0[1]); - ti_i += IT_IX(it2, ip0[2]); - wo2 = IT_WO(it2, ip0[2]); - ti_i += IT_IX(it3, ip0[3]); - wo3 = IT_WO(it3, ip0[3]); - ti_i += IT_IX(it4, ip0[4]); - wo4 = IT_WO(it4, ip0[4]); - ti_i += IT_IX(it5, ip0[5]); - wo5 = IT_WO(it5, ip0[5]); - ti_i += IT_IX(it6, ip0[6]); - wo6 = IT_WO(it6, ip0[6]); - - imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */ - - /* Sort weighting values and vertex offset values */ - CEX(wo0, wo1); - CEX(wo0, wo2); - CEX(wo0, wo3); - CEX(wo0, wo4); - CEX(wo0, wo5); - CEX(wo0, wo6); - CEX(wo1, wo2); - CEX(wo1, wo3); - CEX(wo1, wo4); - CEX(wo1, wo5); - CEX(wo1, wo6); - CEX(wo2, wo3); - CEX(wo2, wo4); - CEX(wo2, wo5); - CEX(wo2, wo6); - CEX(wo3, wo4); - CEX(wo3, wo5); - CEX(wo3, wo6); - CEX(wo4, wo5); - CEX(wo4, wo6); - CEX(wo5, wo6); - } - { - unsigned int nvof; /* Next vertex offset value */ - unsigned int vof; /* Vertex offset value */ - unsigned int vwe; /* Vertex weighting */ - - vof = 0; /* First vertex offset is 0 */ - nvof = (wo0 & 0x7fffff); /* Extract offset value */ - wo0 = (wo0 >> 23); /* Extract weighting value */ - vwe = 256 - wo0; /* Baricentric weighting */ - ova0 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo1 & 0x7fffff); /* Extract offset value */ - wo1 = (wo1 >> 23); /* Extract weighting value */ - vwe = wo0 - wo1; /* Baricentric weighting */ - ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo2 & 0x7fffff); /* Extract offset value */ - wo2 = (wo2 >> 23); /* Extract weighting value */ - vwe = wo1 - wo2; /* Baricentric weighting */ - ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo3 & 0x7fffff); /* Extract offset value */ - wo3 = (wo3 >> 23); /* Extract weighting value */ - vwe = wo2 - wo3; /* Baricentric weighting */ - ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo4 & 0x7fffff); /* Extract offset value */ - wo4 = (wo4 >> 23); /* Extract weighting value */ - vwe = wo3 - wo4; /* Baricentric weighting */ - ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo5 & 0x7fffff); /* Extract offset value */ - wo5 = (wo5 >> 23); /* Extract weighting value */ - vwe = wo4 - wo5; /* Baricentric weighting */ - ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo6 & 0x7fffff); /* Extract offset value */ - wo6 = (wo6 >> 23); /* Extract weighting value */ - vwe = wo5 - wo6; /* Baricentric weighting */ - ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - vwe = wo6; /* Baricentric weighting */ - 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_WO -#undef IT_IX -#undef CEX -#undef IM_O -#undef IM_PE -#undef OT_E - -static void -imdi_k55_gen( -genspec *g /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x0e, 0x00, 0x00, 0x00, 0x00, 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, 0x04, 0x08, - 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08, - 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7, - 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7, - 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08, - 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00, - 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7, - 0x2c, 0xf3, 0xdc, 0xb7, 0x37, 0x5f, 0x31, 0x5f, - 0x69, 0x38, 0x5f, 0x69, 0x31, 0x36, 0x5f, 0x66, - 0x00, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00, - 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf, - 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08, - 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf, - 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x35, 0x35, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01, - 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7, - 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7, - 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08, - 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08, - 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf, - 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7, - 0x00, 0xf0, 0x04, 0x08 - }; /* Structure image */ - - memcpy(g, data, sizeof(data)); /* Initialise the structure */ -} - -static void -imdi_k55_tab( -tabspec *t /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0xa1, 0xd4, 0xe2, 0xb7, - 0xf4, 0xd5, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0xff, 0xff, 0xff, 0x31, 0x00, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xa0, 0xd6, 0x83, 0xbf, 0x8b, 0x22, 0xe2, 0xb7, - 0xf4, 0xd5, 0x83, 0xbf, 0x52, 0xca, 0x04, 0x08, - 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0x21, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff, - 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff - }; /* Structure image */ - - memcpy(t, data, sizeof(data)); /* Initialise the structure */ -} - -/* 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 = 8 - Input channel 0 bits = 8 - Input channel 0 increment = 8 - Input channel 1 bits = 8 - Input channel 1 increment = 8 - Input channel 2 bits = 8 - Input channel 2 increment = 8 - Input channel 3 bits = 8 - Input channel 3 increment = 8 - Input channel 4 bits = 8 - Input channel 4 increment = 8 - Input channel 5 bits = 8 - Input channel 5 increment = 8 - Input channel 6 bits = 8 - Input channel 6 increment = 8 - Input channel 7 bits = 8 - Input channel 7 increment = 8 - 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 = 16 - Output channel 0 increment = 1 - Output is channel interleaved - - Output channels are separate words - Weight+voffset bits = 32 - Interpolation table index bits = 32 - Interpolation table max resolution = 9 - */ - -/* - 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 <memory.h> -#include "imdi_imp.h" -#define IMDI_INCLUDED -#endif /* IMDI_INCLUDED */ - -#ifndef DEFINED_pointer -#define DEFINED_pointer -typedef unsigned char * pointer; -#endif - -/* Input table interp. index */ -#define IT_IX(p, off) *((unsigned int *)((p) + 0 + (off) * 8)) - -/* Input table input weighting/offset value enty */ -#define IT_WO(p, off) *((unsigned int *)((p) + 4 + (off) * 8)) - -/* Conditional exchange for sorting */ -#define CEX(A, B) if (A < B) { A ^= B; B ^= A; A ^= B; } - -/* 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 short *)((p) + (off) * 2)) - -static void -imdi_k56( -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 short *op0 = (unsigned short *)outp[0]; - unsigned char *ep = ip0 + npix * 8 ; - pointer it0 = (pointer)p->in_tables[0]; - pointer it1 = (pointer)p->in_tables[1]; - pointer it2 = (pointer)p->in_tables[2]; - pointer it3 = (pointer)p->in_tables[3]; - pointer it4 = (pointer)p->in_tables[4]; - pointer it5 = (pointer)p->in_tables[5]; - pointer it6 = (pointer)p->in_tables[6]; - pointer it7 = (pointer)p->in_tables[7]; - pointer ot0 = (pointer)p->out_tables[0]; - pointer im_base = (pointer)p->im_table; - - for(;ip0 < ep; ip0 += 8, op0 += 1) { - unsigned int ova0; /* Output value partial accumulator */ - { - pointer imp; - unsigned int wo0; /* Weighting value and vertex offset variable */ - unsigned int wo1; /* Weighting value and vertex offset variable */ - unsigned int wo2; /* Weighting value and vertex offset variable */ - unsigned int wo3; /* Weighting value and vertex offset variable */ - unsigned int wo4; /* Weighting value and vertex offset variable */ - unsigned int wo5; /* Weighting value and vertex offset variable */ - unsigned int wo6; /* Weighting value and vertex offset variable */ - unsigned int wo7; /* Weighting value and vertex offset variable */ - { - unsigned int ti_i; /* Interpolation index variable */ - - ti_i = IT_IX(it0, ip0[0]); - wo0 = IT_WO(it0, ip0[0]); - ti_i += IT_IX(it1, ip0[1]); - wo1 = IT_WO(it1, ip0[1]); - ti_i += IT_IX(it2, ip0[2]); - wo2 = IT_WO(it2, ip0[2]); - ti_i += IT_IX(it3, ip0[3]); - wo3 = IT_WO(it3, ip0[3]); - ti_i += IT_IX(it4, ip0[4]); - wo4 = IT_WO(it4, ip0[4]); - ti_i += IT_IX(it5, ip0[5]); - wo5 = IT_WO(it5, ip0[5]); - ti_i += IT_IX(it6, ip0[6]); - wo6 = IT_WO(it6, ip0[6]); - ti_i += IT_IX(it7, ip0[7]); - wo7 = IT_WO(it7, ip0[7]); - - imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */ - - /* Sort weighting values and vertex offset values */ - CEX(wo0, wo1); - CEX(wo0, wo2); - CEX(wo0, wo3); - CEX(wo0, wo4); - CEX(wo0, wo5); - CEX(wo0, wo6); - CEX(wo0, wo7); - CEX(wo1, wo2); - CEX(wo1, wo3); - CEX(wo1, wo4); - CEX(wo1, wo5); - CEX(wo1, wo6); - CEX(wo1, wo7); - CEX(wo2, wo3); - CEX(wo2, wo4); - CEX(wo2, wo5); - CEX(wo2, wo6); - CEX(wo2, wo7); - CEX(wo3, wo4); - CEX(wo3, wo5); - CEX(wo3, wo6); - CEX(wo3, wo7); - CEX(wo4, wo5); - CEX(wo4, wo6); - CEX(wo4, wo7); - CEX(wo5, wo6); - CEX(wo5, wo7); - CEX(wo6, wo7); - } - { - unsigned int nvof; /* Next vertex offset value */ - unsigned int vof; /* Vertex offset value */ - unsigned int vwe; /* Vertex weighting */ - - vof = 0; /* First vertex offset is 0 */ - nvof = (wo0 & 0x7fffff); /* Extract offset value */ - wo0 = (wo0 >> 23); /* Extract weighting value */ - vwe = 256 - wo0; /* Baricentric weighting */ - ova0 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo1 & 0x7fffff); /* Extract offset value */ - wo1 = (wo1 >> 23); /* Extract weighting value */ - vwe = wo0 - wo1; /* Baricentric weighting */ - ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo2 & 0x7fffff); /* Extract offset value */ - wo2 = (wo2 >> 23); /* Extract weighting value */ - vwe = wo1 - wo2; /* Baricentric weighting */ - ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo3 & 0x7fffff); /* Extract offset value */ - wo3 = (wo3 >> 23); /* Extract weighting value */ - vwe = wo2 - wo3; /* Baricentric weighting */ - ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo4 & 0x7fffff); /* Extract offset value */ - wo4 = (wo4 >> 23); /* Extract weighting value */ - vwe = wo3 - wo4; /* Baricentric weighting */ - ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo5 & 0x7fffff); /* Extract offset value */ - wo5 = (wo5 >> 23); /* Extract weighting value */ - vwe = wo4 - wo5; /* Baricentric weighting */ - ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo6 & 0x7fffff); /* Extract offset value */ - wo6 = (wo6 >> 23); /* Extract weighting value */ - vwe = wo5 - wo6; /* Baricentric weighting */ - ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo7 & 0x7fffff); /* Extract offset value */ - wo7 = (wo7 >> 23); /* Extract weighting value */ - vwe = wo6 - wo7; /* Baricentric weighting */ - ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - vwe = wo7; /* Baricentric weighting */ - 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_WO -#undef IT_IX -#undef CEX -#undef IM_O -#undef IM_PE -#undef OT_E - -static void -imdi_k56_gen( -genspec *g /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x09, 0x00, 0x00, 0x00, 0x00, 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, 0x04, 0x08, - 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08, - 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7, - 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7, - 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08, - 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00, - 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7, - 0x2c, 0xf3, 0xdc, 0xb7, 0x38, 0x5f, 0x31, 0x5f, - 0x69, 0x38, 0x5f, 0x69, 0x31, 0x36, 0x5f, 0x66, - 0x00, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00, - 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf, - 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08, - 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf, - 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x35, 0x36, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01, - 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7, - 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7, - 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08, - 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08, - 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf, - 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7, - 0x00, 0xf0, 0x04, 0x08 - }; /* Structure image */ - - memcpy(g, data, sizeof(data)); /* Initialise the structure */ -} - -static void -imdi_k56_tab( -tabspec *t /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0xa1, 0xd4, 0xe2, 0xb7, - 0xf4, 0xd5, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0xff, 0xff, 0xff, 0x31, 0x00, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xa0, 0xd6, 0x83, 0xbf, 0x8b, 0x22, 0xe2, 0xb7, - 0xf4, 0xd5, 0x83, 0xbf, 0x52, 0xca, 0x04, 0x08, - 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0x21, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff, - 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff - }; /* Structure image */ - - memcpy(t, data, sizeof(data)); /* Initialise the structure */ -} - -/* 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 = 3 - Output channel 0 bits = 16 - Output channel 0 increment = 3 - Output channel 1 bits = 16 - Output channel 1 increment = 3 - Output channel 2 bits = 16 - Output channel 2 increment = 3 - 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 = 255 - */ - -/* - 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 <memory.h> -#include "imdi_imp.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) * 8) - -/* Interpolation table - get vertex values */ -#define IM_FE(p, v, c) *((unsigned int *)((p) + (v) * 8 + (c) * 4)) -#define IM_PE(p, v) *((unsigned int *)((p) + 4 + (v) * 8)) - -/* Output table indexes */ -#define OT_E(p, off) *((unsigned short *)((p) + (off) * 2)) - -static void -imdi_k57( -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 short *op0 = (unsigned short *)outp[0]; - unsigned char *ep = ip0 + npix * 1 ; - pointer it0 = (pointer)p->in_tables[0]; - pointer ot0 = (pointer)p->out_tables[0]; - pointer ot1 = (pointer)p->out_tables[1]; - pointer ot2 = (pointer)p->out_tables[2]; - pointer sw_base = (pointer)p->sw_table; - pointer im_base = (pointer)p->im_table; - - for(;ip0 < ep; ip0 += 1, op0 += 3) { - unsigned int ova0; /* Output value accumulator */ - unsigned int ova1; /* 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_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 = 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_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += 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 */ - oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */ - op0[1] = OT_E(ot1, oti); /* Write result */ - oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */ - op0[2] = OT_E(ot2, oti); /* Write result */ - } - } -} -#undef IT_IT -#undef SW_O -#undef SX_WO -#undef IM_O -#undef IM_FE -#undef IM_PE -#undef OT_E - -static void -imdi_k57_gen( -genspec *g /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0xff, 0x00, 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, 0x04, 0x08, - 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08, - 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7, - 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7, - 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08, - 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00, - 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7, - 0x2c, 0xf3, 0xdc, 0xb7, 0x31, 0x5f, 0x33, 0x5f, - 0x69, 0x38, 0x5f, 0x69, 0x31, 0x36, 0x5f, 0x66, - 0x00, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00, - 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf, - 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08, - 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf, - 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x35, 0x37, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01, - 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7, - 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7, - 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08, - 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08, - 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf, - 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7, - 0x00, 0xf0, 0x04, 0x08 - }; /* Structure image */ - - memcpy(g, data, sizeof(data)); /* Initialise the structure */ -} - -static void -imdi_k57_tab( -tabspec *t /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf, - 0xff, 0xff, 0xff, 0x33, 0x00, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xf4, 0xd5, 0x83, 0xbf, 0x52, 0xca, 0x04, 0x08, - 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0x21, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff, - 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff - }; /* Structure image */ - - memcpy(t, data, sizeof(data)); /* Initialise the structure */ -} - -/* 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 = 3 - Input channel 0 bits = 8 - Input channel 0 increment = 3 - Input channel 1 bits = 8 - Input channel 1 increment = 3 - Input channel 2 bits = 8 - Input channel 2 increment = 3 - Input is channel interleaved - Input channels are separate words - Input value extraction is done in input table lookup - - Output channels per pixel = 3 - Output channel 0 bits = 16 - Output channel 0 increment = 3 - Output channel 1 bits = 16 - Output channel 1 increment = 3 - Output channel 2 bits = 16 - Output channel 2 increment = 3 - Output is channel interleaved - - Output channels are separate words - Simplex table index bits = 12 - Interpolation table index bits = 20 - Simplex table max resolution = 16 - Interpolation table max resolution = 101 - */ - -/* - 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 <memory.h> -#include "imdi_imp.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 int *)((p) + 0 + (off) * 4)) - -/* Simplex weighting table access */ -#define SW_O(off) ((off) * 16) - -/* Simplex table - get weighting value */ -#define SX_WE(p, v) *((unsigned short *)((p) + (v) * 4 + 0)) - -/* Simplex table - get offset value */ -#define SX_VO(p, v) *((unsigned short *)((p) + (v) * 4 + 2)) - -/* Interpolation multi-dim. table access */ -#define IM_O(off) ((off) * 8) - -/* Interpolation table - get vertex values */ -#define IM_FE(p, v, c) *((unsigned int *)((p) + (v) * 8 + (c) * 4)) -#define IM_PE(p, v) *((unsigned int *)((p) + 4 + (v) * 8)) - -/* Output table indexes */ -#define OT_E(p, off) *((unsigned short *)((p) + (off) * 2)) - -static void -imdi_k58( -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 short *op0 = (unsigned short *)outp[0]; - unsigned char *ep = ip0 + npix * 3 ; - pointer it0 = (pointer)p->in_tables[0]; - pointer it1 = (pointer)p->in_tables[1]; - pointer it2 = (pointer)p->in_tables[2]; - pointer ot0 = (pointer)p->out_tables[0]; - pointer ot1 = (pointer)p->out_tables[1]; - pointer ot2 = (pointer)p->out_tables[2]; - pointer sw_base = (pointer)p->sw_table; - pointer im_base = (pointer)p->im_table; - - for(;ip0 < ep; ip0 += 3, op0 += 3) { - unsigned int ova0; /* Output value accumulator */ - unsigned int ova1; /* Output value partial accumulator */ - { - pointer swp; - pointer imp; - { - unsigned int ti; /* Simplex+Interpolation index variable */ - - ti = IT_IT(it0, ip0[0]); - ti += IT_IT(it1, ip0[1]); - ti += IT_IT(it2, ip0[2]); - - imp = im_base + IM_O(ti >> 12); /* Extract interp. index and comp. entry */ - swp = sw_base + SW_O(ti & 0xfff); /* Extract simplex index and comp. entry */ - } - { - unsigned int vof; /* Vertex offset value */ - unsigned int vwe; /* Vertex weighting */ - - vof = SX_VO(swp, 0); /* Read vertex offset value */ - vwe = SX_WE(swp, 0); /* Read vertex weighting value */ - ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof = SX_VO(swp, 1); /* Read vertex offset value */ - vwe = SX_WE(swp, 1); /* Read vertex weighting value */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof = SX_VO(swp, 2); /* Read vertex offset value */ - vwe = SX_WE(swp, 2); /* Read vertex weighting value */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof = SX_VO(swp, 3); /* Read vertex offset value */ - vwe = SX_WE(swp, 3); /* Read vertex weighting value */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += 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 */ - oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */ - op0[1] = OT_E(ot1, oti); /* Write result */ - oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */ - op0[2] = OT_E(ot2, oti); /* Write result */ - } - } -} -#undef IT_IT -#undef SW_O -#undef SX_WE -#undef SX_VO -#undef IM_O -#undef IM_FE -#undef IM_PE -#undef OT_E - -static void -imdi_k58_gen( -genspec *g /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x08, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x65, 0x00, 0x00, 0x00, 0x10, 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, 0x04, 0x08, - 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08, - 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7, - 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7, - 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08, - 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00, - 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7, - 0x2c, 0xf3, 0xdc, 0xb7, 0x33, 0x5f, 0x33, 0x5f, - 0x69, 0x38, 0x5f, 0x69, 0x31, 0x36, 0x5f, 0x66, - 0x00, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00, - 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf, - 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08, - 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf, - 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x35, 0x38, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01, - 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7, - 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7, - 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08, - 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08, - 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf, - 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7, - 0x00, 0xf0, 0x04, 0x08 - }; /* Structure image */ - - memcpy(g, data, sizeof(data)); /* Initialise the structure */ -} - -static void -imdi_k58_tab( -tabspec *t /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x14, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf, - 0xff, 0xff, 0xff, 0x33, 0x00, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xf4, 0xd5, 0x83, 0xbf, 0x52, 0xca, 0x04, 0x08, - 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0x21, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff, - 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff - }; /* Structure image */ - - memcpy(t, data, sizeof(data)); /* Initialise the structure */ -} - -/* 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 = 4 - Input channel 0 bits = 8 - Input channel 0 increment = 4 - Input channel 1 bits = 8 - Input channel 1 increment = 4 - Input channel 2 bits = 8 - Input channel 2 increment = 4 - Input channel 3 bits = 8 - Input channel 3 increment = 4 - Input is channel interleaved - Input channels are separate words - Input value extraction is done in input table lookup - - Output channels per pixel = 3 - Output channel 0 bits = 16 - Output channel 0 increment = 3 - Output channel 1 bits = 16 - Output channel 1 increment = 3 - Output channel 2 bits = 16 - Output channel 2 increment = 3 - Output is channel interleaved - - Output channels are separate words - Simplex table index bits = 32 - Interpolation table index bits = 32 - Simplex table max resolution = 255 - Interpolation table max resolution = 39 - */ - -/* - 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 <memory.h> -#include "imdi_imp.h" -#define IMDI_INCLUDED -#endif /* IMDI_INCLUDED */ - -#ifndef DEFINED_pointer -#define DEFINED_pointer -typedef unsigned char * pointer; -#endif - -/* Input table interp. index */ -#define IT_IX(p, off) *((unsigned int *)((p) + 4 + (off) * 8)) - -/* Input table simplex index enty */ -#define IT_SX(p, off) *((unsigned int *)((p) + 0 + (off) * 8)) - -/* Simplex weighting table access */ -#define SW_O(off) ((off) * 20) - -/* Simplex table - get weighting value */ -#define SX_WE(p, v) *((unsigned short *)((p) + (v) * 4 + 0)) - -/* Simplex table - get offset value */ -#define SX_VO(p, v) *((unsigned short *)((p) + (v) * 4 + 2)) - -/* Interpolation multi-dim. table access */ -#define IM_O(off) ((off) * 8) - -/* Interpolation table - get vertex values */ -#define IM_FE(p, v, c) *((unsigned int *)((p) + (v) * 8 + (c) * 4)) -#define IM_PE(p, v) *((unsigned int *)((p) + 4 + (v) * 8)) - -/* Output table indexes */ -#define OT_E(p, off) *((unsigned short *)((p) + (off) * 2)) - -static void -imdi_k59( -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 short *op0 = (unsigned short *)outp[0]; - unsigned char *ep = ip0 + npix * 4 ; - pointer it0 = (pointer)p->in_tables[0]; - pointer it1 = (pointer)p->in_tables[1]; - pointer it2 = (pointer)p->in_tables[2]; - pointer it3 = (pointer)p->in_tables[3]; - pointer ot0 = (pointer)p->out_tables[0]; - pointer ot1 = (pointer)p->out_tables[1]; - pointer ot2 = (pointer)p->out_tables[2]; - pointer sw_base = (pointer)p->sw_table; - pointer im_base = (pointer)p->im_table; - - for(;ip0 < ep; ip0 += 4, op0 += 3) { - unsigned int ova0; /* Output value accumulator */ - unsigned int ova1; /* Output value partial accumulator */ - { - pointer swp; - pointer imp; - { - unsigned int ti_s; /* Simplex index variable */ - unsigned int ti_i; /* Interpolation index variable */ - - ti_i = IT_IX(it0, ip0[0]); - ti_s = IT_SX(it0, ip0[0]); - ti_i += IT_IX(it1, ip0[1]); - ti_s += IT_SX(it1, ip0[1]); - ti_i += IT_IX(it2, ip0[2]); - ti_s += IT_SX(it2, ip0[2]); - ti_i += IT_IX(it3, ip0[3]); - ti_s += IT_SX(it3, ip0[3]); - - swp = sw_base + SW_O(ti_s); /* Compute simplex table entry pointer */ - imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */ - } - { - unsigned int vof; /* Vertex offset value */ - unsigned int vwe; /* Vertex weighting */ - - vof = SX_VO(swp, 0); /* Read vertex offset value */ - vwe = SX_WE(swp, 0); /* Read vertex weighting value */ - ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof = SX_VO(swp, 1); /* Read vertex offset value */ - vwe = SX_WE(swp, 1); /* Read vertex weighting value */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof = SX_VO(swp, 2); /* Read vertex offset value */ - vwe = SX_WE(swp, 2); /* Read vertex weighting value */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof = SX_VO(swp, 3); /* Read vertex offset value */ - vwe = SX_WE(swp, 3); /* Read vertex weighting value */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof = SX_VO(swp, 4); /* Read vertex offset value */ - vwe = SX_WE(swp, 4); /* Read vertex weighting value */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += 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 */ - oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */ - op0[1] = OT_E(ot1, oti); /* Write result */ - oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */ - op0[2] = OT_E(ot2, oti); /* Write result */ - } - } -} -#undef IT_IX -#undef IT_SX -#undef SW_O -#undef SX_WE -#undef SX_VO -#undef IM_O -#undef IM_FE -#undef IM_PE -#undef OT_E - -static void -imdi_k59_gen( -genspec *g /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x27, 0x00, 0x00, 0x00, 0xff, 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, 0x04, 0x08, - 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08, - 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7, - 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7, - 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08, - 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00, - 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7, - 0x2c, 0xf3, 0xdc, 0xb7, 0x34, 0x5f, 0x33, 0x5f, - 0x69, 0x38, 0x5f, 0x69, 0x31, 0x36, 0x5f, 0x66, - 0x00, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00, - 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf, - 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08, - 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf, - 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x35, 0x39, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01, - 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7, - 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7, - 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08, - 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08, - 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf, - 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7, - 0x00, 0xf0, 0x04, 0x08 - }; /* Structure image */ - - memcpy(g, data, sizeof(data)); /* Initialise the structure */ -} - -static void -imdi_k59_tab( -tabspec *t /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x14, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf, - 0xff, 0xff, 0xff, 0x33, 0x00, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xf4, 0xd5, 0x83, 0xbf, 0x52, 0xca, 0x04, 0x08, - 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0x21, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff, - 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff - }; /* Structure image */ - - memcpy(t, data, sizeof(data)); /* Initialise the structure */ -} - -/* 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 = 5 - Input channel 0 bits = 8 - Input channel 0 increment = 5 - Input channel 1 bits = 8 - Input channel 1 increment = 5 - Input channel 2 bits = 8 - Input channel 2 increment = 5 - Input channel 3 bits = 8 - Input channel 3 increment = 5 - Input channel 4 bits = 8 - Input channel 4 increment = 5 - Input is channel interleaved - Input channels are separate words - Input value extraction is done in input table lookup - - Output channels per pixel = 3 - Output channel 0 bits = 16 - Output channel 0 increment = 3 - Output channel 1 bits = 16 - Output channel 1 increment = 3 - Output channel 2 bits = 16 - Output channel 2 increment = 3 - Output is channel interleaved - - Output channels are separate words - Weight+voffset bits = 32 - Interpolation table index bits = 32 - Interpolation table max resolution = 53 - */ - -/* - 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 <memory.h> -#include "imdi_imp.h" -#define IMDI_INCLUDED -#endif /* IMDI_INCLUDED */ - -#ifndef DEFINED_pointer -#define DEFINED_pointer -typedef unsigned char * pointer; -#endif - -/* Input table interp. index */ -#define IT_IX(p, off) *((unsigned int *)((p) + 0 + (off) * 8)) - -/* Input table input weighting/offset value enty */ -#define IT_WO(p, off) *((unsigned int *)((p) + 4 + (off) * 8)) - -/* Conditional exchange for sorting */ -#define CEX(A, B) if (A < B) { A ^= B; B ^= A; A ^= B; } - -/* Interpolation multi-dim. table access */ -#define IM_O(off) ((off) * 8) - -/* Interpolation table - get vertex values */ -#define IM_FE(p, v, c) *((unsigned int *)((p) + (v) * 8 + (c) * 4)) -#define IM_PE(p, v) *((unsigned int *)((p) + 4 + (v) * 8)) - -/* Output table indexes */ -#define OT_E(p, off) *((unsigned short *)((p) + (off) * 2)) - -static void -imdi_k60( -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 short *op0 = (unsigned short *)outp[0]; - unsigned char *ep = ip0 + npix * 5 ; - pointer it0 = (pointer)p->in_tables[0]; - pointer it1 = (pointer)p->in_tables[1]; - pointer it2 = (pointer)p->in_tables[2]; - pointer it3 = (pointer)p->in_tables[3]; - pointer it4 = (pointer)p->in_tables[4]; - pointer ot0 = (pointer)p->out_tables[0]; - pointer ot1 = (pointer)p->out_tables[1]; - pointer ot2 = (pointer)p->out_tables[2]; - pointer im_base = (pointer)p->im_table; - - for(;ip0 < ep; ip0 += 5, op0 += 3) { - unsigned int ova0; /* Output value accumulator */ - unsigned int ova1; /* Output value partial accumulator */ - { - pointer imp; - unsigned int wo0; /* Weighting value and vertex offset variable */ - unsigned int wo1; /* Weighting value and vertex offset variable */ - unsigned int wo2; /* Weighting value and vertex offset variable */ - unsigned int wo3; /* Weighting value and vertex offset variable */ - unsigned int wo4; /* Weighting value and vertex offset variable */ - { - unsigned int ti_i; /* Interpolation index variable */ - - ti_i = IT_IX(it0, ip0[0]); - wo0 = IT_WO(it0, ip0[0]); - ti_i += IT_IX(it1, ip0[1]); - wo1 = IT_WO(it1, ip0[1]); - ti_i += IT_IX(it2, ip0[2]); - wo2 = IT_WO(it2, ip0[2]); - ti_i += IT_IX(it3, ip0[3]); - wo3 = IT_WO(it3, ip0[3]); - ti_i += IT_IX(it4, ip0[4]); - wo4 = IT_WO(it4, ip0[4]); - - imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */ - - /* Sort weighting values and vertex offset values */ - CEX(wo0, wo1); - CEX(wo0, wo2); - CEX(wo0, wo3); - CEX(wo0, wo4); - CEX(wo1, wo2); - CEX(wo1, wo3); - CEX(wo1, wo4); - CEX(wo2, wo3); - CEX(wo2, wo4); - CEX(wo3, wo4); - } - { - unsigned int nvof; /* Next vertex offset value */ - unsigned int vof; /* Vertex offset value */ - unsigned int vwe; /* Vertex weighting */ - - vof = 0; /* First vertex offset is 0 */ - nvof = (wo0 & 0x7fffff); /* Extract offset value */ - wo0 = (wo0 >> 23); /* Extract weighting value */ - vwe = 256 - wo0; /* Baricentric weighting */ - ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo1 & 0x7fffff); /* Extract offset value */ - wo1 = (wo1 >> 23); /* Extract weighting value */ - vwe = wo0 - wo1; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo2 & 0x7fffff); /* Extract offset value */ - wo2 = (wo2 >> 23); /* Extract weighting value */ - vwe = wo1 - wo2; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo3 & 0x7fffff); /* Extract offset value */ - wo3 = (wo3 >> 23); /* Extract weighting value */ - vwe = wo2 - wo3; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo4 & 0x7fffff); /* Extract offset value */ - wo4 = (wo4 >> 23); /* Extract weighting value */ - vwe = wo3 - wo4; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - vwe = wo4; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += 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 */ - oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */ - op0[1] = OT_E(ot1, oti); /* Write result */ - oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */ - op0[2] = OT_E(ot2, oti); /* Write result */ - } - } -} -#undef IT_WO -#undef IT_IX -#undef CEX -#undef IM_O -#undef IM_FE -#undef IM_PE -#undef OT_E - -static void -imdi_k60_gen( -genspec *g /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x08, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x35, 0x00, 0x00, 0x00, 0x00, 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, 0x04, 0x08, - 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08, - 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7, - 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7, - 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08, - 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00, - 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7, - 0x2c, 0xf3, 0xdc, 0xb7, 0x35, 0x5f, 0x33, 0x5f, - 0x69, 0x38, 0x5f, 0x69, 0x31, 0x36, 0x5f, 0x66, - 0x00, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00, - 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf, - 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08, - 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf, - 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x36, 0x30, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01, - 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7, - 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7, - 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08, - 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08, - 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf, - 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7, - 0x00, 0xf0, 0x04, 0x08 - }; /* Structure image */ - - memcpy(g, data, sizeof(data)); /* Initialise the structure */ -} - -static void -imdi_k60_tab( -tabspec *t /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf, - 0xff, 0xff, 0xff, 0x33, 0x00, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xf4, 0xd5, 0x83, 0xbf, 0x52, 0xca, 0x04, 0x08, - 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0x21, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff, - 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff - }; /* Structure image */ - - memcpy(t, data, sizeof(data)); /* Initialise the structure */ -} - -/* 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 = 6 - Input channel 0 bits = 8 - Input channel 0 increment = 6 - Input channel 1 bits = 8 - Input channel 1 increment = 6 - Input channel 2 bits = 8 - Input channel 2 increment = 6 - Input channel 3 bits = 8 - Input channel 3 increment = 6 - Input channel 4 bits = 8 - Input channel 4 increment = 6 - Input channel 5 bits = 8 - Input channel 5 increment = 6 - Input is channel interleaved - Input channels are separate words - Input value extraction is done in input table lookup - - Output channels per pixel = 3 - Output channel 0 bits = 16 - Output channel 0 increment = 3 - Output channel 1 bits = 16 - Output channel 1 increment = 3 - Output channel 2 bits = 16 - Output channel 2 increment = 3 - Output is channel interleaved - - Output channels are separate words - Weight+voffset bits = 32 - Interpolation table index bits = 32 - Interpolation table max resolution = 24 - */ - -/* - 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 <memory.h> -#include "imdi_imp.h" -#define IMDI_INCLUDED -#endif /* IMDI_INCLUDED */ - -#ifndef DEFINED_pointer -#define DEFINED_pointer -typedef unsigned char * pointer; -#endif - -/* Input table interp. index */ -#define IT_IX(p, off) *((unsigned int *)((p) + 0 + (off) * 8)) - -/* Input table input weighting/offset value enty */ -#define IT_WO(p, off) *((unsigned int *)((p) + 4 + (off) * 8)) - -/* Conditional exchange for sorting */ -#define CEX(A, B) if (A < B) { A ^= B; B ^= A; A ^= B; } - -/* Interpolation multi-dim. table access */ -#define IM_O(off) ((off) * 8) - -/* Interpolation table - get vertex values */ -#define IM_FE(p, v, c) *((unsigned int *)((p) + (v) * 8 + (c) * 4)) -#define IM_PE(p, v) *((unsigned int *)((p) + 4 + (v) * 8)) - -/* Output table indexes */ -#define OT_E(p, off) *((unsigned short *)((p) + (off) * 2)) - -static void -imdi_k61( -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 short *op0 = (unsigned short *)outp[0]; - unsigned char *ep = ip0 + npix * 6 ; - pointer it0 = (pointer)p->in_tables[0]; - pointer it1 = (pointer)p->in_tables[1]; - pointer it2 = (pointer)p->in_tables[2]; - pointer it3 = (pointer)p->in_tables[3]; - pointer it4 = (pointer)p->in_tables[4]; - pointer it5 = (pointer)p->in_tables[5]; - pointer ot0 = (pointer)p->out_tables[0]; - pointer ot1 = (pointer)p->out_tables[1]; - pointer ot2 = (pointer)p->out_tables[2]; - pointer im_base = (pointer)p->im_table; - - for(;ip0 < ep; ip0 += 6, op0 += 3) { - unsigned int ova0; /* Output value accumulator */ - unsigned int ova1; /* Output value partial accumulator */ - { - pointer imp; - unsigned int wo0; /* Weighting value and vertex offset variable */ - unsigned int wo1; /* Weighting value and vertex offset variable */ - unsigned int wo2; /* Weighting value and vertex offset variable */ - unsigned int wo3; /* Weighting value and vertex offset variable */ - unsigned int wo4; /* Weighting value and vertex offset variable */ - unsigned int wo5; /* Weighting value and vertex offset variable */ - { - unsigned int ti_i; /* Interpolation index variable */ - - ti_i = IT_IX(it0, ip0[0]); - wo0 = IT_WO(it0, ip0[0]); - ti_i += IT_IX(it1, ip0[1]); - wo1 = IT_WO(it1, ip0[1]); - ti_i += IT_IX(it2, ip0[2]); - wo2 = IT_WO(it2, ip0[2]); - ti_i += IT_IX(it3, ip0[3]); - wo3 = IT_WO(it3, ip0[3]); - ti_i += IT_IX(it4, ip0[4]); - wo4 = IT_WO(it4, ip0[4]); - ti_i += IT_IX(it5, ip0[5]); - wo5 = IT_WO(it5, ip0[5]); - - imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */ - - /* Sort weighting values and vertex offset values */ - CEX(wo0, wo1); - CEX(wo0, wo2); - CEX(wo0, wo3); - CEX(wo0, wo4); - CEX(wo0, wo5); - CEX(wo1, wo2); - CEX(wo1, wo3); - CEX(wo1, wo4); - CEX(wo1, wo5); - CEX(wo2, wo3); - CEX(wo2, wo4); - CEX(wo2, wo5); - CEX(wo3, wo4); - CEX(wo3, wo5); - CEX(wo4, wo5); - } - { - unsigned int nvof; /* Next vertex offset value */ - unsigned int vof; /* Vertex offset value */ - unsigned int vwe; /* Vertex weighting */ - - vof = 0; /* First vertex offset is 0 */ - nvof = (wo0 & 0x7fffff); /* Extract offset value */ - wo0 = (wo0 >> 23); /* Extract weighting value */ - vwe = 256 - wo0; /* Baricentric weighting */ - ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo1 & 0x7fffff); /* Extract offset value */ - wo1 = (wo1 >> 23); /* Extract weighting value */ - vwe = wo0 - wo1; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo2 & 0x7fffff); /* Extract offset value */ - wo2 = (wo2 >> 23); /* Extract weighting value */ - vwe = wo1 - wo2; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo3 & 0x7fffff); /* Extract offset value */ - wo3 = (wo3 >> 23); /* Extract weighting value */ - vwe = wo2 - wo3; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo4 & 0x7fffff); /* Extract offset value */ - wo4 = (wo4 >> 23); /* Extract weighting value */ - vwe = wo3 - wo4; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo5 & 0x7fffff); /* Extract offset value */ - wo5 = (wo5 >> 23); /* Extract weighting value */ - vwe = wo4 - wo5; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - vwe = wo5; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += 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 */ - oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */ - op0[1] = OT_E(ot1, oti); /* Write result */ - oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */ - op0[2] = OT_E(ot2, oti); /* Write result */ - } - } -} -#undef IT_WO -#undef IT_IX -#undef CEX -#undef IM_O -#undef IM_FE -#undef IM_PE -#undef OT_E - -static void -imdi_k61_gen( -genspec *g /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x08, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x18, 0x00, 0x00, 0x00, 0x00, 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, 0x04, 0x08, - 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08, - 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7, - 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7, - 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08, - 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00, - 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7, - 0x2c, 0xf3, 0xdc, 0xb7, 0x36, 0x5f, 0x33, 0x5f, - 0x69, 0x38, 0x5f, 0x69, 0x31, 0x36, 0x5f, 0x66, - 0x00, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00, - 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf, - 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08, - 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf, - 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x36, 0x31, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01, - 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7, - 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7, - 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08, - 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08, - 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf, - 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7, - 0x00, 0xf0, 0x04, 0x08 - }; /* Structure image */ - - memcpy(g, data, sizeof(data)); /* Initialise the structure */ -} - -static void -imdi_k61_tab( -tabspec *t /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf, - 0xff, 0xff, 0xff, 0x33, 0x00, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xf4, 0xd5, 0x83, 0xbf, 0x52, 0xca, 0x04, 0x08, - 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0x21, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff, - 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff - }; /* Structure image */ - - memcpy(t, data, sizeof(data)); /* Initialise the structure */ -} - -/* 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 = 7 - Input channel 0 bits = 8 - Input channel 0 increment = 7 - Input channel 1 bits = 8 - Input channel 1 increment = 7 - Input channel 2 bits = 8 - Input channel 2 increment = 7 - Input channel 3 bits = 8 - Input channel 3 increment = 7 - Input channel 4 bits = 8 - Input channel 4 increment = 7 - Input channel 5 bits = 8 - Input channel 5 increment = 7 - Input channel 6 bits = 8 - Input channel 6 increment = 7 - Input is channel interleaved - Input channels are separate words - Input value extraction is done in input table lookup - - Output channels per pixel = 3 - Output channel 0 bits = 16 - Output channel 0 increment = 3 - Output channel 1 bits = 16 - Output channel 1 increment = 3 - Output channel 2 bits = 16 - Output channel 2 increment = 3 - Output is channel interleaved - - Output channels are separate words - Weight+voffset bits = 32 - Interpolation table index bits = 32 - Interpolation table max resolution = 14 - */ - -/* - 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 <memory.h> -#include "imdi_imp.h" -#define IMDI_INCLUDED -#endif /* IMDI_INCLUDED */ - -#ifndef DEFINED_pointer -#define DEFINED_pointer -typedef unsigned char * pointer; -#endif - -/* Input table interp. index */ -#define IT_IX(p, off) *((unsigned int *)((p) + 0 + (off) * 8)) - -/* Input table input weighting/offset value enty */ -#define IT_WO(p, off) *((unsigned int *)((p) + 4 + (off) * 8)) - -/* Conditional exchange for sorting */ -#define CEX(A, B) if (A < B) { A ^= B; B ^= A; A ^= B; } - -/* Interpolation multi-dim. table access */ -#define IM_O(off) ((off) * 8) - -/* Interpolation table - get vertex values */ -#define IM_FE(p, v, c) *((unsigned int *)((p) + (v) * 8 + (c) * 4)) -#define IM_PE(p, v) *((unsigned int *)((p) + 4 + (v) * 8)) - -/* Output table indexes */ -#define OT_E(p, off) *((unsigned short *)((p) + (off) * 2)) - -static void -imdi_k62( -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 short *op0 = (unsigned short *)outp[0]; - unsigned char *ep = ip0 + npix * 7 ; - pointer it0 = (pointer)p->in_tables[0]; - pointer it1 = (pointer)p->in_tables[1]; - pointer it2 = (pointer)p->in_tables[2]; - pointer it3 = (pointer)p->in_tables[3]; - pointer it4 = (pointer)p->in_tables[4]; - pointer it5 = (pointer)p->in_tables[5]; - pointer it6 = (pointer)p->in_tables[6]; - pointer ot0 = (pointer)p->out_tables[0]; - pointer ot1 = (pointer)p->out_tables[1]; - pointer ot2 = (pointer)p->out_tables[2]; - pointer im_base = (pointer)p->im_table; - - for(;ip0 < ep; ip0 += 7, op0 += 3) { - unsigned int ova0; /* Output value accumulator */ - unsigned int ova1; /* Output value partial accumulator */ - { - pointer imp; - unsigned int wo0; /* Weighting value and vertex offset variable */ - unsigned int wo1; /* Weighting value and vertex offset variable */ - unsigned int wo2; /* Weighting value and vertex offset variable */ - unsigned int wo3; /* Weighting value and vertex offset variable */ - unsigned int wo4; /* Weighting value and vertex offset variable */ - unsigned int wo5; /* Weighting value and vertex offset variable */ - unsigned int wo6; /* Weighting value and vertex offset variable */ - { - unsigned int ti_i; /* Interpolation index variable */ - - ti_i = IT_IX(it0, ip0[0]); - wo0 = IT_WO(it0, ip0[0]); - ti_i += IT_IX(it1, ip0[1]); - wo1 = IT_WO(it1, ip0[1]); - ti_i += IT_IX(it2, ip0[2]); - wo2 = IT_WO(it2, ip0[2]); - ti_i += IT_IX(it3, ip0[3]); - wo3 = IT_WO(it3, ip0[3]); - ti_i += IT_IX(it4, ip0[4]); - wo4 = IT_WO(it4, ip0[4]); - ti_i += IT_IX(it5, ip0[5]); - wo5 = IT_WO(it5, ip0[5]); - ti_i += IT_IX(it6, ip0[6]); - wo6 = IT_WO(it6, ip0[6]); - - imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */ - - /* Sort weighting values and vertex offset values */ - CEX(wo0, wo1); - CEX(wo0, wo2); - CEX(wo0, wo3); - CEX(wo0, wo4); - CEX(wo0, wo5); - CEX(wo0, wo6); - CEX(wo1, wo2); - CEX(wo1, wo3); - CEX(wo1, wo4); - CEX(wo1, wo5); - CEX(wo1, wo6); - CEX(wo2, wo3); - CEX(wo2, wo4); - CEX(wo2, wo5); - CEX(wo2, wo6); - CEX(wo3, wo4); - CEX(wo3, wo5); - CEX(wo3, wo6); - CEX(wo4, wo5); - CEX(wo4, wo6); - CEX(wo5, wo6); - } - { - unsigned int nvof; /* Next vertex offset value */ - unsigned int vof; /* Vertex offset value */ - unsigned int vwe; /* Vertex weighting */ - - vof = 0; /* First vertex offset is 0 */ - nvof = (wo0 & 0x7fffff); /* Extract offset value */ - wo0 = (wo0 >> 23); /* Extract weighting value */ - vwe = 256 - wo0; /* Baricentric weighting */ - ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo1 & 0x7fffff); /* Extract offset value */ - wo1 = (wo1 >> 23); /* Extract weighting value */ - vwe = wo0 - wo1; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo2 & 0x7fffff); /* Extract offset value */ - wo2 = (wo2 >> 23); /* Extract weighting value */ - vwe = wo1 - wo2; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo3 & 0x7fffff); /* Extract offset value */ - wo3 = (wo3 >> 23); /* Extract weighting value */ - vwe = wo2 - wo3; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo4 & 0x7fffff); /* Extract offset value */ - wo4 = (wo4 >> 23); /* Extract weighting value */ - vwe = wo3 - wo4; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo5 & 0x7fffff); /* Extract offset value */ - wo5 = (wo5 >> 23); /* Extract weighting value */ - vwe = wo4 - wo5; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo6 & 0x7fffff); /* Extract offset value */ - wo6 = (wo6 >> 23); /* Extract weighting value */ - vwe = wo5 - wo6; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - vwe = wo6; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += 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 */ - oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */ - op0[1] = OT_E(ot1, oti); /* Write result */ - oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */ - op0[2] = OT_E(ot2, oti); /* Write result */ - } - } -} -#undef IT_WO -#undef IT_IX -#undef CEX -#undef IM_O -#undef IM_FE -#undef IM_PE -#undef OT_E - -static void -imdi_k62_gen( -genspec *g /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x0e, 0x00, 0x00, 0x00, 0x00, 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, 0x04, 0x08, - 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08, - 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7, - 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7, - 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08, - 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00, - 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7, - 0x2c, 0xf3, 0xdc, 0xb7, 0x37, 0x5f, 0x33, 0x5f, - 0x69, 0x38, 0x5f, 0x69, 0x31, 0x36, 0x5f, 0x66, - 0x00, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00, - 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf, - 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08, - 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf, - 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x36, 0x32, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01, - 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7, - 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7, - 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08, - 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08, - 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf, - 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7, - 0x00, 0xf0, 0x04, 0x08 - }; /* Structure image */ - - memcpy(g, data, sizeof(data)); /* Initialise the structure */ -} - -static void -imdi_k62_tab( -tabspec *t /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf, - 0xff, 0xff, 0xff, 0x33, 0x00, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xf4, 0xd5, 0x83, 0xbf, 0x52, 0xca, 0x04, 0x08, - 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0x21, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff, - 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff - }; /* Structure image */ - - memcpy(t, data, sizeof(data)); /* Initialise the structure */ -} - -/* 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 = 8 - Input channel 0 bits = 8 - Input channel 0 increment = 8 - Input channel 1 bits = 8 - Input channel 1 increment = 8 - Input channel 2 bits = 8 - Input channel 2 increment = 8 - Input channel 3 bits = 8 - Input channel 3 increment = 8 - Input channel 4 bits = 8 - Input channel 4 increment = 8 - Input channel 5 bits = 8 - Input channel 5 increment = 8 - Input channel 6 bits = 8 - Input channel 6 increment = 8 - Input channel 7 bits = 8 - Input channel 7 increment = 8 - Input is channel interleaved - Input channels are separate words - Input value extraction is done in input table lookup - - Output channels per pixel = 3 - Output channel 0 bits = 16 - Output channel 0 increment = 3 - Output channel 1 bits = 16 - Output channel 1 increment = 3 - Output channel 2 bits = 16 - Output channel 2 increment = 3 - Output is channel interleaved - - Output channels are separate words - Weight+voffset bits = 32 - Interpolation table index bits = 32 - Interpolation table max resolution = 9 - */ - -/* - 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 <memory.h> -#include "imdi_imp.h" -#define IMDI_INCLUDED -#endif /* IMDI_INCLUDED */ - -#ifndef DEFINED_pointer -#define DEFINED_pointer -typedef unsigned char * pointer; -#endif - -/* Input table interp. index */ -#define IT_IX(p, off) *((unsigned int *)((p) + 0 + (off) * 8)) - -/* Input table input weighting/offset value enty */ -#define IT_WO(p, off) *((unsigned int *)((p) + 4 + (off) * 8)) - -/* Conditional exchange for sorting */ -#define CEX(A, B) if (A < B) { A ^= B; B ^= A; A ^= B; } - -/* Interpolation multi-dim. table access */ -#define IM_O(off) ((off) * 8) - -/* Interpolation table - get vertex values */ -#define IM_FE(p, v, c) *((unsigned int *)((p) + (v) * 8 + (c) * 4)) -#define IM_PE(p, v) *((unsigned int *)((p) + 4 + (v) * 8)) - -/* Output table indexes */ -#define OT_E(p, off) *((unsigned short *)((p) + (off) * 2)) - -static void -imdi_k63( -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 short *op0 = (unsigned short *)outp[0]; - unsigned char *ep = ip0 + npix * 8 ; - pointer it0 = (pointer)p->in_tables[0]; - pointer it1 = (pointer)p->in_tables[1]; - pointer it2 = (pointer)p->in_tables[2]; - pointer it3 = (pointer)p->in_tables[3]; - pointer it4 = (pointer)p->in_tables[4]; - pointer it5 = (pointer)p->in_tables[5]; - pointer it6 = (pointer)p->in_tables[6]; - pointer it7 = (pointer)p->in_tables[7]; - pointer ot0 = (pointer)p->out_tables[0]; - pointer ot1 = (pointer)p->out_tables[1]; - pointer ot2 = (pointer)p->out_tables[2]; - pointer im_base = (pointer)p->im_table; - - for(;ip0 < ep; ip0 += 8, op0 += 3) { - unsigned int ova0; /* Output value accumulator */ - unsigned int ova1; /* Output value partial accumulator */ - { - pointer imp; - unsigned int wo0; /* Weighting value and vertex offset variable */ - unsigned int wo1; /* Weighting value and vertex offset variable */ - unsigned int wo2; /* Weighting value and vertex offset variable */ - unsigned int wo3; /* Weighting value and vertex offset variable */ - unsigned int wo4; /* Weighting value and vertex offset variable */ - unsigned int wo5; /* Weighting value and vertex offset variable */ - unsigned int wo6; /* Weighting value and vertex offset variable */ - unsigned int wo7; /* Weighting value and vertex offset variable */ - { - unsigned int ti_i; /* Interpolation index variable */ - - ti_i = IT_IX(it0, ip0[0]); - wo0 = IT_WO(it0, ip0[0]); - ti_i += IT_IX(it1, ip0[1]); - wo1 = IT_WO(it1, ip0[1]); - ti_i += IT_IX(it2, ip0[2]); - wo2 = IT_WO(it2, ip0[2]); - ti_i += IT_IX(it3, ip0[3]); - wo3 = IT_WO(it3, ip0[3]); - ti_i += IT_IX(it4, ip0[4]); - wo4 = IT_WO(it4, ip0[4]); - ti_i += IT_IX(it5, ip0[5]); - wo5 = IT_WO(it5, ip0[5]); - ti_i += IT_IX(it6, ip0[6]); - wo6 = IT_WO(it6, ip0[6]); - ti_i += IT_IX(it7, ip0[7]); - wo7 = IT_WO(it7, ip0[7]); - - imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */ - - /* Sort weighting values and vertex offset values */ - CEX(wo0, wo1); - CEX(wo0, wo2); - CEX(wo0, wo3); - CEX(wo0, wo4); - CEX(wo0, wo5); - CEX(wo0, wo6); - CEX(wo0, wo7); - CEX(wo1, wo2); - CEX(wo1, wo3); - CEX(wo1, wo4); - CEX(wo1, wo5); - CEX(wo1, wo6); - CEX(wo1, wo7); - CEX(wo2, wo3); - CEX(wo2, wo4); - CEX(wo2, wo5); - CEX(wo2, wo6); - CEX(wo2, wo7); - CEX(wo3, wo4); - CEX(wo3, wo5); - CEX(wo3, wo6); - CEX(wo3, wo7); - CEX(wo4, wo5); - CEX(wo4, wo6); - CEX(wo4, wo7); - CEX(wo5, wo6); - CEX(wo5, wo7); - CEX(wo6, wo7); - } - { - unsigned int nvof; /* Next vertex offset value */ - unsigned int vof; /* Vertex offset value */ - unsigned int vwe; /* Vertex weighting */ - - vof = 0; /* First vertex offset is 0 */ - nvof = (wo0 & 0x7fffff); /* Extract offset value */ - wo0 = (wo0 >> 23); /* Extract weighting value */ - vwe = 256 - wo0; /* Baricentric weighting */ - ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo1 & 0x7fffff); /* Extract offset value */ - wo1 = (wo1 >> 23); /* Extract weighting value */ - vwe = wo0 - wo1; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo2 & 0x7fffff); /* Extract offset value */ - wo2 = (wo2 >> 23); /* Extract weighting value */ - vwe = wo1 - wo2; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo3 & 0x7fffff); /* Extract offset value */ - wo3 = (wo3 >> 23); /* Extract weighting value */ - vwe = wo2 - wo3; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo4 & 0x7fffff); /* Extract offset value */ - wo4 = (wo4 >> 23); /* Extract weighting value */ - vwe = wo3 - wo4; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo5 & 0x7fffff); /* Extract offset value */ - wo5 = (wo5 >> 23); /* Extract weighting value */ - vwe = wo4 - wo5; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo6 & 0x7fffff); /* Extract offset value */ - wo6 = (wo6 >> 23); /* Extract weighting value */ - vwe = wo5 - wo6; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo7 & 0x7fffff); /* Extract offset value */ - wo7 = (wo7 >> 23); /* Extract weighting value */ - vwe = wo6 - wo7; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - vwe = wo7; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += 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 */ - oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */ - op0[1] = OT_E(ot1, oti); /* Write result */ - oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */ - op0[2] = OT_E(ot2, oti); /* Write result */ - } - } -} -#undef IT_WO -#undef IT_IX -#undef CEX -#undef IM_O -#undef IM_FE -#undef IM_PE -#undef OT_E - -static void -imdi_k63_gen( -genspec *g /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x09, 0x00, 0x00, 0x00, 0x00, 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, 0x04, 0x08, - 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08, - 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7, - 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7, - 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08, - 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00, - 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7, - 0x2c, 0xf3, 0xdc, 0xb7, 0x38, 0x5f, 0x33, 0x5f, - 0x69, 0x38, 0x5f, 0x69, 0x31, 0x36, 0x5f, 0x66, - 0x00, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00, - 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf, - 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08, - 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf, - 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x36, 0x33, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01, - 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7, - 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7, - 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08, - 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08, - 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf, - 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7, - 0x00, 0xf0, 0x04, 0x08 - }; /* Structure image */ - - memcpy(g, data, sizeof(data)); /* Initialise the structure */ -} - -static void -imdi_k63_tab( -tabspec *t /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf, - 0xff, 0xff, 0xff, 0x33, 0x00, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xf4, 0xd5, 0x83, 0xbf, 0x52, 0xca, 0x04, 0x08, - 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0x21, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff, - 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff - }; /* Structure image */ - - memcpy(t, data, sizeof(data)); /* Initialise the structure */ -} - -/* 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 = 4 - Output channel 0 bits = 16 - Output channel 0 increment = 4 - Output channel 1 bits = 16 - Output channel 1 increment = 4 - Output channel 2 bits = 16 - Output channel 2 increment = 4 - Output channel 3 bits = 16 - Output channel 3 increment = 4 - 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 = 255 - */ - -/* - 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 <memory.h> -#include "imdi_imp.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) * 8) - -/* Interpolation table - get vertex values */ -#define IM_FE(p, v, c) *((unsigned int *)((p) + (v) * 8 + (c) * 4)) - -/* Output table indexes */ -#define OT_E(p, off) *((unsigned short *)((p) + (off) * 2)) - -static void -imdi_k64( -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 short *op0 = (unsigned short *)outp[0]; - unsigned char *ep = ip0 + npix * 1 ; - pointer it0 = (pointer)p->in_tables[0]; - pointer ot0 = (pointer)p->out_tables[0]; - pointer ot1 = (pointer)p->out_tables[1]; - pointer ot2 = (pointer)p->out_tables[2]; - pointer ot3 = (pointer)p->out_tables[3]; - pointer sw_base = (pointer)p->sw_table; - pointer im_base = (pointer)p->im_table; - - for(;ip0 < ep; ip0 += 1, op0 += 4) { - unsigned int ova0; /* Output value accumulator */ - unsigned int ova1; /* Output value 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_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate 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_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate 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 */ - oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */ - op0[1] = OT_E(ot1, oti); /* Write result */ - oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */ - op0[2] = OT_E(ot2, oti); /* Write result */ - oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */ - op0[3] = OT_E(ot3, oti); /* Write result */ - } - } -} -#undef IT_IT -#undef SW_O -#undef SX_WO -#undef IM_O -#undef IM_FE -#undef OT_E - -static void -imdi_k64_gen( -genspec *g /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0xff, 0x00, 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, 0x04, 0x08, - 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08, - 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7, - 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7, - 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08, - 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00, - 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7, - 0x2c, 0xf3, 0xdc, 0xb7, 0x31, 0x5f, 0x34, 0x5f, - 0x69, 0x38, 0x5f, 0x69, 0x31, 0x36, 0x5f, 0x66, - 0x00, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00, - 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf, - 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08, - 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf, - 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x36, 0x34, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01, - 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7, - 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7, - 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08, - 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08, - 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf, - 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7, - 0x00, 0xf0, 0x04, 0x08 - }; /* Structure image */ - - memcpy(g, data, sizeof(data)); /* Initialise the structure */ -} - -static void -imdi_k64_tab( -tabspec *t /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0x34, 0x00, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x52, 0xca, 0x04, 0x08, - 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf, - 0x21, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff, - 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff - }; /* Structure image */ - - memcpy(t, data, sizeof(data)); /* Initialise the structure */ -} - -/* 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 = 3 - Input channel 0 bits = 8 - Input channel 0 increment = 3 - Input channel 1 bits = 8 - Input channel 1 increment = 3 - Input channel 2 bits = 8 - Input channel 2 increment = 3 - Input is channel interleaved - Input channels are separate words - Input value extraction is done in input table lookup - - Output channels per pixel = 4 - Output channel 0 bits = 16 - Output channel 0 increment = 4 - Output channel 1 bits = 16 - Output channel 1 increment = 4 - Output channel 2 bits = 16 - Output channel 2 increment = 4 - Output channel 3 bits = 16 - Output channel 3 increment = 4 - Output is channel interleaved - - Output channels are separate words - Simplex table index bits = 12 - Interpolation table index bits = 20 - Simplex table max resolution = 16 - Interpolation table max resolution = 101 - */ - -/* - 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 <memory.h> -#include "imdi_imp.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 int *)((p) + 0 + (off) * 4)) - -/* Simplex weighting table access */ -#define SW_O(off) ((off) * 16) - -/* Simplex table - get weighting value */ -#define SX_WE(p, v) *((unsigned short *)((p) + (v) * 4 + 0)) - -/* Simplex table - get offset value */ -#define SX_VO(p, v) *((unsigned short *)((p) + (v) * 4 + 2)) - -/* Interpolation multi-dim. table access */ -#define IM_O(off) ((off) * 8) - -/* Interpolation table - get vertex values */ -#define IM_FE(p, v, c) *((unsigned int *)((p) + (v) * 8 + (c) * 4)) - -/* Output table indexes */ -#define OT_E(p, off) *((unsigned short *)((p) + (off) * 2)) - -static void -imdi_k65( -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 short *op0 = (unsigned short *)outp[0]; - unsigned char *ep = ip0 + npix * 3 ; - pointer it0 = (pointer)p->in_tables[0]; - pointer it1 = (pointer)p->in_tables[1]; - pointer it2 = (pointer)p->in_tables[2]; - pointer ot0 = (pointer)p->out_tables[0]; - pointer ot1 = (pointer)p->out_tables[1]; - pointer ot2 = (pointer)p->out_tables[2]; - pointer ot3 = (pointer)p->out_tables[3]; - pointer sw_base = (pointer)p->sw_table; - pointer im_base = (pointer)p->im_table; - - for(;ip0 < ep; ip0 += 3, op0 += 4) { - unsigned int ova0; /* Output value accumulator */ - unsigned int ova1; /* Output value accumulator */ - { - pointer swp; - pointer imp; - { - unsigned int ti; /* Simplex+Interpolation index variable */ - - ti = IT_IT(it0, ip0[0]); - ti += IT_IT(it1, ip0[1]); - ti += IT_IT(it2, ip0[2]); - - imp = im_base + IM_O(ti >> 12); /* Extract interp. index and comp. entry */ - swp = sw_base + SW_O(ti & 0xfff); /* Extract simplex index and comp. entry */ - } - { - unsigned int vof; /* Vertex offset value */ - unsigned int vwe; /* Vertex weighting */ - - vof = SX_VO(swp, 0); /* Read vertex offset value */ - vwe = SX_WE(swp, 0); /* Read vertex weighting value */ - ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - vof = SX_VO(swp, 1); /* Read vertex offset value */ - vwe = SX_WE(swp, 1); /* Read vertex weighting value */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - vof = SX_VO(swp, 2); /* Read vertex offset value */ - vwe = SX_WE(swp, 2); /* Read vertex weighting value */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - vof = SX_VO(swp, 3); /* Read vertex offset value */ - vwe = SX_WE(swp, 3); /* Read vertex weighting value */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate 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 */ - oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */ - op0[1] = OT_E(ot1, oti); /* Write result */ - oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */ - op0[2] = OT_E(ot2, oti); /* Write result */ - oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */ - op0[3] = OT_E(ot3, oti); /* Write result */ - } - } -} -#undef IT_IT -#undef SW_O -#undef SX_WE -#undef SX_VO -#undef IM_O -#undef IM_FE -#undef OT_E - -static void -imdi_k65_gen( -genspec *g /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x08, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x65, 0x00, 0x00, 0x00, 0x10, 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, 0x04, 0x08, - 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08, - 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7, - 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7, - 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08, - 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00, - 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7, - 0x2c, 0xf3, 0xdc, 0xb7, 0x33, 0x5f, 0x34, 0x5f, - 0x69, 0x38, 0x5f, 0x69, 0x31, 0x36, 0x5f, 0x66, - 0x00, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00, - 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf, - 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08, - 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf, - 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x36, 0x35, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01, - 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7, - 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7, - 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08, - 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08, - 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf, - 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7, - 0x00, 0xf0, 0x04, 0x08 - }; /* Structure image */ - - memcpy(g, data, sizeof(data)); /* Initialise the structure */ -} - -static void -imdi_k65_tab( -tabspec *t /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x14, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0x34, 0x00, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x52, 0xca, 0x04, 0x08, - 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf, - 0x21, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff, - 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff - }; /* Structure image */ - - memcpy(t, data, sizeof(data)); /* Initialise the structure */ -} - -/* 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 = 4 - Input channel 0 bits = 8 - Input channel 0 increment = 4 - Input channel 1 bits = 8 - Input channel 1 increment = 4 - Input channel 2 bits = 8 - Input channel 2 increment = 4 - Input channel 3 bits = 8 - Input channel 3 increment = 4 - Input is channel interleaved - Input channels are separate words - Input value extraction is done in input table lookup - - Output channels per pixel = 4 - Output channel 0 bits = 16 - Output channel 0 increment = 4 - Output channel 1 bits = 16 - Output channel 1 increment = 4 - Output channel 2 bits = 16 - Output channel 2 increment = 4 - Output channel 3 bits = 16 - Output channel 3 increment = 4 - Output is channel interleaved - - Output channels are separate words - Simplex table index bits = 32 - Interpolation table index bits = 32 - Simplex table max resolution = 255 - Interpolation table max resolution = 39 - */ - -/* - 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 <memory.h> -#include "imdi_imp.h" -#define IMDI_INCLUDED -#endif /* IMDI_INCLUDED */ - -#ifndef DEFINED_pointer -#define DEFINED_pointer -typedef unsigned char * pointer; -#endif - -/* Input table interp. index */ -#define IT_IX(p, off) *((unsigned int *)((p) + 4 + (off) * 8)) - -/* Input table simplex index enty */ -#define IT_SX(p, off) *((unsigned int *)((p) + 0 + (off) * 8)) - -/* Simplex weighting table access */ -#define SW_O(off) ((off) * 20) - -/* Simplex table - get weighting value */ -#define SX_WE(p, v) *((unsigned short *)((p) + (v) * 4 + 0)) - -/* Simplex table - get offset value */ -#define SX_VO(p, v) *((unsigned short *)((p) + (v) * 4 + 2)) - -/* Interpolation multi-dim. table access */ -#define IM_O(off) ((off) * 8) - -/* Interpolation table - get vertex values */ -#define IM_FE(p, v, c) *((unsigned int *)((p) + (v) * 8 + (c) * 4)) - -/* Output table indexes */ -#define OT_E(p, off) *((unsigned short *)((p) + (off) * 2)) - -static void -imdi_k66( -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 short *op0 = (unsigned short *)outp[0]; - unsigned char *ep = ip0 + npix * 4 ; - pointer it0 = (pointer)p->in_tables[0]; - pointer it1 = (pointer)p->in_tables[1]; - pointer it2 = (pointer)p->in_tables[2]; - pointer it3 = (pointer)p->in_tables[3]; - pointer ot0 = (pointer)p->out_tables[0]; - pointer ot1 = (pointer)p->out_tables[1]; - pointer ot2 = (pointer)p->out_tables[2]; - pointer ot3 = (pointer)p->out_tables[3]; - pointer sw_base = (pointer)p->sw_table; - pointer im_base = (pointer)p->im_table; - - for(;ip0 < ep; ip0 += 4, op0 += 4) { - unsigned int ova0; /* Output value accumulator */ - unsigned int ova1; /* Output value accumulator */ - { - pointer swp; - pointer imp; - { - unsigned int ti_s; /* Simplex index variable */ - unsigned int ti_i; /* Interpolation index variable */ - - ti_i = IT_IX(it0, ip0[0]); - ti_s = IT_SX(it0, ip0[0]); - ti_i += IT_IX(it1, ip0[1]); - ti_s += IT_SX(it1, ip0[1]); - ti_i += IT_IX(it2, ip0[2]); - ti_s += IT_SX(it2, ip0[2]); - ti_i += IT_IX(it3, ip0[3]); - ti_s += IT_SX(it3, ip0[3]); - - swp = sw_base + SW_O(ti_s); /* Compute simplex table entry pointer */ - imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */ - } - { - unsigned int vof; /* Vertex offset value */ - unsigned int vwe; /* Vertex weighting */ - - vof = SX_VO(swp, 0); /* Read vertex offset value */ - vwe = SX_WE(swp, 0); /* Read vertex weighting value */ - ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - vof = SX_VO(swp, 1); /* Read vertex offset value */ - vwe = SX_WE(swp, 1); /* Read vertex weighting value */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - vof = SX_VO(swp, 2); /* Read vertex offset value */ - vwe = SX_WE(swp, 2); /* Read vertex weighting value */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - vof = SX_VO(swp, 3); /* Read vertex offset value */ - vwe = SX_WE(swp, 3); /* Read vertex weighting value */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - vof = SX_VO(swp, 4); /* Read vertex offset value */ - vwe = SX_WE(swp, 4); /* Read vertex weighting value */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate 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 */ - oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */ - op0[1] = OT_E(ot1, oti); /* Write result */ - oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */ - op0[2] = OT_E(ot2, oti); /* Write result */ - oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */ - op0[3] = OT_E(ot3, oti); /* Write result */ - } - } -} -#undef IT_IX -#undef IT_SX -#undef SW_O -#undef SX_WE -#undef SX_VO -#undef IM_O -#undef IM_FE -#undef OT_E - -static void -imdi_k66_gen( -genspec *g /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x27, 0x00, 0x00, 0x00, 0xff, 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, 0x04, 0x08, - 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08, - 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7, - 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7, - 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08, - 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00, - 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7, - 0x2c, 0xf3, 0xdc, 0xb7, 0x34, 0x5f, 0x34, 0x5f, - 0x69, 0x38, 0x5f, 0x69, 0x31, 0x36, 0x5f, 0x66, - 0x00, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00, - 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf, - 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08, - 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf, - 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x36, 0x36, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01, - 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7, - 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7, - 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08, - 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08, - 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf, - 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7, - 0x00, 0xf0, 0x04, 0x08 - }; /* Structure image */ - - memcpy(g, data, sizeof(data)); /* Initialise the structure */ -} - -static void -imdi_k66_tab( -tabspec *t /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x14, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0x34, 0x00, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x52, 0xca, 0x04, 0x08, - 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf, - 0x21, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff, - 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff - }; /* Structure image */ - - memcpy(t, data, sizeof(data)); /* Initialise the structure */ -} - -/* 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 = 5 - Input channel 0 bits = 8 - Input channel 0 increment = 5 - Input channel 1 bits = 8 - Input channel 1 increment = 5 - Input channel 2 bits = 8 - Input channel 2 increment = 5 - Input channel 3 bits = 8 - Input channel 3 increment = 5 - Input channel 4 bits = 8 - Input channel 4 increment = 5 - Input is channel interleaved - Input channels are separate words - Input value extraction is done in input table lookup - - Output channels per pixel = 4 - Output channel 0 bits = 16 - Output channel 0 increment = 4 - Output channel 1 bits = 16 - Output channel 1 increment = 4 - Output channel 2 bits = 16 - Output channel 2 increment = 4 - Output channel 3 bits = 16 - Output channel 3 increment = 4 - Output is channel interleaved - - Output channels are separate words - Weight+voffset bits = 32 - Interpolation table index bits = 32 - Interpolation table max resolution = 53 - */ - -/* - 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 <memory.h> -#include "imdi_imp.h" -#define IMDI_INCLUDED -#endif /* IMDI_INCLUDED */ - -#ifndef DEFINED_pointer -#define DEFINED_pointer -typedef unsigned char * pointer; -#endif - -/* Input table interp. index */ -#define IT_IX(p, off) *((unsigned int *)((p) + 0 + (off) * 8)) - -/* Input table input weighting/offset value enty */ -#define IT_WO(p, off) *((unsigned int *)((p) + 4 + (off) * 8)) - -/* Conditional exchange for sorting */ -#define CEX(A, B) if (A < B) { A ^= B; B ^= A; A ^= B; } - -/* Interpolation multi-dim. table access */ -#define IM_O(off) ((off) * 8) - -/* Interpolation table - get vertex values */ -#define IM_FE(p, v, c) *((unsigned int *)((p) + (v) * 8 + (c) * 4)) - -/* Output table indexes */ -#define OT_E(p, off) *((unsigned short *)((p) + (off) * 2)) - -static void -imdi_k67( -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 short *op0 = (unsigned short *)outp[0]; - unsigned char *ep = ip0 + npix * 5 ; - pointer it0 = (pointer)p->in_tables[0]; - pointer it1 = (pointer)p->in_tables[1]; - pointer it2 = (pointer)p->in_tables[2]; - pointer it3 = (pointer)p->in_tables[3]; - pointer it4 = (pointer)p->in_tables[4]; - pointer ot0 = (pointer)p->out_tables[0]; - pointer ot1 = (pointer)p->out_tables[1]; - pointer ot2 = (pointer)p->out_tables[2]; - pointer ot3 = (pointer)p->out_tables[3]; - pointer im_base = (pointer)p->im_table; - - for(;ip0 < ep; ip0 += 5, op0 += 4) { - unsigned int ova0; /* Output value accumulator */ - unsigned int ova1; /* Output value accumulator */ - { - pointer imp; - unsigned int wo0; /* Weighting value and vertex offset variable */ - unsigned int wo1; /* Weighting value and vertex offset variable */ - unsigned int wo2; /* Weighting value and vertex offset variable */ - unsigned int wo3; /* Weighting value and vertex offset variable */ - unsigned int wo4; /* Weighting value and vertex offset variable */ - { - unsigned int ti_i; /* Interpolation index variable */ - - ti_i = IT_IX(it0, ip0[0]); - wo0 = IT_WO(it0, ip0[0]); - ti_i += IT_IX(it1, ip0[1]); - wo1 = IT_WO(it1, ip0[1]); - ti_i += IT_IX(it2, ip0[2]); - wo2 = IT_WO(it2, ip0[2]); - ti_i += IT_IX(it3, ip0[3]); - wo3 = IT_WO(it3, ip0[3]); - ti_i += IT_IX(it4, ip0[4]); - wo4 = IT_WO(it4, ip0[4]); - - imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */ - - /* Sort weighting values and vertex offset values */ - CEX(wo0, wo1); - CEX(wo0, wo2); - CEX(wo0, wo3); - CEX(wo0, wo4); - CEX(wo1, wo2); - CEX(wo1, wo3); - CEX(wo1, wo4); - CEX(wo2, wo3); - CEX(wo2, wo4); - CEX(wo3, wo4); - } - { - unsigned int nvof; /* Next vertex offset value */ - unsigned int vof; /* Vertex offset value */ - unsigned int vwe; /* Vertex weighting */ - - vof = 0; /* First vertex offset is 0 */ - nvof = (wo0 & 0x7fffff); /* Extract offset value */ - wo0 = (wo0 >> 23); /* Extract weighting value */ - vwe = 256 - wo0; /* Baricentric weighting */ - ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo1 & 0x7fffff); /* Extract offset value */ - wo1 = (wo1 >> 23); /* Extract weighting value */ - vwe = wo0 - wo1; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo2 & 0x7fffff); /* Extract offset value */ - wo2 = (wo2 >> 23); /* Extract weighting value */ - vwe = wo1 - wo2; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo3 & 0x7fffff); /* Extract offset value */ - wo3 = (wo3 >> 23); /* Extract weighting value */ - vwe = wo2 - wo3; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo4 & 0x7fffff); /* Extract offset value */ - wo4 = (wo4 >> 23); /* Extract weighting value */ - vwe = wo3 - wo4; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - vwe = wo4; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate 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 */ - oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */ - op0[1] = OT_E(ot1, oti); /* Write result */ - oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */ - op0[2] = OT_E(ot2, oti); /* Write result */ - oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */ - op0[3] = OT_E(ot3, oti); /* Write result */ - } - } -} -#undef IT_WO -#undef IT_IX -#undef CEX -#undef IM_O -#undef IM_FE -#undef OT_E - -static void -imdi_k67_gen( -genspec *g /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x08, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x35, 0x00, 0x00, 0x00, 0x00, 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, 0x04, 0x08, - 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08, - 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7, - 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7, - 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08, - 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00, - 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7, - 0x2c, 0xf3, 0xdc, 0xb7, 0x35, 0x5f, 0x34, 0x5f, - 0x69, 0x38, 0x5f, 0x69, 0x31, 0x36, 0x5f, 0x66, - 0x00, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00, - 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf, - 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08, - 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf, - 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x36, 0x37, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01, - 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7, - 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7, - 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08, - 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08, - 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf, - 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7, - 0x00, 0xf0, 0x04, 0x08 - }; /* Structure image */ - - memcpy(g, data, sizeof(data)); /* Initialise the structure */ -} - -static void -imdi_k67_tab( -tabspec *t /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0x34, 0x00, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x52, 0xca, 0x04, 0x08, - 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf, - 0x21, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff, - 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff - }; /* Structure image */ - - memcpy(t, data, sizeof(data)); /* Initialise the structure */ -} - -/* 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 = 6 - Input channel 0 bits = 8 - Input channel 0 increment = 6 - Input channel 1 bits = 8 - Input channel 1 increment = 6 - Input channel 2 bits = 8 - Input channel 2 increment = 6 - Input channel 3 bits = 8 - Input channel 3 increment = 6 - Input channel 4 bits = 8 - Input channel 4 increment = 6 - Input channel 5 bits = 8 - Input channel 5 increment = 6 - Input is channel interleaved - Input channels are separate words - Input value extraction is done in input table lookup - - Output channels per pixel = 4 - Output channel 0 bits = 16 - Output channel 0 increment = 4 - Output channel 1 bits = 16 - Output channel 1 increment = 4 - Output channel 2 bits = 16 - Output channel 2 increment = 4 - Output channel 3 bits = 16 - Output channel 3 increment = 4 - Output is channel interleaved - - Output channels are separate words - Weight+voffset bits = 32 - Interpolation table index bits = 32 - Interpolation table max resolution = 24 - */ - -/* - 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 <memory.h> -#include "imdi_imp.h" -#define IMDI_INCLUDED -#endif /* IMDI_INCLUDED */ - -#ifndef DEFINED_pointer -#define DEFINED_pointer -typedef unsigned char * pointer; -#endif - -/* Input table interp. index */ -#define IT_IX(p, off) *((unsigned int *)((p) + 0 + (off) * 8)) - -/* Input table input weighting/offset value enty */ -#define IT_WO(p, off) *((unsigned int *)((p) + 4 + (off) * 8)) - -/* Conditional exchange for sorting */ -#define CEX(A, B) if (A < B) { A ^= B; B ^= A; A ^= B; } - -/* Interpolation multi-dim. table access */ -#define IM_O(off) ((off) * 8) - -/* Interpolation table - get vertex values */ -#define IM_FE(p, v, c) *((unsigned int *)((p) + (v) * 8 + (c) * 4)) - -/* Output table indexes */ -#define OT_E(p, off) *((unsigned short *)((p) + (off) * 2)) - -static void -imdi_k68( -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 short *op0 = (unsigned short *)outp[0]; - unsigned char *ep = ip0 + npix * 6 ; - pointer it0 = (pointer)p->in_tables[0]; - pointer it1 = (pointer)p->in_tables[1]; - pointer it2 = (pointer)p->in_tables[2]; - pointer it3 = (pointer)p->in_tables[3]; - pointer it4 = (pointer)p->in_tables[4]; - pointer it5 = (pointer)p->in_tables[5]; - pointer ot0 = (pointer)p->out_tables[0]; - pointer ot1 = (pointer)p->out_tables[1]; - pointer ot2 = (pointer)p->out_tables[2]; - pointer ot3 = (pointer)p->out_tables[3]; - pointer im_base = (pointer)p->im_table; - - for(;ip0 < ep; ip0 += 6, op0 += 4) { - unsigned int ova0; /* Output value accumulator */ - unsigned int ova1; /* Output value accumulator */ - { - pointer imp; - unsigned int wo0; /* Weighting value and vertex offset variable */ - unsigned int wo1; /* Weighting value and vertex offset variable */ - unsigned int wo2; /* Weighting value and vertex offset variable */ - unsigned int wo3; /* Weighting value and vertex offset variable */ - unsigned int wo4; /* Weighting value and vertex offset variable */ - unsigned int wo5; /* Weighting value and vertex offset variable */ - { - unsigned int ti_i; /* Interpolation index variable */ - - ti_i = IT_IX(it0, ip0[0]); - wo0 = IT_WO(it0, ip0[0]); - ti_i += IT_IX(it1, ip0[1]); - wo1 = IT_WO(it1, ip0[1]); - ti_i += IT_IX(it2, ip0[2]); - wo2 = IT_WO(it2, ip0[2]); - ti_i += IT_IX(it3, ip0[3]); - wo3 = IT_WO(it3, ip0[3]); - ti_i += IT_IX(it4, ip0[4]); - wo4 = IT_WO(it4, ip0[4]); - ti_i += IT_IX(it5, ip0[5]); - wo5 = IT_WO(it5, ip0[5]); - - imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */ - - /* Sort weighting values and vertex offset values */ - CEX(wo0, wo1); - CEX(wo0, wo2); - CEX(wo0, wo3); - CEX(wo0, wo4); - CEX(wo0, wo5); - CEX(wo1, wo2); - CEX(wo1, wo3); - CEX(wo1, wo4); - CEX(wo1, wo5); - CEX(wo2, wo3); - CEX(wo2, wo4); - CEX(wo2, wo5); - CEX(wo3, wo4); - CEX(wo3, wo5); - CEX(wo4, wo5); - } - { - unsigned int nvof; /* Next vertex offset value */ - unsigned int vof; /* Vertex offset value */ - unsigned int vwe; /* Vertex weighting */ - - vof = 0; /* First vertex offset is 0 */ - nvof = (wo0 & 0x7fffff); /* Extract offset value */ - wo0 = (wo0 >> 23); /* Extract weighting value */ - vwe = 256 - wo0; /* Baricentric weighting */ - ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo1 & 0x7fffff); /* Extract offset value */ - wo1 = (wo1 >> 23); /* Extract weighting value */ - vwe = wo0 - wo1; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo2 & 0x7fffff); /* Extract offset value */ - wo2 = (wo2 >> 23); /* Extract weighting value */ - vwe = wo1 - wo2; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo3 & 0x7fffff); /* Extract offset value */ - wo3 = (wo3 >> 23); /* Extract weighting value */ - vwe = wo2 - wo3; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo4 & 0x7fffff); /* Extract offset value */ - wo4 = (wo4 >> 23); /* Extract weighting value */ - vwe = wo3 - wo4; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo5 & 0x7fffff); /* Extract offset value */ - wo5 = (wo5 >> 23); /* Extract weighting value */ - vwe = wo4 - wo5; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - vwe = wo5; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate 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 */ - oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */ - op0[1] = OT_E(ot1, oti); /* Write result */ - oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */ - op0[2] = OT_E(ot2, oti); /* Write result */ - oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */ - op0[3] = OT_E(ot3, oti); /* Write result */ - } - } -} -#undef IT_WO -#undef IT_IX -#undef CEX -#undef IM_O -#undef IM_FE -#undef OT_E - -static void -imdi_k68_gen( -genspec *g /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x08, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x18, 0x00, 0x00, 0x00, 0x00, 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, 0x04, 0x08, - 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08, - 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7, - 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7, - 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08, - 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00, - 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7, - 0x2c, 0xf3, 0xdc, 0xb7, 0x36, 0x5f, 0x34, 0x5f, - 0x69, 0x38, 0x5f, 0x69, 0x31, 0x36, 0x5f, 0x66, - 0x00, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00, - 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf, - 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08, - 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf, - 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x36, 0x38, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01, - 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7, - 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7, - 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08, - 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08, - 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf, - 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7, - 0x00, 0xf0, 0x04, 0x08 - }; /* Structure image */ - - memcpy(g, data, sizeof(data)); /* Initialise the structure */ -} - -static void -imdi_k68_tab( -tabspec *t /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0x34, 0x00, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x52, 0xca, 0x04, 0x08, - 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf, - 0x21, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff, - 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff - }; /* Structure image */ - - memcpy(t, data, sizeof(data)); /* Initialise the structure */ -} - -/* 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 = 7 - Input channel 0 bits = 8 - Input channel 0 increment = 7 - Input channel 1 bits = 8 - Input channel 1 increment = 7 - Input channel 2 bits = 8 - Input channel 2 increment = 7 - Input channel 3 bits = 8 - Input channel 3 increment = 7 - Input channel 4 bits = 8 - Input channel 4 increment = 7 - Input channel 5 bits = 8 - Input channel 5 increment = 7 - Input channel 6 bits = 8 - Input channel 6 increment = 7 - Input is channel interleaved - Input channels are separate words - Input value extraction is done in input table lookup - - Output channels per pixel = 4 - Output channel 0 bits = 16 - Output channel 0 increment = 4 - Output channel 1 bits = 16 - Output channel 1 increment = 4 - Output channel 2 bits = 16 - Output channel 2 increment = 4 - Output channel 3 bits = 16 - Output channel 3 increment = 4 - Output is channel interleaved - - Output channels are separate words - Weight+voffset bits = 32 - Interpolation table index bits = 32 - Interpolation table max resolution = 14 - */ - -/* - 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 <memory.h> -#include "imdi_imp.h" -#define IMDI_INCLUDED -#endif /* IMDI_INCLUDED */ - -#ifndef DEFINED_pointer -#define DEFINED_pointer -typedef unsigned char * pointer; -#endif - -/* Input table interp. index */ -#define IT_IX(p, off) *((unsigned int *)((p) + 0 + (off) * 8)) - -/* Input table input weighting/offset value enty */ -#define IT_WO(p, off) *((unsigned int *)((p) + 4 + (off) * 8)) - -/* Conditional exchange for sorting */ -#define CEX(A, B) if (A < B) { A ^= B; B ^= A; A ^= B; } - -/* Interpolation multi-dim. table access */ -#define IM_O(off) ((off) * 8) - -/* Interpolation table - get vertex values */ -#define IM_FE(p, v, c) *((unsigned int *)((p) + (v) * 8 + (c) * 4)) - -/* Output table indexes */ -#define OT_E(p, off) *((unsigned short *)((p) + (off) * 2)) - -static void -imdi_k69( -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 short *op0 = (unsigned short *)outp[0]; - unsigned char *ep = ip0 + npix * 7 ; - pointer it0 = (pointer)p->in_tables[0]; - pointer it1 = (pointer)p->in_tables[1]; - pointer it2 = (pointer)p->in_tables[2]; - pointer it3 = (pointer)p->in_tables[3]; - pointer it4 = (pointer)p->in_tables[4]; - pointer it5 = (pointer)p->in_tables[5]; - pointer it6 = (pointer)p->in_tables[6]; - pointer ot0 = (pointer)p->out_tables[0]; - pointer ot1 = (pointer)p->out_tables[1]; - pointer ot2 = (pointer)p->out_tables[2]; - pointer ot3 = (pointer)p->out_tables[3]; - pointer im_base = (pointer)p->im_table; - - for(;ip0 < ep; ip0 += 7, op0 += 4) { - unsigned int ova0; /* Output value accumulator */ - unsigned int ova1; /* Output value accumulator */ - { - pointer imp; - unsigned int wo0; /* Weighting value and vertex offset variable */ - unsigned int wo1; /* Weighting value and vertex offset variable */ - unsigned int wo2; /* Weighting value and vertex offset variable */ - unsigned int wo3; /* Weighting value and vertex offset variable */ - unsigned int wo4; /* Weighting value and vertex offset variable */ - unsigned int wo5; /* Weighting value and vertex offset variable */ - unsigned int wo6; /* Weighting value and vertex offset variable */ - { - unsigned int ti_i; /* Interpolation index variable */ - - ti_i = IT_IX(it0, ip0[0]); - wo0 = IT_WO(it0, ip0[0]); - ti_i += IT_IX(it1, ip0[1]); - wo1 = IT_WO(it1, ip0[1]); - ti_i += IT_IX(it2, ip0[2]); - wo2 = IT_WO(it2, ip0[2]); - ti_i += IT_IX(it3, ip0[3]); - wo3 = IT_WO(it3, ip0[3]); - ti_i += IT_IX(it4, ip0[4]); - wo4 = IT_WO(it4, ip0[4]); - ti_i += IT_IX(it5, ip0[5]); - wo5 = IT_WO(it5, ip0[5]); - ti_i += IT_IX(it6, ip0[6]); - wo6 = IT_WO(it6, ip0[6]); - - imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */ - - /* Sort weighting values and vertex offset values */ - CEX(wo0, wo1); - CEX(wo0, wo2); - CEX(wo0, wo3); - CEX(wo0, wo4); - CEX(wo0, wo5); - CEX(wo0, wo6); - CEX(wo1, wo2); - CEX(wo1, wo3); - CEX(wo1, wo4); - CEX(wo1, wo5); - CEX(wo1, wo6); - CEX(wo2, wo3); - CEX(wo2, wo4); - CEX(wo2, wo5); - CEX(wo2, wo6); - CEX(wo3, wo4); - CEX(wo3, wo5); - CEX(wo3, wo6); - CEX(wo4, wo5); - CEX(wo4, wo6); - CEX(wo5, wo6); - } - { - unsigned int nvof; /* Next vertex offset value */ - unsigned int vof; /* Vertex offset value */ - unsigned int vwe; /* Vertex weighting */ - - vof = 0; /* First vertex offset is 0 */ - nvof = (wo0 & 0x7fffff); /* Extract offset value */ - wo0 = (wo0 >> 23); /* Extract weighting value */ - vwe = 256 - wo0; /* Baricentric weighting */ - ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo1 & 0x7fffff); /* Extract offset value */ - wo1 = (wo1 >> 23); /* Extract weighting value */ - vwe = wo0 - wo1; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo2 & 0x7fffff); /* Extract offset value */ - wo2 = (wo2 >> 23); /* Extract weighting value */ - vwe = wo1 - wo2; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo3 & 0x7fffff); /* Extract offset value */ - wo3 = (wo3 >> 23); /* Extract weighting value */ - vwe = wo2 - wo3; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo4 & 0x7fffff); /* Extract offset value */ - wo4 = (wo4 >> 23); /* Extract weighting value */ - vwe = wo3 - wo4; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo5 & 0x7fffff); /* Extract offset value */ - wo5 = (wo5 >> 23); /* Extract weighting value */ - vwe = wo4 - wo5; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo6 & 0x7fffff); /* Extract offset value */ - wo6 = (wo6 >> 23); /* Extract weighting value */ - vwe = wo5 - wo6; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - vwe = wo6; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate 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 */ - oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */ - op0[1] = OT_E(ot1, oti); /* Write result */ - oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */ - op0[2] = OT_E(ot2, oti); /* Write result */ - oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */ - op0[3] = OT_E(ot3, oti); /* Write result */ - } - } -} -#undef IT_WO -#undef IT_IX -#undef CEX -#undef IM_O -#undef IM_FE -#undef OT_E - -static void -imdi_k69_gen( -genspec *g /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x0e, 0x00, 0x00, 0x00, 0x00, 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, 0x04, 0x08, - 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08, - 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7, - 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7, - 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08, - 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00, - 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7, - 0x2c, 0xf3, 0xdc, 0xb7, 0x37, 0x5f, 0x34, 0x5f, - 0x69, 0x38, 0x5f, 0x69, 0x31, 0x36, 0x5f, 0x66, - 0x00, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00, - 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf, - 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08, - 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf, - 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x36, 0x39, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01, - 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7, - 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7, - 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08, - 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08, - 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf, - 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7, - 0x00, 0xf0, 0x04, 0x08 - }; /* Structure image */ - - memcpy(g, data, sizeof(data)); /* Initialise the structure */ -} - -static void -imdi_k69_tab( -tabspec *t /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0x34, 0x00, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x52, 0xca, 0x04, 0x08, - 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf, - 0x21, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff, - 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff - }; /* Structure image */ - - memcpy(t, data, sizeof(data)); /* Initialise the structure */ -} - -/* 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 = 8 - Input channel 0 bits = 8 - Input channel 0 increment = 8 - Input channel 1 bits = 8 - Input channel 1 increment = 8 - Input channel 2 bits = 8 - Input channel 2 increment = 8 - Input channel 3 bits = 8 - Input channel 3 increment = 8 - Input channel 4 bits = 8 - Input channel 4 increment = 8 - Input channel 5 bits = 8 - Input channel 5 increment = 8 - Input channel 6 bits = 8 - Input channel 6 increment = 8 - Input channel 7 bits = 8 - Input channel 7 increment = 8 - Input is channel interleaved - Input channels are separate words - Input value extraction is done in input table lookup - - Output channels per pixel = 4 - Output channel 0 bits = 16 - Output channel 0 increment = 4 - Output channel 1 bits = 16 - Output channel 1 increment = 4 - Output channel 2 bits = 16 - Output channel 2 increment = 4 - Output channel 3 bits = 16 - Output channel 3 increment = 4 - Output is channel interleaved - - Output channels are separate words - Weight+voffset bits = 32 - Interpolation table index bits = 32 - Interpolation table max resolution = 9 - */ - -/* - 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 <memory.h> -#include "imdi_imp.h" -#define IMDI_INCLUDED -#endif /* IMDI_INCLUDED */ - -#ifndef DEFINED_pointer -#define DEFINED_pointer -typedef unsigned char * pointer; -#endif - -/* Input table interp. index */ -#define IT_IX(p, off) *((unsigned int *)((p) + 0 + (off) * 8)) - -/* Input table input weighting/offset value enty */ -#define IT_WO(p, off) *((unsigned int *)((p) + 4 + (off) * 8)) - -/* Conditional exchange for sorting */ -#define CEX(A, B) if (A < B) { A ^= B; B ^= A; A ^= B; } - -/* Interpolation multi-dim. table access */ -#define IM_O(off) ((off) * 8) - -/* Interpolation table - get vertex values */ -#define IM_FE(p, v, c) *((unsigned int *)((p) + (v) * 8 + (c) * 4)) - -/* Output table indexes */ -#define OT_E(p, off) *((unsigned short *)((p) + (off) * 2)) - -static void -imdi_k70( -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 short *op0 = (unsigned short *)outp[0]; - unsigned char *ep = ip0 + npix * 8 ; - pointer it0 = (pointer)p->in_tables[0]; - pointer it1 = (pointer)p->in_tables[1]; - pointer it2 = (pointer)p->in_tables[2]; - pointer it3 = (pointer)p->in_tables[3]; - pointer it4 = (pointer)p->in_tables[4]; - pointer it5 = (pointer)p->in_tables[5]; - pointer it6 = (pointer)p->in_tables[6]; - pointer it7 = (pointer)p->in_tables[7]; - pointer ot0 = (pointer)p->out_tables[0]; - pointer ot1 = (pointer)p->out_tables[1]; - pointer ot2 = (pointer)p->out_tables[2]; - pointer ot3 = (pointer)p->out_tables[3]; - pointer im_base = (pointer)p->im_table; - - for(;ip0 < ep; ip0 += 8, op0 += 4) { - unsigned int ova0; /* Output value accumulator */ - unsigned int ova1; /* Output value accumulator */ - { - pointer imp; - unsigned int wo0; /* Weighting value and vertex offset variable */ - unsigned int wo1; /* Weighting value and vertex offset variable */ - unsigned int wo2; /* Weighting value and vertex offset variable */ - unsigned int wo3; /* Weighting value and vertex offset variable */ - unsigned int wo4; /* Weighting value and vertex offset variable */ - unsigned int wo5; /* Weighting value and vertex offset variable */ - unsigned int wo6; /* Weighting value and vertex offset variable */ - unsigned int wo7; /* Weighting value and vertex offset variable */ - { - unsigned int ti_i; /* Interpolation index variable */ - - ti_i = IT_IX(it0, ip0[0]); - wo0 = IT_WO(it0, ip0[0]); - ti_i += IT_IX(it1, ip0[1]); - wo1 = IT_WO(it1, ip0[1]); - ti_i += IT_IX(it2, ip0[2]); - wo2 = IT_WO(it2, ip0[2]); - ti_i += IT_IX(it3, ip0[3]); - wo3 = IT_WO(it3, ip0[3]); - ti_i += IT_IX(it4, ip0[4]); - wo4 = IT_WO(it4, ip0[4]); - ti_i += IT_IX(it5, ip0[5]); - wo5 = IT_WO(it5, ip0[5]); - ti_i += IT_IX(it6, ip0[6]); - wo6 = IT_WO(it6, ip0[6]); - ti_i += IT_IX(it7, ip0[7]); - wo7 = IT_WO(it7, ip0[7]); - - imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */ - - /* Sort weighting values and vertex offset values */ - CEX(wo0, wo1); - CEX(wo0, wo2); - CEX(wo0, wo3); - CEX(wo0, wo4); - CEX(wo0, wo5); - CEX(wo0, wo6); - CEX(wo0, wo7); - CEX(wo1, wo2); - CEX(wo1, wo3); - CEX(wo1, wo4); - CEX(wo1, wo5); - CEX(wo1, wo6); - CEX(wo1, wo7); - CEX(wo2, wo3); - CEX(wo2, wo4); - CEX(wo2, wo5); - CEX(wo2, wo6); - CEX(wo2, wo7); - CEX(wo3, wo4); - CEX(wo3, wo5); - CEX(wo3, wo6); - CEX(wo3, wo7); - CEX(wo4, wo5); - CEX(wo4, wo6); - CEX(wo4, wo7); - CEX(wo5, wo6); - CEX(wo5, wo7); - CEX(wo6, wo7); - } - { - unsigned int nvof; /* Next vertex offset value */ - unsigned int vof; /* Vertex offset value */ - unsigned int vwe; /* Vertex weighting */ - - vof = 0; /* First vertex offset is 0 */ - nvof = (wo0 & 0x7fffff); /* Extract offset value */ - wo0 = (wo0 >> 23); /* Extract weighting value */ - vwe = 256 - wo0; /* Baricentric weighting */ - ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo1 & 0x7fffff); /* Extract offset value */ - wo1 = (wo1 >> 23); /* Extract weighting value */ - vwe = wo0 - wo1; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo2 & 0x7fffff); /* Extract offset value */ - wo2 = (wo2 >> 23); /* Extract weighting value */ - vwe = wo1 - wo2; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo3 & 0x7fffff); /* Extract offset value */ - wo3 = (wo3 >> 23); /* Extract weighting value */ - vwe = wo2 - wo3; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo4 & 0x7fffff); /* Extract offset value */ - wo4 = (wo4 >> 23); /* Extract weighting value */ - vwe = wo3 - wo4; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo5 & 0x7fffff); /* Extract offset value */ - wo5 = (wo5 >> 23); /* Extract weighting value */ - vwe = wo4 - wo5; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo6 & 0x7fffff); /* Extract offset value */ - wo6 = (wo6 >> 23); /* Extract weighting value */ - vwe = wo5 - wo6; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo7 & 0x7fffff); /* Extract offset value */ - wo7 = (wo7 >> 23); /* Extract weighting value */ - vwe = wo6 - wo7; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - vwe = wo7; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate 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 */ - oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */ - op0[1] = OT_E(ot1, oti); /* Write result */ - oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */ - op0[2] = OT_E(ot2, oti); /* Write result */ - oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */ - op0[3] = OT_E(ot3, oti); /* Write result */ - } - } -} -#undef IT_WO -#undef IT_IX -#undef CEX -#undef IM_O -#undef IM_FE -#undef OT_E - -static void -imdi_k70_gen( -genspec *g /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x09, 0x00, 0x00, 0x00, 0x00, 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, 0x04, 0x08, - 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08, - 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7, - 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7, - 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08, - 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00, - 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7, - 0x2c, 0xf3, 0xdc, 0xb7, 0x38, 0x5f, 0x34, 0x5f, - 0x69, 0x38, 0x5f, 0x69, 0x31, 0x36, 0x5f, 0x66, - 0x00, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00, - 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf, - 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08, - 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf, - 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x37, 0x30, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01, - 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7, - 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7, - 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08, - 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08, - 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf, - 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7, - 0x00, 0xf0, 0x04, 0x08 - }; /* Structure image */ - - memcpy(g, data, sizeof(data)); /* Initialise the structure */ -} - -static void -imdi_k70_tab( -tabspec *t /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0x34, 0x00, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x52, 0xca, 0x04, 0x08, - 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf, - 0x21, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff, - 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff - }; /* Structure image */ - - memcpy(t, data, sizeof(data)); /* Initialise the structure */ -} - -/* 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 = 5 - Output channel 0 bits = 16 - Output channel 0 increment = 5 - Output channel 1 bits = 16 - Output channel 1 increment = 5 - Output channel 2 bits = 16 - Output channel 2 increment = 5 - Output channel 3 bits = 16 - Output channel 3 increment = 5 - Output channel 4 bits = 16 - Output channel 4 increment = 5 - 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 = 255 - */ - -/* - 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 <memory.h> -#include "imdi_imp.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) * 12) - -/* Interpolation table - get vertex values */ -#define IM_FE(p, v, c) *((unsigned int *)((p) + (v) * 4 + (c) * 4)) -#define IM_PE(p, v) *((unsigned int *)((p) + 8 + (v) * 4)) - -/* Output table indexes */ -#define OT_E(p, off) *((unsigned short *)((p) + (off) * 2)) - -static void -imdi_k71( -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 short *op0 = (unsigned short *)outp[0]; - unsigned char *ep = ip0 + npix * 1 ; - pointer it0 = (pointer)p->in_tables[0]; - pointer ot0 = (pointer)p->out_tables[0]; - pointer ot1 = (pointer)p->out_tables[1]; - pointer ot2 = (pointer)p->out_tables[2]; - pointer ot3 = (pointer)p->out_tables[3]; - pointer ot4 = (pointer)p->out_tables[4]; - pointer sw_base = (pointer)p->sw_table; - pointer im_base = (pointer)p->im_table; - - for(;ip0 < ep; ip0 += 1, op0 += 5) { - unsigned int ova0; /* Output value accumulator */ - unsigned int ova1; /* Output value accumulator */ - unsigned int ova2; /* 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_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 = 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_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += 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 */ - oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */ - op0[1] = OT_E(ot1, oti); /* Write result */ - oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */ - op0[2] = OT_E(ot2, oti); /* Write result */ - oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */ - op0[3] = OT_E(ot3, oti); /* Write result */ - oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */ - op0[4] = OT_E(ot4, oti); /* Write result */ - } - } -} -#undef IT_IT -#undef SW_O -#undef SX_WO -#undef IM_O -#undef IM_FE -#undef IM_PE -#undef OT_E - -static void -imdi_k71_gen( -genspec *g /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x05, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0xff, 0x00, 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, 0x04, 0x08, - 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08, - 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7, - 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7, - 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08, - 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00, - 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7, - 0x2c, 0xf3, 0xdc, 0xb7, 0x31, 0x5f, 0x35, 0x5f, - 0x69, 0x38, 0x5f, 0x69, 0x31, 0x36, 0x5f, 0x66, - 0x00, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00, - 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf, - 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08, - 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf, - 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x37, 0x31, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01, - 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7, - 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7, - 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08, - 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08, - 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf, - 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7, - 0x00, 0xf0, 0x04, 0x08 - }; /* Structure image */ - - memcpy(g, data, sizeof(data)); /* Initialise the structure */ -} - -static void -imdi_k71_tab( -tabspec *t /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x0c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x21, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff, - 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff - }; /* Structure image */ - - memcpy(t, data, sizeof(data)); /* Initialise the structure */ -} - -/* 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 = 3 - Input channel 0 bits = 8 - Input channel 0 increment = 3 - Input channel 1 bits = 8 - Input channel 1 increment = 3 - Input channel 2 bits = 8 - Input channel 2 increment = 3 - Input is channel interleaved - Input channels are separate words - Input value extraction is done in input table lookup - - Output channels per pixel = 5 - Output channel 0 bits = 16 - Output channel 0 increment = 5 - Output channel 1 bits = 16 - Output channel 1 increment = 5 - Output channel 2 bits = 16 - Output channel 2 increment = 5 - Output channel 3 bits = 16 - Output channel 3 increment = 5 - Output channel 4 bits = 16 - Output channel 4 increment = 5 - Output is channel interleaved - - Output channels are separate words - Simplex table index bits = 12 - Interpolation table index bits = 20 - Simplex table max resolution = 16 - Interpolation table max resolution = 101 - */ - -/* - 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 <memory.h> -#include "imdi_imp.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 int *)((p) + 0 + (off) * 4)) - -/* Simplex weighting table access */ -#define SW_O(off) ((off) * 16) - -/* Simplex table - get weighting value */ -#define SX_WE(p, v) *((unsigned short *)((p) + (v) * 4 + 0)) - -/* Simplex table - get offset value */ -#define SX_VO(p, v) *((unsigned short *)((p) + (v) * 4 + 2)) - -/* Interpolation multi-dim. table access */ -#define IM_O(off) ((off) * 12) - -/* Interpolation table - get vertex values */ -#define IM_FE(p, v, c) *((unsigned int *)((p) + (v) * 4 + (c) * 4)) -#define IM_PE(p, v) *((unsigned int *)((p) + 8 + (v) * 4)) - -/* Output table indexes */ -#define OT_E(p, off) *((unsigned short *)((p) + (off) * 2)) - -static void -imdi_k72( -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 short *op0 = (unsigned short *)outp[0]; - unsigned char *ep = ip0 + npix * 3 ; - pointer it0 = (pointer)p->in_tables[0]; - pointer it1 = (pointer)p->in_tables[1]; - pointer it2 = (pointer)p->in_tables[2]; - pointer ot0 = (pointer)p->out_tables[0]; - pointer ot1 = (pointer)p->out_tables[1]; - pointer ot2 = (pointer)p->out_tables[2]; - pointer ot3 = (pointer)p->out_tables[3]; - pointer ot4 = (pointer)p->out_tables[4]; - pointer sw_base = (pointer)p->sw_table; - pointer im_base = (pointer)p->im_table; - - for(;ip0 < ep; ip0 += 3, op0 += 5) { - unsigned int ova0; /* Output value accumulator */ - unsigned int ova1; /* Output value accumulator */ - unsigned int ova2; /* Output value partial accumulator */ - { - pointer swp; - pointer imp; - { - unsigned int ti; /* Simplex+Interpolation index variable */ - - ti = IT_IT(it0, ip0[0]); - ti += IT_IT(it1, ip0[1]); - ti += IT_IT(it2, ip0[2]); - - imp = im_base + IM_O(ti >> 12); /* Extract interp. index and comp. entry */ - swp = sw_base + SW_O(ti & 0xfff); /* Extract simplex index and comp. entry */ - } - { - unsigned int vof; /* Vertex offset value */ - unsigned int vwe; /* Vertex weighting */ - - vof = SX_VO(swp, 0); /* Read vertex offset value */ - vwe = SX_WE(swp, 0); /* Read vertex weighting value */ - ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof = SX_VO(swp, 1); /* Read vertex offset value */ - vwe = SX_WE(swp, 1); /* Read vertex weighting value */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof = SX_VO(swp, 2); /* Read vertex offset value */ - vwe = SX_WE(swp, 2); /* Read vertex weighting value */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof = SX_VO(swp, 3); /* Read vertex offset value */ - vwe = SX_WE(swp, 3); /* Read vertex weighting value */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += 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 */ - oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */ - op0[1] = OT_E(ot1, oti); /* Write result */ - oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */ - op0[2] = OT_E(ot2, oti); /* Write result */ - oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */ - op0[3] = OT_E(ot3, oti); /* Write result */ - oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */ - op0[4] = OT_E(ot4, oti); /* Write result */ - } - } -} -#undef IT_IT -#undef SW_O -#undef SX_WE -#undef SX_VO -#undef IM_O -#undef IM_FE -#undef IM_PE -#undef OT_E - -static void -imdi_k72_gen( -genspec *g /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x08, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x05, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x65, 0x00, 0x00, 0x00, 0x10, 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, 0x04, 0x08, - 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08, - 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7, - 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7, - 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08, - 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00, - 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7, - 0x2c, 0xf3, 0xdc, 0xb7, 0x33, 0x5f, 0x35, 0x5f, - 0x69, 0x38, 0x5f, 0x69, 0x31, 0x36, 0x5f, 0x66, - 0x00, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00, - 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf, - 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08, - 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf, - 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x37, 0x32, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01, - 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7, - 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7, - 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08, - 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08, - 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf, - 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7, - 0x00, 0xf0, 0x04, 0x08 - }; /* Structure image */ - - memcpy(g, data, sizeof(data)); /* Initialise the structure */ -} - -static void -imdi_k72_tab( -tabspec *t /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x14, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x0c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x21, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff, - 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff - }; /* Structure image */ - - memcpy(t, data, sizeof(data)); /* Initialise the structure */ -} - -/* 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 = 4 - Input channel 0 bits = 8 - Input channel 0 increment = 4 - Input channel 1 bits = 8 - Input channel 1 increment = 4 - Input channel 2 bits = 8 - Input channel 2 increment = 4 - Input channel 3 bits = 8 - Input channel 3 increment = 4 - Input is channel interleaved - Input channels are separate words - Input value extraction is done in input table lookup - - Output channels per pixel = 5 - Output channel 0 bits = 16 - Output channel 0 increment = 5 - Output channel 1 bits = 16 - Output channel 1 increment = 5 - Output channel 2 bits = 16 - Output channel 2 increment = 5 - Output channel 3 bits = 16 - Output channel 3 increment = 5 - Output channel 4 bits = 16 - Output channel 4 increment = 5 - Output is channel interleaved - - Output channels are separate words - Simplex table index bits = 32 - Interpolation table index bits = 32 - Simplex table max resolution = 255 - Interpolation table max resolution = 27 - */ - -/* - 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 <memory.h> -#include "imdi_imp.h" -#define IMDI_INCLUDED -#endif /* IMDI_INCLUDED */ - -#ifndef DEFINED_pointer -#define DEFINED_pointer -typedef unsigned char * pointer; -#endif - -/* Input table interp. index */ -#define IT_IX(p, off) *((unsigned int *)((p) + 4 + (off) * 8)) - -/* Input table simplex index enty */ -#define IT_SX(p, off) *((unsigned int *)((p) + 0 + (off) * 8)) - -/* Simplex weighting table access */ -#define SW_O(off) ((off) * 20) - -/* Simplex table - get weighting value */ -#define SX_WE(p, v) *((unsigned short *)((p) + (v) * 4 + 0)) - -/* Simplex table - get offset value */ -#define SX_VO(p, v) *((unsigned short *)((p) + (v) * 4 + 2)) - -/* Interpolation multi-dim. table access */ -#define IM_O(off) ((off) * 12) - -/* Interpolation table - get vertex values */ -#define IM_FE(p, v, c) *((unsigned int *)((p) + (v) * 4 + (c) * 4)) -#define IM_PE(p, v) *((unsigned int *)((p) + 8 + (v) * 4)) - -/* Output table indexes */ -#define OT_E(p, off) *((unsigned short *)((p) + (off) * 2)) - -static void -imdi_k73( -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 short *op0 = (unsigned short *)outp[0]; - unsigned char *ep = ip0 + npix * 4 ; - pointer it0 = (pointer)p->in_tables[0]; - pointer it1 = (pointer)p->in_tables[1]; - pointer it2 = (pointer)p->in_tables[2]; - pointer it3 = (pointer)p->in_tables[3]; - pointer ot0 = (pointer)p->out_tables[0]; - pointer ot1 = (pointer)p->out_tables[1]; - pointer ot2 = (pointer)p->out_tables[2]; - pointer ot3 = (pointer)p->out_tables[3]; - pointer ot4 = (pointer)p->out_tables[4]; - pointer sw_base = (pointer)p->sw_table; - pointer im_base = (pointer)p->im_table; - - for(;ip0 < ep; ip0 += 4, op0 += 5) { - unsigned int ova0; /* Output value accumulator */ - unsigned int ova1; /* Output value accumulator */ - unsigned int ova2; /* Output value partial accumulator */ - { - pointer swp; - pointer imp; - { - unsigned int ti_s; /* Simplex index variable */ - unsigned int ti_i; /* Interpolation index variable */ - - ti_i = IT_IX(it0, ip0[0]); - ti_s = IT_SX(it0, ip0[0]); - ti_i += IT_IX(it1, ip0[1]); - ti_s += IT_SX(it1, ip0[1]); - ti_i += IT_IX(it2, ip0[2]); - ti_s += IT_SX(it2, ip0[2]); - ti_i += IT_IX(it3, ip0[3]); - ti_s += IT_SX(it3, ip0[3]); - - swp = sw_base + SW_O(ti_s); /* Compute simplex table entry pointer */ - imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */ - } - { - unsigned int vof; /* Vertex offset value */ - unsigned int vwe; /* Vertex weighting */ - - vof = SX_VO(swp, 0); /* Read vertex offset value */ - vwe = SX_WE(swp, 0); /* Read vertex weighting value */ - ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof = SX_VO(swp, 1); /* Read vertex offset value */ - vwe = SX_WE(swp, 1); /* Read vertex weighting value */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof = SX_VO(swp, 2); /* Read vertex offset value */ - vwe = SX_WE(swp, 2); /* Read vertex weighting value */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof = SX_VO(swp, 3); /* Read vertex offset value */ - vwe = SX_WE(swp, 3); /* Read vertex weighting value */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof = SX_VO(swp, 4); /* Read vertex offset value */ - vwe = SX_WE(swp, 4); /* Read vertex weighting value */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += 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 */ - oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */ - op0[1] = OT_E(ot1, oti); /* Write result */ - oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */ - op0[2] = OT_E(ot2, oti); /* Write result */ - oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */ - op0[3] = OT_E(ot3, oti); /* Write result */ - oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */ - op0[4] = OT_E(ot4, oti); /* Write result */ - } - } -} -#undef IT_IX -#undef IT_SX -#undef SW_O -#undef SX_WE -#undef SX_VO -#undef IM_O -#undef IM_FE -#undef IM_PE -#undef OT_E - -static void -imdi_k73_gen( -genspec *g /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x05, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x1b, 0x00, 0x00, 0x00, 0xff, 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, 0x04, 0x08, - 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08, - 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7, - 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7, - 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08, - 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00, - 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7, - 0x2c, 0xf3, 0xdc, 0xb7, 0x34, 0x5f, 0x35, 0x5f, - 0x69, 0x38, 0x5f, 0x69, 0x31, 0x36, 0x5f, 0x66, - 0x00, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00, - 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf, - 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08, - 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf, - 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x37, 0x33, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01, - 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7, - 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7, - 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08, - 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08, - 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf, - 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7, - 0x00, 0xf0, 0x04, 0x08 - }; /* Structure image */ - - memcpy(g, data, sizeof(data)); /* Initialise the structure */ -} - -static void -imdi_k73_tab( -tabspec *t /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x14, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x0c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x21, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff, - 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff - }; /* Structure image */ - - memcpy(t, data, sizeof(data)); /* Initialise the structure */ -} - -/* 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 = 5 - Input channel 0 bits = 8 - Input channel 0 increment = 5 - Input channel 1 bits = 8 - Input channel 1 increment = 5 - Input channel 2 bits = 8 - Input channel 2 increment = 5 - Input channel 3 bits = 8 - Input channel 3 increment = 5 - Input channel 4 bits = 8 - Input channel 4 increment = 5 - Input is channel interleaved - Input channels are separate words - Input value extraction is done in input table lookup - - Output channels per pixel = 5 - Output channel 0 bits = 16 - Output channel 0 increment = 5 - Output channel 1 bits = 16 - Output channel 1 increment = 5 - Output channel 2 bits = 16 - Output channel 2 increment = 5 - Output channel 3 bits = 16 - Output channel 3 increment = 5 - Output channel 4 bits = 16 - Output channel 4 increment = 5 - Output is channel interleaved - - Output channels are separate words - Weight+voffset bits = 32 - Interpolation table index bits = 32 - Interpolation table max resolution = 40 - */ - -/* - 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 <memory.h> -#include "imdi_imp.h" -#define IMDI_INCLUDED -#endif /* IMDI_INCLUDED */ - -#ifndef DEFINED_pointer -#define DEFINED_pointer -typedef unsigned char * pointer; -#endif - -/* Input table interp. index */ -#define IT_IX(p, off) *((unsigned int *)((p) + 0 + (off) * 8)) - -/* Input table input weighting/offset value enty */ -#define IT_WO(p, off) *((unsigned int *)((p) + 4 + (off) * 8)) - -/* Conditional exchange for sorting */ -#define CEX(A, B) if (A < B) { A ^= B; B ^= A; A ^= B; } - -/* Interpolation multi-dim. table access */ -#define IM_O(off) ((off) * 12) - -/* Interpolation table - get vertex values */ -#define IM_FE(p, v, c) *((unsigned int *)((p) + (v) * 4 + (c) * 4)) -#define IM_PE(p, v) *((unsigned int *)((p) + 8 + (v) * 4)) - -/* Output table indexes */ -#define OT_E(p, off) *((unsigned short *)((p) + (off) * 2)) - -static void -imdi_k74( -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 short *op0 = (unsigned short *)outp[0]; - unsigned char *ep = ip0 + npix * 5 ; - pointer it0 = (pointer)p->in_tables[0]; - pointer it1 = (pointer)p->in_tables[1]; - pointer it2 = (pointer)p->in_tables[2]; - pointer it3 = (pointer)p->in_tables[3]; - pointer it4 = (pointer)p->in_tables[4]; - pointer ot0 = (pointer)p->out_tables[0]; - pointer ot1 = (pointer)p->out_tables[1]; - pointer ot2 = (pointer)p->out_tables[2]; - pointer ot3 = (pointer)p->out_tables[3]; - pointer ot4 = (pointer)p->out_tables[4]; - pointer im_base = (pointer)p->im_table; - - for(;ip0 < ep; ip0 += 5, op0 += 5) { - unsigned int ova0; /* Output value accumulator */ - unsigned int ova1; /* Output value accumulator */ - unsigned int ova2; /* Output value partial accumulator */ - { - pointer imp; - unsigned int wo0; /* Weighting value and vertex offset variable */ - unsigned int wo1; /* Weighting value and vertex offset variable */ - unsigned int wo2; /* Weighting value and vertex offset variable */ - unsigned int wo3; /* Weighting value and vertex offset variable */ - unsigned int wo4; /* Weighting value and vertex offset variable */ - { - unsigned int ti_i; /* Interpolation index variable */ - - ti_i = IT_IX(it0, ip0[0]); - wo0 = IT_WO(it0, ip0[0]); - ti_i += IT_IX(it1, ip0[1]); - wo1 = IT_WO(it1, ip0[1]); - ti_i += IT_IX(it2, ip0[2]); - wo2 = IT_WO(it2, ip0[2]); - ti_i += IT_IX(it3, ip0[3]); - wo3 = IT_WO(it3, ip0[3]); - ti_i += IT_IX(it4, ip0[4]); - wo4 = IT_WO(it4, ip0[4]); - - imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */ - - /* Sort weighting values and vertex offset values */ - CEX(wo0, wo1); - CEX(wo0, wo2); - CEX(wo0, wo3); - CEX(wo0, wo4); - CEX(wo1, wo2); - CEX(wo1, wo3); - CEX(wo1, wo4); - CEX(wo2, wo3); - CEX(wo2, wo4); - CEX(wo3, wo4); - } - { - unsigned int nvof; /* Next vertex offset value */ - unsigned int vof; /* Vertex offset value */ - unsigned int vwe; /* Vertex weighting */ - - vof = 0; /* First vertex offset is 0 */ - nvof = (wo0 & 0x7fffff); /* Extract offset value */ - wo0 = (wo0 >> 23); /* Extract weighting value */ - vwe = 256 - wo0; /* Baricentric weighting */ - ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo1 & 0x7fffff); /* Extract offset value */ - wo1 = (wo1 >> 23); /* Extract weighting value */ - vwe = wo0 - wo1; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo2 & 0x7fffff); /* Extract offset value */ - wo2 = (wo2 >> 23); /* Extract weighting value */ - vwe = wo1 - wo2; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo3 & 0x7fffff); /* Extract offset value */ - wo3 = (wo3 >> 23); /* Extract weighting value */ - vwe = wo2 - wo3; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo4 & 0x7fffff); /* Extract offset value */ - wo4 = (wo4 >> 23); /* Extract weighting value */ - vwe = wo3 - wo4; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - vwe = wo4; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += 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 */ - oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */ - op0[1] = OT_E(ot1, oti); /* Write result */ - oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */ - op0[2] = OT_E(ot2, oti); /* Write result */ - oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */ - op0[3] = OT_E(ot3, oti); /* Write result */ - oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */ - op0[4] = OT_E(ot4, oti); /* Write result */ - } - } -} -#undef IT_WO -#undef IT_IX -#undef CEX -#undef IM_O -#undef IM_FE -#undef IM_PE -#undef OT_E - -static void -imdi_k74_gen( -genspec *g /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x08, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x05, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x28, 0x00, 0x00, 0x00, 0x00, 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, 0x04, 0x08, - 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08, - 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7, - 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7, - 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08, - 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00, - 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7, - 0x2c, 0xf3, 0xdc, 0xb7, 0x35, 0x5f, 0x35, 0x5f, - 0x69, 0x38, 0x5f, 0x69, 0x31, 0x36, 0x5f, 0x66, - 0x00, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00, - 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf, - 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08, - 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf, - 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x37, 0x34, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01, - 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7, - 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7, - 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08, - 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08, - 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf, - 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7, - 0x00, 0xf0, 0x04, 0x08 - }; /* Structure image */ - - memcpy(g, data, sizeof(data)); /* Initialise the structure */ -} - -static void -imdi_k74_tab( -tabspec *t /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x0c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x21, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff, - 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff - }; /* Structure image */ - - memcpy(t, data, sizeof(data)); /* Initialise the structure */ -} - -/* 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 = 6 - Input channel 0 bits = 8 - Input channel 0 increment = 6 - Input channel 1 bits = 8 - Input channel 1 increment = 6 - Input channel 2 bits = 8 - Input channel 2 increment = 6 - Input channel 3 bits = 8 - Input channel 3 increment = 6 - Input channel 4 bits = 8 - Input channel 4 increment = 6 - Input channel 5 bits = 8 - Input channel 5 increment = 6 - Input is channel interleaved - Input channels are separate words - Input value extraction is done in input table lookup - - Output channels per pixel = 5 - Output channel 0 bits = 16 - Output channel 0 increment = 5 - Output channel 1 bits = 16 - Output channel 1 increment = 5 - Output channel 2 bits = 16 - Output channel 2 increment = 5 - Output channel 3 bits = 16 - Output channel 3 increment = 5 - Output channel 4 bits = 16 - Output channel 4 increment = 5 - Output is channel interleaved - - Output channels are separate words - Weight+voffset bits = 32 - Interpolation table index bits = 32 - Interpolation table max resolution = 19 - */ - -/* - 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 <memory.h> -#include "imdi_imp.h" -#define IMDI_INCLUDED -#endif /* IMDI_INCLUDED */ - -#ifndef DEFINED_pointer -#define DEFINED_pointer -typedef unsigned char * pointer; -#endif - -/* Input table interp. index */ -#define IT_IX(p, off) *((unsigned int *)((p) + 0 + (off) * 8)) - -/* Input table input weighting/offset value enty */ -#define IT_WO(p, off) *((unsigned int *)((p) + 4 + (off) * 8)) - -/* Conditional exchange for sorting */ -#define CEX(A, B) if (A < B) { A ^= B; B ^= A; A ^= B; } - -/* Interpolation multi-dim. table access */ -#define IM_O(off) ((off) * 12) - -/* Interpolation table - get vertex values */ -#define IM_FE(p, v, c) *((unsigned int *)((p) + (v) * 4 + (c) * 4)) -#define IM_PE(p, v) *((unsigned int *)((p) + 8 + (v) * 4)) - -/* Output table indexes */ -#define OT_E(p, off) *((unsigned short *)((p) + (off) * 2)) - -static void -imdi_k75( -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 short *op0 = (unsigned short *)outp[0]; - unsigned char *ep = ip0 + npix * 6 ; - pointer it0 = (pointer)p->in_tables[0]; - pointer it1 = (pointer)p->in_tables[1]; - pointer it2 = (pointer)p->in_tables[2]; - pointer it3 = (pointer)p->in_tables[3]; - pointer it4 = (pointer)p->in_tables[4]; - pointer it5 = (pointer)p->in_tables[5]; - pointer ot0 = (pointer)p->out_tables[0]; - pointer ot1 = (pointer)p->out_tables[1]; - pointer ot2 = (pointer)p->out_tables[2]; - pointer ot3 = (pointer)p->out_tables[3]; - pointer ot4 = (pointer)p->out_tables[4]; - pointer im_base = (pointer)p->im_table; - - for(;ip0 < ep; ip0 += 6, op0 += 5) { - unsigned int ova0; /* Output value accumulator */ - unsigned int ova1; /* Output value accumulator */ - unsigned int ova2; /* Output value partial accumulator */ - { - pointer imp; - unsigned int wo0; /* Weighting value and vertex offset variable */ - unsigned int wo1; /* Weighting value and vertex offset variable */ - unsigned int wo2; /* Weighting value and vertex offset variable */ - unsigned int wo3; /* Weighting value and vertex offset variable */ - unsigned int wo4; /* Weighting value and vertex offset variable */ - unsigned int wo5; /* Weighting value and vertex offset variable */ - { - unsigned int ti_i; /* Interpolation index variable */ - - ti_i = IT_IX(it0, ip0[0]); - wo0 = IT_WO(it0, ip0[0]); - ti_i += IT_IX(it1, ip0[1]); - wo1 = IT_WO(it1, ip0[1]); - ti_i += IT_IX(it2, ip0[2]); - wo2 = IT_WO(it2, ip0[2]); - ti_i += IT_IX(it3, ip0[3]); - wo3 = IT_WO(it3, ip0[3]); - ti_i += IT_IX(it4, ip0[4]); - wo4 = IT_WO(it4, ip0[4]); - ti_i += IT_IX(it5, ip0[5]); - wo5 = IT_WO(it5, ip0[5]); - - imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */ - - /* Sort weighting values and vertex offset values */ - CEX(wo0, wo1); - CEX(wo0, wo2); - CEX(wo0, wo3); - CEX(wo0, wo4); - CEX(wo0, wo5); - CEX(wo1, wo2); - CEX(wo1, wo3); - CEX(wo1, wo4); - CEX(wo1, wo5); - CEX(wo2, wo3); - CEX(wo2, wo4); - CEX(wo2, wo5); - CEX(wo3, wo4); - CEX(wo3, wo5); - CEX(wo4, wo5); - } - { - unsigned int nvof; /* Next vertex offset value */ - unsigned int vof; /* Vertex offset value */ - unsigned int vwe; /* Vertex weighting */ - - vof = 0; /* First vertex offset is 0 */ - nvof = (wo0 & 0x7fffff); /* Extract offset value */ - wo0 = (wo0 >> 23); /* Extract weighting value */ - vwe = 256 - wo0; /* Baricentric weighting */ - ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo1 & 0x7fffff); /* Extract offset value */ - wo1 = (wo1 >> 23); /* Extract weighting value */ - vwe = wo0 - wo1; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo2 & 0x7fffff); /* Extract offset value */ - wo2 = (wo2 >> 23); /* Extract weighting value */ - vwe = wo1 - wo2; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo3 & 0x7fffff); /* Extract offset value */ - wo3 = (wo3 >> 23); /* Extract weighting value */ - vwe = wo2 - wo3; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo4 & 0x7fffff); /* Extract offset value */ - wo4 = (wo4 >> 23); /* Extract weighting value */ - vwe = wo3 - wo4; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo5 & 0x7fffff); /* Extract offset value */ - wo5 = (wo5 >> 23); /* Extract weighting value */ - vwe = wo4 - wo5; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - vwe = wo5; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += 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 */ - oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */ - op0[1] = OT_E(ot1, oti); /* Write result */ - oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */ - op0[2] = OT_E(ot2, oti); /* Write result */ - oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */ - op0[3] = OT_E(ot3, oti); /* Write result */ - oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */ - op0[4] = OT_E(ot4, oti); /* Write result */ - } - } -} -#undef IT_WO -#undef IT_IX -#undef CEX -#undef IM_O -#undef IM_FE -#undef IM_PE -#undef OT_E - -static void -imdi_k75_gen( -genspec *g /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x08, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x05, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x13, 0x00, 0x00, 0x00, 0x00, 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, 0x04, 0x08, - 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08, - 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7, - 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7, - 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08, - 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00, - 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7, - 0x2c, 0xf3, 0xdc, 0xb7, 0x36, 0x5f, 0x35, 0x5f, - 0x69, 0x38, 0x5f, 0x69, 0x31, 0x36, 0x5f, 0x66, - 0x00, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00, - 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf, - 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08, - 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf, - 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x37, 0x35, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01, - 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7, - 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7, - 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08, - 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08, - 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf, - 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7, - 0x00, 0xf0, 0x04, 0x08 - }; /* Structure image */ - - memcpy(g, data, sizeof(data)); /* Initialise the structure */ -} - -static void -imdi_k75_tab( -tabspec *t /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x0c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x21, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff, - 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff - }; /* Structure image */ - - memcpy(t, data, sizeof(data)); /* Initialise the structure */ -} - -/* 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 = 7 - Input channel 0 bits = 8 - Input channel 0 increment = 7 - Input channel 1 bits = 8 - Input channel 1 increment = 7 - Input channel 2 bits = 8 - Input channel 2 increment = 7 - Input channel 3 bits = 8 - Input channel 3 increment = 7 - Input channel 4 bits = 8 - Input channel 4 increment = 7 - Input channel 5 bits = 8 - Input channel 5 increment = 7 - Input channel 6 bits = 8 - Input channel 6 increment = 7 - Input is channel interleaved - Input channels are separate words - Input value extraction is done in input table lookup - - Output channels per pixel = 5 - Output channel 0 bits = 16 - Output channel 0 increment = 5 - Output channel 1 bits = 16 - Output channel 1 increment = 5 - Output channel 2 bits = 16 - Output channel 2 increment = 5 - Output channel 3 bits = 16 - Output channel 3 increment = 5 - Output channel 4 bits = 16 - Output channel 4 increment = 5 - Output is channel interleaved - - Output channels are separate words - Weight+voffset bits = 32 - Interpolation table index bits = 32 - Interpolation table max resolution = 11 - */ - -/* - 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 <memory.h> -#include "imdi_imp.h" -#define IMDI_INCLUDED -#endif /* IMDI_INCLUDED */ - -#ifndef DEFINED_pointer -#define DEFINED_pointer -typedef unsigned char * pointer; -#endif - -/* Input table interp. index */ -#define IT_IX(p, off) *((unsigned int *)((p) + 0 + (off) * 8)) - -/* Input table input weighting/offset value enty */ -#define IT_WO(p, off) *((unsigned int *)((p) + 4 + (off) * 8)) - -/* Conditional exchange for sorting */ -#define CEX(A, B) if (A < B) { A ^= B; B ^= A; A ^= B; } - -/* Interpolation multi-dim. table access */ -#define IM_O(off) ((off) * 12) - -/* Interpolation table - get vertex values */ -#define IM_FE(p, v, c) *((unsigned int *)((p) + (v) * 4 + (c) * 4)) -#define IM_PE(p, v) *((unsigned int *)((p) + 8 + (v) * 4)) - -/* Output table indexes */ -#define OT_E(p, off) *((unsigned short *)((p) + (off) * 2)) - -static void -imdi_k76( -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 short *op0 = (unsigned short *)outp[0]; - unsigned char *ep = ip0 + npix * 7 ; - pointer it0 = (pointer)p->in_tables[0]; - pointer it1 = (pointer)p->in_tables[1]; - pointer it2 = (pointer)p->in_tables[2]; - pointer it3 = (pointer)p->in_tables[3]; - pointer it4 = (pointer)p->in_tables[4]; - pointer it5 = (pointer)p->in_tables[5]; - pointer it6 = (pointer)p->in_tables[6]; - pointer ot0 = (pointer)p->out_tables[0]; - pointer ot1 = (pointer)p->out_tables[1]; - pointer ot2 = (pointer)p->out_tables[2]; - pointer ot3 = (pointer)p->out_tables[3]; - pointer ot4 = (pointer)p->out_tables[4]; - pointer im_base = (pointer)p->im_table; - - for(;ip0 < ep; ip0 += 7, op0 += 5) { - unsigned int ova0; /* Output value accumulator */ - unsigned int ova1; /* Output value accumulator */ - unsigned int ova2; /* Output value partial accumulator */ - { - pointer imp; - unsigned int wo0; /* Weighting value and vertex offset variable */ - unsigned int wo1; /* Weighting value and vertex offset variable */ - unsigned int wo2; /* Weighting value and vertex offset variable */ - unsigned int wo3; /* Weighting value and vertex offset variable */ - unsigned int wo4; /* Weighting value and vertex offset variable */ - unsigned int wo5; /* Weighting value and vertex offset variable */ - unsigned int wo6; /* Weighting value and vertex offset variable */ - { - unsigned int ti_i; /* Interpolation index variable */ - - ti_i = IT_IX(it0, ip0[0]); - wo0 = IT_WO(it0, ip0[0]); - ti_i += IT_IX(it1, ip0[1]); - wo1 = IT_WO(it1, ip0[1]); - ti_i += IT_IX(it2, ip0[2]); - wo2 = IT_WO(it2, ip0[2]); - ti_i += IT_IX(it3, ip0[3]); - wo3 = IT_WO(it3, ip0[3]); - ti_i += IT_IX(it4, ip0[4]); - wo4 = IT_WO(it4, ip0[4]); - ti_i += IT_IX(it5, ip0[5]); - wo5 = IT_WO(it5, ip0[5]); - ti_i += IT_IX(it6, ip0[6]); - wo6 = IT_WO(it6, ip0[6]); - - imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */ - - /* Sort weighting values and vertex offset values */ - CEX(wo0, wo1); - CEX(wo0, wo2); - CEX(wo0, wo3); - CEX(wo0, wo4); - CEX(wo0, wo5); - CEX(wo0, wo6); - CEX(wo1, wo2); - CEX(wo1, wo3); - CEX(wo1, wo4); - CEX(wo1, wo5); - CEX(wo1, wo6); - CEX(wo2, wo3); - CEX(wo2, wo4); - CEX(wo2, wo5); - CEX(wo2, wo6); - CEX(wo3, wo4); - CEX(wo3, wo5); - CEX(wo3, wo6); - CEX(wo4, wo5); - CEX(wo4, wo6); - CEX(wo5, wo6); - } - { - unsigned int nvof; /* Next vertex offset value */ - unsigned int vof; /* Vertex offset value */ - unsigned int vwe; /* Vertex weighting */ - - vof = 0; /* First vertex offset is 0 */ - nvof = (wo0 & 0x7fffff); /* Extract offset value */ - wo0 = (wo0 >> 23); /* Extract weighting value */ - vwe = 256 - wo0; /* Baricentric weighting */ - ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo1 & 0x7fffff); /* Extract offset value */ - wo1 = (wo1 >> 23); /* Extract weighting value */ - vwe = wo0 - wo1; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo2 & 0x7fffff); /* Extract offset value */ - wo2 = (wo2 >> 23); /* Extract weighting value */ - vwe = wo1 - wo2; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo3 & 0x7fffff); /* Extract offset value */ - wo3 = (wo3 >> 23); /* Extract weighting value */ - vwe = wo2 - wo3; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo4 & 0x7fffff); /* Extract offset value */ - wo4 = (wo4 >> 23); /* Extract weighting value */ - vwe = wo3 - wo4; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo5 & 0x7fffff); /* Extract offset value */ - wo5 = (wo5 >> 23); /* Extract weighting value */ - vwe = wo4 - wo5; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo6 & 0x7fffff); /* Extract offset value */ - wo6 = (wo6 >> 23); /* Extract weighting value */ - vwe = wo5 - wo6; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - vwe = wo6; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += 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 */ - oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */ - op0[1] = OT_E(ot1, oti); /* Write result */ - oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */ - op0[2] = OT_E(ot2, oti); /* Write result */ - oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */ - op0[3] = OT_E(ot3, oti); /* Write result */ - oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */ - op0[4] = OT_E(ot4, oti); /* Write result */ - } - } -} -#undef IT_WO -#undef IT_IX -#undef CEX -#undef IM_O -#undef IM_FE -#undef IM_PE -#undef OT_E - -static void -imdi_k76_gen( -genspec *g /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x05, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x0b, 0x00, 0x00, 0x00, 0x00, 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, 0x04, 0x08, - 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08, - 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7, - 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7, - 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08, - 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00, - 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7, - 0x2c, 0xf3, 0xdc, 0xb7, 0x37, 0x5f, 0x35, 0x5f, - 0x69, 0x38, 0x5f, 0x69, 0x31, 0x36, 0x5f, 0x66, - 0x00, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00, - 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf, - 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08, - 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf, - 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x37, 0x36, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01, - 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7, - 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7, - 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08, - 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08, - 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf, - 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7, - 0x00, 0xf0, 0x04, 0x08 - }; /* Structure image */ - - memcpy(g, data, sizeof(data)); /* Initialise the structure */ -} - -static void -imdi_k76_tab( -tabspec *t /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x0c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x21, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff, - 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff - }; /* Structure image */ - - memcpy(t, data, sizeof(data)); /* Initialise the structure */ -} - -/* 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 = 8 - Input channel 0 bits = 8 - Input channel 0 increment = 8 - Input channel 1 bits = 8 - Input channel 1 increment = 8 - Input channel 2 bits = 8 - Input channel 2 increment = 8 - Input channel 3 bits = 8 - Input channel 3 increment = 8 - Input channel 4 bits = 8 - Input channel 4 increment = 8 - Input channel 5 bits = 8 - Input channel 5 increment = 8 - Input channel 6 bits = 8 - Input channel 6 increment = 8 - Input channel 7 bits = 8 - Input channel 7 increment = 8 - Input is channel interleaved - Input channels are separate words - Input value extraction is done in input table lookup - - Output channels per pixel = 5 - Output channel 0 bits = 16 - Output channel 0 increment = 5 - Output channel 1 bits = 16 - Output channel 1 increment = 5 - Output channel 2 bits = 16 - Output channel 2 increment = 5 - Output channel 3 bits = 16 - Output channel 3 increment = 5 - Output channel 4 bits = 16 - Output channel 4 increment = 5 - Output is channel interleaved - - Output channels are separate words - Weight+voffset bits = 32 - Interpolation table index bits = 32 - Interpolation table max resolution = 8 - */ - -/* - 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 <memory.h> -#include "imdi_imp.h" -#define IMDI_INCLUDED -#endif /* IMDI_INCLUDED */ - -#ifndef DEFINED_pointer -#define DEFINED_pointer -typedef unsigned char * pointer; -#endif - -/* Input table interp. index */ -#define IT_IX(p, off) *((unsigned int *)((p) + 0 + (off) * 8)) - -/* Input table input weighting/offset value enty */ -#define IT_WO(p, off) *((unsigned int *)((p) + 4 + (off) * 8)) - -/* Conditional exchange for sorting */ -#define CEX(A, B) if (A < B) { A ^= B; B ^= A; A ^= B; } - -/* Interpolation multi-dim. table access */ -#define IM_O(off) ((off) * 12) - -/* Interpolation table - get vertex values */ -#define IM_FE(p, v, c) *((unsigned int *)((p) + (v) * 4 + (c) * 4)) -#define IM_PE(p, v) *((unsigned int *)((p) + 8 + (v) * 4)) - -/* Output table indexes */ -#define OT_E(p, off) *((unsigned short *)((p) + (off) * 2)) - -static void -imdi_k77( -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 short *op0 = (unsigned short *)outp[0]; - unsigned char *ep = ip0 + npix * 8 ; - pointer it0 = (pointer)p->in_tables[0]; - pointer it1 = (pointer)p->in_tables[1]; - pointer it2 = (pointer)p->in_tables[2]; - pointer it3 = (pointer)p->in_tables[3]; - pointer it4 = (pointer)p->in_tables[4]; - pointer it5 = (pointer)p->in_tables[5]; - pointer it6 = (pointer)p->in_tables[6]; - pointer it7 = (pointer)p->in_tables[7]; - pointer ot0 = (pointer)p->out_tables[0]; - pointer ot1 = (pointer)p->out_tables[1]; - pointer ot2 = (pointer)p->out_tables[2]; - pointer ot3 = (pointer)p->out_tables[3]; - pointer ot4 = (pointer)p->out_tables[4]; - pointer im_base = (pointer)p->im_table; - - for(;ip0 < ep; ip0 += 8, op0 += 5) { - unsigned int ova0; /* Output value accumulator */ - unsigned int ova1; /* Output value accumulator */ - unsigned int ova2; /* Output value partial accumulator */ - { - pointer imp; - unsigned int wo0; /* Weighting value and vertex offset variable */ - unsigned int wo1; /* Weighting value and vertex offset variable */ - unsigned int wo2; /* Weighting value and vertex offset variable */ - unsigned int wo3; /* Weighting value and vertex offset variable */ - unsigned int wo4; /* Weighting value and vertex offset variable */ - unsigned int wo5; /* Weighting value and vertex offset variable */ - unsigned int wo6; /* Weighting value and vertex offset variable */ - unsigned int wo7; /* Weighting value and vertex offset variable */ - { - unsigned int ti_i; /* Interpolation index variable */ - - ti_i = IT_IX(it0, ip0[0]); - wo0 = IT_WO(it0, ip0[0]); - ti_i += IT_IX(it1, ip0[1]); - wo1 = IT_WO(it1, ip0[1]); - ti_i += IT_IX(it2, ip0[2]); - wo2 = IT_WO(it2, ip0[2]); - ti_i += IT_IX(it3, ip0[3]); - wo3 = IT_WO(it3, ip0[3]); - ti_i += IT_IX(it4, ip0[4]); - wo4 = IT_WO(it4, ip0[4]); - ti_i += IT_IX(it5, ip0[5]); - wo5 = IT_WO(it5, ip0[5]); - ti_i += IT_IX(it6, ip0[6]); - wo6 = IT_WO(it6, ip0[6]); - ti_i += IT_IX(it7, ip0[7]); - wo7 = IT_WO(it7, ip0[7]); - - imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */ - - /* Sort weighting values and vertex offset values */ - CEX(wo0, wo1); - CEX(wo0, wo2); - CEX(wo0, wo3); - CEX(wo0, wo4); - CEX(wo0, wo5); - CEX(wo0, wo6); - CEX(wo0, wo7); - CEX(wo1, wo2); - CEX(wo1, wo3); - CEX(wo1, wo4); - CEX(wo1, wo5); - CEX(wo1, wo6); - CEX(wo1, wo7); - CEX(wo2, wo3); - CEX(wo2, wo4); - CEX(wo2, wo5); - CEX(wo2, wo6); - CEX(wo2, wo7); - CEX(wo3, wo4); - CEX(wo3, wo5); - CEX(wo3, wo6); - CEX(wo3, wo7); - CEX(wo4, wo5); - CEX(wo4, wo6); - CEX(wo4, wo7); - CEX(wo5, wo6); - CEX(wo5, wo7); - CEX(wo6, wo7); - } - { - unsigned int nvof; /* Next vertex offset value */ - unsigned int vof; /* Vertex offset value */ - unsigned int vwe; /* Vertex weighting */ - - vof = 0; /* First vertex offset is 0 */ - nvof = (wo0 & 0x7fffff); /* Extract offset value */ - wo0 = (wo0 >> 23); /* Extract weighting value */ - vwe = 256 - wo0; /* Baricentric weighting */ - ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo1 & 0x7fffff); /* Extract offset value */ - wo1 = (wo1 >> 23); /* Extract weighting value */ - vwe = wo0 - wo1; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo2 & 0x7fffff); /* Extract offset value */ - wo2 = (wo2 >> 23); /* Extract weighting value */ - vwe = wo1 - wo2; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo3 & 0x7fffff); /* Extract offset value */ - wo3 = (wo3 >> 23); /* Extract weighting value */ - vwe = wo2 - wo3; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo4 & 0x7fffff); /* Extract offset value */ - wo4 = (wo4 >> 23); /* Extract weighting value */ - vwe = wo3 - wo4; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo5 & 0x7fffff); /* Extract offset value */ - wo5 = (wo5 >> 23); /* Extract weighting value */ - vwe = wo4 - wo5; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo6 & 0x7fffff); /* Extract offset value */ - wo6 = (wo6 >> 23); /* Extract weighting value */ - vwe = wo5 - wo6; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo7 & 0x7fffff); /* Extract offset value */ - wo7 = (wo7 >> 23); /* Extract weighting value */ - vwe = wo6 - wo7; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - vwe = wo7; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += 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 */ - oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */ - op0[1] = OT_E(ot1, oti); /* Write result */ - oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */ - op0[2] = OT_E(ot2, oti); /* Write result */ - oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */ - op0[3] = OT_E(ot3, oti); /* Write result */ - oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */ - op0[4] = OT_E(ot4, oti); /* Write result */ - } - } -} -#undef IT_WO -#undef IT_IX -#undef CEX -#undef IM_O -#undef IM_FE -#undef IM_PE -#undef OT_E - -static void -imdi_k77_gen( -genspec *g /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x05, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 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, 0x04, 0x08, - 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08, - 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7, - 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7, - 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08, - 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00, - 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7, - 0x2c, 0xf3, 0xdc, 0xb7, 0x38, 0x5f, 0x35, 0x5f, - 0x69, 0x38, 0x5f, 0x69, 0x31, 0x36, 0x5f, 0x66, - 0x00, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00, - 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf, - 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08, - 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf, - 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x37, 0x37, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01, - 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7, - 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7, - 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08, - 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08, - 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf, - 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7, - 0x00, 0xf0, 0x04, 0x08 - }; /* Structure image */ - - memcpy(g, data, sizeof(data)); /* Initialise the structure */ -} - -static void -imdi_k77_tab( -tabspec *t /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x0c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x21, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff, - 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff - }; /* Structure image */ - - memcpy(t, data, sizeof(data)); /* Initialise the structure */ -} - -/* 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 = 6 - Output channel 0 bits = 16 - Output channel 0 increment = 6 - Output channel 1 bits = 16 - Output channel 1 increment = 6 - Output channel 2 bits = 16 - Output channel 2 increment = 6 - Output channel 3 bits = 16 - Output channel 3 increment = 6 - Output channel 4 bits = 16 - Output channel 4 increment = 6 - Output channel 5 bits = 16 - Output channel 5 increment = 6 - 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 = 255 - */ - -/* - 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 <memory.h> -#include "imdi_imp.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) * 12) - -/* Interpolation table - get vertex values */ -#define IM_FE(p, v, c) *((unsigned int *)((p) + (v) * 4 + (c) * 4)) - -/* Output table indexes */ -#define OT_E(p, off) *((unsigned short *)((p) + (off) * 2)) - -static void -imdi_k78( -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 short *op0 = (unsigned short *)outp[0]; - unsigned char *ep = ip0 + npix * 1 ; - pointer it0 = (pointer)p->in_tables[0]; - pointer ot0 = (pointer)p->out_tables[0]; - pointer ot1 = (pointer)p->out_tables[1]; - pointer ot2 = (pointer)p->out_tables[2]; - pointer ot3 = (pointer)p->out_tables[3]; - pointer ot4 = (pointer)p->out_tables[4]; - pointer ot5 = (pointer)p->out_tables[5]; - pointer sw_base = (pointer)p->sw_table; - pointer im_base = (pointer)p->im_table; - - for(;ip0 < ep; ip0 += 1, op0 += 6) { - unsigned int ova0; /* Output value accumulator */ - unsigned int ova1; /* Output value accumulator */ - unsigned int ova2; /* Output value 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_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate 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_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate 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 */ - oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */ - op0[1] = OT_E(ot1, oti); /* Write result */ - oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */ - op0[2] = OT_E(ot2, oti); /* Write result */ - oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */ - op0[3] = OT_E(ot3, oti); /* Write result */ - oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */ - op0[4] = OT_E(ot4, oti); /* Write result */ - oti = ((ova2 >> 24) & 0xff); /* Extract integer part of result */ - op0[5] = OT_E(ot5, oti); /* Write result */ - } - } -} -#undef IT_IT -#undef SW_O -#undef SX_WO -#undef IM_O -#undef IM_FE -#undef OT_E - -static void -imdi_k78_gen( -genspec *g /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0xff, 0x00, 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, 0x04, 0x08, - 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08, - 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7, - 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7, - 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08, - 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00, - 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7, - 0x2c, 0xf3, 0xdc, 0xb7, 0x31, 0x5f, 0x36, 0x5f, - 0x69, 0x38, 0x5f, 0x69, 0x31, 0x36, 0x5f, 0x66, - 0x00, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00, - 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf, - 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08, - 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf, - 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x37, 0x38, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01, - 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7, - 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7, - 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08, - 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08, - 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf, - 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7, - 0x00, 0xf0, 0x04, 0x08 - }; /* Structure image */ - - memcpy(g, data, sizeof(data)); /* Initialise the structure */ -} - -static void -imdi_k78_tab( -tabspec *t /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x0c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, - 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff - }; /* Structure image */ - - memcpy(t, data, sizeof(data)); /* Initialise the structure */ -} - -/* 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 = 3 - Input channel 0 bits = 8 - Input channel 0 increment = 3 - Input channel 1 bits = 8 - Input channel 1 increment = 3 - Input channel 2 bits = 8 - Input channel 2 increment = 3 - Input is channel interleaved - Input channels are separate words - Input value extraction is done in input table lookup - - Output channels per pixel = 6 - Output channel 0 bits = 16 - Output channel 0 increment = 6 - Output channel 1 bits = 16 - Output channel 1 increment = 6 - Output channel 2 bits = 16 - Output channel 2 increment = 6 - Output channel 3 bits = 16 - Output channel 3 increment = 6 - Output channel 4 bits = 16 - Output channel 4 increment = 6 - Output channel 5 bits = 16 - Output channel 5 increment = 6 - Output is channel interleaved - - Output channels are separate words - Simplex table index bits = 12 - Interpolation table index bits = 20 - Simplex table max resolution = 16 - Interpolation table max resolution = 101 - */ - -/* - 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 <memory.h> -#include "imdi_imp.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 int *)((p) + 0 + (off) * 4)) - -/* Simplex weighting table access */ -#define SW_O(off) ((off) * 16) - -/* Simplex table - get weighting value */ -#define SX_WE(p, v) *((unsigned short *)((p) + (v) * 4 + 0)) - -/* Simplex table - get offset value */ -#define SX_VO(p, v) *((unsigned short *)((p) + (v) * 4 + 2)) - -/* Interpolation multi-dim. table access */ -#define IM_O(off) ((off) * 12) - -/* Interpolation table - get vertex values */ -#define IM_FE(p, v, c) *((unsigned int *)((p) + (v) * 4 + (c) * 4)) - -/* Output table indexes */ -#define OT_E(p, off) *((unsigned short *)((p) + (off) * 2)) - -static void -imdi_k79( -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 short *op0 = (unsigned short *)outp[0]; - unsigned char *ep = ip0 + npix * 3 ; - pointer it0 = (pointer)p->in_tables[0]; - pointer it1 = (pointer)p->in_tables[1]; - pointer it2 = (pointer)p->in_tables[2]; - pointer ot0 = (pointer)p->out_tables[0]; - pointer ot1 = (pointer)p->out_tables[1]; - pointer ot2 = (pointer)p->out_tables[2]; - pointer ot3 = (pointer)p->out_tables[3]; - pointer ot4 = (pointer)p->out_tables[4]; - pointer ot5 = (pointer)p->out_tables[5]; - pointer sw_base = (pointer)p->sw_table; - pointer im_base = (pointer)p->im_table; - - for(;ip0 < ep; ip0 += 3, op0 += 6) { - unsigned int ova0; /* Output value accumulator */ - unsigned int ova1; /* Output value accumulator */ - unsigned int ova2; /* Output value accumulator */ - { - pointer swp; - pointer imp; - { - unsigned int ti; /* Simplex+Interpolation index variable */ - - ti = IT_IT(it0, ip0[0]); - ti += IT_IT(it1, ip0[1]); - ti += IT_IT(it2, ip0[2]); - - imp = im_base + IM_O(ti >> 12); /* Extract interp. index and comp. entry */ - swp = sw_base + SW_O(ti & 0xfff); /* Extract simplex index and comp. entry */ - } - { - unsigned int vof; /* Vertex offset value */ - unsigned int vwe; /* Vertex weighting */ - - vof = SX_VO(swp, 0); /* Read vertex offset value */ - vwe = SX_WE(swp, 0); /* Read vertex weighting value */ - ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - vof = SX_VO(swp, 1); /* Read vertex offset value */ - vwe = SX_WE(swp, 1); /* Read vertex weighting value */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - vof = SX_VO(swp, 2); /* Read vertex offset value */ - vwe = SX_WE(swp, 2); /* Read vertex weighting value */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - vof = SX_VO(swp, 3); /* Read vertex offset value */ - vwe = SX_WE(swp, 3); /* Read vertex weighting value */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate 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 */ - oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */ - op0[1] = OT_E(ot1, oti); /* Write result */ - oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */ - op0[2] = OT_E(ot2, oti); /* Write result */ - oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */ - op0[3] = OT_E(ot3, oti); /* Write result */ - oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */ - op0[4] = OT_E(ot4, oti); /* Write result */ - oti = ((ova2 >> 24) & 0xff); /* Extract integer part of result */ - op0[5] = OT_E(ot5, oti); /* Write result */ - } - } -} -#undef IT_IT -#undef SW_O -#undef SX_WE -#undef SX_VO -#undef IM_O -#undef IM_FE -#undef OT_E - -static void -imdi_k79_gen( -genspec *g /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x08, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x65, 0x00, 0x00, 0x00, 0x10, 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, 0x04, 0x08, - 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08, - 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7, - 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7, - 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08, - 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00, - 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7, - 0x2c, 0xf3, 0xdc, 0xb7, 0x33, 0x5f, 0x36, 0x5f, - 0x69, 0x38, 0x5f, 0x69, 0x31, 0x36, 0x5f, 0x66, - 0x00, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00, - 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf, - 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08, - 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf, - 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x37, 0x39, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01, - 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7, - 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7, - 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08, - 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08, - 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf, - 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7, - 0x00, 0xf0, 0x04, 0x08 - }; /* Structure image */ - - memcpy(g, data, sizeof(data)); /* Initialise the structure */ -} - -static void -imdi_k79_tab( -tabspec *t /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x14, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x0c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, - 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff - }; /* Structure image */ - - memcpy(t, data, sizeof(data)); /* Initialise the structure */ -} - -/* 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 = 4 - Input channel 0 bits = 8 - Input channel 0 increment = 4 - Input channel 1 bits = 8 - Input channel 1 increment = 4 - Input channel 2 bits = 8 - Input channel 2 increment = 4 - Input channel 3 bits = 8 - Input channel 3 increment = 4 - Input is channel interleaved - Input channels are separate words - Input value extraction is done in input table lookup - - Output channels per pixel = 6 - Output channel 0 bits = 16 - Output channel 0 increment = 6 - Output channel 1 bits = 16 - Output channel 1 increment = 6 - Output channel 2 bits = 16 - Output channel 2 increment = 6 - Output channel 3 bits = 16 - Output channel 3 increment = 6 - Output channel 4 bits = 16 - Output channel 4 increment = 6 - Output channel 5 bits = 16 - Output channel 5 increment = 6 - Output is channel interleaved - - Output channels are separate words - Simplex table index bits = 32 - Interpolation table index bits = 32 - Simplex table max resolution = 255 - Interpolation table max resolution = 27 - */ - -/* - 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 <memory.h> -#include "imdi_imp.h" -#define IMDI_INCLUDED -#endif /* IMDI_INCLUDED */ - -#ifndef DEFINED_pointer -#define DEFINED_pointer -typedef unsigned char * pointer; -#endif - -/* Input table interp. index */ -#define IT_IX(p, off) *((unsigned int *)((p) + 4 + (off) * 8)) - -/* Input table simplex index enty */ -#define IT_SX(p, off) *((unsigned int *)((p) + 0 + (off) * 8)) - -/* Simplex weighting table access */ -#define SW_O(off) ((off) * 20) - -/* Simplex table - get weighting value */ -#define SX_WE(p, v) *((unsigned short *)((p) + (v) * 4 + 0)) - -/* Simplex table - get offset value */ -#define SX_VO(p, v) *((unsigned short *)((p) + (v) * 4 + 2)) - -/* Interpolation multi-dim. table access */ -#define IM_O(off) ((off) * 12) - -/* Interpolation table - get vertex values */ -#define IM_FE(p, v, c) *((unsigned int *)((p) + (v) * 4 + (c) * 4)) - -/* Output table indexes */ -#define OT_E(p, off) *((unsigned short *)((p) + (off) * 2)) - -static void -imdi_k80( -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 short *op0 = (unsigned short *)outp[0]; - unsigned char *ep = ip0 + npix * 4 ; - pointer it0 = (pointer)p->in_tables[0]; - pointer it1 = (pointer)p->in_tables[1]; - pointer it2 = (pointer)p->in_tables[2]; - pointer it3 = (pointer)p->in_tables[3]; - pointer ot0 = (pointer)p->out_tables[0]; - pointer ot1 = (pointer)p->out_tables[1]; - pointer ot2 = (pointer)p->out_tables[2]; - pointer ot3 = (pointer)p->out_tables[3]; - pointer ot4 = (pointer)p->out_tables[4]; - pointer ot5 = (pointer)p->out_tables[5]; - pointer sw_base = (pointer)p->sw_table; - pointer im_base = (pointer)p->im_table; - - for(;ip0 < ep; ip0 += 4, op0 += 6) { - unsigned int ova0; /* Output value accumulator */ - unsigned int ova1; /* Output value accumulator */ - unsigned int ova2; /* Output value accumulator */ - { - pointer swp; - pointer imp; - { - unsigned int ti_s; /* Simplex index variable */ - unsigned int ti_i; /* Interpolation index variable */ - - ti_i = IT_IX(it0, ip0[0]); - ti_s = IT_SX(it0, ip0[0]); - ti_i += IT_IX(it1, ip0[1]); - ti_s += IT_SX(it1, ip0[1]); - ti_i += IT_IX(it2, ip0[2]); - ti_s += IT_SX(it2, ip0[2]); - ti_i += IT_IX(it3, ip0[3]); - ti_s += IT_SX(it3, ip0[3]); - - swp = sw_base + SW_O(ti_s); /* Compute simplex table entry pointer */ - imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */ - } - { - unsigned int vof; /* Vertex offset value */ - unsigned int vwe; /* Vertex weighting */ - - vof = SX_VO(swp, 0); /* Read vertex offset value */ - vwe = SX_WE(swp, 0); /* Read vertex weighting value */ - ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - vof = SX_VO(swp, 1); /* Read vertex offset value */ - vwe = SX_WE(swp, 1); /* Read vertex weighting value */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - vof = SX_VO(swp, 2); /* Read vertex offset value */ - vwe = SX_WE(swp, 2); /* Read vertex weighting value */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - vof = SX_VO(swp, 3); /* Read vertex offset value */ - vwe = SX_WE(swp, 3); /* Read vertex weighting value */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - vof = SX_VO(swp, 4); /* Read vertex offset value */ - vwe = SX_WE(swp, 4); /* Read vertex weighting value */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate 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 */ - oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */ - op0[1] = OT_E(ot1, oti); /* Write result */ - oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */ - op0[2] = OT_E(ot2, oti); /* Write result */ - oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */ - op0[3] = OT_E(ot3, oti); /* Write result */ - oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */ - op0[4] = OT_E(ot4, oti); /* Write result */ - oti = ((ova2 >> 24) & 0xff); /* Extract integer part of result */ - op0[5] = OT_E(ot5, oti); /* Write result */ - } - } -} -#undef IT_IX -#undef IT_SX -#undef SW_O -#undef SX_WE -#undef SX_VO -#undef IM_O -#undef IM_FE -#undef OT_E - -static void -imdi_k80_gen( -genspec *g /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x1b, 0x00, 0x00, 0x00, 0xff, 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, 0x04, 0x08, - 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08, - 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7, - 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7, - 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08, - 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00, - 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7, - 0x2c, 0xf3, 0xdc, 0xb7, 0x34, 0x5f, 0x36, 0x5f, - 0x69, 0x38, 0x5f, 0x69, 0x31, 0x36, 0x5f, 0x66, - 0x00, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00, - 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf, - 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08, - 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf, - 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x38, 0x30, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01, - 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7, - 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7, - 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08, - 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08, - 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf, - 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7, - 0x00, 0xf0, 0x04, 0x08 - }; /* Structure image */ - - memcpy(g, data, sizeof(data)); /* Initialise the structure */ -} - -static void -imdi_k80_tab( -tabspec *t /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x14, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x0c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, - 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff - }; /* Structure image */ - - memcpy(t, data, sizeof(data)); /* Initialise the structure */ -} - -/* 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 = 5 - Input channel 0 bits = 8 - Input channel 0 increment = 5 - Input channel 1 bits = 8 - Input channel 1 increment = 5 - Input channel 2 bits = 8 - Input channel 2 increment = 5 - Input channel 3 bits = 8 - Input channel 3 increment = 5 - Input channel 4 bits = 8 - Input channel 4 increment = 5 - Input is channel interleaved - Input channels are separate words - Input value extraction is done in input table lookup - - Output channels per pixel = 6 - Output channel 0 bits = 16 - Output channel 0 increment = 6 - Output channel 1 bits = 16 - Output channel 1 increment = 6 - Output channel 2 bits = 16 - Output channel 2 increment = 6 - Output channel 3 bits = 16 - Output channel 3 increment = 6 - Output channel 4 bits = 16 - Output channel 4 increment = 6 - Output channel 5 bits = 16 - Output channel 5 increment = 6 - Output is channel interleaved - - Output channels are separate words - Weight+voffset bits = 32 - Interpolation table index bits = 32 - Interpolation table max resolution = 40 - */ - -/* - 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 <memory.h> -#include "imdi_imp.h" -#define IMDI_INCLUDED -#endif /* IMDI_INCLUDED */ - -#ifndef DEFINED_pointer -#define DEFINED_pointer -typedef unsigned char * pointer; -#endif - -/* Input table interp. index */ -#define IT_IX(p, off) *((unsigned int *)((p) + 0 + (off) * 8)) - -/* Input table input weighting/offset value enty */ -#define IT_WO(p, off) *((unsigned int *)((p) + 4 + (off) * 8)) - -/* Conditional exchange for sorting */ -#define CEX(A, B) if (A < B) { A ^= B; B ^= A; A ^= B; } - -/* Interpolation multi-dim. table access */ -#define IM_O(off) ((off) * 12) - -/* Interpolation table - get vertex values */ -#define IM_FE(p, v, c) *((unsigned int *)((p) + (v) * 4 + (c) * 4)) - -/* Output table indexes */ -#define OT_E(p, off) *((unsigned short *)((p) + (off) * 2)) - -static void -imdi_k81( -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 short *op0 = (unsigned short *)outp[0]; - unsigned char *ep = ip0 + npix * 5 ; - pointer it0 = (pointer)p->in_tables[0]; - pointer it1 = (pointer)p->in_tables[1]; - pointer it2 = (pointer)p->in_tables[2]; - pointer it3 = (pointer)p->in_tables[3]; - pointer it4 = (pointer)p->in_tables[4]; - pointer ot0 = (pointer)p->out_tables[0]; - pointer ot1 = (pointer)p->out_tables[1]; - pointer ot2 = (pointer)p->out_tables[2]; - pointer ot3 = (pointer)p->out_tables[3]; - pointer ot4 = (pointer)p->out_tables[4]; - pointer ot5 = (pointer)p->out_tables[5]; - pointer im_base = (pointer)p->im_table; - - for(;ip0 < ep; ip0 += 5, op0 += 6) { - unsigned int ova0; /* Output value accumulator */ - unsigned int ova1; /* Output value accumulator */ - unsigned int ova2; /* Output value accumulator */ - { - pointer imp; - unsigned int wo0; /* Weighting value and vertex offset variable */ - unsigned int wo1; /* Weighting value and vertex offset variable */ - unsigned int wo2; /* Weighting value and vertex offset variable */ - unsigned int wo3; /* Weighting value and vertex offset variable */ - unsigned int wo4; /* Weighting value and vertex offset variable */ - { - unsigned int ti_i; /* Interpolation index variable */ - - ti_i = IT_IX(it0, ip0[0]); - wo0 = IT_WO(it0, ip0[0]); - ti_i += IT_IX(it1, ip0[1]); - wo1 = IT_WO(it1, ip0[1]); - ti_i += IT_IX(it2, ip0[2]); - wo2 = IT_WO(it2, ip0[2]); - ti_i += IT_IX(it3, ip0[3]); - wo3 = IT_WO(it3, ip0[3]); - ti_i += IT_IX(it4, ip0[4]); - wo4 = IT_WO(it4, ip0[4]); - - imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */ - - /* Sort weighting values and vertex offset values */ - CEX(wo0, wo1); - CEX(wo0, wo2); - CEX(wo0, wo3); - CEX(wo0, wo4); - CEX(wo1, wo2); - CEX(wo1, wo3); - CEX(wo1, wo4); - CEX(wo2, wo3); - CEX(wo2, wo4); - CEX(wo3, wo4); - } - { - unsigned int nvof; /* Next vertex offset value */ - unsigned int vof; /* Vertex offset value */ - unsigned int vwe; /* Vertex weighting */ - - vof = 0; /* First vertex offset is 0 */ - nvof = (wo0 & 0x7fffff); /* Extract offset value */ - wo0 = (wo0 >> 23); /* Extract weighting value */ - vwe = 256 - wo0; /* Baricentric weighting */ - ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo1 & 0x7fffff); /* Extract offset value */ - wo1 = (wo1 >> 23); /* Extract weighting value */ - vwe = wo0 - wo1; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo2 & 0x7fffff); /* Extract offset value */ - wo2 = (wo2 >> 23); /* Extract weighting value */ - vwe = wo1 - wo2; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo3 & 0x7fffff); /* Extract offset value */ - wo3 = (wo3 >> 23); /* Extract weighting value */ - vwe = wo2 - wo3; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo4 & 0x7fffff); /* Extract offset value */ - wo4 = (wo4 >> 23); /* Extract weighting value */ - vwe = wo3 - wo4; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - vwe = wo4; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate 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 */ - oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */ - op0[1] = OT_E(ot1, oti); /* Write result */ - oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */ - op0[2] = OT_E(ot2, oti); /* Write result */ - oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */ - op0[3] = OT_E(ot3, oti); /* Write result */ - oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */ - op0[4] = OT_E(ot4, oti); /* Write result */ - oti = ((ova2 >> 24) & 0xff); /* Extract integer part of result */ - op0[5] = OT_E(ot5, oti); /* Write result */ - } - } -} -#undef IT_WO -#undef IT_IX -#undef CEX -#undef IM_O -#undef IM_FE -#undef OT_E - -static void -imdi_k81_gen( -genspec *g /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x08, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x28, 0x00, 0x00, 0x00, 0x00, 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, 0x04, 0x08, - 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08, - 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7, - 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7, - 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08, - 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00, - 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7, - 0x2c, 0xf3, 0xdc, 0xb7, 0x35, 0x5f, 0x36, 0x5f, - 0x69, 0x38, 0x5f, 0x69, 0x31, 0x36, 0x5f, 0x66, - 0x00, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00, - 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf, - 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08, - 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf, - 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x38, 0x31, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01, - 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7, - 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7, - 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08, - 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08, - 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf, - 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7, - 0x00, 0xf0, 0x04, 0x08 - }; /* Structure image */ - - memcpy(g, data, sizeof(data)); /* Initialise the structure */ -} - -static void -imdi_k81_tab( -tabspec *t /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x0c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, - 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff - }; /* Structure image */ - - memcpy(t, data, sizeof(data)); /* Initialise the structure */ -} - -/* 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 = 6 - Input channel 0 bits = 8 - Input channel 0 increment = 6 - Input channel 1 bits = 8 - Input channel 1 increment = 6 - Input channel 2 bits = 8 - Input channel 2 increment = 6 - Input channel 3 bits = 8 - Input channel 3 increment = 6 - Input channel 4 bits = 8 - Input channel 4 increment = 6 - Input channel 5 bits = 8 - Input channel 5 increment = 6 - Input is channel interleaved - Input channels are separate words - Input value extraction is done in input table lookup - - Output channels per pixel = 6 - Output channel 0 bits = 16 - Output channel 0 increment = 6 - Output channel 1 bits = 16 - Output channel 1 increment = 6 - Output channel 2 bits = 16 - Output channel 2 increment = 6 - Output channel 3 bits = 16 - Output channel 3 increment = 6 - Output channel 4 bits = 16 - Output channel 4 increment = 6 - Output channel 5 bits = 16 - Output channel 5 increment = 6 - Output is channel interleaved - - Output channels are separate words - Weight+voffset bits = 32 - Interpolation table index bits = 32 - Interpolation table max resolution = 19 - */ - -/* - 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 <memory.h> -#include "imdi_imp.h" -#define IMDI_INCLUDED -#endif /* IMDI_INCLUDED */ - -#ifndef DEFINED_pointer -#define DEFINED_pointer -typedef unsigned char * pointer; -#endif - -/* Input table interp. index */ -#define IT_IX(p, off) *((unsigned int *)((p) + 0 + (off) * 8)) - -/* Input table input weighting/offset value enty */ -#define IT_WO(p, off) *((unsigned int *)((p) + 4 + (off) * 8)) - -/* Conditional exchange for sorting */ -#define CEX(A, B) if (A < B) { A ^= B; B ^= A; A ^= B; } - -/* Interpolation multi-dim. table access */ -#define IM_O(off) ((off) * 12) - -/* Interpolation table - get vertex values */ -#define IM_FE(p, v, c) *((unsigned int *)((p) + (v) * 4 + (c) * 4)) - -/* Output table indexes */ -#define OT_E(p, off) *((unsigned short *)((p) + (off) * 2)) - -static void -imdi_k82( -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 short *op0 = (unsigned short *)outp[0]; - unsigned char *ep = ip0 + npix * 6 ; - pointer it0 = (pointer)p->in_tables[0]; - pointer it1 = (pointer)p->in_tables[1]; - pointer it2 = (pointer)p->in_tables[2]; - pointer it3 = (pointer)p->in_tables[3]; - pointer it4 = (pointer)p->in_tables[4]; - pointer it5 = (pointer)p->in_tables[5]; - pointer ot0 = (pointer)p->out_tables[0]; - pointer ot1 = (pointer)p->out_tables[1]; - pointer ot2 = (pointer)p->out_tables[2]; - pointer ot3 = (pointer)p->out_tables[3]; - pointer ot4 = (pointer)p->out_tables[4]; - pointer ot5 = (pointer)p->out_tables[5]; - pointer im_base = (pointer)p->im_table; - - for(;ip0 < ep; ip0 += 6, op0 += 6) { - unsigned int ova0; /* Output value accumulator */ - unsigned int ova1; /* Output value accumulator */ - unsigned int ova2; /* Output value accumulator */ - { - pointer imp; - unsigned int wo0; /* Weighting value and vertex offset variable */ - unsigned int wo1; /* Weighting value and vertex offset variable */ - unsigned int wo2; /* Weighting value and vertex offset variable */ - unsigned int wo3; /* Weighting value and vertex offset variable */ - unsigned int wo4; /* Weighting value and vertex offset variable */ - unsigned int wo5; /* Weighting value and vertex offset variable */ - { - unsigned int ti_i; /* Interpolation index variable */ - - ti_i = IT_IX(it0, ip0[0]); - wo0 = IT_WO(it0, ip0[0]); - ti_i += IT_IX(it1, ip0[1]); - wo1 = IT_WO(it1, ip0[1]); - ti_i += IT_IX(it2, ip0[2]); - wo2 = IT_WO(it2, ip0[2]); - ti_i += IT_IX(it3, ip0[3]); - wo3 = IT_WO(it3, ip0[3]); - ti_i += IT_IX(it4, ip0[4]); - wo4 = IT_WO(it4, ip0[4]); - ti_i += IT_IX(it5, ip0[5]); - wo5 = IT_WO(it5, ip0[5]); - - imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */ - - /* Sort weighting values and vertex offset values */ - CEX(wo0, wo1); - CEX(wo0, wo2); - CEX(wo0, wo3); - CEX(wo0, wo4); - CEX(wo0, wo5); - CEX(wo1, wo2); - CEX(wo1, wo3); - CEX(wo1, wo4); - CEX(wo1, wo5); - CEX(wo2, wo3); - CEX(wo2, wo4); - CEX(wo2, wo5); - CEX(wo3, wo4); - CEX(wo3, wo5); - CEX(wo4, wo5); - } - { - unsigned int nvof; /* Next vertex offset value */ - unsigned int vof; /* Vertex offset value */ - unsigned int vwe; /* Vertex weighting */ - - vof = 0; /* First vertex offset is 0 */ - nvof = (wo0 & 0x7fffff); /* Extract offset value */ - wo0 = (wo0 >> 23); /* Extract weighting value */ - vwe = 256 - wo0; /* Baricentric weighting */ - ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo1 & 0x7fffff); /* Extract offset value */ - wo1 = (wo1 >> 23); /* Extract weighting value */ - vwe = wo0 - wo1; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo2 & 0x7fffff); /* Extract offset value */ - wo2 = (wo2 >> 23); /* Extract weighting value */ - vwe = wo1 - wo2; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo3 & 0x7fffff); /* Extract offset value */ - wo3 = (wo3 >> 23); /* Extract weighting value */ - vwe = wo2 - wo3; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo4 & 0x7fffff); /* Extract offset value */ - wo4 = (wo4 >> 23); /* Extract weighting value */ - vwe = wo3 - wo4; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo5 & 0x7fffff); /* Extract offset value */ - wo5 = (wo5 >> 23); /* Extract weighting value */ - vwe = wo4 - wo5; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - vwe = wo5; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate 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 */ - oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */ - op0[1] = OT_E(ot1, oti); /* Write result */ - oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */ - op0[2] = OT_E(ot2, oti); /* Write result */ - oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */ - op0[3] = OT_E(ot3, oti); /* Write result */ - oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */ - op0[4] = OT_E(ot4, oti); /* Write result */ - oti = ((ova2 >> 24) & 0xff); /* Extract integer part of result */ - op0[5] = OT_E(ot5, oti); /* Write result */ - } - } -} -#undef IT_WO -#undef IT_IX -#undef CEX -#undef IM_O -#undef IM_FE -#undef OT_E - -static void -imdi_k82_gen( -genspec *g /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x08, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x13, 0x00, 0x00, 0x00, 0x00, 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, 0x04, 0x08, - 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08, - 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7, - 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7, - 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08, - 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00, - 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7, - 0x2c, 0xf3, 0xdc, 0xb7, 0x36, 0x5f, 0x36, 0x5f, - 0x69, 0x38, 0x5f, 0x69, 0x31, 0x36, 0x5f, 0x66, - 0x00, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00, - 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf, - 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08, - 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf, - 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x38, 0x32, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01, - 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7, - 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7, - 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08, - 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08, - 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf, - 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7, - 0x00, 0xf0, 0x04, 0x08 - }; /* Structure image */ - - memcpy(g, data, sizeof(data)); /* Initialise the structure */ -} - -static void -imdi_k82_tab( -tabspec *t /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x0c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, - 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff - }; /* Structure image */ - - memcpy(t, data, sizeof(data)); /* Initialise the structure */ -} - -/* 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 = 7 - Input channel 0 bits = 8 - Input channel 0 increment = 7 - Input channel 1 bits = 8 - Input channel 1 increment = 7 - Input channel 2 bits = 8 - Input channel 2 increment = 7 - Input channel 3 bits = 8 - Input channel 3 increment = 7 - Input channel 4 bits = 8 - Input channel 4 increment = 7 - Input channel 5 bits = 8 - Input channel 5 increment = 7 - Input channel 6 bits = 8 - Input channel 6 increment = 7 - Input is channel interleaved - Input channels are separate words - Input value extraction is done in input table lookup - - Output channels per pixel = 6 - Output channel 0 bits = 16 - Output channel 0 increment = 6 - Output channel 1 bits = 16 - Output channel 1 increment = 6 - Output channel 2 bits = 16 - Output channel 2 increment = 6 - Output channel 3 bits = 16 - Output channel 3 increment = 6 - Output channel 4 bits = 16 - Output channel 4 increment = 6 - Output channel 5 bits = 16 - Output channel 5 increment = 6 - Output is channel interleaved - - Output channels are separate words - Weight+voffset bits = 32 - Interpolation table index bits = 32 - Interpolation table max resolution = 11 - */ - -/* - 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 <memory.h> -#include "imdi_imp.h" -#define IMDI_INCLUDED -#endif /* IMDI_INCLUDED */ - -#ifndef DEFINED_pointer -#define DEFINED_pointer -typedef unsigned char * pointer; -#endif - -/* Input table interp. index */ -#define IT_IX(p, off) *((unsigned int *)((p) + 0 + (off) * 8)) - -/* Input table input weighting/offset value enty */ -#define IT_WO(p, off) *((unsigned int *)((p) + 4 + (off) * 8)) - -/* Conditional exchange for sorting */ -#define CEX(A, B) if (A < B) { A ^= B; B ^= A; A ^= B; } - -/* Interpolation multi-dim. table access */ -#define IM_O(off) ((off) * 12) - -/* Interpolation table - get vertex values */ -#define IM_FE(p, v, c) *((unsigned int *)((p) + (v) * 4 + (c) * 4)) - -/* Output table indexes */ -#define OT_E(p, off) *((unsigned short *)((p) + (off) * 2)) - -static void -imdi_k83( -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 short *op0 = (unsigned short *)outp[0]; - unsigned char *ep = ip0 + npix * 7 ; - pointer it0 = (pointer)p->in_tables[0]; - pointer it1 = (pointer)p->in_tables[1]; - pointer it2 = (pointer)p->in_tables[2]; - pointer it3 = (pointer)p->in_tables[3]; - pointer it4 = (pointer)p->in_tables[4]; - pointer it5 = (pointer)p->in_tables[5]; - pointer it6 = (pointer)p->in_tables[6]; - pointer ot0 = (pointer)p->out_tables[0]; - pointer ot1 = (pointer)p->out_tables[1]; - pointer ot2 = (pointer)p->out_tables[2]; - pointer ot3 = (pointer)p->out_tables[3]; - pointer ot4 = (pointer)p->out_tables[4]; - pointer ot5 = (pointer)p->out_tables[5]; - pointer im_base = (pointer)p->im_table; - - for(;ip0 < ep; ip0 += 7, op0 += 6) { - unsigned int ova0; /* Output value accumulator */ - unsigned int ova1; /* Output value accumulator */ - unsigned int ova2; /* Output value accumulator */ - { - pointer imp; - unsigned int wo0; /* Weighting value and vertex offset variable */ - unsigned int wo1; /* Weighting value and vertex offset variable */ - unsigned int wo2; /* Weighting value and vertex offset variable */ - unsigned int wo3; /* Weighting value and vertex offset variable */ - unsigned int wo4; /* Weighting value and vertex offset variable */ - unsigned int wo5; /* Weighting value and vertex offset variable */ - unsigned int wo6; /* Weighting value and vertex offset variable */ - { - unsigned int ti_i; /* Interpolation index variable */ - - ti_i = IT_IX(it0, ip0[0]); - wo0 = IT_WO(it0, ip0[0]); - ti_i += IT_IX(it1, ip0[1]); - wo1 = IT_WO(it1, ip0[1]); - ti_i += IT_IX(it2, ip0[2]); - wo2 = IT_WO(it2, ip0[2]); - ti_i += IT_IX(it3, ip0[3]); - wo3 = IT_WO(it3, ip0[3]); - ti_i += IT_IX(it4, ip0[4]); - wo4 = IT_WO(it4, ip0[4]); - ti_i += IT_IX(it5, ip0[5]); - wo5 = IT_WO(it5, ip0[5]); - ti_i += IT_IX(it6, ip0[6]); - wo6 = IT_WO(it6, ip0[6]); - - imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */ - - /* Sort weighting values and vertex offset values */ - CEX(wo0, wo1); - CEX(wo0, wo2); - CEX(wo0, wo3); - CEX(wo0, wo4); - CEX(wo0, wo5); - CEX(wo0, wo6); - CEX(wo1, wo2); - CEX(wo1, wo3); - CEX(wo1, wo4); - CEX(wo1, wo5); - CEX(wo1, wo6); - CEX(wo2, wo3); - CEX(wo2, wo4); - CEX(wo2, wo5); - CEX(wo2, wo6); - CEX(wo3, wo4); - CEX(wo3, wo5); - CEX(wo3, wo6); - CEX(wo4, wo5); - CEX(wo4, wo6); - CEX(wo5, wo6); - } - { - unsigned int nvof; /* Next vertex offset value */ - unsigned int vof; /* Vertex offset value */ - unsigned int vwe; /* Vertex weighting */ - - vof = 0; /* First vertex offset is 0 */ - nvof = (wo0 & 0x7fffff); /* Extract offset value */ - wo0 = (wo0 >> 23); /* Extract weighting value */ - vwe = 256 - wo0; /* Baricentric weighting */ - ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo1 & 0x7fffff); /* Extract offset value */ - wo1 = (wo1 >> 23); /* Extract weighting value */ - vwe = wo0 - wo1; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo2 & 0x7fffff); /* Extract offset value */ - wo2 = (wo2 >> 23); /* Extract weighting value */ - vwe = wo1 - wo2; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo3 & 0x7fffff); /* Extract offset value */ - wo3 = (wo3 >> 23); /* Extract weighting value */ - vwe = wo2 - wo3; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo4 & 0x7fffff); /* Extract offset value */ - wo4 = (wo4 >> 23); /* Extract weighting value */ - vwe = wo3 - wo4; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo5 & 0x7fffff); /* Extract offset value */ - wo5 = (wo5 >> 23); /* Extract weighting value */ - vwe = wo4 - wo5; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo6 & 0x7fffff); /* Extract offset value */ - wo6 = (wo6 >> 23); /* Extract weighting value */ - vwe = wo5 - wo6; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - vwe = wo6; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate 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 */ - oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */ - op0[1] = OT_E(ot1, oti); /* Write result */ - oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */ - op0[2] = OT_E(ot2, oti); /* Write result */ - oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */ - op0[3] = OT_E(ot3, oti); /* Write result */ - oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */ - op0[4] = OT_E(ot4, oti); /* Write result */ - oti = ((ova2 >> 24) & 0xff); /* Extract integer part of result */ - op0[5] = OT_E(ot5, oti); /* Write result */ - } - } -} -#undef IT_WO -#undef IT_IX -#undef CEX -#undef IM_O -#undef IM_FE -#undef OT_E - -static void -imdi_k83_gen( -genspec *g /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x0b, 0x00, 0x00, 0x00, 0x00, 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, 0x04, 0x08, - 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08, - 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7, - 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7, - 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08, - 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00, - 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7, - 0x2c, 0xf3, 0xdc, 0xb7, 0x37, 0x5f, 0x36, 0x5f, - 0x69, 0x38, 0x5f, 0x69, 0x31, 0x36, 0x5f, 0x66, - 0x00, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00, - 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf, - 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08, - 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf, - 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x38, 0x33, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01, - 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7, - 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7, - 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08, - 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08, - 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf, - 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7, - 0x00, 0xf0, 0x04, 0x08 - }; /* Structure image */ - - memcpy(g, data, sizeof(data)); /* Initialise the structure */ -} - -static void -imdi_k83_tab( -tabspec *t /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x0c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, - 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff - }; /* Structure image */ - - memcpy(t, data, sizeof(data)); /* Initialise the structure */ -} - -/* 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 = 8 - Input channel 0 bits = 8 - Input channel 0 increment = 8 - Input channel 1 bits = 8 - Input channel 1 increment = 8 - Input channel 2 bits = 8 - Input channel 2 increment = 8 - Input channel 3 bits = 8 - Input channel 3 increment = 8 - Input channel 4 bits = 8 - Input channel 4 increment = 8 - Input channel 5 bits = 8 - Input channel 5 increment = 8 - Input channel 6 bits = 8 - Input channel 6 increment = 8 - Input channel 7 bits = 8 - Input channel 7 increment = 8 - Input is channel interleaved - Input channels are separate words - Input value extraction is done in input table lookup - - Output channels per pixel = 6 - Output channel 0 bits = 16 - Output channel 0 increment = 6 - Output channel 1 bits = 16 - Output channel 1 increment = 6 - Output channel 2 bits = 16 - Output channel 2 increment = 6 - Output channel 3 bits = 16 - Output channel 3 increment = 6 - Output channel 4 bits = 16 - Output channel 4 increment = 6 - Output channel 5 bits = 16 - Output channel 5 increment = 6 - Output is channel interleaved - - Output channels are separate words - Weight+voffset bits = 32 - Interpolation table index bits = 32 - Interpolation table max resolution = 8 - */ - -/* - 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 <memory.h> -#include "imdi_imp.h" -#define IMDI_INCLUDED -#endif /* IMDI_INCLUDED */ - -#ifndef DEFINED_pointer -#define DEFINED_pointer -typedef unsigned char * pointer; -#endif - -/* Input table interp. index */ -#define IT_IX(p, off) *((unsigned int *)((p) + 0 + (off) * 8)) - -/* Input table input weighting/offset value enty */ -#define IT_WO(p, off) *((unsigned int *)((p) + 4 + (off) * 8)) - -/* Conditional exchange for sorting */ -#define CEX(A, B) if (A < B) { A ^= B; B ^= A; A ^= B; } - -/* Interpolation multi-dim. table access */ -#define IM_O(off) ((off) * 12) - -/* Interpolation table - get vertex values */ -#define IM_FE(p, v, c) *((unsigned int *)((p) + (v) * 4 + (c) * 4)) - -/* Output table indexes */ -#define OT_E(p, off) *((unsigned short *)((p) + (off) * 2)) - -static void -imdi_k84( -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 short *op0 = (unsigned short *)outp[0]; - unsigned char *ep = ip0 + npix * 8 ; - pointer it0 = (pointer)p->in_tables[0]; - pointer it1 = (pointer)p->in_tables[1]; - pointer it2 = (pointer)p->in_tables[2]; - pointer it3 = (pointer)p->in_tables[3]; - pointer it4 = (pointer)p->in_tables[4]; - pointer it5 = (pointer)p->in_tables[5]; - pointer it6 = (pointer)p->in_tables[6]; - pointer it7 = (pointer)p->in_tables[7]; - pointer ot0 = (pointer)p->out_tables[0]; - pointer ot1 = (pointer)p->out_tables[1]; - pointer ot2 = (pointer)p->out_tables[2]; - pointer ot3 = (pointer)p->out_tables[3]; - pointer ot4 = (pointer)p->out_tables[4]; - pointer ot5 = (pointer)p->out_tables[5]; - pointer im_base = (pointer)p->im_table; - - for(;ip0 < ep; ip0 += 8, op0 += 6) { - unsigned int ova0; /* Output value accumulator */ - unsigned int ova1; /* Output value accumulator */ - unsigned int ova2; /* Output value accumulator */ - { - pointer imp; - unsigned int wo0; /* Weighting value and vertex offset variable */ - unsigned int wo1; /* Weighting value and vertex offset variable */ - unsigned int wo2; /* Weighting value and vertex offset variable */ - unsigned int wo3; /* Weighting value and vertex offset variable */ - unsigned int wo4; /* Weighting value and vertex offset variable */ - unsigned int wo5; /* Weighting value and vertex offset variable */ - unsigned int wo6; /* Weighting value and vertex offset variable */ - unsigned int wo7; /* Weighting value and vertex offset variable */ - { - unsigned int ti_i; /* Interpolation index variable */ - - ti_i = IT_IX(it0, ip0[0]); - wo0 = IT_WO(it0, ip0[0]); - ti_i += IT_IX(it1, ip0[1]); - wo1 = IT_WO(it1, ip0[1]); - ti_i += IT_IX(it2, ip0[2]); - wo2 = IT_WO(it2, ip0[2]); - ti_i += IT_IX(it3, ip0[3]); - wo3 = IT_WO(it3, ip0[3]); - ti_i += IT_IX(it4, ip0[4]); - wo4 = IT_WO(it4, ip0[4]); - ti_i += IT_IX(it5, ip0[5]); - wo5 = IT_WO(it5, ip0[5]); - ti_i += IT_IX(it6, ip0[6]); - wo6 = IT_WO(it6, ip0[6]); - ti_i += IT_IX(it7, ip0[7]); - wo7 = IT_WO(it7, ip0[7]); - - imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */ - - /* Sort weighting values and vertex offset values */ - CEX(wo0, wo1); - CEX(wo0, wo2); - CEX(wo0, wo3); - CEX(wo0, wo4); - CEX(wo0, wo5); - CEX(wo0, wo6); - CEX(wo0, wo7); - CEX(wo1, wo2); - CEX(wo1, wo3); - CEX(wo1, wo4); - CEX(wo1, wo5); - CEX(wo1, wo6); - CEX(wo1, wo7); - CEX(wo2, wo3); - CEX(wo2, wo4); - CEX(wo2, wo5); - CEX(wo2, wo6); - CEX(wo2, wo7); - CEX(wo3, wo4); - CEX(wo3, wo5); - CEX(wo3, wo6); - CEX(wo3, wo7); - CEX(wo4, wo5); - CEX(wo4, wo6); - CEX(wo4, wo7); - CEX(wo5, wo6); - CEX(wo5, wo7); - CEX(wo6, wo7); - } - { - unsigned int nvof; /* Next vertex offset value */ - unsigned int vof; /* Vertex offset value */ - unsigned int vwe; /* Vertex weighting */ - - vof = 0; /* First vertex offset is 0 */ - nvof = (wo0 & 0x7fffff); /* Extract offset value */ - wo0 = (wo0 >> 23); /* Extract weighting value */ - vwe = 256 - wo0; /* Baricentric weighting */ - ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo1 & 0x7fffff); /* Extract offset value */ - wo1 = (wo1 >> 23); /* Extract weighting value */ - vwe = wo0 - wo1; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo2 & 0x7fffff); /* Extract offset value */ - wo2 = (wo2 >> 23); /* Extract weighting value */ - vwe = wo1 - wo2; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo3 & 0x7fffff); /* Extract offset value */ - wo3 = (wo3 >> 23); /* Extract weighting value */ - vwe = wo2 - wo3; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo4 & 0x7fffff); /* Extract offset value */ - wo4 = (wo4 >> 23); /* Extract weighting value */ - vwe = wo3 - wo4; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo5 & 0x7fffff); /* Extract offset value */ - wo5 = (wo5 >> 23); /* Extract weighting value */ - vwe = wo4 - wo5; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo6 & 0x7fffff); /* Extract offset value */ - wo6 = (wo6 >> 23); /* Extract weighting value */ - vwe = wo5 - wo6; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo7 & 0x7fffff); /* Extract offset value */ - wo7 = (wo7 >> 23); /* Extract weighting value */ - vwe = wo6 - wo7; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - vwe = wo7; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate 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 */ - oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */ - op0[1] = OT_E(ot1, oti); /* Write result */ - oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */ - op0[2] = OT_E(ot2, oti); /* Write result */ - oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */ - op0[3] = OT_E(ot3, oti); /* Write result */ - oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */ - op0[4] = OT_E(ot4, oti); /* Write result */ - oti = ((ova2 >> 24) & 0xff); /* Extract integer part of result */ - op0[5] = OT_E(ot5, oti); /* Write result */ - } - } -} -#undef IT_WO -#undef IT_IX -#undef CEX -#undef IM_O -#undef IM_FE -#undef OT_E - -static void -imdi_k84_gen( -genspec *g /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 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, 0x04, 0x08, - 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08, - 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7, - 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7, - 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08, - 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00, - 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7, - 0x2c, 0xf3, 0xdc, 0xb7, 0x38, 0x5f, 0x36, 0x5f, - 0x69, 0x38, 0x5f, 0x69, 0x31, 0x36, 0x5f, 0x66, - 0x00, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00, - 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf, - 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08, - 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf, - 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x38, 0x34, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01, - 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7, - 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7, - 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08, - 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08, - 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf, - 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7, - 0x00, 0xf0, 0x04, 0x08 - }; /* Structure image */ - - memcpy(g, data, sizeof(data)); /* Initialise the structure */ -} - -static void -imdi_k84_tab( -tabspec *t /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x0c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, - 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff - }; /* Structure image */ - - memcpy(t, data, sizeof(data)); /* Initialise the structure */ -} - -/* 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 = 7 - Output channel 0 bits = 16 - Output channel 0 increment = 7 - Output channel 1 bits = 16 - Output channel 1 increment = 7 - Output channel 2 bits = 16 - Output channel 2 increment = 7 - Output channel 3 bits = 16 - Output channel 3 increment = 7 - Output channel 4 bits = 16 - Output channel 4 increment = 7 - Output channel 5 bits = 16 - Output channel 5 increment = 7 - Output channel 6 bits = 16 - Output channel 6 increment = 7 - 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 = 255 - */ - -/* - 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 <memory.h> -#include "imdi_imp.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) * 16) - -/* Interpolation table - get vertex values */ -#define IM_FE(p, v, c) *((unsigned int *)((p) + (v) * 8 + (c) * 4)) -#define IM_PE(p, v) *((unsigned int *)((p) + 12 + (v) * 8)) - -/* Output table indexes */ -#define OT_E(p, off) *((unsigned short *)((p) + (off) * 2)) - -static void -imdi_k85( -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 short *op0 = (unsigned short *)outp[0]; - unsigned char *ep = ip0 + npix * 1 ; - pointer it0 = (pointer)p->in_tables[0]; - pointer ot0 = (pointer)p->out_tables[0]; - pointer ot1 = (pointer)p->out_tables[1]; - pointer ot2 = (pointer)p->out_tables[2]; - pointer ot3 = (pointer)p->out_tables[3]; - pointer ot4 = (pointer)p->out_tables[4]; - pointer ot5 = (pointer)p->out_tables[5]; - pointer ot6 = (pointer)p->out_tables[6]; - pointer sw_base = (pointer)p->sw_table; - pointer im_base = (pointer)p->im_table; - - for(;ip0 < ep; ip0 += 1, op0 += 7) { - unsigned int ova0; /* Output value accumulator */ - unsigned int ova1; /* Output value accumulator */ - unsigned int ova2; /* Output value accumulator */ - unsigned int ova3; /* 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_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 = 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_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += 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 */ - oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */ - op0[1] = OT_E(ot1, oti); /* Write result */ - oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */ - op0[2] = OT_E(ot2, oti); /* Write result */ - oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */ - op0[3] = OT_E(ot3, oti); /* Write result */ - oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */ - op0[4] = OT_E(ot4, oti); /* Write result */ - oti = ((ova2 >> 24) & 0xff); /* Extract integer part of result */ - op0[5] = OT_E(ot5, oti); /* Write result */ - oti = ((ova3 >> 8) & 0xff); /* Extract integer part of result */ - op0[6] = OT_E(ot6, oti); /* Write result */ - } - } -} -#undef IT_IT -#undef SW_O -#undef SX_WO -#undef IM_O -#undef IM_FE -#undef IM_PE -#undef OT_E - -static void -imdi_k85_gen( -genspec *g /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0xff, 0x00, 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, 0x04, 0x08, - 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08, - 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7, - 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7, - 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08, - 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00, - 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7, - 0x2c, 0xf3, 0xdc, 0xb7, 0x31, 0x5f, 0x37, 0x5f, - 0x69, 0x38, 0x5f, 0x69, 0x31, 0x36, 0x5f, 0x66, - 0x00, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00, - 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf, - 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08, - 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf, - 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x38, 0x35, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01, - 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7, - 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7, - 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08, - 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08, - 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf, - 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7, - 0x00, 0xf0, 0x04, 0x08 - }; /* Structure image */ - - memcpy(g, data, sizeof(data)); /* Initialise the structure */ -} - -static void -imdi_k85_tab( -tabspec *t /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0xdc, 0x60, 0xef, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff - }; /* Structure image */ - - memcpy(t, data, sizeof(data)); /* Initialise the structure */ -} - -/* 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 = 3 - Input channel 0 bits = 8 - Input channel 0 increment = 3 - Input channel 1 bits = 8 - Input channel 1 increment = 3 - Input channel 2 bits = 8 - Input channel 2 increment = 3 - Input is channel interleaved - Input channels are separate words - Input value extraction is done in input table lookup - - Output channels per pixel = 7 - Output channel 0 bits = 16 - Output channel 0 increment = 7 - Output channel 1 bits = 16 - Output channel 1 increment = 7 - Output channel 2 bits = 16 - Output channel 2 increment = 7 - Output channel 3 bits = 16 - Output channel 3 increment = 7 - Output channel 4 bits = 16 - Output channel 4 increment = 7 - Output channel 5 bits = 16 - Output channel 5 increment = 7 - Output channel 6 bits = 16 - Output channel 6 increment = 7 - Output is channel interleaved - - Output channels are separate words - Simplex table index bits = 12 - Interpolation table index bits = 20 - Simplex table max resolution = 16 - Interpolation table max resolution = 101 - */ - -/* - 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 <memory.h> -#include "imdi_imp.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 int *)((p) + 0 + (off) * 4)) - -/* Simplex weighting table access */ -#define SW_O(off) ((off) * 16) - -/* Simplex table - get weighting value */ -#define SX_WE(p, v) *((unsigned short *)((p) + (v) * 4 + 0)) - -/* Simplex table - get offset value */ -#define SX_VO(p, v) *((unsigned short *)((p) + (v) * 4 + 2)) - -/* Interpolation multi-dim. table access */ -#define IM_O(off) ((off) * 16) - -/* Interpolation table - get vertex values */ -#define IM_FE(p, v, c) *((unsigned int *)((p) + (v) * 8 + (c) * 4)) -#define IM_PE(p, v) *((unsigned int *)((p) + 12 + (v) * 8)) - -/* Output table indexes */ -#define OT_E(p, off) *((unsigned short *)((p) + (off) * 2)) - -static void -imdi_k86( -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 short *op0 = (unsigned short *)outp[0]; - unsigned char *ep = ip0 + npix * 3 ; - pointer it0 = (pointer)p->in_tables[0]; - pointer it1 = (pointer)p->in_tables[1]; - pointer it2 = (pointer)p->in_tables[2]; - pointer ot0 = (pointer)p->out_tables[0]; - pointer ot1 = (pointer)p->out_tables[1]; - pointer ot2 = (pointer)p->out_tables[2]; - pointer ot3 = (pointer)p->out_tables[3]; - pointer ot4 = (pointer)p->out_tables[4]; - pointer ot5 = (pointer)p->out_tables[5]; - pointer ot6 = (pointer)p->out_tables[6]; - pointer sw_base = (pointer)p->sw_table; - pointer im_base = (pointer)p->im_table; - - for(;ip0 < ep; ip0 += 3, op0 += 7) { - unsigned int ova0; /* Output value accumulator */ - unsigned int ova1; /* Output value accumulator */ - unsigned int ova2; /* Output value accumulator */ - unsigned int ova3; /* Output value partial accumulator */ - { - pointer swp; - pointer imp; - { - unsigned int ti; /* Simplex+Interpolation index variable */ - - ti = IT_IT(it0, ip0[0]); - ti += IT_IT(it1, ip0[1]); - ti += IT_IT(it2, ip0[2]); - - imp = im_base + IM_O(ti >> 12); /* Extract interp. index and comp. entry */ - swp = sw_base + SW_O(ti & 0xfff); /* Extract simplex index and comp. entry */ - } - { - unsigned int vof; /* Vertex offset value */ - unsigned int vwe; /* Vertex weighting */ - - vof = SX_VO(swp, 0); /* Read vertex offset value */ - vwe = SX_WE(swp, 0); /* Read vertex weighting value */ - ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof = SX_VO(swp, 1); /* Read vertex offset value */ - vwe = SX_WE(swp, 1); /* Read vertex weighting value */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof = SX_VO(swp, 2); /* Read vertex offset value */ - vwe = SX_WE(swp, 2); /* Read vertex weighting value */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof = SX_VO(swp, 3); /* Read vertex offset value */ - vwe = SX_WE(swp, 3); /* Read vertex weighting value */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += 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 */ - oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */ - op0[1] = OT_E(ot1, oti); /* Write result */ - oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */ - op0[2] = OT_E(ot2, oti); /* Write result */ - oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */ - op0[3] = OT_E(ot3, oti); /* Write result */ - oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */ - op0[4] = OT_E(ot4, oti); /* Write result */ - oti = ((ova2 >> 24) & 0xff); /* Extract integer part of result */ - op0[5] = OT_E(ot5, oti); /* Write result */ - oti = ((ova3 >> 8) & 0xff); /* Extract integer part of result */ - op0[6] = OT_E(ot6, oti); /* Write result */ - } - } -} -#undef IT_IT -#undef SW_O -#undef SX_WE -#undef SX_VO -#undef IM_O -#undef IM_FE -#undef IM_PE -#undef OT_E - -static void -imdi_k86_gen( -genspec *g /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x08, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x65, 0x00, 0x00, 0x00, 0x10, 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, 0x04, 0x08, - 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08, - 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7, - 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7, - 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08, - 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00, - 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7, - 0x2c, 0xf3, 0xdc, 0xb7, 0x33, 0x5f, 0x37, 0x5f, - 0x69, 0x38, 0x5f, 0x69, 0x31, 0x36, 0x5f, 0x66, - 0x00, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00, - 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf, - 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08, - 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf, - 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x38, 0x36, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01, - 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7, - 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7, - 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08, - 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08, - 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf, - 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7, - 0x00, 0xf0, 0x04, 0x08 - }; /* Structure image */ - - memcpy(g, data, sizeof(data)); /* Initialise the structure */ -} - -static void -imdi_k86_tab( -tabspec *t /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x14, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0xdc, 0x60, 0xef, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff - }; /* Structure image */ - - memcpy(t, data, sizeof(data)); /* Initialise the structure */ -} - -/* 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 = 4 - Input channel 0 bits = 8 - Input channel 0 increment = 4 - Input channel 1 bits = 8 - Input channel 1 increment = 4 - Input channel 2 bits = 8 - Input channel 2 increment = 4 - Input channel 3 bits = 8 - Input channel 3 increment = 4 - Input is channel interleaved - Input channels are separate words - Input value extraction is done in input table lookup - - Output channels per pixel = 7 - Output channel 0 bits = 16 - Output channel 0 increment = 7 - Output channel 1 bits = 16 - Output channel 1 increment = 7 - Output channel 2 bits = 16 - Output channel 2 increment = 7 - Output channel 3 bits = 16 - Output channel 3 increment = 7 - Output channel 4 bits = 16 - Output channel 4 increment = 7 - Output channel 5 bits = 16 - Output channel 5 increment = 7 - Output channel 6 bits = 16 - Output channel 6 increment = 7 - Output is channel interleaved - - Output channels are separate words - Simplex table index bits = 32 - Interpolation table index bits = 32 - Simplex table max resolution = 255 - Interpolation table max resolution = 31 - */ - -/* - 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 <memory.h> -#include "imdi_imp.h" -#define IMDI_INCLUDED -#endif /* IMDI_INCLUDED */ - -#ifndef DEFINED_pointer -#define DEFINED_pointer -typedef unsigned char * pointer; -#endif - -/* Input table interp. index */ -#define IT_IX(p, off) *((unsigned int *)((p) + 4 + (off) * 8)) - -/* Input table simplex index enty */ -#define IT_SX(p, off) *((unsigned int *)((p) + 0 + (off) * 8)) - -/* Simplex weighting table access */ -#define SW_O(off) ((off) * 20) - -/* Simplex table - get weighting value */ -#define SX_WE(p, v) *((unsigned short *)((p) + (v) * 4 + 0)) - -/* Simplex table - get offset value */ -#define SX_VO(p, v) *((unsigned short *)((p) + (v) * 4 + 2)) - -/* Interpolation multi-dim. table access */ -#define IM_O(off) ((off) * 16) - -/* Interpolation table - get vertex values */ -#define IM_FE(p, v, c) *((unsigned int *)((p) + (v) * 8 + (c) * 4)) -#define IM_PE(p, v) *((unsigned int *)((p) + 12 + (v) * 8)) - -/* Output table indexes */ -#define OT_E(p, off) *((unsigned short *)((p) + (off) * 2)) - -static void -imdi_k87( -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 short *op0 = (unsigned short *)outp[0]; - unsigned char *ep = ip0 + npix * 4 ; - pointer it0 = (pointer)p->in_tables[0]; - pointer it1 = (pointer)p->in_tables[1]; - pointer it2 = (pointer)p->in_tables[2]; - pointer it3 = (pointer)p->in_tables[3]; - pointer ot0 = (pointer)p->out_tables[0]; - pointer ot1 = (pointer)p->out_tables[1]; - pointer ot2 = (pointer)p->out_tables[2]; - pointer ot3 = (pointer)p->out_tables[3]; - pointer ot4 = (pointer)p->out_tables[4]; - pointer ot5 = (pointer)p->out_tables[5]; - pointer ot6 = (pointer)p->out_tables[6]; - pointer sw_base = (pointer)p->sw_table; - pointer im_base = (pointer)p->im_table; - - for(;ip0 < ep; ip0 += 4, op0 += 7) { - unsigned int ova0; /* Output value accumulator */ - unsigned int ova1; /* Output value accumulator */ - unsigned int ova2; /* Output value accumulator */ - unsigned int ova3; /* Output value partial accumulator */ - { - pointer swp; - pointer imp; - { - unsigned int ti_s; /* Simplex index variable */ - unsigned int ti_i; /* Interpolation index variable */ - - ti_i = IT_IX(it0, ip0[0]); - ti_s = IT_SX(it0, ip0[0]); - ti_i += IT_IX(it1, ip0[1]); - ti_s += IT_SX(it1, ip0[1]); - ti_i += IT_IX(it2, ip0[2]); - ti_s += IT_SX(it2, ip0[2]); - ti_i += IT_IX(it3, ip0[3]); - ti_s += IT_SX(it3, ip0[3]); - - swp = sw_base + SW_O(ti_s); /* Compute simplex table entry pointer */ - imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */ - } - { - unsigned int vof; /* Vertex offset value */ - unsigned int vwe; /* Vertex weighting */ - - vof = SX_VO(swp, 0); /* Read vertex offset value */ - vwe = SX_WE(swp, 0); /* Read vertex weighting value */ - ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof = SX_VO(swp, 1); /* Read vertex offset value */ - vwe = SX_WE(swp, 1); /* Read vertex weighting value */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof = SX_VO(swp, 2); /* Read vertex offset value */ - vwe = SX_WE(swp, 2); /* Read vertex weighting value */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof = SX_VO(swp, 3); /* Read vertex offset value */ - vwe = SX_WE(swp, 3); /* Read vertex weighting value */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof = SX_VO(swp, 4); /* Read vertex offset value */ - vwe = SX_WE(swp, 4); /* Read vertex weighting value */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += 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 */ - oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */ - op0[1] = OT_E(ot1, oti); /* Write result */ - oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */ - op0[2] = OT_E(ot2, oti); /* Write result */ - oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */ - op0[3] = OT_E(ot3, oti); /* Write result */ - oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */ - op0[4] = OT_E(ot4, oti); /* Write result */ - oti = ((ova2 >> 24) & 0xff); /* Extract integer part of result */ - op0[5] = OT_E(ot5, oti); /* Write result */ - oti = ((ova3 >> 8) & 0xff); /* Extract integer part of result */ - op0[6] = OT_E(ot6, oti); /* Write result */ - } - } -} -#undef IT_IX -#undef IT_SX -#undef SW_O -#undef SX_WE -#undef SX_VO -#undef IM_O -#undef IM_FE -#undef IM_PE -#undef OT_E - -static void -imdi_k87_gen( -genspec *g /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x1f, 0x00, 0x00, 0x00, 0xff, 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, 0x04, 0x08, - 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08, - 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7, - 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7, - 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08, - 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00, - 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7, - 0x2c, 0xf3, 0xdc, 0xb7, 0x34, 0x5f, 0x37, 0x5f, - 0x69, 0x38, 0x5f, 0x69, 0x31, 0x36, 0x5f, 0x66, - 0x00, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00, - 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf, - 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08, - 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf, - 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x38, 0x37, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01, - 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7, - 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7, - 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08, - 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08, - 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf, - 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7, - 0x00, 0xf0, 0x04, 0x08 - }; /* Structure image */ - - memcpy(g, data, sizeof(data)); /* Initialise the structure */ -} - -static void -imdi_k87_tab( -tabspec *t /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x14, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0xdc, 0x60, 0xef, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff - }; /* Structure image */ - - memcpy(t, data, sizeof(data)); /* Initialise the structure */ -} - -/* 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 = 5 - Input channel 0 bits = 8 - Input channel 0 increment = 5 - Input channel 1 bits = 8 - Input channel 1 increment = 5 - Input channel 2 bits = 8 - Input channel 2 increment = 5 - Input channel 3 bits = 8 - Input channel 3 increment = 5 - Input channel 4 bits = 8 - Input channel 4 increment = 5 - Input is channel interleaved - Input channels are separate words - Input value extraction is done in input table lookup - - Output channels per pixel = 7 - Output channel 0 bits = 16 - Output channel 0 increment = 7 - Output channel 1 bits = 16 - Output channel 1 increment = 7 - Output channel 2 bits = 16 - Output channel 2 increment = 7 - Output channel 3 bits = 16 - Output channel 3 increment = 7 - Output channel 4 bits = 16 - Output channel 4 increment = 7 - Output channel 5 bits = 16 - Output channel 5 increment = 7 - Output channel 6 bits = 16 - Output channel 6 increment = 7 - Output is channel interleaved - - Output channels are separate words - Weight+voffset bits = 32 - Interpolation table index bits = 32 - Interpolation table max resolution = 45 - */ - -/* - 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 <memory.h> -#include "imdi_imp.h" -#define IMDI_INCLUDED -#endif /* IMDI_INCLUDED */ - -#ifndef DEFINED_pointer -#define DEFINED_pointer -typedef unsigned char * pointer; -#endif - -/* Input table interp. index */ -#define IT_IX(p, off) *((unsigned int *)((p) + 0 + (off) * 8)) - -/* Input table input weighting/offset value enty */ -#define IT_WO(p, off) *((unsigned int *)((p) + 4 + (off) * 8)) - -/* Conditional exchange for sorting */ -#define CEX(A, B) if (A < B) { A ^= B; B ^= A; A ^= B; } - -/* Interpolation multi-dim. table access */ -#define IM_O(off) ((off) * 16) - -/* Interpolation table - get vertex values */ -#define IM_FE(p, v, c) *((unsigned int *)((p) + (v) * 8 + (c) * 4)) -#define IM_PE(p, v) *((unsigned int *)((p) + 12 + (v) * 8)) - -/* Output table indexes */ -#define OT_E(p, off) *((unsigned short *)((p) + (off) * 2)) - -static void -imdi_k88( -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 short *op0 = (unsigned short *)outp[0]; - unsigned char *ep = ip0 + npix * 5 ; - pointer it0 = (pointer)p->in_tables[0]; - pointer it1 = (pointer)p->in_tables[1]; - pointer it2 = (pointer)p->in_tables[2]; - pointer it3 = (pointer)p->in_tables[3]; - pointer it4 = (pointer)p->in_tables[4]; - pointer ot0 = (pointer)p->out_tables[0]; - pointer ot1 = (pointer)p->out_tables[1]; - pointer ot2 = (pointer)p->out_tables[2]; - pointer ot3 = (pointer)p->out_tables[3]; - pointer ot4 = (pointer)p->out_tables[4]; - pointer ot5 = (pointer)p->out_tables[5]; - pointer ot6 = (pointer)p->out_tables[6]; - pointer im_base = (pointer)p->im_table; - - for(;ip0 < ep; ip0 += 5, op0 += 7) { - unsigned int ova0; /* Output value accumulator */ - unsigned int ova1; /* Output value accumulator */ - unsigned int ova2; /* Output value accumulator */ - unsigned int ova3; /* Output value partial accumulator */ - { - pointer imp; - unsigned int wo0; /* Weighting value and vertex offset variable */ - unsigned int wo1; /* Weighting value and vertex offset variable */ - unsigned int wo2; /* Weighting value and vertex offset variable */ - unsigned int wo3; /* Weighting value and vertex offset variable */ - unsigned int wo4; /* Weighting value and vertex offset variable */ - { - unsigned int ti_i; /* Interpolation index variable */ - - ti_i = IT_IX(it0, ip0[0]); - wo0 = IT_WO(it0, ip0[0]); - ti_i += IT_IX(it1, ip0[1]); - wo1 = IT_WO(it1, ip0[1]); - ti_i += IT_IX(it2, ip0[2]); - wo2 = IT_WO(it2, ip0[2]); - ti_i += IT_IX(it3, ip0[3]); - wo3 = IT_WO(it3, ip0[3]); - ti_i += IT_IX(it4, ip0[4]); - wo4 = IT_WO(it4, ip0[4]); - - imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */ - - /* Sort weighting values and vertex offset values */ - CEX(wo0, wo1); - CEX(wo0, wo2); - CEX(wo0, wo3); - CEX(wo0, wo4); - CEX(wo1, wo2); - CEX(wo1, wo3); - CEX(wo1, wo4); - CEX(wo2, wo3); - CEX(wo2, wo4); - CEX(wo3, wo4); - } - { - unsigned int nvof; /* Next vertex offset value */ - unsigned int vof; /* Vertex offset value */ - unsigned int vwe; /* Vertex weighting */ - - vof = 0; /* First vertex offset is 0 */ - nvof = (wo0 & 0x7fffff); /* Extract offset value */ - wo0 = (wo0 >> 23); /* Extract weighting value */ - vwe = 256 - wo0; /* Baricentric weighting */ - ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo1 & 0x7fffff); /* Extract offset value */ - wo1 = (wo1 >> 23); /* Extract weighting value */ - vwe = wo0 - wo1; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo2 & 0x7fffff); /* Extract offset value */ - wo2 = (wo2 >> 23); /* Extract weighting value */ - vwe = wo1 - wo2; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo3 & 0x7fffff); /* Extract offset value */ - wo3 = (wo3 >> 23); /* Extract weighting value */ - vwe = wo2 - wo3; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo4 & 0x7fffff); /* Extract offset value */ - wo4 = (wo4 >> 23); /* Extract weighting value */ - vwe = wo3 - wo4; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - vwe = wo4; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += 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 */ - oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */ - op0[1] = OT_E(ot1, oti); /* Write result */ - oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */ - op0[2] = OT_E(ot2, oti); /* Write result */ - oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */ - op0[3] = OT_E(ot3, oti); /* Write result */ - oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */ - op0[4] = OT_E(ot4, oti); /* Write result */ - oti = ((ova2 >> 24) & 0xff); /* Extract integer part of result */ - op0[5] = OT_E(ot5, oti); /* Write result */ - oti = ((ova3 >> 8) & 0xff); /* Extract integer part of result */ - op0[6] = OT_E(ot6, oti); /* Write result */ - } - } -} -#undef IT_WO -#undef IT_IX -#undef CEX -#undef IM_O -#undef IM_FE -#undef IM_PE -#undef OT_E - -static void -imdi_k88_gen( -genspec *g /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x08, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x2d, 0x00, 0x00, 0x00, 0x00, 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, 0x04, 0x08, - 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08, - 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7, - 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7, - 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08, - 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00, - 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7, - 0x2c, 0xf3, 0xdc, 0xb7, 0x35, 0x5f, 0x37, 0x5f, - 0x69, 0x38, 0x5f, 0x69, 0x31, 0x36, 0x5f, 0x66, - 0x00, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00, - 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf, - 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08, - 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf, - 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x38, 0x38, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01, - 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7, - 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7, - 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08, - 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08, - 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf, - 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7, - 0x00, 0xf0, 0x04, 0x08 - }; /* Structure image */ - - memcpy(g, data, sizeof(data)); /* Initialise the structure */ -} - -static void -imdi_k88_tab( -tabspec *t /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0xdc, 0x60, 0xef, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff - }; /* Structure image */ - - memcpy(t, data, sizeof(data)); /* Initialise the structure */ -} - -/* 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 = 6 - Input channel 0 bits = 8 - Input channel 0 increment = 6 - Input channel 1 bits = 8 - Input channel 1 increment = 6 - Input channel 2 bits = 8 - Input channel 2 increment = 6 - Input channel 3 bits = 8 - Input channel 3 increment = 6 - Input channel 4 bits = 8 - Input channel 4 increment = 6 - Input channel 5 bits = 8 - Input channel 5 increment = 6 - Input is channel interleaved - Input channels are separate words - Input value extraction is done in input table lookup - - Output channels per pixel = 7 - Output channel 0 bits = 16 - Output channel 0 increment = 7 - Output channel 1 bits = 16 - Output channel 1 increment = 7 - Output channel 2 bits = 16 - Output channel 2 increment = 7 - Output channel 3 bits = 16 - Output channel 3 increment = 7 - Output channel 4 bits = 16 - Output channel 4 increment = 7 - Output channel 5 bits = 16 - Output channel 5 increment = 7 - Output channel 6 bits = 16 - Output channel 6 increment = 7 - Output is channel interleaved - - Output channels are separate words - Weight+voffset bits = 32 - Interpolation table index bits = 32 - Interpolation table max resolution = 20 - */ - -/* - 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 <memory.h> -#include "imdi_imp.h" -#define IMDI_INCLUDED -#endif /* IMDI_INCLUDED */ - -#ifndef DEFINED_pointer -#define DEFINED_pointer -typedef unsigned char * pointer; -#endif - -/* Input table interp. index */ -#define IT_IX(p, off) *((unsigned int *)((p) + 0 + (off) * 8)) - -/* Input table input weighting/offset value enty */ -#define IT_WO(p, off) *((unsigned int *)((p) + 4 + (off) * 8)) - -/* Conditional exchange for sorting */ -#define CEX(A, B) if (A < B) { A ^= B; B ^= A; A ^= B; } - -/* Interpolation multi-dim. table access */ -#define IM_O(off) ((off) * 16) - -/* Interpolation table - get vertex values */ -#define IM_FE(p, v, c) *((unsigned int *)((p) + (v) * 8 + (c) * 4)) -#define IM_PE(p, v) *((unsigned int *)((p) + 12 + (v) * 8)) - -/* Output table indexes */ -#define OT_E(p, off) *((unsigned short *)((p) + (off) * 2)) - -static void -imdi_k89( -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 short *op0 = (unsigned short *)outp[0]; - unsigned char *ep = ip0 + npix * 6 ; - pointer it0 = (pointer)p->in_tables[0]; - pointer it1 = (pointer)p->in_tables[1]; - pointer it2 = (pointer)p->in_tables[2]; - pointer it3 = (pointer)p->in_tables[3]; - pointer it4 = (pointer)p->in_tables[4]; - pointer it5 = (pointer)p->in_tables[5]; - pointer ot0 = (pointer)p->out_tables[0]; - pointer ot1 = (pointer)p->out_tables[1]; - pointer ot2 = (pointer)p->out_tables[2]; - pointer ot3 = (pointer)p->out_tables[3]; - pointer ot4 = (pointer)p->out_tables[4]; - pointer ot5 = (pointer)p->out_tables[5]; - pointer ot6 = (pointer)p->out_tables[6]; - pointer im_base = (pointer)p->im_table; - - for(;ip0 < ep; ip0 += 6, op0 += 7) { - unsigned int ova0; /* Output value accumulator */ - unsigned int ova1; /* Output value accumulator */ - unsigned int ova2; /* Output value accumulator */ - unsigned int ova3; /* Output value partial accumulator */ - { - pointer imp; - unsigned int wo0; /* Weighting value and vertex offset variable */ - unsigned int wo1; /* Weighting value and vertex offset variable */ - unsigned int wo2; /* Weighting value and vertex offset variable */ - unsigned int wo3; /* Weighting value and vertex offset variable */ - unsigned int wo4; /* Weighting value and vertex offset variable */ - unsigned int wo5; /* Weighting value and vertex offset variable */ - { - unsigned int ti_i; /* Interpolation index variable */ - - ti_i = IT_IX(it0, ip0[0]); - wo0 = IT_WO(it0, ip0[0]); - ti_i += IT_IX(it1, ip0[1]); - wo1 = IT_WO(it1, ip0[1]); - ti_i += IT_IX(it2, ip0[2]); - wo2 = IT_WO(it2, ip0[2]); - ti_i += IT_IX(it3, ip0[3]); - wo3 = IT_WO(it3, ip0[3]); - ti_i += IT_IX(it4, ip0[4]); - wo4 = IT_WO(it4, ip0[4]); - ti_i += IT_IX(it5, ip0[5]); - wo5 = IT_WO(it5, ip0[5]); - - imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */ - - /* Sort weighting values and vertex offset values */ - CEX(wo0, wo1); - CEX(wo0, wo2); - CEX(wo0, wo3); - CEX(wo0, wo4); - CEX(wo0, wo5); - CEX(wo1, wo2); - CEX(wo1, wo3); - CEX(wo1, wo4); - CEX(wo1, wo5); - CEX(wo2, wo3); - CEX(wo2, wo4); - CEX(wo2, wo5); - CEX(wo3, wo4); - CEX(wo3, wo5); - CEX(wo4, wo5); - } - { - unsigned int nvof; /* Next vertex offset value */ - unsigned int vof; /* Vertex offset value */ - unsigned int vwe; /* Vertex weighting */ - - vof = 0; /* First vertex offset is 0 */ - nvof = (wo0 & 0x7fffff); /* Extract offset value */ - wo0 = (wo0 >> 23); /* Extract weighting value */ - vwe = 256 - wo0; /* Baricentric weighting */ - ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo1 & 0x7fffff); /* Extract offset value */ - wo1 = (wo1 >> 23); /* Extract weighting value */ - vwe = wo0 - wo1; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo2 & 0x7fffff); /* Extract offset value */ - wo2 = (wo2 >> 23); /* Extract weighting value */ - vwe = wo1 - wo2; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo3 & 0x7fffff); /* Extract offset value */ - wo3 = (wo3 >> 23); /* Extract weighting value */ - vwe = wo2 - wo3; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo4 & 0x7fffff); /* Extract offset value */ - wo4 = (wo4 >> 23); /* Extract weighting value */ - vwe = wo3 - wo4; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo5 & 0x7fffff); /* Extract offset value */ - wo5 = (wo5 >> 23); /* Extract weighting value */ - vwe = wo4 - wo5; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - vwe = wo5; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += 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 */ - oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */ - op0[1] = OT_E(ot1, oti); /* Write result */ - oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */ - op0[2] = OT_E(ot2, oti); /* Write result */ - oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */ - op0[3] = OT_E(ot3, oti); /* Write result */ - oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */ - op0[4] = OT_E(ot4, oti); /* Write result */ - oti = ((ova2 >> 24) & 0xff); /* Extract integer part of result */ - op0[5] = OT_E(ot5, oti); /* Write result */ - oti = ((ova3 >> 8) & 0xff); /* Extract integer part of result */ - op0[6] = OT_E(ot6, oti); /* Write result */ - } - } -} -#undef IT_WO -#undef IT_IX -#undef CEX -#undef IM_O -#undef IM_FE -#undef IM_PE -#undef OT_E - -static void -imdi_k89_gen( -genspec *g /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x08, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x14, 0x00, 0x00, 0x00, 0x00, 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, 0x04, 0x08, - 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08, - 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7, - 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7, - 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08, - 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00, - 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7, - 0x2c, 0xf3, 0xdc, 0xb7, 0x36, 0x5f, 0x37, 0x5f, - 0x69, 0x38, 0x5f, 0x69, 0x31, 0x36, 0x5f, 0x66, - 0x00, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00, - 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf, - 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08, - 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf, - 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x38, 0x39, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01, - 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7, - 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7, - 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08, - 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08, - 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf, - 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7, - 0x00, 0xf0, 0x04, 0x08 - }; /* Structure image */ - - memcpy(g, data, sizeof(data)); /* Initialise the structure */ -} - -static void -imdi_k89_tab( -tabspec *t /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0xdc, 0x60, 0xef, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff - }; /* Structure image */ - - memcpy(t, data, sizeof(data)); /* Initialise the structure */ -} - -/* 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 = 7 - Input channel 0 bits = 8 - Input channel 0 increment = 7 - Input channel 1 bits = 8 - Input channel 1 increment = 7 - Input channel 2 bits = 8 - Input channel 2 increment = 7 - Input channel 3 bits = 8 - Input channel 3 increment = 7 - Input channel 4 bits = 8 - Input channel 4 increment = 7 - Input channel 5 bits = 8 - Input channel 5 increment = 7 - Input channel 6 bits = 8 - Input channel 6 increment = 7 - Input is channel interleaved - Input channels are separate words - Input value extraction is done in input table lookup - - Output channels per pixel = 7 - Output channel 0 bits = 16 - Output channel 0 increment = 7 - Output channel 1 bits = 16 - Output channel 1 increment = 7 - Output channel 2 bits = 16 - Output channel 2 increment = 7 - Output channel 3 bits = 16 - Output channel 3 increment = 7 - Output channel 4 bits = 16 - Output channel 4 increment = 7 - Output channel 5 bits = 16 - Output channel 5 increment = 7 - Output channel 6 bits = 16 - Output channel 6 increment = 7 - Output is channel interleaved - - Output channels are separate words - Weight+voffset bits = 32 - Interpolation table index bits = 32 - Interpolation table max resolution = 12 - */ - -/* - 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 <memory.h> -#include "imdi_imp.h" -#define IMDI_INCLUDED -#endif /* IMDI_INCLUDED */ - -#ifndef DEFINED_pointer -#define DEFINED_pointer -typedef unsigned char * pointer; -#endif - -/* Input table interp. index */ -#define IT_IX(p, off) *((unsigned int *)((p) + 0 + (off) * 8)) - -/* Input table input weighting/offset value enty */ -#define IT_WO(p, off) *((unsigned int *)((p) + 4 + (off) * 8)) - -/* Conditional exchange for sorting */ -#define CEX(A, B) if (A < B) { A ^= B; B ^= A; A ^= B; } - -/* Interpolation multi-dim. table access */ -#define IM_O(off) ((off) * 16) - -/* Interpolation table - get vertex values */ -#define IM_FE(p, v, c) *((unsigned int *)((p) + (v) * 8 + (c) * 4)) -#define IM_PE(p, v) *((unsigned int *)((p) + 12 + (v) * 8)) - -/* Output table indexes */ -#define OT_E(p, off) *((unsigned short *)((p) + (off) * 2)) - -static void -imdi_k90( -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 short *op0 = (unsigned short *)outp[0]; - unsigned char *ep = ip0 + npix * 7 ; - pointer it0 = (pointer)p->in_tables[0]; - pointer it1 = (pointer)p->in_tables[1]; - pointer it2 = (pointer)p->in_tables[2]; - pointer it3 = (pointer)p->in_tables[3]; - pointer it4 = (pointer)p->in_tables[4]; - pointer it5 = (pointer)p->in_tables[5]; - pointer it6 = (pointer)p->in_tables[6]; - pointer ot0 = (pointer)p->out_tables[0]; - pointer ot1 = (pointer)p->out_tables[1]; - pointer ot2 = (pointer)p->out_tables[2]; - pointer ot3 = (pointer)p->out_tables[3]; - pointer ot4 = (pointer)p->out_tables[4]; - pointer ot5 = (pointer)p->out_tables[5]; - pointer ot6 = (pointer)p->out_tables[6]; - pointer im_base = (pointer)p->im_table; - - for(;ip0 < ep; ip0 += 7, op0 += 7) { - unsigned int ova0; /* Output value accumulator */ - unsigned int ova1; /* Output value accumulator */ - unsigned int ova2; /* Output value accumulator */ - unsigned int ova3; /* Output value partial accumulator */ - { - pointer imp; - unsigned int wo0; /* Weighting value and vertex offset variable */ - unsigned int wo1; /* Weighting value and vertex offset variable */ - unsigned int wo2; /* Weighting value and vertex offset variable */ - unsigned int wo3; /* Weighting value and vertex offset variable */ - unsigned int wo4; /* Weighting value and vertex offset variable */ - unsigned int wo5; /* Weighting value and vertex offset variable */ - unsigned int wo6; /* Weighting value and vertex offset variable */ - { - unsigned int ti_i; /* Interpolation index variable */ - - ti_i = IT_IX(it0, ip0[0]); - wo0 = IT_WO(it0, ip0[0]); - ti_i += IT_IX(it1, ip0[1]); - wo1 = IT_WO(it1, ip0[1]); - ti_i += IT_IX(it2, ip0[2]); - wo2 = IT_WO(it2, ip0[2]); - ti_i += IT_IX(it3, ip0[3]); - wo3 = IT_WO(it3, ip0[3]); - ti_i += IT_IX(it4, ip0[4]); - wo4 = IT_WO(it4, ip0[4]); - ti_i += IT_IX(it5, ip0[5]); - wo5 = IT_WO(it5, ip0[5]); - ti_i += IT_IX(it6, ip0[6]); - wo6 = IT_WO(it6, ip0[6]); - - imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */ - - /* Sort weighting values and vertex offset values */ - CEX(wo0, wo1); - CEX(wo0, wo2); - CEX(wo0, wo3); - CEX(wo0, wo4); - CEX(wo0, wo5); - CEX(wo0, wo6); - CEX(wo1, wo2); - CEX(wo1, wo3); - CEX(wo1, wo4); - CEX(wo1, wo5); - CEX(wo1, wo6); - CEX(wo2, wo3); - CEX(wo2, wo4); - CEX(wo2, wo5); - CEX(wo2, wo6); - CEX(wo3, wo4); - CEX(wo3, wo5); - CEX(wo3, wo6); - CEX(wo4, wo5); - CEX(wo4, wo6); - CEX(wo5, wo6); - } - { - unsigned int nvof; /* Next vertex offset value */ - unsigned int vof; /* Vertex offset value */ - unsigned int vwe; /* Vertex weighting */ - - vof = 0; /* First vertex offset is 0 */ - nvof = (wo0 & 0x7fffff); /* Extract offset value */ - wo0 = (wo0 >> 23); /* Extract weighting value */ - vwe = 256 - wo0; /* Baricentric weighting */ - ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo1 & 0x7fffff); /* Extract offset value */ - wo1 = (wo1 >> 23); /* Extract weighting value */ - vwe = wo0 - wo1; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo2 & 0x7fffff); /* Extract offset value */ - wo2 = (wo2 >> 23); /* Extract weighting value */ - vwe = wo1 - wo2; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo3 & 0x7fffff); /* Extract offset value */ - wo3 = (wo3 >> 23); /* Extract weighting value */ - vwe = wo2 - wo3; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo4 & 0x7fffff); /* Extract offset value */ - wo4 = (wo4 >> 23); /* Extract weighting value */ - vwe = wo3 - wo4; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo5 & 0x7fffff); /* Extract offset value */ - wo5 = (wo5 >> 23); /* Extract weighting value */ - vwe = wo4 - wo5; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo6 & 0x7fffff); /* Extract offset value */ - wo6 = (wo6 >> 23); /* Extract weighting value */ - vwe = wo5 - wo6; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - vwe = wo6; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += 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 */ - oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */ - op0[1] = OT_E(ot1, oti); /* Write result */ - oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */ - op0[2] = OT_E(ot2, oti); /* Write result */ - oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */ - op0[3] = OT_E(ot3, oti); /* Write result */ - oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */ - op0[4] = OT_E(ot4, oti); /* Write result */ - oti = ((ova2 >> 24) & 0xff); /* Extract integer part of result */ - op0[5] = OT_E(ot5, oti); /* Write result */ - oti = ((ova3 >> 8) & 0xff); /* Extract integer part of result */ - op0[6] = OT_E(ot6, oti); /* Write result */ - } - } -} -#undef IT_WO -#undef IT_IX -#undef CEX -#undef IM_O -#undef IM_FE -#undef IM_PE -#undef OT_E - -static void -imdi_k90_gen( -genspec *g /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x0c, 0x00, 0x00, 0x00, 0x00, 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, 0x04, 0x08, - 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08, - 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7, - 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7, - 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08, - 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00, - 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7, - 0x2c, 0xf3, 0xdc, 0xb7, 0x37, 0x5f, 0x37, 0x5f, - 0x69, 0x38, 0x5f, 0x69, 0x31, 0x36, 0x5f, 0x66, - 0x00, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00, - 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf, - 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08, - 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf, - 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x39, 0x30, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01, - 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7, - 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7, - 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08, - 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08, - 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf, - 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7, - 0x00, 0xf0, 0x04, 0x08 - }; /* Structure image */ - - memcpy(g, data, sizeof(data)); /* Initialise the structure */ -} - -static void -imdi_k90_tab( -tabspec *t /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0xdc, 0x60, 0xef, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff - }; /* Structure image */ - - memcpy(t, data, sizeof(data)); /* Initialise the structure */ -} - -/* 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 = 8 - Input channel 0 bits = 8 - Input channel 0 increment = 8 - Input channel 1 bits = 8 - Input channel 1 increment = 8 - Input channel 2 bits = 8 - Input channel 2 increment = 8 - Input channel 3 bits = 8 - Input channel 3 increment = 8 - Input channel 4 bits = 8 - Input channel 4 increment = 8 - Input channel 5 bits = 8 - Input channel 5 increment = 8 - Input channel 6 bits = 8 - Input channel 6 increment = 8 - Input channel 7 bits = 8 - Input channel 7 increment = 8 - Input is channel interleaved - Input channels are separate words - Input value extraction is done in input table lookup - - Output channels per pixel = 7 - Output channel 0 bits = 16 - Output channel 0 increment = 7 - Output channel 1 bits = 16 - Output channel 1 increment = 7 - Output channel 2 bits = 16 - Output channel 2 increment = 7 - Output channel 3 bits = 16 - Output channel 3 increment = 7 - Output channel 4 bits = 16 - Output channel 4 increment = 7 - Output channel 5 bits = 16 - Output channel 5 increment = 7 - Output channel 6 bits = 16 - Output channel 6 increment = 7 - Output is channel interleaved - - Output channels are separate words - Weight+voffset bits = 32 - Interpolation table index bits = 32 - Interpolation table max resolution = 8 - */ - -/* - 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 <memory.h> -#include "imdi_imp.h" -#define IMDI_INCLUDED -#endif /* IMDI_INCLUDED */ - -#ifndef DEFINED_pointer -#define DEFINED_pointer -typedef unsigned char * pointer; -#endif - -/* Input table interp. index */ -#define IT_IX(p, off) *((unsigned int *)((p) + 0 + (off) * 8)) - -/* Input table input weighting/offset value enty */ -#define IT_WO(p, off) *((unsigned int *)((p) + 4 + (off) * 8)) - -/* Conditional exchange for sorting */ -#define CEX(A, B) if (A < B) { A ^= B; B ^= A; A ^= B; } - -/* Interpolation multi-dim. table access */ -#define IM_O(off) ((off) * 16) - -/* Interpolation table - get vertex values */ -#define IM_FE(p, v, c) *((unsigned int *)((p) + (v) * 8 + (c) * 4)) -#define IM_PE(p, v) *((unsigned int *)((p) + 12 + (v) * 8)) - -/* Output table indexes */ -#define OT_E(p, off) *((unsigned short *)((p) + (off) * 2)) - -static void -imdi_k91( -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 short *op0 = (unsigned short *)outp[0]; - unsigned char *ep = ip0 + npix * 8 ; - pointer it0 = (pointer)p->in_tables[0]; - pointer it1 = (pointer)p->in_tables[1]; - pointer it2 = (pointer)p->in_tables[2]; - pointer it3 = (pointer)p->in_tables[3]; - pointer it4 = (pointer)p->in_tables[4]; - pointer it5 = (pointer)p->in_tables[5]; - pointer it6 = (pointer)p->in_tables[6]; - pointer it7 = (pointer)p->in_tables[7]; - pointer ot0 = (pointer)p->out_tables[0]; - pointer ot1 = (pointer)p->out_tables[1]; - pointer ot2 = (pointer)p->out_tables[2]; - pointer ot3 = (pointer)p->out_tables[3]; - pointer ot4 = (pointer)p->out_tables[4]; - pointer ot5 = (pointer)p->out_tables[5]; - pointer ot6 = (pointer)p->out_tables[6]; - pointer im_base = (pointer)p->im_table; - - for(;ip0 < ep; ip0 += 8, op0 += 7) { - unsigned int ova0; /* Output value accumulator */ - unsigned int ova1; /* Output value accumulator */ - unsigned int ova2; /* Output value accumulator */ - unsigned int ova3; /* Output value partial accumulator */ - { - pointer imp; - unsigned int wo0; /* Weighting value and vertex offset variable */ - unsigned int wo1; /* Weighting value and vertex offset variable */ - unsigned int wo2; /* Weighting value and vertex offset variable */ - unsigned int wo3; /* Weighting value and vertex offset variable */ - unsigned int wo4; /* Weighting value and vertex offset variable */ - unsigned int wo5; /* Weighting value and vertex offset variable */ - unsigned int wo6; /* Weighting value and vertex offset variable */ - unsigned int wo7; /* Weighting value and vertex offset variable */ - { - unsigned int ti_i; /* Interpolation index variable */ - - ti_i = IT_IX(it0, ip0[0]); - wo0 = IT_WO(it0, ip0[0]); - ti_i += IT_IX(it1, ip0[1]); - wo1 = IT_WO(it1, ip0[1]); - ti_i += IT_IX(it2, ip0[2]); - wo2 = IT_WO(it2, ip0[2]); - ti_i += IT_IX(it3, ip0[3]); - wo3 = IT_WO(it3, ip0[3]); - ti_i += IT_IX(it4, ip0[4]); - wo4 = IT_WO(it4, ip0[4]); - ti_i += IT_IX(it5, ip0[5]); - wo5 = IT_WO(it5, ip0[5]); - ti_i += IT_IX(it6, ip0[6]); - wo6 = IT_WO(it6, ip0[6]); - ti_i += IT_IX(it7, ip0[7]); - wo7 = IT_WO(it7, ip0[7]); - - imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */ - - /* Sort weighting values and vertex offset values */ - CEX(wo0, wo1); - CEX(wo0, wo2); - CEX(wo0, wo3); - CEX(wo0, wo4); - CEX(wo0, wo5); - CEX(wo0, wo6); - CEX(wo0, wo7); - CEX(wo1, wo2); - CEX(wo1, wo3); - CEX(wo1, wo4); - CEX(wo1, wo5); - CEX(wo1, wo6); - CEX(wo1, wo7); - CEX(wo2, wo3); - CEX(wo2, wo4); - CEX(wo2, wo5); - CEX(wo2, wo6); - CEX(wo2, wo7); - CEX(wo3, wo4); - CEX(wo3, wo5); - CEX(wo3, wo6); - CEX(wo3, wo7); - CEX(wo4, wo5); - CEX(wo4, wo6); - CEX(wo4, wo7); - CEX(wo5, wo6); - CEX(wo5, wo7); - CEX(wo6, wo7); - } - { - unsigned int nvof; /* Next vertex offset value */ - unsigned int vof; /* Vertex offset value */ - unsigned int vwe; /* Vertex weighting */ - - vof = 0; /* First vertex offset is 0 */ - nvof = (wo0 & 0x7fffff); /* Extract offset value */ - wo0 = (wo0 >> 23); /* Extract weighting value */ - vwe = 256 - wo0; /* Baricentric weighting */ - ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo1 & 0x7fffff); /* Extract offset value */ - wo1 = (wo1 >> 23); /* Extract weighting value */ - vwe = wo0 - wo1; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo2 & 0x7fffff); /* Extract offset value */ - wo2 = (wo2 >> 23); /* Extract weighting value */ - vwe = wo1 - wo2; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo3 & 0x7fffff); /* Extract offset value */ - wo3 = (wo3 >> 23); /* Extract weighting value */ - vwe = wo2 - wo3; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo4 & 0x7fffff); /* Extract offset value */ - wo4 = (wo4 >> 23); /* Extract weighting value */ - vwe = wo3 - wo4; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo5 & 0x7fffff); /* Extract offset value */ - wo5 = (wo5 >> 23); /* Extract weighting value */ - vwe = wo4 - wo5; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo6 & 0x7fffff); /* Extract offset value */ - wo6 = (wo6 >> 23); /* Extract weighting value */ - vwe = wo5 - wo6; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo7 & 0x7fffff); /* Extract offset value */ - wo7 = (wo7 >> 23); /* Extract weighting value */ - vwe = wo6 - wo7; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */ - vof += nvof; /* Move to next vertex */ - vwe = wo7; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += 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 */ - oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */ - op0[1] = OT_E(ot1, oti); /* Write result */ - oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */ - op0[2] = OT_E(ot2, oti); /* Write result */ - oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */ - op0[3] = OT_E(ot3, oti); /* Write result */ - oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */ - op0[4] = OT_E(ot4, oti); /* Write result */ - oti = ((ova2 >> 24) & 0xff); /* Extract integer part of result */ - op0[5] = OT_E(ot5, oti); /* Write result */ - oti = ((ova3 >> 8) & 0xff); /* Extract integer part of result */ - op0[6] = OT_E(ot6, oti); /* Write result */ - } - } -} -#undef IT_WO -#undef IT_IX -#undef CEX -#undef IM_O -#undef IM_FE -#undef IM_PE -#undef OT_E - -static void -imdi_k91_gen( -genspec *g /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 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, 0x04, 0x08, - 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08, - 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7, - 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7, - 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08, - 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00, - 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7, - 0x2c, 0xf3, 0xdc, 0xb7, 0x38, 0x5f, 0x37, 0x5f, - 0x69, 0x38, 0x5f, 0x69, 0x31, 0x36, 0x5f, 0x66, - 0x00, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00, - 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf, - 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08, - 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf, - 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x39, 0x31, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01, - 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7, - 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7, - 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08, - 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08, - 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf, - 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7, - 0x00, 0xf0, 0x04, 0x08 - }; /* Structure image */ - - memcpy(g, data, sizeof(data)); /* Initialise the structure */ -} - -static void -imdi_k91_tab( -tabspec *t /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0xdc, 0x60, 0xef, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff - }; /* Structure image */ - - memcpy(t, data, sizeof(data)); /* Initialise the structure */ -} - -/* 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 = 8 - Output channel 0 bits = 16 - Output channel 0 increment = 8 - Output channel 1 bits = 16 - Output channel 1 increment = 8 - Output channel 2 bits = 16 - Output channel 2 increment = 8 - Output channel 3 bits = 16 - Output channel 3 increment = 8 - Output channel 4 bits = 16 - Output channel 4 increment = 8 - Output channel 5 bits = 16 - Output channel 5 increment = 8 - Output channel 6 bits = 16 - Output channel 6 increment = 8 - Output channel 7 bits = 16 - Output channel 7 increment = 8 - 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 = 255 - */ - -/* - 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 <memory.h> -#include "imdi_imp.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) * 16) - -/* Interpolation table - get vertex values */ -#define IM_FE(p, v, c) *((unsigned int *)((p) + (v) * 8 + (c) * 4)) - -/* Output table indexes */ -#define OT_E(p, off) *((unsigned short *)((p) + (off) * 2)) - -static void -imdi_k92( -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 short *op0 = (unsigned short *)outp[0]; - unsigned char *ep = ip0 + npix * 1 ; - pointer it0 = (pointer)p->in_tables[0]; - pointer ot0 = (pointer)p->out_tables[0]; - pointer ot1 = (pointer)p->out_tables[1]; - pointer ot2 = (pointer)p->out_tables[2]; - pointer ot3 = (pointer)p->out_tables[3]; - pointer ot4 = (pointer)p->out_tables[4]; - pointer ot5 = (pointer)p->out_tables[5]; - pointer ot6 = (pointer)p->out_tables[6]; - pointer ot7 = (pointer)p->out_tables[7]; - pointer sw_base = (pointer)p->sw_table; - pointer im_base = (pointer)p->im_table; - - for(;ip0 < ep; ip0 += 1, op0 += 8) { - unsigned int ova0; /* Output value accumulator */ - unsigned int ova1; /* Output value accumulator */ - unsigned int ova2; /* Output value accumulator */ - unsigned int ova3; /* Output value 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_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 = IM_FE(imp, vof, 3) * vwe; /* Accumulate 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_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate 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 */ - oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */ - op0[1] = OT_E(ot1, oti); /* Write result */ - oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */ - op0[2] = OT_E(ot2, oti); /* Write result */ - oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */ - op0[3] = OT_E(ot3, oti); /* Write result */ - oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */ - op0[4] = OT_E(ot4, oti); /* Write result */ - oti = ((ova2 >> 24) & 0xff); /* Extract integer part of result */ - op0[5] = OT_E(ot5, oti); /* Write result */ - oti = ((ova3 >> 8) & 0xff); /* Extract integer part of result */ - op0[6] = OT_E(ot6, oti); /* Write result */ - oti = ((ova3 >> 24) & 0xff); /* Extract integer part of result */ - op0[7] = OT_E(ot7, oti); /* Write result */ - } - } -} -#undef IT_IT -#undef SW_O -#undef SX_WO -#undef IM_O -#undef IM_FE -#undef OT_E - -static void -imdi_k92_gen( -genspec *g /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0xff, 0x00, 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, 0x04, 0x08, - 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08, - 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7, - 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7, - 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08, - 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00, - 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7, - 0x2c, 0xf3, 0xdc, 0xb7, 0x31, 0x5f, 0x38, 0x5f, - 0x69, 0x38, 0x5f, 0x69, 0x31, 0x36, 0x5f, 0x66, - 0x00, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00, - 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf, - 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08, - 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf, - 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x39, 0x32, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01, - 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7, - 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7, - 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08, - 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08, - 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf, - 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7, - 0x00, 0xf0, 0x04, 0x08 - }; /* Structure image */ - - memcpy(g, data, sizeof(data)); /* Initialise the structure */ -} - -static void -imdi_k92_tab( -tabspec *t /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff - }; /* Structure image */ - - memcpy(t, data, sizeof(data)); /* Initialise the structure */ -} - -/* 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 = 3 - Input channel 0 bits = 8 - Input channel 0 increment = 3 - Input channel 1 bits = 8 - Input channel 1 increment = 3 - Input channel 2 bits = 8 - Input channel 2 increment = 3 - Input is channel interleaved - Input channels are separate words - Input value extraction is done in input table lookup - - Output channels per pixel = 8 - Output channel 0 bits = 16 - Output channel 0 increment = 8 - Output channel 1 bits = 16 - Output channel 1 increment = 8 - Output channel 2 bits = 16 - Output channel 2 increment = 8 - Output channel 3 bits = 16 - Output channel 3 increment = 8 - Output channel 4 bits = 16 - Output channel 4 increment = 8 - Output channel 5 bits = 16 - Output channel 5 increment = 8 - Output channel 6 bits = 16 - Output channel 6 increment = 8 - Output channel 7 bits = 16 - Output channel 7 increment = 8 - Output is channel interleaved - - Output channels are separate words - Simplex table index bits = 12 - Interpolation table index bits = 20 - Simplex table max resolution = 16 - Interpolation table max resolution = 101 - */ - -/* - 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 <memory.h> -#include "imdi_imp.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 int *)((p) + 0 + (off) * 4)) - -/* Simplex weighting table access */ -#define SW_O(off) ((off) * 16) - -/* Simplex table - get weighting value */ -#define SX_WE(p, v) *((unsigned short *)((p) + (v) * 4 + 0)) - -/* Simplex table - get offset value */ -#define SX_VO(p, v) *((unsigned short *)((p) + (v) * 4 + 2)) - -/* Interpolation multi-dim. table access */ -#define IM_O(off) ((off) * 16) - -/* Interpolation table - get vertex values */ -#define IM_FE(p, v, c) *((unsigned int *)((p) + (v) * 8 + (c) * 4)) - -/* Output table indexes */ -#define OT_E(p, off) *((unsigned short *)((p) + (off) * 2)) - -static void -imdi_k93( -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 short *op0 = (unsigned short *)outp[0]; - unsigned char *ep = ip0 + npix * 3 ; - pointer it0 = (pointer)p->in_tables[0]; - pointer it1 = (pointer)p->in_tables[1]; - pointer it2 = (pointer)p->in_tables[2]; - pointer ot0 = (pointer)p->out_tables[0]; - pointer ot1 = (pointer)p->out_tables[1]; - pointer ot2 = (pointer)p->out_tables[2]; - pointer ot3 = (pointer)p->out_tables[3]; - pointer ot4 = (pointer)p->out_tables[4]; - pointer ot5 = (pointer)p->out_tables[5]; - pointer ot6 = (pointer)p->out_tables[6]; - pointer ot7 = (pointer)p->out_tables[7]; - pointer sw_base = (pointer)p->sw_table; - pointer im_base = (pointer)p->im_table; - - for(;ip0 < ep; ip0 += 3, op0 += 8) { - unsigned int ova0; /* Output value accumulator */ - unsigned int ova1; /* Output value accumulator */ - unsigned int ova2; /* Output value accumulator */ - unsigned int ova3; /* Output value accumulator */ - { - pointer swp; - pointer imp; - { - unsigned int ti; /* Simplex+Interpolation index variable */ - - ti = IT_IT(it0, ip0[0]); - ti += IT_IT(it1, ip0[1]); - ti += IT_IT(it2, ip0[2]); - - imp = im_base + IM_O(ti >> 12); /* Extract interp. index and comp. entry */ - swp = sw_base + SW_O(ti & 0xfff); /* Extract simplex index and comp. entry */ - } - { - unsigned int vof; /* Vertex offset value */ - unsigned int vwe; /* Vertex weighting */ - - vof = SX_VO(swp, 0); /* Read vertex offset value */ - vwe = SX_WE(swp, 0); /* Read vertex weighting value */ - ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 = IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - vof = SX_VO(swp, 1); /* Read vertex offset value */ - vwe = SX_WE(swp, 1); /* Read vertex weighting value */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - vof = SX_VO(swp, 2); /* Read vertex offset value */ - vwe = SX_WE(swp, 2); /* Read vertex weighting value */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - vof = SX_VO(swp, 3); /* Read vertex offset value */ - vwe = SX_WE(swp, 3); /* Read vertex weighting value */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate 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 */ - oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */ - op0[1] = OT_E(ot1, oti); /* Write result */ - oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */ - op0[2] = OT_E(ot2, oti); /* Write result */ - oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */ - op0[3] = OT_E(ot3, oti); /* Write result */ - oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */ - op0[4] = OT_E(ot4, oti); /* Write result */ - oti = ((ova2 >> 24) & 0xff); /* Extract integer part of result */ - op0[5] = OT_E(ot5, oti); /* Write result */ - oti = ((ova3 >> 8) & 0xff); /* Extract integer part of result */ - op0[6] = OT_E(ot6, oti); /* Write result */ - oti = ((ova3 >> 24) & 0xff); /* Extract integer part of result */ - op0[7] = OT_E(ot7, oti); /* Write result */ - } - } -} -#undef IT_IT -#undef SW_O -#undef SX_WE -#undef SX_VO -#undef IM_O -#undef IM_FE -#undef OT_E - -static void -imdi_k93_gen( -genspec *g /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x08, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x65, 0x00, 0x00, 0x00, 0x10, 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, 0x04, 0x08, - 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08, - 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7, - 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7, - 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08, - 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00, - 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7, - 0x2c, 0xf3, 0xdc, 0xb7, 0x33, 0x5f, 0x38, 0x5f, - 0x69, 0x38, 0x5f, 0x69, 0x31, 0x36, 0x5f, 0x66, - 0x00, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00, - 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf, - 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08, - 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf, - 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x39, 0x33, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01, - 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7, - 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7, - 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08, - 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08, - 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf, - 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7, - 0x00, 0xf0, 0x04, 0x08 - }; /* Structure image */ - - memcpy(g, data, sizeof(data)); /* Initialise the structure */ -} - -static void -imdi_k93_tab( -tabspec *t /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x14, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff - }; /* Structure image */ - - memcpy(t, data, sizeof(data)); /* Initialise the structure */ -} - -/* 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 = 4 - Input channel 0 bits = 8 - Input channel 0 increment = 4 - Input channel 1 bits = 8 - Input channel 1 increment = 4 - Input channel 2 bits = 8 - Input channel 2 increment = 4 - Input channel 3 bits = 8 - Input channel 3 increment = 4 - Input is channel interleaved - Input channels are separate words - Input value extraction is done in input table lookup - - Output channels per pixel = 8 - Output channel 0 bits = 16 - Output channel 0 increment = 8 - Output channel 1 bits = 16 - Output channel 1 increment = 8 - Output channel 2 bits = 16 - Output channel 2 increment = 8 - Output channel 3 bits = 16 - Output channel 3 increment = 8 - Output channel 4 bits = 16 - Output channel 4 increment = 8 - Output channel 5 bits = 16 - Output channel 5 increment = 8 - Output channel 6 bits = 16 - Output channel 6 increment = 8 - Output channel 7 bits = 16 - Output channel 7 increment = 8 - Output is channel interleaved - - Output channels are separate words - Simplex table index bits = 32 - Interpolation table index bits = 32 - Simplex table max resolution = 255 - Interpolation table max resolution = 31 - */ - -/* - 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 <memory.h> -#include "imdi_imp.h" -#define IMDI_INCLUDED -#endif /* IMDI_INCLUDED */ - -#ifndef DEFINED_pointer -#define DEFINED_pointer -typedef unsigned char * pointer; -#endif - -/* Input table interp. index */ -#define IT_IX(p, off) *((unsigned int *)((p) + 4 + (off) * 8)) - -/* Input table simplex index enty */ -#define IT_SX(p, off) *((unsigned int *)((p) + 0 + (off) * 8)) - -/* Simplex weighting table access */ -#define SW_O(off) ((off) * 20) - -/* Simplex table - get weighting value */ -#define SX_WE(p, v) *((unsigned short *)((p) + (v) * 4 + 0)) - -/* Simplex table - get offset value */ -#define SX_VO(p, v) *((unsigned short *)((p) + (v) * 4 + 2)) - -/* Interpolation multi-dim. table access */ -#define IM_O(off) ((off) * 16) - -/* Interpolation table - get vertex values */ -#define IM_FE(p, v, c) *((unsigned int *)((p) + (v) * 8 + (c) * 4)) - -/* Output table indexes */ -#define OT_E(p, off) *((unsigned short *)((p) + (off) * 2)) - -static void -imdi_k94( -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 short *op0 = (unsigned short *)outp[0]; - unsigned char *ep = ip0 + npix * 4 ; - pointer it0 = (pointer)p->in_tables[0]; - pointer it1 = (pointer)p->in_tables[1]; - pointer it2 = (pointer)p->in_tables[2]; - pointer it3 = (pointer)p->in_tables[3]; - pointer ot0 = (pointer)p->out_tables[0]; - pointer ot1 = (pointer)p->out_tables[1]; - pointer ot2 = (pointer)p->out_tables[2]; - pointer ot3 = (pointer)p->out_tables[3]; - pointer ot4 = (pointer)p->out_tables[4]; - pointer ot5 = (pointer)p->out_tables[5]; - pointer ot6 = (pointer)p->out_tables[6]; - pointer ot7 = (pointer)p->out_tables[7]; - pointer sw_base = (pointer)p->sw_table; - pointer im_base = (pointer)p->im_table; - - for(;ip0 < ep; ip0 += 4, op0 += 8) { - unsigned int ova0; /* Output value accumulator */ - unsigned int ova1; /* Output value accumulator */ - unsigned int ova2; /* Output value accumulator */ - unsigned int ova3; /* Output value accumulator */ - { - pointer swp; - pointer imp; - { - unsigned int ti_s; /* Simplex index variable */ - unsigned int ti_i; /* Interpolation index variable */ - - ti_i = IT_IX(it0, ip0[0]); - ti_s = IT_SX(it0, ip0[0]); - ti_i += IT_IX(it1, ip0[1]); - ti_s += IT_SX(it1, ip0[1]); - ti_i += IT_IX(it2, ip0[2]); - ti_s += IT_SX(it2, ip0[2]); - ti_i += IT_IX(it3, ip0[3]); - ti_s += IT_SX(it3, ip0[3]); - - swp = sw_base + SW_O(ti_s); /* Compute simplex table entry pointer */ - imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */ - } - { - unsigned int vof; /* Vertex offset value */ - unsigned int vwe; /* Vertex weighting */ - - vof = SX_VO(swp, 0); /* Read vertex offset value */ - vwe = SX_WE(swp, 0); /* Read vertex weighting value */ - ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 = IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - vof = SX_VO(swp, 1); /* Read vertex offset value */ - vwe = SX_WE(swp, 1); /* Read vertex weighting value */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - vof = SX_VO(swp, 2); /* Read vertex offset value */ - vwe = SX_WE(swp, 2); /* Read vertex weighting value */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - vof = SX_VO(swp, 3); /* Read vertex offset value */ - vwe = SX_WE(swp, 3); /* Read vertex weighting value */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - vof = SX_VO(swp, 4); /* Read vertex offset value */ - vwe = SX_WE(swp, 4); /* Read vertex weighting value */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate 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 */ - oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */ - op0[1] = OT_E(ot1, oti); /* Write result */ - oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */ - op0[2] = OT_E(ot2, oti); /* Write result */ - oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */ - op0[3] = OT_E(ot3, oti); /* Write result */ - oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */ - op0[4] = OT_E(ot4, oti); /* Write result */ - oti = ((ova2 >> 24) & 0xff); /* Extract integer part of result */ - op0[5] = OT_E(ot5, oti); /* Write result */ - oti = ((ova3 >> 8) & 0xff); /* Extract integer part of result */ - op0[6] = OT_E(ot6, oti); /* Write result */ - oti = ((ova3 >> 24) & 0xff); /* Extract integer part of result */ - op0[7] = OT_E(ot7, oti); /* Write result */ - } - } -} -#undef IT_IX -#undef IT_SX -#undef SW_O -#undef SX_WE -#undef SX_VO -#undef IM_O -#undef IM_FE -#undef OT_E - -static void -imdi_k94_gen( -genspec *g /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x1f, 0x00, 0x00, 0x00, 0xff, 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, 0x04, 0x08, - 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08, - 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7, - 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7, - 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08, - 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00, - 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7, - 0x2c, 0xf3, 0xdc, 0xb7, 0x34, 0x5f, 0x38, 0x5f, - 0x69, 0x38, 0x5f, 0x69, 0x31, 0x36, 0x5f, 0x66, - 0x00, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00, - 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf, - 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08, - 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf, - 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x39, 0x34, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01, - 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7, - 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7, - 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08, - 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08, - 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf, - 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7, - 0x00, 0xf0, 0x04, 0x08 - }; /* Structure image */ - - memcpy(g, data, sizeof(data)); /* Initialise the structure */ -} - -static void -imdi_k94_tab( -tabspec *t /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x14, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff - }; /* Structure image */ - - memcpy(t, data, sizeof(data)); /* Initialise the structure */ -} - -/* 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 = 5 - Input channel 0 bits = 8 - Input channel 0 increment = 5 - Input channel 1 bits = 8 - Input channel 1 increment = 5 - Input channel 2 bits = 8 - Input channel 2 increment = 5 - Input channel 3 bits = 8 - Input channel 3 increment = 5 - Input channel 4 bits = 8 - Input channel 4 increment = 5 - Input is channel interleaved - Input channels are separate words - Input value extraction is done in input table lookup - - Output channels per pixel = 8 - Output channel 0 bits = 16 - Output channel 0 increment = 8 - Output channel 1 bits = 16 - Output channel 1 increment = 8 - Output channel 2 bits = 16 - Output channel 2 increment = 8 - Output channel 3 bits = 16 - Output channel 3 increment = 8 - Output channel 4 bits = 16 - Output channel 4 increment = 8 - Output channel 5 bits = 16 - Output channel 5 increment = 8 - Output channel 6 bits = 16 - Output channel 6 increment = 8 - Output channel 7 bits = 16 - Output channel 7 increment = 8 - Output is channel interleaved - - Output channels are separate words - Weight+voffset bits = 32 - Interpolation table index bits = 32 - Interpolation table max resolution = 45 - */ - -/* - 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 <memory.h> -#include "imdi_imp.h" -#define IMDI_INCLUDED -#endif /* IMDI_INCLUDED */ - -#ifndef DEFINED_pointer -#define DEFINED_pointer -typedef unsigned char * pointer; -#endif - -/* Input table interp. index */ -#define IT_IX(p, off) *((unsigned int *)((p) + 0 + (off) * 8)) - -/* Input table input weighting/offset value enty */ -#define IT_WO(p, off) *((unsigned int *)((p) + 4 + (off) * 8)) - -/* Conditional exchange for sorting */ -#define CEX(A, B) if (A < B) { A ^= B; B ^= A; A ^= B; } - -/* Interpolation multi-dim. table access */ -#define IM_O(off) ((off) * 16) - -/* Interpolation table - get vertex values */ -#define IM_FE(p, v, c) *((unsigned int *)((p) + (v) * 8 + (c) * 4)) - -/* Output table indexes */ -#define OT_E(p, off) *((unsigned short *)((p) + (off) * 2)) - -static void -imdi_k95( -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 short *op0 = (unsigned short *)outp[0]; - unsigned char *ep = ip0 + npix * 5 ; - pointer it0 = (pointer)p->in_tables[0]; - pointer it1 = (pointer)p->in_tables[1]; - pointer it2 = (pointer)p->in_tables[2]; - pointer it3 = (pointer)p->in_tables[3]; - pointer it4 = (pointer)p->in_tables[4]; - pointer ot0 = (pointer)p->out_tables[0]; - pointer ot1 = (pointer)p->out_tables[1]; - pointer ot2 = (pointer)p->out_tables[2]; - pointer ot3 = (pointer)p->out_tables[3]; - pointer ot4 = (pointer)p->out_tables[4]; - pointer ot5 = (pointer)p->out_tables[5]; - pointer ot6 = (pointer)p->out_tables[6]; - pointer ot7 = (pointer)p->out_tables[7]; - pointer im_base = (pointer)p->im_table; - - for(;ip0 < ep; ip0 += 5, op0 += 8) { - unsigned int ova0; /* Output value accumulator */ - unsigned int ova1; /* Output value accumulator */ - unsigned int ova2; /* Output value accumulator */ - unsigned int ova3; /* Output value accumulator */ - { - pointer imp; - unsigned int wo0; /* Weighting value and vertex offset variable */ - unsigned int wo1; /* Weighting value and vertex offset variable */ - unsigned int wo2; /* Weighting value and vertex offset variable */ - unsigned int wo3; /* Weighting value and vertex offset variable */ - unsigned int wo4; /* Weighting value and vertex offset variable */ - { - unsigned int ti_i; /* Interpolation index variable */ - - ti_i = IT_IX(it0, ip0[0]); - wo0 = IT_WO(it0, ip0[0]); - ti_i += IT_IX(it1, ip0[1]); - wo1 = IT_WO(it1, ip0[1]); - ti_i += IT_IX(it2, ip0[2]); - wo2 = IT_WO(it2, ip0[2]); - ti_i += IT_IX(it3, ip0[3]); - wo3 = IT_WO(it3, ip0[3]); - ti_i += IT_IX(it4, ip0[4]); - wo4 = IT_WO(it4, ip0[4]); - - imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */ - - /* Sort weighting values and vertex offset values */ - CEX(wo0, wo1); - CEX(wo0, wo2); - CEX(wo0, wo3); - CEX(wo0, wo4); - CEX(wo1, wo2); - CEX(wo1, wo3); - CEX(wo1, wo4); - CEX(wo2, wo3); - CEX(wo2, wo4); - CEX(wo3, wo4); - } - { - unsigned int nvof; /* Next vertex offset value */ - unsigned int vof; /* Vertex offset value */ - unsigned int vwe; /* Vertex weighting */ - - vof = 0; /* First vertex offset is 0 */ - nvof = (wo0 & 0x7fffff); /* Extract offset value */ - wo0 = (wo0 >> 23); /* Extract weighting value */ - vwe = 256 - wo0; /* Baricentric weighting */ - ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 = IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo1 & 0x7fffff); /* Extract offset value */ - wo1 = (wo1 >> 23); /* Extract weighting value */ - vwe = wo0 - wo1; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo2 & 0x7fffff); /* Extract offset value */ - wo2 = (wo2 >> 23); /* Extract weighting value */ - vwe = wo1 - wo2; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo3 & 0x7fffff); /* Extract offset value */ - wo3 = (wo3 >> 23); /* Extract weighting value */ - vwe = wo2 - wo3; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo4 & 0x7fffff); /* Extract offset value */ - wo4 = (wo4 >> 23); /* Extract weighting value */ - vwe = wo3 - wo4; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - vwe = wo4; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate 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 */ - oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */ - op0[1] = OT_E(ot1, oti); /* Write result */ - oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */ - op0[2] = OT_E(ot2, oti); /* Write result */ - oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */ - op0[3] = OT_E(ot3, oti); /* Write result */ - oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */ - op0[4] = OT_E(ot4, oti); /* Write result */ - oti = ((ova2 >> 24) & 0xff); /* Extract integer part of result */ - op0[5] = OT_E(ot5, oti); /* Write result */ - oti = ((ova3 >> 8) & 0xff); /* Extract integer part of result */ - op0[6] = OT_E(ot6, oti); /* Write result */ - oti = ((ova3 >> 24) & 0xff); /* Extract integer part of result */ - op0[7] = OT_E(ot7, oti); /* Write result */ - } - } -} -#undef IT_WO -#undef IT_IX -#undef CEX -#undef IM_O -#undef IM_FE -#undef OT_E - -static void -imdi_k95_gen( -genspec *g /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x08, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x2d, 0x00, 0x00, 0x00, 0x00, 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, 0x04, 0x08, - 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08, - 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7, - 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7, - 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08, - 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00, - 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7, - 0x2c, 0xf3, 0xdc, 0xb7, 0x35, 0x5f, 0x38, 0x5f, - 0x69, 0x38, 0x5f, 0x69, 0x31, 0x36, 0x5f, 0x66, - 0x00, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00, - 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf, - 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08, - 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf, - 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x39, 0x35, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01, - 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7, - 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7, - 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08, - 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08, - 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf, - 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7, - 0x00, 0xf0, 0x04, 0x08 - }; /* Structure image */ - - memcpy(g, data, sizeof(data)); /* Initialise the structure */ -} - -static void -imdi_k95_tab( -tabspec *t /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff - }; /* Structure image */ - - memcpy(t, data, sizeof(data)); /* Initialise the structure */ -} - -/* 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 = 6 - Input channel 0 bits = 8 - Input channel 0 increment = 6 - Input channel 1 bits = 8 - Input channel 1 increment = 6 - Input channel 2 bits = 8 - Input channel 2 increment = 6 - Input channel 3 bits = 8 - Input channel 3 increment = 6 - Input channel 4 bits = 8 - Input channel 4 increment = 6 - Input channel 5 bits = 8 - Input channel 5 increment = 6 - Input is channel interleaved - Input channels are separate words - Input value extraction is done in input table lookup - - Output channels per pixel = 8 - Output channel 0 bits = 16 - Output channel 0 increment = 8 - Output channel 1 bits = 16 - Output channel 1 increment = 8 - Output channel 2 bits = 16 - Output channel 2 increment = 8 - Output channel 3 bits = 16 - Output channel 3 increment = 8 - Output channel 4 bits = 16 - Output channel 4 increment = 8 - Output channel 5 bits = 16 - Output channel 5 increment = 8 - Output channel 6 bits = 16 - Output channel 6 increment = 8 - Output channel 7 bits = 16 - Output channel 7 increment = 8 - Output is channel interleaved - - Output channels are separate words - Weight+voffset bits = 32 - Interpolation table index bits = 32 - Interpolation table max resolution = 20 - */ - -/* - 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 <memory.h> -#include "imdi_imp.h" -#define IMDI_INCLUDED -#endif /* IMDI_INCLUDED */ - -#ifndef DEFINED_pointer -#define DEFINED_pointer -typedef unsigned char * pointer; -#endif - -/* Input table interp. index */ -#define IT_IX(p, off) *((unsigned int *)((p) + 0 + (off) * 8)) - -/* Input table input weighting/offset value enty */ -#define IT_WO(p, off) *((unsigned int *)((p) + 4 + (off) * 8)) - -/* Conditional exchange for sorting */ -#define CEX(A, B) if (A < B) { A ^= B; B ^= A; A ^= B; } - -/* Interpolation multi-dim. table access */ -#define IM_O(off) ((off) * 16) - -/* Interpolation table - get vertex values */ -#define IM_FE(p, v, c) *((unsigned int *)((p) + (v) * 8 + (c) * 4)) - -/* Output table indexes */ -#define OT_E(p, off) *((unsigned short *)((p) + (off) * 2)) - -static void -imdi_k96( -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 short *op0 = (unsigned short *)outp[0]; - unsigned char *ep = ip0 + npix * 6 ; - pointer it0 = (pointer)p->in_tables[0]; - pointer it1 = (pointer)p->in_tables[1]; - pointer it2 = (pointer)p->in_tables[2]; - pointer it3 = (pointer)p->in_tables[3]; - pointer it4 = (pointer)p->in_tables[4]; - pointer it5 = (pointer)p->in_tables[5]; - pointer ot0 = (pointer)p->out_tables[0]; - pointer ot1 = (pointer)p->out_tables[1]; - pointer ot2 = (pointer)p->out_tables[2]; - pointer ot3 = (pointer)p->out_tables[3]; - pointer ot4 = (pointer)p->out_tables[4]; - pointer ot5 = (pointer)p->out_tables[5]; - pointer ot6 = (pointer)p->out_tables[6]; - pointer ot7 = (pointer)p->out_tables[7]; - pointer im_base = (pointer)p->im_table; - - for(;ip0 < ep; ip0 += 6, op0 += 8) { - unsigned int ova0; /* Output value accumulator */ - unsigned int ova1; /* Output value accumulator */ - unsigned int ova2; /* Output value accumulator */ - unsigned int ova3; /* Output value accumulator */ - { - pointer imp; - unsigned int wo0; /* Weighting value and vertex offset variable */ - unsigned int wo1; /* Weighting value and vertex offset variable */ - unsigned int wo2; /* Weighting value and vertex offset variable */ - unsigned int wo3; /* Weighting value and vertex offset variable */ - unsigned int wo4; /* Weighting value and vertex offset variable */ - unsigned int wo5; /* Weighting value and vertex offset variable */ - { - unsigned int ti_i; /* Interpolation index variable */ - - ti_i = IT_IX(it0, ip0[0]); - wo0 = IT_WO(it0, ip0[0]); - ti_i += IT_IX(it1, ip0[1]); - wo1 = IT_WO(it1, ip0[1]); - ti_i += IT_IX(it2, ip0[2]); - wo2 = IT_WO(it2, ip0[2]); - ti_i += IT_IX(it3, ip0[3]); - wo3 = IT_WO(it3, ip0[3]); - ti_i += IT_IX(it4, ip0[4]); - wo4 = IT_WO(it4, ip0[4]); - ti_i += IT_IX(it5, ip0[5]); - wo5 = IT_WO(it5, ip0[5]); - - imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */ - - /* Sort weighting values and vertex offset values */ - CEX(wo0, wo1); - CEX(wo0, wo2); - CEX(wo0, wo3); - CEX(wo0, wo4); - CEX(wo0, wo5); - CEX(wo1, wo2); - CEX(wo1, wo3); - CEX(wo1, wo4); - CEX(wo1, wo5); - CEX(wo2, wo3); - CEX(wo2, wo4); - CEX(wo2, wo5); - CEX(wo3, wo4); - CEX(wo3, wo5); - CEX(wo4, wo5); - } - { - unsigned int nvof; /* Next vertex offset value */ - unsigned int vof; /* Vertex offset value */ - unsigned int vwe; /* Vertex weighting */ - - vof = 0; /* First vertex offset is 0 */ - nvof = (wo0 & 0x7fffff); /* Extract offset value */ - wo0 = (wo0 >> 23); /* Extract weighting value */ - vwe = 256 - wo0; /* Baricentric weighting */ - ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 = IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo1 & 0x7fffff); /* Extract offset value */ - wo1 = (wo1 >> 23); /* Extract weighting value */ - vwe = wo0 - wo1; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo2 & 0x7fffff); /* Extract offset value */ - wo2 = (wo2 >> 23); /* Extract weighting value */ - vwe = wo1 - wo2; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo3 & 0x7fffff); /* Extract offset value */ - wo3 = (wo3 >> 23); /* Extract weighting value */ - vwe = wo2 - wo3; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo4 & 0x7fffff); /* Extract offset value */ - wo4 = (wo4 >> 23); /* Extract weighting value */ - vwe = wo3 - wo4; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo5 & 0x7fffff); /* Extract offset value */ - wo5 = (wo5 >> 23); /* Extract weighting value */ - vwe = wo4 - wo5; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - vwe = wo5; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate 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 */ - oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */ - op0[1] = OT_E(ot1, oti); /* Write result */ - oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */ - op0[2] = OT_E(ot2, oti); /* Write result */ - oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */ - op0[3] = OT_E(ot3, oti); /* Write result */ - oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */ - op0[4] = OT_E(ot4, oti); /* Write result */ - oti = ((ova2 >> 24) & 0xff); /* Extract integer part of result */ - op0[5] = OT_E(ot5, oti); /* Write result */ - oti = ((ova3 >> 8) & 0xff); /* Extract integer part of result */ - op0[6] = OT_E(ot6, oti); /* Write result */ - oti = ((ova3 >> 24) & 0xff); /* Extract integer part of result */ - op0[7] = OT_E(ot7, oti); /* Write result */ - } - } -} -#undef IT_WO -#undef IT_IX -#undef CEX -#undef IM_O -#undef IM_FE -#undef OT_E - -static void -imdi_k96_gen( -genspec *g /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x08, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x14, 0x00, 0x00, 0x00, 0x00, 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, 0x04, 0x08, - 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08, - 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7, - 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7, - 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08, - 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00, - 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7, - 0x2c, 0xf3, 0xdc, 0xb7, 0x36, 0x5f, 0x38, 0x5f, - 0x69, 0x38, 0x5f, 0x69, 0x31, 0x36, 0x5f, 0x66, - 0x00, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00, - 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf, - 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08, - 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf, - 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x39, 0x36, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01, - 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7, - 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7, - 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08, - 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08, - 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf, - 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7, - 0x00, 0xf0, 0x04, 0x08 - }; /* Structure image */ - - memcpy(g, data, sizeof(data)); /* Initialise the structure */ -} - -static void -imdi_k96_tab( -tabspec *t /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff - }; /* Structure image */ - - memcpy(t, data, sizeof(data)); /* Initialise the structure */ -} - -/* 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 = 7 - Input channel 0 bits = 8 - Input channel 0 increment = 7 - Input channel 1 bits = 8 - Input channel 1 increment = 7 - Input channel 2 bits = 8 - Input channel 2 increment = 7 - Input channel 3 bits = 8 - Input channel 3 increment = 7 - Input channel 4 bits = 8 - Input channel 4 increment = 7 - Input channel 5 bits = 8 - Input channel 5 increment = 7 - Input channel 6 bits = 8 - Input channel 6 increment = 7 - Input is channel interleaved - Input channels are separate words - Input value extraction is done in input table lookup - - Output channels per pixel = 8 - Output channel 0 bits = 16 - Output channel 0 increment = 8 - Output channel 1 bits = 16 - Output channel 1 increment = 8 - Output channel 2 bits = 16 - Output channel 2 increment = 8 - Output channel 3 bits = 16 - Output channel 3 increment = 8 - Output channel 4 bits = 16 - Output channel 4 increment = 8 - Output channel 5 bits = 16 - Output channel 5 increment = 8 - Output channel 6 bits = 16 - Output channel 6 increment = 8 - Output channel 7 bits = 16 - Output channel 7 increment = 8 - Output is channel interleaved - - Output channels are separate words - Weight+voffset bits = 32 - Interpolation table index bits = 32 - Interpolation table max resolution = 12 - */ - -/* - 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 <memory.h> -#include "imdi_imp.h" -#define IMDI_INCLUDED -#endif /* IMDI_INCLUDED */ - -#ifndef DEFINED_pointer -#define DEFINED_pointer -typedef unsigned char * pointer; -#endif - -/* Input table interp. index */ -#define IT_IX(p, off) *((unsigned int *)((p) + 0 + (off) * 8)) - -/* Input table input weighting/offset value enty */ -#define IT_WO(p, off) *((unsigned int *)((p) + 4 + (off) * 8)) - -/* Conditional exchange for sorting */ -#define CEX(A, B) if (A < B) { A ^= B; B ^= A; A ^= B; } - -/* Interpolation multi-dim. table access */ -#define IM_O(off) ((off) * 16) - -/* Interpolation table - get vertex values */ -#define IM_FE(p, v, c) *((unsigned int *)((p) + (v) * 8 + (c) * 4)) - -/* Output table indexes */ -#define OT_E(p, off) *((unsigned short *)((p) + (off) * 2)) - -static void -imdi_k97( -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 short *op0 = (unsigned short *)outp[0]; - unsigned char *ep = ip0 + npix * 7 ; - pointer it0 = (pointer)p->in_tables[0]; - pointer it1 = (pointer)p->in_tables[1]; - pointer it2 = (pointer)p->in_tables[2]; - pointer it3 = (pointer)p->in_tables[3]; - pointer it4 = (pointer)p->in_tables[4]; - pointer it5 = (pointer)p->in_tables[5]; - pointer it6 = (pointer)p->in_tables[6]; - pointer ot0 = (pointer)p->out_tables[0]; - pointer ot1 = (pointer)p->out_tables[1]; - pointer ot2 = (pointer)p->out_tables[2]; - pointer ot3 = (pointer)p->out_tables[3]; - pointer ot4 = (pointer)p->out_tables[4]; - pointer ot5 = (pointer)p->out_tables[5]; - pointer ot6 = (pointer)p->out_tables[6]; - pointer ot7 = (pointer)p->out_tables[7]; - pointer im_base = (pointer)p->im_table; - - for(;ip0 < ep; ip0 += 7, op0 += 8) { - unsigned int ova0; /* Output value accumulator */ - unsigned int ova1; /* Output value accumulator */ - unsigned int ova2; /* Output value accumulator */ - unsigned int ova3; /* Output value accumulator */ - { - pointer imp; - unsigned int wo0; /* Weighting value and vertex offset variable */ - unsigned int wo1; /* Weighting value and vertex offset variable */ - unsigned int wo2; /* Weighting value and vertex offset variable */ - unsigned int wo3; /* Weighting value and vertex offset variable */ - unsigned int wo4; /* Weighting value and vertex offset variable */ - unsigned int wo5; /* Weighting value and vertex offset variable */ - unsigned int wo6; /* Weighting value and vertex offset variable */ - { - unsigned int ti_i; /* Interpolation index variable */ - - ti_i = IT_IX(it0, ip0[0]); - wo0 = IT_WO(it0, ip0[0]); - ti_i += IT_IX(it1, ip0[1]); - wo1 = IT_WO(it1, ip0[1]); - ti_i += IT_IX(it2, ip0[2]); - wo2 = IT_WO(it2, ip0[2]); - ti_i += IT_IX(it3, ip0[3]); - wo3 = IT_WO(it3, ip0[3]); - ti_i += IT_IX(it4, ip0[4]); - wo4 = IT_WO(it4, ip0[4]); - ti_i += IT_IX(it5, ip0[5]); - wo5 = IT_WO(it5, ip0[5]); - ti_i += IT_IX(it6, ip0[6]); - wo6 = IT_WO(it6, ip0[6]); - - imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */ - - /* Sort weighting values and vertex offset values */ - CEX(wo0, wo1); - CEX(wo0, wo2); - CEX(wo0, wo3); - CEX(wo0, wo4); - CEX(wo0, wo5); - CEX(wo0, wo6); - CEX(wo1, wo2); - CEX(wo1, wo3); - CEX(wo1, wo4); - CEX(wo1, wo5); - CEX(wo1, wo6); - CEX(wo2, wo3); - CEX(wo2, wo4); - CEX(wo2, wo5); - CEX(wo2, wo6); - CEX(wo3, wo4); - CEX(wo3, wo5); - CEX(wo3, wo6); - CEX(wo4, wo5); - CEX(wo4, wo6); - CEX(wo5, wo6); - } - { - unsigned int nvof; /* Next vertex offset value */ - unsigned int vof; /* Vertex offset value */ - unsigned int vwe; /* Vertex weighting */ - - vof = 0; /* First vertex offset is 0 */ - nvof = (wo0 & 0x7fffff); /* Extract offset value */ - wo0 = (wo0 >> 23); /* Extract weighting value */ - vwe = 256 - wo0; /* Baricentric weighting */ - ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 = IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo1 & 0x7fffff); /* Extract offset value */ - wo1 = (wo1 >> 23); /* Extract weighting value */ - vwe = wo0 - wo1; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo2 & 0x7fffff); /* Extract offset value */ - wo2 = (wo2 >> 23); /* Extract weighting value */ - vwe = wo1 - wo2; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo3 & 0x7fffff); /* Extract offset value */ - wo3 = (wo3 >> 23); /* Extract weighting value */ - vwe = wo2 - wo3; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo4 & 0x7fffff); /* Extract offset value */ - wo4 = (wo4 >> 23); /* Extract weighting value */ - vwe = wo3 - wo4; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo5 & 0x7fffff); /* Extract offset value */ - wo5 = (wo5 >> 23); /* Extract weighting value */ - vwe = wo4 - wo5; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo6 & 0x7fffff); /* Extract offset value */ - wo6 = (wo6 >> 23); /* Extract weighting value */ - vwe = wo5 - wo6; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - vwe = wo6; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate 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 */ - oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */ - op0[1] = OT_E(ot1, oti); /* Write result */ - oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */ - op0[2] = OT_E(ot2, oti); /* Write result */ - oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */ - op0[3] = OT_E(ot3, oti); /* Write result */ - oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */ - op0[4] = OT_E(ot4, oti); /* Write result */ - oti = ((ova2 >> 24) & 0xff); /* Extract integer part of result */ - op0[5] = OT_E(ot5, oti); /* Write result */ - oti = ((ova3 >> 8) & 0xff); /* Extract integer part of result */ - op0[6] = OT_E(ot6, oti); /* Write result */ - oti = ((ova3 >> 24) & 0xff); /* Extract integer part of result */ - op0[7] = OT_E(ot7, oti); /* Write result */ - } - } -} -#undef IT_WO -#undef IT_IX -#undef CEX -#undef IM_O -#undef IM_FE -#undef OT_E - -static void -imdi_k97_gen( -genspec *g /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x0c, 0x00, 0x00, 0x00, 0x00, 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, 0x04, 0x08, - 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08, - 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7, - 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7, - 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08, - 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00, - 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7, - 0x2c, 0xf3, 0xdc, 0xb7, 0x37, 0x5f, 0x38, 0x5f, - 0x69, 0x38, 0x5f, 0x69, 0x31, 0x36, 0x5f, 0x66, - 0x00, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00, - 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf, - 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08, - 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf, - 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x39, 0x37, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01, - 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7, - 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7, - 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08, - 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08, - 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf, - 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7, - 0x00, 0xf0, 0x04, 0x08 - }; /* Structure image */ - - memcpy(g, data, sizeof(data)); /* Initialise the structure */ -} - -static void -imdi_k97_tab( -tabspec *t /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff - }; /* Structure image */ - - memcpy(t, data, sizeof(data)); /* Initialise the structure */ -} - -/* 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 = 8 - Input channel 0 bits = 8 - Input channel 0 increment = 8 - Input channel 1 bits = 8 - Input channel 1 increment = 8 - Input channel 2 bits = 8 - Input channel 2 increment = 8 - Input channel 3 bits = 8 - Input channel 3 increment = 8 - Input channel 4 bits = 8 - Input channel 4 increment = 8 - Input channel 5 bits = 8 - Input channel 5 increment = 8 - Input channel 6 bits = 8 - Input channel 6 increment = 8 - Input channel 7 bits = 8 - Input channel 7 increment = 8 - Input is channel interleaved - Input channels are separate words - Input value extraction is done in input table lookup - - Output channels per pixel = 8 - Output channel 0 bits = 16 - Output channel 0 increment = 8 - Output channel 1 bits = 16 - Output channel 1 increment = 8 - Output channel 2 bits = 16 - Output channel 2 increment = 8 - Output channel 3 bits = 16 - Output channel 3 increment = 8 - Output channel 4 bits = 16 - Output channel 4 increment = 8 - Output channel 5 bits = 16 - Output channel 5 increment = 8 - Output channel 6 bits = 16 - Output channel 6 increment = 8 - Output channel 7 bits = 16 - Output channel 7 increment = 8 - Output is channel interleaved - - Output channels are separate words - Weight+voffset bits = 32 - Interpolation table index bits = 32 - Interpolation table max resolution = 8 - */ - -/* - 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 <memory.h> -#include "imdi_imp.h" -#define IMDI_INCLUDED -#endif /* IMDI_INCLUDED */ - -#ifndef DEFINED_pointer -#define DEFINED_pointer -typedef unsigned char * pointer; -#endif - -/* Input table interp. index */ -#define IT_IX(p, off) *((unsigned int *)((p) + 0 + (off) * 8)) - -/* Input table input weighting/offset value enty */ -#define IT_WO(p, off) *((unsigned int *)((p) + 4 + (off) * 8)) - -/* Conditional exchange for sorting */ -#define CEX(A, B) if (A < B) { A ^= B; B ^= A; A ^= B; } - -/* Interpolation multi-dim. table access */ -#define IM_O(off) ((off) * 16) - -/* Interpolation table - get vertex values */ -#define IM_FE(p, v, c) *((unsigned int *)((p) + (v) * 8 + (c) * 4)) - -/* Output table indexes */ -#define OT_E(p, off) *((unsigned short *)((p) + (off) * 2)) - -static void -imdi_k98( -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 short *op0 = (unsigned short *)outp[0]; - unsigned char *ep = ip0 + npix * 8 ; - pointer it0 = (pointer)p->in_tables[0]; - pointer it1 = (pointer)p->in_tables[1]; - pointer it2 = (pointer)p->in_tables[2]; - pointer it3 = (pointer)p->in_tables[3]; - pointer it4 = (pointer)p->in_tables[4]; - pointer it5 = (pointer)p->in_tables[5]; - pointer it6 = (pointer)p->in_tables[6]; - pointer it7 = (pointer)p->in_tables[7]; - pointer ot0 = (pointer)p->out_tables[0]; - pointer ot1 = (pointer)p->out_tables[1]; - pointer ot2 = (pointer)p->out_tables[2]; - pointer ot3 = (pointer)p->out_tables[3]; - pointer ot4 = (pointer)p->out_tables[4]; - pointer ot5 = (pointer)p->out_tables[5]; - pointer ot6 = (pointer)p->out_tables[6]; - pointer ot7 = (pointer)p->out_tables[7]; - pointer im_base = (pointer)p->im_table; - - for(;ip0 < ep; ip0 += 8, op0 += 8) { - unsigned int ova0; /* Output value accumulator */ - unsigned int ova1; /* Output value accumulator */ - unsigned int ova2; /* Output value accumulator */ - unsigned int ova3; /* Output value accumulator */ - { - pointer imp; - unsigned int wo0; /* Weighting value and vertex offset variable */ - unsigned int wo1; /* Weighting value and vertex offset variable */ - unsigned int wo2; /* Weighting value and vertex offset variable */ - unsigned int wo3; /* Weighting value and vertex offset variable */ - unsigned int wo4; /* Weighting value and vertex offset variable */ - unsigned int wo5; /* Weighting value and vertex offset variable */ - unsigned int wo6; /* Weighting value and vertex offset variable */ - unsigned int wo7; /* Weighting value and vertex offset variable */ - { - unsigned int ti_i; /* Interpolation index variable */ - - ti_i = IT_IX(it0, ip0[0]); - wo0 = IT_WO(it0, ip0[0]); - ti_i += IT_IX(it1, ip0[1]); - wo1 = IT_WO(it1, ip0[1]); - ti_i += IT_IX(it2, ip0[2]); - wo2 = IT_WO(it2, ip0[2]); - ti_i += IT_IX(it3, ip0[3]); - wo3 = IT_WO(it3, ip0[3]); - ti_i += IT_IX(it4, ip0[4]); - wo4 = IT_WO(it4, ip0[4]); - ti_i += IT_IX(it5, ip0[5]); - wo5 = IT_WO(it5, ip0[5]); - ti_i += IT_IX(it6, ip0[6]); - wo6 = IT_WO(it6, ip0[6]); - ti_i += IT_IX(it7, ip0[7]); - wo7 = IT_WO(it7, ip0[7]); - - imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */ - - /* Sort weighting values and vertex offset values */ - CEX(wo0, wo1); - CEX(wo0, wo2); - CEX(wo0, wo3); - CEX(wo0, wo4); - CEX(wo0, wo5); - CEX(wo0, wo6); - CEX(wo0, wo7); - CEX(wo1, wo2); - CEX(wo1, wo3); - CEX(wo1, wo4); - CEX(wo1, wo5); - CEX(wo1, wo6); - CEX(wo1, wo7); - CEX(wo2, wo3); - CEX(wo2, wo4); - CEX(wo2, wo5); - CEX(wo2, wo6); - CEX(wo2, wo7); - CEX(wo3, wo4); - CEX(wo3, wo5); - CEX(wo3, wo6); - CEX(wo3, wo7); - CEX(wo4, wo5); - CEX(wo4, wo6); - CEX(wo4, wo7); - CEX(wo5, wo6); - CEX(wo5, wo7); - CEX(wo6, wo7); - } - { - unsigned int nvof; /* Next vertex offset value */ - unsigned int vof; /* Vertex offset value */ - unsigned int vwe; /* Vertex weighting */ - - vof = 0; /* First vertex offset is 0 */ - nvof = (wo0 & 0x7fffff); /* Extract offset value */ - wo0 = (wo0 >> 23); /* Extract weighting value */ - vwe = 256 - wo0; /* Baricentric weighting */ - ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 = IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo1 & 0x7fffff); /* Extract offset value */ - wo1 = (wo1 >> 23); /* Extract weighting value */ - vwe = wo0 - wo1; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo2 & 0x7fffff); /* Extract offset value */ - wo2 = (wo2 >> 23); /* Extract weighting value */ - vwe = wo1 - wo2; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo3 & 0x7fffff); /* Extract offset value */ - wo3 = (wo3 >> 23); /* Extract weighting value */ - vwe = wo2 - wo3; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo4 & 0x7fffff); /* Extract offset value */ - wo4 = (wo4 >> 23); /* Extract weighting value */ - vwe = wo3 - wo4; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo5 & 0x7fffff); /* Extract offset value */ - wo5 = (wo5 >> 23); /* Extract weighting value */ - vwe = wo4 - wo5; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo6 & 0x7fffff); /* Extract offset value */ - wo6 = (wo6 >> 23); /* Extract weighting value */ - vwe = wo5 - wo6; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo7 & 0x7fffff); /* Extract offset value */ - wo7 = (wo7 >> 23); /* Extract weighting value */ - vwe = wo6 - wo7; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - vwe = wo7; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate 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 */ - oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */ - op0[1] = OT_E(ot1, oti); /* Write result */ - oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */ - op0[2] = OT_E(ot2, oti); /* Write result */ - oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */ - op0[3] = OT_E(ot3, oti); /* Write result */ - oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */ - op0[4] = OT_E(ot4, oti); /* Write result */ - oti = ((ova2 >> 24) & 0xff); /* Extract integer part of result */ - op0[5] = OT_E(ot5, oti); /* Write result */ - oti = ((ova3 >> 8) & 0xff); /* Extract integer part of result */ - op0[6] = OT_E(ot6, oti); /* Write result */ - oti = ((ova3 >> 24) & 0xff); /* Extract integer part of result */ - op0[7] = OT_E(ot7, oti); /* Write result */ - } - } -} -#undef IT_WO -#undef IT_IX -#undef CEX -#undef IM_O -#undef IM_FE -#undef OT_E - -static void -imdi_k98_gen( -genspec *g /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 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, 0x04, 0x08, - 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08, - 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7, - 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7, - 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08, - 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00, - 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7, - 0x2c, 0xf3, 0xdc, 0xb7, 0x38, 0x5f, 0x38, 0x5f, - 0x69, 0x38, 0x5f, 0x69, 0x31, 0x36, 0x5f, 0x66, - 0x00, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00, - 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf, - 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08, - 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf, - 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x39, 0x38, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01, - 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7, - 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7, - 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08, - 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08, - 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf, - 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7, - 0x00, 0xf0, 0x04, 0x08 - }; /* Structure image */ - - memcpy(g, data, sizeof(data)); /* Initialise the structure */ -} - -static void -imdi_k98_tab( -tabspec *t /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff - }; /* Structure image */ - - memcpy(t, data, sizeof(data)); /* Initialise the structure */ -} - -/* 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 = 16 - 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 = 16 - Output channel 0 increment = 1 - Output is channel interleaved - - Output channels are separate words - Weight+voffset bits = 32 - Interpolation table index bits = 12 - Interpolation table max resolution = 4095 - */ - -/* - 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 <memory.h> -#include "imdi_imp.h" -#define IMDI_INCLUDED -#endif /* IMDI_INCLUDED */ - -#ifndef DEFINED_pointer -#define DEFINED_pointer -typedef unsigned char * pointer; -#endif - -/* Input table interp index, weighting and vertex offset */ -#define IT_IT(p, off) *((unsigned int *)((p) + 0 + (off) * 4)) - -/* Conditional exchange for sorting */ -#define CEX(A, B) if (A < B) { A ^= B; B ^= A; A ^= B; } - -/* Interpolation multi-dim. table access */ -#define IM_O(off) ((off) * 2) - -/* Interpolation table - get vertex values */ -#define IM_FE(p, v, c) ((unsigned int)*((unsigned short *)((p) + (v) * 2 + (c) * 2))) - -/* Output table indexes */ -#define OT_E(p, off) *((unsigned short *)((p) + (off) * 2)) - -static void -imdi_k99( -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 short *ip0 = (unsigned short *)inp[0]; - unsigned short *op0 = (unsigned short *)outp[0]; - unsigned short *ep = ip0 + npix * 1 ; - pointer it0 = (pointer)p->in_tables[0]; - pointer ot0 = (pointer)p->out_tables[0]; - pointer im_base = (pointer)p->im_table; - - for(;ip0 < ep; ip0 += 1, op0 += 1) { - unsigned int ova0; /* Output value accumulator */ - { - pointer imp; - unsigned int wo0; /* Weighting value and vertex offset variable */ - { - unsigned int ti; /* Input table entry variable */ - unsigned int ti_i; /* Interpolation index variable */ - - ti = IT_IT(it0, ip0[0]); - wo0 = (ti & 0xfffff); /* Extract weighting/vertex offset value */ - ti_i = (ti >> 20); /* Extract interpolation table value */ - - imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */ - - /* Sort weighting values and vertex offset values */ - } - { - unsigned int nvof; /* Next vertex offset value */ - unsigned int vof; /* Vertex offset value */ - unsigned int vwe; /* Vertex weighting */ - - vof = 0; /* First vertex offset is 0 */ - nvof = (wo0 & 0x7); /* Extract offset value */ - wo0 = (wo0 >> 3); /* Extract weighting value */ - vwe = 65536 - wo0; /* Baricentric weighting */ - ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - vwe = wo0; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - } - } - { - unsigned int oti; /* Vertex offset value */ - oti = ((ova0 >> 16) & 0xffff); /* Extract integer part of result */ - op0[0] = OT_E(ot0, oti); /* Write result */ - } - } -} -#undef IT_IT -#undef CEX -#undef IM_O -#undef IM_FE -#undef OT_E - -static void -imdi_k99_gen( -genspec *g /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0xff, 0x0f, 0x00, 0x00, 0x00, 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, 0x04, 0x08, - 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08, - 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7, - 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7, - 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08, - 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00, - 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7, - 0x2c, 0xf3, 0xdc, 0xb7, 0x31, 0x5f, 0x31, 0x5f, - 0x69, 0x31, 0x36, 0x5f, 0x69, 0x31, 0x36, 0x5f, - 0x66, 0x00, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00, - 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf, - 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08, - 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf, - 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x39, 0x39, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01, - 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7, - 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7, - 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08, - 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08, - 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf, - 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7, - 0x00, 0xf0, 0x04, 0x08 - }; /* Structure image */ - - memcpy(g, data, sizeof(data)); /* Initialise the structure */ -} - -static void -imdi_k99_tab( -tabspec *t /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x0c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x14, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x11, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0xa1, 0xd4, 0xe2, 0xb7, - 0xf4, 0xd5, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0xff, 0xff, 0xff, 0x31, 0x00, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xa0, 0xd6, 0x83, 0xbf, 0x8b, 0x22, 0xe2, 0xb7, - 0xf4, 0xd5, 0x83, 0xbf, 0x52, 0xca, 0x04, 0x08, - 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0x22, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff, - 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff - }; /* Structure image */ - - memcpy(t, data, sizeof(data)); /* Initialise the structure */ -} - -/* 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 = 3 - Input channel 0 bits = 16 - Input channel 0 increment = 3 - Input channel 1 bits = 16 - Input channel 1 increment = 3 - Input channel 2 bits = 16 - Input channel 2 increment = 3 - 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 = 16 - Output channel 0 increment = 1 - Output is channel interleaved - - Output channels are separate words - Weight+voffset bits = 32 - Interpolation table index bits = 16 - Interpolation table max resolution = 40 - */ - -/* - 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 <memory.h> -#include "imdi_imp.h" -#define IMDI_INCLUDED -#endif /* IMDI_INCLUDED */ - -#ifndef DEFINED_pointer -#define DEFINED_pointer -typedef unsigned char * pointer; -#endif - -/* Input table interp. index */ -#define IT_IX(p, off) *((unsigned short *)((p) + 0 + (off) * 6)) - -/* Input table input weighting/offset value enty */ -#define IT_WO(p, off) *((unsigned int *)((p) + 2 + (off) * 6)) - -/* Conditional exchange for sorting */ -#define CEX(A, B) if (A < B) { A ^= B; B ^= A; A ^= B; } - -/* Interpolation multi-dim. table access */ -#define IM_O(off) ((off) * 2) - -/* Interpolation table - get vertex values */ -#define IM_FE(p, v, c) ((unsigned int)*((unsigned short *)((p) + (v) * 2 + (c) * 2))) - -/* Output table indexes */ -#define OT_E(p, off) *((unsigned short *)((p) + (off) * 2)) - -static void -imdi_k100( -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 short *ip0 = (unsigned short *)inp[0]; - unsigned short *op0 = (unsigned short *)outp[0]; - unsigned short *ep = ip0 + npix * 3 ; - pointer it0 = (pointer)p->in_tables[0]; - pointer it1 = (pointer)p->in_tables[1]; - pointer it2 = (pointer)p->in_tables[2]; - pointer ot0 = (pointer)p->out_tables[0]; - pointer im_base = (pointer)p->im_table; - - for(;ip0 < ep; ip0 += 3, op0 += 1) { - unsigned int ova0; /* Output value accumulator */ - { - pointer imp; - unsigned int wo0; /* Weighting value and vertex offset variable */ - unsigned int wo1; /* Weighting value and vertex offset variable */ - unsigned int wo2; /* Weighting value and vertex offset variable */ - { - unsigned int ti_i; /* Interpolation index variable */ - - ti_i = IT_IX(it0, ip0[0]); - wo0 = IT_WO(it0, ip0[0]); - ti_i += IT_IX(it1, ip0[1]); - wo1 = IT_WO(it1, ip0[1]); - ti_i += IT_IX(it2, ip0[2]); - wo2 = IT_WO(it2, ip0[2]); - - imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */ - - /* Sort weighting values and vertex offset values */ - CEX(wo0, wo1); - CEX(wo0, wo2); - CEX(wo1, wo2); - } - { - unsigned int nvof; /* Next vertex offset value */ - unsigned int vof; /* Vertex offset value */ - unsigned int vwe; /* Vertex weighting */ - - vof = 0; /* First vertex offset is 0 */ - nvof = (wo0 & 0x7fff); /* Extract offset value */ - wo0 = (wo0 >> 15); /* Extract weighting value */ - vwe = 65536 - wo0; /* Baricentric weighting */ - ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo1 & 0x7fff); /* Extract offset value */ - wo1 = (wo1 >> 15); /* Extract weighting value */ - vwe = wo0 - wo1; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo2 & 0x7fff); /* Extract offset value */ - wo2 = (wo2 >> 15); /* Extract weighting value */ - vwe = wo1 - wo2; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - vwe = wo2; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - } - } - { - unsigned int oti; /* Vertex offset value */ - oti = ((ova0 >> 16) & 0xffff); /* Extract integer part of result */ - op0[0] = OT_E(ot0, oti); /* Write result */ - } - } -} -#undef IT_WO -#undef IT_IX -#undef CEX -#undef IM_O -#undef IM_FE -#undef OT_E - -static void -imdi_k100_gen( -genspec *g /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x10, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x28, 0x00, 0x00, 0x00, 0x00, 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, 0x04, 0x08, - 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08, - 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7, - 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7, - 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08, - 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00, - 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7, - 0x2c, 0xf3, 0xdc, 0xb7, 0x33, 0x5f, 0x31, 0x5f, - 0x69, 0x31, 0x36, 0x5f, 0x69, 0x31, 0x36, 0x5f, - 0x66, 0x00, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00, - 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf, - 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08, - 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf, - 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x30, - 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01, - 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7, - 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7, - 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08, - 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08, - 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf, - 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7, - 0x00, 0xf0, 0x04, 0x08 - }; /* Structure image */ - - memcpy(g, data, sizeof(data)); /* Initialise the structure */ -} - -static void -imdi_k100_tab( -tabspec *t /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x11, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0xa1, 0xd4, 0xe2, 0xb7, - 0xf4, 0xd5, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0xff, 0xff, 0xff, 0x31, 0x00, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xa0, 0xd6, 0x83, 0xbf, 0x8b, 0x22, 0xe2, 0xb7, - 0xf4, 0xd5, 0x83, 0xbf, 0x52, 0xca, 0x04, 0x08, - 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0x22, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff, - 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff - }; /* Structure image */ - - memcpy(t, data, sizeof(data)); /* Initialise the structure */ -} - -/* 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 = 4 - Input channel 0 bits = 16 - Input channel 0 increment = 4 - Input channel 1 bits = 16 - Input channel 1 increment = 4 - Input channel 2 bits = 16 - Input channel 2 increment = 4 - Input channel 3 bits = 16 - Input channel 3 increment = 4 - 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 = 16 - Output channel 0 increment = 1 - Output is channel interleaved - - Output channels are separate words - Weight+voffset bits = 32 - Interpolation table index bits = 32 - Interpolation table max resolution = 31 - */ - -/* - 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 <memory.h> -#include "imdi_imp.h" -#define IMDI_INCLUDED -#endif /* IMDI_INCLUDED */ - -#ifndef DEFINED_pointer -#define DEFINED_pointer -typedef unsigned char * pointer; -#endif - -/* Input table interp. index */ -#define IT_IX(p, off) *((unsigned int *)((p) + 0 + (off) * 8)) - -/* Input table input weighting/offset value enty */ -#define IT_WO(p, off) *((unsigned int *)((p) + 4 + (off) * 8)) - -/* Conditional exchange for sorting */ -#define CEX(A, B) if (A < B) { A ^= B; B ^= A; A ^= B; } - -/* Interpolation multi-dim. table access */ -#define IM_O(off) ((off) * 2) - -/* Interpolation table - get vertex values */ -#define IM_FE(p, v, c) ((unsigned int)*((unsigned short *)((p) + (v) * 2 + (c) * 2))) - -/* Output table indexes */ -#define OT_E(p, off) *((unsigned short *)((p) + (off) * 2)) - -static void -imdi_k101( -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 short *ip0 = (unsigned short *)inp[0]; - unsigned short *op0 = (unsigned short *)outp[0]; - unsigned short *ep = ip0 + npix * 4 ; - pointer it0 = (pointer)p->in_tables[0]; - pointer it1 = (pointer)p->in_tables[1]; - pointer it2 = (pointer)p->in_tables[2]; - pointer it3 = (pointer)p->in_tables[3]; - pointer ot0 = (pointer)p->out_tables[0]; - pointer im_base = (pointer)p->im_table; - - for(;ip0 < ep; ip0 += 4, op0 += 1) { - unsigned int ova0; /* Output value accumulator */ - { - pointer imp; - unsigned int wo0; /* Weighting value and vertex offset variable */ - unsigned int wo1; /* Weighting value and vertex offset variable */ - unsigned int wo2; /* Weighting value and vertex offset variable */ - unsigned int wo3; /* Weighting value and vertex offset variable */ - { - unsigned int ti_i; /* Interpolation index variable */ - - ti_i = IT_IX(it0, ip0[0]); - wo0 = IT_WO(it0, ip0[0]); - ti_i += IT_IX(it1, ip0[1]); - wo1 = IT_WO(it1, ip0[1]); - ti_i += IT_IX(it2, ip0[2]); - wo2 = IT_WO(it2, ip0[2]); - ti_i += IT_IX(it3, ip0[3]); - wo3 = IT_WO(it3, ip0[3]); - - imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */ - - /* Sort weighting values and vertex offset values */ - CEX(wo0, wo1); - CEX(wo0, wo2); - CEX(wo0, wo3); - CEX(wo1, wo2); - CEX(wo1, wo3); - CEX(wo2, wo3); - } - { - unsigned int nvof; /* Next vertex offset value */ - unsigned int vof; /* Vertex offset value */ - unsigned int vwe; /* Vertex weighting */ - - vof = 0; /* First vertex offset is 0 */ - nvof = (wo0 & 0x7fff); /* Extract offset value */ - wo0 = (wo0 >> 15); /* Extract weighting value */ - vwe = 65536 - wo0; /* Baricentric weighting */ - ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo1 & 0x7fff); /* Extract offset value */ - wo1 = (wo1 >> 15); /* Extract weighting value */ - vwe = wo0 - wo1; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo2 & 0x7fff); /* Extract offset value */ - wo2 = (wo2 >> 15); /* Extract weighting value */ - vwe = wo1 - wo2; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo3 & 0x7fff); /* Extract offset value */ - wo3 = (wo3 >> 15); /* Extract weighting value */ - vwe = wo2 - wo3; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - vwe = wo3; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - } - } - { - unsigned int oti; /* Vertex offset value */ - oti = ((ova0 >> 16) & 0xffff); /* Extract integer part of result */ - op0[0] = OT_E(ot0, oti); /* Write result */ - } - } -} -#undef IT_WO -#undef IT_IX -#undef CEX -#undef IM_O -#undef IM_FE -#undef OT_E - -static void -imdi_k101_gen( -genspec *g /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x10, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x1f, 0x00, 0x00, 0x00, 0x00, 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, 0x04, 0x08, - 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08, - 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7, - 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7, - 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08, - 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00, - 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7, - 0x2c, 0xf3, 0xdc, 0xb7, 0x34, 0x5f, 0x31, 0x5f, - 0x69, 0x31, 0x36, 0x5f, 0x69, 0x31, 0x36, 0x5f, - 0x66, 0x00, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00, - 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf, - 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08, - 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf, - 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x30, - 0x31, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01, - 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7, - 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7, - 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08, - 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08, - 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf, - 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7, - 0x00, 0xf0, 0x04, 0x08 - }; /* Structure image */ - - memcpy(g, data, sizeof(data)); /* Initialise the structure */ -} - -static void -imdi_k101_tab( -tabspec *t /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x11, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0xa1, 0xd4, 0xe2, 0xb7, - 0xf4, 0xd5, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0xff, 0xff, 0xff, 0x31, 0x00, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xa0, 0xd6, 0x83, 0xbf, 0x8b, 0x22, 0xe2, 0xb7, - 0xf4, 0xd5, 0x83, 0xbf, 0x52, 0xca, 0x04, 0x08, - 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0x22, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff, - 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff - }; /* Structure image */ - - memcpy(t, data, sizeof(data)); /* Initialise the structure */ -} - -/* 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 = 5 - Input channel 0 bits = 16 - Input channel 0 increment = 5 - Input channel 1 bits = 16 - Input channel 1 increment = 5 - Input channel 2 bits = 16 - Input channel 2 increment = 5 - Input channel 3 bits = 16 - Input channel 3 increment = 5 - Input channel 4 bits = 16 - Input channel 4 increment = 5 - 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 = 16 - Output channel 0 increment = 1 - Output is channel interleaved - - Output channels are separate words - Weight+voffset bits = 32 - Interpolation table index bits = 32 - Interpolation table max resolution = 84 - */ - -/* - 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 <memory.h> -#include "imdi_imp.h" -#define IMDI_INCLUDED -#endif /* IMDI_INCLUDED */ - -#ifndef DEFINED_pointer -#define DEFINED_pointer -typedef unsigned char * pointer; -#endif - -/* Input table interp. index */ -#define IT_IX(p, off) *((unsigned int *)((p) + 0 + (off) * 12)) - -/* Input table input weighting enty */ -#define IT_WE(p, off) *((unsigned int *)((p) + 4 + (off) * 12)) - -/* Input table input offset value enty */ -#define IT_VO(p, off) *((unsigned int *)((p) + 8 + (off) * 12)) - -/* Conditional exchange for sorting */ -#define CEX(A, AA, B, BB) if (A < B) { \ - A ^= B; B ^= A; A ^= B; AA ^= BB; BB ^= AA; AA ^= BB; } - -/* Interpolation multi-dim. table access */ -#define IM_O(off) ((off) * 2) - -/* Interpolation table - get vertex values */ -#define IM_FE(p, v, c) ((unsigned int)*((unsigned short *)((p) + (v) * 2 + (c) * 2))) - -/* Output table indexes */ -#define OT_E(p, off) *((unsigned short *)((p) + (off) * 2)) - -static void -imdi_k102( -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 short *ip0 = (unsigned short *)inp[0]; - unsigned short *op0 = (unsigned short *)outp[0]; - unsigned short *ep = ip0 + npix * 5 ; - pointer it0 = (pointer)p->in_tables[0]; - pointer it1 = (pointer)p->in_tables[1]; - pointer it2 = (pointer)p->in_tables[2]; - pointer it3 = (pointer)p->in_tables[3]; - pointer it4 = (pointer)p->in_tables[4]; - pointer ot0 = (pointer)p->out_tables[0]; - pointer im_base = (pointer)p->im_table; - - for(;ip0 < ep; ip0 += 5, op0 += 1) { - unsigned int ova0; /* Output value accumulator */ - { - pointer imp; - unsigned int we0; /* Weighting value variable */ - unsigned int vo0; /* Vertex offset variable */ - unsigned int we1; /* Weighting value variable */ - unsigned int vo1; /* Vertex offset variable */ - unsigned int we2; /* Weighting value variable */ - unsigned int vo2; /* Vertex offset variable */ - unsigned int we3; /* Weighting value variable */ - unsigned int vo3; /* Vertex offset variable */ - unsigned int we4; /* Weighting value variable */ - unsigned int vo4; /* Vertex offset variable */ - { - unsigned int ti_i; /* Interpolation index variable */ - - ti_i = IT_IX(it0, ip0[0]); - we0 = IT_WE(it0, ip0[0]); - vo0 = IT_VO(it0, ip0[0]); - ti_i += IT_IX(it1, ip0[1]); - we1 = IT_WE(it1, ip0[1]); - vo1 = IT_VO(it1, ip0[1]); - ti_i += IT_IX(it2, ip0[2]); - we2 = IT_WE(it2, ip0[2]); - vo2 = IT_VO(it2, ip0[2]); - ti_i += IT_IX(it3, ip0[3]); - we3 = IT_WE(it3, ip0[3]); - vo3 = IT_VO(it3, ip0[3]); - ti_i += IT_IX(it4, ip0[4]); - we4 = IT_WE(it4, ip0[4]); - vo4 = IT_VO(it4, ip0[4]); - - imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */ - - /* Sort weighting values and vertex offset values */ - CEX(we0, vo0, we1, vo1); - CEX(we0, vo0, we2, vo2); - CEX(we0, vo0, we3, vo3); - CEX(we0, vo0, we4, vo4); - CEX(we1, vo1, we2, vo2); - CEX(we1, vo1, we3, vo3); - CEX(we1, vo1, we4, vo4); - CEX(we2, vo2, we3, vo3); - CEX(we2, vo2, we4, vo4); - CEX(we3, vo3, we4, vo4); - } - { - unsigned int vof; /* Vertex offset value */ - unsigned int vwe; /* Vertex weighting */ - - vof = 0; /* First vertex offset is 0 */ - vwe = 65536 - we0; /* Baricentric weighting */ - ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - vof += vo0; /* Move to next vertex */ - vwe = we0 - we1; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - vof += vo1; /* Move to next vertex */ - vwe = we1 - we2; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - vof += vo2; /* Move to next vertex */ - vwe = we2 - we3; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - vof += vo3; /* Move to next vertex */ - vwe = we3 - we4; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - vof += vo4; /* Move to next vertex */ - vwe = we4; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - } - } - { - unsigned int oti; /* Vertex offset value */ - oti = ((ova0 >> 16) & 0xffff); /* Extract integer part of result */ - op0[0] = OT_E(ot0, oti); /* Write result */ - } - } -} -#undef IT_WE -#undef IT_VO -#undef IT_IX -#undef CEX -#undef IM_O -#undef IM_FE -#undef OT_E - -static void -imdi_k102_gen( -genspec *g /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x10, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x54, 0x00, 0x00, 0x00, 0x00, 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, 0x04, 0x08, - 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08, - 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7, - 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7, - 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08, - 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00, - 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7, - 0x2c, 0xf3, 0xdc, 0xb7, 0x35, 0x5f, 0x31, 0x5f, - 0x69, 0x31, 0x36, 0x5f, 0x69, 0x31, 0x36, 0x5f, - 0x66, 0x00, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00, - 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf, - 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08, - 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf, - 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x30, - 0x32, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01, - 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7, - 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7, - 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08, - 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08, - 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf, - 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7, - 0x00, 0xf0, 0x04, 0x08 - }; /* Structure image */ - - memcpy(g, data, sizeof(data)); /* Initialise the structure */ -} - -static void -imdi_k102_tab( -tabspec *t /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0xa1, 0xd4, 0xe2, 0xb7, - 0xf4, 0xd5, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0xff, 0xff, 0xff, 0x31, 0x00, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xa0, 0xd6, 0x83, 0xbf, 0x8b, 0x22, 0xe2, 0xb7, - 0xf4, 0xd5, 0x83, 0xbf, 0x52, 0xca, 0x04, 0x08, - 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0x22, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff, - 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff - }; /* Structure image */ - - memcpy(t, data, sizeof(data)); /* Initialise the structure */ -} - -/* 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 = 6 - Input channel 0 bits = 16 - Input channel 0 increment = 6 - Input channel 1 bits = 16 - Input channel 1 increment = 6 - Input channel 2 bits = 16 - Input channel 2 increment = 6 - Input channel 3 bits = 16 - Input channel 3 increment = 6 - Input channel 4 bits = 16 - Input channel 4 increment = 6 - Input channel 5 bits = 16 - Input channel 5 increment = 6 - 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 = 16 - Output channel 0 increment = 1 - Output is channel interleaved - - Output channels are separate words - Weight+voffset bits = 32 - Interpolation table index bits = 32 - Interpolation table max resolution = 40 - */ - -/* - 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 <memory.h> -#include "imdi_imp.h" -#define IMDI_INCLUDED -#endif /* IMDI_INCLUDED */ - -#ifndef DEFINED_pointer -#define DEFINED_pointer -typedef unsigned char * pointer; -#endif - -/* Input table interp. index */ -#define IT_IX(p, off) *((unsigned int *)((p) + 0 + (off) * 12)) - -/* Input table input weighting enty */ -#define IT_WE(p, off) *((unsigned int *)((p) + 4 + (off) * 12)) - -/* Input table input offset value enty */ -#define IT_VO(p, off) *((unsigned int *)((p) + 8 + (off) * 12)) - -/* Conditional exchange for sorting */ -#define CEX(A, AA, B, BB) if (A < B) { \ - A ^= B; B ^= A; A ^= B; AA ^= BB; BB ^= AA; AA ^= BB; } - -/* Interpolation multi-dim. table access */ -#define IM_O(off) ((off) * 2) - -/* Interpolation table - get vertex values */ -#define IM_FE(p, v, c) ((unsigned int)*((unsigned short *)((p) + (v) * 2 + (c) * 2))) - -/* Output table indexes */ -#define OT_E(p, off) *((unsigned short *)((p) + (off) * 2)) - -static void -imdi_k103( -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 short *ip0 = (unsigned short *)inp[0]; - unsigned short *op0 = (unsigned short *)outp[0]; - unsigned short *ep = ip0 + npix * 6 ; - pointer it0 = (pointer)p->in_tables[0]; - pointer it1 = (pointer)p->in_tables[1]; - pointer it2 = (pointer)p->in_tables[2]; - pointer it3 = (pointer)p->in_tables[3]; - pointer it4 = (pointer)p->in_tables[4]; - pointer it5 = (pointer)p->in_tables[5]; - pointer ot0 = (pointer)p->out_tables[0]; - pointer im_base = (pointer)p->im_table; - - for(;ip0 < ep; ip0 += 6, op0 += 1) { - unsigned int ova0; /* Output value accumulator */ - { - pointer imp; - unsigned int we0; /* Weighting value variable */ - unsigned int vo0; /* Vertex offset variable */ - unsigned int we1; /* Weighting value variable */ - unsigned int vo1; /* Vertex offset variable */ - unsigned int we2; /* Weighting value variable */ - unsigned int vo2; /* Vertex offset variable */ - unsigned int we3; /* Weighting value variable */ - unsigned int vo3; /* Vertex offset variable */ - unsigned int we4; /* Weighting value variable */ - unsigned int vo4; /* Vertex offset variable */ - unsigned int we5; /* Weighting value variable */ - unsigned int vo5; /* Vertex offset variable */ - { - unsigned int ti_i; /* Interpolation index variable */ - - ti_i = IT_IX(it0, ip0[0]); - we0 = IT_WE(it0, ip0[0]); - vo0 = IT_VO(it0, ip0[0]); - ti_i += IT_IX(it1, ip0[1]); - we1 = IT_WE(it1, ip0[1]); - vo1 = IT_VO(it1, ip0[1]); - ti_i += IT_IX(it2, ip0[2]); - we2 = IT_WE(it2, ip0[2]); - vo2 = IT_VO(it2, ip0[2]); - ti_i += IT_IX(it3, ip0[3]); - we3 = IT_WE(it3, ip0[3]); - vo3 = IT_VO(it3, ip0[3]); - ti_i += IT_IX(it4, ip0[4]); - we4 = IT_WE(it4, ip0[4]); - vo4 = IT_VO(it4, ip0[4]); - ti_i += IT_IX(it5, ip0[5]); - we5 = IT_WE(it5, ip0[5]); - vo5 = IT_VO(it5, ip0[5]); - - imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */ - - /* Sort weighting values and vertex offset values */ - CEX(we0, vo0, we1, vo1); - CEX(we0, vo0, we2, vo2); - CEX(we0, vo0, we3, vo3); - CEX(we0, vo0, we4, vo4); - CEX(we0, vo0, we5, vo5); - CEX(we1, vo1, we2, vo2); - CEX(we1, vo1, we3, vo3); - CEX(we1, vo1, we4, vo4); - CEX(we1, vo1, we5, vo5); - CEX(we2, vo2, we3, vo3); - CEX(we2, vo2, we4, vo4); - CEX(we2, vo2, we5, vo5); - CEX(we3, vo3, we4, vo4); - CEX(we3, vo3, we5, vo5); - CEX(we4, vo4, we5, vo5); - } - { - unsigned int vof; /* Vertex offset value */ - unsigned int vwe; /* Vertex weighting */ - - vof = 0; /* First vertex offset is 0 */ - vwe = 65536 - we0; /* Baricentric weighting */ - ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - vof += vo0; /* Move to next vertex */ - vwe = we0 - we1; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - vof += vo1; /* Move to next vertex */ - vwe = we1 - we2; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - vof += vo2; /* Move to next vertex */ - vwe = we2 - we3; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - vof += vo3; /* Move to next vertex */ - vwe = we3 - we4; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - vof += vo4; /* Move to next vertex */ - vwe = we4 - we5; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - vof += vo5; /* Move to next vertex */ - vwe = we5; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - } - } - { - unsigned int oti; /* Vertex offset value */ - oti = ((ova0 >> 16) & 0xffff); /* Extract integer part of result */ - op0[0] = OT_E(ot0, oti); /* Write result */ - } - } -} -#undef IT_WE -#undef IT_VO -#undef IT_IX -#undef CEX -#undef IM_O -#undef IM_FE -#undef OT_E - -static void -imdi_k103_gen( -genspec *g /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x10, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x28, 0x00, 0x00, 0x00, 0x00, 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, 0x04, 0x08, - 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08, - 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7, - 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7, - 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08, - 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00, - 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7, - 0x2c, 0xf3, 0xdc, 0xb7, 0x36, 0x5f, 0x31, 0x5f, - 0x69, 0x31, 0x36, 0x5f, 0x69, 0x31, 0x36, 0x5f, - 0x66, 0x00, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00, - 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf, - 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08, - 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf, - 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x30, - 0x33, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01, - 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7, - 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7, - 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08, - 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08, - 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf, - 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7, - 0x00, 0xf0, 0x04, 0x08 - }; /* Structure image */ - - memcpy(g, data, sizeof(data)); /* Initialise the structure */ -} - -static void -imdi_k103_tab( -tabspec *t /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0xa1, 0xd4, 0xe2, 0xb7, - 0xf4, 0xd5, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0xff, 0xff, 0xff, 0x31, 0x00, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xa0, 0xd6, 0x83, 0xbf, 0x8b, 0x22, 0xe2, 0xb7, - 0xf4, 0xd5, 0x83, 0xbf, 0x52, 0xca, 0x04, 0x08, - 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0x22, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff, - 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff - }; /* Structure image */ - - memcpy(t, data, sizeof(data)); /* Initialise the structure */ -} - -/* 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 = 7 - Input channel 0 bits = 16 - Input channel 0 increment = 7 - Input channel 1 bits = 16 - Input channel 1 increment = 7 - Input channel 2 bits = 16 - Input channel 2 increment = 7 - Input channel 3 bits = 16 - Input channel 3 increment = 7 - Input channel 4 bits = 16 - Input channel 4 increment = 7 - Input channel 5 bits = 16 - Input channel 5 increment = 7 - Input channel 6 bits = 16 - Input channel 6 increment = 7 - 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 = 16 - Output channel 0 increment = 1 - Output is channel interleaved - - Output channels are separate words - Weight+voffset bits = 32 - Interpolation table index bits = 32 - Interpolation table max resolution = 23 - */ - -/* - 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 <memory.h> -#include "imdi_imp.h" -#define IMDI_INCLUDED -#endif /* IMDI_INCLUDED */ - -#ifndef DEFINED_pointer -#define DEFINED_pointer -typedef unsigned char * pointer; -#endif - -/* Input table interp. index */ -#define IT_IX(p, off) *((unsigned int *)((p) + 0 + (off) * 12)) - -/* Input table input weighting enty */ -#define IT_WE(p, off) *((unsigned int *)((p) + 4 + (off) * 12)) - -/* Input table input offset value enty */ -#define IT_VO(p, off) *((unsigned int *)((p) + 8 + (off) * 12)) - -/* Conditional exchange for sorting */ -#define CEX(A, AA, B, BB) if (A < B) { \ - A ^= B; B ^= A; A ^= B; AA ^= BB; BB ^= AA; AA ^= BB; } - -/* Interpolation multi-dim. table access */ -#define IM_O(off) ((off) * 2) - -/* Interpolation table - get vertex values */ -#define IM_FE(p, v, c) ((unsigned int)*((unsigned short *)((p) + (v) * 2 + (c) * 2))) - -/* Output table indexes */ -#define OT_E(p, off) *((unsigned short *)((p) + (off) * 2)) - -static void -imdi_k104( -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 short *ip0 = (unsigned short *)inp[0]; - unsigned short *op0 = (unsigned short *)outp[0]; - unsigned short *ep = ip0 + npix * 7 ; - pointer it0 = (pointer)p->in_tables[0]; - pointer it1 = (pointer)p->in_tables[1]; - pointer it2 = (pointer)p->in_tables[2]; - pointer it3 = (pointer)p->in_tables[3]; - pointer it4 = (pointer)p->in_tables[4]; - pointer it5 = (pointer)p->in_tables[5]; - pointer it6 = (pointer)p->in_tables[6]; - pointer ot0 = (pointer)p->out_tables[0]; - pointer im_base = (pointer)p->im_table; - - for(;ip0 < ep; ip0 += 7, op0 += 1) { - unsigned int ova0; /* Output value accumulator */ - { - pointer imp; - unsigned int we0; /* Weighting value variable */ - unsigned int vo0; /* Vertex offset variable */ - unsigned int we1; /* Weighting value variable */ - unsigned int vo1; /* Vertex offset variable */ - unsigned int we2; /* Weighting value variable */ - unsigned int vo2; /* Vertex offset variable */ - unsigned int we3; /* Weighting value variable */ - unsigned int vo3; /* Vertex offset variable */ - unsigned int we4; /* Weighting value variable */ - unsigned int vo4; /* Vertex offset variable */ - unsigned int we5; /* Weighting value variable */ - unsigned int vo5; /* Vertex offset variable */ - unsigned int we6; /* Weighting value variable */ - unsigned int vo6; /* Vertex offset variable */ - { - unsigned int ti_i; /* Interpolation index variable */ - - ti_i = IT_IX(it0, ip0[0]); - we0 = IT_WE(it0, ip0[0]); - vo0 = IT_VO(it0, ip0[0]); - ti_i += IT_IX(it1, ip0[1]); - we1 = IT_WE(it1, ip0[1]); - vo1 = IT_VO(it1, ip0[1]); - ti_i += IT_IX(it2, ip0[2]); - we2 = IT_WE(it2, ip0[2]); - vo2 = IT_VO(it2, ip0[2]); - ti_i += IT_IX(it3, ip0[3]); - we3 = IT_WE(it3, ip0[3]); - vo3 = IT_VO(it3, ip0[3]); - ti_i += IT_IX(it4, ip0[4]); - we4 = IT_WE(it4, ip0[4]); - vo4 = IT_VO(it4, ip0[4]); - ti_i += IT_IX(it5, ip0[5]); - we5 = IT_WE(it5, ip0[5]); - vo5 = IT_VO(it5, ip0[5]); - ti_i += IT_IX(it6, ip0[6]); - we6 = IT_WE(it6, ip0[6]); - vo6 = IT_VO(it6, ip0[6]); - - imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */ - - /* Sort weighting values and vertex offset values */ - CEX(we0, vo0, we1, vo1); - CEX(we0, vo0, we2, vo2); - CEX(we0, vo0, we3, vo3); - CEX(we0, vo0, we4, vo4); - CEX(we0, vo0, we5, vo5); - CEX(we0, vo0, we6, vo6); - CEX(we1, vo1, we2, vo2); - CEX(we1, vo1, we3, vo3); - CEX(we1, vo1, we4, vo4); - CEX(we1, vo1, we5, vo5); - CEX(we1, vo1, we6, vo6); - CEX(we2, vo2, we3, vo3); - CEX(we2, vo2, we4, vo4); - CEX(we2, vo2, we5, vo5); - CEX(we2, vo2, we6, vo6); - CEX(we3, vo3, we4, vo4); - CEX(we3, vo3, we5, vo5); - CEX(we3, vo3, we6, vo6); - CEX(we4, vo4, we5, vo5); - CEX(we4, vo4, we6, vo6); - CEX(we5, vo5, we6, vo6); - } - { - unsigned int vof; /* Vertex offset value */ - unsigned int vwe; /* Vertex weighting */ - - vof = 0; /* First vertex offset is 0 */ - vwe = 65536 - we0; /* Baricentric weighting */ - ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - vof += vo0; /* Move to next vertex */ - vwe = we0 - we1; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - vof += vo1; /* Move to next vertex */ - vwe = we1 - we2; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - vof += vo2; /* Move to next vertex */ - vwe = we2 - we3; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - vof += vo3; /* Move to next vertex */ - vwe = we3 - we4; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - vof += vo4; /* Move to next vertex */ - vwe = we4 - we5; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - vof += vo5; /* Move to next vertex */ - vwe = we5 - we6; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - vof += vo6; /* Move to next vertex */ - vwe = we6; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - } - } - { - unsigned int oti; /* Vertex offset value */ - oti = ((ova0 >> 16) & 0xffff); /* Extract integer part of result */ - op0[0] = OT_E(ot0, oti); /* Write result */ - } - } -} -#undef IT_WE -#undef IT_VO -#undef IT_IX -#undef CEX -#undef IM_O -#undef IM_FE -#undef OT_E - -static void -imdi_k104_gen( -genspec *g /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x10, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x17, 0x00, 0x00, 0x00, 0x00, 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, 0x04, 0x08, - 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08, - 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7, - 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7, - 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08, - 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00, - 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7, - 0x2c, 0xf3, 0xdc, 0xb7, 0x37, 0x5f, 0x31, 0x5f, - 0x69, 0x31, 0x36, 0x5f, 0x69, 0x31, 0x36, 0x5f, - 0x66, 0x00, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00, - 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf, - 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08, - 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf, - 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x30, - 0x34, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01, - 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7, - 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7, - 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08, - 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08, - 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf, - 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7, - 0x00, 0xf0, 0x04, 0x08 - }; /* Structure image */ - - memcpy(g, data, sizeof(data)); /* Initialise the structure */ -} - -static void -imdi_k104_tab( -tabspec *t /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0xa1, 0xd4, 0xe2, 0xb7, - 0xf4, 0xd5, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0xff, 0xff, 0xff, 0x31, 0x00, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xa0, 0xd6, 0x83, 0xbf, 0x8b, 0x22, 0xe2, 0xb7, - 0xf4, 0xd5, 0x83, 0xbf, 0x52, 0xca, 0x04, 0x08, - 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0x22, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff, - 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff - }; /* Structure image */ - - memcpy(t, data, sizeof(data)); /* Initialise the structure */ -} - -/* 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 = 8 - Input channel 0 bits = 16 - Input channel 0 increment = 8 - Input channel 1 bits = 16 - Input channel 1 increment = 8 - Input channel 2 bits = 16 - Input channel 2 increment = 8 - Input channel 3 bits = 16 - Input channel 3 increment = 8 - Input channel 4 bits = 16 - Input channel 4 increment = 8 - Input channel 5 bits = 16 - Input channel 5 increment = 8 - Input channel 6 bits = 16 - Input channel 6 increment = 8 - Input channel 7 bits = 16 - Input channel 7 increment = 8 - 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 = 16 - Output channel 0 increment = 1 - Output is channel interleaved - - Output channels are separate words - Weight+voffset bits = 32 - Interpolation table index bits = 32 - Interpolation table max resolution = 16 - */ - -/* - 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 <memory.h> -#include "imdi_imp.h" -#define IMDI_INCLUDED -#endif /* IMDI_INCLUDED */ - -#ifndef DEFINED_pointer -#define DEFINED_pointer -typedef unsigned char * pointer; -#endif - -/* Input table interp. index */ -#define IT_IX(p, off) *((unsigned int *)((p) + 0 + (off) * 12)) - -/* Input table input weighting enty */ -#define IT_WE(p, off) *((unsigned int *)((p) + 4 + (off) * 12)) - -/* Input table input offset value enty */ -#define IT_VO(p, off) *((unsigned int *)((p) + 8 + (off) * 12)) - -/* Conditional exchange for sorting */ -#define CEX(A, AA, B, BB) if (A < B) { \ - A ^= B; B ^= A; A ^= B; AA ^= BB; BB ^= AA; AA ^= BB; } - -/* Interpolation multi-dim. table access */ -#define IM_O(off) ((off) * 2) - -/* Interpolation table - get vertex values */ -#define IM_FE(p, v, c) ((unsigned int)*((unsigned short *)((p) + (v) * 2 + (c) * 2))) - -/* Output table indexes */ -#define OT_E(p, off) *((unsigned short *)((p) + (off) * 2)) - -static void -imdi_k105( -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 short *ip0 = (unsigned short *)inp[0]; - unsigned short *op0 = (unsigned short *)outp[0]; - unsigned short *ep = ip0 + npix * 8 ; - pointer it0 = (pointer)p->in_tables[0]; - pointer it1 = (pointer)p->in_tables[1]; - pointer it2 = (pointer)p->in_tables[2]; - pointer it3 = (pointer)p->in_tables[3]; - pointer it4 = (pointer)p->in_tables[4]; - pointer it5 = (pointer)p->in_tables[5]; - pointer it6 = (pointer)p->in_tables[6]; - pointer it7 = (pointer)p->in_tables[7]; - pointer ot0 = (pointer)p->out_tables[0]; - pointer im_base = (pointer)p->im_table; - - for(;ip0 < ep; ip0 += 8, op0 += 1) { - unsigned int ova0; /* Output value accumulator */ - { - pointer imp; - unsigned int we0; /* Weighting value variable */ - unsigned int vo0; /* Vertex offset variable */ - unsigned int we1; /* Weighting value variable */ - unsigned int vo1; /* Vertex offset variable */ - unsigned int we2; /* Weighting value variable */ - unsigned int vo2; /* Vertex offset variable */ - unsigned int we3; /* Weighting value variable */ - unsigned int vo3; /* Vertex offset variable */ - unsigned int we4; /* Weighting value variable */ - unsigned int vo4; /* Vertex offset variable */ - unsigned int we5; /* Weighting value variable */ - unsigned int vo5; /* Vertex offset variable */ - unsigned int we6; /* Weighting value variable */ - unsigned int vo6; /* Vertex offset variable */ - unsigned int we7; /* Weighting value variable */ - unsigned int vo7; /* Vertex offset variable */ - { - unsigned int ti_i; /* Interpolation index variable */ - - ti_i = IT_IX(it0, ip0[0]); - we0 = IT_WE(it0, ip0[0]); - vo0 = IT_VO(it0, ip0[0]); - ti_i += IT_IX(it1, ip0[1]); - we1 = IT_WE(it1, ip0[1]); - vo1 = IT_VO(it1, ip0[1]); - ti_i += IT_IX(it2, ip0[2]); - we2 = IT_WE(it2, ip0[2]); - vo2 = IT_VO(it2, ip0[2]); - ti_i += IT_IX(it3, ip0[3]); - we3 = IT_WE(it3, ip0[3]); - vo3 = IT_VO(it3, ip0[3]); - ti_i += IT_IX(it4, ip0[4]); - we4 = IT_WE(it4, ip0[4]); - vo4 = IT_VO(it4, ip0[4]); - ti_i += IT_IX(it5, ip0[5]); - we5 = IT_WE(it5, ip0[5]); - vo5 = IT_VO(it5, ip0[5]); - ti_i += IT_IX(it6, ip0[6]); - we6 = IT_WE(it6, ip0[6]); - vo6 = IT_VO(it6, ip0[6]); - ti_i += IT_IX(it7, ip0[7]); - we7 = IT_WE(it7, ip0[7]); - vo7 = IT_VO(it7, ip0[7]); - - imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */ - - /* Sort weighting values and vertex offset values */ - CEX(we0, vo0, we1, vo1); - CEX(we0, vo0, we2, vo2); - CEX(we0, vo0, we3, vo3); - CEX(we0, vo0, we4, vo4); - CEX(we0, vo0, we5, vo5); - CEX(we0, vo0, we6, vo6); - CEX(we0, vo0, we7, vo7); - CEX(we1, vo1, we2, vo2); - CEX(we1, vo1, we3, vo3); - CEX(we1, vo1, we4, vo4); - CEX(we1, vo1, we5, vo5); - CEX(we1, vo1, we6, vo6); - CEX(we1, vo1, we7, vo7); - CEX(we2, vo2, we3, vo3); - CEX(we2, vo2, we4, vo4); - CEX(we2, vo2, we5, vo5); - CEX(we2, vo2, we6, vo6); - CEX(we2, vo2, we7, vo7); - CEX(we3, vo3, we4, vo4); - CEX(we3, vo3, we5, vo5); - CEX(we3, vo3, we6, vo6); - CEX(we3, vo3, we7, vo7); - CEX(we4, vo4, we5, vo5); - CEX(we4, vo4, we6, vo6); - CEX(we4, vo4, we7, vo7); - CEX(we5, vo5, we6, vo6); - CEX(we5, vo5, we7, vo7); - CEX(we6, vo6, we7, vo7); - } - { - unsigned int vof; /* Vertex offset value */ - unsigned int vwe; /* Vertex weighting */ - - vof = 0; /* First vertex offset is 0 */ - vwe = 65536 - we0; /* Baricentric weighting */ - ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - vof += vo0; /* Move to next vertex */ - vwe = we0 - we1; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - vof += vo1; /* Move to next vertex */ - vwe = we1 - we2; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - vof += vo2; /* Move to next vertex */ - vwe = we2 - we3; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - vof += vo3; /* Move to next vertex */ - vwe = we3 - we4; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - vof += vo4; /* Move to next vertex */ - vwe = we4 - we5; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - vof += vo5; /* Move to next vertex */ - vwe = we5 - we6; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - vof += vo6; /* Move to next vertex */ - vwe = we6 - we7; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - vof += vo7; /* Move to next vertex */ - vwe = we7; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - } - } - { - unsigned int oti; /* Vertex offset value */ - oti = ((ova0 >> 16) & 0xffff); /* Extract integer part of result */ - op0[0] = OT_E(ot0, oti); /* Write result */ - } - } -} -#undef IT_WE -#undef IT_VO -#undef IT_IX -#undef CEX -#undef IM_O -#undef IM_FE -#undef OT_E - -static void -imdi_k105_gen( -genspec *g /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x00, 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, 0x04, 0x08, - 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08, - 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7, - 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7, - 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08, - 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00, - 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7, - 0x2c, 0xf3, 0xdc, 0xb7, 0x38, 0x5f, 0x31, 0x5f, - 0x69, 0x31, 0x36, 0x5f, 0x69, 0x31, 0x36, 0x5f, - 0x66, 0x00, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00, - 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf, - 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08, - 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf, - 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x30, - 0x35, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01, - 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7, - 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7, - 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08, - 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08, - 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf, - 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7, - 0x00, 0xf0, 0x04, 0x08 - }; /* Structure image */ - - memcpy(g, data, sizeof(data)); /* Initialise the structure */ -} - -static void -imdi_k105_tab( -tabspec *t /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0xa1, 0xd4, 0xe2, 0xb7, - 0xf4, 0xd5, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0xff, 0xff, 0xff, 0x31, 0x00, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xa0, 0xd6, 0x83, 0xbf, 0x8b, 0x22, 0xe2, 0xb7, - 0xf4, 0xd5, 0x83, 0xbf, 0x52, 0xca, 0x04, 0x08, - 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0x22, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff, - 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff - }; /* Structure image */ - - memcpy(t, data, sizeof(data)); /* Initialise the structure */ -} - -/* 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 = 16 - 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 = 3 - Output channel 0 bits = 16 - Output channel 0 increment = 3 - Output channel 1 bits = 16 - Output channel 1 increment = 3 - Output channel 2 bits = 16 - Output channel 2 increment = 3 - Output is channel interleaved - - Output channels are separate words - Weight+voffset bits = 32 - Interpolation table index bits = 11 - Interpolation table max resolution = 2048 - */ - -/* - 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 <memory.h> -#include "imdi_imp.h" -#define IMDI_INCLUDED -#endif /* IMDI_INCLUDED */ - -#ifndef DEFINED_pointer -#define DEFINED_pointer -typedef unsigned char * pointer; -#endif - -/* Input table interp index, weighting and vertex offset */ -#define IT_IT(p, off) *((unsigned int *)((p) + 0 + (off) * 4)) - -/* Conditional exchange for sorting */ -#define CEX(A, B) if (A < B) { A ^= B; B ^= A; A ^= B; } - -/* Interpolation multi-dim. table access */ -#define IM_O(off) ((off) * 6) - -/* Interpolation table - get vertex values */ -#define IM_FE(p, v, c) ((unsigned int)*((unsigned short *)((p) + (v) * 2 + (c) * 2))) - -/* Output table indexes */ -#define OT_E(p, off) *((unsigned short *)((p) + (off) * 2)) - -static void -imdi_k106( -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 short *ip0 = (unsigned short *)inp[0]; - unsigned short *op0 = (unsigned short *)outp[0]; - unsigned short *ep = ip0 + npix * 1 ; - pointer it0 = (pointer)p->in_tables[0]; - pointer ot0 = (pointer)p->out_tables[0]; - pointer ot1 = (pointer)p->out_tables[1]; - pointer ot2 = (pointer)p->out_tables[2]; - pointer im_base = (pointer)p->im_table; - - for(;ip0 < ep; ip0 += 1, op0 += 3) { - unsigned int ova0; /* Output value accumulator */ - unsigned int ova1; /* Output value accumulator */ - unsigned int ova2; /* Output value accumulator */ - { - pointer imp; - unsigned int wo0; /* Weighting value and vertex offset variable */ - { - unsigned int ti; /* Input table entry variable */ - unsigned int ti_i; /* Interpolation index variable */ - - ti = IT_IT(it0, ip0[0]); - wo0 = (ti & 0x1fffff); /* Extract weighting/vertex offset value */ - ti_i = (ti >> 21); /* Extract interpolation table value */ - - imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */ - - /* Sort weighting values and vertex offset values */ - } - { - unsigned int nvof; /* Next vertex offset value */ - unsigned int vof; /* Vertex offset value */ - unsigned int vwe; /* Vertex weighting */ - - vof = 0; /* First vertex offset is 0 */ - nvof = (wo0 & 0xf); /* Extract offset value */ - wo0 = (wo0 >> 4); /* Extract weighting value */ - vwe = 65536 - wo0; /* Baricentric weighting */ - ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - vwe = wo0; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - } - } - { - unsigned int oti; /* Vertex offset value */ - oti = ((ova0 >> 16) & 0xffff); /* Extract integer part of result */ - op0[0] = OT_E(ot0, oti); /* Write result */ - oti = ((ova1 >> 16) & 0xffff); /* Extract integer part of result */ - op0[1] = OT_E(ot1, oti); /* Write result */ - oti = ((ova2 >> 16) & 0xffff); /* Extract integer part of result */ - op0[2] = OT_E(ot2, oti); /* Write result */ - } - } -} -#undef IT_IT -#undef CEX -#undef IM_O -#undef IM_FE -#undef OT_E - -static void -imdi_k106_gen( -genspec *g /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x08, 0x00, 0x00, 0x00, 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, 0x04, 0x08, - 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08, - 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7, - 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7, - 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08, - 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00, - 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7, - 0x2c, 0xf3, 0xdc, 0xb7, 0x31, 0x5f, 0x33, 0x5f, - 0x69, 0x31, 0x36, 0x5f, 0x69, 0x31, 0x36, 0x5f, - 0x66, 0x00, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00, - 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf, - 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08, - 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf, - 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x30, - 0x36, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01, - 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7, - 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7, - 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08, - 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08, - 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf, - 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7, - 0x00, 0xf0, 0x04, 0x08 - }; /* Structure image */ - - memcpy(g, data, sizeof(data)); /* Initialise the structure */ -} - -static void -imdi_k106_tab( -tabspec *t /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x0b, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x14, 0x00, 0x00, 0x00, 0x15, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x11, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf, - 0xff, 0xff, 0xff, 0x33, 0x00, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xf4, 0xd5, 0x83, 0xbf, 0x52, 0xca, 0x04, 0x08, - 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0x22, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff, - 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff - }; /* Structure image */ - - memcpy(t, data, sizeof(data)); /* Initialise the structure */ -} - -/* 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 = 3 - Input channel 0 bits = 16 - Input channel 0 increment = 3 - Input channel 1 bits = 16 - Input channel 1 increment = 3 - Input channel 2 bits = 16 - Input channel 2 increment = 3 - Input is channel interleaved - Input channels are separate words - Input value extraction is done in input table lookup - - Output channels per pixel = 3 - Output channel 0 bits = 16 - Output channel 0 increment = 3 - Output channel 1 bits = 16 - Output channel 1 increment = 3 - Output channel 2 bits = 16 - Output channel 2 increment = 3 - Output is channel interleaved - - Output channels are separate words - Weight+voffset bits = 32 - Interpolation table index bits = 16 - Interpolation table max resolution = 40 - */ - -/* - 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 <memory.h> -#include "imdi_imp.h" -#define IMDI_INCLUDED -#endif /* IMDI_INCLUDED */ - -#ifndef DEFINED_pointer -#define DEFINED_pointer -typedef unsigned char * pointer; -#endif - -/* Input table interp. index */ -#define IT_IX(p, off) *((unsigned short *)((p) + 0 + (off) * 6)) - -/* Input table input weighting/offset value enty */ -#define IT_WO(p, off) *((unsigned int *)((p) + 2 + (off) * 6)) - -/* Conditional exchange for sorting */ -#define CEX(A, B) if (A < B) { A ^= B; B ^= A; A ^= B; } - -/* Interpolation multi-dim. table access */ -#define IM_O(off) ((off) * 6) - -/* Interpolation table - get vertex values */ -#define IM_FE(p, v, c) ((unsigned int)*((unsigned short *)((p) + (v) * 2 + (c) * 2))) - -/* Output table indexes */ -#define OT_E(p, off) *((unsigned short *)((p) + (off) * 2)) - -static void -imdi_k107( -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 short *ip0 = (unsigned short *)inp[0]; - unsigned short *op0 = (unsigned short *)outp[0]; - unsigned short *ep = ip0 + npix * 3 ; - pointer it0 = (pointer)p->in_tables[0]; - pointer it1 = (pointer)p->in_tables[1]; - pointer it2 = (pointer)p->in_tables[2]; - pointer ot0 = (pointer)p->out_tables[0]; - pointer ot1 = (pointer)p->out_tables[1]; - pointer ot2 = (pointer)p->out_tables[2]; - pointer im_base = (pointer)p->im_table; - - for(;ip0 < ep; ip0 += 3, op0 += 3) { - unsigned int ova0; /* Output value accumulator */ - unsigned int ova1; /* Output value accumulator */ - unsigned int ova2; /* Output value accumulator */ - { - pointer imp; - unsigned int wo0; /* Weighting value and vertex offset variable */ - unsigned int wo1; /* Weighting value and vertex offset variable */ - unsigned int wo2; /* Weighting value and vertex offset variable */ - { - unsigned int ti_i; /* Interpolation index variable */ - - ti_i = IT_IX(it0, ip0[0]); - wo0 = IT_WO(it0, ip0[0]); - ti_i += IT_IX(it1, ip0[1]); - wo1 = IT_WO(it1, ip0[1]); - ti_i += IT_IX(it2, ip0[2]); - wo2 = IT_WO(it2, ip0[2]); - - imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */ - - /* Sort weighting values and vertex offset values */ - CEX(wo0, wo1); - CEX(wo0, wo2); - CEX(wo1, wo2); - } - { - unsigned int nvof; /* Next vertex offset value */ - unsigned int vof; /* Vertex offset value */ - unsigned int vwe; /* Vertex weighting */ - - vof = 0; /* First vertex offset is 0 */ - nvof = (wo0 & 0x7fff); /* Extract offset value */ - wo0 = (wo0 >> 15); /* Extract weighting value */ - vwe = 65536 - wo0; /* Baricentric weighting */ - ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo1 & 0x7fff); /* Extract offset value */ - wo1 = (wo1 >> 15); /* Extract weighting value */ - vwe = wo0 - wo1; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo2 & 0x7fff); /* Extract offset value */ - wo2 = (wo2 >> 15); /* Extract weighting value */ - vwe = wo1 - wo2; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - vwe = wo2; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - } - } - { - unsigned int oti; /* Vertex offset value */ - oti = ((ova0 >> 16) & 0xffff); /* Extract integer part of result */ - op0[0] = OT_E(ot0, oti); /* Write result */ - oti = ((ova1 >> 16) & 0xffff); /* Extract integer part of result */ - op0[1] = OT_E(ot1, oti); /* Write result */ - oti = ((ova2 >> 16) & 0xffff); /* Extract integer part of result */ - op0[2] = OT_E(ot2, oti); /* Write result */ - } - } -} -#undef IT_WO -#undef IT_IX -#undef CEX -#undef IM_O -#undef IM_FE -#undef OT_E - -static void -imdi_k107_gen( -genspec *g /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x10, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x28, 0x00, 0x00, 0x00, 0x00, 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, 0x04, 0x08, - 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08, - 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7, - 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7, - 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08, - 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00, - 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7, - 0x2c, 0xf3, 0xdc, 0xb7, 0x33, 0x5f, 0x33, 0x5f, - 0x69, 0x31, 0x36, 0x5f, 0x69, 0x31, 0x36, 0x5f, - 0x66, 0x00, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00, - 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf, - 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08, - 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf, - 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x30, - 0x37, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01, - 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7, - 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7, - 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08, - 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08, - 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf, - 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7, - 0x00, 0xf0, 0x04, 0x08 - }; /* Structure image */ - - memcpy(g, data, sizeof(data)); /* Initialise the structure */ -} - -static void -imdi_k107_tab( -tabspec *t /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x11, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf, - 0xff, 0xff, 0xff, 0x33, 0x00, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xf4, 0xd5, 0x83, 0xbf, 0x52, 0xca, 0x04, 0x08, - 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0x22, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff, - 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff - }; /* Structure image */ - - memcpy(t, data, sizeof(data)); /* Initialise the structure */ -} - -/* 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 = 4 - Input channel 0 bits = 16 - Input channel 0 increment = 4 - Input channel 1 bits = 16 - Input channel 1 increment = 4 - Input channel 2 bits = 16 - Input channel 2 increment = 4 - Input channel 3 bits = 16 - Input channel 3 increment = 4 - Input is channel interleaved - Input channels are separate words - Input value extraction is done in input table lookup - - Output channels per pixel = 3 - Output channel 0 bits = 16 - Output channel 0 increment = 3 - Output channel 1 bits = 16 - Output channel 1 increment = 3 - Output channel 2 bits = 16 - Output channel 2 increment = 3 - Output is channel interleaved - - Output channels are separate words - Weight+voffset bits = 32 - Interpolation table index bits = 32 - Interpolation table max resolution = 21 - */ - -/* - 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 <memory.h> -#include "imdi_imp.h" -#define IMDI_INCLUDED -#endif /* IMDI_INCLUDED */ - -#ifndef DEFINED_pointer -#define DEFINED_pointer -typedef unsigned char * pointer; -#endif - -/* Input table interp. index */ -#define IT_IX(p, off) *((unsigned int *)((p) + 0 + (off) * 8)) - -/* Input table input weighting/offset value enty */ -#define IT_WO(p, off) *((unsigned int *)((p) + 4 + (off) * 8)) - -/* Conditional exchange for sorting */ -#define CEX(A, B) if (A < B) { A ^= B; B ^= A; A ^= B; } - -/* Interpolation multi-dim. table access */ -#define IM_O(off) ((off) * 6) - -/* Interpolation table - get vertex values */ -#define IM_FE(p, v, c) ((unsigned int)*((unsigned short *)((p) + (v) * 2 + (c) * 2))) - -/* Output table indexes */ -#define OT_E(p, off) *((unsigned short *)((p) + (off) * 2)) - -static void -imdi_k108( -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 short *ip0 = (unsigned short *)inp[0]; - unsigned short *op0 = (unsigned short *)outp[0]; - unsigned short *ep = ip0 + npix * 4 ; - pointer it0 = (pointer)p->in_tables[0]; - pointer it1 = (pointer)p->in_tables[1]; - pointer it2 = (pointer)p->in_tables[2]; - pointer it3 = (pointer)p->in_tables[3]; - pointer ot0 = (pointer)p->out_tables[0]; - pointer ot1 = (pointer)p->out_tables[1]; - pointer ot2 = (pointer)p->out_tables[2]; - pointer im_base = (pointer)p->im_table; - - for(;ip0 < ep; ip0 += 4, op0 += 3) { - unsigned int ova0; /* Output value accumulator */ - unsigned int ova1; /* Output value accumulator */ - unsigned int ova2; /* Output value accumulator */ - { - pointer imp; - unsigned int wo0; /* Weighting value and vertex offset variable */ - unsigned int wo1; /* Weighting value and vertex offset variable */ - unsigned int wo2; /* Weighting value and vertex offset variable */ - unsigned int wo3; /* Weighting value and vertex offset variable */ - { - unsigned int ti_i; /* Interpolation index variable */ - - ti_i = IT_IX(it0, ip0[0]); - wo0 = IT_WO(it0, ip0[0]); - ti_i += IT_IX(it1, ip0[1]); - wo1 = IT_WO(it1, ip0[1]); - ti_i += IT_IX(it2, ip0[2]); - wo2 = IT_WO(it2, ip0[2]); - ti_i += IT_IX(it3, ip0[3]); - wo3 = IT_WO(it3, ip0[3]); - - imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */ - - /* Sort weighting values and vertex offset values */ - CEX(wo0, wo1); - CEX(wo0, wo2); - CEX(wo0, wo3); - CEX(wo1, wo2); - CEX(wo1, wo3); - CEX(wo2, wo3); - } - { - unsigned int nvof; /* Next vertex offset value */ - unsigned int vof; /* Vertex offset value */ - unsigned int vwe; /* Vertex weighting */ - - vof = 0; /* First vertex offset is 0 */ - nvof = (wo0 & 0x7fff); /* Extract offset value */ - wo0 = (wo0 >> 15); /* Extract weighting value */ - vwe = 65536 - wo0; /* Baricentric weighting */ - ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo1 & 0x7fff); /* Extract offset value */ - wo1 = (wo1 >> 15); /* Extract weighting value */ - vwe = wo0 - wo1; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo2 & 0x7fff); /* Extract offset value */ - wo2 = (wo2 >> 15); /* Extract weighting value */ - vwe = wo1 - wo2; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo3 & 0x7fff); /* Extract offset value */ - wo3 = (wo3 >> 15); /* Extract weighting value */ - vwe = wo2 - wo3; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - vwe = wo3; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - } - } - { - unsigned int oti; /* Vertex offset value */ - oti = ((ova0 >> 16) & 0xffff); /* Extract integer part of result */ - op0[0] = OT_E(ot0, oti); /* Write result */ - oti = ((ova1 >> 16) & 0xffff); /* Extract integer part of result */ - op0[1] = OT_E(ot1, oti); /* Write result */ - oti = ((ova2 >> 16) & 0xffff); /* Extract integer part of result */ - op0[2] = OT_E(ot2, oti); /* Write result */ - } - } -} -#undef IT_WO -#undef IT_IX -#undef CEX -#undef IM_O -#undef IM_FE -#undef OT_E - -static void -imdi_k108_gen( -genspec *g /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x10, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x15, 0x00, 0x00, 0x00, 0x00, 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, 0x04, 0x08, - 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08, - 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7, - 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7, - 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08, - 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00, - 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7, - 0x2c, 0xf3, 0xdc, 0xb7, 0x34, 0x5f, 0x33, 0x5f, - 0x69, 0x31, 0x36, 0x5f, 0x69, 0x31, 0x36, 0x5f, - 0x66, 0x00, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00, - 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf, - 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08, - 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf, - 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x30, - 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01, - 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7, - 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7, - 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08, - 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08, - 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf, - 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7, - 0x00, 0xf0, 0x04, 0x08 - }; /* Structure image */ - - memcpy(g, data, sizeof(data)); /* Initialise the structure */ -} - -static void -imdi_k108_tab( -tabspec *t /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x11, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf, - 0xff, 0xff, 0xff, 0x33, 0x00, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xf4, 0xd5, 0x83, 0xbf, 0x52, 0xca, 0x04, 0x08, - 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0x22, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff, - 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff - }; /* Structure image */ - - memcpy(t, data, sizeof(data)); /* Initialise the structure */ -} - -/* 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 = 5 - Input channel 0 bits = 16 - Input channel 0 increment = 5 - Input channel 1 bits = 16 - Input channel 1 increment = 5 - Input channel 2 bits = 16 - Input channel 2 increment = 5 - Input channel 3 bits = 16 - Input channel 3 increment = 5 - Input channel 4 bits = 16 - Input channel 4 increment = 5 - Input is channel interleaved - Input channels are separate words - Input value extraction is done in input table lookup - - Output channels per pixel = 3 - Output channel 0 bits = 16 - Output channel 0 increment = 3 - Output channel 1 bits = 16 - Output channel 1 increment = 3 - Output channel 2 bits = 16 - Output channel 2 increment = 3 - Output is channel interleaved - - Output channels are separate words - Weight+voffset bits = 32 - Interpolation table index bits = 32 - Interpolation table max resolution = 84 - */ - -/* - 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 <memory.h> -#include "imdi_imp.h" -#define IMDI_INCLUDED -#endif /* IMDI_INCLUDED */ - -#ifndef DEFINED_pointer -#define DEFINED_pointer -typedef unsigned char * pointer; -#endif - -/* Input table interp. index */ -#define IT_IX(p, off) *((unsigned int *)((p) + 0 + (off) * 12)) - -/* Input table input weighting enty */ -#define IT_WE(p, off) *((unsigned int *)((p) + 4 + (off) * 12)) - -/* Input table input offset value enty */ -#define IT_VO(p, off) *((unsigned int *)((p) + 8 + (off) * 12)) - -/* Conditional exchange for sorting */ -#define CEX(A, AA, B, BB) if (A < B) { \ - A ^= B; B ^= A; A ^= B; AA ^= BB; BB ^= AA; AA ^= BB; } - -/* Interpolation multi-dim. table access */ -#define IM_O(off) ((off) * 6) - -/* Interpolation table - get vertex values */ -#define IM_FE(p, v, c) ((unsigned int)*((unsigned short *)((p) + (v) * 2 + (c) * 2))) - -/* Output table indexes */ -#define OT_E(p, off) *((unsigned short *)((p) + (off) * 2)) - -static void -imdi_k109( -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 short *ip0 = (unsigned short *)inp[0]; - unsigned short *op0 = (unsigned short *)outp[0]; - unsigned short *ep = ip0 + npix * 5 ; - pointer it0 = (pointer)p->in_tables[0]; - pointer it1 = (pointer)p->in_tables[1]; - pointer it2 = (pointer)p->in_tables[2]; - pointer it3 = (pointer)p->in_tables[3]; - pointer it4 = (pointer)p->in_tables[4]; - pointer ot0 = (pointer)p->out_tables[0]; - pointer ot1 = (pointer)p->out_tables[1]; - pointer ot2 = (pointer)p->out_tables[2]; - pointer im_base = (pointer)p->im_table; - - for(;ip0 < ep; ip0 += 5, op0 += 3) { - unsigned int ova0; /* Output value accumulator */ - unsigned int ova1; /* Output value accumulator */ - unsigned int ova2; /* Output value accumulator */ - { - pointer imp; - unsigned int we0; /* Weighting value variable */ - unsigned int vo0; /* Vertex offset variable */ - unsigned int we1; /* Weighting value variable */ - unsigned int vo1; /* Vertex offset variable */ - unsigned int we2; /* Weighting value variable */ - unsigned int vo2; /* Vertex offset variable */ - unsigned int we3; /* Weighting value variable */ - unsigned int vo3; /* Vertex offset variable */ - unsigned int we4; /* Weighting value variable */ - unsigned int vo4; /* Vertex offset variable */ - { - unsigned int ti_i; /* Interpolation index variable */ - - ti_i = IT_IX(it0, ip0[0]); - we0 = IT_WE(it0, ip0[0]); - vo0 = IT_VO(it0, ip0[0]); - ti_i += IT_IX(it1, ip0[1]); - we1 = IT_WE(it1, ip0[1]); - vo1 = IT_VO(it1, ip0[1]); - ti_i += IT_IX(it2, ip0[2]); - we2 = IT_WE(it2, ip0[2]); - vo2 = IT_VO(it2, ip0[2]); - ti_i += IT_IX(it3, ip0[3]); - we3 = IT_WE(it3, ip0[3]); - vo3 = IT_VO(it3, ip0[3]); - ti_i += IT_IX(it4, ip0[4]); - we4 = IT_WE(it4, ip0[4]); - vo4 = IT_VO(it4, ip0[4]); - - imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */ - - /* Sort weighting values and vertex offset values */ - CEX(we0, vo0, we1, vo1); - CEX(we0, vo0, we2, vo2); - CEX(we0, vo0, we3, vo3); - CEX(we0, vo0, we4, vo4); - CEX(we1, vo1, we2, vo2); - CEX(we1, vo1, we3, vo3); - CEX(we1, vo1, we4, vo4); - CEX(we2, vo2, we3, vo3); - CEX(we2, vo2, we4, vo4); - CEX(we3, vo3, we4, vo4); - } - { - unsigned int vof; /* Vertex offset value */ - unsigned int vwe; /* Vertex weighting */ - - vof = 0; /* First vertex offset is 0 */ - vwe = 65536 - we0; /* Baricentric weighting */ - ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - vof += vo0; /* Move to next vertex */ - vwe = we0 - we1; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - vof += vo1; /* Move to next vertex */ - vwe = we1 - we2; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - vof += vo2; /* Move to next vertex */ - vwe = we2 - we3; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - vof += vo3; /* Move to next vertex */ - vwe = we3 - we4; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - vof += vo4; /* Move to next vertex */ - vwe = we4; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - } - } - { - unsigned int oti; /* Vertex offset value */ - oti = ((ova0 >> 16) & 0xffff); /* Extract integer part of result */ - op0[0] = OT_E(ot0, oti); /* Write result */ - oti = ((ova1 >> 16) & 0xffff); /* Extract integer part of result */ - op0[1] = OT_E(ot1, oti); /* Write result */ - oti = ((ova2 >> 16) & 0xffff); /* Extract integer part of result */ - op0[2] = OT_E(ot2, oti); /* Write result */ - } - } -} -#undef IT_WE -#undef IT_VO -#undef IT_IX -#undef CEX -#undef IM_O -#undef IM_FE -#undef OT_E - -static void -imdi_k109_gen( -genspec *g /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x10, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x54, 0x00, 0x00, 0x00, 0x00, 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, 0x04, 0x08, - 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08, - 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7, - 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7, - 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08, - 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00, - 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7, - 0x2c, 0xf3, 0xdc, 0xb7, 0x35, 0x5f, 0x33, 0x5f, - 0x69, 0x31, 0x36, 0x5f, 0x69, 0x31, 0x36, 0x5f, - 0x66, 0x00, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00, - 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf, - 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08, - 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf, - 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x30, - 0x39, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01, - 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7, - 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7, - 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08, - 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08, - 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf, - 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7, - 0x00, 0xf0, 0x04, 0x08 - }; /* Structure image */ - - memcpy(g, data, sizeof(data)); /* Initialise the structure */ -} - -static void -imdi_k109_tab( -tabspec *t /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf, - 0xff, 0xff, 0xff, 0x33, 0x00, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xf4, 0xd5, 0x83, 0xbf, 0x52, 0xca, 0x04, 0x08, - 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0x22, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff, - 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff - }; /* Structure image */ - - memcpy(t, data, sizeof(data)); /* Initialise the structure */ -} - -/* 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 = 6 - Input channel 0 bits = 16 - Input channel 0 increment = 6 - Input channel 1 bits = 16 - Input channel 1 increment = 6 - Input channel 2 bits = 16 - Input channel 2 increment = 6 - Input channel 3 bits = 16 - Input channel 3 increment = 6 - Input channel 4 bits = 16 - Input channel 4 increment = 6 - Input channel 5 bits = 16 - Input channel 5 increment = 6 - Input is channel interleaved - Input channels are separate words - Input value extraction is done in input table lookup - - Output channels per pixel = 3 - Output channel 0 bits = 16 - Output channel 0 increment = 3 - Output channel 1 bits = 16 - Output channel 1 increment = 3 - Output channel 2 bits = 16 - Output channel 2 increment = 3 - Output is channel interleaved - - Output channels are separate words - Weight+voffset bits = 32 - Interpolation table index bits = 32 - Interpolation table max resolution = 40 - */ - -/* - 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 <memory.h> -#include "imdi_imp.h" -#define IMDI_INCLUDED -#endif /* IMDI_INCLUDED */ - -#ifndef DEFINED_pointer -#define DEFINED_pointer -typedef unsigned char * pointer; -#endif - -/* Input table interp. index */ -#define IT_IX(p, off) *((unsigned int *)((p) + 0 + (off) * 12)) - -/* Input table input weighting enty */ -#define IT_WE(p, off) *((unsigned int *)((p) + 4 + (off) * 12)) - -/* Input table input offset value enty */ -#define IT_VO(p, off) *((unsigned int *)((p) + 8 + (off) * 12)) - -/* Conditional exchange for sorting */ -#define CEX(A, AA, B, BB) if (A < B) { \ - A ^= B; B ^= A; A ^= B; AA ^= BB; BB ^= AA; AA ^= BB; } - -/* Interpolation multi-dim. table access */ -#define IM_O(off) ((off) * 6) - -/* Interpolation table - get vertex values */ -#define IM_FE(p, v, c) ((unsigned int)*((unsigned short *)((p) + (v) * 2 + (c) * 2))) - -/* Output table indexes */ -#define OT_E(p, off) *((unsigned short *)((p) + (off) * 2)) - -static void -imdi_k110( -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 short *ip0 = (unsigned short *)inp[0]; - unsigned short *op0 = (unsigned short *)outp[0]; - unsigned short *ep = ip0 + npix * 6 ; - pointer it0 = (pointer)p->in_tables[0]; - pointer it1 = (pointer)p->in_tables[1]; - pointer it2 = (pointer)p->in_tables[2]; - pointer it3 = (pointer)p->in_tables[3]; - pointer it4 = (pointer)p->in_tables[4]; - pointer it5 = (pointer)p->in_tables[5]; - pointer ot0 = (pointer)p->out_tables[0]; - pointer ot1 = (pointer)p->out_tables[1]; - pointer ot2 = (pointer)p->out_tables[2]; - pointer im_base = (pointer)p->im_table; - - for(;ip0 < ep; ip0 += 6, op0 += 3) { - unsigned int ova0; /* Output value accumulator */ - unsigned int ova1; /* Output value accumulator */ - unsigned int ova2; /* Output value accumulator */ - { - pointer imp; - unsigned int we0; /* Weighting value variable */ - unsigned int vo0; /* Vertex offset variable */ - unsigned int we1; /* Weighting value variable */ - unsigned int vo1; /* Vertex offset variable */ - unsigned int we2; /* Weighting value variable */ - unsigned int vo2; /* Vertex offset variable */ - unsigned int we3; /* Weighting value variable */ - unsigned int vo3; /* Vertex offset variable */ - unsigned int we4; /* Weighting value variable */ - unsigned int vo4; /* Vertex offset variable */ - unsigned int we5; /* Weighting value variable */ - unsigned int vo5; /* Vertex offset variable */ - { - unsigned int ti_i; /* Interpolation index variable */ - - ti_i = IT_IX(it0, ip0[0]); - we0 = IT_WE(it0, ip0[0]); - vo0 = IT_VO(it0, ip0[0]); - ti_i += IT_IX(it1, ip0[1]); - we1 = IT_WE(it1, ip0[1]); - vo1 = IT_VO(it1, ip0[1]); - ti_i += IT_IX(it2, ip0[2]); - we2 = IT_WE(it2, ip0[2]); - vo2 = IT_VO(it2, ip0[2]); - ti_i += IT_IX(it3, ip0[3]); - we3 = IT_WE(it3, ip0[3]); - vo3 = IT_VO(it3, ip0[3]); - ti_i += IT_IX(it4, ip0[4]); - we4 = IT_WE(it4, ip0[4]); - vo4 = IT_VO(it4, ip0[4]); - ti_i += IT_IX(it5, ip0[5]); - we5 = IT_WE(it5, ip0[5]); - vo5 = IT_VO(it5, ip0[5]); - - imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */ - - /* Sort weighting values and vertex offset values */ - CEX(we0, vo0, we1, vo1); - CEX(we0, vo0, we2, vo2); - CEX(we0, vo0, we3, vo3); - CEX(we0, vo0, we4, vo4); - CEX(we0, vo0, we5, vo5); - CEX(we1, vo1, we2, vo2); - CEX(we1, vo1, we3, vo3); - CEX(we1, vo1, we4, vo4); - CEX(we1, vo1, we5, vo5); - CEX(we2, vo2, we3, vo3); - CEX(we2, vo2, we4, vo4); - CEX(we2, vo2, we5, vo5); - CEX(we3, vo3, we4, vo4); - CEX(we3, vo3, we5, vo5); - CEX(we4, vo4, we5, vo5); - } - { - unsigned int vof; /* Vertex offset value */ - unsigned int vwe; /* Vertex weighting */ - - vof = 0; /* First vertex offset is 0 */ - vwe = 65536 - we0; /* Baricentric weighting */ - ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - vof += vo0; /* Move to next vertex */ - vwe = we0 - we1; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - vof += vo1; /* Move to next vertex */ - vwe = we1 - we2; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - vof += vo2; /* Move to next vertex */ - vwe = we2 - we3; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - vof += vo3; /* Move to next vertex */ - vwe = we3 - we4; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - vof += vo4; /* Move to next vertex */ - vwe = we4 - we5; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - vof += vo5; /* Move to next vertex */ - vwe = we5; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - } - } - { - unsigned int oti; /* Vertex offset value */ - oti = ((ova0 >> 16) & 0xffff); /* Extract integer part of result */ - op0[0] = OT_E(ot0, oti); /* Write result */ - oti = ((ova1 >> 16) & 0xffff); /* Extract integer part of result */ - op0[1] = OT_E(ot1, oti); /* Write result */ - oti = ((ova2 >> 16) & 0xffff); /* Extract integer part of result */ - op0[2] = OT_E(ot2, oti); /* Write result */ - } - } -} -#undef IT_WE -#undef IT_VO -#undef IT_IX -#undef CEX -#undef IM_O -#undef IM_FE -#undef OT_E - -static void -imdi_k110_gen( -genspec *g /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x10, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x28, 0x00, 0x00, 0x00, 0x00, 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, 0x04, 0x08, - 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08, - 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7, - 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7, - 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08, - 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00, - 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7, - 0x2c, 0xf3, 0xdc, 0xb7, 0x36, 0x5f, 0x33, 0x5f, - 0x69, 0x31, 0x36, 0x5f, 0x69, 0x31, 0x36, 0x5f, - 0x66, 0x00, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00, - 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf, - 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08, - 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf, - 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x31, - 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01, - 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7, - 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7, - 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08, - 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08, - 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf, - 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7, - 0x00, 0xf0, 0x04, 0x08 - }; /* Structure image */ - - memcpy(g, data, sizeof(data)); /* Initialise the structure */ -} - -static void -imdi_k110_tab( -tabspec *t /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf, - 0xff, 0xff, 0xff, 0x33, 0x00, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xf4, 0xd5, 0x83, 0xbf, 0x52, 0xca, 0x04, 0x08, - 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0x22, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff, - 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff - }; /* Structure image */ - - memcpy(t, data, sizeof(data)); /* Initialise the structure */ -} - -/* 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 = 7 - Input channel 0 bits = 16 - Input channel 0 increment = 7 - Input channel 1 bits = 16 - Input channel 1 increment = 7 - Input channel 2 bits = 16 - Input channel 2 increment = 7 - Input channel 3 bits = 16 - Input channel 3 increment = 7 - Input channel 4 bits = 16 - Input channel 4 increment = 7 - Input channel 5 bits = 16 - Input channel 5 increment = 7 - Input channel 6 bits = 16 - Input channel 6 increment = 7 - Input is channel interleaved - Input channels are separate words - Input value extraction is done in input table lookup - - Output channels per pixel = 3 - Output channel 0 bits = 16 - Output channel 0 increment = 3 - Output channel 1 bits = 16 - Output channel 1 increment = 3 - Output channel 2 bits = 16 - Output channel 2 increment = 3 - Output is channel interleaved - - Output channels are separate words - Weight+voffset bits = 32 - Interpolation table index bits = 32 - Interpolation table max resolution = 23 - */ - -/* - 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 <memory.h> -#include "imdi_imp.h" -#define IMDI_INCLUDED -#endif /* IMDI_INCLUDED */ - -#ifndef DEFINED_pointer -#define DEFINED_pointer -typedef unsigned char * pointer; -#endif - -/* Input table interp. index */ -#define IT_IX(p, off) *((unsigned int *)((p) + 0 + (off) * 12)) - -/* Input table input weighting enty */ -#define IT_WE(p, off) *((unsigned int *)((p) + 4 + (off) * 12)) - -/* Input table input offset value enty */ -#define IT_VO(p, off) *((unsigned int *)((p) + 8 + (off) * 12)) - -/* Conditional exchange for sorting */ -#define CEX(A, AA, B, BB) if (A < B) { \ - A ^= B; B ^= A; A ^= B; AA ^= BB; BB ^= AA; AA ^= BB; } - -/* Interpolation multi-dim. table access */ -#define IM_O(off) ((off) * 6) - -/* Interpolation table - get vertex values */ -#define IM_FE(p, v, c) ((unsigned int)*((unsigned short *)((p) + (v) * 2 + (c) * 2))) - -/* Output table indexes */ -#define OT_E(p, off) *((unsigned short *)((p) + (off) * 2)) - -static void -imdi_k111( -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 short *ip0 = (unsigned short *)inp[0]; - unsigned short *op0 = (unsigned short *)outp[0]; - unsigned short *ep = ip0 + npix * 7 ; - pointer it0 = (pointer)p->in_tables[0]; - pointer it1 = (pointer)p->in_tables[1]; - pointer it2 = (pointer)p->in_tables[2]; - pointer it3 = (pointer)p->in_tables[3]; - pointer it4 = (pointer)p->in_tables[4]; - pointer it5 = (pointer)p->in_tables[5]; - pointer it6 = (pointer)p->in_tables[6]; - pointer ot0 = (pointer)p->out_tables[0]; - pointer ot1 = (pointer)p->out_tables[1]; - pointer ot2 = (pointer)p->out_tables[2]; - pointer im_base = (pointer)p->im_table; - - for(;ip0 < ep; ip0 += 7, op0 += 3) { - unsigned int ova0; /* Output value accumulator */ - unsigned int ova1; /* Output value accumulator */ - unsigned int ova2; /* Output value accumulator */ - { - pointer imp; - unsigned int we0; /* Weighting value variable */ - unsigned int vo0; /* Vertex offset variable */ - unsigned int we1; /* Weighting value variable */ - unsigned int vo1; /* Vertex offset variable */ - unsigned int we2; /* Weighting value variable */ - unsigned int vo2; /* Vertex offset variable */ - unsigned int we3; /* Weighting value variable */ - unsigned int vo3; /* Vertex offset variable */ - unsigned int we4; /* Weighting value variable */ - unsigned int vo4; /* Vertex offset variable */ - unsigned int we5; /* Weighting value variable */ - unsigned int vo5; /* Vertex offset variable */ - unsigned int we6; /* Weighting value variable */ - unsigned int vo6; /* Vertex offset variable */ - { - unsigned int ti_i; /* Interpolation index variable */ - - ti_i = IT_IX(it0, ip0[0]); - we0 = IT_WE(it0, ip0[0]); - vo0 = IT_VO(it0, ip0[0]); - ti_i += IT_IX(it1, ip0[1]); - we1 = IT_WE(it1, ip0[1]); - vo1 = IT_VO(it1, ip0[1]); - ti_i += IT_IX(it2, ip0[2]); - we2 = IT_WE(it2, ip0[2]); - vo2 = IT_VO(it2, ip0[2]); - ti_i += IT_IX(it3, ip0[3]); - we3 = IT_WE(it3, ip0[3]); - vo3 = IT_VO(it3, ip0[3]); - ti_i += IT_IX(it4, ip0[4]); - we4 = IT_WE(it4, ip0[4]); - vo4 = IT_VO(it4, ip0[4]); - ti_i += IT_IX(it5, ip0[5]); - we5 = IT_WE(it5, ip0[5]); - vo5 = IT_VO(it5, ip0[5]); - ti_i += IT_IX(it6, ip0[6]); - we6 = IT_WE(it6, ip0[6]); - vo6 = IT_VO(it6, ip0[6]); - - imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */ - - /* Sort weighting values and vertex offset values */ - CEX(we0, vo0, we1, vo1); - CEX(we0, vo0, we2, vo2); - CEX(we0, vo0, we3, vo3); - CEX(we0, vo0, we4, vo4); - CEX(we0, vo0, we5, vo5); - CEX(we0, vo0, we6, vo6); - CEX(we1, vo1, we2, vo2); - CEX(we1, vo1, we3, vo3); - CEX(we1, vo1, we4, vo4); - CEX(we1, vo1, we5, vo5); - CEX(we1, vo1, we6, vo6); - CEX(we2, vo2, we3, vo3); - CEX(we2, vo2, we4, vo4); - CEX(we2, vo2, we5, vo5); - CEX(we2, vo2, we6, vo6); - CEX(we3, vo3, we4, vo4); - CEX(we3, vo3, we5, vo5); - CEX(we3, vo3, we6, vo6); - CEX(we4, vo4, we5, vo5); - CEX(we4, vo4, we6, vo6); - CEX(we5, vo5, we6, vo6); - } - { - unsigned int vof; /* Vertex offset value */ - unsigned int vwe; /* Vertex weighting */ - - vof = 0; /* First vertex offset is 0 */ - vwe = 65536 - we0; /* Baricentric weighting */ - ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - vof += vo0; /* Move to next vertex */ - vwe = we0 - we1; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - vof += vo1; /* Move to next vertex */ - vwe = we1 - we2; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - vof += vo2; /* Move to next vertex */ - vwe = we2 - we3; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - vof += vo3; /* Move to next vertex */ - vwe = we3 - we4; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - vof += vo4; /* Move to next vertex */ - vwe = we4 - we5; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - vof += vo5; /* Move to next vertex */ - vwe = we5 - we6; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - vof += vo6; /* Move to next vertex */ - vwe = we6; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - } - } - { - unsigned int oti; /* Vertex offset value */ - oti = ((ova0 >> 16) & 0xffff); /* Extract integer part of result */ - op0[0] = OT_E(ot0, oti); /* Write result */ - oti = ((ova1 >> 16) & 0xffff); /* Extract integer part of result */ - op0[1] = OT_E(ot1, oti); /* Write result */ - oti = ((ova2 >> 16) & 0xffff); /* Extract integer part of result */ - op0[2] = OT_E(ot2, oti); /* Write result */ - } - } -} -#undef IT_WE -#undef IT_VO -#undef IT_IX -#undef CEX -#undef IM_O -#undef IM_FE -#undef OT_E - -static void -imdi_k111_gen( -genspec *g /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x10, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x17, 0x00, 0x00, 0x00, 0x00, 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, 0x04, 0x08, - 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08, - 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7, - 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7, - 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08, - 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00, - 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7, - 0x2c, 0xf3, 0xdc, 0xb7, 0x37, 0x5f, 0x33, 0x5f, - 0x69, 0x31, 0x36, 0x5f, 0x69, 0x31, 0x36, 0x5f, - 0x66, 0x00, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00, - 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf, - 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08, - 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf, - 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x31, - 0x31, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01, - 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7, - 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7, - 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08, - 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08, - 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf, - 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7, - 0x00, 0xf0, 0x04, 0x08 - }; /* Structure image */ - - memcpy(g, data, sizeof(data)); /* Initialise the structure */ -} - -static void -imdi_k111_tab( -tabspec *t /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf, - 0xff, 0xff, 0xff, 0x33, 0x00, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xf4, 0xd5, 0x83, 0xbf, 0x52, 0xca, 0x04, 0x08, - 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0x22, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff, - 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff - }; /* Structure image */ - - memcpy(t, data, sizeof(data)); /* Initialise the structure */ -} - -/* 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 = 8 - Input channel 0 bits = 16 - Input channel 0 increment = 8 - Input channel 1 bits = 16 - Input channel 1 increment = 8 - Input channel 2 bits = 16 - Input channel 2 increment = 8 - Input channel 3 bits = 16 - Input channel 3 increment = 8 - Input channel 4 bits = 16 - Input channel 4 increment = 8 - Input channel 5 bits = 16 - Input channel 5 increment = 8 - Input channel 6 bits = 16 - Input channel 6 increment = 8 - Input channel 7 bits = 16 - Input channel 7 increment = 8 - Input is channel interleaved - Input channels are separate words - Input value extraction is done in input table lookup - - Output channels per pixel = 3 - Output channel 0 bits = 16 - Output channel 0 increment = 3 - Output channel 1 bits = 16 - Output channel 1 increment = 3 - Output channel 2 bits = 16 - Output channel 2 increment = 3 - Output is channel interleaved - - Output channels are separate words - Weight+voffset bits = 32 - Interpolation table index bits = 32 - Interpolation table max resolution = 16 - */ - -/* - 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 <memory.h> -#include "imdi_imp.h" -#define IMDI_INCLUDED -#endif /* IMDI_INCLUDED */ - -#ifndef DEFINED_pointer -#define DEFINED_pointer -typedef unsigned char * pointer; -#endif - -/* Input table interp. index */ -#define IT_IX(p, off) *((unsigned int *)((p) + 0 + (off) * 12)) - -/* Input table input weighting enty */ -#define IT_WE(p, off) *((unsigned int *)((p) + 4 + (off) * 12)) - -/* Input table input offset value enty */ -#define IT_VO(p, off) *((unsigned int *)((p) + 8 + (off) * 12)) - -/* Conditional exchange for sorting */ -#define CEX(A, AA, B, BB) if (A < B) { \ - A ^= B; B ^= A; A ^= B; AA ^= BB; BB ^= AA; AA ^= BB; } - -/* Interpolation multi-dim. table access */ -#define IM_O(off) ((off) * 6) - -/* Interpolation table - get vertex values */ -#define IM_FE(p, v, c) ((unsigned int)*((unsigned short *)((p) + (v) * 2 + (c) * 2))) - -/* Output table indexes */ -#define OT_E(p, off) *((unsigned short *)((p) + (off) * 2)) - -static void -imdi_k112( -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 short *ip0 = (unsigned short *)inp[0]; - unsigned short *op0 = (unsigned short *)outp[0]; - unsigned short *ep = ip0 + npix * 8 ; - pointer it0 = (pointer)p->in_tables[0]; - pointer it1 = (pointer)p->in_tables[1]; - pointer it2 = (pointer)p->in_tables[2]; - pointer it3 = (pointer)p->in_tables[3]; - pointer it4 = (pointer)p->in_tables[4]; - pointer it5 = (pointer)p->in_tables[5]; - pointer it6 = (pointer)p->in_tables[6]; - pointer it7 = (pointer)p->in_tables[7]; - pointer ot0 = (pointer)p->out_tables[0]; - pointer ot1 = (pointer)p->out_tables[1]; - pointer ot2 = (pointer)p->out_tables[2]; - pointer im_base = (pointer)p->im_table; - - for(;ip0 < ep; ip0 += 8, op0 += 3) { - unsigned int ova0; /* Output value accumulator */ - unsigned int ova1; /* Output value accumulator */ - unsigned int ova2; /* Output value accumulator */ - { - pointer imp; - unsigned int we0; /* Weighting value variable */ - unsigned int vo0; /* Vertex offset variable */ - unsigned int we1; /* Weighting value variable */ - unsigned int vo1; /* Vertex offset variable */ - unsigned int we2; /* Weighting value variable */ - unsigned int vo2; /* Vertex offset variable */ - unsigned int we3; /* Weighting value variable */ - unsigned int vo3; /* Vertex offset variable */ - unsigned int we4; /* Weighting value variable */ - unsigned int vo4; /* Vertex offset variable */ - unsigned int we5; /* Weighting value variable */ - unsigned int vo5; /* Vertex offset variable */ - unsigned int we6; /* Weighting value variable */ - unsigned int vo6; /* Vertex offset variable */ - unsigned int we7; /* Weighting value variable */ - unsigned int vo7; /* Vertex offset variable */ - { - unsigned int ti_i; /* Interpolation index variable */ - - ti_i = IT_IX(it0, ip0[0]); - we0 = IT_WE(it0, ip0[0]); - vo0 = IT_VO(it0, ip0[0]); - ti_i += IT_IX(it1, ip0[1]); - we1 = IT_WE(it1, ip0[1]); - vo1 = IT_VO(it1, ip0[1]); - ti_i += IT_IX(it2, ip0[2]); - we2 = IT_WE(it2, ip0[2]); - vo2 = IT_VO(it2, ip0[2]); - ti_i += IT_IX(it3, ip0[3]); - we3 = IT_WE(it3, ip0[3]); - vo3 = IT_VO(it3, ip0[3]); - ti_i += IT_IX(it4, ip0[4]); - we4 = IT_WE(it4, ip0[4]); - vo4 = IT_VO(it4, ip0[4]); - ti_i += IT_IX(it5, ip0[5]); - we5 = IT_WE(it5, ip0[5]); - vo5 = IT_VO(it5, ip0[5]); - ti_i += IT_IX(it6, ip0[6]); - we6 = IT_WE(it6, ip0[6]); - vo6 = IT_VO(it6, ip0[6]); - ti_i += IT_IX(it7, ip0[7]); - we7 = IT_WE(it7, ip0[7]); - vo7 = IT_VO(it7, ip0[7]); - - imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */ - - /* Sort weighting values and vertex offset values */ - CEX(we0, vo0, we1, vo1); - CEX(we0, vo0, we2, vo2); - CEX(we0, vo0, we3, vo3); - CEX(we0, vo0, we4, vo4); - CEX(we0, vo0, we5, vo5); - CEX(we0, vo0, we6, vo6); - CEX(we0, vo0, we7, vo7); - CEX(we1, vo1, we2, vo2); - CEX(we1, vo1, we3, vo3); - CEX(we1, vo1, we4, vo4); - CEX(we1, vo1, we5, vo5); - CEX(we1, vo1, we6, vo6); - CEX(we1, vo1, we7, vo7); - CEX(we2, vo2, we3, vo3); - CEX(we2, vo2, we4, vo4); - CEX(we2, vo2, we5, vo5); - CEX(we2, vo2, we6, vo6); - CEX(we2, vo2, we7, vo7); - CEX(we3, vo3, we4, vo4); - CEX(we3, vo3, we5, vo5); - CEX(we3, vo3, we6, vo6); - CEX(we3, vo3, we7, vo7); - CEX(we4, vo4, we5, vo5); - CEX(we4, vo4, we6, vo6); - CEX(we4, vo4, we7, vo7); - CEX(we5, vo5, we6, vo6); - CEX(we5, vo5, we7, vo7); - CEX(we6, vo6, we7, vo7); - } - { - unsigned int vof; /* Vertex offset value */ - unsigned int vwe; /* Vertex weighting */ - - vof = 0; /* First vertex offset is 0 */ - vwe = 65536 - we0; /* Baricentric weighting */ - ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - vof += vo0; /* Move to next vertex */ - vwe = we0 - we1; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - vof += vo1; /* Move to next vertex */ - vwe = we1 - we2; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - vof += vo2; /* Move to next vertex */ - vwe = we2 - we3; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - vof += vo3; /* Move to next vertex */ - vwe = we3 - we4; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - vof += vo4; /* Move to next vertex */ - vwe = we4 - we5; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - vof += vo5; /* Move to next vertex */ - vwe = we5 - we6; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - vof += vo6; /* Move to next vertex */ - vwe = we6 - we7; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - vof += vo7; /* Move to next vertex */ - vwe = we7; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - } - } - { - unsigned int oti; /* Vertex offset value */ - oti = ((ova0 >> 16) & 0xffff); /* Extract integer part of result */ - op0[0] = OT_E(ot0, oti); /* Write result */ - oti = ((ova1 >> 16) & 0xffff); /* Extract integer part of result */ - op0[1] = OT_E(ot1, oti); /* Write result */ - oti = ((ova2 >> 16) & 0xffff); /* Extract integer part of result */ - op0[2] = OT_E(ot2, oti); /* Write result */ - } - } -} -#undef IT_WE -#undef IT_VO -#undef IT_IX -#undef CEX -#undef IM_O -#undef IM_FE -#undef OT_E - -static void -imdi_k112_gen( -genspec *g /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x00, 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, 0x04, 0x08, - 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08, - 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7, - 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7, - 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08, - 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00, - 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7, - 0x2c, 0xf3, 0xdc, 0xb7, 0x38, 0x5f, 0x33, 0x5f, - 0x69, 0x31, 0x36, 0x5f, 0x69, 0x31, 0x36, 0x5f, - 0x66, 0x00, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00, - 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf, - 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08, - 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf, - 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x31, - 0x32, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01, - 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7, - 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7, - 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08, - 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08, - 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf, - 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7, - 0x00, 0xf0, 0x04, 0x08 - }; /* Structure image */ - - memcpy(g, data, sizeof(data)); /* Initialise the structure */ -} - -static void -imdi_k112_tab( -tabspec *t /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf, - 0xff, 0xff, 0xff, 0x33, 0x00, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xf4, 0xd5, 0x83, 0xbf, 0x52, 0xca, 0x04, 0x08, - 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0x22, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff, - 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff - }; /* Structure image */ - - memcpy(t, data, sizeof(data)); /* Initialise the structure */ -} - -/* 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 = 16 - 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 = 4 - Output channel 0 bits = 16 - Output channel 0 increment = 4 - Output channel 1 bits = 16 - Output channel 1 increment = 4 - Output channel 2 bits = 16 - Output channel 2 increment = 4 - Output channel 3 bits = 16 - Output channel 3 increment = 4 - Output is channel interleaved - - Output channels are separate words - Weight+voffset bits = 32 - Interpolation table index bits = 12 - Interpolation table max resolution = 4095 - */ - -/* - 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 <memory.h> -#include "imdi_imp.h" -#define IMDI_INCLUDED -#endif /* IMDI_INCLUDED */ - -#ifndef DEFINED_pointer -#define DEFINED_pointer -typedef unsigned char * pointer; -#endif - -/* Input table interp index, weighting and vertex offset */ -#define IT_IT(p, off) *((unsigned int *)((p) + 0 + (off) * 4)) - -/* Conditional exchange for sorting */ -#define CEX(A, B) if (A < B) { A ^= B; B ^= A; A ^= B; } - -/* Interpolation multi-dim. table access */ -#define IM_O(off) ((off) * 8) - -/* Interpolation table - get vertex values */ -#define IM_FE(p, v, c) ((unsigned int)*((unsigned short *)((p) + (v) * 8 + (c) * 2))) - -/* Output table indexes */ -#define OT_E(p, off) *((unsigned short *)((p) + (off) * 2)) - -static void -imdi_k113( -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 short *ip0 = (unsigned short *)inp[0]; - unsigned short *op0 = (unsigned short *)outp[0]; - unsigned short *ep = ip0 + npix * 1 ; - pointer it0 = (pointer)p->in_tables[0]; - pointer ot0 = (pointer)p->out_tables[0]; - pointer ot1 = (pointer)p->out_tables[1]; - pointer ot2 = (pointer)p->out_tables[2]; - pointer ot3 = (pointer)p->out_tables[3]; - pointer im_base = (pointer)p->im_table; - - for(;ip0 < ep; ip0 += 1, op0 += 4) { - unsigned int ova0; /* Output value accumulator */ - unsigned int ova1; /* Output value accumulator */ - unsigned int ova2; /* Output value accumulator */ - unsigned int ova3; /* Output value accumulator */ - { - pointer imp; - unsigned int wo0; /* Weighting value and vertex offset variable */ - { - unsigned int ti; /* Input table entry variable */ - unsigned int ti_i; /* Interpolation index variable */ - - ti = IT_IT(it0, ip0[0]); - wo0 = (ti & 0xfffff); /* Extract weighting/vertex offset value */ - ti_i = (ti >> 20); /* Extract interpolation table value */ - - imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */ - - /* Sort weighting values and vertex offset values */ - } - { - unsigned int nvof; /* Next vertex offset value */ - unsigned int vof; /* Vertex offset value */ - unsigned int vwe; /* Vertex weighting */ - - vof = 0; /* First vertex offset is 0 */ - nvof = (wo0 & 0x7); /* Extract offset value */ - wo0 = (wo0 >> 3); /* Extract weighting value */ - vwe = 65536 - wo0; /* Baricentric weighting */ - ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 = IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - vwe = wo0; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - } - } - { - unsigned int oti; /* Vertex offset value */ - oti = ((ova0 >> 16) & 0xffff); /* Extract integer part of result */ - op0[0] = OT_E(ot0, oti); /* Write result */ - oti = ((ova1 >> 16) & 0xffff); /* Extract integer part of result */ - op0[1] = OT_E(ot1, oti); /* Write result */ - oti = ((ova2 >> 16) & 0xffff); /* Extract integer part of result */ - op0[2] = OT_E(ot2, oti); /* Write result */ - oti = ((ova3 >> 16) & 0xffff); /* Extract integer part of result */ - op0[3] = OT_E(ot3, oti); /* Write result */ - } - } -} -#undef IT_IT -#undef CEX -#undef IM_O -#undef IM_FE -#undef OT_E - -static void -imdi_k113_gen( -genspec *g /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0xff, 0x0f, 0x00, 0x00, 0x00, 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, 0x04, 0x08, - 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08, - 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7, - 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7, - 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08, - 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00, - 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7, - 0x2c, 0xf3, 0xdc, 0xb7, 0x31, 0x5f, 0x34, 0x5f, - 0x69, 0x31, 0x36, 0x5f, 0x69, 0x31, 0x36, 0x5f, - 0x66, 0x00, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00, - 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf, - 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08, - 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf, - 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x31, - 0x33, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01, - 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7, - 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7, - 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08, - 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08, - 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf, - 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7, - 0x00, 0xf0, 0x04, 0x08 - }; /* Structure image */ - - memcpy(g, data, sizeof(data)); /* Initialise the structure */ -} - -static void -imdi_k113_tab( -tabspec *t /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x0c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x14, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x11, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0x34, 0x00, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x52, 0xca, 0x04, 0x08, - 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf, - 0x22, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff, - 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff - }; /* Structure image */ - - memcpy(t, data, sizeof(data)); /* Initialise the structure */ -} - -/* 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 = 3 - Input channel 0 bits = 16 - Input channel 0 increment = 3 - Input channel 1 bits = 16 - Input channel 1 increment = 3 - Input channel 2 bits = 16 - Input channel 2 increment = 3 - Input is channel interleaved - Input channels are separate words - Input value extraction is done in input table lookup - - Output channels per pixel = 4 - Output channel 0 bits = 16 - Output channel 0 increment = 4 - Output channel 1 bits = 16 - Output channel 1 increment = 4 - Output channel 2 bits = 16 - Output channel 2 increment = 4 - Output channel 3 bits = 16 - Output channel 3 increment = 4 - Output is channel interleaved - - Output channels are separate words - Weight+voffset bits = 32 - Interpolation table index bits = 16 - Interpolation table max resolution = 40 - */ - -/* - 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 <memory.h> -#include "imdi_imp.h" -#define IMDI_INCLUDED -#endif /* IMDI_INCLUDED */ - -#ifndef DEFINED_pointer -#define DEFINED_pointer -typedef unsigned char * pointer; -#endif - -/* Input table interp. index */ -#define IT_IX(p, off) *((unsigned short *)((p) + 0 + (off) * 6)) - -/* Input table input weighting/offset value enty */ -#define IT_WO(p, off) *((unsigned int *)((p) + 2 + (off) * 6)) - -/* Conditional exchange for sorting */ -#define CEX(A, B) if (A < B) { A ^= B; B ^= A; A ^= B; } - -/* Interpolation multi-dim. table access */ -#define IM_O(off) ((off) * 8) - -/* Interpolation table - get vertex values */ -#define IM_FE(p, v, c) ((unsigned int)*((unsigned short *)((p) + (v) * 8 + (c) * 2))) - -/* Output table indexes */ -#define OT_E(p, off) *((unsigned short *)((p) + (off) * 2)) - -static void -imdi_k114( -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 short *ip0 = (unsigned short *)inp[0]; - unsigned short *op0 = (unsigned short *)outp[0]; - unsigned short *ep = ip0 + npix * 3 ; - pointer it0 = (pointer)p->in_tables[0]; - pointer it1 = (pointer)p->in_tables[1]; - pointer it2 = (pointer)p->in_tables[2]; - pointer ot0 = (pointer)p->out_tables[0]; - pointer ot1 = (pointer)p->out_tables[1]; - pointer ot2 = (pointer)p->out_tables[2]; - pointer ot3 = (pointer)p->out_tables[3]; - pointer im_base = (pointer)p->im_table; - - for(;ip0 < ep; ip0 += 3, op0 += 4) { - unsigned int ova0; /* Output value accumulator */ - unsigned int ova1; /* Output value accumulator */ - unsigned int ova2; /* Output value accumulator */ - unsigned int ova3; /* Output value accumulator */ - { - pointer imp; - unsigned int wo0; /* Weighting value and vertex offset variable */ - unsigned int wo1; /* Weighting value and vertex offset variable */ - unsigned int wo2; /* Weighting value and vertex offset variable */ - { - unsigned int ti_i; /* Interpolation index variable */ - - ti_i = IT_IX(it0, ip0[0]); - wo0 = IT_WO(it0, ip0[0]); - ti_i += IT_IX(it1, ip0[1]); - wo1 = IT_WO(it1, ip0[1]); - ti_i += IT_IX(it2, ip0[2]); - wo2 = IT_WO(it2, ip0[2]); - - imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */ - - /* Sort weighting values and vertex offset values */ - CEX(wo0, wo1); - CEX(wo0, wo2); - CEX(wo1, wo2); - } - { - unsigned int nvof; /* Next vertex offset value */ - unsigned int vof; /* Vertex offset value */ - unsigned int vwe; /* Vertex weighting */ - - vof = 0; /* First vertex offset is 0 */ - nvof = (wo0 & 0x7fff); /* Extract offset value */ - wo0 = (wo0 >> 15); /* Extract weighting value */ - vwe = 65536 - wo0; /* Baricentric weighting */ - ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 = IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo1 & 0x7fff); /* Extract offset value */ - wo1 = (wo1 >> 15); /* Extract weighting value */ - vwe = wo0 - wo1; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo2 & 0x7fff); /* Extract offset value */ - wo2 = (wo2 >> 15); /* Extract weighting value */ - vwe = wo1 - wo2; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - vwe = wo2; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - } - } - { - unsigned int oti; /* Vertex offset value */ - oti = ((ova0 >> 16) & 0xffff); /* Extract integer part of result */ - op0[0] = OT_E(ot0, oti); /* Write result */ - oti = ((ova1 >> 16) & 0xffff); /* Extract integer part of result */ - op0[1] = OT_E(ot1, oti); /* Write result */ - oti = ((ova2 >> 16) & 0xffff); /* Extract integer part of result */ - op0[2] = OT_E(ot2, oti); /* Write result */ - oti = ((ova3 >> 16) & 0xffff); /* Extract integer part of result */ - op0[3] = OT_E(ot3, oti); /* Write result */ - } - } -} -#undef IT_WO -#undef IT_IX -#undef CEX -#undef IM_O -#undef IM_FE -#undef OT_E - -static void -imdi_k114_gen( -genspec *g /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x10, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x28, 0x00, 0x00, 0x00, 0x00, 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, 0x04, 0x08, - 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08, - 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7, - 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7, - 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08, - 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00, - 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7, - 0x2c, 0xf3, 0xdc, 0xb7, 0x33, 0x5f, 0x34, 0x5f, - 0x69, 0x31, 0x36, 0x5f, 0x69, 0x31, 0x36, 0x5f, - 0x66, 0x00, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00, - 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf, - 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08, - 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf, - 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x31, - 0x34, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01, - 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7, - 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7, - 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08, - 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08, - 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf, - 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7, - 0x00, 0xf0, 0x04, 0x08 - }; /* Structure image */ - - memcpy(g, data, sizeof(data)); /* Initialise the structure */ -} - -static void -imdi_k114_tab( -tabspec *t /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x11, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0x34, 0x00, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x52, 0xca, 0x04, 0x08, - 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf, - 0x22, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff, - 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff - }; /* Structure image */ - - memcpy(t, data, sizeof(data)); /* Initialise the structure */ -} - -/* 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 = 4 - Input channel 0 bits = 16 - Input channel 0 increment = 4 - Input channel 1 bits = 16 - Input channel 1 increment = 4 - Input channel 2 bits = 16 - Input channel 2 increment = 4 - Input channel 3 bits = 16 - Input channel 3 increment = 4 - Input is channel interleaved - Input channels are separate words - Input value extraction is done in input table lookup - - Output channels per pixel = 4 - Output channel 0 bits = 16 - Output channel 0 increment = 4 - Output channel 1 bits = 16 - Output channel 1 increment = 4 - Output channel 2 bits = 16 - Output channel 2 increment = 4 - Output channel 3 bits = 16 - Output channel 3 increment = 4 - Output is channel interleaved - - Output channels are separate words - Weight+voffset bits = 32 - Interpolation table index bits = 32 - Interpolation table max resolution = 31 - */ - -/* - 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 <memory.h> -#include "imdi_imp.h" -#define IMDI_INCLUDED -#endif /* IMDI_INCLUDED */ - -#ifndef DEFINED_pointer -#define DEFINED_pointer -typedef unsigned char * pointer; -#endif - -/* Input table interp. index */ -#define IT_IX(p, off) *((unsigned int *)((p) + 0 + (off) * 8)) - -/* Input table input weighting/offset value enty */ -#define IT_WO(p, off) *((unsigned int *)((p) + 4 + (off) * 8)) - -/* Conditional exchange for sorting */ -#define CEX(A, B) if (A < B) { A ^= B; B ^= A; A ^= B; } - -/* Interpolation multi-dim. table access */ -#define IM_O(off) ((off) * 8) - -/* Interpolation table - get vertex values */ -#define IM_FE(p, v, c) ((unsigned int)*((unsigned short *)((p) + (v) * 8 + (c) * 2))) - -/* Output table indexes */ -#define OT_E(p, off) *((unsigned short *)((p) + (off) * 2)) - -static void -imdi_k115( -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 short *ip0 = (unsigned short *)inp[0]; - unsigned short *op0 = (unsigned short *)outp[0]; - unsigned short *ep = ip0 + npix * 4 ; - pointer it0 = (pointer)p->in_tables[0]; - pointer it1 = (pointer)p->in_tables[1]; - pointer it2 = (pointer)p->in_tables[2]; - pointer it3 = (pointer)p->in_tables[3]; - pointer ot0 = (pointer)p->out_tables[0]; - pointer ot1 = (pointer)p->out_tables[1]; - pointer ot2 = (pointer)p->out_tables[2]; - pointer ot3 = (pointer)p->out_tables[3]; - pointer im_base = (pointer)p->im_table; - - for(;ip0 < ep; ip0 += 4, op0 += 4) { - unsigned int ova0; /* Output value accumulator */ - unsigned int ova1; /* Output value accumulator */ - unsigned int ova2; /* Output value accumulator */ - unsigned int ova3; /* Output value accumulator */ - { - pointer imp; - unsigned int wo0; /* Weighting value and vertex offset variable */ - unsigned int wo1; /* Weighting value and vertex offset variable */ - unsigned int wo2; /* Weighting value and vertex offset variable */ - unsigned int wo3; /* Weighting value and vertex offset variable */ - { - unsigned int ti_i; /* Interpolation index variable */ - - ti_i = IT_IX(it0, ip0[0]); - wo0 = IT_WO(it0, ip0[0]); - ti_i += IT_IX(it1, ip0[1]); - wo1 = IT_WO(it1, ip0[1]); - ti_i += IT_IX(it2, ip0[2]); - wo2 = IT_WO(it2, ip0[2]); - ti_i += IT_IX(it3, ip0[3]); - wo3 = IT_WO(it3, ip0[3]); - - imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */ - - /* Sort weighting values and vertex offset values */ - CEX(wo0, wo1); - CEX(wo0, wo2); - CEX(wo0, wo3); - CEX(wo1, wo2); - CEX(wo1, wo3); - CEX(wo2, wo3); - } - { - unsigned int nvof; /* Next vertex offset value */ - unsigned int vof; /* Vertex offset value */ - unsigned int vwe; /* Vertex weighting */ - - vof = 0; /* First vertex offset is 0 */ - nvof = (wo0 & 0x7fff); /* Extract offset value */ - wo0 = (wo0 >> 15); /* Extract weighting value */ - vwe = 65536 - wo0; /* Baricentric weighting */ - ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 = IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo1 & 0x7fff); /* Extract offset value */ - wo1 = (wo1 >> 15); /* Extract weighting value */ - vwe = wo0 - wo1; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo2 & 0x7fff); /* Extract offset value */ - wo2 = (wo2 >> 15); /* Extract weighting value */ - vwe = wo1 - wo2; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo3 & 0x7fff); /* Extract offset value */ - wo3 = (wo3 >> 15); /* Extract weighting value */ - vwe = wo2 - wo3; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - vwe = wo3; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - } - } - { - unsigned int oti; /* Vertex offset value */ - oti = ((ova0 >> 16) & 0xffff); /* Extract integer part of result */ - op0[0] = OT_E(ot0, oti); /* Write result */ - oti = ((ova1 >> 16) & 0xffff); /* Extract integer part of result */ - op0[1] = OT_E(ot1, oti); /* Write result */ - oti = ((ova2 >> 16) & 0xffff); /* Extract integer part of result */ - op0[2] = OT_E(ot2, oti); /* Write result */ - oti = ((ova3 >> 16) & 0xffff); /* Extract integer part of result */ - op0[3] = OT_E(ot3, oti); /* Write result */ - } - } -} -#undef IT_WO -#undef IT_IX -#undef CEX -#undef IM_O -#undef IM_FE -#undef OT_E - -static void -imdi_k115_gen( -genspec *g /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x10, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x1f, 0x00, 0x00, 0x00, 0x00, 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, 0x04, 0x08, - 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08, - 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7, - 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7, - 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08, - 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00, - 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7, - 0x2c, 0xf3, 0xdc, 0xb7, 0x34, 0x5f, 0x34, 0x5f, - 0x69, 0x31, 0x36, 0x5f, 0x69, 0x31, 0x36, 0x5f, - 0x66, 0x00, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00, - 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf, - 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08, - 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf, - 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x31, - 0x35, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01, - 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7, - 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7, - 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08, - 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08, - 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf, - 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7, - 0x00, 0xf0, 0x04, 0x08 - }; /* Structure image */ - - memcpy(g, data, sizeof(data)); /* Initialise the structure */ -} - -static void -imdi_k115_tab( -tabspec *t /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x11, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0x34, 0x00, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x52, 0xca, 0x04, 0x08, - 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf, - 0x22, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff, - 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff - }; /* Structure image */ - - memcpy(t, data, sizeof(data)); /* Initialise the structure */ -} - -/* 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 = 5 - Input channel 0 bits = 16 - Input channel 0 increment = 5 - Input channel 1 bits = 16 - Input channel 1 increment = 5 - Input channel 2 bits = 16 - Input channel 2 increment = 5 - Input channel 3 bits = 16 - Input channel 3 increment = 5 - Input channel 4 bits = 16 - Input channel 4 increment = 5 - Input is channel interleaved - Input channels are separate words - Input value extraction is done in input table lookup - - Output channels per pixel = 4 - Output channel 0 bits = 16 - Output channel 0 increment = 4 - Output channel 1 bits = 16 - Output channel 1 increment = 4 - Output channel 2 bits = 16 - Output channel 2 increment = 4 - Output channel 3 bits = 16 - Output channel 3 increment = 4 - Output is channel interleaved - - Output channels are separate words - Weight+voffset bits = 32 - Interpolation table index bits = 32 - Interpolation table max resolution = 84 - */ - -/* - 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 <memory.h> -#include "imdi_imp.h" -#define IMDI_INCLUDED -#endif /* IMDI_INCLUDED */ - -#ifndef DEFINED_pointer -#define DEFINED_pointer -typedef unsigned char * pointer; -#endif - -/* Input table interp. index */ -#define IT_IX(p, off) *((unsigned int *)((p) + 0 + (off) * 12)) - -/* Input table input weighting enty */ -#define IT_WE(p, off) *((unsigned int *)((p) + 4 + (off) * 12)) - -/* Input table input offset value enty */ -#define IT_VO(p, off) *((unsigned int *)((p) + 8 + (off) * 12)) - -/* Conditional exchange for sorting */ -#define CEX(A, AA, B, BB) if (A < B) { \ - A ^= B; B ^= A; A ^= B; AA ^= BB; BB ^= AA; AA ^= BB; } - -/* Interpolation multi-dim. table access */ -#define IM_O(off) ((off) * 8) - -/* Interpolation table - get vertex values */ -#define IM_FE(p, v, c) ((unsigned int)*((unsigned short *)((p) + (v) * 8 + (c) * 2))) - -/* Output table indexes */ -#define OT_E(p, off) *((unsigned short *)((p) + (off) * 2)) - -static void -imdi_k116( -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 short *ip0 = (unsigned short *)inp[0]; - unsigned short *op0 = (unsigned short *)outp[0]; - unsigned short *ep = ip0 + npix * 5 ; - pointer it0 = (pointer)p->in_tables[0]; - pointer it1 = (pointer)p->in_tables[1]; - pointer it2 = (pointer)p->in_tables[2]; - pointer it3 = (pointer)p->in_tables[3]; - pointer it4 = (pointer)p->in_tables[4]; - pointer ot0 = (pointer)p->out_tables[0]; - pointer ot1 = (pointer)p->out_tables[1]; - pointer ot2 = (pointer)p->out_tables[2]; - pointer ot3 = (pointer)p->out_tables[3]; - pointer im_base = (pointer)p->im_table; - - for(;ip0 < ep; ip0 += 5, op0 += 4) { - unsigned int ova0; /* Output value accumulator */ - unsigned int ova1; /* Output value accumulator */ - unsigned int ova2; /* Output value accumulator */ - unsigned int ova3; /* Output value accumulator */ - { - pointer imp; - unsigned int we0; /* Weighting value variable */ - unsigned int vo0; /* Vertex offset variable */ - unsigned int we1; /* Weighting value variable */ - unsigned int vo1; /* Vertex offset variable */ - unsigned int we2; /* Weighting value variable */ - unsigned int vo2; /* Vertex offset variable */ - unsigned int we3; /* Weighting value variable */ - unsigned int vo3; /* Vertex offset variable */ - unsigned int we4; /* Weighting value variable */ - unsigned int vo4; /* Vertex offset variable */ - { - unsigned int ti_i; /* Interpolation index variable */ - - ti_i = IT_IX(it0, ip0[0]); - we0 = IT_WE(it0, ip0[0]); - vo0 = IT_VO(it0, ip0[0]); - ti_i += IT_IX(it1, ip0[1]); - we1 = IT_WE(it1, ip0[1]); - vo1 = IT_VO(it1, ip0[1]); - ti_i += IT_IX(it2, ip0[2]); - we2 = IT_WE(it2, ip0[2]); - vo2 = IT_VO(it2, ip0[2]); - ti_i += IT_IX(it3, ip0[3]); - we3 = IT_WE(it3, ip0[3]); - vo3 = IT_VO(it3, ip0[3]); - ti_i += IT_IX(it4, ip0[4]); - we4 = IT_WE(it4, ip0[4]); - vo4 = IT_VO(it4, ip0[4]); - - imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */ - - /* Sort weighting values and vertex offset values */ - CEX(we0, vo0, we1, vo1); - CEX(we0, vo0, we2, vo2); - CEX(we0, vo0, we3, vo3); - CEX(we0, vo0, we4, vo4); - CEX(we1, vo1, we2, vo2); - CEX(we1, vo1, we3, vo3); - CEX(we1, vo1, we4, vo4); - CEX(we2, vo2, we3, vo3); - CEX(we2, vo2, we4, vo4); - CEX(we3, vo3, we4, vo4); - } - { - unsigned int vof; /* Vertex offset value */ - unsigned int vwe; /* Vertex weighting */ - - vof = 0; /* First vertex offset is 0 */ - vwe = 65536 - we0; /* Baricentric weighting */ - ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 = IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - vof += vo0; /* Move to next vertex */ - vwe = we0 - we1; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - vof += vo1; /* Move to next vertex */ - vwe = we1 - we2; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - vof += vo2; /* Move to next vertex */ - vwe = we2 - we3; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - vof += vo3; /* Move to next vertex */ - vwe = we3 - we4; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - vof += vo4; /* Move to next vertex */ - vwe = we4; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - } - } - { - unsigned int oti; /* Vertex offset value */ - oti = ((ova0 >> 16) & 0xffff); /* Extract integer part of result */ - op0[0] = OT_E(ot0, oti); /* Write result */ - oti = ((ova1 >> 16) & 0xffff); /* Extract integer part of result */ - op0[1] = OT_E(ot1, oti); /* Write result */ - oti = ((ova2 >> 16) & 0xffff); /* Extract integer part of result */ - op0[2] = OT_E(ot2, oti); /* Write result */ - oti = ((ova3 >> 16) & 0xffff); /* Extract integer part of result */ - op0[3] = OT_E(ot3, oti); /* Write result */ - } - } -} -#undef IT_WE -#undef IT_VO -#undef IT_IX -#undef CEX -#undef IM_O -#undef IM_FE -#undef OT_E - -static void -imdi_k116_gen( -genspec *g /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x10, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x54, 0x00, 0x00, 0x00, 0x00, 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, 0x04, 0x08, - 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08, - 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7, - 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7, - 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08, - 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00, - 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7, - 0x2c, 0xf3, 0xdc, 0xb7, 0x35, 0x5f, 0x34, 0x5f, - 0x69, 0x31, 0x36, 0x5f, 0x69, 0x31, 0x36, 0x5f, - 0x66, 0x00, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00, - 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf, - 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08, - 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf, - 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x31, - 0x36, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01, - 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7, - 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7, - 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08, - 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08, - 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf, - 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7, - 0x00, 0xf0, 0x04, 0x08 - }; /* Structure image */ - - memcpy(g, data, sizeof(data)); /* Initialise the structure */ -} - -static void -imdi_k116_tab( -tabspec *t /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0x34, 0x00, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x52, 0xca, 0x04, 0x08, - 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf, - 0x22, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff, - 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff - }; /* Structure image */ - - memcpy(t, data, sizeof(data)); /* Initialise the structure */ -} - -/* 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 = 6 - Input channel 0 bits = 16 - Input channel 0 increment = 6 - Input channel 1 bits = 16 - Input channel 1 increment = 6 - Input channel 2 bits = 16 - Input channel 2 increment = 6 - Input channel 3 bits = 16 - Input channel 3 increment = 6 - Input channel 4 bits = 16 - Input channel 4 increment = 6 - Input channel 5 bits = 16 - Input channel 5 increment = 6 - Input is channel interleaved - Input channels are separate words - Input value extraction is done in input table lookup - - Output channels per pixel = 4 - Output channel 0 bits = 16 - Output channel 0 increment = 4 - Output channel 1 bits = 16 - Output channel 1 increment = 4 - Output channel 2 bits = 16 - Output channel 2 increment = 4 - Output channel 3 bits = 16 - Output channel 3 increment = 4 - Output is channel interleaved - - Output channels are separate words - Weight+voffset bits = 32 - Interpolation table index bits = 32 - Interpolation table max resolution = 40 - */ - -/* - 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 <memory.h> -#include "imdi_imp.h" -#define IMDI_INCLUDED -#endif /* IMDI_INCLUDED */ - -#ifndef DEFINED_pointer -#define DEFINED_pointer -typedef unsigned char * pointer; -#endif - -/* Input table interp. index */ -#define IT_IX(p, off) *((unsigned int *)((p) + 0 + (off) * 12)) - -/* Input table input weighting enty */ -#define IT_WE(p, off) *((unsigned int *)((p) + 4 + (off) * 12)) - -/* Input table input offset value enty */ -#define IT_VO(p, off) *((unsigned int *)((p) + 8 + (off) * 12)) - -/* Conditional exchange for sorting */ -#define CEX(A, AA, B, BB) if (A < B) { \ - A ^= B; B ^= A; A ^= B; AA ^= BB; BB ^= AA; AA ^= BB; } - -/* Interpolation multi-dim. table access */ -#define IM_O(off) ((off) * 8) - -/* Interpolation table - get vertex values */ -#define IM_FE(p, v, c) ((unsigned int)*((unsigned short *)((p) + (v) * 8 + (c) * 2))) - -/* Output table indexes */ -#define OT_E(p, off) *((unsigned short *)((p) + (off) * 2)) - -static void -imdi_k117( -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 short *ip0 = (unsigned short *)inp[0]; - unsigned short *op0 = (unsigned short *)outp[0]; - unsigned short *ep = ip0 + npix * 6 ; - pointer it0 = (pointer)p->in_tables[0]; - pointer it1 = (pointer)p->in_tables[1]; - pointer it2 = (pointer)p->in_tables[2]; - pointer it3 = (pointer)p->in_tables[3]; - pointer it4 = (pointer)p->in_tables[4]; - pointer it5 = (pointer)p->in_tables[5]; - pointer ot0 = (pointer)p->out_tables[0]; - pointer ot1 = (pointer)p->out_tables[1]; - pointer ot2 = (pointer)p->out_tables[2]; - pointer ot3 = (pointer)p->out_tables[3]; - pointer im_base = (pointer)p->im_table; - - for(;ip0 < ep; ip0 += 6, op0 += 4) { - unsigned int ova0; /* Output value accumulator */ - unsigned int ova1; /* Output value accumulator */ - unsigned int ova2; /* Output value accumulator */ - unsigned int ova3; /* Output value accumulator */ - { - pointer imp; - unsigned int we0; /* Weighting value variable */ - unsigned int vo0; /* Vertex offset variable */ - unsigned int we1; /* Weighting value variable */ - unsigned int vo1; /* Vertex offset variable */ - unsigned int we2; /* Weighting value variable */ - unsigned int vo2; /* Vertex offset variable */ - unsigned int we3; /* Weighting value variable */ - unsigned int vo3; /* Vertex offset variable */ - unsigned int we4; /* Weighting value variable */ - unsigned int vo4; /* Vertex offset variable */ - unsigned int we5; /* Weighting value variable */ - unsigned int vo5; /* Vertex offset variable */ - { - unsigned int ti_i; /* Interpolation index variable */ - - ti_i = IT_IX(it0, ip0[0]); - we0 = IT_WE(it0, ip0[0]); - vo0 = IT_VO(it0, ip0[0]); - ti_i += IT_IX(it1, ip0[1]); - we1 = IT_WE(it1, ip0[1]); - vo1 = IT_VO(it1, ip0[1]); - ti_i += IT_IX(it2, ip0[2]); - we2 = IT_WE(it2, ip0[2]); - vo2 = IT_VO(it2, ip0[2]); - ti_i += IT_IX(it3, ip0[3]); - we3 = IT_WE(it3, ip0[3]); - vo3 = IT_VO(it3, ip0[3]); - ti_i += IT_IX(it4, ip0[4]); - we4 = IT_WE(it4, ip0[4]); - vo4 = IT_VO(it4, ip0[4]); - ti_i += IT_IX(it5, ip0[5]); - we5 = IT_WE(it5, ip0[5]); - vo5 = IT_VO(it5, ip0[5]); - - imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */ - - /* Sort weighting values and vertex offset values */ - CEX(we0, vo0, we1, vo1); - CEX(we0, vo0, we2, vo2); - CEX(we0, vo0, we3, vo3); - CEX(we0, vo0, we4, vo4); - CEX(we0, vo0, we5, vo5); - CEX(we1, vo1, we2, vo2); - CEX(we1, vo1, we3, vo3); - CEX(we1, vo1, we4, vo4); - CEX(we1, vo1, we5, vo5); - CEX(we2, vo2, we3, vo3); - CEX(we2, vo2, we4, vo4); - CEX(we2, vo2, we5, vo5); - CEX(we3, vo3, we4, vo4); - CEX(we3, vo3, we5, vo5); - CEX(we4, vo4, we5, vo5); - } - { - unsigned int vof; /* Vertex offset value */ - unsigned int vwe; /* Vertex weighting */ - - vof = 0; /* First vertex offset is 0 */ - vwe = 65536 - we0; /* Baricentric weighting */ - ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 = IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - vof += vo0; /* Move to next vertex */ - vwe = we0 - we1; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - vof += vo1; /* Move to next vertex */ - vwe = we1 - we2; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - vof += vo2; /* Move to next vertex */ - vwe = we2 - we3; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - vof += vo3; /* Move to next vertex */ - vwe = we3 - we4; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - vof += vo4; /* Move to next vertex */ - vwe = we4 - we5; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - vof += vo5; /* Move to next vertex */ - vwe = we5; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - } - } - { - unsigned int oti; /* Vertex offset value */ - oti = ((ova0 >> 16) & 0xffff); /* Extract integer part of result */ - op0[0] = OT_E(ot0, oti); /* Write result */ - oti = ((ova1 >> 16) & 0xffff); /* Extract integer part of result */ - op0[1] = OT_E(ot1, oti); /* Write result */ - oti = ((ova2 >> 16) & 0xffff); /* Extract integer part of result */ - op0[2] = OT_E(ot2, oti); /* Write result */ - oti = ((ova3 >> 16) & 0xffff); /* Extract integer part of result */ - op0[3] = OT_E(ot3, oti); /* Write result */ - } - } -} -#undef IT_WE -#undef IT_VO -#undef IT_IX -#undef CEX -#undef IM_O -#undef IM_FE -#undef OT_E - -static void -imdi_k117_gen( -genspec *g /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x10, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x28, 0x00, 0x00, 0x00, 0x00, 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, 0x04, 0x08, - 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08, - 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7, - 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7, - 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08, - 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00, - 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7, - 0x2c, 0xf3, 0xdc, 0xb7, 0x36, 0x5f, 0x34, 0x5f, - 0x69, 0x31, 0x36, 0x5f, 0x69, 0x31, 0x36, 0x5f, - 0x66, 0x00, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00, - 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf, - 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08, - 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf, - 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x31, - 0x37, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01, - 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7, - 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7, - 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08, - 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08, - 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf, - 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7, - 0x00, 0xf0, 0x04, 0x08 - }; /* Structure image */ - - memcpy(g, data, sizeof(data)); /* Initialise the structure */ -} - -static void -imdi_k117_tab( -tabspec *t /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0x34, 0x00, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x52, 0xca, 0x04, 0x08, - 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf, - 0x22, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff, - 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff - }; /* Structure image */ - - memcpy(t, data, sizeof(data)); /* Initialise the structure */ -} - -/* 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 = 7 - Input channel 0 bits = 16 - Input channel 0 increment = 7 - Input channel 1 bits = 16 - Input channel 1 increment = 7 - Input channel 2 bits = 16 - Input channel 2 increment = 7 - Input channel 3 bits = 16 - Input channel 3 increment = 7 - Input channel 4 bits = 16 - Input channel 4 increment = 7 - Input channel 5 bits = 16 - Input channel 5 increment = 7 - Input channel 6 bits = 16 - Input channel 6 increment = 7 - Input is channel interleaved - Input channels are separate words - Input value extraction is done in input table lookup - - Output channels per pixel = 4 - Output channel 0 bits = 16 - Output channel 0 increment = 4 - Output channel 1 bits = 16 - Output channel 1 increment = 4 - Output channel 2 bits = 16 - Output channel 2 increment = 4 - Output channel 3 bits = 16 - Output channel 3 increment = 4 - Output is channel interleaved - - Output channels are separate words - Weight+voffset bits = 32 - Interpolation table index bits = 32 - Interpolation table max resolution = 23 - */ - -/* - 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 <memory.h> -#include "imdi_imp.h" -#define IMDI_INCLUDED -#endif /* IMDI_INCLUDED */ - -#ifndef DEFINED_pointer -#define DEFINED_pointer -typedef unsigned char * pointer; -#endif - -/* Input table interp. index */ -#define IT_IX(p, off) *((unsigned int *)((p) + 0 + (off) * 12)) - -/* Input table input weighting enty */ -#define IT_WE(p, off) *((unsigned int *)((p) + 4 + (off) * 12)) - -/* Input table input offset value enty */ -#define IT_VO(p, off) *((unsigned int *)((p) + 8 + (off) * 12)) - -/* Conditional exchange for sorting */ -#define CEX(A, AA, B, BB) if (A < B) { \ - A ^= B; B ^= A; A ^= B; AA ^= BB; BB ^= AA; AA ^= BB; } - -/* Interpolation multi-dim. table access */ -#define IM_O(off) ((off) * 8) - -/* Interpolation table - get vertex values */ -#define IM_FE(p, v, c) ((unsigned int)*((unsigned short *)((p) + (v) * 8 + (c) * 2))) - -/* Output table indexes */ -#define OT_E(p, off) *((unsigned short *)((p) + (off) * 2)) - -static void -imdi_k118( -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 short *ip0 = (unsigned short *)inp[0]; - unsigned short *op0 = (unsigned short *)outp[0]; - unsigned short *ep = ip0 + npix * 7 ; - pointer it0 = (pointer)p->in_tables[0]; - pointer it1 = (pointer)p->in_tables[1]; - pointer it2 = (pointer)p->in_tables[2]; - pointer it3 = (pointer)p->in_tables[3]; - pointer it4 = (pointer)p->in_tables[4]; - pointer it5 = (pointer)p->in_tables[5]; - pointer it6 = (pointer)p->in_tables[6]; - pointer ot0 = (pointer)p->out_tables[0]; - pointer ot1 = (pointer)p->out_tables[1]; - pointer ot2 = (pointer)p->out_tables[2]; - pointer ot3 = (pointer)p->out_tables[3]; - pointer im_base = (pointer)p->im_table; - - for(;ip0 < ep; ip0 += 7, op0 += 4) { - unsigned int ova0; /* Output value accumulator */ - unsigned int ova1; /* Output value accumulator */ - unsigned int ova2; /* Output value accumulator */ - unsigned int ova3; /* Output value accumulator */ - { - pointer imp; - unsigned int we0; /* Weighting value variable */ - unsigned int vo0; /* Vertex offset variable */ - unsigned int we1; /* Weighting value variable */ - unsigned int vo1; /* Vertex offset variable */ - unsigned int we2; /* Weighting value variable */ - unsigned int vo2; /* Vertex offset variable */ - unsigned int we3; /* Weighting value variable */ - unsigned int vo3; /* Vertex offset variable */ - unsigned int we4; /* Weighting value variable */ - unsigned int vo4; /* Vertex offset variable */ - unsigned int we5; /* Weighting value variable */ - unsigned int vo5; /* Vertex offset variable */ - unsigned int we6; /* Weighting value variable */ - unsigned int vo6; /* Vertex offset variable */ - { - unsigned int ti_i; /* Interpolation index variable */ - - ti_i = IT_IX(it0, ip0[0]); - we0 = IT_WE(it0, ip0[0]); - vo0 = IT_VO(it0, ip0[0]); - ti_i += IT_IX(it1, ip0[1]); - we1 = IT_WE(it1, ip0[1]); - vo1 = IT_VO(it1, ip0[1]); - ti_i += IT_IX(it2, ip0[2]); - we2 = IT_WE(it2, ip0[2]); - vo2 = IT_VO(it2, ip0[2]); - ti_i += IT_IX(it3, ip0[3]); - we3 = IT_WE(it3, ip0[3]); - vo3 = IT_VO(it3, ip0[3]); - ti_i += IT_IX(it4, ip0[4]); - we4 = IT_WE(it4, ip0[4]); - vo4 = IT_VO(it4, ip0[4]); - ti_i += IT_IX(it5, ip0[5]); - we5 = IT_WE(it5, ip0[5]); - vo5 = IT_VO(it5, ip0[5]); - ti_i += IT_IX(it6, ip0[6]); - we6 = IT_WE(it6, ip0[6]); - vo6 = IT_VO(it6, ip0[6]); - - imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */ - - /* Sort weighting values and vertex offset values */ - CEX(we0, vo0, we1, vo1); - CEX(we0, vo0, we2, vo2); - CEX(we0, vo0, we3, vo3); - CEX(we0, vo0, we4, vo4); - CEX(we0, vo0, we5, vo5); - CEX(we0, vo0, we6, vo6); - CEX(we1, vo1, we2, vo2); - CEX(we1, vo1, we3, vo3); - CEX(we1, vo1, we4, vo4); - CEX(we1, vo1, we5, vo5); - CEX(we1, vo1, we6, vo6); - CEX(we2, vo2, we3, vo3); - CEX(we2, vo2, we4, vo4); - CEX(we2, vo2, we5, vo5); - CEX(we2, vo2, we6, vo6); - CEX(we3, vo3, we4, vo4); - CEX(we3, vo3, we5, vo5); - CEX(we3, vo3, we6, vo6); - CEX(we4, vo4, we5, vo5); - CEX(we4, vo4, we6, vo6); - CEX(we5, vo5, we6, vo6); - } - { - unsigned int vof; /* Vertex offset value */ - unsigned int vwe; /* Vertex weighting */ - - vof = 0; /* First vertex offset is 0 */ - vwe = 65536 - we0; /* Baricentric weighting */ - ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 = IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - vof += vo0; /* Move to next vertex */ - vwe = we0 - we1; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - vof += vo1; /* Move to next vertex */ - vwe = we1 - we2; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - vof += vo2; /* Move to next vertex */ - vwe = we2 - we3; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - vof += vo3; /* Move to next vertex */ - vwe = we3 - we4; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - vof += vo4; /* Move to next vertex */ - vwe = we4 - we5; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - vof += vo5; /* Move to next vertex */ - vwe = we5 - we6; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - vof += vo6; /* Move to next vertex */ - vwe = we6; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - } - } - { - unsigned int oti; /* Vertex offset value */ - oti = ((ova0 >> 16) & 0xffff); /* Extract integer part of result */ - op0[0] = OT_E(ot0, oti); /* Write result */ - oti = ((ova1 >> 16) & 0xffff); /* Extract integer part of result */ - op0[1] = OT_E(ot1, oti); /* Write result */ - oti = ((ova2 >> 16) & 0xffff); /* Extract integer part of result */ - op0[2] = OT_E(ot2, oti); /* Write result */ - oti = ((ova3 >> 16) & 0xffff); /* Extract integer part of result */ - op0[3] = OT_E(ot3, oti); /* Write result */ - } - } -} -#undef IT_WE -#undef IT_VO -#undef IT_IX -#undef CEX -#undef IM_O -#undef IM_FE -#undef OT_E - -static void -imdi_k118_gen( -genspec *g /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x10, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x17, 0x00, 0x00, 0x00, 0x00, 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, 0x04, 0x08, - 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08, - 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7, - 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7, - 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08, - 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00, - 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7, - 0x2c, 0xf3, 0xdc, 0xb7, 0x37, 0x5f, 0x34, 0x5f, - 0x69, 0x31, 0x36, 0x5f, 0x69, 0x31, 0x36, 0x5f, - 0x66, 0x00, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00, - 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf, - 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08, - 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf, - 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x31, - 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01, - 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7, - 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7, - 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08, - 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08, - 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf, - 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7, - 0x00, 0xf0, 0x04, 0x08 - }; /* Structure image */ - - memcpy(g, data, sizeof(data)); /* Initialise the structure */ -} - -static void -imdi_k118_tab( -tabspec *t /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0x34, 0x00, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x52, 0xca, 0x04, 0x08, - 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf, - 0x22, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff, - 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff - }; /* Structure image */ - - memcpy(t, data, sizeof(data)); /* Initialise the structure */ -} - -/* 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 = 8 - Input channel 0 bits = 16 - Input channel 0 increment = 8 - Input channel 1 bits = 16 - Input channel 1 increment = 8 - Input channel 2 bits = 16 - Input channel 2 increment = 8 - Input channel 3 bits = 16 - Input channel 3 increment = 8 - Input channel 4 bits = 16 - Input channel 4 increment = 8 - Input channel 5 bits = 16 - Input channel 5 increment = 8 - Input channel 6 bits = 16 - Input channel 6 increment = 8 - Input channel 7 bits = 16 - Input channel 7 increment = 8 - Input is channel interleaved - Input channels are separate words - Input value extraction is done in input table lookup - - Output channels per pixel = 4 - Output channel 0 bits = 16 - Output channel 0 increment = 4 - Output channel 1 bits = 16 - Output channel 1 increment = 4 - Output channel 2 bits = 16 - Output channel 2 increment = 4 - Output channel 3 bits = 16 - Output channel 3 increment = 4 - Output is channel interleaved - - Output channels are separate words - Weight+voffset bits = 32 - Interpolation table index bits = 32 - Interpolation table max resolution = 16 - */ - -/* - 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 <memory.h> -#include "imdi_imp.h" -#define IMDI_INCLUDED -#endif /* IMDI_INCLUDED */ - -#ifndef DEFINED_pointer -#define DEFINED_pointer -typedef unsigned char * pointer; -#endif - -/* Input table interp. index */ -#define IT_IX(p, off) *((unsigned int *)((p) + 0 + (off) * 12)) - -/* Input table input weighting enty */ -#define IT_WE(p, off) *((unsigned int *)((p) + 4 + (off) * 12)) - -/* Input table input offset value enty */ -#define IT_VO(p, off) *((unsigned int *)((p) + 8 + (off) * 12)) - -/* Conditional exchange for sorting */ -#define CEX(A, AA, B, BB) if (A < B) { \ - A ^= B; B ^= A; A ^= B; AA ^= BB; BB ^= AA; AA ^= BB; } - -/* Interpolation multi-dim. table access */ -#define IM_O(off) ((off) * 8) - -/* Interpolation table - get vertex values */ -#define IM_FE(p, v, c) ((unsigned int)*((unsigned short *)((p) + (v) * 8 + (c) * 2))) - -/* Output table indexes */ -#define OT_E(p, off) *((unsigned short *)((p) + (off) * 2)) - -static void -imdi_k119( -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 short *ip0 = (unsigned short *)inp[0]; - unsigned short *op0 = (unsigned short *)outp[0]; - unsigned short *ep = ip0 + npix * 8 ; - pointer it0 = (pointer)p->in_tables[0]; - pointer it1 = (pointer)p->in_tables[1]; - pointer it2 = (pointer)p->in_tables[2]; - pointer it3 = (pointer)p->in_tables[3]; - pointer it4 = (pointer)p->in_tables[4]; - pointer it5 = (pointer)p->in_tables[5]; - pointer it6 = (pointer)p->in_tables[6]; - pointer it7 = (pointer)p->in_tables[7]; - pointer ot0 = (pointer)p->out_tables[0]; - pointer ot1 = (pointer)p->out_tables[1]; - pointer ot2 = (pointer)p->out_tables[2]; - pointer ot3 = (pointer)p->out_tables[3]; - pointer im_base = (pointer)p->im_table; - - for(;ip0 < ep; ip0 += 8, op0 += 4) { - unsigned int ova0; /* Output value accumulator */ - unsigned int ova1; /* Output value accumulator */ - unsigned int ova2; /* Output value accumulator */ - unsigned int ova3; /* Output value accumulator */ - { - pointer imp; - unsigned int we0; /* Weighting value variable */ - unsigned int vo0; /* Vertex offset variable */ - unsigned int we1; /* Weighting value variable */ - unsigned int vo1; /* Vertex offset variable */ - unsigned int we2; /* Weighting value variable */ - unsigned int vo2; /* Vertex offset variable */ - unsigned int we3; /* Weighting value variable */ - unsigned int vo3; /* Vertex offset variable */ - unsigned int we4; /* Weighting value variable */ - unsigned int vo4; /* Vertex offset variable */ - unsigned int we5; /* Weighting value variable */ - unsigned int vo5; /* Vertex offset variable */ - unsigned int we6; /* Weighting value variable */ - unsigned int vo6; /* Vertex offset variable */ - unsigned int we7; /* Weighting value variable */ - unsigned int vo7; /* Vertex offset variable */ - { - unsigned int ti_i; /* Interpolation index variable */ - - ti_i = IT_IX(it0, ip0[0]); - we0 = IT_WE(it0, ip0[0]); - vo0 = IT_VO(it0, ip0[0]); - ti_i += IT_IX(it1, ip0[1]); - we1 = IT_WE(it1, ip0[1]); - vo1 = IT_VO(it1, ip0[1]); - ti_i += IT_IX(it2, ip0[2]); - we2 = IT_WE(it2, ip0[2]); - vo2 = IT_VO(it2, ip0[2]); - ti_i += IT_IX(it3, ip0[3]); - we3 = IT_WE(it3, ip0[3]); - vo3 = IT_VO(it3, ip0[3]); - ti_i += IT_IX(it4, ip0[4]); - we4 = IT_WE(it4, ip0[4]); - vo4 = IT_VO(it4, ip0[4]); - ti_i += IT_IX(it5, ip0[5]); - we5 = IT_WE(it5, ip0[5]); - vo5 = IT_VO(it5, ip0[5]); - ti_i += IT_IX(it6, ip0[6]); - we6 = IT_WE(it6, ip0[6]); - vo6 = IT_VO(it6, ip0[6]); - ti_i += IT_IX(it7, ip0[7]); - we7 = IT_WE(it7, ip0[7]); - vo7 = IT_VO(it7, ip0[7]); - - imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */ - - /* Sort weighting values and vertex offset values */ - CEX(we0, vo0, we1, vo1); - CEX(we0, vo0, we2, vo2); - CEX(we0, vo0, we3, vo3); - CEX(we0, vo0, we4, vo4); - CEX(we0, vo0, we5, vo5); - CEX(we0, vo0, we6, vo6); - CEX(we0, vo0, we7, vo7); - CEX(we1, vo1, we2, vo2); - CEX(we1, vo1, we3, vo3); - CEX(we1, vo1, we4, vo4); - CEX(we1, vo1, we5, vo5); - CEX(we1, vo1, we6, vo6); - CEX(we1, vo1, we7, vo7); - CEX(we2, vo2, we3, vo3); - CEX(we2, vo2, we4, vo4); - CEX(we2, vo2, we5, vo5); - CEX(we2, vo2, we6, vo6); - CEX(we2, vo2, we7, vo7); - CEX(we3, vo3, we4, vo4); - CEX(we3, vo3, we5, vo5); - CEX(we3, vo3, we6, vo6); - CEX(we3, vo3, we7, vo7); - CEX(we4, vo4, we5, vo5); - CEX(we4, vo4, we6, vo6); - CEX(we4, vo4, we7, vo7); - CEX(we5, vo5, we6, vo6); - CEX(we5, vo5, we7, vo7); - CEX(we6, vo6, we7, vo7); - } - { - unsigned int vof; /* Vertex offset value */ - unsigned int vwe; /* Vertex weighting */ - - vof = 0; /* First vertex offset is 0 */ - vwe = 65536 - we0; /* Baricentric weighting */ - ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 = IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - vof += vo0; /* Move to next vertex */ - vwe = we0 - we1; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - vof += vo1; /* Move to next vertex */ - vwe = we1 - we2; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - vof += vo2; /* Move to next vertex */ - vwe = we2 - we3; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - vof += vo3; /* Move to next vertex */ - vwe = we3 - we4; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - vof += vo4; /* Move to next vertex */ - vwe = we4 - we5; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - vof += vo5; /* Move to next vertex */ - vwe = we5 - we6; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - vof += vo6; /* Move to next vertex */ - vwe = we6 - we7; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - vof += vo7; /* Move to next vertex */ - vwe = we7; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - } - } - { - unsigned int oti; /* Vertex offset value */ - oti = ((ova0 >> 16) & 0xffff); /* Extract integer part of result */ - op0[0] = OT_E(ot0, oti); /* Write result */ - oti = ((ova1 >> 16) & 0xffff); /* Extract integer part of result */ - op0[1] = OT_E(ot1, oti); /* Write result */ - oti = ((ova2 >> 16) & 0xffff); /* Extract integer part of result */ - op0[2] = OT_E(ot2, oti); /* Write result */ - oti = ((ova3 >> 16) & 0xffff); /* Extract integer part of result */ - op0[3] = OT_E(ot3, oti); /* Write result */ - } - } -} -#undef IT_WE -#undef IT_VO -#undef IT_IX -#undef CEX -#undef IM_O -#undef IM_FE -#undef OT_E - -static void -imdi_k119_gen( -genspec *g /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x00, 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, 0x04, 0x08, - 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08, - 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7, - 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7, - 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08, - 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00, - 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7, - 0x2c, 0xf3, 0xdc, 0xb7, 0x38, 0x5f, 0x34, 0x5f, - 0x69, 0x31, 0x36, 0x5f, 0x69, 0x31, 0x36, 0x5f, - 0x66, 0x00, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00, - 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf, - 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08, - 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf, - 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x31, - 0x39, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01, - 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7, - 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7, - 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08, - 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08, - 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf, - 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7, - 0x00, 0xf0, 0x04, 0x08 - }; /* Structure image */ - - memcpy(g, data, sizeof(data)); /* Initialise the structure */ -} - -static void -imdi_k119_tab( -tabspec *t /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0x34, 0x00, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x52, 0xca, 0x04, 0x08, - 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf, - 0x22, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff, - 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff - }; /* Structure image */ - - memcpy(t, data, sizeof(data)); /* Initialise the structure */ -} - -/* 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 = 16 - 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 = 5 - Output channel 0 bits = 16 - Output channel 0 increment = 5 - Output channel 1 bits = 16 - Output channel 1 increment = 5 - Output channel 2 bits = 16 - Output channel 2 increment = 5 - Output channel 3 bits = 16 - Output channel 3 increment = 5 - Output channel 4 bits = 16 - Output channel 4 increment = 5 - Output is channel interleaved - - Output channels are separate words - Weight+voffset bits = 32 - Interpolation table index bits = 10 - Interpolation table max resolution = 1024 - */ - -/* - 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 <memory.h> -#include "imdi_imp.h" -#define IMDI_INCLUDED -#endif /* IMDI_INCLUDED */ - -#ifndef DEFINED_pointer -#define DEFINED_pointer -typedef unsigned char * pointer; -#endif - -/* Input table interp index, weighting and vertex offset */ -#define IT_IT(p, off) *((unsigned int *)((p) + 0 + (off) * 4)) - -/* Conditional exchange for sorting */ -#define CEX(A, B) if (A < B) { A ^= B; B ^= A; A ^= B; } - -/* Interpolation multi-dim. table access */ -#define IM_O(off) ((off) * 10) - -/* Interpolation table - get vertex values */ -#define IM_FE(p, v, c) ((unsigned int)*((unsigned short *)((p) + (v) * 2 + (c) * 2))) - -/* Output table indexes */ -#define OT_E(p, off) *((unsigned short *)((p) + (off) * 2)) - -static void -imdi_k120( -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 short *ip0 = (unsigned short *)inp[0]; - unsigned short *op0 = (unsigned short *)outp[0]; - unsigned short *ep = ip0 + npix * 1 ; - pointer it0 = (pointer)p->in_tables[0]; - pointer ot0 = (pointer)p->out_tables[0]; - pointer ot1 = (pointer)p->out_tables[1]; - pointer ot2 = (pointer)p->out_tables[2]; - pointer ot3 = (pointer)p->out_tables[3]; - pointer ot4 = (pointer)p->out_tables[4]; - pointer im_base = (pointer)p->im_table; - - for(;ip0 < ep; ip0 += 1, op0 += 5) { - unsigned int ova0; /* Output value accumulator */ - unsigned int ova1; /* Output value accumulator */ - unsigned int ova2; /* Output value accumulator */ - unsigned int ova3; /* Output value accumulator */ - unsigned int ova4; /* Output value accumulator */ - { - pointer imp; - unsigned int wo0; /* Weighting value and vertex offset variable */ - { - unsigned int ti; /* Input table entry variable */ - unsigned int ti_i; /* Interpolation index variable */ - - ti = IT_IT(it0, ip0[0]); - wo0 = (ti & 0x3fffff); /* Extract weighting/vertex offset value */ - ti_i = (ti >> 22); /* Extract interpolation table value */ - - imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */ - - /* Sort weighting values and vertex offset values */ - } - { - unsigned int nvof; /* Next vertex offset value */ - unsigned int vof; /* Vertex offset value */ - unsigned int vwe; /* Vertex weighting */ - - vof = 0; /* First vertex offset is 0 */ - nvof = (wo0 & 0x1f); /* Extract offset value */ - wo0 = (wo0 >> 5); /* Extract weighting value */ - vwe = 65536 - wo0; /* Baricentric weighting */ - ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 = IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 = IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - vwe = wo0; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - } - } - { - unsigned int oti; /* Vertex offset value */ - oti = ((ova0 >> 16) & 0xffff); /* Extract integer part of result */ - op0[0] = OT_E(ot0, oti); /* Write result */ - oti = ((ova1 >> 16) & 0xffff); /* Extract integer part of result */ - op0[1] = OT_E(ot1, oti); /* Write result */ - oti = ((ova2 >> 16) & 0xffff); /* Extract integer part of result */ - op0[2] = OT_E(ot2, oti); /* Write result */ - oti = ((ova3 >> 16) & 0xffff); /* Extract integer part of result */ - op0[3] = OT_E(ot3, oti); /* Write result */ - oti = ((ova4 >> 16) & 0xffff); /* Extract integer part of result */ - op0[4] = OT_E(ot4, oti); /* Write result */ - } - } -} -#undef IT_IT -#undef CEX -#undef IM_O -#undef IM_FE -#undef OT_E - -static void -imdi_k120_gen( -genspec *g /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x05, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x04, 0x00, 0x00, 0x00, 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, 0x04, 0x08, - 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08, - 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7, - 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7, - 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08, - 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00, - 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7, - 0x2c, 0xf3, 0xdc, 0xb7, 0x31, 0x5f, 0x35, 0x5f, - 0x69, 0x31, 0x36, 0x5f, 0x69, 0x31, 0x36, 0x5f, - 0x66, 0x00, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00, - 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf, - 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08, - 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf, - 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x32, - 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01, - 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7, - 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7, - 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08, - 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08, - 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf, - 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7, - 0x00, 0xf0, 0x04, 0x08 - }; /* Structure image */ - - memcpy(g, data, sizeof(data)); /* Initialise the structure */ -} - -static void -imdi_k120_tab( -tabspec *t /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x0a, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x14, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x11, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x0a, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x22, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff, - 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff - }; /* Structure image */ - - memcpy(t, data, sizeof(data)); /* Initialise the structure */ -} - -/* 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 = 3 - Input channel 0 bits = 16 - Input channel 0 increment = 3 - Input channel 1 bits = 16 - Input channel 1 increment = 3 - Input channel 2 bits = 16 - Input channel 2 increment = 3 - Input is channel interleaved - Input channels are separate words - Input value extraction is done in input table lookup - - Output channels per pixel = 5 - Output channel 0 bits = 16 - Output channel 0 increment = 5 - Output channel 1 bits = 16 - Output channel 1 increment = 5 - Output channel 2 bits = 16 - Output channel 2 increment = 5 - Output channel 3 bits = 16 - Output channel 3 increment = 5 - Output channel 4 bits = 16 - Output channel 4 increment = 5 - Output is channel interleaved - - Output channels are separate words - Weight+voffset bits = 32 - Interpolation table index bits = 16 - Interpolation table max resolution = 40 - */ - -/* - 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 <memory.h> -#include "imdi_imp.h" -#define IMDI_INCLUDED -#endif /* IMDI_INCLUDED */ - -#ifndef DEFINED_pointer -#define DEFINED_pointer -typedef unsigned char * pointer; -#endif - -/* Input table interp. index */ -#define IT_IX(p, off) *((unsigned short *)((p) + 0 + (off) * 6)) - -/* Input table input weighting/offset value enty */ -#define IT_WO(p, off) *((unsigned int *)((p) + 2 + (off) * 6)) - -/* Conditional exchange for sorting */ -#define CEX(A, B) if (A < B) { A ^= B; B ^= A; A ^= B; } - -/* Interpolation multi-dim. table access */ -#define IM_O(off) ((off) * 10) - -/* Interpolation table - get vertex values */ -#define IM_FE(p, v, c) ((unsigned int)*((unsigned short *)((p) + (v) * 2 + (c) * 2))) - -/* Output table indexes */ -#define OT_E(p, off) *((unsigned short *)((p) + (off) * 2)) - -static void -imdi_k121( -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 short *ip0 = (unsigned short *)inp[0]; - unsigned short *op0 = (unsigned short *)outp[0]; - unsigned short *ep = ip0 + npix * 3 ; - pointer it0 = (pointer)p->in_tables[0]; - pointer it1 = (pointer)p->in_tables[1]; - pointer it2 = (pointer)p->in_tables[2]; - pointer ot0 = (pointer)p->out_tables[0]; - pointer ot1 = (pointer)p->out_tables[1]; - pointer ot2 = (pointer)p->out_tables[2]; - pointer ot3 = (pointer)p->out_tables[3]; - pointer ot4 = (pointer)p->out_tables[4]; - pointer im_base = (pointer)p->im_table; - - for(;ip0 < ep; ip0 += 3, op0 += 5) { - unsigned int ova0; /* Output value accumulator */ - unsigned int ova1; /* Output value accumulator */ - unsigned int ova2; /* Output value accumulator */ - unsigned int ova3; /* Output value accumulator */ - unsigned int ova4; /* Output value accumulator */ - { - pointer imp; - unsigned int wo0; /* Weighting value and vertex offset variable */ - unsigned int wo1; /* Weighting value and vertex offset variable */ - unsigned int wo2; /* Weighting value and vertex offset variable */ - { - unsigned int ti_i; /* Interpolation index variable */ - - ti_i = IT_IX(it0, ip0[0]); - wo0 = IT_WO(it0, ip0[0]); - ti_i += IT_IX(it1, ip0[1]); - wo1 = IT_WO(it1, ip0[1]); - ti_i += IT_IX(it2, ip0[2]); - wo2 = IT_WO(it2, ip0[2]); - - imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */ - - /* Sort weighting values and vertex offset values */ - CEX(wo0, wo1); - CEX(wo0, wo2); - CEX(wo1, wo2); - } - { - unsigned int nvof; /* Next vertex offset value */ - unsigned int vof; /* Vertex offset value */ - unsigned int vwe; /* Vertex weighting */ - - vof = 0; /* First vertex offset is 0 */ - nvof = (wo0 & 0x7fff); /* Extract offset value */ - wo0 = (wo0 >> 15); /* Extract weighting value */ - vwe = 65536 - wo0; /* Baricentric weighting */ - ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 = IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 = IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo1 & 0x7fff); /* Extract offset value */ - wo1 = (wo1 >> 15); /* Extract weighting value */ - vwe = wo0 - wo1; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo2 & 0x7fff); /* Extract offset value */ - wo2 = (wo2 >> 15); /* Extract weighting value */ - vwe = wo1 - wo2; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - vwe = wo2; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - } - } - { - unsigned int oti; /* Vertex offset value */ - oti = ((ova0 >> 16) & 0xffff); /* Extract integer part of result */ - op0[0] = OT_E(ot0, oti); /* Write result */ - oti = ((ova1 >> 16) & 0xffff); /* Extract integer part of result */ - op0[1] = OT_E(ot1, oti); /* Write result */ - oti = ((ova2 >> 16) & 0xffff); /* Extract integer part of result */ - op0[2] = OT_E(ot2, oti); /* Write result */ - oti = ((ova3 >> 16) & 0xffff); /* Extract integer part of result */ - op0[3] = OT_E(ot3, oti); /* Write result */ - oti = ((ova4 >> 16) & 0xffff); /* Extract integer part of result */ - op0[4] = OT_E(ot4, oti); /* Write result */ - } - } -} -#undef IT_WO -#undef IT_IX -#undef CEX -#undef IM_O -#undef IM_FE -#undef OT_E - -static void -imdi_k121_gen( -genspec *g /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x10, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x05, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x28, 0x00, 0x00, 0x00, 0x00, 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, 0x04, 0x08, - 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08, - 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7, - 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7, - 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08, - 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00, - 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7, - 0x2c, 0xf3, 0xdc, 0xb7, 0x33, 0x5f, 0x35, 0x5f, - 0x69, 0x31, 0x36, 0x5f, 0x69, 0x31, 0x36, 0x5f, - 0x66, 0x00, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00, - 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf, - 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08, - 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf, - 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x32, - 0x31, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01, - 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7, - 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7, - 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08, - 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08, - 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf, - 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7, - 0x00, 0xf0, 0x04, 0x08 - }; /* Structure image */ - - memcpy(g, data, sizeof(data)); /* Initialise the structure */ -} - -static void -imdi_k121_tab( -tabspec *t /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x11, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x0a, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x22, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff, - 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff - }; /* Structure image */ - - memcpy(t, data, sizeof(data)); /* Initialise the structure */ -} - -/* 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 = 4 - Input channel 0 bits = 16 - Input channel 0 increment = 4 - Input channel 1 bits = 16 - Input channel 1 increment = 4 - Input channel 2 bits = 16 - Input channel 2 increment = 4 - Input channel 3 bits = 16 - Input channel 3 increment = 4 - Input is channel interleaved - Input channels are separate words - Input value extraction is done in input table lookup - - Output channels per pixel = 5 - Output channel 0 bits = 16 - Output channel 0 increment = 5 - Output channel 1 bits = 16 - Output channel 1 increment = 5 - Output channel 2 bits = 16 - Output channel 2 increment = 5 - Output channel 3 bits = 16 - Output channel 3 increment = 5 - Output channel 4 bits = 16 - Output channel 4 increment = 5 - Output is channel interleaved - - Output channels are separate words - Weight+voffset bits = 32 - Interpolation table index bits = 32 - Interpolation table max resolution = 18 - */ - -/* - 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 <memory.h> -#include "imdi_imp.h" -#define IMDI_INCLUDED -#endif /* IMDI_INCLUDED */ - -#ifndef DEFINED_pointer -#define DEFINED_pointer -typedef unsigned char * pointer; -#endif - -/* Input table interp. index */ -#define IT_IX(p, off) *((unsigned int *)((p) + 0 + (off) * 8)) - -/* Input table input weighting/offset value enty */ -#define IT_WO(p, off) *((unsigned int *)((p) + 4 + (off) * 8)) - -/* Conditional exchange for sorting */ -#define CEX(A, B) if (A < B) { A ^= B; B ^= A; A ^= B; } - -/* Interpolation multi-dim. table access */ -#define IM_O(off) ((off) * 10) - -/* Interpolation table - get vertex values */ -#define IM_FE(p, v, c) ((unsigned int)*((unsigned short *)((p) + (v) * 2 + (c) * 2))) - -/* Output table indexes */ -#define OT_E(p, off) *((unsigned short *)((p) + (off) * 2)) - -static void -imdi_k122( -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 short *ip0 = (unsigned short *)inp[0]; - unsigned short *op0 = (unsigned short *)outp[0]; - unsigned short *ep = ip0 + npix * 4 ; - pointer it0 = (pointer)p->in_tables[0]; - pointer it1 = (pointer)p->in_tables[1]; - pointer it2 = (pointer)p->in_tables[2]; - pointer it3 = (pointer)p->in_tables[3]; - pointer ot0 = (pointer)p->out_tables[0]; - pointer ot1 = (pointer)p->out_tables[1]; - pointer ot2 = (pointer)p->out_tables[2]; - pointer ot3 = (pointer)p->out_tables[3]; - pointer ot4 = (pointer)p->out_tables[4]; - pointer im_base = (pointer)p->im_table; - - for(;ip0 < ep; ip0 += 4, op0 += 5) { - unsigned int ova0; /* Output value accumulator */ - unsigned int ova1; /* Output value accumulator */ - unsigned int ova2; /* Output value accumulator */ - unsigned int ova3; /* Output value accumulator */ - unsigned int ova4; /* Output value accumulator */ - { - pointer imp; - unsigned int wo0; /* Weighting value and vertex offset variable */ - unsigned int wo1; /* Weighting value and vertex offset variable */ - unsigned int wo2; /* Weighting value and vertex offset variable */ - unsigned int wo3; /* Weighting value and vertex offset variable */ - { - unsigned int ti_i; /* Interpolation index variable */ - - ti_i = IT_IX(it0, ip0[0]); - wo0 = IT_WO(it0, ip0[0]); - ti_i += IT_IX(it1, ip0[1]); - wo1 = IT_WO(it1, ip0[1]); - ti_i += IT_IX(it2, ip0[2]); - wo2 = IT_WO(it2, ip0[2]); - ti_i += IT_IX(it3, ip0[3]); - wo3 = IT_WO(it3, ip0[3]); - - imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */ - - /* Sort weighting values and vertex offset values */ - CEX(wo0, wo1); - CEX(wo0, wo2); - CEX(wo0, wo3); - CEX(wo1, wo2); - CEX(wo1, wo3); - CEX(wo2, wo3); - } - { - unsigned int nvof; /* Next vertex offset value */ - unsigned int vof; /* Vertex offset value */ - unsigned int vwe; /* Vertex weighting */ - - vof = 0; /* First vertex offset is 0 */ - nvof = (wo0 & 0x7fff); /* Extract offset value */ - wo0 = (wo0 >> 15); /* Extract weighting value */ - vwe = 65536 - wo0; /* Baricentric weighting */ - ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 = IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 = IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo1 & 0x7fff); /* Extract offset value */ - wo1 = (wo1 >> 15); /* Extract weighting value */ - vwe = wo0 - wo1; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo2 & 0x7fff); /* Extract offset value */ - wo2 = (wo2 >> 15); /* Extract weighting value */ - vwe = wo1 - wo2; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo3 & 0x7fff); /* Extract offset value */ - wo3 = (wo3 >> 15); /* Extract weighting value */ - vwe = wo2 - wo3; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - vwe = wo3; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - } - } - { - unsigned int oti; /* Vertex offset value */ - oti = ((ova0 >> 16) & 0xffff); /* Extract integer part of result */ - op0[0] = OT_E(ot0, oti); /* Write result */ - oti = ((ova1 >> 16) & 0xffff); /* Extract integer part of result */ - op0[1] = OT_E(ot1, oti); /* Write result */ - oti = ((ova2 >> 16) & 0xffff); /* Extract integer part of result */ - op0[2] = OT_E(ot2, oti); /* Write result */ - oti = ((ova3 >> 16) & 0xffff); /* Extract integer part of result */ - op0[3] = OT_E(ot3, oti); /* Write result */ - oti = ((ova4 >> 16) & 0xffff); /* Extract integer part of result */ - op0[4] = OT_E(ot4, oti); /* Write result */ - } - } -} -#undef IT_WO -#undef IT_IX -#undef CEX -#undef IM_O -#undef IM_FE -#undef OT_E - -static void -imdi_k122_gen( -genspec *g /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x10, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x05, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x12, 0x00, 0x00, 0x00, 0x00, 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, 0x04, 0x08, - 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08, - 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7, - 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7, - 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08, - 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00, - 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7, - 0x2c, 0xf3, 0xdc, 0xb7, 0x34, 0x5f, 0x35, 0x5f, - 0x69, 0x31, 0x36, 0x5f, 0x69, 0x31, 0x36, 0x5f, - 0x66, 0x00, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00, - 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf, - 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08, - 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf, - 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x32, - 0x32, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01, - 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7, - 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7, - 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08, - 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08, - 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf, - 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7, - 0x00, 0xf0, 0x04, 0x08 - }; /* Structure image */ - - memcpy(g, data, sizeof(data)); /* Initialise the structure */ -} - -static void -imdi_k122_tab( -tabspec *t /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x11, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x0a, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x22, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff, - 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff - }; /* Structure image */ - - memcpy(t, data, sizeof(data)); /* Initialise the structure */ -} - -/* 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 = 5 - Input channel 0 bits = 16 - Input channel 0 increment = 5 - Input channel 1 bits = 16 - Input channel 1 increment = 5 - Input channel 2 bits = 16 - Input channel 2 increment = 5 - Input channel 3 bits = 16 - Input channel 3 increment = 5 - Input channel 4 bits = 16 - Input channel 4 increment = 5 - Input is channel interleaved - Input channels are separate words - Input value extraction is done in input table lookup - - Output channels per pixel = 5 - Output channel 0 bits = 16 - Output channel 0 increment = 5 - Output channel 1 bits = 16 - Output channel 1 increment = 5 - Output channel 2 bits = 16 - Output channel 2 increment = 5 - Output channel 3 bits = 16 - Output channel 3 increment = 5 - Output channel 4 bits = 16 - Output channel 4 increment = 5 - Output is channel interleaved - - Output channels are separate words - Weight+voffset bits = 32 - Interpolation table index bits = 32 - Interpolation table max resolution = 84 - */ - -/* - 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 <memory.h> -#include "imdi_imp.h" -#define IMDI_INCLUDED -#endif /* IMDI_INCLUDED */ - -#ifndef DEFINED_pointer -#define DEFINED_pointer -typedef unsigned char * pointer; -#endif - -/* Input table interp. index */ -#define IT_IX(p, off) *((unsigned int *)((p) + 0 + (off) * 12)) - -/* Input table input weighting enty */ -#define IT_WE(p, off) *((unsigned int *)((p) + 4 + (off) * 12)) - -/* Input table input offset value enty */ -#define IT_VO(p, off) *((unsigned int *)((p) + 8 + (off) * 12)) - -/* Conditional exchange for sorting */ -#define CEX(A, AA, B, BB) if (A < B) { \ - A ^= B; B ^= A; A ^= B; AA ^= BB; BB ^= AA; AA ^= BB; } - -/* Interpolation multi-dim. table access */ -#define IM_O(off) ((off) * 10) - -/* Interpolation table - get vertex values */ -#define IM_FE(p, v, c) ((unsigned int)*((unsigned short *)((p) + (v) * 2 + (c) * 2))) - -/* Output table indexes */ -#define OT_E(p, off) *((unsigned short *)((p) + (off) * 2)) - -static void -imdi_k123( -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 short *ip0 = (unsigned short *)inp[0]; - unsigned short *op0 = (unsigned short *)outp[0]; - unsigned short *ep = ip0 + npix * 5 ; - pointer it0 = (pointer)p->in_tables[0]; - pointer it1 = (pointer)p->in_tables[1]; - pointer it2 = (pointer)p->in_tables[2]; - pointer it3 = (pointer)p->in_tables[3]; - pointer it4 = (pointer)p->in_tables[4]; - pointer ot0 = (pointer)p->out_tables[0]; - pointer ot1 = (pointer)p->out_tables[1]; - pointer ot2 = (pointer)p->out_tables[2]; - pointer ot3 = (pointer)p->out_tables[3]; - pointer ot4 = (pointer)p->out_tables[4]; - pointer im_base = (pointer)p->im_table; - - for(;ip0 < ep; ip0 += 5, op0 += 5) { - unsigned int ova0; /* Output value accumulator */ - unsigned int ova1; /* Output value accumulator */ - unsigned int ova2; /* Output value accumulator */ - unsigned int ova3; /* Output value accumulator */ - unsigned int ova4; /* Output value accumulator */ - { - pointer imp; - unsigned int we0; /* Weighting value variable */ - unsigned int vo0; /* Vertex offset variable */ - unsigned int we1; /* Weighting value variable */ - unsigned int vo1; /* Vertex offset variable */ - unsigned int we2; /* Weighting value variable */ - unsigned int vo2; /* Vertex offset variable */ - unsigned int we3; /* Weighting value variable */ - unsigned int vo3; /* Vertex offset variable */ - unsigned int we4; /* Weighting value variable */ - unsigned int vo4; /* Vertex offset variable */ - { - unsigned int ti_i; /* Interpolation index variable */ - - ti_i = IT_IX(it0, ip0[0]); - we0 = IT_WE(it0, ip0[0]); - vo0 = IT_VO(it0, ip0[0]); - ti_i += IT_IX(it1, ip0[1]); - we1 = IT_WE(it1, ip0[1]); - vo1 = IT_VO(it1, ip0[1]); - ti_i += IT_IX(it2, ip0[2]); - we2 = IT_WE(it2, ip0[2]); - vo2 = IT_VO(it2, ip0[2]); - ti_i += IT_IX(it3, ip0[3]); - we3 = IT_WE(it3, ip0[3]); - vo3 = IT_VO(it3, ip0[3]); - ti_i += IT_IX(it4, ip0[4]); - we4 = IT_WE(it4, ip0[4]); - vo4 = IT_VO(it4, ip0[4]); - - imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */ - - /* Sort weighting values and vertex offset values */ - CEX(we0, vo0, we1, vo1); - CEX(we0, vo0, we2, vo2); - CEX(we0, vo0, we3, vo3); - CEX(we0, vo0, we4, vo4); - CEX(we1, vo1, we2, vo2); - CEX(we1, vo1, we3, vo3); - CEX(we1, vo1, we4, vo4); - CEX(we2, vo2, we3, vo3); - CEX(we2, vo2, we4, vo4); - CEX(we3, vo3, we4, vo4); - } - { - unsigned int vof; /* Vertex offset value */ - unsigned int vwe; /* Vertex weighting */ - - vof = 0; /* First vertex offset is 0 */ - vwe = 65536 - we0; /* Baricentric weighting */ - ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 = IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 = IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - vof += vo0; /* Move to next vertex */ - vwe = we0 - we1; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - vof += vo1; /* Move to next vertex */ - vwe = we1 - we2; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - vof += vo2; /* Move to next vertex */ - vwe = we2 - we3; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - vof += vo3; /* Move to next vertex */ - vwe = we3 - we4; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - vof += vo4; /* Move to next vertex */ - vwe = we4; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - } - } - { - unsigned int oti; /* Vertex offset value */ - oti = ((ova0 >> 16) & 0xffff); /* Extract integer part of result */ - op0[0] = OT_E(ot0, oti); /* Write result */ - oti = ((ova1 >> 16) & 0xffff); /* Extract integer part of result */ - op0[1] = OT_E(ot1, oti); /* Write result */ - oti = ((ova2 >> 16) & 0xffff); /* Extract integer part of result */ - op0[2] = OT_E(ot2, oti); /* Write result */ - oti = ((ova3 >> 16) & 0xffff); /* Extract integer part of result */ - op0[3] = OT_E(ot3, oti); /* Write result */ - oti = ((ova4 >> 16) & 0xffff); /* Extract integer part of result */ - op0[4] = OT_E(ot4, oti); /* Write result */ - } - } -} -#undef IT_WE -#undef IT_VO -#undef IT_IX -#undef CEX -#undef IM_O -#undef IM_FE -#undef OT_E - -static void -imdi_k123_gen( -genspec *g /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x10, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x05, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x54, 0x00, 0x00, 0x00, 0x00, 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, 0x04, 0x08, - 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08, - 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7, - 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7, - 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08, - 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00, - 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7, - 0x2c, 0xf3, 0xdc, 0xb7, 0x35, 0x5f, 0x35, 0x5f, - 0x69, 0x31, 0x36, 0x5f, 0x69, 0x31, 0x36, 0x5f, - 0x66, 0x00, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00, - 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf, - 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08, - 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf, - 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x32, - 0x33, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01, - 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7, - 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7, - 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08, - 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08, - 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf, - 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7, - 0x00, 0xf0, 0x04, 0x08 - }; /* Structure image */ - - memcpy(g, data, sizeof(data)); /* Initialise the structure */ -} - -static void -imdi_k123_tab( -tabspec *t /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x0a, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x22, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff, - 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff - }; /* Structure image */ - - memcpy(t, data, sizeof(data)); /* Initialise the structure */ -} - -/* 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 = 6 - Input channel 0 bits = 16 - Input channel 0 increment = 6 - Input channel 1 bits = 16 - Input channel 1 increment = 6 - Input channel 2 bits = 16 - Input channel 2 increment = 6 - Input channel 3 bits = 16 - Input channel 3 increment = 6 - Input channel 4 bits = 16 - Input channel 4 increment = 6 - Input channel 5 bits = 16 - Input channel 5 increment = 6 - Input is channel interleaved - Input channels are separate words - Input value extraction is done in input table lookup - - Output channels per pixel = 5 - Output channel 0 bits = 16 - Output channel 0 increment = 5 - Output channel 1 bits = 16 - Output channel 1 increment = 5 - Output channel 2 bits = 16 - Output channel 2 increment = 5 - Output channel 3 bits = 16 - Output channel 3 increment = 5 - Output channel 4 bits = 16 - Output channel 4 increment = 5 - Output is channel interleaved - - Output channels are separate words - Weight+voffset bits = 32 - Interpolation table index bits = 32 - Interpolation table max resolution = 40 - */ - -/* - 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 <memory.h> -#include "imdi_imp.h" -#define IMDI_INCLUDED -#endif /* IMDI_INCLUDED */ - -#ifndef DEFINED_pointer -#define DEFINED_pointer -typedef unsigned char * pointer; -#endif - -/* Input table interp. index */ -#define IT_IX(p, off) *((unsigned int *)((p) + 0 + (off) * 12)) - -/* Input table input weighting enty */ -#define IT_WE(p, off) *((unsigned int *)((p) + 4 + (off) * 12)) - -/* Input table input offset value enty */ -#define IT_VO(p, off) *((unsigned int *)((p) + 8 + (off) * 12)) - -/* Conditional exchange for sorting */ -#define CEX(A, AA, B, BB) if (A < B) { \ - A ^= B; B ^= A; A ^= B; AA ^= BB; BB ^= AA; AA ^= BB; } - -/* Interpolation multi-dim. table access */ -#define IM_O(off) ((off) * 10) - -/* Interpolation table - get vertex values */ -#define IM_FE(p, v, c) ((unsigned int)*((unsigned short *)((p) + (v) * 2 + (c) * 2))) - -/* Output table indexes */ -#define OT_E(p, off) *((unsigned short *)((p) + (off) * 2)) - -static void -imdi_k124( -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 short *ip0 = (unsigned short *)inp[0]; - unsigned short *op0 = (unsigned short *)outp[0]; - unsigned short *ep = ip0 + npix * 6 ; - pointer it0 = (pointer)p->in_tables[0]; - pointer it1 = (pointer)p->in_tables[1]; - pointer it2 = (pointer)p->in_tables[2]; - pointer it3 = (pointer)p->in_tables[3]; - pointer it4 = (pointer)p->in_tables[4]; - pointer it5 = (pointer)p->in_tables[5]; - pointer ot0 = (pointer)p->out_tables[0]; - pointer ot1 = (pointer)p->out_tables[1]; - pointer ot2 = (pointer)p->out_tables[2]; - pointer ot3 = (pointer)p->out_tables[3]; - pointer ot4 = (pointer)p->out_tables[4]; - pointer im_base = (pointer)p->im_table; - - for(;ip0 < ep; ip0 += 6, op0 += 5) { - unsigned int ova0; /* Output value accumulator */ - unsigned int ova1; /* Output value accumulator */ - unsigned int ova2; /* Output value accumulator */ - unsigned int ova3; /* Output value accumulator */ - unsigned int ova4; /* Output value accumulator */ - { - pointer imp; - unsigned int we0; /* Weighting value variable */ - unsigned int vo0; /* Vertex offset variable */ - unsigned int we1; /* Weighting value variable */ - unsigned int vo1; /* Vertex offset variable */ - unsigned int we2; /* Weighting value variable */ - unsigned int vo2; /* Vertex offset variable */ - unsigned int we3; /* Weighting value variable */ - unsigned int vo3; /* Vertex offset variable */ - unsigned int we4; /* Weighting value variable */ - unsigned int vo4; /* Vertex offset variable */ - unsigned int we5; /* Weighting value variable */ - unsigned int vo5; /* Vertex offset variable */ - { - unsigned int ti_i; /* Interpolation index variable */ - - ti_i = IT_IX(it0, ip0[0]); - we0 = IT_WE(it0, ip0[0]); - vo0 = IT_VO(it0, ip0[0]); - ti_i += IT_IX(it1, ip0[1]); - we1 = IT_WE(it1, ip0[1]); - vo1 = IT_VO(it1, ip0[1]); - ti_i += IT_IX(it2, ip0[2]); - we2 = IT_WE(it2, ip0[2]); - vo2 = IT_VO(it2, ip0[2]); - ti_i += IT_IX(it3, ip0[3]); - we3 = IT_WE(it3, ip0[3]); - vo3 = IT_VO(it3, ip0[3]); - ti_i += IT_IX(it4, ip0[4]); - we4 = IT_WE(it4, ip0[4]); - vo4 = IT_VO(it4, ip0[4]); - ti_i += IT_IX(it5, ip0[5]); - we5 = IT_WE(it5, ip0[5]); - vo5 = IT_VO(it5, ip0[5]); - - imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */ - - /* Sort weighting values and vertex offset values */ - CEX(we0, vo0, we1, vo1); - CEX(we0, vo0, we2, vo2); - CEX(we0, vo0, we3, vo3); - CEX(we0, vo0, we4, vo4); - CEX(we0, vo0, we5, vo5); - CEX(we1, vo1, we2, vo2); - CEX(we1, vo1, we3, vo3); - CEX(we1, vo1, we4, vo4); - CEX(we1, vo1, we5, vo5); - CEX(we2, vo2, we3, vo3); - CEX(we2, vo2, we4, vo4); - CEX(we2, vo2, we5, vo5); - CEX(we3, vo3, we4, vo4); - CEX(we3, vo3, we5, vo5); - CEX(we4, vo4, we5, vo5); - } - { - unsigned int vof; /* Vertex offset value */ - unsigned int vwe; /* Vertex weighting */ - - vof = 0; /* First vertex offset is 0 */ - vwe = 65536 - we0; /* Baricentric weighting */ - ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 = IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 = IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - vof += vo0; /* Move to next vertex */ - vwe = we0 - we1; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - vof += vo1; /* Move to next vertex */ - vwe = we1 - we2; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - vof += vo2; /* Move to next vertex */ - vwe = we2 - we3; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - vof += vo3; /* Move to next vertex */ - vwe = we3 - we4; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - vof += vo4; /* Move to next vertex */ - vwe = we4 - we5; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - vof += vo5; /* Move to next vertex */ - vwe = we5; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - } - } - { - unsigned int oti; /* Vertex offset value */ - oti = ((ova0 >> 16) & 0xffff); /* Extract integer part of result */ - op0[0] = OT_E(ot0, oti); /* Write result */ - oti = ((ova1 >> 16) & 0xffff); /* Extract integer part of result */ - op0[1] = OT_E(ot1, oti); /* Write result */ - oti = ((ova2 >> 16) & 0xffff); /* Extract integer part of result */ - op0[2] = OT_E(ot2, oti); /* Write result */ - oti = ((ova3 >> 16) & 0xffff); /* Extract integer part of result */ - op0[3] = OT_E(ot3, oti); /* Write result */ - oti = ((ova4 >> 16) & 0xffff); /* Extract integer part of result */ - op0[4] = OT_E(ot4, oti); /* Write result */ - } - } -} -#undef IT_WE -#undef IT_VO -#undef IT_IX -#undef CEX -#undef IM_O -#undef IM_FE -#undef OT_E - -static void -imdi_k124_gen( -genspec *g /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x10, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x05, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x28, 0x00, 0x00, 0x00, 0x00, 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, 0x04, 0x08, - 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08, - 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7, - 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7, - 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08, - 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00, - 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7, - 0x2c, 0xf3, 0xdc, 0xb7, 0x36, 0x5f, 0x35, 0x5f, - 0x69, 0x31, 0x36, 0x5f, 0x69, 0x31, 0x36, 0x5f, - 0x66, 0x00, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00, - 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf, - 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08, - 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf, - 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x32, - 0x34, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01, - 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7, - 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7, - 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08, - 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08, - 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf, - 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7, - 0x00, 0xf0, 0x04, 0x08 - }; /* Structure image */ - - memcpy(g, data, sizeof(data)); /* Initialise the structure */ -} - -static void -imdi_k124_tab( -tabspec *t /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x0a, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x22, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff, - 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff - }; /* Structure image */ - - memcpy(t, data, sizeof(data)); /* Initialise the structure */ -} - -/* 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 = 7 - Input channel 0 bits = 16 - Input channel 0 increment = 7 - Input channel 1 bits = 16 - Input channel 1 increment = 7 - Input channel 2 bits = 16 - Input channel 2 increment = 7 - Input channel 3 bits = 16 - Input channel 3 increment = 7 - Input channel 4 bits = 16 - Input channel 4 increment = 7 - Input channel 5 bits = 16 - Input channel 5 increment = 7 - Input channel 6 bits = 16 - Input channel 6 increment = 7 - Input is channel interleaved - Input channels are separate words - Input value extraction is done in input table lookup - - Output channels per pixel = 5 - Output channel 0 bits = 16 - Output channel 0 increment = 5 - Output channel 1 bits = 16 - Output channel 1 increment = 5 - Output channel 2 bits = 16 - Output channel 2 increment = 5 - Output channel 3 bits = 16 - Output channel 3 increment = 5 - Output channel 4 bits = 16 - Output channel 4 increment = 5 - Output is channel interleaved - - Output channels are separate words - Weight+voffset bits = 32 - Interpolation table index bits = 32 - Interpolation table max resolution = 23 - */ - -/* - 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 <memory.h> -#include "imdi_imp.h" -#define IMDI_INCLUDED -#endif /* IMDI_INCLUDED */ - -#ifndef DEFINED_pointer -#define DEFINED_pointer -typedef unsigned char * pointer; -#endif - -/* Input table interp. index */ -#define IT_IX(p, off) *((unsigned int *)((p) + 0 + (off) * 12)) - -/* Input table input weighting enty */ -#define IT_WE(p, off) *((unsigned int *)((p) + 4 + (off) * 12)) - -/* Input table input offset value enty */ -#define IT_VO(p, off) *((unsigned int *)((p) + 8 + (off) * 12)) - -/* Conditional exchange for sorting */ -#define CEX(A, AA, B, BB) if (A < B) { \ - A ^= B; B ^= A; A ^= B; AA ^= BB; BB ^= AA; AA ^= BB; } - -/* Interpolation multi-dim. table access */ -#define IM_O(off) ((off) * 10) - -/* Interpolation table - get vertex values */ -#define IM_FE(p, v, c) ((unsigned int)*((unsigned short *)((p) + (v) * 2 + (c) * 2))) - -/* Output table indexes */ -#define OT_E(p, off) *((unsigned short *)((p) + (off) * 2)) - -static void -imdi_k125( -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 short *ip0 = (unsigned short *)inp[0]; - unsigned short *op0 = (unsigned short *)outp[0]; - unsigned short *ep = ip0 + npix * 7 ; - pointer it0 = (pointer)p->in_tables[0]; - pointer it1 = (pointer)p->in_tables[1]; - pointer it2 = (pointer)p->in_tables[2]; - pointer it3 = (pointer)p->in_tables[3]; - pointer it4 = (pointer)p->in_tables[4]; - pointer it5 = (pointer)p->in_tables[5]; - pointer it6 = (pointer)p->in_tables[6]; - pointer ot0 = (pointer)p->out_tables[0]; - pointer ot1 = (pointer)p->out_tables[1]; - pointer ot2 = (pointer)p->out_tables[2]; - pointer ot3 = (pointer)p->out_tables[3]; - pointer ot4 = (pointer)p->out_tables[4]; - pointer im_base = (pointer)p->im_table; - - for(;ip0 < ep; ip0 += 7, op0 += 5) { - unsigned int ova0; /* Output value accumulator */ - unsigned int ova1; /* Output value accumulator */ - unsigned int ova2; /* Output value accumulator */ - unsigned int ova3; /* Output value accumulator */ - unsigned int ova4; /* Output value accumulator */ - { - pointer imp; - unsigned int we0; /* Weighting value variable */ - unsigned int vo0; /* Vertex offset variable */ - unsigned int we1; /* Weighting value variable */ - unsigned int vo1; /* Vertex offset variable */ - unsigned int we2; /* Weighting value variable */ - unsigned int vo2; /* Vertex offset variable */ - unsigned int we3; /* Weighting value variable */ - unsigned int vo3; /* Vertex offset variable */ - unsigned int we4; /* Weighting value variable */ - unsigned int vo4; /* Vertex offset variable */ - unsigned int we5; /* Weighting value variable */ - unsigned int vo5; /* Vertex offset variable */ - unsigned int we6; /* Weighting value variable */ - unsigned int vo6; /* Vertex offset variable */ - { - unsigned int ti_i; /* Interpolation index variable */ - - ti_i = IT_IX(it0, ip0[0]); - we0 = IT_WE(it0, ip0[0]); - vo0 = IT_VO(it0, ip0[0]); - ti_i += IT_IX(it1, ip0[1]); - we1 = IT_WE(it1, ip0[1]); - vo1 = IT_VO(it1, ip0[1]); - ti_i += IT_IX(it2, ip0[2]); - we2 = IT_WE(it2, ip0[2]); - vo2 = IT_VO(it2, ip0[2]); - ti_i += IT_IX(it3, ip0[3]); - we3 = IT_WE(it3, ip0[3]); - vo3 = IT_VO(it3, ip0[3]); - ti_i += IT_IX(it4, ip0[4]); - we4 = IT_WE(it4, ip0[4]); - vo4 = IT_VO(it4, ip0[4]); - ti_i += IT_IX(it5, ip0[5]); - we5 = IT_WE(it5, ip0[5]); - vo5 = IT_VO(it5, ip0[5]); - ti_i += IT_IX(it6, ip0[6]); - we6 = IT_WE(it6, ip0[6]); - vo6 = IT_VO(it6, ip0[6]); - - imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */ - - /* Sort weighting values and vertex offset values */ - CEX(we0, vo0, we1, vo1); - CEX(we0, vo0, we2, vo2); - CEX(we0, vo0, we3, vo3); - CEX(we0, vo0, we4, vo4); - CEX(we0, vo0, we5, vo5); - CEX(we0, vo0, we6, vo6); - CEX(we1, vo1, we2, vo2); - CEX(we1, vo1, we3, vo3); - CEX(we1, vo1, we4, vo4); - CEX(we1, vo1, we5, vo5); - CEX(we1, vo1, we6, vo6); - CEX(we2, vo2, we3, vo3); - CEX(we2, vo2, we4, vo4); - CEX(we2, vo2, we5, vo5); - CEX(we2, vo2, we6, vo6); - CEX(we3, vo3, we4, vo4); - CEX(we3, vo3, we5, vo5); - CEX(we3, vo3, we6, vo6); - CEX(we4, vo4, we5, vo5); - CEX(we4, vo4, we6, vo6); - CEX(we5, vo5, we6, vo6); - } - { - unsigned int vof; /* Vertex offset value */ - unsigned int vwe; /* Vertex weighting */ - - vof = 0; /* First vertex offset is 0 */ - vwe = 65536 - we0; /* Baricentric weighting */ - ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 = IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 = IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - vof += vo0; /* Move to next vertex */ - vwe = we0 - we1; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - vof += vo1; /* Move to next vertex */ - vwe = we1 - we2; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - vof += vo2; /* Move to next vertex */ - vwe = we2 - we3; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - vof += vo3; /* Move to next vertex */ - vwe = we3 - we4; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - vof += vo4; /* Move to next vertex */ - vwe = we4 - we5; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - vof += vo5; /* Move to next vertex */ - vwe = we5 - we6; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - vof += vo6; /* Move to next vertex */ - vwe = we6; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - } - } - { - unsigned int oti; /* Vertex offset value */ - oti = ((ova0 >> 16) & 0xffff); /* Extract integer part of result */ - op0[0] = OT_E(ot0, oti); /* Write result */ - oti = ((ova1 >> 16) & 0xffff); /* Extract integer part of result */ - op0[1] = OT_E(ot1, oti); /* Write result */ - oti = ((ova2 >> 16) & 0xffff); /* Extract integer part of result */ - op0[2] = OT_E(ot2, oti); /* Write result */ - oti = ((ova3 >> 16) & 0xffff); /* Extract integer part of result */ - op0[3] = OT_E(ot3, oti); /* Write result */ - oti = ((ova4 >> 16) & 0xffff); /* Extract integer part of result */ - op0[4] = OT_E(ot4, oti); /* Write result */ - } - } -} -#undef IT_WE -#undef IT_VO -#undef IT_IX -#undef CEX -#undef IM_O -#undef IM_FE -#undef OT_E - -static void -imdi_k125_gen( -genspec *g /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x10, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x05, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x17, 0x00, 0x00, 0x00, 0x00, 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, 0x04, 0x08, - 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08, - 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7, - 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7, - 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08, - 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00, - 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7, - 0x2c, 0xf3, 0xdc, 0xb7, 0x37, 0x5f, 0x35, 0x5f, - 0x69, 0x31, 0x36, 0x5f, 0x69, 0x31, 0x36, 0x5f, - 0x66, 0x00, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00, - 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf, - 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08, - 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf, - 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x32, - 0x35, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01, - 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7, - 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7, - 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08, - 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08, - 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf, - 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7, - 0x00, 0xf0, 0x04, 0x08 - }; /* Structure image */ - - memcpy(g, data, sizeof(data)); /* Initialise the structure */ -} - -static void -imdi_k125_tab( -tabspec *t /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x0a, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x22, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff, - 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff - }; /* Structure image */ - - memcpy(t, data, sizeof(data)); /* Initialise the structure */ -} - -/* 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 = 8 - Input channel 0 bits = 16 - Input channel 0 increment = 8 - Input channel 1 bits = 16 - Input channel 1 increment = 8 - Input channel 2 bits = 16 - Input channel 2 increment = 8 - Input channel 3 bits = 16 - Input channel 3 increment = 8 - Input channel 4 bits = 16 - Input channel 4 increment = 8 - Input channel 5 bits = 16 - Input channel 5 increment = 8 - Input channel 6 bits = 16 - Input channel 6 increment = 8 - Input channel 7 bits = 16 - Input channel 7 increment = 8 - Input is channel interleaved - Input channels are separate words - Input value extraction is done in input table lookup - - Output channels per pixel = 5 - Output channel 0 bits = 16 - Output channel 0 increment = 5 - Output channel 1 bits = 16 - Output channel 1 increment = 5 - Output channel 2 bits = 16 - Output channel 2 increment = 5 - Output channel 3 bits = 16 - Output channel 3 increment = 5 - Output channel 4 bits = 16 - Output channel 4 increment = 5 - Output is channel interleaved - - Output channels are separate words - Weight+voffset bits = 32 - Interpolation table index bits = 32 - Interpolation table max resolution = 16 - */ - -/* - 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 <memory.h> -#include "imdi_imp.h" -#define IMDI_INCLUDED -#endif /* IMDI_INCLUDED */ - -#ifndef DEFINED_pointer -#define DEFINED_pointer -typedef unsigned char * pointer; -#endif - -/* Input table interp. index */ -#define IT_IX(p, off) *((unsigned int *)((p) + 0 + (off) * 12)) - -/* Input table input weighting enty */ -#define IT_WE(p, off) *((unsigned int *)((p) + 4 + (off) * 12)) - -/* Input table input offset value enty */ -#define IT_VO(p, off) *((unsigned int *)((p) + 8 + (off) * 12)) - -/* Conditional exchange for sorting */ -#define CEX(A, AA, B, BB) if (A < B) { \ - A ^= B; B ^= A; A ^= B; AA ^= BB; BB ^= AA; AA ^= BB; } - -/* Interpolation multi-dim. table access */ -#define IM_O(off) ((off) * 10) - -/* Interpolation table - get vertex values */ -#define IM_FE(p, v, c) ((unsigned int)*((unsigned short *)((p) + (v) * 2 + (c) * 2))) - -/* Output table indexes */ -#define OT_E(p, off) *((unsigned short *)((p) + (off) * 2)) - -static void -imdi_k126( -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 short *ip0 = (unsigned short *)inp[0]; - unsigned short *op0 = (unsigned short *)outp[0]; - unsigned short *ep = ip0 + npix * 8 ; - pointer it0 = (pointer)p->in_tables[0]; - pointer it1 = (pointer)p->in_tables[1]; - pointer it2 = (pointer)p->in_tables[2]; - pointer it3 = (pointer)p->in_tables[3]; - pointer it4 = (pointer)p->in_tables[4]; - pointer it5 = (pointer)p->in_tables[5]; - pointer it6 = (pointer)p->in_tables[6]; - pointer it7 = (pointer)p->in_tables[7]; - pointer ot0 = (pointer)p->out_tables[0]; - pointer ot1 = (pointer)p->out_tables[1]; - pointer ot2 = (pointer)p->out_tables[2]; - pointer ot3 = (pointer)p->out_tables[3]; - pointer ot4 = (pointer)p->out_tables[4]; - pointer im_base = (pointer)p->im_table; - - for(;ip0 < ep; ip0 += 8, op0 += 5) { - unsigned int ova0; /* Output value accumulator */ - unsigned int ova1; /* Output value accumulator */ - unsigned int ova2; /* Output value accumulator */ - unsigned int ova3; /* Output value accumulator */ - unsigned int ova4; /* Output value accumulator */ - { - pointer imp; - unsigned int we0; /* Weighting value variable */ - unsigned int vo0; /* Vertex offset variable */ - unsigned int we1; /* Weighting value variable */ - unsigned int vo1; /* Vertex offset variable */ - unsigned int we2; /* Weighting value variable */ - unsigned int vo2; /* Vertex offset variable */ - unsigned int we3; /* Weighting value variable */ - unsigned int vo3; /* Vertex offset variable */ - unsigned int we4; /* Weighting value variable */ - unsigned int vo4; /* Vertex offset variable */ - unsigned int we5; /* Weighting value variable */ - unsigned int vo5; /* Vertex offset variable */ - unsigned int we6; /* Weighting value variable */ - unsigned int vo6; /* Vertex offset variable */ - unsigned int we7; /* Weighting value variable */ - unsigned int vo7; /* Vertex offset variable */ - { - unsigned int ti_i; /* Interpolation index variable */ - - ti_i = IT_IX(it0, ip0[0]); - we0 = IT_WE(it0, ip0[0]); - vo0 = IT_VO(it0, ip0[0]); - ti_i += IT_IX(it1, ip0[1]); - we1 = IT_WE(it1, ip0[1]); - vo1 = IT_VO(it1, ip0[1]); - ti_i += IT_IX(it2, ip0[2]); - we2 = IT_WE(it2, ip0[2]); - vo2 = IT_VO(it2, ip0[2]); - ti_i += IT_IX(it3, ip0[3]); - we3 = IT_WE(it3, ip0[3]); - vo3 = IT_VO(it3, ip0[3]); - ti_i += IT_IX(it4, ip0[4]); - we4 = IT_WE(it4, ip0[4]); - vo4 = IT_VO(it4, ip0[4]); - ti_i += IT_IX(it5, ip0[5]); - we5 = IT_WE(it5, ip0[5]); - vo5 = IT_VO(it5, ip0[5]); - ti_i += IT_IX(it6, ip0[6]); - we6 = IT_WE(it6, ip0[6]); - vo6 = IT_VO(it6, ip0[6]); - ti_i += IT_IX(it7, ip0[7]); - we7 = IT_WE(it7, ip0[7]); - vo7 = IT_VO(it7, ip0[7]); - - imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */ - - /* Sort weighting values and vertex offset values */ - CEX(we0, vo0, we1, vo1); - CEX(we0, vo0, we2, vo2); - CEX(we0, vo0, we3, vo3); - CEX(we0, vo0, we4, vo4); - CEX(we0, vo0, we5, vo5); - CEX(we0, vo0, we6, vo6); - CEX(we0, vo0, we7, vo7); - CEX(we1, vo1, we2, vo2); - CEX(we1, vo1, we3, vo3); - CEX(we1, vo1, we4, vo4); - CEX(we1, vo1, we5, vo5); - CEX(we1, vo1, we6, vo6); - CEX(we1, vo1, we7, vo7); - CEX(we2, vo2, we3, vo3); - CEX(we2, vo2, we4, vo4); - CEX(we2, vo2, we5, vo5); - CEX(we2, vo2, we6, vo6); - CEX(we2, vo2, we7, vo7); - CEX(we3, vo3, we4, vo4); - CEX(we3, vo3, we5, vo5); - CEX(we3, vo3, we6, vo6); - CEX(we3, vo3, we7, vo7); - CEX(we4, vo4, we5, vo5); - CEX(we4, vo4, we6, vo6); - CEX(we4, vo4, we7, vo7); - CEX(we5, vo5, we6, vo6); - CEX(we5, vo5, we7, vo7); - CEX(we6, vo6, we7, vo7); - } - { - unsigned int vof; /* Vertex offset value */ - unsigned int vwe; /* Vertex weighting */ - - vof = 0; /* First vertex offset is 0 */ - vwe = 65536 - we0; /* Baricentric weighting */ - ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 = IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 = IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - vof += vo0; /* Move to next vertex */ - vwe = we0 - we1; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - vof += vo1; /* Move to next vertex */ - vwe = we1 - we2; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - vof += vo2; /* Move to next vertex */ - vwe = we2 - we3; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - vof += vo3; /* Move to next vertex */ - vwe = we3 - we4; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - vof += vo4; /* Move to next vertex */ - vwe = we4 - we5; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - vof += vo5; /* Move to next vertex */ - vwe = we5 - we6; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - vof += vo6; /* Move to next vertex */ - vwe = we6 - we7; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - vof += vo7; /* Move to next vertex */ - vwe = we7; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - } - } - { - unsigned int oti; /* Vertex offset value */ - oti = ((ova0 >> 16) & 0xffff); /* Extract integer part of result */ - op0[0] = OT_E(ot0, oti); /* Write result */ - oti = ((ova1 >> 16) & 0xffff); /* Extract integer part of result */ - op0[1] = OT_E(ot1, oti); /* Write result */ - oti = ((ova2 >> 16) & 0xffff); /* Extract integer part of result */ - op0[2] = OT_E(ot2, oti); /* Write result */ - oti = ((ova3 >> 16) & 0xffff); /* Extract integer part of result */ - op0[3] = OT_E(ot3, oti); /* Write result */ - oti = ((ova4 >> 16) & 0xffff); /* Extract integer part of result */ - op0[4] = OT_E(ot4, oti); /* Write result */ - } - } -} -#undef IT_WE -#undef IT_VO -#undef IT_IX -#undef CEX -#undef IM_O -#undef IM_FE -#undef OT_E - -static void -imdi_k126_gen( -genspec *g /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x05, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x00, 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, 0x04, 0x08, - 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08, - 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7, - 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7, - 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08, - 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00, - 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7, - 0x2c, 0xf3, 0xdc, 0xb7, 0x38, 0x5f, 0x35, 0x5f, - 0x69, 0x31, 0x36, 0x5f, 0x69, 0x31, 0x36, 0x5f, - 0x66, 0x00, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00, - 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf, - 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08, - 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf, - 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x32, - 0x36, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01, - 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7, - 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7, - 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08, - 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08, - 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf, - 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7, - 0x00, 0xf0, 0x04, 0x08 - }; /* Structure image */ - - memcpy(g, data, sizeof(data)); /* Initialise the structure */ -} - -static void -imdi_k126_tab( -tabspec *t /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x0a, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x22, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff, - 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff - }; /* Structure image */ - - memcpy(t, data, sizeof(data)); /* Initialise the structure */ -} - -/* 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 = 16 - 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 = 6 - Output channel 0 bits = 16 - Output channel 0 increment = 6 - Output channel 1 bits = 16 - Output channel 1 increment = 6 - Output channel 2 bits = 16 - Output channel 2 increment = 6 - Output channel 3 bits = 16 - Output channel 3 increment = 6 - Output channel 4 bits = 16 - Output channel 4 increment = 6 - Output channel 5 bits = 16 - Output channel 5 increment = 6 - Output is channel interleaved - - Output channels are separate words - Weight+voffset bits = 32 - Interpolation table index bits = 11 - Interpolation table max resolution = 2048 - */ - -/* - 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 <memory.h> -#include "imdi_imp.h" -#define IMDI_INCLUDED -#endif /* IMDI_INCLUDED */ - -#ifndef DEFINED_pointer -#define DEFINED_pointer -typedef unsigned char * pointer; -#endif - -/* Input table interp index, weighting and vertex offset */ -#define IT_IT(p, off) *((unsigned int *)((p) + 0 + (off) * 4)) - -/* Conditional exchange for sorting */ -#define CEX(A, B) if (A < B) { A ^= B; B ^= A; A ^= B; } - -/* Interpolation multi-dim. table access */ -#define IM_O(off) ((off) * 12) - -/* Interpolation table - get vertex values */ -#define IM_FE(p, v, c) ((unsigned int)*((unsigned short *)((p) + (v) * 4 + (c) * 2))) - -/* Output table indexes */ -#define OT_E(p, off) *((unsigned short *)((p) + (off) * 2)) - -static void -imdi_k127( -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 short *ip0 = (unsigned short *)inp[0]; - unsigned short *op0 = (unsigned short *)outp[0]; - unsigned short *ep = ip0 + npix * 1 ; - pointer it0 = (pointer)p->in_tables[0]; - pointer ot0 = (pointer)p->out_tables[0]; - pointer ot1 = (pointer)p->out_tables[1]; - pointer ot2 = (pointer)p->out_tables[2]; - pointer ot3 = (pointer)p->out_tables[3]; - pointer ot4 = (pointer)p->out_tables[4]; - pointer ot5 = (pointer)p->out_tables[5]; - pointer im_base = (pointer)p->im_table; - - for(;ip0 < ep; ip0 += 1, op0 += 6) { - unsigned int ova0; /* Output value accumulator */ - unsigned int ova1; /* Output value accumulator */ - unsigned int ova2; /* Output value accumulator */ - unsigned int ova3; /* Output value accumulator */ - unsigned int ova4; /* Output value accumulator */ - unsigned int ova5; /* Output value accumulator */ - { - pointer imp; - unsigned int wo0; /* Weighting value and vertex offset variable */ - { - unsigned int ti; /* Input table entry variable */ - unsigned int ti_i; /* Interpolation index variable */ - - ti = IT_IT(it0, ip0[0]); - wo0 = (ti & 0x1fffff); /* Extract weighting/vertex offset value */ - ti_i = (ti >> 21); /* Extract interpolation table value */ - - imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */ - - /* Sort weighting values and vertex offset values */ - } - { - unsigned int nvof; /* Next vertex offset value */ - unsigned int vof; /* Vertex offset value */ - unsigned int vwe; /* Vertex weighting */ - - vof = 0; /* First vertex offset is 0 */ - nvof = (wo0 & 0xf); /* Extract offset value */ - wo0 = (wo0 >> 4); /* Extract weighting value */ - vwe = 65536 - wo0; /* Baricentric weighting */ - ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 = IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 = IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - ova5 = IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - vwe = wo0; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */ - } - } - { - unsigned int oti; /* Vertex offset value */ - oti = ((ova0 >> 16) & 0xffff); /* Extract integer part of result */ - op0[0] = OT_E(ot0, oti); /* Write result */ - oti = ((ova1 >> 16) & 0xffff); /* Extract integer part of result */ - op0[1] = OT_E(ot1, oti); /* Write result */ - oti = ((ova2 >> 16) & 0xffff); /* Extract integer part of result */ - op0[2] = OT_E(ot2, oti); /* Write result */ - oti = ((ova3 >> 16) & 0xffff); /* Extract integer part of result */ - op0[3] = OT_E(ot3, oti); /* Write result */ - oti = ((ova4 >> 16) & 0xffff); /* Extract integer part of result */ - op0[4] = OT_E(ot4, oti); /* Write result */ - oti = ((ova5 >> 16) & 0xffff); /* Extract integer part of result */ - op0[5] = OT_E(ot5, oti); /* Write result */ - } - } -} -#undef IT_IT -#undef CEX -#undef IM_O -#undef IM_FE -#undef OT_E - -static void -imdi_k127_gen( -genspec *g /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x08, 0x00, 0x00, 0x00, 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, 0x04, 0x08, - 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08, - 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7, - 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7, - 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08, - 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00, - 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7, - 0x2c, 0xf3, 0xdc, 0xb7, 0x31, 0x5f, 0x36, 0x5f, - 0x69, 0x31, 0x36, 0x5f, 0x69, 0x31, 0x36, 0x5f, - 0x66, 0x00, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00, - 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf, - 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08, - 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf, - 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x32, - 0x37, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01, - 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7, - 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7, - 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08, - 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08, - 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf, - 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7, - 0x00, 0xf0, 0x04, 0x08 - }; /* Structure image */ - - memcpy(g, data, sizeof(data)); /* Initialise the structure */ -} - -static void -imdi_k127_tab( -tabspec *t /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x0b, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x14, 0x00, 0x00, 0x00, 0x15, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x11, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x0c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, - 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff - }; /* Structure image */ - - memcpy(t, data, sizeof(data)); /* Initialise the structure */ -} - -/* 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 = 3 - Input channel 0 bits = 16 - Input channel 0 increment = 3 - Input channel 1 bits = 16 - Input channel 1 increment = 3 - Input channel 2 bits = 16 - Input channel 2 increment = 3 - Input is channel interleaved - Input channels are separate words - Input value extraction is done in input table lookup - - Output channels per pixel = 6 - Output channel 0 bits = 16 - Output channel 0 increment = 6 - Output channel 1 bits = 16 - Output channel 1 increment = 6 - Output channel 2 bits = 16 - Output channel 2 increment = 6 - Output channel 3 bits = 16 - Output channel 3 increment = 6 - Output channel 4 bits = 16 - Output channel 4 increment = 6 - Output channel 5 bits = 16 - Output channel 5 increment = 6 - Output is channel interleaved - - Output channels are separate words - Weight+voffset bits = 32 - Interpolation table index bits = 16 - Interpolation table max resolution = 40 - */ - -/* - 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 <memory.h> -#include "imdi_imp.h" -#define IMDI_INCLUDED -#endif /* IMDI_INCLUDED */ - -#ifndef DEFINED_pointer -#define DEFINED_pointer -typedef unsigned char * pointer; -#endif - -/* Input table interp. index */ -#define IT_IX(p, off) *((unsigned short *)((p) + 0 + (off) * 6)) - -/* Input table input weighting/offset value enty */ -#define IT_WO(p, off) *((unsigned int *)((p) + 2 + (off) * 6)) - -/* Conditional exchange for sorting */ -#define CEX(A, B) if (A < B) { A ^= B; B ^= A; A ^= B; } - -/* Interpolation multi-dim. table access */ -#define IM_O(off) ((off) * 12) - -/* Interpolation table - get vertex values */ -#define IM_FE(p, v, c) ((unsigned int)*((unsigned short *)((p) + (v) * 4 + (c) * 2))) - -/* Output table indexes */ -#define OT_E(p, off) *((unsigned short *)((p) + (off) * 2)) - -static void -imdi_k128( -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 short *ip0 = (unsigned short *)inp[0]; - unsigned short *op0 = (unsigned short *)outp[0]; - unsigned short *ep = ip0 + npix * 3 ; - pointer it0 = (pointer)p->in_tables[0]; - pointer it1 = (pointer)p->in_tables[1]; - pointer it2 = (pointer)p->in_tables[2]; - pointer ot0 = (pointer)p->out_tables[0]; - pointer ot1 = (pointer)p->out_tables[1]; - pointer ot2 = (pointer)p->out_tables[2]; - pointer ot3 = (pointer)p->out_tables[3]; - pointer ot4 = (pointer)p->out_tables[4]; - pointer ot5 = (pointer)p->out_tables[5]; - pointer im_base = (pointer)p->im_table; - - for(;ip0 < ep; ip0 += 3, op0 += 6) { - unsigned int ova0; /* Output value accumulator */ - unsigned int ova1; /* Output value accumulator */ - unsigned int ova2; /* Output value accumulator */ - unsigned int ova3; /* Output value accumulator */ - unsigned int ova4; /* Output value accumulator */ - unsigned int ova5; /* Output value accumulator */ - { - pointer imp; - unsigned int wo0; /* Weighting value and vertex offset variable */ - unsigned int wo1; /* Weighting value and vertex offset variable */ - unsigned int wo2; /* Weighting value and vertex offset variable */ - { - unsigned int ti_i; /* Interpolation index variable */ - - ti_i = IT_IX(it0, ip0[0]); - wo0 = IT_WO(it0, ip0[0]); - ti_i += IT_IX(it1, ip0[1]); - wo1 = IT_WO(it1, ip0[1]); - ti_i += IT_IX(it2, ip0[2]); - wo2 = IT_WO(it2, ip0[2]); - - imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */ - - /* Sort weighting values and vertex offset values */ - CEX(wo0, wo1); - CEX(wo0, wo2); - CEX(wo1, wo2); - } - { - unsigned int nvof; /* Next vertex offset value */ - unsigned int vof; /* Vertex offset value */ - unsigned int vwe; /* Vertex weighting */ - - vof = 0; /* First vertex offset is 0 */ - nvof = (wo0 & 0x7fff); /* Extract offset value */ - wo0 = (wo0 >> 15); /* Extract weighting value */ - vwe = 65536 - wo0; /* Baricentric weighting */ - ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 = IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 = IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - ova5 = IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo1 & 0x7fff); /* Extract offset value */ - wo1 = (wo1 >> 15); /* Extract weighting value */ - vwe = wo0 - wo1; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo2 & 0x7fff); /* Extract offset value */ - wo2 = (wo2 >> 15); /* Extract weighting value */ - vwe = wo1 - wo2; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - vwe = wo2; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */ - } - } - { - unsigned int oti; /* Vertex offset value */ - oti = ((ova0 >> 16) & 0xffff); /* Extract integer part of result */ - op0[0] = OT_E(ot0, oti); /* Write result */ - oti = ((ova1 >> 16) & 0xffff); /* Extract integer part of result */ - op0[1] = OT_E(ot1, oti); /* Write result */ - oti = ((ova2 >> 16) & 0xffff); /* Extract integer part of result */ - op0[2] = OT_E(ot2, oti); /* Write result */ - oti = ((ova3 >> 16) & 0xffff); /* Extract integer part of result */ - op0[3] = OT_E(ot3, oti); /* Write result */ - oti = ((ova4 >> 16) & 0xffff); /* Extract integer part of result */ - op0[4] = OT_E(ot4, oti); /* Write result */ - oti = ((ova5 >> 16) & 0xffff); /* Extract integer part of result */ - op0[5] = OT_E(ot5, oti); /* Write result */ - } - } -} -#undef IT_WO -#undef IT_IX -#undef CEX -#undef IM_O -#undef IM_FE -#undef OT_E - -static void -imdi_k128_gen( -genspec *g /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x10, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x28, 0x00, 0x00, 0x00, 0x00, 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, 0x04, 0x08, - 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08, - 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7, - 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7, - 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08, - 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00, - 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7, - 0x2c, 0xf3, 0xdc, 0xb7, 0x33, 0x5f, 0x36, 0x5f, - 0x69, 0x31, 0x36, 0x5f, 0x69, 0x31, 0x36, 0x5f, - 0x66, 0x00, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00, - 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf, - 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08, - 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf, - 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x32, - 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01, - 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7, - 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7, - 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08, - 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08, - 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf, - 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7, - 0x00, 0xf0, 0x04, 0x08 - }; /* Structure image */ - - memcpy(g, data, sizeof(data)); /* Initialise the structure */ -} - -static void -imdi_k128_tab( -tabspec *t /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x11, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x0c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, - 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff - }; /* Structure image */ - - memcpy(t, data, sizeof(data)); /* Initialise the structure */ -} - -/* 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 = 4 - Input channel 0 bits = 16 - Input channel 0 increment = 4 - Input channel 1 bits = 16 - Input channel 1 increment = 4 - Input channel 2 bits = 16 - Input channel 2 increment = 4 - Input channel 3 bits = 16 - Input channel 3 increment = 4 - Input is channel interleaved - Input channels are separate words - Input value extraction is done in input table lookup - - Output channels per pixel = 6 - Output channel 0 bits = 16 - Output channel 0 increment = 6 - Output channel 1 bits = 16 - Output channel 1 increment = 6 - Output channel 2 bits = 16 - Output channel 2 increment = 6 - Output channel 3 bits = 16 - Output channel 3 increment = 6 - Output channel 4 bits = 16 - Output channel 4 increment = 6 - Output channel 5 bits = 16 - Output channel 5 increment = 6 - Output is channel interleaved - - Output channels are separate words - Weight+voffset bits = 32 - Interpolation table index bits = 32 - Interpolation table max resolution = 21 - */ - -/* - 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 <memory.h> -#include "imdi_imp.h" -#define IMDI_INCLUDED -#endif /* IMDI_INCLUDED */ - -#ifndef DEFINED_pointer -#define DEFINED_pointer -typedef unsigned char * pointer; -#endif - -/* Input table interp. index */ -#define IT_IX(p, off) *((unsigned int *)((p) + 0 + (off) * 8)) - -/* Input table input weighting/offset value enty */ -#define IT_WO(p, off) *((unsigned int *)((p) + 4 + (off) * 8)) - -/* Conditional exchange for sorting */ -#define CEX(A, B) if (A < B) { A ^= B; B ^= A; A ^= B; } - -/* Interpolation multi-dim. table access */ -#define IM_O(off) ((off) * 12) - -/* Interpolation table - get vertex values */ -#define IM_FE(p, v, c) ((unsigned int)*((unsigned short *)((p) + (v) * 4 + (c) * 2))) - -/* Output table indexes */ -#define OT_E(p, off) *((unsigned short *)((p) + (off) * 2)) - -static void -imdi_k129( -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 short *ip0 = (unsigned short *)inp[0]; - unsigned short *op0 = (unsigned short *)outp[0]; - unsigned short *ep = ip0 + npix * 4 ; - pointer it0 = (pointer)p->in_tables[0]; - pointer it1 = (pointer)p->in_tables[1]; - pointer it2 = (pointer)p->in_tables[2]; - pointer it3 = (pointer)p->in_tables[3]; - pointer ot0 = (pointer)p->out_tables[0]; - pointer ot1 = (pointer)p->out_tables[1]; - pointer ot2 = (pointer)p->out_tables[2]; - pointer ot3 = (pointer)p->out_tables[3]; - pointer ot4 = (pointer)p->out_tables[4]; - pointer ot5 = (pointer)p->out_tables[5]; - pointer im_base = (pointer)p->im_table; - - for(;ip0 < ep; ip0 += 4, op0 += 6) { - unsigned int ova0; /* Output value accumulator */ - unsigned int ova1; /* Output value accumulator */ - unsigned int ova2; /* Output value accumulator */ - unsigned int ova3; /* Output value accumulator */ - unsigned int ova4; /* Output value accumulator */ - unsigned int ova5; /* Output value accumulator */ - { - pointer imp; - unsigned int wo0; /* Weighting value and vertex offset variable */ - unsigned int wo1; /* Weighting value and vertex offset variable */ - unsigned int wo2; /* Weighting value and vertex offset variable */ - unsigned int wo3; /* Weighting value and vertex offset variable */ - { - unsigned int ti_i; /* Interpolation index variable */ - - ti_i = IT_IX(it0, ip0[0]); - wo0 = IT_WO(it0, ip0[0]); - ti_i += IT_IX(it1, ip0[1]); - wo1 = IT_WO(it1, ip0[1]); - ti_i += IT_IX(it2, ip0[2]); - wo2 = IT_WO(it2, ip0[2]); - ti_i += IT_IX(it3, ip0[3]); - wo3 = IT_WO(it3, ip0[3]); - - imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */ - - /* Sort weighting values and vertex offset values */ - CEX(wo0, wo1); - CEX(wo0, wo2); - CEX(wo0, wo3); - CEX(wo1, wo2); - CEX(wo1, wo3); - CEX(wo2, wo3); - } - { - unsigned int nvof; /* Next vertex offset value */ - unsigned int vof; /* Vertex offset value */ - unsigned int vwe; /* Vertex weighting */ - - vof = 0; /* First vertex offset is 0 */ - nvof = (wo0 & 0x7fff); /* Extract offset value */ - wo0 = (wo0 >> 15); /* Extract weighting value */ - vwe = 65536 - wo0; /* Baricentric weighting */ - ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 = IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 = IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - ova5 = IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo1 & 0x7fff); /* Extract offset value */ - wo1 = (wo1 >> 15); /* Extract weighting value */ - vwe = wo0 - wo1; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo2 & 0x7fff); /* Extract offset value */ - wo2 = (wo2 >> 15); /* Extract weighting value */ - vwe = wo1 - wo2; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo3 & 0x7fff); /* Extract offset value */ - wo3 = (wo3 >> 15); /* Extract weighting value */ - vwe = wo2 - wo3; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - vwe = wo3; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */ - } - } - { - unsigned int oti; /* Vertex offset value */ - oti = ((ova0 >> 16) & 0xffff); /* Extract integer part of result */ - op0[0] = OT_E(ot0, oti); /* Write result */ - oti = ((ova1 >> 16) & 0xffff); /* Extract integer part of result */ - op0[1] = OT_E(ot1, oti); /* Write result */ - oti = ((ova2 >> 16) & 0xffff); /* Extract integer part of result */ - op0[2] = OT_E(ot2, oti); /* Write result */ - oti = ((ova3 >> 16) & 0xffff); /* Extract integer part of result */ - op0[3] = OT_E(ot3, oti); /* Write result */ - oti = ((ova4 >> 16) & 0xffff); /* Extract integer part of result */ - op0[4] = OT_E(ot4, oti); /* Write result */ - oti = ((ova5 >> 16) & 0xffff); /* Extract integer part of result */ - op0[5] = OT_E(ot5, oti); /* Write result */ - } - } -} -#undef IT_WO -#undef IT_IX -#undef CEX -#undef IM_O -#undef IM_FE -#undef OT_E - -static void -imdi_k129_gen( -genspec *g /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x10, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x15, 0x00, 0x00, 0x00, 0x00, 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, 0x04, 0x08, - 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08, - 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7, - 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7, - 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08, - 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00, - 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7, - 0x2c, 0xf3, 0xdc, 0xb7, 0x34, 0x5f, 0x36, 0x5f, - 0x69, 0x31, 0x36, 0x5f, 0x69, 0x31, 0x36, 0x5f, - 0x66, 0x00, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00, - 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf, - 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08, - 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf, - 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x32, - 0x39, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01, - 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7, - 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7, - 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08, - 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08, - 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf, - 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7, - 0x00, 0xf0, 0x04, 0x08 - }; /* Structure image */ - - memcpy(g, data, sizeof(data)); /* Initialise the structure */ -} - -static void -imdi_k129_tab( -tabspec *t /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x11, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x0c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, - 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff - }; /* Structure image */ - - memcpy(t, data, sizeof(data)); /* Initialise the structure */ -} - -/* 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 = 5 - Input channel 0 bits = 16 - Input channel 0 increment = 5 - Input channel 1 bits = 16 - Input channel 1 increment = 5 - Input channel 2 bits = 16 - Input channel 2 increment = 5 - Input channel 3 bits = 16 - Input channel 3 increment = 5 - Input channel 4 bits = 16 - Input channel 4 increment = 5 - Input is channel interleaved - Input channels are separate words - Input value extraction is done in input table lookup - - Output channels per pixel = 6 - Output channel 0 bits = 16 - Output channel 0 increment = 6 - Output channel 1 bits = 16 - Output channel 1 increment = 6 - Output channel 2 bits = 16 - Output channel 2 increment = 6 - Output channel 3 bits = 16 - Output channel 3 increment = 6 - Output channel 4 bits = 16 - Output channel 4 increment = 6 - Output channel 5 bits = 16 - Output channel 5 increment = 6 - Output is channel interleaved - - Output channels are separate words - Weight+voffset bits = 32 - Interpolation table index bits = 32 - Interpolation table max resolution = 84 - */ - -/* - 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 <memory.h> -#include "imdi_imp.h" -#define IMDI_INCLUDED -#endif /* IMDI_INCLUDED */ - -#ifndef DEFINED_pointer -#define DEFINED_pointer -typedef unsigned char * pointer; -#endif - -/* Input table interp. index */ -#define IT_IX(p, off) *((unsigned int *)((p) + 0 + (off) * 12)) - -/* Input table input weighting enty */ -#define IT_WE(p, off) *((unsigned int *)((p) + 4 + (off) * 12)) - -/* Input table input offset value enty */ -#define IT_VO(p, off) *((unsigned int *)((p) + 8 + (off) * 12)) - -/* Conditional exchange for sorting */ -#define CEX(A, AA, B, BB) if (A < B) { \ - A ^= B; B ^= A; A ^= B; AA ^= BB; BB ^= AA; AA ^= BB; } - -/* Interpolation multi-dim. table access */ -#define IM_O(off) ((off) * 12) - -/* Interpolation table - get vertex values */ -#define IM_FE(p, v, c) ((unsigned int)*((unsigned short *)((p) + (v) * 4 + (c) * 2))) - -/* Output table indexes */ -#define OT_E(p, off) *((unsigned short *)((p) + (off) * 2)) - -static void -imdi_k130( -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 short *ip0 = (unsigned short *)inp[0]; - unsigned short *op0 = (unsigned short *)outp[0]; - unsigned short *ep = ip0 + npix * 5 ; - pointer it0 = (pointer)p->in_tables[0]; - pointer it1 = (pointer)p->in_tables[1]; - pointer it2 = (pointer)p->in_tables[2]; - pointer it3 = (pointer)p->in_tables[3]; - pointer it4 = (pointer)p->in_tables[4]; - pointer ot0 = (pointer)p->out_tables[0]; - pointer ot1 = (pointer)p->out_tables[1]; - pointer ot2 = (pointer)p->out_tables[2]; - pointer ot3 = (pointer)p->out_tables[3]; - pointer ot4 = (pointer)p->out_tables[4]; - pointer ot5 = (pointer)p->out_tables[5]; - pointer im_base = (pointer)p->im_table; - - for(;ip0 < ep; ip0 += 5, op0 += 6) { - unsigned int ova0; /* Output value accumulator */ - unsigned int ova1; /* Output value accumulator */ - unsigned int ova2; /* Output value accumulator */ - unsigned int ova3; /* Output value accumulator */ - unsigned int ova4; /* Output value accumulator */ - unsigned int ova5; /* Output value accumulator */ - { - pointer imp; - unsigned int we0; /* Weighting value variable */ - unsigned int vo0; /* Vertex offset variable */ - unsigned int we1; /* Weighting value variable */ - unsigned int vo1; /* Vertex offset variable */ - unsigned int we2; /* Weighting value variable */ - unsigned int vo2; /* Vertex offset variable */ - unsigned int we3; /* Weighting value variable */ - unsigned int vo3; /* Vertex offset variable */ - unsigned int we4; /* Weighting value variable */ - unsigned int vo4; /* Vertex offset variable */ - { - unsigned int ti_i; /* Interpolation index variable */ - - ti_i = IT_IX(it0, ip0[0]); - we0 = IT_WE(it0, ip0[0]); - vo0 = IT_VO(it0, ip0[0]); - ti_i += IT_IX(it1, ip0[1]); - we1 = IT_WE(it1, ip0[1]); - vo1 = IT_VO(it1, ip0[1]); - ti_i += IT_IX(it2, ip0[2]); - we2 = IT_WE(it2, ip0[2]); - vo2 = IT_VO(it2, ip0[2]); - ti_i += IT_IX(it3, ip0[3]); - we3 = IT_WE(it3, ip0[3]); - vo3 = IT_VO(it3, ip0[3]); - ti_i += IT_IX(it4, ip0[4]); - we4 = IT_WE(it4, ip0[4]); - vo4 = IT_VO(it4, ip0[4]); - - imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */ - - /* Sort weighting values and vertex offset values */ - CEX(we0, vo0, we1, vo1); - CEX(we0, vo0, we2, vo2); - CEX(we0, vo0, we3, vo3); - CEX(we0, vo0, we4, vo4); - CEX(we1, vo1, we2, vo2); - CEX(we1, vo1, we3, vo3); - CEX(we1, vo1, we4, vo4); - CEX(we2, vo2, we3, vo3); - CEX(we2, vo2, we4, vo4); - CEX(we3, vo3, we4, vo4); - } - { - unsigned int vof; /* Vertex offset value */ - unsigned int vwe; /* Vertex weighting */ - - vof = 0; /* First vertex offset is 0 */ - vwe = 65536 - we0; /* Baricentric weighting */ - ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 = IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 = IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - ova5 = IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */ - vof += vo0; /* Move to next vertex */ - vwe = we0 - we1; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */ - vof += vo1; /* Move to next vertex */ - vwe = we1 - we2; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */ - vof += vo2; /* Move to next vertex */ - vwe = we2 - we3; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */ - vof += vo3; /* Move to next vertex */ - vwe = we3 - we4; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */ - vof += vo4; /* Move to next vertex */ - vwe = we4; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */ - } - } - { - unsigned int oti; /* Vertex offset value */ - oti = ((ova0 >> 16) & 0xffff); /* Extract integer part of result */ - op0[0] = OT_E(ot0, oti); /* Write result */ - oti = ((ova1 >> 16) & 0xffff); /* Extract integer part of result */ - op0[1] = OT_E(ot1, oti); /* Write result */ - oti = ((ova2 >> 16) & 0xffff); /* Extract integer part of result */ - op0[2] = OT_E(ot2, oti); /* Write result */ - oti = ((ova3 >> 16) & 0xffff); /* Extract integer part of result */ - op0[3] = OT_E(ot3, oti); /* Write result */ - oti = ((ova4 >> 16) & 0xffff); /* Extract integer part of result */ - op0[4] = OT_E(ot4, oti); /* Write result */ - oti = ((ova5 >> 16) & 0xffff); /* Extract integer part of result */ - op0[5] = OT_E(ot5, oti); /* Write result */ - } - } -} -#undef IT_WE -#undef IT_VO -#undef IT_IX -#undef CEX -#undef IM_O -#undef IM_FE -#undef OT_E - -static void -imdi_k130_gen( -genspec *g /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x10, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x54, 0x00, 0x00, 0x00, 0x00, 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, 0x04, 0x08, - 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08, - 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7, - 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7, - 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08, - 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00, - 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7, - 0x2c, 0xf3, 0xdc, 0xb7, 0x35, 0x5f, 0x36, 0x5f, - 0x69, 0x31, 0x36, 0x5f, 0x69, 0x31, 0x36, 0x5f, - 0x66, 0x00, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00, - 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf, - 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08, - 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf, - 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x33, - 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01, - 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7, - 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7, - 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08, - 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08, - 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf, - 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7, - 0x00, 0xf0, 0x04, 0x08 - }; /* Structure image */ - - memcpy(g, data, sizeof(data)); /* Initialise the structure */ -} - -static void -imdi_k130_tab( -tabspec *t /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x0c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, - 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff - }; /* Structure image */ - - memcpy(t, data, sizeof(data)); /* Initialise the structure */ -} - -/* 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 = 6 - Input channel 0 bits = 16 - Input channel 0 increment = 6 - Input channel 1 bits = 16 - Input channel 1 increment = 6 - Input channel 2 bits = 16 - Input channel 2 increment = 6 - Input channel 3 bits = 16 - Input channel 3 increment = 6 - Input channel 4 bits = 16 - Input channel 4 increment = 6 - Input channel 5 bits = 16 - Input channel 5 increment = 6 - Input is channel interleaved - Input channels are separate words - Input value extraction is done in input table lookup - - Output channels per pixel = 6 - Output channel 0 bits = 16 - Output channel 0 increment = 6 - Output channel 1 bits = 16 - Output channel 1 increment = 6 - Output channel 2 bits = 16 - Output channel 2 increment = 6 - Output channel 3 bits = 16 - Output channel 3 increment = 6 - Output channel 4 bits = 16 - Output channel 4 increment = 6 - Output channel 5 bits = 16 - Output channel 5 increment = 6 - Output is channel interleaved - - Output channels are separate words - Weight+voffset bits = 32 - Interpolation table index bits = 32 - Interpolation table max resolution = 40 - */ - -/* - 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 <memory.h> -#include "imdi_imp.h" -#define IMDI_INCLUDED -#endif /* IMDI_INCLUDED */ - -#ifndef DEFINED_pointer -#define DEFINED_pointer -typedef unsigned char * pointer; -#endif - -/* Input table interp. index */ -#define IT_IX(p, off) *((unsigned int *)((p) + 0 + (off) * 12)) - -/* Input table input weighting enty */ -#define IT_WE(p, off) *((unsigned int *)((p) + 4 + (off) * 12)) - -/* Input table input offset value enty */ -#define IT_VO(p, off) *((unsigned int *)((p) + 8 + (off) * 12)) - -/* Conditional exchange for sorting */ -#define CEX(A, AA, B, BB) if (A < B) { \ - A ^= B; B ^= A; A ^= B; AA ^= BB; BB ^= AA; AA ^= BB; } - -/* Interpolation multi-dim. table access */ -#define IM_O(off) ((off) * 12) - -/* Interpolation table - get vertex values */ -#define IM_FE(p, v, c) ((unsigned int)*((unsigned short *)((p) + (v) * 4 + (c) * 2))) - -/* Output table indexes */ -#define OT_E(p, off) *((unsigned short *)((p) + (off) * 2)) - -static void -imdi_k131( -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 short *ip0 = (unsigned short *)inp[0]; - unsigned short *op0 = (unsigned short *)outp[0]; - unsigned short *ep = ip0 + npix * 6 ; - pointer it0 = (pointer)p->in_tables[0]; - pointer it1 = (pointer)p->in_tables[1]; - pointer it2 = (pointer)p->in_tables[2]; - pointer it3 = (pointer)p->in_tables[3]; - pointer it4 = (pointer)p->in_tables[4]; - pointer it5 = (pointer)p->in_tables[5]; - pointer ot0 = (pointer)p->out_tables[0]; - pointer ot1 = (pointer)p->out_tables[1]; - pointer ot2 = (pointer)p->out_tables[2]; - pointer ot3 = (pointer)p->out_tables[3]; - pointer ot4 = (pointer)p->out_tables[4]; - pointer ot5 = (pointer)p->out_tables[5]; - pointer im_base = (pointer)p->im_table; - - for(;ip0 < ep; ip0 += 6, op0 += 6) { - unsigned int ova0; /* Output value accumulator */ - unsigned int ova1; /* Output value accumulator */ - unsigned int ova2; /* Output value accumulator */ - unsigned int ova3; /* Output value accumulator */ - unsigned int ova4; /* Output value accumulator */ - unsigned int ova5; /* Output value accumulator */ - { - pointer imp; - unsigned int we0; /* Weighting value variable */ - unsigned int vo0; /* Vertex offset variable */ - unsigned int we1; /* Weighting value variable */ - unsigned int vo1; /* Vertex offset variable */ - unsigned int we2; /* Weighting value variable */ - unsigned int vo2; /* Vertex offset variable */ - unsigned int we3; /* Weighting value variable */ - unsigned int vo3; /* Vertex offset variable */ - unsigned int we4; /* Weighting value variable */ - unsigned int vo4; /* Vertex offset variable */ - unsigned int we5; /* Weighting value variable */ - unsigned int vo5; /* Vertex offset variable */ - { - unsigned int ti_i; /* Interpolation index variable */ - - ti_i = IT_IX(it0, ip0[0]); - we0 = IT_WE(it0, ip0[0]); - vo0 = IT_VO(it0, ip0[0]); - ti_i += IT_IX(it1, ip0[1]); - we1 = IT_WE(it1, ip0[1]); - vo1 = IT_VO(it1, ip0[1]); - ti_i += IT_IX(it2, ip0[2]); - we2 = IT_WE(it2, ip0[2]); - vo2 = IT_VO(it2, ip0[2]); - ti_i += IT_IX(it3, ip0[3]); - we3 = IT_WE(it3, ip0[3]); - vo3 = IT_VO(it3, ip0[3]); - ti_i += IT_IX(it4, ip0[4]); - we4 = IT_WE(it4, ip0[4]); - vo4 = IT_VO(it4, ip0[4]); - ti_i += IT_IX(it5, ip0[5]); - we5 = IT_WE(it5, ip0[5]); - vo5 = IT_VO(it5, ip0[5]); - - imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */ - - /* Sort weighting values and vertex offset values */ - CEX(we0, vo0, we1, vo1); - CEX(we0, vo0, we2, vo2); - CEX(we0, vo0, we3, vo3); - CEX(we0, vo0, we4, vo4); - CEX(we0, vo0, we5, vo5); - CEX(we1, vo1, we2, vo2); - CEX(we1, vo1, we3, vo3); - CEX(we1, vo1, we4, vo4); - CEX(we1, vo1, we5, vo5); - CEX(we2, vo2, we3, vo3); - CEX(we2, vo2, we4, vo4); - CEX(we2, vo2, we5, vo5); - CEX(we3, vo3, we4, vo4); - CEX(we3, vo3, we5, vo5); - CEX(we4, vo4, we5, vo5); - } - { - unsigned int vof; /* Vertex offset value */ - unsigned int vwe; /* Vertex weighting */ - - vof = 0; /* First vertex offset is 0 */ - vwe = 65536 - we0; /* Baricentric weighting */ - ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 = IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 = IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - ova5 = IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */ - vof += vo0; /* Move to next vertex */ - vwe = we0 - we1; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */ - vof += vo1; /* Move to next vertex */ - vwe = we1 - we2; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */ - vof += vo2; /* Move to next vertex */ - vwe = we2 - we3; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */ - vof += vo3; /* Move to next vertex */ - vwe = we3 - we4; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */ - vof += vo4; /* Move to next vertex */ - vwe = we4 - we5; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */ - vof += vo5; /* Move to next vertex */ - vwe = we5; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */ - } - } - { - unsigned int oti; /* Vertex offset value */ - oti = ((ova0 >> 16) & 0xffff); /* Extract integer part of result */ - op0[0] = OT_E(ot0, oti); /* Write result */ - oti = ((ova1 >> 16) & 0xffff); /* Extract integer part of result */ - op0[1] = OT_E(ot1, oti); /* Write result */ - oti = ((ova2 >> 16) & 0xffff); /* Extract integer part of result */ - op0[2] = OT_E(ot2, oti); /* Write result */ - oti = ((ova3 >> 16) & 0xffff); /* Extract integer part of result */ - op0[3] = OT_E(ot3, oti); /* Write result */ - oti = ((ova4 >> 16) & 0xffff); /* Extract integer part of result */ - op0[4] = OT_E(ot4, oti); /* Write result */ - oti = ((ova5 >> 16) & 0xffff); /* Extract integer part of result */ - op0[5] = OT_E(ot5, oti); /* Write result */ - } - } -} -#undef IT_WE -#undef IT_VO -#undef IT_IX -#undef CEX -#undef IM_O -#undef IM_FE -#undef OT_E - -static void -imdi_k131_gen( -genspec *g /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x10, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x28, 0x00, 0x00, 0x00, 0x00, 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, 0x04, 0x08, - 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08, - 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7, - 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7, - 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08, - 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00, - 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7, - 0x2c, 0xf3, 0xdc, 0xb7, 0x36, 0x5f, 0x36, 0x5f, - 0x69, 0x31, 0x36, 0x5f, 0x69, 0x31, 0x36, 0x5f, - 0x66, 0x00, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00, - 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf, - 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08, - 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf, - 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x33, - 0x31, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01, - 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7, - 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7, - 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08, - 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08, - 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf, - 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7, - 0x00, 0xf0, 0x04, 0x08 - }; /* Structure image */ - - memcpy(g, data, sizeof(data)); /* Initialise the structure */ -} - -static void -imdi_k131_tab( -tabspec *t /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x0c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, - 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff - }; /* Structure image */ - - memcpy(t, data, sizeof(data)); /* Initialise the structure */ -} - -/* 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 = 7 - Input channel 0 bits = 16 - Input channel 0 increment = 7 - Input channel 1 bits = 16 - Input channel 1 increment = 7 - Input channel 2 bits = 16 - Input channel 2 increment = 7 - Input channel 3 bits = 16 - Input channel 3 increment = 7 - Input channel 4 bits = 16 - Input channel 4 increment = 7 - Input channel 5 bits = 16 - Input channel 5 increment = 7 - Input channel 6 bits = 16 - Input channel 6 increment = 7 - Input is channel interleaved - Input channels are separate words - Input value extraction is done in input table lookup - - Output channels per pixel = 6 - Output channel 0 bits = 16 - Output channel 0 increment = 6 - Output channel 1 bits = 16 - Output channel 1 increment = 6 - Output channel 2 bits = 16 - Output channel 2 increment = 6 - Output channel 3 bits = 16 - Output channel 3 increment = 6 - Output channel 4 bits = 16 - Output channel 4 increment = 6 - Output channel 5 bits = 16 - Output channel 5 increment = 6 - Output is channel interleaved - - Output channels are separate words - Weight+voffset bits = 32 - Interpolation table index bits = 32 - Interpolation table max resolution = 23 - */ - -/* - 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 <memory.h> -#include "imdi_imp.h" -#define IMDI_INCLUDED -#endif /* IMDI_INCLUDED */ - -#ifndef DEFINED_pointer -#define DEFINED_pointer -typedef unsigned char * pointer; -#endif - -/* Input table interp. index */ -#define IT_IX(p, off) *((unsigned int *)((p) + 0 + (off) * 12)) - -/* Input table input weighting enty */ -#define IT_WE(p, off) *((unsigned int *)((p) + 4 + (off) * 12)) - -/* Input table input offset value enty */ -#define IT_VO(p, off) *((unsigned int *)((p) + 8 + (off) * 12)) - -/* Conditional exchange for sorting */ -#define CEX(A, AA, B, BB) if (A < B) { \ - A ^= B; B ^= A; A ^= B; AA ^= BB; BB ^= AA; AA ^= BB; } - -/* Interpolation multi-dim. table access */ -#define IM_O(off) ((off) * 12) - -/* Interpolation table - get vertex values */ -#define IM_FE(p, v, c) ((unsigned int)*((unsigned short *)((p) + (v) * 4 + (c) * 2))) - -/* Output table indexes */ -#define OT_E(p, off) *((unsigned short *)((p) + (off) * 2)) - -static void -imdi_k132( -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 short *ip0 = (unsigned short *)inp[0]; - unsigned short *op0 = (unsigned short *)outp[0]; - unsigned short *ep = ip0 + npix * 7 ; - pointer it0 = (pointer)p->in_tables[0]; - pointer it1 = (pointer)p->in_tables[1]; - pointer it2 = (pointer)p->in_tables[2]; - pointer it3 = (pointer)p->in_tables[3]; - pointer it4 = (pointer)p->in_tables[4]; - pointer it5 = (pointer)p->in_tables[5]; - pointer it6 = (pointer)p->in_tables[6]; - pointer ot0 = (pointer)p->out_tables[0]; - pointer ot1 = (pointer)p->out_tables[1]; - pointer ot2 = (pointer)p->out_tables[2]; - pointer ot3 = (pointer)p->out_tables[3]; - pointer ot4 = (pointer)p->out_tables[4]; - pointer ot5 = (pointer)p->out_tables[5]; - pointer im_base = (pointer)p->im_table; - - for(;ip0 < ep; ip0 += 7, op0 += 6) { - unsigned int ova0; /* Output value accumulator */ - unsigned int ova1; /* Output value accumulator */ - unsigned int ova2; /* Output value accumulator */ - unsigned int ova3; /* Output value accumulator */ - unsigned int ova4; /* Output value accumulator */ - unsigned int ova5; /* Output value accumulator */ - { - pointer imp; - unsigned int we0; /* Weighting value variable */ - unsigned int vo0; /* Vertex offset variable */ - unsigned int we1; /* Weighting value variable */ - unsigned int vo1; /* Vertex offset variable */ - unsigned int we2; /* Weighting value variable */ - unsigned int vo2; /* Vertex offset variable */ - unsigned int we3; /* Weighting value variable */ - unsigned int vo3; /* Vertex offset variable */ - unsigned int we4; /* Weighting value variable */ - unsigned int vo4; /* Vertex offset variable */ - unsigned int we5; /* Weighting value variable */ - unsigned int vo5; /* Vertex offset variable */ - unsigned int we6; /* Weighting value variable */ - unsigned int vo6; /* Vertex offset variable */ - { - unsigned int ti_i; /* Interpolation index variable */ - - ti_i = IT_IX(it0, ip0[0]); - we0 = IT_WE(it0, ip0[0]); - vo0 = IT_VO(it0, ip0[0]); - ti_i += IT_IX(it1, ip0[1]); - we1 = IT_WE(it1, ip0[1]); - vo1 = IT_VO(it1, ip0[1]); - ti_i += IT_IX(it2, ip0[2]); - we2 = IT_WE(it2, ip0[2]); - vo2 = IT_VO(it2, ip0[2]); - ti_i += IT_IX(it3, ip0[3]); - we3 = IT_WE(it3, ip0[3]); - vo3 = IT_VO(it3, ip0[3]); - ti_i += IT_IX(it4, ip0[4]); - we4 = IT_WE(it4, ip0[4]); - vo4 = IT_VO(it4, ip0[4]); - ti_i += IT_IX(it5, ip0[5]); - we5 = IT_WE(it5, ip0[5]); - vo5 = IT_VO(it5, ip0[5]); - ti_i += IT_IX(it6, ip0[6]); - we6 = IT_WE(it6, ip0[6]); - vo6 = IT_VO(it6, ip0[6]); - - imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */ - - /* Sort weighting values and vertex offset values */ - CEX(we0, vo0, we1, vo1); - CEX(we0, vo0, we2, vo2); - CEX(we0, vo0, we3, vo3); - CEX(we0, vo0, we4, vo4); - CEX(we0, vo0, we5, vo5); - CEX(we0, vo0, we6, vo6); - CEX(we1, vo1, we2, vo2); - CEX(we1, vo1, we3, vo3); - CEX(we1, vo1, we4, vo4); - CEX(we1, vo1, we5, vo5); - CEX(we1, vo1, we6, vo6); - CEX(we2, vo2, we3, vo3); - CEX(we2, vo2, we4, vo4); - CEX(we2, vo2, we5, vo5); - CEX(we2, vo2, we6, vo6); - CEX(we3, vo3, we4, vo4); - CEX(we3, vo3, we5, vo5); - CEX(we3, vo3, we6, vo6); - CEX(we4, vo4, we5, vo5); - CEX(we4, vo4, we6, vo6); - CEX(we5, vo5, we6, vo6); - } - { - unsigned int vof; /* Vertex offset value */ - unsigned int vwe; /* Vertex weighting */ - - vof = 0; /* First vertex offset is 0 */ - vwe = 65536 - we0; /* Baricentric weighting */ - ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 = IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 = IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - ova5 = IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */ - vof += vo0; /* Move to next vertex */ - vwe = we0 - we1; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */ - vof += vo1; /* Move to next vertex */ - vwe = we1 - we2; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */ - vof += vo2; /* Move to next vertex */ - vwe = we2 - we3; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */ - vof += vo3; /* Move to next vertex */ - vwe = we3 - we4; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */ - vof += vo4; /* Move to next vertex */ - vwe = we4 - we5; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */ - vof += vo5; /* Move to next vertex */ - vwe = we5 - we6; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */ - vof += vo6; /* Move to next vertex */ - vwe = we6; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */ - } - } - { - unsigned int oti; /* Vertex offset value */ - oti = ((ova0 >> 16) & 0xffff); /* Extract integer part of result */ - op0[0] = OT_E(ot0, oti); /* Write result */ - oti = ((ova1 >> 16) & 0xffff); /* Extract integer part of result */ - op0[1] = OT_E(ot1, oti); /* Write result */ - oti = ((ova2 >> 16) & 0xffff); /* Extract integer part of result */ - op0[2] = OT_E(ot2, oti); /* Write result */ - oti = ((ova3 >> 16) & 0xffff); /* Extract integer part of result */ - op0[3] = OT_E(ot3, oti); /* Write result */ - oti = ((ova4 >> 16) & 0xffff); /* Extract integer part of result */ - op0[4] = OT_E(ot4, oti); /* Write result */ - oti = ((ova5 >> 16) & 0xffff); /* Extract integer part of result */ - op0[5] = OT_E(ot5, oti); /* Write result */ - } - } -} -#undef IT_WE -#undef IT_VO -#undef IT_IX -#undef CEX -#undef IM_O -#undef IM_FE -#undef OT_E - -static void -imdi_k132_gen( -genspec *g /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x10, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x17, 0x00, 0x00, 0x00, 0x00, 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, 0x04, 0x08, - 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08, - 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7, - 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7, - 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08, - 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00, - 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7, - 0x2c, 0xf3, 0xdc, 0xb7, 0x37, 0x5f, 0x36, 0x5f, - 0x69, 0x31, 0x36, 0x5f, 0x69, 0x31, 0x36, 0x5f, - 0x66, 0x00, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00, - 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf, - 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08, - 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf, - 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x33, - 0x32, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01, - 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7, - 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7, - 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08, - 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08, - 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf, - 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7, - 0x00, 0xf0, 0x04, 0x08 - }; /* Structure image */ - - memcpy(g, data, sizeof(data)); /* Initialise the structure */ -} - -static void -imdi_k132_tab( -tabspec *t /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x0c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, - 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff - }; /* Structure image */ - - memcpy(t, data, sizeof(data)); /* Initialise the structure */ -} - -/* 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 = 8 - Input channel 0 bits = 16 - Input channel 0 increment = 8 - Input channel 1 bits = 16 - Input channel 1 increment = 8 - Input channel 2 bits = 16 - Input channel 2 increment = 8 - Input channel 3 bits = 16 - Input channel 3 increment = 8 - Input channel 4 bits = 16 - Input channel 4 increment = 8 - Input channel 5 bits = 16 - Input channel 5 increment = 8 - Input channel 6 bits = 16 - Input channel 6 increment = 8 - Input channel 7 bits = 16 - Input channel 7 increment = 8 - Input is channel interleaved - Input channels are separate words - Input value extraction is done in input table lookup - - Output channels per pixel = 6 - Output channel 0 bits = 16 - Output channel 0 increment = 6 - Output channel 1 bits = 16 - Output channel 1 increment = 6 - Output channel 2 bits = 16 - Output channel 2 increment = 6 - Output channel 3 bits = 16 - Output channel 3 increment = 6 - Output channel 4 bits = 16 - Output channel 4 increment = 6 - Output channel 5 bits = 16 - Output channel 5 increment = 6 - Output is channel interleaved - - Output channels are separate words - Weight+voffset bits = 32 - Interpolation table index bits = 32 - Interpolation table max resolution = 16 - */ - -/* - 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 <memory.h> -#include "imdi_imp.h" -#define IMDI_INCLUDED -#endif /* IMDI_INCLUDED */ - -#ifndef DEFINED_pointer -#define DEFINED_pointer -typedef unsigned char * pointer; -#endif - -/* Input table interp. index */ -#define IT_IX(p, off) *((unsigned int *)((p) + 0 + (off) * 12)) - -/* Input table input weighting enty */ -#define IT_WE(p, off) *((unsigned int *)((p) + 4 + (off) * 12)) - -/* Input table input offset value enty */ -#define IT_VO(p, off) *((unsigned int *)((p) + 8 + (off) * 12)) - -/* Conditional exchange for sorting */ -#define CEX(A, AA, B, BB) if (A < B) { \ - A ^= B; B ^= A; A ^= B; AA ^= BB; BB ^= AA; AA ^= BB; } - -/* Interpolation multi-dim. table access */ -#define IM_O(off) ((off) * 12) - -/* Interpolation table - get vertex values */ -#define IM_FE(p, v, c) ((unsigned int)*((unsigned short *)((p) + (v) * 4 + (c) * 2))) - -/* Output table indexes */ -#define OT_E(p, off) *((unsigned short *)((p) + (off) * 2)) - -static void -imdi_k133( -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 short *ip0 = (unsigned short *)inp[0]; - unsigned short *op0 = (unsigned short *)outp[0]; - unsigned short *ep = ip0 + npix * 8 ; - pointer it0 = (pointer)p->in_tables[0]; - pointer it1 = (pointer)p->in_tables[1]; - pointer it2 = (pointer)p->in_tables[2]; - pointer it3 = (pointer)p->in_tables[3]; - pointer it4 = (pointer)p->in_tables[4]; - pointer it5 = (pointer)p->in_tables[5]; - pointer it6 = (pointer)p->in_tables[6]; - pointer it7 = (pointer)p->in_tables[7]; - pointer ot0 = (pointer)p->out_tables[0]; - pointer ot1 = (pointer)p->out_tables[1]; - pointer ot2 = (pointer)p->out_tables[2]; - pointer ot3 = (pointer)p->out_tables[3]; - pointer ot4 = (pointer)p->out_tables[4]; - pointer ot5 = (pointer)p->out_tables[5]; - pointer im_base = (pointer)p->im_table; - - for(;ip0 < ep; ip0 += 8, op0 += 6) { - unsigned int ova0; /* Output value accumulator */ - unsigned int ova1; /* Output value accumulator */ - unsigned int ova2; /* Output value accumulator */ - unsigned int ova3; /* Output value accumulator */ - unsigned int ova4; /* Output value accumulator */ - unsigned int ova5; /* Output value accumulator */ - { - pointer imp; - unsigned int we0; /* Weighting value variable */ - unsigned int vo0; /* Vertex offset variable */ - unsigned int we1; /* Weighting value variable */ - unsigned int vo1; /* Vertex offset variable */ - unsigned int we2; /* Weighting value variable */ - unsigned int vo2; /* Vertex offset variable */ - unsigned int we3; /* Weighting value variable */ - unsigned int vo3; /* Vertex offset variable */ - unsigned int we4; /* Weighting value variable */ - unsigned int vo4; /* Vertex offset variable */ - unsigned int we5; /* Weighting value variable */ - unsigned int vo5; /* Vertex offset variable */ - unsigned int we6; /* Weighting value variable */ - unsigned int vo6; /* Vertex offset variable */ - unsigned int we7; /* Weighting value variable */ - unsigned int vo7; /* Vertex offset variable */ - { - unsigned int ti_i; /* Interpolation index variable */ - - ti_i = IT_IX(it0, ip0[0]); - we0 = IT_WE(it0, ip0[0]); - vo0 = IT_VO(it0, ip0[0]); - ti_i += IT_IX(it1, ip0[1]); - we1 = IT_WE(it1, ip0[1]); - vo1 = IT_VO(it1, ip0[1]); - ti_i += IT_IX(it2, ip0[2]); - we2 = IT_WE(it2, ip0[2]); - vo2 = IT_VO(it2, ip0[2]); - ti_i += IT_IX(it3, ip0[3]); - we3 = IT_WE(it3, ip0[3]); - vo3 = IT_VO(it3, ip0[3]); - ti_i += IT_IX(it4, ip0[4]); - we4 = IT_WE(it4, ip0[4]); - vo4 = IT_VO(it4, ip0[4]); - ti_i += IT_IX(it5, ip0[5]); - we5 = IT_WE(it5, ip0[5]); - vo5 = IT_VO(it5, ip0[5]); - ti_i += IT_IX(it6, ip0[6]); - we6 = IT_WE(it6, ip0[6]); - vo6 = IT_VO(it6, ip0[6]); - ti_i += IT_IX(it7, ip0[7]); - we7 = IT_WE(it7, ip0[7]); - vo7 = IT_VO(it7, ip0[7]); - - imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */ - - /* Sort weighting values and vertex offset values */ - CEX(we0, vo0, we1, vo1); - CEX(we0, vo0, we2, vo2); - CEX(we0, vo0, we3, vo3); - CEX(we0, vo0, we4, vo4); - CEX(we0, vo0, we5, vo5); - CEX(we0, vo0, we6, vo6); - CEX(we0, vo0, we7, vo7); - CEX(we1, vo1, we2, vo2); - CEX(we1, vo1, we3, vo3); - CEX(we1, vo1, we4, vo4); - CEX(we1, vo1, we5, vo5); - CEX(we1, vo1, we6, vo6); - CEX(we1, vo1, we7, vo7); - CEX(we2, vo2, we3, vo3); - CEX(we2, vo2, we4, vo4); - CEX(we2, vo2, we5, vo5); - CEX(we2, vo2, we6, vo6); - CEX(we2, vo2, we7, vo7); - CEX(we3, vo3, we4, vo4); - CEX(we3, vo3, we5, vo5); - CEX(we3, vo3, we6, vo6); - CEX(we3, vo3, we7, vo7); - CEX(we4, vo4, we5, vo5); - CEX(we4, vo4, we6, vo6); - CEX(we4, vo4, we7, vo7); - CEX(we5, vo5, we6, vo6); - CEX(we5, vo5, we7, vo7); - CEX(we6, vo6, we7, vo7); - } - { - unsigned int vof; /* Vertex offset value */ - unsigned int vwe; /* Vertex weighting */ - - vof = 0; /* First vertex offset is 0 */ - vwe = 65536 - we0; /* Baricentric weighting */ - ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 = IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 = IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - ova5 = IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */ - vof += vo0; /* Move to next vertex */ - vwe = we0 - we1; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */ - vof += vo1; /* Move to next vertex */ - vwe = we1 - we2; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */ - vof += vo2; /* Move to next vertex */ - vwe = we2 - we3; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */ - vof += vo3; /* Move to next vertex */ - vwe = we3 - we4; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */ - vof += vo4; /* Move to next vertex */ - vwe = we4 - we5; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */ - vof += vo5; /* Move to next vertex */ - vwe = we5 - we6; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */ - vof += vo6; /* Move to next vertex */ - vwe = we6 - we7; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */ - vof += vo7; /* Move to next vertex */ - vwe = we7; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */ - } - } - { - unsigned int oti; /* Vertex offset value */ - oti = ((ova0 >> 16) & 0xffff); /* Extract integer part of result */ - op0[0] = OT_E(ot0, oti); /* Write result */ - oti = ((ova1 >> 16) & 0xffff); /* Extract integer part of result */ - op0[1] = OT_E(ot1, oti); /* Write result */ - oti = ((ova2 >> 16) & 0xffff); /* Extract integer part of result */ - op0[2] = OT_E(ot2, oti); /* Write result */ - oti = ((ova3 >> 16) & 0xffff); /* Extract integer part of result */ - op0[3] = OT_E(ot3, oti); /* Write result */ - oti = ((ova4 >> 16) & 0xffff); /* Extract integer part of result */ - op0[4] = OT_E(ot4, oti); /* Write result */ - oti = ((ova5 >> 16) & 0xffff); /* Extract integer part of result */ - op0[5] = OT_E(ot5, oti); /* Write result */ - } - } -} -#undef IT_WE -#undef IT_VO -#undef IT_IX -#undef CEX -#undef IM_O -#undef IM_FE -#undef OT_E - -static void -imdi_k133_gen( -genspec *g /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x00, 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, 0x04, 0x08, - 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08, - 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7, - 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7, - 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08, - 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00, - 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7, - 0x2c, 0xf3, 0xdc, 0xb7, 0x38, 0x5f, 0x36, 0x5f, - 0x69, 0x31, 0x36, 0x5f, 0x69, 0x31, 0x36, 0x5f, - 0x66, 0x00, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00, - 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf, - 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08, - 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf, - 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x33, - 0x33, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01, - 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7, - 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7, - 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08, - 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08, - 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf, - 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7, - 0x00, 0xf0, 0x04, 0x08 - }; /* Structure image */ - - memcpy(g, data, sizeof(data)); /* Initialise the structure */ -} - -static void -imdi_k133_tab( -tabspec *t /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x0c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, - 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff - }; /* Structure image */ - - memcpy(t, data, sizeof(data)); /* Initialise the structure */ -} - -/* 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 = 16 - 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 = 7 - Output channel 0 bits = 16 - Output channel 0 increment = 7 - Output channel 1 bits = 16 - Output channel 1 increment = 7 - Output channel 2 bits = 16 - Output channel 2 increment = 7 - Output channel 3 bits = 16 - Output channel 3 increment = 7 - Output channel 4 bits = 16 - Output channel 4 increment = 7 - Output channel 5 bits = 16 - Output channel 5 increment = 7 - Output channel 6 bits = 16 - Output channel 6 increment = 7 - Output is channel interleaved - - Output channels are separate words - Weight+voffset bits = 32 - Interpolation table index bits = 10 - Interpolation table max resolution = 1024 - */ - -/* - 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 <memory.h> -#include "imdi_imp.h" -#define IMDI_INCLUDED -#endif /* IMDI_INCLUDED */ - -#ifndef DEFINED_pointer -#define DEFINED_pointer -typedef unsigned char * pointer; -#endif - -/* Input table interp index, weighting and vertex offset */ -#define IT_IT(p, off) *((unsigned int *)((p) + 0 + (off) * 4)) - -/* Conditional exchange for sorting */ -#define CEX(A, B) if (A < B) { A ^= B; B ^= A; A ^= B; } - -/* Interpolation multi-dim. table access */ -#define IM_O(off) ((off) * 14) - -/* Interpolation table - get vertex values */ -#define IM_FE(p, v, c) ((unsigned int)*((unsigned short *)((p) + (v) * 2 + (c) * 2))) - -/* Output table indexes */ -#define OT_E(p, off) *((unsigned short *)((p) + (off) * 2)) - -static void -imdi_k134( -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 short *ip0 = (unsigned short *)inp[0]; - unsigned short *op0 = (unsigned short *)outp[0]; - unsigned short *ep = ip0 + npix * 1 ; - pointer it0 = (pointer)p->in_tables[0]; - pointer ot0 = (pointer)p->out_tables[0]; - pointer ot1 = (pointer)p->out_tables[1]; - pointer ot2 = (pointer)p->out_tables[2]; - pointer ot3 = (pointer)p->out_tables[3]; - pointer ot4 = (pointer)p->out_tables[4]; - pointer ot5 = (pointer)p->out_tables[5]; - pointer ot6 = (pointer)p->out_tables[6]; - pointer im_base = (pointer)p->im_table; - - for(;ip0 < ep; ip0 += 1, op0 += 7) { - unsigned int ova0; /* Output value accumulator */ - unsigned int ova1; /* Output value accumulator */ - unsigned int ova2; /* Output value accumulator */ - unsigned int ova3; /* Output value accumulator */ - unsigned int ova4; /* Output value accumulator */ - unsigned int ova5; /* Output value accumulator */ - unsigned int ova6; /* Output value accumulator */ - { - pointer imp; - unsigned int wo0; /* Weighting value and vertex offset variable */ - { - unsigned int ti; /* Input table entry variable */ - unsigned int ti_i; /* Interpolation index variable */ - - ti = IT_IT(it0, ip0[0]); - wo0 = (ti & 0x3fffff); /* Extract weighting/vertex offset value */ - ti_i = (ti >> 22); /* Extract interpolation table value */ - - imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */ - - /* Sort weighting values and vertex offset values */ - } - { - unsigned int nvof; /* Next vertex offset value */ - unsigned int vof; /* Vertex offset value */ - unsigned int vwe; /* Vertex weighting */ - - vof = 0; /* First vertex offset is 0 */ - nvof = (wo0 & 0x1f); /* Extract offset value */ - wo0 = (wo0 >> 5); /* Extract weighting value */ - vwe = 65536 - wo0; /* Baricentric weighting */ - ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 = IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 = IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - ova5 = IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */ - ova6 = IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - vwe = wo0; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */ - ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */ - } - } - { - unsigned int oti; /* Vertex offset value */ - oti = ((ova0 >> 16) & 0xffff); /* Extract integer part of result */ - op0[0] = OT_E(ot0, oti); /* Write result */ - oti = ((ova1 >> 16) & 0xffff); /* Extract integer part of result */ - op0[1] = OT_E(ot1, oti); /* Write result */ - oti = ((ova2 >> 16) & 0xffff); /* Extract integer part of result */ - op0[2] = OT_E(ot2, oti); /* Write result */ - oti = ((ova3 >> 16) & 0xffff); /* Extract integer part of result */ - op0[3] = OT_E(ot3, oti); /* Write result */ - oti = ((ova4 >> 16) & 0xffff); /* Extract integer part of result */ - op0[4] = OT_E(ot4, oti); /* Write result */ - oti = ((ova5 >> 16) & 0xffff); /* Extract integer part of result */ - op0[5] = OT_E(ot5, oti); /* Write result */ - oti = ((ova6 >> 16) & 0xffff); /* Extract integer part of result */ - op0[6] = OT_E(ot6, oti); /* Write result */ - } - } -} -#undef IT_IT -#undef CEX -#undef IM_O -#undef IM_FE -#undef OT_E - -static void -imdi_k134_gen( -genspec *g /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x04, 0x00, 0x00, 0x00, 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, 0x04, 0x08, - 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08, - 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7, - 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7, - 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08, - 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00, - 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7, - 0x2c, 0xf3, 0xdc, 0xb7, 0x31, 0x5f, 0x37, 0x5f, - 0x69, 0x31, 0x36, 0x5f, 0x69, 0x31, 0x36, 0x5f, - 0x66, 0x00, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00, - 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf, - 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08, - 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf, - 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x33, - 0x34, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01, - 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7, - 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7, - 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08, - 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08, - 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf, - 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7, - 0x00, 0xf0, 0x04, 0x08 - }; /* Structure image */ - - memcpy(g, data, sizeof(data)); /* Initialise the structure */ -} - -static void -imdi_k134_tab( -tabspec *t /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x0a, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x14, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x11, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x0e, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0xdc, 0x60, 0xef, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff - }; /* Structure image */ - - memcpy(t, data, sizeof(data)); /* Initialise the structure */ -} - -/* 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 = 3 - Input channel 0 bits = 16 - Input channel 0 increment = 3 - Input channel 1 bits = 16 - Input channel 1 increment = 3 - Input channel 2 bits = 16 - Input channel 2 increment = 3 - Input is channel interleaved - Input channels are separate words - Input value extraction is done in input table lookup - - Output channels per pixel = 7 - Output channel 0 bits = 16 - Output channel 0 increment = 7 - Output channel 1 bits = 16 - Output channel 1 increment = 7 - Output channel 2 bits = 16 - Output channel 2 increment = 7 - Output channel 3 bits = 16 - Output channel 3 increment = 7 - Output channel 4 bits = 16 - Output channel 4 increment = 7 - Output channel 5 bits = 16 - Output channel 5 increment = 7 - Output channel 6 bits = 16 - Output channel 6 increment = 7 - Output is channel interleaved - - Output channels are separate words - Weight+voffset bits = 32 - Interpolation table index bits = 16 - Interpolation table max resolution = 40 - */ - -/* - 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 <memory.h> -#include "imdi_imp.h" -#define IMDI_INCLUDED -#endif /* IMDI_INCLUDED */ - -#ifndef DEFINED_pointer -#define DEFINED_pointer -typedef unsigned char * pointer; -#endif - -/* Input table interp. index */ -#define IT_IX(p, off) *((unsigned short *)((p) + 0 + (off) * 6)) - -/* Input table input weighting/offset value enty */ -#define IT_WO(p, off) *((unsigned int *)((p) + 2 + (off) * 6)) - -/* Conditional exchange for sorting */ -#define CEX(A, B) if (A < B) { A ^= B; B ^= A; A ^= B; } - -/* Interpolation multi-dim. table access */ -#define IM_O(off) ((off) * 14) - -/* Interpolation table - get vertex values */ -#define IM_FE(p, v, c) ((unsigned int)*((unsigned short *)((p) + (v) * 2 + (c) * 2))) - -/* Output table indexes */ -#define OT_E(p, off) *((unsigned short *)((p) + (off) * 2)) - -static void -imdi_k135( -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 short *ip0 = (unsigned short *)inp[0]; - unsigned short *op0 = (unsigned short *)outp[0]; - unsigned short *ep = ip0 + npix * 3 ; - pointer it0 = (pointer)p->in_tables[0]; - pointer it1 = (pointer)p->in_tables[1]; - pointer it2 = (pointer)p->in_tables[2]; - pointer ot0 = (pointer)p->out_tables[0]; - pointer ot1 = (pointer)p->out_tables[1]; - pointer ot2 = (pointer)p->out_tables[2]; - pointer ot3 = (pointer)p->out_tables[3]; - pointer ot4 = (pointer)p->out_tables[4]; - pointer ot5 = (pointer)p->out_tables[5]; - pointer ot6 = (pointer)p->out_tables[6]; - pointer im_base = (pointer)p->im_table; - - for(;ip0 < ep; ip0 += 3, op0 += 7) { - unsigned int ova0; /* Output value accumulator */ - unsigned int ova1; /* Output value accumulator */ - unsigned int ova2; /* Output value accumulator */ - unsigned int ova3; /* Output value accumulator */ - unsigned int ova4; /* Output value accumulator */ - unsigned int ova5; /* Output value accumulator */ - unsigned int ova6; /* Output value accumulator */ - { - pointer imp; - unsigned int wo0; /* Weighting value and vertex offset variable */ - unsigned int wo1; /* Weighting value and vertex offset variable */ - unsigned int wo2; /* Weighting value and vertex offset variable */ - { - unsigned int ti_i; /* Interpolation index variable */ - - ti_i = IT_IX(it0, ip0[0]); - wo0 = IT_WO(it0, ip0[0]); - ti_i += IT_IX(it1, ip0[1]); - wo1 = IT_WO(it1, ip0[1]); - ti_i += IT_IX(it2, ip0[2]); - wo2 = IT_WO(it2, ip0[2]); - - imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */ - - /* Sort weighting values and vertex offset values */ - CEX(wo0, wo1); - CEX(wo0, wo2); - CEX(wo1, wo2); - } - { - unsigned int nvof; /* Next vertex offset value */ - unsigned int vof; /* Vertex offset value */ - unsigned int vwe; /* Vertex weighting */ - - vof = 0; /* First vertex offset is 0 */ - nvof = (wo0 & 0x7fff); /* Extract offset value */ - wo0 = (wo0 >> 15); /* Extract weighting value */ - vwe = 65536 - wo0; /* Baricentric weighting */ - ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 = IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 = IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - ova5 = IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */ - ova6 = IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo1 & 0x7fff); /* Extract offset value */ - wo1 = (wo1 >> 15); /* Extract weighting value */ - vwe = wo0 - wo1; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */ - ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo2 & 0x7fff); /* Extract offset value */ - wo2 = (wo2 >> 15); /* Extract weighting value */ - vwe = wo1 - wo2; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */ - ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - vwe = wo2; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */ - ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */ - } - } - { - unsigned int oti; /* Vertex offset value */ - oti = ((ova0 >> 16) & 0xffff); /* Extract integer part of result */ - op0[0] = OT_E(ot0, oti); /* Write result */ - oti = ((ova1 >> 16) & 0xffff); /* Extract integer part of result */ - op0[1] = OT_E(ot1, oti); /* Write result */ - oti = ((ova2 >> 16) & 0xffff); /* Extract integer part of result */ - op0[2] = OT_E(ot2, oti); /* Write result */ - oti = ((ova3 >> 16) & 0xffff); /* Extract integer part of result */ - op0[3] = OT_E(ot3, oti); /* Write result */ - oti = ((ova4 >> 16) & 0xffff); /* Extract integer part of result */ - op0[4] = OT_E(ot4, oti); /* Write result */ - oti = ((ova5 >> 16) & 0xffff); /* Extract integer part of result */ - op0[5] = OT_E(ot5, oti); /* Write result */ - oti = ((ova6 >> 16) & 0xffff); /* Extract integer part of result */ - op0[6] = OT_E(ot6, oti); /* Write result */ - } - } -} -#undef IT_WO -#undef IT_IX -#undef CEX -#undef IM_O -#undef IM_FE -#undef OT_E - -static void -imdi_k135_gen( -genspec *g /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x10, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x28, 0x00, 0x00, 0x00, 0x00, 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, 0x04, 0x08, - 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08, - 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7, - 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7, - 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08, - 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00, - 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7, - 0x2c, 0xf3, 0xdc, 0xb7, 0x33, 0x5f, 0x37, 0x5f, - 0x69, 0x31, 0x36, 0x5f, 0x69, 0x31, 0x36, 0x5f, - 0x66, 0x00, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00, - 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf, - 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08, - 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf, - 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x33, - 0x35, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01, - 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7, - 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7, - 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08, - 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08, - 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf, - 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7, - 0x00, 0xf0, 0x04, 0x08 - }; /* Structure image */ - - memcpy(g, data, sizeof(data)); /* Initialise the structure */ -} - -static void -imdi_k135_tab( -tabspec *t /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x11, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x0e, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0xdc, 0x60, 0xef, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff - }; /* Structure image */ - - memcpy(t, data, sizeof(data)); /* Initialise the structure */ -} - -/* 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 = 4 - Input channel 0 bits = 16 - Input channel 0 increment = 4 - Input channel 1 bits = 16 - Input channel 1 increment = 4 - Input channel 2 bits = 16 - Input channel 2 increment = 4 - Input channel 3 bits = 16 - Input channel 3 increment = 4 - Input is channel interleaved - Input channels are separate words - Input value extraction is done in input table lookup - - Output channels per pixel = 7 - Output channel 0 bits = 16 - Output channel 0 increment = 7 - Output channel 1 bits = 16 - Output channel 1 increment = 7 - Output channel 2 bits = 16 - Output channel 2 increment = 7 - Output channel 3 bits = 16 - Output channel 3 increment = 7 - Output channel 4 bits = 16 - Output channel 4 increment = 7 - Output channel 5 bits = 16 - Output channel 5 increment = 7 - Output channel 6 bits = 16 - Output channel 6 increment = 7 - Output is channel interleaved - - Output channels are separate words - Weight+voffset bits = 32 - Interpolation table index bits = 32 - Interpolation table max resolution = 255 - */ - -/* - 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 <memory.h> -#include "imdi_imp.h" -#define IMDI_INCLUDED -#endif /* IMDI_INCLUDED */ - -#ifndef DEFINED_pointer -#define DEFINED_pointer -typedef unsigned char * pointer; -#endif - -/* Input table interp. index */ -#define IT_IX(p, off) *((unsigned int *)((p) + 0 + (off) * 12)) - -/* Input table input weighting enty */ -#define IT_WE(p, off) *((unsigned int *)((p) + 4 + (off) * 12)) - -/* Input table input offset value enty */ -#define IT_VO(p, off) *((unsigned int *)((p) + 8 + (off) * 12)) - -/* Conditional exchange for sorting */ -#define CEX(A, AA, B, BB) if (A < B) { \ - A ^= B; B ^= A; A ^= B; AA ^= BB; BB ^= AA; AA ^= BB; } - -/* Interpolation multi-dim. table access */ -#define IM_O(off) ((off) * 14) - -/* Interpolation table - get vertex values */ -#define IM_FE(p, v, c) ((unsigned int)*((unsigned short *)((p) + (v) * 2 + (c) * 2))) - -/* Output table indexes */ -#define OT_E(p, off) *((unsigned short *)((p) + (off) * 2)) - -static void -imdi_k136( -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 short *ip0 = (unsigned short *)inp[0]; - unsigned short *op0 = (unsigned short *)outp[0]; - unsigned short *ep = ip0 + npix * 4 ; - pointer it0 = (pointer)p->in_tables[0]; - pointer it1 = (pointer)p->in_tables[1]; - pointer it2 = (pointer)p->in_tables[2]; - pointer it3 = (pointer)p->in_tables[3]; - pointer ot0 = (pointer)p->out_tables[0]; - pointer ot1 = (pointer)p->out_tables[1]; - pointer ot2 = (pointer)p->out_tables[2]; - pointer ot3 = (pointer)p->out_tables[3]; - pointer ot4 = (pointer)p->out_tables[4]; - pointer ot5 = (pointer)p->out_tables[5]; - pointer ot6 = (pointer)p->out_tables[6]; - pointer im_base = (pointer)p->im_table; - - for(;ip0 < ep; ip0 += 4, op0 += 7) { - unsigned int ova0; /* Output value accumulator */ - unsigned int ova1; /* Output value accumulator */ - unsigned int ova2; /* Output value accumulator */ - unsigned int ova3; /* Output value accumulator */ - unsigned int ova4; /* Output value accumulator */ - unsigned int ova5; /* Output value accumulator */ - unsigned int ova6; /* Output value accumulator */ - { - pointer imp; - unsigned int we0; /* Weighting value variable */ - unsigned int vo0; /* Vertex offset variable */ - unsigned int we1; /* Weighting value variable */ - unsigned int vo1; /* Vertex offset variable */ - unsigned int we2; /* Weighting value variable */ - unsigned int vo2; /* Vertex offset variable */ - unsigned int we3; /* Weighting value variable */ - unsigned int vo3; /* Vertex offset variable */ - { - unsigned int ti_i; /* Interpolation index variable */ - - ti_i = IT_IX(it0, ip0[0]); - we0 = IT_WE(it0, ip0[0]); - vo0 = IT_VO(it0, ip0[0]); - ti_i += IT_IX(it1, ip0[1]); - we1 = IT_WE(it1, ip0[1]); - vo1 = IT_VO(it1, ip0[1]); - ti_i += IT_IX(it2, ip0[2]); - we2 = IT_WE(it2, ip0[2]); - vo2 = IT_VO(it2, ip0[2]); - ti_i += IT_IX(it3, ip0[3]); - we3 = IT_WE(it3, ip0[3]); - vo3 = IT_VO(it3, ip0[3]); - - imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */ - - /* Sort weighting values and vertex offset values */ - CEX(we0, vo0, we1, vo1); - CEX(we0, vo0, we2, vo2); - CEX(we0, vo0, we3, vo3); - CEX(we1, vo1, we2, vo2); - CEX(we1, vo1, we3, vo3); - CEX(we2, vo2, we3, vo3); - } - { - unsigned int vof; /* Vertex offset value */ - unsigned int vwe; /* Vertex weighting */ - - vof = 0; /* First vertex offset is 0 */ - vwe = 65536 - we0; /* Baricentric weighting */ - ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 = IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 = IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - ova5 = IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */ - ova6 = IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */ - vof += vo0; /* Move to next vertex */ - vwe = we0 - we1; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */ - ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */ - vof += vo1; /* Move to next vertex */ - vwe = we1 - we2; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */ - ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */ - vof += vo2; /* Move to next vertex */ - vwe = we2 - we3; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */ - ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */ - vof += vo3; /* Move to next vertex */ - vwe = we3; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */ - ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */ - } - } - { - unsigned int oti; /* Vertex offset value */ - oti = ((ova0 >> 16) & 0xffff); /* Extract integer part of result */ - op0[0] = OT_E(ot0, oti); /* Write result */ - oti = ((ova1 >> 16) & 0xffff); /* Extract integer part of result */ - op0[1] = OT_E(ot1, oti); /* Write result */ - oti = ((ova2 >> 16) & 0xffff); /* Extract integer part of result */ - op0[2] = OT_E(ot2, oti); /* Write result */ - oti = ((ova3 >> 16) & 0xffff); /* Extract integer part of result */ - op0[3] = OT_E(ot3, oti); /* Write result */ - oti = ((ova4 >> 16) & 0xffff); /* Extract integer part of result */ - op0[4] = OT_E(ot4, oti); /* Write result */ - oti = ((ova5 >> 16) & 0xffff); /* Extract integer part of result */ - op0[5] = OT_E(ot5, oti); /* Write result */ - oti = ((ova6 >> 16) & 0xffff); /* Extract integer part of result */ - op0[6] = OT_E(ot6, oti); /* Write result */ - } - } -} -#undef IT_WE -#undef IT_VO -#undef IT_IX -#undef CEX -#undef IM_O -#undef IM_FE -#undef OT_E - -static void -imdi_k136_gen( -genspec *g /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x10, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0xff, 0x00, 0x00, 0x00, 0x00, 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, 0x04, 0x08, - 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08, - 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7, - 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7, - 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08, - 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00, - 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7, - 0x2c, 0xf3, 0xdc, 0xb7, 0x34, 0x5f, 0x37, 0x5f, - 0x69, 0x31, 0x36, 0x5f, 0x69, 0x31, 0x36, 0x5f, - 0x66, 0x00, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00, - 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf, - 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08, - 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf, - 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x33, - 0x36, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01, - 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7, - 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7, - 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08, - 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08, - 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf, - 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7, - 0x00, 0xf0, 0x04, 0x08 - }; /* Structure image */ - - memcpy(g, data, sizeof(data)); /* Initialise the structure */ -} - -static void -imdi_k136_tab( -tabspec *t /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x0e, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0xdc, 0x60, 0xef, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff - }; /* Structure image */ - - memcpy(t, data, sizeof(data)); /* Initialise the structure */ -} - -/* 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 = 5 - Input channel 0 bits = 16 - Input channel 0 increment = 5 - Input channel 1 bits = 16 - Input channel 1 increment = 5 - Input channel 2 bits = 16 - Input channel 2 increment = 5 - Input channel 3 bits = 16 - Input channel 3 increment = 5 - Input channel 4 bits = 16 - Input channel 4 increment = 5 - Input is channel interleaved - Input channels are separate words - Input value extraction is done in input table lookup - - Output channels per pixel = 7 - Output channel 0 bits = 16 - Output channel 0 increment = 7 - Output channel 1 bits = 16 - Output channel 1 increment = 7 - Output channel 2 bits = 16 - Output channel 2 increment = 7 - Output channel 3 bits = 16 - Output channel 3 increment = 7 - Output channel 4 bits = 16 - Output channel 4 increment = 7 - Output channel 5 bits = 16 - Output channel 5 increment = 7 - Output channel 6 bits = 16 - Output channel 6 increment = 7 - Output is channel interleaved - - Output channels are separate words - Weight+voffset bits = 32 - Interpolation table index bits = 32 - Interpolation table max resolution = 84 - */ - -/* - 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 <memory.h> -#include "imdi_imp.h" -#define IMDI_INCLUDED -#endif /* IMDI_INCLUDED */ - -#ifndef DEFINED_pointer -#define DEFINED_pointer -typedef unsigned char * pointer; -#endif - -/* Input table interp. index */ -#define IT_IX(p, off) *((unsigned int *)((p) + 0 + (off) * 12)) - -/* Input table input weighting enty */ -#define IT_WE(p, off) *((unsigned int *)((p) + 4 + (off) * 12)) - -/* Input table input offset value enty */ -#define IT_VO(p, off) *((unsigned int *)((p) + 8 + (off) * 12)) - -/* Conditional exchange for sorting */ -#define CEX(A, AA, B, BB) if (A < B) { \ - A ^= B; B ^= A; A ^= B; AA ^= BB; BB ^= AA; AA ^= BB; } - -/* Interpolation multi-dim. table access */ -#define IM_O(off) ((off) * 14) - -/* Interpolation table - get vertex values */ -#define IM_FE(p, v, c) ((unsigned int)*((unsigned short *)((p) + (v) * 2 + (c) * 2))) - -/* Output table indexes */ -#define OT_E(p, off) *((unsigned short *)((p) + (off) * 2)) - -static void -imdi_k137( -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 short *ip0 = (unsigned short *)inp[0]; - unsigned short *op0 = (unsigned short *)outp[0]; - unsigned short *ep = ip0 + npix * 5 ; - pointer it0 = (pointer)p->in_tables[0]; - pointer it1 = (pointer)p->in_tables[1]; - pointer it2 = (pointer)p->in_tables[2]; - pointer it3 = (pointer)p->in_tables[3]; - pointer it4 = (pointer)p->in_tables[4]; - pointer ot0 = (pointer)p->out_tables[0]; - pointer ot1 = (pointer)p->out_tables[1]; - pointer ot2 = (pointer)p->out_tables[2]; - pointer ot3 = (pointer)p->out_tables[3]; - pointer ot4 = (pointer)p->out_tables[4]; - pointer ot5 = (pointer)p->out_tables[5]; - pointer ot6 = (pointer)p->out_tables[6]; - pointer im_base = (pointer)p->im_table; - - for(;ip0 < ep; ip0 += 5, op0 += 7) { - unsigned int ova0; /* Output value accumulator */ - unsigned int ova1; /* Output value accumulator */ - unsigned int ova2; /* Output value accumulator */ - unsigned int ova3; /* Output value accumulator */ - unsigned int ova4; /* Output value accumulator */ - unsigned int ova5; /* Output value accumulator */ - unsigned int ova6; /* Output value accumulator */ - { - pointer imp; - unsigned int we0; /* Weighting value variable */ - unsigned int vo0; /* Vertex offset variable */ - unsigned int we1; /* Weighting value variable */ - unsigned int vo1; /* Vertex offset variable */ - unsigned int we2; /* Weighting value variable */ - unsigned int vo2; /* Vertex offset variable */ - unsigned int we3; /* Weighting value variable */ - unsigned int vo3; /* Vertex offset variable */ - unsigned int we4; /* Weighting value variable */ - unsigned int vo4; /* Vertex offset variable */ - { - unsigned int ti_i; /* Interpolation index variable */ - - ti_i = IT_IX(it0, ip0[0]); - we0 = IT_WE(it0, ip0[0]); - vo0 = IT_VO(it0, ip0[0]); - ti_i += IT_IX(it1, ip0[1]); - we1 = IT_WE(it1, ip0[1]); - vo1 = IT_VO(it1, ip0[1]); - ti_i += IT_IX(it2, ip0[2]); - we2 = IT_WE(it2, ip0[2]); - vo2 = IT_VO(it2, ip0[2]); - ti_i += IT_IX(it3, ip0[3]); - we3 = IT_WE(it3, ip0[3]); - vo3 = IT_VO(it3, ip0[3]); - ti_i += IT_IX(it4, ip0[4]); - we4 = IT_WE(it4, ip0[4]); - vo4 = IT_VO(it4, ip0[4]); - - imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */ - - /* Sort weighting values and vertex offset values */ - CEX(we0, vo0, we1, vo1); - CEX(we0, vo0, we2, vo2); - CEX(we0, vo0, we3, vo3); - CEX(we0, vo0, we4, vo4); - CEX(we1, vo1, we2, vo2); - CEX(we1, vo1, we3, vo3); - CEX(we1, vo1, we4, vo4); - CEX(we2, vo2, we3, vo3); - CEX(we2, vo2, we4, vo4); - CEX(we3, vo3, we4, vo4); - } - { - unsigned int vof; /* Vertex offset value */ - unsigned int vwe; /* Vertex weighting */ - - vof = 0; /* First vertex offset is 0 */ - vwe = 65536 - we0; /* Baricentric weighting */ - ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 = IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 = IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - ova5 = IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */ - ova6 = IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */ - vof += vo0; /* Move to next vertex */ - vwe = we0 - we1; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */ - ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */ - vof += vo1; /* Move to next vertex */ - vwe = we1 - we2; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */ - ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */ - vof += vo2; /* Move to next vertex */ - vwe = we2 - we3; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */ - ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */ - vof += vo3; /* Move to next vertex */ - vwe = we3 - we4; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */ - ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */ - vof += vo4; /* Move to next vertex */ - vwe = we4; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */ - ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */ - } - } - { - unsigned int oti; /* Vertex offset value */ - oti = ((ova0 >> 16) & 0xffff); /* Extract integer part of result */ - op0[0] = OT_E(ot0, oti); /* Write result */ - oti = ((ova1 >> 16) & 0xffff); /* Extract integer part of result */ - op0[1] = OT_E(ot1, oti); /* Write result */ - oti = ((ova2 >> 16) & 0xffff); /* Extract integer part of result */ - op0[2] = OT_E(ot2, oti); /* Write result */ - oti = ((ova3 >> 16) & 0xffff); /* Extract integer part of result */ - op0[3] = OT_E(ot3, oti); /* Write result */ - oti = ((ova4 >> 16) & 0xffff); /* Extract integer part of result */ - op0[4] = OT_E(ot4, oti); /* Write result */ - oti = ((ova5 >> 16) & 0xffff); /* Extract integer part of result */ - op0[5] = OT_E(ot5, oti); /* Write result */ - oti = ((ova6 >> 16) & 0xffff); /* Extract integer part of result */ - op0[6] = OT_E(ot6, oti); /* Write result */ - } - } -} -#undef IT_WE -#undef IT_VO -#undef IT_IX -#undef CEX -#undef IM_O -#undef IM_FE -#undef OT_E - -static void -imdi_k137_gen( -genspec *g /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x10, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x54, 0x00, 0x00, 0x00, 0x00, 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, 0x04, 0x08, - 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08, - 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7, - 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7, - 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08, - 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00, - 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7, - 0x2c, 0xf3, 0xdc, 0xb7, 0x35, 0x5f, 0x37, 0x5f, - 0x69, 0x31, 0x36, 0x5f, 0x69, 0x31, 0x36, 0x5f, - 0x66, 0x00, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00, - 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf, - 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08, - 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf, - 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x33, - 0x37, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01, - 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7, - 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7, - 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08, - 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08, - 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf, - 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7, - 0x00, 0xf0, 0x04, 0x08 - }; /* Structure image */ - - memcpy(g, data, sizeof(data)); /* Initialise the structure */ -} - -static void -imdi_k137_tab( -tabspec *t /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x0e, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0xdc, 0x60, 0xef, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff - }; /* Structure image */ - - memcpy(t, data, sizeof(data)); /* Initialise the structure */ -} - -/* 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 = 6 - Input channel 0 bits = 16 - Input channel 0 increment = 6 - Input channel 1 bits = 16 - Input channel 1 increment = 6 - Input channel 2 bits = 16 - Input channel 2 increment = 6 - Input channel 3 bits = 16 - Input channel 3 increment = 6 - Input channel 4 bits = 16 - Input channel 4 increment = 6 - Input channel 5 bits = 16 - Input channel 5 increment = 6 - Input is channel interleaved - Input channels are separate words - Input value extraction is done in input table lookup - - Output channels per pixel = 7 - Output channel 0 bits = 16 - Output channel 0 increment = 7 - Output channel 1 bits = 16 - Output channel 1 increment = 7 - Output channel 2 bits = 16 - Output channel 2 increment = 7 - Output channel 3 bits = 16 - Output channel 3 increment = 7 - Output channel 4 bits = 16 - Output channel 4 increment = 7 - Output channel 5 bits = 16 - Output channel 5 increment = 7 - Output channel 6 bits = 16 - Output channel 6 increment = 7 - Output is channel interleaved - - Output channels are separate words - Weight+voffset bits = 32 - Interpolation table index bits = 32 - Interpolation table max resolution = 40 - */ - -/* - 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 <memory.h> -#include "imdi_imp.h" -#define IMDI_INCLUDED -#endif /* IMDI_INCLUDED */ - -#ifndef DEFINED_pointer -#define DEFINED_pointer -typedef unsigned char * pointer; -#endif - -/* Input table interp. index */ -#define IT_IX(p, off) *((unsigned int *)((p) + 0 + (off) * 12)) - -/* Input table input weighting enty */ -#define IT_WE(p, off) *((unsigned int *)((p) + 4 + (off) * 12)) - -/* Input table input offset value enty */ -#define IT_VO(p, off) *((unsigned int *)((p) + 8 + (off) * 12)) - -/* Conditional exchange for sorting */ -#define CEX(A, AA, B, BB) if (A < B) { \ - A ^= B; B ^= A; A ^= B; AA ^= BB; BB ^= AA; AA ^= BB; } - -/* Interpolation multi-dim. table access */ -#define IM_O(off) ((off) * 14) - -/* Interpolation table - get vertex values */ -#define IM_FE(p, v, c) ((unsigned int)*((unsigned short *)((p) + (v) * 2 + (c) * 2))) - -/* Output table indexes */ -#define OT_E(p, off) *((unsigned short *)((p) + (off) * 2)) - -static void -imdi_k138( -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 short *ip0 = (unsigned short *)inp[0]; - unsigned short *op0 = (unsigned short *)outp[0]; - unsigned short *ep = ip0 + npix * 6 ; - pointer it0 = (pointer)p->in_tables[0]; - pointer it1 = (pointer)p->in_tables[1]; - pointer it2 = (pointer)p->in_tables[2]; - pointer it3 = (pointer)p->in_tables[3]; - pointer it4 = (pointer)p->in_tables[4]; - pointer it5 = (pointer)p->in_tables[5]; - pointer ot0 = (pointer)p->out_tables[0]; - pointer ot1 = (pointer)p->out_tables[1]; - pointer ot2 = (pointer)p->out_tables[2]; - pointer ot3 = (pointer)p->out_tables[3]; - pointer ot4 = (pointer)p->out_tables[4]; - pointer ot5 = (pointer)p->out_tables[5]; - pointer ot6 = (pointer)p->out_tables[6]; - pointer im_base = (pointer)p->im_table; - - for(;ip0 < ep; ip0 += 6, op0 += 7) { - unsigned int ova0; /* Output value accumulator */ - unsigned int ova1; /* Output value accumulator */ - unsigned int ova2; /* Output value accumulator */ - unsigned int ova3; /* Output value accumulator */ - unsigned int ova4; /* Output value accumulator */ - unsigned int ova5; /* Output value accumulator */ - unsigned int ova6; /* Output value accumulator */ - { - pointer imp; - unsigned int we0; /* Weighting value variable */ - unsigned int vo0; /* Vertex offset variable */ - unsigned int we1; /* Weighting value variable */ - unsigned int vo1; /* Vertex offset variable */ - unsigned int we2; /* Weighting value variable */ - unsigned int vo2; /* Vertex offset variable */ - unsigned int we3; /* Weighting value variable */ - unsigned int vo3; /* Vertex offset variable */ - unsigned int we4; /* Weighting value variable */ - unsigned int vo4; /* Vertex offset variable */ - unsigned int we5; /* Weighting value variable */ - unsigned int vo5; /* Vertex offset variable */ - { - unsigned int ti_i; /* Interpolation index variable */ - - ti_i = IT_IX(it0, ip0[0]); - we0 = IT_WE(it0, ip0[0]); - vo0 = IT_VO(it0, ip0[0]); - ti_i += IT_IX(it1, ip0[1]); - we1 = IT_WE(it1, ip0[1]); - vo1 = IT_VO(it1, ip0[1]); - ti_i += IT_IX(it2, ip0[2]); - we2 = IT_WE(it2, ip0[2]); - vo2 = IT_VO(it2, ip0[2]); - ti_i += IT_IX(it3, ip0[3]); - we3 = IT_WE(it3, ip0[3]); - vo3 = IT_VO(it3, ip0[3]); - ti_i += IT_IX(it4, ip0[4]); - we4 = IT_WE(it4, ip0[4]); - vo4 = IT_VO(it4, ip0[4]); - ti_i += IT_IX(it5, ip0[5]); - we5 = IT_WE(it5, ip0[5]); - vo5 = IT_VO(it5, ip0[5]); - - imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */ - - /* Sort weighting values and vertex offset values */ - CEX(we0, vo0, we1, vo1); - CEX(we0, vo0, we2, vo2); - CEX(we0, vo0, we3, vo3); - CEX(we0, vo0, we4, vo4); - CEX(we0, vo0, we5, vo5); - CEX(we1, vo1, we2, vo2); - CEX(we1, vo1, we3, vo3); - CEX(we1, vo1, we4, vo4); - CEX(we1, vo1, we5, vo5); - CEX(we2, vo2, we3, vo3); - CEX(we2, vo2, we4, vo4); - CEX(we2, vo2, we5, vo5); - CEX(we3, vo3, we4, vo4); - CEX(we3, vo3, we5, vo5); - CEX(we4, vo4, we5, vo5); - } - { - unsigned int vof; /* Vertex offset value */ - unsigned int vwe; /* Vertex weighting */ - - vof = 0; /* First vertex offset is 0 */ - vwe = 65536 - we0; /* Baricentric weighting */ - ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 = IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 = IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - ova5 = IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */ - ova6 = IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */ - vof += vo0; /* Move to next vertex */ - vwe = we0 - we1; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */ - ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */ - vof += vo1; /* Move to next vertex */ - vwe = we1 - we2; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */ - ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */ - vof += vo2; /* Move to next vertex */ - vwe = we2 - we3; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */ - ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */ - vof += vo3; /* Move to next vertex */ - vwe = we3 - we4; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */ - ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */ - vof += vo4; /* Move to next vertex */ - vwe = we4 - we5; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */ - ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */ - vof += vo5; /* Move to next vertex */ - vwe = we5; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */ - ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */ - } - } - { - unsigned int oti; /* Vertex offset value */ - oti = ((ova0 >> 16) & 0xffff); /* Extract integer part of result */ - op0[0] = OT_E(ot0, oti); /* Write result */ - oti = ((ova1 >> 16) & 0xffff); /* Extract integer part of result */ - op0[1] = OT_E(ot1, oti); /* Write result */ - oti = ((ova2 >> 16) & 0xffff); /* Extract integer part of result */ - op0[2] = OT_E(ot2, oti); /* Write result */ - oti = ((ova3 >> 16) & 0xffff); /* Extract integer part of result */ - op0[3] = OT_E(ot3, oti); /* Write result */ - oti = ((ova4 >> 16) & 0xffff); /* Extract integer part of result */ - op0[4] = OT_E(ot4, oti); /* Write result */ - oti = ((ova5 >> 16) & 0xffff); /* Extract integer part of result */ - op0[5] = OT_E(ot5, oti); /* Write result */ - oti = ((ova6 >> 16) & 0xffff); /* Extract integer part of result */ - op0[6] = OT_E(ot6, oti); /* Write result */ - } - } -} -#undef IT_WE -#undef IT_VO -#undef IT_IX -#undef CEX -#undef IM_O -#undef IM_FE -#undef OT_E - -static void -imdi_k138_gen( -genspec *g /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x10, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x28, 0x00, 0x00, 0x00, 0x00, 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, 0x04, 0x08, - 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08, - 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7, - 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7, - 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08, - 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00, - 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7, - 0x2c, 0xf3, 0xdc, 0xb7, 0x36, 0x5f, 0x37, 0x5f, - 0x69, 0x31, 0x36, 0x5f, 0x69, 0x31, 0x36, 0x5f, - 0x66, 0x00, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00, - 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf, - 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08, - 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf, - 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x33, - 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01, - 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7, - 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7, - 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08, - 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08, - 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf, - 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7, - 0x00, 0xf0, 0x04, 0x08 - }; /* Structure image */ - - memcpy(g, data, sizeof(data)); /* Initialise the structure */ -} - -static void -imdi_k138_tab( -tabspec *t /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x0e, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0xdc, 0x60, 0xef, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff - }; /* Structure image */ - - memcpy(t, data, sizeof(data)); /* Initialise the structure */ -} - -/* 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 = 7 - Input channel 0 bits = 16 - Input channel 0 increment = 7 - Input channel 1 bits = 16 - Input channel 1 increment = 7 - Input channel 2 bits = 16 - Input channel 2 increment = 7 - Input channel 3 bits = 16 - Input channel 3 increment = 7 - Input channel 4 bits = 16 - Input channel 4 increment = 7 - Input channel 5 bits = 16 - Input channel 5 increment = 7 - Input channel 6 bits = 16 - Input channel 6 increment = 7 - Input is channel interleaved - Input channels are separate words - Input value extraction is done in input table lookup - - Output channels per pixel = 7 - Output channel 0 bits = 16 - Output channel 0 increment = 7 - Output channel 1 bits = 16 - Output channel 1 increment = 7 - Output channel 2 bits = 16 - Output channel 2 increment = 7 - Output channel 3 bits = 16 - Output channel 3 increment = 7 - Output channel 4 bits = 16 - Output channel 4 increment = 7 - Output channel 5 bits = 16 - Output channel 5 increment = 7 - Output channel 6 bits = 16 - Output channel 6 increment = 7 - Output is channel interleaved - - Output channels are separate words - Weight+voffset bits = 32 - Interpolation table index bits = 32 - Interpolation table max resolution = 23 - */ - -/* - 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 <memory.h> -#include "imdi_imp.h" -#define IMDI_INCLUDED -#endif /* IMDI_INCLUDED */ - -#ifndef DEFINED_pointer -#define DEFINED_pointer -typedef unsigned char * pointer; -#endif - -/* Input table interp. index */ -#define IT_IX(p, off) *((unsigned int *)((p) + 0 + (off) * 12)) - -/* Input table input weighting enty */ -#define IT_WE(p, off) *((unsigned int *)((p) + 4 + (off) * 12)) - -/* Input table input offset value enty */ -#define IT_VO(p, off) *((unsigned int *)((p) + 8 + (off) * 12)) - -/* Conditional exchange for sorting */ -#define CEX(A, AA, B, BB) if (A < B) { \ - A ^= B; B ^= A; A ^= B; AA ^= BB; BB ^= AA; AA ^= BB; } - -/* Interpolation multi-dim. table access */ -#define IM_O(off) ((off) * 14) - -/* Interpolation table - get vertex values */ -#define IM_FE(p, v, c) ((unsigned int)*((unsigned short *)((p) + (v) * 2 + (c) * 2))) - -/* Output table indexes */ -#define OT_E(p, off) *((unsigned short *)((p) + (off) * 2)) - -static void -imdi_k139( -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 short *ip0 = (unsigned short *)inp[0]; - unsigned short *op0 = (unsigned short *)outp[0]; - unsigned short *ep = ip0 + npix * 7 ; - pointer it0 = (pointer)p->in_tables[0]; - pointer it1 = (pointer)p->in_tables[1]; - pointer it2 = (pointer)p->in_tables[2]; - pointer it3 = (pointer)p->in_tables[3]; - pointer it4 = (pointer)p->in_tables[4]; - pointer it5 = (pointer)p->in_tables[5]; - pointer it6 = (pointer)p->in_tables[6]; - pointer ot0 = (pointer)p->out_tables[0]; - pointer ot1 = (pointer)p->out_tables[1]; - pointer ot2 = (pointer)p->out_tables[2]; - pointer ot3 = (pointer)p->out_tables[3]; - pointer ot4 = (pointer)p->out_tables[4]; - pointer ot5 = (pointer)p->out_tables[5]; - pointer ot6 = (pointer)p->out_tables[6]; - pointer im_base = (pointer)p->im_table; - - for(;ip0 < ep; ip0 += 7, op0 += 7) { - unsigned int ova0; /* Output value accumulator */ - unsigned int ova1; /* Output value accumulator */ - unsigned int ova2; /* Output value accumulator */ - unsigned int ova3; /* Output value accumulator */ - unsigned int ova4; /* Output value accumulator */ - unsigned int ova5; /* Output value accumulator */ - unsigned int ova6; /* Output value accumulator */ - { - pointer imp; - unsigned int we0; /* Weighting value variable */ - unsigned int vo0; /* Vertex offset variable */ - unsigned int we1; /* Weighting value variable */ - unsigned int vo1; /* Vertex offset variable */ - unsigned int we2; /* Weighting value variable */ - unsigned int vo2; /* Vertex offset variable */ - unsigned int we3; /* Weighting value variable */ - unsigned int vo3; /* Vertex offset variable */ - unsigned int we4; /* Weighting value variable */ - unsigned int vo4; /* Vertex offset variable */ - unsigned int we5; /* Weighting value variable */ - unsigned int vo5; /* Vertex offset variable */ - unsigned int we6; /* Weighting value variable */ - unsigned int vo6; /* Vertex offset variable */ - { - unsigned int ti_i; /* Interpolation index variable */ - - ti_i = IT_IX(it0, ip0[0]); - we0 = IT_WE(it0, ip0[0]); - vo0 = IT_VO(it0, ip0[0]); - ti_i += IT_IX(it1, ip0[1]); - we1 = IT_WE(it1, ip0[1]); - vo1 = IT_VO(it1, ip0[1]); - ti_i += IT_IX(it2, ip0[2]); - we2 = IT_WE(it2, ip0[2]); - vo2 = IT_VO(it2, ip0[2]); - ti_i += IT_IX(it3, ip0[3]); - we3 = IT_WE(it3, ip0[3]); - vo3 = IT_VO(it3, ip0[3]); - ti_i += IT_IX(it4, ip0[4]); - we4 = IT_WE(it4, ip0[4]); - vo4 = IT_VO(it4, ip0[4]); - ti_i += IT_IX(it5, ip0[5]); - we5 = IT_WE(it5, ip0[5]); - vo5 = IT_VO(it5, ip0[5]); - ti_i += IT_IX(it6, ip0[6]); - we6 = IT_WE(it6, ip0[6]); - vo6 = IT_VO(it6, ip0[6]); - - imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */ - - /* Sort weighting values and vertex offset values */ - CEX(we0, vo0, we1, vo1); - CEX(we0, vo0, we2, vo2); - CEX(we0, vo0, we3, vo3); - CEX(we0, vo0, we4, vo4); - CEX(we0, vo0, we5, vo5); - CEX(we0, vo0, we6, vo6); - CEX(we1, vo1, we2, vo2); - CEX(we1, vo1, we3, vo3); - CEX(we1, vo1, we4, vo4); - CEX(we1, vo1, we5, vo5); - CEX(we1, vo1, we6, vo6); - CEX(we2, vo2, we3, vo3); - CEX(we2, vo2, we4, vo4); - CEX(we2, vo2, we5, vo5); - CEX(we2, vo2, we6, vo6); - CEX(we3, vo3, we4, vo4); - CEX(we3, vo3, we5, vo5); - CEX(we3, vo3, we6, vo6); - CEX(we4, vo4, we5, vo5); - CEX(we4, vo4, we6, vo6); - CEX(we5, vo5, we6, vo6); - } - { - unsigned int vof; /* Vertex offset value */ - unsigned int vwe; /* Vertex weighting */ - - vof = 0; /* First vertex offset is 0 */ - vwe = 65536 - we0; /* Baricentric weighting */ - ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 = IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 = IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - ova5 = IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */ - ova6 = IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */ - vof += vo0; /* Move to next vertex */ - vwe = we0 - we1; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */ - ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */ - vof += vo1; /* Move to next vertex */ - vwe = we1 - we2; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */ - ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */ - vof += vo2; /* Move to next vertex */ - vwe = we2 - we3; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */ - ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */ - vof += vo3; /* Move to next vertex */ - vwe = we3 - we4; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */ - ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */ - vof += vo4; /* Move to next vertex */ - vwe = we4 - we5; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */ - ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */ - vof += vo5; /* Move to next vertex */ - vwe = we5 - we6; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */ - ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */ - vof += vo6; /* Move to next vertex */ - vwe = we6; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */ - ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */ - } - } - { - unsigned int oti; /* Vertex offset value */ - oti = ((ova0 >> 16) & 0xffff); /* Extract integer part of result */ - op0[0] = OT_E(ot0, oti); /* Write result */ - oti = ((ova1 >> 16) & 0xffff); /* Extract integer part of result */ - op0[1] = OT_E(ot1, oti); /* Write result */ - oti = ((ova2 >> 16) & 0xffff); /* Extract integer part of result */ - op0[2] = OT_E(ot2, oti); /* Write result */ - oti = ((ova3 >> 16) & 0xffff); /* Extract integer part of result */ - op0[3] = OT_E(ot3, oti); /* Write result */ - oti = ((ova4 >> 16) & 0xffff); /* Extract integer part of result */ - op0[4] = OT_E(ot4, oti); /* Write result */ - oti = ((ova5 >> 16) & 0xffff); /* Extract integer part of result */ - op0[5] = OT_E(ot5, oti); /* Write result */ - oti = ((ova6 >> 16) & 0xffff); /* Extract integer part of result */ - op0[6] = OT_E(ot6, oti); /* Write result */ - } - } -} -#undef IT_WE -#undef IT_VO -#undef IT_IX -#undef CEX -#undef IM_O -#undef IM_FE -#undef OT_E - -static void -imdi_k139_gen( -genspec *g /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x10, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x17, 0x00, 0x00, 0x00, 0x00, 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, 0x04, 0x08, - 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08, - 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7, - 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7, - 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08, - 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00, - 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7, - 0x2c, 0xf3, 0xdc, 0xb7, 0x37, 0x5f, 0x37, 0x5f, - 0x69, 0x31, 0x36, 0x5f, 0x69, 0x31, 0x36, 0x5f, - 0x66, 0x00, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00, - 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf, - 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08, - 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf, - 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x33, - 0x39, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01, - 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7, - 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7, - 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08, - 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08, - 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf, - 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7, - 0x00, 0xf0, 0x04, 0x08 - }; /* Structure image */ - - memcpy(g, data, sizeof(data)); /* Initialise the structure */ -} - -static void -imdi_k139_tab( -tabspec *t /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x0e, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0xdc, 0x60, 0xef, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff - }; /* Structure image */ - - memcpy(t, data, sizeof(data)); /* Initialise the structure */ -} - -/* 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 = 8 - Input channel 0 bits = 16 - Input channel 0 increment = 8 - Input channel 1 bits = 16 - Input channel 1 increment = 8 - Input channel 2 bits = 16 - Input channel 2 increment = 8 - Input channel 3 bits = 16 - Input channel 3 increment = 8 - Input channel 4 bits = 16 - Input channel 4 increment = 8 - Input channel 5 bits = 16 - Input channel 5 increment = 8 - Input channel 6 bits = 16 - Input channel 6 increment = 8 - Input channel 7 bits = 16 - Input channel 7 increment = 8 - Input is channel interleaved - Input channels are separate words - Input value extraction is done in input table lookup - - Output channels per pixel = 7 - Output channel 0 bits = 16 - Output channel 0 increment = 7 - Output channel 1 bits = 16 - Output channel 1 increment = 7 - Output channel 2 bits = 16 - Output channel 2 increment = 7 - Output channel 3 bits = 16 - Output channel 3 increment = 7 - Output channel 4 bits = 16 - Output channel 4 increment = 7 - Output channel 5 bits = 16 - Output channel 5 increment = 7 - Output channel 6 bits = 16 - Output channel 6 increment = 7 - Output is channel interleaved - - Output channels are separate words - Weight+voffset bits = 32 - Interpolation table index bits = 32 - Interpolation table max resolution = 16 - */ - -/* - 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 <memory.h> -#include "imdi_imp.h" -#define IMDI_INCLUDED -#endif /* IMDI_INCLUDED */ - -#ifndef DEFINED_pointer -#define DEFINED_pointer -typedef unsigned char * pointer; -#endif - -/* Input table interp. index */ -#define IT_IX(p, off) *((unsigned int *)((p) + 0 + (off) * 12)) - -/* Input table input weighting enty */ -#define IT_WE(p, off) *((unsigned int *)((p) + 4 + (off) * 12)) - -/* Input table input offset value enty */ -#define IT_VO(p, off) *((unsigned int *)((p) + 8 + (off) * 12)) - -/* Conditional exchange for sorting */ -#define CEX(A, AA, B, BB) if (A < B) { \ - A ^= B; B ^= A; A ^= B; AA ^= BB; BB ^= AA; AA ^= BB; } - -/* Interpolation multi-dim. table access */ -#define IM_O(off) ((off) * 14) - -/* Interpolation table - get vertex values */ -#define IM_FE(p, v, c) ((unsigned int)*((unsigned short *)((p) + (v) * 2 + (c) * 2))) - -/* Output table indexes */ -#define OT_E(p, off) *((unsigned short *)((p) + (off) * 2)) - -static void -imdi_k140( -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 short *ip0 = (unsigned short *)inp[0]; - unsigned short *op0 = (unsigned short *)outp[0]; - unsigned short *ep = ip0 + npix * 8 ; - pointer it0 = (pointer)p->in_tables[0]; - pointer it1 = (pointer)p->in_tables[1]; - pointer it2 = (pointer)p->in_tables[2]; - pointer it3 = (pointer)p->in_tables[3]; - pointer it4 = (pointer)p->in_tables[4]; - pointer it5 = (pointer)p->in_tables[5]; - pointer it6 = (pointer)p->in_tables[6]; - pointer it7 = (pointer)p->in_tables[7]; - pointer ot0 = (pointer)p->out_tables[0]; - pointer ot1 = (pointer)p->out_tables[1]; - pointer ot2 = (pointer)p->out_tables[2]; - pointer ot3 = (pointer)p->out_tables[3]; - pointer ot4 = (pointer)p->out_tables[4]; - pointer ot5 = (pointer)p->out_tables[5]; - pointer ot6 = (pointer)p->out_tables[6]; - pointer im_base = (pointer)p->im_table; - - for(;ip0 < ep; ip0 += 8, op0 += 7) { - unsigned int ova0; /* Output value accumulator */ - unsigned int ova1; /* Output value accumulator */ - unsigned int ova2; /* Output value accumulator */ - unsigned int ova3; /* Output value accumulator */ - unsigned int ova4; /* Output value accumulator */ - unsigned int ova5; /* Output value accumulator */ - unsigned int ova6; /* Output value accumulator */ - { - pointer imp; - unsigned int we0; /* Weighting value variable */ - unsigned int vo0; /* Vertex offset variable */ - unsigned int we1; /* Weighting value variable */ - unsigned int vo1; /* Vertex offset variable */ - unsigned int we2; /* Weighting value variable */ - unsigned int vo2; /* Vertex offset variable */ - unsigned int we3; /* Weighting value variable */ - unsigned int vo3; /* Vertex offset variable */ - unsigned int we4; /* Weighting value variable */ - unsigned int vo4; /* Vertex offset variable */ - unsigned int we5; /* Weighting value variable */ - unsigned int vo5; /* Vertex offset variable */ - unsigned int we6; /* Weighting value variable */ - unsigned int vo6; /* Vertex offset variable */ - unsigned int we7; /* Weighting value variable */ - unsigned int vo7; /* Vertex offset variable */ - { - unsigned int ti_i; /* Interpolation index variable */ - - ti_i = IT_IX(it0, ip0[0]); - we0 = IT_WE(it0, ip0[0]); - vo0 = IT_VO(it0, ip0[0]); - ti_i += IT_IX(it1, ip0[1]); - we1 = IT_WE(it1, ip0[1]); - vo1 = IT_VO(it1, ip0[1]); - ti_i += IT_IX(it2, ip0[2]); - we2 = IT_WE(it2, ip0[2]); - vo2 = IT_VO(it2, ip0[2]); - ti_i += IT_IX(it3, ip0[3]); - we3 = IT_WE(it3, ip0[3]); - vo3 = IT_VO(it3, ip0[3]); - ti_i += IT_IX(it4, ip0[4]); - we4 = IT_WE(it4, ip0[4]); - vo4 = IT_VO(it4, ip0[4]); - ti_i += IT_IX(it5, ip0[5]); - we5 = IT_WE(it5, ip0[5]); - vo5 = IT_VO(it5, ip0[5]); - ti_i += IT_IX(it6, ip0[6]); - we6 = IT_WE(it6, ip0[6]); - vo6 = IT_VO(it6, ip0[6]); - ti_i += IT_IX(it7, ip0[7]); - we7 = IT_WE(it7, ip0[7]); - vo7 = IT_VO(it7, ip0[7]); - - imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */ - - /* Sort weighting values and vertex offset values */ - CEX(we0, vo0, we1, vo1); - CEX(we0, vo0, we2, vo2); - CEX(we0, vo0, we3, vo3); - CEX(we0, vo0, we4, vo4); - CEX(we0, vo0, we5, vo5); - CEX(we0, vo0, we6, vo6); - CEX(we0, vo0, we7, vo7); - CEX(we1, vo1, we2, vo2); - CEX(we1, vo1, we3, vo3); - CEX(we1, vo1, we4, vo4); - CEX(we1, vo1, we5, vo5); - CEX(we1, vo1, we6, vo6); - CEX(we1, vo1, we7, vo7); - CEX(we2, vo2, we3, vo3); - CEX(we2, vo2, we4, vo4); - CEX(we2, vo2, we5, vo5); - CEX(we2, vo2, we6, vo6); - CEX(we2, vo2, we7, vo7); - CEX(we3, vo3, we4, vo4); - CEX(we3, vo3, we5, vo5); - CEX(we3, vo3, we6, vo6); - CEX(we3, vo3, we7, vo7); - CEX(we4, vo4, we5, vo5); - CEX(we4, vo4, we6, vo6); - CEX(we4, vo4, we7, vo7); - CEX(we5, vo5, we6, vo6); - CEX(we5, vo5, we7, vo7); - CEX(we6, vo6, we7, vo7); - } - { - unsigned int vof; /* Vertex offset value */ - unsigned int vwe; /* Vertex weighting */ - - vof = 0; /* First vertex offset is 0 */ - vwe = 65536 - we0; /* Baricentric weighting */ - ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 = IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 = IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - ova5 = IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */ - ova6 = IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */ - vof += vo0; /* Move to next vertex */ - vwe = we0 - we1; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */ - ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */ - vof += vo1; /* Move to next vertex */ - vwe = we1 - we2; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */ - ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */ - vof += vo2; /* Move to next vertex */ - vwe = we2 - we3; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */ - ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */ - vof += vo3; /* Move to next vertex */ - vwe = we3 - we4; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */ - ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */ - vof += vo4; /* Move to next vertex */ - vwe = we4 - we5; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */ - ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */ - vof += vo5; /* Move to next vertex */ - vwe = we5 - we6; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */ - ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */ - vof += vo6; /* Move to next vertex */ - vwe = we6 - we7; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */ - ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */ - vof += vo7; /* Move to next vertex */ - vwe = we7; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */ - ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */ - } - } - { - unsigned int oti; /* Vertex offset value */ - oti = ((ova0 >> 16) & 0xffff); /* Extract integer part of result */ - op0[0] = OT_E(ot0, oti); /* Write result */ - oti = ((ova1 >> 16) & 0xffff); /* Extract integer part of result */ - op0[1] = OT_E(ot1, oti); /* Write result */ - oti = ((ova2 >> 16) & 0xffff); /* Extract integer part of result */ - op0[2] = OT_E(ot2, oti); /* Write result */ - oti = ((ova3 >> 16) & 0xffff); /* Extract integer part of result */ - op0[3] = OT_E(ot3, oti); /* Write result */ - oti = ((ova4 >> 16) & 0xffff); /* Extract integer part of result */ - op0[4] = OT_E(ot4, oti); /* Write result */ - oti = ((ova5 >> 16) & 0xffff); /* Extract integer part of result */ - op0[5] = OT_E(ot5, oti); /* Write result */ - oti = ((ova6 >> 16) & 0xffff); /* Extract integer part of result */ - op0[6] = OT_E(ot6, oti); /* Write result */ - } - } -} -#undef IT_WE -#undef IT_VO -#undef IT_IX -#undef CEX -#undef IM_O -#undef IM_FE -#undef OT_E - -static void -imdi_k140_gen( -genspec *g /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x00, 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, 0x04, 0x08, - 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08, - 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7, - 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7, - 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08, - 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00, - 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7, - 0x2c, 0xf3, 0xdc, 0xb7, 0x38, 0x5f, 0x37, 0x5f, - 0x69, 0x31, 0x36, 0x5f, 0x69, 0x31, 0x36, 0x5f, - 0x66, 0x00, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00, - 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf, - 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08, - 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf, - 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x34, - 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01, - 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7, - 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7, - 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08, - 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08, - 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf, - 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7, - 0x00, 0xf0, 0x04, 0x08 - }; /* Structure image */ - - memcpy(g, data, sizeof(data)); /* Initialise the structure */ -} - -static void -imdi_k140_tab( -tabspec *t /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x0e, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0xdc, 0x60, 0xef, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff - }; /* Structure image */ - - memcpy(t, data, sizeof(data)); /* Initialise the structure */ -} - -/* 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 = 16 - 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 = 8 - Output channel 0 bits = 16 - Output channel 0 increment = 8 - Output channel 1 bits = 16 - Output channel 1 increment = 8 - Output channel 2 bits = 16 - Output channel 2 increment = 8 - Output channel 3 bits = 16 - Output channel 3 increment = 8 - Output channel 4 bits = 16 - Output channel 4 increment = 8 - Output channel 5 bits = 16 - Output channel 5 increment = 8 - Output channel 6 bits = 16 - Output channel 6 increment = 8 - Output channel 7 bits = 16 - Output channel 7 increment = 8 - Output is channel interleaved - - Output channels are separate words - Weight+voffset bits = 32 - Interpolation table index bits = 11 - Interpolation table max resolution = 2048 - */ - -/* - 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 <memory.h> -#include "imdi_imp.h" -#define IMDI_INCLUDED -#endif /* IMDI_INCLUDED */ - -#ifndef DEFINED_pointer -#define DEFINED_pointer -typedef unsigned char * pointer; -#endif - -/* Input table interp index, weighting and vertex offset */ -#define IT_IT(p, off) *((unsigned int *)((p) + 0 + (off) * 4)) - -/* Conditional exchange for sorting */ -#define CEX(A, B) if (A < B) { A ^= B; B ^= A; A ^= B; } - -/* Interpolation multi-dim. table access */ -#define IM_O(off) ((off) * 16) - -/* Interpolation table - get vertex values */ -#define IM_FE(p, v, c) ((unsigned int)*((unsigned short *)((p) + (v) * 8 + (c) * 2))) - -/* Output table indexes */ -#define OT_E(p, off) *((unsigned short *)((p) + (off) * 2)) - -static void -imdi_k141( -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 short *ip0 = (unsigned short *)inp[0]; - unsigned short *op0 = (unsigned short *)outp[0]; - unsigned short *ep = ip0 + npix * 1 ; - pointer it0 = (pointer)p->in_tables[0]; - pointer ot0 = (pointer)p->out_tables[0]; - pointer ot1 = (pointer)p->out_tables[1]; - pointer ot2 = (pointer)p->out_tables[2]; - pointer ot3 = (pointer)p->out_tables[3]; - pointer ot4 = (pointer)p->out_tables[4]; - pointer ot5 = (pointer)p->out_tables[5]; - pointer ot6 = (pointer)p->out_tables[6]; - pointer ot7 = (pointer)p->out_tables[7]; - pointer im_base = (pointer)p->im_table; - - for(;ip0 < ep; ip0 += 1, op0 += 8) { - unsigned int ova0; /* Output value accumulator */ - unsigned int ova1; /* Output value accumulator */ - unsigned int ova2; /* Output value accumulator */ - unsigned int ova3; /* Output value accumulator */ - unsigned int ova4; /* Output value accumulator */ - unsigned int ova5; /* Output value accumulator */ - unsigned int ova6; /* Output value accumulator */ - unsigned int ova7; /* Output value accumulator */ - { - pointer imp; - unsigned int wo0; /* Weighting value and vertex offset variable */ - { - unsigned int ti; /* Input table entry variable */ - unsigned int ti_i; /* Interpolation index variable */ - - ti = IT_IT(it0, ip0[0]); - wo0 = (ti & 0x1fffff); /* Extract weighting/vertex offset value */ - ti_i = (ti >> 21); /* Extract interpolation table value */ - - imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */ - - /* Sort weighting values and vertex offset values */ - } - { - unsigned int nvof; /* Next vertex offset value */ - unsigned int vof; /* Vertex offset value */ - unsigned int vwe; /* Vertex weighting */ - - vof = 0; /* First vertex offset is 0 */ - nvof = (wo0 & 0xf); /* Extract offset value */ - wo0 = (wo0 >> 4); /* Extract weighting value */ - vwe = 65536 - wo0; /* Baricentric weighting */ - ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 = IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 = IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - ova5 = IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */ - ova6 = IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */ - ova7 = IM_FE(imp, vof, 7) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - vwe = wo0; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */ - ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */ - ova7 += IM_FE(imp, vof, 7) * vwe; /* Accumulate weighted output values */ - } - } - { - unsigned int oti; /* Vertex offset value */ - oti = ((ova0 >> 16) & 0xffff); /* Extract integer part of result */ - op0[0] = OT_E(ot0, oti); /* Write result */ - oti = ((ova1 >> 16) & 0xffff); /* Extract integer part of result */ - op0[1] = OT_E(ot1, oti); /* Write result */ - oti = ((ova2 >> 16) & 0xffff); /* Extract integer part of result */ - op0[2] = OT_E(ot2, oti); /* Write result */ - oti = ((ova3 >> 16) & 0xffff); /* Extract integer part of result */ - op0[3] = OT_E(ot3, oti); /* Write result */ - oti = ((ova4 >> 16) & 0xffff); /* Extract integer part of result */ - op0[4] = OT_E(ot4, oti); /* Write result */ - oti = ((ova5 >> 16) & 0xffff); /* Extract integer part of result */ - op0[5] = OT_E(ot5, oti); /* Write result */ - oti = ((ova6 >> 16) & 0xffff); /* Extract integer part of result */ - op0[6] = OT_E(ot6, oti); /* Write result */ - oti = ((ova7 >> 16) & 0xffff); /* Extract integer part of result */ - op0[7] = OT_E(ot7, oti); /* Write result */ - } - } -} -#undef IT_IT -#undef CEX -#undef IM_O -#undef IM_FE -#undef OT_E - -static void -imdi_k141_gen( -genspec *g /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x08, 0x00, 0x00, 0x00, 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, 0x04, 0x08, - 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08, - 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7, - 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7, - 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08, - 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00, - 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7, - 0x2c, 0xf3, 0xdc, 0xb7, 0x31, 0x5f, 0x38, 0x5f, - 0x69, 0x31, 0x36, 0x5f, 0x69, 0x31, 0x36, 0x5f, - 0x66, 0x00, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00, - 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf, - 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08, - 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf, - 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x34, - 0x31, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01, - 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7, - 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7, - 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08, - 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08, - 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf, - 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7, - 0x00, 0xf0, 0x04, 0x08 - }; /* Structure image */ - - memcpy(g, data, sizeof(data)); /* Initialise the structure */ -} - -static void -imdi_k141_tab( -tabspec *t /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x0b, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x14, 0x00, 0x00, 0x00, 0x15, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x11, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff - }; /* Structure image */ - - memcpy(t, data, sizeof(data)); /* Initialise the structure */ -} - -/* 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 = 3 - Input channel 0 bits = 16 - Input channel 0 increment = 3 - Input channel 1 bits = 16 - Input channel 1 increment = 3 - Input channel 2 bits = 16 - Input channel 2 increment = 3 - Input is channel interleaved - Input channels are separate words - Input value extraction is done in input table lookup - - Output channels per pixel = 8 - Output channel 0 bits = 16 - Output channel 0 increment = 8 - Output channel 1 bits = 16 - Output channel 1 increment = 8 - Output channel 2 bits = 16 - Output channel 2 increment = 8 - Output channel 3 bits = 16 - Output channel 3 increment = 8 - Output channel 4 bits = 16 - Output channel 4 increment = 8 - Output channel 5 bits = 16 - Output channel 5 increment = 8 - Output channel 6 bits = 16 - Output channel 6 increment = 8 - Output channel 7 bits = 16 - Output channel 7 increment = 8 - Output is channel interleaved - - Output channels are separate words - Weight+voffset bits = 32 - Interpolation table index bits = 16 - Interpolation table max resolution = 40 - */ - -/* - 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 <memory.h> -#include "imdi_imp.h" -#define IMDI_INCLUDED -#endif /* IMDI_INCLUDED */ - -#ifndef DEFINED_pointer -#define DEFINED_pointer -typedef unsigned char * pointer; -#endif - -/* Input table interp. index */ -#define IT_IX(p, off) *((unsigned short *)((p) + 0 + (off) * 6)) - -/* Input table input weighting/offset value enty */ -#define IT_WO(p, off) *((unsigned int *)((p) + 2 + (off) * 6)) - -/* Conditional exchange for sorting */ -#define CEX(A, B) if (A < B) { A ^= B; B ^= A; A ^= B; } - -/* Interpolation multi-dim. table access */ -#define IM_O(off) ((off) * 16) - -/* Interpolation table - get vertex values */ -#define IM_FE(p, v, c) ((unsigned int)*((unsigned short *)((p) + (v) * 8 + (c) * 2))) - -/* Output table indexes */ -#define OT_E(p, off) *((unsigned short *)((p) + (off) * 2)) - -static void -imdi_k142( -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 short *ip0 = (unsigned short *)inp[0]; - unsigned short *op0 = (unsigned short *)outp[0]; - unsigned short *ep = ip0 + npix * 3 ; - pointer it0 = (pointer)p->in_tables[0]; - pointer it1 = (pointer)p->in_tables[1]; - pointer it2 = (pointer)p->in_tables[2]; - pointer ot0 = (pointer)p->out_tables[0]; - pointer ot1 = (pointer)p->out_tables[1]; - pointer ot2 = (pointer)p->out_tables[2]; - pointer ot3 = (pointer)p->out_tables[3]; - pointer ot4 = (pointer)p->out_tables[4]; - pointer ot5 = (pointer)p->out_tables[5]; - pointer ot6 = (pointer)p->out_tables[6]; - pointer ot7 = (pointer)p->out_tables[7]; - pointer im_base = (pointer)p->im_table; - - for(;ip0 < ep; ip0 += 3, op0 += 8) { - unsigned int ova0; /* Output value accumulator */ - unsigned int ova1; /* Output value accumulator */ - unsigned int ova2; /* Output value accumulator */ - unsigned int ova3; /* Output value accumulator */ - unsigned int ova4; /* Output value accumulator */ - unsigned int ova5; /* Output value accumulator */ - unsigned int ova6; /* Output value accumulator */ - unsigned int ova7; /* Output value accumulator */ - { - pointer imp; - unsigned int wo0; /* Weighting value and vertex offset variable */ - unsigned int wo1; /* Weighting value and vertex offset variable */ - unsigned int wo2; /* Weighting value and vertex offset variable */ - { - unsigned int ti_i; /* Interpolation index variable */ - - ti_i = IT_IX(it0, ip0[0]); - wo0 = IT_WO(it0, ip0[0]); - ti_i += IT_IX(it1, ip0[1]); - wo1 = IT_WO(it1, ip0[1]); - ti_i += IT_IX(it2, ip0[2]); - wo2 = IT_WO(it2, ip0[2]); - - imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */ - - /* Sort weighting values and vertex offset values */ - CEX(wo0, wo1); - CEX(wo0, wo2); - CEX(wo1, wo2); - } - { - unsigned int nvof; /* Next vertex offset value */ - unsigned int vof; /* Vertex offset value */ - unsigned int vwe; /* Vertex weighting */ - - vof = 0; /* First vertex offset is 0 */ - nvof = (wo0 & 0x7fff); /* Extract offset value */ - wo0 = (wo0 >> 15); /* Extract weighting value */ - vwe = 65536 - wo0; /* Baricentric weighting */ - ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 = IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 = IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - ova5 = IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */ - ova6 = IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */ - ova7 = IM_FE(imp, vof, 7) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo1 & 0x7fff); /* Extract offset value */ - wo1 = (wo1 >> 15); /* Extract weighting value */ - vwe = wo0 - wo1; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */ - ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */ - ova7 += IM_FE(imp, vof, 7) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo2 & 0x7fff); /* Extract offset value */ - wo2 = (wo2 >> 15); /* Extract weighting value */ - vwe = wo1 - wo2; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */ - ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */ - ova7 += IM_FE(imp, vof, 7) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - vwe = wo2; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */ - ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */ - ova7 += IM_FE(imp, vof, 7) * vwe; /* Accumulate weighted output values */ - } - } - { - unsigned int oti; /* Vertex offset value */ - oti = ((ova0 >> 16) & 0xffff); /* Extract integer part of result */ - op0[0] = OT_E(ot0, oti); /* Write result */ - oti = ((ova1 >> 16) & 0xffff); /* Extract integer part of result */ - op0[1] = OT_E(ot1, oti); /* Write result */ - oti = ((ova2 >> 16) & 0xffff); /* Extract integer part of result */ - op0[2] = OT_E(ot2, oti); /* Write result */ - oti = ((ova3 >> 16) & 0xffff); /* Extract integer part of result */ - op0[3] = OT_E(ot3, oti); /* Write result */ - oti = ((ova4 >> 16) & 0xffff); /* Extract integer part of result */ - op0[4] = OT_E(ot4, oti); /* Write result */ - oti = ((ova5 >> 16) & 0xffff); /* Extract integer part of result */ - op0[5] = OT_E(ot5, oti); /* Write result */ - oti = ((ova6 >> 16) & 0xffff); /* Extract integer part of result */ - op0[6] = OT_E(ot6, oti); /* Write result */ - oti = ((ova7 >> 16) & 0xffff); /* Extract integer part of result */ - op0[7] = OT_E(ot7, oti); /* Write result */ - } - } -} -#undef IT_WO -#undef IT_IX -#undef CEX -#undef IM_O -#undef IM_FE -#undef OT_E - -static void -imdi_k142_gen( -genspec *g /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x10, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x28, 0x00, 0x00, 0x00, 0x00, 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, 0x04, 0x08, - 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08, - 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7, - 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7, - 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08, - 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00, - 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7, - 0x2c, 0xf3, 0xdc, 0xb7, 0x33, 0x5f, 0x38, 0x5f, - 0x69, 0x31, 0x36, 0x5f, 0x69, 0x31, 0x36, 0x5f, - 0x66, 0x00, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00, - 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf, - 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08, - 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf, - 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x34, - 0x32, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01, - 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7, - 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7, - 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08, - 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08, - 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf, - 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7, - 0x00, 0xf0, 0x04, 0x08 - }; /* Structure image */ - - memcpy(g, data, sizeof(data)); /* Initialise the structure */ -} - -static void -imdi_k142_tab( -tabspec *t /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x11, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff - }; /* Structure image */ - - memcpy(t, data, sizeof(data)); /* Initialise the structure */ -} - -/* 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 = 4 - Input channel 0 bits = 16 - Input channel 0 increment = 4 - Input channel 1 bits = 16 - Input channel 1 increment = 4 - Input channel 2 bits = 16 - Input channel 2 increment = 4 - Input channel 3 bits = 16 - Input channel 3 increment = 4 - Input is channel interleaved - Input channels are separate words - Input value extraction is done in input table lookup - - Output channels per pixel = 8 - Output channel 0 bits = 16 - Output channel 0 increment = 8 - Output channel 1 bits = 16 - Output channel 1 increment = 8 - Output channel 2 bits = 16 - Output channel 2 increment = 8 - Output channel 3 bits = 16 - Output channel 3 increment = 8 - Output channel 4 bits = 16 - Output channel 4 increment = 8 - Output channel 5 bits = 16 - Output channel 5 increment = 8 - Output channel 6 bits = 16 - Output channel 6 increment = 8 - Output channel 7 bits = 16 - Output channel 7 increment = 8 - Output is channel interleaved - - Output channels are separate words - Weight+voffset bits = 32 - Interpolation table index bits = 32 - Interpolation table max resolution = 25 - */ - -/* - 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 <memory.h> -#include "imdi_imp.h" -#define IMDI_INCLUDED -#endif /* IMDI_INCLUDED */ - -#ifndef DEFINED_pointer -#define DEFINED_pointer -typedef unsigned char * pointer; -#endif - -/* Input table interp. index */ -#define IT_IX(p, off) *((unsigned int *)((p) + 0 + (off) * 8)) - -/* Input table input weighting/offset value enty */ -#define IT_WO(p, off) *((unsigned int *)((p) + 4 + (off) * 8)) - -/* Conditional exchange for sorting */ -#define CEX(A, B) if (A < B) { A ^= B; B ^= A; A ^= B; } - -/* Interpolation multi-dim. table access */ -#define IM_O(off) ((off) * 16) - -/* Interpolation table - get vertex values */ -#define IM_FE(p, v, c) ((unsigned int)*((unsigned short *)((p) + (v) * 8 + (c) * 2))) - -/* Output table indexes */ -#define OT_E(p, off) *((unsigned short *)((p) + (off) * 2)) - -static void -imdi_k143( -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 short *ip0 = (unsigned short *)inp[0]; - unsigned short *op0 = (unsigned short *)outp[0]; - unsigned short *ep = ip0 + npix * 4 ; - pointer it0 = (pointer)p->in_tables[0]; - pointer it1 = (pointer)p->in_tables[1]; - pointer it2 = (pointer)p->in_tables[2]; - pointer it3 = (pointer)p->in_tables[3]; - pointer ot0 = (pointer)p->out_tables[0]; - pointer ot1 = (pointer)p->out_tables[1]; - pointer ot2 = (pointer)p->out_tables[2]; - pointer ot3 = (pointer)p->out_tables[3]; - pointer ot4 = (pointer)p->out_tables[4]; - pointer ot5 = (pointer)p->out_tables[5]; - pointer ot6 = (pointer)p->out_tables[6]; - pointer ot7 = (pointer)p->out_tables[7]; - pointer im_base = (pointer)p->im_table; - - for(;ip0 < ep; ip0 += 4, op0 += 8) { - unsigned int ova0; /* Output value accumulator */ - unsigned int ova1; /* Output value accumulator */ - unsigned int ova2; /* Output value accumulator */ - unsigned int ova3; /* Output value accumulator */ - unsigned int ova4; /* Output value accumulator */ - unsigned int ova5; /* Output value accumulator */ - unsigned int ova6; /* Output value accumulator */ - unsigned int ova7; /* Output value accumulator */ - { - pointer imp; - unsigned int wo0; /* Weighting value and vertex offset variable */ - unsigned int wo1; /* Weighting value and vertex offset variable */ - unsigned int wo2; /* Weighting value and vertex offset variable */ - unsigned int wo3; /* Weighting value and vertex offset variable */ - { - unsigned int ti_i; /* Interpolation index variable */ - - ti_i = IT_IX(it0, ip0[0]); - wo0 = IT_WO(it0, ip0[0]); - ti_i += IT_IX(it1, ip0[1]); - wo1 = IT_WO(it1, ip0[1]); - ti_i += IT_IX(it2, ip0[2]); - wo2 = IT_WO(it2, ip0[2]); - ti_i += IT_IX(it3, ip0[3]); - wo3 = IT_WO(it3, ip0[3]); - - imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */ - - /* Sort weighting values and vertex offset values */ - CEX(wo0, wo1); - CEX(wo0, wo2); - CEX(wo0, wo3); - CEX(wo1, wo2); - CEX(wo1, wo3); - CEX(wo2, wo3); - } - { - unsigned int nvof; /* Next vertex offset value */ - unsigned int vof; /* Vertex offset value */ - unsigned int vwe; /* Vertex weighting */ - - vof = 0; /* First vertex offset is 0 */ - nvof = (wo0 & 0x7fff); /* Extract offset value */ - wo0 = (wo0 >> 15); /* Extract weighting value */ - vwe = 65536 - wo0; /* Baricentric weighting */ - ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 = IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 = IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - ova5 = IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */ - ova6 = IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */ - ova7 = IM_FE(imp, vof, 7) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo1 & 0x7fff); /* Extract offset value */ - wo1 = (wo1 >> 15); /* Extract weighting value */ - vwe = wo0 - wo1; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */ - ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */ - ova7 += IM_FE(imp, vof, 7) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo2 & 0x7fff); /* Extract offset value */ - wo2 = (wo2 >> 15); /* Extract weighting value */ - vwe = wo1 - wo2; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */ - ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */ - ova7 += IM_FE(imp, vof, 7) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - nvof = (wo3 & 0x7fff); /* Extract offset value */ - wo3 = (wo3 >> 15); /* Extract weighting value */ - vwe = wo2 - wo3; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */ - ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */ - ova7 += IM_FE(imp, vof, 7) * vwe; /* Accumulate weighted output values */ - vof += nvof; /* Move to next vertex */ - vwe = wo3; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */ - ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */ - ova7 += IM_FE(imp, vof, 7) * vwe; /* Accumulate weighted output values */ - } - } - { - unsigned int oti; /* Vertex offset value */ - oti = ((ova0 >> 16) & 0xffff); /* Extract integer part of result */ - op0[0] = OT_E(ot0, oti); /* Write result */ - oti = ((ova1 >> 16) & 0xffff); /* Extract integer part of result */ - op0[1] = OT_E(ot1, oti); /* Write result */ - oti = ((ova2 >> 16) & 0xffff); /* Extract integer part of result */ - op0[2] = OT_E(ot2, oti); /* Write result */ - oti = ((ova3 >> 16) & 0xffff); /* Extract integer part of result */ - op0[3] = OT_E(ot3, oti); /* Write result */ - oti = ((ova4 >> 16) & 0xffff); /* Extract integer part of result */ - op0[4] = OT_E(ot4, oti); /* Write result */ - oti = ((ova5 >> 16) & 0xffff); /* Extract integer part of result */ - op0[5] = OT_E(ot5, oti); /* Write result */ - oti = ((ova6 >> 16) & 0xffff); /* Extract integer part of result */ - op0[6] = OT_E(ot6, oti); /* Write result */ - oti = ((ova7 >> 16) & 0xffff); /* Extract integer part of result */ - op0[7] = OT_E(ot7, oti); /* Write result */ - } - } -} -#undef IT_WO -#undef IT_IX -#undef CEX -#undef IM_O -#undef IM_FE -#undef OT_E - -static void -imdi_k143_gen( -genspec *g /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x10, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x19, 0x00, 0x00, 0x00, 0x00, 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, 0x04, 0x08, - 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08, - 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7, - 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7, - 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08, - 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00, - 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7, - 0x2c, 0xf3, 0xdc, 0xb7, 0x34, 0x5f, 0x38, 0x5f, - 0x69, 0x31, 0x36, 0x5f, 0x69, 0x31, 0x36, 0x5f, - 0x66, 0x00, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00, - 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf, - 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08, - 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf, - 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x34, - 0x33, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01, - 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7, - 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7, - 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08, - 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08, - 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf, - 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7, - 0x00, 0xf0, 0x04, 0x08 - }; /* Structure image */ - - memcpy(g, data, sizeof(data)); /* Initialise the structure */ -} - -static void -imdi_k143_tab( -tabspec *t /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x11, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff - }; /* Structure image */ - - memcpy(t, data, sizeof(data)); /* Initialise the structure */ -} - -/* 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 = 5 - Input channel 0 bits = 16 - Input channel 0 increment = 5 - Input channel 1 bits = 16 - Input channel 1 increment = 5 - Input channel 2 bits = 16 - Input channel 2 increment = 5 - Input channel 3 bits = 16 - Input channel 3 increment = 5 - Input channel 4 bits = 16 - Input channel 4 increment = 5 - Input is channel interleaved - Input channels are separate words - Input value extraction is done in input table lookup - - Output channels per pixel = 8 - Output channel 0 bits = 16 - Output channel 0 increment = 8 - Output channel 1 bits = 16 - Output channel 1 increment = 8 - Output channel 2 bits = 16 - Output channel 2 increment = 8 - Output channel 3 bits = 16 - Output channel 3 increment = 8 - Output channel 4 bits = 16 - Output channel 4 increment = 8 - Output channel 5 bits = 16 - Output channel 5 increment = 8 - Output channel 6 bits = 16 - Output channel 6 increment = 8 - Output channel 7 bits = 16 - Output channel 7 increment = 8 - Output is channel interleaved - - Output channels are separate words - Weight+voffset bits = 32 - Interpolation table index bits = 32 - Interpolation table max resolution = 84 - */ - -/* - 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 <memory.h> -#include "imdi_imp.h" -#define IMDI_INCLUDED -#endif /* IMDI_INCLUDED */ - -#ifndef DEFINED_pointer -#define DEFINED_pointer -typedef unsigned char * pointer; -#endif - -/* Input table interp. index */ -#define IT_IX(p, off) *((unsigned int *)((p) + 0 + (off) * 12)) - -/* Input table input weighting enty */ -#define IT_WE(p, off) *((unsigned int *)((p) + 4 + (off) * 12)) - -/* Input table input offset value enty */ -#define IT_VO(p, off) *((unsigned int *)((p) + 8 + (off) * 12)) - -/* Conditional exchange for sorting */ -#define CEX(A, AA, B, BB) if (A < B) { \ - A ^= B; B ^= A; A ^= B; AA ^= BB; BB ^= AA; AA ^= BB; } - -/* Interpolation multi-dim. table access */ -#define IM_O(off) ((off) * 16) - -/* Interpolation table - get vertex values */ -#define IM_FE(p, v, c) ((unsigned int)*((unsigned short *)((p) + (v) * 8 + (c) * 2))) - -/* Output table indexes */ -#define OT_E(p, off) *((unsigned short *)((p) + (off) * 2)) - -static void -imdi_k144( -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 short *ip0 = (unsigned short *)inp[0]; - unsigned short *op0 = (unsigned short *)outp[0]; - unsigned short *ep = ip0 + npix * 5 ; - pointer it0 = (pointer)p->in_tables[0]; - pointer it1 = (pointer)p->in_tables[1]; - pointer it2 = (pointer)p->in_tables[2]; - pointer it3 = (pointer)p->in_tables[3]; - pointer it4 = (pointer)p->in_tables[4]; - pointer ot0 = (pointer)p->out_tables[0]; - pointer ot1 = (pointer)p->out_tables[1]; - pointer ot2 = (pointer)p->out_tables[2]; - pointer ot3 = (pointer)p->out_tables[3]; - pointer ot4 = (pointer)p->out_tables[4]; - pointer ot5 = (pointer)p->out_tables[5]; - pointer ot6 = (pointer)p->out_tables[6]; - pointer ot7 = (pointer)p->out_tables[7]; - pointer im_base = (pointer)p->im_table; - - for(;ip0 < ep; ip0 += 5, op0 += 8) { - unsigned int ova0; /* Output value accumulator */ - unsigned int ova1; /* Output value accumulator */ - unsigned int ova2; /* Output value accumulator */ - unsigned int ova3; /* Output value accumulator */ - unsigned int ova4; /* Output value accumulator */ - unsigned int ova5; /* Output value accumulator */ - unsigned int ova6; /* Output value accumulator */ - unsigned int ova7; /* Output value accumulator */ - { - pointer imp; - unsigned int we0; /* Weighting value variable */ - unsigned int vo0; /* Vertex offset variable */ - unsigned int we1; /* Weighting value variable */ - unsigned int vo1; /* Vertex offset variable */ - unsigned int we2; /* Weighting value variable */ - unsigned int vo2; /* Vertex offset variable */ - unsigned int we3; /* Weighting value variable */ - unsigned int vo3; /* Vertex offset variable */ - unsigned int we4; /* Weighting value variable */ - unsigned int vo4; /* Vertex offset variable */ - { - unsigned int ti_i; /* Interpolation index variable */ - - ti_i = IT_IX(it0, ip0[0]); - we0 = IT_WE(it0, ip0[0]); - vo0 = IT_VO(it0, ip0[0]); - ti_i += IT_IX(it1, ip0[1]); - we1 = IT_WE(it1, ip0[1]); - vo1 = IT_VO(it1, ip0[1]); - ti_i += IT_IX(it2, ip0[2]); - we2 = IT_WE(it2, ip0[2]); - vo2 = IT_VO(it2, ip0[2]); - ti_i += IT_IX(it3, ip0[3]); - we3 = IT_WE(it3, ip0[3]); - vo3 = IT_VO(it3, ip0[3]); - ti_i += IT_IX(it4, ip0[4]); - we4 = IT_WE(it4, ip0[4]); - vo4 = IT_VO(it4, ip0[4]); - - imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */ - - /* Sort weighting values and vertex offset values */ - CEX(we0, vo0, we1, vo1); - CEX(we0, vo0, we2, vo2); - CEX(we0, vo0, we3, vo3); - CEX(we0, vo0, we4, vo4); - CEX(we1, vo1, we2, vo2); - CEX(we1, vo1, we3, vo3); - CEX(we1, vo1, we4, vo4); - CEX(we2, vo2, we3, vo3); - CEX(we2, vo2, we4, vo4); - CEX(we3, vo3, we4, vo4); - } - { - unsigned int vof; /* Vertex offset value */ - unsigned int vwe; /* Vertex weighting */ - - vof = 0; /* First vertex offset is 0 */ - vwe = 65536 - we0; /* Baricentric weighting */ - ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 = IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 = IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - ova5 = IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */ - ova6 = IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */ - ova7 = IM_FE(imp, vof, 7) * vwe; /* Accumulate weighted output values */ - vof += vo0; /* Move to next vertex */ - vwe = we0 - we1; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */ - ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */ - ova7 += IM_FE(imp, vof, 7) * vwe; /* Accumulate weighted output values */ - vof += vo1; /* Move to next vertex */ - vwe = we1 - we2; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */ - ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */ - ova7 += IM_FE(imp, vof, 7) * vwe; /* Accumulate weighted output values */ - vof += vo2; /* Move to next vertex */ - vwe = we2 - we3; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */ - ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */ - ova7 += IM_FE(imp, vof, 7) * vwe; /* Accumulate weighted output values */ - vof += vo3; /* Move to next vertex */ - vwe = we3 - we4; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */ - ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */ - ova7 += IM_FE(imp, vof, 7) * vwe; /* Accumulate weighted output values */ - vof += vo4; /* Move to next vertex */ - vwe = we4; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */ - ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */ - ova7 += IM_FE(imp, vof, 7) * vwe; /* Accumulate weighted output values */ - } - } - { - unsigned int oti; /* Vertex offset value */ - oti = ((ova0 >> 16) & 0xffff); /* Extract integer part of result */ - op0[0] = OT_E(ot0, oti); /* Write result */ - oti = ((ova1 >> 16) & 0xffff); /* Extract integer part of result */ - op0[1] = OT_E(ot1, oti); /* Write result */ - oti = ((ova2 >> 16) & 0xffff); /* Extract integer part of result */ - op0[2] = OT_E(ot2, oti); /* Write result */ - oti = ((ova3 >> 16) & 0xffff); /* Extract integer part of result */ - op0[3] = OT_E(ot3, oti); /* Write result */ - oti = ((ova4 >> 16) & 0xffff); /* Extract integer part of result */ - op0[4] = OT_E(ot4, oti); /* Write result */ - oti = ((ova5 >> 16) & 0xffff); /* Extract integer part of result */ - op0[5] = OT_E(ot5, oti); /* Write result */ - oti = ((ova6 >> 16) & 0xffff); /* Extract integer part of result */ - op0[6] = OT_E(ot6, oti); /* Write result */ - oti = ((ova7 >> 16) & 0xffff); /* Extract integer part of result */ - op0[7] = OT_E(ot7, oti); /* Write result */ - } - } -} -#undef IT_WE -#undef IT_VO -#undef IT_IX -#undef CEX -#undef IM_O -#undef IM_FE -#undef OT_E - -static void -imdi_k144_gen( -genspec *g /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x10, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x54, 0x00, 0x00, 0x00, 0x00, 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, 0x04, 0x08, - 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08, - 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7, - 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7, - 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08, - 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00, - 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7, - 0x2c, 0xf3, 0xdc, 0xb7, 0x35, 0x5f, 0x38, 0x5f, - 0x69, 0x31, 0x36, 0x5f, 0x69, 0x31, 0x36, 0x5f, - 0x66, 0x00, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00, - 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf, - 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08, - 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf, - 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x34, - 0x34, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01, - 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7, - 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7, - 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08, - 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08, - 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf, - 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7, - 0x00, 0xf0, 0x04, 0x08 - }; /* Structure image */ - - memcpy(g, data, sizeof(data)); /* Initialise the structure */ -} - -static void -imdi_k144_tab( -tabspec *t /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff - }; /* Structure image */ - - memcpy(t, data, sizeof(data)); /* Initialise the structure */ -} - -/* 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 = 6 - Input channel 0 bits = 16 - Input channel 0 increment = 6 - Input channel 1 bits = 16 - Input channel 1 increment = 6 - Input channel 2 bits = 16 - Input channel 2 increment = 6 - Input channel 3 bits = 16 - Input channel 3 increment = 6 - Input channel 4 bits = 16 - Input channel 4 increment = 6 - Input channel 5 bits = 16 - Input channel 5 increment = 6 - Input is channel interleaved - Input channels are separate words - Input value extraction is done in input table lookup - - Output channels per pixel = 8 - Output channel 0 bits = 16 - Output channel 0 increment = 8 - Output channel 1 bits = 16 - Output channel 1 increment = 8 - Output channel 2 bits = 16 - Output channel 2 increment = 8 - Output channel 3 bits = 16 - Output channel 3 increment = 8 - Output channel 4 bits = 16 - Output channel 4 increment = 8 - Output channel 5 bits = 16 - Output channel 5 increment = 8 - Output channel 6 bits = 16 - Output channel 6 increment = 8 - Output channel 7 bits = 16 - Output channel 7 increment = 8 - Output is channel interleaved - - Output channels are separate words - Weight+voffset bits = 32 - Interpolation table index bits = 32 - Interpolation table max resolution = 40 - */ - -/* - 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 <memory.h> -#include "imdi_imp.h" -#define IMDI_INCLUDED -#endif /* IMDI_INCLUDED */ - -#ifndef DEFINED_pointer -#define DEFINED_pointer -typedef unsigned char * pointer; -#endif - -/* Input table interp. index */ -#define IT_IX(p, off) *((unsigned int *)((p) + 0 + (off) * 12)) - -/* Input table input weighting enty */ -#define IT_WE(p, off) *((unsigned int *)((p) + 4 + (off) * 12)) - -/* Input table input offset value enty */ -#define IT_VO(p, off) *((unsigned int *)((p) + 8 + (off) * 12)) - -/* Conditional exchange for sorting */ -#define CEX(A, AA, B, BB) if (A < B) { \ - A ^= B; B ^= A; A ^= B; AA ^= BB; BB ^= AA; AA ^= BB; } - -/* Interpolation multi-dim. table access */ -#define IM_O(off) ((off) * 16) - -/* Interpolation table - get vertex values */ -#define IM_FE(p, v, c) ((unsigned int)*((unsigned short *)((p) + (v) * 8 + (c) * 2))) - -/* Output table indexes */ -#define OT_E(p, off) *((unsigned short *)((p) + (off) * 2)) - -static void -imdi_k145( -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 short *ip0 = (unsigned short *)inp[0]; - unsigned short *op0 = (unsigned short *)outp[0]; - unsigned short *ep = ip0 + npix * 6 ; - pointer it0 = (pointer)p->in_tables[0]; - pointer it1 = (pointer)p->in_tables[1]; - pointer it2 = (pointer)p->in_tables[2]; - pointer it3 = (pointer)p->in_tables[3]; - pointer it4 = (pointer)p->in_tables[4]; - pointer it5 = (pointer)p->in_tables[5]; - pointer ot0 = (pointer)p->out_tables[0]; - pointer ot1 = (pointer)p->out_tables[1]; - pointer ot2 = (pointer)p->out_tables[2]; - pointer ot3 = (pointer)p->out_tables[3]; - pointer ot4 = (pointer)p->out_tables[4]; - pointer ot5 = (pointer)p->out_tables[5]; - pointer ot6 = (pointer)p->out_tables[6]; - pointer ot7 = (pointer)p->out_tables[7]; - pointer im_base = (pointer)p->im_table; - - for(;ip0 < ep; ip0 += 6, op0 += 8) { - unsigned int ova0; /* Output value accumulator */ - unsigned int ova1; /* Output value accumulator */ - unsigned int ova2; /* Output value accumulator */ - unsigned int ova3; /* Output value accumulator */ - unsigned int ova4; /* Output value accumulator */ - unsigned int ova5; /* Output value accumulator */ - unsigned int ova6; /* Output value accumulator */ - unsigned int ova7; /* Output value accumulator */ - { - pointer imp; - unsigned int we0; /* Weighting value variable */ - unsigned int vo0; /* Vertex offset variable */ - unsigned int we1; /* Weighting value variable */ - unsigned int vo1; /* Vertex offset variable */ - unsigned int we2; /* Weighting value variable */ - unsigned int vo2; /* Vertex offset variable */ - unsigned int we3; /* Weighting value variable */ - unsigned int vo3; /* Vertex offset variable */ - unsigned int we4; /* Weighting value variable */ - unsigned int vo4; /* Vertex offset variable */ - unsigned int we5; /* Weighting value variable */ - unsigned int vo5; /* Vertex offset variable */ - { - unsigned int ti_i; /* Interpolation index variable */ - - ti_i = IT_IX(it0, ip0[0]); - we0 = IT_WE(it0, ip0[0]); - vo0 = IT_VO(it0, ip0[0]); - ti_i += IT_IX(it1, ip0[1]); - we1 = IT_WE(it1, ip0[1]); - vo1 = IT_VO(it1, ip0[1]); - ti_i += IT_IX(it2, ip0[2]); - we2 = IT_WE(it2, ip0[2]); - vo2 = IT_VO(it2, ip0[2]); - ti_i += IT_IX(it3, ip0[3]); - we3 = IT_WE(it3, ip0[3]); - vo3 = IT_VO(it3, ip0[3]); - ti_i += IT_IX(it4, ip0[4]); - we4 = IT_WE(it4, ip0[4]); - vo4 = IT_VO(it4, ip0[4]); - ti_i += IT_IX(it5, ip0[5]); - we5 = IT_WE(it5, ip0[5]); - vo5 = IT_VO(it5, ip0[5]); - - imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */ - - /* Sort weighting values and vertex offset values */ - CEX(we0, vo0, we1, vo1); - CEX(we0, vo0, we2, vo2); - CEX(we0, vo0, we3, vo3); - CEX(we0, vo0, we4, vo4); - CEX(we0, vo0, we5, vo5); - CEX(we1, vo1, we2, vo2); - CEX(we1, vo1, we3, vo3); - CEX(we1, vo1, we4, vo4); - CEX(we1, vo1, we5, vo5); - CEX(we2, vo2, we3, vo3); - CEX(we2, vo2, we4, vo4); - CEX(we2, vo2, we5, vo5); - CEX(we3, vo3, we4, vo4); - CEX(we3, vo3, we5, vo5); - CEX(we4, vo4, we5, vo5); - } - { - unsigned int vof; /* Vertex offset value */ - unsigned int vwe; /* Vertex weighting */ - - vof = 0; /* First vertex offset is 0 */ - vwe = 65536 - we0; /* Baricentric weighting */ - ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 = IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 = IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - ova5 = IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */ - ova6 = IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */ - ova7 = IM_FE(imp, vof, 7) * vwe; /* Accumulate weighted output values */ - vof += vo0; /* Move to next vertex */ - vwe = we0 - we1; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */ - ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */ - ova7 += IM_FE(imp, vof, 7) * vwe; /* Accumulate weighted output values */ - vof += vo1; /* Move to next vertex */ - vwe = we1 - we2; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */ - ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */ - ova7 += IM_FE(imp, vof, 7) * vwe; /* Accumulate weighted output values */ - vof += vo2; /* Move to next vertex */ - vwe = we2 - we3; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */ - ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */ - ova7 += IM_FE(imp, vof, 7) * vwe; /* Accumulate weighted output values */ - vof += vo3; /* Move to next vertex */ - vwe = we3 - we4; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */ - ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */ - ova7 += IM_FE(imp, vof, 7) * vwe; /* Accumulate weighted output values */ - vof += vo4; /* Move to next vertex */ - vwe = we4 - we5; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */ - ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */ - ova7 += IM_FE(imp, vof, 7) * vwe; /* Accumulate weighted output values */ - vof += vo5; /* Move to next vertex */ - vwe = we5; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */ - ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */ - ova7 += IM_FE(imp, vof, 7) * vwe; /* Accumulate weighted output values */ - } - } - { - unsigned int oti; /* Vertex offset value */ - oti = ((ova0 >> 16) & 0xffff); /* Extract integer part of result */ - op0[0] = OT_E(ot0, oti); /* Write result */ - oti = ((ova1 >> 16) & 0xffff); /* Extract integer part of result */ - op0[1] = OT_E(ot1, oti); /* Write result */ - oti = ((ova2 >> 16) & 0xffff); /* Extract integer part of result */ - op0[2] = OT_E(ot2, oti); /* Write result */ - oti = ((ova3 >> 16) & 0xffff); /* Extract integer part of result */ - op0[3] = OT_E(ot3, oti); /* Write result */ - oti = ((ova4 >> 16) & 0xffff); /* Extract integer part of result */ - op0[4] = OT_E(ot4, oti); /* Write result */ - oti = ((ova5 >> 16) & 0xffff); /* Extract integer part of result */ - op0[5] = OT_E(ot5, oti); /* Write result */ - oti = ((ova6 >> 16) & 0xffff); /* Extract integer part of result */ - op0[6] = OT_E(ot6, oti); /* Write result */ - oti = ((ova7 >> 16) & 0xffff); /* Extract integer part of result */ - op0[7] = OT_E(ot7, oti); /* Write result */ - } - } -} -#undef IT_WE -#undef IT_VO -#undef IT_IX -#undef CEX -#undef IM_O -#undef IM_FE -#undef OT_E - -static void -imdi_k145_gen( -genspec *g /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x10, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x28, 0x00, 0x00, 0x00, 0x00, 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, 0x04, 0x08, - 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08, - 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7, - 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7, - 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08, - 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00, - 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7, - 0x2c, 0xf3, 0xdc, 0xb7, 0x36, 0x5f, 0x38, 0x5f, - 0x69, 0x31, 0x36, 0x5f, 0x69, 0x31, 0x36, 0x5f, - 0x66, 0x00, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00, - 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf, - 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08, - 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf, - 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x34, - 0x35, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01, - 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7, - 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7, - 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08, - 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08, - 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf, - 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7, - 0x00, 0xf0, 0x04, 0x08 - }; /* Structure image */ - - memcpy(g, data, sizeof(data)); /* Initialise the structure */ -} - -static void -imdi_k145_tab( -tabspec *t /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff - }; /* Structure image */ - - memcpy(t, data, sizeof(data)); /* Initialise the structure */ -} - -/* 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 = 7 - Input channel 0 bits = 16 - Input channel 0 increment = 7 - Input channel 1 bits = 16 - Input channel 1 increment = 7 - Input channel 2 bits = 16 - Input channel 2 increment = 7 - Input channel 3 bits = 16 - Input channel 3 increment = 7 - Input channel 4 bits = 16 - Input channel 4 increment = 7 - Input channel 5 bits = 16 - Input channel 5 increment = 7 - Input channel 6 bits = 16 - Input channel 6 increment = 7 - Input is channel interleaved - Input channels are separate words - Input value extraction is done in input table lookup - - Output channels per pixel = 8 - Output channel 0 bits = 16 - Output channel 0 increment = 8 - Output channel 1 bits = 16 - Output channel 1 increment = 8 - Output channel 2 bits = 16 - Output channel 2 increment = 8 - Output channel 3 bits = 16 - Output channel 3 increment = 8 - Output channel 4 bits = 16 - Output channel 4 increment = 8 - Output channel 5 bits = 16 - Output channel 5 increment = 8 - Output channel 6 bits = 16 - Output channel 6 increment = 8 - Output channel 7 bits = 16 - Output channel 7 increment = 8 - Output is channel interleaved - - Output channels are separate words - Weight+voffset bits = 32 - Interpolation table index bits = 32 - Interpolation table max resolution = 23 - */ - -/* - 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 <memory.h> -#include "imdi_imp.h" -#define IMDI_INCLUDED -#endif /* IMDI_INCLUDED */ - -#ifndef DEFINED_pointer -#define DEFINED_pointer -typedef unsigned char * pointer; -#endif - -/* Input table interp. index */ -#define IT_IX(p, off) *((unsigned int *)((p) + 0 + (off) * 12)) - -/* Input table input weighting enty */ -#define IT_WE(p, off) *((unsigned int *)((p) + 4 + (off) * 12)) - -/* Input table input offset value enty */ -#define IT_VO(p, off) *((unsigned int *)((p) + 8 + (off) * 12)) - -/* Conditional exchange for sorting */ -#define CEX(A, AA, B, BB) if (A < B) { \ - A ^= B; B ^= A; A ^= B; AA ^= BB; BB ^= AA; AA ^= BB; } - -/* Interpolation multi-dim. table access */ -#define IM_O(off) ((off) * 16) - -/* Interpolation table - get vertex values */ -#define IM_FE(p, v, c) ((unsigned int)*((unsigned short *)((p) + (v) * 8 + (c) * 2))) - -/* Output table indexes */ -#define OT_E(p, off) *((unsigned short *)((p) + (off) * 2)) - -static void -imdi_k146( -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 short *ip0 = (unsigned short *)inp[0]; - unsigned short *op0 = (unsigned short *)outp[0]; - unsigned short *ep = ip0 + npix * 7 ; - pointer it0 = (pointer)p->in_tables[0]; - pointer it1 = (pointer)p->in_tables[1]; - pointer it2 = (pointer)p->in_tables[2]; - pointer it3 = (pointer)p->in_tables[3]; - pointer it4 = (pointer)p->in_tables[4]; - pointer it5 = (pointer)p->in_tables[5]; - pointer it6 = (pointer)p->in_tables[6]; - pointer ot0 = (pointer)p->out_tables[0]; - pointer ot1 = (pointer)p->out_tables[1]; - pointer ot2 = (pointer)p->out_tables[2]; - pointer ot3 = (pointer)p->out_tables[3]; - pointer ot4 = (pointer)p->out_tables[4]; - pointer ot5 = (pointer)p->out_tables[5]; - pointer ot6 = (pointer)p->out_tables[6]; - pointer ot7 = (pointer)p->out_tables[7]; - pointer im_base = (pointer)p->im_table; - - for(;ip0 < ep; ip0 += 7, op0 += 8) { - unsigned int ova0; /* Output value accumulator */ - unsigned int ova1; /* Output value accumulator */ - unsigned int ova2; /* Output value accumulator */ - unsigned int ova3; /* Output value accumulator */ - unsigned int ova4; /* Output value accumulator */ - unsigned int ova5; /* Output value accumulator */ - unsigned int ova6; /* Output value accumulator */ - unsigned int ova7; /* Output value accumulator */ - { - pointer imp; - unsigned int we0; /* Weighting value variable */ - unsigned int vo0; /* Vertex offset variable */ - unsigned int we1; /* Weighting value variable */ - unsigned int vo1; /* Vertex offset variable */ - unsigned int we2; /* Weighting value variable */ - unsigned int vo2; /* Vertex offset variable */ - unsigned int we3; /* Weighting value variable */ - unsigned int vo3; /* Vertex offset variable */ - unsigned int we4; /* Weighting value variable */ - unsigned int vo4; /* Vertex offset variable */ - unsigned int we5; /* Weighting value variable */ - unsigned int vo5; /* Vertex offset variable */ - unsigned int we6; /* Weighting value variable */ - unsigned int vo6; /* Vertex offset variable */ - { - unsigned int ti_i; /* Interpolation index variable */ - - ti_i = IT_IX(it0, ip0[0]); - we0 = IT_WE(it0, ip0[0]); - vo0 = IT_VO(it0, ip0[0]); - ti_i += IT_IX(it1, ip0[1]); - we1 = IT_WE(it1, ip0[1]); - vo1 = IT_VO(it1, ip0[1]); - ti_i += IT_IX(it2, ip0[2]); - we2 = IT_WE(it2, ip0[2]); - vo2 = IT_VO(it2, ip0[2]); - ti_i += IT_IX(it3, ip0[3]); - we3 = IT_WE(it3, ip0[3]); - vo3 = IT_VO(it3, ip0[3]); - ti_i += IT_IX(it4, ip0[4]); - we4 = IT_WE(it4, ip0[4]); - vo4 = IT_VO(it4, ip0[4]); - ti_i += IT_IX(it5, ip0[5]); - we5 = IT_WE(it5, ip0[5]); - vo5 = IT_VO(it5, ip0[5]); - ti_i += IT_IX(it6, ip0[6]); - we6 = IT_WE(it6, ip0[6]); - vo6 = IT_VO(it6, ip0[6]); - - imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */ - - /* Sort weighting values and vertex offset values */ - CEX(we0, vo0, we1, vo1); - CEX(we0, vo0, we2, vo2); - CEX(we0, vo0, we3, vo3); - CEX(we0, vo0, we4, vo4); - CEX(we0, vo0, we5, vo5); - CEX(we0, vo0, we6, vo6); - CEX(we1, vo1, we2, vo2); - CEX(we1, vo1, we3, vo3); - CEX(we1, vo1, we4, vo4); - CEX(we1, vo1, we5, vo5); - CEX(we1, vo1, we6, vo6); - CEX(we2, vo2, we3, vo3); - CEX(we2, vo2, we4, vo4); - CEX(we2, vo2, we5, vo5); - CEX(we2, vo2, we6, vo6); - CEX(we3, vo3, we4, vo4); - CEX(we3, vo3, we5, vo5); - CEX(we3, vo3, we6, vo6); - CEX(we4, vo4, we5, vo5); - CEX(we4, vo4, we6, vo6); - CEX(we5, vo5, we6, vo6); - } - { - unsigned int vof; /* Vertex offset value */ - unsigned int vwe; /* Vertex weighting */ - - vof = 0; /* First vertex offset is 0 */ - vwe = 65536 - we0; /* Baricentric weighting */ - ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 = IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 = IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - ova5 = IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */ - ova6 = IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */ - ova7 = IM_FE(imp, vof, 7) * vwe; /* Accumulate weighted output values */ - vof += vo0; /* Move to next vertex */ - vwe = we0 - we1; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */ - ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */ - ova7 += IM_FE(imp, vof, 7) * vwe; /* Accumulate weighted output values */ - vof += vo1; /* Move to next vertex */ - vwe = we1 - we2; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */ - ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */ - ova7 += IM_FE(imp, vof, 7) * vwe; /* Accumulate weighted output values */ - vof += vo2; /* Move to next vertex */ - vwe = we2 - we3; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */ - ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */ - ova7 += IM_FE(imp, vof, 7) * vwe; /* Accumulate weighted output values */ - vof += vo3; /* Move to next vertex */ - vwe = we3 - we4; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */ - ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */ - ova7 += IM_FE(imp, vof, 7) * vwe; /* Accumulate weighted output values */ - vof += vo4; /* Move to next vertex */ - vwe = we4 - we5; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */ - ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */ - ova7 += IM_FE(imp, vof, 7) * vwe; /* Accumulate weighted output values */ - vof += vo5; /* Move to next vertex */ - vwe = we5 - we6; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */ - ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */ - ova7 += IM_FE(imp, vof, 7) * vwe; /* Accumulate weighted output values */ - vof += vo6; /* Move to next vertex */ - vwe = we6; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */ - ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */ - ova7 += IM_FE(imp, vof, 7) * vwe; /* Accumulate weighted output values */ - } - } - { - unsigned int oti; /* Vertex offset value */ - oti = ((ova0 >> 16) & 0xffff); /* Extract integer part of result */ - op0[0] = OT_E(ot0, oti); /* Write result */ - oti = ((ova1 >> 16) & 0xffff); /* Extract integer part of result */ - op0[1] = OT_E(ot1, oti); /* Write result */ - oti = ((ova2 >> 16) & 0xffff); /* Extract integer part of result */ - op0[2] = OT_E(ot2, oti); /* Write result */ - oti = ((ova3 >> 16) & 0xffff); /* Extract integer part of result */ - op0[3] = OT_E(ot3, oti); /* Write result */ - oti = ((ova4 >> 16) & 0xffff); /* Extract integer part of result */ - op0[4] = OT_E(ot4, oti); /* Write result */ - oti = ((ova5 >> 16) & 0xffff); /* Extract integer part of result */ - op0[5] = OT_E(ot5, oti); /* Write result */ - oti = ((ova6 >> 16) & 0xffff); /* Extract integer part of result */ - op0[6] = OT_E(ot6, oti); /* Write result */ - oti = ((ova7 >> 16) & 0xffff); /* Extract integer part of result */ - op0[7] = OT_E(ot7, oti); /* Write result */ - } - } -} -#undef IT_WE -#undef IT_VO -#undef IT_IX -#undef CEX -#undef IM_O -#undef IM_FE -#undef OT_E - -static void -imdi_k146_gen( -genspec *g /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x10, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x17, 0x00, 0x00, 0x00, 0x00, 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, 0x04, 0x08, - 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08, - 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7, - 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7, - 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08, - 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00, - 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7, - 0x2c, 0xf3, 0xdc, 0xb7, 0x37, 0x5f, 0x38, 0x5f, - 0x69, 0x31, 0x36, 0x5f, 0x69, 0x31, 0x36, 0x5f, - 0x66, 0x00, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00, - 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf, - 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08, - 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf, - 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x34, - 0x36, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01, - 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7, - 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7, - 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08, - 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08, - 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf, - 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7, - 0x00, 0xf0, 0x04, 0x08 - }; /* Structure image */ - - memcpy(g, data, sizeof(data)); /* Initialise the structure */ -} - -static void -imdi_k146_tab( -tabspec *t /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff - }; /* Structure image */ - - memcpy(t, data, sizeof(data)); /* Initialise the structure */ -} - -/* 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 = 8 - Input channel 0 bits = 16 - Input channel 0 increment = 8 - Input channel 1 bits = 16 - Input channel 1 increment = 8 - Input channel 2 bits = 16 - Input channel 2 increment = 8 - Input channel 3 bits = 16 - Input channel 3 increment = 8 - Input channel 4 bits = 16 - Input channel 4 increment = 8 - Input channel 5 bits = 16 - Input channel 5 increment = 8 - Input channel 6 bits = 16 - Input channel 6 increment = 8 - Input channel 7 bits = 16 - Input channel 7 increment = 8 - Input is channel interleaved - Input channels are separate words - Input value extraction is done in input table lookup - - Output channels per pixel = 8 - Output channel 0 bits = 16 - Output channel 0 increment = 8 - Output channel 1 bits = 16 - Output channel 1 increment = 8 - Output channel 2 bits = 16 - Output channel 2 increment = 8 - Output channel 3 bits = 16 - Output channel 3 increment = 8 - Output channel 4 bits = 16 - Output channel 4 increment = 8 - Output channel 5 bits = 16 - Output channel 5 increment = 8 - Output channel 6 bits = 16 - Output channel 6 increment = 8 - Output channel 7 bits = 16 - Output channel 7 increment = 8 - Output is channel interleaved - - Output channels are separate words - Weight+voffset bits = 32 - Interpolation table index bits = 32 - Interpolation table max resolution = 16 - */ - -/* - 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 <memory.h> -#include "imdi_imp.h" -#define IMDI_INCLUDED -#endif /* IMDI_INCLUDED */ - -#ifndef DEFINED_pointer -#define DEFINED_pointer -typedef unsigned char * pointer; -#endif - -/* Input table interp. index */ -#define IT_IX(p, off) *((unsigned int *)((p) + 0 + (off) * 12)) - -/* Input table input weighting enty */ -#define IT_WE(p, off) *((unsigned int *)((p) + 4 + (off) * 12)) - -/* Input table input offset value enty */ -#define IT_VO(p, off) *((unsigned int *)((p) + 8 + (off) * 12)) - -/* Conditional exchange for sorting */ -#define CEX(A, AA, B, BB) if (A < B) { \ - A ^= B; B ^= A; A ^= B; AA ^= BB; BB ^= AA; AA ^= BB; } - -/* Interpolation multi-dim. table access */ -#define IM_O(off) ((off) * 16) - -/* Interpolation table - get vertex values */ -#define IM_FE(p, v, c) ((unsigned int)*((unsigned short *)((p) + (v) * 8 + (c) * 2))) - -/* Output table indexes */ -#define OT_E(p, off) *((unsigned short *)((p) + (off) * 2)) - -static void -imdi_k147( -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 short *ip0 = (unsigned short *)inp[0]; - unsigned short *op0 = (unsigned short *)outp[0]; - unsigned short *ep = ip0 + npix * 8 ; - pointer it0 = (pointer)p->in_tables[0]; - pointer it1 = (pointer)p->in_tables[1]; - pointer it2 = (pointer)p->in_tables[2]; - pointer it3 = (pointer)p->in_tables[3]; - pointer it4 = (pointer)p->in_tables[4]; - pointer it5 = (pointer)p->in_tables[5]; - pointer it6 = (pointer)p->in_tables[6]; - pointer it7 = (pointer)p->in_tables[7]; - pointer ot0 = (pointer)p->out_tables[0]; - pointer ot1 = (pointer)p->out_tables[1]; - pointer ot2 = (pointer)p->out_tables[2]; - pointer ot3 = (pointer)p->out_tables[3]; - pointer ot4 = (pointer)p->out_tables[4]; - pointer ot5 = (pointer)p->out_tables[5]; - pointer ot6 = (pointer)p->out_tables[6]; - pointer ot7 = (pointer)p->out_tables[7]; - pointer im_base = (pointer)p->im_table; - - for(;ip0 < ep; ip0 += 8, op0 += 8) { - unsigned int ova0; /* Output value accumulator */ - unsigned int ova1; /* Output value accumulator */ - unsigned int ova2; /* Output value accumulator */ - unsigned int ova3; /* Output value accumulator */ - unsigned int ova4; /* Output value accumulator */ - unsigned int ova5; /* Output value accumulator */ - unsigned int ova6; /* Output value accumulator */ - unsigned int ova7; /* Output value accumulator */ - { - pointer imp; - unsigned int we0; /* Weighting value variable */ - unsigned int vo0; /* Vertex offset variable */ - unsigned int we1; /* Weighting value variable */ - unsigned int vo1; /* Vertex offset variable */ - unsigned int we2; /* Weighting value variable */ - unsigned int vo2; /* Vertex offset variable */ - unsigned int we3; /* Weighting value variable */ - unsigned int vo3; /* Vertex offset variable */ - unsigned int we4; /* Weighting value variable */ - unsigned int vo4; /* Vertex offset variable */ - unsigned int we5; /* Weighting value variable */ - unsigned int vo5; /* Vertex offset variable */ - unsigned int we6; /* Weighting value variable */ - unsigned int vo6; /* Vertex offset variable */ - unsigned int we7; /* Weighting value variable */ - unsigned int vo7; /* Vertex offset variable */ - { - unsigned int ti_i; /* Interpolation index variable */ - - ti_i = IT_IX(it0, ip0[0]); - we0 = IT_WE(it0, ip0[0]); - vo0 = IT_VO(it0, ip0[0]); - ti_i += IT_IX(it1, ip0[1]); - we1 = IT_WE(it1, ip0[1]); - vo1 = IT_VO(it1, ip0[1]); - ti_i += IT_IX(it2, ip0[2]); - we2 = IT_WE(it2, ip0[2]); - vo2 = IT_VO(it2, ip0[2]); - ti_i += IT_IX(it3, ip0[3]); - we3 = IT_WE(it3, ip0[3]); - vo3 = IT_VO(it3, ip0[3]); - ti_i += IT_IX(it4, ip0[4]); - we4 = IT_WE(it4, ip0[4]); - vo4 = IT_VO(it4, ip0[4]); - ti_i += IT_IX(it5, ip0[5]); - we5 = IT_WE(it5, ip0[5]); - vo5 = IT_VO(it5, ip0[5]); - ti_i += IT_IX(it6, ip0[6]); - we6 = IT_WE(it6, ip0[6]); - vo6 = IT_VO(it6, ip0[6]); - ti_i += IT_IX(it7, ip0[7]); - we7 = IT_WE(it7, ip0[7]); - vo7 = IT_VO(it7, ip0[7]); - - imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */ - - /* Sort weighting values and vertex offset values */ - CEX(we0, vo0, we1, vo1); - CEX(we0, vo0, we2, vo2); - CEX(we0, vo0, we3, vo3); - CEX(we0, vo0, we4, vo4); - CEX(we0, vo0, we5, vo5); - CEX(we0, vo0, we6, vo6); - CEX(we0, vo0, we7, vo7); - CEX(we1, vo1, we2, vo2); - CEX(we1, vo1, we3, vo3); - CEX(we1, vo1, we4, vo4); - CEX(we1, vo1, we5, vo5); - CEX(we1, vo1, we6, vo6); - CEX(we1, vo1, we7, vo7); - CEX(we2, vo2, we3, vo3); - CEX(we2, vo2, we4, vo4); - CEX(we2, vo2, we5, vo5); - CEX(we2, vo2, we6, vo6); - CEX(we2, vo2, we7, vo7); - CEX(we3, vo3, we4, vo4); - CEX(we3, vo3, we5, vo5); - CEX(we3, vo3, we6, vo6); - CEX(we3, vo3, we7, vo7); - CEX(we4, vo4, we5, vo5); - CEX(we4, vo4, we6, vo6); - CEX(we4, vo4, we7, vo7); - CEX(we5, vo5, we6, vo6); - CEX(we5, vo5, we7, vo7); - CEX(we6, vo6, we7, vo7); - } - { - unsigned int vof; /* Vertex offset value */ - unsigned int vwe; /* Vertex weighting */ - - vof = 0; /* First vertex offset is 0 */ - vwe = 65536 - we0; /* Baricentric weighting */ - ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 = IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 = IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - ova5 = IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */ - ova6 = IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */ - ova7 = IM_FE(imp, vof, 7) * vwe; /* Accumulate weighted output values */ - vof += vo0; /* Move to next vertex */ - vwe = we0 - we1; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */ - ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */ - ova7 += IM_FE(imp, vof, 7) * vwe; /* Accumulate weighted output values */ - vof += vo1; /* Move to next vertex */ - vwe = we1 - we2; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */ - ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */ - ova7 += IM_FE(imp, vof, 7) * vwe; /* Accumulate weighted output values */ - vof += vo2; /* Move to next vertex */ - vwe = we2 - we3; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */ - ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */ - ova7 += IM_FE(imp, vof, 7) * vwe; /* Accumulate weighted output values */ - vof += vo3; /* Move to next vertex */ - vwe = we3 - we4; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */ - ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */ - ova7 += IM_FE(imp, vof, 7) * vwe; /* Accumulate weighted output values */ - vof += vo4; /* Move to next vertex */ - vwe = we4 - we5; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */ - ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */ - ova7 += IM_FE(imp, vof, 7) * vwe; /* Accumulate weighted output values */ - vof += vo5; /* Move to next vertex */ - vwe = we5 - we6; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */ - ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */ - ova7 += IM_FE(imp, vof, 7) * vwe; /* Accumulate weighted output values */ - vof += vo6; /* Move to next vertex */ - vwe = we6 - we7; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */ - ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */ - ova7 += IM_FE(imp, vof, 7) * vwe; /* Accumulate weighted output values */ - vof += vo7; /* Move to next vertex */ - vwe = we7; /* Baricentric weighting */ - ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */ - ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */ - ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */ - ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */ - ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */ - ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */ - ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */ - ova7 += IM_FE(imp, vof, 7) * vwe; /* Accumulate weighted output values */ - } - } - { - unsigned int oti; /* Vertex offset value */ - oti = ((ova0 >> 16) & 0xffff); /* Extract integer part of result */ - op0[0] = OT_E(ot0, oti); /* Write result */ - oti = ((ova1 >> 16) & 0xffff); /* Extract integer part of result */ - op0[1] = OT_E(ot1, oti); /* Write result */ - oti = ((ova2 >> 16) & 0xffff); /* Extract integer part of result */ - op0[2] = OT_E(ot2, oti); /* Write result */ - oti = ((ova3 >> 16) & 0xffff); /* Extract integer part of result */ - op0[3] = OT_E(ot3, oti); /* Write result */ - oti = ((ova4 >> 16) & 0xffff); /* Extract integer part of result */ - op0[4] = OT_E(ot4, oti); /* Write result */ - oti = ((ova5 >> 16) & 0xffff); /* Extract integer part of result */ - op0[5] = OT_E(ot5, oti); /* Write result */ - oti = ((ova6 >> 16) & 0xffff); /* Extract integer part of result */ - op0[6] = OT_E(ot6, oti); /* Write result */ - oti = ((ova7 >> 16) & 0xffff); /* Extract integer part of result */ - op0[7] = OT_E(ot7, oti); /* Write result */ - } - } -} -#undef IT_WE -#undef IT_VO -#undef IT_IX -#undef CEX -#undef IM_O -#undef IM_FE -#undef OT_E - -static void -imdi_k147_gen( -genspec *g /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x00, 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, 0x04, 0x08, - 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08, - 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7, - 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7, - 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08, - 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00, - 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7, - 0x2c, 0xf3, 0xdc, 0xb7, 0x38, 0x5f, 0x38, 0x5f, - 0x69, 0x31, 0x36, 0x5f, 0x69, 0x31, 0x36, 0x5f, - 0x66, 0x00, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00, - 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf, - 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08, - 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7, - 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf, - 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x34, - 0x37, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01, - 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7, - 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7, - 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08, - 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08, - 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf, - 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08, - 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7, - 0x00, 0xf0, 0x04, 0x08 - }; /* Structure image */ - - memcpy(g, data, sizeof(data)); /* Initialise the structure */ -} - -static void -imdi_k147_tab( -tabspec *t /* structure to be initialised */ -) { - static unsigned char data[] = { - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff - }; /* Structure image */ - - memcpy(t, data, sizeof(data)); /* Initialise the structure */ -} diff --git a/gs/imdi/imdi_k.h b/gs/imdi/imdi_k.h deleted file mode 100644 index c71f60455..000000000 --- a/gs/imdi/imdi_k.h +++ /dev/null @@ -1,160 +0,0 @@ -/* Declarations for all the generated kernel functions */ -/* This file is generated by imdi_gen */ - -#include "imdi_k.c" /* All the kernel code */ - -struct { - void (*interp)(imdi *s, void **outp, void **inp, unsigned int npix); - void (*gen)(genspec *g); - void (*tab)(tabspec *t); -} ktable[147] = { - { imdi_k1, imdi_k1_gen, imdi_k1_tab }, - { imdi_k2, imdi_k2_gen, imdi_k2_tab }, - { imdi_k3, imdi_k3_gen, imdi_k3_tab }, - { imdi_k4, imdi_k4_gen, imdi_k4_tab }, - { imdi_k5, imdi_k5_gen, imdi_k5_tab }, - { imdi_k6, imdi_k6_gen, imdi_k6_tab }, - { imdi_k7, imdi_k7_gen, imdi_k7_tab }, - { imdi_k8, imdi_k8_gen, imdi_k8_tab }, - { imdi_k9, imdi_k9_gen, imdi_k9_tab }, - { imdi_k10, imdi_k10_gen, imdi_k10_tab }, - { imdi_k11, imdi_k11_gen, imdi_k11_tab }, - { imdi_k12, imdi_k12_gen, imdi_k12_tab }, - { imdi_k13, imdi_k13_gen, imdi_k13_tab }, - { imdi_k14, imdi_k14_gen, imdi_k14_tab }, - { imdi_k15, imdi_k15_gen, imdi_k15_tab }, - { imdi_k16, imdi_k16_gen, imdi_k16_tab }, - { imdi_k17, imdi_k17_gen, imdi_k17_tab }, - { imdi_k18, imdi_k18_gen, imdi_k18_tab }, - { imdi_k19, imdi_k19_gen, imdi_k19_tab }, - { imdi_k20, imdi_k20_gen, imdi_k20_tab }, - { imdi_k21, imdi_k21_gen, imdi_k21_tab }, - { imdi_k22, imdi_k22_gen, imdi_k22_tab }, - { imdi_k23, imdi_k23_gen, imdi_k23_tab }, - { imdi_k24, imdi_k24_gen, imdi_k24_tab }, - { imdi_k25, imdi_k25_gen, imdi_k25_tab }, - { imdi_k26, imdi_k26_gen, imdi_k26_tab }, - { imdi_k27, imdi_k27_gen, imdi_k27_tab }, - { imdi_k28, imdi_k28_gen, imdi_k28_tab }, - { imdi_k29, imdi_k29_gen, imdi_k29_tab }, - { imdi_k30, imdi_k30_gen, imdi_k30_tab }, - { imdi_k31, imdi_k31_gen, imdi_k31_tab }, - { imdi_k32, imdi_k32_gen, imdi_k32_tab }, - { imdi_k33, imdi_k33_gen, imdi_k33_tab }, - { imdi_k34, imdi_k34_gen, imdi_k34_tab }, - { imdi_k35, imdi_k35_gen, imdi_k35_tab }, - { imdi_k36, imdi_k36_gen, imdi_k36_tab }, - { imdi_k37, imdi_k37_gen, imdi_k37_tab }, - { imdi_k38, imdi_k38_gen, imdi_k38_tab }, - { imdi_k39, imdi_k39_gen, imdi_k39_tab }, - { imdi_k40, imdi_k40_gen, imdi_k40_tab }, - { imdi_k41, imdi_k41_gen, imdi_k41_tab }, - { imdi_k42, imdi_k42_gen, imdi_k42_tab }, - { imdi_k43, imdi_k43_gen, imdi_k43_tab }, - { imdi_k44, imdi_k44_gen, imdi_k44_tab }, - { imdi_k45, imdi_k45_gen, imdi_k45_tab }, - { imdi_k46, imdi_k46_gen, imdi_k46_tab }, - { imdi_k47, imdi_k47_gen, imdi_k47_tab }, - { imdi_k48, imdi_k48_gen, imdi_k48_tab }, - { imdi_k49, imdi_k49_gen, imdi_k49_tab }, - { imdi_k50, imdi_k50_gen, imdi_k50_tab }, - { imdi_k51, imdi_k51_gen, imdi_k51_tab }, - { imdi_k52, imdi_k52_gen, imdi_k52_tab }, - { imdi_k53, imdi_k53_gen, imdi_k53_tab }, - { imdi_k54, imdi_k54_gen, imdi_k54_tab }, - { imdi_k55, imdi_k55_gen, imdi_k55_tab }, - { imdi_k56, imdi_k56_gen, imdi_k56_tab }, - { imdi_k57, imdi_k57_gen, imdi_k57_tab }, - { imdi_k58, imdi_k58_gen, imdi_k58_tab }, - { imdi_k59, imdi_k59_gen, imdi_k59_tab }, - { imdi_k60, imdi_k60_gen, imdi_k60_tab }, - { imdi_k61, imdi_k61_gen, imdi_k61_tab }, - { imdi_k62, imdi_k62_gen, imdi_k62_tab }, - { imdi_k63, imdi_k63_gen, imdi_k63_tab }, - { imdi_k64, imdi_k64_gen, imdi_k64_tab }, - { imdi_k65, imdi_k65_gen, imdi_k65_tab }, - { imdi_k66, imdi_k66_gen, imdi_k66_tab }, - { imdi_k67, imdi_k67_gen, imdi_k67_tab }, - { imdi_k68, imdi_k68_gen, imdi_k68_tab }, - { imdi_k69, imdi_k69_gen, imdi_k69_tab }, - { imdi_k70, imdi_k70_gen, imdi_k70_tab }, - { imdi_k71, imdi_k71_gen, imdi_k71_tab }, - { imdi_k72, imdi_k72_gen, imdi_k72_tab }, - { imdi_k73, imdi_k73_gen, imdi_k73_tab }, - { imdi_k74, imdi_k74_gen, imdi_k74_tab }, - { imdi_k75, imdi_k75_gen, imdi_k75_tab }, - { imdi_k76, imdi_k76_gen, imdi_k76_tab }, - { imdi_k77, imdi_k77_gen, imdi_k77_tab }, - { imdi_k78, imdi_k78_gen, imdi_k78_tab }, - { imdi_k79, imdi_k79_gen, imdi_k79_tab }, - { imdi_k80, imdi_k80_gen, imdi_k80_tab }, - { imdi_k81, imdi_k81_gen, imdi_k81_tab }, - { imdi_k82, imdi_k82_gen, imdi_k82_tab }, - { imdi_k83, imdi_k83_gen, imdi_k83_tab }, - { imdi_k84, imdi_k84_gen, imdi_k84_tab }, - { imdi_k85, imdi_k85_gen, imdi_k85_tab }, - { imdi_k86, imdi_k86_gen, imdi_k86_tab }, - { imdi_k87, imdi_k87_gen, imdi_k87_tab }, - { imdi_k88, imdi_k88_gen, imdi_k88_tab }, - { imdi_k89, imdi_k89_gen, imdi_k89_tab }, - { imdi_k90, imdi_k90_gen, imdi_k90_tab }, - { imdi_k91, imdi_k91_gen, imdi_k91_tab }, - { imdi_k92, imdi_k92_gen, imdi_k92_tab }, - { imdi_k93, imdi_k93_gen, imdi_k93_tab }, - { imdi_k94, imdi_k94_gen, imdi_k94_tab }, - { imdi_k95, imdi_k95_gen, imdi_k95_tab }, - { imdi_k96, imdi_k96_gen, imdi_k96_tab }, - { imdi_k97, imdi_k97_gen, imdi_k97_tab }, - { imdi_k98, imdi_k98_gen, imdi_k98_tab }, - { imdi_k99, imdi_k99_gen, imdi_k99_tab }, - { imdi_k100, imdi_k100_gen, imdi_k100_tab }, - { imdi_k101, imdi_k101_gen, imdi_k101_tab }, - { imdi_k102, imdi_k102_gen, imdi_k102_tab }, - { imdi_k103, imdi_k103_gen, imdi_k103_tab }, - { imdi_k104, imdi_k104_gen, imdi_k104_tab }, - { imdi_k105, imdi_k105_gen, imdi_k105_tab }, - { imdi_k106, imdi_k106_gen, imdi_k106_tab }, - { imdi_k107, imdi_k107_gen, imdi_k107_tab }, - { imdi_k108, imdi_k108_gen, imdi_k108_tab }, - { imdi_k109, imdi_k109_gen, imdi_k109_tab }, - { imdi_k110, imdi_k110_gen, imdi_k110_tab }, - { imdi_k111, imdi_k111_gen, imdi_k111_tab }, - { imdi_k112, imdi_k112_gen, imdi_k112_tab }, - { imdi_k113, imdi_k113_gen, imdi_k113_tab }, - { imdi_k114, imdi_k114_gen, imdi_k114_tab }, - { imdi_k115, imdi_k115_gen, imdi_k115_tab }, - { imdi_k116, imdi_k116_gen, imdi_k116_tab }, - { imdi_k117, imdi_k117_gen, imdi_k117_tab }, - { imdi_k118, imdi_k118_gen, imdi_k118_tab }, - { imdi_k119, imdi_k119_gen, imdi_k119_tab }, - { imdi_k120, imdi_k120_gen, imdi_k120_tab }, - { imdi_k121, imdi_k121_gen, imdi_k121_tab }, - { imdi_k122, imdi_k122_gen, imdi_k122_tab }, - { imdi_k123, imdi_k123_gen, imdi_k123_tab }, - { imdi_k124, imdi_k124_gen, imdi_k124_tab }, - { imdi_k125, imdi_k125_gen, imdi_k125_tab }, - { imdi_k126, imdi_k126_gen, imdi_k126_tab }, - { imdi_k127, imdi_k127_gen, imdi_k127_tab }, - { imdi_k128, imdi_k128_gen, imdi_k128_tab }, - { imdi_k129, imdi_k129_gen, imdi_k129_tab }, - { imdi_k130, imdi_k130_gen, imdi_k130_tab }, - { imdi_k131, imdi_k131_gen, imdi_k131_tab }, - { imdi_k132, imdi_k132_gen, imdi_k132_tab }, - { imdi_k133, imdi_k133_gen, imdi_k133_tab }, - { imdi_k134, imdi_k134_gen, imdi_k134_tab }, - { imdi_k135, imdi_k135_gen, imdi_k135_tab }, - { imdi_k136, imdi_k136_gen, imdi_k136_tab }, - { imdi_k137, imdi_k137_gen, imdi_k137_tab }, - { imdi_k138, imdi_k138_gen, imdi_k138_tab }, - { imdi_k139, imdi_k139_gen, imdi_k139_tab }, - { imdi_k140, imdi_k140_gen, imdi_k140_tab }, - { imdi_k141, imdi_k141_gen, imdi_k141_tab }, - { imdi_k142, imdi_k142_gen, imdi_k142_tab }, - { imdi_k143, imdi_k143_gen, imdi_k143_tab }, - { imdi_k144, imdi_k144_gen, imdi_k144_tab }, - { imdi_k145, imdi_k145_gen, imdi_k145_tab }, - { imdi_k146, imdi_k146_gen, imdi_k146_tab }, - { imdi_k147, imdi_k147_gen, imdi_k147_tab } -}; - -int no_kfuncs = 147; diff --git a/gs/imdi/imdi_tab.c b/gs/imdi/imdi_tab.c deleted file mode 100644 index 4a389f5f1..000000000 --- a/gs/imdi/imdi_tab.c +++ /dev/null @@ -1,687 +0,0 @@ -/* Integer Multi-Dimensional Interpolation */ -/* - * Copyright 2000 - 2002 Graeme W. Gill - * All rights reserved. - * - * This material is licenced under the GNU GENERAL PUBLIC LICENCE :- - * see the Licence.txt file for licencing details. - */ - -/* Run time table allocater and initialiser */ - -/* - * The function here that knows how to create the - * appropriate run time tables for our chosen kernel, - * and the color mapping we want to perform. - */ - -#include <stdio.h> -#include <stdlib.h> -#include <math.h> -#include <stdarg.h> -#include <string.h> - -#include "imdi_imp.h" -#include "imdi_gen.h" -#include "imdi_tab.h" - -#undef VERBOSE -#undef ASSERTS /* Check asserts */ - -#ifdef ASSERTS -#include <numlib.h> -#endif - -typedef unsigned char byte; - -/* Left shift, handles >= 32 properly */ -#define LSHIFT(aa, bb) ((bb) <= 31 ? ((aa) << (bb)) : (((aa) << 31) << ((bb)-31))) - -/* Specific entry size write routine */ - -void write_uchar( -byte *p, -#ifdef ALLOW64 -unsigned longlong v -#else -unsigned long v -#endif -) { - *((unsigned char *)p) = (unsigned char)v; -} - -void write_ushort( -byte *p, -#ifdef ALLOW64 -unsigned longlong v -#else -unsigned long v -#endif -) { - *((unsigned short *)p) = (unsigned short)v; -} - -void write_uint( -byte *p, -#ifdef ALLOW64 -unsigned longlong v -#else -unsigned long v -#endif -) { - *((unsigned int *)p) = (unsigned int)v; -} - -void write_ulong( -byte *p, -#ifdef ALLOW64 -unsigned longlong v -#else -unsigned long v -#endif -) { - *((unsigned long *)p) = (unsigned long)v; -} - -#ifdef ALLOW64 -void write_ulonglong( -byte *p, -unsigned longlong v -) { - *((unsigned longlong *)p) = (unsigned longlong)v; -} -#endif /* ALLOW64 */ - -void write_default( -byte *p, -#ifdef ALLOW64 -unsigned longlong v -#else -unsigned long v -#endif -) { - fprintf(stderr,"imdi_tabl: internal failure - unexpected write size!\n"); -*((char *)NULL) = 0; /* ~~999 */ - exit(-1); -} - -/* Array of write routines */ -#ifdef ALLOW64 -void (*write_entry[16])(byte *p, unsigned longlong v); -#else -void (*write_entry[16])(byte *p, unsigned long v); -#endif - -void -init_write_tab(void) { - int i; - - for (i = 0; i < 16; i++) - write_entry[i] = write_default; /* Make sure any un-inited access bombs */ - - write_entry[sizeof(unsigned char)] = write_uchar; - write_entry[sizeof(unsigned short)] = write_ushort; - write_entry[sizeof(unsigned int)] = write_uint; - write_entry[sizeof(unsigned long)] = write_ulong; -#ifdef ALLOW64 - write_entry[sizeof(unsigned longlong)] = write_ulonglong; -#endif /* ALLOW64 */ -} - -imdi_imp * -imdi_tab( - genspec *gs, /* Pointer to gen spec */ - tabspec *ts, /* Pointer to table spec */ - - /* Callbacks to lookup the mdi table values */ - double (*input_curve) (void *cntx, int ch, double in_val), - void (*md_table) (void *cntx, double *out_vals, double *in_vals), - double (*output_curve)(void *cntx, int ch, double in_val), - void *cntx /* Context to callbacks */ -) { - static inited = 0; - static bigend = 0; - int e; - imdi_imp *it; - unsigned long etest = 0xff; - int idinc[IXDI+1]; /* Increment for each dimension of interp table. */ - int ibdinc[IXDI+1]; /* idinc[] in bytes */ - int sdinc[IXDI+1]; /* Increment for each dimension of simplex table. */ - int sbdinc[IXDI+1]; /* sdinc[] in bytes */ - -#ifdef VERBOSE - printf("imdi_tab called\n"); -#endif - - if (inited == 0) { - init_write_tab(); - if (*((unsigned char *)&etest) == 0xff) - bigend = 0; /* Little endian */ - else - bigend = 1; /* Big endian */ - inited = 1; - } - - if ((it = (imdi_imp *)malloc(sizeof(imdi_imp))) == NULL) { -#ifdef VERBOSE - printf("malloc imdi_imp size %d failed\n",sizeof(imdi_imp)); -#endif - return NULL; /* Should we signal error ? How ? */ - } - - /* Compute interp and simplex table dimension increments & total sizes */ - idinc[0] = 1; - ibdinc[0] = ts->im_ts; - for (e = 1; e <= gs->id; e++) { - idinc[e] = idinc[e-1] * gs->itres; - ibdinc[e] = ibdinc[e-1] * gs->itres; - } - - if (!ts->sort) { - sdinc[0] = 1; - sbdinc[0] = ts->sm_ts; - for (e = 1; e <= gs->id; e++) { - sdinc[e] = sdinc[e-1] * gs->stres; - sbdinc[e] = sbdinc[e-1] * gs->stres; - } - } - - /* First we setup the input tables */ - for (e = 0; e < gs->id; e++) { - byte *t, *p; /* Pointer to input table, entry pointer */ - int ne; /* Number of entries */ - int ex; /* Entry index */ - int ix = 0; /* Extract flag */ - - /* Compute number of entries */ - if (ts->it_ix && !gs->in.packed) { /* Input is the whole bpch[] size */ - ix = 1; /* Need to do extraction in lookup */ - if (gs->in.pint) { - ne = (1 << (gs->in.bpch[0])); /* Same size used for all input tables */ - } else { - ne = (1 << (gs->in.bpch[e])); /* This input channels size */ - } - } else { /* Input is the value size */ - ne = (1 << (gs->in.bpv[e])); /* This input values size */ - } - - /* Allocate the table */ - if ((t = (byte *)malloc(ts->it_ts * ne)) == NULL) { -#ifdef VERBOSE - printf("malloc imdi input table size %d failed\n",ts->it_ts * ne); -#endif - return NULL; /* Should we signal error ? How ? */ - } - - /* For each possible input value, compute the entry value */ - for (ex = 0, p = t; ex < ne; ex++, p += ts->it_ts) { - int ee; - int iiv; /* Integer input value */ - int ivr; /* Input value range */ - int isb; /* Input sign bit/signed to offset displacement */ - double riv; /* Real input value, 0.0 - 1.0 */ - double rtv; /* Real transformed value, 0.0 - 1.0 */ - double rmi; /* Real interpolation table index */ - double rsi; /* Real simplex index */ - int imi; /* Interpiolation table index */ - int isi; /* Integer simplex index */ - int iwe; /* Integer weighting value */ - int vo; /* Vertex offset value */ - - if (ix) { /* Extract value from index */ - ivr = ((1 << (gs->in.bpv[e])) -1); - iiv = (ex >> gs->in.bov[e]) & ((1 << (gs->in.bpv[e])) -1); - } else { - ivr = (ne - 1); /* (Should be bpv[e], but take no chances!) */ - iiv = ex; /* Input value is simply index */ - } - isb = ivr & ~(((unsigned int)ivr) >> 1); /* Top bit */ - if (gs->in_signed & (1 << e)) /* Treat input as signed */ - iiv = (iiv & isb) ? iiv - isb : iiv + isb; /* Convert to offset from signed */ - riv = (double) iiv / (double)ivr; /* Compute floating point */ - rtv = input_curve(cntx, e, riv); /* Lookup the input table transform */ - if (rtv < 0.0) /* Guard against sillies */ - rtv = 0.0; - else if (rtv > 1.0) - rtv = 1.0; - - /* divide into interp base and cube sub index */ - rmi = rtv * (gs->itres - 1); - imi = (int)floor(rmi); /* Interp. entry coordinate */ - if (imi >= (gs->itres-1)) /* Keep cube base one row back from far edge */ - imi = gs->itres-2; - rsi = rmi - (double)imi; /* offset into entry cube */ - if (ts->sort) { - iwe = (int)((rsi * (1 << gs->prec)) + 0.5); /* Weighting scale */ - vo = idinc[e] * ts->vo_om; /* Vertex offset */ - } else { - isi = (int)((rsi * gs->stres) + 0.5); - if (isi == gs->stres) { /* Keep simplex index within table */ - isi = 0; - imi++; /* Move to next interp. lattice */ - } - isi *= sdinc[e]; /* Convert the raw indexes into offset in this dim */ - } - imi *= idinc[e]; /* Convert the raw indexes into offset in this dim */ - -#ifdef ASSERTS - /* ~~~ needs fixing for sort ~~~~ */ - if ((imi & (LSHIFT(1,ts->it_ab)-1)) != imi) - error("imdi_tab assert: (imi & ((1 << ts->it_ab)-1)) != imi, imi = 0x%x, it_ab = 0x%x\n",imi,ts->it_ab); - if (imi >= idinc[gs->id]) - error("imdi_tab assert: imi >= idinc[gs->id]\n"); - if ((isi & (LSHIFT(1,ts->sx_ab)-1)) != isi) - error("imdi_tab assert: (isi & ((1 << ts->sx_ab)-1)) != isi, isi = 0x%x, sx_ab = 0x%x\n",isi,ts->sx_ab); - if (!ts->sort && isi >= sdinc[gs->id]) - error("imdi_tab assert: isi >= sdinc[gs->id]\n"); -#endif - - /* Now stuff them into the table entry */ - if (ts->sort) { - if (ts->it_xs) { /* Separate interp index and weight/offset*/ - if (ts->wo_xs) { /* All 3 are separate */ - write_entry[ts->ix_es](p + ts->ix_eo, imi); - write_entry[ts->we_es](p + ts->we_eo, iwe); - write_entry[ts->vo_es](p + ts->vo_eo, vo); - } else { -#ifdef ALLOW64 - unsigned longlong iwo; -#else - unsigned long iwo; -#endif - - iwo = (iwe << ts->vo_ab) | vo; /* Combined weight+vertex offset */ - write_entry[ts->ix_es](p + ts->ix_eo, imi); - write_entry[ts->wo_es](p + ts->wo_eo, iwo); - } - } else { /* All 3 are combined */ -#ifdef ALLOW64 - unsigned longlong iit; -#else - unsigned long iit; -#endif - iit = (((imi << ts->we_ab) | iwe) << ts->vo_ab) | vo; - write_entry[ts->it_ts](p, iit); - } - } else { - if (ts->it_xs) { /* Separate interp index and weight/offset*/ - write_entry[ts->ix_es](p + ts->ix_eo, imi); - write_entry[ts->sx_es](p + ts->sx_eo, isi); - } else { -#ifdef ALLOW64 - unsigned longlong iit; -#else - unsigned long iit; -#endif - iit = (imi << ts->sx_ab) | isi; /* Combine interp and simplex indexes */ - write_entry[ts->it_ts](p, iit); - } - } - } - - /* Put table into place */ - it->in_tables[e] = (void *)t; - } - it->nintabs = e; - - /* Setup the interpolation table */ - { - byte *t, *p; /* Pointer to interp table, pointer to total entry */ - PHILBERT(phc) /* Pseudo Hilbert counter */ - double vscale; /* Value scale for fixed point */ - int vsize; /* Fixed point storage size */ - - if (ts->im_cd) - vsize = (gs->prec * 2)/8; /* Fixed point entry & computation size */ - else - vsize = gs->prec/8; /* Fixed point entry size */ - vscale = (1 << gs->prec) -1.0; /* Value scale for fixed point padding */ - /* -1.0 is to prevent carry after accumulation */ - /* Allocate the table */ - if ((t = (byte *)malloc(ibdinc[gs->id])) == NULL) { -#ifdef VERBOSE - printf("malloc imdi interpolation table size %d failed\n",ibdinc[gs->id]); -#endif - return NULL; /* Should we signal error ? How ? */ - } -#ifdef VERBOSE - printf("Allocated grid table = %d bytes\n",ibdinc[gs->id]); -#endif - - /* Get ready to access all the entries in the table */ - p = t; - PH_INIT(phc, gs->id, gs->itres) - - /* Create all the interpolation table entry values */ - do { - int ee, f; - double riv[IXDI]; /* Real input values */ - double rev[IXDO]; /* Real entry values */ - unsigned long iev; - byte *pp; /* Pointer to sub-entry */ - - for (e = 0, p = t; e < gs->id; e++) { - riv[e] = ((double)phc[e]) / (gs->itres - 1.0); - p += phc[e] * ibdinc[e]; /* Compute pointer to entry value */ - } - - /* Lookup this verticies value */ - md_table(cntx, rev, riv); - - /* Create all the output values */ - - /* I'm trying to avoid having to declare the actual entry sized */ - /* variables, since it is difficult dynamically. */ - - /* For all the full entries */ - f = 0; - pp = p; - for (e = 0; e < ts->im_fn; e++, pp += ts->im_fs) { - /* For all channels within full entry */ - for (ee = 0; ee < ts->im_fv; ee++, f++) { - double revf = rev[f]; - if (revf < 0.0) /* Guard against sillies */ - revf = 0.0; - else if (revf > 1.0) - revf = 1.0; - iev = (unsigned long)(revf * vscale + 0.5); - - if (bigend) { - write_entry[vsize](pp + (ts->im_fs - (ee+1) * vsize), iev); - } else { - write_entry[vsize](pp + ee * vsize, iev); - } - } - } - - /* For all the 0 or 1 partial entry */ - for (e = 0; e < ts->im_pn; e++) { - /* For all channels within partial entry */ - for (ee = 0; ee < ts->im_pv; ee++, f++) { - double revf = rev[f]; - if (revf < 0.0) /* Guard against sillies */ - revf = 0.0; - else if (revf > 1.0) - revf = 1.0; - iev = (unsigned long)(revf * vscale + 0.5); - - if (bigend) { - write_entry[vsize](pp + (ts->im_ps - (ee+1) * vsize), iev); - } else { - write_entry[vsize](pp + ee * vsize, iev); - } - } - } -#ifdef ASSERTS - if (f != gs->od) - fprintf(stderr,"imdi_tab assert: f == gs->od\n"); -#endif - - PH_INC(phc) - } while (!PH_LOOPED(phc)); - - /* Put table into place */ - it->im_table = (void *)t; - } - - /* Setup the simplex table */ - if (ts->sort) { - it->sw_table = (void *)NULL; - - } else { - byte *t, *p; /* Pointer to input table, pointer to total entry */ - int nsplx; /* Total number of simplexes */ - XCOMBO(vcmb, gs->id+1, 1 << gs->id);/* Simplex dimension id out of cube dimention id */ - int comb[24][IXDI]; /* Parameter[id]->Absolute[id] coordinate index */ - int ps[IXDI+1]; /* Base simplex parameter space counter */ - int pse; /* Base simplex parameter space counter index */ - int idioff; /* Interpolation table diagonal offset value */ - - if (gs->id > 4) { - fprintf(stderr,"imdi_tabl: internal failure - trying to create simplex table with di > 4!\n"); - exit(-1); - } - - /* Allocate the table */ - if ((t = (byte *)malloc(sbdinc[gs->id])) == NULL) { -#ifdef VERBOSE - printf("malloc imdi simplex table size %d failed\n",sbdinc[gs->id]); -#endif - return NULL; /* Should we signal error ? How ? */ - } -#ifdef VERBOSE - printf("Allocated simplex table = %d bytes\n",sbdinc[gs->id]); -#endif - - /* Compute the interp table offset to the diagonal vertex */ - for (idioff = 0, e = 0; e < gs->id; e++) - idioff += idinc[e]; /* Sum one offset in each dimension */ - - /* Figure out how many simplexes fit into this dimension cube, */ - /* and how to map from the base simplex to each actual simplex. */ - XCB_INIT(vcmb); - for (nsplx = 0; ;) { - int i; - - /* XCOMB generates verticies in order from max to min offest */ - - /* Compute Absolute -> Parameter mapping */ - for (e = 0; e < gs->id; e++) { /* For each absolute axis */ - for (i = 0; i < gs->id; i++) { /* For each verticy, order large to small */ - if ((vcmb[i] & (1<<e)) != 0 && - (vcmb[i+1] & (1<<e)) == 0) {/* Transition from offset 1 to 0 */ - comb[nsplx][i] = e; - break; - } - } - } - -/* -printf("~~Verticies = "); -for (i = 0; i <= gs->id; i++) - printf("%d ",vcmb[i]); -printf("\n"); - -printf("~~Parm -> Abs = "); -for (e = 0; e < gs->id; e++) - printf("%d ",comb[nsplx][e]); -printf("\n"); -*/ - - /* Increment the counter value */ - XCB_INC(vcmb); - nsplx++; - if (XCB_DONE(vcmb)) - break; - } - - /* Now generate the contents of the base simplex, */ - /* and map it to all the symetrical simplexes */ - - /* Init parameter space counter. */ - /* Note that ps[id-1] >= ps[id-2] >= ... >= ps[1] >= ps[0] */ - for (pse = 0; pse < gs->id; pse++) - ps[pse] = 0; - ps[pse] = gs->stres-1; - - /* Itterate through the simplex parameter space */ - for (pse = 0; pse < gs->id;) { - double qps[IXDI]; /* Quantized parameter values */ - int we[IXDI+1]; /* Baricentric coords/vertex weighting */ - double wvscale = (1 << gs->prec); /* Weighting value scale */ - int sx; /* Simplex */ - -/* -printf("Param coord ="); -for (e = gs->id-1; e >= 0; e--) { - printf(" %d",ps[e]); -} -printf("\n"); -*/ - for (e = 0; e < gs->id; e++) { - /* (Should try wvscale + 0.49999999, or something ?) */ - double tt = (wvscale * (double)ps[e])/((double)gs->stres); - qps[e] = (int)(tt + 0.5); - } - - /* Convert quantized parameter values into weighting values */ - we[gs->id] = (1 << gs->prec) - qps[gs->id-1]; - for (e = gs->id-1; e > 0; e--) - we[e] = qps[e] - qps[e-1]; - we[0] = qps[0]; - -#ifdef ASSERTS - { - int sow = 0; - for (e = gs->id; e >= 0; e--) - sow += we[e]; - - if (sow != (1 << gs->prec)) - fprintf(stderr,"imdi_tab assert: sum weights == (1 << gs->prec)\n"); - } -#endif - -/* -printf("Baricentric coord ="); -for (e = gs->id; e >= 0; e--) { - printf(" %d",we[e]); -} -printf("\n"); -*/ - - /* For each simplex, compute the interp. and */ - /* and entry offsets, and write the entry. */ - for (sx = 0; sx < nsplx; sx++ ) { - int v; /* Vertex index */ - byte *pp; /* Pointer to sub-entry */ - unsigned long vofb; /* Vertex offset, base */ - unsigned long vwe; /* Vertex weight */ - - for (e = 0, p = t; e < gs->id; e++) { - int ee = comb[sx][e]; /* Absolute coord index */ - p += ps[e] * sbdinc[ee]; /* Pointer to entry */ - } - - /* For each vertex entry */ - for (v = 0, pp = p; v <= gs->id; v++) { - unsigned long vof; - if (v == 0) { - vofb = idioff; /* Start at diagonal offset */ - } else { - vofb -= idinc[comb[sx][v-1]];/* Move to next vertex */ - } - vwe = we[v]; /* Weight for this vertex */ - - if (vwe == 0) - vof = 0; /* Use zero offset if weight is zero */ - else - vof = vofb * ts->vo_om; /* Strength reduce kernel scaling */ - - /* Write vwe and vof to entry */ - if (ts->wo_xs) { /* Separate entries */ - write_entry[ts->we_es](pp + ts->we_eo, vwe); - write_entry[ts->vo_es](pp + ts->vo_eo, vof); - pp += ts->wo_es; - } else { /* Combined entries */ -#ifdef ALLOW64 - unsigned longlong iwo; -#else - unsigned long iwo; -#endif - iwo = (vwe << ts->vo_ab) | vof; /* Combined weight+vertex offset */ - write_entry[ts->wo_es](pp + ts->wo_eo, iwo); - pp += ts->wo_es; - } - } - - /* Assert vofb == 0 */ -#ifdef ASSERTS - if (vofb != 0) - fprintf(stderr,"imdi_tab assert: vofb == 0\n"); -#endif - } /* Next simplex */ - - /* Increment the parameter coords */ - for (pse = 0; pse < gs->id; pse++) { - ps[pse]++; - if (ps[pse] <= ps[pse+1]) - break; /* No carry */ - ps[pse] = 0; - } - } - - /* Put table into place */ - it->sw_table = (void *)t; - } - - /* Last, setup the output tables */ - for (e = 0; e < gs->od; e++) { - byte *t, *p; /* Pointer to output table, entry pointer */ - int ne; /* Number of entries */ - int iiv; /* Integer input value */ - double ivr = (double)((1 << gs->prec)-1); /* Input value range */ - double ovr = (double)((1 << ts->ot_bits[e])-1); /* Output value range */ - int osb = (1 << (ts->ot_bits[e]-1)); /* Output offset to signed displacement */ - int ooff = ts->ot_off[e]; /* Output value bit offset */ - - ne = (1 << gs->prec); /* Output of clut is prec bits */ - - /* Allocate the table */ - if ((t = (byte *)malloc(ts->ot_ts * ne)) == NULL) { -#ifdef VERBOSE - printf("malloc imdi output table size %d failed\n",ts->ot_ts * ne); -#endif - return NULL; /* Should we signal error ? How ? */ - } - - /* For each possible output value, compute the entry value */ - for (iiv = 0, p = t; iiv < ne; iiv++, p += ts->ot_ts) { - int ee; - double riv; /* Real input value, 0.0 - 1.0 */ - double rtv; /* Real transformed value, 0.0 - 1.0 */ - unsigned long iov; /* Integer output value */ - - riv = (double) iiv / ivr; /* Compute floating point */ - rtv = output_curve(cntx, e, riv); /* Lookup the output table transform */ - if (rtv < 0.0) /* Guard against sillies */ - rtv = 0.0; - else if (rtv > 1.0) - rtv = 1.0; - iov = (unsigned long)(rtv * ovr + 0.5); /* output value */ - if (gs->out_signed & (1 << e)) /* Treat output as signed */ - iov = (iov >= osb) ? iov - osb : iov + osb; /* Convert to signed from offset */ - iov <<= ooff; /* Aligned for output */ - - write_entry[ts->ot_ts](p, iov); /* Write entry */ - } - - /* Put table into place */ - it->out_tables[e] = (void *)t; - } - it->nouttabs = e; - -#ifdef VERBOSE - printf("imdi_tabl returning OK\n"); -#endif - return it; -} - -/* Free up the data allocated */ -void -imdi_tab_free( -imdi_imp *it -) { - int e; - - for (e = 0; e < it->nintabs; e++) - free(it->in_tables[e]); - - free(it->sw_table); - free(it->im_table); - - for (e = 0; e < it->nouttabs; e++) - free(it->out_tables[e]); - - free(it); - -} diff --git a/gs/imdi/imdi_tab.h b/gs/imdi/imdi_tab.h deleted file mode 100644 index f5e531c61..000000000 --- a/gs/imdi/imdi_tab.h +++ /dev/null @@ -1,99 +0,0 @@ -#ifndef IMDI_TAB_H -#define IMDI_TAB_H - -/* Integer Multi-Dimensional Interpolation */ -/* - * Copyright 2000 - 2002 Graeme W. Gill - * All rights reserved. - * - * This material is licenced under the GNU GENERAL PUBLIC LICENCE :- - * see the Licence.txt file for licencing details. - */ - -/* Implementation details needed for table initialisation for a particular kernel */ - -typedef struct { - - int sort; /* NZ for explicit sort rather than simplex table lookup */ - int it_xs; /* NZ if separate interp index and simplex index/Weighting+Offset values */ - int wo_xs; /* NZ if separate weighting and vertex offset entries are to be used */ - - int it_ix; /* Non-zero if input value extraction should be done in input table */ - int it_map[IXDI]; /* Mapping from input channels to table indexes needed */ - int it_ab; /* Input table entry size in bits */ - int it_ts; /* Input table :- total input table entry size in bytes */ - /* Bit packing order is (ms to ls) : - sort: ix, we, vo - sort: ix, wo - !sort: ix, sx - */ - - /* Interpolation index is always in the input table */ - int ix_ab; /* Interpolation index entry size in bits */ - int ix_es; /* Interpolation index entry size in bytes */ - int ix_eo; /* Interpolation index entry offset in bytes */ - - /* Simplex Index is always in the input table */ - int sx_ab; /* Simplex Index entry size in bits */ - int sx_es; /* Simplex Index entry size in bytes */ - int sx_eo; /* Simplex Index entry offset in bytes */ - - int sm_ts; /* Simplex table entry total size in bytes */ - /* Bit packing order is (ms to ls) : we, vo */ - - /* Combined Weighting + Offset may be in input table or Simplex entry */ - int wo_ab; /* Combined Weighting + Offset entry size in bits */ - int wo_es; /* Combined Weighting + Offset entry size in bytes */ - int wo_eo; /* Combined Weighting + Offset entry offset in bytes */ - - /* Weighting may be in input table or Simplex entry */ - int we_ab; /* Weighting entry size in bits */ - int we_es; /* Weighting entry size in bytes */ - int we_eo; /* Weighting entry offset in bytes */ - - /* Vertex offset may be in input table or Simplex entry */ - int vo_ab; /* Vertex Offset entry size in bits */ - int vo_es; /* Vertex Offset entry size in bytes */ - int vo_eo; /* Vertex Offset entry offset in bytes */ - int vo_om; /* Vertex Offset scaling multiplier */ - - int im_cd; /* Non-zero if interpolation table entries are padded with fraction */ - int im_ts; /* Interp. multidim :- total interp table entry size in bytes */ - int im_oc; /* Interp. multidim :- offset scale to apply to index into interp entry */ - int im_fs; /* Interp. multidim :- full table entry size in bytes */ - int im_fn; /* Interp. multidim :- number of full entries */ - int im_fv; /* Interp. multidim :- output values per full entry . */ - int im_ps; /* Interp. multidim :- partial table entry size in bytes, used & unsused */ - int im_pn; /* Interp. multidim :- number of partial entries - must be 0 or 1 */ - int im_pv; /* Interp. multidim :- used output values per partial entry . */ - int im_map[IXDO]; /* Mapping from output table values to output positions needed */ - - int ot_ts; /* Output table :- total entry size in bytes of every table */ - int ot_off[IXDO]; /* Offset for each output value within the output word needed */ - int ot_bits[IXDO]; /* Number of bits for value within the output word needed */ - - /* Associated interpolation function */ - void (*interp)(struct _imdi *s, void **inp, void **outp, unsigned int npix); /* At run time */ -} tabspec; - -/* - * We declare the function that knows how to create the - * appropriate run time tables for our chosen kernel, - * and the color mapping we want to perform. -*/ - -imdi_imp * -imdi_tab( - genspec *gs, /* Pointer to gen spec */ - tabspec *ts, /* Pointer to tabl spec */ - - /* Callbacks to lookup the mdi table values */ - double (*input_curve) (void *cntx, int ch, double in_val), - void (*md_table) (void *cntx, double *out_vals, double *in_vals), - double (*output_curve)(void *cntx, int ch, double in_val), - void *cntx /* Context to callbacks */ -); - -void imdi_tab_free(imdi_imp *it); - -#endif /* IMDI_TAB_H */ diff --git a/gs/psi/msvc.mak b/gs/psi/msvc.mak index 3d5fc2bc5..92ec0c283 100644 --- a/gs/psi/msvc.mak +++ b/gs/psi/msvc.mak @@ -354,13 +354,6 @@ IJSSRCDIR=ijs IJSEXECTYPE=win !endif -# Define the directory where the imdi library source is stored. -# See devs.mak for more information - -!ifndef IMDISRCDIR -IMDISRCDIR=imdi -!endif - # Define the directory where the CUPS library sources are stored, !ifndef LCUPSSRCDIR diff --git a/gs/psi/os2.mak b/gs/psi/os2.mak index be786fc3f..e0f6c0a90 100644 --- a/gs/psi/os2.mak +++ b/gs/psi/os2.mak @@ -146,11 +146,6 @@ JBIG2SRCDIR=jbig2dec #IJSSRCDIR=ijs #IJSEXECTYPE=win -# Define the directory where the imdi library source is stored. -# See devs.mak for more information - -IMDISRCDIR=imdi - # 1 --> Use 64 bits for gx_color_index. This is required only for # non standard devices or DeviceN process color model devices. USE_LARGE_COLOR_INDEX=1 |