blob: e0235a427ec2584b5b6796ab57e5fa5e6649ac85 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
/*
* PowerPC specific render optims live here
*/
#include "fitz_base.h"
#include "fitz_tree.h"
#include "fitz_draw.h"
typedef unsigned char byte;
#ifdef HAVE_ALTIVEC
static void srow1ppc(byte *src, byte *dst, int w, int denom)
{
int x, left;
int sum;
left = 0;
sum = 0;
for (x = 0; x < w; x++)
{
sum += *src++;
if (++left == denom)
{
left = 0;
*dst++ = sum / denom;
sum = 0;
}
}
if (left)
*dst++ = sum / left;
}
static void scol1ppc(byte *src, byte *dst, int w, int denom)
{
int x, y;
unsigned char *s;
int sum;
for (x = 0; x < w; x++)
{
s = src + x;
sum = 0;
for (y = 0; y < denom; y++)
sum += s[y * w];
*dst++ = sum / denom;
}
}
#endif /* HAVE_ALTIVEC */
#if defined (ARCH_PPC)
void
fz_accelerate(void)
{
# ifdef HAVE_ALTIVEC
if (fz_cpuflags & HAVE_ALTIVEC)
{
fz_srow1 = srow1ppc;
fz_scol1 = scol1ppc;
}
# endif
}
#endif
|