/alps/ipecamera

To get this branch, use:
bzr branch http://darksoft.org/webbzr/alps/ipecamera

« back to all changes in this revision

Viewing changes to ipecamera/ipecamera.c

  • Committer: Suren A. Chilingaryan
  • Date: 2012-07-04 23:54:12 UTC
  • Revision ID: csa@dside.dyndns.org-20120704235412-ozpqr63e9ve2omjp
UFO5 size estimation

Show diffs side-by-side

added added

removed removed

Lines of Context:
241
241
    pcilib_t *pcilib = vctx->pcilib;
242
242
    pcilib_register_value_t value;
243
243
    
244
 
    const size_t chan_size = (2 + IPECAMERA_PIXELS_PER_CHANNEL / 3) * sizeof(ipecamera_payload_t);
245
 
    const size_t line_size = (IPECAMERA_MAX_CHANNELS * chan_size);
246
 
    const size_t header_size = 8 * sizeof(ipecamera_payload_t);
247
 
    const size_t footer_size = 8 * sizeof(ipecamera_payload_t);
248
 
    size_t raw_size;
249
 
    size_t padded_blocks;
250
 
    
251
244
    pthread_attr_t attr;
252
245
    struct sched_param sched;
253
246
    
279
272
    ctx->dim.width = IPECAMERA_WIDTH;
280
273
    GET_REG(n_lines_reg, ctx->dim.height);
281
274
    
282
 
    raw_size = header_size + ctx->dim.height * line_size + footer_size;
283
 
    padded_blocks = raw_size / IPECAMERA_DMA_PACKET_LENGTH + ((raw_size % IPECAMERA_DMA_PACKET_LENGTH)?1:0);
284
 
    
 
275
    ipecamera_compute_buffer_size(ctx, ctx->dim.height);
 
276
 
 
277
    ctx->raw_size = ctx->cur_raw_size;
 
278
    ctx->full_size = ctx->cur_full_size;
 
279
    ctx->padded_size = ctx->cur_padded_size;
 
280
 
285
281
    ctx->image_size = ctx->dim.width * ctx->dim.height;
286
 
    ctx->raw_size = raw_size;
287
 
    ctx->full_size = padded_blocks * IPECAMERA_DMA_PACKET_LENGTH;
288
 
 
289
 
#ifdef IPECAMERA_BUG_EXTRA_DATA
290
 
    ctx->full_size += 8;
291
 
    padded_blocks ++;
292
 
#endif /* IPECAMERA_BUG_EXTRA_DATA */
293
 
 
294
 
    ctx->padded_size = padded_blocks * IPECAMERA_DMA_PACKET_LENGTH;
295
282
 
296
283
    ctx->buffer = malloc(ctx->padded_size * ctx->buffer_size);
297
284
    if (!ctx->buffer) {