Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "Clip.h"
- extern concurrent_vector<short> highPass2ClipQueue;
- extern concurrent_vector<unsigned char> clip2CounterVector;
- struct ClipClass {
- concurrent_vector<short>& myhighPass2ClipQueue;
- concurrent_vector<unsigned char>& myclip2CounterVector;
- char myLowerValue, myUpperValue;
- ClipClass(concurrent_vector<short>& q, concurrent_vector<unsigned char>& v, char& c1, char& c2) : myhighPass2ClipQueue{ q }, myclip2CounterVector{ v }, myLowerValue{ c1 }, myUpperValue{ c2 } {}
- void operator()(const blocked_range<unsigned int> range) const {
- for (int p = range.begin(); p != range.end(); ++p){
- short data = highPass2ClipQueue.at(p);
- if (data < myLowerValue)
- {
- data = myLowerValue;
- }
- else if (data > myUpperValue)
- {
- data = myUpperValue;
- }
- myclip2CounterVector.push_back((unsigned char)data);
- }
- }
- };
- RetVal Clip(char lowerValue, char upperValue)
- {
- // clipping loop
- parallel_for(blocked_range<unsigned int>(0, highPass2ClipQueue.size()), ClipClass(highPass2ClipQueue, clip2CounterVector, lowerValue, upperValue));
- return RET_OK;
- }
- ----------------------------------------------------------------------------------------------
- #ifndef _CLIP_H_
- #define _CLIP_H_
- #include <queue>
- #include <vector>
- #include "tbb/concurrent_vector.h"
- #include "tbb/parallel_for.h"
- #include "defines.h"
- #include "tbb/blocked_range.h"
- using namespace std;
- using namespace tbb;
- RetVal Clip(char lowerValue, char upperValue);
- #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement