History

[Processing/x86] Add an SSSE3 implementation of GeneralBilinearFastDownsample

Keep track of relative pixel offsets and utilize pshufb to efficiently extract relevant pixels for horizontal scaling ratios <= 4. Fall back to a generic approach for ratios > 4. Note that the generic approach can be backported to SSE2. The implementation assumes that data beyond the end of each line, before the next line begins, can be dirtied; which AFAICT is safe with the current usage of these routines. Speedup is ~6.67x/~3.26x (32-bit/64-bit) for horizontal ratios <= 2, ~6.24x/~3.00x for ratios within (2, 4], and ~4.89x/~2.17x for ratios > 4 when not memory-bound on Haswell as compared with the current SSE2 implementation.

Sindre Aamås committed 10 years ago

Commit 1995e031 parent cbaf0876 files · +535 −0Browse files

Showing the changes to codec/processing/src/downsample (3 of 6 files). Show all

Unified · Split

3 files
  1. codec/processing/src/downsample/downsample.cpp +1 −0
  2. codec/processing/src/downsample/downsample.h +4 −0
  3. codec/processing/src/downsample/downsamplefuncs.cpp +1 −0
codec/processing/src/downsample/downsample.cpp+1−0
@@ -100,6 +100,7 @@ void CDownsampling::InitDownsampleFuncs (SDownsampleFuncs& sDownsampleFunc, int · 99 unmodified lines
100 sDownsampleFunc.pfHalfAverage[1] = DyadicBilinearDownsamplerWidthx16_ssse3;100 sDownsampleFunc.pfHalfAverage[1] = DyadicBilinearDownsamplerWidthx16_ssse3;
101 sDownsampleFunc.pfOneThirdDownsampler = DyadicBilinearOneThirdDownsampler_ssse3;101 sDownsampleFunc.pfOneThirdDownsampler = DyadicBilinearOneThirdDownsampler_ssse3;
102 sDownsampleFunc.pfQuarterDownsampler = DyadicBilinearQuarterDownsampler_ssse3;102 sDownsampleFunc.pfQuarterDownsampler = DyadicBilinearQuarterDownsampler_ssse3;
103 sDownsampleFunc.pfGeneralRatioLuma = GeneralBilinearFastDownsamplerWrap_ssse3;
103 }104 }
104 if (iCpuFlag & WELS_CPU_SSE41) {105 if (iCpuFlag & WELS_CPU_SSE41) {
105 sDownsampleFunc.pfHalfAverage[0] = DyadicBilinearDownsamplerWidthx32_sse4;106 sDownsampleFunc.pfHalfAverage[0] = DyadicBilinearDownsamplerWidthx32_sse4;
codec/processing/src/downsample/downsample.h+4−0
@@ -101,6 +101,7 @@ HalveDownsampleFunc DyadicBilinearDownsamplerWidthx32_sse4; · 100 unmodified lines
101 101
102GeneralDownsampleFunc GeneralBilinearFastDownsamplerWrap_sse2;102GeneralDownsampleFunc GeneralBilinearFastDownsamplerWrap_sse2;
103GeneralDownsampleFunc GeneralBilinearAccurateDownsamplerWrap_sse2;103GeneralDownsampleFunc GeneralBilinearAccurateDownsamplerWrap_sse2;
104GeneralDownsampleFunc GeneralBilinearFastDownsamplerWrap_ssse3;
104 105
105SpecificDownsampleFunc DyadicBilinearOneThirdDownsampler_ssse3;106SpecificDownsampleFunc DyadicBilinearOneThirdDownsampler_ssse3;
106SpecificDownsampleFunc DyadicBilinearOneThirdDownsampler_sse4;107SpecificDownsampleFunc DyadicBilinearOneThirdDownsampler_sse4;
@@ -114,6 +115,9 @@ void GeneralBilinearFastDownsampler_sse2 (uint8_t* pDst, const int32_t kiDstStri · 7 unmodified lines
114void GeneralBilinearAccurateDownsampler_sse2 (uint8_t* pDst, const int32_t kiDstStride, const int32_t kiDstWidth,115void GeneralBilinearAccurateDownsampler_sse2 (uint8_t* pDst, const int32_t kiDstStride, const int32_t kiDstWidth,
115 const int32_t kiDstHeight, uint8_t* pSrc, const int32_t kiSrcStride, const uint32_t kuiScaleX,116 const int32_t kiDstHeight, uint8_t* pSrc, const int32_t kiSrcStride, const uint32_t kuiScaleX,
116 const uint32_t kuiScaleY);117 const uint32_t kuiScaleY);
118void GeneralBilinearFastDownsampler_ssse3 (uint8_t* pDst, int32_t iDstStride, int32_t iDstWidth,
119 int32_t iDstHeight, uint8_t* pSrc, int32_t iSrcStride, uint32_t uiScaleX,
120 uint32_t uiScaleY);
117 121
118WELSVP_EXTERN_C_END122WELSVP_EXTERN_C_END
119#endif123#endif
codec/processing/src/downsample/downsamplefuncs.cpp+1−0
@@ -282,6 +282,7 @@ static void GeneralBilinearDownsamplerWrap (uint8_t* pDst, const int32_t kiDstSt · 281 unmodified lines
282#ifdef X86_ASM282#ifdef X86_ASM
283DEFINE_GENERAL_BILINEAR_FAST_DOWNSAMPLER_WRAP (sse2)283DEFINE_GENERAL_BILINEAR_FAST_DOWNSAMPLER_WRAP (sse2)
284DEFINE_GENERAL_BILINEAR_ACCURATE_DOWNSAMPLER_WRAP (sse2)284DEFINE_GENERAL_BILINEAR_ACCURATE_DOWNSAMPLER_WRAP (sse2)
285DEFINE_GENERAL_BILINEAR_FAST_DOWNSAMPLER_WRAP (ssse3)
285#endif //X86_ASM286#endif //X86_ASM
286 287
287#ifdef HAVE_NEON288#ifdef HAVE_NEON

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t