Introduction
Introduction Statistics Contact Development Disclaimer Help
blind-quaternion-product.c - blind - suckless command-line video editing utility
git clone git://git.suckless.org/blind
Log
Files
Refs
README
LICENSE
---
blind-quaternion-product.c (1418B)
---
1 /* See LICENSE file for copyright and license details. */
2 #ifndef TYPE
3 #include "common.h"
4
5 USAGE("right-hand-stream")
6
7 #define FILE "blind-quaternion-product.c"
8 #include "define-functions.h"
9
10 int
11 main(int argc, char *argv[])
12 {
13 struct stream left, right;
14 void (*process)(struct stream *left, struct stream *right, size_…
15
16 UNOFLAGS(argc != 1);
17
18 eopen_stream(&left, NULL);
19 eopen_stream(&right, argv[0]);
20
21 SELECT_PROCESS_FUNCTION(&left);
22 CHECK_ALPHA_CHAN(&left);
23 CHECK_N_CHAN(&left, 4, 4);
24
25 fprint_stream_head(stdout, &left);
26 efflush(stdout, "<stdout>");
27 process_two_streams(&left, &right, STDOUT_FILENO, "<stdout>", pr…
28 return 0;
29 }
30
31 #else
32
33 static void
34 PROCESS(struct stream *left, struct stream *right, size_t n)
35 {
36 size_t i;
37 TYPE *lx, *ly, *lz, *la, *rx, *ry, *rz, *ra, x, y, z, a;
38 for (i = 0; i < n; i += 4 * sizeof(TYPE)) {
39 lx = ((TYPE *)(left->buf + i)) + 0, rx = ((TYPE *)(right…
40 ly = ((TYPE *)(left->buf + i)) + 1, ry = ((TYPE *)(right…
41 lz = ((TYPE *)(left->buf + i)) + 2, rz = ((TYPE *)(right…
42 la = ((TYPE *)(left->buf + i)) + 3, ra = ((TYPE *)(right…
43 x = *lx * *rx - *ly * *ry - *lz * *rz - *la * *ra;
44 y = *lz * *ra - *la * *rz + *lx * *ry + *ly * *rx;
45 z = *la * *ry - *ly * *rz + *lx * *rz + *lz * *rx;
46 a = *ly * *rz - *lz * *rz + *lx * *ra + *la * *rx;
47 *lx = x;
48 *ly = y;
49 *lz = z;
50 *la = a;
51 }
52 }
53
54 #endif
You are viewing proxied material from suckless.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.