This file is indexed.

/usr/include/mffm/timeCode.H is in mffm-timecode-dev 1.6-2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
/*
  mffm Time Code
  Time Code for multimedia systems

  Copyright (C) 2000, 2001 Matt R. Flax <flatmax@ieee.org>
  
  This library is free software; you can redistribute it and/or
  modify it under the terms of the GNU Lesser General Public
  License as published by the Free Software Foundation; either
  version 2.1 of the License, or (at your option) any later version.
  
  This library is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  Lesser General Public License for more details.
  
  You have received a copy of the GNU Lesser General Public License
  along with this library.
*/
#ifndef TIMECODE_H_
#define TIMECODE_H_

#include <stdarg.h>
#include "masterCounter.H"
#include "masterCounterArray.H"

/** Time Code, inherits the current code
 */
template <class MASTERCOUNTERTYPE, class ARRAYTYPE>
class TimeCode : public MASTERCOUNTERTYPE {
  int beginning, finish;
protected:
  MASTERCOUNTERTYPE start, end;
public:
  // The window count
  MasterCounterArray<MASTERCOUNTERTYPE, ARRAYTYPE> *window;
  //void zeroArray(void) {window->zeroArray();}
  //ARRAYTYPE* getDataPtr(void){return window->getDataPtr();}
  //  ARRAYTYPE& operator[](int i){return window[i];}

  TimeCode(int startVal, ...) : MASTERCOUNTERTYPE (){
#if DEBUG > 1
    std::cout<<"TimeCode::TimeCode(startVal, ...)"<<std::endl;
#endif
    window=NULL;
    va_list ap, ap1, ap2, ap3;
    va_start(ap, startVal);
    va_start(ap1, startVal);
    va_start(ap2, startVal);
    va_start(ap3, startVal);
    init(startVal, ap, ap1, ap2, ap3);
    va_end(ap);
    va_end(ap1);
    va_end(ap2);
    va_end(ap3);
  }

  TimeCode(void) : MASTERCOUNTERTYPE (){
#if DEBUG > 1
    std::cout<<"TimeCode::TimeCode()"<<std::endl;
#endif
    window=NULL;
  }

  void init(int startVal, ...) {
      va_list ap, ap1, ap2, ap3;
      va_start(ap, startVal);
      va_start(ap1, startVal);
      va_start(ap2, startVal);
      va_start(ap3, startVal);
      init(startVal, ap, ap1, ap2, ap3);
      va_end(ap);
      va_end(ap1);
      va_end(ap2);
      va_end(ap3);
  }

 void init(int c, va_list& ap, va_list& apStart, va_list& apEnd, va_list& apWindow){
#if DEBUG > 1
   std::cout<<"TimeCode::init"<<std::endl;
#endif
    beginning=0;
    start.init(beginning, apStart);

    MASTERCOUNTERTYPE::init(c, ap);
    finish=this->getMaxCount();

    // Ensure end points to the last window
    end.init(finish-1, apEnd);

    if (window) delete window;
    if (!(window=new MasterCounterArray<MASTERCOUNTERTYPE, ARRAYTYPE>)) std::cerr <<"TimeCode::init : window malloc error"<<std::endl;
    window->init(this->fields[this->fieldCount()-1]->getMaxCount(), apWindow);
  }

  ~TimeCode(void){
#if DEBUG > 1
    std::cout<<"TimeCode::~TimeCode"<<std::endl;
#endif
    if (window) delete window;
  }

  int getBeginning(void){return beginning;}
  void setBeginning(counter c){setBeginning(c.getCount());}
  void setBeginning(int c){
    if (c>=finish)
      c=finish-1;
    beginning=c;
    setStart(beginning);
  }

  void nothing(){}

  int getStart(){return start.getCount();};
  void setStart(counter c){setStart(c.getCount());}
  void setStart(int c){
#if DEBUG > 1
    std::cout<<"TimeCode::setStart "<<c<<std::endl;
#endif
    //Check that the beginning is not underrun
    // the end minimum is not before the start
    // the end minimum matches the start point
    if (c<beginning) c=beginning;
    if (c>end.getCount()) c=end.getCount();
    //    if (c<end->getMinCount()) end->setMinCount(c);
    end.setMinCount(c);
    nothing();
    start.MASTERCOUNTERTYPE::operator=(c);// set the start point
    //start=c;// set the start point
    //    std::cout<<start<<std::endl;
    setMinCount(start); // reset the minimum of the current time
  }

