2002-11-02 12:28:08 +01:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2002 Brian Foley
|
|
|
|
* Copyright (c) 2002 Dieter Shirley
|
2004-04-20 19:05:12 +02:00
|
|
|
* Copyright (c) 2003-2004 Romain Dolbeau <romain@dolbeau.org>
|
2002-11-02 12:28:08 +01:00
|
|
|
*
|
2006-10-07 17:30:46 +02:00
|
|
|
* This file is part of FFmpeg.
|
|
|
|
*
|
|
|
|
* FFmpeg is free software; you can redistribute it and/or
|
2002-11-02 12:28:08 +01:00
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
2006-10-07 17:30:46 +02:00
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
2002-11-02 12:28:08 +01:00
|
|
|
*
|
2006-10-07 17:30:46 +02:00
|
|
|
* FFmpeg is distributed in the hope that it will be useful,
|
2002-11-02 12:28:08 +01:00
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
2006-10-07 17:30:46 +02:00
|
|
|
* License along with FFmpeg; if not, write to the Free Software
|
2006-01-12 23:43:26 +01:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
2002-11-02 12:28:08 +01:00
|
|
|
*/
|
|
|
|
|
2012-08-15 22:27:52 +02:00
|
|
|
#include <string.h>
|
|
|
|
|
2013-02-01 10:31:59 +01:00
|
|
|
#include "libavutil/attributes.h"
|
2010-09-08 17:07:14 +02:00
|
|
|
#include "libavutil/cpu.h"
|
2013-08-20 16:36:47 +02:00
|
|
|
#include "libavutil/ppc/cpu.h"
|
2014-01-17 17:38:05 +01:00
|
|
|
#include "libavcodec/avcodec.h"
|
|
|
|
#include "libavcodec/dsputil.h"
|
2002-09-02 10:48:12 +02:00
|
|
|
#include "dsputil_altivec.h"
|
|
|
|
|
2013-12-30 12:09:03 +01:00
|
|
|
av_cold void ff_dsputil_init_ppc(DSPContext *c, AVCodecContext *avctx,
|
|
|
|
unsigned high_bit_depth)
|
2002-09-02 10:48:12 +02:00
|
|
|
{
|
2011-09-30 02:43:20 +02:00
|
|
|
int mm_flags = av_get_cpu_flags();
|
2013-08-29 14:23:28 +02:00
|
|
|
if (PPC_ALTIVEC(mm_flags)) {
|
2013-12-30 12:09:03 +01:00
|
|
|
ff_dsputil_init_altivec(c, avctx, high_bit_depth);
|
2012-02-15 13:42:56 +01:00
|
|
|
ff_int_init_altivec(c, avctx);
|
|
|
|
c->gmc1 = ff_gmc1_altivec;
|
2003-03-03 15:54:00 +01:00
|
|
|
|
2013-12-30 12:09:03 +01:00
|
|
|
if (!high_bit_depth) {
|
2009-01-14 00:44:16 +01:00
|
|
|
#if CONFIG_ENCODERS
|
2013-12-30 12:09:03 +01:00
|
|
|
if (avctx->dct_algo == FF_DCT_AUTO ||
|
|
|
|
avctx->dct_algo == FF_DCT_ALTIVEC) {
|
|
|
|
c->fdct = ff_fdct_altivec;
|
|
|
|
}
|
2003-10-26 11:14:05 +01:00
|
|
|
#endif //CONFIG_ENCODERS
|
2014-03-20 22:06:01 +01:00
|
|
|
if (avctx->lowres == 0) {
|
2008-07-20 20:58:30 +02:00
|
|
|
if ((avctx->idct_algo == FF_IDCT_AUTO) ||
|
|
|
|
(avctx->idct_algo == FF_IDCT_ALTIVEC)) {
|
2014-06-14 18:32:17 +02:00
|
|
|
c->idct = ff_idct_altivec;
|
2014-01-15 12:07:55 +01:00
|
|
|
c->idct_put = ff_idct_put_altivec;
|
|
|
|
c->idct_add = ff_idct_add_altivec;
|
2008-07-20 20:58:30 +02:00
|
|
|
c->idct_permutation_type = FF_TRANSPOSE_IDCT_PERM;
|
|
|
|
}
|
2014-03-20 22:06:01 +01:00
|
|
|
}
|
2003-03-03 15:54:00 +01:00
|
|
|
}
|
2002-09-02 10:48:12 +02:00
|
|
|
}
|
|
|
|
}
|