2001-08-14 00:38:25 +03:00
|
|
|
/*
|
2008-12-17 02:54:54 +02:00
|
|
|
* ARM optimized DSP utils
|
2009-01-19 17:46:40 +02:00
|
|
|
* Copyright (c) 2001 Lionel Ulmer
|
2001-08-14 00:38:25 +03: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-05-26 01:45:33 +03: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.
|
2001-08-14 00:38:25 +03:00
|
|
|
*
|
2006-10-07 18:30:46 +03:00
|
|
|
* FFmpeg is distributed in the hope that it will be useful,
|
2001-08-14 00:38:25 +03:00
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
2002-05-26 01:45:33 +03:00
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
2001-08-14 00:38:25 +03:00
|
|
|
*
|
2002-05-26 01:45:33 +03:00
|
|
|
* 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
|
2001-08-14 00:38:25 +03:00
|
|
|
*/
|
|
|
|
|
2014-02-12 23:28:44 +03:00
|
|
|
#include <stdint.h>
|
|
|
|
|
2013-02-01 12:31:59 +03:00
|
|
|
#include "libavutil/attributes.h"
|
2014-02-12 23:28:44 +03:00
|
|
|
#include "libavutil/cpu.h"
|
2012-04-21 17:31:10 +03:00
|
|
|
#include "libavutil/arm/cpu.h"
|
2014-02-12 23:28:44 +03:00
|
|
|
#include "libavcodec/avcodec.h"
|
|
|
|
#include "libavcodec/dsputil.h"
|
2009-10-04 16:12:55 +03:00
|
|
|
#include "dsputil_arm.h"
|
2001-08-14 00:38:25 +03:00
|
|
|
|
2013-01-20 03:02:29 +03:00
|
|
|
void ff_j_rev_dct_arm(int16_t *data);
|
|
|
|
void ff_simple_idct_arm(int16_t *data);
|
2001-08-14 00:38:25 +03:00
|
|
|
|
2003-03-03 16:54:00 +02:00
|
|
|
/* XXX: local hack */
|
2013-01-20 03:02:29 +03:00
|
|
|
static void (*ff_put_pixels_clamped)(const int16_t *block, uint8_t *pixels, int line_size);
|
|
|
|
static void (*ff_add_pixels_clamped)(const int16_t *block, uint8_t *pixels, int line_size);
|
2003-03-03 16:54:00 +02:00
|
|
|
|
2013-01-20 03:02:29 +03:00
|
|
|
void ff_add_pixels_clamped_arm(const int16_t *block, uint8_t *dest,
|
2009-10-07 00:55:37 +03:00
|
|
|
int line_size);
|
2005-05-26 17:32:46 +03:00
|
|
|
|
2003-03-03 16:54:00 +02:00
|
|
|
/* XXX: those functions should be suppressed ASAP when all IDCTs are
|
2014-01-30 17:03:55 +03:00
|
|
|
* converted */
|
2013-01-20 03:02:29 +03:00
|
|
|
static void j_rev_dct_arm_put(uint8_t *dest, int line_size, int16_t *block)
|
2003-03-03 16:54:00 +02:00
|
|
|
{
|
2014-01-30 17:03:55 +03:00
|
|
|
ff_j_rev_dct_arm(block);
|
2003-03-03 16:54:00 +02:00
|
|
|
ff_put_pixels_clamped(block, dest, line_size);
|
|
|
|
}
|
2014-01-30 17:03:55 +03:00
|
|
|
|
2013-01-20 03:02:29 +03:00
|
|
|
static void j_rev_dct_arm_add(uint8_t *dest, int line_size, int16_t *block)
|
2003-03-03 16:54:00 +02:00
|
|
|
{
|
2014-01-30 17:03:55 +03:00
|
|
|
ff_j_rev_dct_arm(block);
|
2003-03-03 16:54:00 +02:00
|
|
|
ff_add_pixels_clamped(block, dest, line_size);
|
|
|
|
}
|
2014-01-30 17:03:55 +03:00
|
|
|
|
2013-01-20 03:02:29 +03:00
|
|
|
static void simple_idct_arm_put(uint8_t *dest, int line_size, int16_t *block)
|
2003-07-07 14:19:18 +03:00
|
|
|
{
|
2014-01-30 17:03:55 +03:00
|
|
|
ff_simple_idct_arm(block);
|
2003-07-07 14:19:18 +03:00
|
|
|
ff_put_pixels_clamped(block, dest, line_size);
|
|
|
|
}
|
2014-01-30 17:03:55 +03:00
|
|
|
|
2013-01-20 03:02:29 +03:00
|
|
|
static void simple_idct_arm_add(uint8_t *dest, int line_size, int16_t *block)
|
2003-07-07 14:19:18 +03:00
|
|
|
{
|
2014-01-30 17:03:55 +03:00
|
|
|
ff_simple_idct_arm(block);
|
2003-07-07 14:19:18 +03:00
|
|
|
ff_add_pixels_clamped(block, dest, line_size);
|
|
|
|
}
|
2006-09-16 02:20:58 +03:00
|
|
|
|
2013-12-30 14:09:03 +03:00
|
|
|
av_cold void ff_dsputil_init_arm(DSPContext *c, AVCodecContext *avctx,
|
|
|
|
unsigned high_bit_depth)
|
2001-08-14 00:38:25 +03:00
|
|
|
{
|
2012-04-21 17:31:10 +03:00
|
|
|
int cpu_flags = av_get_cpu_flags();
|
2011-03-29 18:48:59 +03:00
|
|
|
|
2003-03-03 16:54:00 +02:00
|
|
|
ff_put_pixels_clamped = c->put_pixels_clamped;
|
|
|
|
ff_add_pixels_clamped = c->add_pixels_clamped;
|
|
|
|
|
2014-03-21 00:06:01 +03:00
|
|
|
if (!avctx->lowres && !high_bit_depth) {
|
2014-01-30 17:03:55 +03:00
|
|
|
if (avctx->idct_algo == FF_IDCT_AUTO ||
|
|
|
|
avctx->idct_algo == FF_IDCT_ARM) {
|
2009-10-07 00:55:41 +03:00
|
|
|
c->idct_put = j_rev_dct_arm_put;
|
|
|
|
c->idct_add = j_rev_dct_arm_add;
|
|
|
|
c->idct = ff_j_rev_dct_arm;
|
2009-10-04 16:13:08 +03:00
|
|
|
c->idct_permutation_type = FF_LIBMPEG2_IDCT_PERM;
|
2014-01-30 17:03:55 +03:00
|
|
|
} else if (avctx->idct_algo == FF_IDCT_SIMPLEARM) {
|
2009-10-07 00:55:41 +03:00
|
|
|
c->idct_put = simple_idct_arm_put;
|
|
|
|
c->idct_add = simple_idct_arm_add;
|
|
|
|
c->idct = ff_simple_idct_arm;
|
2009-10-04 16:13:08 +03:00
|
|
|
c->idct_permutation_type = FF_NO_IDCT_PERM;
|
2008-01-27 10:37:28 +02:00
|
|
|
}
|
2008-01-27 10:36:50 +02:00
|
|
|
}
|
2005-05-26 17:32:46 +03:00
|
|
|
|
2009-10-07 00:55:41 +03:00
|
|
|
c->add_pixels_clamped = ff_add_pixels_clamped_arm;
|
2009-10-07 00:55:37 +03:00
|
|
|
|
2014-01-30 17:03:55 +03:00
|
|
|
if (have_armv5te(cpu_flags))
|
2013-12-30 14:09:03 +03:00
|
|
|
ff_dsputil_init_armv5te(c, avctx, high_bit_depth);
|
2014-01-30 17:03:55 +03:00
|
|
|
if (have_armv6(cpu_flags))
|
2013-12-30 14:09:03 +03:00
|
|
|
ff_dsputil_init_armv6(c, avctx, high_bit_depth);
|
2014-01-30 17:03:55 +03:00
|
|
|
if (have_neon(cpu_flags))
|
2013-12-30 14:09:03 +03:00
|
|
|
ff_dsputil_init_neon(c, avctx, high_bit_depth);
|
2001-08-14 00:38:25 +03:00
|
|
|
}
|