diracdsp_mmx.c
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2010 David Conrad
3  *
4  * This file is part of FFmpeg.
5  *
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.
10  *
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.
15  *
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
19  */
20 
21 #include "dsputil_mmx.h"
22 #include "diracdsp_mmx.h"
23 
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);
28 
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); \
32  \
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) \
35  { \
36  while( height-- ) \
37  { \
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); \
41  \
42  dsth += stride; \
43  dstv += stride; \
44  dstc += stride; \
45  src += stride; \
46  } \
47  }
48 
49 #if !ARCH_X86_64
50 HPEL_FILTER(8, mmx)
51 #endif
52 HPEL_FILTER(16, sse2)
53 
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
58 
60 {
61  int mm_flags = av_get_cpu_flags();
62 
63  if (!(mm_flags & AV_CPU_FLAG_MMX))
64  return;
65 
66 #if HAVE_YASM
68 #if !ARCH_X86_64
71  c->dirac_hpel_filter = dirac_hpel_filter_mmx;
74 #endif
75 #endif
76 
77 #if HAVE_MMX_INLINE
78  PIXFUNC(put, 0, mmx);
79  PIXFUNC(avg, 0, mmx);
80 #endif
81 
82 #if HAVE_MMXEXT_INLINE
83  if (mm_flags & AV_CPU_FLAG_MMX2) {
84  PIXFUNC(avg, 0, mmxext);
85  }
86 #endif
87 
88  if (mm_flags & AV_CPU_FLAG_SSE2) {
89 #if HAVE_YASM
90  c->dirac_hpel_filter = dirac_hpel_filter_sse2;
93 
96 #endif
97 #if HAVE_SSE2_INLINE
102 #endif
103  }
104 }
void ff_add_dirac_obmc16_mmx(uint16_t *dst, const uint8_t *src, int stride, const uint8_t *obmc_weight, int yblen)
void ff_put_dirac_pixels16_sse2(uint8_t *dst, const uint8_t *src[5], int stride, int h)
#define AV_CPU_FLAG_MMX2
SSE integer functions or AMD MMX ext.
Definition: cpu.h:31
void(* add_rect_clamped)(uint8_t *dst, const uint16_t *src, int stride, const int16_t *idwt, int idwt_stride, int width, int height)
Definition: diracdsp.h:46
void ff_add_dirac_obmc32_mmx(uint16_t *dst, const uint8_t *src, int stride, const uint8_t *obmc_weight, int yblen)
void ff_avg_dirac_pixels32_sse2(uint8_t *dst, const uint8_t *src[5], int stride, int h)
void ff_add_rect_clamped_sse2(uint8_t *, const uint16_t *, int, const int16_t *, int, int, int)
uint8_t
void ff_add_dirac_obmc32_sse2(uint16_t *dst, const uint8_t *src, int stride, const uint8_t *obmc_weight, int yblen)
#define PIXFUNC(PFX, IDX, EXT)
Definition: diracdsp_mmx.c:54
#define put(d, s)
Definition: dsputil_align.c:51
void ff_add_rect_clamped_mmx(uint8_t *, const uint16_t *, int, const int16_t *, int, int, int)
void ff_diracdsp_init_mmx(DiracDSPContext *c)
Definition: diracdsp_mmx.c:59
void ff_put_dirac_pixels32_sse2(uint8_t *dst, const uint8_t *src[5], int stride, int h)
void(* avg_dirac_pixels_tab[3][4])(uint8_t *dst, const uint8_t *src[5], int stride, int h)
Definition: diracdsp.h:42
#define HPEL_FILTER(MMSIZE, EXT)
Definition: diracdsp_mmx.c:29
void ff_put_rect_clamped_sse2(uint8_t *dst, int dst_stride, const int16_t *src, int src_stride, int width, int height)
void ff_avg_dirac_pixels16_sse2(uint8_t *dst, const uint8_t *src[5], int stride, int h)
void(* add_dirac_obmc[3])(uint16_t *dst, const uint8_t *src, int stride, const uint8_t *obmc_weight, int yblen)
Definition: diracdsp.h:47
static int width
Definition: tests/utils.c:158
AVS_Value src
Definition: avisynth_c.h:523
#define AV_CPU_FLAG_MMX
standard MMX
Definition: cpu.h:29
BYTE int const BYTE int int int height
Definition: avisynth_c.h:713
int av_get_cpu_flags(void)
Return the flags which specify extensions supported by the CPU.
Definition: cpu.c:30
void ff_add_dirac_obmc8_mmx(uint16_t *dst, const uint8_t *src, int stride, const uint8_t *obmc_weight, int yblen)
static double c[64]
void ff_put_signed_rect_clamped_sse2(uint8_t *dst, int dst_stride, const int16_t *src, int src_stride, int width, int height)
void ff_add_dirac_obmc16_sse2(uint16_t *dst, const uint8_t *src, int stride, const uint8_t *obmc_weight, int yblen)
void(* put_dirac_pixels_tab[3][4])(uint8_t *dst, const uint8_t *src[5], int stride, int h)
dirac_pixels_tab[width][subpel] width is 2 for 32, 1 for 16, 0 for 8 subpel is 0 for fpel and hpel (o...
Definition: diracdsp.h:41
#define avg(d, s)
Definition: dsputil_align.c:52
else dst[i][x+y *dst_stride[i]]
Definition: vf_mcdeint.c:160
#define AV_CPU_FLAG_SSE2
PIV SSE2 functions.
Definition: cpu.h:34
void ff_put_rect_clamped_mmx(uint8_t *dst, int dst_stride, const int16_t *src, int src_stride, int width, int height)
void ff_put_signed_rect_clamped_mmx(uint8_t *dst, int dst_stride, const int16_t *src, int src_stride, int width, int height)
void(* dirac_hpel_filter)(uint8_t *dsth, uint8_t *dstv, uint8_t *dstc, const uint8_t *src, int stride, int width, int height)
Definition: diracdsp.h:30
void(* put_signed_rect_clamped)(uint8_t *dst, int dst_stride, const int16_t *src, int src_stride, int width, int height)
Definition: diracdsp.h:44