Coverage Report

Created: 2026-10-28 06:18

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/work/vvenc/source/Lib/EncoderLib/BvSearchOps.cpp
Line
Count
Source
1
/* -----------------------------------------------------------------------------
2
The copyright in this software is being made available under the Clear BSD
3
License, included below. No patent rights, trademark rights and/or
4
other Intellectual Property Rights other than the copyrights concerning
5
the Software are granted under this license.
6
7
The Clear BSD License
8
9
Copyright (c) 2019-2026, Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V. & The VVenC Authors.
10
All rights reserved.
11
12
Redistribution and use in source and binary forms, with or without modification,
13
are permitted (subject to the limitations in the disclaimer below) provided that
14
the following conditions are met:
15
16
     * Redistributions of source code must retain the above copyright notice,
17
     this list of conditions and the following disclaimer.
18
19
     * Redistributions in binary form must reproduce the above copyright
20
     notice, this list of conditions and the following disclaimer in the
21
     documentation and/or other materials provided with the distribution.
22
23
     * Neither the name of the copyright holder nor the names of its
24
     contributors may be used to endorse or promote products derived from
25
     this software without specific prior written permission.
26
27
NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED UNDER
28
THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
29
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
30
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
31
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
32
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
33
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
34
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
35
BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
36
IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
37
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
38
POSSIBILITY OF SUCH DAMAGE.
39
40
41
------------------------------------------------------------------------------------------- */
42
43
/** \file     BvSearchOps.cpp
44
    \brief    SIMD optimized helpers of the IBC block vector search
45
 */
46
47
#include "BvSearchOps.h"
48
49
#include <algorithm>
50
51
//! \ingroup EncoderLib
52
//! \{
53
54
namespace vvenc {
55
56
static bool containsMvCore( const Mv* list, const unsigned n, const Mv& mv )
57
1.01M
{
58
1.01M
  return std::find( list, list + n, mv ) != list + n;
59
1.01M
}
60
61
static Distortion sumAbsDiffShiftedCore( const Pel* org, const ptrdiff_t orgStride, const Pel* cur, const ptrdiff_t curStride, const int width, const int height, const int shift )
62
0
{
63
0
  Distortion sum = 0;
64
0
  for( int y = 0; y < height; y++, org += orgStride, cur += curStride )
65
0
  {
66
0
    for( int x = 0; x < width; x++ )
67
0
    {
68
0
      sum += abs( cur[x] - org[x] ) >> shift;
69
0
    }
70
0
  }
71
0
  return sum;
72
0
}
73
74
BvSearchOps::BvSearchOps( bool enableOpt )
75
5.97k
{
76
5.97k
  containsMv        = containsMvCore;
77
5.97k
  sumAbsDiffShifted = sumAbsDiffShiftedCore;
78
#if defined( TARGET_SIMD_X86 ) && ENABLE_SIMD_OPT
79
  if( enableOpt )
80
  {
81
    initBvSearchOpsX86();
82
  }
83
#endif
84
5.97k
}
85
86
} // namespace vvenc
87
88
//! \}