예제 #1
0
파일: cfimage.c 프로젝트: hao-lh/megawave
Cfimage mw_new_cfimage()
{
  Cfimage image;

  if(!(image = (Cfimage) (malloc(sizeof(struct cfimage)))))
    {
      mwerror(ERROR, 0, "[mw_new_cfimage] Not enough memory\n");
      return(NULL);
    }

  image->nrow = image->ncol = 0;
  image->allocsize = 0;
  image->model = MODEL_RGB;
  image->firstcol = image->lastcol = image->firstrow = image->lastrow = 0.0;

  image->scale = 0.0;
  strcpy(image->cmt,"?");
  strcpy(image->name,"?");

  image->red = image->green = image->blue = NULL;

  image->previous = NULL;
  image->next = NULL;

  return (image);
}
예제 #2
0
파일: cimage.c 프로젝트: hao-lh/megawave
Cimage mw_new_cimage()
{
  Cimage image;

  if(!(image = (Cimage) (malloc(sizeof(struct cimage)))))
    {
      mwerror(ERROR, 0, "[mw_new_cimage] Not enough memory\n");
      return(NULL);
    }

  image->nrow = image->ncol = 0;
  image->allocsize = 0;
  image->firstcol = image->lastcol = image->firstrow = image->lastrow = 0.0;

  image->scale = 1.0;
  strcpy(image->cmt,"?");
  strcpy(image->name,"?");

  image->gray = NULL;

  image->previous = NULL;
  image->next = NULL;

  return (image);
}
예제 #3
0
파일: fsignal.c 프로젝트: jguinet/s2p
Fsignal mw_new_fsignal()
{
    Fsignal signal;

    if (!(signal = (Fsignal) (malloc(sizeof(struct fsignal)))))
    {
        mwerror(ERROR, 0, "[mw_new_fsignal] Not enough memory\n");
        return (NULL);
    }

    signal->size = 0;
    signal->allocsize = 0;
    signal->firstp = signal->lastp = 0;
    signal->param = 0.0;

    signal->scale = 1.0;
    signal->shift = 0.0;
    signal->gain = 1.0;
    signal->sgrate = 1.0;
    signal->bpsample = 8 * sizeof(float);

    strcpy(signal->cmt, "?");
    strcpy(signal->name, "?");

    signal->values = NULL;

    return (signal);
}
예제 #4
0
파일: fsignal.c 프로젝트: jguinet/s2p
Fsignal mw_alloc_fsignal(Fsignal signal, int N)
{
    int mem_size;

    if (signal == NULL)
    {
        mwerror(ERROR, 0,
                "[mw_alloc_fsignal] cannot alloc array : "
                "fsignal structure is NULL\n");
        return (NULL);
    }

    mem_size = N * sizeof(float);
    if (mem_size <= 0)
    {
        mwerror(ERROR, 0,
                "[mw_alloc_fsignal] Attempts to alloc a fsignal "
                "with null size\n");
        return NULL;
    }

    if (signal->values != NULL)
    {
        mwerror(ERROR, 0,
                "[mw_alloc_fsignal] Attempts to alloc a fsignal "
                "which is already allocated\n");
        return (NULL);
    }

    signal->values = (float *) malloc(mem_size);
    if (signal->values == NULL)
    {
        signal->size = 0;
        signal->allocsize = 0;
        mwerror(ERROR, 0, "[mw_alloc_fsignal] Not enough memory\n");
        return (NULL);
    }

    signal->size = N;
    signal->allocsize = mem_size;
    return (signal);
}
예제 #5
0
파일: fsignal.c 프로젝트: jguinet/s2p
void mw_copy_fsignal_values(Fsignal in, Fsignal out)
{
    if ((!in) || (!out) || (!in->values) || (!out->values)
        || (in->size != out->size))
    {
        mwerror(ERROR, 0,
                "[mw_copy_fsignal_values] NULL input or output "
                "signal or signals of different sizes !\n");
        return;
    }

    memcpy(out->values, in->values, sizeof(float) * in->size);
}
예제 #6
0
파일: rawdata.c 프로젝트: hao-lh/megawave
Rawdata mw_new_rawdata()
{
  Rawdata rd;

  if(!(rd = (Rawdata) (malloc(sizeof(struct rawdata)))))
    {
      mwerror(ERROR, 0, "[mw_new_rawdata] Not enough memory\n");
      return(NULL);
    }

  rd->size = 0;
  rd->data = NULL;
  return (rd);
}
예제 #7
0
파일: list.c 프로젝트: hao-lh/megawave
Flist mw_new_flist()
{
  Flist l;

  if(!(l = (Flist) (malloc(sizeof(struct flist))))) {
    mwerror(ERROR,0,"[mw_new_flist] Not enough memory\n");
    return(NULL);
  }
  l->size = l->max_size = l->dim = l->data_size = 0;
  l->values = NULL;
  l->data = NULL;

  return (l);
}
예제 #8
0
파일: fsignal.c 프로젝트: jguinet/s2p
void mw_clear_fsignal(Fsignal signal, float v)
{
    register float *ptr;
    register int l;

    if ((!signal) || (!signal->values))
    {
        mwerror(ERROR, 0,
                "[mw_clear_fsignal] NULL signal struct or NULL values array\n");
        return;
    }

    for (l = 1, ptr = signal->values; l <= signal->size; l++, ptr++)
        *ptr = v;
}
예제 #9
0
파일: fsignal.c 프로젝트: jguinet/s2p
void mw_delete_fsignal(Fsignal signal)
{
    if (signal == NULL)
    {
        mwerror(ERROR, 0,
                "[mw_delete_fsignal] cannot delete : "
                "fsignal structure is NULL\n");
        return;
    }

    if (signal->values != NULL)
        free(signal->values);
    signal->values = NULL;
    free(signal);
    signal = NULL;
}
예제 #10
0
파일: module.c 프로젝트: hao-lh/megawave
Module mw_new_module()

