diff options
author | Shivraj Patil <shivraj.patil@imgtec.com> | 2015-06-29 18:27:13 +0300 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2015-07-06 19:25:01 +0300 |
commit | 2f3f98af2b3215b7f3ab302275a0b3b4acaf84a5 (patch) | |
tree | 820512a13f2a87942a1f1b4f4b6a76e7c880e8ec /libavcodec/mips | |
parent | 115c14c3b6644181e0331bfbda7f86c61e939a7d (diff) |
avcodec/mips: MSA (MIPS-SIMD-Arch) optimizations for mpegvideoencdsp functions
This patch adds MSA (MIPS-SIMD-Arch) optimizations for mpegvideoencdsp functions in new file mpegvideoencdsp_msa.c
Signed-off-by: Shivraj Patil <shivraj.patil@imgtec.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/mips')
-rw-r--r-- | libavcodec/mips/Makefile | 2 | ||||
-rw-r--r-- | libavcodec/mips/mpegvideoencdsp_init_mips.c | 40 | ||||
-rw-r--r-- | libavcodec/mips/mpegvideoencdsp_msa.c | 62 |
3 files changed, 104 insertions, 0 deletions
diff --git a/libavcodec/mips/Makefile b/libavcodec/mips/Makefile index 277ac2a9e6..59c1f7947a 100644 --- a/libavcodec/mips/Makefile +++ b/libavcodec/mips/Makefile @@ -30,6 +30,7 @@ OBJS-$(CONFIG_HPELDSP) += mips/hpeldsp_init_mips.o OBJS-$(CONFIG_BLOCKDSP) += mips/blockdsp_init_mips.o OBJS-$(CONFIG_PIXBLOCKDSP) += mips/pixblockdsp_init_mips.o OBJS-$(CONFIG_MPEGVIDEO) += mips/mpegvideo_init_mips.o +OBJS-$(CONFIG_MPEGVIDEOENC) += mips/mpegvideoencdsp_init_mips.o MSA-OBJS-$(CONFIG_HEVC_DECODER) += mips/hevcdsp_msa.o \ mips/hevc_mc_uni_msa.o \ mips/hevc_mc_uniw_msa.o \ @@ -49,5 +50,6 @@ MSA-OBJS-$(CONFIG_HPELDSP) += mips/hpeldsp_msa.o MSA-OBJS-$(CONFIG_BLOCKDSP) += mips/blockdsp_msa.o MSA-OBJS-$(CONFIG_PIXBLOCKDSP) += mips/pixblockdsp_msa.o MSA-OBJS-$(CONFIG_MPEGVIDEO) += mips/mpegvideo_msa.o +MSA-OBJS-$(CONFIG_MPEGVIDEOENC) += mips/mpegvideoencdsp_msa.o LOONGSON3-OBJS-$(CONFIG_H264DSP) += mips/h264dsp_mmi.o LOONGSON3-OBJS-$(CONFIG_H264CHROMA) += mips/h264chroma_mmi.o diff --git a/libavcodec/mips/mpegvideoencdsp_init_mips.c b/libavcodec/mips/mpegvideoencdsp_init_mips.c new file mode 100644 index 0000000000..9bfe94e4cd --- /dev/null +++ b/libavcodec/mips/mpegvideoencdsp_init_mips.c @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2015 Manojkumar Bhosale (Manojkumar.Bhosale@imgtec.com) + * + * 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 "libavcodec/bit_depth_template.c" +#include "h263dsp_mips.h" + +#if HAVE_MSA +static av_cold void mpegvideoencdsp_init_msa(MpegvideoEncDSPContext *c, + AVCodecContext *avctx) +{ +#if BIT_DEPTH == 8 + c->pix_sum = ff_pix_sum_msa; +#endif +} +#endif // #if HAVE_MSA + +av_cold void ff_mpegvideoencdsp_init_mips(MpegvideoEncDSPContext *c, + AVCodecContext *avctx) +{ +#if HAVE_MSA + mpegvideoencdsp_init_msa(c, avctx); +#endif // #if HAVE_MSA +} diff --git a/libavcodec/mips/mpegvideoencdsp_msa.c b/libavcodec/mips/mpegvideoencdsp_msa.c new file mode 100644 index 0000000000..46473dafe5 --- /dev/null +++ b/libavcodec/mips/mpegvideoencdsp_msa.c @@ -0,0 +1,62 @@ +/* + * Copyright (c) 2015 Manojkumar Bhosale (Manojkumar.Bhosale@imgtec.com) + * + * 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 "h263dsp_mips.h" +#include "libavutil/mips/generic_macros_msa.h" + +static int32_t sum_u8src_16width_msa(uint8_t *src, int32_t stride) +{ + uint32_t sum = 0; + v16u8 in0, in1, in2, in3, in4, in5, in6, in7; + v16u8 in8, in9, in10, in11, in12, in13, in14, in15; + + LD_UB8(src, stride, in0, in1, in2, in3, in4, in5, in6, in7); + src += (8 * stride); + LD_UB8(src, stride, in8, in9, in10, in11, in12, in13, in14, in15); + + HADD_UB4_UB(in0, in1, in2, in3, in0, in1, in2, in3); + HADD_UB4_UB(in4, in5, in6, in7, in4, in5, in6, in7); + HADD_UB4_UB(in8, in9, in10, in11, in8, in9, in10, in11); + HADD_UB4_UB(in12, in13, in14, in15, in12, in13, in14, in15); + + sum = HADD_UH_U32(in0); + sum += HADD_UH_U32(in1); + sum += HADD_UH_U32(in2); + sum += HADD_UH_U32(in3); + sum += HADD_UH_U32(in4); + sum += HADD_UH_U32(in5); + sum += HADD_UH_U32(in6); + sum += HADD_UH_U32(in7); + sum += HADD_UH_U32(in8); + sum += HADD_UH_U32(in9); + sum += HADD_UH_U32(in10); + sum += HADD_UH_U32(in11); + sum += HADD_UH_U32(in12); + sum += HADD_UH_U32(in13); + sum += HADD_UH_U32(in14); + sum += HADD_UH_U32(in15); + + return sum; +} + +int ff_pix_sum_msa(uint8_t *pix, int line_size) +{ + return sum_u8src_16width_msa(pix, line_size); +} |