mirror of
https://gitee.com/openharmony/third_party_ffmpeg
synced 2024-11-24 03:39:45 +00:00
add SSE2 version of vp6_filter_diag
original patch by Zuxy Meng zuxy.meng _at_ gmail _dot_ com Originally committed as revision 17195 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
parent
6af3c226c3
commit
ecb24904fe
@ -415,11 +415,11 @@ MMX-OBJS-$(CONFIG_VC1_DECODER) += x86/vc1dsp_mmx.o
|
|||||||
MMX-OBJS-$(CONFIG_VP3_DECODER) += x86/vp3dsp_mmx.o x86/vp3dsp_sse2.o
|
MMX-OBJS-$(CONFIG_VP3_DECODER) += x86/vp3dsp_mmx.o x86/vp3dsp_sse2.o
|
||||||
MMX-OBJS-$(CONFIG_VP5_DECODER) += x86/vp3dsp_mmx.o x86/vp3dsp_sse2.o
|
MMX-OBJS-$(CONFIG_VP5_DECODER) += x86/vp3dsp_mmx.o x86/vp3dsp_sse2.o
|
||||||
MMX-OBJS-$(CONFIG_VP6_DECODER) += x86/vp3dsp_mmx.o x86/vp3dsp_sse2.o \
|
MMX-OBJS-$(CONFIG_VP6_DECODER) += x86/vp3dsp_mmx.o x86/vp3dsp_sse2.o \
|
||||||
x86/vp6dsp_mmx.o
|
x86/vp6dsp_mmx.o x86/vp6dsp_sse2.o
|
||||||
MMX-OBJS-$(CONFIG_VP6A_DECODER) += x86/vp3dsp_mmx.o x86/vp3dsp_sse2.o \
|
MMX-OBJS-$(CONFIG_VP6A_DECODER) += x86/vp3dsp_mmx.o x86/vp3dsp_sse2.o \
|
||||||
x86/vp6dsp_mmx.o
|
x86/vp6dsp_mmx.o x86/vp6dsp_sse2.o
|
||||||
MMX-OBJS-$(CONFIG_VP6F_DECODER) += x86/vp3dsp_mmx.o x86/vp3dsp_sse2.o \
|
MMX-OBJS-$(CONFIG_VP6F_DECODER) += x86/vp3dsp_mmx.o x86/vp3dsp_sse2.o \
|
||||||
x86/vp6dsp_mmx.o
|
x86/vp6dsp_mmx.o x86/vp6dsp_sse2.o
|
||||||
MMX-OBJS-$(CONFIG_WMV3_DECODER) += x86/vc1dsp_mmx.o
|
MMX-OBJS-$(CONFIG_WMV3_DECODER) += x86/vc1dsp_mmx.o
|
||||||
MMX-OBJS-$(HAVE_YASM) += x86/dsputil_yasm.o \
|
MMX-OBJS-$(HAVE_YASM) += x86/dsputil_yasm.o \
|
||||||
$(YASM-OBJS-yes)
|
$(YASM-OBJS-yes)
|
||||||
|
@ -32,6 +32,7 @@
|
|||||||
#include "vp3dsp_mmx.h"
|
#include "vp3dsp_mmx.h"
|
||||||
#include "vp3dsp_sse2.h"
|
#include "vp3dsp_sse2.h"
|
||||||
#include "vp6dsp_mmx.h"
|
#include "vp6dsp_mmx.h"
|
||||||
|
#include "vp6dsp_sse2.h"
|
||||||
#include "idct_xvid.h"
|
#include "idct_xvid.h"
|
||||||
|
|
||||||
//#undef NDEBUG
|
//#undef NDEBUG
|
||||||
@ -2901,6 +2902,10 @@ void dsputil_init_mmx(DSPContext* c, AVCodecContext *avctx)
|
|||||||
H264_QPEL_FUNCS(3, 1, sse2);
|
H264_QPEL_FUNCS(3, 1, sse2);
|
||||||
H264_QPEL_FUNCS(3, 2, sse2);
|
H264_QPEL_FUNCS(3, 2, sse2);
|
||||||
H264_QPEL_FUNCS(3, 3, sse2);
|
H264_QPEL_FUNCS(3, 3, sse2);
|
||||||
|
|
||||||
|
if (CONFIG_VP6_DECODER) {
|
||||||
|
c->vp6_filter_diag4 = ff_vp6_filter_diag4_sse2;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#if HAVE_SSSE3
|
#if HAVE_SSSE3
|
||||||
if(mm_flags & FF_MM_SSSE3){
|
if(mm_flags & FF_MM_SSSE3){
|
||||||
|
98
libavcodec/x86/vp6dsp_sse2.c
Normal file
98
libavcodec/x86/vp6dsp_sse2.c
Normal file
@ -0,0 +1,98 @@
|
|||||||
|
/**
|
||||||
|
* @file libavcodec/x86/vp6dsp_mmx.c
|
||||||
|
* SSE2-optimized functions for the VP6 decoder
|
||||||
|
*
|
||||||
|
* Copyright (C) 2009 Zuxy Meng <zuxy.meng@gmail.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 "libavutil/x86_cpu.h"
|
||||||
|
#include "libavcodec/dsputil.h"
|
||||||
|
#include "dsputil_mmx.h"
|
||||||
|
#include "vp6dsp_sse2.h"
|
||||||
|
|
||||||
|
#define DIAG4_SSE2(in1,in2,in3,in4) \
|
||||||
|
"movq "#in1"(%0), %%xmm0 \n\t" \
|
||||||
|
"movq "#in2"(%0), %%xmm1 \n\t" \
|
||||||
|
"punpcklbw %%xmm7, %%xmm0 \n\t" \
|
||||||
|
"punpcklbw %%xmm7, %%xmm1 \n\t" \
|
||||||
|
"pmullw %%xmm4, %%xmm0 \n\t" /* src[x-8 ] * biweight [0] */ \
|
||||||
|
"pmullw %%xmm5, %%xmm1 \n\t" /* src[x ] * biweight [1] */ \
|
||||||
|
"paddw %%xmm1, %%xmm0 \n\t" \
|
||||||
|
"movq "#in3"(%0), %%xmm1 \n\t" \
|
||||||
|
"movq "#in4"(%0), %%xmm2 \n\t" \
|
||||||
|
"punpcklbw %%xmm7, %%xmm1 \n\t" \
|
||||||
|
"punpcklbw %%xmm7, %%xmm2 \n\t" \
|
||||||
|
"pmullw %%xmm6, %%xmm1 \n\t" /* src[x+8 ] * biweight [2] */ \
|
||||||
|
"pmullw %%xmm3, %%xmm2 \n\t" /* src[x+16] * biweight [3] */ \
|
||||||
|
"paddw %%xmm2, %%xmm1 \n\t" \
|
||||||
|
"paddsw %%xmm1, %%xmm0 \n\t" \
|
||||||
|
"paddsw "MANGLE(ff_pw_64)", %%xmm0 \n\t" /* Add 64 */ \
|
||||||
|
"psraw $7, %%xmm0 \n\t" \
|
||||||
|
"packuswb %%xmm0, %%xmm0 \n\t" \
|
||||||
|
"movq %%xmm0, (%1) \n\t" \
|
||||||
|
|
||||||
|
void ff_vp6_filter_diag4_sse2(uint8_t *dst, uint8_t *src, int stride,
|
||||||
|
const int16_t *h_weights,const int16_t *v_weights)
|
||||||
|
{
|
||||||
|
uint8_t tmp[8*11], *t = tmp;
|
||||||
|
src -= stride;
|
||||||
|
|
||||||
|
__asm__ volatile(
|
||||||
|
"pxor %%xmm7, %%xmm7 \n\t"
|
||||||
|
"movq %4, %%xmm3 \n\t"
|
||||||
|
"pshuflw $0, %%xmm3, %%xmm4 \n\t"
|
||||||
|
"punpcklqdq %%xmm4, %%xmm4 \n\t"
|
||||||
|
"pshuflw $85, %%xmm3, %%xmm5 \n\t"
|
||||||
|
"punpcklqdq %%xmm5, %%xmm5 \n\t"
|
||||||
|
"pshuflw $170, %%xmm3, %%xmm6 \n\t"
|
||||||
|
"punpcklqdq %%xmm6, %%xmm6 \n\t"
|
||||||
|
"pshuflw $255, %%xmm3, %%xmm3 \n\t"
|
||||||
|
"punpcklqdq %%xmm3, %%xmm3 \n\t"
|
||||||
|
"1: \n\t"
|
||||||
|
DIAG4_SSE2(-1,0,1,2)
|
||||||
|
"add $8, %1 \n\t"
|
||||||
|
"add %2, %0 \n\t"
|
||||||
|
"decl %3 \n\t"
|
||||||
|
"jnz 1b \n\t"
|
||||||
|
: "+r"(src), "+r"(t)
|
||||||
|
: "g"((x86_reg)stride), "r"(11), "m"(*(const int64_t*)h_weights)
|
||||||
|
: "memory");
|
||||||
|
|
||||||
|
t = tmp + 8;
|
||||||
|
|
||||||
|
__asm__ volatile(
|
||||||
|
"movq %4, %%xmm3 \n\t"
|
||||||
|
"pshuflw $0, %%xmm3, %%xmm4 \n\t"
|
||||||
|
"punpcklqdq %%xmm4, %%xmm4 \n\t"
|
||||||
|
"pshuflw $85, %%xmm3, %%xmm5 \n\t"
|
||||||
|
"punpcklqdq %%xmm5, %%xmm5 \n\t"
|
||||||
|
"pshuflw $170, %%xmm3, %%xmm6 \n\t"
|
||||||
|
"punpcklqdq %%xmm6, %%xmm6 \n\t"
|
||||||
|
"pshuflw $255, %%xmm3, %%xmm3 \n\t"
|
||||||
|
"punpcklqdq %%xmm3, %%xmm3 \n\t"
|
||||||
|
"1: \n\t"
|
||||||
|
DIAG4_SSE2(-8,0,8,16)
|
||||||
|
"add $8, %0 \n\t"
|
||||||
|
"add %2, %1 \n\t"
|
||||||
|
"decl %3 \n\t"
|
||||||
|
"jnz 1b \n\t"
|
||||||
|
: "+r"(t), "+r"(dst)
|
||||||
|
: "g"((x86_reg)stride), "r"(8), "m"(*(const int64_t*)v_weights)
|
||||||
|
: "memory");
|
||||||
|
}
|
30
libavcodec/x86/vp6dsp_sse2.h
Normal file
30
libavcodec/x86/vp6dsp_sse2.h
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
/*
|
||||||
|
* vp6dsp SSE2 function declarations
|
||||||
|
* Copyright (c) 2009 Zuxy Meng <zuxy.meng@gmail.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
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef AVCODEC_X86_VP6DSP_SSE2_H
|
||||||
|
#define AVCODEC_X86_VP6DSP_SSE2_H
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
void ff_vp6_filter_diag4_sse2(uint8_t *dst, uint8_t *src, int stride,
|
||||||
|
const int16_t *h_weights,const int16_t *v_weights);
|
||||||
|
|
||||||
|
#endif /* AVCODEC_X86_VP6DSP_SSE2_H */
|
Loading…
Reference in New Issue
Block a user