2 * Copyright (C) 2010 David Conrad
4 * This file is part of FFmpeg.
6 * FFmpeg is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * FFmpeg is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with FFmpeg; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 #include "dsputil_mmx.h"
22 #include "diracdsp_mmx.h"
24 void ff_put_rect_clamped_mmx(uint8_t *dst, int dst_stride, const int16_t *src, int src_stride, int width, int height);
25 void ff_put_rect_clamped_sse2(uint8_t *dst, int dst_stride, const int16_t *src, int src_stride, int width, int height);
26 void ff_put_signed_rect_clamped_mmx(uint8_t *dst, int dst_stride, const int16_t *src, int src_stride, int width, int height);
27 void ff_put_signed_rect_clamped_sse2(uint8_t *dst, int dst_stride, const int16_t *src, int src_stride, int width, int height);
29 #define HPEL_FILTER(MMSIZE, EXT) \
30 void ff_dirac_hpel_filter_v_ ## EXT(uint8_t *, const uint8_t *, int, int); \
31 void ff_dirac_hpel_filter_h_ ## EXT(uint8_t *, const uint8_t *, int); \
33 static void dirac_hpel_filter_ ## EXT(uint8_t *dsth, uint8_t *dstv, uint8_t *dstc, \
34 const uint8_t *src, int stride, int width, int height) \
38 ff_dirac_hpel_filter_v_ ## EXT(dstv-MMSIZE, src-MMSIZE, stride, width+MMSIZE+5); \
39 ff_dirac_hpel_filter_h_ ## EXT(dsth, src, width); \
40 ff_dirac_hpel_filter_h_ ## EXT(dstc, dstv, width); \
54 #define PIXFUNC(PFX, IDX, EXT) \
55 /*MMXDISABLEDc->PFX ## _dirac_pixels_tab[0][IDX] = ff_ ## PFX ## _dirac_pixels8_ ## EXT;*/ \
56 c->PFX ## _dirac_pixels_tab[1][IDX] = ff_ ## PFX ## _dirac_pixels16_ ## EXT; \
57 c->PFX ## _dirac_pixels_tab[2][IDX] = ff_ ## PFX ## _dirac_pixels32_ ## EXT
59 void ff_diracdsp_init_mmx(DiracDSPContext* c)
61 int mm_flags = av_get_cpu_flags();
64 c->add_dirac_obmc[0] = ff_add_dirac_obmc8_mmx;
66 c->add_dirac_obmc[1] = ff_add_dirac_obmc16_mmx;
67 c->add_dirac_obmc[2] = ff_add_dirac_obmc32_mmx;
68 c->dirac_hpel_filter = dirac_hpel_filter_mmx;
69 c->add_rect_clamped = ff_add_rect_clamped_mmx;
70 c->put_signed_rect_clamped = ff_put_signed_rect_clamped_mmx;
77 if (mm_flags & AV_CPU_FLAG_MMX2) {
78 PIXFUNC(avg, 0, mmx2);
81 if (mm_flags & AV_CPU_FLAG_SSE2) {
83 c->dirac_hpel_filter = dirac_hpel_filter_sse2;
84 c->add_rect_clamped = ff_add_rect_clamped_sse2;
85 c->put_signed_rect_clamped = ff_put_signed_rect_clamped_sse2;
87 c->add_dirac_obmc[1] = ff_add_dirac_obmc16_sse2;
88 c->add_dirac_obmc[2] = ff_add_dirac_obmc32_sse2;
90 c->put_dirac_pixels_tab[1][0] = ff_put_dirac_pixels16_sse2;
91 c->avg_dirac_pixels_tab[1][0] = ff_avg_dirac_pixels16_sse2;
92 c->put_dirac_pixels_tab[2][0] = ff_put_dirac_pixels32_sse2;
93 c->avg_dirac_pixels_tab[2][0] = ff_avg_dirac_pixels32_sse2;