2001-08-13 21:38:25 +00:00
|
|
|
/*
|
2008-12-17 00:54:54 +00:00
|
|
|
* ARM optimized DSP utils
|
2009-01-19 15:46:40 +00:00
|
|
|
* Copyright (c) 2001 Lionel Ulmer
|
2001-08-13 21:38:25 +00:00
|
|
|
*
|
2006-10-07 15:30:46 +00:00
|
|
|
* This file is part of FFmpeg.
|
|
|
|
*
|
|
|
|
* FFmpeg is free software; you can redistribute it and/or
|
2002-05-25 22:45:33 +00:00
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
2006-10-07 15:30:46 +00:00
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
2001-08-13 21:38:25 +00:00
|
|
|
*
|
2006-10-07 15:30:46 +00:00
|
|
|
* FFmpeg is distributed in the hope that it will be useful,
|
2001-08-13 21:38:25 +00:00
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
2002-05-25 22:45:33 +00:00
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
2001-08-13 21:38:25 +00:00
|
|
|
*
|
2002-05-25 22:45:33 +00:00
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
2006-10-07 15:30:46 +00:00
|
|
|
* 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
|
2001-08-13 21:38:25 +00:00
|
|
|
*/
|
|
|
|
|
2008-05-09 11:56:36 +00:00
|
|
|
#include "libavcodec/dsputil.h"
|
2009-10-04 13:12:55 +00:00
|
|
|
#include "dsputil_arm.h"
|
2001-08-13 21:38:25 +00:00
|
|
|
|
2009-10-06 21:55:41 +00:00
|
|
|
void ff_j_rev_dct_arm(DCTELEM *data);
|
|
|
|
void ff_simple_idct_arm(DCTELEM *data);
|
2001-08-13 21:38:25 +00:00
|
|
|
|
2003-03-03 14:54:00 +00:00
|
|
|
/* XXX: local hack */
|
|
|
|
static void (*ff_put_pixels_clamped)(const DCTELEM *block, uint8_t *pixels, int line_size);
|
|
|
|
static void (*ff_add_pixels_clamped)(const DCTELEM *block, uint8_t *pixels, int line_size);
|
|
|
|
|
2009-10-04 13:13:12 +00:00
|
|
|
void ff_put_pixels8_arm(uint8_t *block, const uint8_t *pixels, int line_size, int h);
|
|
|
|
void ff_put_pixels8_x2_arm(uint8_t *block, const uint8_t *pixels, int line_size, int h);
|
|
|
|
void ff_put_pixels8_y2_arm(uint8_t *block, const uint8_t *pixels, int line_size, int h);
|
|
|
|
void ff_put_pixels8_xy2_arm(uint8_t *block, const uint8_t *pixels, int line_size, int h);
|
2005-05-26 14:32:46 +00:00
|
|
|
|
2009-10-04 13:13:12 +00:00
|
|
|
void ff_put_no_rnd_pixels8_x2_arm(uint8_t *block, const uint8_t *pixels, int line_size, int h);
|
|
|
|
void ff_put_no_rnd_pixels8_y2_arm(uint8_t *block, const uint8_t *pixels, int line_size, int h);
|
|
|
|
void ff_put_no_rnd_pixels8_xy2_arm(uint8_t *block, const uint8_t *pixels, int line_size, int h);
|
2005-05-26 14:32:46 +00:00
|
|
|
|
2009-10-04 13:13:12 +00:00
|
|
|
void ff_put_pixels16_arm(uint8_t *block, const uint8_t *pixels, int line_size, int h);
|
2005-05-26 14:32:46 +00:00
|
|
|
|
2009-10-04 13:13:12 +00:00
|
|
|
CALL_2X_PIXELS(ff_put_pixels16_x2_arm, ff_put_pixels8_x2_arm, 8)
|
|
|
|
CALL_2X_PIXELS(ff_put_pixels16_y2_arm, ff_put_pixels8_y2_arm, 8)
|
|
|
|
CALL_2X_PIXELS(ff_put_pixels16_xy2_arm, ff_put_pixels8_xy2_arm, 8)
|
|
|
|
CALL_2X_PIXELS(ff_put_no_rnd_pixels16_x2_arm, ff_put_no_rnd_pixels8_x2_arm, 8)
|
|
|
|
CALL_2X_PIXELS(ff_put_no_rnd_pixels16_y2_arm, ff_put_no_rnd_pixels8_y2_arm, 8)
|
|
|
|
CALL_2X_PIXELS(ff_put_no_rnd_pixels16_xy2_arm, ff_put_no_rnd_pixels8_xy2_arm,8)
|
2005-05-26 14:32:46 +00:00
|
|
|
|
2009-10-06 21:55:41 +00:00
|
|
|
void ff_add_pixels_clamped_arm(const DCTELEM *block, uint8_t *dest,
|
2009-10-06 21:55:37 +00:00
|
|
|
int line_size);
|
2005-05-26 14:32:46 +00:00
|
|
|
|
2003-03-03 14:54:00 +00:00
|
|
|
/* XXX: those functions should be suppressed ASAP when all IDCTs are
|
|
|
|
converted */
|
2009-10-06 21:55:41 +00:00
|
|
|
static void j_rev_dct_arm_put(uint8_t *dest, int line_size, DCTELEM *block)
|
2003-03-03 14:54:00 +00:00
|
|
|
{
|
2009-10-06 21:55:41 +00:00
|
|
|
ff_j_rev_dct_arm (block);
|
2003-03-03 14:54:00 +00:00
|
|
|
ff_put_pixels_clamped(block, dest, line_size);
|
|
|
|
}
|
2009-10-06 21:55:41 +00:00
|
|
|
static void j_rev_dct_arm_add(uint8_t *dest, int line_size, DCTELEM *block)
|
2003-03-03 14:54:00 +00:00
|
|
|
{
|
2009-10-06 21:55:41 +00:00
|
|
|
ff_j_rev_dct_arm (block);
|
2003-03-03 14:54:00 +00:00
|
|
|
ff_add_pixels_clamped(block, dest, line_size);
|
|
|
|
}
|
2009-10-06 21:55:41 +00:00
|
|
|
static void simple_idct_arm_put(uint8_t *dest, int line_size, DCTELEM *block)
|
2003-07-07 11:19:18 +00:00
|
|
|
{
|
2009-10-06 21:55:41 +00:00
|
|
|
ff_simple_idct_arm (block);
|
2003-07-07 11:19:18 +00:00
|
|
|
ff_put_pixels_clamped(block, dest, line_size);
|
|
|
|
}
|
2009-10-06 21:55:41 +00:00
|
|
|
static void simple_idct_arm_add(uint8_t *dest, int line_size, DCTELEM *block)
|
2003-07-07 11:19:18 +00:00
|
|
|
{
|
2009-10-06 21:55:41 +00:00
|
|
|
ff_simple_idct_arm (block);
|
2003-07-07 11:19:18 +00:00
|
|
|
ff_add_pixels_clamped(block, dest, line_size);
|
|
|
|
}
|
2006-09-15 23:20:58 +00:00
|
|
|
|
2008-06-30 07:31:41 +00:00
|
|
|
int mm_support(void)
|
|
|
|
{
|
2009-01-14 17:19:17 +00:00
|
|
|
return HAVE_IWMMXT * FF_MM_IWMMXT;
|
2008-06-30 07:31:41 +00:00
|
|
|
}
|
|
|
|
|
2008-12-17 00:54:54 +00:00
|
|
|
void dsputil_init_arm(DSPContext* c, AVCodecContext *avctx)
|
2001-08-13 21:38:25 +00:00
|
|
|
{
|
2003-03-03 14:54:00 +00:00
|
|
|
ff_put_pixels_clamped = c->put_pixels_clamped;
|
|
|
|
ff_add_pixels_clamped = c->add_pixels_clamped;
|
|
|
|
|
2009-10-04 13:13:08 +00:00
|
|
|
if (!avctx->lowres) {
|
2009-10-04 13:12:55 +00:00
|
|
|
if(avctx->idct_algo == FF_IDCT_AUTO ||
|
|
|
|
avctx->idct_algo == FF_IDCT_ARM){
|
2009-10-06 21:55:41 +00: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 13:13:08 +00:00
|
|
|
c->idct_permutation_type = FF_LIBMPEG2_IDCT_PERM;
|
|
|
|
} else if (avctx->idct_algo == FF_IDCT_SIMPLEARM){
|
2009-10-06 21:55:41 +00:00
|
|
|
c->idct_put = simple_idct_arm_put;
|
|
|
|
c->idct_add = simple_idct_arm_add;
|
|
|
|
c->idct = ff_simple_idct_arm;
|
2009-10-04 13:13:08 +00:00
|
|
|
c->idct_permutation_type = FF_NO_IDCT_PERM;
|
2008-01-27 08:37:28 +00:00
|
|
|
}
|
2008-01-27 08:36:50 +00:00
|
|
|
}
|
2005-05-26 14:32:46 +00:00
|
|
|
|
2009-10-06 21:55:41 +00:00
|
|
|
c->add_pixels_clamped = ff_add_pixels_clamped_arm;
|
2009-10-06 21:55:37 +00:00
|
|
|
|
2009-10-04 13:13:12 +00:00
|
|
|
c->put_pixels_tab[0][0] = ff_put_pixels16_arm;
|
|
|
|
c->put_pixels_tab[0][1] = ff_put_pixels16_x2_arm;
|
|
|
|
c->put_pixels_tab[0][2] = ff_put_pixels16_y2_arm;
|
|
|
|
c->put_pixels_tab[0][3] = ff_put_pixels16_xy2_arm;
|
|
|
|
c->put_pixels_tab[1][0] = ff_put_pixels8_arm;
|
|
|
|
c->put_pixels_tab[1][1] = ff_put_pixels8_x2_arm;
|
|
|
|
c->put_pixels_tab[1][2] = ff_put_pixels8_y2_arm;
|
|
|
|
c->put_pixels_tab[1][3] = ff_put_pixels8_xy2_arm;
|
2009-10-04 13:13:08 +00:00
|
|
|
|
2009-10-04 13:13:12 +00:00
|
|
|
c->put_no_rnd_pixels_tab[0][0] = ff_put_pixels16_arm;
|
|
|
|
c->put_no_rnd_pixels_tab[0][1] = ff_put_no_rnd_pixels16_x2_arm;
|
|
|
|
c->put_no_rnd_pixels_tab[0][2] = ff_put_no_rnd_pixels16_y2_arm;
|
|
|
|
c->put_no_rnd_pixels_tab[0][3] = ff_put_no_rnd_pixels16_xy2_arm;
|
|
|
|
c->put_no_rnd_pixels_tab[1][0] = ff_put_pixels8_arm;
|
|
|
|
c->put_no_rnd_pixels_tab[1][1] = ff_put_no_rnd_pixels8_x2_arm;
|
|
|
|
c->put_no_rnd_pixels_tab[1][2] = ff_put_no_rnd_pixels8_y2_arm;
|
|
|
|
c->put_no_rnd_pixels_tab[1][3] = ff_put_no_rnd_pixels8_xy2_arm;
|
2005-05-26 14:32:46 +00:00
|
|
|
|
2009-10-04 13:12:55 +00:00
|
|
|
if (HAVE_ARMV5TE) ff_dsputil_init_armv5te(c, avctx);
|
|
|
|
if (HAVE_ARMV6) ff_dsputil_init_armv6(c, avctx);
|
2009-10-04 13:13:12 +00:00
|
|
|
if (HAVE_IWMMXT) ff_dsputil_init_iwmmxt(c, avctx);
|
2009-10-04 13:13:06 +00:00
|
|
|
if (HAVE_ARMVFP) ff_dsputil_init_vfp(c, avctx);
|
|
|
|
if (HAVE_NEON) ff_dsputil_init_neon(c, avctx);
|
2001-08-13 21:38:25 +00:00
|
|
|
}
|