diff options
author | Matthieu Bouron <matthieu.bouron@gmail.com> | 2016-03-28 11:33:38 +0000 |
---|---|---|
committer | Matthieu Bouron <matthieu.bouron@stupeflix.com> | 2016-04-01 17:23:45 +0200 |
commit | 5629361cc24d7257f75f8c82653e84eaacaf9dc0 (patch) | |
tree | e38e3da43f0c0ee042075b15e7a367375764e0ba /libswscale/arm | |
parent | 339668301e455e3f8b5cba664622d7ccf5237b54 (diff) | |
download | ffmpeg-streaming-5629361cc24d7257f75f8c82653e84eaacaf9dc0.zip ffmpeg-streaming-5629361cc24d7257f75f8c82653e84eaacaf9dc0.tar.gz |
swscale/arm/yuv2rgb: save a few instructions by processing the luma line interleaved
Diffstat (limited to 'libswscale/arm')
-rw-r--r-- | libswscale/arm/yuv2rgb_neon.S | 80 |
1 files changed, 30 insertions, 50 deletions
diff --git a/libswscale/arm/yuv2rgb_neon.S b/libswscale/arm/yuv2rgb_neon.S index ee11e08..350e360 100644 --- a/libswscale/arm/yuv2rgb_neon.S +++ b/libswscale/arm/yuv2rgb_neon.S @@ -22,62 +22,35 @@ #include "libavutil/arm/asm.S" -.macro compute_premult half_u1, half_u2, half_v1, half_v2 - vmov d2, \half_u1 @ copy left q14 to left q1 - vmov d3, \half_u1 @ copy left q14 to right q1 - vmov d4, \half_u2 @ copy right q14 to left q2 - vmov d5, \half_u2 @ copy right q14 to right q2 - - vmov d6, \half_v1 @ copy left q15 to left q3 - vmov d7, \half_v1 @ copy left q15 to right q3 - vmov d8, \half_v2 @ copy right q15 to left q4 - vmov d9, \half_v2 @ copy right q15 to right q4 - - vzip.16 d2, d3 @ U1U1U2U2U3U3U4U4 - vzip.16 d4, d5 @ U5U5U6U6U7U7U8U8 - - vzip.16 d6, d7 @ V1V1V2V2V3V3V4V4 - vzip.16 d8, d9 @ V5V5V6V6V7V7V8V8 - - vmul.s16 q8, q3, d1[0] @ V * v2r (left, red) - vmul.s16 q9, q4, d1[0] @ V * v2r (right, red) - vmul.s16 q10, q1, d1[1] @ U * u2g - vmul.s16 q11, q2, d1[1] @ U * u2g - vmla.s16 q10, q3, d1[2] @ U * u2g + V * v2g (left, green) - vmla.s16 q11, q4, d1[2] @ U * u2g + V * v2g (right, green) - vmul.s16 q12, q1, d1[3] @ U * u2b (left, blue) - vmul.s16 q13, q2, d1[3] @ U * u2b (right, blue) +.macro compute_premult + vmul.s16 q8, q15, d1[0] @ q8 = V * v2r + vmul.s16 q9, q14, d1[1] @ q9 = U * u2g + vmla.s16 q9, q15, d1[2] @ q9 = U * u2g + V * v2g + vmul.s16 q10,q14, d1[3] @ q10 = U * u2b .endm -.macro compute_color dst_comp1 dst_comp2 pre1 pre2 - vadd.s16 q1, q14, \pre1 - vadd.s16 q2, q15, \pre2 +.macro compute_color dst_comp1 dst_comp2 pre + vadd.s16 q1, q14, \pre + vadd.s16 q2, q15, \pre vqrshrun.s16 \dst_comp1, q1, #6 vqrshrun.s16 \dst_comp2, q2, #6 .endm .macro compute_rgba r1 g1 b1 a1 r2 g2 b2 a2 - compute_color \r1, \r2, q8, q9 - compute_color \g1, \g2, q10, q11 - compute_color \b1, \b2, q12, q13 + compute_color \r1, \r2, q8 + compute_color \g1, \g2, q9 + compute_color \b1, \b2, q10 vmov.u8 \a1, #255 vmov.u8 \a2, #255 .endm -.macro compute dst y0 y1 ofmt - vmovl.u8 q14, \y0 @ 8px of y - vmovl.u8 q15, \y1 @ 8px of y - - vdup.16 q5, r9 @ q5 = y_offset - vmov d14, d0 @ q7 = y_coeff - vmov d15, d0 @ q7 = y_coeff - - vsub.s16 q14, q5 - vsub.s16 q15, q5 - - vmul.s16 q14, q7 @ q14 = (srcY - y_offset) * y_coeff (left) - vmul.s16 q15, q7 @ q15 = (srcY - y_offset) * y_coeff (right) - +.macro compute dst ofmt + vmovl.u8 q14, d14 @ q14 = Y + vmovl.u8 q15, d15 @ q15 = Y + vsub.s16 q14, q12 @ q14 = (Y - y_offset) + vsub.s16 q15, q12 @ q15 = (Y - y_offset) + vmul.s16 q14, q13 @ q14 = (Y - y_offset) * y_coeff + vmul.s16 q15, q13 @ q15 = (Y - y_offset) * y_coeff .ifc \ofmt,argb compute_rgba d7, d8, d9, d6, d11, d12, d13, d10 @@ -94,23 +67,27 @@ .ifc \ofmt,bgra compute_rgba d8, d7, d6, d9, d12, d11, d10, d13 .endif + + vzip.8 d6, d10 @ d6 = R1R2R3R4R5R6R7R8 d10 = R9R10R11R12R13R14R15R16 + vzip.8 d7, d11 @ d7 = G1G2G3G4G5G6G7G8 d11 = G9G10G11G12G13G14G15G16 + vzip.8 d8, d12 @ d8 = B1B2B3B4B5B6B7B8 d12 = B9B10B11B12B13B14B15B16 + vzip.8 d9, d13 @ d9 = A1A2A3A4A5A6A7A8 d13 = A9A10A11A12A13A14A15A16 vst4.8 {q3, q4}, [\dst,:128]! vst4.8 {q5, q6}, [\dst,:128]! - .endm .macro process_1l_internal dst src ofmt - vld1.8 {q7}, [\src]! - compute \dst, d14, d15, \ofmt + vld2.8 {d14, d15}, [\src]! @ q7 = Y (interleaved) + compute \dst, \ofmt .endm .macro process_1l ofmt - compute_premult d28, d29, d30, d31 + compute_premult process_1l_internal r2, r4, \ofmt .endm .macro process_2l ofmt - compute_premult d28, d29, d30, d31 + compute_premult process_1l_internal r2, r4, \ofmt process_1l_internal r11,r12,\ofmt .endm @@ -263,6 +240,9 @@ .macro declare_func ifmt ofmt function ff_\ifmt\()_to_\ofmt\()_neon, export=1 load_args_\ifmt + vdup.16 q12, r9 @ q12 = y_offset + vmov d26, d0 @ q13 = y_coeff + vmov d27, d0 @ q13 = y_coeff 1: mov r8, r0 @ r8 = width 2: |