Esempio n. 1
0
bs1770_nd_t *bs1770_nd_init(bs1770_nd_t *node, bs1770_ctx_t *ctx,
	const bs1770_ps_t *lufs, const bs1770_ps_t *lra)
{
  memset(node,0,sizeof *node);

  if (NULL==bs1770_stats_init(&node->lufs,&ctx->lufs,lufs))
	goto error;
  else if (NULL!=lra&&NULL==bs1770_stats_init(&node->lra,&ctx->lra,lra))
	goto error;
  else if (NULL==bs1770_init(&node->bs1770,&node->lufs.aggr,
      NULL!=lra?&node->lra.aggr:NULL))
	goto error;

  return node;
error:
  bs1770_nd_cleanup(node);

  return NULL;
}
Esempio n. 2
0
bs1770_ctx_t *bs1770_ctx_init(bs1770_ctx_t *ctx, int mode, double gate,
    double ms, int partition, double reference)
{
  bs1770_stats_s_init_t bs1770_stats_init
      =BS1770_MODE_H==mode?bs1770_stats_h_init:bs1770_stats_s_init;

  memset(ctx, 0, sizeof *ctx);

  if (NULL==bs1770_stats_init(&ctx->track,gate,ms,partition,reference))
    goto error;

  if (NULL==bs1770_init(&ctx->bs1770, &ctx->track))
    goto error;

  return ctx;
error:
  bs1770_ctx_cleanup(ctx);
  
  return NULL;
}