Showing the changes to codec/processing/src/adaptivequantization (2 of 15 files). Show all
Unified · Split
| @@ -50,9 +50,11 @@ CAdaptiveQuantization::CAdaptiveQuantization (int32_t iCpuFlag) { · 49 unmodified lines | |||
| 50 | m_pfVar = NULL; | 50 | m_pfVar = NULL; |
| 51 | WelsMemset (&m_sAdaptiveQuantParam, 0, sizeof (m_sAdaptiveQuantParam)); | 51 | WelsMemset (&m_sAdaptiveQuantParam, 0, sizeof (m_sAdaptiveQuantParam)); |
| 52 | WelsInitVarFunc (m_pfVar, m_CPUFlag); | 52 | WelsInitVarFunc (m_pfVar, m_CPUFlag); |
| 53 | XMMREG_PROTECT_INIT(AdaptiveQuantization); | ||
| 53 | } | 54 | } |
| 54 | 55 | ||
| 55 | CAdaptiveQuantization::~CAdaptiveQuantization() { | 56 | CAdaptiveQuantization::~CAdaptiveQuantization() { |
| 57 | XMMREG_PROTECT_UNINIT(AdaptiveQuantization); | ||
| 56 | } | 58 | } |
| 57 | 59 | ||
| 58 | EResult CAdaptiveQuantization::Process (int32_t iType, SPixMap* pSrcPixMap, SPixMap* pRefPixMap) { | 60 | EResult CAdaptiveQuantization::Process (int32_t iType, SPixMap* pSrcPixMap, SPixMap* pRefPixMap) { |
| @@ -101,6 +103,7 @@ EResult CAdaptiveQuantization::Process (int32_t iType, SPixMap* pSrcPixMap, SPix · 42 unmodified lines | |||
| 101 | pRefFrameTmp = pRefFrameY; | 103 | pRefFrameTmp = pRefFrameY; |
| 102 | pCurFrameTmp = pCurFrameY; | 104 | pCurFrameTmp = pCurFrameY; |
| 103 | for (i = 0; i < iMbWidth; i++) { | 105 | for (i = 0; i < iMbWidth; i++) { |
| 106 | XMMREG_PROTECT_STORE(AdaptiveQuantization); | ||
| 104 | iSumDiff = pVaaCalcResults->pSad8x8[iMbIndex][0]; | 107 | iSumDiff = pVaaCalcResults->pSad8x8[iMbIndex][0]; |
| 105 | iSumDiff += pVaaCalcResults->pSad8x8[iMbIndex][1]; | 108 | iSumDiff += pVaaCalcResults->pSad8x8[iMbIndex][1]; |
| 106 | iSumDiff += pVaaCalcResults->pSad8x8[iMbIndex][2]; | 109 | iSumDiff += pVaaCalcResults->pSad8x8[iMbIndex][2]; |
| @@ -109,6 +112,7 @@ EResult CAdaptiveQuantization::Process (int32_t iType, SPixMap* pSrcPixMap, SPix · 2 unmodified lines | |||
| 109 | iSQDiff = pVaaCalcResults->pSsd16x16[iMbIndex]; | 112 | iSQDiff = pVaaCalcResults->pSsd16x16[iMbIndex]; |
| 110 | uiSum = pVaaCalcResults->pSum16x16[iMbIndex]; | 113 | uiSum = pVaaCalcResults->pSum16x16[iMbIndex]; |
| 111 | iSQSum = pVaaCalcResults->pSumOfSquare16x16[iMbIndex]; | 114 | iSQSum = pVaaCalcResults->pSumOfSquare16x16[iMbIndex]; |
| 115 | XMMREG_PROTECT_LOAD(AdaptiveQuantization); | ||
| 112 | 116 | ||
| 113 | iSumDiff = iSumDiff >> 8; | 117 | iSumDiff = iSumDiff >> 8; |
| 114 | pMotionTexture->uiMotionIndex = (iSQDiff >> 8) - (iSumDiff * iSumDiff); | 118 | pMotionTexture->uiMotionIndex = (iSQDiff >> 8) - (iSumDiff * iSumDiff); |
| @@ -131,7 +135,9 @@ EResult CAdaptiveQuantization::Process (int32_t iType, SPixMap* pSrcPixMap, SPix · 16 unmodified lines | |||
| 131 | pRefFrameTmp = pRefFrameY; | 135 | pRefFrameTmp = pRefFrameY; |
| 132 | pCurFrameTmp = pCurFrameY; | 136 | pCurFrameTmp = pCurFrameY; |
| 133 | for (i = 0; i < iMbWidth; i++) { | 137 | for (i = 0; i < iMbWidth; i++) { |
| 138 | XMMREG_PROTECT_STORE(AdaptiveQuantization); | ||
| 134 | m_pfVar (pRefFrameTmp, iRefStride, pCurFrameTmp, iCurStride, pMotionTexture); | 139 | m_pfVar (pRefFrameTmp, iRefStride, pCurFrameTmp, iCurStride, pMotionTexture); |
| 140 | XMMREG_PROTECT_LOAD(AdaptiveQuantization); | ||
| 135 | dAverageMotionIndex += pMotionTexture->uiMotionIndex; | 141 | dAverageMotionIndex += pMotionTexture->uiMotionIndex; |
| 136 | dAverageTextureIndex += pMotionTexture->uiTextureIndex; | 142 | dAverageTextureIndex += pMotionTexture->uiTextureIndex; |
| 137 | pMotionTexture++; | 143 | pMotionTexture++; |
| @@ -223,7 +229,7 @@ void CAdaptiveQuantization::WelsInitVarFunc (PVarFunc& pfVar, int32_t iCpuFlag) · 85 unmodified lines | |||
| 223 | 229 | ||
| 224 | #ifdef X86_ASM | 230 | #ifdef X86_ASM |
| 225 | if (iCpuFlag & WELS_CPU_SSE2) { | 231 | if (iCpuFlag & WELS_CPU_SSE2) { |
| 226 | // pfVar = SampleVariance16x16_sse2; | 232 | pfVar = SampleVariance16x16_sse2; |
| 227 | } | 233 | } |
| 228 | #endif | 234 | #endif |
| 229 | } | 235 | } |
| @@ -45,6 +45,7 @@ · 44 unmodified lines | |||
| 45 | #include "../common/memory.h" | 45 | #include "../common/memory.h" |
| 46 | #include "../common/WelsFrameWork.h" | 46 | #include "../common/WelsFrameWork.h" |
| 47 | #include "../../interface/IWelsVP.h" | 47 | #include "../../interface/IWelsVP.h" |
| 48 | #include "cpu.h" | ||
| 48 | 49 | ||
| 49 | WELSVP_NAMESPACE_BEGIN | 50 | WELSVP_NAMESPACE_BEGIN |
| 50 | 51 | ||
| @@ -78,6 +79,7 @@ class CAdaptiveQuantization : public IStrategy { · 27 unmodified lines | |||
| 78 | PVarFunc m_pfVar; | 79 | PVarFunc m_pfVar; |
| 79 | int32_t m_CPUFlag; | 80 | int32_t m_CPUFlag; |
| 80 | SAdaptiveQuantizationParam m_sAdaptiveQuantParam; | 81 | SAdaptiveQuantizationParam m_sAdaptiveQuantParam; |
| 82 | XMMREG_PROTECT_DECLARE(AdaptiveQuantization); | ||
| 81 | }; | 83 | }; |
| 82 | 84 | ||
| 83 | WELSVP_NAMESPACE_END | 85 | WELSVP_NAMESPACE_END |