Changeset 1120f86


Ignore:
Timestamp:
Apr 21, 2016, 6:21:43 PM (3 years ago)
Author:
Paul Brossier <piem@piem.org>
Branches:
feature/autosink, feature/constantq, feature/pitchshift, feature/pydocstrings, feature/timestretch, master, pitchshift, sampler, timestretch, yinfft+
Children:
ae5d58a
Parents:
c4d251c
Message:

src/{fvec,cvec,fmat,lvec}.{c,h}: added const qualifiers to unmodified pointers

Location:
src
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • src/cvec.c

    rc4d251c r1120f86  
    2222#include "cvec.h"
    2323
    24 cvec_t * new_cvec( uint_t length) {
     24cvec_t * new_cvec(uint_t length) {
    2525  cvec_t * s;
    2626  if ((sint_t)length <= 0) {
     
    5656}
    5757
    58 smpl_t * cvec_norm_get_data (cvec_t *s) {
     58smpl_t * cvec_norm_get_data (const cvec_t *s) {
    5959  return s->norm;
    6060}
    6161
    62 smpl_t * cvec_phas_get_data (cvec_t *s) {
     62smpl_t * cvec_phas_get_data (const cvec_t *s) {
    6363  return s->phas;
    6464}
     
    6666/* helper functions */
    6767
    68 void cvec_print(cvec_t *s) {
     68void cvec_print(const cvec_t *s) {
    6969  uint_t j;
    7070  AUBIO_MSG("norm: ");
     
    8080}
    8181
    82 void cvec_copy(cvec_t *s, cvec_t *t) {
     82void cvec_copy(const cvec_t *s, cvec_t *t) {
    8383  if (s->length != t->length) {
    8484    AUBIO_ERR("trying to copy %d elements to %d elements \n",
  • src/cvec.h

    rc4d251c r1120f86  
    151151
    152152*/
    153 smpl_t * cvec_norm_get_data (cvec_t *s);
     153smpl_t * cvec_norm_get_data (const cvec_t *s);
    154154
    155155/** read phase data from a complex buffer
     
    163163
    164164*/
    165 smpl_t * cvec_phas_get_data (cvec_t *s);
     165smpl_t * cvec_phas_get_data (const cvec_t *s);
    166166
    167167/** print out cvec data
     
    170170
    171171*/
    172 void cvec_print(cvec_t *s);
     172void cvec_print(const cvec_t *s);
    173173
    174174/** make a copy of a vector
     
    178178
    179179*/
    180 void cvec_copy(cvec_t *s, cvec_t *t);
     180void cvec_copy(const cvec_t *s, cvec_t *t);
    181181
    182182/** set all norm elements to a given value
  • src/fmat.c

    rc4d251c r1120f86  
    5454}
    5555
    56 smpl_t fmat_get_sample(fmat_t *s, uint_t channel, uint_t position) {
     56smpl_t fmat_get_sample(const fmat_t *s, uint_t channel, uint_t position) {
    5757  return s->data[channel][position];
    5858}
    5959
    60 void fmat_get_channel(fmat_t *s, uint_t channel, fvec_t *output) {
     60void fmat_get_channel(const fmat_t *s, uint_t channel, fvec_t *output) {
    6161  output->data = s->data[channel];
    6262  output->length = s->length;
     
    6464}
    6565
    66 smpl_t * fmat_get_channel_data(fmat_t *s, uint_t channel) {
     66smpl_t * fmat_get_channel_data(const fmat_t *s, uint_t channel) {
    6767  return s->data[channel];
    6868}
    6969
    70 smpl_t ** fmat_get_data(fmat_t *s) {
     70smpl_t ** fmat_get_data(const fmat_t *s) {
    7171  return s->data;
    7272}
     
    7474/* helper functions */
    7575
    76 void fmat_print(fmat_t *s) {
     76void fmat_print(const fmat_t *s) {
    7777  uint_t i,j;
    7878  for (i=0; i< s->height; i++) {
     
    117117}
    118118
    119 void fmat_weight(fmat_t *s, fmat_t *weight) {
     119void fmat_weight(fmat_t *s, const fmat_t *weight) {
    120120  uint_t i,j;
    121121  uint_t length = MIN(s->length, weight->length);
     
    127127}
    128128
    129 void fmat_copy(fmat_t *s, fmat_t *t) {
     129void fmat_copy(const fmat_t *s, fmat_t *t) {
    130130  uint_t i;
    131131#if !HAVE_MEMCPY_HACKS
     
    155155}
    156156
    157 void fmat_vecmul(fmat_t *s, fvec_t *scale, fvec_t *output) {
     157void fmat_vecmul(const fmat_t *s, const fvec_t *scale, fvec_t *output) {
    158158  uint_t k;
    159159#if 0
  • src/fmat.h

    rc4d251c r1120f86  
    6666
    6767*/
    68 smpl_t fmat_get_sample(fmat_t *s, uint_t channel, uint_t position);
     68smpl_t fmat_get_sample(const fmat_t *s, uint_t channel, uint_t position);
    6969
    7070/** write sample value in a buffer
     
    8585
    8686*/
    87 void fmat_get_channel (fmat_t *s, uint_t channel, fvec_t *output);
     87void fmat_get_channel (const fmat_t *s, uint_t channel, fvec_t *output);
    8888
    8989/** get vector buffer from an fmat data
     
    9393
    9494*/
    95 smpl_t * fmat_get_channel_data (fmat_t *s, uint_t channel);
     95smpl_t * fmat_get_channel_data (const fmat_t *s, uint_t channel);
    9696
    9797/** read data from a buffer
     
    100100
    101101*/
    102 smpl_t ** fmat_get_data(fmat_t *s);
     102smpl_t ** fmat_get_data(const fmat_t *s);
    103103
    104104/** print out fmat data
     
    107107
    108108*/
    109 void fmat_print(fmat_t *s);
     109void fmat_print(const fmat_t *s);
    110110
    111111/** set all elements to a given value
     
    147147
    148148*/
    149 void fmat_weight(fmat_t *s, fmat_t *weight);
     149void fmat_weight(fmat_t *s, const fmat_t *weight);
    150150
    151151/** make a copy of a matrix
     
    155155
    156156*/
    157 void fmat_copy(fmat_t *s, fmat_t *t);
     157void fmat_copy(const fmat_t *s, fmat_t *t);
    158158
    159159/* compute the product of a matrix by a vector
     
    164164
    165165*/
    166 void fmat_vecmul(fmat_t *s, fvec_t *scale, fvec_t *output);
     166void fmat_vecmul(const fmat_t *s, const fvec_t *scale, fvec_t *output);
    167167
    168168#ifdef __cplusplus
  • src/fvec.c

    rc4d251c r1120f86  
    2222#include "fvec.h"
    2323
    24 fvec_t * new_fvec( uint_t length) {
     24fvec_t * new_fvec(uint_t length) {
    2525  fvec_t * s;
    2626  if ((sint_t)length <= 0) {
     
    4242}
    4343
    44 smpl_t fvec_get_sample(fvec_t *s, uint_t position) {
     44smpl_t fvec_get_sample(const fvec_t *s, uint_t position) {
    4545  return s->data[position];
    4646}
    4747
    48 smpl_t * fvec_get_data(fvec_t *s) {
     48smpl_t * fvec_get_data(const fvec_t *s) {
    4949  return s->data;
    5050}
     
    5252/* helper functions */
    5353
    54 void fvec_print(fvec_t *s) {
     54void fvec_print(const fvec_t *s) {
    5555  uint_t j;
    5656  for (j=0; j< s->length; j++) {
     
    9696}
    9797
    98 void fvec_weight(fvec_t *s, fvec_t *weight) {
     98void fvec_weight(fvec_t *s, const fvec_t *weight) {
    9999#ifndef HAVE_ACCELERATE
    100100  uint_t j;
     
    108108}
    109109
    110 void fvec_weighted_copy(fvec_t *in, fvec_t *weight, fvec_t *out) {
     110void fvec_weighted_copy(const fvec_t *in, const fvec_t *weight, fvec_t *out) {
    111111#ifndef HAVE_ACCELERATE
    112112  uint_t j;
     
    120120}
    121121
    122 void fvec_copy(fvec_t *s, fvec_t *t) {
     122void fvec_copy(const fvec_t *s, fvec_t *t) {
    123123  if (s->length != t->length) {
    124124    AUBIO_ERR("trying to copy %d elements to %d elements \n",
  • src/fvec.h

    rc4d251c r1120f86  
    9090
    9191*/
    92 smpl_t fvec_get_sample(fvec_t *s, uint_t position);
     92smpl_t fvec_get_sample(const fvec_t *s, uint_t position);
    9393
    9494/** write sample value in a buffer
     
    106106
    107107*/
    108 smpl_t * fvec_get_data(fvec_t *s);
     108smpl_t * fvec_get_data(const fvec_t *s);
    109109
    110110/** print out fvec data
     
    113113
    114114*/
    115 void fvec_print(fvec_t *s);
     115void fvec_print(const fvec_t *s);
    116116
    117117/** set all elements to a given value
     
    153153
    154154*/
    155 void fvec_weight(fvec_t *s, fvec_t *weight);
     155void fvec_weight(fvec_t *s, const fvec_t *weight);
    156156
    157157/** make a copy of a vector
     
    161161
    162162*/
    163 void fvec_copy(fvec_t *s, fvec_t *t);
     163void fvec_copy(const fvec_t *s, fvec_t *t);
    164164
    165165/** make a copy of a vector, applying weights to each element
     
    170170
    171171*/
    172 void fvec_weighted_copy(fvec_t *in, fvec_t *weight, fvec_t *out);
     172void fvec_weighted_copy(const fvec_t *in, const fvec_t *weight, fvec_t *out);
    173173
    174174#ifdef __cplusplus
  • src/lvec.c

    rc4d251c r1120f86  
    2222#include "lvec.h"
    2323
    24 lvec_t * new_lvec( uint_t length) {
     24lvec_t * new_lvec(uint_t length) {
    2525  lvec_t * s;
    2626  if ((sint_t)length <= 0) {
     
    4646}
    4747
    48 lsmp_t * lvec_get_data(lvec_t *s) {
     48lsmp_t * lvec_get_data(const lvec_t *s) {
    4949  return s->data;
    5050}
     
    5252/* helper functions */
    5353
    54 void lvec_print(lvec_t *s) {
     54void lvec_print(const lvec_t *s) {
    5555  uint_t j;
    5656  for (j=0; j< s->length; j++) {
  • src/lvec.h

    rc4d251c r1120f86  
    8181
    8282*/
    83 lsmp_t * lvec_get_data(lvec_t *s);
     83lsmp_t * lvec_get_data(const lvec_t *s);
    8484
    8585/** print out lvec data
     
    8888
    8989*/
    90 void lvec_print(lvec_t *s);
     90void lvec_print(const lvec_t *s);
    9191
    9292/** set all elements to a given value
Note: See TracChangeset for help on using the changeset viewer.