summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjaromil <jaromil@383723c8-4afa-0310-b8a8-b1afb83214fc>2003-07-14 16:43:00 (GMT)
committer jaromil <jaromil@383723c8-4afa-0310-b8a8-b1afb83214fc>2003-07-14 16:43:00 (GMT)
commit442ae266fe728449712c2b25372810a559e57803 (patch)
tree814dc160bbd3af5643fb5562a21faefde652ca27
parentebcac6ac011993c6adc13842a1225fe3d6509e8a (diff)
removal of obsolete files, upgrading of autoconf/automake
git-svn-id: svn://dyne.org/rastasoft/hasciicam@504 383723c8-4afa-0310-b8a8-b1afb83214fc
-rw-r--r--hasciicam/Makefile.in7
-rw-r--r--hasciicam/acconfig.h2
-rw-r--r--hasciicam/config.h.in2
-rwxr-xr-xhasciicam/configure2
-rw-r--r--hasciicam/configure.in2
-rw-r--r--hasciicam/cpu_accel.c115
-rw-r--r--hasciicam/mm_accel.h30
-rw-r--r--hasciicam/mmx.h261
-rw-r--r--hasciicam/resample.c499
-rw-r--r--hasciicam/yuv2rgb.c422
-rw-r--r--hasciicam/yuv2rgb.h32
-rw-r--r--hasciicam/yuv2rgb_mmx.c328
12 files changed, 5 insertions, 1697 deletions
diff --git a/hasciicam/Makefile.in b/hasciicam/Makefile.in
index 2e88ff4..0646320 100644
--- a/hasciicam/Makefile.in
+++ b/hasciicam/Makefile.in
@@ -155,9 +155,8 @@ DIST_SOURCES = $(hasciicam_SOURCES)
NROFF = nroff
MANS = $(man_MANS)
DIST_COMMON = README AUTHORS COPYING ChangeLog INSTALL Makefile.am \
- Makefile.in NEWS acconfig.h aclocal.m4 config.guess config.h.in \
- config.sub configure configure.in depcomp install-sh missing \
- mkinstalldirs
+ Makefile.in NEWS aclocal.m4 config.guess config.h.in config.sub \
+ configure configure.in depcomp install-sh missing mkinstalldirs
SOURCES = $(hasciicam_SOURCES)
all: config.h
@@ -192,7 +191,7 @@ stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status
@rm -f stamp-h1
cd $(top_builddir) && $(SHELL) ./config.status config.h
-$(srcdir)/config.h.in: $(top_srcdir)/configure.in $(ACLOCAL_M4) $(top_srcdir)/acconfig.h
+$(srcdir)/config.h.in: $(top_srcdir)/configure.in $(ACLOCAL_M4)
cd $(top_srcdir) && $(AUTOHEADER)
touch $(srcdir)/config.h.in
diff --git a/hasciicam/acconfig.h b/hasciicam/acconfig.h
deleted file mode 100644
index 1ae5335..0000000
--- a/hasciicam/acconfig.h
+++ /dev/null
@@ -1,2 +0,0 @@
-#undef HAVE_LINUX
-#undef HAVE_SGI
diff --git a/hasciicam/config.h.in b/hasciicam/config.h.in
index 73188af..34c6321 100644
--- a/hasciicam/config.h.in
+++ b/hasciicam/config.h.in
@@ -1,6 +1,4 @@
/* config.h.in. Generated from configure.in by autoheader. */
-#undef HAVE_LINUX
-#undef HAVE_SGI
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
diff --git a/hasciicam/configure b/hasciicam/configure
index 77c4a67..f73e947 100755
--- a/hasciicam/configure
+++ b/hasciicam/configure
@@ -2828,7 +2828,7 @@ else
fi
-CFLAGS="$CFLAGS -O3 -pipe -I/usr/local/include -ffast-math"
+CFLAGS="$CFLAGS -O3 -pipe -ffast-math"
ac_ext=c
diff --git a/hasciicam/configure.in b/hasciicam/configure.in
index 75d819a..b09e16c 100644
--- a/hasciicam/configure.in
+++ b/hasciicam/configure.in
@@ -21,7 +21,7 @@ AC_PROG_CC
AC_PROG_RANLIB
dnl Add the local include path and some flags
-CFLAGS="$CFLAGS -O3 -pipe -I/usr/local/include -ffast-math"
+CFLAGS="$CFLAGS -O3 -pipe -ffast-math"
dnl Checks for header files.
AC_HEADER_STDC
diff --git a/hasciicam/cpu_accel.c b/hasciicam/cpu_accel.c
deleted file mode 100644
index b5bbecb..0000000
--- a/hasciicam/cpu_accel.c
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- * cpu_accel.c
- * Copyright (C) 1999-2001 Aaron Holtzman <aholtzma@ess.engr.uvic.ca>
- *
- * This file is part of mpeg2dec, a free MPEG-2 video stream decoder.
- *
- * mpeg2dec is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * mpeg2dec 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#include <inttypes.h>
-
-#include <mm_accel.h>
-
-#include <config.h>
-
-static uint32_t x86_accel (void)
-{
- uint32_t eax, ebx, ecx, edx;
- int AMD;
- uint32_t caps;
-
-#ifndef PIC
-#define cpuid(op,eax,ebx,ecx,edx) \
- asm ("cpuid" \
- : "=a" (eax), \
- "=b" (ebx), \
- "=c" (ecx), \
- "=d" (edx) \
- : "a" (op) \
- : "cc")
-#else // PIC version : save ebx
-#define cpuid(op,eax,ebx,ecx,edx) \
- asm ("pushl %%ebx\n\t" \
- "cpuid\n\t" \
- "movl %%ebx,%1\n\t" \
- "popl %%ebx" \
- : "=a" (eax), \
- "=r" (ebx), \
- "=c" (ecx), \
- "=d" (edx) \
- : "a" (op) \
- : "cc")
-#endif
-
- asm ("pushfl\n\t"
- "pushfl\n\t"
- "popl %0\n\t"
- "movl %0,%1\n\t"
- "xorl $0x200000,%0\n\t"
- "pushl %0\n\t"
- "popfl\n\t"
- "pushfl\n\t"
- "popl %0\n\t"
- "popfl"
- : "=r" (eax),
- "=r" (ebx)
- :
- : "cc");
-
- if (eax == ebx) /* no cpuid */
- return 0;
-
- cpuid (0x00000000, eax, ebx, ecx, edx);
- if (!eax) /* vendor string only */
- return 0;
-
- AMD = (ebx == 0x68747541) && (ecx == 0x444d4163) && (edx == 0x69746e65);
-
- cpuid (0x00000001, eax, ebx, ecx, edx);
- if (! (edx & 0x00800000)) /* no MMX */
- return 0;
-
- caps = MM_ACCEL_X86_MMX;
- if (edx & 0x02000000) /* SSE - identical to AMD MMX extensions */
- caps = MM_ACCEL_X86_MMX | MM_ACCEL_X86_MMXEXT;
-
- cpuid (0x80000000, eax, ebx, ecx, edx);
- if (eax < 0x80000001) /* no extended capabilities */
- return caps;
-
- cpuid (0x80000001, eax, ebx, ecx, edx);
-
- if (edx & 0x80000000)
- caps |= MM_ACCEL_X86_3DNOW;
-
- if (AMD && (edx & 0x00400000)) /* AMD MMX extensions */
- caps |= MM_ACCEL_X86_MMXEXT;
-
- return caps;
-}
-
-uint32_t mm_accel (void)
-{
- static int got_accel = 0;
- static uint32_t accel;
-
- if (!got_accel) {
- got_accel = 1;
- accel = x86_accel ();
- }
-
- return accel;
-}
diff --git a/hasciicam/mm_accel.h b/hasciicam/mm_accel.h
deleted file mode 100644
index d60ea65..0000000
--- a/hasciicam/mm_accel.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * mm_accel.h
- * Copyright (C) 1999-2001 Aaron Holtzman <aholtzma@ess.engr.uvic.ca>
- *
- * This file is part of mpeg2dec, a free MPEG-2 video stream decoder.
- *
- * mpeg2dec is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * mpeg2dec 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-/* generic accelerations */
-#define MM_ACCEL_MLIB 0x00000001
-
-/* x86 accelerations */
-#define MM_ACCEL_X86_MMX 0x80000000
-#define MM_ACCEL_X86_3DNOW 0x40000000
-#define MM_ACCEL_X86_MMXEXT 0x20000000
-
-uint32_t mm_accel (void);
diff --git a/hasciicam/mmx.h b/hasciicam/mmx.h
deleted file mode 100644
index e402b21..0000000
--- a/hasciicam/mmx.h
+++ /dev/null
@@ -1,261 +0,0 @@
-/*
- * mmx.h
- * Copyright (C) 1997-2001 H. Dietz and R. Fisher
- *
- * This file is part of mpeg2dec, a free MPEG-2 video stream decoder.
- *
- * mpeg2dec is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * mpeg2dec 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-/*
- * The type of an value that fits in an MMX register (note that long
- * long constant values MUST be suffixed by LL and unsigned long long
- * values by ULL, lest they be truncated by the compiler)
- */
-
-typedef union {
- long long q; /* Quadword (64-bit) value */
- unsigned long long uq; /* Unsigned Quadword */
- int d[2]; /* 2 Doubleword (32-bit) values */
- unsigned int ud[2]; /* 2 Unsigned Doubleword */
- short w[4]; /* 4 Word (16-bit) values */
- unsigned short uw[4]; /* 4 Unsigned Word */
- char b[8]; /* 8 Byte (8-bit) values */
- unsigned char ub[8]; /* 8 Unsigned Byte */
- float s[2]; /* Single-precision (32-bit) value */
-} ATTR_ALIGN(8) mmx_t; /* On an 8-byte (64-bit) boundary */
-
-
-#define mmx_i2r(op,imm,reg) \
- __asm__ __volatile__ (#op " %0, %%" #reg \
- : /* nothing */ \
- : "i" (imm) )
-
-#define mmx_m2r(op,mem,reg) \
- __asm__ __volatile__ (#op " %0, %%" #reg \
- : /* nothing */ \
- : "m" (mem))
-
-#define mmx_r2m(op,reg,mem) \
- __asm__ __volatile__ (#op " %%" #reg ", %0" \
- : "=m" (mem) \
- : /* nothing */ )
-
-#define mmx_r2r(op,regs,regd) \
- __asm__ __volatile__ (#op " %" #regs ", %" #regd)
-
-
-#define emms() __asm__ __volatile__ ("emms")
-
-#define movd_m2r(var,reg) mmx_m2r (movd, var, reg)
-#define movd_r2m(reg,var) mmx_r2m (movd, reg, var)
-#define movd_v2r(var,reg) __asm__ __volatile__ ("movd %0, %%" #reg \
- : /* nothing */ \
- : "rm" (var))
-#define movd_r2v(reg,var) __asm__ __volatile__ ("movd %%" #reg ", %0" \
- : "=rm" (var) \
- : /* nothing */ )
-
-#define movq_m2r(var,reg) mmx_m2r (movq, var, reg)
-#define movq_r2m(reg,var) mmx_r2m (movq, reg, var)
-#define movq_r2r(regs,regd) mmx_r2r (movq, regs, regd)
-
-#define packssdw_m2r(var,reg) mmx_m2r (packssdw, var, reg)
-#define packssdw_r2r(regs,regd) mmx_r2r (packssdw, regs, regd)
-#define packsswb_m2r(var,reg) mmx_m2r (packsswb, var, reg)
-#define packsswb_r2r(regs,regd) mmx_r2r (packsswb, regs, regd)
-
-#define packuswb_m2r(var,reg) mmx_m2r (packuswb, var, reg)
-#define packuswb_r2r(regs,regd) mmx_r2r (packuswb, regs, regd)
-
-#define paddb_m2r(var,reg) mmx_m2r (paddb, var, reg)
-#define paddb_r2r(regs,regd) mmx_r2r (paddb, regs, regd)
-#define paddd_m2r(var,reg) mmx_m2r (paddd, var, reg)
-#define paddd_r2r(regs,regd) mmx_r2r (paddd, regs, regd)
-#define paddw_m2r(var,reg) mmx_m2r (paddw, var, reg)
-#define paddw_r2r(regs,regd) mmx_r2r (paddw, regs, regd)
-
-#define paddsb_m2r(var,reg) mmx_m2r (paddsb, var, reg)
-#define paddsb_r2r(regs,regd) mmx_r2r (paddsb, regs, regd)
-#define paddsw_m2r(var,reg) mmx_m2r (paddsw, var, reg)
-#define paddsw_r2r(regs,regd) mmx_r2r (paddsw, regs, regd)
-
-#define paddusb_m2r(var,reg) mmx_m2r (paddusb, var, reg)
-#define paddusb_r2r(regs,regd) mmx_r2r (paddusb, regs, regd)
-#define paddusw_m2r(var,reg) mmx_m2r (paddusw, var, reg)
-#define paddusw_r2r(regs,regd) mmx_r2r (paddusw, regs, regd)
-
-#define pand_m2r(var,reg) mmx_m2r (pand, var, reg)
-#define pand_r2r(regs,regd) mmx_r2r (pand, regs, regd)
-
-#define pandn_m2r(var,reg) mmx_m2r (pandn, var, reg)
-#define pandn_r2r(regs,regd) mmx_r2r (pandn, regs, regd)
-
-#define pcmpeqb_m2r(var,reg) mmx_m2r (pcmpeqb, var, reg)
-#define pcmpeqb_r2r(regs,regd) mmx_r2r (pcmpeqb, regs, regd)
-#define pcmpeqd_m2r(var,reg) mmx_m2r (pcmpeqd, var, reg)
-#define pcmpeqd_r2r(regs,regd) mmx_r2r (pcmpeqd, regs, regd)
-#define pcmpeqw_m2r(var,reg) mmx_m2r (pcmpeqw, var, reg)
-#define pcmpeqw_r2r(regs,regd) mmx_r2r (pcmpeqw, regs, regd)
-
-#define pcmpgtb_m2r(var,reg) mmx_m2r (pcmpgtb, var, reg)
-#define pcmpgtb_r2r(regs,regd) mmx_r2r (pcmpgtb, regs, regd)
-#define pcmpgtd_m2r(var,reg) mmx_m2r (pcmpgtd, var, reg)
-#define pcmpgtd_r2r(regs,regd) mmx_r2r (pcmpgtd, regs, regd)
-#define pcmpgtw_m2r(var,reg) mmx_m2r (pcmpgtw, var, reg)
-#define pcmpgtw_r2r(regs,regd) mmx_r2r (pcmpgtw, regs, regd)
-
-#define pmaddwd_m2r(var,reg) mmx_m2r (pmaddwd, var, reg)
-#define pmaddwd_r2r(regs,regd) mmx_r2r (pmaddwd, regs, regd)
-
-#define pmulhw_m2r(var,reg) mmx_m2r (pmulhw, var, reg)
-#define pmulhw_r2r(regs,regd) mmx_r2r (pmulhw, regs, regd)
-
-#define pmullw_m2r(var,reg) mmx_m2r (pmullw, var, reg)
-#define pmullw_r2r(regs,regd) mmx_r2r (pmullw, regs, regd)
-
-#define por_m2r(var,reg) mmx_m2r (por, var, reg)
-#define por_r2r(regs,regd) mmx_r2r (por, regs, regd)
-
-#define pslld_i2r(imm,reg) mmx_i2r (pslld, imm, reg)
-#define pslld_m2r(var,reg) mmx_m2r (pslld, var, reg)
-#define pslld_r2r(regs,regd) mmx_r2r (pslld, regs, regd)
-#define psllq_i2r(imm,reg) mmx_i2r (psllq, imm, reg)
-#define psllq_m2r(var,reg) mmx_m2r (psllq, var, reg)
-#define psllq_r2r(regs,regd) mmx_r2r (psllq, regs, regd)
-#define psllw_i2r(imm,reg) mmx_i2r (psllw, imm, reg)
-#define psllw_m2r(var,reg) mmx_m2r (psllw, var, reg)
-#define psllw_r2r(regs,regd) mmx_r2r (psllw, regs, regd)
-
-#define psrad_i2r(imm,reg) mmx_i2r (psrad, imm, reg)
-#define psrad_m2r(var,reg) mmx_m2r (psrad, var, reg)
-#define psrad_r2r(regs,regd) mmx_r2r (psrad, regs, regd)
-#define psraw_i2r(imm,reg) mmx_i2r (psraw, imm, reg)
-#define psraw_m2r(var,reg) mmx_m2r (psraw, var, reg)
-#define psraw_r2r(regs,regd) mmx_r2r (psraw, regs, regd)
-
-#define psrld_i2r(imm,reg) mmx_i2r (psrld, imm, reg)
-#define psrld_m2r(var,reg) mmx_m2r (psrld, var, reg)
-#define psrld_r2r(regs,regd) mmx_r2r (psrld, regs, regd)
-#define psrlq_i2r(imm,reg) mmx_i2r (psrlq, imm, reg)
-#define psrlq_m2r(var,reg) mmx_m2r (psrlq, var, reg)
-#define psrlq_r2r(regs,regd) mmx_r2r (psrlq, regs, regd)
-#define psrlw_i2r(imm,reg) mmx_i2r (psrlw, imm, reg)
-#define psrlw_m2r(var,reg) mmx_m2r (psrlw, var, reg)
-#define psrlw_r2r(regs,regd) mmx_r2r (psrlw, regs, regd)
-
-#define psubb_m2r(var,reg) mmx_m2r (psubb, var, reg)
-#define psubb_r2r(regs,regd) mmx_r2r (psubb, regs, regd)
-#define psubd_m2r(var,reg) mmx_m2r (psubd, var, reg)
-#define psubd_r2r(regs,regd) mmx_r2r (psubd, regs, regd)
-#define psubw_m2r(var,reg) mmx_m2r (psubw, var, reg)
-#define psubw_r2r(regs,regd) mmx_r2r (psubw, regs, regd)
-
-#define psubsb_m2r(var,reg) mmx_m2r (psubsb, var, reg)
-#define psubsb_r2r(regs,regd) mmx_r2r (psubsb, regs, regd)
-#define psubsw_m2r(var,reg) mmx_m2r (psubsw, var, reg)
-#define psubsw_r2r(regs,regd) mmx_r2r (psubsw, regs, regd)
-
-#define psubusb_m2r(var,reg) mmx_m2r (psubusb, var, reg)
-#define psubusb_r2r(regs,regd) mmx_r2r (psubusb, regs, regd)
-#define psubusw_m2r(var,reg) mmx_m2r (psubusw, var, reg)
-#define psubusw_r2r(regs,regd) mmx_r2r (psubusw, regs, regd)
-
-#define punpckhbw_m2r(var,reg) mmx_m2r (punpckhbw, var, reg)
-#define punpckhbw_r2r(regs,regd) mmx_r2r (punpckhbw, regs, regd)
-#define punpckhdq_m2r(var,reg) mmx_m2r (punpckhdq, var, reg)
-#define punpckhdq_r2r(regs,regd) mmx_r2r (punpckhdq, regs, regd)
-#define punpckhwd_m2r(var,reg) mmx_m2r (punpckhwd, var, reg)
-#define punpckhwd_r2r(regs,regd) mmx_r2r (punpckhwd, regs, regd)
-
-#define punpcklbw_m2r(var,reg) mmx_m2r (punpcklbw, var, reg)
-#define punpcklbw_r2r(regs,regd) mmx_r2r (punpcklbw, regs, regd)
-#define punpckldq_m2r(var,reg) mmx_m2r (punpckldq, var, reg)
-#define punpckldq_r2r(regs,regd) mmx_r2r (punpckldq, regs, regd)
-#define punpcklwd_m2r(var,reg) mmx_m2r (punpcklwd, var, reg)
-#define punpcklwd_r2r(regs,regd) mmx_r2r (punpcklwd, regs, regd)
-
-#define pxor_m2r(var,reg) mmx_m2r (pxor, var, reg)
-#define pxor_r2r(regs,regd) mmx_r2r (pxor, regs, regd)
-
-
-/* 3DNOW extensions */
-
-#define pavgusb_m2r(var,reg) mmx_m2r (pavgusb, var, reg)
-#define pavgusb_r2r(regs,regd) mmx_r2r (pavgusb, regs, regd)
-
-
-/* AMD MMX extensions - also available in intel SSE */
-
-
-#define mmx_m2ri(op,mem,reg,imm) \
- __asm__ __volatile__ (#op " %1, %0, %%" #reg \
- : /* nothing */ \
- : "m" (mem), "i" (imm))
-
-#define mmx_r2ri(op,regs,regd,imm) \
- __asm__ __volatile__ (#op " %0, %%" #regs ", %%" #regd \
- : /* nothing */ \
- : "i" (imm) )
-
-#define mmx_fetch(mem,hint) \
- __asm__ __volatile__ ("prefetch" #hint " %0" \
- : /* nothing */ \
- : "m" (mem))
-
-
-#define maskmovq(regs,maskreg) mmx_r2ri (maskmovq, regs, maskreg)
-
-#define movntq_r2m(mmreg,var) mmx_r2m (movntq, mmreg, var)
-
-#define pavgb_m2r(var,reg) mmx_m2r (pavgb, var, reg)
-#define pavgb_r2r(regs,regd) mmx_r2r (pavgb, regs, regd)
-#define pavgw_m2r(var,reg) mmx_m2r (pavgw, var, reg)
-#define pavgw_r2r(regs,regd) mmx_r2r (pavgw, regs, regd)
-
-#define pextrw_r2r(mmreg,reg,imm) mmx_r2ri (pextrw, mmreg, reg, imm)
-
-#define pinsrw_r2r(reg,mmreg,imm) mmx_r2ri (pinsrw, reg, mmreg, imm)
-
-#define pmaxsw_m2r(var,reg) mmx_m2r (pmaxsw, var, reg)
-#define pmaxsw_r2r(regs,regd) mmx_r2r (pmaxsw, regs, regd)
-
-#define pmaxub_m2r(var,reg) mmx_m2r (pmaxub, var, reg)
-#define pmaxub_r2r(regs,regd) mmx_r2r (pmaxub, regs, regd)
-
-#define pminsw_m2r(var,reg) mmx_m2r (pminsw, var, reg)
-#define pminsw_r2r(regs,regd) mmx_r2r (pminsw, regs, regd)
-
-#define pminub_m2r(var,reg) mmx_m2r (pminub, var, reg)
-#define pminub_r2r(regs,regd) mmx_r2r (pminub, regs, regd)
-
-#define pmovmskb(mmreg,reg) \
- __asm__ __volatile__ ("movmskps %" #mmreg ", %" #reg)
-
-#define pmulhuw_m2r(var,reg) mmx_m2r (pmulhuw, var, reg)
-#define pmulhuw_r2r(regs,regd) mmx_r2r (pmulhuw, regs, regd)
-
-#define prefetcht0(mem) mmx_fetch (mem, t0)
-#define prefetcht1(mem) mmx_fetch (mem, t1)
-#define prefetcht2(mem) mmx_fetch (mem, t2)
-#define prefetchnta(mem) mmx_fetch (mem, nta)
-
-#define psadbw_m2r(var,reg) mmx_m2r (psadbw, var, reg)
-#define psadbw_r2r(regs,regd) mmx_r2r (psadbw, regs, regd)
-
-#define pshufw_m2r(var,reg,imm) mmx_m2ri(pshufw, var, reg, imm)
-#define pshufw_r2r(regs,regd,imm) mmx_r2ri(pshufw, regs, regd, imm)
-
-#define sfence() __asm__ __volatile__ ("sfence\n\t")
diff --git a/hasciicam/resample.c b/hasciicam/resample.c
deleted file mode 100644
index c51e35d..0000000
--- a/hasciicam/resample.c
+++ /dev/null
@@ -1,499 +0,0 @@
-/*
- Filtered Image Resampling
- Original file by Dale Schumacher (found in Graphics Gems, III).
- Additional changes by Ray Gardener, Daylon Graphics Ltd.
- December 4, 1999
-*/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <malloc.h>
-#include <math.h>
-
-#ifndef EXIT_SUCCESS
-#define EXIT_SUCCESS (0)
-#define EXIT_FAILURE (1)
-#endif
-
-/* M_PI was not in gems header ? ? */
-#ifndef M_PI
-#define M_PI 3.14159265359
-#endif
-#ifndef TRUE
-#define TRUE 1
-#define FALSE 0
-#endif
-typedef unsigned char Pixel;
-
-
-#define WHITE_PIXEL (255)
-#define BLACK_PIXEL (0)
-#define MaxRGB WHITE_PIXEL
-#define MinRGB BLACK_PIXEL
-
-#define CLAMP(val,a,b) (((val)<(a))?(a):(((val)>(b))?(b):(val)))
-
-/*
- * filter function definitions
- */
-
-#define filter_support (1.0)
-
-static double
-filter (double t)
-{
- /* f(t) = 2|t|^3 - 3|t|^2 + 1, -1 <= t <= 1 */
- if (t < 0.0)
- t = -t;
- if (t < 1.0)
- return ((2.0 * t - 3.0) * t * t + 1.0);
- return (0.0);
-}
-
-#define box_support (0.5)
-
-static double
-box_filter (double t)
-{
- if ((t > -0.5) && (t <= 0.5))
- return (1.0);
- return (0.0);
-}
-
-#define triangle_support (1.0)
-
-static double
-triangle_filter (double t)
-{
- if (t < 0.0)
- t = -t;
- if (t < 1.0)
- return (1.0 - t);
- return (0.0);
-}
-
-#define bell_support (1.5)
-
-static double
-bell_filter (double t)
- /* box (*) box (*) box */
-{
- if (t < 0)
- t = -t;
- if (t < .5)
- return (.75 - (t * t));
- if (t < 1.5)
- {
- t = (t - 1.5);
- return (.5 * (t * t));
- }
- return (0.0);
-}
-
-#define B_spline_support (2.0)
-
-static double
-B_spline_filter (double t) /* box (*) box (*) box (*) box */
-{
- double tt;
-
- if (t < 0)
- t = -t;
- if (t < 1)
- {
- tt = t * t;
- return ((.5 * tt * t) - tt + (2.0 / 3.0));
- }
- else if (t < 2)
- {
- t = 2 - t;
- return ((1.0 / 6.0) * (t * t * t));
- }
- return (0.0);
-}
-
-
-
-#define Mitchell_support (2.0)
-
-static double
-Mitchell_filter (double t)
-{
- double tt;
- double B = (1.0 / 3.0);
- double C = (1.0 / 3.0);
-
- tt = t * t;
- if (t < 0)
- t = -t;
- if (t < 1.0)
- {
- t = (((12.0 - 9.0 * B - 6.0 * C) * (t * tt))
- + ((-18.0 + 12.0 * B + 6.0 * C) * tt) + (6.0 - 2 * B));
- return (t / 6.0);
- }
- else if (t < 2.0)
- {
- t = (((-1.0 * B - 6.0 * C) * (t * tt))
- + ((6.0 * B + 30.0 * C) * tt)
- + ((-12.0 * B - 48.0 * C) * t) + (8.0 * B + 24 * C));
- return (t / 6.0);
- }
- return (0.0);
-}
-
-
-static double
-sinc (const double x)
-{
- if (x != 0)
- return (sin (x * M_PI) / (x * M_PI));
- return (1.0);
-}
-
-#define Lanczos3_support (3.0)
-
-static double
-Lanczos3_filter (const double arg)
-{
- double t = arg;
- if (t < 0)
- t = -t;
- if (t < 3.0)
- return (sinc (t) * sinc (t / 3.0));
- return (0.0);
-}
-
-
-/*
- * image rescaling routine
- */
-
-typedef struct
-{
- int pixel;
- double weight;
-}
-CONTRIB;
-
-typedef struct
-{
- int n; /* number of contributors */
- CONTRIB *p; /* pointer to list of contributions */
-}
-CLIST;
-
-CLIST *contrib; /* array of contribution lists */
-
-
-/*
- roundcloser()
-
- Round an FP value to its closest int representation.
- General routine; ideally belongs in general math lib file.
-*/
-static int
-roundcloser (double d)
-{
- /* Untested potential one-liner, but smacks of call overhead */
- /* return fabs(ceil(d)-d) <= 0.5 ? ceil(d) : floor(d); */
-
- /* Untested potential optimized ceil() usage */
- /* double cd = ceil(d);
- int ncd = (int)cd;
- if(fabs(cd - d) > 0.5)
- ncd--;
- return ncd;
- */
-
- /* Version that uses no function calls at all. */
- int n = (int) d;
- double diff = d - (double) n;
- if (diff < 0)
- diff = -diff;
- if (diff >= 0.5)
- {
- if (d < 0)
- n--;
- else
- n++;
- }
- return n;
-} /* roundcloser */
-
-
-/*
- calc_x_contrib()
-
- Calculates the filter weights for a single target column.
- contribX->p must be freed afterwards.
-
- Returns -1 if error, 0 otherwise.
-*/
-static int
-calc_x_contrib (contribX, xscale, fwidth, dstwidth, srcwidth, filterf, i)
- CLIST *contribX; /* Receiver of contrib info */
- double xscale; /* Horizontal zooming scale */
- double fwidth; /* Filter sampling width */
- int dstwidth; /* Target bitmap width */
- int srcwidth; /* Source bitmap width */
- double (*filterf) (double); /* Filter proc */
- int i; /* Pixel column in source bitmap being processed */
-{
- double width;
- double fscale;
- double center, left, right;
- double weight;
- int j, k, n;
-
- if (xscale < 1.0)
- {
- /* Shrinking image */
- width = fwidth / xscale;
- fscale = 1.0 / xscale;
-
- contribX->n = 0;
- contribX->p = (CONTRIB *) calloc ((int) (width * 2 + 1),
- sizeof (CONTRIB));
- if (contribX->p == NULL)
- return -1;
-
- center = (double) i / xscale;
- left = ceil (center - width);
- right = floor (center + width);
- for (j = (int) left; j <= right; ++j)
- {
- weight = center - (double) j;
- weight = (*filterf) (weight / fscale) / fscale;
- if (j < 0)
- n = -j;
- else if (j >= srcwidth)
- n = (srcwidth - j) + srcwidth - 1;
- else
- n = j;
-
- k = contribX->n++;
- contribX->p[k].pixel = n;
- contribX->p[k].weight = weight;
- }
-
- }
- else
- {
- /* Expanding image */
- contribX->n = 0;
- contribX->p = (CONTRIB *) calloc ((int) (fwidth * 2 + 1),
- sizeof (CONTRIB));
- if (contribX->p == NULL)
- return -1;
- center = (double) i / xscale;
- left = ceil (center - fwidth);
- right = floor (center + fwidth);
-
- for (j = (int) left; j <= right; ++j)
- {
- weight = center - (double) j;
- weight = (*filterf) (weight);
- if (j < 0)
- {
- n = -j;
- }
- else if (j >= srcwidth)
- {
- n = (srcwidth - j) + srcwidth - 1;
- }
- else
- {
- n = j;
- }
- k = contribX->n++;
- contribX->p[k].pixel = n;
- contribX->p[k].weight = weight;
- }
- }
- return 0;
-} /* calc_x_contrib */
-
-
-/*
- zoom()
-
- Resizes a one-component bitmap while resampling it.
- Returns -1 if error, 0 if success.
-*/
-void
-zoom (unsigned char *src, int src_width, int src_height,
- unsigned char *dst, int dst_width, int dst_height)
-{
- Pixel *tmp;
- double xscale, yscale; /* zoom scale factors */
- int xx;
- int i, j, k; /* loop variables */
- int n; /* pixel number */
- double center, left, right; /* filter calculation variables */
- double width, fscale, weight; /* filter calculation variables */
- Pixel pel, pel2;
- int bPelDelta;
- CLIST *contribY; /* array of contribution lists */
- CLIST contribX;
-
- double (*filterf) (double) = bell_filter;
- double fwidth = bell_support;
-
- /* create intermediate column to hold horizontal dst column zoom */
- tmp = (Pixel *) malloc (src_height * sizeof (Pixel));
- if (tmp == NULL)
- return;
-
- xscale = (double) dst_width / (double) src_width;
-
- /* Build y weights */
- /* pre-calculate filter contributions for a column */
- contribY = (CLIST *) calloc (dst_height, sizeof (CLIST));
- if (contribY == NULL)
- {
- free (tmp);
- return;
- }
-
- yscale = (double) dst_height / (double) src_height;
-
- if (yscale < 1.0)
- {
- width = fwidth / yscale;
- fscale = 1.0 / yscale;
- for (i = 0; i < dst_height; ++i)
- {
- contribY[i].n = 0;
- contribY[i].p = (CONTRIB *) calloc ((int) (width * 2 + 1),
- sizeof (CONTRIB));
- if (contribY[i].p == NULL)
- {
- free (tmp);
- free (contribY);
- return;
- }
- center = (double) i / yscale;
- left = ceil (center - width);
- right = floor (center + width);
- for (j = (int) left; j <= right; ++j)
- {
- weight = center - (double) j;
- weight = (*filterf) (weight / fscale) / fscale;
- if (j < 0)
- {
- n = -j;
- }
- else if (j >= src_height)
- {
- n = (src_height - j) + src_height - 1;
- }
- else
- {
- n = j;
- }
- k = contribY[i].n++;
- contribY[i].p[k].pixel = n;
- contribY[i].p[k].weight = weight;
- }
- }
- }
- else
- {
- for (i = 0; i < dst_height; ++i)
- {
- contribY[i].n = 0;
- contribY[i].p = (CONTRIB *) calloc ((int) (fwidth * 2 + 1),
- sizeof (CONTRIB));
- if (contribY[i].p == NULL)
- {
- free (tmp);
- free (contribY);
- return;
- }
- center = (double) i / yscale;
- left = ceil (center - fwidth);
- right = floor (center + fwidth);
- for (j = (int) left; j <= right; ++j)
- {
- weight = center - (double) j;
- weight = (*filterf) (weight);
- if (j < 0)
- {
- n = -j;
- }
- else if (j >= src_height)
- {
- n = (src_height - j) + src_height - 1;
- }
- else
- {
- n = j;
- }
- k = contribY[i].n++;
- contribY[i].p[k].pixel = n;
- contribY[i].p[k].weight = weight;
- }
- }
- }
-
- for (xx = 0; xx < dst_width; xx++)
- {
- if (0 != calc_x_contrib (&contribX, xscale, fwidth,
- dst_width, src_width, filterf, xx))
- {
- goto __zoom_cleanup;
- }
- /* Apply horz filter to make dst column in tmp. */
- for (k = 0; k < src_height; ++k)
- {
- weight = 0.0;
- bPelDelta = FALSE;
- /*pel = get_pixel(src, contribX.p[0].pixel, k); */
- pel = ((Pixel *) src)[(contribX.p[0].pixel + k * src_width)];
- for (j = 0; j < contribX.n; ++j)
- {
- /* pel2 = get_pixel(src, contribX.p[j].pixel, k); */
- pel2 = ((Pixel *) src)[(contribX.p[j].pixel + k * src_width)];
- if (pel2 != pel)
- bPelDelta = TRUE;
- weight += pel2 * contribX.p[j].weight;
- }
- weight = bPelDelta ? roundcloser (weight) : pel;
-
- tmp[k] = (Pixel) CLAMP (weight, BLACK_PIXEL, WHITE_PIXEL);
- } /* next row in temp column */
-
- free (contribX.p);
-
- /* The temp column has been built. Now stretch it
- vertically into dst column. */
- for (i = 0; i < dst_height; ++i)
- {
- weight = 0.0;
- bPelDelta = FALSE;
- pel = tmp[contribY[i].p[0].pixel];
-
- for (j = 0; j < contribY[i].n; ++j)
- {
- pel2 = tmp[contribY[i].p[j].pixel];
- if (pel2 != pel)
- bPelDelta = TRUE;
- weight += pel2 * contribY[i].p[j].weight;
- }
- weight = bPelDelta ? roundcloser (weight) : pel;
- ((Pixel *) dst)[(xx + i * dst_width)] =
- (Pixel) CLAMP (weight, BLACK_PIXEL, WHITE_PIXEL);
- } /* next dst row */
- } /* next dst column */
-
-__zoom_cleanup:
- free (tmp);
-
- /* free the memory allocated for vertical filter weights */
- for (i = 0; i < dst_height; ++i)
- free (contribY[i].p);
- free (contribY);
-
-} /* zoom */
diff --git a/hasciicam/yuv2rgb.c b/hasciicam/yuv2rgb.c
deleted file mode 100644
index b904bf6..0000000
--- a/hasciicam/yuv2rgb.c
+++ /dev/null
@@ -1,422 +0,0 @@
-/*
- * yuv2rgb.c
- * Copyright (C) 1999-2001 Aaron Holtzman <aholtzma@ess.engr.uvic.ca>
- *
- * This file is part of mpeg2dec, a free MPEG-2 video stream decoder.
- *
- * mpeg2dec is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * mpeg2dec 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <inttypes.h>
-
-#include <yuv2rgb.h>
-#include <mm_accel.h>
-
-#include <config.h>
-
-#define ARCH_X86 1
-
-yuv2rgb_fun yuv2rgb_init_mmxext (int bpp, int mode);
-yuv2rgb_fun yuv2rgb_init_mmx (int bpp, int mode);
-
-uint32_t matrix_coefficients = 6;
-
-const int32_t Inverse_Table_6_9[8][4] = {
- {117504, 138453, 13954, 34903}, /* no sequence_display_extension */
- {117504, 138453, 13954, 34903}, /* ITU-R Rec. 709 (1990) */
- {104597, 132201, 25675, 53279}, /* unspecified */
- {104597, 132201, 25675, 53279}, /* reserved */
- {104448, 132798, 24759, 53109}, /* FCC */
- {104597, 132201, 25675, 53279}, /* ITU-R Rec. 624-4 System B, G */
- {104597, 132201, 25675, 53279}, /* SMPTE 170M */
- {117579, 136230, 16907, 35559} /* SMPTE 240M (1987) */
-};
-
-static yuv2rgb_fun yuv2rgb;
-static uint32_t vo_mm_accel;
-
-static void yuv2rgb_c_init (int bpp, int mode);
-
-
-
-static void (* yuv2rgb_c_internal) (uint8_t *, uint8_t *,
- uint8_t *, uint8_t *,
- void *, void *, int);
-
-static void yuv2rgb_c (void * dst, uint8_t * py,
- uint8_t * pu, uint8_t * pv,
- int width, int height,
- int rgb_stride, int y_stride, int uv_stride)
-{
- height >>= 1;
- do {
- yuv2rgb_c_internal (py, py + y_stride, pu, pv,
- dst, ((uint8_t *)dst) + rgb_stride, width);
-
- py += 2 * y_stride;
- pu += uv_stride;
- pv += uv_stride;
- dst = ((uint8_t *)dst) + 2 * rgb_stride;
- } while (--height);
-}
-
-yuv2rgb_fun *yuv2rgb_init (int bpp, int mode)
-{
-
- /* detect cpu acceleration */
- vo_mm_accel = mm_accel();
-
- yuv2rgb = NULL;
-#ifdef ARCH_X86
- if ((yuv2rgb == NULL) && (vo_mm_accel & MM_ACCEL_X86_MMXEXT)) {
- yuv2rgb = yuv2rgb_init_mmxext (bpp, mode);
- if (yuv2rgb != NULL)
- fprintf(stderr,"Using MMXEXT for colorspace transform\n");
- }
- if ((yuv2rgb == NULL) && (vo_mm_accel & MM_ACCEL_X86_MMX)) {
- yuv2rgb = yuv2rgb_init_mmx (bpp, mode);
- if (yuv2rgb != NULL)
- fprintf(stderr,"Using MMX for colorspace transform\n");
- }
-#endif
-
- if (yuv2rgb == NULL) {
- fprintf(stderr,"Using ANSI C for colorspace transform\n");
- yuv2rgb_c_init (bpp, mode);
- yuv2rgb = (yuv2rgb_fun) yuv2rgb_c;
- }
- return &yuv2rgb;
-}
-
-void * table_rV[256];
-void * table_gU[256];
-int table_gV[256];
-void * table_bU[256];
-
-#define RGB(i) \
- U = pu[i]; \
- V = pv[i]; \
- r = table_rV[V]; \
- g = (void *) (((uint8_t *)table_gU[U]) + table_gV[V]); \
- b = table_bU[U];
-
-#define DST1(i) \
- Y = py_1[2*i]; \
- dst_1[2*i] = r[Y] + g[Y] + b[Y]; \
- Y = py_1[2*i+1]; \
- dst_1[2*i+1] = r[Y] + g[Y] + b[Y];
-
-#define DST2(i) \
- Y = py_2[2*i]; \
- dst_2[2*i] = r[Y] + g[Y] + b[Y]; \
- Y = py_2[2*i+1]; \
- dst_2[2*i+1] = r[Y] + g[Y] + b[Y];
-
-#define DST1RGB(i) \
- Y = py_1[2*i]; \
- dst_1[6*i] = r[Y]; dst_1[6*i+1] = g[Y]; dst_1[6*i+2] = b[Y]; \
- Y = py_1[2*i+1]; \
- dst_1[6*i+3] = r[Y]; dst_1[6*i+4] = g[Y]; dst_1[6*i+5] = b[Y];
-
-#define DST2RGB(i) \
- Y = py_2[2*i]; \
- dst_2[6*i] = r[Y]; dst_2[6*i+1] = g[Y]; dst_2[6*i+2] = b[Y]; \
- Y = py_2[2*i+1]; \
- dst_2[6*i+3] = r[Y]; dst_2[6*i+4] = g[Y]; dst_2[6*i+5] = b[Y];
-
-#define DST1BGR(i) \
- Y = py_1[2*i]; \
- dst_1[6*i] = b[Y]; dst_1[6*i+1] = g[Y]; dst_1[6*i+2] = r[Y]; \
- Y = py_1[2*i+1]; \
- dst_1[6*i+3] = b[Y]; dst_1[6*i+4] = g[Y]; dst_1[6*i+5] = r[Y];
-
-#define DST2BGR(i) \
- Y = py_2[2*i]; \
- dst_2[6*i] = b[Y]; dst_2[6*i+1] = g[Y]; dst_2[6*i+2] = r[Y]; \
- Y = py_2[2*i+1]; \
- dst_2[6*i+3] = b[Y]; dst_2[6*i+4] = g[Y]; dst_2[6*i+5] = r[Y];
-
-static void yuv2rgb_c_32 (uint8_t * py_1, uint8_t * py_2,
- uint8_t * pu, uint8_t * pv,
- void * _dst_1, void * _dst_2, int width)
-{
- int U, V, Y;
- uint32_t * r, * g, * b;
- uint32_t * dst_1, * dst_2;
-
- width >>= 3;
- dst_1 = _dst_1;
- dst_2 = _dst_2;
-
- do {
- RGB(0);
- DST1(0);
- DST2(0);
-
- RGB(1);
- DST2(1);
- DST1(1);
-
- RGB(2);
- DST1(2);
- DST2(2);
-
- RGB(3);
- DST2(3);
- DST1(3);
-
- pu += 4;
- pv += 4;
- py_1 += 8;
- py_2 += 8;
- dst_1 += 8;
- dst_2 += 8;
- } while (--width);
-}
-
-/* This is very near from the yuv2rgb_c_32 code */
-static void yuv2rgb_c_24_rgb (uint8_t * py_1, uint8_t * py_2,
- uint8_t * pu, uint8_t * pv,
- void * _dst_1, void * _dst_2, int width)
-{
- int U, V, Y;
- uint8_t * r, * g, * b;
- uint8_t * dst_1, * dst_2;
-
- width >>= 3;
- dst_1 = _dst_1;
- dst_2 = _dst_2;
-
- do {
- RGB(0);
- DST1RGB(0);
- DST2RGB(0);
-
- RGB(1);
- DST2RGB(1);
- DST1RGB(1);
-
- RGB(2);
- DST1RGB(2);
- DST2RGB(2);
-
- RGB(3);
- DST2RGB(3);
- DST1RGB(3);
-
- pu += 4;
- pv += 4;
- py_1 += 8;
- py_2 += 8;
- dst_1 += 24;
- dst_2 += 24;
- } while (--width);
-}
-
-/* only trivial mods from yuv2rgb_c_24_rgb */
-static void yuv2rgb_c_24_bgr (uint8_t * py_1, uint8_t * py_2,
- uint8_t * pu, uint8_t * pv,
- void * _dst_1, void * _dst_2, int width)
-{
- int U, V, Y;
- uint8_t * r, * g, * b;
- uint8_t * dst_1, * dst_2;
-
- width >>= 3;
- dst_1 = _dst_1;
- dst_2 = _dst_2;
-
- do {
- RGB(0);
- DST1BGR(0);
- DST2BGR(0);
-
- RGB(1);
- DST2BGR(1);
- DST1BGR(1);
-
- RGB(2);
- DST1BGR(2);
- DST2BGR(2);
-
- RGB(3);
- DST2BGR(3);
- DST1BGR(3);
-
- pu += 4;
- pv += 4;
- py_1 += 8;
- py_2 += 8;
- dst_1 += 24;
- dst_2 += 24;
- } while (--width);
-}
-
-/* This is exactly the same code as yuv2rgb_c_32 except for the types of */
-/* r, g, b, dst_1, dst_2 */
-static void yuv2rgb_c_16 (uint8_t * py_1, uint8_t * py_2,
- uint8_t * pu, uint8_t * pv,
- void * _dst_1, void * _dst_2, int width)
-{
- int U, V, Y;
- uint16_t * r, * g, * b;
- uint16_t * dst_1, * dst_2;
-
- width >>= 3;
- dst_1 = _dst_1;
- dst_2 = _dst_2;
-
- do {
- RGB(0);
- DST1(0);
- DST2(0);
-
- RGB(1);
- DST2(1);
- DST1(1);
-
- RGB(2);
- DST1(2);
- DST2(2);
-
- RGB(3);
- DST2(3);
- DST1(3);
-
- pu += 4;
- pv += 4;
- py_1 += 8;
- py_2 += 8;
- dst_1 += 8;
- dst_2 += 8;
- } while (--width);
-}
-
-static int div_round (int dividend, int divisor)
-{
- if (dividend > 0)
- return (dividend + (divisor>>1)) / divisor;
- else
- return -((-dividend + (divisor>>1)) / divisor);
-}
-
-static void yuv2rgb_c_init (int bpp, int mode)
-{
- int i;
- uint8_t table_Y[1024];
- uint32_t * table_32 = 0;
- uint16_t * table_16 = 0;
- uint8_t * table_8 = 0;
- int entry_size = 0;
- void *table_r = 0, *table_g = 0, *table_b = 0;
-
- int crv = Inverse_Table_6_9[matrix_coefficients][0];
- int cbu = Inverse_Table_6_9[matrix_coefficients][1];
- int cgu = -Inverse_Table_6_9[matrix_coefficients][2];
- int cgv = -Inverse_Table_6_9[matrix_coefficients][3];
-
- for (i = 0; i < 1024; i++) {
- int j;
-
- j = (76309 * (i - 384 - 16) + 32768) >> 16;
- j = (j < 0) ? 0 : ((j > 255) ? 255 : j);
- table_Y[i] = j;
- }
-
- switch (bpp) {
- case 32:
- yuv2rgb_c_internal = yuv2rgb_c_32;
-
- table_32 = malloc ((197 + 2*682 + 256 + 132) * sizeof (uint32_t));
-
- entry_size = sizeof (uint32_t);
- table_r = table_32 + 197;
- table_b = table_32 + 197 + 685;
- table_g = table_32 + 197 + 2*682;
-
- for (i = -197; i < 256+197; i++)
- ((uint32_t *) table_r)[i] =
- table_Y[i+384] << ((mode==MODE_RGB) ? 16 : 0);
- for (i = -132; i < 256+132; i++)
- ((uint32_t *) table_g)[i] = table_Y[i+384] << 8;
- for (i = -232; i < 256+232; i++)
- ((uint32_t *) table_b)[i] =
- table_Y[i+384] << ((mode==MODE_RGB) ? 0 : 16);
- break;
-
- case 24:
- yuv2rgb_c_internal = (mode==MODE_RGB) ? yuv2rgb_c_24_rgb : yuv2rgb_c_24_bgr;
-
- table_8 = malloc ((256 + 2*232) * sizeof (uint8_t));
-
- entry_size = sizeof (uint8_t);
- table_r = table_g = table_b = table_8 + 232;
-
- for (i = -232; i < 256+232; i++)
- ((uint8_t * )table_b)[i] = table_Y[i+384];
- break;
-
- case 15:
- case 16:
- yuv2rgb_c_internal = yuv2rgb_c_16;
-
- table_16 = malloc ((197 + 2*682 + 256 + 132) * sizeof (uint16_t));
-
- entry_size = sizeof (uint16_t);
- table_r = table_16 + 197;
- table_b = table_16 + 197 + 685;
- table_g = table_16 + 197 + 2*682;
-
- for (i = -197; i < 256+197; i++) {
- int j = table_Y[i+384] >> 3;
-
- if (mode == MODE_RGB)
- j <<= ((bpp==16) ? 11 : 10);
-
- ((uint16_t *)table_r)[i] = j;
- }
- for (i = -132; i < 256+132; i++) {
- int j = table_Y[i+384] >> ((bpp==16) ? 2 : 3);
-
- ((uint16_t *)table_g)[i] = j << 5;
- }
- for (i = -232; i < 256+232; i++) {
- int j = table_Y[i+384] >> 3;
-
- if (mode == MODE_BGR)
- j <<= ((bpp==16) ? 11 : 10);
-
- ((uint16_t *)table_b)[i] = j;
- }
- break;
-
- default:
- fprintf (stderr, "%ibpp not supported by yuv2rgb\n", bpp);
- exit (1);
- }
-
- for (i = 0; i < 256; i++) {
- table_rV[i] = (((uint8_t *)table_r) +
- entry_size * div_round (crv * (i-128), 76309));
- table_gU[i] = (((uint8_t *)table_g) +
- entry_size * div_round (cgu * (i-128), 76309));
- table_gV[i] = entry_size * div_round (cgv * (i-128), 76309);
- table_bU[i] = (((uint8_t *)table_b) +
- entry_size * div_round (cbu * (i-128), 76309));
- }
-}
diff --git a/hasciicam/yuv2rgb.h b/hasciicam/yuv2rgb.h
deleted file mode 100644
index b175b7d..0000000
--- a/hasciicam/yuv2rgb.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * yuv2rgb.h
- * Copyright (C) 1999-2001 Aaron Holtzman <aholtzma@ess.engr.uvic.ca>
- *
- * This file is part of mpeg2dec, a free MPEG-2 video stream decoder.
- *
- * mpeg2dec is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * mpeg2dec 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#include <stdint.h>
-
-#define MODE_RGB 0x1
-#define MODE_BGR 0x2
-
-typedef void (* yuv2rgb_fun) (uint8_t * image, uint8_t * py,
- uint8_t * pu, uint8_t * pv,
- int h_size, int v_size,
- int rgb_stride, int y_stride, int uv_stride);
-
-yuv2rgb_fun *yuv2rgb_init (int bpp, int mode);
diff --git a/hasciicam/yuv2rgb_mmx.c b/hasciicam/yuv2rgb_mmx.c
deleted file mode 100644
index 48998a5..0000000
--- a/hasciicam/yuv2rgb_mmx.c
+++ /dev/null
@@ -1,328 +0,0 @@
-/*
- * yuv2rgb_mmx.c
- * Copyright (C) 2000-2001 Silicon Integrated System Corp.
- * All Rights Reserved.
- *
- * Author: Olie Lho <ollie@sis.com.tw>
- *
- * This file is part of mpeg2dec, a free MPEG-2 video stream decoder.
- *
- * mpeg2dec is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * mpeg2dec 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#include <config.h>
-
-#define ARCH_X86 1
-
-/* use gcc attribs to align critical data structures */
-#ifdef ATTRIBUTE_ALIGNED_MAX
-#define ATTR_ALIGN(align) __attribute__ ((__aligned__ ((ATTRIBUTE_ALIGNED_MAX < align) ? ATTRIBUTE_ALIGNED_MAX : align)))
-#else
-#define ATTR_ALIGN(align)
-#endif
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <inttypes.h>
-#include <yuv2rgb.h>
-
-#include "mmx.h"
-
-
-#define CPU_MMXEXT 0
-#define CPU_MMX 1
-
-/* CPU_MMXEXT/CPU_MMX adaptation layer */
-
-#define movntq(src,dest) \
-do { \
- if (cpu == CPU_MMXEXT) \
- movntq_r2m (src, dest); \
- else \
- movq_r2m (src, dest); \
-} while (0)
-
-static inline void mmx_yuv2rgb (uint8_t * py, uint8_t * pu, uint8_t * pv)
-{
- static mmx_t mmx_80w = {0x0080008000800080};
- static mmx_t mmx_U_green = {0xf37df37df37df37d};
- static mmx_t mmx_U_blue = {0x4093409340934093};
- static mmx_t mmx_V_red = {0x3312331233123312};
- static mmx_t mmx_V_green = {0xe5fce5fce5fce5fc};
- static mmx_t mmx_10w = {0x1010101010101010};
- static mmx_t mmx_00ffw = {0x00ff00ff00ff00ff};
- static mmx_t mmx_Y_coeff = {0x253f253f253f253f};
-
- movd_m2r (*pu, mm0); // mm0 = 00 00 00 00 u3 u2 u1 u0
- movd_m2r (*pv, mm1); // mm1 = 00 00 00 00 v3 v2 v1 v0
- movq_m2r (*py, mm6); // mm6 = Y7 Y6 Y5 Y4 Y3 Y2 Y1 Y0
- pxor_r2r (mm4, mm4); // mm4 = 0
- /* XXX might do cache preload for image here */
-
- /*
- * Do the multiply part of the conversion for even and odd pixels
- * register usage:
- * mm0 -> Cblue, mm1 -> Cred, mm2 -> Cgreen even pixels
- * mm3 -> Cblue, mm4 -> Cred, mm5 -> Cgreen odd pixels
- * mm6 -> Y even, mm7 -> Y odd
- */
-
- punpcklbw_r2r (mm4, mm0); // mm0 = u3 u2 u1 u0
- punpcklbw_r2r (mm4, mm1); // mm1 = v3 v2 v1 v0
- psubsw_m2r (mmx_80w, mm0); // u -= 128
- psubsw_m2r (mmx_80w, mm1); // v -= 128
- psllw_i2r (3, mm0); // promote precision
- psllw_i2r (3, mm1); // promote precision
- movq_r2r (mm0, mm2); // mm2 = u3 u2 u1 u0
- movq_r2r (mm1, mm3); // mm3 = v3 v2 v1 v0
- pmulhw_m2r (mmx_U_green, mm2); // mm2 = u * u_green
- pmulhw_m2r (mmx_V_green, mm3); // mm3 = v * v_green
- pmulhw_m2r (mmx_U_blue, mm0); // mm0 = chroma_b
- pmulhw_m2r (mmx_V_red, mm1); // mm1 = chroma_r
- paddsw_r2r (mm3, mm2); // mm2 = chroma_g
-
- psubusb_m2r (mmx_10w, mm6); // Y -= 16
- movq_r2r (mm6, mm7); // mm7 = Y7 Y6 Y5 Y4 Y3 Y2 Y1 Y0
- pand_m2r (mmx_00ffw, mm6); // mm6 = Y6 Y4 Y2 Y0
- psrlw_i2r (8, mm7); // mm7 = Y7 Y5 Y3 Y1
- psllw_i2r (3, mm6); // promote precision
- psllw_i2r (3, mm7); // promote precision
- pmulhw_m2r (mmx_Y_coeff, mm6); // mm6 = luma_rgb even
- pmulhw_m2r (mmx_Y_coeff, mm7); // mm7 = luma_rgb odd
-
- /*
- * Do the addition part of the conversion for even and odd pixels
- * register usage:
- * mm0 -> Cblue, mm1 -> Cred, mm2 -> Cgreen even pixels
- * mm3 -> Cblue, mm4 -> Cred, mm5 -> Cgreen odd pixels
- * mm6 -> Y even, mm7 -> Y odd
- */
-
- movq_r2r (mm0, mm3); // mm3 = chroma_b
- movq_r2r (mm1, mm4); // mm4 = chroma_r
- movq_r2r (mm2, mm5); // mm5 = chroma_g
- paddsw_r2r (mm6, mm0); // mm0 = B6 B4 B2 B0
- paddsw_r2r (mm7, mm3); // mm3 = B7 B5 B3 B1
- paddsw_r2r (mm6, mm1); // mm1 = R6 R4 R2 R0
- paddsw_r2r (mm7, mm4); // mm4 = R7 R5 R3 R1
- paddsw_r2r (mm6, mm2); // mm2 = G6 G4 G2 G0
- paddsw_r2r (mm7, mm5); // mm5 = G7 G5 G3 G1
- packuswb_r2r (mm0, mm0); // saturate to 0-255
- packuswb_r2r (mm1, mm1); // saturate to 0-255
- packuswb_r2r (mm2, mm2); // saturate to 0-255
- packuswb_r2r (mm3, mm3); // saturate to 0-255
- packuswb_r2r (mm4, mm4); // saturate to 0-255
- packuswb_r2r (mm5, mm5); // saturate to 0-255
- punpcklbw_r2r (mm3, mm0); // mm0 = B7 B6 B5 B4 B3 B2 B1 B0
- punpcklbw_r2r (mm4, mm1); // mm1 = R7 R6 R5 R4 R3 R2 R1 R0
- punpcklbw_r2r (mm5, mm2); // mm2 = G7 G6 G5 G4 G3 G2 G1 G0
- emms();
-}
-
-static inline void mmx_unpack_16rgb (uint8_t * image, int cpu)
-{
- static mmx_t mmx_bluemask = {0xf8f8f8f8f8f8f8f8};
- static mmx_t mmx_greenmask = {0xfcfcfcfcfcfcfcfc};
- static mmx_t mmx_redmask = {0xf8f8f8f8f8f8f8f8};
-
- /*
- * convert RGB plane to RGB 16 bits
- * mm0 -> B, mm1 -> R, mm2 -> G
- * mm4 -> GB, mm5 -> AR pixel 4-7
- * mm6 -> GB, mm7 -> AR pixel 0-3
- */
-
- pand_m2r (mmx_bluemask, mm0); // mm0 = b7b6b5b4b3______
- pand_m2r (mmx_greenmask, mm2); // mm2 = g7g6g5g4g3g2____
- pand_m2r (mmx_redmask, mm1); // mm1 = r7r6r5r4r3______
- psrlq_i2r (3, mm0); // mm0 = ______b7b6b5b4b3
- pxor_r2r (mm4, mm4); // mm4 = 0
- movq_r2r (mm0, mm5); // mm5 = ______b7b6b5b4b3
- movq_r2r (mm2, mm7); // mm7 = g7g6g5g4g3g2____
-
- punpcklbw_r2r (mm4, mm2);
- punpcklbw_r2r (mm1, mm0);
- psllq_i2r (3, mm2);
- por_r2r (mm2, mm0);
- movntq (mm0, *image);
-
- punpckhbw_r2r (mm4, mm7);
- punpckhbw_r2r (mm1, mm5);
- psllq_i2r (3, mm7);
- por_r2r (mm7, mm5);
- movntq (mm5, *(image+8));
- emms();
-}
-
-static inline void mmx_unpack_32rgb (uint8_t * image, int cpu)
-{
- /*
- * convert RGB plane to RGB packed format,
- * mm0 -> B, mm1 -> R, mm2 -> G, mm3 -> 0,
- * mm4 -> GB, mm5 -> AR pixel 4-7,
- * mm6 -> GB, mm7 -> AR pixel 0-3
- */
-
- pxor_r2r (mm3, mm3);
- movq_r2r (mm0, mm6);
- movq_r2r (mm1, mm7);
- movq_r2r (mm0, mm4);
- movq_r2r (mm1, mm5);
- punpcklbw_r2r (mm2, mm6);
- punpcklbw_r2r (mm3, mm7);
- punpcklwd_r2r (mm7, mm6);
- movntq (mm6, *image);
- movq_r2r (mm0, mm6);
- punpcklbw_r2r (mm2, mm6);
- punpckhwd_r2r (mm7, mm6);
- movntq (mm6, *(image+8));
- punpckhbw_r2r (mm2, mm4);
- punpckhbw_r2r (mm3, mm5);
- punpcklwd_r2r (mm5, mm4);
- movntq (mm4, *(image+16));
- movq_r2r (mm0, mm4);
- punpckhbw_r2r (mm2, mm4);
- punpckhwd_r2r (mm5, mm4);
- movntq (mm4, *(image+24));
- emms();
-}
-
-static inline void yuv420_rgb16 (uint8_t * image,
- uint8_t * py, uint8_t * pu, uint8_t * pv,
- int width, int height,
- int rgb_stride, int y_stride, int uv_stride,
- int cpu)
-{
- int i;
-
- rgb_stride -= 2 * width;
- y_stride -= width;
- uv_stride -= width >> 1;
- width >>= 3;
-
- do {
- i = width;
- do {
- mmx_yuv2rgb (py, pu, pv);
- mmx_unpack_16rgb (image, cpu);
- py += 8;
- pu += 4;
- pv += 4;
- image += 16;
- } while (--i);
-
- py += y_stride;
- image += rgb_stride;
- if (height & 1) {
- pu += uv_stride;
- pv += uv_stride;
- } else {
- pu -= 4 * width;
- pv -= 4 * width;
- }
- } while (--height);
-}
-
-static inline void yuv420_argb32 (uint8_t * image, uint8_t * py,
- uint8_t * pu, uint8_t * pv,
- int width, int height,
- int rgb_stride, int y_stride, int uv_stride,
- int cpu)
-{
- int i;
-
- rgb_stride -= 4 * width;
- y_stride -= width;
- uv_stride -= width >> 1;
- width >>= 3;
-
- do {
- i = width;
- do {
- mmx_yuv2rgb (py, pu, pv);
- mmx_unpack_32rgb (image, cpu);
- py += 8;
- pu += 4;
- pv += 4;
- image += 32;
- } while (--i);
-
- py += y_stride;
- image += rgb_stride;
- if (height & 1) {
- pu += uv_stride;
- pv += uv_stride;
- } else {
- pu -= 4 * width;
- pv -= 4 * width;
- }
- } while (--height);
-}
-
-static void mmxext_rgb16 (uint8_t * image,
- uint8_t * py, uint8_t * pu, uint8_t * pv,
- int width, int height,
- int rgb_stride, int y_stride, int uv_stride)
-{
- yuv420_rgb16 (image, py, pu, pv, width, height,
- rgb_stride, y_stride, uv_stride, CPU_MMXEXT);
-}
-
-static void mmxext_argb32 (uint8_t * image,
- uint8_t * py, uint8_t * pu, uint8_t * pv,
- int width, int height,
- int rgb_stride, int y_stride, int uv_stride)
-{
- yuv420_argb32 (image, py, pu, pv, width, height,
- rgb_stride, y_stride, uv_stride, CPU_MMXEXT);
-}
-
-static void mmx_rgb16 (uint8_t * image,
- uint8_t * py, uint8_t * pu, uint8_t * pv,
- int width, int height,
- int rgb_stride, int y_stride, int uv_stride)
-{
- yuv420_rgb16 (image, py, pu, pv, width, height,
- rgb_stride, y_stride, uv_stride, CPU_MMX);
-}
-
-static void mmx_argb32 (uint8_t * image,
- uint8_t * py, uint8_t * pu, uint8_t * pv,
- int width, int height,
- int rgb_stride, int y_stride, int uv_stride)
-{
- yuv420_argb32 (image, py, pu, pv, width, height,
- rgb_stride, y_stride, uv_stride, CPU_MMX);
-}
-
-yuv2rgb_fun yuv2rgb_init_mmxext (int bpp, int mode)
-{
- if ((bpp == 16) && (mode == MODE_RGB))
- return mmxext_rgb16;
- else if ((bpp == 32) && (mode == MODE_RGB))
- return mmxext_argb32;
-
- return NULL; /* Fallback to C */
-}
-
-yuv2rgb_fun yuv2rgb_init_mmx (int bpp, int mode)
-{
- if ((bpp == 16) && (mode == MODE_RGB))
- return mmx_rgb16;
- else if ((bpp == 32) && (mode == MODE_RGB))
- return mmx_argb32;
-
- return NULL; /* Fallback to C */
-}