00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #include "dsputil_mmx.h"
00022 #include "diracdsp_mmx.h"
00023
00024 void ff_put_rect_clamped_mmx(uint8_t *dst, int dst_stride, const int16_t *src, int src_stride, int width, int height);
00025 void ff_put_rect_clamped_sse2(uint8_t *dst, int dst_stride, const int16_t *src, int src_stride, int width, int height);
00026 void ff_put_signed_rect_clamped_mmx(uint8_t *dst, int dst_stride, const int16_t *src, int src_stride, int width, int height);
00027 void ff_put_signed_rect_clamped_sse2(uint8_t *dst, int dst_stride, const int16_t *src, int src_stride, int width, int height);
00028
00029 #define HPEL_FILTER(MMSIZE, EXT) \
00030 void ff_dirac_hpel_filter_v_ ## EXT(uint8_t *, uint8_t *, int, int); \
00031 void ff_dirac_hpel_filter_h_ ## EXT(uint8_t *, uint8_t *, int); \
00032 \
00033 static void dirac_hpel_filter_ ## EXT(uint8_t *dsth, uint8_t *dstv, uint8_t *dstc, \
00034 uint8_t *src, int stride, int width, int height) \
00035 { \
00036 while( height-- ) \
00037 { \
00038 ff_dirac_hpel_filter_v_ ## EXT(dstv-MMSIZE, src-MMSIZE, stride, width+MMSIZE+5); \
00039 ff_dirac_hpel_filter_h_ ## EXT(dsth, src, width); \
00040 ff_dirac_hpel_filter_h_ ## EXT(dstc, dstv, width); \
00041 \
00042 dsth += stride; \
00043 dstv += stride; \
00044 dstc += stride; \
00045 src += stride; \
00046 } \
00047 }
00048
00049 #if !ARCH_X86_64
00050 HPEL_FILTER(8, mmx)
00051 #endif
00052 HPEL_FILTER(16, sse2)
00053
00054 #define PIXFUNC(PFX, IDX, EXT) \
00055 \
00056 c->PFX ## _dirac_pixels_tab[1][IDX] = ff_ ## PFX ## _dirac_pixels16_ ## EXT; \
00057 c->PFX ## _dirac_pixels_tab[2][IDX] = ff_ ## PFX ## _dirac_pixels32_ ## EXT
00058
00059 void ff_diracdsp_init_mmx(DiracDSPContext* c)
00060 {
00061 int mm_flags = av_get_cpu_flags();
00062
00063 #if HAVE_YASM
00064 c->add_dirac_obmc[0] = ff_add_dirac_obmc8_mmx;
00065 #if !ARCH_X86_64
00066 c->add_dirac_obmc[1] = ff_add_dirac_obmc16_mmx;
00067 c->add_dirac_obmc[2] = ff_add_dirac_obmc32_mmx;
00068 c->dirac_hpel_filter = dirac_hpel_filter_mmx;
00069 c->add_rect_clamped = ff_add_rect_clamped_mmx;
00070 c->put_signed_rect_clamped = ff_put_signed_rect_clamped_mmx;
00071 #endif
00072 #endif
00073
00074 PIXFUNC(put, 0, mmx);
00075 PIXFUNC(avg, 0, mmx);
00076
00077 if (mm_flags & AV_CPU_FLAG_MMX2) {
00078 PIXFUNC(avg, 0, mmx2);
00079 }
00080
00081 if (mm_flags & AV_CPU_FLAG_SSE2) {
00082 #if HAVE_YASM
00083 c->dirac_hpel_filter = dirac_hpel_filter_sse2;
00084 c->add_rect_clamped = ff_add_rect_clamped_sse2;
00085 c->put_signed_rect_clamped = ff_put_signed_rect_clamped_sse2;
00086
00087 c->add_dirac_obmc[1] = ff_add_dirac_obmc16_sse2;
00088 c->add_dirac_obmc[2] = ff_add_dirac_obmc32_sse2;
00089 #endif
00090 c->put_dirac_pixels_tab[1][0] = ff_put_dirac_pixels16_sse2;
00091 c->avg_dirac_pixels_tab[1][0] = ff_avg_dirac_pixels16_sse2;
00092 c->put_dirac_pixels_tab[2][0] = ff_put_dirac_pixels32_sse2;
00093 c->avg_dirac_pixels_tab[2][0] = ff_avg_dirac_pixels32_sse2;
00094 }
00095 }