LCOV - code coverage report
Current view: top level - libavfilter/x86 - vf_blend_init.c (source / functions) Hit Total Coverage
Test: coverage.info Lines: 27 28 96.4 %
Date: 2017-10-18 21:45:51 Functions: 1 1 100.0 %

          Line data    Source code
       1             : /*
       2             :  * Copyright (c) 2015 Paul B Mahol
       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 "libavutil/attributes.h"
      22             : #include "libavutil/cpu.h"
      23             : #include "libavutil/x86/cpu.h"
      24             : #include "libavfilter/blend.h"
      25             : 
      26             : #define BLEND_FUNC(name, opt) \
      27             : void ff_blend_##name##_##opt(const uint8_t *top, ptrdiff_t top_linesize,       \
      28             :                              const uint8_t *bottom, ptrdiff_t bottom_linesize, \
      29             :                              uint8_t *dst, ptrdiff_t dst_linesize,             \
      30             :                              ptrdiff_t width, ptrdiff_t height,                \
      31             :                              struct FilterParams *param, double *values, int starty);
      32             : 
      33             : BLEND_FUNC(addition, sse2)
      34             : BLEND_FUNC(grainmerge, sse2)
      35             : BLEND_FUNC(average, sse2)
      36             : BLEND_FUNC(and, sse2)
      37             : BLEND_FUNC(darken, sse2)
      38             : BLEND_FUNC(grainextract, sse2)
      39             : BLEND_FUNC(multiply, sse2)
      40             : BLEND_FUNC(screen, sse2)
      41             : BLEND_FUNC(hardmix, sse2)
      42             : BLEND_FUNC(divide, sse2)
      43             : BLEND_FUNC(lighten, sse2)
      44             : BLEND_FUNC(or, sse2)
      45             : BLEND_FUNC(phoenix, sse2)
      46             : BLEND_FUNC(subtract, sse2)
      47             : BLEND_FUNC(xor, sse2)
      48             : BLEND_FUNC(difference, sse2)
      49             : BLEND_FUNC(difference, ssse3)
      50             : BLEND_FUNC(extremity, sse2)
      51             : BLEND_FUNC(extremity, ssse3)
      52             : BLEND_FUNC(negation, sse2)
      53             : BLEND_FUNC(negation, ssse3)
      54             : 
      55         225 : av_cold void ff_blend_init_x86(FilterParams *param, int is_16bit)
      56             : {
      57         225 :     int cpu_flags = av_get_cpu_flags();
      58             : 
      59         225 :     if (EXTERNAL_SSE2(cpu_flags) && param->opacity == 1 && !is_16bit) {
      60         153 :         switch (param->mode) {
      61           9 :         case BLEND_ADDITION: param->blend = ff_blend_addition_sse2; break;
      62           9 :         case BLEND_GRAINMERGE: param->blend = ff_blend_grainmerge_sse2; break;
      63           9 :         case BLEND_AND:      param->blend = ff_blend_and_sse2;      break;
      64           9 :         case BLEND_AVERAGE:  param->blend = ff_blend_average_sse2;  break;
      65           9 :         case BLEND_DARKEN:   param->blend = ff_blend_darken_sse2;   break;
      66           9 :         case BLEND_GRAINEXTRACT: param->blend = ff_blend_grainextract_sse2; break;
      67           0 :         case BLEND_DIVIDE:   param->blend = ff_blend_divide_sse2;   break;
      68           9 :         case BLEND_HARDMIX:  param->blend = ff_blend_hardmix_sse2;  break;
      69           9 :         case BLEND_LIGHTEN:  param->blend = ff_blend_lighten_sse2;  break;
      70           9 :         case BLEND_MULTIPLY: param->blend = ff_blend_multiply_sse2; break;
      71           9 :         case BLEND_OR:       param->blend = ff_blend_or_sse2;       break;
      72           9 :         case BLEND_PHOENIX:  param->blend = ff_blend_phoenix_sse2;  break;
      73           9 :         case BLEND_SCREEN:   param->blend = ff_blend_screen_sse2;   break;
      74           9 :         case BLEND_SUBTRACT: param->blend = ff_blend_subtract_sse2; break;
      75           9 :         case BLEND_XOR:      param->blend = ff_blend_xor_sse2;      break;
      76           9 :         case BLEND_DIFFERENCE: param->blend = ff_blend_difference_sse2; break;
      77           9 :         case BLEND_EXTREMITY:  param->blend = ff_blend_extremity_sse2;  break;
      78           9 :         case BLEND_NEGATION:   param->blend = ff_blend_negation_sse2;   break;
      79             :         }
      80             :     }
      81         225 :     if (EXTERNAL_SSSE3(cpu_flags) && param->opacity == 1 && !is_16bit) {
      82         119 :         switch (param->mode) {
      83           7 :         case BLEND_DIFFERENCE: param->blend = ff_blend_difference_ssse3; break;
      84           7 :         case BLEND_EXTREMITY:  param->blend = ff_blend_extremity_ssse3;  break;
      85           7 :         case BLEND_NEGATION:   param->blend = ff_blend_negation_ssse3;   break;
      86             :         }
      87             :     }
      88         225 : }

Generated by: LCOV version 1.13