Commit 45f3f282 authored by Christophe Massiot's avatar Christophe Massiot

* Totally rewrote the video decoder (inspired by walken's mpeg2dec), implying :

- performance boost ;
- fixed the "Dual Prime Arithmetic" bug ;
- 3DNow! motion compensation module ;
* BTW, fixed numerous bugs ;
* AC3dec statistics do not show up with --enable-stats, because I doubt
they're understandable by a normal human being, and they pollute the output.
parent 54ed2ed3
......@@ -117,6 +117,11 @@ D: playlist and modules system
D: Gnome and Gtk+ interfaces, Glide and fb video outputs, Esound audio output
D: DVD subtitles decoder
N: Aaron Holtzman
E: aholtzma@ess.engr.uvic.ca
D: AC3 decoder
D: MPEG video decoder
N: Eugenio Jarosiewicz
E: ej0@cise.ufl.edu
C: ej
......
This diff is collapsed.
......@@ -124,10 +124,10 @@ void foo() { int meuh; ntohl(meuh); }],,
AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
dnl Check for inline function size limit
CFLAGS="${save_CFLAGS} -finline-limit=31337"
CFLAGS="${save_CFLAGS} -finline-limit-20000"
AC_MSG_CHECKING([if \$CC accepts -finline-limit])
AC_TRY_COMPILE([],,
save_CFLAGS="${save_CFLAGS} -finline-limit=31337"; AC_MSG_RESULT(yes),
save_CFLAGS="${save_CFLAGS} -finline-limit-20000"; AC_MSG_RESULT(yes),
AC_MSG_RESULT(no))
dnl Check for Darwin plugin linking flags
......@@ -190,6 +190,22 @@ AC_C_CONST
AC_TYPE_SIZE_T
AC_HEADER_TIME
dnl Checks for __attribute__(aligned()) directive
AC_CACHE_CHECK([__attribute__ ((aligned ())) support],
[ac_cv_c_attribute_aligned],
[ac_cv_c_attribute_aligned=0
for ac_cv_c_attr_align_try in 2 4 8 16 32 64; do
AC_TRY_COMPILE([],
[static char c __attribute__ ((aligned($ac_cv_c_attr_align_try))) = 0; return c;],
[ac_cv_c_attribute_aligned=$ac_cv_c_attr_align_try])
done])
if test x"$ac_cv_c_attribute_aligned" != x"0"; then
AC_DEFINE_UNQUOTED([ATTRIBUTE_ALIGNED_MAX],
[$ac_cv_c_attribute_aligned],[Maximum supported data alignment])
fi
ARCH=${host_cpu}
dnl
......
/*
* attributes.h
* Copyright (C) 1999-2000 Aaron Holtzman <aholtzma@ess.engr.uvic.ca>
*
* 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 of the License, 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 this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
//use gcc attribs to align critical data structures
#ifdef ATTRIBUTE_ALIGNED_MAX
#define ATTR_ALIGN(align) __attribute__ ((__aligned__ ((ATTRIBUTE_ALIGNED_MAX < align) ? ATTRIBUTE_ALIGNED_MAX : align)))
#else
#define ATTR_ALIGN(align)
#endif
......@@ -3,7 +3,7 @@
* Collection of useful common types and macros definitions
*****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN
* $Id: common.h,v 1.38 2001/08/14 04:52:39 sam Exp $
* $Id: common.h,v 1.39 2001/08/22 17:21:45 massiot Exp $
*
* Authors: Samuel Hocevar <sam@via.ecp.fr>
* Vincent Seguin <seguin@via.ecp.fr>
......@@ -66,11 +66,10 @@ typedef int ptrdiff_t;
typedef unsigned long count_t;
/* DCT elements types */
#ifndef VDEC_DFT
typedef short dctelem_t;
#else
typedef int dctelem_t;
#endif
typedef s16 dctelem_t;
/* Video buffer types */
typedef u8 yuv_data_t;
/*****************************************************************************
* Classes declaration
......@@ -193,6 +192,13 @@ struct pgrm_descriptor_s;
#define U32_AT(p) ( ntoh32 ( *( (u32 *)(p) ) ) )
#define U16_AT(p) ( ntoh16 ( *( (u16 *)(p) ) ) )
/* Alignment of critical static data structures */
#ifdef ATTRIBUTE_ALIGNED_MAX
# define ATTR_ALIGN(align) __attribute__ ((__aligned__ ((ATTRIBUTE_ALIGNED_MAX < align) ? ATTRIBUTE_ALIGNED_MAX : align)))
#else
# define ATTR_ALIGN(align)
#endif
/* win32, cl and icl support */
#if defined( _MSC_VER )
# define __attribute__(x)
......
/* include/defs.h.in. Generated automatically from configure.in by autoheader 2.13. */
/* include/defs.h.in. Generated automatically from configure.in by autoheader. */
/* Define to empty if the keyword does not work. */
#undef const
......@@ -184,6 +184,9 @@
/* Define if <cthreads.h> defines boolean_t. */
#undef BOOLEAN_T_IN_CTHREADS_H
/* Maximum supported data alignment */
#undef ATTRIBUTE_ALIGNED_MAX
/* Define if <sys/dvdio.h> defines dvd_struct. */
#undef DVD_STRUCT_IN_SYS_DVDIO_H
......
......@@ -2,7 +2,7 @@
* input_ext-dec.h: structures exported to the VideoLAN decoders
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: input_ext-dec.h,v 1.33 2001/07/16 12:10:32 massiot Exp $
* $Id: input_ext-dec.h,v 1.34 2001/08/22 17:21:45 massiot Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
* Michel Kaempf <maxx@via.ecp.fr>
......@@ -192,8 +192,10 @@ typedef struct bit_stream_s
#if (WORD_TYPE == u32)
# define WORD_AT U32_AT
# define WORD_SIGNED s32
#elif (WORD_TYPE == u64)
# define WORD_AT U64_AT
# define WORD_SIGNED s64
#else
# error Unsupported WORD_TYPE
#endif
......@@ -201,7 +203,7 @@ typedef struct bit_stream_s
/*****************************************************************************
* Protoypes from input_ext-dec.c
*****************************************************************************/
u32 UnalignedShowBits( struct bit_stream_s *, unsigned int );
void UnalignedShowBits( struct bit_stream_s *, unsigned int );
void UnalignedRemoveBits( struct bit_stream_s * );
u32 UnalignedGetBits( struct bit_stream_s *, unsigned int );
......@@ -252,7 +254,26 @@ static __inline__ u32 ShowBits( bit_stream_t * p_bit_stream,
>> (8 * sizeof(WORD_TYPE) - i_bits) );
}
return UnalignedShowBits( p_bit_stream, i_bits );
UnalignedShowBits( p_bit_stream, i_bits );
return( p_bit_stream->fifo.buffer >> (8 * sizeof(WORD_TYPE) - i_bits) );
}
/*****************************************************************************
* ShowSignedBits : return i_bits bits from the bit stream, using signed
* arithmetic
*****************************************************************************/
static __inline__ s32 ShowSignedBits( bit_stream_t * p_bit_stream,
unsigned int i_bits )
{
if( p_bit_stream->fifo.i_available >= i_bits )
{
return( (WORD_SIGNED)p_bit_stream->fifo.buffer
>> (8 * sizeof(WORD_TYPE) - i_bits) );
}
/* You can probably do something a little faster, but now I'm tired. */
return( (WORD_SIGNED)(ShowBits( p_bit_stream, i_bits ) << (32 - i_bits))
>> (32 - i_bits) );
}
/*****************************************************************************
......@@ -346,6 +367,30 @@ static __inline__ u32 GetBits( bit_stream_t * p_bit_stream,
return UnalignedGetBits( p_bit_stream, i_bits );
}
/*****************************************************************************
* GetSignedBits : returns i_bits bits from the bit stream and removes them,
* using signed arithmetic
* XXX: do not use for 32 bits
*****************************************************************************/
static __inline__ s32 GetSignedBits( bit_stream_t * p_bit_stream,
unsigned int i_bits )
{
if( p_bit_stream->fifo.i_available >= i_bits )
{
s32 i_result;
p_bit_stream->fifo.i_available -= i_bits;
i_result = (WORD_SIGNED)p_bit_stream->fifo.buffer
>> (8 * sizeof(WORD_TYPE) - i_bits);
p_bit_stream->fifo.buffer <<= i_bits;
return( i_result );
}
/* You can probably do something a little faster, but now I'm tired. */
return( (WORD_SIGNED)(GetBits( p_bit_stream, i_bits ) << (32 - i_bits))
>> (32 - i_bits) );
}
/*****************************************************************************
* GetBits32 : returns 32 bits from the bit stream and removes them
*****************************************************************************/
......
......@@ -2,7 +2,7 @@
* modules.h : Module management functions.
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: modules.h,v 1.27 2001/07/17 09:48:07 massiot Exp $
* $Id: modules.h,v 1.28 2001/08/22 17:21:45 massiot Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
......@@ -162,32 +162,21 @@ typedef struct function_list_s
/* Motion compensation plugin */
struct
{
#define motion_functions( yuv ) \
void ( * pf_field_field_##yuv ) ( struct macroblock_s * ); \
void ( * pf_field_16x8_##yuv ) ( struct macroblock_s * ); \
void ( * pf_field_dmv_##yuv ) ( struct macroblock_s * ); \
void ( * pf_frame_field_##yuv ) ( struct macroblock_s * ); \
void ( * pf_frame_frame_##yuv ) ( struct macroblock_s * ); \
void ( * pf_frame_dmv_##yuv ) ( struct macroblock_s * );
motion_functions( 420 )
motion_functions( 422 )
motion_functions( 444 )
#undef motion_functions
void ( * ppppf_motion[2][2][4] ) ( yuv_data_t *, yuv_data_t *,
int, int );
} motion;
/* IDCT plugin */
struct
{
void ( * pf_idct_init ) ( struct vdec_thread_s * );
void ( * pf_idct_init ) ( void ** );
void ( * pf_sparse_idct ) ( void *, dctelem_t *, int );
void ( * pf_idct ) ( void *, dctelem_t *, int );
void ( * pf_norm_scan ) ( u8 ppi_scan[2][64] );
void ( * pf_decode_init ) ( struct vdec_thread_s * );
void ( * pf_decode_mb_c ) ( struct vdec_thread_s *,
struct macroblock_s * );
void ( * pf_decode_mb_bw ) ( struct vdec_thread_s *,
struct macroblock_s * );
void ( * pf_decode_init ) ( );
void ( * pf_addblock ) ( dctelem_t *, yuv_data_t *, int );
void ( * pf_copyblock ) ( dctelem_t *, yuv_data_t *, int );
} idct;
/* YUV transformation plugin */
......
/*****************************************************************************
* vdec_common.h : structures from the video decoder exported to plug-ins
* vdec_ext-plugins.h : structures from the video decoder exported to plug-ins
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: vdec_ext-plugins.h,v 1.2 2001/07/18 14:21:00 massiot Exp $
* $Id: vdec_ext-plugins.h,v 1.3 2001/08/22 17:21:45 massiot Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
......@@ -21,77 +21,55 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
/*****************************************************************************
* Function pointers
*****************************************************************************/
typedef void (*f_motion_t)( struct macroblock_s * );
/*****************************************************************************
* macroblock_t : information on a macroblock passed to the video_decoder
* thread
*****************************************************************************/
typedef struct idct_inner_s
{
dctelem_t pi_block[64]; /* block */
void ( * pf_idct ) ( void *, dctelem_t*, int );
/* sparse IDCT or not ? */
int i_sparse_pos; /* position of the
* non-NULL coeff */
yuv_data_t * p_dct_data; /* pointer to the position
* in the final picture */
} idct_inner_t;
typedef struct motion_inner_s
{
boolean_t b_average; /* 0 == copy */
int i_x_pred, i_y_pred; /* motion vectors */
yuv_data_t * pp_source[3];
int i_dest_offset, i_src_offset;
int i_stride, i_height;
boolean_t b_second_half;
} motion_inner_t;
typedef struct macroblock_s
{
picture_t * p_picture; /* current frame in progress */
int i_mb_modes;
int i_mb_type; /* macroblock type */
/* IDCT information */
idct_inner_t p_idcts[6];
int i_coded_block_pattern;
/* which blocks are coded ? */
int i_chroma_nb_blocks; /* number of blocks for
* chroma components */
/* IDCT information */
dctelem_t ppi_blocks[12][64]; /* blocks */
void ( * pf_idct[12] ) ( void *, dctelem_t*, int );
/* sparse IDCT or not ? */
int pi_sparse_pos[12]; /* position of the
* non-NULL coeff */
int i_lum_dct_stride, i_chrom_dct_stride;
/* nb of coeffs to jump when changing lines */
/* Motion compensation information */
f_motion_t pf_motion; /* function to use for motion comp */
picture_t * p_backward; /* backward reference frame */
picture_t * p_forward; /* forward reference frame */
int ppi_field_select[2][2]; /* field to use to
* form predictions */
int pppi_motion_vectors[2][2][2]; /* motion vectors */
int ppi_dmv[2][2]; /* differential motion vectors */
/* coordinates of the block in the picture */
int i_l_x, i_c_x;
int i_motion_l_y;
int i_motion_c_y;
int i_l_stride; /* number of yuv_data_t to
* ignore when changing line */
int i_c_stride; /* idem, for chroma */
boolean_t b_P_second; /* Second field of a P picture ?
* (used to determine the predicting
* frame) */
boolean_t b_motion_field; /* Field we are predicting
* (top field or bottom field) */
/* AddBlock information */
yuv_data_t * p_data[12]; /* pointer to the position
* in the final picture */
int i_addb_l_stride, i_addb_c_stride;
/* nb of coeffs to jump when changing lines */
motion_inner_t p_motions[8];
int i_nb_motions;
yuv_data_t * pp_dest[3];
} macroblock_t;
/* Macroblock types */
/* Macroblock Modes */
#define MB_INTRA 1
#define MB_PATTERN 2
#define MB_MOTION_BACKWARD 4
#define MB_MOTION_FORWARD 8
#define MB_QUANT 16
/* Motion types */
#define MOTION_FIELD 1
#define MOTION_FRAME 2
#define MOTION_16X8 2
#define MOTION_DMV 3
/* Structures */
#define TOP_FIELD 1
#define BOTTOM_FIELD 2
#define FRAME_STRUCTURE 3
#define DCT_TYPE_INTERLACED 32
/*****************************************************************************
* vdec_thread_t: video decoder thread descriptor
......
......@@ -4,7 +4,7 @@
* includes all common video types and constants.
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: video.h,v 1.31 2001/07/18 14:21:00 massiot Exp $
* $Id: video.h,v 1.32 2001/08/22 17:21:45 massiot Exp $
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
*
......@@ -30,11 +30,6 @@
* "mtime.h"
*****************************************************************************/
/*****************************************************************************
* yuv_data_t: type for storing one Y, U or V sample.
*****************************************************************************/
typedef u8 yuv_data_t;
/*****************************************************************************
* picture_t: video picture
*****************************************************************************
......
......@@ -2,7 +2,7 @@
* idct.c : IDCT module
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: idct.c,v 1.13 2001/07/17 09:48:07 massiot Exp $
* $Id: idct.c,v 1.14 2001/08/22 17:21:45 massiot Exp $
*
* Authors: Gal Hendryckx <jimmy@via.ecp.fr>
*
......@@ -37,12 +37,6 @@
#include "mtime.h"
#include "tests.h"
#include "video.h"
#include "video_output.h"
#include "vdec_ext-plugins.h"
#include "vdec_block.h"
#include "vdec_idct.h"
#include "modules.h"
......@@ -91,8 +85,8 @@ static void idct_getfunctions( function_list_t * p_function_list )
F.pf_idct = _M( vdec_IDCT );
F.pf_norm_scan = vdec_NormScan;
F.pf_decode_init = _M( vdec_InitDecode );
F.pf_decode_mb_c = _M( vdec_DecodeMacroblockC );
F.pf_decode_mb_bw = _M( vdec_DecodeMacroblockBW );
F.pf_addblock = _M( vdec_AddBlock );
F.pf_copyblock = _M( vdec_CopyBlock );
#undef F
}
......@@ -121,7 +115,8 @@ static void vdec_NormScan( u8 ppi_scan[2][64] )
/*****************************************************************************
* vdec_IDCT : IDCT function for normal matrices
*****************************************************************************/
void _M( vdec_IDCT )( void * p_idct_data, dctelem_t * p_block, int i_idontcare )
void _M( vdec_IDCT )( void * p_unused_data, dctelem_t * p_block,
int i_idontcare )
{
s32 tmp0, tmp1, tmp2, tmp3;
s32 tmp10, tmp11, tmp12, tmp13;
......
......@@ -2,7 +2,7 @@
* idctaltivec.c : Altivec IDCT module
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: idctaltivec.c,v 1.10 2001/07/17 09:48:07 massiot Exp $
* $Id: idctaltivec.c,v 1.11 2001/08/22 17:21:45 massiot Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
......@@ -22,6 +22,7 @@
*****************************************************************************/
#define MODULE_NAME idctaltivec
#include "modules_inner.h"
/*****************************************************************************
* Preamble
......@@ -36,19 +37,11 @@
#include "mtime.h"
#include "tests.h" /* TestCPU() */
#include "video.h"
#include "video_output.h"
#include "modules.h"
#include "modules_inner.h"
#include "vdec_ext-plugins.h"
#include "vdec_block.h"
#include "vdec_idct.h"
#include "idctaltivec.h"
#include "modules.h"
#include "modules_export.h"
/*****************************************************************************
......@@ -93,8 +86,8 @@ static void idct_getfunctions( function_list_t * p_function_list )
F.pf_idct = _M( vdec_IDCT );
F.pf_norm_scan = vdec_NormScan;
F.pf_decode_init = _M( vdec_InitDecode );
F.pf_decode_mb_c = _M( vdec_DecodeMacroblockC );
F.pf_decode_mb_bw = _M( vdec_DecodeMacroblockBW );
F.pf_addblock = _M( vdec_AddBlock );
F.pf_copyblock = _M( vdec_CopyBlock );
#undef F
}
......@@ -128,7 +121,8 @@ static void vdec_NormScan( u8 ppi_scan[2][64] )
/*****************************************************************************
* vdec_IDCT :
*****************************************************************************/
void _M( vdec_IDCT )( void * p_idct_data, dctelem_t * p_block, int i_idontcare )
void _M( vdec_IDCT )( void * p_unused_data, dctelem_t * p_block,
int i_idontcare )
{
IDCT( p_block, p_block );
}
......
......@@ -2,7 +2,7 @@
* idctclassic.c : Classic IDCT module
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: idctclassic.c,v 1.13 2001/07/17 09:48:07 massiot Exp $
* $Id: idctclassic.c,v 1.14 2001/08/22 17:21:45 massiot Exp $
*
* Authors: Gal Hendryckx <jimmy@via.ecp.fr>
*
......@@ -22,6 +22,7 @@
*****************************************************************************/
#define MODULE_NAME idctclassic
#include "modules_inner.h"
/*****************************************************************************
* Preamble
......@@ -36,17 +37,9 @@
#include "mtime.h"
#include "tests.h"
#include "video.h"
#include "video_output.h"
#include "vdec_ext-plugins.h"
#include "modules.h"
#include "modules_inner.h"
#include "vdec_block.h"
#include "vdec_idct.h"
#include "modules.h"
#include "modules_export.h"
/*****************************************************************************
......@@ -93,8 +86,8 @@ static void idct_getfunctions( function_list_t * p_function_list )
F.pf_idct = _M( vdec_IDCT );
F.pf_norm_scan = vdec_NormScan;
F.pf_decode_init = _M( vdec_InitDecode );
F.pf_decode_mb_c = _M( vdec_DecodeMacroblockC );
F.pf_decode_mb_bw = _M( vdec_DecodeMacroblockBW );
F.pf_addblock = _M( vdec_AddBlock );
F.pf_copyblock = _M( vdec_CopyBlock );
#undef F
}
......@@ -123,7 +116,8 @@ static void vdec_NormScan( u8 ppi_scan[2][64] )
/*****************************************************************************
* vdec_IDCT : IDCT function for normal matrices
*****************************************************************************/
void _M( vdec_IDCT )( void * p_idct_data, dctelem_t * p_block, int i_idontcare )
void _M( vdec_IDCT )( void * p_unused_data, dctelem_t * p_block,
int i_idontcare )
{
/* dct classique: pour tester la meilleure entre la classique et la */
/* no classique */
......@@ -248,7 +242,7 @@ void _M( vdec_IDCT )( void * p_idct_data, dctelem_t * p_block, int i_idontcare )
* may be commented out.
*/
#ifndef NO_ZERO_COLUMN_TEST /*ajoute un test mais evite des calculs */
#ifndef NO_ZERO_COLUMN_TEST /* Adds a test but avoids calculus */
if ((dataptr[DCTSIZE*1] | dataptr[DCTSIZE*2] | dataptr[DCTSIZE*3] |
dataptr[DCTSIZE*4] | dataptr[DCTSIZE*5] | dataptr[DCTSIZE*6] |
dataptr[DCTSIZE*7]) == 0)
......
......@@ -2,7 +2,7 @@
* idctmmx.c : MMX IDCT module
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: idctmmx.c,v 1.15 2001/07/17 09:48:07 massiot Exp $
* $Id: idctmmx.c,v 1.16 2001/08/22 17:21:45 massiot Exp $
*
* Authors: Aaron Holtzman <aholtzma@ess.engr.uvic.ca>
* Michel Lespinasse <walken@zoy.org>
......@@ -26,6 +26,7 @@
*****************************************************************************/
#define MODULE_NAME idctmmx
#include "modules_inner.h"
/*****************************************************************************
* Preamble
......@@ -40,20 +41,11 @@
#include "mtime.h"
#include "tests.h" /* TestCPU() */
#include "video.h"
#include "video_output.h"
#include "modules.h"
#include "modules_inner.h"
#include "vdec_ext-plugins.h"
#include "vdec_block.h"
#include "vdec_idct.h"
#include "attributes.h"
#include "mmx.h"
#include "modules.h"
#include "modules_export.h"
/*****************************************************************************
......@@ -98,8 +90,8 @@ static void idct_getfunctions( function_list_t * p_function_list )
F.pf_idct = _M( vdec_IDCT );
F.pf_norm_scan = vdec_NormScan;
F.pf_decode_init = _M( vdec_InitDecode );
F.pf_decode_mb_c = _M( vdec_DecodeMacroblockC );
F.pf_decode_mb_bw = _M( vdec_DecodeMacroblockBW );
F.pf_addblock = _M( vdec_AddBlock );
F.pf_copyblock = _M( vdec_CopyBlock );
#undef F
}
......@@ -434,7 +426,8 @@ static s32 rounder3[] ATTR_ALIGN(8) =
static s32 rounder5[] ATTR_ALIGN(8) =
rounder (-0.441341716183); // C3*(-C5/C4+C5-C3)/2
void _M( vdec_IDCT )( void * p_idct_data, dctelem_t * p_block, int i_idontcare )
void _M( vdec_IDCT )( void * p_unused_data, dctelem_t * p_block,
int i_idontcare )
{
static dctelem_t table04[] ATTR_ALIGN(16) =
table (22725, 21407, 19266, 16384, 12873, 8867, 4520);
......
......@@ -2,7 +2,7 @@
* idctmmxext.c : MMX EXT IDCT module
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: idctmmxext.c,v 1.12 2001/07/17 09:48:07 massiot Exp $
* $Id: idctmmxext.c,v 1.13 2001/08/22 17:21:45 massiot Exp $
*
* Authors: Aaron Holtzman <aholtzma@ess.engr.uvic.ca>
* Michel Lespinasse <walken@zoy.org>
......@@ -26,6 +26,7 @@
*****************************************************************************/
#define MODULE_NAME idctmmxext
#include "modules_inner.h"
/*****************************************************************************
* Preamble
......@@ -40,20 +41,11 @@
#include "mtime.h"
#include "tests.h" /* TestCPU() */
#include "video.h"
#include "video_output.h"
#include "modules.h"
#include "modules_inner.h"
#include "vdec_ext-plugins.h"
#include "vdec_block.h"
#include "vdec_idct.h"
#include "attributes.h"
#include "mmx.h"
#include "modules.h"
#include "modules_export.h"
/*****************************************************************************
......@@ -98,8 +90,8 @@ static void idct_getfunctions( function_list_t * p_function_list )
F.pf_idct = _M( vdec_IDCT );
F.pf_norm_scan = vdec_NormScan;
F.pf_decode_init = _M( vdec_InitDecode );
F.pf_decode_mb_c = _M( vdec_DecodeMacroblockC );
F.pf_decode_mb_bw = _M( vdec_DecodeMacroblockBW );
F.pf_addblock = _M( vdec_AddBlock );
F.pf_copyblock = _M( vdec_CopyBlock );
#undef F
}
......@@ -418,7 +410,8 @@ static s32 rounder3[] ATTR_ALIGN(8) =
static s32 rounder5[] ATTR_ALIGN(8) =
rounder (-0.441341716183); // C3*(-C5/C4+C5-C3)/2
void _M( vdec_IDCT )( void * p_idct_data, dctelem_t * p_block, int i_idontcare )
void _M( vdec_IDCT )( void * p_unused_data, dctelem_t * p_block,
int i_idontcare )
{
static dctelem_t table04[] ATTR_ALIGN(16) =
table (22725, 21407, 19266, 16384, 12873, 8867, 4520);
......
/*****************************************************************************
* vdec_block_h: Macroblock copy functions
*****************************************************************************
* Copyright (C) 1999, 2000, 2001 VideoLAN
* $Id: vdec_block.h,v 1.3 2001/07/17 09:48:07 massiot Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
* This program 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 of the License, or
* (at your option) any later version.
*
* This program 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 this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
/*****************************************************************************
* Prototypes
*****************************************************************************/
void _M( vdec_InitDecode ) ( struct vdec_thread_s *p_vdec );
void _M( vdec_DecodeMacroblockC ) ( struct vdec_thread_s *p_vdec,
struct macroblock_s * p_mb );
void _M( vdec_DecodeMacroblockBW ) ( struct vdec_thread_s *p_vdec,
struct macroblock_s * p_mb );
/*****************************************************************************
* vdec_DecodeMacroblock : decode a macroblock of a picture
*****************************************************************************/
#define DECODEBLOCKSC( OPBLOCK ) \
{ \
int i_b, i_mask; \
\
i_mask = 1 << (3 + p_mb->i_chroma_nb_blocks); \
\
/* luminance */ \
for( i_b = 0; i_b < 4; i_b++, i_mask >>= 1 ) \
{ \
if( p_mb->i_coded_block_pattern & i_mask ) \
{ \
/* \
* Inverse DCT (ISO/IEC 13818-2 section Annex A) \
*/ \
(p_mb->pf_idct[i_b])( p_vdec->p_idct_data, \
p_mb->ppi_blocks[i_b], \
p_mb->pi_sparse_pos[i_b] ); \
\
/* \
* Adding prediction and coefficient data (ISO/IEC 13818-2 \
* section 7.6.8) \
*/ \
OPBLOCK( p_vdec, p_mb->ppi_blocks[i_b], \
p_mb->p_data[i_b], p_mb->i_addb_l_stride ); \
} \
} \
\
/* chrominance */ \
for( i_b = 4; i_b < 4 + p_mb->i_chroma_nb_blocks; \
i_b++, i_mask >>= 1 ) \
{ \
if( p_mb->i_coded_block_pattern & i_mask ) \
{ \
/* \
* Inverse DCT (ISO/IEC 13818-2 section Annex A) \
*/ \
(p_mb->pf_idct[i_b])( p_vdec->p_idct_data, \
p_mb->ppi_blocks[i_b], \
p_mb->pi_sparse_pos[i_b] ); \
\
/* \
* Adding prediction and coefficient data (ISO/IEC 13818-2 \
* section 7.6.8) \
*/ \
OPBLOCK( p_vdec, p_mb->ppi_blocks[i_b], \
p_mb->p_data[i_b], p_mb->i_addb_c_stride ); \
} \
} \
}
#define DECODEBLOCKSBW( OPBLOCK ) \
{ \
int i_b, i_mask; \
\
i_mask = 1 << (3 + p_mb->i_chroma_nb_blocks); \
\
/* luminance */ \
for( i_b = 0; i_b < 4; i_b++, i_mask >>= 1 ) \
{ \
if( p_mb->i_coded_block_pattern & i_mask ) \
{ \
/* \
* Inverse DCT (ISO/IEC 13818-2 section Annex A) \
*/ \
(p_mb->pf_idct[i_b])( p_vdec->p_idct_data, \
p_mb->ppi_blocks[i_b], \
p_mb->pi_sparse_pos[i_b] ); \
\
/* \
* Adding prediction and coefficient data (ISO/IEC 13818-2 \
* section 7.6.8) \
*/ \
OPBLOCK( p_vdec, p_mb->ppi_blocks[i_b], \
p_mb->p_data[i_b], p_mb->i_addb_l_stride ); \
} \
} \
}
......@@ -2,7 +2,7 @@
* vdec_block_c.c: Macroblock copy functions in C
*****************************************************************************
* Copyright (C) 1999, 2000, 2001 VideoLAN
* $Id: vdec_block_c.c,v 1.5 2001/07/17 09:48:07 massiot Exp $
* $Id: vdec_block_c.c,v 1.6 2001/08/22 17:21:45 massiot Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
......@@ -42,14 +42,7 @@
#include "intf_msg.h"
#include "input_ext-dec.h"
#include "video.h"
#include "video_output.h"
#include "vdec_ext-plugins.h"
#include "vdec_block.h"
#include "vdec_idct.h"
#include "modules.h"
#include "modules_export.h"
......@@ -65,7 +58,7 @@ static u8 *pi_crop;
/*****************************************************************************
* vdec_InitDecode: initialize video decoder thread
*****************************************************************************/
void _M( vdec_InitDecode ) ( vdec_thread_t *p_vdec )
void _M( vdec_InitDecode ) ( )
{
int i_dummy;
......@@ -89,88 +82,48 @@ void _M( vdec_InitDecode ) ( vdec_thread_t *p_vdec )
}
/*****************************************************************************
* AddBlock : add a block
* vdec_AddBlock : add a block
*****************************************************************************/
static __inline__ void AddBlock( vdec_thread_t * p_vdec, dctelem_t * p_block,
yuv_data_t * p_data, int i_incr )
void _M( vdec_AddBlock ) ( dctelem_t * p_block, yuv_data_t * p_data,
int i_incr )
{
int i_x, i_y;
int i = 8;
do {
p_data[0] = pi_crop[ p_data[0] + p_block[0] ];
p_data[1] = pi_crop[ p_data[1] + p_block[1] ];
p_data[2] = pi_crop[ p_data[2] + p_block[2] ];
p_data[3] = pi_crop[ p_data[3] + p_block[3] ];
p_data[4] = pi_crop[ p_data[4] + p_block[4] ];
p_data[5] = pi_crop[ p_data[5] + p_block[5] ];
p_data[6] = pi_crop[ p_data[6] + p_block[6] ];
p_data[7] = pi_crop[ p_data[7] + p_block[7] ];
for( i_y = 0; i_y < 8; i_y++ )
{
for( i_x = 0; i_x < 8; i_x++ )
{
*p_data = pi_crop[*p_data + *p_block++];
p_data++;
}
p_data += i_incr;
}
p_block += 8;
} while( --i );
}
/*****************************************************************************
* CopyBlock : copy a block
* vdec_CopyBlock : copy a block
*****************************************************************************/
static __inline__ void CopyBlock( vdec_thread_t * p_vdec, dctelem_t * p_block,
yuv_data_t * p_data, int i_incr )
void _M( vdec_CopyBlock )( dctelem_t * p_block, yuv_data_t * p_data,
int i_incr )
{
int i_x, i_y;
int i = 8;
do {
p_data[0] = pi_crop[ p_block[0] ];
p_data[1] = pi_crop[ p_block[1] ];
p_data[2] = pi_crop[ p_block[2] ];
p_data[3] = pi_crop[ p_block[3] ];
p_data[4] = pi_crop[ p_block[4] ];
p_data[5] = pi_crop[ p_block[5] ];
p_data[6] = pi_crop[ p_block[6] ];
p_data[7] = pi_crop[ p_block[7] ];
for( i_y = 0; i_y < 8; i_y++ )
{
for( i_x = 0; i_x < 8; i_x++ )
{
*p_data++ = pi_crop[*p_block++];
}
p_data += i_incr;
}
}
void _M( vdec_DecodeMacroblockC ) ( vdec_thread_t *p_vdec, macroblock_t * p_mb )
{
if( !(p_mb->i_mb_type & MB_INTRA) )
{
/*
* Motion Compensation (ISO/IEC 13818-2 section 7.6)
*/
if( p_mb->pf_motion == 0 )
{
intf_WarnMsg( 2, "pf_motion set to NULL" );
}
else
{
p_mb->pf_motion( p_mb );
}
DECODEBLOCKSC( AddBlock )
}
else
{
DECODEBLOCKSC( CopyBlock )
}
}
void _M( vdec_DecodeMacroblockBW ) ( vdec_thread_t *p_vdec,
macroblock_t * p_mb )
{
if( !(p_mb->i_mb_type & MB_INTRA) )
{
/*
* Motion Compensation (ISO/IEC 13818-2 section 7.6)
*/
if( p_mb->pf_motion == 0 )
{
intf_WarnMsg( 2, "pf_motion set to NULL" );
}
else
{
p_mb->pf_motion( p_mb );
}
DECODEBLOCKSBW( AddBlock )
}
else
{
DECODEBLOCKSBW( CopyBlock )
}
p_block += 8;
} while( --i );
}
This diff is collapsed.
......@@ -2,7 +2,7 @@
* vdec_idct.c : common IDCT functions
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: vdec_idct.c,v 1.3 2001/07/25 08:41:21 gbazin Exp $
* $Id: vdec_idct.c,v 1.4 2001/08/22 17:21:45 massiot Exp $
*
* Authors: Gal Hendryckx <jimmy@via.ecp.fr>
*
......@@ -46,25 +46,24 @@
#include "modules.h"
#include "vdec_ext-plugins.h"
#include "vdec_idct.h"
/*****************************************************************************
* vdec_InitIDCT : initialize datas for vdec_SparseIDCT
*****************************************************************************/
void _M( vdec_InitIDCT ) ( vdec_thread_t * p_vdec )
void _M( vdec_InitIDCT ) ( void ** pp_idct_data )
{
int i;
dctelem_t * p_pre;
p_vdec->p_idct_data = malloc( sizeof(dctelem_t) * 64 * 64 );
p_pre = (dctelem_t *) p_vdec->p_idct_data;
*pp_idct_data = malloc( sizeof(dctelem_t) * 64 * 64 );
p_pre = (dctelem_t *) *pp_idct_data;
memset( p_pre, 0, 64 * 64 * sizeof(dctelem_t) );
for( i=0 ; i < 64 ; i++ )
for( i = 0 ; i < 64 ; i++ )
{
p_pre[i*64+i] = 1 << SPARSE_SCALE_FACTOR;
_M( vdec_IDCT )( p_vdec, &p_pre[i*64], 0) ;
_M( vdec_IDCT )( NULL, &p_pre[i*64], 0) ;
}
return;
}
......
......@@ -2,7 +2,7 @@
* vdec_idct.h : macros for the inverse discrete cosine transform
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: vdec_idct.h,v 1.2 2001/07/17 09:48:07 massiot Exp $
* $Id: vdec_idct.h,v 1.3 2001/08/22 17:21:45 massiot Exp $
*
* Authors: Gaël Hendryckx <jimmy@via.ecp.fr>
* Christophe Massiot <massiot@via.ecp.fr>
......@@ -143,7 +143,11 @@
/*****************************************************************************
* Protoypes
*****************************************************************************/
void _M( vdec_SparseIDCT ) ( void *, dctelem_t * p_block, int i_sparse_pos);
void _M( vdec_InitIDCT ) ( struct vdec_thread_s * );
void _M( vdec_SparseIDCT ) ( void *, dctelem_t * p_block, int i_sparse_pos );
void _M( vdec_InitIDCT ) ( void ** );
void _M( vdec_IDCT ) ( void *, dctelem_t * p_block, int i_idontcare );
void _M( vdec_InitDecode ) ( );
void _M( vdec_AddBlock ) ( dctelem_t * p_block, yuv_data_t * p_data,
int i_incr );
void _M( vdec_CopyBlock ) ( dctelem_t * p_block, yuv_data_t * p_data,
int i_incr );
......@@ -7,20 +7,18 @@
# Objects
#
PLUGIN_MOTION = motion.o vdec_motion_inner.o
PLUGIN_MOTIONMMX = motionmmx.o vdec_motion_inner_mmx.o
PLUGIN_MOTIONMMXEXT = motionmmxext.o vdec_motion_inner_mmxext.o
PLUGIN_MOTIONCOMMON = vdec_motion_common.o
PLUGIN_MOTION = motion.o
PLUGIN_MOTIONMMX = motionmmx.o
PLUGIN_MOTIONMMXEXT = motionmmxext.o
PLUGIN_MOTION3DNOW = motion3dnow.o
BUILTIN_MOTION = $(PLUGIN_MOTION:%.o=BUILTIN_MOTION_%.o) \
$(PLUGIN_MOTIONCOMMON:%.o=BUILTIN_MOTION_%.o)
BUILTIN_MOTIONMMX = $(PLUGIN_MOTIONMMX:%.o=BUILTIN_MOTIONMMX_%.o) \
$(PLUGIN_MOTIONCOMMON:%.o=BUILTIN_MOTIONMMX_%.o)
BUILTIN_MOTIONMMXEXT = $(PLUGIN_MOTIONMMXEXT:%.o=BUILTIN_MOTIONMMXEXT_%.o) \
$(PLUGIN_MOTIONCOMMON:%.o=BUILTIN_MOTIONMMXEXT_%.o)
BUILTIN_MOTION = $(PLUGIN_MOTION:%.o=BUILTIN_MOTION_%.o)
BUILTIN_MOTIONMMX = $(PLUGIN_MOTIONMMX:%.o=BUILTIN_MOTIONMMX_%.o)
BUILTIN_MOTIONMMXEXT = $(PLUGIN_MOTIONMMXEXT:%.o=BUILTIN_MOTIONMMXEXT_%.o)
BUILTIN_MOTION3DNOW = $(PLUGIN_MOTION3DNOW:%.o=BUILTIN_MOTION3DNOW_%.o)
PLUGIN_C = $(PLUGIN_MOTION) $(PLUGIN_MOTIONMMX) $(PLUGIN_MOTIONMMXEXT) $(PLUGIN_MOTIONCOMMON)
ALL_OBJ = $(PLUGIN_C) $(BUILTIN_MOTION) $(BUILTIN_MOTIONMMX) $(BUILTIN_MOTIONMMXEXT)
PLUGIN_C = $(PLUGIN_MOTION) $(PLUGIN_MOTIONMMX) $(PLUGIN_MOTIONMMXEXT) $(PLUGIN_MOTION3DNOW)
ALL_OBJ = $(PLUGIN_C) $(BUILTIN_MOTION) $(BUILTIN_MOTIONMMX) $(BUILTIN_MOTIONMMXEXT) $(BUILTIN_MOTION3DNOW)
#
# Virtual targets
......@@ -40,35 +38,46 @@ $(BUILTIN_MOTIONMMXEXT): BUILTIN_MOTIONMMXEXT_%.o: .dep/%.d
$(BUILTIN_MOTIONMMXEXT): BUILTIN_MOTIONMMXEXT_%.o: %.c
$(CC) $(CFLAGS) -DBUILTIN -DMODULE_NAME=motionmmxext -c -o $@ $<
$(BUILTIN_MOTION3DNOW): BUILTIN_MOTION3DNOW_%.o: .dep/%.d
$(BUILTIN_MOTION3DNOW): BUILTIN_MOTION3DNOW_%.o: %.c
$(CC) $(CFLAGS) -DBUILTIN -DMODULE_NAME=motion3dnow -c -o $@ $<
#
# Real targets
#
../motion.so: $(PLUGIN_MOTION) $(PLUGIN_MOTIONCOMMON)
../motion.so: $(PLUGIN_MOTION)
$(CC) $(PCFLAGS) -o $@ $^ $(PLCFLAGS)
../motion.a: $(BUILTIN_MOTION)
ar r $@ $^
$(RANLIB) $@
../motionclassic.so: $(PLUGIN_MOTIONCLASSIC) $(PLUGIN_MOTIONCOMMON)
../motionclassic.so: $(PLUGIN_MOTIONCLASSIC)
$(CC) $(PCFLAGS) -o $@ $^ $(PLCFLAGS)
../motionclassic.a: $(BUILTIN_MOTIONCLASSIC)
ar r $@ $^
$(RANLIB) $@
../motionmmx.so: $(PLUGIN_MOTIONMMX) $(PLUGIN_MOTIONCOMMON)
../motionmmx.so: $(PLUGIN_MOTIONMMX)
$(CC) $(PCFLAGS) -o $@ $^ $(PLCFLAGS)
../motionmmx.a: $(BUILTIN_MOTIONMMX)
ar r $@ $^
$(RANLIB) $@
../motionmmxext.so: $(PLUGIN_MOTIONMMXEXT) $(PLUGIN_MOTIONCOMMON)
../motionmmxext.so: $(PLUGIN_MOTIONMMXEXT)
$(CC) $(PCFLAGS) -o $@ $^ $(PLCFLAGS)
../motionmmxext.a: $(BUILTIN_MOTIONMMXEXT)
ar r $@ $^
$(RANLIB) $@
../motion3dnow.so: $(PLUGIN_MOTION3DNOW)
$(CC) $(PCFLAGS) -o $@ $^ $(PLCFLAGS)
../motionm3dnow.a: $(BUILTIN_MOTION3DNOW)
ar r $@ $^
$(RANLIB) $@
/*****************************************************************************
* motion.c : C motion compensation module for vlc
*****************************************************************************
* Copyright (C) 2000 VideoLAN
* $Id: motion.c,v 1.8 2001/07/11 02:01:05 sam Exp $
* Copyright (C) 2001 VideoLAN
* $Id: motion.c,v 1.9 2001/08/22 17:21:45 massiot Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
* Authors: Aaron Holtzman <aholtzma@ess.engr.uvic.ca>
* Michel Lespinasse <walken@zoy.org>
*
* This program 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 of the License, or
* (at your option) any later version.
*
*
* This program 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
......@@ -37,15 +38,13 @@
#include "mtime.h"
#include "tests.h"
#include "video.h"
#include "modules.h"
#include "modules_export.h"
/*****************************************************************************
* Local and extern prototypes.
*****************************************************************************/
void _M( motion_getfunctions )( function_list_t * p_function_list );
static void motion_getfunctions( function_list_t * p_function_list );
/*****************************************************************************
* Build configuration tree.
......@@ -62,7 +61,7 @@ MODULE_INIT_START
MODULE_INIT_STOP
MODULE_ACTIVATE_START
_M( motion_getfunctions )( &p_module->p_functions->motion );
motion_getfunctions( &p_module->p_functions->motion );
MODULE_ACTIVATE_STOP
MODULE_DEACTIVATE_START
......@@ -71,7 +70,7 @@ MODULE_DEACTIVATE_STOP
/*****************************************************************************
* motion_Probe: tests probe the CPU and return a score
*****************************************************************************/
int _M( motion_Probe )( probedata_t *p_data )
static int motion_Probe( probedata_t *p_data )
{
if( TestMethod( MOTION_METHOD_VAR, "motion" )
|| TestMethod( MOTION_METHOD_VAR, "c" ) )
......@@ -83,3 +82,114 @@ int _M( motion_Probe )( probedata_t *p_data )
return( 50 );
}
/*****************************************************************************
* Simple motion compensation in C
*****************************************************************************/
#define avg2(a,b) ((a+b+1)>>1)
#define avg4(a,b,c,d) ((a+b+c+d+2)>>2)
#define predict_(i) (ref[i])
#define predict_x(i) (avg2 (ref[i], ref[i+1]))
#define predict_y(i) (avg2 (ref[i], (ref+stride)[i]))
#define predict_xy(i) (avg4 (ref[i], ref[i+1], (ref+stride)[i], (ref+stride)[i+1]))
#define put(predictor,i) dest[i] = predictor (i)
#define avg(predictor,i) dest[i] = avg2 (predictor (i), dest[i])
// mc function template
#define MC_FUNC(op,xy) \
static void MC_##op##_##xy##16_c (yuv_data_t * dest, yuv_data_t * ref, \
int stride, int height) \
{ \
do { \
op (predict_##xy, 0); \
op (predict_##xy, 1); \
op (predict_##xy, 2); \
op (predict_##xy, 3); \
op (predict_##xy, 4); \
op (predict_##xy, 5); \
op (predict_##xy, 6); \
op (predict_##xy, 7); \
op (predict_##xy, 8); \
op (predict_##xy, 9); \
op (predict_##xy, 10); \
op (predict_##xy, 11); \
op (predict_##xy, 12); \
op (predict_##xy, 13); \
op (predict_##xy, 14); \
op (predict_##xy, 15); \
ref += stride; \
dest += stride; \
} while (--height); \
} \
static void MC_##op##_##xy##8_c (yuv_data_t * dest, yuv_data_t * ref, \
int stride, int height) \
{ \
do { \
op (predict_##xy, 0); \
op (predict_##xy, 1); \
op (predict_##xy, 2); \
op (predict_##xy, 3); \
op (predict_##xy, 4); \
op (predict_##xy, 5); \
op (predict_##xy, 6); \
op (predict_##xy, 7); \
ref += stride; \
dest += stride; \
} while (--height); \
}
// definitions of the actual mc functions
MC_FUNC (put,)
MC_FUNC (avg,)
MC_FUNC (put,x)
MC_FUNC (avg,x)
MC_FUNC (put,y)
MC_FUNC (avg,y)
MC_FUNC (put,xy)
MC_FUNC (avg,xy)
/*****************************************************************************
* Functions exported as capabilities. They are declared as static so that
* we don't pollute the namespace too much.
*****************************************************************************/
static void motion_getfunctions( function_list_t * p_function_list )
{
static void (* ppppf_motion[2][2][4])( yuv_data_t *, yuv_data_t *,
int, int ) =
{
{
/* Copying functions */
{
/* Width == 16 */
MC_put_16_c, MC_put_x16_c, MC_put_y16_c, MC_put_xy16_c
},
{
/* Width == 8 */
MC_put_8_c, MC_put_x8_c, MC_put_y8_c, MC_put_xy8_c
}
},
{
/* Averaging functions */
{
/* Width == 16 */
MC_avg_16_c, MC_avg_x16_c, MC_avg_y16_c, MC_avg_xy16_c
},
{
/* Width == 8 */
MC_avg_8_c, MC_avg_x8_c, MC_avg_y8_c, MC_avg_xy8_c
}
}
};
p_function_list->pf_probe = motion_Probe;
#define list p_function_list->functions.motion
memcpy( list.ppppf_motion, ppppf_motion, sizeof( void * ) * 16 );
#undef list
return;
}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -2,7 +2,7 @@
* ac3_parse.c: ac3 parsing procedures
*****************************************************************************
* Copyright (C) 1999, 2000, 2001 VideoLAN
* $Id: ac3_parse.c,v 1.23 2001/05/15 16:19:42 sam Exp $
* $Id: ac3_parse.c,v 1.24 2001/08/22 17:21:45 massiot Exp $
*
* Authors: Michel Kaempf <maxx@via.ecp.fr>
* Aaron Holtzman <aholtzma@engr.uvic.ca>
......@@ -103,7 +103,7 @@ static const struct frmsize_s frmsizecod_tbl[] =
static const int fscod_tbl[] = {48000, 44100, 32000};
/* Some internal functions */
#ifdef STATS
#ifdef TRACE
static void parse_bsi_stats (ac3dec_t * p_ac3dec);
static void parse_audblk_stats (ac3dec_t * p_ac3dec);
#endif
......@@ -308,7 +308,7 @@ int parse_bsi (ac3dec_t * p_ac3dec)
}
p_ac3dec->total_bits_read += 25;
#ifdef STATS
#ifdef TRACE
parse_bsi_stats (p_ac3dec);
#endif
......@@ -785,7 +785,7 @@ int parse_audblk (ac3dec_t * p_ac3dec, int blknum)
p_ac3dec->total_bits_read += 8 * p_ac3dec->audblk.skipl + 9;
}
#ifdef STATS
#ifdef TRACE
parse_audblk_stats(p_ac3dec);
#endif
......@@ -814,7 +814,7 @@ void parse_auxdata (ac3dec_t * p_ac3dec)
RemoveBits (&p_ac3dec->bit_stream,16);
}
#ifdef STATS
#ifdef TRACE
static void parse_bsi_stats (ac3dec_t * p_ac3dec) /* Some stats */
{
struct mixlev_s
......
......@@ -2,7 +2,7 @@
* audio_decoder.c: MPEG audio decoder thread
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: audio_decoder.c,v 1.51 2001/05/31 01:37:08 sam Exp $
* $Id: audio_decoder.c,v 1.52 2001/08/22 17:21:45 massiot Exp $
*
* Authors: Michel Kaempf <maxx@via.ecp.fr>
* Michel Lespinasse <walken@via.ecp.fr>
......@@ -170,18 +170,6 @@ static void RunThread (adec_thread_t * p_adec)
s16 * buffer;
adec_sync_info_t sync_info;
if( DECODER_FIFO_START( *p_adec->p_fifo)->i_pts )
{
p_adec->p_aout_fifo->date[p_adec->p_aout_fifo->l_end_frame] =
DECODER_FIFO_START( *p_adec->p_fifo )->i_pts;
DECODER_FIFO_START(*p_adec->p_fifo)->i_pts = 0;
}
else
{
p_adec->p_aout_fifo->date[p_adec->p_aout_fifo->l_end_frame] =
LAST_MDATE;
}
if( ! adec_SyncFrame (p_adec, &sync_info) )
{
sync = 1;
......@@ -191,6 +179,18 @@ static void RunThread (adec_thread_t * p_adec)
buffer = ((s16 *)p_adec->p_aout_fifo->buffer)
+ (p_adec->p_aout_fifo->l_end_frame * ADEC_FRAME_SIZE);
if( DECODER_FIFO_START( *p_adec->p_fifo)->i_pts )
{
p_adec->p_aout_fifo->date[p_adec->p_aout_fifo->l_end_frame] =
DECODER_FIFO_START( *p_adec->p_fifo )->i_pts;
DECODER_FIFO_START(*p_adec->p_fifo)->i_pts = 0;
}
else
{
p_adec->p_aout_fifo->date[p_adec->p_aout_fifo->l_end_frame] =
LAST_MDATE;
}
if( adec_DecodeFrame (p_adec, buffer) )
{
/* Ouch, failed decoding... We'll have to resync */
......
......@@ -2,7 +2,7 @@
* input_ext-dec.c: services to the decoders
*****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN
* $Id: input_ext-dec.c,v 1.17 2001/07/17 09:48:08 massiot Exp $
* $Id: input_ext-dec.c,v 1.18 2001/08/22 17:21:45 massiot Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
......@@ -150,10 +150,10 @@ void NextDataPacket( bit_stream_t * p_bit_stream )
}
/*****************************************************************************
* UnalignedShowBits : return i_bits bits from the bit stream, even when
* UnalignedShowBits : places i_bits bits into the bit buffer, even when
* not aligned on a word boundary
*****************************************************************************/
u32 UnalignedShowBits( bit_stream_t * p_bit_stream, unsigned int i_bits )
void UnalignedShowBits( bit_stream_t * p_bit_stream, unsigned int i_bits )
{
/* We just fill in the bit buffer. */
while( p_bit_stream->fifo.i_available < i_bits )
......@@ -216,11 +216,8 @@ u32 UnalignedShowBits( bit_stream_t * p_bit_stream, unsigned int i_bits )
AlignWord( p_bit_stream );
}
}
return( ShowBits( p_bit_stream, i_bits ) );
}
}
return( p_bit_stream->fifo.buffer >> (8 * sizeof(WORD_TYPE) - i_bits) );
}
/*****************************************************************************
......@@ -283,7 +280,7 @@ u32 UnalignedGetBits( bit_stream_t * p_bit_stream, unsigned int i_bits )
{
/* Get aligned on a word boundary. Otherwise it is safer
* to do it the next time.
* NB : we _will_ get aligned, because we have at most
* NB : we _will_ get aligned, because we have at most
* sizeof(WORD_TYPE) - 1 bytes to store, and at least
* sizeof(WORD_TYPE) - 1 empty bytes in the bit buffer. */
AlignWord( p_bit_stream );
......
This diff is collapsed.
......@@ -2,7 +2,7 @@
* video_decoder.h : video decoder thread
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: video_decoder.h,v 1.4 2001/07/18 14:21:00 massiot Exp $
* $Id: video_decoder.h,v 1.5 2001/08/22 17:21:45 massiot Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
......@@ -24,18 +24,12 @@
/*****************************************************************************
* Prototypes
*****************************************************************************/
struct vpar_thread_s;
struct macroblock_s;
/* Thread management functions */
void vdec_InitThread ( struct vdec_thread_s *p_vdec );
void vdec_EndThread ( struct vdec_thread_s *p_vdec );
void vdec_DecodeMacroblock ( struct vdec_thread_s *p_vdec,
struct macroblock_s *p_mb );
void vdec_DecodeMacroblockC ( struct vdec_thread_s *p_vdec,
struct macroblock_s *p_mb );
void vdec_DecodeMacroblockBW ( struct vdec_thread_s *p_vdec,
struct macroblock_s *p_mb );
void vdec_InitThread ( struct vdec_thread_s * );
void vdec_EndThread ( struct vdec_thread_s * );
void vdec_DecodeMacroblockC ( struct vdec_thread_s *,
struct macroblock_s * );
void vdec_DecodeMacroblockBW ( struct vdec_thread_s *,
struct macroblock_s * );
struct vdec_thread_s * vdec_CreateThread( struct vdec_pool_s * );
void vdec_DestroyThread ( struct vdec_thread_s *p_vdec );
void vdec_DestroyThread ( struct vdec_thread_s * );
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -2,7 +2,7 @@
* vpar_pool.c : management of the pool of decoder threads
*****************************************************************************
* Copyright (C) 1999, 2000, 2001 VideoLAN
* $Id: vpar_pool.c,v 1.1 2001/07/18 14:21:00 massiot Exp $
* $Id: vpar_pool.c,v 1.2 2001/08/22 17:21:46 massiot Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
......@@ -186,11 +186,11 @@ void vpar_SpawnPool( vpar_thread_t * p_vpar )
if( !b_grayscale )
{
p_vpar->pool.pf_vdec_decode = p_vpar->pf_decode_mb_c;
p_vpar->pool.pf_vdec_decode = vdec_DecodeMacroblockC;
}
else
{
p_vpar->pool.pf_vdec_decode = p_vpar->pf_decode_mb_bw;
p_vpar->pool.pf_vdec_decode = vdec_DecodeMacroblockBW;
}
}
......
......@@ -2,7 +2,7 @@
* vpar_pool.h : video parser/video decoders communication
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: vpar_pool.h,v 1.1 2001/07/18 14:21:00 massiot Exp $
* $Id: vpar_pool.h,v 1.2 2001/08/22 17:21:46 massiot Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
......@@ -73,8 +73,13 @@ typedef struct vdec_pool_s
boolean_t b_bw; /* Current value for B&W */
/* Access to the plug-ins needed by the video decoder thread */
void ( * pf_decode_init ) ( struct vdec_thread_s * );
void ( * pf_idct_init ) ( struct vdec_thread_s * );
void ( * pf_idct_init ) ( void ** );
void ( * pf_decode_init ) ( );
void ( * pf_addblock ) ( dctelem_t *, yuv_data_t *, int );
void ( * pf_copyblock ) ( dctelem_t *, yuv_data_t *, int );
void ( * ppppf_motion[2][2][4] ) ( yuv_data_t *, yuv_data_t *,
int, int );
} vdec_pool_t;
/*****************************************************************************
......
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