Showing the changes to codec/processing/src/scrolldetection/ScrollDetection.cpp (1 of 120 files). Show all
Unified · Split
| @@ -37,37 +37,38 @@ · 36 unmodified lines | |||
| 37 | 37 | ||
| 38 | WELSVP_NAMESPACE_BEGIN | 38 | WELSVP_NAMESPACE_BEGIN |
| 39 | 39 | ||
| 40 | EResult CScrollDetection::Process(int32_t iType, SPixMap* pSrcPixMap, SPixMap* pRefPixMap){ | 40 | EResult CScrollDetection::Process (int32_t iType, SPixMap* pSrcPixMap, SPixMap* pRefPixMap) { |
| 41 | if (pRefPixMap->pPixel[0] == NULL || pSrcPixMap->pPixel[0] == NULL || | 41 | if (pRefPixMap->pPixel[0] == NULL || pSrcPixMap->pPixel[0] == NULL || |
| 42 | pRefPixMap->sRect.iRectWidth != pSrcPixMap->sRect.iRectWidth || pRefPixMap->sRect.iRectHeight != pSrcPixMap->sRect.iRectHeight){ | 42 | pRefPixMap->sRect.iRectWidth != pSrcPixMap->sRect.iRectWidth |
| 43 | return RET_INVALIDPARAM; | 43 | || pRefPixMap->sRect.iRectHeight != pSrcPixMap->sRect.iRectHeight) { |
| 44 | return RET_INVALIDPARAM; | ||
| 44 | } | 45 | } |
| 45 | 46 | ||
| 46 | if (!m_sScrollDetectionParam.bMaskInfoAvailable) | 47 | if (!m_sScrollDetectionParam.bMaskInfoAvailable) |
| 47 | ScrollDetectionWithoutMask(pSrcPixMap, pRefPixMap); | 48 | ScrollDetectionWithoutMask (pSrcPixMap, pRefPixMap); |
| 48 | else | 49 | else |
| 49 | ScrollDetectionWithMask(pSrcPixMap, pRefPixMap); | 50 | ScrollDetectionWithMask (pSrcPixMap, pRefPixMap); |
| 50 | 51 | ||
| 51 | return RET_SUCCESS; | 52 | return RET_SUCCESS; |
| 52 | } | 53 | } |
| 53 | 54 | ||
| 54 | EResult CScrollDetection::Set(int32_t iType, void *pParam){ | 55 | EResult CScrollDetection::Set (int32_t iType, void* pParam) { |
| 55 | if( pParam == NULL ){ | 56 | if (pParam == NULL) { |
| 56 | return RET_INVALIDPARAM; | 57 | return RET_INVALIDPARAM; |
| 57 | } | 58 | } |
| 58 | m_sScrollDetectionParam = *((SScrollDetectionParam*)pParam); | 59 | m_sScrollDetectionParam = * ((SScrollDetectionParam*)pParam); |
| 59 | return RET_SUCCESS; | 60 | return RET_SUCCESS; |
| 60 | } | 61 | } |
| 61 | 62 | ||
| 62 | EResult CScrollDetection::Get(int32_t iType, void *pParam){ | 63 | EResult CScrollDetection::Get (int32_t iType, void* pParam) { |
| 63 | if( pParam == NULL ){ | 64 | if (pParam == NULL) { |
| 64 | return RET_INVALIDPARAM; | 65 | return RET_INVALIDPARAM; |
| 65 | } | 66 | } |
| 66 | *((SScrollDetectionParam*)pParam) = m_sScrollDetectionParam; | 67 | * ((SScrollDetectionParam*)pParam) = m_sScrollDetectionParam; |
| 67 | return RET_SUCCESS; | 68 | return RET_SUCCESS; |
| 68 | } | 69 | } |
| 69 | 70 | ||
| 70 | void CScrollDetection::ScrollDetectionWithMask(SPixMap* pSrcPixMap, SPixMap* pRefPixMap) { | 71 | void CScrollDetection::ScrollDetectionWithMask (SPixMap* pSrcPixMap, SPixMap* pRefPixMap) { |
| 71 | int32_t iStartX, iStartY, iWidth, iHeight; | 72 | int32_t iStartX, iStartY, iWidth, iHeight; |
| 72 | 73 | ||
| 73 | iStartX = m_sScrollDetectionParam.sMaskRect.iRectLeft; | 74 | iStartX = m_sScrollDetectionParam.sMaskRect.iRectLeft; |
| @@ -76,39 +77,39 @@ void CScrollDetection::ScrollDetectionWithMask(SPixMap* pSrcPixMap, SPixMap* pRe · 2 unmodified lines | |||
| 76 | iHeight = m_sScrollDetectionParam.sMaskRect.iRectHeight; | 77 | iHeight = m_sScrollDetectionParam.sMaskRect.iRectHeight; |
| 77 | 78 | ||
| 78 | iWidth /= 2; | 79 | iWidth /= 2; |
| 79 | iStartX += iWidth/2; | 80 | iStartX += iWidth / 2; |
| 80 | 81 | ||
| 81 | m_sScrollDetectionParam.iScrollMvX = 0; | 82 | m_sScrollDetectionParam.iScrollMvX = 0; |
| 82 | m_sScrollDetectionParam.iScrollMvY = 0; | 83 | m_sScrollDetectionParam.iScrollMvY = 0; |
| 83 | m_sScrollDetectionParam.bScrollDetectFlag = false; | 84 | m_sScrollDetectionParam.bScrollDetectFlag = false; |
| 84 | 85 | ||
| 85 | if(iStartX >= 0 && iWidth > MINIMUM_DETECT_WIDTH && iHeight > 2 * CHECK_OFFSET){ | 86 | if (iStartX >= 0 && iWidth > MINIMUM_DETECT_WIDTH && iHeight > 2 * CHECK_OFFSET) { |
| 86 | ScrollDetectionCore(pSrcPixMap, pRefPixMap,iWidth, iHeight, iStartX, iStartY, m_sScrollDetectionParam); | 87 | ScrollDetectionCore (pSrcPixMap, pRefPixMap, iWidth, iHeight, iStartX, iStartY, m_sScrollDetectionParam); |
| 87 | } | 88 | } |
| 88 | } | 89 | } |
| 89 | 90 | ||
| 90 | void CScrollDetection::ScrollDetectionWithoutMask(SPixMap* pSrcPixMap, SPixMap* pRefPixMap){ | 91 | void CScrollDetection::ScrollDetectionWithoutMask (SPixMap* pSrcPixMap, SPixMap* pRefPixMap) { |
| 91 | int32_t iStartX, iStartY, iWidth, iHeight; | 92 | int32_t iStartX, iStartY, iWidth, iHeight; |
| 92 | 93 | ||
| 93 | const int32_t kiPicBorderWidth= pSrcPixMap->sRect.iRectHeight>>4; | 94 | const int32_t kiPicBorderWidth = pSrcPixMap->sRect.iRectHeight >> 4; |
| 94 | const int32_t kiRegionWidth = (int) (pSrcPixMap->sRect.iRectWidth-(kiPicBorderWidth<<1))/3; | 95 | const int32_t kiRegionWidth = (int) (pSrcPixMap->sRect.iRectWidth - (kiPicBorderWidth << 1)) / 3; |
| 95 | const int32_t kiRegionHeight = (pSrcPixMap->sRect.iRectHeight*7)>>3; | 96 | const int32_t kiRegionHeight = (pSrcPixMap->sRect.iRectHeight * 7) >> 3; |
| 96 | const int32_t kiHieghtStride = (int) pSrcPixMap->sRect.iRectHeight*5/24; | 97 | const int32_t kiHieghtStride = (int) pSrcPixMap->sRect.iRectHeight * 5 / 24; |
| 97 | 98 | ||
| 98 | for (int32_t i=0; i< REGION_NUMBER;i++){ | 99 | for (int32_t i = 0; i < REGION_NUMBER; i++) { |
| 99 | iStartX = kiPicBorderWidth+(i%3)*kiRegionWidth; | 100 | iStartX = kiPicBorderWidth + (i % 3) * kiRegionWidth; |
| 100 | iStartY = -pSrcPixMap->sRect.iRectHeight*7/48+ (int)(i/3)*(kiHieghtStride); | 101 | iStartY = -pSrcPixMap->sRect.iRectHeight * 7 / 48 + (int) (i / 3) * (kiHieghtStride); |
| 101 | iWidth = kiRegionWidth; | 102 | iWidth = kiRegionWidth; |
| 102 | iHeight = kiRegionHeight; | 103 | iHeight = kiRegionHeight; |
| 103 | 104 | ||
| 104 | iWidth /= 2; | 105 | iWidth /= 2; |
| 105 | iStartX += iWidth/2; | 106 | iStartX += iWidth / 2; |
| 106 | 107 | ||
| 107 | m_sScrollDetectionParam.iScrollMvX = 0; | 108 | m_sScrollDetectionParam.iScrollMvX = 0; |
| 108 | m_sScrollDetectionParam.iScrollMvY = 0; | 109 | m_sScrollDetectionParam.iScrollMvY = 0; |
| 109 | m_sScrollDetectionParam.bScrollDetectFlag = false; | 110 | m_sScrollDetectionParam.bScrollDetectFlag = false; |
| 110 | 111 | ||
| 111 | ScrollDetectionCore(pSrcPixMap, pRefPixMap, iWidth, iHeight, iStartX, iStartY, m_sScrollDetectionParam); | 112 | ScrollDetectionCore (pSrcPixMap, pRefPixMap, iWidth, iHeight, iStartX, iStartY, m_sScrollDetectionParam); |
| 112 | 113 | ||
| 113 | if (m_sScrollDetectionParam.bScrollDetectFlag && m_sScrollDetectionParam.iScrollMvY) | 114 | if (m_sScrollDetectionParam.bScrollDetectFlag && m_sScrollDetectionParam.iScrollMvY) |
| 114 | break; | 115 | break; |