2007-10-04 22:47:12 +02:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2007 Marc Hoffman <marc.hoffman@analog.com>
|
|
|
|
*
|
2011-03-18 18:35:10 +01:00
|
|
|
* This file is part of Libav.
|
2007-10-05 00:41:21 +02:00
|
|
|
*
|
2011-03-18 18:35:10 +01:00
|
|
|
* Libav is free software; you can redistribute it and/or
|
2007-10-04 22:47:12 +02:00
|
|
|
* 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.
|
|
|
|
*
|
2011-03-18 18:35:10 +01:00
|
|
|
* Libav is distributed in the hope that it will be useful,
|
2007-10-04 22:47:12 +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
|
2011-03-18 18:35:10 +01:00
|
|
|
* License along with Libav; if not, write to the Free Software
|
2007-10-04 22:47:12 +02:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
*/
|
|
|
|
|
2013-01-28 20:19:07 +01:00
|
|
|
#include <string.h>
|
|
|
|
|
2013-02-01 10:31:59 +01:00
|
|
|
#include "libavutil/attributes.h"
|
2008-05-09 13:56:36 +02:00
|
|
|
#include "libavcodec/avcodec.h"
|
2013-01-28 20:22:54 +01:00
|
|
|
#include "libavcodec/vp3dsp.h"
|
2013-01-29 14:34:30 +01:00
|
|
|
#include "libavcodec/dsputil.h"
|
2007-10-04 22:47:12 +02:00
|
|
|
#include "dsputil_bfin.h"
|
2013-01-28 20:22:54 +01:00
|
|
|
#include "vp3_bfin.h"
|
2007-10-04 22:47:12 +02:00
|
|
|
|
|
|
|
/* Intra iDCT offset 128 */
|
2013-04-03 13:26:14 +02:00
|
|
|
static void bfin_vp3_idct_put(uint8_t *dest, int line_size, int16_t *block)
|
2007-10-04 22:47:12 +02:00
|
|
|
{
|
2013-04-03 14:28:45 +02:00
|
|
|
const uint8_t *cm = ff_cropTbl + MAX_NEG_CROP + 128;
|
2007-10-04 22:47:12 +02:00
|
|
|
int i,j;
|
|
|
|
|
|
|
|
ff_bfin_vp3_idct (block);
|
|
|
|
|
|
|
|
for (i=0;i<8;i++)
|
|
|
|
for (j=0;j<8;j++)
|
2013-04-03 14:03:17 +02:00
|
|
|
dest[line_size*i + j] = cm[block[j*8 + i]];
|
2013-01-28 20:19:07 +01:00
|
|
|
|
|
|
|
memset(block, 0, 128);
|
2007-10-04 22:47:12 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Inter iDCT */
|
2013-04-03 13:26:14 +02:00
|
|
|
static void bfin_vp3_idct_add(uint8_t *dest, int line_size, int16_t *block)
|
2007-10-04 22:47:12 +02:00
|
|
|
{
|
2013-04-03 14:03:17 +02:00
|
|
|
const uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
|
|
|
|
int i, j;
|
|
|
|
|
2007-10-04 22:47:12 +02:00
|
|
|
ff_bfin_vp3_idct (block);
|
2013-04-03 14:03:17 +02:00
|
|
|
for (i = 0; i < 8; i++)
|
|
|
|
for (j = 0; j < 8; j++)
|
|
|
|
dest[line_size*i + j] = cm[dest[line_size*i + j] + block[j*8 + i]];
|
2013-01-28 20:19:07 +01:00
|
|
|
|
|
|
|
memset(block, 0, 128);
|
2007-10-04 22:47:12 +02:00
|
|
|
}
|
2013-01-28 20:22:54 +01:00
|
|
|
|
2013-02-01 10:31:59 +01:00
|
|
|
av_cold void ff_vp3dsp_init_bfin(VP3DSPContext *c, int flags)
|
2013-01-28 20:22:54 +01:00
|
|
|
{
|
2013-04-03 12:56:33 +02:00
|
|
|
if (!(flags & CODEC_FLAG_BITEXACT)) {
|
2013-04-03 13:26:14 +02:00
|
|
|
c->idct_add = bfin_vp3_idct_add;
|
|
|
|
c->idct_put = bfin_vp3_idct_put;
|
2013-04-03 12:56:33 +02:00
|
|
|
}
|
2013-01-28 20:22:54 +01:00
|
|
|
}
|