From patchwork Wed Dec 4 13:21:36 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ragesh Radhakrishnan X-Patchwork-Id: 22019 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ob0-f199.google.com (mail-ob0-f199.google.com [209.85.214.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id A6C8623FCB for ; Wed, 4 Dec 2013 13:21:53 +0000 (UTC) Received: by mail-ob0-f199.google.com with SMTP id gq1sf50585393obb.10 for ; Wed, 04 Dec 2013 05:21:52 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=B9+Z3vml0D0mKvB/W6veYmE/vb8h4gv7aEVxICPs6ec=; b=B7ru7V88+salEji50JKZjSDns+oVZt2NhpYUYT2ouh00N6JMrrEBHdn8frxSr20oX2 IzgMKWkNbXHysYuVN3QFtgJn453FvzzHqDLgUrqF1l9hZ+qrnpTbQC6GmbMdGFZoMoq6 Pe8BbqDCNy5qSbCaYao7dopPyUiaTarkd0M/OOp5mAdJIK3mQ187FBfaoqX112LuIe3g uO2zbzjigi36BKUvJpuRxCIFZqbypzQrg0+hABN4+yiuwdfITaKTzjx6B/cJNEAxdvBD If9S2CBJwgwdmSYviZdTCMTD5P1lhKvcmlbjU77XlJjyjTMiUeYCrE+SAmFskiv5Sp18 Qwzg== X-Gm-Message-State: ALoCoQnjBmo839Vy/sBC0znqEe1XDv7j8VMRaP6mbR3cGY/q7dbn3ivM+9ZbIbrnWQCYrW0ZIIJi X-Received: by 10.183.3.36 with SMTP id bt4mr25414771obd.29.1386163312379; Wed, 04 Dec 2013 05:21:52 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.35.108 with SMTP id g12ls292746qej.81.gmail; Wed, 04 Dec 2013 05:21:52 -0800 (PST) X-Received: by 10.58.216.133 with SMTP id oq5mr38878vec.80.1386163312193; Wed, 04 Dec 2013 05:21:52 -0800 (PST) Received: from mail-ve0-f177.google.com (mail-ve0-f177.google.com [209.85.128.177]) by mx.google.com with ESMTPS id tj7si14183153vdc.98.2013.12.04.05.21.52 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 04 Dec 2013 05:21:52 -0800 (PST) Received-SPF: neutral (google.com: 209.85.128.177 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.177; Received: by mail-ve0-f177.google.com with SMTP id db12so11859610veb.36 for ; Wed, 04 Dec 2013 05:21:52 -0800 (PST) X-Received: by 10.58.50.35 with SMTP id z3mr51307ven.61.1386163311980; Wed, 04 Dec 2013 05:21:51 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.174.196 with SMTP id u4csp291573vcz; Wed, 4 Dec 2013 05:21:51 -0800 (PST) X-Received: by 10.68.220.194 with SMTP id py2mr45746492pbc.92.1386163311036; Wed, 04 Dec 2013 05:21:51 -0800 (PST) Received: from mail-pb0-f54.google.com (mail-pb0-f54.google.com [209.85.160.54]) by mx.google.com with ESMTPS id tt8si15656632pbc.318.2013.12.04.05.21.50 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 04 Dec 2013 05:21:51 -0800 (PST) Received-SPF: neutral (google.com: 209.85.160.54 is neither permitted nor denied by best guess record for domain of ragesh.r@linaro.org) client-ip=209.85.160.54; Received: by mail-pb0-f54.google.com with SMTP id un15so23608347pbc.27 for ; Wed, 04 Dec 2013 05:21:50 -0800 (PST) X-Received: by 10.68.217.129 with SMTP id oy1mr45443567pbc.23.1386163310205; Wed, 04 Dec 2013 05:21:50 -0800 (PST) Received: from ragesh-Latitude-E6420.LGE.NET ([203.247.149.152]) by mx.google.com with ESMTPSA id gh3sm137418454pbb.2.2013.12.04.05.21.46 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 04 Dec 2013 05:21:48 -0800 (PST) From: Ragesh Radhakrishnan To: patches@linaro.org Cc: Ragesh Radhakrishnan Subject: [PATCH 4/9] Add armv8 port idct_2x2 armv7 implementation Date: Wed, 4 Dec 2013 18:51:36 +0530 Message-Id: <1386163296-3229-1-git-send-email-ragesh.r@linaro.org> X-Mailer: git-send-email 1.7.9.5 X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: ragesh.r@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.128.177 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Modified existing idct_2x2 armv7 implementation to support armv8 --- simd/jsimd_arm_neon_64.S | 191 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 191 insertions(+) diff --git a/simd/jsimd_arm_neon_64.S b/simd/jsimd_arm_neon_64.S index f510814..ac38d39 100644 --- a/simd/jsimd_arm_neon_64.S +++ b/simd/jsimd_arm_neon_64.S @@ -1341,3 +1341,194 @@ asm_function jsimd_idct_4x4_neon .endfunc .purgem idct_helper + + +/* + * jsimd_idct_2x2_neon + * + * This function contains inverse-DCT code for getting reduced-size + * 2x2 pixels output from an 8x8 DCT block. It uses the same calculations + * and produces exactly the same output as IJG's original 'jpeg_idct_2x2' + * function from jpeg-6b (jidctred.c). + * + * NOTE: jpeg-8 has an improved implementation of 2x2 inverse-DCT, which + * requires much less arithmetic operations and hence should be faster. + * The primary purpose of this particular NEON optimized function is + * bit exact compatibility with jpeg-6b. + */ + +.balign 8 +jsimd_idct_2x2_neon_consts: + .short -FIX_0_720959822 /* d0[0] */ + .short FIX_0_850430095 /* d0[1] */ + .short -FIX_1_272758580 /* d0[2] */ + .short FIX_3_624509785 /* d0[3] */ + +.macro idct_helper x4, x6, x10, x12, x16, shift, y26, y27 + sshll v28.4s, \x4, #15 + smull v26.4s, \x6, v0.4h[3] + smlal v26.4s, \x10, v0.4h[2] + smlal v26.4s, \x12, v0.4h[1] + smlal v26.4s, \x16, v0.4h[0] + + add v20.4s, v28.4s, v26.4s + sub v28.4s, v28.4s, v26.4s + +.if \shift > 16 + srshr v20.4s, v20.4s, #\shift + srshr v28.4s, v28.4s, #\shift + xtn \y26, v20.4s + xtn \y27, v28.4s +.else + rshrn \y26, v20.4s, #\shift + rshrn \y27, v28.4s, #\shift +.endif + +.endm + +/****************************************************************************** +* +* jsimd_idct_2x2_neon +* +*******************************************************************************/ + +asm_function jsimd_idct_2x2_neon + + DCT_TABLE .req x0 + COEF_BLOCK .req x1 + OUTPUT_BUF .req x2 + OUTPUT_COL .req x3 + TMP1 .req x0 + TMP2 .req x15 + + /*vpush {v8.4h-v15.4h} ; not available */ + sub sp,sp,#32 + st1 {v8.4h-v11.4h}, [sp]/* save NEON registers */ + sub sp,sp,#32 + st1 {v12.4h-v15.4h},[sp] + + + /* Load constants */ + adr TMP2, jsimd_idct_2x2_neon_consts + ld1 {v0.4h}, [TMP2] + + /* Load all COEF_BLOCK into NEON registers with the following allocation: + * 0 1 2 3 | 4 5 6 7 + * ---------+-------- + * 0 | v4.4h | v5.4h + * 1 | v6.4h | v7.4h + * 2 | - | - + * 3 | v10.4h | v11.4h + * 4 | - | - + * 5 | v12.4h | v13.4h + * 6 | - | - + * 7 | v16.4h | v17.4h + */ + ld1 {v4.4h, v5.4h, v6.4h, v7.4h}, [COEF_BLOCK],32 + add COEF_BLOCK, COEF_BLOCK, #16 + ld1 {v10.4h, v11.4h}, [COEF_BLOCK],16 + add COEF_BLOCK, COEF_BLOCK, #16 + ld1 {v12.4h, v13.4h}, [COEF_BLOCK],16 + add COEF_BLOCK, COEF_BLOCK, #16 + ld1 {v16.4h, v17.4h}, [COEF_BLOCK],16 + /* Dequantize */ + ld1 {v18.4h, v19.4h, v20.4h, v21.4h}, [DCT_TABLE],32 + + mul v4.8h, v4.8h, v18.8h + mul v5.8h, v5.8h, v18.8h + ins v4.2d[1],v5.2d[0] + + mul v6.8h, v6.8h, v20.8h + mul v7.8h, v7.8h, v21.8h + ins v6.2d[1],v7.2d[0] + + add DCT_TABLE, DCT_TABLE, #16 + ld1 {v24.4h, v25.4h}, [DCT_TABLE],16 + + + mul v10.8h, v10.8h, v24.8h + mul v11.8h, v11.8h, v25.8h + ins v10.2d[1],v11.2d[0] + + add DCT_TABLE, DCT_TABLE, #16 + ld1 {v26.4h, v27.4h}, [DCT_TABLE],16 + + mul v12.8h, v12.8h, v26.8h + mul v13.8h, v13.8h, v27.8h + ins v12.2d[1],v13.2d[0] + + add DCT_TABLE, DCT_TABLE, #16 + + ld1 {v30.4h, v31.4h}, [DCT_TABLE],16 + + mul v16.8h, v16.8h, v30.8h + mul v17.8h, v17.8h, v31.8h + ins v16.2d[1],v17.2d[0] + + + /* Pass 1 */ +#if 0 + idct_helper v4.4h, v6.4h, v10.4h, v12.4h, v16.4h, 13, v4.4h, v6.4h + transpose_4x4 v4.4h, v6.4h, v8.4h, v10.4h + idct_helper v5.4h, v7.4h, v11.4h, v13.4h, v17.4h, 13, v5.4h, v7.4h + transpose_4x4 v5.4h, v7.4h, v9.4h, v11.4h +#else + smull v26.4s, v6.4h, v0.4h[3] + smlal v26.4s, v10.4h, v0.4h[2] + smlal v26.4s, v12.4h, v0.4h[1] + smlal v26.4s, v16.4h, v0.4h[0] + smull v24.4s, v7.4h, v0.4h[3] + smlal v24.4s, v11.4h, v0.4h[2] + smlal v24.4s, v13.4h, v0.4h[1] + smlal v24.4s, v17.4h, v0.4h[0] + sshll v28.4s, v4.4h, #15 + sshll v30.4s, v5.4h, #15 + add v20.4s, v28.4s, v26.4s + sub v28.4s, v28.4s, v26.4s + rshrn v4.4h, v20.4s, #13 + rshrn v6.4h, v28.4s, #13 + add v20.4s, v30.4s, v24.4s + sub v28.4s, v30.4s, v24.4s + rshrn v5.4h, v20.4s, #13 + rshrn v7.4h, v28.4s, #13 + transpose v4,v6,v3,.16b,.8h + transpose v6,v10,v3,.16b,.4s +#endif + + /* Pass 2 */ + idct_helper v4.4h, v6.4h, v10.4h, v7.4h, v11.4h, 20, v26.4h, v27.4h + + /* Range limit */ + movi v30.8h, #0x80 + ins v26.2d[1],v27.2d[0] + add v26.8h, v26.8h, v30.8h + sqxtun v30.8b, v26.8h + ins v26.2d[0],v30.2d[0] + sqxtun v27.8b,v26.8h + + /* Store results to the output buffer */ + ldp TMP1, TMP2,[OUTPUT_BUF] + add TMP1, TMP1, OUTPUT_COL + add TMP2, TMP2, OUTPUT_COL + + st1 {v26.b}[0], [TMP1],1 + st1 {v27.b}[4], [TMP1],1 + st1 {v26.b}[1], [TMP2],1 + st1 {v27.b}[5], [TMP2],1 + + /*vpop {v8.4h-v15.4h} ;not available*/ + + ld1 {v12.4h-v15.4h},[sp],32 + ld1 {v8.4h-v11.4h},[sp],32 + + blr x30 + + .unreq DCT_TABLE + .unreq COEF_BLOCK + .unreq OUTPUT_BUF + .unreq OUTPUT_COL + .unreq TMP1 + .unreq TMP2 +.endfunc + +.purgem idct_helper