From patchwork Mon Oct 10 08:10:59 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?5ZGo5pmT5YuH?= X-Patchwork-Id: 942 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.140.66 with SMTP id o63csp2254424vsd; Mon, 10 Oct 2016 01:11:11 -0700 (PDT) X-Received: by 10.194.96.211 with SMTP id du19mr25074566wjb.62.1476087071518; Mon, 10 Oct 2016 01:11:11 -0700 (PDT) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id i1si11860902wjz.130.2016.10.10.01.11.11; Mon, 10 Oct 2016 01:11: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; dkim=neutral (body hash did not verify) header.i=@126.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; dmarc=fail (p=NONE dis=NONE) header.from=126.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 82C6D689B50; Mon, 10 Oct 2016 11:10:52 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from m15-56.126.com (m15-56.126.com [220.181.15.56]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 96F96689AD0 for ; Mon, 10 Oct 2016 11:10:44 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=126.com; s=s110527; h=Date:From:Subject:MIME-Version:Message-ID; bh=Eu5Xl y9ufgJtNzFMlgl5cDCvHV4vMVt00N2u0QYAHsM=; b=ZTFBs0ZkArh2sNGDtFZ/V qSb3Sw//IGG6bf+PwT2z82II3yyKVKK7Gy/lCEbii+BCx19dJwtl6eqT1Mx3FnSs 0nXZQ95TjGOw91+DrFcEznucC+T9ZgDLpWQsQfpPZa8AT91TFmsW0ELzm0FRNXCb EFBliGScTByi5AmqOY2otw= Received: from ipfootball$126.com ( [114.242.206.180] ) by ajax-webmail-wmsvr56 (Coremail) ; Mon, 10 Oct 2016 16:10:59 +0800 (CST) X-Originating-IP: [114.242.206.180] Date: Mon, 10 Oct 2016 16:10:59 +0800 (CST) From: =?GBK?B?1tzP/tPC?= To: "ffmpeg-devel@ffmpeg.org" X-Priority: 3 X-Mailer: Coremail Webmail Server Version SP_ntes V3.5 build 20160729(86883.8884) Copyright (c) 2002-2016 www.mailtech.cn 126com MIME-Version: 1.0 Message-ID: <2bb930d5.8eaa.157ada5153e.Coremail.ipfootball@126.com> X-Coremail-Locale: zh_CN X-CM-TRANSID: OMqowACXpv4TTftX4MpMAA--.2599W X-CM-SenderInfo: 5lsi00hwedzza6rslhhfrp/1tbiihP+E1XnLOoM4gAAsu X-Coremail-Antispam: 1U5529EdanIXcx71UUUUU7vcSsGvfC2KfnxnUU== X-Content-Filtered-By: Mailman/MimeDel 2.1.20 Subject: [FFmpeg-devel] [PATCH 6/7] avcodec/mips: version 1 of wmv2dsp optimizations for loongson mmi 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: "michael@niedermayer.cc" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" From 9b19ea3364d96a6eb0f3441f549c8d20ede36592 Mon Sep 17 00:00:00 2001 From: Zhou Xiaoyong Date: Mon, 10 Oct 2016 15:04:35 +0800 Subject: [PATCH 6/7] avcodec/mips: version 1 of wmv2dsp optimizations for loongson mmi --- libavcodec/mips/Makefile | 2 + libavcodec/mips/wmv2dsp_init_mips.c | 38 +++++ libavcodec/mips/wmv2dsp_mips.h | 29 ++++ libavcodec/mips/wmv2dsp_mmi.c | 278 ++++++++++++++++++++++++++++++++++++ libavcodec/wmv2dsp.c | 3 + libavcodec/wmv2dsp.h | 1 + 6 files changed, 351 insertions(+) create mode 100644 libavcodec/mips/wmv2dsp_init_mips.c create mode 100644 libavcodec/mips/wmv2dsp_mips.h create mode 100644 libavcodec/mips/wmv2dsp_mmi.c diff --git a/libavcodec/mips/Makefile b/libavcodec/mips/Makefile index cf54f38..2b6f37e 100644 --- a/libavcodec/mips/Makefile +++ b/libavcodec/mips/Makefile @@ -36,6 +36,7 @@ OBJS-$(CONFIG_MPEGVIDEO) += mips/mpegvideo_init_mips.o OBJS-$(CONFIG_MPEGVIDEOENC) += mips/mpegvideoencdsp_init_mips.o OBJS-$(CONFIG_ME_CMP) += mips/me_cmp_init_mips.o OBJS-$(CONFIG_MPEG4_DECODER) += mips/xvididct_init_mips.o +OBJS-$(CONFIG_WMV2DSP) += mips/wmv2dsp_init_mips.o MSA-OBJS-$(CONFIG_HEVC_DECODER) += mips/hevcdsp_msa.o \ mips/hevc_mc_uni_msa.o \ mips/hevc_mc_uniw_msa.o \ @@ -79,3 +80,4 @@ MMI-OBJS-$(CONFIG_PIXBLOCKDSP) += mips/pixblockdsp_mmi.o MMI-OBJS-$(CONFIG_H264QPEL) += mips/h264qpel_mmi.o MMI-OBJS-$(CONFIG_VP8_DECODER) += mips/vp8dsp_mmi.o MMI-OBJS-$(CONFIG_HPELDSP) += mips/hpeldsp_mmi.o +MMI-OBJS-$(CONFIG_WMV2DSP) += mips/wmv2dsp_mmi.o diff --git a/libavcodec/mips/wmv2dsp_init_mips.c b/libavcodec/mips/wmv2dsp_init_mips.c new file mode 100644 index 0000000..51dd207 --- /dev/null +++ b/libavcodec/mips/wmv2dsp_init_mips.c @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2016 Zhou Xiaoyong + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "config.h" +#include "libavutil/attributes.h" +#include "wmv2dsp_mips.h" + +#if HAVE_MMI +static av_cold void wmv2dsp_init_mmi(WMV2DSPContext *c) +{ + c->idct_add = ff_wmv2_idct_add_mmi; + c->idct_put = ff_wmv2_idct_put_mmi; +} +#endif /* HAVE_MMI */ + +av_cold void ff_wmv2dsp_init_mips(WMV2DSPContext *c) +{ +#if HAVE_MMI + wmv2dsp_init_mmi(c); +#endif /* HAVE_MMI */ +} diff --git a/libavcodec/mips/wmv2dsp_mips.h b/libavcodec/mips/wmv2dsp_mips.h new file mode 100644 index 0000000..22894c5 --- /dev/null +++ b/libavcodec/mips/wmv2dsp_mips.h @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2016 Zhou Xiaoyong + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVCODEC_MIPS_WMV2DSP_MIPS_H +#define AVCODEC_MIPS_WMV2DSP_MIPS_H + +#include "libavcodec/wmv2dsp.h" + +void ff_wmv2_idct_add_mmi(uint8_t *dest, int line_size, int16_t *block); +void ff_wmv2_idct_put_mmi(uint8_t *dest, int line_size, int16_t *block); + +#endif /* AVCODEC_MIPS_WMV2DSP_MIPS_H */ diff --git a/libavcodec/mips/wmv2dsp_mmi.c b/libavcodec/mips/wmv2dsp_mmi.c new file mode 100644 index 0000000..1f6ccb2 --- /dev/null +++ b/libavcodec/mips/wmv2dsp_mmi.c @@ -0,0 +1,278 @@ +/* + * WMV2 - DSP functions Loongson MMI-optimized + * + * Copyright (c) 2016 Zhou Xiaoyong + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "libavutil/avassert.h" +#include "constants.h" +#include "wmv2dsp_mips.h" +#include "libavutil/mips/mmiutils.h" + +#define W0 2048 +#define W1 2841 /* 2048*sqrt (2)*cos (1*pi/16) */ +#define W2 2676 /* 2048*sqrt (2)*cos (2*pi/16) */ +#define W3 2408 /* 2048*sqrt (2)*cos (3*pi/16) */ +#define W4 2048 /* 2048*sqrt (2)*cos (4*pi/16) */ +#define W5 1609 /* 2048*sqrt (2)*cos (5*pi/16) */ +#define W6 1108 /* 2048*sqrt (2)*cos (6*pi/16) */ +#define W7 565 /* 2048*sqrt (2)*cos (7*pi/16) */ + +static void wmv2_idct_row_mmi(short * b) +{ + int s1, s2; + int a0, a1, a2, a3, a4, a5, a6, a7; + + /* step 1 */ + a0 = W0 * b[0] + W0 * b[4]; + a1 = W1 * b[1] + W7 * b[7]; + a2 = W2 * b[2] + W6 * b[6]; + a3 = W3 * b[5] - W5 * b[3]; + a4 = W0 * b[0] - W0 * b[4]; + a5 = W5 * b[5] + W3 * b[3]; + a6 = W6 * b[2] - W2 * b[6]; + a7 = W7 * b[1] - W1 * b[7]; + + /* step 2 */ + s1 = (181 * (a1 - a5 + a7 - a3) + 128) >> 8; // 1, 3, 5, 7 + s2 = (181 * (a1 - a5 - a7 + a3) + 128) >> 8; + + /* step 3 */ + b[0] = (a0 + a2 + a1 + a5 + 128) >> 8; + b[1] = (a4 + a6 + s1 + 128) >> 8; + b[2] = (a4 - a6 + s2 + 128) >> 8; + b[3] = (a0 - a2 + a7 + a3 + 128) >> 8; + b[4] = (a0 - a2 - a7 - a3 + 128) >> 8; + b[5] = (a4 - a6 - s2 + 128) >> 8; + b[6] = (a4 + a6 - s1 + 128) >> 8; + b[7] = (a0 + a2 - a1 - a5 + 128) >> 8; +} + +static void wmv2_idct_col_mmi(short * b) +{ + int s1, s2; + int a0, a1, a2, a3, a4, a5, a6, a7; + + /* step 1, with extended precision */ + a0 = (W0 * b[ 0] + W0 * b[32] ) >> 3; + a1 = (W1 * b[ 8] + W7 * b[56] + 4) >> 3; + a2 = (W2 * b[16] + W6 * b[48] + 4) >> 3; + a3 = (W3 * b[40] - W5 * b[24] + 4) >> 3; + a4 = (W0 * b[ 0] - W0 * b[32] ) >> 3; + a5 = (W5 * b[40] + W3 * b[24] + 4) >> 3; + a6 = (W6 * b[16] - W2 * b[48] + 4) >> 3; + a7 = (W7 * b[ 8] - W1 * b[56] + 4) >> 3; + + /* step 2 */ + s1 = (181 * (a1 - a5 + a7 - a3) + 128) >> 8; + s2 = (181 * (a1 - a5 - a7 + a3) + 128) >> 8; + + /* step 3 */ + b[ 0] = (a0 + a2 + a1 + a5 + 8192) >> 14; + b[ 8] = (a4 + a6 + s1 + 8192) >> 14; + b[16] = (a4 - a6 + s2 + 8192) >> 14; + b[24] = (a0 - a2 + a7 + a3 + 8192) >> 14; + + b[32] = (a0 - a2 - a7 - a3 + 8192) >> 14; + b[40] = (a4 - a6 - s2 + 8192) >> 14; + b[48] = (a4 + a6 - s1 + 8192) >> 14; + b[56] = (a0 + a2 - a1 - a5 + 8192) >> 14; +} + +void ff_wmv2_idct_add_mmi(uint8_t *dest, int line_size, int16_t *block) +{ + int i; + double ftmp[11]; + + for (i = 0; i < 64; i += 8) + wmv2_idct_row_mmi(block + i); + for (i = 0; i < 8; i++) + wmv2_idct_col_mmi(block + i); + + __asm__ volatile ( + "xor %[ftmp0], %[ftmp0], %[ftmp0] \n\t" + + // low 4 loop + MMI_LDC1(%[ftmp1], %[block], 0x00) + MMI_LDC1(%[ftmp2], %[block], 0x08) + MMI_LDC1(%[ftmp3], %[block], 0x10) + MMI_LDC1(%[ftmp4], %[block], 0x18) + MMI_LDC1(%[ftmp5], %[block], 0x20) + MMI_LDC1(%[ftmp6], %[block], 0x28) + MMI_LDC1(%[ftmp7], %[block], 0x30) + MMI_LDC1(%[ftmp8], %[block], 0x38) + + MMI_LDC1(%[ftmp9], %[dest], 0x00) + "punpckhbh %[ftmp10], %[ftmp9], %[ftmp0] \n\t" + "punpcklbh %[ftmp9], %[ftmp9], %[ftmp0] \n\t" + "paddh %[ftmp1], %[ftmp1], %[ftmp9] \n\t" + "paddh %[ftmp2], %[ftmp2], %[ftmp10] \n\t" + "packushb %[ftmp1], %[ftmp1], %[ftmp2] \n\t" + MMI_SDC1(%[ftmp1], %[dest], 0x00) + PTR_ADDU "%[dest], %[dest], %[line_size] \n\t" + + MMI_LDC1(%[ftmp9], %[dest], 0x00) + "punpckhbh %[ftmp10], %[ftmp9], %[ftmp0] \n\t" + "punpcklbh %[ftmp9], %[ftmp9], %[ftmp0] \n\t" + "paddh %[ftmp3], %[ftmp3], %[ftmp9] \n\t" + "paddh %[ftmp4], %[ftmp4], %[ftmp10] \n\t" + "packushb %[ftmp3], %[ftmp3], %[ftmp4] \n\t" + MMI_SDC1(%[ftmp3], %[dest], 0x00) + PTR_ADDU "%[dest], %[dest], %[line_size] \n\t" + + MMI_LDC1(%[ftmp9], %[dest], 0x00) + "punpckhbh %[ftmp10], %[ftmp9], %[ftmp0] \n\t" + "punpcklbh %[ftmp9], %[ftmp9], %[ftmp0] \n\t" + "paddh %[ftmp5], %[ftmp5], %[ftmp9] \n\t" + "paddh %[ftmp6], %[ftmp6], %[ftmp10] \n\t" + "packushb %[ftmp5], %[ftmp5], %[ftmp6] \n\t" + MMI_SDC1(%[ftmp5], %[dest], 0x00) + PTR_ADDU "%[dest], %[dest], %[line_size] \n\t" + + MMI_LDC1(%[ftmp9], %[dest], 0x00) + "punpckhbh %[ftmp10], %[ftmp9], %[ftmp0] \n\t" + "punpcklbh %[ftmp9], %[ftmp9], %[ftmp0] \n\t" + "paddh %[ftmp7], %[ftmp7], %[ftmp9] \n\t" + "paddh %[ftmp8], %[ftmp8], %[ftmp10] \n\t" + "packushb %[ftmp7], %[ftmp7], %[ftmp8] \n\t" + MMI_SDC1(%[ftmp7], %[dest], 0x00) + + PTR_ADDIU "%[block], %[block], 0x40 \n\t" + PTR_ADDU "%[dest], %[dest], %[line_size] \n\t" + + // high 4 loop + MMI_LDC1(%[ftmp1], %[block], 0x00) + MMI_LDC1(%[ftmp2], %[block], 0x08) + MMI_LDC1(%[ftmp3], %[block], 0x10) + MMI_LDC1(%[ftmp4], %[block], 0x18) + MMI_LDC1(%[ftmp5], %[block], 0x20) + MMI_LDC1(%[ftmp6], %[block], 0x28) + MMI_LDC1(%[ftmp7], %[block], 0x30) + MMI_LDC1(%[ftmp8], %[block], 0x38) + + MMI_LDC1(%[ftmp9], %[dest], 0x00) + "punpckhbh %[ftmp10], %[ftmp9], %[ftmp0] \n\t" + "punpcklbh %[ftmp9], %[ftmp9], %[ftmp0] \n\t" + "paddh %[ftmp1], %[ftmp1], %[ftmp9] \n\t" + "paddh %[ftmp2], %[ftmp2], %[ftmp10] \n\t" + "packushb %[ftmp1], %[ftmp1], %[ftmp2] \n\t" + MMI_SDC1(%[ftmp1], %[dest], 0x00) + PTR_ADDU "%[dest], %[dest], %[line_size] \n\t" + + MMI_LDC1(%[ftmp9], %[dest], 0x00) + "punpckhbh %[ftmp10], %[ftmp9], %[ftmp0] \n\t" + "punpcklbh %[ftmp9], %[ftmp9], %[ftmp0] \n\t" + "paddh %[ftmp3], %[ftmp3], %[ftmp9] \n\t" + "paddh %[ftmp4], %[ftmp4], %[ftmp10] \n\t" + "packushb %[ftmp3], %[ftmp3], %[ftmp4] \n\t" + MMI_SDC1(%[ftmp3], %[dest], 0x00) + PTR_ADDU "%[dest], %[dest], %[line_size] \n\t" + + MMI_LDC1(%[ftmp9], %[dest], 0x00) + "punpckhbh %[ftmp10], %[ftmp9], %[ftmp0] \n\t" + "punpcklbh %[ftmp9], %[ftmp9], %[ftmp0] \n\t" + "paddh %[ftmp5], %[ftmp5], %[ftmp9] \n\t" + "paddh %[ftmp6], %[ftmp6], %[ftmp10] \n\t" + "packushb %[ftmp5], %[ftmp5], %[ftmp6] \n\t" + MMI_SDC1(%[ftmp5], %[dest], 0x00) + PTR_ADDU "%[dest], %[dest], %[line_size] \n\t" + + MMI_LDC1(%[ftmp9], %[dest], 0x00) + "punpckhbh %[ftmp10], %[ftmp9], %[ftmp0] \n\t" + "punpcklbh %[ftmp9], %[ftmp9], %[ftmp0] \n\t" + "paddh %[ftmp7], %[ftmp7], %[ftmp9] \n\t" + "paddh %[ftmp8], %[ftmp8], %[ftmp10] \n\t" + "packushb %[ftmp7], %[ftmp7], %[ftmp8] \n\t" + MMI_SDC1(%[ftmp7], %[dest], 0x00) + : [ftmp0]"=&f"(ftmp[0]), [ftmp1]"=&f"(ftmp[1]), + [ftmp2]"=&f"(ftmp[2]), [ftmp3]"=&f"(ftmp[3]), + [ftmp4]"=&f"(ftmp[4]), [ftmp5]"=&f"(ftmp[5]), + [ftmp6]"=&f"(ftmp[6]), [ftmp7]"=&f"(ftmp[7]), + [ftmp8]"=&f"(ftmp[8]), [ftmp9]"=&f"(ftmp[9]), + [ftmp10]"=&f"(ftmp[10]), + [block]"+&r"(block), [dest]"+&r"(dest) + : [line_size]"r"((mips_reg)line_size) + : "memory" + ); +} + +void ff_wmv2_idct_put_mmi(uint8_t *dest, int line_size, int16_t *block) +{ + int i; + double ftmp[8]; + + for (i = 0; i < 64; i += 8) + wmv2_idct_row_mmi(block + i); + for (i = 0; i < 8; i++) + wmv2_idct_col_mmi(block + i); + + __asm__ volatile ( + // low 4 loop + MMI_LDC1(%[ftmp0], %[block], 0x00) + MMI_LDC1(%[ftmp1], %[block], 0x08) + MMI_LDC1(%[ftmp2], %[block], 0x10) + MMI_LDC1(%[ftmp3], %[block], 0x18) + MMI_LDC1(%[ftmp4], %[block], 0x20) + MMI_LDC1(%[ftmp5], %[block], 0x28) + MMI_LDC1(%[ftmp6], %[block], 0x30) + MMI_LDC1(%[ftmp7], %[block], 0x38) + "packushb %[ftmp0], %[ftmp0], %[ftmp1] \n\t" + "packushb %[ftmp2], %[ftmp2], %[ftmp3] \n\t" + "packushb %[ftmp4], %[ftmp4], %[ftmp5] \n\t" + "packushb %[ftmp6], %[ftmp6], %[ftmp7] \n\t" + MMI_SDC1(%[ftmp0], %[dest], 0x00) + PTR_ADDU "%[dest], %[dest], %[line_size] \n\t" + MMI_SDC1(%[ftmp2], %[dest], 0x00) + PTR_ADDU "%[dest], %[dest], %[line_size] \n\t" + MMI_SDC1(%[ftmp4], %[dest], 0x00) + PTR_ADDU "%[dest], %[dest], %[line_size] \n\t" + MMI_SDC1(%[ftmp6], %[dest], 0x00) + + PTR_ADDIU "%[block], %[block], 0x40 \n\t" + PTR_ADDU "%[dest], %[dest], %[line_size] \n\t" + + // high 4 loop + MMI_LDC1(%[ftmp0], %[block], 0x00) + MMI_LDC1(%[ftmp1], %[block], 0x08) + MMI_LDC1(%[ftmp2], %[block], 0x10) + MMI_LDC1(%[ftmp3], %[block], 0x18) + MMI_LDC1(%[ftmp4], %[block], 0x20) + MMI_LDC1(%[ftmp5], %[block], 0x28) + MMI_LDC1(%[ftmp6], %[block], 0x30) + MMI_LDC1(%[ftmp7], %[block], 0x38) + "packushb %[ftmp0], %[ftmp0], %[ftmp1] \n\t" + "packushb %[ftmp2], %[ftmp2], %[ftmp3] \n\t" + "packushb %[ftmp4], %[ftmp4], %[ftmp5] \n\t" + "packushb %[ftmp6], %[ftmp6], %[ftmp7] \n\t" + MMI_SDC1(%[ftmp0], %[dest], 0x00) + PTR_ADDU "%[dest], %[dest], %[line_size] \n\t" + MMI_SDC1(%[ftmp2], %[dest], 0x00) + PTR_ADDU "%[dest], %[dest], %[line_size] \n\t" + MMI_SDC1(%[ftmp4], %[dest], 0x00) + PTR_ADDU "%[dest], %[dest], %[line_size] \n\t" + MMI_SDC1(%[ftmp6], %[dest], 0x00) + : [ftmp0]"=&f"(ftmp[0]), [ftmp1]"=&f"(ftmp[1]), + [ftmp2]"=&f"(ftmp[2]), [ftmp3]"=&f"(ftmp[3]), + [ftmp4]"=&f"(ftmp[4]), [ftmp5]"=&f"(ftmp[5]), + [ftmp6]"=&f"(ftmp[6]), [ftmp7]"=&f"(ftmp[7]), + [block]"+&r"(block), [dest]"+&r"(dest) + : [line_size]"r"((mips_reg)line_size) + : "memory" + ); +} diff --git a/libavcodec/wmv2dsp.c b/libavcodec/wmv2dsp.c index 40e0bef..b9e98d5 100644 --- a/libavcodec/wmv2dsp.c +++ b/libavcodec/wmv2dsp.c @@ -262,4 +262,7 @@ av_cold void ff_wmv2dsp_init(WMV2DSPContext *c) c->put_mspel_pixels_tab[5] = put_mspel8_mc12_c; c->put_mspel_pixels_tab[6] = put_mspel8_mc22_c; c->put_mspel_pixels_tab[7] = put_mspel8_mc32_c; + + if (ARCH_MIPS) + ff_wmv2dsp_init_mips(c); } diff --git a/libavcodec/wmv2dsp.h b/libavcodec/wmv2dsp.h index 0bf9489..62a990d 100644 --- a/libavcodec/wmv2dsp.h +++ b/libavcodec/wmv2dsp.h @@ -33,5 +33,6 @@ typedef struct WMV2DSPContext { } WMV2DSPContext; void ff_wmv2dsp_init(WMV2DSPContext *c); +void ff_wmv2dsp_init_mips(WMV2DSPContext *c); #endif /* AVCODEC_WMV2DSP_H */