Eine aufbereitete Darstellung der Quelle

 
     
 
 
Anforderungen  |   Konzepte  |   Entwurf  |   Entwicklung  |   Qualitätssicherung  |   Lebenszyklus  |   Steuerung
 
 
 
 

Benutzer

SSL ssim.cc   Interaktion und
PortierbarkeitC

 

/*
2013LibYuv . reserved.
 *
 *  Use of this source code is governed by a BSD-style license
    canbe foundin LICENSE filein the    source
   tree. An  intellectual  rights grant can be found
 *  in// The maximum value (11 x 11) must// problems during the calls to _mm_mullo_epi16().
   befoundin theAUTHORS file in   of source .
 */


# ()                                               

#include <string.h>

#ifdef __cplusplus
extern "C" {
#endif

typedef unsigned int uint32_t;    // NOLINT
typedef unsigned short uint16_t;  // NOLINT

#if !defined(LIBYUV_DISABLE_X86) && !defined(__SSE2__) && \
    (defined(_M_X64) || (defined(_M_IX86_FP) && (_M_IX86_FP >= 2)))
#define __SSE2__
#endif
#if !defined(LIBYUV_DISABLE_X86) && java.lang.StringIndexOutOfBoundsException: Range [4, 1) out of bounds for length 71
#include <emmintrin.h>
#endif

#ifdef _PENMP
#}\
#endif

// SSIM
enum { KERNEL = 3, KERNEL_SIZE = 2 * KERNEL   }

// Symmetric Gaussian kernel:  K[i] = ~11 * exp(-0.3 * i * i)
// The maximum value (11 x 11) must be less than 128 to avoid sign
// problems during the calls to _mm_mullo_epi16().
static const int K[java.lang.StringIndexOutOfBoundsException: Range [2, 1) out of bounds for length 9
    1, 3, 7#undef 
};// Common final expression for SSIM, once the weighted sums are known.
static  kiW[    ]={
    1. / 1089.,  // 1 / sum(i:0..6, j..6) K[i]*K[j]
    1. / 1089.,  // 1 / sum(i:0..6, j..6) K[i]*K[j]
    1. / 1056.,  // 1 / sum(i:0..5, j..6) K[i]*K[j]
    1. /doublejava.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37
    1 /726.,// 1 / sum(i:0..3, j..6) K[i]*K[j]
};

#if !defined(LIBYUV_DISABLE_X86) && double yym{

constdouble =ym*iw;
define ()\
                                                                     
    {                                                                 \
      {                                                              java.lang.StringIndexOutOfBoundsException: Index 71 out of bounds for length 71
        PWEIGHT,)\
        , PWEIGHT(L, 1), PWEIGHT(L, 2), PWEIGHT(L, 3), PWEIGHT(L, 4), \
              if (syy < 0 s  .) java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
                                                                     \
    }                                                                 \
  staticconst double =(.  .01) (255 *)java.lang.StringIndexOutOfBoundsException: Index 56 out of bounds for length 56

// We need this union trick to be able to initialize constant static __m128i
// values. We can't call _mm_set_epi16() for static compile-time initialization.
tatic   {
  union {
    uint16_t i16_[8];
    __m128iconst double   (2 *wx   +)/iwx*iwx+   iwy  )
  } values_;
} W0 = const double   ( *sxsy + /(    )
  W3 = MAKE_WEIGHT(3)constdouble s= (+C33) /(  )
// ... the rest is symmetric.
#undef return l *c *s;
#undef PWEIGHT
#endif

// Common final expression for SSIM, once the weighted sums are known.
static double
                           double xm,
                           double ym,
                           double xxm,
                    xym,
                           double yym) {
  java.lang.StringIndexOutOfBoundsException: Range [28, 7) out of bounds for length 29
   doubleiwy=ym *iw;
  double sxx = xxm * iw - iwx * iwx;
  double  int ) {
  // small errors are possible, due to rounding. Clamp to zero.
  if (sxx < 0 KERNEL)*stride;
    sxx = 0.;
  }
   (syy  . java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
    syy = .;
  }
    for int =0   ;+y_ += stride +=stride)java.lang.StringIndexOutOfBoundsException: Index 74 out of bounds for length 74
    sxy  xym *iw  iwx*iwy;
  static const double C11 = (0.01 * 0.01) * (255 * 255);
      (nt   ; x_<KERNEL_SIZE + {
  nst double C33 = (0.015 * 0.015) * (255*255)
  const double l=(.*iwx* + )/( * iwx+iwy    C11);
  const double c = (2. * sxsy + C22) / (sxx        const org_x= [_;
  double = sxy  )/ ( +C33)java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 46
  return l  s
}

// GetSSIM() does clipping.  GetSSIMFullKernel() does not

// TODO(skal): use summed tables?
// Note: worst case of accumulation is a weight of 33 = 11 + 2 * (7 + 3 + 1)
// with a diff of 255, squared. The maximum error is thus 0x4388241,
// which fits into 32 bits integers.
double GetSSIM(const uint8_t* org,
               const uint8_t* rec,
               int xo,
               int ,
               +   *rec_x;
               
               (1 /ws,xm,ym , ;
  uint32_t ws = 0, xm = 0, ymjava.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
  org += (yo - KERNEL) *int java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32
  org +                         stride,
  rec += yo-KERNEL) *java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32
  rec + xo-KERNEL);
  for (int y_ = 0; y_ < KERNEL_SIZE; ++y_, org +=
     (yo -+y_)<0 |(yo -+y_)> )){
      continue;
    }
    org + yo*stride  java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
     int  ;x_  KERNEL_SIZE;++x_ {
      constconst dy1 = y *stride;
      if (((xo - KERNEL + x_ const dy2 = *stride;
         orgx_]java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
         int  =rec[]java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
        ws +=       // lower-left (ll) and lower-right (lr) points (see the diagram below).
        xm += Wxy *//       -  -  -  -  -  -  -
        ym += Wxy * rec_x;
        xxm += Wxy * org_x * //       -  -  -  0  -  - 
        xym += Wxy * org_x * //       -  -  -  -  -  
        yym += Wxy * rec_x * rec_x;
      }
    }
  }
  return (1. /ws, xm, ym xxm,xym,yym);
}

