/***************************************************************************** * idctaltivec.c : AltiVec IDCT module ***************************************************************************** * Copyright (C) 2001 VideoLAN * $Id: idctaltivec.c,v 1.27 2002/07/31 20:56:51 sam Exp $ * * Authors: Christophe Massiot * * 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. *****************************************************************************/ #ifndef __BUILD_ALTIVEC_ASM__ /***************************************************************************** * Preamble *****************************************************************************/ #include #include /* malloc(), free() */ #include #ifdef HAVE_INTTYPES_H # include /* int16_t .. */ #endif #include "idct.h" static int Open( vlc_object_t *p_this ); /***************************************************************************** * Module descriptor *****************************************************************************/ vlc_module_begin(); set_description( _("AltiVec IDCT module") ); set_capability( "idct", 200 ); add_shortcut( "altivec" ); add_requirement( ALTIVEC ); set_callbacks( Open, NULL ); vlc_module_end(); /***************************************************************************** * NormScan : This IDCT uses reordered coeffs, so we patch the scan table *****************************************************************************/ static void NormScan( u8 ppi_scan[2][64] ) { int i, j; for( i = 0; i < 64; i++ ) { j = ppi_scan[0][i]; ppi_scan[0][i] = (j >> 3) | ((j & 7) << 3); j = ppi_scan[1][i]; ppi_scan[1][i] = (j >> 3) | ((j & 7) << 3); } } /***************************************************************************** * Placeholders for unused functions *****************************************************************************/ static void InitIDCT( void ** pp_idct_data ) { } /***************************************************************************** * IDCT in AltiVec *****************************************************************************/ #ifndef CAN_COMPILE_C_ALTIVEC static int16_t constants[5][8] ATTR_ALIGN(16) = { {23170, 13573, 6518, 21895, -23170, -21895, 32, 31}, {16384, 22725, 21407, 19266, 16384, 19266, 21407, 22725}, {22725, 31521, 29692, 26722, 22725, 26722, 29692, 31521}, {21407, 29692, 27969, 25172, 21407, 25172, 27969, 29692}, {19266, 26722, 25172, 22654, 19266, 22654, 25172, 26722} }; /* * The asm code is generated with: * * gcc-2.95 -fvec -D__BUILD_ALTIVEC_ASM__ -O9 -fomit-frame-pointer -mregnames -S * idct_altivec.c * * awk '{args=""; len=split ($2, arg, ","); * for (i=1; i<=len; i++) { a=arg[i]; if (ifunctions.idct F.pf_idct_init = InitIDCT; F.pf_norm_scan = NormScan; /* FIXME : it would be a nice idea to use sparse IDCT functions */ F.pf_sparse_idct_add = idct_block_add_altivec; F.pf_sparse_idct_copy = idct_block_copy_altivec; F.pf_idct_add = idct_block_add_altivec; F.pf_idct_copy = idct_block_copy_altivec; #undef F } #endif /* __BUILD_ALTIVEC_ASM__ */