Browse Source

Add --print-num-rows and fix debug output

Matthias Vogelgesang 11 years ago
parent
commit
90ecb35a99
2 changed files with 8 additions and 9 deletions
  1. 1 5
      src/ufodecode.c
  2. 7 4
      test/ipedec.c

+ 1 - 5
src/ufodecode.c

@@ -299,10 +299,6 @@ ufo_decode_frame_channels_v4(UfoDecoder     *decoder,
         int header = (info >> 30) & 0x03;
         const int bpp = (info >> 16) & 0x0F;
         CHECK_FLAG("raw header magick", header == 2, header);
-
-        /* XXX: rows are numbered absolutely so this becomes unnecessary */
-        /* CHECK_FLAG("row number, only %i rows requested", row < num_rows, row, num_rows); */
-
         CHECK_FLAG("pixel size, only 10 bits are supported", bpp == 10, bpp);
         CHECK_FLAG("channel, limited by %zu output channels", channel < channels_per_row, channel, channels_per_row);
 #endif
@@ -581,7 +577,7 @@ size_t ufo_decoder_decode_frame(UfoDecoder      *decoder,
 
             if ((meta->output_mode != IPECAMERA_MODE_4_CHAN_IO) && (meta->output_mode != IPECAMERA_MODE_16_CHAN_IO)) {
 #ifdef DEBUG
-                fprintf(stderr, "Output mode 0x%lx is not supported\n", meta->output_mode);
+                fprintf(stderr, "Output mode 0x%x is not supported\n", meta->output_mode);
 #endif
                 return EILSEQ;
             }

+ 7 - 4
test/ipedec.c

@@ -187,23 +187,26 @@ process_file(const char *filename, Options *opts)
         timer_stop (timer);
 
         if (!error) {
+            n_frames++;
+
             if (opts->verbose) {
                 printf("Status for frame %i\n", n_frames);
                 print_meta_data (&meta);
             }
 
-            if (opts->print_frame_rate && old_time_stamp != 0) {
+            if (opts->print_frame_rate) {
                 uint32_t diff = 80 * (meta.time_stamp - old_time_stamp);
 
-                printf("%d", 1000000000 / diff);
+                printf("%-6d", 1000000000 / diff);
                 old_time_stamp = meta.time_stamp;
             }
 
+            if (opts->print_num_rows)
+                printf("%d", meta.n_rows); 
+
             if (opts->print_frame_rate || opts->print_num_rows)
                 printf("\n");
 
-            n_frames++;
-
             if (!opts->dry_run)
                 fwrite(pixels, sizeof(uint16_t), 2048 * 1088, fp);
         }