00001 /* 00002 * RV30/40 MMX/SSE2 optimizations 00003 * Copyright (C) 2012 Christophe Gisquet <christophe.gisquet@gmail.com> 00004 * 00005 * This file is part of Libav. 00006 * 00007 * Libav is free software; you can redistribute it and/or 00008 * modify it under the terms of the GNU Lesser General Public 00009 * License as published by the Free Software Foundation; either 00010 * version 2.1 of the License, or (at your option) any later version. 00011 * 00012 * Libav is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00015 * Lesser General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU Lesser General Public 00018 * License along with Libav; if not, write to the Free Software 00019 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 00020 */ 00021 00022 #include "libavutil/cpu.h" 00023 #include "libavutil/x86_cpu.h" 00024 #include "libavcodec/dsputil.h" 00025 #include "libavcodec/rv34dsp.h" 00026 00027 void ff_rv34_idct_dc_mmx2(DCTELEM *block); 00028 void ff_rv34_idct_dc_noround_mmx2(DCTELEM *block); 00029 void ff_rv34_idct_dc_add_mmx(uint8_t *dst, ptrdiff_t stride, int dc); 00030 void ff_rv34_idct_dc_add_sse4(uint8_t *dst, ptrdiff_t stride, int dc); 00031 void ff_rv34_idct_add_mmx2(uint8_t *dst, ptrdiff_t stride, DCTELEM *block); 00032 00033 av_cold void ff_rv34dsp_init_x86(RV34DSPContext* c, DSPContext *dsp) 00034 { 00035 #if HAVE_YASM 00036 int mm_flags = av_get_cpu_flags(); 00037 00038 if (mm_flags & AV_CPU_FLAG_MMX) 00039 c->rv34_idct_dc_add = ff_rv34_idct_dc_add_mmx; 00040 if (mm_flags & AV_CPU_FLAG_MMX2) { 00041 c->rv34_inv_transform_dc = ff_rv34_idct_dc_noround_mmx2; 00042 c->rv34_idct_add = ff_rv34_idct_add_mmx2; 00043 } 00044 if (mm_flags & AV_CPU_FLAG_SSE4) 00045 c->rv34_idct_dc_add = ff_rv34_idct_dc_add_sse4; 00046 #endif 00047 }