misc/libtremor/tremor/mdct.c
author nemo
Fri, 29 Mar 2013 10:54:12 -0400
changeset 8818 8f317ba10675
parent 7849 a12155461b34
permissions -rw-r--r--
This should ensure rope can still be aimed quickly when an alt weapon is active.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
5170
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
     1
/********************************************************************
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
     2
 *                                                                  *
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
     3
 * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE.   *
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
     4
 *                                                                  *
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
     5
 * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS     *
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
     6
 * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
     7
 * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
     8
 *                                                                  *
7849
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
     9
 * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002    *
5170
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
    10
 * BY THE Xiph.Org FOUNDATION http://www.xiph.org/                  *
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
    11
 *                                                                  *
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
    12
 ********************************************************************
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
    13
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
    14
 function: normalized modified discrete cosine transform
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
    15
           power of two length transform only [64 <= n ]
7849
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
    16
 last mod: $Id: mdct.c,v 1.9 2002/10/16 09:17:39 xiphmont Exp $
5170
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
    17
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
    18
 Original algorithm adapted long ago from _The use of multirate filter
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
    19
 banks for coding of high quality digital audio_, by T. Sporer,
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
    20
 K. Brandenburg and B. Edler, collection of the European Signal
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
    21
 Processing Conference (EUSIPCO), Amsterdam, June 1992, Vol.1, pp
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
    22
 211-214
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
    23
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
    24
 The below code implements an algorithm that no longer looks much like
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
    25
 that presented in the paper, but the basic structure remains if you
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
    26
 dig deep enough to see it.
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
    27
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
    28
 This module DOES NOT INCLUDE code to generate/apply the window
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
    29
 function.  Everybody has their own weird favorite including me... I
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
    30
 happen to like the properties of y=sin(.5PI*sin^2(x)), but others may
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
    31
 vehemently disagree.
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
    32
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
    33
 ********************************************************************/
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
    34
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
    35
#include "ivorbiscodec.h"
7849
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
    36
#include "codebook.h"
5170
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
    37
#include "misc.h"
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
    38
#include "mdct.h"
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
    39
#include "mdct_lookup.h"
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
    40
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
    41
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
    42
/* 8 point butterfly (in place) */
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
    43
STIN void mdct_butterfly_8(DATA_TYPE *x){
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
    44
7849
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
    45
  REG_TYPE r0   = x[4] + x[0];
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
    46
  REG_TYPE r1   = x[4] - x[0];
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
    47
  REG_TYPE r2   = x[5] + x[1];
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
    48
  REG_TYPE r3   = x[5] - x[1];
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
    49
  REG_TYPE r4   = x[6] + x[2];
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
    50
  REG_TYPE r5   = x[6] - x[2];
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
    51
  REG_TYPE r6   = x[7] + x[3];
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
    52
  REG_TYPE r7   = x[7] - x[3];
5170
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
    53
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
    54
	   x[0] = r5   + r3;
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
    55
	   x[1] = r7   - r1;
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
    56
	   x[2] = r5   - r3;
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
    57
	   x[3] = r7   + r1;
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
    58
           x[4] = r4   - r0;
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
    59
	   x[5] = r6   - r2;
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
    60
           x[6] = r4   + r0;
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
    61
	   x[7] = r6   + r2;
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
    62
	   MB();
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
    63
}
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
    64
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
    65
/* 16 point butterfly (in place, 4 register) */
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
    66
