-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbaremetalAlgorithm.html
142 lines (120 loc) · 4.99 KB
/
baremetalAlgorithm.html
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8'>
<meta http-equiv="X-UA-Compatible" content="chrome=1">
<link rel="stylesheet" type="text/css" href="stylesheets/stylesheet.css" media="screen" />
<link rel="stylesheet" type="text/css" href="stylesheets/pygment_trac.css" media="screen" />
<link rel="stylesheet" type="text/css" href="stylesheets/print.css" media="print" />
<title>baremetalAlgorithm</title>
</head>
<body>
<header>
<div class="container">
<h1>baremetalAlgorithm</h1>
<h2>Some rem usage examples</h2>
<section id="downloads">
<a href="https://github.com/rem1-0/baremetalAlgorithm" class="btn btn-github"><span class="icon"></span>Get in from GitHub</a>
</section>
</div>
</header>
<div class="container">
<section id="main_content">
<h3>
<h3><a name="use-rem" class="anchor" href="#use-rem"><span class="octicon octicon-link"></span></a>Get started</h3>
<h4><a name="use-rem" class="anchor" href="#use-rem"><span class="octicon octicon-link"></span></a>Compilation</h4>
Use your favorite compiler (however we recommend the one used to compile VLC and
the rem module) and use it to create a shared library.
example :
gcc -shared -fPIC example1.c -o example1.so
<h4><a name="use-rem" class="anchor" href="#use-rem"><span class="octicon octicon-link"></span></a>Usage</h4>
See <a href="index.html">Rem documentation</a>
<h3><a name="use-rem" class="anchor" href="#use-rem"><span class="octicon octicon-link"></span></a>Create your own treatment</h3>
A treatment is provided as a shared library defining some functions implemented thanks to an API consisting of two C header files : <b>macros.h</b> and <b>rgb_image.h</b>.
<br>For now, two formats can be passed as input :
<ul><li>packed RGB 32 bits</li>
<li>planar RGB</li>
</ul>
A valid library :
<ul><li>defines at least a function handling one of the two formats :
<ul>
<li>planar_rgb_image_t</li>
<li>packed_rgb32_image_t</li>
</ul></li>
<li>is configured correctly</li>
<li>uses calls to the API in the bodies of the functions</li>
</ul>
<h4><a name="use-rem" class="anchor" href="#use-rem"><span class="octicon octicon-link"></span></a>Prototypes</h4>
Here is the valid prototype for a treatment function :
<ul><li>for planar RGB :
<pre><code>static void tr(const planar_rgb_image_t* in_image,
planar_rgb_image_t* out_image,
void* ptr);
</code></pre></li>
<li>for packed RGB 32 bits :
<pre><code>static void tr(const packed_rgb32_image_t* in_image,
packed_rgb32_image_t* out_image,
void* void_pointer);
</code></pre></li>
</ul>
<h4><a name="use-rem" class="anchor" href="#use-rem"><span class="octicon octicon-link"></span></a>Configuration</h4>
To configure the library, a configuration block must be added in the global scope :
<pre><code>
CONFIG_START
.
.
.
CONFIG_END
</code></pre>
Between <b>CONFIG_START</b> and <b>CONFIG_END</b>, you can add the following declarations :
<ul><li>Declaration of the supported formats :
<pre><code>
PLANAR_RGB_HANDLE(function); // declares "function" as the function to
// be called on planar RGB
PACKED_RGB32_HANDLE(function); // declares "function" as the function to
// be called on packed RGB 32 bits
</code></pre></li>
<li>Declaration of the initialization and finalization functions :
<pre><code>
void PLANAR_RGB_INIT(void function (void**))
void PACKED_RGB32_INIT(void function (void**))
</code></pre>
These functions are called before the treatment begins</li>
<pre><code>
void PLANAR_RGB_FINALIZE(void function (void**))
void PACKED_RGB32_FINALIZE(void function (void**))
</code></pre>
These functions are called after the treatment ends</li>
<li>Declaration of statistics :
<pre><code>
INT_STAT(const char* str); // declares an integer statisctic "str"
TIME_STAT(const char* str); // declares a time statistic "str"
</code></pre>
These statistics can then be used in your code.</li></ul>
<h4><a name="use-rem" class="anchor" href="#use-rem"><span class="octicon octicon-link"></span></a>Bodies</h4>
The following calls can be used for the statistics defined in the configuration block :
<ul><li>time statistics :
<pre><code>
BEGIN_TIME_STAT(const char* str);
END_TIME_STAT(const char* str);
</code></pre>
The time is measured between the call to BEGIN_TIME_STAT and the call to END_TIME_STAT.</li>
<li>integer statistics :
<pre><code>
SET_INT_STAT(const char* str, int value); //sets the value
// of the statistic "str"
</code></pre>
</li>
<li>on-screen display :
<pre><code>
DRAW_LINE(int x1, int y1, int x2, int y2); // draw a line between pixels
// (x1,y1) and (x2,y2)
DRAW_RECTANGLE(int x1, int y1, int x2, int y2) // draw a rectangle
// between pixels
// (x1,y1) and (x2,y2)
</code></pre>
</li></ul>
</section>
</div>
</body>
</html>