2004-04-23 23:38:54 +00:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2003 David S. Miller <davem@redhat.com>
|
|
|
|
*
|
2006-10-07 15:30:46 +00:00
|
|
|
* This file is part of FFmpeg.
|
2004-04-23 23:38:54 +00:00
|
|
|
*
|
2006-10-11 07:47:59 +00:00
|
|
|
* FFmpeg is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
2004-04-23 23:38:54 +00:00
|
|
|
*
|
2006-10-07 15:30:46 +00:00
|
|
|
* FFmpeg is distributed in the hope that it will be useful,
|
2004-04-23 23:38:54 +00:00
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
2006-10-11 07:47:59 +00:00
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
2004-04-23 23:38:54 +00:00
|
|
|
*
|
2006-10-11 07:47:59 +00:00
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with FFmpeg; if not, write to the Free Software
|
2006-01-12 22:43:26 +00:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
2004-04-23 23:38:54 +00:00
|
|
|
*/
|
|
|
|
|
2004-04-24 15:23:50 +00:00
|
|
|
/* The *no_round* functions have been added by James A. Morrison, 2003,2004.
|
2011-10-30 17:02:42 +00:00
|
|
|
The vis code from libmpeg2 was adapted for libavcodec by James A. Morrison.
|
2004-04-23 23:38:54 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
|
|
|
#include <inttypes.h>
|
|
|
|
|
2013-02-01 09:31:59 +00:00
|
|
|
#include "libavutil/attributes.h"
|
2008-05-09 11:56:36 +00:00
|
|
|
#include "libavcodec/dsputil.h"
|
2012-08-16 07:22:31 +00:00
|
|
|
#include "libavutil/mem.h"
|
2010-03-10 22:24:42 +00:00
|
|
|
#include "dsputil_vis.h"
|
2004-04-23 23:38:54 +00:00
|
|
|
|
|
|
|
#include "vis.h"
|
|
|
|
|
2004-04-24 15:23:50 +00:00
|
|
|
#define ACCEL_SPARC_VIS 1
|
|
|
|
#define ACCEL_SPARC_VIS2 2
|
|
|
|
|
2009-01-30 18:38:25 +00:00
|
|
|
static int vis_level(void)
|
2004-04-24 15:23:50 +00:00
|
|
|
{
|
2007-10-02 19:51:18 +00:00
|
|
|
int accel = 0;
|
2004-04-24 15:23:50 +00:00
|
|
|
accel |= ACCEL_SPARC_VIS;
|
|
|
|
accel |= ACCEL_SPARC_VIS2;
|
|
|
|
return accel;
|
|
|
|
}
|
|
|
|
|
2004-04-23 23:38:54 +00:00
|
|
|
/* libavcodec initialization code */
|
2013-02-01 09:31:59 +00:00
|
|
|
av_cold void ff_dsputil_init_vis(DSPContext *c, AVCodecContext *avctx)
|
2004-04-23 23:38:54 +00:00
|
|
|
{
|
2007-12-02 15:43:08 +00:00
|
|
|
/* VIS-specific optimizations */
|
2004-04-24 15:23:50 +00:00
|
|
|
int accel = vis_level ();
|
2013-03-14 11:21:43 +00:00
|
|
|
const int high_bit_depth = avctx->bits_per_raw_sample > 8;
|
2004-04-24 15:23:50 +00:00
|
|
|
|
2013-02-15 01:13:42 +00:00
|
|
|
if (accel & ACCEL_SPARC_VIS && !high_bit_depth) {
|
|
|
|
if (avctx->idct_algo == FF_IDCT_SIMPLEVIS) {
|
2007-08-30 19:18:23 +00:00
|
|
|
c->idct_put = ff_simple_idct_put_vis;
|
|
|
|
c->idct_add = ff_simple_idct_add_vis;
|
|
|
|
c->idct = ff_simple_idct_vis;
|
|
|
|
c->idct_permutation_type = FF_TRANSPOSE_IDCT_PERM;
|
|
|
|
}
|
2004-04-24 15:23:50 +00:00
|
|
|
}
|
2004-04-23 23:38:54 +00:00
|
|
|
}
|