Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
elphel-apps-camogm
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Elphel
elphel-apps-camogm
Commits
4d5a1967
Commit
4d5a1967
authored
Jul 15, 2016
by
Mikhail Karpenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reorder decision tree in 'build_index' function
parent
b7da7e4f
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
21 deletions
+20
-21
camogm_read.c
camogm_read.c
+20
-21
No files found.
camogm_read.c
View file @
4d5a1967
...
@@ -1289,7 +1289,6 @@ static inline void exit_thread(void *arg)
...
@@ -1289,7 +1289,6 @@ static inline void exit_thread(void *arg)
* @param[out] idir a pointer to disk index directory. This directory will contain
* @param[out] idir a pointer to disk index directory. This directory will contain
* offset of the files found in the raw device buffer.
* offset of the files found in the raw device buffer.
* @return None
* @return None
* @todo reorder decision tree
*/
*/
static
void
build_index
(
camogm_state
*
state
,
struct
disk_idir
*
idir
)
static
void
build_index
(
camogm_state
*
state
,
struct
disk_idir
*
idir
)
{
{
...
@@ -1374,6 +1373,26 @@ static void build_index(camogm_state *state, struct disk_idir *idir)
...
@@ -1374,6 +1373,26 @@ static void build_index(camogm_state *state, struct disk_idir *idir)
// normal condition, search in progress
// normal condition, search in progress
buff_processed
=
1
;
buff_processed
=
1
;
// D6(fprintf(debug_file, "State 'skip data'\n"));
// D6(fprintf(debug_file, "State 'skip data'\n"));
}
else
if
(
pos_start
>=
0
&&
pos_stop
>=
0
&&
pos_start
>
pos_stop
)
{
// normal condition, start marker following stop marker found - this indicates a new file
if
(
search_state
==
SEARCH_FILE_DATA
)
{
uint64_t
disk_pos
=
dev_curr_pos
+
pos_stop
+
(
save_from
-
active_buff
);
idir_result
=
stop_index
(
idir
->
tail
,
disk_pos
);
}
if
(
zero_cross
==
0
)
{
state
->
rawdev
.
file_start
=
dev_curr_pos
+
pos_start
+
(
save_from
-
active_buff
);
idir_result
=
read_index
(
&
state
->
rawdev
,
&
node
);
if
(
idir_result
==
0
)
add_node
(
idir
,
node
);
search_state
=
SEARCH_FILE_DATA
;
save_from
=
save_from
+
pos_start
+
add_stm_len
;
// @todo: replace with pointer to current buffer
save_to
=
buff
+
rd
;
}
else
{
buff_processed
=
1
;
process
=
0
;
}
D6
(
fprintf
(
debug_file
,
"State 'stop current file and start new file'
\n
"
));
}
else
if
(
pos_start
>=
0
&&
pos_stop
==
MATCH_NOT_FOUND
&&
search_state
==
SEARCH_SKIP
)
{
}
else
if
(
pos_start
>=
0
&&
pos_stop
==
MATCH_NOT_FOUND
&&
search_state
==
SEARCH_SKIP
)
{
// normal condition, new file found
// normal condition, new file found
search_state
=
SEARCH_FILE_DATA
;
search_state
=
SEARCH_FILE_DATA
;
...
@@ -1411,26 +1430,6 @@ static void build_index(camogm_state *state, struct disk_idir *idir)
...
@@ -1411,26 +1430,6 @@ static void build_index(camogm_state *state, struct disk_idir *idir)
// error condition (normally should not happen), drop current read buffer and do nothing
// error condition (normally should not happen), drop current read buffer and do nothing
buff_processed
=
1
;
buff_processed
=
1
;
D6
(
fprintf
(
debug_file
,
"State 'abnormal stop marker, skip data'
\n
"
));
D6
(
fprintf
(
debug_file
,
"State 'abnormal stop marker, skip data'
\n
"
));
}
else
if
(
pos_start
>=
0
&&
pos_stop
>=
0
&&
pos_start
>
pos_stop
)
{
// normal condition, start marker following stop marker found - this indicates a new file
if
(
search_state
==
SEARCH_FILE_DATA
)
{
uint64_t
disk_pos
=
dev_curr_pos
+
pos_stop
+
(
save_from
-
active_buff
);
idir_result
=
stop_index
(
idir
->
tail
,
disk_pos
);
}
if
(
zero_cross
==
0
)
{
state
->
rawdev
.
file_start
=
dev_curr_pos
+
pos_start
+
(
save_from
-
active_buff
);
idir_result
=
read_index
(
&
state
->
rawdev
,
&
node
);
if
(
idir_result
==
0
)
add_node
(
idir
,
node
);
search_state
=
SEARCH_FILE_DATA
;
save_from
=
save_from
+
pos_start
+
add_stm_len
;
// @todo: replace with pointer to current buffer
save_to
=
buff
+
rd
;
}
else
{
buff_processed
=
1
;
process
=
0
;
}
D6
(
fprintf
(
debug_file
,
"State 'stop current file and start new file'
\n
"
));
}
else
if
(
pos_start
==
MATCH_PARTIAL
&&
search_state
==
SEARCH_SKIP
)
{
}
else
if
(
pos_start
==
MATCH_PARTIAL
&&
search_state
==
SEARCH_SKIP
)
{
// partial start marker found in the end of read buffer, get next chunk of data and try to find marker there
// partial start marker found in the end of read buffer, get next chunk of data and try to find marker there
enum
match_result
result
;
enum
match_result
result
;
...
...
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