Advertisement
canezzy

highPass

Apr 3rd, 2018
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.93 KB | None | 0 0
  1. #include "HighPassFilter.h"
  2.  
  3. extern queue<unsigned char> in2HighPassQueue;
  4. extern concurrent_vector<short> highPass2ClipQueue;
  5.  
  6. RetVal HighPassFilter(float alpha)
  7. {
  8.     // input data
  9.     static short xCurr = 0;
  10.     static short xPrev = 0;
  11.    
  12.     // output data
  13.     static short yCurr = 0;
  14.     static short yPrev = 0;
  15.  
  16.     // filterring
  17.     while(!in2HighPassQueue.empty())
  18.     {
  19.         xPrev = xCurr;
  20.         xCurr = in2HighPassQueue.front();
  21.         in2HighPassQueue.pop();
  22.  
  23.         yPrev = yCurr;
  24.         yCurr = alpha * (yPrev + xCurr - xPrev);
  25.  
  26.         highPass2ClipQueue.push_back(yCurr);
  27.     }
  28.  
  29.     return RET_OK;
  30. }
  31.  
  32.  
  33. --------------------------------------------------------
  34.  
  35.  
  36.  
  37. #ifndef _HIGH_PASS_FILTER_H_
  38. #define _HIGH_PASS_FILTER_H_
  39.  
  40. #include <queue>
  41. #include "tbb/concurrent_vector.h"
  42. #include "defines.h"
  43.  
  44. using namespace std;
  45. using namespace tbb;
  46.  
  47. RetVal HighPassFilter(float alpha);
  48.  
  49. #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement