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"
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
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"
fi
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
AC_CHECK_HEADERS(linux/fb.h, [
PLUGINS="${PLUGINS} fb"
fi ])
])
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,6 +173,7 @@ static int chroma_Init( vout_thread_t *p_vout )
}
p_vout->chroma.p_sys->p_offset = malloc( p_vout->output.i_width
* ( ( p_vout->output.i_chroma == FOURCC_RGB2 ) ? 2 : 1 )
* sizeof( int ) );
if( p_vout->chroma.p_sys->p_offset == NULL )
{
......@@ -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:
......@@ -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:
case FOURCC_RGB2:
p_vout->chroma.p_sys->p_rgb8 = (u8 *)p_vout->chroma.p_sys->p_base;
Set8bppPalette( p_vout, p_vout->chroma.p_sys->p_rgb8 );
break;
case FOURCC_RV15:
case FOURCC_RV16:
p_vout->chroma.p_sys->p_rgb16 = (u16 *)p_vout->chroma.p_sys->p_base;
for( i_index = 0; i_index < RED_MARGIN; i_index++ )
{
p_vout->chroma.p_sys->p_rgb16[RED_OFFSET - RED_MARGIN + i_index] = RGB2PIXEL( p_vout, pi_gamma[0], 0, 0 );
p_vout->chroma.p_sys->p_rgb16[RED_OFFSET + 256 + i_index] = RGB2PIXEL( p_vout, pi_gamma[255], 0, 0 );
}
for( i_index = 0; i_index < GREEN_MARGIN; i_index++ )
{
#define RGB_MIN 0
#define RGB_MAX 255
p_vout->chroma.p_sys->p_rgb16[GREEN_OFFSET - GREEN_MARGIN + i_index] = RGB2PIXEL( p_vout, 0, pi_gamma[0], 0 );
p_vout->chroma.p_sys->p_rgb16[GREEN_OFFSET + 256 + i_index] = RGB2PIXEL( p_vout, 0, pi_gamma[255], 0 );
}
for( i_index = 0; i_index < BLUE_MARGIN; i_index++ )
{
p_vout->chroma.p_sys->p_rgb16[BLUE_OFFSET - BLUE_MARGIN + i_index] = RGB2PIXEL( p_vout, 0, 0, pi_gamma[0] );
p_vout->chroma.p_sys->p_rgb16[BLUE_OFFSET + BLUE_MARGIN + i_index] = RGB2PIXEL( p_vout, 0, 0, pi_gamma[255] );
}
for( i_index = 0; i_index < 256; i_index++ )
{
p_vout->chroma.p_sys->p_rgb16[RED_OFFSET + i_index] = RGB2PIXEL( p_vout, pi_gamma[ i_index ], 0, 0 );
p_vout->chroma.p_sys->p_rgb16[GREEN_OFFSET + i_index] = RGB2PIXEL( p_vout, 0, pi_gamma[ i_index ], 0 );
p_vout->chroma.p_sys->p_rgb16[BLUE_OFFSET + i_index] = RGB2PIXEL( p_vout, 0, 0, pi_gamma[ i_index ] );
}
break;
case FOURCC_RV24:
case FOURCC_RV32:
p_vout->chroma.p_sys->p_rgb32 = (u32 *)p_vout->chroma.p_sys->p_base;
for( i_index = 0; i_index < RED_MARGIN; i_index++ )
{
p_vout->chroma.p_sys->p_rgb32[RED_OFFSET - RED_MARGIN + i_index] = RGB2PIXEL( p_vout, pi_gamma[0], 0, 0 );
p_vout->chroma.p_sys->p_rgb32[RED_OFFSET + 256 + i_index] = RGB2PIXEL( p_vout, pi_gamma[255], 0, 0 );
}
for( i_index = 0; i_index < GREEN_MARGIN; i_index++ )
{
p_vout->chroma.p_sys->p_rgb32[GREEN_OFFSET - GREEN_MARGIN + i_index] = RGB2PIXEL( p_vout, 0, pi_gamma[0], 0 );
p_vout->chroma.p_sys->p_rgb32[GREEN_OFFSET + 256 + i_index] = RGB2PIXEL( p_vout, 0, pi_gamma[255], 0 );
}
for( i_index = 0; i_index < BLUE_MARGIN; i_index++ )
{
p_vout->chroma.p_sys->p_rgb32[BLUE_OFFSET - BLUE_MARGIN + i_index] = RGB2PIXEL( p_vout, 0, 0, pi_gamma[0] );
p_vout->chroma.p_sys->p_rgb32[BLUE_OFFSET + BLUE_MARGIN + i_index] = RGB2PIXEL( p_vout, 0, 0, pi_gamma[255] );
}
for( i_index = 0; i_index < 256; i_index++ )
{
p_vout->chroma.p_sys->p_rgb32[RED_OFFSET + i_index] = RGB2PIXEL( p_vout, pi_gamma[ i_index ], 0, 0 );
p_vout->chroma.p_sys->p_rgb32[GREEN_OFFSET + i_index] = RGB2PIXEL( p_vout, 0, pi_gamma[ i_index ], 0 );
p_vout->chroma.p_sys->p_rgb32[BLUE_OFFSET + i_index] = RGB2PIXEL( p_vout, 0, 0, pi_gamma[ i_index ] );
}
break;
}
}
static void Set8bppPalette( vout_thread_t *p_vout, u8 *p_rgb8 )
{
#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;
u16 red[ 256 ], green[ 256 ], blue[ 256 ];
unsigned char p_lookup[PALETTE_TABLE_SIZE];
/* this loop calculates the intersection of an YUV box
* and the RGB cube. */
for ( y = 0; y <= 256; y += 16 )
/* This loop calculates the intersection of an YUV box and the RGB cube. */
for ( y = 0; y <= 256; y += 16, i += 128 - 81 )
{
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;
r = y + ( (V_RED_COEF*(v-128)) >> SHIFT );
g = y + ( (U_GREEN_COEF*(u-128)
+ V_GREEN_COEF*(v-128)) >> SHIFT );
b = y + ( (U_BLUE_COEF*(u-128)) >> SHIFT );
if( r >= RGB_MIN && g >= RGB_MIN && b >= RGB_MIN
&& r <= RGB_MAX && g <= RGB_MAX && b <= RGB_MAX )
if( r >= 0x00 && g >= 0x00 && b >= 0x00
&& r <= 0xff && g <= 0xff && b <= 0xff )
{
/* This one should never happen unless someone
* fscked up my code */
if( j == 256 )
{
/* 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; }
intf_ErrMsg( "vout error: no colors left in palette" );
break;
}
/* clip the colors */
red[j] = CLIP( r );
green[j] = CLIP( g );
blue[j] = CLIP( b );
transp[j] = 0;
/* Clip the colors */
red[ j ] = CLIP( r );
green[ j ] = CLIP( g );
blue[ j ] = CLIP( b );
/* allocate color */
lookup[i] = 1;
p_vout->chroma.p_sys->yuv.p_rgb8[i++] = j;
/* Allocate color */
p_lookup[ i ] = 1;
p_rgb8[ i++ ] = j;
j++;
}
else
{
lookup[i] = 0;
p_vout->chroma.p_sys->yuv.p_rgb8[i++] = 0;
p_lookup[ i ] = 0;
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 );
/* The colors have been allocated, we can set the palette */
p_vout->output.pf_setpalette( p_vout, red, green, blue );
#if 0
/* There will eventually be a way to know which colors
* couldn't be allocated and try to find a replacement */
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 )
/* This loop allocates colors that got outside the RGB cube */
for ( i = 0, y = 0; y <= 256; y += 16, i += 128 - 81 )
{
for ( u = 0; u <= 256; u += 32 )
for ( v = 0; v <= 256; v += 32 )
{
int u2, v2;
int dist, mindist = 100000000;
for ( v = 0; v <= 256; v += 32, i++ )
{
int u2, v2, dist, mindist = 100000000;
if( lookup[i] || y==0)
if( p_lookup[ i ] || y == 0 )
{
i++;
continue;
}
/* heavy. yeah. */
/* Heavy. yeah. */
for( u2 = 0; u2 <= 256; u2 += 32 )
{
for( v2 = 0; v2 <= 256; v2 += 32 )
{
j = ((y>>4)<<7) + (u2>>5)*9 + (v2>>5);
dist = (u-u2)*(u-u2) + (v-v2)*(v-v2);
if( lookup[j] )
/* find the nearest color */
if( dist < mindist )
/* Find the nearest color */
if( p_lookup[ j ] && dist < mindist )
{
p_vout->chroma.p_sys->yuv.p_rgb8[i] = p_vout->chroma.p_sys->yuv.p_rgb8[j];
p_rgb8[ i ] = p_rgb8[ j ];
mindist = dist;
}
j -= 128;
if( lookup[j] )
/* find the nearest color */
if( dist + 128 < mindist )
{
p_vout->chroma.p_sys->yuv.p_rgb8[i] = p_vout->chroma.p_sys->yuv.p_rgb8[j];
mindist = dist + 128;
}
}
i++;
}
i += 128-81;
}
}
break;
j -= 128;
case FOURCC_RV15:
case FOURCC_RV16:
p_vout->chroma.p_sys->yuv.p_rgb16 = (u16 *)p_vout->chroma.p_sys->p_base;
for( i_index = 0; i_index < RED_MARGIN; i_index++ )
/* Find the nearest color */
if( p_lookup[ j ] && dist + 128 < mindist )
{
p_vout->chroma.p_sys->yuv.p_rgb16[RED_OFFSET - RED_MARGIN + i_index] = RGB2PIXEL( p_vout, pi_gamma[0], 0, 0 );
p_vout->chroma.p_sys->yuv.p_rgb16[RED_OFFSET + 256 + i_index] = RGB2PIXEL( p_vout, pi_gamma[255], 0, 0 );
}
for( i_index = 0; i_index < GREEN_MARGIN; i_index++ )
{
p_vout->chroma.p_sys->yuv.p_rgb16[GREEN_OFFSET - GREEN_MARGIN + i_index] = RGB2PIXEL( p_vout, 0, pi_gamma[0], 0 );
p_vout->chroma.p_sys->yuv.p_rgb16[GREEN_OFFSET + 256 + i_index] = RGB2PIXEL( p_vout, 0, pi_gamma[255], 0 );
}
for( i_index = 0; i_index < BLUE_MARGIN; i_index++ )
{
p_vout->chroma.p_sys->yuv.p_rgb16[BLUE_OFFSET - BLUE_MARGIN + i_index] = RGB2PIXEL( p_vout, 0, 0, pi_gamma[0] );
p_vout->chroma.p_sys->yuv.p_rgb16[BLUE_OFFSET + BLUE_MARGIN + i_index] = RGB2PIXEL( p_vout, 0, 0, pi_gamma[255] );
}
for( i_index = 0; i_index < 256; i_index++ )
{
p_vout->chroma.p_sys->yuv.p_rgb16[RED_OFFSET + i_index] = RGB2PIXEL( p_vout, pi_gamma[ i_index ], 0, 0 );
p_vout->chroma.p_sys->yuv.p_rgb16[GREEN_OFFSET + i_index] = RGB2PIXEL( p_vout, 0, pi_gamma[ i_index ], 0 );
p_vout->chroma.p_sys->yuv.p_rgb16[BLUE_OFFSET + i_index] = RGB2PIXEL( p_vout, 0, 0, pi_gamma[ i_index ] );
p_rgb8[ i ] = p_rgb8[ j ];
mindist = dist + 128;
}
break;
case FOURCC_RV24:
case FOURCC_RV32:
p_vout->chroma.p_sys->yuv.p_rgb32 = (u32 *)p_vout->chroma.p_sys->p_base;
for( i_index = 0; i_index < RED_MARGIN; i_index++ )
{
p_vout->chroma.p_sys->yuv.p_rgb32[RED_OFFSET - RED_MARGIN + i_index] = RGB2PIXEL( p_vout, pi_gamma[0], 0, 0 );
p_vout->chroma.p_sys->yuv.p_rgb32[RED_OFFSET + 256 + i_index] = RGB2PIXEL( p_vout, pi_gamma[255], 0, 0 );
}
for( i_index = 0; i_index < GREEN_MARGIN; i_index++ )
{
p_vout->chroma.p_sys->yuv.p_rgb32[GREEN_OFFSET - GREEN_MARGIN + i_index] = RGB2PIXEL( p_vout, 0, pi_gamma[0], 0 );
p_vout->chroma.p_sys->yuv.p_rgb32[GREEN_OFFSET + 256 + i_index] = RGB2PIXEL( p_vout, 0, pi_gamma[255], 0 );
}
for( i_index = 0; i_index < BLUE_MARGIN; i_index++ )
{
p_vout->chroma.p_sys->yuv.p_rgb32[BLUE_OFFSET - BLUE_MARGIN + i_index] = RGB2PIXEL( p_vout, 0, 0, pi_gamma[0] );
p_vout->chroma.p_sys->yuv.p_rgb32[BLUE_OFFSET + BLUE_MARGIN + i_index] = RGB2PIXEL( p_vout, 0, 0, pi_gamma[255] );
}
for( i_index = 0; i_index < 256; i_index++ )
{
p_vout->chroma.p_sys->yuv.p_rgb32[RED_OFFSET + i_index] = RGB2PIXEL( p_vout, pi_gamma[ i_index ], 0, 0 );
p_vout->chroma.p_sys->yuv.p_rgb32[GREEN_OFFSET + i_index] = RGB2PIXEL( p_vout, 0, pi_gamma[ i_index ], 0 );
p_vout->chroma.p_sys->yuv.p_rgb32[BLUE_OFFSET + i_index] = RGB2PIXEL( p_vout, 0, 0, pi_gamma[ i_index ] );
}
break;
}
}
#endif
......@@ -2,7 +2,7 @@
* i420_rgb.h : YUV to bitmap RGB conversion module for vlc
*****************************************************************************
* Copyright (C) 2000 VideoLAN
* $Id: i420_rgb.h,v 1.4 2002/03/16 23:03:19 sam Exp $
* $Id: i420_rgb.h,v 1.5 2002/03/17 17:00:38 sam Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
......@@ -34,13 +34,10 @@ typedef struct chroma_sys_s
#ifdef MODULE_NAME_IS_chroma_i420_rgb
/* Pre-calculated conversion tables */
void * p_base; /* base for all conversion tables */
union
{
u8 * p_rgb8; /* RGB 8 bits table */
u16 * p_rgb16; /* RGB 16 bits table */
u32 * p_rgb32; /* RGB 32 bits table */
} yuv;
void *p_base; /* base for all conversion tables */
u8 *p_rgb8; /* RGB 8 bits table */
u16 *p_rgb16; /* RGB 16 bits table */
u32 *p_rgb32; /* RGB 32 bits table */
#endif
} chroma_sys_t;
......
......@@ -2,7 +2,7 @@
* i420_rgb16.c : YUV to bitmap RGB conversion module for vlc
*****************************************************************************
* Copyright (C) 2000 VideoLAN
* $Id: i420_rgb16.c,v 1.4 2002/03/16 23:03:19 sam Exp $
* $Id: i420_rgb16.c,v 1.5 2002/03/17 17:00:38 sam Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
......@@ -73,7 +73,7 @@ void _M( I420_RGB15 )( vout_thread_t *p_vout, picture_t *p_src,
#if defined (MODULE_NAME_IS_chroma_i420_rgb)
int i_uval, i_vval; /* U and V samples */
int i_red, i_green, i_blue; /* U and V modified samples */
u16 * p_yuv = p_vout->chroma.p_sys->yuv.p_rgb16;
u16 * p_yuv = p_vout->chroma.p_sys->p_rgb16;
u16 * p_ybase; /* Y dependant conversion table */
#endif
......@@ -208,7 +208,7 @@ void _M( I420_RGB16 )( vout_thread_t *p_vout, picture_t *p_src,
#if defined (MODULE_NAME_IS_chroma_i420_rgb)
int i_uval, i_vval; /* U and V samples */
int i_red, i_green, i_blue; /* U and V modified samples */
u16 * p_yuv = p_vout->chroma.p_sys->yuv.p_rgb16;
u16 * p_yuv = p_vout->chroma.p_sys->p_rgb16;
u16 * p_ybase; /* Y dependant conversion table */
#endif
......@@ -340,6 +340,12 @@ void _M( I420_RGB32 )( vout_thread_t *p_vout, picture_t *p_src,
int i_scale_count; /* scale modulo counter */
int i_chroma_width = p_vout->render.i_width / 2; /* chroma width */
u32 * p_pic_start; /* beginning of the current line for copy */
#if defined (MODULE_NAME_IS_chroma_i420_rgb)
int i_uval, i_vval; /* U and V samples */
int i_red, i_green, i_blue; /* U and V modified samples */
u32 * p_yuv = p_vout->chroma.p_sys->p_rgb32;
u32 * p_ybase; /* Y dependant conversion table */
#endif
/* Conversion buffer pointer */
u32 * p_buffer_start = (u32*)p_vout->chroma.p_sys->p_buffer;
......@@ -374,11 +380,6 @@ void _M( I420_RGB32 )( vout_thread_t *p_vout, picture_t *p_src,
p_vout->output.i_width, p_vout->output.i_height,
&b_hscale, &i_vscale, p_offset_start );
#if defined (MODULE_NAME_IS_chroma_i420_rgb)
intf_ErrMsg( "vout error: I420_RGB32 unimplemented, "
"please harass sam@zoy.org" );
#endif
/*
* Perform conversion
*/
......@@ -392,7 +393,10 @@ void _M( I420_RGB32 )( vout_thread_t *p_vout, picture_t *p_src,
for ( i_x = p_vout->render.i_width / 8; i_x--; )
{
#if defined (MODULE_NAME_IS_chroma_i420_rgb)
/* FIXME: TODO */
CONVERT_YUV_PIXEL(4); CONVERT_Y_PIXEL(4);
CONVERT_YUV_PIXEL(4); CONVERT_Y_PIXEL(4);
CONVERT_YUV_PIXEL(4); CONVERT_Y_PIXEL(4);
CONVERT_YUV_PIXEL(4); CONVERT_Y_PIXEL(4);
#elif defined (MODULE_NAME_IS_chroma_i420_rgb_mmx)
__asm__( MMX_INIT_32
: : "r" (p_y), "r" (p_u), "r" (p_v), "r" (p_buffer) );
......@@ -419,7 +423,10 @@ void _M( I420_RGB32 )( vout_thread_t *p_vout, picture_t *p_src,
p_v -= i_rewind >> 1;
p_buffer -= i_rewind;
#if defined (MODULE_NAME_IS_chroma_i420_rgb)
/* FIXME: TODO */
CONVERT_YUV_PIXEL(4); CONVERT_Y_PIXEL(4);
CONVERT_YUV_PIXEL(4); CONVERT_Y_PIXEL(4);
CONVERT_YUV_PIXEL(4); CONVERT_Y_PIXEL(4);
CONVERT_YUV_PIXEL(4); CONVERT_Y_PIXEL(4);
#elif defined (MODULE_NAME_IS_chroma_i420_rgb_mmx)
__asm__( MMX_INIT_32
: : "r" (p_y), "r" (p_u), "r" (p_v), "r" (p_buffer) );
......
......@@ -2,7 +2,7 @@
* i420_rgb8.c : YUV to bitmap RGB conversion module for vlc
*****************************************************************************
* Copyright (C) 2000 VideoLAN
* $Id: i420_rgb8.c,v 1.2 2002/01/12 01:25:57 sam Exp $
* $Id: i420_rgb8.c,v 1.3 2002/03/17 17:00:38 sam Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
......@@ -42,43 +42,66 @@ static void SetOffset( int, int, int, int, boolean_t *, int *, int * );
/*****************************************************************************
* I420_RGB8: color YUV 4:2:0 to RGB 8 bpp
*****************************************************************************/
void _M( I420_RGB8 )( vout_thread_t *p_vout, picture_t *p_source,
void _M( I420_RGB8 )( vout_thread_t *p_vout, picture_t *p_src,
picture_t *p_dest )
{
/* We got this one from the old arguments */
u16 *p_pic = (u16*)p_dest->p->p_pixels;
u8 *p_y = p_source->Y_PIXELS;
u8 *p_u = p_source->U_PIXELS, *p_v = p_source->V_PIXELS;
/* FIXME: add margins here */
int i_pic_line_width = p_dest->p->i_pitch / 2;
u8 *p_pic = (u8*)p_dest->p->p_pixels;
u8 *p_y = p_src->Y_PIXELS;
u8 *p_u = p_src->U_PIXELS;
u8 *p_v = p_src->V_PIXELS;
boolean_t b_hscale; /* horizontal scaling type */
int i_vscale; /* vertical scaling type */
int i_x, i_y; /* horizontal and vertical indexes */
int i_real_y; /* y % 4 */
int i_right_margin;
int i_rewind;
int i_scale_count; /* scale modulo counter */
int i_chroma_width; /* chroma width */
u16 * p_pic_start; /* beginning of the current line for copy */
u16 * p_buffer_start; /* conversion buffer start */
u16 * p_buffer; /* conversion buffer pointer */
int * p_offset_start; /* offset array start */
int * p_offset; /* offset array pointer */
int i_chroma_width = p_vout->render.i_width / 2; /* chroma width */
/* Lookup table */
u8 * p_lookup = p_vout->chroma.p_sys->p_base;
/* Offset array pointer */
int * p_offset_start = p_vout->chroma.p_sys->p_offset;
int * p_offset;
/* The dithering matrices */
static int dither10[4] = { 0x0, 0x8, 0x2, 0xa };
static int dither11[4] = { 0xc, 0x4, 0xe, 0x6 };
static int dither12[4] = { 0x3, 0xb, 0x1, 0x9 };
static int dither13[4] = { 0xf, 0x7, 0xd, 0x5 };
static int dither20[4] = { 0x0, 0x10, 0x4, 0x14 };
static int dither21[4] = { 0x18, 0x8, 0x1c, 0xc };
static int dither22[4] = { 0x6, 0x16, 0x2, 0x12 };
static int dither23[4] = { 0x1e, 0xe, 0x1a, 0xa };
/*
* Initialize some values - i_pic_line_width will store the line skip
*/
i_pic_line_width -= p_vout->output.i_width;
i_chroma_width = p_vout->render.i_width / 2;
p_buffer_start = (u16*)p_vout->chroma.p_sys->p_buffer;
p_offset_start = p_vout->chroma.p_sys->p_offset;
SetOffset( p_vout->render.i_width, p_vout->render.i_height,
p_vout->output.i_width, p_vout->output.i_height,
&b_hscale, &i_vscale, p_offset_start );
/* FIXME */
#warning "Please ignore the following warnings, I already know about them"
intf_ErrMsg( "vout error: I420_RGB8 unimplemented, "
"please harass sam@zoy.org" );
if( p_dest->p->b_margin )
{
i_right_margin = (p_dest->p->i_pitch - p_dest->p->i_visible_bytes);
}
else
{
i_right_margin = 0;
}
/*
* Perform conversion
*/
i_scale_count = ( i_vscale == 1 ) ?
p_vout->output.i_height : p_vout->render.i_height;
for( i_y = 0, i_real_y = 0; i_y < p_vout->render.i_height; i_y++ )
{
/* Do horizontal and vertical scaling */
SCALE_WIDTH_DITHER( 420 );
SCALE_HEIGHT_DITHER( 420 );
}
}
/* Following functions are local */
......
......@@ -2,7 +2,7 @@
* vout_directx.c: Windows DirectX video output display method
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: vout_directx.c,v 1.25 2002/03/16 23:03:19 sam Exp $
* $Id: vout_directx.c,v 1.26 2002/03/17 17:00:38 sam Exp $
*
* Authors: Gildas Bazin <gbazin@netcourrier.com>
*
......@@ -963,15 +963,15 @@ static int NewPictureVec( vout_thread_t *p_vout, picture_t *p_pic,
switch( )
{
case 8: /* FIXME: set the palette */
p_vout->output.i_chroma = FOURCC_BI_RGB; break;
p_vout->output.i_chroma = FOURCC_RGB2; break;
case 15:
p_vout->output.i_chroma = FOURCC_RV15; break;
case 16:
p_vout->output.i_chroma = FOURCC_RV16; break;
case 24:
p_vout->output.i_chroma = FOURCC_BI_BITFIELDS; break;
p_vout->output.i_chroma = FOURCC_RV24; break;
case 32:
p_vout->output.i_chroma = FOURCC_BI_BITFIELDS; break;
p_vout->output.i_chroma = FOURCC_RV32; break;
default:
intf_ErrMsg( "vout error: unknown screen depth" );
return( 0 );
......
......@@ -2,7 +2,7 @@
* fb.c : framebuffer plugin for vlc
*****************************************************************************
* Copyright (C) 2000, 2001 VideoLAN
* $Id: fb.c,v 1.15 2002/03/16 23:03:19 sam Exp $
* $Id: fb.c,v 1.16 2002/03/17 17:00:38 sam Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
......@@ -261,15 +261,15 @@ static int vout_Init( vout_thread_t *p_vout )
switch( p_vout->p_sys->var_info.bits_per_pixel )
{
case 8: /* FIXME: set the palette */
p_vout->output.i_chroma = FOURCC_BI_RGB; break;
p_vout->output.i_chroma = FOURCC_RGB2; break;
case 15:
p_vout->output.i_chroma = FOURCC_RV15; break;
case 16:
p_vout->output.i_chroma = FOURCC_RV16; break;
case 24:
p_vout->output.i_chroma = FOURCC_BI_BITFIELDS; break;
p_vout->output.i_chroma = FOURCC_RV24; break;
case 32:
p_vout->output.i_chroma = FOURCC_BI_BITFIELDS; break;
p_vout->output.i_chroma = FOURCC_RV32; break;
default:
intf_ErrMsg( "vout error: unknown screen depth" );
return 0;
......
......@@ -2,7 +2,7 @@
* ggi.c : GGI plugin for vlc
*****************************************************************************
* Copyright (C) 2000, 2001 VideoLAN
* $Id: ggi.c,v 1.17 2002/03/16 23:03:19 sam Exp $
* $Id: ggi.c,v 1.18 2002/03/17 17:00:38 sam Exp $
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org>
......@@ -54,6 +54,7 @@ static void vout_Display ( vout_thread_t *, picture_t * );
static int OpenDisplay ( vout_thread_t * );
static void CloseDisplay ( vout_thread_t * );
static void SetPalette ( vout_thread_t *, u16 *, u16 *, u16 * );
/*****************************************************************************
* Building configuration tree
......@@ -145,6 +146,7 @@ int vout_Create( vout_thread_t *p_vout )
*****************************************************************************/
int vout_Init( vout_thread_t *p_vout )
{
#define p_b p_vout->p_sys->pp_buffer
int i_index;
picture_t *p_pic;
......@@ -158,16 +160,18 @@ int vout_Init( vout_thread_t *p_vout )
switch( p_vout->p_sys->i_bits_per_pixel )
{
case 8: /* FIXME: set the palette */
p_vout->output.i_chroma = FOURCC_BI_RGB; break;
case 8:
p_vout->output.i_chroma = FOURCC_RGB2;
p_vout->output.pf_setpalette = SetPalette;
break;
case 15:
p_vout->output.i_chroma = FOURCC_RV15; break;
case 16:
p_vout->output.i_chroma = FOURCC_RV16; break;
case 24:
p_vout->output.i_chroma = FOURCC_BI_BITFIELDS; break;
p_vout->output.i_chroma = FOURCC_RV24; break;
case 32:
p_vout->output.i_chroma = FOURCC_BI_BITFIELDS; break;
p_vout->output.i_chroma = FOURCC_RV32; break;
default:
intf_ErrMsg( "vout error: unknown screen depth" );
return 0;
......@@ -195,7 +199,6 @@ int vout_Init( vout_thread_t *p_vout )
return 0;
}
#define p_b p_vout->p_sys->pp_buffer
/* We know the chroma, allocate a buffer which will be used
* directly by the decoder */
p_vout->p_sys->i_index = 0;
......@@ -514,3 +517,28 @@ static void CloseDisplay( vout_thread_t *p_vout )
/* Exit library */
ggiExit();
}
/*****************************************************************************
* SetPalette: sets an 8 bpp palette
*****************************************************************************/
static void SetPalette( vout_thread_t *p_vout, u16 *red, u16 *green, u16 *blue )
{
ggi_color colors[256];
int i;
/* Fill colors with color information */
for( i = 0; i < 256; i++ )
{
colors[ i ].r = red[ i ];
colors[ i ].g = green[ i ];
colors[ i ].b = blue[ i ];
colors[ i ].a = 0;
}
/* Set palette */
if( ggiSetPalette( p_vout->p_sys->p_display, 0, 256, colors ) < 0 )
{
intf_ErrMsg( "vout error: failed setting palette" );
}
}
......@@ -2,7 +2,7 @@
* kde.cpp : KDE plugin for vlc
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: kde.cpp,v 1.8 2002/03/01 16:07:00 sam Exp $
* $Id: kde.cpp,v 1.9 2002/03/17 17:00:38 sam Exp $
*
* Authors: Andres Krapf <dae@chez.com> Sun Mar 25 2001
*
......@@ -52,7 +52,16 @@ MODULE_CONFIG_STOP
MODULE_INIT_START
SET_DESCRIPTION( "KDE interface module" )
ADD_CAPABILITY( INTF, 80 )
#ifndef WIN32
if( getenv( "DISPLAY" ) == NULL )
{
ADD_CAPABILITY( INTF, 8 )
}
else
#endif
{
ADD_CAPABILITY( INTF, 85 )
}
ADD_SHORTCUT( "kde" )
ADD_PROGRAM( "kvlc" )
MODULE_INIT_STOP
......
......@@ -2,7 +2,7 @@
* xmga.c : X11 MGA plugin for vlc
*****************************************************************************
* Copyright (C) 1998-2001 VideoLAN
* $Id: xmga.c,v 1.8 2002/03/17 13:53:21 gbazin Exp $
* $Id: xmga.c,v 1.9 2002/03/17 17:00:38 sam Exp $
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org>
......@@ -372,15 +372,15 @@ static int vout_Init( vout_thread_t *p_vout )
switch( p_vout->p_sys->i_screen_depth )
{
case 8: /* FIXME: set the palette */
p_vout->output.i_chroma = FOURCC_BI_RGB; break;
p_vout->output.i_chroma = FOURCC_RGB2; break;
case 15:
p_vout->output.i_chroma = FOURCC_RV15; break;
case 16:
p_vout->output.i_chroma = FOURCC_RV16; break;
case 24:
p_vout->output.i_chroma = FOURCC_BI_BITFIELDS; break;
p_vout->output.i_chroma = FOURCC_RV24; break;
case 32:
p_vout->output.i_chroma = FOURCC_BI_BITFIELDS; break;
p_vout->output.i_chroma = FOURCC_RV32; break;
default:
intf_ErrMsg( "vout error: unknown screen depth" );
return( 0 );
......
......@@ -2,7 +2,7 @@
* vpar_blocks.c : blocks parsing
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: vpar_blocks.c,v 1.6 2002/01/04 14:01:34 sam Exp $
* $Id: vpar_blocks.c,v 1.7 2002/03/17 17:00:38 sam Exp $
*
* Authors: Michel Lespinasse <walken@zoy.org>
* Aaron Holtzman <aholtzma@ess.engr.uvic.ca>
......@@ -535,7 +535,7 @@ coeff_2:
if( i_coeff >= 64 )
{
/* Illegal, but needed to avoid overflow */
intf_WarnMsg( 2, "MPEG2NonIntra coeff is out of bound" );
intf_WarnMsg( 2, "vpar warning: MPEG2NonIntra coeff is out of bound" );
p_vpar->picture.b_error = 1;
break;
}
......@@ -589,7 +589,7 @@ coeff_2:
}
}
intf_WarnMsg( 2, "MPEG2NonIntra coeff is out of bound" );
intf_WarnMsg( 2, "vpar warning: MPEG2NonIntra coeff is out of bound" );
p_vpar->picture.b_error = 1;
break;
}
......@@ -693,7 +693,7 @@ store_coeff:
if( i_coeff >= 64 )
{
/* Illegal, but needed to avoid overflow */
intf_WarnMsg( 2, "MPEG1Intra coeff is out of bound" );
intf_WarnMsg( 2, "vpar warning: MPEG1Intra coeff is out of bound" );
p_vpar->picture.b_error = 1;
break;
}
......@@ -755,7 +755,7 @@ store_coeff:
}
}
intf_WarnMsg( 2, "MPEG1Intra coeff is out of bound" );
intf_WarnMsg( 2, "vpar warning: MPEG1Intra coeff is out of bound" );
p_vpar->picture.b_error = 1;
break;
}
......@@ -848,7 +848,7 @@ coeff_2:
if( i_coeff >= 64 )
{
/* Illegal, but needed to avoid overflow */
intf_WarnMsg( 2, "MPEG1NonIntra coeff is out of bound" );
intf_WarnMsg( 2, "vpar warning: MPEG1NonIntra coeff is out of bound" );
p_vpar->picture.b_error = 1;
break;
}
......@@ -910,7 +910,7 @@ coeff_2:
}
}
intf_WarnMsg( 2, "MPEG1NonIntra coeff is out of bound" );
intf_WarnMsg( 2, "vpar warning: MPEG1NonIntra coeff is out of bound" );
p_vpar->picture.b_error = 1;
break;
}
......
......@@ -2,7 +2,7 @@
* vpar_headers.c : headers parsing
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: vpar_headers.c,v 1.16 2002/03/14 01:35:28 stef Exp $
* $Id: vpar_headers.c,v 1.17 2002/03/17 17:00:38 sam Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
* Stphane Borel <stef@via.ecp.fr>
......@@ -422,7 +422,8 @@ static void SequenceHeader( vpar_thread_t * p_vpar )
}
/* check whether the input gives a particular aspect ratio */
if( p_vpar->p_config->p_demux_data )
if( p_vpar->p_config->p_demux_data
&& *(int*)(p_vpar->p_config->p_demux_data) )
{
i_aspect = *(int*)(p_vpar->p_config->p_demux_data);
}
......
......@@ -2,7 +2,7 @@
* qt.cpp : Qt plugin for vlc
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: qt.cpp,v 1.8 2002/03/01 16:07:00 sam Exp $
* $Id: qt.cpp,v 1.9 2002/03/17 17:00:38 sam Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
......@@ -44,7 +44,16 @@ MODULE_CONFIG_STOP
MODULE_INIT_START
SET_DESCRIPTION( "Qt interface module" )
#ifndef WIN32
if( getenv( "DISPLAY" ) == NULL )
{
ADD_CAPABILITY( INTF, 7 )
}
else
#endif
{
ADD_CAPABILITY( INTF, 80 )
}
ADD_PROGRAM( "qvlc" )
ADD_SHORTCUT( "qt" )
MODULE_INIT_STOP
......
......@@ -2,7 +2,7 @@
* vout_sdl.c: SDL video output display method
*****************************************************************************
* Copyright (C) 1998-2001 VideoLAN
* $Id: vout_sdl.c,v 1.83 2002/03/16 23:03:19 sam Exp $
* $Id: vout_sdl.c,v 1.84 2002/03/17 17:00:38 sam Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
* Pierre Baillet <oct@zoy.org>
......@@ -125,9 +125,10 @@ static int vout_Manage ( struct vout_thread_s * );
static void vout_Render ( struct vout_thread_s *, struct picture_s * );
static void vout_Display ( struct vout_thread_s *, struct picture_s * );
static int SDLOpenDisplay ( vout_thread_t *p_vout );
static void SDLCloseDisplay ( vout_thread_t *p_vout );
static int SDLNewPicture ( vout_thread_t *p_vout, picture_t *p_pic );
static int OpenDisplay ( struct vout_thread_s * );
static void CloseDisplay ( struct vout_thread_s * );
static int NewPicture ( struct vout_thread_s *, struct picture_s * );
static void SetPalette ( struct vout_thread_s *, u16 *, u16 *, u16 * );
/*****************************************************************************
* Functions exported as capabilities. They are declared as static so that
......@@ -215,7 +216,7 @@ static int vout_Create( vout_thread_t *p_vout )
}
#endif
if( SDLOpenDisplay( p_vout ) )
if( OpenDisplay( p_vout ) )
{
intf_ErrMsg( "vout error: can't set up SDL (%s)", SDL_GetError() );
SDL_QuitSubSystem( SDL_INIT_VIDEO );
......@@ -275,7 +276,7 @@ static int vout_Init( vout_thread_t *p_vout )
}
/* Allocate the picture if we found one */
if( p_pic == NULL || SDLNewPicture( p_vout, p_pic ) )
if( p_pic == NULL || NewPicture( p_vout, p_pic ) )
{
break;
}
......@@ -326,7 +327,7 @@ static void vout_End( vout_thread_t *p_vout )
*****************************************************************************/
static void vout_Destroy( vout_thread_t *p_vout )
{
SDLCloseDisplay( p_vout );
CloseDisplay( p_vout );
SDL_QuitSubSystem( SDL_INIT_VIDEO );
......@@ -351,8 +352,8 @@ static int vout_Manage( vout_thread_t *p_vout )
case SDL_VIDEORESIZE: /* Resizing of window */
p_vout->p_sys->i_width = event.resize.w;
p_vout->p_sys->i_height = event.resize.h;
SDLCloseDisplay( p_vout );
SDLOpenDisplay( p_vout );
CloseDisplay( p_vout );
OpenDisplay( p_vout );
break;
case SDL_MOUSEMOTION:
......@@ -547,12 +548,12 @@ static void vout_Display( vout_thread_t *p_vout, picture_t *p_pic )
/* following functions are local */
/*****************************************************************************
* SDLOpenDisplay: open and initialize SDL device
* OpenDisplay: open and initialize SDL device
*****************************************************************************
* Open and initialize display according to preferences specified in the vout
* thread fields.
*****************************************************************************/
static int SDLOpenDisplay( vout_thread_t *p_vout )
static int OpenDisplay( vout_thread_t *p_vout )
{
Uint32 i_flags;
int i_bpp;
......@@ -607,7 +608,6 @@ static int SDLOpenDisplay( vout_thread_t *p_vout )
p_vout->p_sys->p_overlay =
SDL_CreateYUVOverlay( 32, 32, p_vout->output.i_chroma,
p_vout->p_sys->p_display );
/* FIXME: if the first overlay we find is software, don't stop,
* because we may find a hardware one later ... */
......@@ -645,7 +645,8 @@ static int SDLOpenDisplay( vout_thread_t *p_vout )
switch( p_vout->p_sys->p_display->format->BitsPerPixel )
{
case 8:
p_vout->output.i_chroma = FOURCC_RGB;
p_vout->output.i_chroma = FOURCC_RGB2;
p_vout->output.pf_setpalette = SetPalette;
break;
case 15:
p_vout->output.i_chroma = FOURCC_RV15;
......@@ -693,12 +694,12 @@ static int SDLOpenDisplay( vout_thread_t *p_vout )
}
/*****************************************************************************
* SDLCloseDisplay: close and reset SDL device
* CloseDisplay: close and reset SDL device
*****************************************************************************
* This function returns all resources allocated by SDLOpenDisplay and restore
* This function returns all resources allocated by OpenDisplay and restore
* the original state of the device.
*****************************************************************************/
static void SDLCloseDisplay( vout_thread_t *p_vout )
static void CloseDisplay( vout_thread_t *p_vout )
{
SDL_FreeYUVOverlay( p_vout->p_sys->p_overlay );
SDL_UnlockSurface ( p_vout->p_sys->p_display );
......@@ -706,11 +707,11 @@ static void SDLCloseDisplay( vout_thread_t *p_vout )
}
/*****************************************************************************
* SDLNewPicture: allocate a picture
* NewPicture: allocate a picture
*****************************************************************************
* Returns 0 on success, -1 otherwise
*****************************************************************************/
static int SDLNewPicture( vout_thread_t *p_vout, picture_t *p_pic )
static int NewPicture( vout_thread_t *p_vout, picture_t *p_pic )
{
int i_width = p_vout->output.i_width;
int i_height = p_vout->output.i_height;
......@@ -731,12 +732,29 @@ static int SDLNewPicture( vout_thread_t *p_vout, picture_t *p_pic )
return -1;
}
switch( p_vout->p_sys->p_display->format->BitsPerPixel )
{
case 8:
p_pic->p->i_pixel_bytes = 1;
break;
case 15:
case 16:
p_pic->p->i_pixel_bytes = 2;
break;
case 24:
case 32:
p_pic->p->i_pixel_bytes = 4;
break;
default:
return( -1 );
}
p_pic->p->p_pixels = p_vout->p_sys->p_display->pixels;
p_pic->p->i_lines = p_vout->p_sys->p_display->h;
p_pic->p->i_pitch = p_vout->p_sys->p_display->pitch;
p_pic->p->i_pixel_bytes = 2;
if( p_pic->p->i_pitch == 2 * p_vout->p_sys->p_display->w )
if( p_pic->p->i_pitch ==
p_pic->p->i_pixel_bytes * p_vout->p_sys->p_display->w )
{
p_pic->p->b_margin = 0;
}
......@@ -744,7 +762,8 @@ static int SDLNewPicture( vout_thread_t *p_vout, picture_t *p_pic )
{
p_pic->p->b_margin = 1;
p_pic->p->b_hidden = 1;
p_pic->p->i_visible_bytes = 2 * p_vout->p_sys->p_display->w;
p_pic->p->i_visible_bytes =
p_pic->p->i_pixel_bytes * p_vout->p_sys->p_display->w;
}
p_vout->p_sys->i_surfaces++;
......@@ -829,3 +848,26 @@ static int SDLNewPicture( vout_thread_t *p_vout, picture_t *p_pic )
return 0;
}
/*****************************************************************************
* SetPalette: sets an 8 bpp palette
*****************************************************************************/
static void SetPalette( vout_thread_t *p_vout, u16 *red, u16 *green, u16 *blue )
{
SDL_Color colors[256];
int i;
/* Fill colors with color information */
for( i = 0; i < 256; i++ )
{
colors[ i ].r = red[ i ] >> 8;
colors[ i ].g = green[ i ] >> 8;
colors[ i ].b = blue[ i ] >> 8;
}
/* Set palette */
if( SDL_SetColors( p_vout->p_sys->p_display, colors, 0, 256 ) == 0 )
{
intf_ErrMsg( "vout error: failed setting palette" );
}
}
......@@ -2,7 +2,7 @@
* xcommon.c: Functions common to the X11 and XVideo plugins
*****************************************************************************
* Copyright (C) 1998-2001 VideoLAN
* $Id: xcommon.c,v 1.23 2002/03/17 13:53:21 gbazin Exp $
* $Id: xcommon.c,v 1.24 2002/03/17 17:00:38 sam Exp $
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org>
......@@ -125,6 +125,10 @@ static int XVideoGetPort ( Display *, u32, u32 * );
static void XVideoReleasePort ( Display *, int );
#endif
#ifdef MODULE_NAME_IS_x11
static void SetPalette ( vout_thread_t *, u16 *, u16 *, u16 * );
#endif
/*****************************************************************************
* vout_sys_t: video output method descriptor
*****************************************************************************
......@@ -453,7 +457,7 @@ static int vout_Init( vout_thread_t *p_vout )
switch( p_vout->p_sys->i_screen_depth )
{
case 8: /* FIXME: set the palette */
p_vout->output.i_chroma = FOURCC_RGB; break;
p_vout->output.i_chroma = FOURCC_RGB2; break;
case 15:
p_vout->output.i_chroma = FOURCC_RV15; break;
case 16:
......@@ -1307,6 +1311,29 @@ static int NewPicture( vout_thread_t *p_vout, picture_t *p_pic )
break;
#else
case FOURCC_RGB2:
p_pic->p->p_pixels = p_pic->p_sys->p_image->data
+ p_pic->p_sys->p_image->xoffset;
p_pic->p->i_lines = p_pic->p_sys->p_image->height;
p_pic->p->i_pitch = p_pic->p_sys->p_image->bytes_per_line;
p_pic->p->i_pixel_bytes = p_pic->p_sys->p_image->depth;
if( p_pic->p->i_pitch == p_pic->p_sys->p_image->width )
{
p_pic->p->b_margin = 0;
}
else
{
p_pic->p->b_margin = 1;
p_pic->p->b_hidden = 1;
p_pic->p->i_visible_bytes = p_pic->p_sys->p_image->width;
}
p_pic->i_planes = 1;
break;
case FOURCC_RV16:
case FOURCC_RV15:
......@@ -1331,7 +1358,8 @@ static int NewPicture( vout_thread_t *p_vout, picture_t *p_pic )
break;
case FOURCC_BI_BITFIELDS:
case FOURCC_RV32:
case FOURCC_RV24:
p_pic->p->p_pixels = p_pic->p_sys->p_image->data
+ p_pic->p_sys->p_image->xoffset;
......@@ -2057,6 +2085,7 @@ static int InitDisplay( vout_thread_t *p_vout )
return( 1 );
}
p_vout->p_sys->i_bytes_per_pixel = 1;
p_vout->output.pf_setpalette = SetPalette;
break;
case 15:
case 16:
......@@ -2250,3 +2279,34 @@ static IMAGE_TYPE * CreateImage( Display *p_display, EXTRA_ARGS,
return p_image;
}
#ifdef MODULE_NAME_IS_x11
/*****************************************************************************
* SetPalette: sets an 8 bpp palette
*****************************************************************************
* This function sets the palette given as an argument. It does not return
* anything, but could later send information on which colors it was unable
* to set.
*****************************************************************************/
static void SetPalette( vout_thread_t *p_vout, u16 *red, u16 *green, u16 *blue )
{
int i;
XColor p_colors[255];
/* allocate palette */
for( i = 0; i < 255; i++ )
{
/* kludge: colors are indexed reversely because color 255 seems
* to be reserved for black even if we try to set it to white */
p_colors[ i ].pixel = 255 - i;
p_colors[ i ].pad = 0;
p_colors[ i ].flags = DoRed | DoGreen | DoBlue;
p_colors[ i ].red = red[ 255 - i ];
p_colors[ i ].blue = blue[ 255 - i ];
p_colors[ i ].green = green[ 255 - i ];
}
XStoreColors( p_vout->p_sys->p_display,
p_vout->p_sys->colormap, p_colors, 255 );
}
#endif
......@@ -2,7 +2,7 @@
* mpeg_system.c: TS, PS and PES management
*****************************************************************************
* Copyright (C) 1998-2001 VideoLAN
* $Id: mpeg_system.c,v 1.84 2002/03/11 07:23:09 gbazin Exp $
* $Id: mpeg_system.c,v 1.85 2002/03/17 17:00:38 sam Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
* Michel Lespinasse <walken@via.ecp.fr>
......@@ -670,7 +670,7 @@ ssize_t input_ReadPS( input_thread_t * p_input, data_packet_t ** pp_data )
/* It is common for MPEG-1 streams to pad with zeros
* (although it is forbidden by the recommendation), so
* don't bother everybody in this case. */
intf_WarnMsg( 3, "input warning: garbage at input (0x%x%x%x%x)",
intf_WarnMsg( 3, "input warning: garbage (0x%.2x%.2x%.2x%.2x)",
*p_peek, *(p_peek + 1), *(p_peek + 2), *(p_peek + 3) );
}
......
......@@ -5,7 +5,7 @@
* thread, and destroy a previously oppened video output thread.
*****************************************************************************
* Copyright (C) 2000-2001 VideoLAN
* $Id: video_output.c,v 1.167 2002/03/16 23:03:19 sam Exp $
* $Id: video_output.c,v 1.168 2002/03/17 17:00:38 sam Exp $
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
*
......@@ -365,19 +365,9 @@ static int InitThread( vout_thread_t *p_vout )
}
#define f p_vout->chroma.p_module->p_functions->chroma.functions.chroma
p_vout->chroma.pf_init = f.pf_init;
p_vout->chroma.pf_end = f.pf_end;
#undef f
if( p_vout->chroma.pf_init( p_vout ) )
{
intf_ErrMsg( "vout error: could not initialize chroma module" );
module_Unneed( p_vout->chroma.p_module );
p_vout->pf_end( p_vout );
vlc_mutex_unlock( &p_vout->change_lock );
return( 1 );
}
if( I_OUTPUTPICTURES < VOUT_MAX_PICTURES )
{
intf_WarnMsg( 2, "vout info: indirect render, mapping "
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment