LCOV - code coverage report
Current view: top level - libswresample/x86 - resample_init.c (source / functions) Hit Total Coverage
Test: coverage.info Lines: 19 37 51.4 %
Date: 2017-10-22 09:09:27 Functions: 1 1 100.0 %

          Line data    Source code
       1             : /*
       2             :  * audio resampling
       3             :  * Copyright (c) 2004-2012 Michael Niedermayer <michaelni@gmx.at>
       4             :  *
       5             :  * This file is part of FFmpeg.
       6             :  *
       7             :  * FFmpeg is free software; you can redistribute it and/or
       8             :  * modify it under the terms of the GNU Lesser General Public
       9             :  * License as published by the Free Software Foundation; either
      10             :  * version 2.1 of the License, or (at your option) any later version.
      11             :  *
      12             :  * FFmpeg is distributed in the hope that it will be useful,
      13             :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      14             :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
      15             :  * Lesser General Public License for more details.
      16             :  *
      17             :  * You should have received a copy of the GNU Lesser General Public
      18             :  * License along with FFmpeg; if not, write to the Free Software
      19             :  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
      20             :  */
      21             : 
      22             : /**
      23             :  * @file
      24             :  * audio resampling
      25             :  * @author Michael Niedermayer <michaelni@gmx.at>
      26             :  */
      27             : 
      28             : #include "libavutil/x86/cpu.h"
      29             : #include "libswresample/resample.h"
      30             : 
      31             : #define RESAMPLE_FUNCS(type, opt) \
      32             : int ff_resample_common_##type##_##opt(ResampleContext *c, void *dst, \
      33             :                                       const void *src, int sz, int upd); \
      34             : int ff_resample_linear_##type##_##opt(ResampleContext *c, void *dst, \
      35             :                                       const void *src, int sz, int upd)
      36             : 
      37             : RESAMPLE_FUNCS(int16,  mmxext);
      38             : RESAMPLE_FUNCS(int16,  sse2);
      39             : RESAMPLE_FUNCS(int16,  xop);
      40             : RESAMPLE_FUNCS(float,  sse);
      41             : RESAMPLE_FUNCS(float,  avx);
      42             : RESAMPLE_FUNCS(float,  fma3);
      43             : RESAMPLE_FUNCS(float,  fma4);
      44             : RESAMPLE_FUNCS(double, sse2);
      45             : RESAMPLE_FUNCS(double, avx);
      46             : RESAMPLE_FUNCS(double, fma3);
      47             : 
      48         667 : av_cold void swri_resample_dsp_x86_init(ResampleContext *c)
      49             : {
      50         667 :     int av_unused mm_flags = av_get_cpu_flags();
      51             : 
      52         667 :     switch(c->format){
      53         175 :     case AV_SAMPLE_FMT_S16P:
      54             :         if (ARCH_X86_32 && EXTERNAL_MMXEXT(mm_flags)) {
      55             :             c->dsp.resample_linear = ff_resample_linear_int16_mmxext;
      56             :             c->dsp.resample_common = ff_resample_common_int16_mmxext;
      57             :         }
      58         175 :         if (EXTERNAL_SSE2(mm_flags)) {
      59           0 :             c->dsp.resample_linear = ff_resample_linear_int16_sse2;
      60           0 :             c->dsp.resample_common = ff_resample_common_int16_sse2;
      61             :         }
      62         175 :         if (EXTERNAL_XOP(mm_flags)) {
      63           0 :             c->dsp.resample_linear = ff_resample_linear_int16_xop;
      64           0 :             c->dsp.resample_common = ff_resample_common_int16_xop;
      65             :         }
      66         175 :         break;
      67         192 :     case AV_SAMPLE_FMT_FLTP:
      68         192 :         if (EXTERNAL_SSE(mm_flags)) {
      69           0 :             c->dsp.resample_linear = ff_resample_linear_float_sse;
      70           0 :             c->dsp.resample_common = ff_resample_common_float_sse;
      71             :         }
      72         192 :         if (EXTERNAL_AVX_FAST(mm_flags)) {
      73           0 :             c->dsp.resample_linear = ff_resample_linear_float_avx;
      74           0 :             c->dsp.resample_common = ff_resample_common_float_avx;
      75             :         }
      76         192 :         if (EXTERNAL_FMA3_FAST(mm_flags)) {
      77           0 :             c->dsp.resample_linear = ff_resample_linear_float_fma3;
      78           0 :             c->dsp.resample_common = ff_resample_common_float_fma3;
      79             :         }
      80         192 :         if (EXTERNAL_FMA4(mm_flags)) {
      81           0 :             c->dsp.resample_linear = ff_resample_linear_float_fma4;
      82           0 :             c->dsp.resample_common = ff_resample_common_float_fma4;
      83             :         }
      84         192 :         break;
      85         156 :     case AV_SAMPLE_FMT_DBLP:
      86         156 :         if (EXTERNAL_SSE2(mm_flags)) {
      87           0 :             c->dsp.resample_linear = ff_resample_linear_double_sse2;
      88           0 :             c->dsp.resample_common = ff_resample_common_double_sse2;
      89             :         }
      90         156 :         if (EXTERNAL_AVX_FAST(mm_flags)) {
      91           0 :             c->dsp.resample_linear = ff_resample_linear_double_avx;
      92           0 :             c->dsp.resample_common = ff_resample_common_double_avx;
      93             :         }
      94         156 :         if (EXTERNAL_FMA3_FAST(mm_flags)) {
      95           0 :             c->dsp.resample_linear = ff_resample_linear_double_fma3;
      96           0 :             c->dsp.resample_common = ff_resample_common_double_fma3;
      97             :         }
      98         156 :         break;
      99             :     }
     100         667 : }

Generated by: LCOV version 1.13