{
    Module module;
    int i;

    if(!(module = (Module) (malloc(sizeof(struct module)))))
    {
        mwerror(ERROR, 0, "[mw_new_module] Not enough memory\n");
        return(NULL);
    }

    module->next = module->previous = module->down = module->up = NULL;
    strcpy(module->name,"?");
    module->type='?';
    return(module);
}
예제 #11
0
파일: ccmovie.c 프로젝트: hao-lh/megawave
Ccmovie mw_new_ccmovie()
{
  Ccmovie movie;

  if(!(movie = (Ccmovie) (malloc(sizeof(struct ccmovie)))))
    {
      mwerror(ERROR, 0, "[mw_new_ccmovie] Not enough memory\n");
      return(NULL);
    }

  movie->scale = 1.0;
  strcpy(movie->cmt,"?");
  strcpy(movie->name,"?");
  movie->first = NULL;

  return (movie);
}
예제 #12
0
파일: fsignal.c 프로젝트: jguinet/s2p
void mw_copy_fsignal_header(Fsignal in, Fsignal out)
{
    if ((!in) || (!out))
    {
        mwerror(ERROR, 0,
                "[mw_copy_fsignal_header] NULL input or output signal !\n");
        return;
    }
    out->firstp = in->firstp;
    out->lastp = in->lastp;
    out->param = in->param;
    out->scale = in->scale;
    out->shift = in->shift;
    out->gain = in->gain;
    out->sgrate = in->sgrate;
    out->bpsample = in->bpsample;
    strcpy(out->cmt, in->cmt);
}
예제 #13
0
파일: fiscalq.c 프로젝트: hao-lh/megawave
static int 
READ_BIT_FIMAGE()

{
  int           bit;              /* Value of read and returned bit */

  if (bits_to_go == 0) {
    if (ncwreadfi == sizecomp) 
      mwerror(FATAL, 1, "Buffer ended to soon while readind header for image!\n");
    else 
      {
	ptrc++;
	buffer = *ptrc;
	bits_to_go = 8;
	ncwreadfi += 1;
      }
  }

  bit = buffer&1;
  buffer >>= 1;
  bits_to_go -= 1;
  return bit;
}
예제 #14
0
파일: wmax2d.c 프로젝트: hao-lh/megawave
Vpoint_wmax mw_new_vpoint_wmax()
{
  Vpoint_wmax vpoint;
  int n;

  if(!(vpoint = (Vpoint_wmax) (malloc(sizeof(struct vpoint_wmax)))))
    {
      mwerror(ERROR, 0, "[mw_new_vpoint_wmax] Not enough memory\n");
      return(NULL);
    }
  vpoint->x = vpoint->y = -1;
  vpoint->previous = NULL;
  vpoint->next = NULL;

  for (n=0;n<mw_max_nlevel;n++) 
    {
      vpoint->mag[n] = mw_not_a_magnitude;
      vpoint->arg[n] = mw_not_an_argument;
    }
  vpoint->argp = mw_not_an_argument;

  return(vpoint);
}