STIN void mdct_butterfly_16(DATA_TYPE *x){
7849
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
    67
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
    68
  REG_TYPE r0, r1;
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
    69
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
    70
	   r0 = x[ 0] - x[ 8]; x[ 8] += x[ 0];
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
    71
	   r1 = x[ 1] - x[ 9]; x[ 9] += x[ 1];
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
    72
	   x[ 0] = MULT31((r0 + r1) , cPI2_8);
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
    73
	   x[ 1] = MULT31((r1 - r0) , cPI2_8);
5170
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
    74
	   MB();
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
    75
7849
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
    76
	   r0 = x[10] - x[ 2]; x[10] += x[ 2];
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
    77
	   r1 = x[ 3] - x[11]; x[11] += x[ 3];
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
    78
	   x[ 2] = r1; x[ 3] = r0;
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
    79
	   MB();
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
    80
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
    81
	   r0 = x[12] - x[ 4]; x[12] += x[ 4];
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
    82
	   r1 = x[13] - x[ 5]; x[13] += x[ 5];
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
    83
	   x[ 4] = MULT31((r0 - r1) , cPI2_8);
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
    84
	   x[ 5] = MULT31((r0 + r1) , cPI2_8);
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
    85
	   MB();
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
    86
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
    87
	   r0 = x[14] - x[ 6]; x[14] += x[ 6];
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
    88
	   r1 = x[15] - x[ 7]; x[15] += x[ 7];
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
    89
	   x[ 6] = r0; x[ 7] = r1;
5170
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
    90
	   MB();
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
    91
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
    92
	   mdct_butterfly_8(x);
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
    93
	   mdct_butterfly_8(x+8);
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
    94
}
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
    95
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
    96
/* 32 point butterfly (in place, 4 register) */
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
    97
