2002-04-24 21:51:24 +00:00
|
|
|
/* GStreamer
|
|
|
|
* Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
|
2004-01-07 10:16:09 +00:00
|
|
|
* Copyright (C) <2003> David Schleef <ds@schleef.org>
|
2002-04-24 21:51:24 +00:00
|
|
|
*
|
|
|
|
* EffecTV - Realtime Digital Video Effector
|
|
|
|
* Copyright (C) 2001 FUKUCHI Kentarou
|
2004-01-07 10:16:09 +00:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
2002-08-14 21:01:38 +00:00
|
|
|
* modify it under the terms of the GNU Library General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Library General Public License for more details.
|
2002-04-24 21:51:24 +00:00
|
|
|
*
|
2002-08-14 21:01:38 +00:00
|
|
|
* You should have received a copy of the GNU Library General Public
|
|
|
|
* License along with this library; if not, write to the
|
|
|
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
* Boston, MA 02111-1307, USA.
|
2004-01-07 10:16:09 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* This file was (probably) generated from gstvideotemplate.c,
|
|
|
|
* gstvideotemplate.c,v 1.11 2004/01/07 08:56:45 ds Exp
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* From main.c of warp-1.1:
|
2002-04-24 21:51:24 +00:00
|
|
|
*
|
|
|
|
* Simple DirectMedia Layer demo
|
|
|
|
* Realtime picture 'gooing'
|
|
|
|
* by sam lantinga slouken@devolution.com
|
|
|
|
*/
|
|
|
|
|
2003-06-29 19:46:12 +00:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "config.h"
|
|
|
|
#endif
|
2004-01-07 10:16:09 +00:00
|
|
|
|
|
|
|
#include <gst/gst.h>
|
|
|
|
#include <gstvideofilter.h>
|
2002-04-24 21:51:24 +00:00
|
|
|
#include <string.h>
|
|
|
|
#include <math.h>
|
|
|
|
#include "gsteffectv.h"
|
|
|
|
|
|
|
|
#ifndef M_PI
|
|
|
|
#define M_PI 3.14159265358979323846
|
|
|
|
#endif
|
|
|
|
|
2004-01-07 10:16:09 +00:00
|
|
|
|
2002-04-24 21:51:24 +00:00
|
|
|
#define GST_TYPE_WARPTV \
|
|
|
|
(gst_warptv_get_type())
|
|
|
|
#define GST_WARPTV(obj) \
|
|
|
|
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_WARPTV,GstWarpTV))
|
|
|
|
#define GST_WARPTV_CLASS(klass) \
|
2004-01-07 10:16:09 +00:00
|
|
|
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_WARPTV,GstWarpTVClass))
|
2002-04-24 21:51:24 +00:00
|
|
|
#define GST_IS_WARPTV(obj) \
|
|
|
|
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_WARPTV))
|
|
|
|
#define GST_IS_WARPTV_CLASS(obj) \
|
|
|
|
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_WARPTV))
|
|
|
|
|
|
|
|
typedef struct _GstWarpTV GstWarpTV;
|
|
|
|
typedef struct _GstWarpTVClass GstWarpTVClass;
|
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
struct _GstWarpTV
|
|
|
|
{
|
2004-01-07 10:16:09 +00:00
|
|
|
GstVideofilter videofilter;
|
2002-04-24 21:51:24 +00:00
|
|
|
|
|
|
|
gint width, height;
|
|
|
|
gint *offstable;
|
|
|
|
gint32 *disttable;
|
|
|
|
gint32 ctable[1024];
|
2004-03-14 22:34:33 +00:00
|
|
|
gint32 sintable[1024 + 256];
|
2002-04-24 21:51:24 +00:00
|
|
|
gint tval;
|
|
|
|
};
|
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
struct _GstWarpTVClass
|
|
|
|
{
|
2004-01-07 10:16:09 +00:00
|
|
|
GstVideofilterClass parent_class;
|
2002-04-24 21:51:24 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2004-01-07 10:16:09 +00:00
|
|
|
/* GstWarpTV signals and args */
|
2004-03-14 22:34:33 +00:00
|
|
|
enum
|
|
|
|
{
|
2002-04-24 21:51:24 +00:00
|
|
|
/* FILL ME */
|
|
|
|
LAST_SIGNAL
|
|
|
|
};
|
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
enum
|
|
|
|
{
|
2004-05-21 22:39:30 +00:00
|
|
|
ARG_0
|
|
|
|
/* FILL ME */
|
2002-04-24 21:51:24 +00:00
|
|
|
};
|
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
static void gst_warptv_base_init (gpointer g_class);
|
|
|
|
static void gst_warptv_class_init (gpointer g_class, gpointer class_data);
|
|
|
|
static void gst_warptv_init (GTypeInstance * instance, gpointer g_class);
|
2002-04-24 21:51:24 +00:00
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
static void gst_warptv_set_property (GObject * object, guint prop_id,
|
|
|
|
const GValue * value, GParamSpec * pspec);
|
|
|
|
static void gst_warptv_get_property (GObject * object, guint prop_id,
|
|
|
|
GValue * value, GParamSpec * pspec);
|
2002-04-24 21:51:24 +00:00
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
static void gst_warptv_setup (GstVideofilter * videofilter);
|
|
|
|
static void initSinTable (GstWarpTV * filter);
|
|
|
|
static void initOffsTable (GstWarpTV * filter);
|
|
|
|
static void initDistTable (GstWarpTV * filter);
|
|
|
|
static void gst_warptv_rgb32 (GstVideofilter * videofilter, void *d, void *s);
|
2002-04-24 21:51:24 +00:00
|
|
|
|
2004-01-07 10:16:09 +00:00
|
|
|
GType
|
|
|
|
gst_warptv_get_type (void)
|
2002-04-24 21:51:24 +00:00
|
|
|
{
|
|
|
|
static GType warptv_type = 0;
|
|
|
|
|
|
|
|
if (!warptv_type) {
|
|
|
|
static const GTypeInfo warptv_info = {
|
2004-03-14 22:34:33 +00:00
|
|
|
sizeof (GstWarpTVClass),
|
2003-11-02 12:48:08 +00:00
|
|
|
gst_warptv_base_init,
|
2002-04-24 21:51:24 +00:00
|
|
|
NULL,
|
2004-01-07 10:16:09 +00:00
|
|
|
gst_warptv_class_init,
|
2002-04-24 21:51:24 +00:00
|
|
|
NULL,
|
|
|
|
NULL,
|
2004-03-14 22:34:33 +00:00
|
|
|
sizeof (GstWarpTV),
|
2002-04-24 21:51:24 +00:00
|
|
|
0,
|
2004-01-07 10:16:09 +00:00
|
|
|
gst_warptv_init,
|
2002-04-24 21:51:24 +00:00
|
|
|
};
|
2004-03-15 19:32:27 +00:00
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
warptv_type = g_type_register_static (GST_TYPE_VIDEOFILTER,
|
2004-03-15 19:32:27 +00:00
|
|
|
"GstWarpTV", &warptv_info, 0);
|
2002-04-24 21:51:24 +00:00
|
|
|
}
|
|
|
|
return warptv_type;
|
|
|
|
}
|
|
|
|
|
2004-01-07 10:16:09 +00:00
|
|
|
static GstVideofilterFormat gst_warptv_formats[] = {
|
2004-03-14 22:34:33 +00:00
|
|
|
{"RGB ", 32, gst_warptv_rgb32, 24, G_BIG_ENDIAN, 0x00ff0000, 0x0000ff00,
|
|
|
|
0x000000ff},
|
|
|
|
{"RGB ", 32, gst_warptv_rgb32, 24, G_BIG_ENDIAN, 0xff000000, 0x00ff0000,
|
|
|
|
0x0000ff00},
|
|
|
|
{"RGB ", 32, gst_warptv_rgb32, 24, G_BIG_ENDIAN, 0x000000ff, 0x0000ff00,
|
|
|
|
0x00ff0000},
|
|
|
|
{"RGB ", 32, gst_warptv_rgb32, 24, G_BIG_ENDIAN, 0x0000ff00, 0x00ff0000,
|
|
|
|
0xff000000},
|
2004-01-07 10:16:09 +00:00
|
|
|
};
|
|
|
|
|
2003-11-02 12:48:08 +00:00
|
|
|
static void
|
|
|
|
gst_warptv_base_init (gpointer g_class)
|
|
|
|
{
|
2004-03-14 22:34:33 +00:00
|
|
|
static GstElementDetails warptv_details = GST_ELEMENT_DETAILS ("WarpTV",
|
|
|
|
"Filter/Effect/Video",
|
|
|
|
"WarpTV does realtime goo'ing of the video input",
|
|
|
|
"Sam Lantinga <slouken@devolution.com>");
|
2003-11-02 12:48:08 +00:00
|
|
|
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
|
2004-01-07 10:16:09 +00:00
|
|
|
GstVideofilterClass *videofilter_class = GST_VIDEOFILTER_CLASS (g_class);
|
|
|
|
int i;
|
2004-03-14 22:34:33 +00:00
|
|
|
|
2004-01-07 10:16:09 +00:00
|
|
|
gst_element_class_set_details (element_class, &warptv_details);
|
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
for (i = 0; i < G_N_ELEMENTS (gst_warptv_formats); i++) {
|
|
|
|
gst_videofilter_class_add_format (videofilter_class,
|
2004-03-15 19:32:27 +00:00
|
|
|
gst_warptv_formats + i);
|
2004-01-07 10:16:09 +00:00
|
|
|
}
|
2003-11-02 12:48:08 +00:00
|
|
|
|
2004-01-07 10:16:09 +00:00
|
|
|
gst_videofilter_class_add_pad_templates (GST_VIDEOFILTER_CLASS (g_class));
|
2003-11-02 12:48:08 +00:00
|
|
|
}
|
|
|
|
|
2002-04-24 21:51:24 +00:00
|
|
|
static void
|
2004-01-07 10:16:09 +00:00
|
|
|
gst_warptv_class_init (gpointer g_class, gpointer class_data)
|
2002-04-24 21:51:24 +00:00
|
|
|
{
|
|
|
|
GObjectClass *gobject_class;
|
2004-01-07 10:16:09 +00:00
|
|
|
GstVideofilterClass *videofilter_class;
|
2002-04-24 21:51:24 +00:00
|
|
|
|
2004-01-07 10:16:09 +00:00
|
|
|
gobject_class = G_OBJECT_CLASS (g_class);
|
|
|
|
videofilter_class = GST_VIDEOFILTER_CLASS (g_class);
|
2002-04-24 21:51:24 +00:00
|
|
|
|
2005-05-06 11:04:30 +00:00
|
|
|
gobject_class->set_property = gst_warptv_set_property;
|
|
|
|
gobject_class->get_property = gst_warptv_get_property;
|
|
|
|
|
2004-01-07 10:16:09 +00:00
|
|
|
#if 0
|
2004-03-14 22:34:33 +00:00
|
|
|
g_object_class_install_property (gobject_class, ARG_METHOD,
|
|
|
|
g_param_spec_enum ("method", "method", "method",
|
2004-03-15 19:32:27 +00:00
|
|
|
GST_TYPE_WARPTV_METHOD, GST_WARPTV_METHOD_1, G_PARAM_READWRITE));
|
2004-01-07 10:16:09 +00:00
|
|
|
#endif
|
2002-04-24 21:51:24 +00:00
|
|
|
|
2004-01-07 10:16:09 +00:00
|
|
|
videofilter_class->setup = gst_warptv_setup;
|
2002-04-24 21:51:24 +00:00
|
|
|
}
|
|
|
|
|
2004-01-07 10:16:09 +00:00
|
|
|
static void
|
2004-03-14 22:34:33 +00:00
|
|
|
gst_warptv_init (GTypeInstance * instance, gpointer g_class)
|
2002-04-24 21:51:24 +00:00
|
|
|
{
|
2004-01-07 10:16:09 +00:00
|
|
|
GstWarpTV *warptv = GST_WARPTV (instance);
|
|
|
|
GstVideofilter *videofilter;
|
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
GST_DEBUG ("gst_warptv_init");
|
2004-01-07 10:16:09 +00:00
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
videofilter = GST_VIDEOFILTER (warptv);
|
2002-04-24 21:51:24 +00:00
|
|
|
|
2004-01-07 10:16:09 +00:00
|
|
|
/* do stuff */
|
|
|
|
}
|
2002-04-24 21:51:24 +00:00
|
|
|
|
2004-01-07 10:16:09 +00:00
|
|
|
static void
|
2004-03-14 22:34:33 +00:00
|
|
|
gst_warptv_set_property (GObject * object, guint prop_id, const GValue * value,
|
|
|
|
GParamSpec * pspec)
|
2004-01-07 10:16:09 +00:00
|
|
|
{
|
|
|
|
GstWarpTV *src;
|
2002-04-24 21:51:24 +00:00
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
g_return_if_fail (GST_IS_WARPTV (object));
|
|
|
|
src = GST_WARPTV (object);
|
2002-04-24 21:51:24 +00:00
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
GST_DEBUG ("gst_warptv_set_property");
|
2004-01-07 10:16:09 +00:00
|
|
|
switch (prop_id) {
|
|
|
|
#if 0
|
|
|
|
case ARG_METHOD:
|
|
|
|
src->method = g_value_get_enum (value);
|
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
2002-04-24 21:51:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2004-03-14 22:34:33 +00:00
|
|
|
gst_warptv_get_property (GObject * object, guint prop_id, GValue * value,
|
|
|
|
GParamSpec * pspec)
|
2002-04-24 21:51:24 +00:00
|
|
|
{
|
2004-01-07 10:16:09 +00:00
|
|
|
GstWarpTV *src;
|
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
g_return_if_fail (GST_IS_WARPTV (object));
|
|
|
|
src = GST_WARPTV (object);
|
2004-01-07 10:16:09 +00:00
|
|
|
|
|
|
|
switch (prop_id) {
|
|
|
|
#if 0
|
|
|
|
case ARG_METHOD:
|
|
|
|
g_value_set_enum (value, src->method);
|
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
2002-04-24 21:51:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
static void
|
|
|
|
gst_warptv_setup (GstVideofilter * videofilter)
|
2004-01-07 10:16:09 +00:00
|
|
|
{
|
|
|
|
GstWarpTV *warptv;
|
2004-03-14 22:34:33 +00:00
|
|
|
int width = gst_videofilter_get_input_width (videofilter);
|
|
|
|
int height = gst_videofilter_get_input_height (videofilter);
|
2004-01-07 10:16:09 +00:00
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
g_return_if_fail (GST_IS_WARPTV (videofilter));
|
|
|
|
warptv = GST_WARPTV (videofilter);
|
2004-01-07 10:16:09 +00:00
|
|
|
|
|
|
|
/* if any setup needs to be done, do it here */
|
|
|
|
|
|
|
|
warptv->width = width;
|
|
|
|
warptv->height = height;
|
2004-01-11 22:03:52 +00:00
|
|
|
#if 0
|
|
|
|
/* FIXME this should be reset in PAUSE->READY, not here */
|
2004-01-07 10:16:09 +00:00
|
|
|
warptv->tval = 0;
|
2004-01-11 22:03:52 +00:00
|
|
|
#endif
|
2004-01-07 10:16:09 +00:00
|
|
|
|
|
|
|
g_free (warptv->disttable);
|
|
|
|
g_free (warptv->offstable);
|
|
|
|
|
2005-06-29 16:14:30 +00:00
|
|
|
warptv->offstable = g_malloc (height * sizeof (guint32));
|
2004-01-07 10:16:09 +00:00
|
|
|
warptv->disttable = g_malloc (width * height * sizeof (guint32));
|
|
|
|
|
|
|
|
initSinTable (warptv);
|
|
|
|
initOffsTable (warptv);
|
|
|
|
initDistTable (warptv);
|
|
|
|
}
|
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
static void
|
|
|
|
initSinTable (GstWarpTV * filter)
|
2002-04-24 21:51:24 +00:00
|
|
|
{
|
2004-03-14 22:34:33 +00:00
|
|
|
gint32 *tptr, *tsinptr;
|
|
|
|
double i;
|
2002-04-24 21:51:24 +00:00
|
|
|
|
|
|
|
tsinptr = tptr = filter->sintable;
|
|
|
|
|
|
|
|
for (i = 0; i < 1024; i++)
|
|
|
|
*tptr++ = (int) (sin (i * M_PI / 512) * 32767);
|
|
|
|
|
|
|
|
for (i = 0; i < 256; i++)
|
|
|
|
*tptr++ = *tsinptr++;
|
|
|
|
}
|
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
static void
|
|
|
|
initOffsTable (GstWarpTV * filter)
|
2002-04-24 21:51:24 +00:00
|
|
|
{
|
|
|
|
int y;
|
2004-03-14 22:34:33 +00:00
|
|
|
|
2002-04-24 21:51:24 +00:00
|
|
|
for (y = 0; y < filter->height; y++) {
|
|
|
|
filter->offstable[y] = y * filter->width;
|
|
|
|
}
|
|
|
|
}
|
2004-03-14 22:34:33 +00:00
|
|
|
|
|
|
|
static void
|
|
|
|
initDistTable (GstWarpTV * filter)
|
2002-04-24 21:51:24 +00:00
|
|
|
{
|
|
|
|
gint32 halfw, halfh, *distptr;
|
2004-03-14 22:34:33 +00:00
|
|
|
|
2002-04-24 21:51:24 +00:00
|
|
|
#ifdef PS2
|
2004-03-14 22:34:33 +00:00
|
|
|
float x, y, m;
|
2002-04-24 21:51:24 +00:00
|
|
|
#else
|
2004-03-14 22:34:33 +00:00
|
|
|
double x, y, m;
|
2002-04-24 21:51:24 +00:00
|
|
|
#endif
|
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
halfw = filter->width >> 1;
|
2002-04-24 21:51:24 +00:00
|
|
|
halfh = filter->height >> 1;
|
|
|
|
|
|
|
|
distptr = filter->disttable;
|
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
m = sqrt ((double) (halfw * halfw + halfh * halfh));
|
2002-04-24 21:51:24 +00:00
|
|
|
|
|
|
|
for (y = -halfh; y < halfh; y++)
|
2004-03-14 22:34:33 +00:00
|
|
|
for (x = -halfw; x < halfw; x++)
|
2002-04-24 21:51:24 +00:00
|
|
|
#ifdef PS2
|
|
|
|
*distptr++ = ((int) ((sqrtf (x * x + y * y) * 511.9999) / m)) << 1;
|
|
|
|
#else
|
|
|
|
*distptr++ = ((int) ((sqrt (x * x + y * y) * 511.9999) / m)) << 1;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
static void
|
|
|
|
gst_warptv_rgb32 (GstVideofilter * videofilter, void *d, void *s)
|
2002-04-24 21:51:24 +00:00
|
|
|
{
|
2004-01-07 10:16:09 +00:00
|
|
|
GstWarpTV *warptv;
|
2004-03-14 22:34:33 +00:00
|
|
|
int width = gst_videofilter_get_input_width (videofilter);
|
|
|
|
int height = gst_videofilter_get_input_height (videofilter);
|
2004-01-07 10:16:09 +00:00
|
|
|
guint32 *src = s;
|
|
|
|
guint32 *dest = d;
|
2004-03-14 22:34:33 +00:00
|
|
|
gint xw, yw, cw;
|
|
|
|
gint32 c, i, x, y, dx, dy, maxx, maxy;
|
2004-01-07 10:16:09 +00:00
|
|
|
gint32 skip, *ctptr, *distptr;
|
2002-04-24 21:51:24 +00:00
|
|
|
gint32 *sintable, *ctable;
|
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
g_return_if_fail (GST_IS_WARPTV (videofilter));
|
|
|
|
warptv = GST_WARPTV (videofilter);
|
2002-04-24 21:51:24 +00:00
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
xw = (gint) (sin ((warptv->tval + 100) * M_PI / 128) * 30);
|
|
|
|
yw = (gint) (sin ((warptv->tval) * M_PI / 256) * -35);
|
|
|
|
cw = (gint) (sin ((warptv->tval - 70) * M_PI / 64) * 50);
|
2004-01-07 10:16:09 +00:00
|
|
|
xw += (gint) (sin ((warptv->tval - 10) * M_PI / 512) * 40);
|
2004-03-14 22:34:33 +00:00
|
|
|
yw += (gint) (sin ((warptv->tval + 30) * M_PI / 512) * 40);
|
2002-04-24 21:51:24 +00:00
|
|
|
|
2004-01-07 10:16:09 +00:00
|
|
|
ctptr = warptv->ctable;
|
|
|
|
distptr = warptv->disttable;
|
|
|
|
sintable = warptv->sintable;
|
|
|
|
ctable = warptv->ctable;
|
2002-04-24 21:51:24 +00:00
|
|
|
|
2004-03-15 19:32:27 +00:00
|
|
|
skip = 0; /* video_width*sizeof(RGB32)/4 - video_width;; */
|
2002-04-24 21:51:24 +00:00
|
|
|
c = 0;
|
|
|
|
|
|
|
|
for (x = 0; x < 512; x++) {
|
|
|
|
i = (c >> 3) & 0x3FE;
|
|
|
|
*ctptr++ = ((sintable[i] * yw) >> 15);
|
|
|
|
*ctptr++ = ((sintable[i + 256] * xw) >> 15);
|
|
|
|
c += cw;
|
|
|
|
}
|
2004-03-14 22:34:33 +00:00
|
|
|
maxx = width - 2;
|
|
|
|
maxy = height - 2;
|
2002-04-24 21:51:24 +00:00
|
|
|
|
|
|
|
for (y = 0; y < height - 1; y++) {
|
|
|
|
for (x = 0; x < width; x++) {
|
2004-03-14 22:34:33 +00:00
|
|
|
i = *distptr++;
|
|
|
|
dx = ctable[i + 1] + x;
|
|
|
|
dy = ctable[i] + y;
|
|
|
|
|
|
|
|
if (dx < 0)
|
2004-03-15 19:32:27 +00:00
|
|
|
dx = 0;
|
2004-03-14 22:34:33 +00:00
|
|
|
else if (dx > maxx)
|
2004-03-15 19:32:27 +00:00
|
|
|
dx = maxx;
|
2004-03-14 22:34:33 +00:00
|
|
|
|
|
|
|
if (dy < 0)
|
2004-03-15 19:32:27 +00:00
|
|
|
dy = 0;
|
2004-03-14 22:34:33 +00:00
|
|
|
else if (dy > maxy)
|
2004-03-15 19:32:27 +00:00
|
|
|
dy = maxy;
|
2004-03-14 22:34:33 +00:00
|
|
|
*dest++ = src[warptv->offstable[dy] + dx];
|
2002-04-24 21:51:24 +00:00
|
|
|
}
|
|
|
|
dest += skip;
|
|
|
|
}
|
|
|
|
|
2004-01-07 10:16:09 +00:00
|
|
|
warptv->tval = (warptv->tval + 1) & 511;
|
2002-04-24 21:51:24 +00:00
|
|
|
}
|