Commit f6e65158 authored by David Schleef's avatar David Schleef
Browse files

gst-libs/gst/Makefile.am: Remove idct. It hasn't been used in gst-plugins in...

gst-libs/gst/Makefile.am: Remove idct.  It hasn't been used in gst-plugins in a long time, and properly belongs in li...

Original commit message from CVS:
* gst-libs/gst/Makefile.am: Remove idct.  It hasn't been used
in gst-plugins in a long time, and properly belongs in liboil.
* gst-libs/gst/idct/Makefile.am:
* gst-libs/gst/idct/README:
* gst-libs/gst/idct/dct.h:
* gst-libs/gst/idct/doieee:
* gst-libs/gst/idct/fastintidct.c:
* gst-libs/gst/idct/floatidct.c:
* gst-libs/gst/idct/idct.c:
* gst-libs/gst/idct/idct.h:
* gst-libs/gst/idct/idtc.vcproj:
* gst-libs/gst/idct/ieeetest.c:
* gst-libs/gst/idct/intidct.c:
parent 5a3941c7
2005-04-23 David Schleef <ds@schleef.org>
* gst-libs/gst/Makefile.am: Remove idct. It hasn't been used
in gst-plugins in a long time, and properly belongs in liboil.
* gst-libs/gst/idct/Makefile.am:
* gst-libs/gst/idct/README:
* gst-libs/gst/idct/dct.h:
* gst-libs/gst/idct/doieee:
* gst-libs/gst/idct/fastintidct.c:
* gst-libs/gst/idct/floatidct.c:
* gst-libs/gst/idct/idct.c:
* gst-libs/gst/idct/idct.h:
* gst-libs/gst/idct/idtc.vcproj:
* gst-libs/gst/idct/ieeetest.c:
* gst-libs/gst/idct/intidct.c:
2005-04-20 Wim Taymans <wim@fluendo.com>
 
