Linux-DVB-DVBT-Advert
view release on metacpan or search on metacpan
clib/libmpeg2/motion_comp_vis.c view on Meta::CPAN
/*
* motion_comp_vis.c
* Copyright (C) 2003 David S. Miller <davem@redhat.com>
*
* This file is part of mpeg2dec, a free MPEG-2 video stream decoder.
* See http://libmpeg2.sourceforge.net/ for updates.
*
* mpeg2dec is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* mpeg2dec is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "config.h"
#ifdef ARCH_SPARC
#include <inttypes.h>
#include "mpeg2.h"
#include "attributes.h"
#include "mpeg2_internal.h"
#include "vis.h"
/* The trick used in some of this file is the formula from the MMX
* motion comp code, which is:
*
* (x+y+1)>>1 == (x|y)-((x^y)>>1)
*
* This allows us to average 8 bytes at a time in a 64-bit FPU reg.
* We avoid overflows by masking before we do the shift, and we
* implement the shift by multiplying by 1/2 using mul8x16. So in
* VIS this is (assume 'x' is in f0, 'y' is in f2, a repeating mask
* of '0xfe' is in f4, a repeating mask of '0x7f' is in f6, and
* the value 0x80808080 is in f8):
*
* fxor f0, f2, f10
* fand f10, f4, f10
* fmul8x16 f8, f10, f10
* fand f10, f6, f10
* for f0, f2, f12
* fpsub16 f12, f10, f10
*/
#define DUP4(x) {x, x, x, x}
#define DUP8(x) {x, x, x, x, x, x, x, x}
static const int16_t constants1[] ATTR_ALIGN(8) = DUP4 (1);
static const int16_t constants2[] ATTR_ALIGN(8) = DUP4 (2);
static const int16_t constants3[] ATTR_ALIGN(8) = DUP4 (3);
static const int16_t constants6[] ATTR_ALIGN(8) = DUP4 (6);
static const int8_t constants_fe[] ATTR_ALIGN(8) = DUP8 (0xfe);
static const int8_t constants_7f[] ATTR_ALIGN(8) = DUP8 (0x7f);
static const int8_t constants128[] ATTR_ALIGN(8) = DUP8 (128);
static const int16_t constants256_512[] ATTR_ALIGN(8) =
{256, 512, 256, 512};
static const int16_t constants256_1024[] ATTR_ALIGN(8) =
{256, 1024, 256, 1024};
#define REF_0 0
#define REF_0_1 1
#define REF_2 2
#define REF_2_1 3
#define REF_4 4
#define REF_4_1 5
#define REF_6 6
#define REF_6_1 7
#define REF_S0 8
#define REF_S0_1 9
#define REF_S2 10
#define REF_S2_1 11
#define REF_S4 12
#define REF_S4_1 13
#define REF_S6 14
#define REF_S6_1 15
#define DST_0 16
#define DST_1 17
#define DST_2 18
#define DST_3 19
#define CONST_1 20
#define CONST_2 20
#define CONST_3 20
#define CONST_6 20
#define MASK_fe 20
#define CONST_128 22
#define CONST_256 22
( run in 0.394 second using v1.01-cache-2.11-cpan-39bf76dae61 )