summaryrefslogtreecommitdiffstats
path: root/ipecamera/ipecamera.c
diff options
context:
space:
mode:
authorSuren A. Chilingaryan <csa@dside.dyndns.org>2012-07-05 01:54:12 +0200
committerSuren A. Chilingaryan <csa@dside.dyndns.org>2012-07-05 01:54:12 +0200
commit59a6ce037b0806e26c5d6dada2e12ea4bbe1b588 (patch)
tree679c51c7127780792ace07e7b98dea7edca77ecf /ipecamera/ipecamera.c
parent71657075c0e9991d36f640554b8f4ac4d2ae95ba (diff)
downloadipecamera-59a6ce037b0806e26c5d6dada2e12ea4bbe1b588.tar.gz
ipecamera-59a6ce037b0806e26c5d6dada2e12ea4bbe1b588.tar.bz2
ipecamera-59a6ce037b0806e26c5d6dada2e12ea4bbe1b588.tar.xz
ipecamera-59a6ce037b0806e26c5d6dada2e12ea4bbe1b588.zip
UFO5 size estimation
Diffstat (limited to 'ipecamera/ipecamera.c')
-rw-r--r--ipecamera/ipecamera.c23
1 files changed, 5 insertions, 18 deletions
diff --git a/ipecamera/ipecamera.c b/ipecamera/ipecamera.c
index b76cf19..9b7482a 100644
--- a/ipecamera/ipecamera.c
+++ b/ipecamera/ipecamera.c
@@ -241,13 +241,6 @@ int ipecamera_start(pcilib_context_t *vctx, pcilib_event_t event_mask, pcilib_ev
pcilib_t *pcilib = vctx->pcilib;
pcilib_register_value_t value;
- const size_t chan_size = (2 + IPECAMERA_PIXELS_PER_CHANNEL / 3) * sizeof(ipecamera_payload_t);
- const size_t line_size = (IPECAMERA_MAX_CHANNELS * chan_size);
- const size_t header_size = 8 * sizeof(ipecamera_payload_t);
- const size_t footer_size = 8 * sizeof(ipecamera_payload_t);
- size_t raw_size;
- size_t padded_blocks;
-
pthread_attr_t attr;
struct sched_param sched;
@@ -279,19 +272,13 @@ int ipecamera_start(pcilib_context_t *vctx, pcilib_event_t event_mask, pcilib_ev
ctx->dim.width = IPECAMERA_WIDTH;
GET_REG(n_lines_reg, ctx->dim.height);
- raw_size = header_size + ctx->dim.height * line_size + footer_size;
- padded_blocks = raw_size / IPECAMERA_DMA_PACKET_LENGTH + ((raw_size % IPECAMERA_DMA_PACKET_LENGTH)?1:0);
-
- ctx->image_size = ctx->dim.width * ctx->dim.height;
- ctx->raw_size = raw_size;
- ctx->full_size = padded_blocks * IPECAMERA_DMA_PACKET_LENGTH;
+ ipecamera_compute_buffer_size(ctx, ctx->dim.height);
-#ifdef IPECAMERA_BUG_EXTRA_DATA
- ctx->full_size += 8;
- padded_blocks ++;
-#endif /* IPECAMERA_BUG_EXTRA_DATA */
+ ctx->raw_size = ctx->cur_raw_size;
+ ctx->full_size = ctx->cur_full_size;
+ ctx->padded_size = ctx->cur_padded_size;
- ctx->padded_size = padded_blocks * IPECAMERA_DMA_PACKET_LENGTH;
+ ctx->image_size = ctx->dim.width * ctx->dim.height;
ctx->buffer = malloc(ctx->padded_size * ctx->buffer_size);
if (!ctx->buffer) {