LCOV - code coverage report
Current view: top level - libavfilter/x86 - vf_idet_init.c (source / functions) Hit Total Coverage
Test: coverage.info Lines: 4 7 57.1 %
Date: 2017-10-24 00:14:43 Functions: 1 3 33.3 %

          Line data    Source code
       1             : /*
       2             :  * This file is part of FFmpeg.
       3             :  *
       4             :  * FFmpeg is free software; you can redistribute it and/or
       5             :  * modify it under the terms of the GNU Lesser General Public
       6             :  * License as published by the Free Software Foundation; either
       7             :  * version 2.1 of the License, or (at your option) any later version.
       8             :  *
       9             :  * FFmpeg is distributed in the hope that it will be useful,
      10             :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      11             :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
      12             :  * Lesser General Public License for more details.
      13             :  *
      14             :  * You should have received a copy of the GNU Lesser General Public
      15             :  * License along with FFmpeg; if not, write to the Free Software
      16             :  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
      17             :  */
      18             : 
      19             : #include "libavutil/attributes.h"
      20             : #include "libavutil/cpu.h"
      21             : #include "libavutil/mem.h"
      22             : #include "libavutil/x86/asm.h"
      23             : #include "libavutil/x86/cpu.h"
      24             : #include "libavfilter/vf_idet.h"
      25             : 
      26             : #if HAVE_X86ASM
      27             : 
      28             : /* declares main callable idet_filter_line_{mmx,mmxext,sse2}() */
      29             : #define FUNC_MAIN_DECL(KIND, SPAN)                                        \
      30             : int ff_idet_filter_line_##KIND(const uint8_t *a, const uint8_t *b,        \
      31             :                                const uint8_t *c, int w);                  \
      32             : static int idet_filter_line_##KIND(const uint8_t *a, const uint8_t *b,    \
      33             :                                    const uint8_t *c, int w) {             \
      34             :     int sum = 0;                                                          \
      35             :     const int left_over = w & (SPAN - 1);                                 \
      36             :     w -= left_over;                                                       \
      37             :     if (w > 0)                                                            \
      38             :         sum += ff_idet_filter_line_##KIND(a, b, c, w);                    \
      39             :     if (left_over > 0)                                                    \
      40             :         sum += ff_idet_filter_line_c(a + w, b + w, c + w, left_over);     \
      41             :     return sum;                                                           \
      42             : }
      43             : 
      44             : 
      45             : #define FUNC_MAIN_DECL_16bit(KIND, SPAN)                                       \
      46             : int ff_idet_filter_line_16bit_##KIND(const uint16_t *a, const uint16_t *b,     \
      47             :                                      const uint16_t *c, int w);                \
      48             : static int idet_filter_line_16bit_##KIND(const uint16_t *a, const uint16_t *b, \
      49             :                                          const uint16_t *c, int w) {           \
      50             :     int sum = 0;                                                               \
      51             :     const int left_over = w & (SPAN - 1);                                      \
      52             :     w -= left_over;                                                            \
      53             :     if (w > 0)                                                                 \
      54             :         sum += ff_idet_filter_line_16bit_##KIND(a, b, c, w);                   \
      55             :     if (left_over > 0)                                                         \
      56             :         sum += ff_idet_filter_line_c_16bit(a + w, b + w, c + w, left_over);    \
      57             :     return sum;                                                                \
      58             : }
      59             : 
      60           0 : FUNC_MAIN_DECL(sse2, 16)
      61           0 : FUNC_MAIN_DECL_16bit(sse2, 8)
      62             : #if ARCH_X86_32
      63             : FUNC_MAIN_DECL(mmx, 8)
      64             : FUNC_MAIN_DECL(mmxext, 8)
      65             : FUNC_MAIN_DECL_16bit(mmx, 4)
      66             : #endif
      67             : 
      68             : #endif
      69           1 : av_cold void ff_idet_init_x86(IDETContext *idet, int for_16b)
      70             : {
      71             : #if HAVE_X86ASM
      72           1 :     const int cpu_flags = av_get_cpu_flags();
      73             : 
      74             : #if ARCH_X86_32
      75             :     if (EXTERNAL_MMX(cpu_flags)) {
      76             :         idet->filter_line = for_16b ? (ff_idet_filter_func)idet_filter_line_16bit_mmx : idet_filter_line_mmx;
      77             :     }
      78             :     if (EXTERNAL_MMXEXT(cpu_flags)) {
      79             :         idet->filter_line = for_16b ? (ff_idet_filter_func)idet_filter_line_16bit_mmx : idet_filter_line_mmxext;
      80             :     }
      81             : #endif // ARCH_x86_32
      82             : 
      83           1 :     if (EXTERNAL_SSE2(cpu_flags)) {
      84           0 :         idet->filter_line = for_16b ? (ff_idet_filter_func)idet_filter_line_16bit_sse2 : idet_filter_line_sse2;
      85             :     }
      86             : #endif // HAVE_X86ASM
      87           1 : }

Generated by: LCOV version 1.13