From patchwork Thu Jun 14 07:19:01 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shiyou Yin X-Patchwork-Id: 9401 Delivered-To: ffmpegpatchwork@gmail.com Received: by 2002:a02:11c:0:0:0:0:0 with SMTP id c28-v6csp1578408jad; Thu, 14 Jun 2018 00:19:14 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKMgHyWvmfO+rSicTYcrI4OUa/tTu6vk630tPbcvDyJ8GTcsnhj5ucll4wfEc3wJPnjxusl X-Received: by 2002:adf:fb92:: with SMTP id a18-v6mr1030330wrr.278.1528960754822; Thu, 14 Jun 2018 00:19:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528960754; cv=none; d=google.com; s=arc-20160816; b=nc6otgtMFfSAy9TtM69bQ2ezFvCkDuOMA3Xhf8Mnm8a3K9etozKhpzQHtE1/ENSvz0 Oh6i77XosZHE+kGEK74IKTY369mccPjneAEhuptxj5GcRyzaNMKjs/4YwQawGqOJ5ale LrIHN7w1fpEEndzhmH66mXQ7Gbo5BjNn8QdBJ3PnpFuq8Ygm7f+BmgbWjNIGLVjz6CZ0 ctGz4MZksCxmS/MWL1nIZdWxU8+BTQ87EkNH3MRSqBytJ4hZ02nPYaNMdpxZ9FcK9EuB TguogvbjEQSOwhW9bY6hGCY39Msxy134yvrC+aJve1yZMokyLoLGutZe5opxxn/PEMg/ SGdQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:message-id:date:to:from:delivered-to :arc-authentication-results; bh=jrXSq3cgTEtYNOkHJrjFhs1zDNu2sNOiYoIZmRKsj1o=; b=X2lF4sh0gLZIthPyTvmq1ByckfqMRqd1/Xp12MhHHQ4sX7c09tCnrRnwM8FB5l2bYR ZGTwh5J3tCFGOaO/s3nGEJlX42xvz9WnyMLfNj3uMRr/O3AiAtPjmCY4Sz7duBqVDUuf kN2xcFtUY45SdTZ+CR4Cm2BHKFP/Xv01qoV+DmHG2O0LvsKQVz0O0LQYcfMk22+l2dik /8njpoUjENtPtSDtwUCKU9Pnl8DHM8rH+WN431Q4pE0iMNTsYXj0Z3wj3a5+vSOpybCO pC30nXZynnTVwdvP1B9KI1Tj+kyrewvtZfqrZ/g8cFkucLgwBl6Y2/xv2u9vFgDigN1X F/Bw== 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 o188-v6si607037wmd.123.2018.06.14.00.19.14; Thu, 14 Jun 2018 00:19:14 -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 1326268AEF0; Thu, 14 Jun 2018 10:18:22 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail.loongson.cn (mail.loongson.cn [114.242.206.163]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 88A2C68ADBD for ; Thu, 14 Jun 2018 10:18:14 +0300 (EEST) Received: from localhost (unknown [202.141.160.96]) by mail (Coremail) with SMTP id QMiowPAxyOH3FSJbZX13AA--.14332S3; Thu, 14 Jun 2018 15:15:03 +0800 (CST) From: Shiyou Yin To: ffmpeg-devel@ffmpeg.org Date: Thu, 14 Jun 2018 15:19:01 +0800 Message-Id: <1528960741-16815-1-git-send-email-yinshiyou-hf@loongson.cn> X-Mailer: git-send-email 2.1.0 X-CM-TRANSID: QMiowPAxyOH3FSJbZX13AA--.14332S3 X-Coremail-Antispam: 1UD129KBjvJXoWxCF48GryrJw17tFWxCrW5trb_yoWrJryxp3 48Kw4UA3WSkF4fW347Jr48Cr13CFs5Xr1fGFsrKFy7Ja43tFsrurZ7Wws0gw4rKFn7AFsF qrZ8uFy5uayUAw7anT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUv214x267AKxVWUJVW8JwAFc2x0x2IEx4CE42xK8VAvwI8IcIk0 rVWrJVCq3wAFIxvE14AKwVWUJVWUGwA2ocxC64kIII0Yj41l84x0c7CEw4AK67xGY2AK02 1l84ACjcxK6xIIjxv20xvE14v26r4j6ryUM28EF7xvwVC0I7IYx2IY6xkF7I0E14v26r4j 6F4UM28EF7xvwVC2z280aVAFwI0_Gr1j6F4UJwA2z4x0Y4vEx4A2jsIEc7CjxVAFwI0_Cr 1j6rxdM2AIxVAIcxkEcVAq07x20xvEncxIr21l5I8CrVACY4xI64kE6c02F40Ex7xfMcIj 6xIIjxv20xvE14v26r1Y6r17McIj6I8E87Iv67AKxVWUJVW8JwAm72CE4IkC6x0Yz7v_Jr 0_Gr1lF7xvr2IYc2Ij64vIr41lF7xvr2IYc2Ij64vIr40E4x8a64kEw24lF7I21c0EjII2 zVCS5cI20VAGYxC7MxkIecxEwVAFwVW8CwCF04k20xvY0x0EwIxGrwCFx2IqxVCFs4IE7x kEbVWUJVW8JwC20s026c02F40E14v26r1j6r18MI8I3I0E7480Y4vE14v26r106r1rMI8E 67AF67kF1VAFwI0_Jrv_JF1lIxAIcVC0I7IYx2IY67AKxVWUJVWUCwCI42IY6xIIjxv20x vEc7CjxVAFwI0_Jr0_Gr1lIxAIcVCF04k26cxKx2IYs7xG6r4j6FyUMIIF0xvEx4A2jsIE 14v26r1j6r4UMIIF0xvEx4A2jsIEc7CjxVAFwI0_Jr0_GrUvcSsGvfC2KfnxnUUI43ZEXa 7VUjOzstUUUUU== X-CM-SenderInfo: p1lq2x5l1r3gtki6z05rqj20fqof0/ Subject: [FFmpeg-devel] [PATCH 3/7] avcodec/mips: [loongson] optimize memset in h264dsp. 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: Shiyou Yin MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Optimized memset with mmi in function: 1. ff_h264_add_pixels4_8_mmi. 2. ff_h264_idct_add_8_mmi. 3. ff_h264_idct8_add_8_mmi. Change-Id: Ifde1dd36c053970e33ac9cfc660cb21b17b1bd6d Signed-off-by: Shiyou Yin --- libavcodec/mips/h264dsp_mmi.c | 36 +++++++++++++++++++++++++++++++++--- 1 file changed, 33 insertions(+), 3 deletions(-) diff --git a/libavcodec/mips/h264dsp_mmi.c b/libavcodec/mips/h264dsp_mmi.c index ac6fa99..8cc632c 100644 --- a/libavcodec/mips/h264dsp_mmi.c +++ b/libavcodec/mips/h264dsp_mmi.c @@ -59,6 +59,17 @@ void ff_h264_add_pixels4_8_mmi(uint8_t *dst, int16_t *src, int stride) MMI_SWC1(%[ftmp2], %[dst1], 0x00) MMI_SWC1(%[ftmp3], %[dst2], 0x00) MMI_SWC1(%[ftmp4], %[dst3], 0x00) + + /* memset(src, 0, 32); */ + "xor %[ftmp0], %[ftmp0], %[ftmp0] \n\t" + "gssdlc1 %[ftmp0], 0x07(%[src]) \n\t" + "gssdrc1 %[ftmp0], 0x00(%[src]) \n\t" + "gssdlc1 %[ftmp0], 0x0f(%[src]) \n\t" + "gssdrc1 %[ftmp0], 0x08(%[src]) \n\t" + "gssdlc1 %[ftmp0], 0x17(%[src]) \n\t" + "gssdrc1 %[ftmp0], 0x10(%[src]) \n\t" + "gssdlc1 %[ftmp0], 0x1f(%[src]) \n\t" + "gssdrc1 %[ftmp0], 0x18(%[src]) \n\t" : [ftmp0]"=&f"(ftmp[0]), [ftmp1]"=&f"(ftmp[1]), [ftmp2]"=&f"(ftmp[2]), [ftmp3]"=&f"(ftmp[3]), [ftmp4]"=&f"(ftmp[4]), [ftmp5]"=&f"(ftmp[5]), @@ -72,7 +83,6 @@ void ff_h264_add_pixels4_8_mmi(uint8_t *dst, int16_t *src, int stride) : "memory" ); - memset(src, 0, 32); } void ff_h264_idct_add_8_mmi(uint8_t *dst, int16_t *block, int stride) @@ -152,6 +162,17 @@ void ff_h264_idct_add_8_mmi(uint8_t *dst, int16_t *block, int stride) MMI_SWC1(%[ftmp2], %[dst], 0x00) "packushb %[ftmp0], %[ftmp0], %[ftmp7] \n\t" MMI_SWXC1(%[ftmp0], %[dst], %[stride], 0x00) + + /* memset(block, 0, 32) */ + "xor %[ftmp0], %[ftmp0], %[ftmp0] \n\t" + "gssdlc1 %[ftmp0], 0x07(%[block]) \n\t" + "gssdrc1 %[ftmp0], 0x00(%[block]) \n\t" + "gssdlc1 %[ftmp0], 0x0f(%[block]) \n\t" + "gssdrc1 %[ftmp0], 0x08(%[block]) \n\t" + "gssdlc1 %[ftmp0], 0x17(%[block]) \n\t" + "gssdrc1 %[ftmp0], 0x10(%[block]) \n\t" + "gssdlc1 %[ftmp0], 0x1f(%[block]) \n\t" + "gssdrc1 %[ftmp0], 0x18(%[block]) \n\t" : [ftmp0]"=&f"(ftmp[0]), [ftmp1]"=&f"(ftmp[1]), [ftmp2]"=&f"(ftmp[2]), [ftmp3]"=&f"(ftmp[3]), [ftmp4]"=&f"(ftmp[4]), [ftmp5]"=&f"(ftmp[5]), @@ -167,7 +188,6 @@ void ff_h264_idct_add_8_mmi(uint8_t *dst, int16_t *block, int stride) : "memory" ); - memset(block, 0, 32); } void ff_h264_idct8_add_8_mmi(uint8_t *dst, int16_t *block, int stride) @@ -617,6 +637,17 @@ void ff_h264_idct8_add_8_mmi(uint8_t *dst, int16_t *block, int stride) MMI_SWC1(%[ftmp6], %[addr0], 0x00) MMI_SWXC1(%[ftmp7], %[addr0], %[stride], 0x00) PTR_ADDIU "$29, $29, 0x20 \n\t" + + /* memset(block, 0, 32) */ + "xor %[ftmp0], %[ftmp0], %[ftmp0] \n\t" + "gssdlc1 %[ftmp0], 0x07(%[block]) \n\t" + "gssdrc1 %[ftmp0], 0x00(%[block]) \n\t" + "gssdlc1 %[ftmp0], 0x0f(%[block]) \n\t" + "gssdrc1 %[ftmp0], 0x08(%[block]) \n\t" + "gssdlc1 %[ftmp0], 0x17(%[block]) \n\t" + "gssdrc1 %[ftmp0], 0x10(%[block]) \n\t" + "gssdlc1 %[ftmp0], 0x1f(%[block]) \n\t" + "gssdrc1 %[ftmp0], 0x18(%[block]) \n\t" : [ftmp0]"=&f"(ftmp[0]), [ftmp1]"=&f"(ftmp[1]), [ftmp2]"=&f"(ftmp[2]), [ftmp3]"=&f"(ftmp[3]), [ftmp4]"=&f"(ftmp[4]), [ftmp5]"=&f"(ftmp[5]), @@ -638,7 +669,6 @@ void ff_h264_idct8_add_8_mmi(uint8_t *dst, int16_t *block, int stride) : "$29","memory" ); - memset(block, 0, 128); } void ff_h264_idct_dc_add_8_mmi(uint8_t *dst, int16_t *block, int stride)