Originally committed as revision 24921 to svn://svn.ffmpeg.org/ffmpeg/trunk
| ... | ... |
@@ -4428,9 +4428,6 @@ av_cold void dsputil_init(DSPContext* c, AVCodecContext *avctx) |
| 4428 | 4428 |
c->vp3_v_loop_filter= ff_vp3_v_loop_filter_c; |
| 4429 | 4429 |
c->vp3_idct_dc_add= ff_vp3_idct_dc_add_c; |
| 4430 | 4430 |
} |
| 4431 |
- if (CONFIG_VP6_DECODER) {
|
|
| 4432 |
- c->vp6_filter_diag4= ff_vp6_filter_diag4_c; |
|
| 4433 |
- } |
|
| 4434 | 4431 |
|
| 4435 | 4432 |
c->h261_loop_filter= h261_loop_filter_c; |
| 4436 | 4433 |
|
| ... | ... |
@@ -91,10 +91,6 @@ void ff_vp3_idct_dc_add_c(uint8_t *dest/*align 8*/, int line_size, const DCTELEM |
| 91 | 91 |
void ff_vp3_v_loop_filter_c(uint8_t *src, int stride, int *bounding_values); |
| 92 | 92 |
void ff_vp3_h_loop_filter_c(uint8_t *src, int stride, int *bounding_values); |
| 93 | 93 |
|
| 94 |
-/* VP6 DSP functions */ |
|
| 95 |
-void ff_vp6_filter_diag4_c(uint8_t *dst, uint8_t *src, int stride, |
|
| 96 |
- const int16_t *h_weights, const int16_t *v_weights); |
|
| 97 |
- |
|
| 98 | 94 |
/* Bink functions */ |
| 99 | 95 |
void ff_bink_idct_c (DCTELEM *block); |
| 100 | 96 |
void ff_bink_idct_add_c(uint8_t *dest, int linesize, DCTELEM *block); |
| ... | ... |
@@ -369,9 +365,6 @@ typedef struct DSPContext {
|
| 369 | 369 |
void (*vp3_v_loop_filter)(uint8_t *src, int stride, int *bounding_values); |
| 370 | 370 |
void (*vp3_h_loop_filter)(uint8_t *src, int stride, int *bounding_values); |
| 371 | 371 |
|
| 372 |
- void (*vp6_filter_diag4)(uint8_t *dst, uint8_t *src, int stride, |
|
| 373 |
- const int16_t *h_weights,const int16_t *v_weights); |
|
| 374 |
- |
|
| 375 | 372 |
/* assume len is a multiple of 4, and arrays are 16-byte aligned */ |
| 376 | 373 |
void (*vorbis_inverse_coupling)(float *mag, float *ang, int blocksize); |
| 377 | 374 |
void (*ac3_downmix)(float (*samples)[256], float (*matrix)[2], int out_ch, int in_ch, int len); |
| ... | ... |
@@ -82,7 +82,12 @@ void ff_vp56dsp_init(VP56DSPContext *s, enum CodecID codec) |
| 82 | 82 |
} else {
|
| 83 | 83 |
s->edge_filter_hor = vp6_edge_filter_hor; |
| 84 | 84 |
s->edge_filter_ver = vp6_edge_filter_ver; |
| 85 |
+ |
|
| 86 |
+ if (CONFIG_VP6_DECODER) {
|
|
| 87 |
+ s->vp6_filter_diag4= ff_vp6_filter_diag4_c; |
|
| 88 |
+ } |
|
| 85 | 89 |
} |
| 86 | 90 |
|
| 87 | 91 |
if (ARCH_ARM) ff_vp56dsp_init_arm(s, codec); |
| 92 |
+ if (HAVE_MMX) ff_vp56dsp_init_x86(s, codec); |
|
| 88 | 93 |
} |
| ... | ... |
@@ -22,13 +22,21 @@ |
| 22 | 22 |
#define AVCODEC_VP56DSP_H |
| 23 | 23 |
|
| 24 | 24 |
#include <stdint.h> |
| 25 |
+#include "avcodec.h" |
|
| 25 | 26 |
|
| 26 | 27 |
typedef struct VP56DSPContext {
|
| 27 | 28 |
void (*edge_filter_hor)(uint8_t *yuv, int stride, int t); |
| 28 | 29 |
void (*edge_filter_ver)(uint8_t *yuv, int stride, int t); |
| 30 |
+ |
|
| 31 |
+ void (*vp6_filter_diag4)(uint8_t *dst, uint8_t *src, int stride, |
|
| 32 |
+ const int16_t *h_weights,const int16_t *v_weights); |
|
| 29 | 33 |
} VP56DSPContext; |
| 30 | 34 |
|
| 35 |
+void ff_vp6_filter_diag4_c(uint8_t *dst, uint8_t *src, int stride, |
|
| 36 |
+ const int16_t *h_weights, const int16_t *v_weights); |
|
| 37 |
+ |
|
| 31 | 38 |
void ff_vp56dsp_init(VP56DSPContext *s, enum CodecID codec); |
| 32 | 39 |
void ff_vp56dsp_init_arm(VP56DSPContext *s, enum CodecID codec); |
| 40 |
+void ff_vp56dsp_init_x86(VP56DSPContext* c, enum CodecID codec); |
|
| 33 | 41 |
|
| 34 | 42 |
#endif /* AVCODEC_VP56DSP_H */ |
| ... | ... |
@@ -559,7 +559,7 @@ static void vp6_filter(VP56Context *s, uint8_t *dst, uint8_t *src, |
| 559 | 559 |
vp6_filter_hv4(dst, src+offset1, stride, stride, |
| 560 | 560 |
vp6_block_copy_filter[select][y8]); |
| 561 | 561 |
} else {
|
| 562 |
- s->dsp.vp6_filter_diag4(dst, src+offset1+((mv.x^mv.y)>>31), stride, |
|
| 562 |
+ s->vp56dsp.vp6_filter_diag4(dst, src+offset1+((mv.x^mv.y)>>31), stride, |
|
| 563 | 563 |
vp6_block_copy_filter[select][x8], |
| 564 | 564 |
vp6_block_copy_filter[select][y8]); |
| 565 | 565 |
} |
| ... | ... |
@@ -29,11 +29,13 @@ MMX-OBJS-$(CONFIG_VC1_DECODER) += x86/vc1dsp_mmx.o |
| 29 | 29 |
MMX-OBJS-$(CONFIG_VP3_DECODER) += x86/vp3dsp_mmx.o \ |
| 30 | 30 |
x86/vp3dsp_sse2.o |
| 31 | 31 |
MMX-OBJS-$(CONFIG_VP5_DECODER) += x86/vp3dsp_mmx.o \ |
| 32 |
- x86/vp3dsp_sse2.o |
|
| 32 |
+ x86/vp3dsp_sse2.o \ |
|
| 33 |
+ x86/vp56dsp_init.o |
|
| 33 | 34 |
MMX-OBJS-$(CONFIG_VP6_DECODER) += x86/vp3dsp_mmx.o \ |
| 34 | 35 |
x86/vp3dsp_sse2.o \ |
| 35 | 36 |
x86/vp6dsp_mmx.o \ |
| 36 |
- x86/vp6dsp_sse2.o |
|
| 37 |
+ x86/vp6dsp_sse2.o \ |
|
| 38 |
+ x86/vp56dsp_init.o |
|
| 37 | 39 |
YASM-OBJS-$(CONFIG_VP8_DECODER) += x86/vp8dsp.o |
| 38 | 40 |
MMX-OBJS-$(CONFIG_VP8_DECODER) += x86/vp8dsp-init.o |
| 39 | 41 |
MMX-OBJS-$(HAVE_YASM) += x86/dsputil_yasm.o \ |
| ... | ... |
@@ -30,8 +30,6 @@ |
| 30 | 30 |
#include "dsputil_mmx.h" |
| 31 | 31 |
#include "vp3dsp_mmx.h" |
| 32 | 32 |
#include "vp3dsp_sse2.h" |
| 33 |
-#include "vp6dsp_mmx.h" |
|
| 34 |
-#include "vp6dsp_sse2.h" |
|
| 35 | 33 |
#include "idct_xvid.h" |
| 36 | 34 |
|
| 37 | 35 |
//#undef NDEBUG |
| ... | ... |
@@ -2626,10 +2624,6 @@ void dsputil_init_mmx(DSPContext* c, AVCodecContext *avctx) |
| 2626 | 2626 |
c->put_rv40_chroma_pixels_tab[0]= put_rv40_chroma_mc8_mmx; |
| 2627 | 2627 |
c->put_rv40_chroma_pixels_tab[1]= put_rv40_chroma_mc4_mmx; |
| 2628 | 2628 |
|
| 2629 |
- if (CONFIG_VP6_DECODER) {
|
|
| 2630 |
- c->vp6_filter_diag4 = ff_vp6_filter_diag4_mmx; |
|
| 2631 |
- } |
|
| 2632 |
- |
|
| 2633 | 2629 |
if (mm_flags & FF_MM_MMX2) {
|
| 2634 | 2630 |
c->prefetch = prefetch_mmx2; |
| 2635 | 2631 |
|
| ... | ... |
@@ -2812,10 +2806,6 @@ void dsputil_init_mmx(DSPContext* c, AVCodecContext *avctx) |
| 2812 | 2812 |
H264_QPEL_FUNCS(3, 1, sse2); |
| 2813 | 2813 |
H264_QPEL_FUNCS(3, 2, sse2); |
| 2814 | 2814 |
H264_QPEL_FUNCS(3, 3, sse2); |
| 2815 |
- |
|
| 2816 |
- if (CONFIG_VP6_DECODER) {
|
|
| 2817 |
- c->vp6_filter_diag4 = ff_vp6_filter_diag4_sse2; |
|
| 2818 |
- } |
|
| 2819 | 2815 |
} |
| 2820 | 2816 |
#if HAVE_SSSE3 |
| 2821 | 2817 |
if(mm_flags & FF_MM_SSSE3){
|
| 2822 | 2818 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,42 @@ |
| 0 |
+/* |
|
| 1 |
+ * VP6 MMX/SSE2 optimizations |
|
| 2 |
+ * Copyright (C) 2009 Sebastien Lucas <sebastien.lucas@gmail.com> |
|
| 3 |
+ * Copyright (C) 2009 Zuxy Meng <zuxy.meng@gmail.com> |
|
| 4 |
+ * |
|
| 5 |
+ * This file is part of FFmpeg. |
|
| 6 |
+ * |
|
| 7 |
+ * FFmpeg is free software; you can redistribute it and/or |
|
| 8 |
+ * modify it under the terms of the GNU Lesser General Public |
|
| 9 |
+ * License as published by the Free Software Foundation; either |
|
| 10 |
+ * version 2.1 of the License, or (at your option) any later version. |
|
| 11 |
+ * |
|
| 12 |
+ * FFmpeg is distributed in the hope that it will be useful, |
|
| 13 |
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
| 14 |
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
| 15 |
+ * Lesser General Public License for more details. |
|
| 16 |
+ * |
|
| 17 |
+ * You should have received a copy of the GNU Lesser General Public |
|
| 18 |
+ * License along with FFmpeg; if not, write to the Free Software |
|
| 19 |
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
| 20 |
+ */ |
|
| 21 |
+ |
|
| 22 |
+#include "libavutil/x86_cpu.h" |
|
| 23 |
+#include "libavcodec/dsputil.h" |
|
| 24 |
+#include "libavcodec/vp56dsp.h" |
|
| 25 |
+#include "vp6dsp_mmx.h" |
|
| 26 |
+#include "vp6dsp_sse2.h" |
|
| 27 |
+ |
|
| 28 |
+av_cold void ff_vp56dsp_init_x86(VP56DSPContext* c, enum CodecID codec) |
|
| 29 |
+{
|
|
| 30 |
+ int mm_flags = mm_support(); |
|
| 31 |
+ |
|
| 32 |
+ if (CONFIG_VP6_DECODER && codec == CODEC_ID_VP6) {
|
|
| 33 |
+ if (mm_flags & FF_MM_MMX) {
|
|
| 34 |
+ c->vp6_filter_diag4 = ff_vp6_filter_diag4_mmx; |
|
| 35 |
+ } |
|
| 36 |
+ |
|
| 37 |
+ if (mm_flags & FF_MM_SSE2) {
|
|
| 38 |
+ c->vp6_filter_diag4 = ff_vp6_filter_diag4_sse2; |
|
| 39 |
+ } |
|
| 40 |
+ } |
|
| 41 |
+} |