Commit cf0b7cf9 authored by Christophe Massiot's avatar Christophe Massiot

* Borrowed LiViD's MMX and MMX EXT IDCT.

This might break things. Expect a performance increase.
parent fd1220a2
...@@ -278,7 +278,7 @@ endif ...@@ -278,7 +278,7 @@ endif
ifneq (,$(findstring 86,$(ARCH))) ifneq (,$(findstring 86,$(ARCH)))
ifneq (,$(findstring mmx,$(ARCH))) ifneq (,$(findstring mmx,$(ARCH)))
ASM_OBJ = ASM_OBJ =
STD_PLUGIN_ASM = plugins/idct/idctmmx_asm.o STD_PLUGIN_ASM =
endif endif
endif endif
...@@ -351,11 +351,10 @@ PLUGIN_IDCTCLASSIC = plugins/idct/idctclassic.o \ ...@@ -351,11 +351,10 @@ PLUGIN_IDCTCLASSIC = plugins/idct/idctclassic.o \
plugins/idct/idct_common.o plugins/idct/idct_common.o
PLUGIN_IDCTMMX = plugins/idct/idctmmx.o \ PLUGIN_IDCTMMX = plugins/idct/idctmmx.o \
plugins/idct/idct_common.o \ plugins/idct/idct_common.o
plugins/idct/idctmmx_asm.o
PLUGIN_IDCTMMXEXT = plugins/idct/idctmmxext.o \ PLUGIN_IDCTMMXEXT = plugins/idct/idctmmxext.o \
plugins/idct/idct_mmxext.o plugins/idct/idct_common.o
PLUGIN_ALSA = plugins/alsa/alsa.o \ PLUGIN_ALSA = plugins/alsa/alsa.o \
plugins/alsa/aout_alsa.o plugins/alsa/aout_alsa.o
......
...@@ -83,6 +83,7 @@ typedef struct function_list_s ...@@ -83,6 +83,7 @@ typedef struct function_list_s
void ( * pf_idct ) ( struct vdec_thread_s * p_vdec, void ( * pf_idct ) ( struct vdec_thread_s * p_vdec,
dctelem_t * p_block, dctelem_t * p_block,
int i_idontcare ); int i_idontcare );
void ( * pf_norm_scan ) ( u8 ppi_scan[2][64] );
} idct; } idct;
struct struct
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* idct.c : IDCT module * idct.c : IDCT module
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN * Copyright (C) 1999, 2000 VideoLAN
* $Id: idct.c,v 1.4 2001/01/16 05:04:25 sam Exp $ * $Id: idct.c,v 1.5 2001/01/17 18:17:30 massiot Exp $
* *
* Authors: Gaël Hendryckx <jimmy@via.ecp.fr> * Authors: Gaël Hendryckx <jimmy@via.ecp.fr>
* *
...@@ -50,13 +50,8 @@ ...@@ -50,13 +50,8 @@
* Local and extern prototypes. * Local and extern prototypes.
*****************************************************************************/ *****************************************************************************/
static void idct_getfunctions( function_list_t * p_function_list ); static void idct_getfunctions( function_list_t * p_function_list );
static int idct_Probe ( probedata_t *p_data ); static int idct_Probe ( probedata_t *p_data );
static void vdec_InitIDCT ( vdec_thread_t * p_vdec); static void vdec_NormScan ( u8 ppi_scan[2][64] );
void vdec_SparseIDCT ( vdec_thread_t * p_vdec, dctelem_t * p_block,
int i_sparse_pos);
static void vdec_IDCT ( vdec_thread_t * p_vdec, dctelem_t * p_block,
int i_idontcare );
/***************************************************************************** /*****************************************************************************
...@@ -136,6 +131,7 @@ static void idct_getfunctions( function_list_t * p_function_list ) ...@@ -136,6 +131,7 @@ static void idct_getfunctions( function_list_t * p_function_list )
p_function_list->functions.idct.pf_init = vdec_InitIDCT; p_function_list->functions.idct.pf_init = vdec_InitIDCT;
p_function_list->functions.idct.pf_sparse_idct = vdec_SparseIDCT; p_function_list->functions.idct.pf_sparse_idct = vdec_SparseIDCT;
p_function_list->functions.idct.pf_idct = vdec_IDCT; p_function_list->functions.idct.pf_idct = vdec_IDCT;
p_function_list->functions.idct.pf_norm_scan = vdec_NormScan;
} }
/***************************************************************************** /*****************************************************************************
...@@ -153,28 +149,17 @@ static int idct_Probe( probedata_t *p_data ) ...@@ -153,28 +149,17 @@ static int idct_Probe( probedata_t *p_data )
} }
/***************************************************************************** /*****************************************************************************
* vdec_InitIDCT : initialize datas for vdec_SparseIDCT * vdec_NormScan : Unused in this IDCT
*****************************************************************************/ *****************************************************************************/
static void vdec_InitIDCT (vdec_thread_t * p_vdec) static void vdec_NormScan( u8 ppi_scan[2][64] )
{ {
int i;
dctelem_t * p_pre = p_vdec->p_pre_idct;
memset( p_pre, 0, 64*64*sizeof(dctelem_t) );
for( i=0 ; i < 64 ; i++ )
{
p_pre[i*64+i] = 1 << SPARSE_SCALE_FACTOR;
vdec_IDCT( p_vdec, &p_pre[i*64], 0) ;
}
return;
} }
/***************************************************************************** /*****************************************************************************
* vdec_IDCT : IDCT function for normal matrices * vdec_IDCT : IDCT function for normal matrices
*****************************************************************************/ *****************************************************************************/
static void vdec_IDCT( vdec_thread_t * p_vdec, dctelem_t * p_block, void vdec_IDCT( vdec_thread_t * p_vdec, dctelem_t * p_block,
int i_idontcare ) int i_idontcare )
{ {
s32 tmp0, tmp1, tmp2, tmp3; s32 tmp0, tmp1, tmp2, tmp3;
s32 tmp10, tmp11, tmp12, tmp13; s32 tmp10, tmp11, tmp12, tmp13;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* idct.h : macros for the inverse discrete cosine transform * idct.h : macros for the inverse discrete cosine transform
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN * Copyright (C) 1999, 2000 VideoLAN
* $Id: idct.h,v 1.1 2001/01/13 12:57:20 sam Exp $ * $Id: idct.h,v 1.2 2001/01/17 18:17:30 massiot Exp $
* *
* Authors: Gaël Hendryckx <jimmy@via.ecp.fr> * Authors: Gaël Hendryckx <jimmy@via.ecp.fr>
* Christophe Massiot <massiot@via.ecp.fr> * Christophe Massiot <massiot@via.ecp.fr>
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
#define DCTSIZE 8 /* 8*8 DCT */ #define DCTSIZE 8 /* 8*8 DCT */
/***************************************************************************** /*****************************************************************************
* Macros * Macros
*****************************************************************************/ *****************************************************************************/
/* We assume that right shift corresponds to signed division by 2 with /* We assume that right shift corresponds to signed division by 2 with
...@@ -140,3 +140,12 @@ ...@@ -140,3 +140,12 @@
#define MULTIPLY(var,const) ((var) * (const)) #define MULTIPLY(var,const) ((var) * (const))
#endif #endif
/*****************************************************************************
* Protoypes
*****************************************************************************/
void vdec_SparseIDCT ( vdec_thread_t * p_vdec, dctelem_t * p_block,
int i_sparse_pos);
void vdec_InitIDCT ( vdec_thread_t * p_vdec );
void vdec_IDCT ( vdec_thread_t * p_vdec, dctelem_t * p_block,
int i_idontcare );
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* idct_common.c : common IDCT functions * idct_common.c : common IDCT functions
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN * Copyright (C) 1999, 2000 VideoLAN
* $Id: idct_common.c,v 1.2 2001/01/15 06:18:23 sam Exp $ * $Id: idct_common.c,v 1.3 2001/01/17 18:17:30 massiot Exp $
* *
* Authors: Gal Hendryckx <jimmy@via.ecp.fr> * Authors: Gal Hendryckx <jimmy@via.ecp.fr>
* *
...@@ -40,8 +40,23 @@ ...@@ -40,8 +40,23 @@
#include "idct.h" #include "idct.h"
void vdec_SparseIDCT ( vdec_thread_t * p_vdec, dctelem_t * p_block, /*****************************************************************************
int i_sparse_pos); * vdec_InitIDCT : initialize datas for vdec_SparseIDCT
*****************************************************************************/
void vdec_InitIDCT (vdec_thread_t * p_vdec)
{
int i;
dctelem_t * p_pre = p_vdec->p_pre_idct;
memset( p_pre, 0, 64*64*sizeof(dctelem_t) );
for( i=0 ; i < 64 ; i++ )
{
p_pre[i*64+i] = 1 << SPARSE_SCALE_FACTOR;
vdec_IDCT( p_vdec, &p_pre[i*64], 0) ;
}
return;
}
/***************************************************************************** /*****************************************************************************
* vdec_SparseIDCT : IDCT function for sparse matrices * vdec_SparseIDCT : IDCT function for sparse matrices
......
/*****************************************************************************
* idct_mmxext.c : MMX EXT IDCT functions
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: idct_mmxext.c,v 1.1 2001/01/16 13:26:46 sam Exp $
*
* Authors:
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
/*****************************************************************************
* Preamble
*****************************************************************************/
#include "defs.h"
#include <stdlib.h>
#include "config.h"
#include "common.h"
#include "threads.h"
#include "mtime.h"
#include "tests.h"
#include "video.h"
#include "video_output.h"
#include "video_decoder.h"
#include "idct.h"
/*****************************************************************************
* Local and extern prototypes.
*****************************************************************************/
void vdec_InitIDCT ( vdec_thread_t * p_vdec);
void vdec_SparseIDCT ( vdec_thread_t * p_vdec, dctelem_t * p_block,
int i_sparse_pos);
void vdec_IDCT ( vdec_thread_t * p_vdec, dctelem_t * p_block,
int i_idontcare );
/*****************************************************************************
* vdec_InitIDCT : initialize datas for vdec_SparseIDCT
*****************************************************************************/
void vdec_InitIDCT (vdec_thread_t * p_vdec)
{
return;
}
/*****************************************************************************
* vdec_IDCT : IDCT function for normal matrices
*****************************************************************************/
void vdec_IDCT( vdec_thread_t * p_vdec, dctelem_t * p_block,
int i_idontcare )
{
return;
}
/*****************************************************************************
* vdec_SparseIDCT : IDCT function for sparse matrices
*****************************************************************************/
void vdec_SparseIDCT( vdec_thread_t * p_vdec, dctelem_t * p_block,
int i_sparse_pos )
{
return;
}
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* idctclassic.c : Classic IDCT module * idctclassic.c : Classic IDCT module
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN * Copyright (C) 1999, 2000 VideoLAN
* $Id: idctclassic.c,v 1.4 2001/01/16 05:04:25 sam Exp $ * $Id: idctclassic.c,v 1.5 2001/01/17 18:17:30 massiot Exp $
* *
* Authors: Gaël Hendryckx <jimmy@via.ecp.fr> * Authors: Gaël Hendryckx <jimmy@via.ecp.fr>
* *
...@@ -50,13 +50,8 @@ ...@@ -50,13 +50,8 @@
* Local and extern prototypes. * Local and extern prototypes.
*****************************************************************************/ *****************************************************************************/
static void idct_getfunctions( function_list_t * p_function_list ); static void idct_getfunctions( function_list_t * p_function_list );
static int idct_Probe ( probedata_t *p_data ); static int idct_Probe ( probedata_t *p_data );
static void vdec_InitIDCT ( vdec_thread_t * p_vdec); static void vdec_NormScan ( u8 ppi_scan[2][64] );
void vdec_SparseIDCT ( vdec_thread_t * p_vdec, dctelem_t * p_block,
int i_sparse_pos);
static void vdec_IDCT ( vdec_thread_t * p_vdec, dctelem_t * p_block,
int i_idontcare );
/***************************************************************************** /*****************************************************************************
...@@ -136,6 +131,7 @@ static void idct_getfunctions( function_list_t * p_function_list ) ...@@ -136,6 +131,7 @@ static void idct_getfunctions( function_list_t * p_function_list )
p_function_list->functions.idct.pf_init = vdec_InitIDCT; p_function_list->functions.idct.pf_init = vdec_InitIDCT;
p_function_list->functions.idct.pf_sparse_idct = vdec_SparseIDCT; p_function_list->functions.idct.pf_sparse_idct = vdec_SparseIDCT;
p_function_list->functions.idct.pf_idct = vdec_IDCT; p_function_list->functions.idct.pf_idct = vdec_IDCT;
p_function_list->functions.idct.pf_norm_scan = vdec_NormScan;
} }
/***************************************************************************** /*****************************************************************************
...@@ -153,28 +149,17 @@ static int idct_Probe( probedata_t *p_data ) ...@@ -153,28 +149,17 @@ static int idct_Probe( probedata_t *p_data )
} }
/***************************************************************************** /*****************************************************************************
* vdec_InitIDCT : initialize datas for vdec_SparseIDCT * vdec_NormScan : Unused in this IDCT
*****************************************************************************/ *****************************************************************************/
static void vdec_InitIDCT (vdec_thread_t * p_vdec) static void vdec_NormScan( u8 ppi_scan[2][64] )
{ {
int i;
dctelem_t * p_pre = p_vdec->p_pre_idct;
memset( p_pre, 0, 64*64*sizeof(dctelem_t) );
for( i=0 ; i < 64 ; i++ )
{
p_pre[i*64+i] = 1 << SPARSE_SCALE_FACTOR;
vdec_IDCT( p_vdec, &p_pre[i*64], 0) ;
}
return;
} }
/***************************************************************************** /*****************************************************************************
* vdec_IDCT : IDCT function for normal matrices * vdec_IDCT : IDCT function for normal matrices
*****************************************************************************/ *****************************************************************************/
static void vdec_IDCT( vdec_thread_t * p_vdec, dctelem_t * p_block, void vdec_IDCT( vdec_thread_t * p_vdec, dctelem_t * p_block,
int i_idontcare ) int i_idontcare )
{ {
/* dct classique: pour tester la meilleure entre la classique et la */ /* dct classique: pour tester la meilleure entre la classique et la */
/* no classique */ /* no classique */
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* vdec_idct.h : types for the inverse discrete cosine transform * vdec_idct.h : types for the inverse discrete cosine transform
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN * Copyright (C) 1999, 2000 VideoLAN
* $Id: vdec_idct.h,v 1.3 2001/01/13 12:57:47 sam Exp $ * $Id: vdec_idct.h,v 1.4 2001/01/17 18:17:30 massiot Exp $
* *
* Authors: Gaël Hendryckx <jimmy@via.ecp.fr> * Authors: Gaël Hendryckx <jimmy@via.ecp.fr>
* Christophe Massiot <massiot@via.ecp.fr> * Christophe Massiot <massiot@via.ecp.fr>
...@@ -26,4 +26,4 @@ struct vdec_thread_s; ...@@ -26,4 +26,4 @@ struct vdec_thread_s;
typedef void ( *idct_init_t ) ( struct vdec_thread_s * ); typedef void ( *idct_init_t ) ( struct vdec_thread_s * );
typedef void ( *f_idct_t ) ( struct vdec_thread_s *, dctelem_t*, int ); typedef void ( *f_idct_t ) ( struct vdec_thread_s *, dctelem_t*, int );
typedef void ( *norm_scan_t ) ( u8 ppi_scan[2][64] );
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* video_parser.h : video parser thread * video_parser.h : video parser thread
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN * Copyright (C) 1999, 2000 VideoLAN
* $Id: video_parser.h,v 1.4 2001/01/15 13:25:09 massiot Exp $ * $Id: video_parser.h,v 1.5 2001/01/17 18:17:30 massiot Exp $
* *
* Authors: Christophe Massiot <massiot@via.ecp.fr> * Authors: Christophe Massiot <massiot@via.ecp.fr>
* *
...@@ -125,14 +125,20 @@ typedef struct vpar_thread_s ...@@ -125,14 +125,20 @@ typedef struct vpar_thread_s
lookup_t * pl_coded_pattern; lookup_t * pl_coded_pattern;
/* variable length codes for the structure dct_dc_size for intra blocks */ /* variable length codes for the structure dct_dc_size for intra blocks */
lookup_t * pppl_dct_dc_size[2][2]; lookup_t * pppl_dct_dc_size[2][2];
/* Structure to store the tables B14 & B15 (ISO/CEI 13818-2 B.4) */ /* Structure to store the tables B14 & B15 (ISO/IEC 13818-2 B.4) */
dct_lookup_t ppl_dct_coef[2][16384]; dct_lookup_t ppl_dct_coef[2][16384];
/* Scan table */
u8 ppi_scan[2][64];
/* Default quantization matrices */
u8 pi_default_intra_quant[64];
u8 pi_default_nonintra_quant[64];
/* IDCT plugin used and shortcuts to access its capabilities */ /* IDCT plugin used and shortcuts to access its capabilities */
struct module_s * p_module; struct module_s * p_module;
idct_init_t pf_init; idct_init_t pf_init;
f_idct_t pf_sparse_idct; f_idct_t pf_sparse_idct;
f_idct_t pf_idct; f_idct_t pf_idct;
norm_scan_t pf_norm_scan;
#ifdef STATS #ifdef STATS
/* Statistics */ /* Statistics */
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* vpar_blocks.h : video parser blocks management * vpar_blocks.h : video parser blocks management
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN * Copyright (C) 1999, 2000 VideoLAN
* $Id: vpar_blocks.h,v 1.1 2000/12/21 17:19:52 massiot Exp $ * $Id: vpar_blocks.h,v 1.2 2001/01/17 18:17:30 massiot Exp $
* *
* Authors: Christophe Massiot <massiot@via.ecp.fr> * Authors: Christophe Massiot <massiot@via.ecp.fr>
* Jean-Marc Dressler <polux@via.ecp.fr> * Jean-Marc Dressler <polux@via.ecp.fr>
...@@ -157,8 +157,8 @@ typedef struct dct_lookup_s ...@@ -157,8 +157,8 @@ typedef struct dct_lookup_s
/***************************************************************************** /*****************************************************************************
* Constants * Constants
*****************************************************************************/ *****************************************************************************/
extern int pi_default_intra_quant[]; extern u8 pi_default_intra_quant[64];
extern int pi_default_nonintra_quant[]; extern u8 pi_default_nonintra_quant[64];
extern u8 pi_scan[2][64]; extern u8 pi_scan[2][64];
/***************************************************************************** /*****************************************************************************
...@@ -170,4 +170,5 @@ void vpar_InitPMBType( struct vpar_thread_s * p_vpar ); ...@@ -170,4 +170,5 @@ void vpar_InitPMBType( struct vpar_thread_s * p_vpar );
void vpar_InitBMBType( struct vpar_thread_s * p_vpar ); void vpar_InitBMBType( struct vpar_thread_s * p_vpar );
void vpar_InitCodedPattern( struct vpar_thread_s * p_vpar ); void vpar_InitCodedPattern( struct vpar_thread_s * p_vpar );
void vpar_InitDCTTables( struct vpar_thread_s * p_vpar ); void vpar_InitDCTTables( struct vpar_thread_s * p_vpar );
void vpar_InitScanTable( struct vpar_thread_s * p_vpar );
void vpar_PictureData( struct vpar_thread_s * p_vpar, int i_mb_base ); void vpar_PictureData( struct vpar_thread_s * p_vpar, int i_mb_base );
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* vpar_headers.h : video parser : headers parsing * vpar_headers.h : video parser : headers parsing
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN * Copyright (C) 1999, 2000 VideoLAN
* $Id: vpar_headers.h,v 1.3 2001/01/15 18:02:48 massiot Exp $ * $Id: vpar_headers.h,v 1.4 2001/01/17 18:17:30 massiot Exp $
* *
* Authors: Christophe Massiot <massiot@via.ecp.fr> * Authors: Christophe Massiot <massiot@via.ecp.fr>
* Stphane Borel <stef@via.ecp.fr> * Stphane Borel <stef@via.ecp.fr>
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
*****************************************************************************/ *****************************************************************************/
typedef struct quant_matrix_s typedef struct quant_matrix_s
{ {
int * pi_matrix; u8 * pi_matrix;
boolean_t b_allocated; boolean_t b_allocated;
/* Has the matrix been allocated by vpar_headers ? */ /* Has the matrix been allocated by vpar_headers ? */
} quant_matrix_t; } quant_matrix_t;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* video_parser.c : video parser thread * video_parser.c : video parser thread
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN * Copyright (C) 1999, 2000 VideoLAN
* $Id: video_parser.c,v 1.67 2001/01/15 13:25:09 massiot Exp $ * $Id: video_parser.c,v 1.68 2001/01/17 18:17:31 massiot Exp $
* *
* Authors: Christophe Massiot <massiot@via.ecp.fr> * Authors: Christophe Massiot <massiot@via.ecp.fr>
* Samuel Hocevar <sam@via.ecp.fr> * Samuel Hocevar <sam@via.ecp.fr>
...@@ -116,6 +116,7 @@ vlc_thread_t vpar_CreateThread( vdec_config_t * p_config ) ...@@ -116,6 +116,7 @@ vlc_thread_t vpar_CreateThread( vdec_config_t * p_config )
p_vpar->pf_init = idct_functions.pf_init; p_vpar->pf_init = idct_functions.pf_init;
p_vpar->pf_sparse_idct = idct_functions.pf_sparse_idct; p_vpar->pf_sparse_idct = idct_functions.pf_sparse_idct;
p_vpar->pf_idct = idct_functions.pf_idct; p_vpar->pf_idct = idct_functions.pf_idct;
p_vpar->pf_norm_scan = idct_functions.pf_norm_scan;
#undef idct_functions #undef idct_functions
/* Spawn the video parser thread */ /* Spawn the video parser thread */
...@@ -228,6 +229,7 @@ static int InitThread( vpar_thread_t *p_vpar ) ...@@ -228,6 +229,7 @@ static int InitThread( vpar_thread_t *p_vpar )
vpar_InitPMBType( p_vpar ); vpar_InitPMBType( p_vpar );
vpar_InitBMBType( p_vpar ); vpar_InitBMBType( p_vpar );
vpar_InitDCTTables( p_vpar ); vpar_InitDCTTables( p_vpar );
vpar_InitScanTable( p_vpar );
/* /*
* Initialize the synchro properties * Initialize the synchro properties
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* vpar_blocks.c : blocks parsing * vpar_blocks.c : blocks parsing
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN * Copyright (C) 1999, 2000 VideoLAN
* $Id: vpar_blocks.c,v 1.70 2001/01/13 12:57:21 sam Exp $ * $Id: vpar_blocks.c,v 1.71 2001/01/17 18:17:31 massiot Exp $
* *
* Authors: Christophe Massiot <massiot@via.ecp.fr> * Authors: Christophe Massiot <massiot@via.ecp.fr>
* Jean-Marc Dressler <polux@via.ecp.fr> * Jean-Marc Dressler <polux@via.ecp.fr>
...@@ -609,6 +609,26 @@ void vpar_InitDCTTables( vpar_thread_t * p_vpar ) ...@@ -609,6 +609,26 @@ void vpar_InitDCTTables( vpar_thread_t * p_vpar )
FillDCTTable( p_vpar->ppl_dct_coef[1], pl_DCT_tab6, 1, 16, 16 ); FillDCTTable( p_vpar->ppl_dct_coef[1], pl_DCT_tab6, 1, 16, 16 );
} }
/*****************************************************************************
* vpar_InitScanTable : Initialize scan table
*****************************************************************************/
void vpar_InitScanTable( vpar_thread_t * p_vpar )
{
int i;
memcpy( p_vpar->ppi_scan, pi_scan, sizeof(pi_scan) );
p_vpar->pf_norm_scan( p_vpar->ppi_scan );
/* If scan table has changed, we must change the quantization matrices. */
for( i = 0; i < 64; i++ )
{
p_vpar->pi_default_intra_quant[ p_vpar->ppi_scan[0][i] ] =
pi_default_intra_quant[ pi_scan[0][i] ];
p_vpar->pi_default_nonintra_quant[ p_vpar->ppi_scan[0][i] ] =
pi_default_nonintra_quant[ pi_scan[0][i] ];
}
}
/* /*
* Block parsing * Block parsing
...@@ -686,11 +706,6 @@ static __inline__ void DecodeMPEG1NonIntra( vpar_thread_t * p_vpar, ...@@ -686,11 +706,6 @@ static __inline__ void DecodeMPEG1NonIntra( vpar_thread_t * p_vpar,
break; break;
case DCT_EOB: case DCT_EOB:
#ifdef HAVE_MMX
/* The MMX IDCT has a precision problem with non-intra
* blocks. */
p_mb->ppi_blocks[i_b][0] += 4;
#endif
if( i_nc <= 1 ) if( i_nc <= 1 )
{ {
p_mb->pf_idct[i_b] = p_vpar->pf_sparse_idct; p_mb->pf_idct[i_b] = p_vpar->pf_sparse_idct;
...@@ -715,7 +730,7 @@ static __inline__ void DecodeMPEG1NonIntra( vpar_thread_t * p_vpar, ...@@ -715,7 +730,7 @@ static __inline__ void DecodeMPEG1NonIntra( vpar_thread_t * p_vpar,
break; break;
} }
i_pos = pi_scan[p_vpar->picture.b_alternate_scan][i_parse]; i_pos = p_vpar->ppi_scan[p_vpar->picture.b_alternate_scan][i_parse];
i_level = ( ((i_level << 1) + 1) * p_vpar->mb.i_quantizer_scale i_level = ( ((i_level << 1) + 1) * p_vpar->mb.i_quantizer_scale
* p_vpar->sequence.nonintra_quant.pi_matrix[i_pos] ) >> 4; * p_vpar->sequence.nonintra_quant.pi_matrix[i_pos] ) >> 4;
...@@ -870,7 +885,7 @@ static __inline__ void DecodeMPEG1Intra( vpar_thread_t * p_vpar, ...@@ -870,7 +885,7 @@ static __inline__ void DecodeMPEG1Intra( vpar_thread_t * p_vpar,
} }
/* Determine the position of the block in the frame */ /* Determine the position of the block in the frame */
i_pos = pi_scan[p_vpar->picture.b_alternate_scan][i_parse]; i_pos = p_vpar->ppi_scan[p_vpar->picture.b_alternate_scan][i_parse];
i_level = ( i_level * i_level = ( i_level *
p_vpar->mb.i_quantizer_scale * p_vpar->mb.i_quantizer_scale *
p_vpar->sequence.intra_quant.pi_matrix[i_pos] ) >> 3; p_vpar->sequence.intra_quant.pi_matrix[i_pos] ) >> 3;
...@@ -908,7 +923,7 @@ static __inline__ void DecodeMPEG2NonIntra( vpar_thread_t * p_vpar, ...@@ -908,7 +923,7 @@ static __inline__ void DecodeMPEG2NonIntra( vpar_thread_t * p_vpar,
boolean_t b_dc; boolean_t b_dc;
boolean_t b_sign; boolean_t b_sign;
boolean_t b_chroma; boolean_t b_chroma;
int * pi_quant; u8 * pi_quant;
/* Give the chromatic component (0, 1, 2) */ /* Give the chromatic component (0, 1, 2) */
i_cc = pi_cc_index[i_b]; i_cc = pi_cc_index[i_b];
...@@ -988,7 +1003,7 @@ static __inline__ void DecodeMPEG2NonIntra( vpar_thread_t * p_vpar, ...@@ -988,7 +1003,7 @@ static __inline__ void DecodeMPEG2NonIntra( vpar_thread_t * p_vpar,
break; break;
} }
i_pos = pi_scan[p_vpar->picture.b_alternate_scan][i_parse]; i_pos = p_vpar->ppi_scan[p_vpar->picture.b_alternate_scan][i_parse];
i_level = ( ((i_level << 1) + 1) * p_vpar->mb.i_quantizer_scale i_level = ( ((i_level << 1) + 1) * p_vpar->mb.i_quantizer_scale
* pi_quant[i_pos] ) >> 5; * pi_quant[i_pos] ) >> 5;
p_mb->ppi_blocks[i_b][i_pos] = b_sign ? -i_level : i_level; p_mb->ppi_blocks[i_b][i_pos] = b_sign ? -i_level : i_level;
...@@ -1019,7 +1034,7 @@ static __inline__ void DecodeMPEG2Intra( vpar_thread_t * p_vpar, ...@@ -1019,7 +1034,7 @@ static __inline__ void DecodeMPEG2Intra( vpar_thread_t * p_vpar,
boolean_t b_vlc_intra; boolean_t b_vlc_intra;
boolean_t b_sign; boolean_t b_sign;
boolean_t b_chroma; boolean_t b_chroma;
int * pi_quant; u8 * pi_quant;
/* Give the chromatic component (0, 1, 2) */ /* Give the chromatic component (0, 1, 2) */
i_cc = pi_cc_index[i_b]; i_cc = pi_cc_index[i_b];
...@@ -1132,7 +1147,7 @@ static __inline__ void DecodeMPEG2Intra( vpar_thread_t * p_vpar, ...@@ -1132,7 +1147,7 @@ static __inline__ void DecodeMPEG2Intra( vpar_thread_t * p_vpar,
} }
/* Determine the position of the block in the frame */ /* Determine the position of the block in the frame */
i_pos = pi_scan[p_vpar->picture.b_alternate_scan][i_parse]; i_pos = p_vpar->ppi_scan[p_vpar->picture.b_alternate_scan][i_parse];
i_level = ( i_level * i_level = ( i_level *
p_vpar->mb.i_quantizer_scale * p_vpar->mb.i_quantizer_scale *
pi_quant[i_pos] ) >> 4; pi_quant[i_pos] ) >> 4;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* vpar_headers.c : headers parsing * vpar_headers.c : headers parsing
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN * Copyright (C) 1999, 2000 VideoLAN
* $Id: vpar_headers.c,v 1.72 2001/01/16 18:06:01 massiot Exp $ * $Id: vpar_headers.c,v 1.73 2001/01/17 18:17:31 massiot Exp $
* *
* Authors: Christophe Massiot <massiot@via.ecp.fr> * Authors: Christophe Massiot <massiot@via.ecp.fr>
* Stphane Borel <stef@via.ecp.fr> * Stphane Borel <stef@via.ecp.fr>
...@@ -76,8 +76,7 @@ static void CopyrightExtension( vpar_thread_t * p_vpar ); ...@@ -76,8 +76,7 @@ static void CopyrightExtension( vpar_thread_t * p_vpar );
/***************************************************************************** /*****************************************************************************
* pi_default_intra_quant : default quantization matrix * pi_default_intra_quant : default quantization matrix
*****************************************************************************/ *****************************************************************************/
#ifndef VDEC_DFT u8 pi_default_intra_quant[] =
int pi_default_intra_quant[] =
{ {
8, 16, 19, 22, 26, 27, 29, 34, 8, 16, 19, 22, 26, 27, 29, 34,
16, 16, 22, 24, 27, 29, 34, 37, 16, 16, 22, 24, 27, 29, 34, 37,
...@@ -88,25 +87,11 @@ int pi_default_intra_quant[] = ...@@ -88,25 +87,11 @@ int pi_default_intra_quant[] =
26, 27, 29, 34, 38, 46, 56, 69, 26, 27, 29, 34, 38, 46, 56, 69,
27, 29, 35, 38, 46, 56, 69, 83 27, 29, 35, 38, 46, 56, 69, 83
}; };
#else
int pi_default_intra_quant[] =
{
2048, 5681, 6355, 6623, 6656, 5431, 4018, 2401,
5681, 7880, 10207, 10021, 9587, 8091, 6534, 3625,
6355, 10207, 11363, 10619, 9700, 8935, 6155, 3507,
6623, 9186, 10226, 9557, 8730, 8041, 6028, 3322,
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
};
#endif
/***************************************************************************** /*****************************************************************************
* pi_default_nonintra_quant : default quantization matrix * pi_default_nonintra_quant : default quantization matrix
*****************************************************************************/ *****************************************************************************/
#ifndef VDEC_DFT u8 pi_default_nonintra_quant[] =
int pi_default_nonintra_quant[] =
{ {
16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
...@@ -117,19 +102,6 @@ int pi_default_nonintra_quant[] = ...@@ -117,19 +102,6 @@ int pi_default_nonintra_quant[] =
16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
16, 16, 16, 16, 16, 16, 16, 16 16, 16, 16, 16, 16, 16, 16, 16
}; };
#else
int pi_default_nonintra_quanit[] =
{
4096, 5680, 5344, 4816, 4096, 3216, 2224, 1136,
5680, 7888, 7424, 6688, 5680, 4464, 3072, 1568,
5344, 7424, 6992, 6288, 5344, 4208, 2896, 1472,
4816, 6688, 6288, 5664, 4816, 3792, 2608, 1328,
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
};
#endif
/***************************************************************************** /*****************************************************************************
* pi_scan : zig-zag and alternate scan patterns * pi_scan : zig-zag and alternate scan patterns
...@@ -211,14 +183,15 @@ static void __inline__ ReferenceReplace( vpar_thread_t * p_vpar, ...@@ -211,14 +183,15 @@ static void __inline__ ReferenceReplace( vpar_thread_t * p_vpar,
/***************************************************************************** /*****************************************************************************
* LoadMatrix : Load a quantization matrix * LoadMatrix : Load a quantization matrix
*****************************************************************************/ *****************************************************************************/
static __inline__ void LoadMatrix( vpar_thread_t * p_vpar, quant_matrix_t * p_matrix ) static __inline__ void LoadMatrix( vpar_thread_t * p_vpar,
quant_matrix_t * p_matrix )
{ {
int i_dummy; int i_dummy;
if( !p_matrix->b_allocated ) if( !p_matrix->b_allocated )
{ {
/* Allocate a piece of memory to load the matrix. */ /* Allocate a piece of memory to load the matrix. */
if( (p_matrix->pi_matrix = (int *)malloc( 64*sizeof(int) )) == NULL ) if( (p_matrix->pi_matrix = (u8 *)malloc( 64*sizeof(u8) )) == NULL )
{ {
intf_ErrMsg( "vpar error: allocation error in LoadMatrix()" ); intf_ErrMsg( "vpar error: allocation error in LoadMatrix()" );
p_vpar->p_fifo->b_error = 1; p_vpar->p_fifo->b_error = 1;
...@@ -229,7 +202,7 @@ static __inline__ void LoadMatrix( vpar_thread_t * p_vpar, quant_matrix_t * p_ma ...@@ -229,7 +202,7 @@ static __inline__ void LoadMatrix( vpar_thread_t * p_vpar, quant_matrix_t * p_ma
for( i_dummy = 0; i_dummy < 64; i_dummy++ ) for( i_dummy = 0; i_dummy < 64; i_dummy++ )
{ {
p_matrix->pi_matrix[pi_scan[SCAN_ZIGZAG][i_dummy]] p_matrix->pi_matrix[p_vpar->ppi_scan[SCAN_ZIGZAG][i_dummy]]
= GetBits( &p_vpar->bit_stream, 8 ); = GetBits( &p_vpar->bit_stream, 8 );
} }
...@@ -243,7 +216,7 @@ static __inline__ void LoadMatrix( vpar_thread_t * p_vpar, quant_matrix_t * p_ma ...@@ -243,7 +216,7 @@ static __inline__ void LoadMatrix( vpar_thread_t * p_vpar, quant_matrix_t * p_ma
/***************************************************************************** /*****************************************************************************
* LinkMatrix : Link a quantization matrix to another * LinkMatrix : Link a quantization matrix to another
*****************************************************************************/ *****************************************************************************/
static __inline__ void LinkMatrix( quant_matrix_t * p_matrix, int * pi_array ) static __inline__ void LinkMatrix( quant_matrix_t * p_matrix, u8 * pi_array )
{ {
if( p_matrix->b_allocated ) if( p_matrix->b_allocated )
{ {
...@@ -366,7 +339,8 @@ static void SequenceHeader( vpar_thread_t * p_vpar ) ...@@ -366,7 +339,8 @@ static void SequenceHeader( vpar_thread_t * p_vpar )
else else
{ {
/* Use default matrix. */ /* Use default matrix. */
LinkMatrix( &p_vpar->sequence.intra_quant, pi_default_intra_quant ); LinkMatrix( &p_vpar->sequence.intra_quant,
p_vpar->pi_default_intra_quant );
} }
if( GetBits( &p_vpar->bit_stream, 1 ) ) /* load_non_intra_quantizer_matrix */ if( GetBits( &p_vpar->bit_stream, 1 ) ) /* load_non_intra_quantizer_matrix */
...@@ -376,7 +350,8 @@ static void SequenceHeader( vpar_thread_t * p_vpar ) ...@@ -376,7 +350,8 @@ static void SequenceHeader( vpar_thread_t * p_vpar )
else else
{ {
/* Use default matrix. */ /* Use default matrix. */
LinkMatrix( &p_vpar->sequence.nonintra_quant, pi_default_nonintra_quant ); LinkMatrix( &p_vpar->sequence.nonintra_quant,
p_vpar->pi_default_nonintra_quant );
} }
/* Unless later overwritten by a matrix extension, we have the same /* Unless later overwritten by a matrix extension, we have the same
...@@ -905,7 +880,7 @@ static void QuantMatrixExtension( vpar_thread_t * p_vpar ) ...@@ -905,7 +880,7 @@ static void QuantMatrixExtension( vpar_thread_t * p_vpar )
{ {
/* Use the default matrix. */ /* Use the default matrix. */
LinkMatrix( &p_vpar->sequence.intra_quant, LinkMatrix( &p_vpar->sequence.intra_quant,
pi_default_intra_quant ); p_vpar->pi_default_intra_quant );
} }
if( GetBits( &p_vpar->bit_stream, 1 ) ) if( GetBits( &p_vpar->bit_stream, 1 ) )
{ {
...@@ -916,7 +891,7 @@ static void QuantMatrixExtension( vpar_thread_t * p_vpar ) ...@@ -916,7 +891,7 @@ static void QuantMatrixExtension( vpar_thread_t * p_vpar )
{ {
/* Use the default matrix. */ /* Use the default matrix. */
LinkMatrix( &p_vpar->sequence.nonintra_quant, LinkMatrix( &p_vpar->sequence.nonintra_quant,
pi_default_nonintra_quant ); p_vpar->pi_default_nonintra_quant );
} }
if( GetBits( &p_vpar->bit_stream, 1 ) ) if( GetBits( &p_vpar->bit_stream, 1 ) )
{ {
......
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