Commit bf254b6b authored by Aaron Holtzman's avatar Aaron Holtzman

The long awaited libvo changes. Also included in here are updates

to the SDL, 3dfx, and Xv/X11 drivers.

The big change here is that all of the display drivers are now
compiled into the libvo library. This allows us to change
backends at runtime. The mpeg2dec application defaults to x11,
but you select your output mode using -o [mga|3dfx|sdl|x11].
I also cleaned the configure script up a bit, so there may be
some build breakages.

Here's the status of the various video_out backends.

mga  - tested
sdl  - tested
x11  - 32bpp tested
3dfx - untested, but should work
xv   - untested, but should work
gatos - broken

Now lets see if a fresh cvs checkout actually compiles :)

cheers,
aaron
parent dd38813a
......@@ -4,24 +4,18 @@ AUTOMAKE_OPTIONS = 1.3 foreign no-dependencies
CFLAGS = -g -O3 -Wall -Werror @ROOT_CFLAGS@ @GLOBAL_CFLAGS@ @X_CFLAGS@
SUBDIRS = libmpeg2 tools drivers .
SUBDIRS = libmpeg2 libvo tools drivers .
EXTRA_DIST = Changelog autogen.sh
bin_PROGRAMS = mpeg2dec
mpeg2dec_SOURCES = mpeg2dec.c
mpeg2dec_DEPENDENCIES = libmpeg2/libmpeg2.la @CONFIG_OBJS@
mpeg2dec_LDADD= libmpeg2/libmpeg2.la @CONFIG_OBJS@ @X_PRE_LIBS@ @X_LIBS@ -lXext\
mpeg2dec_DEPENDENCIES = libmpeg2/libmpeg2.la libvo/libvo.la
mpeg2dec_LDADD= libmpeg2/libmpeg2.la libvo/libvo.la @X_PRE_LIBS@ @X_LIBS@ -lXext\
-L/usr/X11R6/lib -lX11 @X_EXTRA_LIBS@ -lm
EXTRA_mpeg2dec_SOURCES = display_gatos.c display_mga_vid.c display_x11.c\
yuv2rgb.c yuv2rgb_mlib.c
noinst_HEADERS = config.h display.h yuv2rgb.h yuv2rgb_mlib.h
noinst_HEADERS = config.h
prof:
$(MAKE) mpeg2dec CFLAGS="-pg `echo $(CFLAGS) | sed s/-fomit-frame-pointer//`"
x11:
$(MAKE) -e mpeg2dec mpeg2dec_LDADD="display_x11.o idct_block_mmx.S motion_comp_mmx.c idct_mmx.c"
......@@ -6,3 +6,11 @@
#undef __sparc__
/* Extension defines */
#undef HAVE_MLIB
/* libvo options */
#undef HAVE_X11
#undef HAVE_XV
#undef HAVE_SDL
#undef HAVE_3DFX
#undef HAVE_MGA
#undef HAVE_GATOS
......@@ -19,6 +19,14 @@ AC_LIBTOOL_DLOPEN
AM_DISABLE_STATIC
AM_PROG_LIBTOOL
AC_SUBST(GLOBAL_CFLAGS)
AC_SUBST(ROOT_CFLAGS)
AC_SUBST(LIBMPEG2_CFLAGS)
AC_SUBST(LIBMPEG2_CONFIG_OBJS)
AC_SUBST(TOOLS_CFLAGS)
AC_SUBST(LIBVO_CFLAGS)
AC_SUBST(LIBVO_CONFIG_LIBS)
dnl
dnl Display driver probing...
dnl
......@@ -26,11 +34,11 @@ dnl
AC_ARG_ENABLE(3dfx,
[ --enable-3dfx make a version using experimental 3dfx driver],
enable_3dfx=yes, enable_3dfx=no)
if test "x$DISPLAY_DRIVER" = x -a x$enable_3dfx = xyes; then
if test x$enable_3dfx = xyes; then
AC_DEFINE(HAVE_3DFX)
AC_MSG_CHECKING(for /dev/3dfx)
if test -c "/dev/3dfx"; then
AC_MSG_RESULT(found)
DISPLAY_DRIVER=display_3dfx.o
X_LIBS="$X_LIBS -lXxf86dga"
else
AC_MSG_RESULT(not found)
......@@ -40,30 +48,31 @@ fi
AC_ARG_ENABLE(mga,
[ --disable-mga make a version not using MGA],
enable_mga=no, enable_mga=yes)
if test "x$DISPLAY_DRIVER" = x -a x$enable_mga = xyes; then
if test x$enable_mga = xyes; then
AC_DEFINE(HAVE_MGA)
AM_CONDITIONAL(HAVE_MGA,true)
AC_MSG_CHECKING(for /dev/mga_vid)
if test -c "/dev/mga_vid"; then
AC_MSG_RESULT(found)
DISPLAY_DRIVER=display_mga_vid.o
else
AC_MSG_RESULT(not found)
AC_MSG_WARN("to create /dev/mga_vid - use mknod /dev/mga_vid c 178 0")
fi
fi
AM_CONDITIONAL(BUILD_MGA_DRIVER, test "$DISPLAY_DRIVER" = "display_mga_vid.o")
AC_ARG_ENABLE(gatos,
[ --enable-gatos make a version using GATOS],
enable_gatos=yes, enable_gatos=no)
if test "x$DISPLAY_DRIVER" = x -a x$enable_gatos = xyes; then
AC_CHECK_LIB(gatos, main, [ DISPLAY_DRIVER=display_gatos.o
if test "x$LIBVO_CONFIG_OBJS" = x -a x$enable_gatos = xyes; then
AC_CHECK_LIB(gatos, main, [ LIBVO_CONFIG_OBJS=video_out_gatos.o
LIBS="$LIBS -lgatos" ], , -L/usr/X11R6/lib -L/usr/lib -L/usr/local/lib)
fi
AC_ARG_ENABLE(xil, [ --disable-xil make a version not using XIL],
enable_xil=no, enable_xil=yes)
if test "x$DISPLAY_DRIVER" = x -a x$enable_xil = xyes; then
AC_CHECK_LIB(xil, main, [ DISPLAY_DRIVER="display_xil.o yuv2rgb.o"
if test "x$LIBVO_CONFIG_OBJS" = x -a x$enable_xil = xyes; then
AC_CHECK_LIB(xil, main, [ LIBVO_CONFIG_OBJS="video_out_xil.o yuv2rgb.o"
LIBS="$LIBS -lxil" ])
fi
......@@ -76,47 +85,24 @@ AC_ARG_ENABLE(sdl, [ --enable-sdl make a version using SDL],
if test "x$enable_sdl" = xyes; then
AC_CHECK_PROG(SDLCONFIG, sdl-config, yes)
if test "x$SDLCONFIG" = xyes; then
DISPLAY_DRIVER="display_sdl.o"
ROOT_CFLAGS="$ROOT_CFLAGS `sdl-config --cflags`"
LIBS="$LIBS `sdl-config --libs`"
AC_DEFINE(HAVE_SDL)
LIBVO_CFLAGS="$LIBVO_CFLAGS `sdl-config --cflags`"
LIBVO_CONFIG_LIBS="$LIBVO_CONFIG_LIBS `sdl-config --libs`"
else
AC_MSG_ERROR([\"--enable-sdl\" specified, but sdl-config isn't in your path!])
AC_MSG_ERROR(["--enable-sdl" specified, but sdl-config isn't in your path!])
fi
fi
if test "x$DISPLAY_DRIVER" = x; then
AC_MSG_WARN(no accelerated display driver found -> using X11)
DISPLAY_DRIVER="display_x11.o yuv2rgb.o"
dnl FIXME check for X actually existing
AC_DEFINE(HAVE_X11)
dnl Checks for libraries. (X11)
AC_PATH_XTRA
AC_CHECK_LIB(Xv, XvShmCreateImage,
dnl Checks for libraries. (X11)
AC_PATH_XTRA
AC_CHECK_LIB(Xv, XvShmCreateImage,
X_LIBS="$X_LIBS -lXv"
ROOT_CFLAGS="$ROOT_CFLAGS -DHAVE_XV",,
AC_DEFINE(HAVE_XV),,
$X_LIBS $X_PRE_LIBS -lXext -lX11 $X_EXTRA_LIBS)
AM_CONDITIONAL(HAVE_X, test "x$no_x" != "xyes")
fi
dnl
dnl Other extentions
dnl
AC_ARG_ENABLE(mlib,
[ --disable-mlib make a version not using mediaLib],
enable_mlib=no, enable_mlib=yes)
if test x$enable_mlib = xyes; then
AC_CHECK_LIB(mlib, main,
[ EXTENSION_DRIVER="$EXTENSION_DRIVER yuv2rgb_mlib.o motion_comp_mlib.o"
LIB_CONFIG_OBJS="$LIB_CONFIG_OBJS idct_mlib.o"
LIBS="$LIBS -L/opt/SUNWmlib/lib -R/opt/SUNWmlib/lib -lmlib"
CFLAGS="$CFLAGS -I/opt/SUNWmlib/include"
AC_DEFINE(HAVE_MLIB)], , -L/opt/SUNWmlib/lib )
fi
CONFIG_OBJS="$CONFIG_OBJS $DISPLAY_DRIVER $EXTENSION_DRIVER"
AC_SUBST(CONFIG_OBJS)
AC_SUBST(LIB_CONFIG_OBJS)
dnl There must be a better way to check for SMP....
AC_MSG_CHECKING(for SMP)
......@@ -137,21 +123,28 @@ case "$host" in
esac
dnl Set the appropriate architecture define
case "$host" in
i?86-*)
case "$host_alias" in
i?86-* | k?-*) dnl catch i386,i486,i586,i686,k6,k7
AC_DEFINE(__i386__)
LIB_CONFIG_OBJS="$LIB_CONFIG_OBJS idct_mmx.lo idct_block_mmx.lo motion_comp_mmx.lo"
LIBMPEG2_CONFIG_OBJS="idct_mmx.lo idct_block_mmx.lo motion_comp_mmx.lo"
case "$host_alias" in
i486-*)
GLOBAL_CFLAGS="$GLOBAL_CFLAGS -march=m486";;
i586-*)
GLOBAL_CFLAGS="$GLOBAL_CFLAGS -march=pentium";;
i686-*)
GLOBAL_CFLAGS="$GLOBAL_CFLAGS -march=pentiumpro";;
k6-*)
GLOBAL_CFLAGS="$GLOBAL_CFLAGS -march=k6";;
k7-*)
GLOBAL_CFLAGS="$GLOBAL_CFLAGS -march=k7";;
esac;;
alpha*-*) AC_DEFINE(__alpha__);;
sparc-*) AC_DEFINE(__sparc__);;
ppc-*) AC_DEFINE(__ppc__);;
*) echo "$host is not currently supported by mpeg2dec"; exit 1;;
esac
AC_SUBST(GLOBAL_CFLAGS)
AC_SUBST(ROOT_CFLAGS)
AC_SUBST(LIBMPEG2_CFLAGS)
AC_SUBST(TOOLS_CFLAGS)
dnl
dnl get location of kernel headers
......@@ -163,4 +156,4 @@ AC_ARG_WITH(kernel-headers,
[KERNEL_INCLUDES=/usr/src/linux/include])
AC_SUBST(KERNEL_INCLUDES)
AC_OUTPUT( libmpeg2/Makefile tools/Makefile drivers/Makefile Makefile )
AC_OUTPUT( libvo/Makefile libmpeg2/Makefile tools/Makefile drivers/Makefile Makefile )
/*
* display.h
*
* Copyright (C) Aaron Holtzman - Aug 1999
*
* This file is part of mpeg2dec, a free MPEG-2 video stream decoder.
*
* mpeg2dec is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* mpeg2dec is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Make; see the file COPYING. If not, write to
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
/*
* Initialize the display driver.
*
* params : width == width of video to display.
* height == height of video to display.
* fullscreen == non-zero if driver should attempt to
* render in fullscreen mode. Zero if
* a windowed mode is requested. This is
* merely a request; if the driver can only do
* fullscreen (like fbcon) or windowed (like X11),
* than this param may be disregarded.
* title == string for titlebar of window. May be disregarded
* if there is no such thing as a window to your
* driver. Make a copy of this string, if you need it.
* returns : non-zero on successful initialization, zero on error.
* The program will probably respond to an error condition
* by terminating.
*/
uint_32 display_init(uint_32 width, uint_32 height, uint_32 fullscreen, char *title);
/*
* Display a new frame of the video. This gets called very rapidly, so
* the more efficient you can make your implementation of this function,
* the better.
*
* params : *src[] == A array with three elements. This is a YUV
* stream, with the Y plane in src[0], U in src[1],
* and V in src[2]. There is enough data for an image
* that is (WxH) pixels, where W and H are the width
* and height parameters that were previously passed
* to display_init().
* Information on the YUV format can be found at:
* http://www.webartz.com/fourcc/fccyuv.htm#IYUV
*
* returns : non-zero on successful rendering, zero on error.
* The program will probably respond to an error condition
* by terminating.
*/
uint_32 display_frame(uint_8 *src[]);
//FIXME document this when things settle down
uint_32 display_slice(uint_8 *src[],uint_32 slice_num);
void display_flip_page(void);
void* display_allocate_buffer(uint_32 num_bytes);
/*
* display_xil.c, Sun XIL / mediaLib interface
*
*
* Copyright (C) 1996, MPEG Software Simulation Group. All Rights Reserved.
*
* Adapted from display_x11.c (mpeg2dec) for XIL support by
* Hkan Hjort <d95hjort@dtek.chalmers.se>
*/
#include <stdio.h>
#include <stdlib.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <string.h>
#include <errno.h>
#include "mpeg2.h"
#include "mpeg2_internal.h"
#include "yuv2rgb.h"
#include <xil/xil.h>
/* X11 related variables */
static Display *mydisplay;
static Window mywindow;
static GC mygc;
static int bpp;
static XWindowAttributes attribs;
static int X_already_started = 0;
/* XIL variables */
static XilSystemState xilstate;
static int bands;
static int resized;
static float horizontal_factor, vertical_factor;
static XilImage renderimage, copyimage, displayimage;
static void InstallXErrorHandler()
{
//XSetErrorHandler(HandleXError);
XFlush(mydisplay);
}
static void DeInstallXErrorHandler()
{
XSetErrorHandler(NULL);
XFlush(mydisplay);
}
// Clamp to [0,255]
static uint_8 clip_tbl[1024]; /* clipping table */
static uint_8 *clip;
uint_32 image_width;
uint_32 image_height;
uint_32 progressive_sequence = 0;
/* connect to server, create and map window,
* allocate colors and (shared) memory
*/
int display_init(uint_32 width, uint_32 height, int fullscreen, char *title)
{
int screen;
int i;
char *hello = (title == NULL) ? "I love XIL" : title;
char *name = ":0.0";
XSizeHints hint;
XVisualInfo vinfo;
XEvent xev;
XGCValues xgcv;
Colormap theCmap;
XSetWindowAttributes xswa;
unsigned long xswamask;
clip = clip_tbl + 384;
for (i= -384; i< 640; i++)
clip[i] = (i < 0) ? 0 : ((i > 255) ? 255 : i);
image_height = height;
image_width = width;
if (X_already_started) {
// ??? Add code to resize window....
return;
}
printf( "x= %i y= %i\n", width, height);
if(getenv("DISPLAY"))
name = getenv("DISPLAY");
mydisplay = XOpenDisplay(name);
if (mydisplay == NULL)
{
fprintf(stderr,"Can not open display\n");
return(0);
}
screen = DefaultScreen(mydisplay);
hint.x = 0;
hint.y = 10;
hint.width = image_width;
hint.height = image_height;
hint.flags = PPosition | PSize;
/* Make the window */
if (XMatchVisualInfo(mydisplay, screen, 24, TrueColor, &vinfo) ) {
bpp = 24;
bands = 3;
} else if (XMatchVisualInfo(mydisplay, screen, 8, PseudoColor, &vinfo) ) {
bpp = 8;
bands = 1;
} else {
fprintf(stderr, "Failed to find a suitable visual" );
return(0);
}
printf("visual id is %lx\n",vinfo.visualid);
theCmap = XCreateColormap(mydisplay, DefaultRootWindow(mydisplay),
vinfo.visual, AllocNone);
xswa.background_pixel = 0;
xswa.border_pixel = 1;
xswa.colormap = theCmap;
xswamask = CWBackPixel | CWBorderPixel |CWColormap;
mywindow = XCreateWindow(mydisplay, RootWindow(mydisplay,screen),
hint.x, hint.y, hint.width, hint.height,
4, bpp, CopyFromParent, vinfo.visual,
xswamask, &xswa);
XSelectInput(mydisplay, mywindow, StructureNotifyMask);
/* Tell other applications about this window */
XSetStandardProperties(mydisplay, mywindow, hello, hello, None,
NULL, 0, &hint);
/* Map window. */
XMapWindow(mydisplay, mywindow);
/* Wait for map. */
do {
XNextEvent(mydisplay, &xev);
}
while (xev.type != MapNotify || xev.xmap.event != mywindow);
XSelectInput(mydisplay, mywindow, StructureNotifyMask);
XFlush(mydisplay);
XSync(mydisplay, False);
mygc = XCreateGC(mydisplay, mywindow, 0L, &xgcv);
// XIL sends an error message to stderr if xil_open fails
if ((xilstate = xil_open()) == NULL)
return(0);
// Install error handler
// if (xil_install_error_handler(State, error_handler) == XIL_FAILURE)
// error("unable to install error handler for XIL");
// XIL sends error message to stderr if xil_create_from_window fail
if (!(displayimage = xil_create_from_window(xilstate, mydisplay, mywindow)))
return(0);
xil_set_synchronize(displayimage, 1);
renderimage = xil_create(xilstate, image_width, image_height, 4, XIL_BYTE);
if (renderimage == NULL) {
fprintf(stderr, "XIL error, failed to create image\n" );
}
copyimage = xil_create_child(renderimage, 0, 0,
image_width, image_height, 1, 3);
//Humm... maybe we should do some more error checking.
yuv2rgb_init( 32, MODE_BGR );
X_already_started++;
return(-1); // non-zero == success.
}
void Terminate_Display_Process() {
getchar(); /* wait for enter to remove window */
if (displayimage) xil_destroy(displayimage);
if (copyimage) xil_destroy(copyimage);
if (renderimage) xil_destroy(renderimage);
xil_close(xilstate);
XDestroyWindow(mydisplay, mywindow);
XCloseDisplay(mydisplay);
X_already_started = 0;
}
void resize() {
Window root;
int x, y;
unsigned int w, h, b, d;
XGetGeometry(mydisplay, mywindow, &root, &x, &y, &w, &h, &b, &d);
if( w == image_width && h == image_height ) {
resized = 0;
horizontal_factor = 1.0;
vertical_factor = 1.0;
} else {
// indicate resize
resized = 1;
horizontal_factor = ((float) w)/image_width;
vertical_factor = ((float) h)/image_height;
}
// to avoid new events for the time being
XSelectInput(mydisplay, mywindow, NoEventMask);
// Create new image with new geometry
xil_destroy(displayimage);
displayimage = xil_create_from_window(xilstate, mydisplay, mywindow);
xil_set_synchronize(displayimage, 1);
XSelectInput(mydisplay, mywindow, StructureNotifyMask);
}
void Display_First_Field(void) { /* nothing */ }
void Display_Second_Field(void) { /* nothing */ }
int display_frame(uint_8 *src[])
{
XilMemoryStorage xilstorage;
XEvent event;
xil_export(renderimage);
xil_get_memory_storage(renderimage, &xilstorage);
yuv2rgb(xilstorage.byte.data, src[0], src[1], src[2],
image_width, image_height,
xilstorage.byte.scanline_stride,
image_width, image_width/2);
xil_import(renderimage, TRUE);
if (resized){
xil_scale(copyimage, displayimage, "bilinear",
horizontal_factor, vertical_factor);
}
else {
xil_copy(copyimage, displayimage);
}
if (XCheckWindowEvent(mydisplay, mywindow, StructureNotifyMask, &event))
resize();
return(-1); // non-zero == success.
}
/*
* 3dfx.h
*
* Copyright (C) Colin Cross Apr 2000
*
* mpeg2dec is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* mpeg2dec is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Make; see the file COPYING. If not, write to
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
#define VOODOO_IO_REG_OFFSET ((unsigned long int)0x0000000)
#define VOODOO_YUV_REG_OFFSET ((unsigned long int)0x0080100)
#define VOODOO_AGP_REG_OFFSET ((unsigned long int)0x0080000)
......@@ -9,9 +31,6 @@
#define VOODOO_YUV_STRIDE (1024>>2)
typedef unsigned long int uint_32;
typedef unsigned char uint_8;
struct voodoo_yuv_fb_t {
uint_32 Y[0x0040000];
uint_32 U[0x0040000];
......@@ -133,8 +152,3 @@ typedef struct voodoo_io_reg_t voodoo_io_reg;
typedef struct voodoo_yuv_reg_t voodoo_yuv_reg;
typedef struct voodoo_yuv_fb_t voodoo_yuv_fb;
......@@ -13,7 +13,7 @@ CFLAGS = -g -O2 -Wall -D__KERNEL__ -DMODULE @MOD_CFLAGS@\
noinst_HEADERS = mga_vid.h
if BUILD_MGA_DRIVER
if HAVE_MGA
all: mga_vid.o mga_vid_test
endif
......
CFLAGS = -g -O3 -Wall -Werror -I../libvo @LIBMPEG2_CFLAGS@ @GLOBAL_CFLAGS@
CFLAGS = -g -O3 -Wall -Werror @LIBMPEG2_CFLAGS@ @GLOBAL_CFLAGS@
lib_LTLIBRARIES = libmpeg2.la
include_HEADERS = mpeg2.h
lib_HEADER = mpeg2.h
libmpeg2_la_LIBADD = @LIB_CONFIG_OBJS@
libmpeg2_la_DEPENDENCIES = @LIB_CONFIG_OBJS@
libmpeg2_la_LIBADD = @LIBMPEG2_CONFIG_OBJS@
libmpeg2_la_DEPENDENCIES = @LIBMPEG2_CONFIG_OBJS@
libmpeg2_la_LDFLAGS = -version-info 1:6:1 -export-symbols libmpeg2.sym
libmpeg2_la_SOURCES = getvlc.c slice.c header.c stats.c idct.c motion_comp.c\
......@@ -18,4 +18,3 @@ noinst_HEADERS = config.h getvlc.h stats.h header.h slice.h motion_comp.h \
mpeg2.h mpeg2_internal.h idct.h\
mpeg2dec.h debug.h bitstream.h idct_mmx.h idct_mlib.h motion_comp_mmx.h\
motion_comp_mlib.h mmx.h
......@@ -38,7 +38,6 @@
#include "idct.h"
#include "header.h"
#include "slice.h"
#include "display.h"
#ifdef __i386__
#include "mmx.h"
......@@ -51,7 +50,7 @@ picture_t picture;
mpeg2_config_t config;
//pointers to the display interface functions
mpeg2_display_t mpeg2_display;
vo_functions_t video_out;
//
//the current start code chunk we are working on
......@@ -67,31 +66,28 @@ static uint_32 is_display_initialized = 0;
static uint_32 is_sequence_needed = 1;
void
mpeg2_init(mpeg2_display_t *foo)
mpeg2_init(vo_functions_t *foo)
{
uint_32 max_frame_size;
uint_32 max_slice_size;
//copy the display interface function pointers
mpeg2_display = *foo;
video_out = *foo;
max_frame_size = 720 * 576;
max_slice_size = 720 * 16;
picture.throwaway_frame[0] = mpeg2_display.allocate_buffer((max_slice_size * 3) / 2);
picture.throwaway_frame[0] = video_out.allocate_buffer((max_slice_size * 3) / 2);
picture.throwaway_frame[1] = picture.throwaway_frame[0] + max_slice_size;
picture.throwaway_frame[2] = picture.throwaway_frame[1] + max_slice_size/4;
printf("throwaway_frame %p\n",picture.throwaway_frame[0]);
picture.backward_reference_frame[0] = mpeg2_display.allocate_buffer((max_frame_size *3) / 2);
picture.backward_reference_frame[0] = video_out.allocate_buffer((max_frame_size *3) / 2);
picture.backward_reference_frame[1] = picture.backward_reference_frame[0] + max_frame_size;
picture.backward_reference_frame[2] = picture.backward_reference_frame[1] + max_frame_size/4;
printf("back ref_frame %p\n",picture.backward_reference_frame[0]);
picture.forward_reference_frame[0] = mpeg2_display.allocate_buffer((max_frame_size * 3) / 2);
picture.forward_reference_frame[0] = video_out.allocate_buffer((max_frame_size * 3) / 2);
picture.forward_reference_frame[1] = picture.forward_reference_frame[0] + max_frame_size;
picture.forward_reference_frame[2] = picture.forward_reference_frame[1] + max_frame_size/4;
printf("forward ref_frame %p\n",picture.forward_reference_frame[0]);
//FIXME setup config properly
config.flags = MPEG2_MMX_ENABLE;
......@@ -206,7 +202,7 @@ mpeg2_decode_data(uint_8 *data_start,uint_8 *data_end)
if(!is_display_initialized)
{
mpeg2_display.init(picture.coded_picture_width,picture.coded_picture_height,0,0);
video_out.init(picture.coded_picture_width,picture.coded_picture_height,0,0);
is_display_initialized = 1;
}
}
......@@ -229,7 +225,7 @@ mpeg2_decode_data(uint_8 *data_start,uint_8 *data_end)
if(picture.picture_coding_type == B_TYPE)
{
mpeg2_display.draw_slice(picture.throwaway_frame,chunk_buffer[0] - 1);
video_out.draw_slice(picture.throwaway_frame,chunk_buffer[0] - 1);
picture.current_frame[0] = picture.throwaway_frame[0] -
(chunk_buffer[0]) * 16 * picture.coded_picture_width;
......@@ -248,8 +244,8 @@ mpeg2_decode_data(uint_8 *data_start,uint_8 *data_end)
picture.coded_picture_width/2;
foo[2] = picture.forward_reference_frame[2] + (chunk_buffer[0]-1) * 8 *
picture.coded_picture_width/2;
mpeg2_display.draw_slice(foo,chunk_buffer[0]-1);
//mpeg2_display.draw_frame(picture.forward_reference_frame);
video_out.draw_slice(foo,chunk_buffer[0]-1);
//video_out.draw_frame(picture.forward_reference_frame);
}
}
......@@ -260,7 +256,7 @@ mpeg2_decode_data(uint_8 *data_start,uint_8 *data_end)
if(is_frame_done)
{
mpeg2_display.flip_page();
video_out.flip_page();
is_frame_done = 0;
......
......@@ -21,6 +21,10 @@
*
*/
//FIXME normally I wouldn't nest includes, but we'll leave this here until I get
//another chance to move things around
#include "libvo/video_out.h"
#ifndef AARONS_TYPES
#define AARONS_TYPES
//typedef to appropriate type for your architecture
......@@ -48,21 +52,5 @@ typedef struct mpeg2_config_s
void (*fill_buffer_callback)(uint_8 **, uint_8 **);
} mpeg2_config_t;
typedef struct mpeg2_frame_s
{
uint_32 width;
uint_32 height;
uint_8 *frame[3];
} mpeg2_frame_t;
typedef struct mpeg2_display_s
{
uint_32 (*init)(uint_32 width, uint_32 height, uint_32 fullscreen, char *title);
uint_32 (*draw_frame)(uint_8 *src[]);
uint_32 (*draw_slice)(uint_8 *src[],uint_32 slice_num);
void (*flip_page)(void);
void* (*allocate_buffer)(uint_32 num_bytes);
} mpeg2_display_t;
void mpeg2_init(mpeg2_display_t*);
void mpeg2_init(vo_functions_t*);
uint_32 mpeg2_decode_data(uint_8 *data_start,uint_8 *data_end);
......@@ -34,7 +34,6 @@
#include "motion_comp.h"
#include "bitstream.h"
#include "idct.h"