~ubuntu-branches/debian/sid/mplayer/sid

« back to all changes in this revision

Viewing changes to liba52/resample_altivec.c

  • Committer: Bazaar Package Importer
  • Author(s): A Mennucc1
  • Date: 2009-03-23 10:05:45 UTC
  • mfrom: (4.1.4 sid)
  • Revision ID: james.westby@ubuntu.com-20090323100545-x8h79obawnnte7kk
Tags: 1.0~rc2+svn20090303-5
debian/control : move docbook-xml,docbook-xsl,xsltproc from 
Build-Depends-Indep to Build-Depends, since they are needed to run
configure

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
// this code is based on a52dec/libao/audio_out_oss.c
2
 
// AltiVec support Copyright (c) 2004 Romain Dolbeau <romain@dolbeau.org>
 
1
/*
 
2
 * resample.c
 
3
 * Copyright (C) 2004 Romain Dolbeau <romain@dolbeau.org>
 
4
 *
 
5
 * This file is part of a52dec, a free ATSC A-52 stream decoder.
 
6
 * See http://liba52.sourceforge.net/ for updates.
 
7
 *
 
8
 * File added for use with MPlayer and not part of original a52dec.
 
9
 *
 
10
 * a52dec is free software; you can redistribute it and/or modify
 
11
 * it under the terms of the GNU General Public License as published by
 
12
 * the Free Software Foundation; either version 2 of the License, or
 
13
 * (at your option) any later version.
 
14
 *
 
15
 * a52dec is distributed in the hope that it will be useful,
 
16
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
17
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
18
 * GNU General Public License for more details.
 
19
 *
 
20
 * You should have received a copy of the GNU General Public License
 
21
 * along with this program; if not, write to the Free Software
 
22
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
23
 */
3
24
 
4
 
#ifndef SYS_DARWIN
 
25
#ifdef HAVE_ALTIVEC_H
5
26
#include <altivec.h>
6
27
#endif
7
28
 
17
38
  return result;
18
39
}
19
40
 
 
41
static void unaligned_store(vector signed short value, int off, int16_t *dst)
 
42
{
 
43
    register vector unsigned char align = vec_lvsr(0, dst),
 
44
                                  mask = vec_lvsl(0, dst);
 
45
    register vector signed short t0,t1, edges;
 
46
 
 
47
    t0 = vec_ld(0+off, dst);
 
48
    t1 = vec_ld(15+off, dst);
 
49
    edges = vec_perm(t1 ,t0, mask);
 
50
    t1 = vec_perm(value, edges, align);
 
51
    t0 = vec_perm(edges, value, align);
 
52
    vec_st(t1, 15+off, dst);
 
53
    vec_st(t0, 0+off, dst);
 
54
}
 
55
 
20
56
static int a52_resample_STEREO_to_2_altivec(float * _f, int16_t * s16){
21
57
#if 0
22
58
  int i;
35
71
  for (i = 0; i < 256; i+= 8) {
36
72
    f0 = vec_ld(0, f);
37
73
    f4 = vec_ld(16, f);
38
 
    
 
74
 
39
75
    f256 = vec_ld(1024, f);
40
76
    f260 = vec_ld(1040, f);
41
77
 
44
80
 
45
81
    r0 = vec_mergeh(reven, rodd);
46
82
    r1 = vec_mergel(reven, rodd);
47
 
    
48
 
    vec_st(r0, 0, s16);
49
 
    vec_st(r1, 16, s16);
 
83
    // FIXME can be merged to spare some I/O
 
84
    unaligned_store(r0, 0, s16);
 
85
    unaligned_store(r1, 16, s16);
50
86
 
51
87
    f += 8;
52
88
    s16 += 16;