STIN void mdct_butterfly_32(DATA_TYPE *x){
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
    98
7849
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
    99
  REG_TYPE r0, r1;
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   100
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   101
	   r0 = x[30] - x[14]; x[30] += x[14];           
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   102
	   r1 = x[31] - x[15]; x[31] += x[15];
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   103
	   x[14] = r0; x[15] = r1;
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   104
	   MB();
5170
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   105
7849
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   106
	   r0 = x[28] - x[12]; x[28] += x[12];           
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   107
	   r1 = x[29] - x[13]; x[29] += x[13];
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   108
	   XNPROD31( r0, r1, cPI1_8, cPI3_8, &x[12], &x[13] );
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   109
	   MB();
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   110
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   111
	   r0 = x[26] - x[10]; x[26] += x[10];
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   112
	   r1 = x[27] - x[11]; x[27] += x[11];
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   113
	   x[10] = MULT31((r0 - r1) , cPI2_8);
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   114
	   x[11] = MULT31((r0 + r1) , cPI2_8);
5170
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   115
	   MB();
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   116
7849
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   117
	   r0 = x[24] - x[ 8]; x[24] += x[ 8];
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   118
	   r1 = x[25] - x[ 9]; x[25] += x[ 9];
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   119
	   XNPROD31( r0, r1, cPI3_8, cPI1_8, &x[ 8], &x[ 9] );
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   120
	   MB();
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   121
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   122
	   r0 = x[22] - x[ 6]; x[22] += x[ 6];
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   123
	   r1 = x[ 7] - x[23]; x[23] += x[ 7];
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   124
	   x[ 6] = r1; x[ 7] = r0;
5170
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   125
	   MB();
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   126
7849
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   127
	   r0 = x[ 4] - x[20]; x[20] += x[ 4];
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   128
	   r1 = x[ 5] - x[21]; x[21] += x[ 5];
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   129
	   XPROD31 ( r0, r1, cPI3_8, cPI1_8, &x[ 4], &x[ 5] );
5170
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   130
	   MB();
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   131
7849
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   132
	   r0 = x[ 2] - x[18]; x[18] += x[ 2];
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   133
	   r1 = x[ 3] - x[19]; x[19] += x[ 3];
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   134
	   x[ 2] = MULT31((r1 + r0) , cPI2_8);
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   135
	   x[ 3] = MULT31((r1 - r0) , cPI2_8);
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   136
	   MB();
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   137
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   138
	   r0 = x[ 0] - x[16]; x[16] += x[ 0];
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   139
	   r1 = x[ 1] - x[17]; x[17] += x[ 1];
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   140
	   XPROD31 ( r0, r1, cPI1_8, cPI3_8, &x[ 0], &x[ 1] );
5170
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   141
	   MB();
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   142
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   143
	   mdct_butterfly_16(x);
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   144
	   mdct_butterfly_16(x+16);
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   145
}
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   146
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   147
/* N/stage point generic N stage butterfly (in place, 2 register) */
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   148
STIN void mdct_butterfly_generic(DATA_TYPE *x,int points,int step){
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   149
7849
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   150
  LOOKUP_T *T   = sincos_lookup0;
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   151
  DATA_TYPE *x1        = x + points      - 8;
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   152
  DATA_TYPE *x2        = x + (points>>1) - 8;
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   153
  REG_TYPE   r0;
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   154
  REG_TYPE   r1;
5170
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   155
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   156
  do{
7849
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   157
    r0 = x1[6] - x2[6]; x1[6] += x2[6];
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   158
    r1 = x2[7] - x1[7]; x1[7] += x2[7];
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   159
    XPROD31( r1, r0, T[0], T[1], &x2[6], &x2[7] ); T+=step;
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   160
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   161
    r0 = x1[4] - x2[4]; x1[4] += x2[4];
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   162
    r1 = x2[5] - x1[5]; x1[5] += x2[5];
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   163
    XPROD31( r1, r0, T[0], T[1], &x2[4], &x2[5] ); T+=step;
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   164
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   165
    r0 = x1[2] - x2[2]; x1[2] += x2[2];
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   166
    r1 = x2[3] - x1[3]; x1[3] += x2[3];
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   167
    XPROD31( r1, r0, T[0], T[1], &x2[2], &x2[3] ); T+=step;
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   168
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   169
    r0 = x1[0] - x2[0]; x1[0] += x2[0];
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   170
    r1 = x2[1] - x1[1]; x1[1] += x2[1];
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   171
    XPROD31( r1, r0, T[0], T[1], &x2[0], &x2[1] ); T+=step;
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   172
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   173
    x1-=8; x2-=8;
5170
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   174
  }while(T<sincos_lookup0+1024);
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   175
  do{
7849
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   176
    r0 = x1[6] - x2[6]; x1[6] += x2[6];
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   177
    r1 = x1[7] - x2[7]; x1[7] += x2[7];
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   178
    XNPROD31( r0, r1, T[0], T[1], &x2[6], &x2[7] ); T-=step;
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   179
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   180
    r0 = x1[4] - x2[4]; x1[4] += x2[4];
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   181
    r1 = x1[5] - x2[5]; x1[5] += x2[5];
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   182
    XNPROD31( r0, r1, T[0], T[1], &x2[4], &x2[5] ); T-=step;
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   183
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   184
    r0 = x1[2] - x2[2]; x1[2] += x2[2];
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   185
    r1 = x1[3] - x2[3]; x1[3] += x2[3];
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   186
    XNPROD31( r0, r1, T[0], T[1], &x2[2], &x2[3] ); T-=step;
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   187
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   188
    r0 = x1[0] - x2[0]; x1[0] += x2[0];
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   189
    r1 = x1[1] - x2[1]; x1[1] += x2[1];
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   190
    XNPROD31( r0, r1, T[0], T[1], &x2[0], &x2[1] ); T-=step;
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   191
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   192
    x1-=8; x2-=8;
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   193
  }while(T>sincos_lookup0);
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   194
  do{
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   195
    r0 = x2[6] - x1[6]; x1[6] += x2[6];
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   196
    r1 = x2[7] - x1[7]; x1[7] += x2[7];
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   197
    XPROD31( r0, r1, T[0], T[1], &x2[6], &x2[7] ); T+=step;
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   198
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   199
    r0 = x2[4] - x1[4]; x1[4] += x2[4];
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   200
    r1 = x2[5] - x1[5]; x1[5] += x2[5];
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   201
    XPROD31( r0, r1, T[0], T[1], &x2[4], &x2[5] ); T+=step;
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   202
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   203
    r0 = x2[2] - x1[2]; x1[2] += x2[2];
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   204
    r1 = x2[3] - x1[3]; x1[3] += x2[3];
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   205
    XPROD31( r0, r1, T[0], T[1], &x2[2], &x2[3] ); T+=step;
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   206
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   207
    r0 = x2[0] - x1[0]; x1[0] += x2[0];
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   208
    r1 = x2[1] - x1[1]; x1[1] += x2[1];
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   209
    XPROD31( r0, r1, T[0], T[1], &x2[0], &x2[1] ); T+=step;
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   210
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   211
    x1-=8; x2-=8;
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   212
  }while(T<sincos_lookup0+1024);
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   213
  do{
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   214
    r0 = x1[6] - x2[6]; x1[6] += x2[6];
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   215
    r1 = x2[7] - x1[7]; x1[7] += x2[7];
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   216
    XNPROD31( r1, r0, T[0], T[1], &x2[6], &x2[7] ); T-=step;
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   217
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   218
    r0 = x1[4] - x2[4]; x1[4] += x2[4];
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   219
    r1 = x2[5] - x1[5]; x1[5] += x2[5];
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   220
    XNPROD31( r1, r0, T[0], T[1], &x2[4], &x2[5] ); T-=step;
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   221
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   222
    r0 = x1[2] - x2[2]; x1[2] += x2[2];
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   223
    r1 = x2[3] - x1[3]; x1[3] += x2[3];
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   224
    XNPROD31( r1, r0, T[0], T[1], &x2[2], &x2[3] ); T-=step;
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   225
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   226
    r0 = x1[0] - x2[0]; x1[0] += x2[0];
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   227
    r1 = x2[1] - x1[1]; x1[1] += x2[1];
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   228
    XNPROD31( r1, r0, T[0], T[1], &x2[0], &x2[1] ); T-=step;
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   229
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   230
    x1-=8; x2-=8;
5170
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   231
  }while(T>sincos_lookup0);
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   232
}
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   233
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   234
STIN void mdct_butterflies(DATA_TYPE *x,int points,int shift){
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   235
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   236
  int stages=8-shift;
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   237
  int i,j;
7849
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   238
  
5170
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   239
  for(i=0;--stages>0;i++){
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   240
    for(j=0;j<(1<<i);j++)
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   241
      mdct_butterfly_generic(x+(points>>i)*j,points>>i,4<<(i+shift));
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   242
  }
7849
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   243
5170
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   244
  for(j=0;j<points;j+=32)
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   245
    mdct_butterfly_32(x+j);
7849
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   246
5170
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   247
}
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   248
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   249
static unsigned char bitrev[16]={0,8,4,12,2,10,6,14,1,9,5,13,3,11,7,15};
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   250
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   251
STIN int bitrev12(int x){
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   252
  return bitrev[x>>8]|(bitrev[(x&0x0f0)>>4]<<4)|(((int)bitrev[x&0x00f])<<8);
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   253
}
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   254
7849
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   255
STIN void mdct_bitreverse(DATA_TYPE *x,int n,int step,int shift){
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   256
5170
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   257
  int          bit   = 0;
7849
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   258
  DATA_TYPE   *w0    = x;
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   259
  DATA_TYPE   *w1    = x = w0+(n>>1);
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   260
  LOOKUP_T    *T = (step>=4)?(sincos_lookup0+(step>>1)):sincos_lookup1;
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   261
  LOOKUP_T    *Ttop  = T+1024;
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   262
  DATA_TYPE    r2;
5170
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   263
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   264
  do{
7849
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   265
    DATA_TYPE r3     = bitrev12(bit++);
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   266
    DATA_TYPE *x0    = x + ((r3 ^ 0xfff)>>shift) -1;
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   267
    DATA_TYPE *x1    = x + (r3>>shift);
5170
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   268
7849
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   269
    REG_TYPE  r0     = x0[0]  + x1[0];
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   270
    REG_TYPE  r1     = x1[1]  - x0[1];
5170
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   271
7849
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   272
	      XPROD32( r0, r1, T[1], T[0], &r2, &r3 ); T+=step;
5170
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   273
7849
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   274
	      w1    -= 4;
5170
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   275
7849
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   276
	      r0     = (x0[1] + x1[1])>>1;
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   277
              r1     = (x0[0] - x1[0])>>1;
5170
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   278
	      w0[0]  = r0     + r2;
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   279
	      w0[1]  = r1     + r3;
7849
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   280
	      w1[2]  = r0     - r2;
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   281
	      w1[3]  = r3     - r1;
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   282
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   283
	      r3     = bitrev12(bit++);
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   284
              x0     = x + ((r3 ^ 0xfff)>>shift) -1;
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   285
              x1     = x + (r3>>shift);
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   286
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   287
              r0     = x0[0]  + x1[0];
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   288
              r1     = x1[1]  - x0[1];
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   289
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   290
	      XPROD32( r0, r1, T[1], T[0], &r2, &r3 ); T+=step;
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   291
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   292
              r0     = (x0[1] + x1[1])>>1;
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   293
              r1     = (x0[0] - x1[0])>>1;
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   294
	      w0[2]  = r0     + r2;
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   295
	      w0[3]  = r1     + r3;
7697
767d3c4153a1 switch the Tremor implementation from the Cocos2D one to the lowmem-no-byte branch and let's see what happens
koda
parents: 6045
diff changeset
   296
	      w1[0]  = r0     - r2;
767d3c4153a1 switch the Tremor implementation from the Cocos2D one to the lowmem-no-byte branch and let's see what happens
koda
parents: 6045
diff changeset
   297
	      w1[1]  = r3     - r1;
5170
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   298
7849
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   299
	      w0    += 4;
7697
767d3c4153a1 switch the Tremor implementation from the Cocos2D one to the lowmem-no-byte branch and let's see what happens
koda
parents: 6045
diff changeset
   300
  }while(T<Ttop);
767d3c4153a1 switch the Tremor implementation from the Cocos2D one to the lowmem-no-byte branch and let's see what happens
koda
parents: 6045
diff changeset
   301
  do{
7849
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   302
    DATA_TYPE r3     = bitrev12(bit++);
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   303
    DATA_TYPE *x0    = x + ((r3 ^ 0xfff)>>shift) -1;
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   304
    DATA_TYPE *x1    = x + (r3>>shift);
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   305
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   306
    REG_TYPE  r0     = x0[0]  + x1[0];
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   307
    REG_TYPE  r1     = x1[1]  - x0[1];
5170
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   308
7849
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   309
	      T-=step; XPROD32( r0, r1, T[0], T[1], &r2, &r3 );
5170
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   310
7849
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   311
	      w1    -= 4;
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   312
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   313
	      r0     = (x0[1] + x1[1])>>1;
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   314
              r1     = (x0[0] - x1[0])>>1;
7697
767d3c4153a1 switch the Tremor implementation from the Cocos2D one to the lowmem-no-byte branch and let's see what happens
koda
parents: 6045
diff changeset
   315
	      w0[0]  = r0     + r2;
767d3c4153a1 switch the Tremor implementation from the Cocos2D one to the lowmem-no-byte branch and let's see what happens
koda
parents: 6045
diff changeset
   316
	      w0[1]  = r1     + r3;
7849
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   317
	      w1[2]  = r0     - r2;
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   318
	      w1[3]  = r3     - r1;
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   319
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   320
	      r3     = bitrev12(bit++);
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   321
              x0     = x + ((r3 ^ 0xfff)>>shift) -1;
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   322
              x1     = x + (r3>>shift);
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   323
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   324
              r0     = x0[0]  + x1[0];
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   325
              r1     = x1[1]  - x0[1];
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   326
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   327
	      T-=step; XPROD32( r0, r1, T[0], T[1], &r2, &r3 );
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   328
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   329
              r0     = (x0[1] + x1[1])>>1;
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   330
              r1     = (x0[0] - x1[0])>>1;
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   331
	      w0[2]  = r0     + r2;
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   332
	      w0[3]  = r1     + r3;
5170
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   333
	      w1[0]  = r0     - r2;
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   334
	      w1[1]  = r3     - r1;
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   335
7849
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   336
	      w0    += 4;
5170
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   337
  }while(w0<w1);
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   338
}
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   339
7849
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   340
void mdct_backward(int n, DATA_TYPE *in, DATA_TYPE *out){
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   341
  int n2=n>>1;
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   342
  int n4=n>>2;
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   343
  DATA_TYPE *iX;
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   344
  DATA_TYPE *oX;
5170
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   345
  LOOKUP_T *T;
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   346
  LOOKUP_T *V;
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   347
  int shift;
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   348
  int step;
7849
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   349
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   350
  for (shift=6;!(n&(1<<shift));shift++);
5170
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   351
  shift=13-shift;
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   352
  step=2<<shift;
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   353
   
7849
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   354
  /* rotate */
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   355
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   356
  iX            = in+n2-7;
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   357
  oX            = out+n2+n4;
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   358
  T             = sincos_lookup0;
5170
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   359
7849
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   360
  do{
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   361
    oX-=4;
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   362
    XPROD31( iX[4], iX[6], T[0], T[1], &oX[2], &oX[3] ); T+=step;
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   363
    XPROD31( iX[0], iX[2], T[0], T[1], &oX[0], &oX[1] ); T+=step;
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   364
    iX-=8;
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   365
  }while(iX>=in+n4);
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   366
  do{
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   367
    oX-=4;
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   368
    XPROD31( iX[4], iX[6], T[1], T[0], &oX[2], &oX[3] ); T-=step;
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   369
    XPROD31( iX[0], iX[2], T[1], T[0], &oX[0], &oX[1] ); T-=step;
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   370
    iX-=8;
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   371
  }while(iX>=in);
5170
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   372
7849
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   373
  iX            = in+n2-8;
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   374
  oX            = out+n2+n4;
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   375
  T             = sincos_lookup0;
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   376
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   377
  do{
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   378
    T+=step; XNPROD31( iX[6], iX[4], T[0], T[1], &oX[0], &oX[1] );
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   379
    T+=step; XNPROD31( iX[2], iX[0], T[0], T[1], &oX[2], &oX[3] );
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   380
    iX-=8;
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   381
    oX+=4;
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   382
  }while(iX>=in+n4);
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   383
  do{
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   384
    T-=step; XNPROD31( iX[6], iX[4], T[1], T[0], &oX[0], &oX[1] );
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   385
    T-=step; XNPROD31( iX[2], iX[0], T[1], T[0], &oX[2], &oX[3] );
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   386
    iX-=8;
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   387
    oX+=4;
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   388
  }while(iX>=in);
5170
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   389
7849
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   390
  mdct_butterflies(out+n2,n2,shift);
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   391
  mdct_bitreverse(out,n,step,shift);
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   392
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   393
  /* rotate + window */
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   394
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   395
  step>>=2;
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   396
  {
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   397
    DATA_TYPE *oX1=out+n2+n4;
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   398
    DATA_TYPE *oX2=out+n2+n4;
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   399
    DATA_TYPE *iX =out;
5170
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   400
7849
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   401
    switch(step) {
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   402
      default: {
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   403
        T=(step>=4)?(sincos_lookup0+(step>>1)):sincos_lookup1;
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   404
        do{
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   405
          oX1-=4;
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   406
	  XPROD31( iX[0], -iX[1], T[0], T[1], &oX1[3], &oX2[0] ); T+=step;
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   407
	  XPROD31( iX[2], -iX[3], T[0], T[1], &oX1[2], &oX2[1] ); T+=step;
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   408
	  XPROD31( iX[4], -iX[5], T[0], T[1], &oX1[1], &oX2[2] ); T+=step;
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   409
	  XPROD31( iX[6], -iX[7], T[0], T[1], &oX1[0], &oX2[3] ); T+=step;
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   410
	  oX2+=4;
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   411
	  iX+=8;
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   412
	}while(iX<oX1);
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   413
	break;
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   414
      }
5170
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   415
7849
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   416
      case 1: {
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   417
        /* linear interpolation between table values: offset=0.5, step=1 */
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   418
	REG_TYPE  t0,t1,v0,v1;
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   419
        T         = sincos_lookup0;
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   420
        V         = sincos_lookup1;
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   421
	t0        = (*T++)>>1;
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   422
	t1        = (*T++)>>1;
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   423
        do{
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   424
          oX1-=4;
5170
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   425
7849
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   426
	  t0 += (v0 = (*V++)>>1);
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   427
	  t1 += (v1 = (*V++)>>1);
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   428
	  XPROD31( iX[0], -iX[1], t0, t1, &oX1[3], &oX2[0] );
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   429
	  v0 += (t0 = (*T++)>>1);
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   430
	  v1 += (t1 = (*T++)>>1);
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   431
	  XPROD31( iX[2], -iX[3], v0, v1, &oX1[2], &oX2[1] );
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   432
	  t0 += (v0 = (*V++)>>1);
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   433
	  t1 += (v1 = (*V++)>>1);
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   434
	  XPROD31( iX[4], -iX[5], t0, t1, &oX1[1], &oX2[2] );
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   435
	  v0 += (t0 = (*T++)>>1);
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   436
	  v1 += (t1 = (*T++)>>1);
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   437
	  XPROD31( iX[6], -iX[7], v0, v1, &oX1[0], &oX2[3] );
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   438
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   439
	  oX2+=4;
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   440
	  iX+=8;
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   441
	}while(iX<oX1);
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   442
	break;
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   443
      }
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   444
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   445
      case 0: {
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   446
        /* linear interpolation between table values: offset=0.25, step=0.5 */
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   447
	REG_TYPE  t0,t1,v0,v1,q0,q1;
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   448
        T         = sincos_lookup0;
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   449
        V         = sincos_lookup1;
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   450
	t0        = *T++;
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   451
	t1        = *T++;
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   452
        do{
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   453
          oX1-=4;
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   454
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   455
	  v0  = *V++;
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   456
	  v1  = *V++;
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   457
	  t0 +=  (q0 = (v0-t0)>>2);
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   458
	  t1 +=  (q1 = (v1-t1)>>2);
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   459
	  XPROD31( iX[0], -iX[1], t0, t1, &oX1[3], &oX2[0] );
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   460
	  t0  = v0-q0;
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   461
	  t1  = v1-q1;
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   462
	  XPROD31( iX[2], -iX[3], t0, t1, &oX1[2], &oX2[1] );
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   463
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   464
	  t0  = *T++;
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   465
	  t1  = *T++;
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   466
	  v0 += (q0 = (t0-v0)>>2);
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   467
	  v1 += (q1 = (t1-v1)>>2);
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   468
	  XPROD31( iX[4], -iX[5], v0, v1, &oX1[1], &oX2[2] );
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   469
	  v0  = t0-q0;
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   470
	  v1  = t1-q1;
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   471
	  XPROD31( iX[6], -iX[7], v0, v1, &oX1[0], &oX2[3] );
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   472
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   473
	  oX2+=4;
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   474
	  iX+=8;
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   475
	}while(iX<oX1);
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   476
	break;
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   477
      }
7697
767d3c4153a1 switch the Tremor implementation from the Cocos2D one to the lowmem-no-byte branch and let's see what happens
koda
parents: 6045
diff changeset
   478
    }
7849
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   479
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   480
    iX=out+n2+n4;
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   481
    oX1=out+n4;
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   482
    oX2=oX1;
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   483
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   484
    do{
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   485
      oX1-=4;
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   486
      iX-=4;
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   487
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   488
      oX2[0] = -(oX1[3] = iX[3]);
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   489
      oX2[1] = -(oX1[2] = iX[2]);
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   490
      oX2[2] = -(oX1[1] = iX[1]);
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   491
      oX2[3] = -(oX1[0] = iX[0]);
5170
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   492
7849
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   493
      oX2+=4;
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   494
    }while(oX2<iX);
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   495
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   496
    iX=out+n2+n4;
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   497
    oX1=out+n2+n4;
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   498
    oX2=out+n2;
5170
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   499
7849
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   500
    do{
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   501
      oX1-=4;
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   502
      oX1[0]= iX[3];
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   503
      oX1[1]= iX[2];
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   504
      oX1[2]= iX[1];
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   505
      oX1[3]= iX[0];
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   506
      iX+=4;
a12155461b34 revert r767d3c4153a1 this tremor implementation is buggy
koda
parents: 7697
diff changeset
   507
    }while(oX1>oX2);
5170
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   508
  }
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   509
}
f7e49eff3708 add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff changeset
   510