Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
ale
imms
Commits
2e937c86
Commit
2e937c86
authored
Mar 23, 2013
by
ale
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
export the stream-based analyzer interface to C
parent
f3512603
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
9 deletions
+30
-9
imms-c.cc
imms-c.cc
+17
-3
imms-c.h
imms-c.h
+13
-6
No files found.
imms-c.cc
View file @
2e937c86
...
...
@@ -8,9 +8,23 @@
const
string
AppName
=
"imms"
;
imms_features_t
imms_analyze
(
int
in_fd
)
{
Analyzer
analyzer
;
return
analyzer
.
analyze
(
in_fd
);
imms_analyzer_t
imms_stream_analyzer_new
()
{
return
(
imms_analyzer_t
)
new
StreamAnalyzer
();
}
void
imms_stream_analyzer_process
(
imms_analyzer_t
aptr
,
char
*
data
,
int
n
)
{
StreamAnalyzer
*
sa
=
reinterpret_cast
<
StreamAnalyzer
*>
(
aptr
);
sa
->
process
(
data
,
n
);
}
imms_features_t
imms_stream_analyzer_get_result
(
imms_analyzer_t
aptr
)
{
StreamAnalyzer
*
sa
=
reinterpret_cast
<
StreamAnalyzer
*>
(
aptr
);
return
(
imms_features_t
)
sa
->
get_result
();
}
void
imms_stream_analyzer_free
(
imms_analyzer_t
aptr
)
{
StreamAnalyzer
*
sa
=
reinterpret_cast
<
StreamAnalyzer
*>
(
aptr
);
delete
sa
;
}
imms_features_t
imms_features_from_data
(
char
*
buf
,
int
n
)
{
...
...
imms-c.h
View file @
2e937c86
...
...
@@ -6,23 +6,30 @@ extern "C" {
#endif
// Opaque types.
typedef
void
*
imms_
similarity_model
_t
;
typedef
void
*
imms_
analyzer
_t
;
typedef
void
*
imms_features_t
;
typedef
void
*
imms_similarity_model_t
;
// C wrappers for the analysis/model API.
// Analyze the input stream (given with a file descriptor) and return
// feature data.
imms_features_t
imms_analyze
(
int
);
// A StreamAnalyzer analyzes the input stream (passed in buffers of
// arbitrary size by the caller) and returns feature data.
imms_analyzer_t
imms_stream_analyzer_new
();
void
imms_stream_analyzer_process
(
imms_analyzer_t
,
char
*
,
int
);
imms_features_t
imms_stream_analyzer_get_result
(
imms_analyzer_t
);
void
imms_stream_analyzer_free
(
imms_analyzer_t
);
// Deserialize feature data.
imms_features_t
imms_features_from_data
(
char
*
,
int
);
// Returns the size of the serialized feature data, in bytes.
int
imms_features_d
ump
_size
();
int
imms_features_d
ata
_size
();
// Serialize feature data into the provided buffer.
void
imms_features_d
ump
(
imms_features_t
,
char
*
,
int
);
void
imms_features_d
ata
(
imms_features_t
,
char
*
,
int
);
// Free resources associated with feature data.
void
imms_features_free
(
imms_features_t
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment