Introduction
Introduction Statistics Contact Development Disclaimer Help
blind-sawtooth-wave.c - blind - suckless command-line video editing utility
git clone git://git.suckless.org/blind
Log
Files
Refs
README
LICENSE
---
blind-sawtooth-wave.c (1327B)
---
1 /* See LICENSE file for copyright and license details. */
2 #ifndef TYPE
3 #include "common.h"
4
5 USAGE("[-e]")
6
7 static int equal = 0;
8
9 #define FILE "blind-sawtooth-wave.c"
10 #include "define-functions.h"
11
12 int
13 main(int argc, char *argv[])
14 {
15 struct stream stream;
16 void (*process)(struct stream *stream);
17
18 ARGBEGIN {
19 case 'e':
20 equal = 1;
21 break;
22 default:
23 usage();
24 } ARGEND;
25
26 if (argc)
27 usage();
28
29 eopen_stream(&stream, NULL);
30
31 SELECT_PROCESS_FUNCTION(&stream);
32 fprint_stream_head(stdout, &stream);
33 efflush(stdout, "<stdout>");
34 process(&stream);
35 return 0;
36 }
37
38 #else
39
40 static void
41 PROCESS(struct stream *stream)
42 {
43 size_t i, j, n;
44 TYPE v, *p;
45 do {
46 if (equal) {
47 n = stream->ptr / stream->pixel_size;
48 for (i = 0; i < n; i++) {
49 p = (TYPE *)(stream->buf) + i * stream->…
50 v = posmod(*p, (TYPE)1);
51 for (j = 0; j < stream->n_chan; j++)
52 p[j] = v;
53 }
54 n *= stream->pixel_size;
55 } else {
56 n = stream->ptr / stream->chan_size;
57 for (i = 0; i < n; i++) {
58 p = (TYPE *)(stream->buf) + i;
59 *p = posmod(*p, (TYPE)1);
60 }
61 n *= stream->chan_size;
62 }
63 ewriteall(STDOUT_FILENO, stream->buf, n, "<stdout>");
64 memmove(stream->buf, stream->buf + n, stream->ptr -= n);
65 } while (eread_stream(stream, SIZE_MAX));
66 if (stream->ptr)
67 eprintf("%s: incomplete frame\n", stream->file);
68 }
69
70 #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.