From patchwork Fri Sep 15 06:13:01 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: kaustubh.raste@imgtec.com X-Patchwork-Id: 5147 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.2.36.26 with SMTP id f26csp290841jaa; Thu, 14 Sep 2017 23:12:15 -0700 (PDT) X-Google-Smtp-Source: AOwi7QAhp1W9/wCJJ5pBET63+U5Pkz273XothE0MjtFPkD4TsP5GQY2giE0LduK05O8nj7hm87xk X-Received: by 10.28.208.72 with SMTP id h69mr1886946wmg.134.1505455935610; Thu, 14 Sep 2017 23:12:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1505455935; cv=none; d=google.com; s=arc-20160816; b=rRjNyZKwtNujAG5veImdcXpLagXgMm0Uxz5+q5VQmZQsT5Y5qNez4c+OhgNevung24 k7xc/6Ti7Znib9jvWOtzIVH6XPc0QLL3lztrbw8DRfAMbek49+8rVuxxkD8dcuOCZwGF 4X+zC/a7U+wc1XQThb08eLBNjxBqDgV1s8b834iDKqK+hCrp/2pJiiWQogWbY8ppLDIK 48c3MH2PKbUGqsICDS+4pFWqm5B2Gcro9QyzC9VTGkEr2DaiD4qze2SsDHOGerUiTkW1 ts77y1cYWVMpnmafe+eDmLAEy4TuzZAU4jfb76lWmzdvb4WWIxFHSN37cTsCve3JqjEq +7pg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:mime-version:message-id:date:to:from :delivered-to:arc-authentication-results; bh=L/c2p35/k0Iz3JPxuzbF2YGb+wvk5iLTC/wUtZiKNjs=; b=X2En8plDEPq4vNvRL5rJvpoLcWTuIdIWO6m6JpxtnDht2cu+OOW/1giP9n8xd9FW/1 EAj1h2viFshYzfqLvXeETz37YdUCcRvEsu+v/JF53/HbNtS00+/OQ6UngmRlzvEemN2d kf8z5KuA6V7c0Dk3FSnyDtF+Rf+NE/CB13l6HpAIP4VkPYuWToS79GJ9RlvhVJLZtIlj 3V5AMxX0BOtv9qtTKJJavT+s0gFLdVFbIN3oAKyUAcbT7jk3FSvkDtviHGOp3UzuP6Ys qx0wj+WizEn+3fSmTuu2SxcqAjo7MONpC25D1SxlXJMfq7eDDPYHktGBqZws1kb9YosT IXKg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id o6si152885wre.419.2017.09.14.23.12.14; Thu, 14 Sep 2017 23:12:15 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id D0CA7689E6B; Fri, 15 Sep 2017 09:12:06 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mailapp01.imgtec.com (mailapp01.imgtec.com [195.59.15.196]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id C876E689C4D for ; Fri, 15 Sep 2017 09:12:00 +0300 (EEST) Received: from hhmail02.hh.imgtec.org (unknown [10.100.10.20]) by Forcepoint Email with ESMTPS id 9D66498949F9B for ; Fri, 15 Sep 2017 07:12:04 +0100 (IST) Received: from pudesk204.pu.imgtec.org (192.168.91.13) by hhmail02.hh.imgtec.org (10.100.10.20) with Microsoft SMTP Server (TLS) id 14.3.294.0; Fri, 15 Sep 2017 07:12:06 +0100 From: To: Date: Fri, 15 Sep 2017 11:43:01 +0530 Message-ID: <1505455981-27923-1-git-send-email-kaustubh.raste@imgtec.com> X-Mailer: git-send-email 1.7.9.5 MIME-Version: 1.0 X-Originating-IP: [192.168.91.13] Subject: [FFmpeg-devel] [PATCH] avcodec/mips: Improve avc mc copy msa functions X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Kaustubh Raste Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" From: Kaustubh Raste Remove loops and unroll as block sizes are known. Signed-off-by: Kaustubh Raste --- libavcodec/mips/h264qpel_msa.c | 81 +++++++++++++++++++++++++++++++++++++--- 1 file changed, 75 insertions(+), 6 deletions(-) diff --git a/libavcodec/mips/h264qpel_msa.c b/libavcodec/mips/h264qpel_msa.c index 43d21f7..05dffea 100644 --- a/libavcodec/mips/h264qpel_msa.c +++ b/libavcodec/mips/h264qpel_msa.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 Parag Salasakar (Parag.Salasakar@imgtec.com) + * Copyright (c) 2015 -2017 Parag Salasakar (Parag.Salasakar@imgtec.com) * * This file is part of FFmpeg. * @@ -2966,31 +2966,100 @@ static void avg_width16_msa(const uint8_t *src, int32_t src_stride, void ff_put_h264_qpel16_mc00_msa(uint8_t *dst, const uint8_t *src, ptrdiff_t stride) { - copy_width16_msa(src, stride, dst, stride, 16); + v16u8 src0, src1, src2, src3, src4, src5, src6, src7; + v16u8 src8, src9, src10, src11, src12, src13, src14, src15; + + LD_UB8(src, stride, src0, src1, src2, src3, src4, src5, src6, src7); + src += (8 * stride); + LD_UB8(src, stride, src8, src9, src10, src11, src12, src13, src14, src15); + + ST_UB8(src0, src1, src2, src3, src4, src5, src6, src7, dst, stride); + dst += (8 * stride); + ST_UB8(src8, src9, src10, src11, src12, src13, src14, src15, dst, stride); } void ff_put_h264_qpel8_mc00_msa(uint8_t *dst, const uint8_t *src, ptrdiff_t stride) { - copy_width8_msa(src, stride, dst, stride, 8); + uint64_t src0, src1, src2, src3, src4, src5, src6, src7; + + LD4(src, stride, src0, src1, src2, src3); + src += 4 * stride; + LD4(src, stride, src4, src5, src6, src7); + SD4(src0, src1, src2, src3, dst, stride); + dst += 4 * stride; + SD4(src4, src5, src6, src7, dst, stride); } void ff_avg_h264_qpel16_mc00_msa(uint8_t *dst, const uint8_t *src, ptrdiff_t stride) { - avg_width16_msa(src, stride, dst, stride, 16); + v16u8 src0, src1, src2, src3, src4, src5, src6, src7; + v16u8 dst0, dst1, dst2, dst3, dst4, dst5, dst6, dst7; + + LD_UB8(src, stride, src0, src1, src2, src3, src4, src5, src6, src7); + src += (8 * stride); + LD_UB8(dst, stride, dst0, dst1, dst2, dst3, dst4, dst5, dst6, dst7); + + AVER_UB4_UB(src0, dst0, src1, dst1, src2, dst2, src3, dst3, dst0, dst1, + dst2, dst3); + AVER_UB4_UB(src4, dst4, src5, dst5, src6, dst6, src7, dst7, dst4, dst5, + dst6, dst7); + ST_UB8(dst0, dst1, dst2, dst3, dst4, dst5, dst6, dst7, dst, stride); + dst += (8 * stride); + + LD_UB8(src, stride, src0, src1, src2, src3, src4, src5, src6, src7); + LD_UB8(dst, stride, dst0, dst1, dst2, dst3, dst4, dst5, dst6, dst7); + + AVER_UB4_UB(src0, dst0, src1, dst1, src2, dst2, src3, dst3, dst0, dst1, + dst2, dst3); + AVER_UB4_UB(src4, dst4, src5, dst5, src6, dst6, src7, dst7, dst4, dst5, + dst6, dst7); + ST_UB8(dst0, dst1, dst2, dst3, dst4, dst5, dst6, dst7, dst, stride); } void ff_avg_h264_qpel8_mc00_msa(uint8_t *dst, const uint8_t *src, ptrdiff_t stride) { - avg_width8_msa(src, stride, dst, stride, 8); + uint64_t tp0, tp1, tp2, tp3, tp4, tp5, tp6, tp7; + v16u8 src0 = { 0 }, src1 = { 0 }, src2 = { 0 }, src3 = { 0 }; + v16u8 dst0 = { 0 }, dst1 = { 0 }, dst2 = { 0 }, dst3 = { 0 }; + + LD4(src, stride, tp0, tp1, tp2, tp3); + src += 4 * stride; + LD4(src, stride, tp4, tp5, tp6, tp7); + INSERT_D2_UB(tp0, tp1, src0); + INSERT_D2_UB(tp2, tp3, src1); + INSERT_D2_UB(tp4, tp5, src2); + INSERT_D2_UB(tp6, tp7, src3); + + LD4(dst, stride, tp0, tp1, tp2, tp3); + LD4(dst + 4 * stride, stride, tp4, tp5, tp6, tp7); + INSERT_D2_UB(tp0, tp1, dst0); + INSERT_D2_UB(tp2, tp3, dst1); + INSERT_D2_UB(tp4, tp5, dst2); + INSERT_D2_UB(tp6, tp7, dst3); + + AVER_UB4_UB(src0, dst0, src1, dst1, src2, dst2, src3, dst3, dst0, dst1, + dst2, dst3); + + ST8x8_UB(dst0, dst1, dst2, dst3, dst, stride); } void ff_avg_h264_qpel4_mc00_msa(uint8_t *dst, const uint8_t *src, ptrdiff_t stride) { - avg_width4_msa(src, stride, dst, stride, 4); + uint32_t tp0, tp1, tp2, tp3; + v16u8 src0 = { 0 }, dst0 = { 0 }; + + LW4(src, stride, tp0, tp1, tp2, tp3); + INSERT_W4_UB(tp0, tp1, tp2, tp3, src0); + LW4(dst, stride, tp0, tp1, tp2, tp3); + INSERT_W4_UB(tp0, tp1, tp2, tp3, dst0); + + dst0 = __msa_aver_u_b(src0, dst0); + + ST4x4_UB(dst0, dst0, 0, 1, 2, 3, dst, stride); } void ff_put_h264_qpel16_mc10_msa(uint8_t *dst, const uint8_t *src,