History

[Processing/x86] Add an SSE4.1 implementation of GeneralBilinearAccurateDownsample

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. The use of blendps makes this require SSE4.1. The pshufb path can be backported to SSSE3 and the generic path to SSE2 for a minor reduction in performance by replacing blendps and preceding instructions with an equivalent sequence. 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 ~5.32x/~4.25x (32-bit/64-bit) for horizontal ratios <= 2, ~5.06x/~3.97x for ratios within (2, 4], and ~3.93x/~3.13x for ratios > 4 when not memory-bound on Haswell as compared with the current SSE2 implementation.

Sindre Aamås committed 10 years ago

Commit b1013091 parent 1995e035 files · +455 −0Browse files

Showing the changes to codec/processing/src (4 of 5 files). Show all

Unified · Split

4 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
  4. codec/processing/src/x86/downsample_bilinear.asm +447 −0
codec/processing/src/downsample/downsample.cpp+1−0
@@ -107,6 +107,7 @@ void CDownsampling::InitDownsampleFuncs (SDownsampleFuncs& sDownsampleFunc, int · 106 unmodified lines
107107 sDownsampleFunc.pfHalfAverage[1] = DyadicBilinearDownsamplerWidthx16_sse4;
108108 sDownsampleFunc.pfOneThirdDownsampler = DyadicBilinearOneThirdDownsampler_sse4;
109109 sDownsampleFunc.pfQuarterDownsampler = DyadicBilinearQuarterDownsampler_sse4;
110+ sDownsampleFunc.pfGeneralRatioChroma = GeneralBilinearAccurateDownsamplerWrap_sse41;
110111 }
111112 #endif//X86_ASM
112113
codec/processing/src/downsample/downsample.h+4−0
@@ -102,6 +102,7 @@ HalveDownsampleFunc DyadicBilinearDownsamplerWidthx32_sse4; · 101 unmodified lines
102102 GeneralDownsampleFunc GeneralBilinearFastDownsamplerWrap_sse2;
103103 GeneralDownsampleFunc GeneralBilinearAccurateDownsamplerWrap_sse2;
104104 GeneralDownsampleFunc GeneralBilinearFastDownsamplerWrap_ssse3;
105+GeneralDownsampleFunc GeneralBilinearAccurateDownsamplerWrap_sse41;
105106
106107 SpecificDownsampleFunc DyadicBilinearOneThirdDownsampler_ssse3;
107108 SpecificDownsampleFunc DyadicBilinearOneThirdDownsampler_sse4;
@@ -118,6 +119,9 @@ void GeneralBilinearAccurateDownsampler_sse2 (uint8_t* pDst, const int32_t kiDst · 10 unmodified lines
118119 void GeneralBilinearFastDownsampler_ssse3 (uint8_t* pDst, int32_t iDstStride, int32_t iDstWidth,
119120 int32_t iDstHeight, uint8_t* pSrc, int32_t iSrcStride, uint32_t uiScaleX,
120121 uint32_t uiScaleY);
122+void GeneralBilinearAccurateDownsampler_sse41 (uint8_t* pDst, int32_t iDstStride, int32_t iDstWidth,
123+ int32_t iDstHeight, uint8_t* pSrc, int32_t iSrcStride, uint32_t uiScaleX,
124+ uint32_t uiScaleY);
121125
122126 WELSVP_EXTERN_C_END
123127 #endif
codec/processing/src/downsample/downsamplefuncs.cpp+1−0
@@ -283,6 +283,7 @@ static void GeneralBilinearDownsamplerWrap (uint8_t* pDst, const int32_t kiDstSt · 282 unmodified lines
283283 DEFINE_GENERAL_BILINEAR_FAST_DOWNSAMPLER_WRAP (sse2)
284284 DEFINE_GENERAL_BILINEAR_ACCURATE_DOWNSAMPLER_WRAP (sse2)
285285 DEFINE_GENERAL_BILINEAR_FAST_DOWNSAMPLER_WRAP (ssse3)
286+DEFINE_GENERAL_BILINEAR_ACCURATE_DOWNSAMPLER_WRAP (sse41)
286287 #endif //X86_ASM
287288
288289 #ifdef HAVE_NEON
codec/processing/src/x86/downsample_bilinear.asm+447−0
@@ -2766,6 +2766,166 @@ WELS_EXTERN DyadicBilinearQuarterDownsampler_sse4 · 2765 unmodified lines
27662766 paddw xmm_xfrac1, xmm_xfrac_inc
27672767 %endmacro
27682768
2769+; xpos_int=%1 xpos_frac=%2 inc_int=%3 inc_frac=%4 7FFFh=%5 tmp=%6
2770+%macro SSE2_BilinearIncXposw 6
2771+ pxor %6, %6
2772+ paddw %2, %4
2773+ pcmpgtw %6, %2
2774+ paddb %1, %3
2775+ psubb %1, %6 ; add carry
2776+ pand %2, %5
2777+%endmacro
2778+
2779+; outl=%1 outh=%2 in=%3 7FFFh=%4
2780+%macro SSE2_UnpckXFracw 4
2781+ movdqa %1, %3
2782+ pxor %1, %4
2783+ movdqa %2, %1
2784+ punpcklwd %1, %3
2785+ punpckhwd %2, %3
2786+%endmacro
2787+
2788+; res>>29=%1 data0=%2 data1=%3 frac0=%4 frac1=%5 tmp=%6
2789+%macro SSE41_LinearAccurateInterpolateVerticalDwords 6
2790+ pshufd %1, %2, 10110001b
2791+ pshufd %6, %3, 10110001b
2792+ pmuludq %1, %4
2793+ pmuludq %6, %5
2794+ paddq %1, %6
2795+ pmuludq %2, %4
2796+ pmuludq %3, %5
2797+ paddq %2, %3
2798+ psllq %1, 3
2799+ psrlq %2, 29
2800+ blendps %1, %2, 0101b
2801+%endmacro
2802+
2803+%macro SSE41_BilinearAccurateDownsample2xOrLess_8px 0
2804+ movdqa xmm_tmp0, xmm_xpos_int
2805+ pshufb xmm_tmp0, xmm_0
2806+ psubb xmm_xpos_int, xmm_tmp0
2807+ SSE2_UnpckXFracw xmm_tmp0, xmm_tmp1, xmm_xpos_frac, xmm_7fff
2808+ mov r_tmp0, i_xpos
2809+ lea i_xpos, [i_xpos + 8 * i_scalex]
2810+ shr r_tmp0, 16
2811+ movdqu xmm_tmp4, [p_src_row0 + r_tmp0]
2812+ pshufb xmm_tmp4, xmm_xpos_int
2813+ movdqa xmm_tmp5, xmm_tmp4
2814+ punpcklbw xmm_tmp4, xmm_0
2815+ punpckhbw xmm_tmp5, xmm_0
2816+ pmaddwd xmm_tmp4, xmm_tmp0
2817+ pmaddwd xmm_tmp5, xmm_tmp1
2818+ movdqu xmm_tmp2, [p_src_row1 + r_tmp0]
2819+ pshufb xmm_tmp2, xmm_xpos_int
2820+ movdqa xmm_tmp3, xmm_tmp2
2821+ punpcklbw xmm_tmp2, xmm_0
2822+ punpckhbw xmm_tmp3, xmm_0
2823+ pmaddwd xmm_tmp2, xmm_tmp0
2824+ pmaddwd xmm_tmp3, xmm_tmp1
2825+ SSE41_LinearAccurateInterpolateVerticalDwords xmm_tmp0, xmm_tmp4, xmm_tmp2, xmm_yfrac0, xmm_yfrac1, xmm_tmp1
2826+ SSE41_LinearAccurateInterpolateVerticalDwords xmm_tmp1, xmm_tmp5, xmm_tmp3, xmm_yfrac0, xmm_yfrac1, xmm_tmp2
2827+ packssdw xmm_tmp0, xmm_tmp1
2828+ pavgw xmm_tmp0, xmm_0
2829+ packuswb xmm_tmp0, xmm_tmp0
2830+ movlps [p_dst], xmm_tmp0
2831+ add p_dst, 8
2832+ SSE2_BilinearIncXposw xmm_xpos_int, xmm_xpos_frac, xmm_xpos_int_inc, xmm_xpos_frac_inc, xmm_7fff, xmm_tmp0
2833+%endmacro
2834+
2835+%macro SSE41_BilinearAccurateDownsample4xOrLess_8px 0
2836+ movdqa xmm_tmp0, xmm_xpos_int
2837+ pshufb xmm_tmp0, [shufb_0000000088888888]
2838+ psubb xmm_xpos_int, xmm_tmp0
2839+ SSE2_UnpckXFracw xmm_tmp0, xmm_tmp1, xmm_xpos_frac, xmm_7fff
2840+ mov r_tmp0, i_xpos
2841+ shr r_tmp0, 16
2842+ movdqa xmm_tmp3, xmm_xpos_int
2843+ punpcklbw xmm_tmp3, [db80h_128]
2844+ movdqu xmm_tmp4, [p_src_row0 + r_tmp0]
2845+ movdqu xmm_tmp2, [p_src_row1 + r_tmp0]
2846+ lea r_tmp0, [i_xpos + 4 * i_scalex]
2847+ lea i_xpos, [i_xpos + 8 * i_scalex]
2848+ shr r_tmp0, 16
2849+ pshufb xmm_tmp4, xmm_tmp3
2850+ pshufb xmm_tmp2, xmm_tmp3
2851+ pmaddwd xmm_tmp4, xmm_tmp0
2852+ pmaddwd xmm_tmp2, xmm_tmp0
2853+ SSE41_LinearAccurateInterpolateVerticalDwords xmm_tmp0, xmm_tmp4, xmm_tmp2, xmm_yfrac0, xmm_yfrac1, xmm_tmp3
2854+ movdqa xmm_tmp2, xmm_xpos_int
2855+ punpckhbw xmm_tmp2, [db80h_128]
2856+ movdqu xmm_tmp4, [p_src_row0 + r_tmp0]
2857+ movdqu xmm_tmp3, [p_src_row1 + r_tmp0]
2858+ pshufb xmm_tmp4, xmm_tmp2
2859+ pshufb xmm_tmp3, xmm_tmp2
2860+ pmaddwd xmm_tmp4, xmm_tmp1
2861+ pmaddwd xmm_tmp3, xmm_tmp1
2862+ SSE41_LinearAccurateInterpolateVerticalDwords xmm_tmp1, xmm_tmp4, xmm_tmp3, xmm_yfrac0, xmm_yfrac1, xmm_tmp2
2863+ packssdw xmm_tmp0, xmm_tmp1
2864+ pavgw xmm_tmp0, xmm_0
2865+ packuswb xmm_tmp0, xmm_tmp0
2866+ movlps [p_dst], xmm_tmp0
2867+ add p_dst, 8
2868+ SSE2_BilinearIncXposw xmm_xpos_int, xmm_xpos_frac, xmm_xpos_int_inc, xmm_xpos_frac_inc, xmm_7fff, xmm_tmp0
2869+%endmacro
2870+
2871+%macro SSE41_GeneralBilinearAccurateDownsample_8px 0
2872+ mov r_tmp0, i_xpos
2873+ shr r_tmp0, 16
2874+ movd xmm_tmp4, [p_src_row0 + r_tmp0]
2875+ movd xmm_tmp2, [p_src_row1 + r_tmp0]
2876+ lea r_tmp0, [i_xpos + 1 * i_scalex]
2877+ shr r_tmp0, 16
2878+ pinsrw xmm_tmp4, [p_src_row0 + r_tmp0], 1
2879+ pinsrw xmm_tmp2, [p_src_row1 + r_tmp0], 1
2880+ lea r_tmp0, [i_xpos + 2 * i_scalex]
2881+ lea i_xpos, [i_xpos + 4 * i_scalex]
2882+ shr r_tmp0, 16
2883+ pinsrw xmm_tmp4, [p_src_row0 + r_tmp0], 2
2884+ pinsrw xmm_tmp2, [p_src_row1 + r_tmp0], 2
2885+ mov r_tmp0, i_xpos
2886+ sub r_tmp0, i_scalex
2887+ shr r_tmp0, 16
2888+ pinsrw xmm_tmp4, [p_src_row0 + r_tmp0], 3
2889+ pinsrw xmm_tmp2, [p_src_row1 + r_tmp0], 3
2890+ punpcklbw xmm_tmp4, xmm_0
2891+ punpcklbw xmm_tmp2, xmm_0
2892+ pmaddwd xmm_tmp4, xmm_xfrac0
2893+ pmaddwd xmm_tmp2, xmm_xfrac0
2894+ SSE41_LinearAccurateInterpolateVerticalDwords xmm_tmp0, xmm_tmp4, xmm_tmp2, xmm_yfrac0, xmm_yfrac1, xmm_tmp3
2895+ mov r_tmp0, i_xpos
2896+ shr r_tmp0, 16
2897+ movd xmm_tmp4, [p_src_row0 + r_tmp0]
2898+ movd xmm_tmp3, [p_src_row1 + r_tmp0]
2899+ lea r_tmp0, [i_xpos + 1 * i_scalex]
2900+ shr r_tmp0, 16
2901+ pinsrw xmm_tmp4, [p_src_row0 + r_tmp0], 1
2902+ pinsrw xmm_tmp3, [p_src_row1 + r_tmp0], 1
2903+ lea r_tmp0, [i_xpos + 2 * i_scalex]
2904+ lea i_xpos, [i_xpos + 4 * i_scalex]
2905+ shr r_tmp0, 16
2906+ pinsrw xmm_tmp4, [p_src_row0 + r_tmp0], 2
2907+ pinsrw xmm_tmp3, [p_src_row1 + r_tmp0], 2
2908+ mov r_tmp0, i_xpos
2909+ sub r_tmp0, i_scalex
2910+ shr r_tmp0, 16
2911+ pinsrw xmm_tmp4, [p_src_row0 + r_tmp0], 3
2912+ pinsrw xmm_tmp3, [p_src_row1 + r_tmp0], 3
2913+ punpcklbw xmm_tmp4, xmm_0
2914+ punpcklbw xmm_tmp3, xmm_0
2915+ pmaddwd xmm_tmp4, xmm_xfrac1
2916+ pmaddwd xmm_tmp3, xmm_xfrac1
2917+ SSE41_LinearAccurateInterpolateVerticalDwords xmm_tmp1, xmm_tmp4, xmm_tmp3, xmm_yfrac0, xmm_yfrac1, xmm_tmp2
2918+ packssdw xmm_tmp0, xmm_tmp1
2919+ pavgw xmm_tmp0, xmm_0
2920+ packuswb xmm_tmp0, xmm_tmp0
2921+ movlps [p_dst], xmm_tmp0
2922+ add p_dst, 8
2923+ paddw xmm_xfrac0, xmm_xfrac_inc
2924+ paddw xmm_xfrac1, xmm_xfrac_inc
2925+ pand xmm_xfrac0, xmm_7fff
2926+ pand xmm_xfrac1, xmm_7fff
2927+%endmacro
2928+
27692929 ; downsample_8px_macro=%1 b_fast=%2
27702930 %macro SSE2_GeneralBilinearDownsampler_loop 2
27712931 %%height:
@@ -3116,3 +3276,290 @@ WELS_EXTERN GeneralBilinearFastDownsampler_ssse3 · 344 unmodified lines
31163276 %undef xmm_xfrac0_begin
31173277 %undef xmm_xfrac1_begin
31183278 %undef xmm_xfrac_inc
3279+
3280+;**************************************************************************************************************
3281+;void GeneralBilinearAccurateDownsampler_sse41 (uint8_t* pDst, int32_t iDstStride, int32_t iDstWidth,
3282+; int32_t iDstHeight, uint8_t* pSrc, int32_t iSrcStride, uint32_t uiScaleX,
3283+; uint32_t uiScaleY);
3284+;
3285+;**************************************************************************************************************
3286+
3287+WELS_EXTERN GeneralBilinearAccurateDownsampler_sse41
3288+ %assign push_num 0
3289+%ifndef X86_32
3290+ push r12
3291+ push r13
3292+ push rbx
3293+ push rbp
3294+ %assign push_num 4
3295+%ifdef WIN64
3296+ push rdi
3297+ push rsi
3298+ %assign push_num push_num + 2
3299+%endif
3300+%endif
3301+ LOAD_7_PARA
3302+ PUSH_XMM 16
3303+ SIGN_EXTENSION r1, r1d
3304+ SIGN_EXTENSION r2, r2d
3305+ SIGN_EXTENSION r3, r3d
3306+ SIGN_EXTENSION r5, r5d
3307+ ZERO_EXTENSION r6d
3308+ sub r1, r2 ; dst_stride - dst_width
3309+ add r6, r6 ; 2 * scalex
3310+%ifdef X86_32
3311+ movd xmm0, arg8
3312+ movd xmm1, esp
3313+ and esp, -16
3314+ sub esp, 8 * 4 + 8 * 16
3315+ movd [esp], xmm1
3316+ %define p_dst r0
3317+ %define i_dst_stride_less_width [esp + 1 * 4]
3318+ %define i_dst_width [esp + 2 * 4]
3319+ %define i_dst_height dword [esp + 3 * 4]
3320+ %define p_src [esp + 4 * 4]
3321+ %define i_src_stride [esp + 5 * 4]
3322+ %define i_scalex r6
3323+ %define i_scalexd r6d
3324+ %define i_scaleyd [esp + 6 * 4]
3325+ %define i_xpos r2
3326+ %define i_ypos dword [esp + 7 * 4]
3327+ %define i_yposd dword [esp + 7 * 4]
3328+ %define p_src_row0 r3
3329+ %define p_src_row1 r4
3330+ %define i_width_cnt r5
3331+ %define r_tmp0 r1
3332+ %define r_tmp0b r1b
3333+ %define xmm_xpos_frac xmm1
3334+ %define xmm_xpos_frac_inc [esp + 8 * 4]
3335+ %define xmm_xpos_int xmm3
3336+ %define xmm_xpos_int_inc [esp + 8 * 4 + 1 * 16]
3337+ %define xmm_yfrac0 [esp + 8 * 4 + 2 * 16]
3338+ %define xmm_yfrac1 [esp + 8 * 4 + 3 * 16]
3339+ %define xmm_tmp0 xmm7
3340+ %define xmm_tmp1 xmm0
3341+ %define xmm_tmp2 xmm2
3342+ %define xmm_tmp3 xmm4
3343+ %define xmm_tmp4 xmm5
3344+ %define xmm_tmp5 xmm6
3345+ %define xmm_0 [esp + 8 * 4 + 4 * 16]
3346+ %define xmm_7fff [esp + 8 * 4 + 5 * 16]
3347+ %define xmm_xpos_int_begin [esp + 8 * 4 + 6 * 16]
3348+ %define xmm_xpos_frac_begin [esp + 8 * 4 + 7 * 16]
3349+ mov i_dst_stride_less_width, r1
3350+ mov i_dst_width, r2
3351+ mov i_dst_height, r3
3352+ mov p_src, r4
3353+ mov i_src_stride, r5
3354+ movd i_scaleyd, xmm0
3355+ pxor xmm_tmp5, xmm_tmp5
3356+ movdqa xmm_0, xmm_tmp5
3357+ pcmpeqw xmm_tmp5, xmm_tmp5
3358+ psrlw xmm_tmp5, 1
3359+ movdqa xmm_7fff, xmm_tmp5
3360+%else
3361+ %define p_dst r0
3362+ %define i_dst_stride_less_width r1
3363+ %define i_dst_width r2
3364+ %define i_dst_height r3
3365+ %define p_src r4
3366+ %define i_src_stride r5
3367+ %define i_scalex r6
3368+ %define i_scalexd r6d
3369+ %define i_scaleyd dword arg8d
3370+ %define i_xpos r12
3371+ %define i_ypos r13
3372+ %define i_yposd r13d
3373+ %define p_src_row0 rbp
3374+%ifdef WIN64
3375+ %define p_src_row1 rsi
3376+ %define i_width_cnt rdi
3377+%else
3378+ %define p_src_row1 r11
3379+ %define i_width_cnt rax
3380+%endif
3381+ %define r_tmp0 rbx
3382+ %define r_tmp0b bl
3383+ %define xmm_0 xmm0
3384+ %define xmm_xpos_frac xmm1
3385+ %define xmm_xpos_frac_inc xmm8
3386+ %define xmm_xpos_int xmm3
3387+ %define xmm_xpos_int_inc xmm10
3388+ %define xmm_yfrac0 xmm11
3389+ %define xmm_yfrac1 xmm12
3390+ %define xmm_tmp0 xmm7
3391+ %define xmm_tmp1 xmm2
3392+ %define xmm_tmp2 xmm9
3393+ %define xmm_tmp3 xmm4
3394+ %define xmm_tmp4 xmm5
3395+ %define xmm_tmp5 xmm6
3396+ %define xmm_7fff xmm13
3397+ %define xmm_xpos_int_begin xmm14
3398+ %define xmm_xpos_frac_begin xmm15
3399+ pxor xmm_0, xmm_0
3400+ pcmpeqw xmm_7fff, xmm_7fff
3401+ psrlw xmm_7fff, 1
3402+%endif
3403+
3404+ sub i_dst_height, 1
3405+ je .final_row
3406+ jl .done
3407+
3408+ mov i_ypos, 1 << 14
3409+ movd xmm_xpos_frac, i_scalexd
3410+ pshufd xmm_xpos_frac, xmm_xpos_frac, 0
3411+ movdqa xmm_tmp0, xmm_xpos_frac
3412+ pslld xmm_tmp0, 2
3413+ pslldq xmm_xpos_frac, 4
3414+ paddd xmm_tmp0, xmm_xpos_frac
3415+ movdqa xmm_tmp1, xmm_xpos_frac
3416+ pslldq xmm_tmp1, 4
3417+ paddd xmm_xpos_frac, xmm_tmp1
3418+ paddd xmm_tmp0, xmm_tmp1
3419+ pslldq xmm_tmp1, 4
3420+ paddd xmm_xpos_frac, xmm_tmp1
3421+ paddd xmm_tmp0, xmm_tmp1
3422+ pcmpeqw xmm_tmp1, xmm_tmp1
3423+ psrld xmm_tmp1, 31
3424+ pslld xmm_tmp1, 15
3425+ paddd xmm_xpos_frac, xmm_tmp1
3426+ paddd xmm_tmp0, xmm_tmp1
3427+ movdqa xmm_xpos_int, xmm_xpos_frac
3428+ movdqa xmm_tmp1, xmm_tmp0
3429+ psrld xmm_xpos_int, 16
3430+ psrld xmm_tmp1, 16
3431+ packssdw xmm_xpos_int, xmm_tmp1
3432+ packuswb xmm_xpos_int, xmm_xpos_int
3433+ movdqa xmm_tmp1, xmm_xpos_int
3434+ pcmpeqw xmm_tmp2, xmm_tmp2
3435+ psubb xmm_tmp1, xmm_tmp2
3436+ punpcklbw xmm_xpos_int, xmm_tmp1
3437+ pslld xmm_xpos_frac, 16
3438+ pslld xmm_tmp0, 16
3439+ psrad xmm_xpos_frac, 16
3440+ psrad xmm_tmp0, 16
3441+ packssdw xmm_xpos_frac, xmm_tmp0
3442+ psrlw xmm_xpos_frac, 1
3443+ movd xmm_tmp0, i_scalexd
3444+ pslld xmm_tmp0, 3
3445+ movdqa xmm_tmp1, xmm_tmp0
3446+ punpcklwd xmm_tmp0, xmm_tmp0
3447+ pshufd xmm_tmp0, xmm_tmp0, 0
3448+ psrlw xmm_tmp0, 1
3449+ movdqa xmm_xpos_frac_inc, xmm_tmp0
3450+ psrld xmm_tmp1, 16
3451+ pxor xmm_tmp2, xmm_tmp2
3452+ pshufb xmm_tmp1, xmm_tmp2
3453+ movdqa xmm_xpos_int_inc, xmm_tmp1
3454+ movdqa xmm_xpos_int_begin, xmm_xpos_int
3455+ movdqa xmm_xpos_frac_begin, xmm_xpos_frac
3456+
3457+ cmp i_scalex, 4 << 16
3458+ ja .scalex_above4
3459+ cmp i_scalex, 2 << 16
3460+ ja .scalex_above2_beloweq4
3461+ SSE2_GeneralBilinearDownsampler_loop SSE41_BilinearAccurateDownsample2xOrLess_8px, 0
3462+ jmp .final_row
3463+%ifdef X86_32
3464+ %undef xmm_yfrac0
3465+ %xdefine xmm_yfrac0 xmm_tmp5
3466+ %undef xmm_tmp5
3467+%endif
3468+.scalex_above2_beloweq4:
3469+ SSE2_GeneralBilinearDownsampler_loop SSE41_BilinearAccurateDownsample4xOrLess_8px, 0
3470+ jmp .final_row
3471+.scalex_above4:
3472+%xdefine xmm_xfrac0 xmm_xpos_frac
3473+%xdefine xmm_xfrac1 xmm_xpos_int
3474+%xdefine xmm_xfrac0_begin xmm_xpos_int_begin
3475+%xdefine xmm_xfrac1_begin xmm_xpos_frac_begin
3476+%xdefine xmm_xfrac_inc xmm_xpos_frac_inc
3477+%undef xmm_xpos_int
3478+%undef xmm_xpos_frac
3479+%undef xmm_xpos_int_begin
3480+%undef xmm_xpos_frac_begin
3481+%undef xmm_xpos_int_inc
3482+%undef xmm_xpos_frac_inc
3483+ SSE2_UnpckXFracw xmm_tmp0, xmm_xfrac1, xmm_xfrac0, xmm_7fff
3484+ movdqa xmm_xfrac0, xmm_tmp0
3485+ movdqa xmm_xfrac0_begin, xmm_xfrac0
3486+ movdqa xmm_xfrac1_begin, xmm_xfrac1
3487+ pcmpeqw xmm_tmp0, xmm_tmp0
3488+ pmullw xmm_tmp0, xmm_xfrac_inc
3489+ punpcklwd xmm_tmp0, xmm_xfrac_inc
3490+ movdqa xmm_xfrac_inc, xmm_tmp0
3491+ SSE2_GeneralBilinearDownsampler_loop SSE41_GeneralBilinearAccurateDownsample_8px, 0
3492+
3493+.final_row:
3494+ mov p_src_row0, i_ypos
3495+ shr p_src_row0, 15
3496+ imul p_src_row0, i_src_stride
3497+ add p_src_row0, p_src
3498+ mov i_xpos, 1 << 15
3499+ mov i_width_cnt, i_dst_width
3500+
3501+.final_row_width:
3502+ mov r_tmp0, i_xpos
3503+ shr r_tmp0, 16
3504+ movzx r_tmp0, byte [p_src_row0 + r_tmp0]
3505+ mov [p_dst], r_tmp0b
3506+ add p_dst, 1
3507+ add i_xpos, i_scalex
3508+ sub i_width_cnt, 1
3509+ jg .final_row_width
3510+
3511+.done:
3512+%ifdef X86_32
3513+ mov esp, [esp]
3514+%endif
3515+ POP_XMM
3516+ LOAD_7_PARA_POP
3517+%ifndef X86_32
3518+%ifdef WIN64
3519+ pop rsi
3520+ pop rdi
3521+%endif
3522+ pop rbp
3523+ pop rbx
3524+ pop r13
3525+ pop r12
3526+%endif
3527+ ret
3528+%undef p_dst
3529+%undef i_dst_stride_less_width
3530+%undef i_dst_width
3531+%undef i_dst_height
3532+%undef p_src
3533+%undef i_src_stride
3534+%undef i_scalex
3535+%undef i_scalexd
3536+%undef i_scaleyd
3537+%undef i_xpos
3538+%undef i_ypos
3539+%undef i_yposd
3540+%undef p_src_row0
3541+%undef p_src_row1
3542+%undef i_width_cnt
3543+%undef r_tmp0
3544+%undef r_tmp0b
3545+%undef xmm_0
3546+%undef xmm_xpos_frac
3547+%undef xmm_xpos_frac_inc
3548+%undef xmm_xpos_int
3549+%undef xmm_xpos_int_inc
3550+%undef xmm_yfrac0
3551+%undef xmm_yfrac1
3552+%undef xmm_tmp0
3553+%undef xmm_tmp1
3554+%undef xmm_tmp2
3555+%undef xmm_tmp3
3556+%undef xmm_tmp4
3557+%undef xmm_tmp5
3558+%undef xmm_7fff
3559+%undef xmm_xpos_int_begin
3560+%undef xmm_xpos_frac_begin
3561+%undef xmm_xfrac0
3562+%undef xmm_xfrac1
3563+%undef xmm_xfrac0_begin
3564+%undef xmm_xfrac1_begin
3565+%undef xmm_xfrac_inc

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