  int getEnd(){return end.getCount();};
  void setEnd(counter c){setEnd(c.getCount());}
  void setEnd(int c){
#if DEBUG > 1
    std::cout<<"TimeCode::setEnd "<<c<<std::endl;
#endif

    //Check that the finish is not overrun
    // the start maximum is not after the end
    // the start maximum matches the end point
    if (c>finish) c=finish;
    if (c<start.getCount()) c=start.getCount();
    
    start.setMaxCount(c);
    // set the end point
    end.MASTERCOUNTERTYPE::operator=(c);
    setMaxCount(end); // reset the maximum of the current time
  }

  int getFinish(void){return finish;}
  void setFinish(counter c){setEnd(c.getCount());}
  void setFinish(int c){
    finish=c;
    end.setMaxCount(c);
    window->setMaxCount(c);
  }

  /** this function will apply a type II filter using the masterArray as the 
      output.
      Filter coefficients are specified by the arrays a and b, with their
      coefficient counts represented by aCnt and bCnt.
      The input is pointed to by 'input'. The current location must be pointed
      to and there must be at least 'aCnt' elements in the array preceeding
      the pointer.
      This function will only process one output at a time.
      Coefficient notes :
      a[0]=1.0;
      input :
              input  The current value of the input signal
	      aCnt   the number of denomiator coefficients
	      a      the denominator (pole polynomial) coefficients
	      bCnt   the number of numerator coefficients
	      b      the numerator (zero polynomial) coefficients
	      memory the filter memory of dimension max(aCnt,bCnt)
  */
  inline void filter(ARRAYTYPE input, const int aCnt, const double *a, const int bCnt, const double *b, double *memory){
    int j, loc=this->getCount();

    //cout<<a<<'\t'<<b<<'\t'<<memory<<'\n';
    //cout<<aCnt<<'\t'<<bCnt<<'\n';

    // Firstly calculate the output
    (*window)[loc]=input*b[0]+memory[0];
    //cout<<(*window)[loc]<<'\t'<<input<<'\t'<<b[0]<<'\t'<<memory[0]<<'\n';
    // Manipulate the filter memory
    for (j=1;j<aCnt & j<bCnt; j++){
      memory[j-1]=memory[j]+input*b[j]-(*window)[loc]*a[j];
      //cout<<memory[j-1]<<'\t'<<memory[j]<<'\t'<<input<<'\t'<<b[j]<<'\t'<<(*window)[loc]<<'\t'<<a[j]<<'\n';
    }

    //if (bCnt>aCnt)
    for (j;j<bCnt;j++){
      memory[j-1]=memory[j]+input*b[j];
      //cout<<"take 2 b: "<<memory[j-1]<<'\t'<<memory[j]<<'\t'<<input<<'\t'<<b[j]<<'\n';
    }
    //else
    for (j;j<aCnt;j++){
      memory[j-1]=memory[j]-(*window)[loc]*a[j];
      //cout<<"take 2 a "<<memory[j-1]<<'\t'<<memory[j]<<'\t'<<(*window)[loc]<<'\t'<<a[j]<<'\n';
    }
    //cout<<'\n';
  }

  TimeCode& operator =(TimeCode& c){counter::operator=(c);return *this;}
  TimeCode& operator =(counter c){counter::operator=(c);return *this;}
  TimeCode& operator =(int c){counter::operator=(c);return *this;}

  friend std::ostream& operator <<(std::ostream& o, TimeCode& tc) {
    o<<"TimeCode: Beginning: "<<tc.beginning<<" Finish: "<<tc.finish<<'\n';
    o<<"Start: "<<tc.start<<'\n';
    o<<"Current: "<<(MASTERCOUNTERTYPE&)tc<<'\n';
    o<<"End: "<<tc.end<<'\n';
    o<<"Window Count: "<<*tc.window<<'\n';
    return o;
  }
};
#endif //TIMECODE_H_