* docs/design-audiosinks.txt:
......
......@@ -15,7 +15,6 @@ SUBDIRS = \
colorbalance \
floatcast \
$(GCONF_DIR) \
idct \
media-info \
mixer \
navigation \
......@@ -35,7 +34,6 @@ DIST_SUBDIRS = \
colorbalance \
floatcast \
gconf \
idct \
media-info \
mixer \
navigation \
......
librarydir = $(libdir)/gstreamer-@GST_MAJORMINOR@
library_LTLIBRARIES = libgstidct.la
libgstidct_la_SOURCES = \
fastintidct.c \
floatidct.c \
idct.c \
intidct.c
libgstidctincludedir = $(includedir)/gstreamer-@GST_MAJORMINOR@/gst/idct
libgstidctinclude_HEADERS = idct.h
noinst_HEADERS = dct.h
## check_PROGRAMS = ieeetest
## ieeetest_SOURCES = ieeetest.c
## ieeetest_LDADD = libgstidct.la
## ieeetest_CFLAGS = $(GST_CFLAGS)
## ieeetest_LDFLAGS = $(GST_LIBS)
libgstidct_la_LIBADD =
libgstidct_la_CFLAGS = $(GST_CFLAGS)
libgstidct_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
This archive contains a quick & dirty implementation of the IEEE Standard
1180-1990 accuracy test for inverse DCT. It is not guaranteed to be
correct ... but if you find any bugs, please let me know (by email to
tgl@cs.cmu.edu).
The test harness consists of the C program ieeetest.c and shell script
doieee. For comparison purposes I have also supplied a copy of jrevdct.c,
the inverse DCT routine from release 4 of the Independent JPEG Group's
free JPEG software. (jrevdct.c is slightly modified from the IJG release
so that it will compile without the IJG include files.) jrevdct.c passes
the 1180 test --- or at least, this program thinks so. jrevdct.out is
the output from a test run.
Note that numerical results may vary somewhat across machines. This appears
to be mostly due to differing results from the cosine function.
INSTALLATION:
Check the Makefile, change CC and CFLAGS if needed. Then say "make".
If your C compiler is non-ANSI, you may need to change includes and/or
function headers.
To test a different IDCT routine, link with that routine instead of
jrevdct.o. You will need to modify dct.h and/or ieeetest.c if your
routine's calling convention is not in-place modification of an array
of 64 "short"s.
USAGE:
The standard test procedure is
doieee ieeetest >outputfile
Expect it to take a while (almost 80 minutes on my old 68030 box).
Each of the six passes will emit a row of 100 dots as it runs.
You can grep the output for the word FAILS if you just want to know
yea or nay.
LEGAL MUMBO-JUMBO:
I hereby release the test harness to the public domain.
Thomas G. Lane, 22 Nov 1993
IMPORTANT: jrevdct.c is NOT public domain, but is copyrighted free software
(not the same thing at all). It is subject to IJG's distribution terms, which
primarily state that if you incorporate it into a program you must acknowledge
IJG's contribution in your program documentation. For more details and the
complete IJG software, see the IJG FTP archive at ftp.uu.net, in directory
/graphics/jpeg.
/* define DCT types */
/*
* DCTSIZE underlying (1d) transform size
* DCTSIZE2 DCTSIZE squared
*/
#define DCTSIZE (8)
#define DCTSIZE2 (DCTSIZE*DCTSIZE)
#define EIGHT_BIT_SAMPLES /* needed in jrevdct.c */
typedef short DCTELEM; /* must be at least 16 bits */
typedef DCTELEM DCTBLOCK[DCTSIZE2];
typedef long INT32; /* must be at least 32 bits */
extern void gst_idct_int_idct();
extern void gst_idct_init_fast_int_idct (void);
extern void gst_idct_fast_int_idct (short *block);
extern void gst_idct_init_float_idct(void);
extern void gst_idct_float_idct (short *block);
# perform IEEE 1180 test series
# Typical usage:
# doieee >outfile
# where progname is ieeetest or a variant
for i in 1 2 3 4 5;
do
time ./ieeetest $i -256 255 1 10000
time ./ieeetest $i -5 5 1 10000
time ./ieeetest $i -300 300 1 10000
time ./ieeetest $i -256 255 -1 10000
time ./ieeetest $i -5 5 -1 10000
time ./ieeetest $i -300 300 -1 10000
done
/* idct.c, inverse fast discrete cosine transform */
/* Copyright (C) 1996, MPEG Software Simulation Group. All Rights Reserved. */
/*
* Disclaimer of Warranty
*
* These software programs are available to the user without any license fee or
* royalty on an "as is" basis. The MPEG Software Simulation Group disclaims
* any and all warranties, whether express, implied, or statuary, including any
* implied warranties or merchantability or of fitness for a particular
* purpose. In no event shall the copyright-holder be liable for any
* incidental, punitive, or consequential damages of any kind whatsoever
* arising from the use of these programs.
*
* This disclaimer of warranty extends to the user of these programs and user's
* customers, employees, agents, transferees, successors, and assigns.
*
* The MPEG Software Simulation Group does not represent or warrant that the
* programs furnished hereunder are free of infringement of any third-party
* patents.
*
* Commercial implementations of MPEG-1 and MPEG-2 video, including shareware,
* are subject to royalty fees to patent holders. Many of these patents are
* general enough such that they are unavoidable regardless of implementation
* design.
*
*/
/**********************************************************/
/* inverse two dimensional DCT, Chen-Wang algorithm */
/* (cf. IEEE ASSP-32, pp. 803-816, Aug. 1984) */
/* 32-bit integer arithmetic (8 bit coefficients) */
/* 11 mults, 29 adds per DCT */
/* sE, 18.8.91 */
/**********************************************************/
/* coefficients extended to 12 bit for IEEE1180-1990 */
/* compliance sE, 2.1.94 */
/**********************************************************/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
/* this code assumes >> to be a two's-complement arithmetic */
/* right shift: (-2)>>1 == -1 , (-3)>>1 == -2 */
#define W1 2841 /* 2048*sqrt(2)*cos(1*pi/16) */
#define W2 2676 /* 2048*sqrt(2)*cos(2*pi/16) */
#define W3 2408 /* 2048*sqrt(2)*cos(3*pi/16) */
#define W5 1609 /* 2048*sqrt(2)*cos(5*pi/16) */
#define W6 1108 /* 2048*sqrt(2)*cos(6*pi/16) */
#define W7 565 /* 2048*sqrt(2)*cos(7*pi/16) */
#include "dct.h"
/* private data */
static short iclip[1024]; /* clipping table */
static short *iclp;
/* private prototypes */
static void idctrow (short *blk);
static void idctcol (short *blk);
/* row (horizontal) IDCT
*
* 7 pi 1
* dst[k] = sum c[l] * src[l] * cos( -- * ( k + - ) * l )
* l=0 8 2
*
* where: c[0] = 128
* c[1..7] = 128*sqrt(2)
*/
static void
idctrow (blk)
short *blk;
{
int x0, x1, x2, x3, x4, x5, x6, x7, x8;
/* shortcut */
if (!((x1 = blk[4] << 11) | (x2 = blk[6]) | (x3 = blk[2]) |
(x4 = blk[1]) | (x5 = blk[7]) | (x6 = blk[5]) | (x7 = blk[3]))) {
blk[0] = blk[1] = blk[2] = blk[3] = blk[4] = blk[5] = blk[6] = blk[7] =
blk[0] << 3;
return;
}
x0 = (blk[0] << 11) + 128; /* for proper rounding in the fourth stage */
/* first stage */
x8 = W7 * (x4 + x5);
x4 = x8 + (W1 - W7) * x4;
x5 = x8 - (W1 + W7) * x5;
x8 = W3 * (x6 + x7);
x6 = x8 - (W3 - W5) * x6;
x7 = x8 - (W3 + W5) * x7;
/* second stage */
x8 = x0 + x1;
x0 -= x1;
x1 = W6 * (x3 + x2);
x2 = x1 - (W2 + W6) * x2;
x3 = x1 + (W2 - W6) * x3;
x1 = x4 + x6;
x4 -= x6;
x6 = x5 + x7;
x5 -= x7;
/* third stage */
x7 = x8 + x3;
x8 -= x3;
x3 = x0 + x2;
x0 -= x2;
x2 = (181 * (x4 + x5) + 128) >> 8;
x4 = (181 * (x4 - x5) + 128) >> 8;
/* fourth stage */
blk[0] = (x7 + x1) >> 8;
blk[1] = (x3 + x2) >> 8;
blk[2] = (x0 + x4) >> 8;
blk[3] = (x8 + x6) >> 8;
blk[4] = (x8 - x6) >> 8;
blk[5] = (x0 - x4) >> 8;
blk[6] = (x3 - x2) >> 8;
blk[7] = (x7 - x1) >> 8;
}
/* column (vertical) IDCT
*
* 7 pi 1
* dst[8*k] = sum c[l] * src[8*l] * cos( -- * ( k + - ) * l )
* l=0 8 2
*
* where: c[0] = 1/1024
* c[1..7] = (1/1024)*sqrt(2)
*/
static void
idctcol (blk)
short *blk;
{
int x0, x1, x2, x3, x4, x5, x6, x7, x8;
/* shortcut */
if (!((x1 = (blk[8 * 4] << 8)) | (x2 = blk[8 * 6]) | (x3 = blk[8 * 2]) |
(x4 = blk[8 * 1]) | (x5 = blk[8 * 7]) | (x6 = blk[8 * 5]) | (x7 =
blk[8 * 3]))) {
blk[8 * 0] = blk[8 * 1] = blk[8 * 2] = blk[8 * 3] = blk[8 * 4] =
blk[8 * 5] = blk[8 * 6] = blk[8 * 7] = iclp[(blk[8 * 0] + 32) >> 6];
return;
}
x0 = (blk[8 * 0] << 8) + 8192;
/* first stage */
x8 = W7 * (x4 + x5) + 4;
x4 = (x8 + (W1 - W7) * x4) >> 3;
x5 = (x8 - (W1 + W7) * x5) >> 3;
x8 = W3 * (x6 + x7) + 4;
x6 = (x8 - (W3 - W5) * x6) >> 3;
x7 = (x8 - (W3 + W5) * x7) >> 3;
/* second stage */
x8 = x0 + x1;
x0 -= x1;
x1 = W6 * (x3 + x2) + 4;
x2 = (x1 - (W2 + W6) * x2) >> 3;
x3 = (x1 + (W2 - W6) * x3) >> 3;
x1 = x4 + x6;
x4 -= x6;
x6 = x5 + x7;
x5 -= x7;
/* third stage */
x7 = x8 + x3;
x8 -= x3;
x3 = x0 + x2;
x0 -= x2;
x2 = (181 * (x4 + x5) + 128) >> 8;
x4 = (181 * (x4 - x5) + 128) >> 8;
/* fourth stage */
blk[8 * 0] = iclp[(x7 + x1) >> 14];
blk[8 * 1] = iclp[(x3 + x2) >> 14];
blk[8 * 2] = iclp[(x0 + x4) >> 14];
blk[8 * 3] = iclp[(x8 + x6) >> 14];
blk[8 * 4] = iclp[(x8 - x6) >> 14];
blk[8 * 5] = iclp[(x0 - x4) >> 14];
blk[8 * 6] = iclp[(x3 - x2) >> 14];
blk[8 * 7] = iclp[(x7 - x1) >> 14];
}
/* two dimensional inverse discrete cosine transform */
void
gst_idct_fast_int_idct (block)
short *block;
{
int i;
for (i = 0; i < 8; i++)
idctrow (block + 8 * i);
for (i = 0; i < 8; i++)
idctcol (block + i);
}
void
gst_idct_init_fast_int_idct ()
{
int i;
iclp = iclip + 512;
for (i = -512; i < 512; i++)
iclp[i] = (i < -256) ? -256 : ((i > 255) ? 255 : i);
}
/* Reference_IDCT.c, Inverse Discrete Fourier Transform, double precision */
/* Copyright (C) 1996, MPEG Software Simulation Group. All Rights Reserved. */
/*
* Disclaimer of Warranty
*
* These software programs are available to the user without any license fee or
* royalty on an "as is" basis. The MPEG Software Simulation Group disclaims
* any and all warranties, whether express, implied, or statuary, including any
* implied warranties or merchantability or of fitness for a particular
* purpose. In no event shall the copyright-holder be liable for any
* incidental, punitive, or consequential damages of any kind whatsoever
* arising from the use of these programs.
*
* This disclaimer of warranty extends to the user of these programs and user's
* customers, employees, agents, transferees, successors, and assigns.
*
* The MPEG Software Simulation Group does not represent or warrant that the
* programs furnished hereunder are free of infringement of any third-party
* patents.
*
* Commercial implementations of MPEG-1 and MPEG-2 video, including shareware,
* are subject to royalty fees to patent holders. Many of these patents are
* general enough such that they are unavoidable regardless of implementation
* design.
*
*/
/* Perform IEEE 1180 reference (64-bit floating point, separable 8x1
* direct matrix multiply) Inverse Discrete Cosine Transform
*/
/* Here we use math.h to generate constants. Compiler results may
vary a little */
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <math.h>
#ifndef PI
# ifdef M_PI
# define PI M_PI
# else
# define PI 3.14159265358979323846
# endif
#endif
/* private data */
/* cosine transform matrix for 8x1 IDCT */
static double gst_idct_float_c[8][8];
/* initialize DCT coefficient matrix */
void
gst_idct_init_float_idct ()
{
int freq, time;
double scale;
for (freq = 0; freq < 8; freq++) {
scale = (freq == 0) ? sqrt (0.125) : 0.5;
for (time = 0; time < 8; time++)
gst_idct_float_c[freq][time] =
scale * cos ((PI / 8.0) * freq * (time + 0.5));
}
}
/* perform IDCT matrix multiply for 8x8 coefficient block */
void
gst_idct_float_idct (block)
short *block;
{
int i, j, k, v;
double partial_product;
double tmp[64];
for (i = 0; i < 8; i++)
for (j = 0; j < 8; j++) {
partial_product = 0.0;
for (k = 0; k < 8; k++)
partial_product += gst_idct_float_c[k][j] * block[8 * i + k];
tmp[8 * i + j] = partial_product;
}
/* Transpose operation is integrated into address mapping by switching
loop order of i and j */
for (j = 0; j < 8; j++)
for (i = 0; i < 8; i++) {
partial_product = 0.0;
for (k = 0; k < 8; k++)
partial_product += gst_idct_float_c[k][i] * tmp[8 * k + j];
v = (int) floor (partial_product + 0.5);
block[8 * i + j] = (v < -256) ? -256 : ((v > 255) ? 255 : v);
}
}
/* GStreamer
* Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
*
* This library is free software; you can redistribute it and/or
* 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.
*
* 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.
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <gst/gst.h>
#include <gst/idct/idct.h>
#include "dct.h"
static void gst_idct_int_sparse_idct (short *data);
GstIDCT *
gst_idct_new (GstIDCTMethod method)
{
GstIDCT *new = g_malloc (sizeof (GstIDCT));
new->need_transpose = FALSE;
if (method == GST_IDCT_DEFAULT) {
method = GST_IDCT_FAST_INT;
}
new->convert_sparse = gst_idct_int_sparse_idct;
switch (method) {
case GST_IDCT_FAST_INT:
GST_INFO ("using fast_int_idct");
gst_idct_init_fast_int_idct ();
new->convert = gst_idct_fast_int_idct;
break;
case GST_IDCT_INT:
GST_INFO ("using int_idct");
new->convert = gst_idct_int_idct;
break;
case GST_IDCT_FLOAT:
GST_INFO ("using float_idct");
gst_idct_init_float_idct ();
new->convert = gst_idct_float_idct;
break;
default:
GST_INFO ("method not supported");
g_free (new);
return NULL;
}
return new;
}
static void
gst_idct_int_sparse_idct (short *data)
{
short val;
gint32 v, *dp = (guint32 *) data;
v = *data;
if (v < 0) {
val = -v;
val += (8 >> 1);
val /= 8;
val = -val;
} else {
val = (v + (8 >> 1)) / 8;
}
v = ((val & 0xffff) | (val << 16));
dp[0] = v;
dp[1] = v;
dp[2] = v;
dp[3] = v;
dp[4] = v;
dp[5] = v;
dp[6] = v;
dp[7] = v;
dp[8] = v;
dp[9] = v;
dp[10] = v;
dp[11] = v;
dp[12] = v;
dp[13] = v;
dp[14] = v;
dp[15] = v;
dp[16] = v;
dp[17] = v;
dp[18] = v;
dp[19] = v;
dp[20] = v;
dp[21] = v;
dp[22] = v;
dp[23] = v;
dp[24] = v;
dp[25] = v;
dp[26] = v;
dp[27] = v;
dp[28] = v;
dp[29] = v;
dp[30] = v;
dp[31] = v;
}
void
gst_idct_destroy (GstIDCT * idct)
{
g_return_if_fail (idct != NULL);
g_free (idct);
}
static gboolean
plugin_init (GstPlugin * plugin)
{
return TRUE;
}
GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
GST_VERSION_MINOR,
"gstidct",
"Accelerated IDCT routines",
plugin_init, VERSION, GST_LICENSE, GST_PACKAGE, GST_ORIGIN)
/* GStreamer
* Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
*
* This library is free software; you can redistribute it and/or
* 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.
*