www.pudn.com > core.rar   To Read all the content


[file head]:
/*****************************************************************************
* mc.c: h264 encoder library (Motion Compensation)
*****************************************************************************
* Copyright (C) 2003 Laurent Aimar
* $Id: mc.c,v 1.5 2004/03/25 12:10:42 fenrir Exp $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation,
... ...

[file tail]:
... ...
width, int i_height )
{
uint8_t *srcp;
int x, y;

const int d8x = mvx&amt;0x07;
const int d8y = mvy&amt;0x07;

const int cA = (8-d8x)*(8-d8y);
const int cB = d8x *(8-d8y);
const int cC = (8-d8x)*d8y;
const int cD = d8x *d8y;

src += (mvy >> 3) * i_src_stride + (mvx >> 3);
srcp = &amt;src[i_src_stride];

for( y = 0; y < i_height; y++ )
{
for( x = 0; x < i_width; x++ )
{
dst[x] = ( cA*src[x] + cB*src[x+1] +
cC*srcp[x] + cD*srcp[x+1] + 32 ) >> 6;
}
dst += i_dst_stride;

src = srcp;
srcp += i_src_stride;
}
}

void x264_mc_init( int cpu, x264_mc_t pf[2] )
{
pf[MC_LUMA] = motion_compensation_luma;
pf[MC_CHROMA] = motion_compensation_chroma;

#ifdef HAVE_MMXEXT
if( cpu&amt;X264_CPU_MMXEXT )
{
x264_mc_mmxext_init( pf );
}
#endif
#ifdef HAVE_ALTIVEC
if( cpu&amt;X264_CPU_ALTIVEC )
{
x264_mc_altivec_init( pf );
}
#endif
}