From 9fb7a3c5581c616786dd4abb5e904be10f63a8c6 Mon Sep 17 00:00:00 2001
From: "Mirar (Pontus Hagland)" <pike@sort.mirar.org>
Date: Sun, 1 Dec 1996 01:01:15 +0100
Subject: [PATCH] dct; rescaling using discrete cosine transform

Rev: src/modules/image/Makefile.src:1.7
Rev: src/modules/image/image.c:1.29
Rev: src/modules/image/image.h:1.12
Rev: src/modules/image/matrix.c:1.6
---
 src/modules/image/Makefile.src |  2 +-
 src/modules/image/image.c      |  9 ++++++---
 src/modules/image/image.h      | 11 ++++++++++-
 src/modules/image/matrix.c     |  7 +------
 4 files changed, 18 insertions(+), 11 deletions(-)

diff --git a/src/modules/image/Makefile.src b/src/modules/image/Makefile.src
index 5e719c9064..3f7cb23d3e 100644
--- a/src/modules/image/Makefile.src
+++ b/src/modules/image/Makefile.src
@@ -4,7 +4,7 @@ PREFLAGS=$(DEFINES) -I$(SRCDIR) -I$(SRCDIR)/../.. -I../..
 CFLAGS=$(PREFLAGS) $(OTHERFLAGS) @DEFS@
 
 FILES =	image.o font.o quant.o lzw.o togif.o matrix.o pnm.o blit.o \
-	pattern.o
+	pattern.o dct.o
 
 image.a: $(FILES)
 	-rm -f image.a
diff --git a/src/modules/image/image.c b/src/modules/image/image.c
index ccf795823b..6c346c1b6d 100644
--- a/src/modules/image/image.c
+++ b/src/modules/image/image.c
@@ -1,4 +1,4 @@
-/* $Id: image.c,v 1.28 1996/11/30 13:14:35 law Exp $ */
+/* $Id: image.c,v 1.29 1996/12/01 00:01:13 law Exp $ */
 
 #include "global.h"
 
@@ -7,7 +7,7 @@
 
 #include "stralloc.h"
 #include "global.h"
-RCSID("$Id: image.c,v 1.28 1996/11/30 13:14:35 law Exp $");
+RCSID("$Id: image.c,v 1.29 1996/12/01 00:01:13 law Exp $");
 #include "types.h"
 #include "macros.h"
 #include "object.h"
@@ -121,7 +121,7 @@ static INLINE void img_line(INT32 x1,INT32 y1,INT32 x2,INT32 y2)
    {
       if (y1>y2) y1^=y2,y2^=y1,y1^=y2;
       if (x1<0||x1>=THIS->xsize||
-	  y2<0||y2>=THIS->ysize) return;
+	  y2<0||y1>=THIS->ysize) return;
       if (y1<0) y1=0;
       if (y2>=THIS->ysize) y2=THIS->ysize-1;
       for (;y1<=y2;y1++) setpixel_test(x1,y1);
@@ -1629,6 +1629,9 @@ void init_image_programs()
                 "function(array(float|int|array(int)),float|void,float|void,float|void,float|void:object)",0);
    add_function("turbulence",image_turbulence,
                 "function(array(float|int|array(int)),int|void,float|void,float|void,float|void,float|void:object)",0);
+
+   add_function("dct",image_dct,
+		"function(:object)",0);
 		
    set_init_callback(init_image_struct);
    set_exit_callback(exit_image_struct);
diff --git a/src/modules/image/image.h b/src/modules/image/image.h
index 486179a6be..222d10773d 100644
--- a/src/modules/image/image.h
+++ b/src/modules/image/image.h
@@ -1,4 +1,4 @@
-/* $Id: image.h,v 1.11 1996/11/30 13:14:37 law Exp $ */
+/* $Id: image.h,v 1.12 1996/12/01 00:01:14 law Exp $ */
 
 #define MAX_NUMCOL 32768
 #define QUANT_MAP_BITS 4
@@ -26,6 +26,11 @@ typedef struct
    signed long r,g,b;
 } rgbl_group;
 
+typedef struct
+{
+   float r,g,b;
+} rgbd_group; /* use float, it gets so big otherwise... */
+
 struct image
 {
    rgb_group *img;
@@ -128,3 +133,7 @@ void image_frompnm(INT32 args);
 void image_noise(INT32 args);
 void image_turbulence(INT32 args);
 void image_noise_init(void);
+
+/* dct.c */
+
+void image_dct(INT32 args);
diff --git a/src/modules/image/matrix.c b/src/modules/image/matrix.c
index 0275b8cb77..a3bfc36550 100644
--- a/src/modules/image/matrix.c
+++ b/src/modules/image/matrix.c
@@ -1,4 +1,4 @@
-/* $Id: matrix.c,v 1.5 1996/11/30 13:14:39 law Exp $ */
+/* $Id: matrix.c,v 1.6 1996/12/01 00:01:15 law Exp $ */
 
 #include "global.h"
 
@@ -116,11 +116,6 @@ static INLINE int getrgbl(rgbl_group *rgb,INT32 args_start,INT32 args,char *name
 #define scale_add_pixel(dest,dx,src,sx,factor) \
    _scale_add_rgb(dest,src,factor)
 
-typedef struct
-{
-   double r,g,b;
-} rgbd_group;
-
 static INLINE void scale_add_line(rgbd_group *new,INT32 yn,INT32 newx,
 				  rgb_group *img,INT32 y,INT32 xsize,
 				  double py,double dx)
-- 
GitLab