Commit 89a64c61 authored by Sam Hocevar's avatar Sam Hocevar

. fix� une erreur de syntaxe dans video_fb.c

 . *3dfx* devient *glide*
 . suppression de tabulations dans quelques fichiers
 . suppression des 2 warnings dans sam_synchro
 . video_* devient vout_* quand ce sont des m�thodes de vout
 . tentative de correction de la d�tection de MMX pour BeOS
 . nouvelle option vlc_vout_method (faute de mieux pour le moment)
 . modification du Makefile pour supporter plusieurs VIDEO_*

dor�navant on peut compiler plusieurs output diff�rents dans le
client. la pr�f�rence se fait dans l'ordre x11, fb, ggi, glide...

si on le compile avec x11 et fb, par d�faut il se lancera en X.
pour le lancer en framebuffer :
./vlc vlc_vout_method=fb

(il faut que je proprifie un peu le choix de l'output, et que je
facilite l'ajout d'un nouveau vout_*)
parent ce722764
......@@ -14,17 +14,16 @@
#SHELL=/bin/sh
# Video output settings
VIDEO=X11
#VIDEO=DUMMY
#VIDEO=FB
#VIDEO=GGI
VIDEO_X11=YES
VIDEO_FB=YES
#VIDEO_GGI=YES
# Highly experimental
#VIDEO=3DFX
#VIDEO_GLIDE=YES
# Not yet supported
#VIDEO=BEOS
#VIDEO=DGA
#VIDEO_BEOS=YES
#VIDEO_DGA=YES
# Target architecture
ARCH=X86
......@@ -56,8 +55,49 @@ DEBUG=1
# Program version - may only be changed by the project leader
PROGRAM_VERSION = 1.0-dev
# VIDEO_OPTIONS describes all used video options
VIDEO_OPTIONS = dummy
intf_method = interface/intf_dummy.o
vout_method = video_output/vout_dummy.o
ifeq ($(VIDEO_GLIDE), YES)
VIDEO_OPTIONS += glide
DEFINE += -DVIDEO_GLIDE
intf_method += interface/intf_glide.o
vout_method += video_output/vout_glide.o
endif
ifeq ($(VIDEO_X11), YES)
VIDEO_OPTIONS += x11
DEFINE += -DVIDEO_X11
intf_method += interface/intf_x11.o
vout_method += video_output/vout_x11.o
endif
ifeq ($(VIDEO_GGI), YES)
VIDEO_OPTIONS += ggi
DEFINE += -DVIDEO_GGI
intf_method += interface/intf_ggi.o
vout_method += video_output/vout_ggi.o
endif
ifeq ($(VIDEO_FB), YES)
VIDEO_OPTIONS += fb
DEFINE += -DVIDEO_FB
intf_method += interface/intf_fb.o
vout_method += video_output/vout_fb.o
endif
ifeq ($(VIDEO_BEOS), YES)
VIDEO_OPTIONS += beos
DEFINE += -DVIDEO_BEOS
intf_method += interface/intf_beos.o
vout_method += video_output/vout_beos.o
endif
ifeq ($(VIDEO_DGA), YES)
VIDEO_OPTIONS += dga
DEFINE += -DVIDEO_DGA
intf_method += interface/intf_dga.o
vout_method += video_output/vout_dga.o
endif
# PROGRAM_OPTIONS is an identification string of the compilation options
PROGRAM_OPTIONS = $(VIDEO) $(ARCH) $(SYS)
PROGRAM_OPTIONS = $(ARCH) $(SYS)
ifeq ($(DEBUG),1)
PROGRAM_OPTIONS += DEBUG
endif
......@@ -66,10 +106,10 @@ endif
PROGRAM_BUILD = `date -R` $(USER)@`hostname`
# DEFINE will contain some of the constants definitions decided in Makefile,
# including VIDEO_xx and ARCH_xx. It will be passed to C compiler.
DEFINE += -DVIDEO_$(VIDEO)
# including ARCH_xx and SYS_xx. It will be passed to C compiler.
DEFINE += -DARCH_$(ARCH)
DEFINE += -DSYS_$(SYS)
DEFINE += -DVIDEO_OPTIONS="\"$(VIDEO_OPTIONS)\""
DEFINE += -DPROGRAM_VERSION="\"$(PROGRAM_VERSION)\""
DEFINE += -DPROGRAM_OPTIONS="\"$(PROGRAM_OPTIONS)\""
DEFINE += -DPROGRAM_BUILD="\"$(PROGRAM_BUILD)\""
......@@ -81,7 +121,7 @@ endif
video = $(shell echo $(VIDEO) | tr 'A-Z' 'a-z')
################################################################################
# Tunning and other variables - do not change anything except if you know
# Tuning and other variables - do not change anything except if you know
# exactly what you are doing
################################################################################
......@@ -90,11 +130,11 @@ video = $(shell echo $(VIDEO) | tr 'A-Z' 'a-z')
#
INCLUDE += -Iinclude
ifeq ($(VIDEO),X11)
ifeq ($(VIDEO_X11),YES)
INCLUDE += -I/usr/X11R6/include
endif
ifeq ($(VIDEO),3DFX)
ifeq ($(VIDEO_GLIDE),YES)
INCLUDE += -I/usr/include/glide
endif
......@@ -104,15 +144,15 @@ endif
LIB += -lpthread
LIN += -lm
ifeq ($(VIDEO),X11)
ifeq ($(VIDEO_X11),YES)
LIB += -L/usr/X11R6/lib
LIB += -lX11
LIB += -lXext
endif
ifeq ($(VIDEO),GGI)
ifeq ($(VIDEO_GGI),YES)
LIB += -lggi
endif
ifeq ($(VIDEO),3DFX)
ifeq ($(VIDEO_GLIDE),YES)
LIB += -lglide2x
endif
......@@ -194,7 +234,7 @@ interface_obj = interface/main.o \
interface/intf_ctrl.o \
interface/control.o \
interface/intf_console.o \
interface/intf_$(video).o
$(intf_method)
input_obj = input/input_vlan.o \
input/input_file.o \
......@@ -209,9 +249,9 @@ audio_output_obj = audio_output/audio_output.o \
audio_output/audio_dsp.o
video_output_obj = video_output/video_output.o \
video_output/video_$(video).o \
video_output/video_text.o \
video_output/video_yuv.o
video_output/video_yuv.o \
$(vout_method)
ac3_decoder_obj = ac3_decoder/ac3_decoder.o \
ac3_decoder/ac3_parse.o \
......
......@@ -23,265 +23,265 @@
typedef struct syncinfo_s
{
/* Sync word == 0x0B77 */
/* u16 syncword; */
/* crc for the first 5/8 of the sync block */
/* u16 crc1; */
/* Stream Sampling Rate (kHz) 0 = 48, 1 = 44.1, 2 = 32, 3 = reserved */
u16 fscod;
/* Frame size code */
u16 frmsizecod;
/* Information not in the AC-3 bitstream, but derived */
/* Frame size in 16 bit words */
u16 frame_size;
/* Bit rate in kilobits */
u16 bit_rate;
/* Sync word == 0x0B77 */
/* u16 syncword; */
/* crc for the first 5/8 of the sync block */
/* u16 crc1; */
/* Stream Sampling Rate (kHz) 0 = 48, 1 = 44.1, 2 = 32, 3 = reserved */
u16 fscod;
/* Frame size code */
u16 frmsizecod;
/* Information not in the AC-3 bitstream, but derived */
/* Frame size in 16 bit words */
u16 frame_size;
/* Bit rate in kilobits */
u16 bit_rate;
} syncinfo_t;
typedef struct bsi_s
{
/* Bit stream identification == 0x8 */
u16 bsid;
/* Bit stream mode */
u16 bsmod;
/* Audio coding mode */
u16 acmod;
/* If we're using the centre channel then */
/* centre mix level */
u16 cmixlev;
/* If we're using the surround channel then */
/* surround mix level */
u16 surmixlev;
/* If we're in 2/0 mode then */
/* Dolby surround mix level - NOT USED - */
u16 dsurmod;
/* Low frequency effects on */
u16 lfeon;
/* Dialogue Normalization level */
u16 dialnorm;
/* Compression exists */
u16 compre;
/* Compression level */
u16 compr;
/* Language code exists */
u16 langcode;
/* Language code */
u16 langcod;
/* Audio production info exists*/
u16 audprodie;
u16 mixlevel;
u16 roomtyp;
/* If we're in dual mono mode (acmod == 0) then extra stuff */
u16 dialnorm2;
u16 compr2e;
u16 compr2;
u16 langcod2e;
u16 langcod2;
u16 audprodi2e;
u16 mixlevel2;
u16 roomtyp2;
/* Copyright bit */
u16 copyrightb;
/* Original bit */
u16 origbs;
/* Timecode 1 exists */
u16 timecod1e;
/* Timecode 1 */
u16 timecod1;
/* Timecode 2 exists */
u16 timecod2e;
/* Timecode 2 */
u16 timecod2;
/* Additional bit stream info exists */
u16 addbsie;
/* Additional bit stream length - 1 (in bytes) */
u16 addbsil;
/* Additional bit stream information (max 64 bytes) */
u8 addbsi[64];
/* Information not in the AC-3 bitstream, but derived */
/* Number of channels (excluding LFE)
* Derived from acmod */
u16 nfchans;
/* Bit stream identification == 0x8 */
u16 bsid;
/* Bit stream mode */
u16 bsmod;
/* Audio coding mode */
u16 acmod;
/* If we're using the centre channel then */
/* centre mix level */
u16 cmixlev;
/* If we're using the surround channel then */
/* surround mix level */
u16 surmixlev;
/* If we're in 2/0 mode then */
/* Dolby surround mix level - NOT USED - */
u16 dsurmod;
/* Low frequency effects on */
u16 lfeon;
/* Dialogue Normalization level */
u16 dialnorm;
/* Compression exists */
u16 compre;
/* Compression level */
u16 compr;
/* Language code exists */
u16 langcode;
/* Language code */
u16 langcod;
/* Audio production info exists*/
u16 audprodie;
u16 mixlevel;
u16 roomtyp;
/* If we're in dual mono mode (acmod == 0) then extra stuff */
u16 dialnorm2;
u16 compr2e;
u16 compr2;
u16 langcod2e;
u16 langcod2;
u16 audprodi2e;
u16 mixlevel2;
u16 roomtyp2;
/* Copyright bit */
u16 copyrightb;
/* Original bit */
u16 origbs;
/* Timecode 1 exists */
u16 timecod1e;
/* Timecode 1 */
u16 timecod1;
/* Timecode 2 exists */
u16 timecod2e;
/* Timecode 2 */
u16 timecod2;
/* Additional bit stream info exists */
u16 addbsie;
/* Additional bit stream length - 1 (in bytes) */
u16 addbsil;
/* Additional bit stream information (max 64 bytes) */
u8 addbsi[64];
/* Information not in the AC-3 bitstream, but derived */
/* Number of channels (excluding LFE)
* Derived from acmod */
u16 nfchans;
} bsi_t;
/* more pain */
typedef struct audblk_s
{
/* block switch bit indexed by channel num */
u16 blksw[5];
/* dither enable bit indexed by channel num */
u16 dithflag[5];
/* dynamic range gain exists */
u16 dynrnge;
/* dynamic range gain */
u16 dynrng;
/* if acmod==0 then */
/* dynamic range 2 gain exists */
u16 dynrng2e;
/* dynamic range 2 gain */
u16 dynrng2;
/* coupling strategy exists */
u16 cplstre;
/* coupling in use */
u16 cplinu;
/* channel coupled */
u16 chincpl[5];
/* if acmod==2 then */
/* Phase flags in use */
u16 phsflginu;
/* coupling begin frequency code */
u16 cplbegf;
/* coupling end frequency code */
u16 cplendf;
/* coupling band structure bits */
u16 cplbndstrc[18];
/* Do coupling co-ords exist for this channel? */
u16 cplcoe[5];
/* Master coupling co-ordinate */
u16 mstrcplco[5];
/* Per coupling band coupling co-ordinates */
u16 cplcoexp[5][18];
u16 cplcomant[5][18];
/* Phase flags for dual mono */
u16 phsflg[18];
/* Is there a rematrixing strategy */
u16 rematstr;
/* Rematrixing bits */
u16 rematflg[4];
/* Coupling exponent strategy */
u16 cplexpstr;
/* Exponent strategy for full bandwidth channels */
u16 chexpstr[5];
/* Exponent strategy for lfe channel */
u16 lfeexpstr;
/* Channel bandwidth for independent channels */
u16 chbwcod[5];
/* The absolute coupling exponent */
u16 cplabsexp;
/* Coupling channel exponents (D15 mode gives 18 * 12 /3 encoded exponents */
u16 cplexps[18 * 12 / 3];
/* Sanity checking constant */
u32 magic2;
/* fbw channel exponents */
u16 exps[5][252 / 3];
/* channel gain range */
u16 gainrng[5];
/* low frequency exponents */
u16 lfeexps[3];
/* Bit allocation info */
u16 baie;
/* Slow decay code */
u16 sdcycod;
/* Fast decay code */
u16 fdcycod;
/* Slow gain code */
u16 sgaincod;
/* dB per bit code */
u16 dbpbcod;
/* masking floor code */
u16 floorcod;
/* SNR offset info */
u16 snroffste;
/* coarse SNR offset */
u16 csnroffst;
/* coupling fine SNR offset */
u16 cplfsnroffst;
/* coupling fast gain code */
u16 cplfgaincod;
/* fbw fine SNR offset */
u16 fsnroffst[5];
/* fbw fast gain code */
u16 fgaincod[5];
/* lfe fine SNR offset */
u16 lfefsnroffst;
/* lfe fast gain code */
u16 lfefgaincod;
/* Coupling leak info */
u16 cplleake;
/* coupling fast leak initialization */
u16 cplfleak;
/* coupling slow leak initialization */
u16 cplsleak;
/* delta bit allocation info */
u16 deltbaie;
/* coupling delta bit allocation exists */
u16 cpldeltbae;
/* fbw delta bit allocation exists */
u16 deltbae[5];
/* number of cpl delta bit segments */
u16 cpldeltnseg;
/* coupling delta bit allocation offset */
u16 cpldeltoffst[8];
/* coupling delta bit allocation length */
u16 cpldeltlen[8];
/* coupling delta bit allocation length */
u16 cpldeltba[8];
/* number of delta bit segments */
u16 deltnseg[5];
/* fbw delta bit allocation offset */
u16 deltoffst[5][8];
/* fbw delta bit allocation length */
u16 deltlen[5][8];
/* fbw delta bit allocation length */
u16 deltba[5][8];
/* skip length exists */
u16 skiple;
/* skip length */
u16 skipl;
/* channel mantissas */
// u16 chmant[5][256];
/* coupling mantissas */
float cplfbw[ 256 ];
// u16 cplmant[256];
/* coupling mantissas */
// u16 lfemant[7];
/* -- Information not in the bitstream, but derived thereof -- */
/* Number of coupling sub-bands */
u16 ncplsubnd;
/* Number of combined coupling sub-bands
* Derived from ncplsubnd and cplbndstrc */
u16 ncplbnd;
/* Number of exponent groups by channel
* Derived from strmant, endmant */
u16 nchgrps[5];
/* Number of coupling exponent groups
* Derived from cplbegf, cplendf, cplexpstr */
u16 ncplgrps;
/* End mantissa numbers of fbw channels */
u16 endmant[5];
/* Start and end mantissa numbers for the coupling channel */
u16 cplstrtmant;
u16 cplendmant;
/* Decoded exponent info */
u16 fbw_exp[5][256];
u16 cpl_exp[256];
u16 lfe_exp[7];
/* Bit allocation pointer results */
u16 fbw_bap[5][256];
//FIXME figure out exactly how many entries there should be (253-37?)
u16 cpl_bap[256];
u16 lfe_bap[7];
/* block switch bit indexed by channel num */
u16 blksw[5];
/* dither enable bit indexed by channel num */
u16 dithflag[5];
/* dynamic range gain exists */
u16 dynrnge;
/* dynamic range gain */
u16 dynrng;
/* if acmod==0 then */
/* dynamic range 2 gain exists */
u16 dynrng2e;
/* dynamic range 2 gain */
u16 dynrng2;
/* coupling strategy exists */
u16 cplstre;
/* coupling in use */
u16 cplinu;
/* channel coupled */
u16 chincpl[5];
/* if acmod==2 then */
/* Phase flags in use */
u16 phsflginu;
/* coupling begin frequency code */
u16 cplbegf;
/* coupling end frequency code */
u16 cplendf;
/* coupling band structure bits */
u16 cplbndstrc[18];
/* Do coupling co-ords exist for this channel? */
u16 cplcoe[5];
/* Master coupling co-ordinate */
u16 mstrcplco[5];
/* Per coupling band coupling co-ordinates */
u16 cplcoexp[5][18];
u16 cplcomant[5][18];
/* Phase flags for dual mono */
u16 phsflg[18];
/* Is there a rematrixing strategy */
u16 rematstr;
/* Rematrixing bits */
u16 rematflg[4];
/* Coupling exponent strategy */
u16 cplexpstr;
/* Exponent strategy for full bandwidth channels */
u16 chexpstr[5];
/* Exponent strategy for lfe channel */
u16 lfeexpstr;
/* Channel bandwidth for independent channels */
u16 chbwcod[5];
/* The absolute coupling exponent */
u16 cplabsexp;
/* Coupling channel exponents (D15 mode gives 18 * 12 /3 encoded exponents */
u16 cplexps[18 * 12 / 3];
/* Sanity checking constant */
u32 magic2;
/* fbw channel exponents */
u16 exps[5][252 / 3];
/* channel gain range */
u16 gainrng[5];
/* low frequency exponents */
u16 lfeexps[3];
/* Bit allocation info */
u16 baie;
/* Slow decay code */
u16 sdcycod;
/* Fast decay code */
u16 fdcycod;
/* Slow gain code */
u16 sgaincod;
/* dB per bit code */
u16 dbpbcod;
/* masking floor code */
u16 floorcod;
/* SNR offset info */
u16 snroffste;
/* coarse SNR offset */
u16 csnroffst;
/* coupling fine SNR offset */
u16 cplfsnroffst;
/* coupling fast gain code */
u16 cplfgaincod;
/* fbw fine SNR offset */
u16 fsnroffst[5];
/* fbw fast gain code */
u16 fgaincod[5];
/* lfe fine SNR offset */
u16 lfefsnroffst;
/* lfe fast gain code */
u16 lfefgaincod;
/* Coupling leak info */
u16 cplleake;
/* coupling fast leak initialization */
u16 cplfleak;
/* coupling slow leak initialization */
u16 cplsleak;
/* delta bit allocation info */
u16 deltbaie;
/* coupling delta bit allocation exists */
u16 cpldeltbae;
/* fbw delta bit allocation exists */
u16 deltbae[5];
/* number of cpl delta bit segments */
u16 cpldeltnseg;
/* coupling delta bit allocation offset */
u16 cpldeltoffst[8];
/* coupling delta bit allocation length */
u16 cpldeltlen[8];
/* coupling delta bit allocation length */
u16 cpldeltba[8];
/* number of delta bit segments */
u16 deltnseg[5];
/* fbw delta bit allocation offset */
u16 deltoffst[5][8];
/* fbw delta bit allocation length */
u16 deltlen[5][8];
/* fbw delta bit allocation length */
u16 deltba[5][8];
/* skip length exists */
u16 skiple;
/* skip length */
u16 skipl;
/* channel mantissas */
// u16 chmant[5][256];
/* coupling mantissas */
float cplfbw[ 256 ];
// u16 cplmant[256];
/* coupling mantissas */
// u16 lfemant[7];
/* -- Information not in the bitstream, but derived thereof -- */
/* Number of coupling sub-bands */
u16 ncplsubnd;
/* Number of combined coupling sub-bands
* Derived from ncplsubnd and cplbndstrc */
u16 ncplbnd;
/* Number of exponent groups by channel
* Derived from strmant, endmant */
u16 nchgrps[5];
/* Number of coupling exponent groups
* Derived from cplbegf, cplendf, cplexpstr */
u16 ncplgrps;
/* End mantissa numbers of fbw channels */
u16 endmant[5];
/* Start and end mantissa numbers for the coupling channel */
u16 cplstrtmant;
u16 cplendmant;
/* Decoded exponent info */
u16 fbw_exp[5][256];
u16 cpl_exp[256];
u16 lfe_exp[7];
/* Bit allocation pointer results */
u16 fbw_bap[5][256];
//FIXME figure out exactly how many entries there should be (253-37?)
u16 cpl_bap[256];
u16 lfe_bap[7];
} audblk_t;
......@@ -306,14 +306,14 @@ typedef struct audblk_s
typedef struct stream_coeffs_s
{
float fbw[5][256];
float lfe[256];
float fbw[5][256];
float lfe[256];
} stream_coeffs_t;
typedef struct stream_samples_s
{
float channel[6][256];
float channel[6][256];
} stream_samples_t;
......
......@@ -24,7 +24,7 @@
*****************************************************************************/
/* Program version and copyright message */
#define COPYRIGHT_MESSAGE "VideoLAN Client v" PROGRAM_VERSION " - (c)1999-2000 VideoLAN"
#define COPYRIGHT_MESSAGE "VideoLAN Client v" PROGRAM_VERSION " - (c)1999-2000 VideoLAN"
#define VERSION_MESSAGE "VideoLAN Client - (c)1999-2000 VideoLAN\n" \
"version " PROGRAM_VERSION " ( " PROGRAM_BUILD " )\n" \
"compilation options: " PROGRAM_OPTIONS
......@@ -97,7 +97,7 @@
*****************************************************************************/
/* Environment variable used to store startup script name and default value */
#define INTF_INIT_SCRIPT_VAR "vlc_init"
#define INTF_INIT_SCRIPT_VAR "vlc_init"
#define INTF_INIT_SCRIPT_DEFAULT "vlc.init"
/* Environment variable used to store channels file and default value */
......@@ -226,6 +226,9 @@
* Default settings for video output threads
*/
/* Environment variable containing the display method */
#define VOUT_METHOD_VAR "vlc_vout_method"
/* Environment variable used in place of DISPLAY if available */
#define VOUT_DISPLAY_VAR "vlc_display"
......
......@@ -18,9 +18,10 @@
* in release program.
*****************************************************************************/
#ifdef DEBUG
#define ASSERT(p_Mem) \
if (!(p_Mem)) \
intf_ErrMsg("Void pointer error: %s line %d (variable %s at address %p)\n", \
#define ASSERT(p_Mem) \
if (!(p_Mem)) \
intf_ErrMsg("Void pointer error: " \
"%s line %d (variable %s at address %p)\n", \
__FILE__, __LINE__, #p_Mem, &p_Mem);
#else
......@@ -37,7 +38,7 @@ if (!(p_Mem)) \
* program is compiled with the debug option.
*****************************************************************************/
#ifdef DEBUG
#define RZERO(r_Var) \
#define RZERO(r_Var) \
bzero(&(r_Var), sizeof((r_Var)));
#else
......@@ -53,7 +54,7 @@ bzero(&(r_Var), sizeof((r_Var)));
* It has the same purpose than RZERO, but for pointers.
*****************************************************************************/
#ifdef DEBUG
#define PZERO(p_Mem) \
#define PZERO(p_Mem) \
bzero((p_Mem), sizeof(*(p_Mem)));
#else
......@@ -69,7 +70,7 @@ bzero((p_Mem), sizeof(*(p_Mem)));
* It has the same purpose than RZERO or PZERO, but for array
*****************************************************************************/
#ifdef DEBUG
#define AZERO(p_Array, i_Size) \
#define AZERO(p_Array, i_Size) \
bzero((p_Array), (i_Size)*sizeof(*(p_Array)));
#else
......
......@@ -39,7 +39,7 @@ static __inline__ void input_NetlistFreePES( input_thread_t *p_input,
p_ts_packet = p_pes_packet->p_first_ts;
for( i_dummy = 0; i_dummy < p_pes_packet->i_ts_packets; i_dummy++ )
{
ASSERT(p_ts_packet);
ASSERT(p_ts_packet);
#ifdef INPUT_LIFO_TS_NETLIST
p_input->netlist.i_ts_index--;
......
......@@ -26,6 +26,10 @@
* This structe describes all interface-specific data of the main (interface)
* thread.
*****************************************************************************/
typedef int ( intf_sys_create_t ) ( p_intf_thread_t p_intf );
typedef void ( intf_sys_destroy_t ) ( p_intf_thread_t p_intf );
typedef void ( intf_sys_manage_t ) ( p_intf_thread_t p_intf );
typedef struct intf_thread_s
{
boolean_t b_die; /* `die' flag */
......@@ -34,12 +38,18 @@ typedef struct intf_thread_s
p_intf_console_t p_console; /* console */
p_intf_sys_t p_sys; /* system interface */
/* method-specific functions */
intf_sys_create_t * p_sys_create; /* create interface thread */
intf_sys_manage_t * p_sys_manage; /* main loop */
intf_sys_destroy_t * p_sys_destroy; /* destroy interface */
/* Channels array - NULL if not used */
p_intf_channel_t p_channel; /* description of channels */
/* Main threads - NULL if not active */
p_vout_thread_t p_vout;
p_input_thread_t p_input;
} intf_thread_t;
/*****************************************************************************
......
......@@ -6,6 +6,37 @@
/*****************************************************************************
* Prototypes
*****************************************************************************/
int intf_SysCreate ( p_intf_thread_t p_intf );
void intf_SysDestroy( p_intf_thread_t p_intf );
void intf_SysManage ( p_intf_thread_t p_intf );
int intf_DummySysCreate ( p_intf_thread_t p_intf );
void intf_DummySysDestroy ( p_intf_thread_t p_intf );
void intf_DummySysManage ( p_intf_thread_t p_intf );
#ifdef VIDEO_X11
int intf_X11SysCreate ( p_intf_thread_t p_intf );
void intf_X11SysDestroy ( p_intf_thread_t p_intf );
void intf_X11SysManage ( p_intf_thread_t p_intf );
#endif
#ifdef VIDEO_FB
int intf_FBSysCreate ( p_intf_thread_t p_intf );
void intf_FBSysDestroy ( p_intf_thread_t p_intf );
void intf_FBSysManage ( p_intf_thread_t p_intf );
#endif
#ifdef VIDEO_GLIDE
int intf_GlideSysCreate ( p_intf_thread_t p_intf );
void intf_GlideSysDestroy ( p_intf_thread_t p_intf );
void intf_GlideSysManage ( p_intf_thread_t p_intf );
#endif
#ifdef VIDEO_DGA
int intf_DGASysCreate ( p_intf_thread_t p_intf );
void intf_DGASysDestroy ( p_intf_thread_t p_intf );
void intf_DGASysManage ( p_intf_thread_t p_intf );
#endif
#ifdef VIDEO_GGI
int intf_GGISysCreate ( p_intf_thread_t p_intf );
void intf_GGISysDestroy ( p_intf_thread_t p_intf );
void intf_GGISysManage ( p_intf_thread_t p_intf );
#endif
#ifdef VIDEO_BEOS
int intf_BeSysCreate ( p_intf_thread_t p_intf );
void intf_BeSysDestroy ( p_intf_thread_t p_intf );
void intf_BeSysManage ( p_intf_thread_t p_intf );
#endif
......@@ -86,15 +86,15 @@ struct vdec_thread_s;
* shows that the values given below are the most effective.
*/
#define CONST_BITS 8 /* Jimmy chose this constant :) */
#define CONST_BITS 8 /* Jimmy chose this constant :) */
#ifdef EIGHT_BIT_SAMPLES
#define PASS1_BITS 2
#else
#define PASS1_BITS 1 /* lose a little precision to avoid overflow */
#define PASS1_BITS 1 /* lose a little precision to avoid overflow */
#endif
#define ONE ((s32) 1)
#define ONE ((s32) 1)
#define CONST_SCALE (ONE << CONST_BITS)
......@@ -104,10 +104,10 @@ struct vdec_thread_s;
* the correct integer constant values and insert them by hand.
*/
#define FIX(x) ((s32) ((x) * CONST_SCALE + 0.5))
#define FIX(x) ((s32) ((x) * CONST_SCALE + 0.5))
/* When adding two opposite-signed fixes, the 0.5 cancels */
#define FIX2(x) ((s32) ((x) * CONST_SCALE))
#define FIX2(x) ((s32) ((x) * CONST_SCALE))
/* Descale and correctly round an s32 value that's scaled by N bits.
* We assume RIGHT_SHIFT rounds towards minus infinity, so adding
......@@ -128,15 +128,15 @@ struct vdec_thread_s;
*/
#ifdef EIGHT_BIT_SAMPLES
#ifdef SHORTxSHORT_32 /* may work if 'int' is 32 bits */
#ifdef SHORTxSHORT_32 /* may work if 'int' is 32 bits */
#define MULTIPLY(var,const) (((INT16) (var)) * ((INT16) (const)))
#endif
#ifdef SHORTxLCONST_32 /* known to work with Microsoft C 6.0 */
#ifdef SHORTxLCONST_32 /* known to work with Microsoft C 6.0 */
#define MULTIPLY(var,const) (((INT16) (var)) * ((s32) (const)))
#endif
#endif
#ifndef MULTIPLY /* default definition */
#ifndef MULTIPLY /* default definition */
#define MULTIPLY(var,const) ((var) * (const))
#endif
......
......@@ -140,7 +140,7 @@ static __inline__ void vpar_ReleaseMacroblock( video_fifo_t * p_fifo,
/* Unlink referenced pictures */
if( p_mb->p_forward != NULL )
{
vout_UnlinkPicture( p_fifo->p_vpar->p_vout, p_mb->p_forward );
vout_UnlinkPicture( p_fifo->p_vpar->p_vout, p_mb->p_forward );
}
if( p_mb->p_backward != NULL )
{
......
......@@ -61,7 +61,7 @@ typedef struct vout_yuv_s
* vout_buffer_t: rendering buffer
*****************************************************************************
* This structure store informations about a buffer. Buffers are not completely
* cleared between displays, and modified areas needs to be stored.
* cleared between displays, and modified areas need to be stored.
*****************************************************************************/
typedef struct vout_buffer_s
{
......@@ -82,11 +82,18 @@ typedef struct vout_buffer_s
* vout_thread_t: video output thread descriptor
*****************************************************************************
* Any independant video output device, such as an X11 window or a GGI device,
* is represented by a video output thread, and described using following
* is represented by a video output thread, and described using the following
* structure.
*****************************************************************************/
typedef void (vout_set_palette_t)( p_vout_thread_t p_vout,
u16 *red, u16 *green, u16 *blue, u16 *transp );
typedef int (vout_sys_create_t) ( p_vout_thread_t p_vout,
char *psz_display, int i_root_window );
typedef int (vout_sys_init_t) ( p_vout_thread_t p_vout );
typedef void (vout_sys_end_t) ( p_vout_thread_t p_vout );
typedef void (vout_sys_destroy_t) ( p_vout_thread_t p_vout );
typedef int (vout_sys_manage_t) ( p_vout_thread_t p_vout );
typedef void (vout_sys_display_t) ( p_vout_thread_t p_vout );
typedef void (vout_set_palette_t) ( p_vout_thread_t p_vout, u16 *red,
u16 *green, u16 *blue, u16 *transp );
typedef struct vout_thread_s
{
......@@ -100,6 +107,7 @@ typedef struct vout_thread_s
vlc_mutex_t change_lock; /* thread change lock */
int * pi_status; /* temporary status flag */
p_vout_sys_t p_sys; /* system output method */
int i_method; /* display method */
/* Current display properties */
u16 i_changes; /* changes made to the thread */
......@@ -127,12 +135,20 @@ typedef struct vout_thread_s
u32 i_gray_pixel; /* gray */
u32 i_blue_pixel; /* blue */
/* method-dependant functions */
vout_sys_create_t * p_sys_create; /* allocate output method */
vout_sys_init_t * p_sys_init; /* initialize output method */
vout_sys_end_t * p_sys_end; /* terminate output method */
vout_sys_destroy_t * p_sys_destroy; /* destroy output method */
vout_sys_manage_t * p_sys_manage; /* handle events */
vout_sys_display_t * p_sys_display; /* display rendered image */
vout_set_palette_t * p_set_palette; /* sets 8bpp palette */
/* Pictures and rendering properties */
boolean_t b_grayscale; /* color or grayscale display */
boolean_t b_info; /* print additionnal informations */
boolean_t b_interface; /* render interface */
boolean_t b_scale; /* allow picture scaling */
vout_set_palette_t *p_set_palette; /* sets 8bpp palette */
/* Idle screens management */
mtime_t last_display_date; /* last non idle display date */
......@@ -158,8 +174,45 @@ typedef struct vout_thread_s
/* Bitmap fonts */
p_vout_font_t p_default_font; /* default font */
p_vout_font_t p_large_font; /* large font */
} vout_thread_t;
/* Output methods */
#define VOUT_DUMMY_METHOD 0x0000 /* dummy video output */
#define VOUT_X11_METHOD 0x0001 /* X11 */
#define VOUT_GGI_METHOD 0x0002 /* General Graphics Interface */
#define VOUT_FB_METHOD 0x0003 /* Linux framebuffer */
#define VOUT_GLIDE_METHOD 0x0004 /* Voodoo 3dfx */
#define VOUT_DGA_METHOD 0x0005 /* X11 DGA extension */
#define VOUT_BEOS_METHOD 0x0006 /* BeOS rendering */
/* Get the fallback method */
#ifdef VIDEO_X11
#define VOUT_DEFAULT_METHOD "x11"
#else
#ifdef VIDEO_FB
#define VOUT_DEFAULT_METHOD "fb"
#else
#ifdef VIDEO_GGI
#define VOUT_DEFAULT_METHOD "ggi"
#else
#ifdef VIDEO_GLIDE
#define VOUT_DEFAULT_METHOD "glide"
#else
#ifdef VIDEO_DGA
#define VOUT_DEFAULT_METHOD "dga"
#else
#ifdef VIDEO_BEOS
#define VOUT_DEFAULT_METHOD "beos"
#else
#define VOUT_DEFAULT_METHOD "dummy"
#endif
#endif
#endif
#endif
#endif
#endif
/* Flags for changes - these flags are set in the i_changes field when another
* thread changed a variable */
#define VOUT_INFO_CHANGE 0x0001 /* b_info changed */
......@@ -187,7 +240,7 @@ typedef struct vout_thread_s
* Prototypes
*****************************************************************************/
vout_thread_t * vout_CreateThread ( char *psz_display, int i_root_window,
int i_width, int i_height, int *pi_status );
int i_width, int i_height, int *pi_status, int i_method );
void vout_DestroyThread ( vout_thread_t *p_vout, int *pi_status );
picture_t * vout_CreatePicture ( vout_thread_t *p_vout, int i_type,
int i_width, int i_height );
......
......@@ -115,7 +115,7 @@ typedef struct vpar_thread_s
/* Structure to store the tables B14 & B15 (ISO/CEI 13818-2 B.4) */
dct_lookup_t ppl_dct_coef[2][16384];
#ifdef STATS
/* Statistics */
......
......@@ -6,12 +6,58 @@
/*****************************************************************************
* Prototypes
*****************************************************************************/
int vout_SysCreate ( p_vout_thread_t p_vout, char *psz_display, int i_root_window );
int vout_SysInit ( p_vout_thread_t p_vout );
void vout_SysEnd ( p_vout_thread_t p_vout );
void vout_SysDestroy ( p_vout_thread_t p_vout );
int vout_SysManage ( p_vout_thread_t p_vout );
void vout_SysDisplay ( p_vout_thread_t p_vout );
int vout_DummySysCreate ( p_vout_thread_t p_vout, char *psz_display, int i_root_window );
int vout_DummySysInit ( p_vout_thread_t p_vout );
void vout_DummySysEnd ( p_vout_thread_t p_vout );
void vout_DummySysDestroy ( p_vout_thread_t p_vout );
int vout_DummySysManage ( p_vout_thread_t p_vout );
void vout_DummySysDisplay ( p_vout_thread_t p_vout );
#ifdef VIDEO_X11
int vout_X11SysCreate ( p_vout_thread_t p_vout, char *psz_display, int i_root_window );
int vout_X11SysInit ( p_vout_thread_t p_vout );
void vout_X11SysEnd ( p_vout_thread_t p_vout );
void vout_X11SysDestroy ( p_vout_thread_t p_vout );
int vout_X11SysManage ( p_vout_thread_t p_vout );
void vout_X11SysDisplay ( p_vout_thread_t p_vout );
#endif
#ifdef VIDEO_FB
int vout_FBSysCreate ( p_vout_thread_t p_vout, char *psz_display, int i_root_window );
int vout_FBSysInit ( p_vout_thread_t p_vout );
void vout_FBSysEnd ( p_vout_thread_t p_vout );
void vout_FBSysDestroy ( p_vout_thread_t p_vout );
int vout_FBSysManage ( p_vout_thread_t p_vout );
void vout_FBSysDisplay ( p_vout_thread_t p_vout );
#endif
#ifdef VIDEO_GLIDE
int vout_GlideSysCreate ( p_vout_thread_t p_vout, char *psz_display, int i_root_window );
int vout_GlideSysInit ( p_vout_thread_t p_vout );
void vout_GlideSysEnd ( p_vout_thread_t p_vout );
void vout_GlideSysDestroy ( p_vout_thread_t p_vout );
int vout_GlideSysManage ( p_vout_thread_t p_vout );
void vout_GlideSysDisplay ( p_vout_thread_t p_vout );
#endif
#ifdef VIDEO_DGA
int vout_DGASysCreate ( p_vout_thread_t p_vout, char *psz_display, int i_root_window );
int vout_DGASysInit ( p_vout_thread_t p_vout );
void vout_DGASysEnd ( p_vout_thread_t p_vout );
void vout_DGASysDestroy ( p_vout_thread_t p_vout );
int vout_DGASysManage ( p_vout_thread_t p_vout );
void vout_DGASysDisplay ( p_vout_thread_t p_vout );
#endif
#ifdef VIDEO_GGI
int vout_GGISysCreate ( p_vout_thread_t p_vout, char *psz_display, int i_root_window );
int vout_GGISysInit ( p_vout_thread_t p_vout );
void vout_GGISysEnd ( p_vout_thread_t p_vout );
void vout_GGISysDestroy ( p_vout_thread_t p_vout );
int vout_GGISysManage ( p_vout_thread_t p_vout );
void vout_GGISysDisplay ( p_vout_thread_t p_vout );
#endif
#ifdef VIDEO_BEOS
int vout_BeSysCreate ( p_vout_thread_t p_vout, char *psz_display, int i_root_window );
int vout_BeSysInit ( p_vout_thread_t p_vout );
void vout_BeSysEnd ( p_vout_thread_t p_vout );
void vout_BeSysDestroy ( p_vout_thread_t p_vout );
int vout_BeSysManage ( p_vout_thread_t p_vout );
void vout_BeSysDisplay ( p_vout_thread_t p_vout );
#endif
......@@ -47,7 +47,7 @@ typedef void *(*vlc_thread_func_t)(void *p_data);
*****************************************************************************/
static __inline__ int vlc_thread_create( vlc_thread_t *p_thread, char *psz_name,
vlc_thread_func_t func, void *p_data );
vlc_thread_func_t func, void *p_data );
static __inline__ void vlc_thread_exit ( void );
static __inline__ void vlc_thread_join ( vlc_thread_t thread );
......@@ -66,8 +66,8 @@ static __inline__ int vlc_cond_wait ( vlc_cond_t *p_condvar, vlc_mutex_t *p_
* vlc_thread_create: create a thread
*****************************************************************************/
static __inline__ int vlc_thread_create( vlc_thread_t *p_thread,
char *psz_name, vlc_thread_func_t func,
void *p_data)
char *psz_name, vlc_thread_func_t func,
void *p_data)
{
return pthread_create( p_thread, NULL, func, p_data );
}
......
......@@ -68,13 +68,78 @@ static int ParseChannel ( intf_channel_t *p_channel, char *psz_str );
intf_thread_t* intf_Create( void )
{
intf_thread_t *p_intf;
char * psz_method;
/* Allocate structure */
p_intf = malloc( sizeof( intf_thread_t ) );
if( !p_intf )
{
intf_ErrMsg("error: %s\n", strerror( ENOMEM ) );
return( NULL );
return( NULL );
}
/* initialize method-dependent functions */
psz_method = main_GetPszVariable( VOUT_METHOD_VAR, VOUT_DEFAULT_METHOD );
if( !strcmp(psz_method, "dummy") )
{
p_intf->p_sys_create = intf_DummySysCreate;
p_intf->p_sys_manage = intf_DummySysManage;
p_intf->p_sys_destroy = intf_DummySysDestroy;
}
#ifdef VIDEO_X11
else if( !strcmp(psz_method, "x11") )
{
p_intf->p_sys_create = intf_X11SysCreate;
p_intf->p_sys_manage = intf_X11SysManage;
p_intf->p_sys_destroy = intf_X11SysDestroy;
}
#endif
#ifdef VIDEO_FB
else if( !strcmp(psz_method, "fb") )
{
p_intf->p_sys_create = intf_FBSysCreate;
p_intf->p_sys_manage = intf_FBSysManage;
p_intf->p_sys_destroy = intf_FBSysDestroy;
}
#endif
#ifdef VIDEO_GGI
else if( !strcmp(psz_method, "ggi") )
{
p_intf->p_sys_create = intf_GGISysCreate;
p_intf->p_sys_manage = intf_GGISysManage;
p_intf->p_sys_destroy = intf_GGISysDestroy;
}
#endif
#ifdef VIDEO_DGA
else if( !strcmp(psz_method, "dga") )
{
p_intf->p_sys_create = intf_DGASysCreate;
p_intf->p_sys_manage = intf_DGASysManage;
p_intf->p_sys_destroy = intf_DGASysDestroy;
}
#endif
#ifdef VIDEO_GLIDE
else if( !strcmp(psz_method, "glide") )
{
p_intf->p_sys_create = intf_GlideSysCreate;
p_intf->p_sys_manage = intf_GlideSysManage;
p_intf->p_sys_destroy = intf_GlideSysDestroy;
}
#endif
#ifdef VIDEO_BEOS
else if( !strcmp(psz_method, "beos") )
{
p_intf->p_sys_create = intf_BeSysCreate;
p_intf->p_sys_manage = intf_BeSysManage;
p_intf->p_sys_destroy = intf_BeSysDestroy;
}
#endif
else
{
intf_ErrMsg( "error: video output method not available\n" );
free( p_intf );
return( NULL );
}
/* Initialize structure */
......@@ -92,15 +157,15 @@ intf_thread_t* intf_Create( void )
if( p_intf->p_console == NULL )
{
intf_ErrMsg("error: can't create control console\n");
free( p_intf );
free( p_intf );
return( NULL );
}
if( intf_SysCreate( p_intf ) )
if( p_intf->p_sys_create( p_intf ) )
{
intf_ErrMsg("error: can't create interface\n");
intf_ConsoleDestroy( p_intf->p_console );
free( p_intf );
return( NULL );
intf_ErrMsg("error: can't create interface\n");
intf_ConsoleDestroy( p_intf->p_console );
free( p_intf );
return( NULL );
}
intf_Msg("Interface initialized\n");
......@@ -118,7 +183,7 @@ void intf_Run( intf_thread_t *p_intf )
* the script could be executed but failed */
if( intf_ExecScript( main_GetPszVariable( INTF_INIT_SCRIPT_VAR, INTF_INIT_SCRIPT_DEFAULT ) ) > 0 )
{
intf_ErrMsg("warning: error(s) during startup script\n");
intf_ErrMsg("warning: error(s) during startup script\n");
}
/* Main loop */
......@@ -128,7 +193,7 @@ void intf_Run( intf_thread_t *p_intf )
intf_FlushMsg();
/* Manage specific interface */
intf_SysManage( p_intf );
p_intf->p_sys_manage( p_intf );
/* Check attached threads status */
if( (p_intf->p_vout != NULL) && p_intf->p_vout->b_error )
......@@ -157,7 +222,7 @@ void intf_Run( intf_thread_t *p_intf )
void intf_Destroy( intf_thread_t *p_intf )
{
/* Destroy interfaces */
intf_SysDestroy( p_intf );
p_intf->p_sys_destroy( p_intf );
intf_ConsoleDestroy( p_intf->p_console );
/* Unload channels */
......@@ -249,7 +314,7 @@ int intf_ProcessKey( intf_thread_t *p_intf, int i_key )
case 'M': /* toggle mute */
case 'm':
// ??
break;
break;
case 'g': /* gamma - */
if( (p_intf->p_vout != NULL) && (p_intf->p_vout->f_gamma > -INTF_GAMMA_LIMIT) )
{
......
/*****************************************************************************
* intf_3dfx.c: 3dfx interface
* (c)2000 VideoLAN
*****************************************************************************/
/*****************************************************************************
* Preamble
*****************************************************************************/
#include <errno.h>
#include <signal.h>
#include <stdio.h> /* stderr */
#include <stdlib.h>
#include <string.h>
#include <termios.h>
#include <unistd.h> /* close() */
#include <sys/uio.h> /* for input.h */
#include <linutil.h> /* Glide kbhit() and getch() */
#include <sys/types.h> /* open() */
#include <sys/stat.h>
#include <fcntl.h>
#include "config.h"
#include "common.h"
#include "mtime.h"
#include "vlc_thread.h"
#include "input.h"
#include "video.h"
#include "video_output.h"
#include "intf_sys.h"
#include "intf_msg.h"
#include "interface.h"
#include "main.h"
/*****************************************************************************
* intf_sys_t: description and status of 3dfx interface
*****************************************************************************/
typedef struct intf_sys_s
{
} intf_sys_t;
/*****************************************************************************
* intf_SysCreate: initialize 3dfx interface
*****************************************************************************/
int intf_SysCreate( intf_thread_t *p_intf )
{
/* Allocate instance and initialize some members */
p_intf->p_sys = malloc( sizeof( intf_sys_t ) );
if( p_intf->p_sys == NULL )
{
return( 1 );
};
intf_DbgMsg("0x%x\n", p_intf );
/* Spawn video output thread */
if( p_main->b_video )
{
p_intf->p_vout = vout_CreateThread( NULL, 0, 0, 0, NULL);
if( p_intf->p_vout == NULL ) /* error */
{
intf_ErrMsg("intf error: can't create output thread\n" );
return( 1 );
}
}
return( 0 );
}
/*****************************************************************************
* intf_SysDestroy: destroy 3dfx interface
*****************************************************************************/
void intf_SysDestroy( intf_thread_t *p_intf )
{
/* Close input thread, if any (blocking) */
if( p_intf->p_input )
{
input_DestroyThread( p_intf->p_input, NULL );
}
/* Close video output thread, if any (blocking) */
if( p_intf->p_vout )
{
vout_DestroyThread( p_intf->p_vout, NULL );
}
/* Destroy structure */
free( p_intf->p_sys );
}
/*****************************************************************************
* intf_SysManage: event loop
*****************************************************************************/
void intf_SysManage( intf_thread_t *p_intf )
{
unsigned int buf;
/* very Linux specific - see tlib.c in Glide for other versions */
while( kbhit() )
{
if( intf_ProcessKey(p_intf, (int)buf = getch()) )
{
printf("unhandled key '%c' (%i)\n", (char) buf, buf );
}
}
}
......@@ -435,7 +435,7 @@ static int SelectPID( int i_argc, intf_arg_t *p_argv )
switch( p_argv[i_arg].i_index )
{
case 0:
// ?? useless
// ?? useless
i_input = p_argv[i_arg].i_num;
break;
case 1:
......@@ -448,7 +448,7 @@ static int SelectPID( int i_argc, intf_arg_t *p_argv )
/* Find to which input this command is destinated */
intf_IntfMsg( "Adding PID %d to input %d\n", i_pid, i_input );
//???? input_AddPgrmElem( p_main->p_intf->p_x11->p_input,
//???? i_pid );
//???? i_pid );
return( INTF_NO_ERROR );
}
......
......@@ -87,7 +87,7 @@ typedef struct intf_msg_s
*****************************************************************************/
static void QueueMsg ( intf_msg_t *p_msg, int i_type,
char *psz_format, va_list ap );
char *psz_format, va_list ap );
static void PrintMsg ( intf_msg_item_t *p_msg );
#ifdef DEBUG
static void QueueDbgMsg ( intf_msg_t *p_msg, char *psz_file,
......@@ -100,7 +100,7 @@ static void FlushLockedMsg ( intf_msg_t *p_msg );
/*****************************************************************************
* intf_MsgCreate: initialize messages interface (ok ?)
* intf_MsgCreate: initialize messages interface (ok ?)
*****************************************************************************
* This functions has to be called before any call to other intf_*Msg functions.
* It set up the locks and the message queue if it is used.
......@@ -113,7 +113,7 @@ p_intf_msg_t intf_MsgCreate( void )
p_msg = malloc( sizeof( intf_msg_t ) );
if( p_msg == NULL )
{
errno = ENOMEM;
errno = ENOMEM;
}
else
{
......@@ -124,10 +124,10 @@ p_intf_msg_t intf_MsgCreate( void )
#endif
#ifdef DEBUG_LOG
/* Log file initialization - on failure, file pointer will be null,
* and no log will be issued, but this is not considered as an
* error */
p_msg->i_log_file = open( DEBUG_LOG,
/* Log file initialization - on failure, file pointer will be null,
* and no log will be issued, but this is not considered as an
* error */
p_msg->i_log_file = open( DEBUG_LOG,
O_CREAT | O_TRUNC | O_SYNC | O_WRONLY,
0666 );
#endif
......@@ -150,7 +150,7 @@ void intf_MsgDestroy( void )
/* Close log file if any */
if( p_main->p_msg->i_log_file >= 0 )
{
close( p_main->p_msg->i_log_file );
close( p_main->p_msg->i_log_file );
}
#endif
......@@ -365,7 +365,7 @@ static void QueueMsg( intf_msg_t *p_msg, int i_type, char *psz_format, va_list a
*****************************************************************************/
#ifdef DEBUG
static void QueueDbgMsg(intf_msg_t *p_msg, char *psz_file, char *psz_function,
int i_line, char *psz_format, va_list ap)
int i_line, char *psz_format, va_list ap)
{
char * psz_str; /* formatted message string */
intf_msg_item_t * p_msg_item; /* pointer to message */
......@@ -384,7 +384,7 @@ static void QueueDbgMsg(intf_msg_t *p_msg, char *psz_file, char *psz_function,
fprintf(stderr, "warning: can't store following message (%s): ",
strerror(errno) );
fprintf(stderr, INTF_MSG_DBG_FORMAT, psz_file, psz_function, i_line );
vfprintf(stderr, psz_format, ap );
vfprintf(stderr, psz_format, ap );
exit( errno );
}
......@@ -509,7 +509,7 @@ static void PrintMsg( intf_msg_item_t *p_msg )
/* Append all messages to log file */
if( p_main->p_msg->i_log_file >= 0 )
{
write( p_main->p_msg->i_log_file, psz_msg, strlen( psz_msg ) );
write( p_main->p_msg->i_log_file, psz_msg, strlen( psz_msg ) );
}
#endif
......
......@@ -107,7 +107,7 @@ static int TestMMX ( void );
* -openning of audio output device and some global modules
* -execution of interface, which exit on error or on user request
* -closing of audio output device and some global modules
* On error, the spawned threads are cancelled, and the openned devices closed.
* On error, the spawned threads are cancelled, and the open devices closed.
*****************************************************************************/
int main( int i_argc, char *ppsz_argv[], char *ppsz_env[] )
{
......@@ -121,7 +121,7 @@ int main( int i_argc, char *ppsz_argv[], char *ppsz_env[] )
if( !TestMMX() )
{
fprintf( stderr, "Sorry, this program needs an MMX processor. Please run the non-MMX version.\n" );
return(0);
return( 1 );
}
#endif
p_main->p_msg = intf_MsgCreate();
......@@ -131,7 +131,7 @@ int main( int i_argc, char *ppsz_argv[], char *ppsz_env[] )
strerror(errno));
return(errno);
}
if( GetConfiguration( i_argc, ppsz_argv, ppsz_env ) )/* parse command line */
if( GetConfiguration( i_argc, ppsz_argv, ppsz_env ) ) /* parse cmd line */
{
intf_MsgDestroy();
return(errno);
......@@ -154,12 +154,12 @@ int main( int i_argc, char *ppsz_argv[], char *ppsz_env[] )
if( main_data.b_audio )
{
main_data.p_aout = aout_CreateThread( NULL );
if( main_data.p_aout == NULL )
{
/* On error during audio initialization, switch of audio */
if( main_data.p_aout == NULL )
{
/* On error during audio initialization, switch of audio */
intf_Msg("Audio initialization failed : audio is desactivated\n");
main_data.b_audio = 0;
}
}
}
/*
......@@ -168,9 +168,9 @@ int main( int i_argc, char *ppsz_argv[], char *ppsz_env[] )
main_data.p_intf = intf_Create();
if( main_data.p_intf != NULL )
{
InitSignalHandler(); /* prepare signals for interception */
intf_Run( main_data.p_intf );
intf_Destroy( main_data.p_intf );
InitSignalHandler(); /* prepare signals for interception */
intf_Run( main_data.p_intf );
intf_Destroy( main_data.p_intf );
}
/*
......@@ -216,7 +216,7 @@ int main_GetIntVariable( char *psz_name, int i_default )
{
return( i_value );
}
}
}
return( i_default );
}
......@@ -335,7 +335,7 @@ static int GetConfiguration( int i_argc, char *ppsz_argv[], char *ppsz_env[] )
/* Audio options */
case OPT_NOAUDIO: /* --noaudio */
p_main->b_audio = 0;
p_main->b_audio = 0;
break;
case OPT_STEREO: /* --stereo */
main_PutIntVariable( AOUT_STEREO_VAR, 1 );
......@@ -375,7 +375,7 @@ static int GetConfiguration( int i_argc, char *ppsz_argv[], char *ppsz_env[] )
case OPT_PORT: /* --port */
main_PutPszVariable( INPUT_PORT_VAR, optarg );
break;
/* Internal error: unknown option */
case '?':
default:
......@@ -388,7 +388,7 @@ static int GetConfiguration( int i_argc, char *ppsz_argv[], char *ppsz_env[] )
/* Parse command line parameters - no check is made for these options */
for( i_opt = optind; i_opt < i_argc; i_opt++ )
{
putenv( ppsz_argv[ i_opt ] );
putenv( ppsz_argv[ i_opt ] );
}
return( 0 );
}
......@@ -419,34 +419,36 @@ static void Usage( void )
/* Interface parameters */
intf_Msg("Interface parameters:\n" \
" " INTF_INIT_SCRIPT_VAR "=<filename> \tinitialization script\n" \
" " INTF_INIT_SCRIPT_VAR "=<filename> \tinitialization script\n" \
" " INTF_CHANNELS_VAR "=<filename> \tchannels list\n"\
);
);
/* Audio parameters */
intf_Msg("Audio parameters:\n" \
" " AOUT_DSP_VAR "=<filename> \tdsp device path\n" \
" " AOUT_STEREO_VAR "={1|0} \tstereo or mono output\n" \
" " AOUT_RATE_VAR "=<rate> \toutput rate\n" \
);
);
/* Video parameters */
intf_Msg("Video parameters:\n" \
" " VOUT_METHOD_VAR "=<method name> \tmethod used\n" \
" ( available: " VIDEO_OPTIONS " )\n" \
" " VOUT_DISPLAY_VAR "=<display name> \tdisplay used\n" \
" " VOUT_WIDTH_VAR "=<width> \tdisplay width\n" \
" " VOUT_HEIGHT_VAR "=<height> \tdislay height\n" \
" " VOUT_FB_DEV_VAR "=<filename> \tframebuffer device path\n" \
" " VOUT_GRAYSCALE_VAR "={1|0} \tgrayscale or color output\n" \
);
);
/* Input parameters */
intf_Msg("Input parameters:\n" \
" " INPUT_SERVER_VAR "=<hostname> \tvideo server\n" \
" " INPUT_PORT_VAR "=<port> \tvideo server port\n" \
" " INPUT_IFACE_VAR "=<interface> \tnetwork interface\n" \
" " INPUT_IFACE_VAR "=<interface> \tnetwork interface\n" \
" " INPUT_VLAN_SERVER_VAR "=<hostname> \tvlan server\n" \
" " INPUT_VLAN_PORT_VAR "=<port> \tvlan server port\n"\
);
);
}
/*****************************************************************************
......@@ -513,7 +515,7 @@ static void SignalHandler( int i_signal )
*****************************************************************************/
static int TestMMX( void )
{
int reg, dummy;
int i_reg, i_dummy = 0;
/* test for a 386 cpu */
asm volatile ( "pushfl
......@@ -526,9 +528,9 @@ static int TestMMX( void )
popl %%eax
xorl %%ecx, %%eax
andl $0x40000, %%eax"
: "=a" ( reg ) );
: "=a" ( i_reg ) );
if( !reg )
if( !i_reg )
return( 0 );
/* test for a 486 cpu */
......@@ -542,33 +544,35 @@ static int TestMMX( void )
pushl %%ecx
popfl
andl $0x200000, %%eax"
: "=a" ( reg ) );
: "=a" ( i_reg ) );
if( !reg )
if( !i_reg )
return( 0 );
/* the cpu supports the CPUID instruction - get its level */
asm volatile ( "cpuid"
: "=a" ( reg ),
"=b" ( dummy ),
"=c" ( dummy ),
"=d" ( dummy )
: "a" ( 0 ) ); /* level 0 */
: "=a" ( i_reg ),
"=b" ( i_dummy ),
"=c" ( i_dummy ),
"=d" ( i_dummy )
: "a" ( 0 ), /* level 0 */
"b" ( i_dummy ) ); /* buggy compiler shouldn't complain */
/* this shouldn't happen on a normal cpu */
if( !reg )
if( !i_reg )
return( 0 );
/* test for the MMX flag */
asm volatile ( "cpuid
andl $0x00800000, %%edx" /* X86_FEATURE_MMX */
: "=a" ( dummy ),
"=b" ( dummy ),
"=c" ( dummy ),
"=d" ( reg )
: "a" ( 1 ) ); /* level 1 */
if( !reg )
: "=a" ( i_dummy ),
"=b" ( i_dummy ),
"=c" ( i_dummy ),
"=d" ( i_reg )
: "a" ( 1 ), /* level 1 */
"b" ( i_dummy ) ); /* buggy compiler shouldn't complain */
if( !i_reg )
return( 0 );
return( 1 );
......
......@@ -7,8 +7,8 @@
*/
.data
.align 16
.type preSC,@object
.align 16
.type preSC,@object
preSC: .short 16384,22725,21407,19266,16384,12873,8867,4520
.short 22725,31521,29692,26722,22725,17855,12299,6270
.short 21407,29692,27969,25172,21407,16819,11585,5906
......@@ -17,214 +17,214 @@ preSC: .short 16384,22725,21407,19266,16384,12873,8867,4520
.short 12873,17855,16819,15137,25746,20228,13933,7103
.short 17734,24598,23170,20853,17734,13933,9597,4892
.short 18081,25080,23624,21261,18081,14206,9785,4988
.size preSC,128
.align 8
.type x0005000200010001,@object
.size x0005000200010001,8
.size preSC,128
.align 8
.type x0005000200010001,@object
.size x0005000200010001,8
x0005000200010001:
.long 0x00010001,0x00050002
.align 8
.type x0040000000000000,@object
.size x0040000000000000,8
.long 0x00010001,0x00050002
.align 8
.type x0040000000000000,@object
.size x0040000000000000,8
x0040000000000000:
.long 0, 0x00400000
.align 8
.type x5a825a825a825a82,@object
.size x5a825a825a825a82,8
.long 0, 0x00400000
.align 8
.type x5a825a825a825a82,@object
.size x5a825a825a825a82,8
x5a825a825a825a82:
.long 0x5a825a82, 0x5a825a82
.align 8
.type x539f539f539f539f,@object
.size x539f539f539f539f,8
.long 0x5a825a82, 0x5a825a82
.align 8
.type x539f539f539f539f,@object
.size x539f539f539f539f,8
x539f539f539f539f:
.long 0x539f539f,0x539f539f
.align 8
.type x4546454645464546,@object
.size x4546454645464546,8
.long 0x539f539f,0x539f539f
.align 8
.type x4546454645464546,@object
.size x4546454645464546,8
x4546454645464546:
.long 0x45464546,0x45464546
.align 8
.type x61f861f861f861f8,@object
.size x61f861f861f861f8,8
.long 0x45464546,0x45464546
.align 8
.type x61f861f861f861f8,@object
.size x61f861f861f861f8,8
x61f861f861f861f8:
.long 0x61f861f8,0x61f861f8
.align 8
.type scratch1,@object
.size scratch1,8
.long 0x61f861f8,0x61f861f8
.align 8
.type scratch1,@object
.size scratch1,8
scratch1:
.long 0,0
.align 8
.type scratch3,@object
.size scratch3,8
.long 0,0
.align 8
.type scratch3,@object
.size scratch3,8
scratch3:
.long 0,0
.align 8
.type scratch5,@object
.size scratch5,8
.long 0,0
.align 8
.type scratch5,@object
.size scratch5,8
scratch5:
.long 0,0
.align 8
.type scratch7,@object
.size scratch7,8
.long 0,0
.align 8
.type scratch7,@object
.size scratch7,8
scratch7:
.long 0,0
.type x0,@object
.size x0,8
.long 0,0
.type x0,@object
.size x0,8
x0:
.long 0,0
.align 8
.long 0,0
.align 8
.text
.align 4
.align 4
.globl vdec_IDCT
.type vdec_IDCT,@function
.type vdec_IDCT,@function
vdec_IDCT:
pushl %ebp
movl %esp,%ebp
pushl %ebx
pushl %ecx
pushl %edx
pushl %esi
pushl %edi
leal preSC, %ecx
movl 12(%ebp),%esi
movq (%esi), %mm0
movq 8(%esi), %mm1
movq 16(%esi), %mm2
movq 24(%esi), %mm3
movq 32(%esi), %mm4
movq 40(%esi), %mm5
movq 48(%esi), %mm6
movq 56(%esi), %mm7
psllw $4, %mm0
psllw $4, %mm1
psllw $4, %mm2
psllw $4, %mm3
psllw $4, %mm4
psllw $4, %mm5
psllw $4, %mm6
psllw $4, %mm7
movq %mm0, (%esi)
movq %mm1, 8(%esi)
movq %mm2,16(%esi)
movq %mm3,24(%esi)
movq %mm4,32(%esi)
movq %mm5,40(%esi)
movq %mm6,48(%esi)
movq %mm7,56(%esi)
movq 64(%esi), %mm0
movq 72(%esi), %mm1
movq 80(%esi), %mm2
movq 88(%esi), %mm3
movq 96(%esi), %mm4
movq 104(%esi), %mm5
movq 112(%esi), %mm6
movq 120(%esi), %mm7
psllw $4, %mm0
psllw $4, %mm1
psllw $4, %mm2
psllw $4, %mm3
psllw $4, %mm4
psllw $4, %mm5
psllw $4, %mm6
psllw $4, %mm7
movq %mm0,64(%esi)
movq %mm1,72(%esi)
movq %mm2,80(%esi)
movq %mm3,88(%esi)
movq %mm4,96(%esi)
movq %mm5,104(%esi)
movq %mm6,112(%esi)
movq %mm7,120(%esi)
pushl %ebp
movl %esp,%ebp
pushl %ebx
pushl %ecx
pushl %edx
pushl %esi
pushl %edi
leal preSC, %ecx
movl 12(%ebp),%esi
movq (%esi), %mm0
movq 8(%esi), %mm1
movq 16(%esi), %mm2
movq 24(%esi), %mm3
movq 32(%esi), %mm4
movq 40(%esi), %mm5
movq 48(%esi), %mm6
movq 56(%esi), %mm7
psllw $4, %mm0
psllw $4, %mm1
psllw $4, %mm2
psllw $4, %mm3
psllw $4, %mm4
psllw $4, %mm5
psllw $4, %mm6
psllw $4, %mm7
movq %mm0, (%esi)
movq %mm1, 8(%esi)
movq %mm2,16(%esi)
movq %mm3,24(%esi)
movq %mm4,32(%esi)
movq %mm5,40(%esi)
movq %mm6,48(%esi)
movq %mm7,56(%esi)
movq 64(%esi), %mm0
movq 72(%esi), %mm1
movq 80(%esi), %mm2
movq 88(%esi), %mm3
movq 96(%esi), %mm4
movq 104(%esi), %mm5
movq 112(%esi), %mm6
movq 120(%esi), %mm7
psllw $4, %mm0
psllw $4, %mm1
psllw $4, %mm2
psllw $4, %mm3
psllw $4, %mm4
psllw $4, %mm5
psllw $4, %mm6
psllw $4, %mm7
movq %mm0,64(%esi)
movq %mm1,72(%esi)
movq %mm2,80(%esi)
movq %mm3,88(%esi)
movq %mm4,96(%esi)
movq %mm5,104(%esi)
movq %mm6,112(%esi)
movq %mm7,120(%esi)
/* column 0: even part
* use V4, V12, V0, V8 to produce V22..V25
*/
movq 8*12(%ecx), %mm0 /* maybe the first mul can be done together */
/* with the dequantization in iHuff module */
pmulhw 8*12(%esi), %mm0 /* V12 */
movq 8*4(%ecx), %mm1
pmulhw 8*4(%esi), %mm1 /* V4 */
movq (%ecx), %mm3
psraw $1, %mm0 /* t64=t66 */
pmulhw (%esi), %mm3 /* V0 */
movq 8*8(%ecx), %mm5 /* duplicate V4 */
movq %mm1, %mm2 /* added 11/1/96 */
pmulhw 8*8(%esi),%mm5 /* V8 */
psubsw %mm0, %mm1 /* V16 */
pmulhw x5a825a825a825a82, %mm1 /* 23170 ->V18 */
paddsw %mm0, %mm2 /* V17 */
movq %mm2, %mm0 /* duplicate V17 */
psraw $1, %mm2 /* t75=t82 */
psraw $2, %mm0 /* t72 */
movq %mm3, %mm4 /* duplicate V0 */
paddsw %mm5, %mm3 /* V19 */
psubsw %mm5, %mm4 /* V20 ;mm5 free */
movq 8*12(%ecx), %mm0 /* maybe the first mul can be done together */
/* with the dequantization in iHuff module */
pmulhw 8*12(%esi), %mm0 /* V12 */
movq 8*4(%ecx), %mm1
pmulhw 8*4(%esi), %mm1 /* V4 */
movq (%ecx), %mm3
psraw $1, %mm0 /* t64=t66 */
pmulhw (%esi), %mm3 /* V0 */
movq 8*8(%ecx), %mm5 /* duplicate V4 */
movq %mm1, %mm2 /* added 11/1/96 */
pmulhw 8*8(%esi),%mm5 /* V8 */
psubsw %mm0, %mm1 /* V16 */
pmulhw x5a825a825a825a82, %mm1 /* 23170 ->V18 */
paddsw %mm0, %mm2 /* V17 */
movq %mm2, %mm0 /* duplicate V17 */
psraw $1, %mm2 /* t75=t82 */
psraw $2, %mm0 /* t72 */
movq %mm3, %mm4 /* duplicate V0 */
paddsw %mm5, %mm3 /* V19 */
psubsw %mm5, %mm4 /* V20 ;mm5 free */
/* moved from the block below */
movq 8*10(%ecx), %mm7
psraw $1, %mm3 /* t74=t81 */
movq %mm3, %mm6 /* duplicate t74=t81 */
psraw $2, %mm4 /* t77=t79 */
psubsw %mm0, %mm1 /* V21 ; mm0 free */
paddsw %mm2, %mm3 /* V22 */
movq %mm1, %mm5 /* duplicate V21 */
paddsw %mm4, %mm1 /* V23 */
movq %mm3, 8*4(%esi) /* V22 */
psubsw %mm5, %mm4 /* V24; mm5 free */
movq %mm1, 8*12(%esi) /* V23 */
psubsw %mm2, %mm6 /* V25; mm2 free */
movq %mm4, (%esi) /* V24 */
movq 8*10(%ecx), %mm7
psraw $1, %mm3 /* t74=t81 */
movq %mm3, %mm6 /* duplicate t74=t81 */
psraw $2, %mm4 /* t77=t79 */
psubsw %mm0, %mm1 /* V21 ; mm0 free */
paddsw %mm2, %mm3 /* V22 */
movq %mm1, %mm5 /* duplicate V21 */
paddsw %mm4, %mm1 /* V23 */
movq %mm3, 8*4(%esi) /* V22 */
psubsw %mm5, %mm4 /* V24; mm5 free */
movq %mm1, 8*12(%esi) /* V23 */
psubsw %mm2, %mm6 /* V25; mm2 free */
movq %mm4, (%esi) /* V24 */
/* keep mm6 alive all along the next block */
/* movq %mm6, 8*8(%esi) V25 */
/* movq %mm6, 8*8(%esi) V25 */
/* column 0: odd part
* use V2, V6, V10, V14 to produce V31, V39, V40, V41
*/
/* moved above: movq 8*10(%ecx), %mm7 */
pmulhw 8*10(%esi), %mm7 /* V10 */
movq 8*6(%ecx), %mm0
pmulhw 8*6(%esi), %mm0 /* V6 */
movq 8*2(%ecx), %mm5
movq %mm7, %mm3 /* duplicate V10 */
pmulhw 8*2(%esi), %mm5 /* V2 */
movq 8*14(%ecx), %mm4
psubsw %mm0, %mm7 /* V26 */
pmulhw 8*14(%esi), %mm4 /* V14 */
paddsw %mm0, %mm3 /* V29 ; free mm0 */
movq %mm7, %mm1 /* duplicate V26 */
psraw $1, %mm3 /* t91=t94 */
pmulhw x539f539f539f539f,%mm7 /* V33 */
psraw $1, %mm1 /* t96 */
movq %mm5, %mm0 /* duplicate V2 */
psraw $2, %mm4 /* t85=t87 */
paddsw %mm4,%mm5 /* V27 */
psubsw %mm4, %mm0 /* V28 ; free mm4 */
movq %mm0, %mm2 /* duplicate V28 */
psraw $1, %mm5 /* t90=t93 */
pmulhw x4546454645464546,%mm0 /* V35 */
psraw $1, %mm2 /* t97 */
movq %mm5, %mm4 /* duplicate t90=t93 */
psubsw %mm2, %mm1 /* V32 ; free mm2 */
pmulhw x61f861f861f861f8,%mm1 /* V36 */
psllw $1, %mm7 /* t107 */
paddsw %mm3, %mm5 /* V31 */
psubsw %mm3, %mm4 /* V30 ; free mm3 */
pmulhw x5a825a825a825a82,%mm4 /* V34 */
nop
psubsw %mm1, %mm0 /* V38 */
psubsw %mm7, %mm1 /* V37 ; free mm7 */
psllw $1, %mm1 /* t114 */
pmulhw 8*10(%esi), %mm7 /* V10 */
movq 8*6(%ecx), %mm0
pmulhw 8*6(%esi), %mm0 /* V6 */
movq 8*2(%ecx), %mm5
movq %mm7, %mm3 /* duplicate V10 */
pmulhw 8*2(%esi), %mm5 /* V2 */
movq 8*14(%ecx), %mm4
psubsw %mm0, %mm7 /* V26 */
pmulhw 8*14(%esi), %mm4 /* V14 */
paddsw %mm0, %mm3 /* V29 ; free mm0 */
movq %mm7, %mm1 /* duplicate V26 */
psraw $1, %mm3 /* t91=t94 */
pmulhw x539f539f539f539f,%mm7 /* V33 */
psraw $1, %mm1 /* t96 */
movq %mm5, %mm0 /* duplicate V2 */
psraw $2, %mm4 /* t85=t87 */
paddsw %mm4,%mm5 /* V27 */
psubsw %mm4, %mm0 /* V28 ; free mm4 */
movq %mm0, %mm2 /* duplicate V28 */
psraw $1, %mm5 /* t90=t93 */
pmulhw x4546454645464546,%mm0 /* V35 */
psraw $1, %mm2 /* t97 */
movq %mm5, %mm4 /* duplicate t90=t93 */
psubsw %mm2, %mm1 /* V32 ; free mm2 */
pmulhw x61f861f861f861f8,%mm1 /* V36 */
psllw $1, %mm7 /* t107 */
paddsw %mm3, %mm5 /* V31 */
psubsw %mm3, %mm4 /* V30 ; free mm3 */
pmulhw x5a825a825a825a82,%mm4 /* V34 */
nop
psubsw %mm1, %mm0 /* V38 */
psubsw %mm7, %mm1 /* V37 ; free mm7 */
psllw $1, %mm1 /* t114 */
/* move from the next block */
movq %mm6, %mm3 /* duplicate V25 */
movq %mm6, %mm3 /* duplicate V25 */
/* move from the next block */
movq 8*4(%esi), %mm7 /* V22 */
psllw $1, %mm0 /* t110 */
psubsw %mm5, %mm0 /* V39 (mm5 needed for next block) */
psllw $2, %mm4 /* t112 */
movq 8*4(%esi), %mm7 /* V22 */
psllw $1, %mm0 /* t110 */
psubsw %mm5, %mm0 /* V39 (mm5 needed for next block) */
psllw $2, %mm4 /* t112 */
/* moved from the next block */
movq 8*12(%esi), %mm2 /* V23 */
psubsw %mm0, %mm4 /* V40 */
paddsw %mm4, %mm1 /* V41; free mm0 */
movq 8*12(%esi), %mm2 /* V23 */
psubsw %mm0, %mm4 /* V40 */
paddsw %mm4, %mm1 /* V41; free mm0 */
/* moved from the next block */
psllw $1, %mm2 /* t117=t125 */
psllw $1, %mm2 /* t117=t125 */
/* column 0: output butterfly */
/* moved above:
* movq %mm6, %mm3 duplicate V25
......@@ -232,31 +232,31 @@ vdec_IDCT:
* movq 8*12(%esi), %mm2 V23
* psllw $1, %mm2 t117=t125
*/
psubsw %mm1, %mm6 /* tm6 */
paddsw %mm1, %mm3 /* tm8; free mm1 */
movq %mm7, %mm1 /* duplicate V22 */
paddsw %mm5, %mm7 /* tm0 */
movq %mm3, 8*8(%esi) /* tm8; free mm3 */
psubsw %mm5, %mm1 /* tm14; free mm5 */
movq %mm6, 8*6(%esi) /* tm6; free mm6 */
movq %mm2, %mm3 /* duplicate t117=t125 */
movq (%esi), %mm6 /* V24 */
paddsw %mm0, %mm2 /* tm2 */
movq %mm7, (%esi) /* tm0; free mm7 */
psubsw %mm0, %mm3 /* tm12; free mm0 */
movq %mm1, 8*14(%esi) /* tm14; free mm1 */
psllw $1, %mm6 /* t119=t123 */
movq %mm2, 8*2(%esi) /* tm2; free mm2 */
movq %mm6, %mm0 /* duplicate t119=t123 */
movq %mm3, 8*12(%esi) /* tm12; free mm3 */
paddsw %mm4, %mm6 /* tm4 */
psubsw %mm1, %mm6 /* tm6 */
paddsw %mm1, %mm3 /* tm8; free mm1 */
movq %mm7, %mm1 /* duplicate V22 */
paddsw %mm5, %mm7 /* tm0 */
movq %mm3, 8*8(%esi) /* tm8; free mm3 */
psubsw %mm5, %mm1 /* tm14; free mm5 */
movq %mm6, 8*6(%esi) /* tm6; free mm6 */
movq %mm2, %mm3 /* duplicate t117=t125 */
movq (%esi), %mm6 /* V24 */
paddsw %mm0, %mm2 /* tm2 */
movq %mm7, (%esi) /* tm0; free mm7 */
psubsw %mm0, %mm3 /* tm12; free mm0 */
movq %mm1, 8*14(%esi) /* tm14; free mm1 */
psllw $1, %mm6 /* t119=t123 */
movq %mm2, 8*2(%esi) /* tm2; free mm2 */
movq %mm6, %mm0 /* duplicate t119=t123 */
movq %mm3, 8*12(%esi) /* tm12; free mm3 */
paddsw %mm4, %mm6 /* tm4 */
/* moved from next block */
movq 8*5(%ecx), %mm1
psubsw %mm4, %mm0 /* tm10; free mm4 */
movq 8*5(%ecx), %mm1
psubsw %mm4, %mm0 /* tm10; free mm4 */
/* moved from next block */
pmulhw 8*5(%esi), %mm1 /* V5 */
movq %mm6, 8*4(%esi) /* tm4; free mm6 */
movq %mm0, 8*10(%esi) /* tm10; free mm0 */
pmulhw 8*5(%esi), %mm1 /* V5 */
movq %mm6, 8*4(%esi) /* tm4; free mm6 */
movq %mm0, 8*10(%esi) /* tm10; free mm0 */
/* column 1: even part
* use V5, V13, V1, V9 to produce V56..V59
*/
......@@ -264,95 +264,95 @@ vdec_IDCT:
* movq 8*5(%ecx), %mm1
* pmulhw 8*5(%esi), %mm1 V5
*/
movq 8*13(%ecx), %mm7
psllw $1, %mm1 /* t128=t130 */
pmulhw 8*13(%esi), %mm7 /* V13 */
movq %mm1, %mm2 /* duplicate t128=t130 */
movq 8(%ecx), %mm3
pmulhw 8(%esi), %mm3 /* V1 */
movq 8*9(%ecx), %mm5
psubsw %mm7, %mm1 /* V50 */
pmulhw 8*9(%esi), %mm5 /* V9 */
paddsw %mm7, %mm2 /* V51 */
pmulhw x5a825a825a825a82, %mm1 /* 23170 ->V52 */
movq %mm2, %mm6 /* duplicate V51 */
psraw $1, %mm2 /* t138=t144 */
movq %mm3, %mm4 /* duplicate V1 */
psraw $2, %mm6 /* t136 */
paddsw %mm5, %mm3 /* V53 */
psubsw %mm5, %mm4 /* V54 ;mm5 free */
movq %mm3, %mm7 /* duplicate V53 */
movq 8*13(%ecx), %mm7
psllw $1, %mm1 /* t128=t130 */
pmulhw 8*13(%esi), %mm7 /* V13 */
movq %mm1, %mm2 /* duplicate t128=t130 */
movq 8(%ecx), %mm3
pmulhw 8(%esi), %mm3 /* V1 */
movq 8*9(%ecx), %mm5
psubsw %mm7, %mm1 /* V50 */
pmulhw 8*9(%esi), %mm5 /* V9 */
paddsw %mm7, %mm2 /* V51 */
pmulhw x5a825a825a825a82, %mm1 /* 23170 ->V52 */
movq %mm2, %mm6 /* duplicate V51 */
psraw $1, %mm2 /* t138=t144 */
movq %mm3, %mm4 /* duplicate V1 */
psraw $2, %mm6 /* t136 */
paddsw %mm5, %mm3 /* V53 */
psubsw %mm5, %mm4 /* V54 ;mm5 free */
movq %mm3, %mm7 /* duplicate V53 */
/* moved from next block */
movq 8*11(%ecx), %mm0
psraw $1, %mm4 /* t140=t142 */
psubsw %mm6, %mm1 /* V55 ; mm6 free */
paddsw %mm2, %mm3 /* V56 */
movq %mm4, %mm5 /* duplicate t140=t142 */
paddsw %mm1, %mm4 /* V57 */
movq %mm3, 8*5(%esi) /* V56 */
psubsw %mm1, %mm5 /* V58; mm1 free */
movq %mm4, 8*13(%esi) /* V57 */
psubsw %mm2, %mm7 /* V59; mm2 free */
movq %mm5, 8*9(%esi) /* V58 */
movq 8*11(%ecx), %mm0
psraw $1, %mm4 /* t140=t142 */
psubsw %mm6, %mm1 /* V55 ; mm6 free */
paddsw %mm2, %mm3 /* V56 */
movq %mm4, %mm5 /* duplicate t140=t142 */
paddsw %mm1, %mm4 /* V57 */
movq %mm3, 8*5(%esi) /* V56 */
psubsw %mm1, %mm5 /* V58; mm1 free */
movq %mm4, 8*13(%esi) /* V57 */
psubsw %mm2, %mm7 /* V59; mm2 free */
movq %mm5, 8*9(%esi) /* V58 */
/* keep mm7 alive all along the next block
* movq %mm7, 8(%esi) V59
* moved above
* movq 8*11(%ecx), %mm0
*/
pmulhw 8*11(%esi), %mm0 /* V11 */
movq 8*7(%ecx), %mm6
pmulhw 8*7(%esi), %mm6 /* V7 */
movq 8*15(%ecx), %mm4
movq %mm0, %mm3 /* duplicate V11 */
pmulhw 8*15(%esi), %mm4 /* V15 */
movq 8*3(%ecx), %mm5
psllw $1, %mm6 /* t146=t152 */
pmulhw 8*3(%esi), %mm5 /* V3 */
paddsw %mm6, %mm0 /* V63 */
pmulhw 8*11(%esi), %mm0 /* V11 */
movq 8*7(%ecx), %mm6
pmulhw 8*7(%esi), %mm6 /* V7 */
movq 8*15(%ecx), %mm4
movq %mm0, %mm3 /* duplicate V11 */
pmulhw 8*15(%esi), %mm4 /* V15 */
movq 8*3(%ecx), %mm5
psllw $1, %mm6 /* t146=t152 */
pmulhw 8*3(%esi), %mm5 /* V3 */
paddsw %mm6, %mm0 /* V63 */
/* note that V15 computation has a correction step:
* this is a 'magic' constant that rebiases the results to be closer to the
* expected result. this magic constant can be refined to reduce the error
* even more by doing the correction step in a later stage when the number
* is actually multiplied by 16
*/
paddw x0005000200010001, %mm4
psubsw %mm6, %mm3 /* V60 ; free mm6 */
psraw $1, %mm0 /* t154=t156 */
movq %mm3, %mm1 /* duplicate V60 */
pmulhw x539f539f539f539f, %mm1 /* V67 */
movq %mm5, %mm6 /* duplicate V3 */
psraw $2, %mm4 /* t148=t150 */
paddsw %mm4, %mm5 /* V61 */
psubsw %mm4, %mm6 /* V62 ; free mm4 */
movq %mm5, %mm4 /* duplicate V61 */
psllw $1, %mm1 /* t169 */
paddsw %mm0, %mm5 /* V65 -> result */
psubsw %mm0, %mm4 /* V64 ; free mm0 */
pmulhw x5a825a825a825a82, %mm4 /* V68 */
psraw $1, %mm3 /* t158 */
psubsw %mm6, %mm3 /* V66 */
movq %mm5, %mm2 /* duplicate V65 */
pmulhw x61f861f861f861f8, %mm3 /* V70 */
psllw $1, %mm6 /* t165 */
pmulhw x4546454645464546, %mm6 /* V69 */
psraw $1, %mm2 /* t172 */
paddw x0005000200010001, %mm4
psubsw %mm6, %mm3 /* V60 ; free mm6 */
psraw $1, %mm0 /* t154=t156 */
movq %mm3, %mm1 /* duplicate V60 */
pmulhw x539f539f539f539f, %mm1 /* V67 */
movq %mm5, %mm6 /* duplicate V3 */
psraw $2, %mm4 /* t148=t150 */
paddsw %mm4, %mm5 /* V61 */
psubsw %mm4, %mm6 /* V62 ; free mm4 */
movq %mm5, %mm4 /* duplicate V61 */
psllw $1, %mm1 /* t169 */
paddsw %mm0, %mm5 /* V65 -> result */
psubsw %mm0, %mm4 /* V64 ; free mm0 */
pmulhw x5a825a825a825a82, %mm4 /* V68 */
psraw $1, %mm3 /* t158 */
psubsw %mm6, %mm3 /* V66 */
movq %mm5, %mm2 /* duplicate V65 */
pmulhw x61f861f861f861f8, %mm3 /* V70 */
psllw $1, %mm6 /* t165 */
pmulhw x4546454645464546, %mm6 /* V69 */
psraw $1, %mm2 /* t172 */
/* moved from next block */
movq 8*5(%esi), %mm0 /* V56 */
psllw $1, %mm4 /* t174 */
movq 8*5(%esi), %mm0 /* V56 */
psllw $1, %mm4 /* t174 */
/* moved from next block */
psraw $1, %mm0 /* t177=t188 */
nop
psubsw %mm3, %mm6 /* V72 */
psubsw %mm1, %mm3 /* V71 ; free mm1 */
psubsw %mm2, %mm6 /* V73 ; free mm2 */
psraw $1, %mm0 /* t177=t188 */
nop
psubsw %mm3, %mm6 /* V72 */
psubsw %mm1, %mm3 /* V71 ; free mm1 */
psubsw %mm2, %mm6 /* V73 ; free mm2 */
/* moved from next block */
psraw $1, %mm5 /* t178=t189 */
psubsw %mm6, %mm4 /* V74 */
psraw $1, %mm5 /* t178=t189 */
psubsw %mm6, %mm4 /* V74 */
/* moved from next block */
movq %mm0, %mm1 /* duplicate t177=t188 */
paddsw %mm4, %mm3 /* V75 */
movq %mm0, %mm1 /* duplicate t177=t188 */
paddsw %mm4, %mm3 /* V75 */
/* moved from next block */
paddsw %mm5, %mm0 /* tm1 */
paddsw %mm5, %mm0 /* tm1 */
/* location
* 5 - V56
* 13 - V57
......@@ -370,34 +370,34 @@ vdec_IDCT:
* movq %mm0, %mm1 duplicate t177=t188
* paddsw %mm5, %mm0 tm1
*/
movq 8*13(%esi), %mm2 /* V57 */
psubsw %mm5, %mm1 /* tm15; free mm5 */
movq %mm0, 8(%esi) /* tm1; free mm0 */
psraw $1, %mm7 /* t182=t184 ! new !! */
movq 8*13(%esi), %mm2 /* V57 */
psubsw %mm5, %mm1 /* tm15; free mm5 */
movq %mm0, 8(%esi) /* tm1; free mm0 */
psraw $1, %mm7 /* t182=t184 ! new !! */
/* save the store as used directly in the transpose
* movq %mm1, 120(%esi) tm15; free mm1
*/
movq %mm7, %mm5 /* duplicate t182=t184 */
psubsw %mm3, %mm7 /* tm7 */
paddsw %mm3, %mm5 /* tm9; free mm3 */
movq 8*9(%esi), %mm0 /* V58 */
movq %mm2, %mm3 /* duplicate V57 */
movq %mm7, 8*7(%esi) /* tm7; free mm7 */
psubsw %mm6, %mm3 /* tm13 */
paddsw %mm6, %mm2 /* tm3 ; free mm6 */
movq %mm7, %mm5 /* duplicate t182=t184 */
psubsw %mm3, %mm7 /* tm7 */
paddsw %mm3, %mm5 /* tm9; free mm3 */
movq 8*9(%esi), %mm0 /* V58 */
movq %mm2, %mm3 /* duplicate V57 */
movq %mm7, 8*7(%esi) /* tm7; free mm7 */
psubsw %mm6, %mm3 /* tm13 */
paddsw %mm6, %mm2 /* tm3 ; free mm6 */
/* moved up from the transpose */
movq %mm3, %mm7
movq %mm3, %mm7
/* moved up from the transpose */
punpcklwd %mm1, %mm3
movq %mm0, %mm6 /* duplicate V58 */
movq %mm2, 8*3(%esi) /* tm3; free mm2 */
paddsw %mm4, %mm0 /* tm5 */
psubsw %mm4, %mm6 /* tm11; free mm4 */
punpcklwd %mm1, %mm3
movq %mm0, %mm6 /* duplicate V58 */
movq %mm2, 8*3(%esi) /* tm3; free mm2 */
paddsw %mm4, %mm0 /* tm5 */
psubsw %mm4, %mm6 /* tm11; free mm4 */
/* moved up from the transpose */
punpckhwd %mm1, %mm7
movq %mm0, 8*5(%esi) /* tm5; free mm0 */
punpckhwd %mm1, %mm7
movq %mm0, 8*5(%esi) /* tm5; free mm0 */
/* moved up from the transpose */
movq %mm5, %mm2
movq %mm5, %mm2
/* transpose - M4 part
* --------- ---------
* | M1 | M2 | | M1'| M3'|
......@@ -408,27 +408,27 @@ vdec_IDCT:
* scheduled before the transpose is done without stores, or use the faster
* half mmword stores (when possible)
*/
movd %mm3, 8*9+4(%esi) /* MS part of tmt9 */
punpcklwd %mm6, %mm5
movd %mm7, 8*13+4(%esi) /* MS part of tmt13 */
punpckhwd %mm6, %mm2
movd %mm5, 8*9(%esi) /* LS part of tmt9 */
punpckhdq %mm3, %mm5 /* free mm3 */
movd %mm2, 8*13(%esi) /* LS part of tmt13 */
punpckhdq %mm7, %mm2 /* free mm7 */
movd %mm3, 8*9+4(%esi) /* MS part of tmt9 */
punpcklwd %mm6, %mm5
movd %mm7, 8*13+4(%esi) /* MS part of tmt13 */
punpckhwd %mm6, %mm2
movd %mm5, 8*9(%esi) /* LS part of tmt9 */
punpckhdq %mm3, %mm5 /* free mm3 */
movd %mm2, 8*13(%esi) /* LS part of tmt13 */
punpckhdq %mm7, %mm2 /* free mm7 */
/* moved up from the M3 transpose */
movq 8*8(%esi), %mm0
movq 8*8(%esi), %mm0
/* moved up from the M3 transpose */
movq 8*10(%esi), %mm1
movq 8*10(%esi), %mm1
/* moved up from the M3 transpose */
movq %mm0, %mm3
movq %mm0, %mm3
/* shuffle the rest of the data, and write it with 2 mmword writes */
movq %mm5, 8*11(%esi) /* tmt11 */
movq %mm5, 8*11(%esi) /* tmt11 */
/* moved up from the M3 transpose */
punpcklwd %mm1, %mm0
movq %mm2, 8*15(%esi) /* tmt15 */
punpcklwd %mm1, %mm0
movq %mm2, 8*15(%esi) /* tmt15 */
/* moved up from the M3 transpose */
punpckhwd %mm1, %mm3
punpckhwd %mm1, %mm3
/* transpose - M3 part
* moved up to previous code section
* movq 8*8(%esi), %mm0
......@@ -437,124 +437,124 @@ vdec_IDCT:
* punpcklwd %mm1, %mm0
* punpckhwd %mm1, %mm3
*/
movq 8*12(%esi), %mm6
movq 8*14(%esi), %mm4
movq %mm6, %mm2
movq 8*12(%esi), %mm6
movq 8*14(%esi), %mm4
movq %mm6, %mm2
/* shuffle the data and write the lower parts of the transposed in 4 dwords */
punpcklwd %mm4, %mm6
movq %mm0, %mm1
punpckhdq %mm6, %mm1
movq %mm3, %mm7
punpckhwd %mm4, %mm2 /* free mm4 */
punpckldq %mm6, %mm0 /* free mm6 */
punpcklwd %mm4, %mm6
movq %mm0, %mm1
punpckhdq %mm6, %mm1
movq %mm3, %mm7
punpckhwd %mm4, %mm2 /* free mm4 */
punpckldq %mm6, %mm0 /* free mm6 */
/* moved from next block */
movq 8*13(%esi), %mm4 /* tmt13 */
punpckldq %mm2, %mm3
punpckhdq %mm2, %mm7 /* free mm2 */
movq 8*13(%esi), %mm4 /* tmt13 */
punpckldq %mm2, %mm3
punpckhdq %mm2, %mm7 /* free mm2 */
/* moved from next block */
movq %mm3, %mm5 /* duplicate tmt5 */
movq %mm3, %mm5 /* duplicate tmt5 */
/* column 1: even part (after transpose)
* moved above
* movq %mm3, %mm5 duplicate tmt5
* movq 8*13(%esi), %mm4 tmt13
*/
psubsw %mm4, %mm3 /* V134 */
pmulhw x5a825a825a825a82, %mm3 /* 23170 ->V136 */
movq 8*9(%esi), %mm6 /* tmt9 */
paddsw %mm4, %mm5 /* V135 ; mm4 free */
movq %mm0, %mm4 /* duplicate tmt1 */
paddsw %mm6, %mm0 /* V137 */
psubsw %mm6, %mm4 /* V138 ; mm6 free */
psllw $2, %mm3 /* t290 */
psubsw %mm5, %mm3 /* V139 */
movq %mm0, %mm6 /* duplicate V137 */
paddsw %mm5, %mm0 /* V140 */
movq %mm4, %mm2 /* duplicate V138 */
paddsw %mm3, %mm2 /* V141 */
psubsw %mm3, %mm4 /* V142 ; mm3 free */
movq %mm0, 8*9(%esi) /* V140 */
psubsw %mm5, %mm6 /* V143 ; mm5 free */
psubsw %mm4, %mm3 /* V134 */
pmulhw x5a825a825a825a82, %mm3 /* 23170 ->V136 */
movq 8*9(%esi), %mm6 /* tmt9 */
paddsw %mm4, %mm5 /* V135 ; mm4 free */
movq %mm0, %mm4 /* duplicate tmt1 */
paddsw %mm6, %mm0 /* V137 */
psubsw %mm6, %mm4 /* V138 ; mm6 free */
psllw $2, %mm3 /* t290 */
psubsw %mm5, %mm3 /* V139 */
movq %mm0, %mm6 /* duplicate V137 */
paddsw %mm5, %mm0 /* V140 */
movq %mm4, %mm2 /* duplicate V138 */
paddsw %mm3, %mm2 /* V141 */
psubsw %mm3, %mm4 /* V142 ; mm3 free */
movq %mm0, 8*9(%esi) /* V140 */
psubsw %mm5, %mm6 /* V143 ; mm5 free */
/* moved from next block */
movq 8*11(%esi), %mm0 /* tmt11 */
movq %mm2, 8*13(%esi) /* V141 */
movq 8*11(%esi), %mm0 /* tmt11 */
movq %mm2, 8*13(%esi) /* V141 */
/* moved from next block */
movq %mm0, %mm2 /* duplicate tmt11 */
movq %mm0, %mm2 /* duplicate tmt11 */
/* column 1: odd part (after transpose) */
/* moved up to the prev block
* movq 8*11(%esi), %mm0 tmt11
* movq %mm0, %mm2 duplicate tmt11
*/
movq 8*15(%esi), %mm5 /* tmt15 */
psubsw %mm7, %mm0 /* V144 */
movq %mm0, %mm3 /* duplicate V144 */
paddsw %mm7, %mm2 /* V147 ; free mm7 */
pmulhw x539f539f539f539f, %mm0 /* 21407-> V151 */
movq %mm1, %mm7 /* duplicate tmt3 */
paddsw %mm5, %mm7 /* V145 */
psubsw %mm5, %mm1 /* V146 ; free mm5 */
psubsw %mm1, %mm3 /* V150 */
movq %mm7, %mm5 /* duplicate V145 */
pmulhw x4546454645464546, %mm1 /* 17734-> V153 */
psubsw %mm2, %mm5 /* V148 */
pmulhw x61f861f861f861f8, %mm3 /* 25080-> V154 */
psllw $2, %mm0 /* t311 */
pmulhw x5a825a825a825a82, %mm5 /* 23170-> V152 */
paddsw %mm2, %mm7 /* V149 ; free mm2 */
psllw $1, %mm1 /* t313 */
nop /* without the nop - freeze here for one clock */
movq %mm3, %mm2 /* duplicate V154 */
psubsw %mm0, %mm3 /* V155 ; free mm0 */
psubsw %mm2, %mm1 /* V156 ; free mm2 */
movq 8*15(%esi), %mm5 /* tmt15 */
psubsw %mm7, %mm0 /* V144 */
movq %mm0, %mm3 /* duplicate V144 */
paddsw %mm7, %mm2 /* V147 ; free mm7 */
pmulhw x539f539f539f539f, %mm0 /* 21407-> V151 */
movq %mm1, %mm7 /* duplicate tmt3 */
paddsw %mm5, %mm7 /* V145 */
psubsw %mm5, %mm1 /* V146 ; free mm5 */
psubsw %mm1, %mm3 /* V150 */
movq %mm7, %mm5 /* duplicate V145 */
pmulhw x4546454645464546, %mm1 /* 17734-> V153 */
psubsw %mm2, %mm5 /* V148 */
pmulhw x61f861f861f861f8, %mm3 /* 25080-> V154 */
psllw $2, %mm0 /* t311 */
pmulhw x5a825a825a825a82, %mm5 /* 23170-> V152 */
paddsw %mm2, %mm7 /* V149 ; free mm2 */
psllw $1, %mm1 /* t313 */
nop /* without the nop - freeze here for one clock */
movq %mm3, %mm2 /* duplicate V154 */
psubsw %mm0, %mm3 /* V155 ; free mm0 */
psubsw %mm2, %mm1 /* V156 ; free mm2 */
/* moved from the next block */
movq %mm6, %mm2 /* duplicate V143 */
movq %mm6, %mm2 /* duplicate V143 */
/* moved from the next block */
movq 8*13(%esi), %mm0 /* V141 */
psllw $1, %mm1 /* t315 */
psubsw %mm7, %mm1 /* V157 (keep V149) */
psllw $2, %mm5 /* t317 */
psubsw %mm1, %mm5 /* V158 */
psllw $1, %mm3 /* t319 */
paddsw %mm5, %mm3 /* V159 */
movq 8*13(%esi), %mm0 /* V141 */
psllw $1, %mm1 /* t315 */
psubsw %mm7, %mm1 /* V157 (keep V149) */
psllw $2, %mm5 /* t317 */
psubsw %mm1, %mm5 /* V158 */
psllw $1, %mm3 /* t319 */
paddsw %mm5, %mm3 /* V159 */
/* column 1: output butterfly (after transform)
* moved to the prev block
* movq %mm6, %mm2 duplicate V143
* movq 8*13(%esi), %mm0 V141
*/
psubsw %mm3, %mm2 /* V163 */
paddsw %mm3, %mm6 /* V164 ; free mm3 */
movq %mm4, %mm3 /* duplicate V142 */
psubsw %mm5, %mm4 /* V165 ; free mm5 */
movq %mm2, scratch7 /* out7 */
psraw $4, %mm6
psraw $4, %mm4
paddsw %mm5, %mm3 /* V162 */
movq 8*9(%esi), %mm2 /* V140 */
movq %mm0, %mm5 /* duplicate V141 */
psubsw %mm3, %mm2 /* V163 */
paddsw %mm3, %mm6 /* V164 ; free mm3 */
movq %mm4, %mm3 /* duplicate V142 */
psubsw %mm5, %mm4 /* V165 ; free mm5 */
movq %mm2, scratch7 /* out7 */
psraw $4, %mm6
psraw $4, %mm4
paddsw %mm5, %mm3 /* V162 */
movq 8*9(%esi), %mm2 /* V140 */
movq %mm0, %mm5 /* duplicate V141 */
/* in order not to perculate this line up,
* we read 72(%esi) very near to this location
*/
movq %mm6, 8*9(%esi) /* out9 */
paddsw %mm1, %mm0 /* V161 */
movq %mm3, scratch5 /* out5 */
psubsw %mm1, %mm5 /* V166 ; free mm1 */
movq %mm4, 8*11(%esi) /* out11 */
psraw $4, %mm5
movq %mm0, scratch3 /* out3 */
movq %mm2, %mm4 /* duplicate V140 */
movq %mm5, 8*13(%esi) /* out13 */
paddsw %mm7, %mm2 /* V160 */
movq %mm6, 8*9(%esi) /* out9 */
paddsw %mm1, %mm0 /* V161 */
movq %mm3, scratch5 /* out5 */
psubsw %mm1, %mm5 /* V166 ; free mm1 */
movq %mm4, 8*11(%esi) /* out11 */
psraw $4, %mm5
movq %mm0, scratch3 /* out3 */
movq %mm2, %mm4 /* duplicate V140 */
movq %mm5, 8*13(%esi) /* out13 */
paddsw %mm7, %mm2 /* V160 */
/* moved from the next block */
movq 8(%esi), %mm0
psubsw %mm7, %mm4 /* V167 ; free mm7 */
movq 8(%esi), %mm0
psubsw %mm7, %mm4 /* V167 ; free mm7 */
/* moved from the next block */
movq 8*3(%esi), %mm7
psraw $4, %mm4
movq %mm2, scratch1 /* out1 */
movq 8*3(%esi), %mm7
psraw $4, %mm4
movq %mm2, scratch1 /* out1 */
/* moved from the next block */
movq %mm0, %mm1
movq %mm4, 8*15(%esi) /* out15 */
movq %mm0, %mm1
movq %mm4, 8*15(%esi) /* out15 */
/* moved from the next block */
punpcklwd %mm7, %mm0
punpcklwd %mm7, %mm0
/* transpose - M2 parts
* moved up to the prev block
* movq 8(%esi), %mm0
......@@ -562,130 +562,130 @@ vdec_IDCT:
* movq %mm0, %mm1
* punpcklwd %mm7, %mm0
*/
movq 8*5(%esi), %mm5
punpckhwd %mm7, %mm1
movq 8*7(%esi), %mm4
movq %mm5, %mm3
movq 8*5(%esi), %mm5
punpckhwd %mm7, %mm1
movq 8*7(%esi), %mm4
movq %mm5, %mm3
/* shuffle the data and write the lower parts of the trasposed in 4 dwords */
movd %mm0, 8*8(%esi) /* LS part of tmt8 */
punpcklwd %mm4, %mm5
movd %mm1, 8*12(%esi) /* LS part of tmt12 */
punpckhwd %mm4, %mm3
movd %mm5, 8*8+4(%esi) /* MS part of tmt8 */
punpckhdq %mm5, %mm0 /* tmt10 */
movd %mm3, 8*12+4(%esi) /* MS part of tmt12 */
punpckhdq %mm3, %mm1 /* tmt14 */
movd %mm0, 8*8(%esi) /* LS part of tmt8 */
punpcklwd %mm4, %mm5
movd %mm1, 8*12(%esi) /* LS part of tmt12 */
punpckhwd %mm4, %mm3
movd %mm5, 8*8+4(%esi) /* MS part of tmt8 */
punpckhdq %mm5, %mm0 /* tmt10 */
movd %mm3, 8*12+4(%esi) /* MS part of tmt12 */
punpckhdq %mm3, %mm1 /* tmt14 */
/* transpose - M1 parts */
movq (%esi), %mm7
movq 8*2(%esi), %mm2
movq %mm7, %mm6
movq 8*4(%esi), %mm5
punpcklwd %mm2, %mm7
movq 8*6(%esi), %mm4
punpckhwd %mm2, %mm6 /* free mm2 */
movq %mm5, %mm3
punpcklwd %mm4, %mm5
punpckhwd %mm4, %mm3 /* free mm4 */
movq %mm7, %mm2
movq %mm6, %mm4
punpckldq %mm5, %mm7 /* tmt0 */
punpckhdq %mm5, %mm2 /* tmt2 ; free mm5 */
movq (%esi), %mm7
movq 8*2(%esi), %mm2
movq %mm7, %mm6
movq 8*4(%esi), %mm5
punpcklwd %mm2, %mm7
movq 8*6(%esi), %mm4
punpckhwd %mm2, %mm6 /* free mm2 */
movq %mm5, %mm3
punpcklwd %mm4, %mm5
punpckhwd %mm4, %mm3 /* free mm4 */
movq %mm7, %mm2
movq %mm6, %mm4
punpckldq %mm5, %mm7 /* tmt0 */
punpckhdq %mm5, %mm2 /* tmt2 ; free mm5 */
/* shuffle the rest of the data, and write it with 2 mmword writes */
punpckldq %mm3, %mm6 /* tmt4 */
punpckldq %mm3, %mm6 /* tmt4 */
/* moved from next block */
movq %mm2, %mm5 /* duplicate tmt2 */
punpckhdq %mm3, %mm4 /* tmt6 ; free mm3 */
movq %mm2, %mm5 /* duplicate tmt2 */
punpckhdq %mm3, %mm4 /* tmt6 ; free mm3 */
/* moved from next block */
movq %mm0, %mm3 /* duplicate tmt10 */
movq %mm0, %mm3 /* duplicate tmt10 */
/* column 0: odd part (after transpose)
*moved up to prev block
* movq %mm0, %mm3 duplicate tmt10
* movq %mm2, %mm5 duplicate tmt2
*/
psubsw %mm4, %mm0 /* V110 */
paddsw %mm4, %mm3 /* V113 ; free mm4 */
movq %mm0, %mm4 /* duplicate V110 */
paddsw %mm1, %mm2 /* V111 */
pmulhw x539f539f539f539f, %mm0 /* 21407-> V117 */
psubsw %mm1, %mm5 /* V112 ; free mm1 */
psubsw %mm5, %mm4 /* V116 */
movq %mm2, %mm1 /* duplicate V111 */
pmulhw x4546454645464546, %mm5 /* 17734-> V119 */
psubsw %mm3, %mm2 /* V114 */
pmulhw x61f861f861f861f8, %mm4 /* 25080-> V120 */
paddsw %mm3, %mm1 /* V115 ; free mm3 */
pmulhw x5a825a825a825a82, %mm2 /* 23170-> V118 */
psllw $2, %mm0 /* t266 */
movq %mm1, (%esi) /* save V115 */
psllw $1, %mm5 /* t268 */
psubsw %mm4, %mm5 /* V122 */
psubsw %mm0, %mm4 /* V121 ; free mm0 */
psllw $1, %mm5 /* t270 */
psubsw %mm1, %mm5 /* V123 ; free mm1 */
psllw $2, %mm2 /* t272 */
psubsw %mm5, %mm2 /* V124 (keep V123) */
psllw $1, %mm4 /* t274 */
movq %mm5, 8*2(%esi) /* save V123 ; free mm5 */
paddsw %mm2, %mm4 /* V125 (keep V124) */
psubsw %mm4, %mm0 /* V110 */
paddsw %mm4, %mm3 /* V113 ; free mm4 */
movq %mm0, %mm4 /* duplicate V110 */
paddsw %mm1, %mm2 /* V111 */
pmulhw x539f539f539f539f, %mm0 /* 21407-> V117 */
psubsw %mm1, %mm5 /* V112 ; free mm1 */
psubsw %mm5, %mm4 /* V116 */
movq %mm2, %mm1 /* duplicate V111 */
pmulhw x4546454645464546, %mm5 /* 17734-> V119 */
psubsw %mm3, %mm2 /* V114 */
pmulhw x61f861f861f861f8, %mm4 /* 25080-> V120 */
paddsw %mm3, %mm1 /* V115 ; free mm3 */
pmulhw x5a825a825a825a82, %mm2 /* 23170-> V118 */
psllw $2, %mm0 /* t266 */
movq %mm1, (%esi) /* save V115 */
psllw $1, %mm5 /* t268 */
psubsw %mm4, %mm5 /* V122 */
psubsw %mm0, %mm4 /* V121 ; free mm0 */
psllw $1, %mm5 /* t270 */
psubsw %mm1, %mm5 /* V123 ; free mm1 */
psllw $2, %mm2 /* t272 */
psubsw %mm5, %mm2 /* V124 (keep V123) */
psllw $1, %mm4 /* t274 */
movq %mm5, 8*2(%esi) /* save V123 ; free mm5 */
paddsw %mm2, %mm4 /* V125 (keep V124) */
/* column 0: even part (after transpose) */
movq 8*12(%esi), %mm0 /* tmt12 */
movq %mm6, %mm3 /* duplicate tmt4 */
psubsw %mm0, %mm6 /* V100 */
paddsw %mm0, %mm3 /* V101 ; free mm0 */
pmulhw x5a825a825a825a82, %mm6 /* 23170 ->V102 */
movq %mm7, %mm5 /* duplicate tmt0 */
movq 8*8(%esi), %mm1 /* tmt8 */
paddsw %mm1, %mm7 /* V103 */
psubsw %mm1, %mm5 /* V104 ; free mm1 */
movq %mm7, %mm0 /* duplicate V103 */
psllw $2, %mm6 /* t245 */
paddsw %mm3, %mm7 /* V106 */
movq %mm5, %mm1 /* duplicate V104 */
psubsw %mm3, %mm6 /* V105 */
psubsw %mm3, %mm0 /* V109; free mm3 */
paddsw %mm6, %mm5 /* V107 */
psubsw %mm6, %mm1 /* V108 ; free mm6 */
movq 8*12(%esi), %mm0 /* tmt12 */
movq %mm6, %mm3 /* duplicate tmt4 */
psubsw %mm0, %mm6 /* V100 */
paddsw %mm0, %mm3 /* V101 ; free mm0 */
pmulhw x5a825a825a825a82, %mm6 /* 23170 ->V102 */
movq %mm7, %mm5 /* duplicate tmt0 */
movq 8*8(%esi), %mm1 /* tmt8 */
paddsw %mm1, %mm7 /* V103 */
psubsw %mm1, %mm5 /* V104 ; free mm1 */
movq %mm7, %mm0 /* duplicate V103 */
psllw $2, %mm6 /* t245 */
paddsw %mm3, %mm7 /* V106 */
movq %mm5, %mm1 /* duplicate V104 */
psubsw %mm3, %mm6 /* V105 */
psubsw %mm3, %mm0 /* V109; free mm3 */
paddsw %mm6, %mm5 /* V107 */
psubsw %mm6, %mm1 /* V108 ; free mm6 */
/* column 0: output butterfly (after transform) */
movq %mm1, %mm3 /* duplicate V108 */
paddsw %mm2, %mm1 /* out4 */
psraw $4, %mm1
psubsw %mm2, %mm3 /* out10 ; free mm2 */
psraw $4, %mm3
movq %mm0, %mm6 /* duplicate V109 */
movq %mm1, 8*4(%esi) /* out4 ; free mm1 */
psubsw %mm4, %mm0 /* out6 */
movq %mm3, 8*10(%esi) /* out10 ; free mm3 */
psraw $4, %mm0
paddsw %mm4, %mm6 /* out8 ; free mm4 */
movq %mm7, %mm1 /* duplicate V106 */
movq %mm0, 8*6(%esi) /* out6 ; free mm0 */
psraw $4, %mm6
movq (%esi), %mm4 /* V115 */
movq %mm6, 8*8(%esi) /* out8 ; free mm6 */
movq %mm5, %mm2 /* duplicate V107 */
movq 8*2(%esi), %mm3 /* V123 */
paddsw %mm4, %mm7 /* out0 */
movq %mm1, %mm3 /* duplicate V108 */
paddsw %mm2, %mm1 /* out4 */
psraw $4, %mm1
psubsw %mm2, %mm3 /* out10 ; free mm2 */
psraw $4, %mm3
movq %mm0, %mm6 /* duplicate V109 */
movq %mm1, 8*4(%esi) /* out4 ; free mm1 */
psubsw %mm4, %mm0 /* out6 */
movq %mm3, 8*10(%esi) /* out10 ; free mm3 */
psraw $4, %mm0
paddsw %mm4, %mm6 /* out8 ; free mm4 */
movq %mm7, %mm1 /* duplicate V106 */
movq %mm0, 8*6(%esi) /* out6 ; free mm0 */
psraw $4, %mm6
movq (%esi), %mm4 /* V115 */
movq %mm6, 8*8(%esi) /* out8 ; free mm6 */
movq %mm5, %mm2 /* duplicate V107 */
movq 8*2(%esi), %mm3 /* V123 */
paddsw %mm4, %mm7 /* out0 */
/* moved up from next block */
movq scratch3, %mm0
psraw $4, %mm7
movq scratch3, %mm0
psraw $4, %mm7
/* moved up from next block */
movq scratch5, %mm6
psubsw %mm4, %mm1 /* out14 ; free mm4 */
paddsw %mm3, %mm5 /* out2 */
psraw $4, %mm1
movq %mm7, (%esi) /* out0 ; free mm7 */
psraw $4, %mm5
movq %mm1, 8*14(%esi) /* out14 ; free mm1 */
psubsw %mm3, %mm2 /* out12 ; free mm3 */
movq %mm5, 8*2(%esi) /* out2 ; free mm5 */
psraw $4, %mm2
movq scratch5, %mm6
psubsw %mm4, %mm1 /* out14 ; free mm4 */
paddsw %mm3, %mm5 /* out2 */
psraw $4, %mm1
movq %mm7, (%esi) /* out0 ; free mm7 */
psraw $4, %mm5
movq %mm1, 8*14(%esi) /* out14 ; free mm1 */
psubsw %mm3, %mm2 /* out12 ; free mm3 */
movq %mm5, 8*2(%esi) /* out2 ; free mm5 */
psraw $4, %mm2
/* moved up to the prev block */
movq scratch7, %mm4
movq scratch7, %mm4
/* moved up to the prev block */
psraw $4, %mm0
movq %mm2, 8*12(%esi) /* out12 ; free mm2 */
psraw $4, %mm0
movq %mm2, 8*12(%esi) /* out12 ; free mm2 */
/* moved up to the prev block */
psraw $4, %mm6
psraw $4, %mm6
/* move back the data to its correct place
* moved up to the prev block
* movq scratch3, %mm0
......@@ -694,112 +694,112 @@ vdec_IDCT:
* psraw $4, %mm0
* psraw $4, %mm6
*/
movq scratch1, %mm1
psraw $4, %mm4
movq %mm0, 8*3(%esi) /* out3 */
psraw $4, %mm1
movq %mm6, 8*5(%esi) /* out5 */
movq %mm4, 8*7(%esi) /* out7 */
movq %mm1, 8(%esi) /* out1 */
movq scratch1, %mm1
psraw $4, %mm4
movq %mm0, 8*3(%esi) /* out3 */
psraw $4, %mm1
movq %mm6, 8*5(%esi) /* out5 */
movq %mm4, 8*7(%esi) /* out7 */
movq %mm1, 8(%esi) /* out1 */
/* transpose matrix */
movl $8, %ebx /* ebx is x_size */
movl %esi, %edi /* pointer to the matrix */
movl %ebx, %ecx
sal $2, %ecx
movl %ebx, %eax
addl %ebx, %ecx
subl $4, %eax /* eax is inner loop variable */
addl %ebx, %ecx /* ecx is 6*row size */
movl %eax, %edx /* edx is the outer loop variable */
movl $8, %ebx /* ebx is x_size */
movl %esi, %edi /* pointer to the matrix */
movl %ebx, %ecx
sal $2, %ecx
movl %ebx, %eax
addl %ebx, %ecx
subl $4, %eax /* eax is inner loop variable */
addl %ebx, %ecx /* ecx is 6*row size */
movl %eax, %edx /* edx is the outer loop variable */
.L1: movq (%esi), %mm0 /* first line */
movq (%esi,%ebx,4), %mm2 /* third line */
movq %mm0, %mm6 /* copy first line */
punpcklwd (%esi,%ebx,2), %mm0 /* interleave fist and second lines */
movq %mm2, %mm7 /* copy third line */
punpcklwd (%esi,%ecx), %mm2 /* interleave third and fourth lines */
movq %mm0, %mm4 /* copy first intermediate result */
movq (%esi,%ebx,2), %mm1 /* second line */
movq (%esi,%ebx,4), %mm2 /* third line */
movq %mm0, %mm6 /* copy first line */
punpcklwd (%esi,%ebx,2), %mm0 /* interleave fist and second lines */
movq %mm2, %mm7 /* copy third line */
punpcklwd (%esi,%ecx), %mm2 /* interleave third and fourth lines */
movq %mm0, %mm4 /* copy first intermediate result */
movq (%esi,%ebx,2), %mm1 /* second line */
/* the next line 'punpcklwd %mm2, %mm0' inverted two pixels. */
/* punpckldq make printing cleaner */
punpckldq %mm2, %mm0 /* interleave to produce result 1 */
movq (%esi,%ecx), %mm3 /* fourth line */
punpckhdq %mm2, %mm4 /* interleave to produce result 2 */
movq %mm0, (%esi) /* write result 1 */
punpckhwd %mm1, %mm6 /* interleave first and second lines */
movq %mm4, (%esi,%ebx,2) /* write result 2 */
punpckhwd %mm3, %mm7 /* interleave 3rd and 4th lines */
movq %mm6, %mm5 /* copy first intermediate result */
punpckldq %mm7, %mm6 /* interleave to produce result 3 */
leal (%edi,%ebx,8), %edi /* point to 4x4 set 4 rows down */
punpckhdq %mm7, %mm5 /* interleave to produce result 4 */
movq %mm6, (%esi,%ebx,4) /* write result 3 */
movq %mm5, (%esi,%ecx) /* write result 4 */
/* check to see if number of rows left is zero */
cmpl $0, %edx
/* last time through you are done and ready to exit */
je .L3
punpckldq %mm2, %mm0 /* interleave to produce result 1 */
movq (%esi,%ecx), %mm3 /* fourth line */
punpckhdq %mm2, %mm4 /* interleave to produce result 2 */
movq %mm0, (%esi) /* write result 1 */
punpckhwd %mm1, %mm6 /* interleave first and second lines */
movq %mm4, (%esi,%ebx,2) /* write result 2 */
punpckhwd %mm3, %mm7 /* interleave 3rd and 4th lines */
movq %mm6, %mm5 /* copy first intermediate result */
punpckldq %mm7, %mm6 /* interleave to produce result 3 */
leal (%edi,%ebx,8), %edi /* point to 4x4 set 4 rows down */
punpckhdq %mm7, %mm5 /* interleave to produce result 4 */
movq %mm6, (%esi,%ebx,4) /* write result 3 */
movq %mm5, (%esi,%ecx) /* write result 4 */
/* check to see if number of rows left is zero */
cmpl $0, %edx
/* last time through you are done and ready to exit */
je .L3
.L2: movq 8(%esi), %mm0 /* first line */
movq 8(%esi,%ebx,4), %mm2 /* third line */
movq %mm0, %mm6 /* copy first line */
punpcklwd 8(%esi,%ebx,2), %mm0 /* interleave first and second lines */
movq %mm2, %mm7 /* copy third line */
punpcklwd 8(%esi,%ecx), %mm2 /* interleave 3rd and 4th lines */
movq %mm0, %mm4 /* copy first intermediate */
movq (%edi), %mm1 /* first line */
punpckldq %mm2, %mm0 /* interleave to produce 1st result */
movq (%edi,%ebx,4), %mm3 /* third line */
punpckhdq %mm2, %mm4 /* interleave to produce 2nd result */
punpckhwd 8(%esi,%ebx,2), %mm6 /* interleave 1st and 2nd lines */
movq %mm1, %mm2 /* copy first line */
punpckhwd 8(%esi,%ecx), %mm7 /* interleave 3rd and 4th lines */
movq %mm6, %mm5 /* copy first intermediate */
movq %mm0, (%edi) /* write result 1 */
punpckhdq %mm7, %mm5 /* produce third result */
punpcklwd (%edi,%ebx,2), %mm1 /* interleave 1st and 2nd lines */
movq %mm3, %mm0 /* copy third line */
punpckhwd (%edi,%ebx,2), %mm2 /* interleave 1st and 2nd lines */
movq %mm4, (%edi,%ebx,2) /* write result 2 */
punpckldq %mm7, %mm6 /* produce fourth result */
punpcklwd (%edi,%ecx), %mm3 /* interleave 3rd and 4th lines */
movq %mm1, %mm4 /* copy first intermediate */
movq %mm6, (%edi,%ebx,4) /* write result 3 */
punpckldq %mm3, %mm1
punpckhwd (%edi,%ecx), %mm0 /* interleave 3rd and 4th lines */
movq %mm2, %mm6 /* copy second intermediate */
movq %mm5, (%edi,%ecx) /* write result 4 */
punpckhdq %mm3, %mm4 /* produce second result */
movq %mm1, 8(%esi) /* write result 5 */
punpckldq %mm0, %mm2 /* produce third result */
movq %mm4, 8(%esi,%ebx,2) /* write result 6 */
punpckhdq %mm0, %mm6 /* produce fourth result */
movq %mm2, 8(%esi,%ebx,4) /* write result 7 */
movq %mm6, 8(%esi,%ecx) /* write result 8 */
/* increment %esi to point to next 4x4 block in same row */
addl $8, %esi
/* increment %edi to point to nxt 4x4 block below current */
leal (%edi,%ebx,8), %edi
sub $4, %eax /* decrement inner loop var */
jnz .L2
/* %edi points to start of second row in block just finished */
sal $1, %edx
leal 8(%esi,%ebx,8), %esi
subl %edx, %esi
/* subtract the number of bytes in last row */
/* now we point to spot where row=col */
subl $8, %edx /* sub 4 from row number */
sarl $1, %edx
mov %esi, %edi
mov %edx, %eax
/* reset x_size to outer loop variable to start new row */
jmp .L1
movq 8(%esi,%ebx,4), %mm2 /* third line */
movq %mm0, %mm6 /* copy first line */
punpcklwd 8(%esi,%ebx,2), %mm0 /* interleave first and second lines */
movq %mm2, %mm7 /* copy third line */
punpcklwd 8(%esi,%ecx), %mm2 /* interleave 3rd and 4th lines */
movq %mm0, %mm4 /* copy first intermediate */
movq (%edi), %mm1 /* first line */
punpckldq %mm2, %mm0 /* interleave to produce 1st result */
movq (%edi,%ebx,4), %mm3 /* third line */
punpckhdq %mm2, %mm4 /* interleave to produce 2nd result */
punpckhwd 8(%esi,%ebx,2), %mm6 /* interleave 1st and 2nd lines */
movq %mm1, %mm2 /* copy first line */
punpckhwd 8(%esi,%ecx), %mm7 /* interleave 3rd and 4th lines */
movq %mm6, %mm5 /* copy first intermediate */
movq %mm0, (%edi) /* write result 1 */
punpckhdq %mm7, %mm5 /* produce third result */
punpcklwd (%edi,%ebx,2), %mm1 /* interleave 1st and 2nd lines */
movq %mm3, %mm0 /* copy third line */
punpckhwd (%edi,%ebx,2), %mm2 /* interleave 1st and 2nd lines */
movq %mm4, (%edi,%ebx,2) /* write result 2 */
punpckldq %mm7, %mm6 /* produce fourth result */
punpcklwd (%edi,%ecx), %mm3 /* interleave 3rd and 4th lines */
movq %mm1, %mm4 /* copy first intermediate */
movq %mm6, (%edi,%ebx,4) /* write result 3 */
punpckldq %mm3, %mm1
punpckhwd (%edi,%ecx), %mm0 /* interleave 3rd and 4th lines */
movq %mm2, %mm6 /* copy second intermediate */
movq %mm5, (%edi,%ecx) /* write result 4 */
punpckhdq %mm3, %mm4 /* produce second result */
movq %mm1, 8(%esi) /* write result 5 */
punpckldq %mm0, %mm2 /* produce third result */
movq %mm4, 8(%esi,%ebx,2) /* write result 6 */
punpckhdq %mm0, %mm6 /* produce fourth result */
movq %mm2, 8(%esi,%ebx,4) /* write result 7 */
movq %mm6, 8(%esi,%ecx) /* write result 8 */
/* increment %esi to point to next 4x4 block in same row */
addl $8, %esi
/* increment %edi to point to nxt 4x4 block below current */
leal (%edi,%ebx,8), %edi
sub $4, %eax /* decrement inner loop var */
jnz .L2
/* %edi points to start of second row in block just finished */
sal $1, %edx
leal 8(%esi,%ebx,8), %esi
subl %edx, %esi
/* subtract the number of bytes in last row */
/* now we point to spot where row=col */
subl $8, %edx /* sub 4 from row number */
sarl $1, %edx
mov %esi, %edi
mov %edx, %eax
/* reset x_size to outer loop variable to start new row */
jmp .L1
.L3: emms
popl %edi
popl %esi
popl %edx
popl %ecx
popl %ebx
movl %ebp,%esp
popl %ebp
ret
popl %edi
popl %esi
popl %edx
popl %ecx
popl %ebx
movl %ebp,%esp
popl %ebp
ret
.Lfe1:
.size vdec_IDCT,.Lfe1-vdec_IDCT
.size vdec_IDCT,.Lfe1-vdec_IDCT
......@@ -155,7 +155,7 @@ void vdec_IDCT( vdec_thread_t * p_vdec, dctelem_t * p_block, int i_idontcare )
*/
if ((dataptr[1] | dataptr[2] | dataptr[3] | dataptr[4] |
dataptr[5] | dataptr[6] | dataptr[7]) == 0)
dataptr[5] | dataptr[6] | dataptr[7]) == 0)
{
/* AC terms all zero */
dctelem_t dcval = (dctelem_t) (dataptr[0] << PASS1_BITS);
......@@ -169,7 +169,7 @@ void vdec_IDCT( vdec_thread_t * p_vdec, dctelem_t * p_block, int i_idontcare )
dataptr[6] = dcval;
dataptr[7] = dcval;
dataptr += DCTSIZE; /* advance pointer to next row */
dataptr += DCTSIZE; /* advance pointer to next row */
continue;
}
......@@ -234,7 +234,7 @@ void vdec_IDCT( vdec_thread_t * p_vdec, dctelem_t * p_block, int i_idontcare )
dataptr[3] = (dctelem_t) DESCALE(tmp13 + tmp0, CONST_BITS-PASS1_BITS);
dataptr[4] = (dctelem_t) DESCALE(tmp13 - tmp0, CONST_BITS-PASS1_BITS);
dataptr += DCTSIZE; /* advance pointer to next row */
dataptr += DCTSIZE; /* advance pointer to next row */
}
/* Pass 2: process columns. */
......@@ -254,8 +254,8 @@ void vdec_IDCT( vdec_thread_t * p_vdec, dctelem_t * p_block, int i_idontcare )
#ifndef NO_ZERO_COLUMN_TEST /*ajoute un test mais evite des calculs */
if ((dataptr[DCTSIZE*1] | dataptr[DCTSIZE*2] | dataptr[DCTSIZE*3] |
dataptr[DCTSIZE*4] | dataptr[DCTSIZE*5] | dataptr[DCTSIZE*6] |
dataptr[DCTSIZE*7]) == 0)
dataptr[DCTSIZE*4] | dataptr[DCTSIZE*5] | dataptr[DCTSIZE*6] |
dataptr[DCTSIZE*7]) == 0)
{
/* AC terms all zero */
dctelem_t dcval = (dctelem_t) DESCALE((s32) dataptr[0], PASS1_BITS+3);
......@@ -269,7 +269,7 @@ void vdec_IDCT( vdec_thread_t * p_vdec, dctelem_t * p_block, int i_idontcare )
dataptr[DCTSIZE*6] = dcval;
dataptr[DCTSIZE*7] = dcval;
dataptr++; /* advance pointer to next column */
dataptr++; /* advance pointer to next column */
continue;
}
#endif
......@@ -327,23 +327,23 @@ void vdec_IDCT( vdec_thread_t * p_vdec, dctelem_t * p_block, int i_idontcare )
/* Final output stage: inputs are tmp10..tmp13, tmp0..tmp3 */
dataptr[DCTSIZE*0] = (dctelem_t) DESCALE(tmp10 + tmp3,
CONST_BITS+PASS1_BITS+3);
CONST_BITS+PASS1_BITS+3);
dataptr[DCTSIZE*7] = (dctelem_t) DESCALE(tmp10 - tmp3,
CONST_BITS+PASS1_BITS+3);
CONST_BITS+PASS1_BITS+3);
dataptr[DCTSIZE*1] = (dctelem_t) DESCALE(tmp11 + tmp2,
CONST_BITS+PASS1_BITS+3);
CONST_BITS+PASS1_BITS+3);
dataptr[DCTSIZE*6] = (dctelem_t) DESCALE(tmp11 - tmp2,
CONST_BITS+PASS1_BITS+3);
CONST_BITS+PASS1_BITS+3);
dataptr[DCTSIZE*2] = (dctelem_t) DESCALE(tmp12 + tmp1,
CONST_BITS+PASS1_BITS+3);
CONST_BITS+PASS1_BITS+3);
dataptr[DCTSIZE*5] = (dctelem_t) DESCALE(tmp12 - tmp1,
CONST_BITS+PASS1_BITS+3);
CONST_BITS+PASS1_BITS+3);
dataptr[DCTSIZE*3] = (dctelem_t) DESCALE(tmp13 + tmp0,
CONST_BITS+PASS1_BITS+3);
CONST_BITS+PASS1_BITS+3);
dataptr[DCTSIZE*4] = (dctelem_t) DESCALE(tmp13 - tmp0,
CONST_BITS+PASS1_BITS+3);
CONST_BITS+PASS1_BITS+3);
dataptr++; /* advance pointer to next column */
dataptr++; /* advance pointer to next column */
}
#endif
......@@ -393,7 +393,7 @@ void vdec_IDCT( vdec_thread_t * p_vdec, dctelem_t * p_block, int i_idontcare )
idataptr[3] = v;
}
dataptr += DCTSIZE; /* advance pointer to next row */
dataptr += DCTSIZE; /* advance pointer to next row */
continue;
}
d2 = dataptr[2];
......@@ -411,7 +411,7 @@ void vdec_IDCT( vdec_thread_t * p_vdec, dctelem_t * p_block, int i_idontcare )
{
if (d2)
{
if (d0)
if (d0)
{
/* d0 != 0, d2 != 0, d4 != 0, d6 != 0 */
z1 = MULTIPLY(d2 + d6, FIX(0.541196100));
......@@ -428,7 +428,7 @@ void vdec_IDCT( vdec_thread_t * p_vdec, dctelem_t * p_block, int i_idontcare )
}
else
{
/* d0 == 0, d2 != 0, d4 != 0, d6 != 0 */
/* d0 == 0, d2 != 0, d4 != 0, d6 != 0 */
z1 = MULTIPLY(d2 + d6, FIX(0.541196100));
tmp2 = z1 + MULTIPLY(d6, - FIX(1.847759065));
tmp3 = z1 + MULTIPLY(d2, FIX(0.765366865));
......@@ -439,11 +439,11 @@ void vdec_IDCT( vdec_thread_t * p_vdec, dctelem_t * p_block, int i_idontcare )
tmp13 = tmp0 - tmp3;
tmp11 = tmp2 - tmp0;
tmp12 = -(tmp0 + tmp2);
}
}
}
else
{
if (d0)
if (d0)
{
/* d0 != 0, d2 == 0, d4 != 0, d6 != 0 */
tmp2 = MULTIPLY(d6, - FIX2(1.306562965));
......@@ -456,10 +456,10 @@ void vdec_IDCT( vdec_thread_t * p_vdec, dctelem_t * p_block, int i_idontcare )
tmp13 = tmp0 - tmp3;
tmp11 = tmp1 + tmp2;
tmp12 = tmp1 - tmp2;
}
}
else
{
/* d0 == 0, d2 == 0, d4 != 0, d6 != 0 */
/* d0 == 0, d2 == 0, d4 != 0, d6 != 0 */
tmp2 = MULTIPLY(d6, - FIX2(1.306562965));
tmp3 = MULTIPLY(d6, FIX(0.541196100));
......@@ -469,14 +469,14 @@ void vdec_IDCT( vdec_thread_t * p_vdec, dctelem_t * p_block, int i_idontcare )
tmp13 = tmp0 - tmp3;
tmp11 = tmp2 - tmp0;
tmp12 = -(tmp0 + tmp2);
}
}
}
}
else
{
if (d2)
{
if (d0)
if (d0)
{
/* d0 != 0, d2 != 0, d4 == 0, d6 != 0 */
z1 = MULTIPLY(d2 + d6, FIX(0.541196100));
......@@ -492,7 +492,7 @@ void vdec_IDCT( vdec_thread_t * p_vdec, dctelem_t * p_block, int i_idontcare )
}
else
{
/* d0 == 0, d2 != 0, d4 == 0, d6 != 0 */
/* d0 == 0, d2 != 0, d4 == 0, d6 != 0 */
z1 = MULTIPLY(d2 + d6, FIX(0.541196100));
tmp2 = z1 + MULTIPLY(d6, - FIX(1.847759065));
tmp3 = z1 + MULTIPLY(d2, FIX(0.765366865));
......@@ -501,8 +501,8 @@ void vdec_IDCT( vdec_thread_t * p_vdec, dctelem_t * p_block, int i_idontcare )
tmp13 = -tmp3;
tmp11 = tmp2;
tmp12 = -tmp2;
}
}
}
}
else
{
if (d0)
......@@ -540,7 +540,7 @@ void vdec_IDCT( vdec_thread_t * p_vdec, dctelem_t * p_block, int i_idontcare )
{
if (d0)
{
/* d0 != 0, d2 != 0, d4 != 0, d6 == 0 */
/* d0 != 0, d2 != 0, d4 != 0, d6 == 0 */
tmp2 = MULTIPLY(d2, FIX(0.541196100));
tmp3 = MULTIPLY(d2, (FIX(1.306562965) + .5));
......@@ -568,7 +568,7 @@ void vdec_IDCT( vdec_thread_t * p_vdec, dctelem_t * p_block, int i_idontcare )
}
else
{
if (d0)
if (d0)
{
/* d0 != 0, d2 == 0, d4 != 0, d6 == 0 */
tmp10 = tmp13 = (d0 + d4) << CONST_BITS;
......@@ -634,7 +634,7 @@ void vdec_IDCT( vdec_thread_t * p_vdec, dctelem_t * p_block, int i_idontcare )
if (d7)
{
if (d5)
if (d5)
{
if (d3)
{
......@@ -646,7 +646,7 @@ void vdec_IDCT( vdec_thread_t * p_vdec, dctelem_t * p_block, int i_idontcare )
z3 = d7 + d3;
z4 = d5 + d1;
z5 = MULTIPLY(z3 + z4, FIX(1.175875602));
tmp0 = MULTIPLY(d7, FIX(0.298631336));
tmp1 = MULTIPLY(d5, FIX(2.053119869));
tmp2 = MULTIPLY(d3, FIX(3.072711026));
......@@ -655,10 +655,10 @@ void vdec_IDCT( vdec_thread_t * p_vdec, dctelem_t * p_block, int i_idontcare )
z2 = MULTIPLY(z2, - FIX(2.562915447));
z3 = MULTIPLY(z3, - FIX(1.961570560));
z4 = MULTIPLY(z4, - FIX(0.390180644));
z3 += z5;
z4 += z5;
tmp0 += z1 + z3;
tmp1 += z2 + z4;
tmp2 += z2 + z3;
......@@ -670,7 +670,7 @@ void vdec_IDCT( vdec_thread_t * p_vdec, dctelem_t * p_block, int i_idontcare )
z2 = d5 + d3;
z3 = d7 + d3;
z5 = MULTIPLY(z3 + d5, FIX(1.175875602));
tmp0 = MULTIPLY(d7, FIX(0.298631336));
tmp1 = MULTIPLY(d5, FIX(2.053119869));
tmp2 = MULTIPLY(d3, FIX(3.072711026));
......@@ -678,16 +678,16 @@ void vdec_IDCT( vdec_thread_t * p_vdec, dctelem_t * p_block, int i_idontcare )
z2 = MULTIPLY(z2, - FIX(2.562915447));
z3 = MULTIPLY(z3, - FIX(1.961570560));
z4 = MULTIPLY(d5, - FIX(0.390180644));
z3 += z5;
z4 += z5;
tmp0 += z1 + z3;
tmp1 += z2 + z4;
tmp2 += z2 + z3;
tmp3 = z1 + z4;
}
}
}
}
else
{
if (d1)
......@@ -696,7 +696,7 @@ void vdec_IDCT( vdec_thread_t * p_vdec, dctelem_t * p_block, int i_idontcare )
z1 = d7 + d1;
z4 = d5 + d1;
z5 = MULTIPLY(d7 + z4, FIX(1.175875602));
tmp0 = MULTIPLY(d7, FIX(0.298631336));
tmp1 = MULTIPLY(d5, FIX(2.053119869));
tmp3 = MULTIPLY(d1, FIX(1.501321110));
......@@ -704,10 +704,10 @@ void vdec_IDCT( vdec_thread_t * p_vdec, dctelem_t * p_block, int i_idontcare )
z2 = MULTIPLY(d5, - FIX(2.562915447));
z3 = MULTIPLY(d7, - FIX(1.961570560));
z4 = MULTIPLY(z4, - FIX(0.390180644));
z3 += z5;
z4 += z5;
tmp0 += z1 + z3;
tmp1 += z2 + z4;
tmp2 = z2 + z3;
......@@ -724,10 +724,10 @@ void vdec_IDCT( vdec_thread_t * p_vdec, dctelem_t * p_block, int i_idontcare )
z3 = MULTIPLY(d7, - FIX(1.961570560));
z2 = MULTIPLY(d5, - FIX(2.562915447));
z4 = MULTIPLY(d5, - FIX(0.390180644));
z3 += z5;
z4 += z5;
tmp0 += z3;
tmp1 += z4;
tmp2 = z2 + z3;
......@@ -745,7 +745,7 @@ void vdec_IDCT( vdec_thread_t * p_vdec, dctelem_t * p_block, int i_idontcare )
z1 = d7 + d1;
z3 = d7 + d3;
z5 = MULTIPLY(z3 + d1, FIX(1.175875602));
tmp0 = MULTIPLY(d7, FIX(0.298631336));
tmp2 = MULTIPLY(d3, FIX(3.072711026));
tmp3 = MULTIPLY(d1, FIX(1.501321110));
......@@ -753,10 +753,10 @@ void vdec_IDCT( vdec_thread_t * p_vdec, dctelem_t * p_block, int i_idontcare )
z2 = MULTIPLY(d3, - FIX(2.562915447));
z3 = MULTIPLY(z3, - FIX(1.961570560));
z4 = MULTIPLY(d1, - FIX(0.390180644));
z3 += z5;
z4 += z5;
tmp0 += z1 + z3;
tmp1 = z2 + z4;
tmp2 += z2 + z3;
......@@ -767,7 +767,7 @@ void vdec_IDCT( vdec_thread_t * p_vdec, dctelem_t * p_block, int i_idontcare )
/* d1 == 0, d3 != 0, d5 == 0, d7 != 0 */
z3 = d7 + d3;
z5 = MULTIPLY(z3, FIX(1.175875602));
tmp0 = MULTIPLY(d7, - FIX2(0.601344887));
tmp2 = MULTIPLY(d3, FIX(0.509795579));
z1 = MULTIPLY(d7, - FIX(0.899976223));
......@@ -822,7 +822,7 @@ void vdec_IDCT( vdec_thread_t * p_vdec, dctelem_t * p_block, int i_idontcare )
z2 = d5 + d3;
z4 = d5 + d1;
z5 = MULTIPLY(d3 + z4, FIX(1.175875602));
tmp1 = MULTIPLY(d5, FIX(2.053119869));
tmp2 = MULTIPLY(d3, FIX(3.072711026));
tmp3 = MULTIPLY(d1, FIX(1.501321110));
......@@ -830,10 +830,10 @@ void vdec_IDCT( vdec_thread_t * p_vdec, dctelem_t * p_block, int i_idontcare )
z2 = MULTIPLY(z2, - FIX(2.562915447));
z3 = MULTIPLY(d3, - FIX(1.961570560));
z4 = MULTIPLY(z4, - FIX(0.390180644));
z3 += z5;
z4 += z5;
tmp0 = z1 + z3;
tmp1 += z2 + z4;
tmp2 += z2 + z3;
......@@ -844,13 +844,13 @@ void vdec_IDCT( vdec_thread_t * p_vdec, dctelem_t * p_block, int i_idontcare )
/* d1 == 0, d3 != 0, d5 != 0, d7 == 0 */
z2 = d5 + d3;
z5 = MULTIPLY(z2, FIX(1.175875602));
tmp1 = MULTIPLY(d5, FIX2(1.662939225));
tmp2 = MULTIPLY(d3, FIX2(1.111140466));
z2 = MULTIPLY(z2, - FIX2(1.387039845));
z3 = MULTIPLY(d3, - FIX(1.961570560));
z4 = MULTIPLY(d5, - FIX(0.390180644));
tmp0 = z3 + z5;
tmp1 += z2;
tmp2 += z2;
......@@ -864,13 +864,13 @@ void vdec_IDCT( vdec_thread_t * p_vdec, dctelem_t * p_block, int i_idontcare )
/* d1 != 0, d3 == 0, d5 != 0, d7 == 0 */
z4 = d5 + d1;
z5 = MULTIPLY(z4, FIX(1.175875602));
tmp1 = MULTIPLY(d5, - FIX2(0.509795578));
tmp3 = MULTIPLY(d1, FIX2(0.601344887));
z1 = MULTIPLY(d1, - FIX(0.899976223));
z2 = MULTIPLY(d5, - FIX(2.562915447));
z4 = MULTIPLY(z4, FIX2(0.785694958));
tmp0 = z1 + z5;
tmp1 += z4;
tmp2 = z2 + z5;
......@@ -901,7 +901,7 @@ void vdec_IDCT( vdec_thread_t * p_vdec, dctelem_t * p_block, int i_idontcare )
z2 = MULTIPLY(d3, - FIX(2.172734803));
z4 = MULTIPLY(z5, FIX(0.785694958));
z5 = MULTIPLY(z5, FIX(1.175875602));
tmp0 = z1 - z4;
tmp1 = z2 + z4;
tmp2 += z5;
......@@ -946,7 +946,7 @@ void vdec_IDCT( vdec_thread_t * p_vdec, dctelem_t * p_block, int i_idontcare )
dataptr[3] = (dctelem_t) DESCALE(tmp13 + tmp0, CONST_BITS-PASS1_BITS);
dataptr[4] = (dctelem_t) DESCALE(tmp13 - tmp0, CONST_BITS-PASS1_BITS);
dataptr += DCTSIZE; /* advance pointer to next row */
dataptr += DCTSIZE; /* advance pointer to next row */
}
/* Pass 2: process columns. */
......@@ -1107,7 +1107,7 @@ void vdec_IDCT( vdec_thread_t * p_vdec, dctelem_t * p_block, int i_idontcare )
{
if (d2)
{
if (d0)
if (d0)
{
/* d0 != 0, d2 != 0, d4 != 0, d6 == 0 */
tmp2 = MULTIPLY(d2, FIX(0.541196100));
......@@ -1155,7 +1155,7 @@ void vdec_IDCT( vdec_thread_t * p_vdec, dctelem_t * p_block, int i_idontcare )
{
if (d2)
{
if (d0)
if (d0)
{
/* d0 != 0, d2 != 0, d4 == 0, d6 == 0 */
tmp2 = MULTIPLY(d2, FIX(0.541196100));
......@@ -1201,11 +1201,11 @@ void vdec_IDCT( vdec_thread_t * p_vdec, dctelem_t * p_block, int i_idontcare )
*/
if (d7)
{
if (d5)
if (d5)
{
if (d3)
{
if (d1)
if (d1)
{
/* d1 != 0, d3 != 0, d5 != 0, d7 != 0 */
z1 = d7 + d1;
......@@ -1213,7 +1213,7 @@ void vdec_IDCT( vdec_thread_t * p_vdec, dctelem_t * p_block, int i_idontcare )
z3 = d7 + d3;
z4 = d5 + d1;
z5 = MULTIPLY(z3 + z4, FIX(1.175875602));
tmp0 = MULTIPLY(d7, FIX(0.298631336));
tmp1 = MULTIPLY(d5, FIX(2.053119869));
tmp2 = MULTIPLY(d3, FIX(3.072711026));
......@@ -1222,10 +1222,10 @@ void vdec_IDCT( vdec_thread_t * p_vdec, dctelem_t * p_block, int i_idontcare )
z2 = MULTIPLY(z2, - FIX(2.562915447));
z3 = MULTIPLY(z3, - FIX(1.961570560));
z4 = MULTIPLY(z4, - FIX(0.390180644));
z3 += z5;
z4 += z5;
tmp0 += z1 + z3;
tmp1 += z2 + z4;
tmp2 += z2 + z3;
......@@ -1237,7 +1237,7 @@ void vdec_IDCT( vdec_thread_t * p_vdec, dctelem_t * p_block, int i_idontcare )
z2 = d5 + d3;
z3 = d7 + d3;
z5 = MULTIPLY(z3 + d5, FIX(1.175875602));
tmp0 = MULTIPLY(d7, FIX(0.298631336));
tmp1 = MULTIPLY(d5, FIX(2.053119869));
tmp2 = MULTIPLY(d3, FIX(3.072711026));
......@@ -1245,10 +1245,10 @@ void vdec_IDCT( vdec_thread_t * p_vdec, dctelem_t * p_block, int i_idontcare )
z2 = MULTIPLY(z2, - FIX(2.562915447));
z3 = MULTIPLY(z3, - FIX(1.961570560));
z4 = MULTIPLY(d5, - FIX(0.390180644));
z3 += z5;
z4 += z5;
tmp0 += z1 + z3;
tmp1 += z2 + z4;
tmp2 += z2 + z3;
......@@ -1263,7 +1263,7 @@ void vdec_IDCT( vdec_thread_t * p_vdec, dctelem_t * p_block, int i_idontcare )
z1 = d7 + d1;
z4 = d5 + d1;
z5 = MULTIPLY(d7 + z4, FIX(1.175875602));
tmp0 = MULTIPLY(d7, FIX(0.298631336));
tmp1 = MULTIPLY(d5, FIX(2.053119869));
tmp3 = MULTIPLY(d1, FIX(1.501321110));
......@@ -1271,10 +1271,10 @@ void vdec_IDCT( vdec_thread_t * p_vdec, dctelem_t * p_block, int i_idontcare )
z2 = MULTIPLY(d5, - FIX(2.562915447));
z3 = MULTIPLY(d7, - FIX(1.961570560));
z4 = MULTIPLY(z4, - FIX(0.390180644));
z3 += z5;
z4 += z5;
tmp0 += z1 + z3;
tmp1 += z2 + z4;
tmp2 = z2 + z3;
......@@ -1291,10 +1291,10 @@ void vdec_IDCT( vdec_thread_t * p_vdec, dctelem_t * p_block, int i_idontcare )
z3 = MULTIPLY(d7, - FIX(1.961570560));
z2 = MULTIPLY(d5, - FIX(2.562915447));
z4 = MULTIPLY(d5, - FIX(0.390180644));
z3 += z5;
z4 += z5;
tmp0 += z3;
tmp1 += z4;
tmp2 = z2 + z3;
......@@ -1312,7 +1312,7 @@ void vdec_IDCT( vdec_thread_t * p_vdec, dctelem_t * p_block, int i_idontcare )
z1 = d7 + d1;
z3 = d7 + d3;
z5 = MULTIPLY(z3 + d1, FIX(1.175875602));
tmp0 = MULTIPLY(d7, FIX(0.298631336));
tmp2 = MULTIPLY(d3, FIX(3.072711026));
tmp3 = MULTIPLY(d1, FIX(1.501321110));
......@@ -1320,10 +1320,10 @@ void vdec_IDCT( vdec_thread_t * p_vdec, dctelem_t * p_block, int i_idontcare )
z2 = MULTIPLY(d3, - FIX(2.562915447));
z3 = MULTIPLY(z3, - FIX(1.961570560));
z4 = MULTIPLY(d1, - FIX(0.390180644));
z3 += z5;
z4 += z5;
tmp0 += z1 + z3;
tmp1 = z2 + z4;
tmp2 += z2 + z3;
......@@ -1334,13 +1334,13 @@ void vdec_IDCT( vdec_thread_t * p_vdec, dctelem_t * p_block, int i_idontcare )
/* d1 == 0, d3 != 0, d5 == 0, d7 != 0 */
z3 = d7 + d3;
z5 = MULTIPLY(z3, FIX(1.175875602));
tmp0 = MULTIPLY(d7, - FIX2(0.601344887));
z1 = MULTIPLY(d7, - FIX(0.899976223));
tmp2 = MULTIPLY(d3, FIX(0.509795579));
z2 = MULTIPLY(d3, - FIX(2.562915447));
z3 = MULTIPLY(z3, - FIX2(0.785694958));
tmp0 += z3;
tmp1 = z2 + z5;
tmp2 += z3;
......@@ -1389,7 +1389,7 @@ void vdec_IDCT( vdec_thread_t * p_vdec, dctelem_t * p_block, int i_idontcare )
z2 = d5 + d3;
z4 = d5 + d1;
z5 = MULTIPLY(d3 + z4, FIX(1.175875602));
tmp1 = MULTIPLY(d5, FIX(2.053119869));
tmp2 = MULTIPLY(d3, FIX(3.072711026));
tmp3 = MULTIPLY(d1, FIX(1.501321110));
......@@ -1397,10 +1397,10 @@ void vdec_IDCT( vdec_thread_t * p_vdec, dctelem_t * p_block, int i_idontcare )
z2 = MULTIPLY(z2, - FIX(2.562915447));
z3 = MULTIPLY(d3, - FIX(1.961570560));
z4 = MULTIPLY(z4, - FIX(0.390180644));
z3 += z5;
z4 += z5;
tmp0 = z1 + z3;
tmp1 += z2 + z4;
tmp2 += z2 + z3;
......@@ -1417,7 +1417,7 @@ void vdec_IDCT( vdec_thread_t * p_vdec, dctelem_t * p_block, int i_idontcare )
z2 = MULTIPLY(z2, - FIX2(1.387039845));
z3 = MULTIPLY(d3, - FIX(1.961570560));
z4 = MULTIPLY(d5, - FIX(0.390180644));
tmp0 = z3 + z5;
tmp1 += z2;
tmp2 += z2;
......@@ -1431,13 +1431,13 @@ void vdec_IDCT( vdec_thread_t * p_vdec, dctelem_t * p_block, int i_idontcare )
/* d1 != 0, d3 == 0, d5 != 0, d7 == 0 */
z4 = d5 + d1;
z5 = MULTIPLY(z4, FIX(1.175875602));
tmp1 = MULTIPLY(d5, - FIX2(0.509795578));
tmp3 = MULTIPLY(d1, FIX2(0.601344887));
z1 = MULTIPLY(d1, - FIX(0.899976223));
z2 = MULTIPLY(d5, - FIX(2.562915447));
z4 = MULTIPLY(z4, FIX2(0.785694958));
tmp0 = z1 + z5;
tmp1 += z4;
tmp2 = z2 + z5;
......@@ -1468,7 +1468,7 @@ void vdec_IDCT( vdec_thread_t * p_vdec, dctelem_t * p_block, int i_idontcare )
z2 = MULTIPLY(d3, - FIX(2.172734803));
z4 = MULTIPLY(z5, FIX(0.785694958));
z5 = MULTIPLY(z5, FIX(1.175875602));
tmp0 = z1 - z4;
tmp1 = z2 + z4;
tmp2 += z5;
......@@ -1521,7 +1521,7 @@ void vdec_IDCT( vdec_thread_t * p_vdec, dctelem_t * p_block, int i_idontcare )
dataptr[DCTSIZE*4] = (dctelem_t) DESCALE(tmp13 - tmp0,
CONST_BITS+PASS1_BITS+3);
dataptr++; /* advance pointer to next column */
dataptr++; /* advance pointer to next column */
}
#endif
}
......
/*****************************************************************************
* vout_3dfx.c: 3dfx video output display method for 3dfx cards
* (c)2000 VideoLAN
*****************************************************************************/
/*****************************************************************************
* Preamble
*****************************************************************************/
#include <errno.h>
#include <fcntl.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#ifndef __linux__
#include <conio.h> /* for glide ? */
#endif
#include <sys/uio.h> /* for input.h */
#include <glide.h>
#include "config.h"
#include "common.h"
#include "mtime.h"
#include "vlc_thread.h"
#include "input.h"
#include "video.h"
#include "video_output.h"
#include "video_sys.h"
#include "intf_msg.h"
#include "main.h"
#define WIDTH 640
#define HEIGHT 480
#define BITS_PER_PLANE 16
#define BYTES_PER_PIXEL 2
/*****************************************************************************
* vout_sys_t: 3dfx video output method descriptor
*****************************************************************************
* This structure is part of the video output thread descriptor.
* It describes the 3dfx specific properties of an output thread.
*****************************************************************************/
typedef struct vout_sys_s
{
GrLfbInfo_t p_buffer_info; /* back buffer info */
/* Dummy video memory */
byte_t * p_video; /* base adress */
size_t i_page_size; /* page size */
} vout_sys_t;
/*****************************************************************************
* Local prototypes
*****************************************************************************/
static int GlideOpenDisplay ( vout_thread_t *p_vout );
static void GlideCloseDisplay ( vout_thread_t *p_vout );
/*****************************************************************************
* vout_SysCreate: allocates 3dfx video thread output method
*****************************************************************************
* This function allocates and initializes a 3dfx vout method.
*****************************************************************************/
int vout_SysCreate( vout_thread_t *p_vout, char *psz_display, int i_root_window )
{
/* Allocate structure */
p_vout->p_sys = malloc( sizeof( vout_sys_t ) );
if( p_vout->p_sys == NULL )
{
intf_ErrMsg("error: %s\n", strerror(ENOMEM) );
return( 1 );
}
/* Open and initialize device */
if( GlideOpenDisplay( p_vout ) )
{
intf_ErrMsg("vout error: can't open display\n");
free( p_vout->p_sys );
return( 1 );
}
return( 0 );
}
/*****************************************************************************
* vout_SysInit: initialize 3dfx video thread output method
*****************************************************************************/
int vout_SysInit( vout_thread_t *p_vout )
{
return( 0 );
}
/*****************************************************************************
* vout_SysEnd: terminate 3dfx video thread output method
*****************************************************************************/
void vout_SysEnd( vout_thread_t *p_vout )
{
;
}
/*****************************************************************************
* vout_SysDestroy: destroy 3dfx video thread output method
*****************************************************************************
* Terminate an output method created by vout_CreateOutputMethod
*****************************************************************************/
void vout_SysDestroy( vout_thread_t *p_vout )
{
GlideCloseDisplay( p_vout );
free( p_vout->p_sys );
}
/*****************************************************************************
* vout_SysManage: handle 3dfx events
*****************************************************************************
* This function should be called regularly by video output thread. It manages
* console events. It returns a non null value on error.
*****************************************************************************/
int vout_SysManage( vout_thread_t *p_vout )
{
return 0;
}
/*****************************************************************************
* vout_SysDisplay: displays previously rendered output
*****************************************************************************
* This function send the currently rendered image to 3dfx image, waits until
* it is displayed and switch the two rendering buffers, preparing next frame.
*****************************************************************************/
void vout_SysDisplay( vout_thread_t *p_vout )
{
grLfbUnlock( GR_LFB_WRITE_ONLY, GR_BUFFER_BACKBUFFER );
grBufferSwap( 0 );
if ( grLfbLock(GR_LFB_WRITE_ONLY, GR_BUFFER_BACKBUFFER,
GR_LFBWRITEMODE_565, GR_ORIGIN_UPPER_LEFT, FXFALSE,
&p_vout->p_sys->p_buffer_info) == FXFALSE )
{
intf_ErrMsg( "vout error: can't take 3dfx back buffer lock\n" );
}
}
/* following functions are local */
/*****************************************************************************
* GlideOpenDisplay: open and initialize 3dfx device
*****************************************************************************/
static int GlideOpenDisplay( vout_thread_t *p_vout )
{
static char version[80];
GrHwConfiguration hwconfig;
GrScreenResolution_t resolution = GR_RESOLUTION_640x480;
GrLfbInfo_t p_front_buffer_info; /* front buffer info */
p_vout->i_width = WIDTH;
p_vout->i_height = HEIGHT;
p_vout->i_screen_depth = BITS_PER_PLANE;
p_vout->i_bytes_per_pixel = BYTES_PER_PIXEL;
p_vout->i_bytes_per_line = 1024 * BYTES_PER_PIXEL;
p_vout->p_sys->i_page_size = WIDTH * HEIGHT * BYTES_PER_PIXEL;
p_vout->i_red_mask = 0xf800;
p_vout->i_green_mask = 0x07e0;
p_vout->i_blue_mask = 0x001f;
/* Map two framebuffers a the very beginning of the fb */
p_vout->p_sys->p_video = malloc( p_vout->p_sys->i_page_size * 2 );
if( (int)p_vout->p_sys->p_video == -1 )
{
intf_ErrMsg( "vout error: can't map video memory (%s)\n", strerror(errno) );
return( 1 );
}
grGlideGetVersion( version );
grGlideInit();
if( !grSstQueryHardware(&hwconfig) )
{
intf_ErrMsg( "vout error: can't get 3dfx hardware config\n" );
return( 1 );
}
grSstSelect( 0 );
if( !grSstWinOpen(0, resolution, GR_REFRESH_60Hz,
GR_COLORFORMAT_ABGR, GR_ORIGIN_UPPER_LEFT, 2, 1) )
{
intf_ErrMsg( "vout error: can't open 3dfx screen\n" );
return( 1 );
}
/* disable dithering */
//grDitherMode( GR_DITHER_DISABLE );
/* clear both buffers */
grRenderBuffer( GR_BUFFER_BACKBUFFER );
grBufferClear( 0, 0, 0 );
grRenderBuffer( GR_BUFFER_FRONTBUFFER );
grBufferClear( 0, 0, 0 );
grRenderBuffer( GR_BUFFER_BACKBUFFER );
p_vout->p_sys->p_buffer_info.size = sizeof( GrLfbInfo_t );
p_front_buffer_info.size = sizeof( GrLfbInfo_t );
/* lock the buffers to find their adresses */
if ( grLfbLock(GR_LFB_WRITE_ONLY, GR_BUFFER_FRONTBUFFER,
GR_LFBWRITEMODE_565, GR_ORIGIN_UPPER_LEFT, FXFALSE,
&p_front_buffer_info) == FXFALSE )
{
intf_ErrMsg( "vout error: can't take 3dfx front buffer lock\n" );
grGlideShutdown();
return( 1 );
}
grLfbUnlock( GR_LFB_WRITE_ONLY, GR_BUFFER_FRONTBUFFER );
if ( grLfbLock(GR_LFB_WRITE_ONLY, GR_BUFFER_BACKBUFFER,
GR_LFBWRITEMODE_565, GR_ORIGIN_UPPER_LEFT, FXFALSE,
&p_vout->p_sys->p_buffer_info) == FXFALSE )
{
intf_ErrMsg( "vout error: can't take 3dfx back buffer lock\n" );
grGlideShutdown();
return( 1 );
}
grBufferClear( 0, 0, 0 );
/* Set and initialize buffers */
vout_SetBuffers( p_vout, p_vout->p_sys->p_buffer_info.lfbPtr,
p_front_buffer_info.lfbPtr );
return( 0 );
}
/*****************************************************************************
* GlideCloseDisplay: close and reset 3dfx device
*****************************************************************************
* Returns all resources allocated by GlideOpenDisplay and restore the original
* state of the device.
*****************************************************************************/
static void GlideCloseDisplay( vout_thread_t *p_vout )
{
/* unlock the hidden buffer */
grLfbUnlock( GR_LFB_WRITE_ONLY, GR_BUFFER_BACKBUFFER );
/* shutdown Glide */
grGlideShutdown();
free( p_vout->p_sys->p_video );
}
/*****************************************************************************
* vout_dummy.c: Dummy video output display method for testing purposes
* (c)2000 VideoLAN
*****************************************************************************/
/*****************************************************************************
* Preamble
*****************************************************************************/
#include <errno.h>
#include <fcntl.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <sys/uio.h> /* for input.h */
#include "config.h"
#include "common.h"
#include "mtime.h"
#include "vlc_thread.h"
#include "input.h"
#include "video.h"
#include "video_output.h"
#include "video_sys.h"
#include "intf_msg.h"
#include "main.h"
#define WIDTH 128
#define HEIGHT 64
#define BITS_PER_PLANE 16
#define BYTES_PER_PIXEL 2
/*****************************************************************************
* vout_sys_t: dummy video output method descriptor
*****************************************************************************
* This structure is part of the video output thread descriptor.
* It describes the dummy specific properties of an output thread.
*****************************************************************************/
typedef struct vout_sys_s
{
/* Dummy video memory */
byte_t * p_video; /* base adress */
size_t i_page_size; /* page size */
} vout_sys_t;
/*****************************************************************************
* Local prototypes
*****************************************************************************/
static int DummyOpenDisplay ( vout_thread_t *p_vout );
static void DummyCloseDisplay ( vout_thread_t *p_vout );
/*****************************************************************************
* vout_SysCreate: allocates dummy video thread output method
*****************************************************************************
* This function allocates and initializes a dummy vout method.
*****************************************************************************/
int vout_SysCreate( vout_thread_t *p_vout, char *psz_display, int i_root_window )
{
/* Allocate structure */
p_vout->p_sys = malloc( sizeof( vout_sys_t ) );
if( p_vout->p_sys == NULL )
{
intf_ErrMsg("error: %s\n", strerror(ENOMEM) );
return( 1 );
}
/* Open and initialize device */
if( DummyOpenDisplay( p_vout ) )
{
intf_ErrMsg("vout error: can't open display\n");
free( p_vout->p_sys );
return( 1 );
}
return( 0 );
}
/*****************************************************************************
* vout_SysInit: initialize dummy video thread output method
*****************************************************************************/
int vout_SysInit( vout_thread_t *p_vout )
{
return( 0 );
}
/*****************************************************************************
* vout_SysEnd: terminate dummy video thread output method
*****************************************************************************/
void vout_SysEnd( vout_thread_t *p_vout )
{
;
}
/*****************************************************************************
* vout_SysDestroy: destroy dummy video thread output method
*****************************************************************************
* Terminate an output method created by vout_DummyCreateOutputMethod
*****************************************************************************/
void vout_SysDestroy( vout_thread_t *p_vout )
{
DummyCloseDisplay( p_vout );
free( p_vout->p_sys );
}
/*****************************************************************************
* vout_SysManage: handle dummy events
*****************************************************************************
* This function should be called regularly by video output thread. It manages
* console events. It returns a non null value on error.
*****************************************************************************/
int vout_SysManage( vout_thread_t *p_vout )
{
return 0;
}
/*****************************************************************************
* vout_SysDisplay: displays previously rendered output
*****************************************************************************
* This function send the currently rendered image to dummy image, waits until
* it is displayed and switch the two rendering buffers, preparing next frame.
*****************************************************************************/
void vout_SysDisplay( vout_thread_t *p_vout )
{
;
}
/* following functions are local */
/*****************************************************************************
* DummyOpenDisplay: open and initialize dummy device
*****************************************************************************
* ?? The framebuffer mode is only provided as a fast and efficient way to
* display video, providing the card is configured and the mode ok. It is
* not portable, and is not supposed to work with many cards. Use at your
* own risk !
*****************************************************************************/
static int DummyOpenDisplay( vout_thread_t *p_vout )
{
p_vout->i_width = WIDTH;
p_vout->i_height = HEIGHT;
p_vout->i_screen_depth = BITS_PER_PLANE;
p_vout->i_bytes_per_pixel = BYTES_PER_PIXEL;
p_vout->i_bytes_per_line = WIDTH * BYTES_PER_PIXEL;
p_vout->p_sys->i_page_size = WIDTH * HEIGHT * BYTES_PER_PIXEL;
/* Map two framebuffers a the very beginning of the fb */
p_vout->p_sys->p_video = malloc( p_vout->p_sys->i_page_size * 2 );
if( (int)p_vout->p_sys->p_video == -1 )
{
intf_ErrMsg("vout error: can't map video memory (%s)\n", strerror(errno) );
return( 1 );
}
/* Set and initialize buffers */
vout_SetBuffers( p_vout, p_vout->p_sys->p_video,
p_vout->p_sys->p_video + p_vout->p_sys->i_page_size );
return( 0 );
}
/*****************************************************************************
* DummyCloseDisplay: close and reset dummy device
*****************************************************************************
* Returns all resources allocated by DummyOpenDisplay and restore the original
* state of the device.
*****************************************************************************/
static void DummyCloseDisplay( vout_thread_t *p_vout )
{
free( p_vout->p_sys->p_video );
}
/*****************************************************************************
* vout_fb.c: Linux framebuffer video output display method
* (c)1999 VideoLAN
*****************************************************************************/
/*****************************************************************************
* Preamble
*****************************************************************************/
#include <errno.h>
#include <fcntl.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <linux/fb.h>
#include <sys/ioctl.h>
#include <sys/mman.h>
#include <sys/shm.h>
#include <sys/uio.h> /* for input.h */
#include "config.h"
#include "common.h"
#include "mtime.h"
#include "vlc_thread.h"
#include "input.h"
#include "video.h"
#include "video_output.h"
#include "video_sys.h"
#include "intf_msg.h"
#include "main.h"
/*****************************************************************************
* vout_sys_t: video output framebuffer method descriptor
*****************************************************************************
* This structure is part of the video output thread descriptor.
* It describes the FB specific properties of an output thread.
*****************************************************************************/
typedef struct vout_sys_s
{
/* System informations */
int i_fb_dev; /* framebuffer device handle */
struct fb_var_screeninfo var_info; /* framebuffer mode informations */
/* Video memory */
byte_t * p_video; /* base adress */
size_t i_page_size; /* page size */
struct fb_cmap fb_cmap; /* original colormap */
unsigned short *fb_palette; /* original palette */
} vout_sys_t;
/*****************************************************************************
* Local prototypes
*****************************************************************************/
static int FBOpenDisplay ( vout_thread_t *p_vout );
static void FBCloseDisplay ( vout_thread_t *p_vout );
static void FBSetPalette ( p_vout_thread_t p_vout,
u16 *red, u16 *green, u16 *blue, u16 *transp );
/*****************************************************************************
* vout_SysCreate: allocates FB video thread output method
*****************************************************************************
* This function allocates and initializes a FB vout method.
*****************************************************************************/
int vout_SysCreate( vout_thread_t *p_vout, char *psz_display, int i_root_window )
{
/* Allocate structure */
p_vout->p_sys = malloc( sizeof( vout_sys_t ) );
if( p_vout->p_sys == NULL )
{
intf_ErrMsg("error: %s\n", strerror(ENOMEM) );
return( 1 );
}
/* Open and initialize device */
if( FBOpenDisplay( p_vout ) )
{
intf_ErrMsg("vout error: can't open display\n");
free( p_vout->p_sys );
return( 1 );
}
return( 0 );
}
/*****************************************************************************
* vout_SysInit: initialize framebuffer video thread output method
*****************************************************************************/
int vout_SysInit( vout_thread_t *p_vout )
{
p_vout->p_set_palette = FBSetPalette;
return( 0 );
}
/*****************************************************************************
* vout_SysEnd: terminate FB video thread output method
*****************************************************************************/
void vout_SysEnd( vout_thread_t *p_vout )
{
;
}
/*****************************************************************************
* vout_SysDestroy: destroy FB video thread output method
*****************************************************************************
* Terminate an output method created by vout_CreateOutputMethod
*****************************************************************************/
void vout_SysDestroy( vout_thread_t *p_vout )
{
FBCloseDisplay( p_vout );
free( p_vout->p_sys );
}
/*****************************************************************************
* vout_SysManage: handle FB events
*****************************************************************************
* This function should be called regularly by video output thread. It manages
* console events. It returns a non null value on error.
*****************************************************************************/
int vout_SysManage( vout_thread_t *p_vout )
{
return 0;
}
/*****************************************************************************
* vout_SysDisplay: displays previously rendered output
*****************************************************************************
* This function send the currently rendered image to FB image, waits until
* it is displayed and switch the two rendering buffers, preparing next frame.
*****************************************************************************/
void vout_SysDisplay( vout_thread_t *p_vout )
{
/* swap the two Y offsets */
p_vout->p_sys->var_info.yoffset = p_vout->i_buffer_index ? p_vout->p_sys->var_info.yres : 0;
/* the X offset should be 0, but who knows ...
* some other app might have played with the framebuffer */
p_vout->p_sys->var_info.xoffset = 0;
//ioctl( p_vout->p_sys->i_fb_dev, FBIOPUT_VSCREENINFO, &p_vout->p_sys->var_info );
ioctl( p_vout->p_sys->i_fb_dev, FBIOPAN_DISPLAY, &p_vout->p_sys->var_info );
}
/* following functions are local */
/*****************************************************************************
* FBOpenDisplay: open and initialize framebuffer device
*****************************************************************************
* ?? The framebuffer mode is only provided as a fast and efficient way to
* display video, providing the card is configured and the mode ok. It is
* not portable, and is not supposed to work with many cards. Use at your
* own risk !
*****************************************************************************/
static int FBOpenDisplay( vout_thread_t *p_vout )
{
char *psz_device; /* framebuffer device path */
struct fb_fix_screeninfo fix_info; /* framebuffer fix information */
/* framebuffer palette information */
/* Open framebuffer device */
psz_device = main_GetPszVariable( VOUT_FB_DEV_VAR, VOUT_FB_DEV_DEFAULT );
p_vout->p_sys->i_fb_dev = open( psz_device, O_RDWR);
if( p_vout->p_sys->i_fb_dev == -1 )
{
intf_ErrMsg("vout error: can't open %s (%s)\n", psz_device, strerror(errno) );
return( 1 );
}
// ?? here would be the code used to save the current mode and
// ?? change to the most appropriate mode...
/* Get framebuffer device informations */
if( ioctl( p_vout->p_sys->i_fb_dev, FBIOGET_VSCREENINFO, &p_vout->p_sys->var_info ) )
{
intf_ErrMsg("vout error: can't get framebuffer informations (%s)\n", strerror(errno) );
close( p_vout->p_sys->i_fb_dev );
return( 1 );
}
/* Framebuffer must have some basic properties to be usable */
//??
/* Set some attributes */
p_vout->p_sys->var_info.activate = FB_ACTIVATE_NXTOPEN;
p_vout->p_sys->var_info.xoffset = 0;
p_vout->p_sys->var_info.yoffset = 0;
fprintf(stderr, "ypanstep is %i\n", fix_info.ypanstep);
//??ask sam p_vout->p_sys->mode_info.sync = FB_SYNC_VERT_HIGH_ACT;
//???
if( ioctl( p_vout->p_sys->i_fb_dev, FBIOPUT_VSCREENINFO, &p_vout->p_sys->var_info ) )
{
intf_ErrMsg("vout error: can't set framebuffer informations (%s)\n", strerror(errno) );
close( p_vout->p_sys->i_fb_dev );
return( 1 );
}
/* Get some informations again, in the definitive configuration */
if( ioctl( p_vout->p_sys->i_fb_dev, FBIOGET_FSCREENINFO, &fix_info ) ||
ioctl( p_vout->p_sys->i_fb_dev, FBIOGET_VSCREENINFO, &p_vout->p_sys->var_info ) )
{
intf_ErrMsg("vout error: can't get framebuffer informations (%s)\n", strerror(errno) );
// ?? restore fb config
close( p_vout->p_sys->i_fb_dev );
return( 1 );
}
p_vout->i_width = p_vout->p_sys->var_info.xres;
p_vout->i_height = p_vout->p_sys->var_info.yres;
p_vout->i_screen_depth = p_vout->p_sys->var_info.bits_per_pixel;
switch( p_vout->i_screen_depth )
{
case 8: /* 8 bpp */
p_vout->p_sys->fb_palette = malloc( 8 * 256 * sizeof(unsigned short) );
p_vout->p_sys->fb_cmap.start = 0;
p_vout->p_sys->fb_cmap.len = 256;
p_vout->p_sys->fb_cmap.red = p_vout->p_sys->fb_palette;
p_vout->p_sys->fb_cmap.green = p_vout->p_sys->fb_palette + 256 * sizeof(unsigned short);
p_vout->p_sys->fb_cmap.blue = p_vout->p_sys->fb_palette + 2 * 256 * sizeof(unsigned short);
p_vout->p_sys->fb_cmap.transp = p_vout->p_sys->fb_palette + 3 * 256 * sizeof(unsigned short);
/* saves the colormap */
ioctl( p_vout->p_sys->i_fb_dev, FBIOGETCMAP, &p_vout->p_sys->fb_cmap );
p_vout->i_bytes_per_pixel = 1;
p_vout->i_bytes_per_line = p_vout->i_width;
break;
case 15: /* 15 bpp (16bpp with a missing green bit) */
case 16: /* 16 bpp (65536 colors) */
p_vout->i_bytes_per_pixel = 2;
p_vout->i_bytes_per_line = p_vout->i_width * 2;
break;
case 24: /* 24 bpp (millions of colors) */
p_vout->i_bytes_per_pixel = 3;
p_vout->i_bytes_per_line = p_vout->i_width * 3;
break;
case 32: /* 32 bpp (millions of colors) */
p_vout->i_bytes_per_pixel = 4;
p_vout->i_bytes_per_line = p_vout->i_width * 4;
break;
default: /* unsupported screen depth */
intf_ErrMsg("vout error: screen depth %d is not supported\n",
p_vout->i_screen_depth);
return( 1 );
break;
}
switch( p_vout->i_screen_depth )
{
case 15:
case 16:
case 24:
case 32:
p_vout->i_red_mask = ( (1 << p_vout->p_sys->var_info.red.length) - 1 )
<< p_vout->p_sys->var_info.red.offset;
p_vout->i_green_mask = ( (1 << p_vout->p_sys->var_info.green.length) - 1 )
<< p_vout->p_sys->var_info.green.offset;
p_vout->i_blue_mask = ( (1 << p_vout->p_sys->var_info.blue.length) - 1 )
<< p_vout->p_sys->var_info.blue.offset;
}
p_vout->p_sys->i_page_size = p_vout->p_sys->var_info.xres *
p_vout->p_sys->var_info.yres * p_vout->i_bytes_per_pixel;
/* Map two framebuffers a the very beginning of the fb */
p_vout->p_sys->p_video = mmap(0, p_vout->p_sys->i_page_size * 2,
PROT_READ | PROT_WRITE, MAP_SHARED,
p_vout->p_sys->i_fb_dev, 0 );
if( (int)p_vout->p_sys->p_video == -1 ) //?? according to man, it is -1. What about NULL ?
{
intf_ErrMsg("vout error: can't map video memory (%s)\n", strerror(errno) );
// ?? restore fb config
close( p_vout->p_sys->i_fb_dev );
return( 1 );
}
/* Set and initialize buffers */
vout_SetBuffers( p_vout, p_vout->p_sys->p_video,
p_vout->p_sys->p_video + p_vout->p_sys->i_page_size );
intf_DbgMsg("framebuffer type=%d, visual=%d, ypanstep=%d, ywrap=%d, accel=%d\n",
fix_info.type, fix_info.visual, fix_info.ypanstep, fix_info.ywrapstep, fix_info.accel );
return( 0 );
}
/*****************************************************************************
* FBCloseDisplay: close and reset framebuffer device
*****************************************************************************
* Returns all resources allocated by FBOpenDisplay and restore the original
* state of the device.
*****************************************************************************/
static void FBCloseDisplay( vout_thread_t *p_vout )
{
/* Restore palette */
if( p_vout->i_screen_depth == 8 );
{
ioctl( p_vout->p_sys->i_fb_dev, FBIOPUTCMAP, &p_vout->p_sys->fb_cmap );
free( p_vout->p_sys->fb_palette );
}
/* Destroy window and close display */
close( p_vout->p_sys->i_fb_dev );
}
/*****************************************************************************
* FBSetPalette: 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 FBSetPalette ( p_vout_thread_t p_vout,
u16 *red, u16 *green, u16 *blue, u16 *transp )
{
struct fb_cmap cmap = { 0, 256, red, green, blue, transp };
ioctl( p_vout->p_sys->i_fb_dev, FBIOPUTCMAP, &cmap );
}
/*****************************************************************************
* vout_ggi.c: GGI video output display method
* (c)1998 VideoLAN
*****************************************************************************/
/*****************************************************************************
* Preamble
*****************************************************************************/
#include <errno.h>
#include <stdlib.h>
#include <string.h>
#include <ggi/ggi.h>
#include "config.h"
#include "common.h"
#include "mtime.h"
#include "vlc_thread.h"
#include "video.h"
#include "video_output.h"
#include "video_sys.h"
#include "intf_msg.h"
/*****************************************************************************
* vout_sys_t: video output GGI method descriptor
*****************************************************************************
* This structure is part of the video output thread descriptor.
* It describes the GGI specific properties of an output thread.
*****************************************************************************/
typedef struct vout_sys_s
{
/* GGI system informations */
ggi_visual_t p_display; /* display device */
/* Buffers informations */
ggi_directbuffer * p_buffer[2]; /* buffers */
boolean_t b_must_acquire; /* must be acquired before writing */
} vout_sys_t;
/*****************************************************************************
* Local prototypes
*****************************************************************************/
static int GGIOpenDisplay ( vout_thread_t *p_vout, char *psz_display );
static void GGICloseDisplay ( vout_thread_t *p_vout );
/*****************************************************************************
* vout_SysCreate: allocate GGI video thread output method
*****************************************************************************
* This function allocate and initialize a GGI vout method. It uses some of the
* vout properties to choose the correct mode, and change them according to the
* mode actually used.
*****************************************************************************/
int vout_SysCreate( vout_thread_t *p_vout, char *psz_display, int i_root_window )
{
/* Allocate structure */
p_vout->p_sys = malloc( sizeof( vout_sys_t ) );
if( p_vout->p_sys == NULL )
{
intf_ErrMsg("error: %s\n", strerror(ENOMEM) );
return( 1 );
}
/* Open and initialize device */
if( GGIOpenDisplay( p_vout, psz_display ) )
{
intf_ErrMsg("error: can't initialize GGI display\n");
free( p_vout->p_sys );
return( 1 );
}
return( 0 );
}
/*****************************************************************************
* vout_SysInit: initialize GGI video thread output method
*****************************************************************************
* This function initialize the GGI display device.
*****************************************************************************/
int vout_SysInit( vout_thread_t *p_vout )
{
/* Acquire first buffer */
if( p_vout->p_sys->b_must_acquire )
{
ggiResourceAcquire( p_vout->p_sys->p_buffer[ p_vout->i_buffer_index ]->resource, GGI_ACTYPE_WRITE );
}
return( 0 );
}
/*****************************************************************************
* vout_SysEnd: terminate Sys video thread output method
*****************************************************************************
* Terminate an output method created by vout_SysCreateOutputMethod
*****************************************************************************/
void vout_SysEnd( vout_thread_t *p_vout )
{
/* Release buffer */
if( p_vout->p_sys->b_must_acquire )
{
ggiResourceRelease( p_vout->p_sys->p_buffer[ p_vout->i_buffer_index ]->resource );
}
}
/*****************************************************************************
* vout_SysDestroy: destroy Sys video thread output method
*****************************************************************************
* Terminate an output method created by vout_SysCreateOutputMethod
*****************************************************************************/
void vout_SysDestroy( vout_thread_t *p_vout )
{
GGICloseDisplay( p_vout );
free( p_vout->p_sys );
}
/*****************************************************************************
* vout_SysManage: handle Sys events
*****************************************************************************
* This function should be called regularly by video output thread. It returns
* a non null value if an error occured.
*****************************************************************************/
int vout_SysManage( vout_thread_t *p_vout )
{
//?? 8bpp: change palette
return( 0 );
}
/*****************************************************************************
* vout_SysDisplay: displays previously rendered output
*****************************************************************************
* This function send the currently rendered image to the display, wait until
* it is displayed and switch the two rendering buffer, preparing next frame.
*****************************************************************************/
void vout_SysDisplay( vout_thread_t *p_vout )
{
/* Change display frame */
if( p_vout->p_sys->b_must_acquire )
{
ggiResourceRelease( p_vout->p_sys->p_buffer[ p_vout->i_buffer_index ]->resource );
}
ggiFlush( p_vout->p_sys->p_display ); // ??
ggiSetDisplayFrame( p_vout->p_sys->p_display,
p_vout->p_sys->p_buffer[ p_vout->i_buffer_index ]->frame );
/* Swap buffers and change write frame */
if( p_vout->p_sys->b_must_acquire )
{
ggiResourceAcquire( p_vout->p_sys->p_buffer[ (p_vout->i_buffer_index + 1) & 1]->resource,
GGI_ACTYPE_WRITE );
}
ggiSetWriteFrame( p_vout->p_sys->p_display,
p_vout->p_sys->p_buffer[ (p_vout->i_buffer_index + 1) & 1]->frame );
}
/*****************************************************************************
* vout_SysGetVisual: send visual to interface driver
*****************************************************************************
* This function is not part of the regular vout_Sys* API, but is used by GGI
* interface to get back visual display pointer once the output thread has
* been spawned. This visual is used to keep track of keyboard events.
*****************************************************************************/
ggi_visual_t vout_SysGetVisual( vout_thread_t *p_vout )
{
return( p_vout->p_sys->p_display );
}
/* following functions are local */
/*****************************************************************************
* GGIOpenDisplay: open and initialize GGI device
*****************************************************************************
* Open and initialize display according to preferences specified in the vout
* thread fields.
*****************************************************************************/
static int GGIOpenDisplay( vout_thread_t *p_vout, char *psz_display )
{
ggi_mode mode; /* mode descriptor */
ggi_color col_fg; /* foreground color */
ggi_color col_bg; /* background color */
int i_index; /* all purposes index */
/* Initialize library */
if( ggiInit() )
{
intf_ErrMsg("error: can't initialize GGI library\n");
return( 1 );
}
/* Open display */
p_vout->p_sys->p_display = ggiOpen( psz_display, NULL );
if( p_vout->p_sys->p_display == NULL )
{
intf_ErrMsg("error: can't open GGI default display\n");
ggiExit();
return( 1 );
}
/* Find most appropriate mode */
mode.frames = 2; /* 2 buffers */
mode.visible.x = p_vout->i_width; /* minimum width */
mode.visible.y = p_vout->i_height; /* minimum height */
mode.virt.x = GGI_AUTO;
mode.virt.y = GGI_AUTO;
mode.size.x = GGI_AUTO;
mode.size.y = GGI_AUTO;
mode.graphtype = GT_15BIT; /* minimum usable screen depth */
mode.dpp.x = GGI_AUTO;
mode.dpp.y = GGI_AUTO;
ggiCheckMode( p_vout->p_sys->p_display, &mode );
/* Check that returned mode has some minimum properties */
//??
/* Set mode */
if( ggiSetMode( p_vout->p_sys->p_display, &mode ) )
{
intf_ErrMsg("error: can't set GGI mode\n");
ggiClose( p_vout->p_sys->p_display );
ggiExit();
return( 1 );
}
/* Check buffers properties */
p_vout->p_sys->b_must_acquire = 0;
for( i_index = 0; i_index < 2; i_index++ )
{
/* Get buffer address */
p_vout->p_sys->p_buffer[ i_index ] =
ggiDBGetBuffer( p_vout->p_sys->p_display, i_index );
if( p_vout->p_sys->p_buffer[ i_index ] == NULL )
{
intf_ErrMsg("error: double buffering is not possible\n");
ggiClose( p_vout->p_sys->p_display );
ggiExit();
return( 1 );
}
/* Check buffer properties */
if( ! (p_vout->p_sys->p_buffer[ i_index ]->type & GGI_DB_SIMPLE_PLB) ||
(p_vout->p_sys->p_buffer[ i_index ]->page_size != 0) ||
(p_vout->p_sys->p_buffer[ i_index ]->write == NULL ) ||
(p_vout->p_sys->p_buffer[ i_index ]->noaccess != 0) ||
(p_vout->p_sys->p_buffer[ i_index ]->align != 0) )
{
intf_ErrMsg("error: incorrect video memory type\n");
ggiClose( p_vout->p_sys->p_display );
ggiExit();
return( 1 );
}
/* Check if buffer needs to be acquired before write */
if( ggiResourceMustAcquire( p_vout->p_sys->p_buffer[ i_index ]->resource ) )
{
p_vout->p_sys->b_must_acquire = 1;
}
}
#ifdef DEBUG
if( p_vout->p_sys->b_must_acquire )
{
intf_DbgMsg("buffers must be acquired\n");
}
#endif
/* Set graphic context colors */
col_fg.r = col_fg.g = col_fg.b = -1;
col_bg.r = col_bg.g = col_bg.b = 0;
if( ggiSetGCForeground(p_vout->p_sys->p_display,
ggiMapColor(p_vout->p_sys->p_display,&col_fg)) ||
ggiSetGCBackground(p_vout->p_sys->p_display,
ggiMapColor(p_vout->p_sys->p_display,&col_bg)) )
{
intf_ErrMsg("error: can't set colors\n");
ggiClose( p_vout->p_sys->p_display );
ggiExit();
return( 1 );
}
/* Set clipping for text */
if( ggiSetGCClipping(p_vout->p_sys->p_display, 0, 0,
mode.visible.x, mode.visible.y ) )
{
intf_ErrMsg("error: can't set clipping\n");
ggiClose( p_vout->p_sys->p_display );
ggiExit();
return( 1 );
}
/* Set thread information */
p_vout->i_width = mode.visible.x;
p_vout->i_height = mode.visible.y;
p_vout->i_bytes_per_line = p_vout->p_sys->p_buffer[ 0 ]->buffer.plb.stride;
p_vout->i_screen_depth = p_vout->p_sys->p_buffer[ 0 ]->buffer.plb->pixelformat.depth;
p_vout->i_bytes_per_pixel = p_vout->p_sys->p_buffer[ 0 ]->buffer.plb->pixelformat.size / 8;
p_vout->i_red_mask = p_vout->p_sys->p_buffer[ 0 ]->buffer.plb->pixelformat.red_mask;
p_vout->i_green_mask = p_vout->p_sys->p_buffer[ 0 ]->buffer.plb->pixelformat.green_mask;
p_vout->i_blue_mask = p_vout->p_sys->p_buffer[ 0 ]->buffer.plb->pixelformat.blue_mask;
//?? palette in 8bpp
/* Set and initialize buffers */
vout_SetBuffers( p_vout, p_vout->p_sys->p_buffer[ 0 ]->write, p_vout->p_sys->p_buffer[ 1 ]->write );
return( 0 );
}
/*****************************************************************************
* GGICloseDisplay: close and reset GGI device
*****************************************************************************
* This function returns all resources allocated by GGIOpenDisplay and restore
* the original state of the device.
*****************************************************************************/
static void GGICloseDisplay( vout_thread_t *p_vout )
{
// Restore original mode and close display
ggiClose( p_vout->p_sys->p_display );
// Exit library
ggiExit();
}
......@@ -65,8 +65,8 @@ static void SetPalette ( p_vout_thread_t p_vout, u16 *red,
* If pi_status is NULL, then the function will block until the thread is ready.
* If not, it will be updated using one of the THREAD_* constants.
*****************************************************************************/
vout_thread_t * vout_CreateThread ( char *psz_display, int i_root_window,
int i_width, int i_height, int *pi_status )
vout_thread_t * vout_CreateThread ( char *psz_display, int i_root_window,
int i_width, int i_height, int *pi_status, int i_method )
{
vout_thread_t * p_vout; /* thread descriptor */
int i_status; /* thread status */
......@@ -81,6 +81,83 @@ vout_thread_t * vout_CreateThread ( char *psz_display, int i_root_
return( NULL );
}
/* Sets method-specific functions */
switch( i_method )
{
case VOUT_DUMMY_METHOD:
p_vout->p_sys_create = vout_DummySysCreate;
p_vout->p_sys_init = vout_DummySysInit;
p_vout->p_sys_end = vout_DummySysEnd;
p_vout->p_sys_destroy = vout_DummySysDestroy;
p_vout->p_sys_manage = vout_DummySysManage;
p_vout->p_sys_display = vout_DummySysDisplay;
break;
#ifdef VIDEO_X11
case VOUT_X11_METHOD:
p_vout->p_sys_create = vout_X11SysCreate;
p_vout->p_sys_init = vout_X11SysInit;
p_vout->p_sys_end = vout_X11SysEnd;
p_vout->p_sys_destroy = vout_X11SysDestroy;
p_vout->p_sys_manage = vout_X11SysManage;
p_vout->p_sys_display = vout_X11SysDisplay;
break;
#endif
#ifdef VIDEO_FB
case VOUT_FB_METHOD:
p_vout->p_sys_create = vout_FBSysCreate;
p_vout->p_sys_init = vout_FBSysInit;
p_vout->p_sys_end = vout_FBSysEnd;
p_vout->p_sys_destroy = vout_FBSysDestroy;
p_vout->p_sys_manage = vout_FBSysManage;
p_vout->p_sys_display = vout_FBSysDisplay;
break;
#endif
#ifdef VIDEO_GLIDE
case VOUT_GLIDE_METHOD:
p_vout->p_sys_create = vout_GlideSysCreate;
p_vout->p_sys_init = vout_GlideSysInit;
p_vout->p_sys_end = vout_GlideSysEnd;
p_vout->p_sys_destroy = vout_GlideSysDestroy;
p_vout->p_sys_manage = vout_GlideSysManage;
p_vout->p_sys_display = vout_GlideSysDisplay;
break;
#endif
#ifdef VIDEO_DGA
case VOUT_DGA_METHOD:
p_vout->p_sys_create = vout_DGASysCreate;
p_vout->p_sys_init = vout_DGASysInit;
p_vout->p_sys_end = vout_DGASysEnd;
p_vout->p_sys_destroy = vout_DGASysDestroy;
p_vout->p_sys_manage = vout_DGASysManage;
p_vout->p_sys_display = vout_DGASysDisplay;
break;
#endif
#ifdef VIDEO_GGI
case VOUT_GGI_METHOD:
p_vout->p_sys_create = vout_GGISysCreate;
p_vout->p_sys_init = vout_GGISysInit;
p_vout->p_sys_end = vout_GGISysEnd;
p_vout->p_sys_destroy = vout_GGISysDestroy;
p_vout->p_sys_manage = vout_GGISysManage;
p_vout->p_sys_display = vout_GGISysDisplay;
break;
#endif
#ifdef VIDEO_BEOS
case VOUT_BEOS_METHOD:
p_vout->p_sys_create = vout_BeSysCreate;
p_vout->p_sys_init = vout_BeSysInit;
p_vout->p_sys_end = vout_BeSysEnd;
p_vout->p_sys_destroy = vout_BeSysDestroy;
p_vout->p_sys_manage = vout_BeSysManage;
p_vout->p_sys_display = vout_BeSysDisplay;
break;
#endif
default:
intf_ErrMsg( "error: video output method not available\n" );
free( p_vout );
return( NULL );
}
/* Initialize thread properties - thread id and locks will be initialized
* later */
p_vout->b_die = 0;
......@@ -136,7 +213,7 @@ vout_thread_t * vout_CreateThread ( char *psz_display, int i_root_
/* Create and initialize system-dependant method - this function issues its
* own error messages */
if( vout_SysCreate( p_vout, psz_display, i_root_window ) )
if( p_vout->p_sys_create( p_vout, psz_display, i_root_window ) )
{
free( p_vout );
return( NULL );
......@@ -157,12 +234,12 @@ vout_thread_t * vout_CreateThread ( char *psz_display, int i_root_
p_vout->i_gray_pixel = RGB2PIXEL( p_vout, 128, 128, 128 );
p_vout->i_blue_pixel = RGB2PIXEL( p_vout, 0, 0, 50 );
/* Load fonts - fonts must be initialized after the systme method since
* they may be dependant of screen depth and other thread properties */
/* Load fonts - fonts must be initialized after the system method since
* they may be dependant on screen depth and other thread properties */
p_vout->p_default_font = vout_LoadFont( VOUT_DEFAULT_FONT );
if( p_vout->p_default_font == NULL )
{
vout_SysDestroy( p_vout );
p_vout->p_sys_destroy( p_vout );
free( p_vout );
return( NULL );
}
......@@ -170,7 +247,7 @@ vout_thread_t * vout_CreateThread ( char *psz_display, int i_root_
if( p_vout->p_large_font == NULL )
{
vout_UnloadFont( p_vout->p_default_font );
vout_SysDestroy( p_vout );
p_vout->p_sys_destroy( p_vout );
free( p_vout );
return( NULL );
}
......@@ -185,7 +262,7 @@ vout_thread_t * vout_CreateThread ( char *psz_display, int i_root_
intf_ErrMsg("error: %s\n", strerror(ENOMEM));
vout_UnloadFont( p_vout->p_default_font );
vout_UnloadFont( p_vout->p_large_font );
vout_SysDestroy( p_vout );
p_vout->p_sys_destroy( p_vout );
free( p_vout );
return( NULL );
}
......@@ -298,34 +375,34 @@ subpicture_t *vout_CreateSubPicture( vout_thread_t *p_vout, int i_type,
*/
for( i_subpic = 0; i_subpic < VOUT_MAX_PICTURES; i_subpic++ )
{
if( p_vout->p_subpicture[i_subpic].i_status == DESTROYED_SUBPICTURE )
{
/* Subpicture is marked for destruction, but is still allocated */
if( (p_vout->p_subpicture[i_subpic].i_type == i_type) &&
(p_vout->p_subpicture[i_subpic].i_size >= i_size) )
{
/* Memory size do match or is smaller : memory will not be reallocated,
if( p_vout->p_subpicture[i_subpic].i_status == DESTROYED_SUBPICTURE )
{
/* Subpicture is marked for destruction, but is still allocated */
if( (p_vout->p_subpicture[i_subpic].i_type == i_type) &&
(p_vout->p_subpicture[i_subpic].i_size >= i_size) )
{
/* Memory size do match or is smaller : memory will not be reallocated,
* and function can end immediately - this is the best possible case,
* since no memory allocation needs to be done */
p_vout->p_subpicture[i_subpic].i_status = RESERVED_SUBPICTURE;
p_vout->p_subpicture[i_subpic].i_status = RESERVED_SUBPICTURE;
#ifdef DEBUG_VIDEO
intf_DbgMsg("subpicture %p (in destroyed subpicture slot)\n",
&p_vout->p_subpicture[i_subpic] );
#endif
vlc_mutex_unlock( &p_vout->subpicture_lock );
return( &p_vout->p_subpicture[i_subpic] );
}
else if( p_destroyed_subpic == NULL )
{
/* Memory size do not match, but subpicture index will be kept in
* case no other place are left */
p_destroyed_subpic = &p_vout->p_subpicture[i_subpic];
}
}
vlc_mutex_unlock( &p_vout->subpicture_lock );
return( &p_vout->p_subpicture[i_subpic] );
}
else if( p_destroyed_subpic == NULL )
{
/* Memory size do not match, but subpicture index will be kept in
* case no other place are left */
p_destroyed_subpic = &p_vout->p_subpicture[i_subpic];
}
}
else if( (p_free_subpic == NULL) &&
(p_vout->p_subpicture[i_subpic].i_status == FREE_SUBPICTURE ))
{
/* Subpicture is empty and ready for allocation */
/* Subpicture is empty and ready for allocation */
p_free_subpic = &p_vout->p_subpicture[i_subpic];
}
}
......@@ -333,8 +410,8 @@ subpicture_t *vout_CreateSubPicture( vout_thread_t *p_vout, int i_type,
/* If no free subpicture is available, use a destroyed subpicture */
if( (p_free_subpic == NULL) && (p_destroyed_subpic != NULL ) )
{
/* No free subpicture or matching destroyed subpicture has been found, but
* a destroyed subpicture is still avalaible */
/* No free subpicture or matching destroyed subpicture has been found, but
* a destroyed subpicture is still avalaible */
free( p_destroyed_subpic->p_data );
p_free_subpic = p_destroyed_subpic;
}
......@@ -494,7 +571,7 @@ void vout_DatePicture( vout_thread_t *p_vout, picture_t *p_pic, mtime_t date )
* since several pictures can be created by several producers threads.
*****************************************************************************/
picture_t *vout_CreatePicture( vout_thread_t *p_vout, int i_type,
int i_width, int i_height )
int i_width, int i_height )
{
int i_picture; /* picture index */
int i_chroma_width = 0; /* chroma width */
......@@ -509,37 +586,37 @@ picture_t *vout_CreatePicture( vout_thread_t *p_vout, int i_type,
*/
for( i_picture = 0; i_picture < VOUT_MAX_PICTURES; i_picture++ )
{
if( p_vout->p_picture[i_picture].i_status == DESTROYED_PICTURE )
{
/* Picture is marked for destruction, but is still allocated - note
if( p_vout->p_picture[i_picture].i_status == DESTROYED_PICTURE )
{
/* Picture is marked for destruction, but is still allocated - note
* that if width and type are the same for two pictures, chroma_width
* should also be the same */
if( (p_vout->p_picture[i_picture].i_type == i_type) &&
(p_vout->p_picture[i_picture].i_height == i_height) &&
(p_vout->p_picture[i_picture].i_width == i_width) )
{
/* Memory size do match : memory will not be reallocated, and function
if( (p_vout->p_picture[i_picture].i_type == i_type) &&
(p_vout->p_picture[i_picture].i_height == i_height) &&
(p_vout->p_picture[i_picture].i_width == i_width) )
{
/* Memory size do match : memory will not be reallocated, and function
* can end immediately - this is the best possible case, since no
* memory allocation needs to be done */
p_vout->p_picture[i_picture].i_status = RESERVED_PICTURE;
p_vout->p_picture[i_picture].i_status = RESERVED_PICTURE;
#ifdef DEBUG_VIDEO
intf_DbgMsg("picture %p (in destroyed picture slot)\n",
&p_vout->p_picture[i_picture] );
#endif
vlc_mutex_unlock( &p_vout->picture_lock );
return( &p_vout->p_picture[i_picture] );
}
else if( p_destroyed_picture == NULL )
{
/* Memory size do not match, but picture index will be kept in
* case no other place are left */
p_destroyed_picture = &p_vout->p_picture[i_picture];
}
}
vlc_mutex_unlock( &p_vout->picture_lock );
return( &p_vout->p_picture[i_picture] );
}
else if( p_destroyed_picture == NULL )
{
/* Memory size do not match, but picture index will be kept in
* case no other place are left */
p_destroyed_picture = &p_vout->p_picture[i_picture];
}
}
else if( (p_free_picture == NULL) &&
(p_vout->p_picture[i_picture].i_status == FREE_PICTURE ))
{
/* Picture is empty and ready for allocation */
/* Picture is empty and ready for allocation */
p_free_picture = &p_vout->p_picture[i_picture];
}
}
......@@ -547,8 +624,8 @@ picture_t *vout_CreatePicture( vout_thread_t *p_vout, int i_type,
/* If no free picture is available, use a destroyed picture */
if( (p_free_picture == NULL) && (p_destroyed_picture != NULL ) )
{
/* No free picture or matching destroyed picture has been found, but
* a destroyed picture is still avalaible */
/* No free picture or matching destroyed picture has been found, but
* a destroyed picture is still avalaible */
free( p_destroyed_picture->p_data );
p_free_picture = p_destroyed_picture;
}
......@@ -694,7 +771,7 @@ void vout_UnlinkPicture( vout_thread_t *p_vout, picture_t *p_pic )
if( (p_pic->i_refcount == 0) && (p_pic->i_status == DISPLAYED_PICTURE) )
{
p_pic->i_status = DESTROYED_PICTURE;
p_pic->i_status = DESTROYED_PICTURE;
}
#ifdef DEBUG_VIDEO
......@@ -783,7 +860,7 @@ static int BinaryLog(u32 i)
}
if (i != ((u32)1 << i_log))
{
intf_ErrMsg("internal error: binary log overflow\n");
intf_ErrMsg("internal error: binary log overflow\n");
}
return( i_log );
......@@ -825,7 +902,7 @@ static int InitThread( vout_thread_t *p_vout )
*p_vout->pi_status = THREAD_START;
/* Initialize output method - this function issues its own error messages */
if( vout_SysInit( p_vout ) )
if( p_vout->p_sys_init( p_vout ) )
{
return( 1 );
}
......@@ -884,45 +961,45 @@ static void RunThread( vout_thread_t *p_vout)
current_date = mdate();
/*
* Find the picture to display - this operation does not need lock,
* Find the picture to display - this operation does not need lock,
* since only READY_PICTUREs are handled
*/
for( i_index = 0; i_index < VOUT_MAX_PICTURES; i_index++ )
{
if( (p_vout->p_picture[i_index].i_status == READY_PICTURE) &&
( (p_pic == NULL) ||
(p_vout->p_picture[i_index].date < display_date) ) )
{
{
if( (p_vout->p_picture[i_index].i_status == READY_PICTURE) &&
( (p_pic == NULL) ||
(p_vout->p_picture[i_index].date < display_date) ) )
{
p_pic = &p_vout->p_picture[i_index];
display_date = p_pic->date;
}
}
}
}
if( p_pic )
{
#ifdef STATS
/* Computes FPS rate */
p_vout->p_fps_sample[ p_vout->c_fps_samples++ % VOUT_FPS_SAMPLES ] = display_date;
#endif
if( display_date < current_date )
{
/* Picture is late: it will be destroyed and the thread will sleep and
#endif
if( display_date < current_date )
{
/* Picture is late: it will be destroyed and the thread will sleep and
* go to next picture */
vlc_mutex_lock( &p_vout->picture_lock );
p_pic->i_status = p_pic->i_refcount ? DISPLAYED_PICTURE : DESTROYED_PICTURE;
intf_DbgMsg( "warning: late picture %p skipped refcount=%d\n", p_pic, p_pic->i_refcount );
intf_DbgMsg( "warning: late picture %p skipped refcount=%d\n", p_pic, p_pic->i_refcount );
vlc_mutex_unlock( &p_vout->picture_lock );
p_pic = NULL;
display_date = 0;
}
else if( display_date > current_date + VOUT_DISPLAY_DELAY )
{
/* A picture is ready to be rendered, but its rendering date is
* far from the current one so the thread will perform an empty loop
* as if no picture were found. The picture state is unchanged */
}
else if( display_date > current_date + VOUT_DISPLAY_DELAY )
{
/* A picture is ready to be rendered, but its rendering date is
* far from the current one so the thread will perform an empty loop
* as if no picture were found. The picture state is unchanged */
p_pic = NULL;
display_date = 0;
}
}
}
/*
......@@ -1063,20 +1140,20 @@ static void RunThread( vout_thread_t *p_vout)
#endif
if( b_display && !(p_vout->i_changes & VOUT_NODISPLAY_CHANGE) )
{
vout_SysDisplay( p_vout );
p_vout->p_sys_display( p_vout );
p_vout->i_buffer_index = ++p_vout->i_buffer_index & 1;
}
/*
* Check events and manage thread
*/
if( vout_SysManage( p_vout ) | Manage( p_vout ) )
{
/* A fatal error occured, and the thread must terminate immediately,
* without displaying anything - setting b_error to 1 cause the
* immediate end of the main while() loop. */
p_vout->b_error = 1;
}
*/
if( p_vout->p_sys_manage( p_vout ) | Manage( p_vout ) )
{
/* A fatal error occured, and the thread must terminate immediately,
* without displaying anything - setting b_error to 1 cause the
* immediate end of the main while() loop. */
p_vout->b_error = 1;
}
}
/*
......@@ -1128,8 +1205,8 @@ static void EndThread( vout_thread_t *p_vout )
/* Destroy all remaining pictures and subpictures */
for( i_index = 0; i_index < VOUT_MAX_PICTURES; i_index++ )
{
if( p_vout->p_picture[i_index].i_status != FREE_PICTURE )
{
if( p_vout->p_picture[i_index].i_status != FREE_PICTURE )
{
free( p_vout->p_picture[i_index].p_data );
}
if( p_vout->p_subpicture[i_index].i_status != FREE_SUBPICTURE )
......@@ -1140,7 +1217,7 @@ static void EndThread( vout_thread_t *p_vout )
/* Destroy translation tables */
vout_EndYUV( p_vout );
vout_SysEnd( p_vout );
p_vout->p_sys_end( p_vout );
}
/*****************************************************************************
......@@ -1160,7 +1237,7 @@ static void DestroyThread( vout_thread_t *p_vout, int i_status )
/* Destroy thread structures allocated by Create and InitThread */
vout_UnloadFont( p_vout->p_default_font );
vout_UnloadFont( p_vout->p_large_font );
vout_SysDestroy( p_vout );
p_vout->p_sys_destroy( p_vout );
free( p_vout );
*pi_status = i_status;
}
......@@ -1823,8 +1900,8 @@ static int Manage( vout_thread_t *p_vout )
/* Detect unauthorized changes */
if( p_vout->i_changes )
{
/* Some changes were not acknowledged by vout_SysManage or this function,
* it means they should not be authorized */
/* Some changes were not acknowledged by p_vout->p_sys_manage or this
* function, it means they should not be authorized */
intf_ErrMsg( "error: unauthorized changes in the video output thread\n" );
return( 1 );
}
......
/*****************************************************************************
* vout_x11.c: X11 video output display method
* (c)1998 VideoLAN
*****************************************************************************/
/*****************************************************************************
* Preamble
*****************************************************************************/
#include <errno.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/shm.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/extensions/XShm.h>
#include "config.h"
#include "common.h"
#include "mtime.h"
#include "vlc_thread.h"
#include "video.h"
#include "video_output.h"
#include "video_sys.h"
#include "video_yuv.h"
#include "intf_msg.h"
/*****************************************************************************
* vout_sys_t: video output X11 method descriptor
*****************************************************************************
* This structure is part of the video output thread descriptor.
* It describes the X11 specific properties of an output thread. X11 video
* output is performed through regular resizable windows. Windows can be
* dynamically resized to adapt to the size of the streams.
*****************************************************************************/
typedef struct vout_sys_s
{
/* User settings */
boolean_t b_shm; /* shared memory extension flag */
/* Internal settings and properties */
Display * p_display; /* display pointer */
Visual * p_visual; /* visual pointer */
int i_screen; /* screen number */
Window root_window; /* root window */
Window window; /* window instance handler */
GC gc; /* graphic context instance handler */
Colormap colormap; /* colormap used (8bpp only) */
/* Display buffers and shared memory information */
XImage * p_ximage[2]; /* XImage pointer */
XShmSegmentInfo shm_info[2]; /* shared memory zone information */
} vout_sys_t;
/*****************************************************************************
* Local prototypes
*****************************************************************************/
static int X11OpenDisplay ( vout_thread_t *p_vout, char *psz_display, Window root_window );
static void X11CloseDisplay ( vout_thread_t *p_vout );
static int X11CreateWindow ( vout_thread_t *p_vout );
static void X11DestroyWindow ( vout_thread_t *p_vout );
static int X11CreateImage ( vout_thread_t *p_vout, XImage **pp_ximage );
static void X11DestroyImage ( XImage *p_ximage );
static int X11CreateShmImage ( vout_thread_t *p_vout, XImage **pp_ximage,
XShmSegmentInfo *p_shm_info );
static void X11DestroyShmImage ( vout_thread_t *p_vout, XImage *p_ximage,
XShmSegmentInfo *p_shm_info );
/*****************************************************************************
* vout_SysCreate: allocate X11 video thread output method
*****************************************************************************
* This function allocate and initialize a X11 vout method. It uses some of the
* vout properties to choose the window size, and change them according to the
* actual properties of the display.
*****************************************************************************/
int vout_SysCreate( vout_thread_t *p_vout, char *psz_display, int i_root_window )
{
/* Allocate structure */
p_vout->p_sys = malloc( sizeof( vout_sys_t ) );
if( p_vout->p_sys == NULL )
{
intf_ErrMsg("error: %s\n", strerror(ENOMEM) );
return( 1 );
}
/* Open and initialize device. This function issues its own error messages.
* Since XLib is usually not thread-safe, we can't use the same display
* pointer than the interface or another thread. However, the root window
* id is still valid. */
if( X11OpenDisplay( p_vout, psz_display, i_root_window ) )
{
intf_ErrMsg("error: can't initialize X11 display\n" );
free( p_vout->p_sys );
return( 1 );
}
return( 0 );
}
/*****************************************************************************
* vout_SysInit: initialize X11 video thread output method
*****************************************************************************
* This function create the XImages needed by the output thread. It is called
* at the beginning of the thread, but also each time the window is resized.
*****************************************************************************/
int vout_SysInit( vout_thread_t *p_vout )
{
int i_err;
/* Create XImages using XShm extension - on failure, fall back to regular
* way (and destroy the first image if it was created successfully) */
if( p_vout->p_sys->b_shm )
{
/* Create first image */
i_err = X11CreateShmImage( p_vout, &p_vout->p_sys->p_ximage[0],
&p_vout->p_sys->shm_info[0] );
if( !i_err ) /* first image has been created */
{
/* Create second image */
if( X11CreateShmImage( p_vout, &p_vout->p_sys->p_ximage[1],
&p_vout->p_sys->shm_info[1] ) )
{ /* error creating the second image */
X11DestroyShmImage( p_vout, p_vout->p_sys->p_ximage[0],
&p_vout->p_sys->shm_info[0] );
i_err = 1;
}
}
if( i_err ) /* an error occured */
{
intf_Msg("XShm video sextension desactivated\n" );
p_vout->p_sys->b_shm = 0;
}
}
/* Create XImages without XShm extension */
if( !p_vout->p_sys->b_shm )
{
if( X11CreateImage( p_vout, &p_vout->p_sys->p_ximage[0] ) )
{
intf_ErrMsg("error: can't create images\n");
p_vout->p_sys->p_ximage[0] = NULL;
p_vout->p_sys->p_ximage[1] = NULL;
return( 1 );
}
if( X11CreateImage( p_vout, &p_vout->p_sys->p_ximage[1] ) )
{
intf_ErrMsg("error: can't create images\n");
X11DestroyImage( p_vout->p_sys->p_ximage[0] );
p_vout->p_sys->p_ximage[0] = NULL;
p_vout->p_sys->p_ximage[1] = NULL;
return( 1 );
}
}
/* Set bytes per line and initialize buffers */
p_vout->i_bytes_per_line = p_vout->p_sys->p_ximage[0]->bytes_per_line;
vout_SetBuffers( p_vout, p_vout->p_sys->p_ximage[ 0 ]->data,
p_vout->p_sys->p_ximage[ 1 ]->data );
return( 0 );
}
/*****************************************************************************
* vout_SysEnd: terminate X11 video thread output method
*****************************************************************************
* Destroy the X11 XImages created by vout_SysInit. It is called at the end of
* the thread, but also each time the window is resized.
*****************************************************************************/
void vout_SysEnd( vout_thread_t *p_vout )
{
if( p_vout->p_sys->b_shm ) /* Shm XImages... */
{
X11DestroyShmImage( p_vout, p_vout->p_sys->p_ximage[0],
&p_vout->p_sys->shm_info[0] );
X11DestroyShmImage( p_vout, p_vout->p_sys->p_ximage[1],
&p_vout->p_sys->shm_info[1] );
}
else /* ...or regular XImages */
{
X11DestroyImage( p_vout->p_sys->p_ximage[0] );
X11DestroyImage( p_vout->p_sys->p_ximage[1] );
}
}
/*****************************************************************************
* vout_SysDestroy: destroy X11 video thread output method
*****************************************************************************
* Terminate an output method created by vout_X11CreateOutputMethod
*****************************************************************************/
void vout_SysDestroy( vout_thread_t *p_vout )
{
X11CloseDisplay( p_vout );
free( p_vout->p_sys );
}
/*****************************************************************************
* vout_SysManage: handle X11 events
*****************************************************************************
* This function should be called regularly by video output thread. It manages
* X11 events and allows window resizing. It returns a non null value on
* error.
*****************************************************************************/
int vout_SysManage( vout_thread_t *p_vout )
{
/*
* Color/Grayscale or gamma change: in 8bpp, just change the colormap
*/
if( (p_vout->i_changes & VOUT_GRAYSCALE_CHANGE) && (p_vout->i_screen_depth == 8) )
{
//??
//?? clear flags
}
/*
* Size change
*/
if( p_vout->i_changes & VOUT_SIZE_CHANGE )
{
intf_DbgMsg("resizing window\n");
p_vout->i_changes &= ~VOUT_SIZE_CHANGE;
/* Resize window */
XResizeWindow( p_vout->p_sys->p_display, p_vout->p_sys->window,
p_vout->i_width, p_vout->i_height );
/* Destroy XImages to change their size */
vout_SysEnd( p_vout );
/* Recreate XImages. If SysInit failed, the thread can't go on. */
if( vout_SysInit( p_vout ) )
{
intf_ErrMsg("error: can't resize display\n");
return( 1 );
}
/* Tell the video output thread that it will need to rebuild YUV
* tables. This is needed since convertion buffer size may have changed */
p_vout->i_changes |= VOUT_YUV_CHANGE;
intf_Msg("Video display resized (%dx%d)\n", p_vout->i_width, p_vout->i_height);
}
return 0;
}
/*****************************************************************************
* vout_SysDisplay: displays previously rendered output
*****************************************************************************
* This function send the currently rendered image to X11 server, wait until
* it is displayed and switch the two rendering buffer, preparing next frame.
*****************************************************************************/
void vout_SysDisplay( vout_thread_t *p_vout )
{
if( p_vout->p_sys->b_shm) /* XShm is used */
{
/* Display rendered image using shared memory extension */
XShmPutImage(p_vout->p_sys->p_display, p_vout->p_sys->window, p_vout->p_sys->gc,
p_vout->p_sys->p_ximage[ p_vout->i_buffer_index ],
0, 0, 0, 0,
p_vout->p_sys->p_ximage[ p_vout->i_buffer_index ]->width,
p_vout->p_sys->p_ximage[ p_vout->i_buffer_index ]->height, True);
/* Send the order to the X server */
XFlush(p_vout->p_sys->p_display);
}
else /* regular X11 capabilities are used */
{
XPutImage(p_vout->p_sys->p_display, p_vout->p_sys->window, p_vout->p_sys->gc,
p_vout->p_sys->p_ximage[ p_vout->i_buffer_index ],
0, 0, 0, 0,
p_vout->p_sys->p_ximage[ p_vout->i_buffer_index ]->width,
p_vout->p_sys->p_ximage[ p_vout->i_buffer_index ]->height);
/* Send the order to the X server */
XFlush(p_vout->p_sys->p_display);
}
}
/* following functions are local */
/*****************************************************************************
* X11OpenDisplay: open and initialize X11 device
*****************************************************************************
* Create a window according to video output given size, and set other
* properties according to the display properties.
*****************************************************************************/
static int X11OpenDisplay( vout_thread_t *p_vout, char *psz_display, Window root_window )
{
XPixmapFormatValues * p_xpixmap_format; /* pixmap formats */
XVisualInfo * p_xvisual; /* visuals informations */
XVisualInfo xvisual_template; /* visual template */
int i_count; /* array size */
/* Open display */
p_vout->p_sys->p_display = XOpenDisplay( psz_display );
if( p_vout->p_sys->p_display == NULL )
{
intf_ErrMsg("error: can't open display %s\n", psz_display );
return( 1 );
}
/* Initialize structure */
p_vout->p_sys->root_window = root_window;
p_vout->p_sys->b_shm = (XShmQueryExtension(p_vout->p_sys->p_display) == True);
p_vout->p_sys->i_screen = DefaultScreen( p_vout->p_sys->p_display );
if( !p_vout->p_sys->b_shm )
{
intf_Msg("XShm video extension is not available\n");
}
/* Get screen depth */
p_vout->i_screen_depth = XDefaultDepth( p_vout->p_sys->p_display, p_vout->p_sys->i_screen );
switch( p_vout->i_screen_depth )
{
case 8:
/*
* Screen depth is 8bpp. Use PseudoColor visual with private colormap.
*/
xvisual_template.screen = p_vout->p_sys->i_screen;
xvisual_template.class = DirectColor;
p_xvisual = XGetVisualInfo( p_vout->p_sys->p_display, VisualScreenMask | VisualClassMask,
&xvisual_template, &i_count );
if( p_xvisual == NULL )
{
intf_ErrMsg("error: no PseudoColor visual available\n");
XCloseDisplay( p_vout->p_sys->p_display );
return( 1 );
}
//??
//?? SetColormap;
p_vout->i_bytes_per_pixel = 1;
break;
case 15:
case 16:
case 24:
default:
/*
* Screen depth is higher than 8bpp. TrueColor visual is used.
*/
xvisual_template.screen = p_vout->p_sys->i_screen;
xvisual_template.class = TrueColor;
p_xvisual = XGetVisualInfo( p_vout->p_sys->p_display, VisualScreenMask | VisualClassMask,
&xvisual_template, &i_count );
if( p_xvisual == NULL )
{
intf_ErrMsg("error: no TrueColor visual available\n");
XCloseDisplay( p_vout->p_sys->p_display );
return( 1 );
}
p_vout->i_red_mask = p_xvisual->red_mask;
p_vout->i_green_mask = p_xvisual->green_mask;
p_vout->i_blue_mask = p_xvisual->blue_mask;
/* There is no difference yet between 3 and 4 Bpp. The only way to find
* the actual number of bytes per pixel is to list supported pixmap
* formats. */
p_xpixmap_format = XListPixmapFormats( p_vout->p_sys->p_display, &i_count );
p_vout->i_bytes_per_pixel = 0;
for( ; i_count--; p_xpixmap_format++ )
{
if( p_xpixmap_format->bits_per_pixel / 8 > p_vout->i_bytes_per_pixel )
{
p_vout->i_bytes_per_pixel = p_xpixmap_format->bits_per_pixel / 8;
}
}
break;
}
p_vout->p_sys->p_visual = p_xvisual->visual;
XFree( p_xvisual );
/* Create a window */
if( X11CreateWindow( p_vout ) )
{
intf_ErrMsg("error: can't open a window\n");
XCloseDisplay( p_vout->p_sys->p_display );
return( 1 );
}
return( 0 );
}
/*****************************************************************************
* X11CloseDisplay: close X11 device
*****************************************************************************
* Returns all resources allocated by X11OpenDisplay and restore the original
* state of the display.
*****************************************************************************/
static void X11CloseDisplay( vout_thread_t *p_vout )
{
/* Destroy colormap */
if( p_vout->i_screen_depth == 8 )
{
XFreeColormap( p_vout->p_sys->p_display, p_vout->p_sys->colormap );
}
/* Destroy window and close display */
X11DestroyWindow( p_vout );
XCloseDisplay( p_vout->p_sys->p_display );
}
/*****************************************************************************
* X11CreateWindow: create X11 vout window
*****************************************************************************
* The video output window will be created. Normally, this window is wether
* full screen or part of a parent window. Therefore, it does not need a
* title or other hints. Thery are still supplied in case the window would be
* spawned as a standalone one by the interface.
*****************************************************************************/
static int X11CreateWindow( vout_thread_t *p_vout )
{
XSetWindowAttributes xwindow_attributes; /* window attributes */
XGCValues xgcvalues; /* graphic context configuration */
XEvent xevent; /* first events */
boolean_t b_expose; /* 'expose' event received */
boolean_t b_map_notify; /* 'map_notify' event received */
/* Prepare window attributes */
xwindow_attributes.backing_store = Always; /* save the hidden part */
/* Create the window and set hints */
p_vout->p_sys->window = XCreateSimpleWindow( p_vout->p_sys->p_display,
p_vout->p_sys->root_window,
0, 0,
p_vout->i_width, p_vout->i_height,
0, 0, 0);
XSelectInput( p_vout->p_sys->p_display, p_vout->p_sys->window,
ExposureMask | StructureNotifyMask );
XChangeWindowAttributes( p_vout->p_sys->p_display, p_vout->p_sys->window,
CWBackingStore, &xwindow_attributes);
/* Creation of a graphic context that doesn't generate a GraphicsExpose event
when using functions like XCopyArea */
xgcvalues.graphics_exposures = False;
p_vout->p_sys->gc = XCreateGC( p_vout->p_sys->p_display, p_vout->p_sys->window,
GCGraphicsExposures, &xgcvalues);
/* Send orders to server, and wait until window is displayed - two events
* must be received: a MapNotify event, an Expose event allowing drawing in the
* window */
b_expose = 0;
b_map_notify = 0;
XMapWindow( p_vout->p_sys->p_display, p_vout->p_sys->window);
do
{
XNextEvent( p_vout->p_sys->p_display, &xevent);
if( (xevent.type == Expose)
&& (xevent.xexpose.window == p_vout->p_sys->window) )
{
b_expose = 1;
}
else if( (xevent.type == MapNotify)
&& (xevent.xmap.window == p_vout->p_sys->window) )
{
b_map_notify = 1;
}
}
while( !( b_expose && b_map_notify ) );
XSelectInput( p_vout->p_sys->p_display, p_vout->p_sys->window, 0 );
/* At this stage, the window is openned, displayed, and ready to receive
* data */
return( 0 );
}
/*****************************************************************************
* X11DestroyWindow: destroy X11 window
*****************************************************************************
* Destroy an X11 window created by vout_X11CreateWindow
*****************************************************************************/
static void X11DestroyWindow( vout_thread_t *p_vout )
{
XUnmapWindow( p_vout->p_sys->p_display, p_vout->p_sys->window );
XFreeGC( p_vout->p_sys->p_display, p_vout->p_sys->gc );
XDestroyWindow( p_vout->p_sys->p_display, p_vout->p_sys->window );
}
/*****************************************************************************
* X11CreateImage: create an XImage
*****************************************************************************
* Create a simple XImage used as a buffer.
*****************************************************************************/
static int X11CreateImage( vout_thread_t *p_vout, XImage **pp_ximage )
{
byte_t * pb_data; /* image data storage zone */
int i_quantum; /* XImage quantum (see below) */
/* Allocate memory for image */
p_vout->i_bytes_per_line = p_vout->i_width * p_vout->i_bytes_per_pixel;
pb_data = (byte_t *) malloc( p_vout->i_bytes_per_line * p_vout->i_height );
if( !pb_data ) /* error */
{
intf_ErrMsg("error: %s\n", strerror(ENOMEM));
return( 1 );
}
/* Optimize the quantum of a scanline regarding its size - the quantum is
a diviser of the number of bits between the start of two scanlines. */
if( !(( p_vout->i_bytes_per_line ) % 32) )
{
i_quantum = 32;
}
else
{
if( !(( p_vout->i_bytes_per_line ) % 16) )
{
i_quantum = 16;
}
else
{
i_quantum = 8;
}
}
/* Create XImage */
*pp_ximage = XCreateImage( p_vout->p_sys->p_display, p_vout->p_sys->p_visual,
p_vout->i_screen_depth, ZPixmap, 0, pb_data,
p_vout->i_width, p_vout->i_height, i_quantum, 0);
if(! *pp_ximage ) /* error */
{
intf_ErrMsg( "error: XCreateImage() failed\n" );
free( pb_data );
return( 1 );
}
return 0;
}
/*****************************************************************************
* X11CreateShmImage: create an XImage using shared memory extension
*****************************************************************************
* Prepare an XImage for DisplayX11ShmImage function.
* The order of the operations respects the recommandations of the mit-shm
* document by J.Corbet and K.Packard. Most of the parameters were copied from
* there.
*****************************************************************************/
static int X11CreateShmImage( vout_thread_t *p_vout, XImage **pp_ximage,
XShmSegmentInfo *p_shm_info)
{
/* Create XImage */
*pp_ximage = XShmCreateImage( p_vout->p_sys->p_display, p_vout->p_sys->p_visual,
p_vout->i_screen_depth, ZPixmap, 0,
p_shm_info, p_vout->i_width, p_vout->i_height );
if(! *pp_ximage ) /* error */
{
intf_ErrMsg("error: XShmCreateImage() failed\n");
return( 1 );
}
/* Allocate shared memory segment - 0777 set the access permission
* rights (like umask), they are not yet supported by X servers */
p_shm_info->shmid = shmget( IPC_PRIVATE,
(*pp_ximage)->bytes_per_line * (*pp_ximage)->height,
IPC_CREAT | 0777);
if( p_shm_info->shmid < 0) /* error */
{
intf_ErrMsg("error: can't allocate shared image data (%s)\n",
strerror(errno));
XDestroyImage( *pp_ximage );
return( 1 );
}
/* Attach shared memory segment to process (read/write) */
p_shm_info->shmaddr = (*pp_ximage)->data = shmat(p_shm_info->shmid, 0, 0);
if(! p_shm_info->shmaddr )
{ /* error */
intf_ErrMsg("error: can't attach shared memory (%s)\n",
strerror(errno));
shmctl( p_shm_info->shmid, IPC_RMID, 0 ); /* free shared memory */
XDestroyImage( *pp_ximage );
return( 1 );
}
/* Mark the shm segment to be removed when there will be no more
* attachements, so it is automatic on process exit or after shmdt */
shmctl( p_shm_info->shmid, IPC_RMID, 0 );
/* Attach shared memory segment to X server (read only) */
p_shm_info->readOnly = True;
if( XShmAttach( p_vout->p_sys->p_display, p_shm_info ) == False ) /* error */
{
intf_ErrMsg("error: can't attach shared memory to X11 server\n");
shmdt( p_shm_info->shmaddr ); /* detach shared memory from process
* and automatic free */
XDestroyImage( *pp_ximage );
return( 1 );
}
/* Send image to X server. This instruction is required, since having
* built a Shm XImage and not using it causes an error on XCloseDisplay */
XFlush( p_vout->p_sys->p_display );
return( 0 );
}
/*****************************************************************************
* X11DestroyImage: destroy an XImage
*****************************************************************************
* Destroy XImage AND associated data. If pointer is NULL, the image won't be
* destroyed (see vout_X11ManageOutputMethod())
*****************************************************************************/
static void X11DestroyImage( XImage *p_ximage )
{
if( p_ximage != NULL )
{
XDestroyImage( p_ximage ); /* no free() required */
}
}
/*****************************************************************************
* X11DestroyShmImage
*****************************************************************************
* Destroy XImage AND associated data. Detach shared memory segment from
* server and process, then free it. If pointer is NULL, the image won't be
* destroyed (see vout_X11ManageOutputMethod())
*****************************************************************************/
static void X11DestroyShmImage( vout_thread_t *p_vout, XImage *p_ximage,
XShmSegmentInfo *p_shm_info )
{
/* If pointer is NULL, do nothing */
if( p_ximage == NULL )
{
return;
}
XShmDetach( p_vout->p_sys->p_display, p_shm_info ); /* detach from server */
XDestroyImage( p_ximage );
if( shmdt( p_shm_info->shmaddr ) ) /* detach shared memory from process */
{ /* also automatic freeing... */
intf_ErrMsg("error: can't detach shared memory (%s)\n",
strerror(errno));
}
}
......@@ -274,7 +274,7 @@ static void ConvertYUV444RGB32( p_vout_thread_t p_vout, u32 *p_pic, yuv_data
{ \
/* Horizontal scaling, but we can't use a buffer due to dither */ \
p_offset = p_offset_start; \
b_jump_uv = 0; \
b_jump_uv = 0; \
for( i_x = i_pic_width / 16; i_x--; ) \
{ \
CONVERT_4YUV_PIXELS_SCALE( CHROMA ) \
......@@ -291,7 +291,7 @@ static void ConvertYUV444RGB32( p_vout_thread_t p_vout, u32 *p_pic, yuv_data
CONVERT_4YUV_PIXELS( CHROMA ) \
CONVERT_4YUV_PIXELS( CHROMA ) \
CONVERT_4YUV_PIXELS( CHROMA ) \
} \
} \
} \
/* Increment of picture pointer to end of line is still needed */ \
p_pic += i_pic_line_width; \
......@@ -693,7 +693,7 @@ static void SetYUV( vout_thread_t *p_vout )
i++;
continue;
}
/* heavy. yeah. */
for( u2 = 0; u2 <= 256; u2 += 32 )
for( v2 = 0; v2 <= 256; v2 += 32 )
......@@ -1729,8 +1729,8 @@ static void ConvertYUV444RGB32( p_vout_thread_t p_vout, u32 *p_pic, yuv_data_t *
#if 0
//??
static void yuvToRgb24 (unsigned char * Y,
unsigned char * U, unsigned char * V,
char * dest, int table[1935], int width)
unsigned char * U, unsigned char * V,
char * dest, int table[1935], int width)
{
int i;
int u;
......@@ -1743,145 +1743,145 @@ static void yuvToRgb24 (unsigned char * Y,
i = width >> 3;
while (i--) {
u = *(U++);
v = *(V++);
uvRed = (V_RED_COEF*v) >> SHIFT;
uvGreen = (U_GREEN_COEF*u + V_GREEN_COEF*v) >> SHIFT;
uvBlue = (U_BLUE_COEF*u) >> SHIFT;
tableY = table + *(Y++);
tmp24 = (tableY [1501 - ((V_RED_COEF*128)>>SHIFT) + uvRed] |
tableY [135 - (((U_GREEN_COEF+V_GREEN_COEF)*128)>>SHIFT) +
uvGreen] |
tableY [818 - ((U_BLUE_COEF*128)>>SHIFT) + uvBlue]);
*(dest++) = tmp24;
*(dest++) = tmp24 >> 8;
*(dest++) = tmp24 >> 16;
tableY = table + *(Y++);
tmp24 = (tableY [1501 - ((V_RED_COEF*128)>>SHIFT) + uvRed] |
tableY [135 - (((U_GREEN_COEF+V_GREEN_COEF)*128)>>SHIFT) +
uvGreen] |
tableY [818 - ((U_BLUE_COEF*128)>>SHIFT) + uvBlue]);
*(dest++) = tmp24;
*(dest++) = tmp24 >> 8;
*(dest++) = tmp24 >> 16;
u = *(U++);
v = *(V++);
uvRed = (V_RED_COEF*v) >> SHIFT;
uvGreen = (U_GREEN_COEF*u + V_GREEN_COEF*v) >> SHIFT;
uvBlue = (U_BLUE_COEF*u) >> SHIFT;
tableY = table + *(Y++);
tmp24 = (tableY [1501 - ((V_RED_COEF*128)>>SHIFT) + uvRed] |
tableY [135 - (((U_GREEN_COEF+V_GREEN_COEF)*128)>>SHIFT) +
uvGreen] |
tableY [818 - ((U_BLUE_COEF*128)>>SHIFT) + uvBlue]);
*(dest++) = tmp24;
*(dest++) = tmp24 >> 8;
*(dest++) = tmp24 >> 16;
tableY = table + *(Y++);
tmp24 = (tableY [1501 - ((V_RED_COEF*128)>>SHIFT) + uvRed] |
tableY [135 - (((U_GREEN_COEF+V_GREEN_COEF)*128)>>SHIFT) +
uvGreen] |
tableY [818 - ((U_BLUE_COEF*128)>>SHIFT) + uvBlue]);
*(dest++) = tmp24;
*(dest++) = tmp24 >> 8;
*(dest++) = tmp24 >> 16;
u = *(U++);
v = *(V++);
uvRed = (V_RED_COEF*v) >> SHIFT;
uvGreen = (U_GREEN_COEF*u + V_GREEN_COEF*v) >> SHIFT;
uvBlue = (U_BLUE_COEF*u) >> SHIFT;
tableY = table + *(Y++);
tmp24 = (tableY [1501 - ((V_RED_COEF*128)>>SHIFT) + uvRed] |
tableY [135 - (((U_GREEN_COEF+V_GREEN_COEF)*128)>>SHIFT) +
uvGreen] |
tableY [818 - ((U_BLUE_COEF*128)>>SHIFT) + uvBlue]);
*(dest++) = tmp24;
*(dest++) = tmp24 >> 8;
*(dest++) = tmp24 >> 16;
tableY = table + *(Y++);
tmp24 = (tableY [1501 - ((V_RED_COEF*128)>>SHIFT) + uvRed] |
tableY [135 - (((U_GREEN_COEF+V_GREEN_COEF)*128)>>SHIFT) +
uvGreen] |
tableY [818 - ((U_BLUE_COEF*128)>>SHIFT) + uvBlue]);
*(dest++) = tmp24;
*(dest++) = tmp24 >> 8;
*(dest++) = tmp24 >> 16;
u = *(U++);
v = *(V++);
uvRed = (V_RED_COEF*v) >> SHIFT;
uvGreen = (U_GREEN_COEF*u + V_GREEN_COEF*v) >> SHIFT;
uvBlue = (U_BLUE_COEF*u) >> SHIFT;
tableY = table + *(Y++);
tmp24 = (tableY [1501 - ((V_RED_COEF*128)>>SHIFT) + uvRed] |
tableY [135 - (((U_GREEN_COEF+V_GREEN_COEF)*128)>>SHIFT) +
uvGreen] |
tableY [818 - ((U_BLUE_COEF*128)>>SHIFT) + uvBlue]);
*(dest++) = tmp24;
*(dest++) = tmp24 >> 8;
*(dest++) = tmp24 >> 16;
tableY = table + *(Y++);
tmp24 = (tableY [1501 - ((V_RED_COEF*128)>>SHIFT) + uvRed] |
tableY [135 - (((U_GREEN_COEF+V_GREEN_COEF)*128)>>SHIFT) +
uvGreen] |
tableY [818 - ((U_BLUE_COEF*128)>>SHIFT) + uvBlue]);
*(dest++) = tmp24;
*(dest++) = tmp24 >> 8;
*(dest++) = tmp24 >> 16;
u = *(U++);
v = *(V++);
uvRed = (V_RED_COEF*v) >> SHIFT;
uvGreen = (U_GREEN_COEF*u + V_GREEN_COEF*v) >> SHIFT;
uvBlue = (U_BLUE_COEF*u) >> SHIFT;
tableY = table + *(Y++);
tmp24 = (tableY [1501 - ((V_RED_COEF*128)>>SHIFT) + uvRed] |
tableY [135 - (((U_GREEN_COEF+V_GREEN_COEF)*128)>>SHIFT) +
uvGreen] |
tableY [818 - ((U_BLUE_COEF*128)>>SHIFT) + uvBlue]);
*(dest++) = tmp24;
*(dest++) = tmp24 >> 8;
*(dest++) = tmp24 >> 16;
tableY = table + *(Y++);
tmp24 = (tableY [1501 - ((V_RED_COEF*128)>>SHIFT) + uvRed] |
tableY [135 - (((U_GREEN_COEF+V_GREEN_COEF)*128)>>SHIFT) +
uvGreen] |
tableY [818 - ((U_BLUE_COEF*128)>>SHIFT) + uvBlue]);
*(dest++) = tmp24;
*(dest++) = tmp24 >> 8;
*(dest++) = tmp24 >> 16;
u = *(U++);
v = *(V++);
uvRed = (V_RED_COEF*v) >> SHIFT;
uvGreen = (U_GREEN_COEF*u + V_GREEN_COEF*v) >> SHIFT;
uvBlue = (U_BLUE_COEF*u) >> SHIFT;
tableY = table + *(Y++);
tmp24 = (tableY [1501 - ((V_RED_COEF*128)>>SHIFT) + uvRed] |
tableY [135 - (((U_GREEN_COEF+V_GREEN_COEF)*128)>>SHIFT) +
uvGreen] |
tableY [818 - ((U_BLUE_COEF*128)>>SHIFT) + uvBlue]);
*(dest++) = tmp24;
*(dest++) = tmp24 >> 8;
*(dest++) = tmp24 >> 16;
tableY = table + *(Y++);
tmp24 = (tableY [1501 - ((V_RED_COEF*128)>>SHIFT) + uvRed] |
tableY [135 - (((U_GREEN_COEF+V_GREEN_COEF)*128)>>SHIFT) +
uvGreen] |
tableY [818 - ((U_BLUE_COEF*128)>>SHIFT) + uvBlue]);
*(dest++) = tmp24;
*(dest++) = tmp24 >> 8;
*(dest++) = tmp24 >> 16;
u = *(U++);
v = *(V++);
uvRed = (V_RED_COEF*v) >> SHIFT;
uvGreen = (U_GREEN_COEF*u + V_GREEN_COEF*v) >> SHIFT;
uvBlue = (U_BLUE_COEF*u) >> SHIFT;
tableY = table + *(Y++);
tmp24 = (tableY [1501 - ((V_RED_COEF*128)>>SHIFT) + uvRed] |
tableY [135 - (((U_GREEN_COEF+V_GREEN_COEF)*128)>>SHIFT) +
uvGreen] |
tableY [818 - ((U_BLUE_COEF*128)>>SHIFT) + uvBlue]);
*(dest++) = tmp24;
*(dest++) = tmp24 >> 8;
*(dest++) = tmp24 >> 16;
tableY = table + *(Y++);
tmp24 = (tableY [1501 - ((V_RED_COEF*128)>>SHIFT) + uvRed] |
tableY [135 - (((U_GREEN_COEF+V_GREEN_COEF)*128)>>SHIFT) +
uvGreen] |
tableY [818 - ((U_BLUE_COEF*128)>>SHIFT) + uvBlue]);
*(dest++) = tmp24;
*(dest++) = tmp24 >> 8;
*(dest++) = tmp24 >> 16;
u = *(U++);
v = *(V++);
uvRed = (V_RED_COEF*v) >> SHIFT;
uvGreen = (U_GREEN_COEF*u + V_GREEN_COEF*v) >> SHIFT;
uvBlue = (U_BLUE_COEF*u) >> SHIFT;
tableY = table + *(Y++);
tmp24 = (tableY [1501 - ((V_RED_COEF*128)>>SHIFT) + uvRed] |
tableY [135 - (((U_GREEN_COEF+V_GREEN_COEF)*128)>>SHIFT) +
uvGreen] |
tableY [818 - ((U_BLUE_COEF*128)>>SHIFT) + uvBlue]);
*(dest++) = tmp24;
*(dest++) = tmp24 >> 8;
*(dest++) = tmp24 >> 16;
tableY = table + *(Y++);
tmp24 = (tableY [1501 - ((V_RED_COEF*128)>>SHIFT) + uvRed] |
tableY [135 - (((U_GREEN_COEF+V_GREEN_COEF)*128)>>SHIFT) +
uvGreen] |
tableY [818 - ((U_BLUE_COEF*128)>>SHIFT) + uvBlue]);
*(dest++) = tmp24;
*(dest++) = tmp24 >> 8;
*(dest++) = tmp24 >> 16;
}
i = (width & 7) >> 1;
while (i--) {
u = *(U++);
v = *(V++);
uvRed = (V_RED_COEF*v) >> SHIFT;
uvGreen = (U_GREEN_COEF*u + V_GREEN_COEF*v) >> SHIFT;
uvBlue = (U_BLUE_COEF*u) >> SHIFT;
tableY = table + *(Y++);
tmp24 = (tableY [1501 - ((V_RED_COEF*128)>>SHIFT) + uvRed] |
tableY [135 - (((U_GREEN_COEF+V_GREEN_COEF)*128)>>SHIFT) +
uvGreen] |
tableY [818 - ((U_BLUE_COEF*128)>>SHIFT) + uvBlue]);
*(dest++) = tmp24;
*(dest++) = tmp24 >> 8;
*(dest++) = tmp24 >> 16;
tableY = table + *(Y++);
tmp24 = (tableY [1501 - ((V_RED_COEF*128)>>SHIFT) + uvRed] |
tableY [135 - (((U_GREEN_COEF+V_GREEN_COEF)*128)>>SHIFT) +
uvGreen] |
tableY [818 - ((U_BLUE_COEF*128)>>SHIFT) + uvBlue]);
*(dest++) = tmp24;
*(dest++) = tmp24 >> 8;
*(dest++) = tmp24 >> 16;
u = *(U++);
v = *(V++);
uvRed = (V_RED_COEF*v) >> SHIFT;
uvGreen = (U_GREEN_COEF*u + V_GREEN_COEF*v) >> SHIFT;
uvBlue = (U_BLUE_COEF*u) >> SHIFT;
tableY = table + *(Y++);
tmp24 = (tableY [1501 - ((V_RED_COEF*128)>>SHIFT) + uvRed] |
tableY [135 - (((U_GREEN_COEF+V_GREEN_COEF)*128)>>SHIFT) +
uvGreen] |
tableY [818 - ((U_BLUE_COEF*128)>>SHIFT) + uvBlue]);
*(dest++) = tmp24;
*(dest++) = tmp24 >> 8;
*(dest++) = tmp24 >> 16;
tableY = table + *(Y++);
tmp24 = (tableY [1501 - ((V_RED_COEF*128)>>SHIFT) + uvRed] |
tableY [135 - (((U_GREEN_COEF+V_GREEN_COEF)*128)>>SHIFT) +
uvGreen] |
tableY [818 - ((U_BLUE_COEF*128)>>SHIFT) + uvBlue]);
*(dest++) = tmp24;
*(dest++) = tmp24 >> 8;
*(dest++) = tmp24 >> 16;
}
if (width & 1) {
u = *(U++);
v = *(V++);
uvRed = (V_RED_COEF*v) >> SHIFT;
uvGreen = (U_GREEN_COEF*u + V_GREEN_COEF*v) >> SHIFT;
uvBlue = (U_BLUE_COEF*u) >> SHIFT;
tableY = table + *(Y++);
tmp24 = (tableY [1501 - ((V_RED_COEF*128)>>SHIFT) + uvRed] |
tableY [135 - (((U_GREEN_COEF+V_GREEN_COEF)*128)>>SHIFT) +
uvGreen] |
tableY [818 - ((U_BLUE_COEF*128)>>SHIFT) + uvBlue]);
*(dest++) = tmp24;
*(dest++) = tmp24 >> 8;
*(dest++) = tmp24 >> 16;
u = *(U++);
v = *(V++);
uvRed = (V_RED_COEF*v) >> SHIFT;
uvGreen = (U_GREEN_COEF*u + V_GREEN_COEF*v) >> SHIFT;
uvBlue = (U_BLUE_COEF*u) >> SHIFT;
tableY = table + *(Y++);
tmp24 = (tableY [1501 - ((V_RED_COEF*128)>>SHIFT) + uvRed] |
tableY [135 - (((U_GREEN_COEF+V_GREEN_COEF)*128)>>SHIFT) +
uvGreen] |
tableY [818 - ((U_BLUE_COEF*128)>>SHIFT) + uvBlue]);
*(dest++) = tmp24;
*(dest++) = tmp24 >> 8;
*(dest++) = tmp24 >> 16;
}
}
#endif
......@@ -500,7 +500,7 @@ do_next_8x2_block:
addl $16,%edi /* ih take 16 bytes (8 pixels-16 bit) */
addl $4,%ebx /* ? to take 4 pixels together
instead of 2 */
#endif
#endif
jl do_next_8x2_block
addl CCOSkipDistance(%esp),%edi /* go to begin of next line */
......
......@@ -76,7 +76,7 @@ int pi_default_intra_quant[] =
26, 27, 29, 32, 35, 40, 48, 58,
26, 27, 29, 34, 38, 46, 56, 69,
27, 29, 35, 38, 46, 56, 69, 83
};
};
#else
int pi_default_intra_quant[] =
{
......@@ -87,7 +87,7 @@ int pi_default_intra_quant[] =
5632, 9232, 9031, 8730, 8192, 7040, 5542, 3390,
5230, 7533, 7621, 7568, 7040, 6321, 5225, 3219,
3602, 5189, 5250, 5539, 5265, 5007, 4199, 2638,
1907, 2841, 3230, 3156, 3249, 3108, 2638, 1617
1907, 2841, 3230, 3156, 3249, 3108, 2638, 1617
};
#endif
......@@ -116,7 +116,7 @@ int pi_default_nonintra_quanit[] =
4096, 5680, 5344, 4816, 4096, 3216, 2224, 1136,
3216, 4464, 4208, 3792, 3216, 2528, 1744, 880,
2224, 3072, 2896, 2608, 2224, 1744, 1200, 608,
1136, 1568, 1472, 1328, 1136, 880, 608, 304
1136, 1568, 1472, 1328, 1136, 880, 608, 304
};
#endif
......
......@@ -49,7 +49,7 @@
*****************************************************************************/
float vpar_SynchroUpdateTab( video_synchro_tab_t * tab, int count )
{
tab->mean = ( tab->mean + MAX_COUNT * count ) / ( MAX_COUNT + 1 );
tab->deviation = ( tab->deviation + MAX_COUNT * abs (tab->mean - count) )
/ ( MAX_COUNT + 1 );
......@@ -84,7 +84,7 @@ void vpar_SynchroUpdateStructures( vpar_thread_t * p_vpar,
/* see if the current image has a pts - if not, set to 0 */
p_vpar->synchro.fifo[p_vpar->synchro.i_fifo_stop].i_pts
= i_current_pts;
= i_current_pts;
/* update display time */
i_displaydate = decoder_fifo->buffer[decoder_fifo->i_start]->b_has_pts ?
......@@ -129,7 +129,7 @@ void vpar_SynchroUpdateStructures( vpar_thread_t * p_vpar,
case I_CODING_TYPE:
/* update information about images we can decode */
if (i_current_pts != p_vpar->synchro.i_last_i_pts)
if (i_current_pts != p_vpar->synchro.i_last_i_pts)
{
if ( p_vpar->synchro.i_last_i_pts && i_current_pts != p_vpar->synchro.i_last_i_pts)
{
......@@ -161,7 +161,7 @@ void vpar_SynchroUpdateStructures( vpar_thread_t * p_vpar,
&p_vpar->synchro.tab_p[1 + (p_vpar->synchro.modulo & 0x1)],
p_vpar->synchro.current_p_count);
if (candidate_deviation < optimal_deviation)
{
{
optimal_deviation = candidate_deviation;
predict = p_vpar->synchro.tab_p[1 + (p_vpar->synchro.modulo & 0x1)].mean;
}
......@@ -171,12 +171,12 @@ void vpar_SynchroUpdateStructures( vpar_thread_t * p_vpar,
&p_vpar->synchro.tab_p[3 + (p_vpar->synchro.modulo % 3)],
p_vpar->synchro.current_p_count);
if (candidate_deviation < optimal_deviation)
{
{
optimal_deviation = candidate_deviation;
predict = p_vpar->synchro.tab_p[1 + (p_vpar->synchro.modulo % 3)].mean;
}
p_vpar->synchro.p_count_predict = predict;
p_vpar->synchro.p_count_predict = predict;
p_vpar->synchro.current_p_count = 0;
......@@ -193,7 +193,7 @@ void vpar_SynchroUpdateStructures( vpar_thread_t * p_vpar,
&p_vpar->synchro.tab_b[1 + (p_vpar->synchro.modulo & 0x1)],
p_vpar->synchro.current_b_count);
if (candidate_deviation < optimal_deviation)
{
{
optimal_deviation = candidate_deviation;
predict = p_vpar->synchro.tab_b[1 + (p_vpar->synchro.modulo & 0x1)].mean;
}
......@@ -203,20 +203,20 @@ void vpar_SynchroUpdateStructures( vpar_thread_t * p_vpar,
&p_vpar->synchro.tab_b[3 + (p_vpar->synchro.modulo % 3)],
p_vpar->synchro.current_b_count);
if (candidate_deviation < optimal_deviation)
{
{
optimal_deviation = candidate_deviation;
predict = p_vpar->synchro.tab_b[1 + (p_vpar->synchro.modulo % 3)].mean;
}
p_vpar->synchro.b_count_predict = predict;
p_vpar->synchro.b_count_predict = predict;
p_vpar->synchro.current_b_count = 0;
/* now we calculated all statistics, it's time to
* decide what we have the time to display
*/
i_delay = i_current_pts - p_vpar->synchro.i_last_nondropped_i_pts;
p_vpar->synchro.can_display_i
p_vpar->synchro.can_display_i
= ( p_vpar->synchro.i_mean_decode_time < i_delay );
p_vpar->synchro.can_display_p
......@@ -230,15 +230,15 @@ void vpar_SynchroUpdateStructures( vpar_thread_t * p_vpar,
if( p_vpar->synchro.displayable_p < 0 )
p_vpar->synchro.displayable_p = 0;
}
else
else
p_vpar->synchro.displayable_p = 0;
if( p_vpar->synchro.can_display_p
if( p_vpar->synchro.can_display_p
&& !(p_vpar->synchro.can_display_b
= ( p_vpar->synchro.i_mean_decode_time
* (1 + p_vpar->synchro.b_count_predict
+ p_vpar->synchro.p_count_predict)) < i_delay) )
{
{
p_vpar->synchro.displayable_b
= -2.0 + i_delay / p_vpar->synchro.i_mean_decode_time
- p_vpar->synchro.can_display_p;
......@@ -360,7 +360,7 @@ void vpar_SynchroEnd( vpar_thread_t * p_vpar )
i_decode_time = (mdate() -
p_vpar->synchro.fifo[p_vpar->synchro.i_fifo_start].i_decode_date)
/ (p_vpar->synchro.i_fifo_stop - p_vpar->synchro.i_fifo_start & 0x0f);
/ ( (p_vpar->synchro.i_fifo_stop - p_vpar->synchro.i_fifo_start) & 0x0f);
p_vpar->synchro.i_mean_decode_time =
( 7 * p_vpar->synchro.i_mean_decode_time + i_decode_time ) / 8;
......@@ -380,9 +380,9 @@ mtime_t vpar_SynchroDate( vpar_thread_t * p_vpar )
{
mtime_t i_displaydate = p_vpar->synchro.i_last_display_pts;
static mtime_t i_delta = 0;
#if 0
static mtime_t i_delta = 0;
fprintf( stderr,
"displaying type %i with delay %lli and delta %lli\n",
p_vpar->synchro.fifo[p_vpar->synchro.i_fifo_start].i_image_type,
......
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