aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2010-04-01 11:24:37 +0200
committerGerd Hoffmann <kraxel@redhat.com>2010-04-01 11:24:37 +0200
commit20425e5b96ea436628042dfbf3a112f8bd5d0fa1 (patch)
tree52b4443f43e20b0e872daa9f6c0f714c8d49a9dd
parentf6d2dd2b56d8ae71234f8a1f5196d45f8eaf0e6a (diff)
v3.42
-rw-r--r--Changes9
-rw-r--r--Makefile2
-rw-r--r--Makefile.clean2
-rw-r--r--Makefile.in26
-rw-r--r--Programming-FAQ2
-rw-r--r--debian/changelog6
-rw-r--r--debian/control2
-rw-r--r--debian/xawtv.conffiles1
-rw-r--r--font/Makefile59
-rw-r--r--font/fonts.dir4
-rw-r--r--i2c/Makefile17
-rw-r--r--libng/Makefile.in1
-rw-r--r--libng/color_lut.c108
-rw-r--r--libng/color_packed.c32
-rw-r--r--libng/color_yuv2rgb.c268
-rw-r--r--libng/grab-ng.c1
-rw-r--r--libng/grab-ng.h19
-rw-r--r--libng/grab-v4l.c7
-rw-r--r--src/channel.c2
-rw-r--r--src/fbtools.c2
-rw-r--r--src/main.c20
-rw-r--r--src/parseconfig.c11
-rw-r--r--src/parseconfig.h1
-rw-r--r--src/webcam.c1
-rw-r--r--src/xawtv-remote.c2
-rw-r--r--webcam/parseconfig.c11
-rw-r--r--webcam/parseconfig.h1
-rw-r--r--xawtv.spec4
-rw-r--r--xawtv.spec.in2
29 files changed, 472 insertions, 151 deletions
diff --git a/Changes b/Changes
index 2d999eb..8cfa7ef 100644
--- a/Changes
+++ b/Changes
@@ -1,4 +1,13 @@
+3.41 => 3.42
+============
+
+ * Added color space conversion functions for 4:2:2 yuv (packed) to rgb.
+ * Added color space conversion functions for 4:2:2 yuv (planar) to rgb.
+ * minor cleanups in the conversion functions.
+ * some fixes from Kawamata/Hitoshi <kwmt@din.or.jp>.
+
+
3.40 => 3.41
============
diff --git a/Makefile b/Makefile
index c20aae5..f7f27dc 100644
--- a/Makefile
+++ b/Makefile
@@ -5,5 +5,5 @@ default:
#########################################################
# just for me, some maintaining jobs. Don't use them
-checkit diff release port:
+checkit diff release port tarball:
./configure && $(MAKE) $@
diff --git a/Makefile.clean b/Makefile.clean
index c20aae5..f7f27dc 100644
--- a/Makefile.clean
+++ b/Makefile.clean
@@ -5,5 +5,5 @@ default:
#########################################################
# just for me, some maintaining jobs. Don't use them
-checkit diff release port:
+checkit diff release port tarball:
./configure && $(MAKE) $@
diff --git a/Makefile.in b/Makefile.in
index 5b53987..563a5fc 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -14,7 +14,6 @@ distclean realclean::
#########################################################
# just for me, some maintaining jobs. Don't use them
-RPM=/home/ftp/rpm
VERSION=@XAWTV_VERSION@
realclean::
@@ -23,19 +22,30 @@ realclean::
find . -name .nfs* -print | xargs -i rm -f
set -e; for dir in i2c; do make -C $$dir distclean; done
-checkit: distclean
- dpkg-buildpackage -tc -us -uc -rfakeroot
- rpm -ta ../xawtv_*.tar.gz
- lintian ../xawtv_*.changes
-
diff:
last=`ls -t $(HOME)/strusel/linux/xawtv/xawtv_*.tar.gz | head -1`;\
tardiff $$last . | gzip > ../xawtv_$(VERSION).diff.gz
-release: realclean diff
- make -C font bdf
+checkit: distclean
+ dpkg-buildpackage -tc -us -uc -rfakeroot
+# rpm -ta ../xawtv_*.tar.gz
+ lintian ../xawtv_*.changes
+
+#release: realclean diff
+release: distclean diff
+# make -C font bdf
dpkg-buildpackage -tc -rfakeroot
port:
dpkg-buildpackage -b -tc -rfakeroot
+tarball: distclean
+ (cd ..; tar cvzf xawtv_$(VERSION).tar.gz \
+ xawtv-$(VERSION))
+
+auto:
+ rm -f config.cache
+ autoconf
+ autoheader
+ ./configure
+
diff --git a/Programming-FAQ b/Programming-FAQ
index 2e51fa9..f3a0377 100644
--- a/Programming-FAQ
+++ b/Programming-FAQ
@@ -1,5 +1,5 @@
-mostly for bttv currently...
+mostly for bttv currently, also a bit outdated and incomplete...
Initialisation
diff --git a/debian/changelog b/debian/changelog
index 1d836f2..609c066 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+xawtv (3.42) unstable; urgency=low
+
+ * new release.
+
+ -- Gerd Knorr <kraxel@debian.org> Fri, 6 Apr 2001 08:04:27 +0000
+
xawtv (3.41) unstable; urgency=low
* new release.
diff --git a/debian/control b/debian/control
index 09c6c5b..deaf319 100644
--- a/debian/control
+++ b/debian/control
@@ -1,7 +1,7 @@
Source: xawtv
Section: graphics
Priority: extra
-Build-Depends: libjpeg62-dev, libncurses5-dev, xlibs-dev (>= 4.0.1), xaw3dg-dev, liblircclient-dev, debhelper, xutils, libquicktime4linux-dev, xbase-clients
+Build-Depends: libjpeg-dev, libncurses5-dev, xlibs-dev (>= 4.0.1), xaw3dg-dev, liblircclient-dev, debhelper, xutils, libquicktime4linux-dev, xbase-clients
Maintainer: Gerd Knorr <kraxel@debian.org>
Standards-Version: 3.5.2
diff --git a/debian/xawtv.conffiles b/debian/xawtv.conffiles
deleted file mode 100644
index 94e7b18..0000000
--- a/debian/xawtv.conffiles
+++ /dev/null
@@ -1 +0,0 @@
-/etc/X11/app-defaults/Xawtv
diff --git a/font/Makefile b/font/Makefile
deleted file mode 100644
index 3cb5fe4..0000000
--- a/font/Makefile
+++ /dev/null
@@ -1,59 +0,0 @@
-# Generated automatically from Makefile.in by configure.
-srcdir=.
-
-ROOT=
-prefix=/usr/X11R6
-FONTDIR=$(ROOT)$(prefix)/lib/X11/fonts/misc
-PCF=led-latin1.pcf led-latin2.pcf led-koi8.pcf
-
-all build: $(PCF)
- mkfontdir
-
-install: all
- mkdir -p $(R)$(FONTDIR)
- for file in $(PCF); do \
- install -m 644 $$file $(R)$(FONTDIR); \
- done
- if test "$(ROOT)" = ""; then \
- (cd $(FONTDIR); mkfontdir); \
- xset fp rehash || true; \
- fi
-
-.SUFFIXES: .bdf .pcf
-.bdf.pcf:
- bdftopcf -o $@ $<
-
-dep:
-
-clean:
- rm -f $(PCF)
-
-distclean: clean
- rm -f Makefile *~ *.bak
-
-
-###########################################################################
-# don't use these, unless you know what you are doing...
-
-SERVER=tcp/goldbach:7100
-
-bdf: led-latin1.bdf led-latin2.bdf led-koi8.bdf
-
-led-latin1.bdf:
- perl ./bigfont.pl -s $(SERVER) -fn \
- "-misc-fixed-medium-r-semicondensed--13-*-iso8859-1" > led-latin1.bdf
-
-led-latin2.bdf:
- perl ./bigfont.pl -s $(SERVER) -fn \
- "-misc-fixed-medium-r-semicondensed--13-*-iso8859-2" > led-latin2.bdf
-
-led-koi8.bdf:
- perl ./bigfont.pl -s $(SERVER) -fn \
- "-misc-fixed-medium-r-semicondensed--13-*-koi8-r" > led-koi8.bdf
-
-
-realclean: clean
- rm -f *.bdf fonts.dir
-
-dist: realclean bdf
-
diff --git a/font/fonts.dir b/font/fonts.dir
new file mode 100644
index 0000000..d1a1f4d
--- /dev/null
+++ b/font/fonts.dir
@@ -0,0 +1,4 @@
+3
+led-latin1.pcf -xxl-ledfixed-medium-r-semicondensed--39-120-75-75-c-180-iso8859-1
+led-latin2.pcf -xxl-ledfixed-medium-r-semicondensed--39-120-75-75-c-180-iso8859-2
+led-koi8.pcf -xxl-ledfixed-medium-r-semicondensed--39-120-75-75-c-180-koi8-r
diff --git a/i2c/Makefile b/i2c/Makefile
new file mode 100644
index 0000000..a2c9804
--- /dev/null
+++ b/i2c/Makefile
@@ -0,0 +1,17 @@
+# Generated automatically from Makefile.in by configure.
+srcdir=.
+
+PROGS=detect eeprom #scan
+
+CC=gcc
+CFLAGS=-Wall
+
+all: $(PROGS)
+
+clean:
+ rm -f $(PROGS)
+
+distclean realclean: clean
+ rm -f Makefile *~ *.bak
+
+dep depend install:
diff --git a/libng/Makefile.in b/libng/Makefile.in
index 80f104f..221d87f 100644
--- a/libng/Makefile.in
+++ b/libng/Makefile.in
@@ -7,6 +7,7 @@ DEPEND=@DEPEND@
CFLAGS=-Wall -O2 -g @CFLAGS@ -I..
OBJS=grab-ng.o @NG_GRAB@ \
color_common.o color_packed.o color_lut.o \
+ color_yuv2rgb.o \
mjpeg.o \
writefile.o writeavi.o writeqt.o
diff --git a/libng/color_lut.c b/libng/color_lut.c
index e9bc3d9..afb6839 100644
--- a/libng/color_lut.c
+++ b/libng/color_lut.c
@@ -20,132 +20,130 @@
#include "grab-ng.h"
#include "byteswap.h"
-static unsigned long lut_red[256];
-static unsigned long lut_green[256];
-static unsigned long lut_blue[256];
+unsigned long ng_lut_red[256];
+unsigned long ng_lut_green[256];
+unsigned long ng_lut_blue[256];
/* ------------------------------------------------------------------- */
-static int
+static void
rgb24_to_lut2(unsigned char *dest, unsigned char *src, int p)
{
unsigned short *d = (unsigned short*)dest;
while (p-- > 0) {
- *(d++) = lut_red[src[0]] | lut_green[src[1]] | lut_blue[src[2]];
+ *(d++) = ng_lut_red[src[0]] | ng_lut_green[src[1]] |
+ ng_lut_blue[src[2]];
src += 3;
}
- return ((unsigned char*)d-dest);
}
-static int
+static void
bgr24_to_lut2(unsigned char *dest, unsigned char *src, int p)
{
unsigned short *d = (unsigned short*)dest;
while (p-- > 0) {
- *(d++) = lut_red[src[2]] | lut_green[src[1]] | lut_blue[src[0]];
+ *(d++) = ng_lut_red[src[2]] | ng_lut_green[src[1]] |
+ ng_lut_blue[src[0]];
src += 3;
}
- return ((unsigned char*)d-dest);
}
-static int
+static void
rgb32_to_lut2(unsigned char *dest, unsigned char *src, int p)
{
unsigned short *d = (unsigned short*)dest;
while (p-- > 0) {
- *(d++) = lut_red[src[1]] | lut_green[src[2]] | lut_blue[src[3]];
+ *(d++) = ng_lut_red[src[1]] | ng_lut_green[src[2]] |
+ ng_lut_blue[src[3]];
src += 4;
}
- return ((unsigned char*)d-dest);
}
-static int
+static void
bgr32_to_lut2(unsigned char *dest, unsigned char *src, int p)
{
unsigned short *d = (unsigned short*)dest;
while (p-- > 0) {
- *(d++) = lut_red[src[3]] | lut_green[src[2]] | lut_blue[src[1]];
+ *(d++) = ng_lut_red[src[3]] | ng_lut_green[src[2]] |
+ ng_lut_blue[src[1]];
src += 4;
}
- return ((unsigned char*)d-dest);
}
-static int
+static void
gray_to_lut2(unsigned char *dest, unsigned char *src, int p)
{
unsigned short *d = (unsigned short*)dest;
while (p-- > 0) {
- *(d++) = lut_red[*src] | lut_green[*src] | lut_blue[*src];
+ *(d++) = ng_lut_red[*src] | ng_lut_green[*src] | ng_lut_blue[*src];
src++;
}
- return ((unsigned char*)d-dest);
}
/* ------------------------------------------------------------------- */
-static int
+static void
rgb24_to_lut4(unsigned char *dest, unsigned char *src, int p)
{
unsigned int *d = (unsigned int*)dest;
while (p-- > 0) {
- *(d++) = lut_red[src[0]] | lut_green[src[1]] | lut_blue[src[2]];
+ *(d++) = ng_lut_red[src[0]] | ng_lut_green[src[1]] |
+ ng_lut_blue[src[2]];
src += 3;
}
- return ((unsigned char*)d-dest);
}
-static int
+static void
bgr24_to_lut4(unsigned char *dest, unsigned char *src, int p)
{
unsigned int *d = (unsigned int*)dest;
while (p-- > 0) {
- *(d++) = lut_red[src[2]] | lut_green[src[1]] | lut_blue[src[0]];
+ *(d++) = ng_lut_red[src[2]] | ng_lut_green[src[1]] |
+ ng_lut_blue[src[0]];
src += 3;
}
- return ((unsigned char*)d-dest);
}
-static int
+static void
rgb32_to_lut4(unsigned char *dest, unsigned char *src, int p)
{
unsigned int *d = (unsigned int*)dest;
while (p-- > 0) {
- *(d++) = lut_red[src[1]] | lut_green[src[2]] | lut_blue[src[3]];
+ *(d++) = ng_lut_red[src[1]] | ng_lut_green[src[2]] |
+ ng_lut_blue[src[3]];
src += 4;
}
- return ((unsigned char*)d-dest);
}
-static int
+static void
bgr32_to_lut4(unsigned char *dest, unsigned char *src, int p)
{
unsigned int *d = (unsigned int*)dest;
while (p-- > 0) {
- *(d++) = lut_red[src[3]] | lut_green[src[2]] | lut_blue[src[1]];
+ *(d++) = ng_lut_red[src[3]] | ng_lut_green[src[2]] |
+ ng_lut_blue[src[1]];
src += 4;
}
- return ((unsigned char*)d-dest);
}
-static int
+static void
gray_to_lut4(unsigned char *dest, unsigned char *src, int p)
{
unsigned int *d = (unsigned int*)dest;
while (p-- > 0) {
- *(d++) = lut_red[*src] | lut_green[*src] | lut_blue[*src];
+ *(d++) = ng_lut_red[*src] | ng_lut_green[*src] | ng_lut_blue[*src];
src++;
}
- return ((unsigned char*)d-dest);
}
/* ------------------------------------------------------------------- */
@@ -171,6 +169,15 @@ static struct ng_video_conv lut2_list[] = {
NG_GENERIC_PACKED,
fmtid_in: VIDEO_GRAY,
priv: gray_to_lut2,
+ }, {
+ NG_GENERIC_PACKED,
+ fmtid_in: VIDEO_YUV422,
+ priv: ng_yuv422_to_lut2,
+ },{
+ init: ng_conv_nop_init,
+ fini: ng_conv_nop_fini,
+ frame: ng_yuv422p_to_lut2,
+ fmtid_in: VIDEO_YUV422P,
}
};
@@ -195,6 +202,17 @@ static struct ng_video_conv lut4_list[] = {
NG_GENERIC_PACKED,
fmtid_in: VIDEO_GRAY,
priv: gray_to_lut4,
+ }, {
+ NG_GENERIC_PACKED,
+ fmtid_in: VIDEO_YUV422,
+ priv: ng_yuv422_to_lut4,
+#if 0
+ },{
+ init: ng_conv_nop_init,
+ fini: ng_conv_nop_fini,
+ frame: yuv422p_to_lut4,
+ fmtid_in: VIDEO_YUV422P,
+#endif
}
};
@@ -244,32 +262,32 @@ ng_lut_init(unsigned long red_mask, unsigned long green_mask,
if (rgb_red_bits > 8)
for (i = 0; i < 256; i++)
- lut_red[i] = (i << (rgb_red_bits + rgb_red_shift - 8));
+ ng_lut_red[i] = (i << (rgb_red_bits + rgb_red_shift - 8));
else
for (i = 0; i < 256; i++)
- lut_red[i] = (i >> (8 - rgb_red_bits)) << rgb_red_shift;
+ ng_lut_red[i] = (i >> (8 - rgb_red_bits)) << rgb_red_shift;
if (rgb_green_bits > 8)
for (i = 0; i < 256; i++)
- lut_green[i] = (i << (rgb_green_bits + rgb_green_shift - 8));
+ ng_lut_green[i] = (i << (rgb_green_bits + rgb_green_shift - 8));
else
for (i = 0; i < 256; i++)
- lut_green[i] = (i >> (8 - rgb_green_bits)) << rgb_green_shift;
+ ng_lut_green[i] = (i >> (8 - rgb_green_bits)) << rgb_green_shift;
if (rgb_blue_bits > 8)
for (i = 0; i < 256; i++)
- lut_blue[i] = (i << (rgb_blue_bits + rgb_blue_shift - 8));
+ ng_lut_blue[i] = (i << (rgb_blue_bits + rgb_blue_shift - 8));
else
for (i = 0; i < 256; i++)
- lut_blue[i] = (i >> (8 - rgb_blue_bits)) << rgb_blue_shift;
+ ng_lut_blue[i] = (i >> (8 - rgb_blue_bits)) << rgb_blue_shift;
switch (ng_vfmt_to_depth[fmtid]) {
case 16:
if (swap) {
for (i = 0; i < 256; i++) {
- lut_red[i] = SWAP2(lut_red[i]);
- lut_green[i] = SWAP2(lut_green[i]);
- lut_blue[i] = SWAP2(lut_blue[i]);
+ ng_lut_red[i] = SWAP2(ng_lut_red[i]);
+ ng_lut_green[i] = SWAP2(ng_lut_green[i]);
+ ng_lut_blue[i] = SWAP2(ng_lut_blue[i]);
}
}
for (i = 0; i < nconv2; i++)
@@ -279,9 +297,9 @@ ng_lut_init(unsigned long red_mask, unsigned long green_mask,
case 32:
if (swap) {
for (i = 0; i < 256; i++) {
- lut_red[i] = SWAP4(lut_red[i]);
- lut_green[i] = SWAP4(lut_green[i]);
- lut_blue[i] = SWAP4(lut_blue[i]);
+ ng_lut_red[i] = SWAP4(ng_lut_red[i]);
+ ng_lut_green[i] = SWAP4(ng_lut_green[i]);
+ ng_lut_blue[i] = SWAP4(ng_lut_blue[i]);
}
}
for (i = 0; i < nconv4; i++)
diff --git a/libng/color_packed.c b/libng/color_packed.c
index f2efbc5..302ca7e 100644
--- a/libng/color_packed.c
+++ b/libng/color_packed.c
@@ -21,7 +21,7 @@
/* ------------------------------------------------------------------- */
/* RGB conversions */
-static int
+static void
redblue_swap(unsigned char *dest, unsigned char *src, int p)
{
register unsigned char *s = src;
@@ -33,10 +33,9 @@ redblue_swap(unsigned char *dest, unsigned char *src, int p)
*(d++) = s[0];
s += 3;
}
- return d-dest;
}
-static int
+static void
bgr24_to_bgr32(unsigned char *dest, unsigned char *src, int p)
{
register unsigned char *s = src;
@@ -48,10 +47,9 @@ bgr24_to_bgr32(unsigned char *dest, unsigned char *src, int p)
*(d++) = *(s++);
*(d++) = 0;
}
- return d-dest;
}
-static int
+static void
bgr24_to_rgb32(unsigned char *dest, unsigned char *src, int p)
{
register unsigned char *s = src;
@@ -64,10 +62,9 @@ bgr24_to_rgb32(unsigned char *dest, unsigned char *src, int p)
*(d++) = s[0];
s +=3;
}
- return d-dest;
}
-static int
+static void
rgb32_to_rgb24(unsigned char *dest, unsigned char *src, int p)
{
register unsigned char *s = src;
@@ -79,10 +76,9 @@ rgb32_to_rgb24(unsigned char *dest, unsigned char *src, int p)
*(d++) = *(s++);
*(d++) = *(s++);
}
- return d-dest;
}
-static int
+static void
rgb32_to_bgr24(unsigned char *dest, unsigned char *src, int p)
{
register unsigned char *s = src;
@@ -95,11 +91,10 @@ rgb32_to_bgr24(unsigned char *dest, unsigned char *src, int p)
d[0] = *(s++);
d += 3;
}
- return d-dest;
}
/* 15+16 bpp LE <=> BE */
-static int
+static void
byteswap_short(unsigned char *dest, unsigned char *src, int p)
{
register unsigned char *s = src;
@@ -110,13 +105,12 @@ byteswap_short(unsigned char *dest, unsigned char *src, int p)
*(d++) = s[0];
s += 2;
}
- return d-dest;
}
/* ------------------------------------------------------------------- */
/* color => grayscale */
-static int
+static void
rgb15_native_gray(unsigned char *dest, unsigned char *s, int p)
{
int r,g,b;
@@ -130,11 +124,10 @@ rgb15_native_gray(unsigned char *dest, unsigned char *s, int p)
*(dest++) = ((3*r + 6*g + b)/10) << 3;
src++;
}
- return (unsigned char*)src-s;
}
#if BYTE_ORDER == LITTLE_ENDIAN
-static int
+static void
rgb15_be_gray(unsigned char *dest, unsigned char *src, int p)
{
register unsigned char *d = dest;
@@ -147,12 +140,11 @@ rgb15_be_gray(unsigned char *dest, unsigned char *src, int p)
*(d++) = ((3*r + 6*g + b)/10) << 3;
src += 2;
}
- return d-dest;
}
#endif
#if BYTE_ORDER == BIG_ENDIAN
-static int
+static void
rgb15_le_gray(unsigned char *dest, unsigned char *src, int p)
{
register unsigned char *d = dest;
@@ -165,17 +157,11 @@ rgb15_le_gray(unsigned char *dest, unsigned char *src, int p)
*(dest++) = ((3*r + 6*g + b)/10) << 3;
src += 2;
}
- return d-dest;
}
#endif
/* ------------------------------------------------------------------- */
-#define GENERIC_PACKED \
- init: ng_packed_init, \
- frame: ng_packed_frame, \
- fini: ng_packed_fini
-
static struct ng_video_conv conv_list[] = {
{
/* ----------------------------------- write GRAY -- */
diff --git a/libng/color_yuv2rgb.c b/libng/color_yuv2rgb.c
new file mode 100644
index 0000000..bd87dfe
--- /dev/null
+++ b/libng/color_yuv2rgb.c
@@ -0,0 +1,268 @@
+/*
+ * colorspace conversion functions
+ * -- yuv to rgb colorspace conversions
+ *
+ * (c) 2001 Gerd Knorr <kraxel@bytesex.org>
+ *
+ */
+
+#include "config.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <pthread.h>
+#include <sys/time.h>
+#ifdef HAVE_ENDIAN_H
+# include <endian.h>
+#endif
+#include "grab-ng.h"
+
+/* ------------------------------------------------------------------- */
+
+#define CLIP 320
+
+#if 0
+# define RED_NULL 137
+# define BLUE_NULL 156
+# define LUN_MUL 360
+# define RED_MUL 512
+# define BLUE_MUL 512
+#else
+# define RED_NULL 128
+# define BLUE_NULL 128
+# define LUN_MUL 256
+# define RED_MUL 512
+# define BLUE_MUL 512
+#endif
+
+#define GREEN1_MUL (-RED_MUL/2)
+#define GREEN2_MUL (-BLUE_MUL/6)
+#define RED_ADD (-RED_NULL * RED_MUL)
+#define BLUE_ADD (-BLUE_NULL * BLUE_MUL)
+#define GREEN1_ADD (-RED_ADD/2)
+#define GREEN2_ADD (-BLUE_ADD/6)
+
+/* lookup tables */
+static unsigned int ng_yuv_gray[256];
+static unsigned int ng_yuv_red[256];
+static unsigned int ng_yuv_blue[256];
+static unsigned int ng_yuv_g1[256];
+static unsigned int ng_yuv_g2[256];
+static unsigned int ng_clip[256 + 2 * CLIP];
+
+#define GRAY(val) ng_yuv_gray[val]
+#define RED(gray,red) ng_clip[ CLIP + gray + ng_yuv_red[red] ]
+#define GREEN(gray,red,blue) ng_clip[ CLIP + gray + ng_yuv_g1[red] + \
+ ng_yuv_g2[blue] ]
+#define BLUE(gray,blue) ng_clip[ CLIP + gray + ng_yuv_blue[blue] ]
+
+/* ------------------------------------------------------------------- */
+/* packed pixel yuv to RGB */
+
+static void
+yuv422_to_rgb24(unsigned char *dest, unsigned char *s, int p)
+{
+ unsigned char *d = dest;
+ int gray;
+
+ while (p) {
+ gray = GRAY(s[0]);
+ d[0] = RED(gray,s[3]);
+ d[1] = GREEN(gray,s[3],s[1]);
+ d[2] = BLUE(gray,s[1]);
+ gray = GRAY(s[2]);
+ d[3] = RED(gray,s[3]);
+ d[4] = GREEN(gray,s[3],s[1]);
+ d[5] = BLUE(gray,s[1]);
+ d += 6;
+ s += 4;
+ p -= 2;
+ }
+}
+
+void
+ng_yuv422_to_lut2(unsigned char *dest, unsigned char *s, int p)
+{
+ unsigned short *d = (unsigned short*)dest;
+ int gray;
+
+ while (p) {
+ gray = GRAY(s[0]);
+ *(d++) =
+ ng_lut_red[RED(gray,s[3])] |
+ ng_lut_green[GREEN(gray,s[3],s[1])] |
+ ng_lut_blue[BLUE(gray,s[1])];
+ gray = GRAY(s[2]);
+ *(d++) =
+ ng_lut_red[RED(gray,s[3])] |
+ ng_lut_green[GREEN(gray,s[3],s[1])] |
+ ng_lut_blue[BLUE(gray,s[1])];
+ s += 4;
+ p -= 2;
+ }
+}
+
+void
+ng_yuv422_to_lut4(unsigned char *dest, unsigned char *s, int p)
+{
+ unsigned int *d = (unsigned int*)dest;
+ int gray;
+
+ while (p) {
+ gray = GRAY(s[0]);
+ *(d++) =
+ ng_lut_red[RED(gray,s[3])] |
+ ng_lut_green[GREEN(gray,s[3],s[1])] |
+ ng_lut_blue[BLUE(gray,s[1])];
+ gray = GRAY(s[2]);
+ *(d++) =
+ ng_lut_red[RED(gray,s[3])] |
+ ng_lut_green[GREEN(gray,s[3],s[1])] |
+ ng_lut_blue[BLUE(gray,s[1])];
+ s += 4;
+ p -= 2;
+ }
+}
+
+/* ------------------------------------------------------------------- */
+/* planar yuv to RGB */
+
+void
+yuv422p_to_rgb24(void *h, struct ng_video_buf *out, struct ng_video_buf *in)
+{
+ unsigned char *y,*u,*v;
+ unsigned char *dp,*d;
+ int i,j,gray;
+
+ dp = out->data;
+ y = in->data;
+ u = y + in->fmt.width * in->fmt.height;
+ v = u + in->fmt.width * in->fmt.height / 2;
+
+ for (i = 0; i < in->fmt.height; i++) {
+ d = dp;
+ for (j = 0; j < in->fmt.width; j+= 2) {
+ gray = GRAY(*y);
+ *(d++) = RED(gray,*v);
+ *(d++) = GREEN(gray,*v,*u);
+ *(d++) = BLUE(gray,*u);
+ y++;
+ gray = GRAY(*y);
+ *(d++) = RED(gray,*v);
+ *(d++) = GREEN(gray,*v,*u);
+ *(d++) = BLUE(gray,*u);
+ y++; u++; v++;
+ }
+ dp += out->fmt.bytesperline;
+ }
+}
+
+void
+ng_yuv422p_to_lut2(void *h, struct ng_video_buf *out, struct ng_video_buf *in)
+{
+ unsigned char *y,*u,*v;
+ unsigned char *dp;
+ unsigned short *d;
+ int i,j,gray;
+
+ dp = out->data;
+ y = in->data;
+ u = y + in->fmt.width * in->fmt.height;
+ v = u + in->fmt.width * in->fmt.height / 2;
+
+ for (i = 0; i < in->fmt.height; i++) {
+ d = (unsigned short*) dp;
+ for (j = 0; j < in->fmt.width; j+= 2) {
+ gray = GRAY(*y);
+ *(d++) =
+ ng_lut_red[RED(gray,*v)] |
+ ng_lut_green[GREEN(gray,*v,*u)] |
+ ng_lut_blue[BLUE(gray,*u)];
+ y++;
+ gray = GRAY(*y);
+ *(d++) =
+ ng_lut_red[RED(gray,*v)] |
+ ng_lut_green[GREEN(gray,*v,*u)] |
+ ng_lut_blue[BLUE(gray,*u)];
+ y++; u++; v++;
+ }
+ dp += out->fmt.bytesperline;
+ }
+}
+
+void
+ng_yuv422p_to_lut4(void *h, struct ng_video_buf *out, struct ng_video_buf *in)
+{
+ unsigned char *y,*u,*v;
+ unsigned char *dp;
+ unsigned int *d;
+ int i,j,gray;
+
+ dp = out->data;
+ y = in->data;
+ u = y + in->fmt.width * in->fmt.height;
+ v = u + in->fmt.width * in->fmt.height / 2;
+
+ for (i = 0; i < in->fmt.height; i++) {
+ d = (unsigned int*) dp;
+ for (j = 0; j < in->fmt.width; j+= 2) {
+ gray = GRAY(*y);
+ *(d++) =
+ ng_lut_red[RED(gray,*v)] |
+ ng_lut_green[GREEN(gray,*v,*u)] |
+ ng_lut_blue[BLUE(gray,*u)];
+ y++;
+ gray = GRAY(*y);
+ *(d++) =
+ ng_lut_red[RED(gray,*v)] |
+ ng_lut_green[GREEN(gray,*v,*u)] |
+ ng_lut_blue[BLUE(gray,*u)];
+ y++; u++; v++;
+ }
+ dp += out->fmt.bytesperline;
+ }
+}
+
+/* ------------------------------------------------------------------- */
+
+static struct ng_video_conv conv_list[] = {
+ {
+ NG_GENERIC_PACKED,
+ fmtid_in: VIDEO_YUV422,
+ fmtid_out: VIDEO_RGB24,
+ priv: yuv422_to_rgb24,
+ },{
+ init: ng_conv_nop_init,
+ fini: ng_conv_nop_fini,
+ frame: yuv422p_to_rgb24,
+ fmtid_in: VIDEO_YUV422P,
+ fmtid_out: VIDEO_RGB24,
+ }
+};
+static const int nconv = sizeof(conv_list)/sizeof(struct ng_video_conv);
+
+/* ------------------------------------------------------------------- */
+
+void ng_color_yuv2rgb_init(void)
+{
+ int i;
+
+ /* init Lookup tables */
+ for (i = 0; i < 256; i++) {
+ ng_yuv_gray[i] = i * LUN_MUL >> 8;
+ ng_yuv_red[i] = (RED_ADD + i * RED_MUL) >> 8;
+ ng_yuv_blue[i] = (BLUE_ADD + i * BLUE_MUL) >> 8;
+ ng_yuv_g1[i] = (GREEN1_ADD + i * GREEN1_MUL) >> 8;
+ ng_yuv_g2[i] = (GREEN2_ADD + i * GREEN2_MUL) >> 8;
+ }
+ for (i = 0; i < CLIP; i++)
+ ng_clip[i] = 0;
+ for (; i < CLIP + 256; i++)
+ ng_clip[i] = i - CLIP;
+ for (; i < 2 * CLIP + 256; i++)
+ ng_clip[i] = 255;
+
+ /* register stuff */
+ ng_conv_register(conv_list,nconv);
+}
diff --git a/libng/grab-ng.c b/libng/grab-ng.c
index 9e4bac5..4c0ebe0 100644
--- a/libng/grab-ng.c
+++ b/libng/grab-ng.c
@@ -408,5 +408,6 @@ ng_init(void)
exit(1);
}
ng_color_packed_init();
+ ng_color_yuv2rgb_init();
ng_mjpg_init();
}
diff --git a/libng/grab-ng.h b/libng/grab-ng.h
index 18f0cfc..925db45 100644
--- a/libng/grab-ng.h
+++ b/libng/grab-ng.h
@@ -265,14 +265,27 @@ long long ng_get_timestamp(void);
/* --------------------------------------------------------------------- */
void ng_init(void);
-void ng_color_packed_init(void);
-void ng_mjpg_init(void);
void ng_lut_init(unsigned long red_mask, unsigned long green_mask,
unsigned long blue_mask, int fmtid, int swap);
/* --------------------------------------------------------------------- */
-/* color_common.c */
+/* internal stuff starts here */
+
+/* init functions */
+void ng_color_packed_init(void);
+void ng_color_yuv2rgb_init(void);
+void ng_mjpg_init(void);
+
+/* for yuv2rgb using lookup tables (color_lut.c, color_yuv2rgb.c) */
+unsigned long ng_lut_red[256];
+unsigned long ng_lut_green[256];
+unsigned long ng_lut_blue[256];
+void ng_yuv422_to_lut2(unsigned char *dest, unsigned char *s, int p);
+void ng_yuv422_to_lut4(unsigned char *dest, unsigned char *s, int p);
+void ng_yuv422p_to_lut2(void *h, struct ng_video_buf *out,
+ struct ng_video_buf *in);
+/* color_common.c stuff */
void* ng_packed_init(struct ng_video_fmt *out, void *priv);
void ng_packed_frame(void *handle, struct ng_video_buf *out,
struct ng_video_buf *in);
diff --git a/libng/grab-v4l.c b/libng/grab-v4l.c
index 4dc01fb..6c826a2 100644
--- a/libng/grab-v4l.c
+++ b/libng/grab-v4l.c
@@ -1105,6 +1105,13 @@ v4l_setformat(void *handle, struct ng_video_fmt *fmt)
struct v4l_handle *h = handle;
int rc;
+#if 1
+ /* for debugging color space conversion functions:
+ force xawtv to capture some specific format */
+ if (fmt->fmtid != VIDEO_YUV422)
+ return -1;
+#endif
+
if (ng_debug)
fprintf(stderr,"v4l: setformat\n");
if (h->use_read) {
diff --git a/src/channel.c b/src/channel.c
index 0584853..3c15dd0 100644
--- a/src/channel.c
+++ b/src/channel.c
@@ -324,7 +324,7 @@ init_channel(char *name, struct CHANNEL *c)
c->cname = strdup(val);
if (NULL != (val = cfg_get_str(name,"freq")))
c->freq = (int)(atof(val)*16);
- if (-1 != (n = cfg_get_int(name,"fine")))
+ if (0 != (n = cfg_get_signed_int(name,"fine")))
c->fine = n;
if (NULL != (val = cfg_get_str(name,"key")))
diff --git a/src/fbtools.c b/src/fbtools.c
index 5e69807..8d8a882 100644
--- a/src/fbtools.c
+++ b/src/fbtools.c
@@ -54,7 +54,9 @@ static int font_height;
static unsigned char *font_data;
static char *default_font[] = {
"/usr/lib/kbd/consolefonts/lat1-16.psf",
+ "/usr/lib/kbd/consolefonts/lat1-16.psfu",
"/usr/lib/kbd/consolefonts/lat1-16.psf.gz",
+ "/usr/lib/kbd/consolefonts/lat1-16.psfu.gz",
"/usr/share/consolefonts/lat1-16.psf",
"/usr/share/consolefonts/lat1-16.psf.gz",
NULL,
diff --git a/src/main.c b/src/main.c
index ecf1832..b58baeb 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1370,6 +1370,7 @@ do_fullscreen(void)
vp_width = vm_modelines[0]->hdisplay;
vp_height = vm_modelines[0]->vdisplay;
}
+ fprintf(stderr,"%d x %d\n",vp_width,vp_height);
if (vp_width < sheight || vp_width < swidth) {
/* move viewpoint, make sure the pointer is in there */
warp_pointer = 1;
@@ -2091,6 +2092,21 @@ do_movie_record(int argc, char **argv)
int i;
/* set parameters */
+ if (argc > 1 && 0 == strcasecmp(argv[0],"driver")) {
+ for (i = 0; m_movie_driver[i].str != NULL; i++)
+ if (0 == strcasecmp(argv[1],m_movie_driver[i].str))
+ movie_driver = m_movie_driver[i].nr;
+ set_menu_val(w_movie_driver,MOVIE_DRIVER,
+ m_movie_driver,movie_driver);
+ build_menus();
+ movie_audio = 0;
+ movie_video = 0;
+ set_menu_val(w_movie_audio,MOVIE_AUDIO,
+ m_movie_audio,movie_audio);
+ set_menu_val(w_movie_video,MOVIE_VIDEO,
+ m_movie_video,movie_video);
+ return;
+ }
if (argc > 1 && 0 == strcasecmp(argv[0],"fvideo")) {
XtVaSetValues(w_movie_fvideo,XtNstring,argv[1],NULL);
return;
@@ -2110,7 +2126,7 @@ do_movie_record(int argc, char **argv)
if (argc > 1 && 0 == strcasecmp(argv[0],"rate")) {
for (i = 0; m_movie_rate[i].str != NULL; i++)
if (atoi(argv[1]) == m_movie_rate[i].nr)
- movie_fps = m_movie_rate[i].nr;
+ movie_rate = m_movie_rate[i].nr;
set_menu_val(w_movie_rate,MOVIE_RATE,
m_movie_rate,movie_rate);
}
@@ -2125,7 +2141,7 @@ do_movie_record(int argc, char **argv)
if (argc > 1 && 0 == strcasecmp(argv[0],"fps")) {
for (i = 0; m_movie_fps[i].str != NULL; i++)
if (atoi(argv[1]) == m_movie_fps[i].nr)
- movie_rate= m_movie_fps[i].nr;
+ movie_fps = m_movie_fps[i].nr;
set_menu_val(w_movie_fps,MOVIE_FPS,
m_movie_fps,movie_fps);
}
diff --git a/src/parseconfig.c b/src/parseconfig.c
index 4567e08..9bac2d7 100644
--- a/src/parseconfig.c
+++ b/src/parseconfig.c
@@ -193,6 +193,17 @@ cfg_get_int(char *sec, char *ent)
return atoi(val);
}
+int
+cfg_get_signed_int(char *sec, char *ent)
+{
+ char *val;
+
+ val = cfg_get_str(sec,ent);
+ if (NULL == val)
+ return 0;
+ return atoi(val);
+}
+
float
cfg_get_float(char *sec, char *ent)
{
diff --git a/src/parseconfig.h b/src/parseconfig.h
index 746d52a..e3b609d 100644
--- a/src/parseconfig.h
+++ b/src/parseconfig.h
@@ -3,4 +3,5 @@ char** cfg_list_sections(void);
char** cfg_list_entries(char *name);
char* cfg_get_str(char *sec, char *ent);
int cfg_get_int(char *sec, char *ent);
+int cfg_get_signed_int(char *sec, char *ent);
float cfg_get_float(char *sec, char *ent);
diff --git a/src/webcam.c b/src/webcam.c
index 6e88f24..4667a41 100644
--- a/src/webcam.c
+++ b/src/webcam.c
@@ -33,7 +33,6 @@ webcam_writer(void *arg)
int rename,fd,old;
char tmpfilename[512];
struct ng_video_fmt *fmt;
- char *data;
if (debug)
fprintf(stderr,"webcam_writer start\n");
diff --git a/src/xawtv-remote.c b/src/xawtv-remote.c
index 2a901a0..f3a21fa 100644
--- a/src/xawtv-remote.c
+++ b/src/xawtv-remote.c
@@ -150,7 +150,7 @@ main(int argc, char *argv[])
dpyname = optarg;
break;
case 'i':
- id = atoi(optarg);
+ sscanf(optarg,"%li",&id);
break;
case 'v':
debug = atoi(optarg);
diff --git a/webcam/parseconfig.c b/webcam/parseconfig.c
index 4567e08..9bac2d7 100644
--- a/webcam/parseconfig.c
+++ b/webcam/parseconfig.c
@@ -193,6 +193,17 @@ cfg_get_int(char *sec, char *ent)
return atoi(val);
}
+int
+cfg_get_signed_int(char *sec, char *ent)
+{
+ char *val;
+
+ val = cfg_get_str(sec,ent);
+ if (NULL == val)
+ return 0;
+ return atoi(val);
+}
+
float
cfg_get_float(char *sec, char *ent)
{
diff --git a/webcam/parseconfig.h b/webcam/parseconfig.h
index 746d52a..e3b609d 100644
--- a/webcam/parseconfig.h
+++ b/webcam/parseconfig.h
@@ -3,4 +3,5 @@ char** cfg_list_sections(void);
char** cfg_list_entries(char *name);
char* cfg_get_str(char *sec, char *ent);
int cfg_get_int(char *sec, char *ent);
+int cfg_get_signed_int(char *sec, char *ent);
float cfg_get_float(char *sec, char *ent);
diff --git a/xawtv.spec b/xawtv.spec
index b0b4983..64aaa3a 100644
--- a/xawtv.spec
+++ b/xawtv.spec
@@ -7,8 +7,8 @@
%define __os_install_post true
Summary: Video4Linux Stream Capture Viewer
-Name: xawtv
-Version: 3.41
+Name: xawtv
+Version: 3.42
Release: 1
Source0: xawtv_%{version}.tar.gz
Group: X11/Applications
diff --git a/xawtv.spec.in b/xawtv.spec.in
index bf8e485..9db1eb0 100644
--- a/xawtv.spec.in
+++ b/xawtv.spec.in
@@ -7,7 +7,7 @@
%define __os_install_post true
Summary: Video4Linux Stream Capture Viewer
-Name: xawtv
+Name: xawtv
Version: @XAWTV_VERSION@
Release: 1
Source0: xawtv_%{version}.tar.gz

Privacy Policy