Commit 4c8afc76 authored by Sam Hocevar's avatar Sam Hocevar

  * ./plugins/chroma/i420_rgb8.c: plain C 8 bpp transformation.
  * ./plugins/chroma/i420_rgb16.c: plain C 24/32 bpp transformations.
  * ./plugins/ggi/ggi.c: support for 8 bpp displays.
  * ./plugins/sdl/vout_sdl.c: support for 8 bpp displays.
  * ./plugins/x11/xcommon.c: support for 8 bpp displays.
  * ./src/video_output/video_output.c: fixed a segfault.
parent 279de2ef
......@@ -71,7 +71,7 @@ ac_help="$ac_help
ac_help="$ac_help
--disable-a52 AC3 support with liba52 (default enabled)"
ac_help="$ac_help
--enable-fb Linux framebuffer support (default disabled)"
--enable-fb Linux framebuffer support (default enabled on Linux)"
ac_help="$ac_help
--enable-mga Linux kernel Matrox support (default disabled)"
ac_help="$ac_help
......@@ -6463,7 +6463,7 @@ if test "${with_dvdcss+set}" = set; then
;;
xno)
# don't use libdvdcss at all, build a DVD module that can dlopen() it
BUILTINS="${BUILTINS} dvd"
PLUGINS="${PLUGINS} dvd"
DUMMY_LIBDVDCSS=1
SRC_DVD_EXTRA="${SRC_DVD_EXTRA} dummy_dvdcss.c"
CFLAGS_DVD="${CFLAGS_DVD} -DGOD_DAMN_DMCA"
......@@ -6492,7 +6492,7 @@ else
LIB_DVD="${LIB_DVD} lib/libdvdcss.a ${LIB_LIBDVDCSS}"
else
# XXX: no check for libdl is done, don't try this at home !
BUILTINS="${BUILTINS} dvd"
PLUGINS="${PLUGINS} dvd"
DUMMY_LIBDVDCSS=1
SRC_DVD_EXTRA="${SRC_DVD_EXTRA} dummy_dvdcss.c"
CFLAGS_DVD="${CFLAGS_DVD} -DGOD_DAMN_DMCA"
......@@ -6576,22 +6576,22 @@ if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
egrep "cdrom_msf0" >/dev/null 2>&1; then
rm -rf conftest*
BUILTINS="${BUILTINS} vcd"
PLUGINS="${PLUGINS} vcd"
fi
rm -f conftest*
fi
if test x$enable_vcd != xno -a "${SYS}" = "bsdi"
then
BUILTINS="${BUILTINS} vcd"
fi
if test "x${SYS}" = "xbsdi"
then
PLUGINS="${PLUGINS} vcd"
fi
if test x$enable_vcd != xno -a "${SYS}" = "darwin"
then
BUILTINS="${BUILTINS} vcd"
LIB_VCD="${LIB_VCD} -framework IOKit"
if test "x${SYS}" = "xdarwin"
then
PLUGINS="${PLUGINS} vcd"
LIB_VCD="${LIB_VCD} -framework IOKit"
fi
fi
# Check whether --enable-dummy or --disable-dummy was given.
......@@ -7135,12 +7135,54 @@ fi
# Check whether --enable-fb or --disable-fb was given.
if test "${enable_fb+set}" = set; then
enableval="$enable_fb"
if test x$enable_fb = xyes
:
fi
if test x$enable_fb != xno
then
PLUGINS="${PLUGINS} fb"
fi
for ac_hdr in linux/fb.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
echo "configure:7148: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 7153 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:7158: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
eval "ac_cv_header_$ac_safe=yes"
else
echo "$ac_err" >&5
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
eval "ac_cv_header_$ac_safe=no"
fi
rm -f conftest*
fi
if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
echo "$ac_t""yes" 1>&6
ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
cat >> confdefs.h <<EOF
#define $ac_tr_hdr 1
EOF
PLUGINS="${PLUGINS} fb"
else
echo "$ac_t""no" 1>&6
fi
done
fi
# Check whether --enable-mga or --disable-mga was given.
if test "${enable_mga+set}" = set; then
......@@ -7189,7 +7231,7 @@ fi
# Extract the first word of "sdl12-config", so it can be a program name with args.
set dummy sdl12-config; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:7193: checking for $ac_word" >&5
echo "configure:7235: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_path_SDL12_CONFIG'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
......@@ -7229,7 +7271,7 @@ fi
# Extract the first word of "sdl11-config", so it can be a program name with args.
set dummy sdl11-config; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:7233: checking for $ac_word" >&5
echo "configure:7275: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_path_SDL11_CONFIG'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
......@@ -7270,7 +7312,7 @@ fi
# Extract the first word of "sdl-config", so it can be a program name with args.
set dummy sdl-config; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:7274: checking for $ac_word" >&5
echo "configure:7316: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_path_SDL_CONFIG'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
......@@ -7316,17 +7358,17 @@ fi
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
echo "configure:7320: checking for $ac_hdr" >&5
echo "configure:7362: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 7325 "configure"
#line 7367 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:7330: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:7372: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
......@@ -7396,17 +7438,17 @@ fi
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
echo "configure:7400: checking for $ac_hdr" >&5
echo "configure:7442: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 7405 "configure"
#line 7447 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:7410: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:7452: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
......@@ -7435,7 +7477,7 @@ done
else
echo $ac_n "checking for directX headers in ${withval}""... $ac_c" 1>&6
echo "configure:7439: checking for directX headers in ${withval}" >&5
echo "configure:7481: checking for directX headers in ${withval}" >&5
if test -f ${withval}/ddraw.h
then
PLUGINS="${PLUGINS} directx"
......@@ -7544,7 +7586,7 @@ if test "${enable_gnome+set}" = set; then
# Extract the first word of "gnome-config", so it can be a program name with args.
set dummy gnome-config; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:7548: checking for $ac_word" >&5
echo "configure:7590: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_path_GNOME_CONFIG'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
......@@ -7589,17 +7631,17 @@ fi
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
echo "configure:7593: checking for $ac_hdr" >&5
echo "configure:7635: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 7598 "configure"
#line 7640 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:7603: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:7645: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
......@@ -7659,7 +7701,7 @@ fi
# Extract the first word of "gtk12-config", so it can be a program name with args.
set dummy gtk12-config; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:7663: checking for $ac_word" >&5
echo "configure:7705: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_path_GTK12_CONFIG'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
......@@ -7698,7 +7740,7 @@ fi
# Extract the first word of "gtk-config", so it can be a program name with args.
set dummy gtk-config; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:7702: checking for $ac_word" >&5
echo "configure:7744: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_path_GTK_CONFIG'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
......@@ -7748,17 +7790,17 @@ fi
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
echo "configure:7752: checking for $ac_hdr" >&5
echo "configure:7794: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 7757 "configure"
#line 7799 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:7762: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:7804: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
......@@ -7816,17 +7858,17 @@ if test x$enable_x11 != xno &&
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
echo "configure:7820: checking for $ac_hdr" >&5
echo "configure:7862: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 7825 "configure"
#line 7867 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:7830: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:7872: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
......@@ -7879,17 +7921,17 @@ if test x$enable_xvideo != xno &&
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
echo "configure:7883: checking for $ac_hdr" >&5
echo "configure:7925: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 7888 "configure"
#line 7930 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:7893: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:7935: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
......@@ -7913,7 +7955,7 @@ EOF
saved_CFLAGS=$CFLAGS
CFLAGS="$CFLAGS -L$x_libraries -lX11 -lXext"
echo $ac_n "checking for XvSetPortAttribute in -lXv_pic""... $ac_c" 1>&6
echo "configure:7917: checking for XvSetPortAttribute in -lXv_pic" >&5
echo "configure:7959: checking for XvSetPortAttribute in -lXv_pic" >&5
ac_lib_var=`echo Xv_pic'_'XvSetPortAttribute | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
......@@ -7921,7 +7963,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lXv_pic $LIBS"
cat > conftest.$ac_ext <<EOF
#line 7925 "configure"
#line 7967 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
......@@ -7932,7 +7974,7 @@ int main() {
XvSetPortAttribute()
; return 0; }
EOF
if { (eval echo configure:7936: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:7978: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
......@@ -7979,17 +8021,17 @@ if test x$enable_lirc = xyes
then
ac_safe=`echo "lirc/lirc_client.h" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for lirc/lirc_client.h""... $ac_c" 1>&6
echo "configure:7983: checking for lirc/lirc_client.h" >&5
echo "configure:8025: checking for lirc/lirc_client.h" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 7988 "configure"
#line 8030 "configure"
#include "confdefs.h"
#include <lirc/lirc_client.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:7993: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:8035: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
......@@ -8006,7 +8048,7 @@ fi
if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
echo "$ac_t""yes" 1>&6
echo $ac_n "checking for lirc_init in -llirc_client""... $ac_c" 1>&6
echo "configure:8010: checking for lirc_init in -llirc_client" >&5
echo "configure:8052: checking for lirc_init in -llirc_client" >&5
ac_lib_var=`echo lirc_client'_'lirc_init | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
......@@ -8014,7 +8056,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-llirc_client $LIBS"
cat > conftest.$ac_ext <<EOF
#line 8018 "configure"
#line 8060 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
......@@ -8025,7 +8067,7 @@ int main() {
lirc_init()
; return 0; }
EOF
if { (eval echo configure:8029: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:8071: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
......@@ -8065,17 +8107,17 @@ if test "${enable_alsa+set}" = set; then
then
ac_safe=`echo "alsa/asoundlib.h" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for alsa/asoundlib.h""... $ac_c" 1>&6
echo "configure:8069: checking for alsa/asoundlib.h" >&5
echo "configure:8111: checking for alsa/asoundlib.h" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 8074 "configure"
#line 8116 "configure"
#include "confdefs.h"
#include <alsa/asoundlib.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:8079: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:8121: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
......@@ -8092,7 +8134,7 @@ fi
if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
echo "$ac_t""yes" 1>&6
echo $ac_n "checking for main in -lasound""... $ac_c" 1>&6
echo "configure:8096: checking for main in -lasound" >&5
echo "configure:8138: checking for main in -lasound" >&5
ac_lib_var=`echo asound'_'main | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
......@@ -8100,14 +8142,14 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lasound $LIBS"
cat > conftest.$ac_ext <<EOF
#line 8104 "configure"
#line 8146 "configure"
#include "confdefs.h"
int main() {
main()
; return 0; }
EOF
if { (eval echo configure:8111: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:8153: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
......
......@@ -1111,11 +1111,13 @@ dnl
dnl Linux framebuffer module
dnl
AC_ARG_ENABLE(fb,
[ --enable-fb Linux framebuffer support (default disabled)],
[ if test x$enable_fb = xyes
[ --enable-fb Linux framebuffer support (default enabled on Linux)])
if test x$enable_fb != xno
then
PLUGINS="${PLUGINS} fb"
fi ])
AC_CHECK_HEADERS(linux/fb.h, [
PLUGINS="${PLUGINS} fb"
])
fi
dnl
dnl Linux MGA module
......
......@@ -238,6 +238,9 @@
/* Define if you have the <linux/cdrom.h> header file. */
#undef HAVE_LINUX_CDROM_H
/* Define if you have the <linux/fb.h> header file. */
#undef HAVE_LINUX_FB_H
/* Define if you have the <locale.h> header file. */
#undef HAVE_LOCALE_H
......
......@@ -4,7 +4,7 @@
* includes all common video types and constants.
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: video.h,v 1.46 2002/03/16 23:03:19 sam Exp $
* $Id: video.h,v 1.47 2002/03/17 17:00:38 sam Exp $
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
*
......@@ -103,13 +103,16 @@ typedef struct picture_heap_s
u32 i_chroma; /* picture chroma */
int i_aspect; /* aspect ratio */
/* Variables used for RGB planes */
/* Real pictures */
picture_t* pp_picture[VOUT_MAX_PICTURES]; /* pictures */
/* Stuff used for truecolor RGB planes */
int i_rmask, i_rrshift, i_lrshift;
int i_gmask, i_rgshift, i_lgshift;
int i_bmask, i_rbshift, i_lbshift;
/* Real pictures */
picture_t* pp_picture[VOUT_MAX_PICTURES]; /* pictures */
/* Stuff used for palettized RGB planes */
void (* pf_setpalette) ( struct vout_thread_s *, u16 *, u16 *, u16 * );
} picture_heap_t;
......@@ -143,7 +146,7 @@ typedef struct picture_heap_s
/* Packed RGB formats */
#define FOURCC_BI_RGB 0x00000000 /* RGB for 8bpp */
#define FOURCC_RGB 0x32424752 /* alias for BI_RGB */
#define FOURCC_RGB2 0x32424752 /* alias for BI_RGB */
#define FOURCC_BI_BITFIELDS 0x00000003 /* RGB, for 16, 24, 32bpp */
#define FOURCC_RV15 0x35315652 /* RGB 15bpp, 0x1f, 0x7e0, 0xf800 */
#define FOURCC_RV16 0x36315652 /* RGB 16bpp, 0x1f, 0x3e0, 0x7c00 */
......
......@@ -2,7 +2,7 @@
* i420_rgb.c : YUV to bitmap RGB conversion module for vlc
*****************************************************************************
* Copyright (C) 2000, 2001 VideoLAN
* $Id: i420_rgb.c,v 1.6 2002/03/16 23:03:19 sam Exp $
* $Id: i420_rgb.c,v 1.7 2002/03/17 17:00:38 sam Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
......@@ -44,12 +44,13 @@
*****************************************************************************/
static void chroma_getfunctions ( function_list_t * p_function_list );
static int chroma_Init ( vout_thread_t *p_vout );
static void chroma_End ( vout_thread_t *p_vout );
static int chroma_Init ( vout_thread_t * );
static void chroma_End ( vout_thread_t * );
#if defined (MODULE_NAME_IS_chroma_i420_rgb)
static void SetGammaTable ( int *pi_table, double f_gamma );
static void SetYUV ( vout_thread_t *p_vout );
static void SetYUV ( vout_thread_t * );
static void Set8bppPalette ( vout_thread_t *, u8 * );
#endif
/*****************************************************************************
......@@ -110,7 +111,7 @@ static int chroma_Init( vout_thread_t *p_vout )
switch( p_vout->output.i_chroma )
{
#if defined (MODULE_NAME_IS_chroma_i420_rgb)
case FOURCC_RGB:
case FOURCC_RGB2:
p_vout->chroma.pf_convert = _M( I420_RGB8 );
break;
#endif
......@@ -122,6 +123,7 @@ static int chroma_Init( vout_thread_t *p_vout )
p_vout->chroma.pf_convert = _M( I420_RGB16 );
break;
case FOURCC_RV24:
case FOURCC_RV32:
p_vout->chroma.pf_convert = _M( I420_RGB32 );
break;
......@@ -144,7 +146,7 @@ static int chroma_Init( vout_thread_t *p_vout )
switch( p_vout->output.i_chroma )
{
#if defined (MODULE_NAME_IS_chroma_i420_rgb)
case FOURCC_RGB:
case FOURCC_RGB2:
p_vout->chroma.p_sys->p_buffer = malloc( VOUT_MAX_WIDTH );
break;
#endif
......@@ -154,6 +156,7 @@ static int chroma_Init( vout_thread_t *p_vout )
p_vout->chroma.p_sys->p_buffer = malloc( VOUT_MAX_WIDTH * 2 );
break;
case FOURCC_RV24:
case FOURCC_RV32:
p_vout->chroma.p_sys->p_buffer = malloc( VOUT_MAX_WIDTH * 4 );
break;
......@@ -170,7 +173,8 @@ static int chroma_Init( vout_thread_t *p_vout )
}
p_vout->chroma.p_sys->p_offset = malloc( p_vout->output.i_width
* sizeof( int ) );
* ( ( p_vout->output.i_chroma == FOURCC_RGB2 ) ? 2 : 1 )
* sizeof( int ) );
if( p_vout->chroma.p_sys->p_offset == NULL )
{
free( p_vout->chroma.p_sys->p_buffer );
......@@ -181,7 +185,7 @@ static int chroma_Init( vout_thread_t *p_vout )
#if defined (MODULE_NAME_IS_chroma_i420_rgb)
switch( p_vout->output.i_chroma )
{
case FOURCC_RGB:
case FOURCC_RGB2:
i_tables_size = sizeof( u8 ) * PALETTE_TABLE_SIZE;
break;
case FOURCC_RV15:
......@@ -231,7 +235,7 @@ static void chroma_End( vout_thread_t *p_vout )
*****************************************************************************/
static void SetGammaTable( int *pi_table, double f_gamma )
{
int i_y; /* base intensity */
int i_y; /* base intensity */
/* Use exp(gamma) instead of gamma */
f_gamma = exp( f_gamma );
......@@ -257,175 +261,176 @@ static void SetYUV( vout_thread_t *p_vout )
/*
* Set pointers and build YUV tables
*/
/* Color: build red, green and blue tables */
switch( p_vout->output.i_chroma )
{
case FOURCC_RGB:
{
#define RGB_MIN 0
#define RGB_MAX 255
#define CLIP( x ) ( ((x < 0) ? 0 : (x > 255) ? 255 : x) << 8 )
int y,u,v;
int r,g,b;
int uvr, uvg, uvb;
int i = 0, j = 0;
u16 red[256], green[256], blue[256], transp[256];
unsigned char lookup[PALETTE_TABLE_SIZE];
p_vout->chroma.p_sys->yuv.p_rgb8 = (u8 *)p_vout->chroma.p_sys->p_base;
/* this loop calculates the intersection of an YUV box
* and the RGB cube. */
for ( y = 0; y <= 256; y += 16 )
{
for ( u = 0; u <= 256; u += 32 )
for ( v = 0; v <= 256; v += 32 )
{
uvr = (V_RED_COEF*(v-128)) >> SHIFT;
uvg = (U_GREEN_COEF*(u-128) + V_GREEN_COEF*(v-128)) >> SHIFT;
uvb = (U_BLUE_COEF*(u-128)) >> SHIFT;
r = y + uvr;
g = y + uvg;
b = y + uvb;
if( r >= RGB_MIN && g >= RGB_MIN && b >= RGB_MIN
&& r <= RGB_MAX && g <= RGB_MAX && b <= RGB_MAX )
{
/* this one should never happen unless someone fscked up my code */
if(j == 256) { intf_ErrMsg( "vout error: no colors left to build palette" ); break; }
/* clip the colors */
red[j] = CLIP( r );
green[j] = CLIP( g );
blue[j] = CLIP( b );
transp[j] = 0;
/* allocate color */
lookup[i] = 1;
p_vout->chroma.p_sys->yuv.p_rgb8[i++] = j;
j++;
}
else
{
lookup[i] = 0;
p_vout->chroma.p_sys->yuv.p_rgb8[i++] = 0;
}
}
i += 128-81;
}
/* the colors have been allocated, we can set the palette */
/* there will eventually be a way to know which colors
* couldn't be allocated and try to find a replacement */
#if 0
p_vout->pf_setpalette( p_vout, red, green, blue, transp );
p_vout->i_white_pixel = 0xff;
p_vout->i_black_pixel = 0x00;
p_vout->i_gray_pixel = 0x44;
p_vout->i_blue_pixel = 0x3b;
#endif
i = 0;
/* this loop allocates colors that got outside
* the RGB cube */
for ( y = 0; y <= 256; y += 16 )