Commit f0051deb authored by Wim Taymans's avatar Wim Taymans
Browse files

Removed old unused libs.

Original commit message from CVS:
Removed old unused libs.
parent bb55e797
if HAVE_CPU_I386
GSTARCH_SUBDS = winloader
else
GSTARCH_SUBDS =
endif
SUBDIRS = riff colorspace getbits putbits idct videoscale audio $(GSTARCH_SUBDS)
SUBDIRS = riff getbits putbits idct audio
DIST_SUBDIRS = riff colorspace getbits putbits videoscale winloader audio idct
DIST_SUBDIRS = riff getbits putbits audio idct
Makefile
Makefile.in
*.o
*.lo
*.la
.deps
.libs
filterdir = $(libdir)/gst
filter_LTLIBRARIES = libgstcolorspace.la
if HAVE_CPU_I386
ARCHSRCS = yuv2rgb_mmx16.s
else
ARCHSRCS =
endif
libgstcolorspace_la_SOURCES = gstcolorspace.c rgb2rgb.c yuv2rgb.c $(ARCHSRCS)
libgstcolorspaceincludedir = $(includedir)/gst/libs/gstcolorspace
libgstcolorspaceinclude_HEADERS = gstcolorspace.h
noinst_HEADERS = yuv2rgb.h
# FIXME is this needed?
CFLAGS += -O2 $(FOMIT_FRAME_POINTER) -finline-functions -ffast-math
/* Gnome-Streamer
* 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.
*/
//#define DEBUG_ENABLED
#include <gst/gst.h>
#include <gstcolorspace.h>
extern GstColorSpaceConvertFunction gst_colorspace_rgb2rgb_get_converter(GstColorSpaceConverter *space, GstColorSpaceType srcspace,
GstColorSpaceType destspace);
extern GstColorSpaceConvertFunction gst_colorspace_yuv2rgb_get_converter(GstColorSpaceConverter *space, GstColorSpaceType srcspace,
GstColorSpaceType destspace);
extern GstColorSpaceConvertFunction gst_colorspace_rgb2yuv_get_converter(GstColorSpaceConverter *space, GstColorSpaceType srcspace,
GstColorSpaceType destspace);
extern GstColorSpaceConvertFunction gst_colorspace_yuv2yuv_get_converter(GstColorSpaceConverter *space, GstColorSpaceType srcspace,
GstColorSpaceType destspace);
GstColorSpaceConverter *gst_colorspace_converter_new(gint width, gint height, GstColorSpaceType srcspace,
GstColorSpaceType destspace, GdkVisual *destvisual)
{
GstColorSpaceConverter *new = g_malloc(sizeof(GstColorSpaceConverter));
new->width = width;
new->height = height;
new->srcspace = srcspace;
new->destspace = destspace;
new->visual = destvisual;
new->color_tables = NULL;
new->convert = NULL;
GST_DEBUG (0,"gst_colorspace: new\n");
if (GST_COLORSPACE_IS_RGB_TYPE(srcspace)) {
if (GST_COLORSPACE_IS_RGB_TYPE(destspace)) {
new->convert = gst_colorspace_rgb2rgb_get_converter(new, srcspace, destspace);
}
else {
//return gst_colorspace_rgb2yuv_get_converter(srcspace, destspace);
}
}
else if (GST_COLORSPACE_IS_YUV_TYPE(srcspace)) {
if (GST_COLORSPACE_IS_RGB_TYPE(destspace)) {
new->convert = gst_colorspace_yuv2rgb_get_converter(new, srcspace, destspace);
}
else {
//return gst_colorspace_yuv2yuv_get_converter(srcspace, destspace);
}
}
if (new->convert == NULL) {
g_print("gst_colorspace: conversion not implemented\n");
g_free(new);
new = NULL;
}
return new;
}
void gst_colorspace_destroy(GstColorSpaceConverter *space)
{
if (space->color_tables) g_free(space->color_tables);
g_free(space);
}
/* Gnome-Streamer
* 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.
*/
#ifndef __GST_COLORSPACE_H__
#define __GST_COLORSPACE_H__
#include <gdk/gdk.h>
#include <gst/gst.h>
#include "yuv2rgb.h"
typedef enum {
GST_COLORSPACE_RGB555,
GST_COLORSPACE_BGR555,
GST_COLORSPACE_RGB565,
GST_COLORSPACE_BGR565,
GST_COLORSPACE_RGB24,
GST_COLORSPACE_BGR24,
GST_COLORSPACE_RGB32,
GST_COLORSPACE_BGR32,
GST_COLORSPACE_YUV420,
GST_COLORSPACE_YUV420P,
GST_COLORSPACE_YUV422,
GST_COLORSPACE_YUV422P
} GstColorSpaceType;
#define GST_COLORSPACE_RGB_FIRST GST_COLORSPACE_RGB555
#define GST_COLORSPACE_RGB_LAST GST_COLORSPACE_BGR32
#define GST_COLORSPACE_YUV_FIRST GST_COLORSPACE_YUV420
#define GST_COLORSPACE_YUV_LAST GST_COLORSPACE_YUV422P
typedef struct _GstColorSpaceConverter GstColorSpaceConverter;
typedef void (*GstColorSpaceConvertFunction) (GstColorSpaceConverter *space, guchar *src, guchar *dest);
struct _GstColorSpaceConverter {
guint width;
guint height;
GstColorSpaceType srcspace;
GstColorSpaceType destspace;
GdkVisual *visual;
guint insize;
guint outsize;
/* private */
GstColorSpaceYUVTables *color_tables;
GstColorSpaceConvertFunction convert;
};
#define GST_COLORSPACE_IS_RGB_TYPE(type) ((type)>=GST_COLORSPACE_RGB_FIRST && \
(type)<=GST_COLORSPACE_RGB_LAST)
#define GST_COLORSPACE_IS_YUV_TYPE(type) ((type)>=GST_COLORSPACE_YUV_FIRST && \
(type)<=GST_COLORSPACE_YUV_LAST)
GstColorSpaceConverter *gst_colorspace_converter_new(gint width, gint height, GstColorSpaceType srcspace,
GstColorSpaceType destspace, GdkVisual *destvisual);
#define gst_colorspace_convert(converter, src, dest) \
(converter)->convert((converter), (src), (dest))
void gst_colorspace_destroy(GstColorSpaceConverter *space);
#endif /* __GST_COLORSPACE_H__ */
/* Gnome-Streamer
* 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.
*/
#include <string.h>
//#define DEBUG_ENABLED
#include "gstcolorspace.h"
static void gst_colorspace_rgb_to_rgb_identity(GstColorSpaceConverter *space, unsigned char *src, unsigned char *dest);
static void gst_colorspace_rgb24_to_bgr24(GstColorSpaceConverter *space, unsigned char *src, unsigned char *dest);
static void gst_colorspace_rgb24_to_rgb32(GstColorSpaceConverter *space, unsigned char *src, unsigned char *dest);
static void gst_colorspace_rgb32_to_bgr32(GstColorSpaceConverter *space, unsigned char *src, unsigned char *dest);
static void gst_colorspace_rgb555_to_rgb565(GstColorSpaceConverter *space, unsigned char *src, unsigned char *dest);
static void gst_colorspace_bgr565_to_rgb32(GstColorSpaceConverter *space, unsigned char *src, unsigned char *dest);
static void gst_colorspace_bgr24_to_bgr565(GstColorSpaceConverter *space, unsigned char *src, unsigned char *dest);
static void gst_colorspace_bgr32_to_bgr565(GstColorSpaceConverter *space, unsigned char *src, unsigned char *dest);
GstColorSpaceConvertFunction gst_colorspace_rgb2rgb_get_converter(GstColorSpaceConverter *space, GstColorSpaceType src, GstColorSpaceType dest) {
switch(src) {
case GST_COLORSPACE_RGB24:
space->insize = space->width*space->height*3;
switch(dest) {
case GST_COLORSPACE_RGB24:
space->outsize = space->width*space->height*3;
return gst_colorspace_rgb_to_rgb_identity;
case GST_COLORSPACE_BGR24:
space->outsize = space->width*space->height*3;
return gst_colorspace_rgb24_to_bgr24;
case GST_COLORSPACE_RGB32:
space->outsize = space->width*space->height*4;
return gst_colorspace_rgb24_to_rgb32;
default:
break;
}
break;
case GST_COLORSPACE_BGR24:
space->insize = space->width*space->height*3;
switch(dest) {
case GST_COLORSPACE_RGB24:
space->outsize = space->width*space->height*3;
return gst_colorspace_rgb24_to_bgr24;
case GST_COLORSPACE_BGR24:
space->outsize = space->width*space->height*3;
return gst_colorspace_rgb_to_rgb_identity;
case GST_COLORSPACE_BGR565:
space->outsize = space->width*space->height*2;
return gst_colorspace_bgr24_to_bgr565;
default:
break;
}
break;
case GST_COLORSPACE_RGB32:
space->insize = space->width*space->height*4;
switch(dest) {
case GST_COLORSPACE_BGR32:
space->outsize = space->width*space->height*4;
return gst_colorspace_rgb32_to_bgr32;
case GST_COLORSPACE_RGB32:
space->outsize = space->width*space->height*4;
return gst_colorspace_rgb_to_rgb_identity;
default:
break;
}
break;
case GST_COLORSPACE_BGR32:
space->insize = space->width*space->height*4;
switch(dest) {
case GST_COLORSPACE_RGB32:
space->outsize = space->width*space->height*4;
return gst_colorspace_rgb32_to_bgr32;
case GST_COLORSPACE_BGR32:
space->outsize = space->width*space->height*4;
return gst_colorspace_rgb_to_rgb_identity;
case GST_COLORSPACE_BGR565:
space->outsize = space->width*space->height*2;
return gst_colorspace_bgr32_to_bgr565;
case GST_COLORSPACE_RGB565:
space->outsize = space->width*space->height*2;
return gst_colorspace_bgr32_to_bgr565;
default:
break;
}
break;
case GST_COLORSPACE_BGR555:
space->insize = space->width*space->height*2;
switch(dest) {
case GST_COLORSPACE_RGB555:
space->outsize = space->width*space->height*2;
return gst_colorspace_rgb32_to_bgr32;
case GST_COLORSPACE_BGR565:
space->outsize = space->width*space->height*2;
return gst_colorspace_rgb555_to_rgb565;
default:
break;
}
break;
case GST_COLORSPACE_BGR565:
space->insize = space->width*space->height*2;
switch(dest) {
case GST_COLORSPACE_RGB32 :
space->outsize = space->width*space->height*4;
return gst_colorspace_bgr565_to_rgb32;
default:
break;
};
break;
default:
break;
}
g_print("gst_colorspace: conversion not supported %d %d\n", src, dest);
return NULL;
}
static void gst_colorspace_rgb_to_rgb_identity(GstColorSpaceConverter *space, unsigned char *src, unsigned char *dest)
{
memcpy(dest, src, space->outsize);
}
static void gst_colorspace_rgb24_to_bgr24(GstColorSpaceConverter *space, unsigned char *src, unsigned char *dest)
{
gint size;
gchar temp;
GST_DEBUG (0,"gst_colorspace_rgb24_to_bgr24 %p %p %d %d %d\n", src, dest, space->outsize, space->width, space->height);
size = space->outsize/3;
if (src == dest) {
while (size--) {
temp = src[0];
src[0] = src[2];
src[2] = temp;
src+=3;
}
}
else {
while (size--) {
*dest++ = src[2];
*dest++ = src[1];
*dest++ = src[0];
src+=3;
}
}
GST_DEBUG (0,"gst_colorspace_rgb24_to_bgr24 end\n");
}
static void gst_colorspace_bgr24_to_bgr565(GstColorSpaceConverter *space, unsigned char *src, unsigned char *dest)
{
gint size;
guint16 *destptr = (guint16 *)dest;
GST_DEBUG (0,"gst_colorspace_bgr24_to_bgr565 %p %p %d %d %d\n", src, dest, space->outsize, space->width, space->height);
size = space->outsize/2;
while (size--) {
*destptr++ = ((src[2]&0xF8)<<8)|((src[1]&0xFC)<<3)|((src[0]&0xF8)>>3);
src+=3;
}
GST_DEBUG (0,"gst_colorspace_bgr24_to_bgr565 end\n");
}
static void gst_colorspace_bgr32_to_bgr565(GstColorSpaceConverter *space, unsigned char *src, unsigned char *dest)
{
gint size;
guint16 *destptr = (guint16 *)dest;
GST_DEBUG (0,"gst_colorspace_bgr32_to_bgr565 %p %p %d %d %d\n", src, dest, space->outsize, space->width, space->height);
size = space->outsize/2;
while (size--) {
*destptr++ = ((src[2]&0xF8)<<8)|((src[1]&0xFC)<<3)|((src[0]&0xF8)>>3);
src+=4;
}
GST_DEBUG (0,"gst_colorspace_bgr32_to_bgr565 end\n");
}
static void gst_colorspace_rgb24_to_rgb32(GstColorSpaceConverter *space, unsigned char *src, unsigned char *dest)
{
gint size;
guint32 *destptr = (guint32 *)dest;
GST_DEBUG (0,"gst_colorspace_rgb24_to_rgb32 %p %p %d\n", src, dest, space->outsize);
size = space->outsize/4;
while (size--) {
*destptr++ = (src[0]<<16)|(src[1]<<8)|src[2];
src+=3;
}
GST_DEBUG (0,"gst_colorspace_rgb24_to_rgb32 end\n");
}
static void gst_colorspace_rgb32_to_bgr32(GstColorSpaceConverter *space, unsigned char *src, unsigned char *dest)
{
gint size;
gchar temp;
GST_DEBUG (0,"gst_colorspace_rgb32_to_bgr32 %p %p %d\n", src, dest, space->outsize);
size = space->outsize/4;
if (src == dest) {
while (size--) {
temp = src[0];
src[0] = src[2];
src[2] = temp;
src+=4;
}
}
else {
while (size--) {
*dest++ = src[2];
*dest++ = src[1];
*dest++ = src[0];
dest++;
src+=4;
}
}
GST_DEBUG (0,"gst_colorspace_rgb32_to_bgr32 end\n");
}
static void gst_colorspace_rgb555_to_rgb565(GstColorSpaceConverter *space, unsigned char *src, unsigned char *dest)
{
gint size;
guint32 *srcptr = (guint32 *) src;
guint32 *destptr = (guint32 *) dest;
GST_DEBUG (0,"gst_colorspace_rgb555_to_rgb565 %p %p %d\n", src, dest, space->outsize);
size = space->outsize/4;
if (src == dest) {
while (size--) {
*srcptr += (*srcptr++)&0xFFE0FFE0;
}
}
else {
while (size--) {
*destptr++ = *srcptr + ((*srcptr++)&0xFFE0FFE0);
}
}
}
static void gst_colorspace_bgr565_to_rgb32(GstColorSpaceConverter *space, unsigned char *src, unsigned char *dest)
{
gint size;
guint16 *srcptr = (guint16 *)src;
guint32 *destptr = (guint32 *)dest;
size = space->outsize >> 2;
g_assert (src != dest); /* todo */
while (size--) {
/* in detail I do this
red=(unsigned char)(*srcptr)&0x1f;
green=(unsigned char)(((*srcptr)&0x07E0)>>5);
blue=(unsigned char)(((*srcptr)&0xf800)>>11);
*destptr++ = (((guint32)blue) << 3)
| (((guint32)green) << (8+2))
| (((guint32)red) << (16+3));
*/
*destptr++ = (((*srcptr)&0xf800)>>8)|(((*srcptr)&0x07E0)<<5)|(((*srcptr)&0x1f)<<19);
srcptr++;
}
}
This diff is collapsed.
/*
* Copyright (c) 1995 The Regents of the University of California.
* All rights reserved.
*
* Permission to use, copy, modify, and distribute this software and its
* documentation for any purpose, without fee, and without written agreement is
* hereby granted, provided that the above copyright notice and the following
* two paragraphs appear in all copies of this software.
*
* IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
* DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
* OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
* CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
* ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
*/
#ifndef __YUV2RGB_H__
#define __YUV2RGB_H__
typedef struct _GstColorSpaceYUVTables GstColorSpaceYUVTables;
struct _GstColorSpaceYUVTables {
int gammaCorrectFlag;
double gammaCorrect;
int chromaCorrectFlag;
double chromaCorrect;
int *L_tab, *Cr_r_tab, *Cr_g_tab, *Cb_g_tab, *Cb_b_tab;
/*
* We define tables that convert a color value between -256 and 512
* into the R, G and B parts of the pixel. The normal range is 0-255.
**/
long *r_2_pix;
long *g_2_pix;
long *b_2_pix;
};
#define CB_BASE 1
#define CR_BASE (CB_BASE*CB_RANGE)
#define LUM_BASE (CR_BASE*CR_RANGE)
#define Min(x,y) (((x) < (y)) ? (x) : (y))
#define Max(x,y) (((x) > (y)) ? (x) : (y))
#define GAMMA_CORRECTION(x) ((int)(pow((x) / 255.0, 1.0 / gammaCorrect) * 255.0))
#define CHROMA_CORRECTION256(x) ((x) >= 128 \
? 128 + Min(127, (int)(((x) - 128.0) * chromaCorrect)) \
: 128 - Min(128, (int)((128.0 - (x)) * chromaCorrect)))
#define CHROMA_CORRECTION128(x) ((x) >= 0 \
? Min(127, (int)(((x) * chromaCorrect))) \
: Max(-128, (int)(((x) * chromaCorrect))))
#define CHROMA_CORRECTION256D(x) ((x) >= 128 \
? 128.0 + Min(127.0, (((x) - 128.0) * chromaCorrect)) \
: 128.0 - Min(128.0, (((128.0 - (x)) * chromaCorrect))))
#define CHROMA_CORRECTION128D(x) ((x) >= 0 \
? Min(127.0, ((x) * chromaCorrect)) \
: Max(-128.0, ((x) * chromaCorrect)))
#endif
.globl mmx_80w
.data
.align 4
.type mmx_80w,@object
.size mmx_80w,8
mmx_80w:
.long 8388736
.long 8388736
.globl mmx_10w
.align 4
.type mmx_10w,@object
.size mmx_10w,8
mmx_10w:
.long 269488144
.long 269488144
.globl mmx_00ffw
.align 4
.type mmx_00ffw,@object
.size mmx_00ffw,8
mmx_00ffw:
.long 16711935
.long 16711935
.globl mmx_Y_coeff
.align 4
.type mmx_Y_coeff,@object
.size mmx_Y_coeff,8
mmx_Y_coeff:
.long 624895295
.long 624895295
.globl mmx_U_green
.align 4
.type mmx_U_green,@object
.size mmx_U_green,8
mmx_U_green:
.long -209849475
.long -209849475
.globl mmx_U_blue
.align 4
.type mmx_U_blue,@object
.size mmx_U_blue,8
mmx_U_blue:
.long 1083392147
.long 1083392147
.globl mmx_V_red
.align 4
.type mmx_V_red,@object
.size mmx_V_red,8
mmx_V_red:
.long 856830738
.long 856830738
.globl mmx_V_green
.align 4
.type mmx_V_green,@object
.size mmx_V_green,8
mmx_V_green: