From patchwork Thu Jul 12 12:44:50 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shiyou Yin X-Patchwork-Id: 9698 Delivered-To: ffmpegpatchwork@gmail.com Received: by 2002:a02:104:0:0:0:0:0 with SMTP id c4-v6csp1618296jad; Thu, 12 Jul 2018 05:45:12 -0700 (PDT) X-Google-Smtp-Source: AAOMgpeWjzRvuieBcnv+zpWrxj3aVDwkgf9sFDuEaJ9jHAXq2jaBMZ9CEmRE5QiK1Ma5+AogDarE X-Received: by 2002:adf:aa0b:: with SMTP id p11-v6mr1595956wrd.220.1531399512006; Thu, 12 Jul 2018 05:45:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531399511; cv=none; d=google.com; s=arc-20160816; b=gfeD8j/X1Cc6DP4FIsSXvsyD4MsXj9WYDi2XvKyNDTWTYgsfzQPrtmetPRPBBCDcoC bOZBxYZp/9BYkfZjonrVlzmQNTfLlWQetP5gxoIb654tJKeAQRrnQlgdRKzbWCU0/tsp rFkW3ioxwHhWFl8y5ea9m1+eEmksGb18JbAefROmqunc98fgYZKd4C1rfzWq7yNWeMzO XPtSU5PtPv9ruTLfQZkGZl3WNPa2Aq0vy8z7JhlD5pyiJWgy9Jcu/ezFMgfQ+xqTObfY Oc9n37P+9wB5Cq/IZ4UsYWrMH2meL19BnvLMxA9JB3wAiEqz8IjHzqEkw8RocK6JIkOJ +H/A== 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: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=Esig/3A4zIts/0ez9jrGYq+saB3dhBk2NNkAbPUcqO8=; b=TTgh60VdoPcSG8+W6xbPKdNmiFasbwXZKudk16JKfzb0AqkcZpVNuMJTg2HDWZbSy1 DeXzcOk7J/D1LK5RTO4IFGKPIDrXZng6vUWumUrNhIenUZygxdvlx96F+58sNRazuve1 0AgTnomkQC/hc7LPqgiuJDYEzmryqgYChDOH4W/aqVEcyIqgqB7hbCFKhxWA5QeWJOeB SI+nxRQlvqnOATAyeGR7bgXqcXJ7D/bUuAOsr2WZhar30CvzSmTSb73C+8+fiBD55dCs JLXuHou21QH2iu0qAlo/Uh2+HcD49Fo/vMWre9hzfCJvK8ku7riiVuJfcZh5kg+86HO4 yk2w== 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 q12-v6si19977192wrp.314.2018.07.12.05.45.11; Thu, 12 Jul 2018 05:45:11 -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 4B97A68A6C9; Thu, 12 Jul 2018 15:44:50 +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 E5D2E68A679 for ; Thu, 12 Jul 2018 15:44:47 +0300 (EEST) Received: from localhost (unknown [202.141.160.96]) by mail (Coremail) with SMTP id QMiowPDxz2MgTEdbBZuTAA--.27131S3; Thu, 12 Jul 2018 20:40:01 +0800 (CST) From: Shiyou Yin To: ffmpeg-devel@ffmpeg.org Date: Thu, 12 Jul 2018 20:44:50 +0800 Message-Id: <1531399490-14682-1-git-send-email-yinshiyou-hf@loongson.cn> X-Mailer: git-send-email 2.1.0 X-CM-TRANSID: QMiowPDxz2MgTEdbBZuTAA--.27131S3 X-Coremail-Antispam: 1UD129KBjvJXoWxGF4xuw4rZFWkGr1DZFW5Jrb_yoWrGr43p3 48K3y5A3WSkF4fW347Jr18Gr13CFs5Xr1fGFsrKFy7Ja45tFsrWrZ7Wws0gw4rKFn7AFsF qrZ8uFW5uayUAw7anT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUk2b4IE77IF4wAFF20E14v26r1j6r4UM7CY07I20VC2zVCF04k2 6cxKx2IYs7xG6rWj6s0DM7CIcVAFz4kK6r1j6r18M28lY4IEw2IIxxk0rwA2F7IY1VAKz4 vEj48ve4kI8wA2z4x0Y4vE2Ix0cI8IcVAFwI0_JFI_Gr1l84ACjcxK6xIIjxv20xvEc7Cj xVAFwI0_Gr0_Cr1l84ACjcxK6I8E87Iv67AKxVWxJr0_GcWl84ACjcxK6I8E87Iv6xkF7I 0E14v26rxl6s0DM2AIxVAIcxkEcVAq07x20xvEncxIr21l5I8CrVACY4xI64kE6c02F40E x7xfMcIj6xIIjxv20xvE14v26r126r1DMcIj6I8E87Iv67AKxVW8JVWxJwAm72CE4IkC6x 0Yz7v_Jr0_Gr1lF7xvr2IYc2Ij64vIr41lF7xvr2IYc2Ij64vIr40E4x8a64kEw24lc2xS Y4AK67AK6ryUMxAIw28IcxkI7VAKI48JMxC20s026xCaFVCjc4AY6r1j6r4UMI8I3I0E5I 8CrVAFwI0_Jr0_Jr4lx2IqxVCjr7xvwVAFwI0_JrI_JrWlx4CE17CEb7AF67AKxVWUJVWU XwCI42IY6xIIjxv20xvE14v26r1j6r1xMIIF0xvE2Ix0cI8IcVCY1x0267AKxVWUJVW8Jw CI42IY6xAIw20EY4v20xvaj40_JFI_Gr1lIxAIcVC2z280aVAFwI0_Jr0_Gr1lIxAIcVC2 z280aVCY1x0267AKxVWUJVW8JbIYCTnIWIevJa73UjIFyTuYvjxUxoGQDUUUU X-CM-SenderInfo: p1lq2x5l1r3gtki6z05rqj20fqof0/ Subject: [FFmpeg-devel] [PATCH 4/9] 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 MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Optimized memset with mmi in following functions: 1. ff_h264_add_pixels4_8_mmi. 2. ff_h264_idct_add_8_mmi. 3. ff_h264_idct8_add_8_mmi. This optimization improved h264 decoding performance about 1fps(tested on loongson 3A3000). Change-Id: I4e8b75510e6a34b4c80f84ad784b00377570c4ec 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)