• Main Page
  • Related Pages
  • Modules
  • Data Structures
  • Files
  • File List
  • Globals

libavcodec/x86/diracdsp_mmx.c

Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2010 David Conrad
00003  *
00004  * This file is part of FFmpeg.
00005  *
00006  * FFmpeg is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU Lesser General Public
00008  * License as published by the Free Software Foundation; either
00009  * version 2.1 of the License, or (at your option) any later version.
00010  *
00011  * FFmpeg is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014  * Lesser General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU Lesser General Public
00017  * License along with FFmpeg; if not, write to the Free Software
00018  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
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     /*MMXDISABLEDc->PFX ## _dirac_pixels_tab[0][IDX] = ff_ ## PFX ## _dirac_pixels8_ ## EXT;*/  \
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 }
Generated on Fri Feb 1 2013 14:34:46 for FFmpeg by doxygen 1.7.1