summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Vogelgesang <matthias.vogelgesang@kit.edu>2013-06-19 14:25:29 +0200
committerMatthias Vogelgesang <matthias.vogelgesang@kit.edu>2013-06-19 14:25:29 +0200
commitadaf0ef2f4e046a8f0a16ca8f2f7ffd933306a39 (patch)
treec1d98239f67f7496e9c643c1083c3b6ac360bc40
parent15b142fc8200f900c45e12841feb11c812fa7770 (diff)
downloadlibufodecode-adaf0ef2f4e046a8f0a16ca8f2f7ffd933306a39.tar.gz
libufodecode-adaf0ef2f4e046a8f0a16ca8f2f7ffd933306a39.tar.bz2
libufodecode-adaf0ef2f4e046a8f0a16ca8f2f7ffd933306a39.tar.xz
libufodecode-adaf0ef2f4e046a8f0a16ca8f2f7ffd933306a39.zip
Try to use number of rows from header data
-rw-r--r--src/ufodecode.c5
-rw-r--r--test/ipedec.c15
2 files changed, 12 insertions, 8 deletions
diff --git a/src/ufodecode.c b/src/ufodecode.c
index 635f397..8a6b53a 100644
--- a/src/ufodecode.c
+++ b/src/ufodecode.c
@@ -558,6 +558,7 @@ size_t ufo_decoder_decode_frame(UfoDecoder *decoder,
meta->frame_number = raw[pos++] & 0xFFFFFFF;
CHECK_VALUE(raw[pos] >> 28, 0x5);
meta->time_stamp = raw[pos++] & 0xFFFFFFF;
+ meta->n_rows = 1088;
break;
case 4:
@@ -576,9 +577,7 @@ size_t ufo_decoder_decode_frame(UfoDecoder *decoder,
pos++;
if ((meta->output_mode != IPECAMERA_MODE_4_CHAN_IO) && (meta->output_mode != IPECAMERA_MODE_16_CHAN_IO)) {
-#ifdef DEBUG
fprintf(stderr, "Output mode 0x%x is not supported\n", meta->output_mode);
-#endif
return EILSEQ;
}
break;
@@ -593,11 +592,13 @@ size_t ufo_decoder_decode_frame(UfoDecoder *decoder,
#else
switch (version) {
case 0:
+ meta->n_rows = 1088;
meta->frame_number = raw[pos + 6] & 0xFFFFFFF;
meta->time_stamp = raw[pos + 7] & 0xFFFFFFF;
break;
case 4:
case 5:
+ meta->n_rows = rows_per_frame = raw[pos] & 0x7FF;
meta->frame_number = raw[pos + 6] & 0x1FFFFFF;
meta->time_stamp = raw[pos + 7] & 0xFFFFFF;
meta->output_mode = (raw[pos + 7] >> 24) & 0x3;
diff --git a/test/ipedec.c b/test/ipedec.c
index 04d3d98..fe3ba07 100644
--- a/test/ipedec.c
+++ b/test/ipedec.c
@@ -183,16 +183,16 @@ process_file(const char *filename, Options *opts)
old_time_stamp = 0;
while (error != EIO) {
- if (opts->clear_frame)
- memset(pixels, 0, 2048 * opts->rows * sizeof(uint16_t));
-
timer_start (timer);
error = ufo_decoder_get_next_frame(decoder, &pixels, &meta);
+
+ if (meta.n_rows == 0)
+ meta.n_rows = opts->rows;
+
timer_stop (timer);
n_frames++;
if (!error) {
-
if (opts->verbose) {
printf("Status for frame %i\n", n_frames);
print_meta_data (&meta);
@@ -211,8 +211,11 @@ process_file(const char *filename, Options *opts)
if (opts->print_frame_rate || opts->print_num_rows)
printf("\n");
+ if (opts->clear_frame)
+ memset(pixels, 0, 2048 * meta.n_rows * sizeof(uint16_t));
+
if (!opts->dry_run)
- fwrite(pixels, sizeof(uint16_t), 2048 * opts->rows , fp);
+ fwrite(pixels, sizeof(uint16_t), 2048 * meta.n_rows , fp);
}
else if (error != EIO) {
fprintf(stderr, "Failed to decode frame %i\n", n_frames);
@@ -220,7 +223,7 @@ process_file(const char *filename, Options *opts)
if (opts->cont) {
/* Save the frame even though we know it is corrupted */
if (!opts->dry_run)
- fwrite(pixels, sizeof(uint16_t), 2048 * opts->rows, fp);
+ fwrite(pixels, sizeof(uint16_t), 2048 * meta.n_rows, fp);
}
else
break;