Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- __m64 EdgeDetector::populateRun(unsigned int x, unsigned int y, unsigned int channelOffset, RunOrientation orientation)
- {
- unsigned int index = (y * 2560) + (x << 2) + channelOffset;
- if(orientation == HORIZONTAL)
- {
- return _mm_setr_pi8(yuvArray[index],
- yuvArray[index + 4],
- yuvArray[index + 8],
- yuvArray[index + 12],
- yuvArray[index + 16],
- yuvArray[index + 20],
- yuvArray[index + 24],
- yuvArray[index + 28]);
- }
- else if(orientation == VERTICAL)
- {
- return _mm_setr_pi8(yuvArray[index],
- yuvArray[index + 2560],
- yuvArray[index + 5120],
- yuvArray[index + 7680],
- yuvArray[index + 10240],
- yuvArray[index + 12800],
- yuvArray[index + 15360],
- yuvArray[index + 17920]);
- }
- return _m_from_int(0);
- }
- long long EdgeDetector::differenceCombined(unsigned int startX, unsigned int startY, RunOrientation orientation, unsigned int channelOffset)
- {
- __m64 pixelValues = populateRun(startX, startY, channelOffset, orientation);
- __m64 shiftedValuesRight = _mm_srli_si64(pixelValues, 8);
- __m64 shiftedValuesLeft = _mm_slli_si64(pixelValues, 8);
- __m64 resultRight = _mm_subs_pu8(pixelValues, shiftedValuesRight);
- __m64 resultLeft = _mm_subs_pu8(pixelValues, shiftedValuesLeft);
- __m64 result = _mm_adds_pu8(resultRight, resultLeft);
- long long retVal = _m_to_int64(result);
- _mm_empty();
- return retVal;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement