Bug 1910842 - fix non-scaling-stroke when outer svg element has a CSS transform r...
[gecko.git] / media / libopus / celt / mips / vq_mipsr1.h
blob1621c5624f257a7c5971e10a1bdf6f93a04ed531
1 /* Copyright (c) 2007-2008 CSIRO
2 Copyright (c) 2007-2009 Xiph.Org Foundation
3 Written by Jean-Marc Valin */
4 /*
5 Redistribution and use in source and binary forms, with or without
6 modification, are permitted provided that the following conditions
7 are met:
9 - Redistributions of source code must retain the above copyright
10 notice, this list of conditions and the following disclaimer.
12 - Redistributions in binary form must reproduce the above copyright
13 notice, this list of conditions and the following disclaimer in the
14 documentation and/or other materials provided with the distribution.
16 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
20 OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
21 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
22 PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
23 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
24 LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
25 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 #ifndef VQ_MIPSR1_H__
30 #define VQ_MIPSR1_H__
32 #ifdef HAVE_CONFIG_H
33 #include "config.h"
34 #endif
36 #include "mathops.h"
37 #include "arch.h"
39 #define OVERRIDE_vq_exp_rotation1
40 static void exp_rotation1(celt_norm *X, int len, int stride, opus_val16 c, opus_val16 s)
42 int i;
43 opus_val16 ms;
44 celt_norm *Xptr;
45 Xptr = X;
46 ms = NEG16(s);
47 for (i=0;i<len-stride;i++)
49 celt_norm x1, x2;
50 x1 = Xptr[0];
51 x2 = Xptr[stride];
52 Xptr[stride] = EXTRACT16(PSHR32(MAC16_16(MULT16_16(c, x2), s, x1), 15));
53 *Xptr++ = EXTRACT16(PSHR32(MAC16_16(MULT16_16(c, x1), ms, x2), 15));
55 Xptr = &X[len-2*stride-1];
56 for (i=len-2*stride-1;i>=0;i--)
58 celt_norm x1, x2;
59 x1 = Xptr[0];
60 x2 = Xptr[stride];
61 Xptr[stride] = EXTRACT16(PSHR32(MAC16_16(MULT16_16(c, x2), s, x1), 15));
62 *Xptr-- = EXTRACT16(PSHR32(MAC16_16(MULT16_16(c, x1), ms, x2), 15));
66 #define OVERRIDE_renormalise_vector
67 void renormalise_vector(celt_norm *X, int N, opus_val16 gain, int arch)
69 int i;
70 #ifdef FIXED_POINT
71 int k;
72 #endif
73 opus_val32 E = EPSILON;
74 opus_val16 g;
75 opus_val32 t;
76 celt_norm *xptr = X;
77 int X0, X1;
79 (void)arch;
81 asm volatile("mult $ac1, $0, $0");
82 asm volatile("MTLO %0, $ac1" : :"r" (E));
83 /*if(N %4)
84 printf("error");*/
85 for (i=0;i<N-2;i+=2)
87 X0 = (int)*xptr++;
88 asm volatile("MADD $ac1, %0, %1" : : "r" (X0), "r" (X0));
90 X1 = (int)*xptr++;
91 asm volatile("MADD $ac1, %0, %1" : : "r" (X1), "r" (X1));
94 for (;i<N;i++)
96 X0 = (int)*xptr++;
97 asm volatile("MADD $ac1, %0, %1" : : "r" (X0), "r" (X0));
100 asm volatile("MFLO %0, $ac1" : "=r" (E));
101 #ifdef FIXED_POINT
102 k = celt_ilog2(E)>>1;
103 #endif
104 t = VSHR32(E, 2*(k-7));
105 g = MULT16_16_P15(celt_rsqrt_norm(t),gain);
107 xptr = X;
108 for (i=0;i<N;i++)
110 *xptr = EXTRACT16(PSHR32(MULT16_16(g, *xptr), k+1));
111 xptr++;
113 /*return celt_sqrt(E);*/
116 #endif /* VQ_MIPSR1_H__ */