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