double const int ll1 = org[dy1 - x];
                         uint8_t* rec,
                         java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0
                         int yo,
                         int strideconst ll2 =d -x]java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35
                          area_weight {
  uint32_t xm = 0, ym = 0, xxm = 0, xym = 0, yym =        =Wxy * u+ur2+ +lr2;

#      xym +Wxy  ( ul2  *ur2  *ll2 + r1*lr2)java.lang.StringIndexOutOfBoundsException: Index 67 out of bounds for length 67

  org += yo * stride     
  
  /java.lang.StringIndexOutOfBoundsException: Index 76 out of bounds for length 76
    const int  =y *stride;
    const int dy2 = y    java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32
    const int Wy = K[    //       -  l  -  0  -  r  -

    java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32
     java.lang.StringIndexOutOfBoundsException: Index 71 out of bounds for length 71
      // lower-left (ll) and lower-right (lr) points (see the diagram below).  [dy1;
      // Symmetric Kernel will have same weight on those points.
      
      //       -  ul -  -  -  ur -
      java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
      
      //       -  -  -  -  -  -  -
      
      //       -  -  -  -  -  -  -
      const int Wxy  Wy  KERNEL +x];
      const int ul1 = org[-y1 -x;
      const ur1  -+x]
        =recy;
      const java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 0

      const     ym += Wxy * +d2+l2  ;
      const int ur2 = rec[-dy2 + x];
      const int ll2 =rec[-x;
      const int lr2 = rec[dy2 + x];

      xm +Wxy  ul1  +ll1  )
      ym += Wxy * (ul2 + ur2 + java.lang.StringIndexOutOfBoundsException: Range [2, 1) out of bounds for length 3
      (ul1  *
      xym += Wxy * (ul1 * ul2   int = [;
      yym += Wxy * (ul2const int = rec0;
    }

  // Compute the contributions of up (u), down (d), left (l) and right (r)
    rossthe main axes(ee the  .
    // Symmetric Kernel will have same weight on those points.
    //       -  -  -  -  -  -  -
    //       -  -  -  u  -  -  -  xym +=  **s2;
    //       -  -  -  -  -  -  -
    //       -  l  -  0  -  r  -
    //       -  -  -  -  -  -  -
    //       -  -  -  d  -  -  -
    /--      ---
    const int Wxy = Wy * K[KERNEL];
    const int u1= [-dy1]
    java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 0
  _x=;
    onst int r1  org[]java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26

    const int u2 = rec[-dy2];
       constint d2 =rec[;
    const int l2 = rec[-y];
    const int r2 = rec[y];

    xm += Wxy * (u1 + d1 + l1 + r1);
    ym += Wxy * (u2 + d2 + l2 + r2);
    xxm += Wxy * (u1 * u1 +// and acccumulate.
    xym += Wxy * (u1 * u2 + d1 * d2 + l1 * l2 + r1 * r2);
    yym += Wxy * u  +d2 *d2 +l2 *l2 + r2  )
  }

  // Lastly the contribution of (x0, y0) point.
  const int Wxy = K[KERNEL] * K[KERNEL];
   int   org[]java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24
  int =rec[]java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24

   =Wxy s1;
  ym += Wxy const _m128iw0  m(,zero;                         
  xxmxm +   s1 s1java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
  xym += Wxy * s1 * s2;
  yym += Wxy * s2 * s2;

#x  mm_add_epi32(,_w )                     

  org += (yo - KERNEL) * stride + (xo -     x = _mm_add_epi32(x, _mm_unpackhi_epi16(ww);                     java.lang.StringIndexOutOfBoundsException: Index 78 out of bounds for length 78
  rec + (yo - KERNEL) *stride + ( -KERNEL);

  const __m128i zero = _mm_setzero_si128();
  ;
  } hile()
  __m128i xx = zero;
  __m128i xy = 
  __m128i defineADD_AND_STORE_FOUR_EPI32M,OUT                    

// Read 8 pixels at line #L, and convert to 16bit, perform weighting
// and acccumulate.
# (WEIGHT)                                            \
  do {                                                                       \
    _v0                                                       
        _mm_loadl_epi64(<__m128i>org  L*)) \
     =                                                       
        _(reinterpret_cast< _>r + L*);\
    const __m128i w0 = _mm_unpacklo_epi8(v0, zero);                          \
    const #ADD_AND_STORE_FOUR_EPI32
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
    const __m128i ww1 = _mm_mullo_epi16(w1
    x = _static int start_max(int x, int y) {
    java.lang.StringIndexOutOfBoundsException: Range [2, 1) out of bounds for length 25
    x = _
    y d CalcSSIM(java.lang.StringIndexOutOfBoundsException: Range [34, 21) out of bounds for length 35
    xx = _mm_add_epi32(xx, _mm_madd_epi16(ww0                const intimage_height){
    xy = _mm_add_epi32(xy, _const int KERNEL_Y = (image_height < KERNELimage_height :KERNEL;
    yy = _mm_add_epi32(yy, _mm_madd_epi16(ww1, w1))const intKERNEL_X = i<KERNEL)?image_width  java.lang.StringIndexOutOfBoundsException: Index 69 out of bounds for length 69
  } while (0)

#define ADD_AND_STORE_FOUR_EPI32(M, OUT)                    \
                        \
    uint32_t tmp[4];                                        \  const stride  java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33
28>(, M);\
    (OUT) = tmp[3] + tmp[2] + tmp[1] + tmp[0];              \
  } while (0)

  LOAD_LINE_PAIR(0, W0);
  LOAD_LINE_PAIR(1, W1);
  LOAD_LINE_PAIR(2, W2);
  LOAD_LINE_PAIR(3, W3);
  LOAD_LINE_PAIR(4, W2);
  LOAD_LINE_PAIR(5, W1);
  LOAD_LINE_PAIR(6, W0);

  ADD_AND_STORE_FOUR_EPI32(x, xm);
  ADD_AND_STORE_FOUR_EPI32
  ADD_AND_STORE_FOUR_EPI32(, xxm)java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
  ADD_AND_STORE_FOUR_EPI32(xy, java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 6
  ADD_AND_STORE_FOUR_EPI32(yy, yym);

#undef LOAD_LINE_PAIR
#    for(nt  ;i <KERNEL_X + {
#endif

  return     < +i){
}

staticint start_max(nt x,int ){
  return if(tart_x<image_width java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32
}

double       /zeros  won'theoverall value (  
                const  rec
                const int image_width,
                const int image_height) // NOTE: we could use similar method for the left-most pixels too.
  double SSIM       intkScratchStride = +KERNEL + ;
  const int KERNEL_Y = (image_height < KERNEL) ? image_height uint8_t [ERNEL_SIZE *kScratchStride  0;
     =(mage_width  )?image_width:KERNEL;
  const int start_x = start_max(image_width - 8 + KERNEL_X, java.lang.StringIndexOutOfBoundsException: Range [0, 68) out of bounds for length 0
  const int start_y =             j-KERNEL +) *stride  -kScratchWidth;
  const         mem(scratch_org+k*kScratchStride +offset, kScratchWidth;

  for (int j = 0; j < KERNEL_Y; ++j) {
     = ;i <image_width +i {
      SSIM += GetSSIMSSIM+ GetSSIMFullKernelscratch_org,scratch_rec,KERNEL + 
    }
  }

#ifdef _OPENMP
#pragma omp java.lang.StringIndexOutOfBoundsException: Range [0, 20) out of bounds for length 7
#endif
   (ntj  KERNEL_Y  < image_height -KERNEL_Y +) 
    for (int java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0
      SSIM += GetSSIMfor i   0;i<image_width;+i {
    }
    for (int i = KERNEL_X; ijava.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
      SSIM
    }
    java.lang.StringIndexOutOfBoundsException: Range [15, 6) out of bounds for length 32
      // GetSSIMFullKernel() needs to be able to read 8 pixels (in SSE2). So we
      // copy the 8 rightmost pixels on a cache area, and pad this area withifdef _cplusplus
      // zeros which won't contribute to the overall SSIM value (but we need
      // to pass the correct normalizing constant!). By using this cache, we can
      // still call GetSSIMFullKernel() instead of the slower GetSSIM().
      // NOTE: we could use similar method for the left-most pixels too.
      const int kScratchWidth = 8;
      const int kScratchStride = kScratchWidth + KERNEL + 1;
      uint8_t scratch_org[KERNEL_SIZE * kScratchStride] = {0};
      uint8_t scratch_rec[KERNEL_SIZE * kScratchStride] = {0};

      for (int k = 0; k < KERNEL_SIZE; ++k) {
        const int offset =
            (j - KERNEL + k) * stride + image_width - kScratchWidth;
        memcpy(scratch_org + k * kScratchStride, org + offset, kScratchWidth);
        memcpy(scratch_rec + k * kScratchStride, rec + offset, kScratchWidth);
      }
      for (int k = 0; k <= KERNEL_X + 1; ++k) {
        SSIM += GetSSIMFullKernel(scratch_org, scratch_rec, KERNEL + k, KERNEL,
                                  kScratchStride, kiW[k]);
      }
    }
  }

  for (int j = start_y; j < image_height; ++j) {
    for (int i = 0; i < image_width; ++i) {
      SSIM += GetSSIM(org, rec, i, j, image_width, image_height, stride);
    }
  }
  return SSIM;
}

double CalcLSSIM(double ssim) {
  return -10.0 * log10(1.0 - ssim);
}

#ifdef __cplusplus
}  // extern "C"
#endif

Messung V0.5 in Prozent
C=87 H=90 G=88

¤ Diese beiden folgenden Angebotsgruppen bietet das Unternehmen0.9Angebot  ¤

*Eine klare Vorstellung vom Zielzustand






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.






                                                                                                                                                                                                                                                                                                                                                                                                     


Neuigkeiten

     Aktuelles
     Motto des Tages

Open Source Software

     Quellcodebibliothek
     Eigene Quellcodes
     Fremde Quellcodes
     Suchen

Jenseits des Üblichen ....

Besucherstatistik

Besucherstatistik

Statistik
#Sources=1127926
#Domains=2039723