LCOV - code coverage report
Current view: top level - C_DEFAULT - EbPictureOperators_C.c (source / functions) Hit Total Coverage
Test: coverage.info Lines: 0 38 0.0 %
Date: 2019-11-25 17:38:06 Functions: 0 4 0.0 %

          Line data    Source code
       1             : /*
       2             : * Copyright(c) 2019 Intel Corporation
       3             : * SPDX - License - Identifier: BSD - 2 - Clause - Patent
       4             : */
       5             : 
       6             : #include "EbPictureOperators_C.h"
       7             : #include "EbUtility.h"
       8             : 
       9             : /*********************************
      10             : * Picture Average
      11             : *********************************/
      12           0 : void picture_average_kernel_c(
      13             :     EbByte   src0,
      14             :     uint32_t   src0_stride,
      15             :     EbByte   src1,
      16             :     uint32_t   src1_stride,
      17             :     EbByte   dst,
      18             :     uint32_t   dst_stride,
      19             :     uint32_t   area_width,
      20             :     uint32_t   area_height)
      21             : {
      22             :     uint32_t x, y;
      23             : 
      24           0 :     for (y = 0; y < area_height; y++) {
      25           0 :         for (x = 0; x < area_width; x++) {
      26           0 :             dst[x] = (src0[x] + src1[x] + 1) >> 1;
      27             :         }
      28           0 :         src0 += src0_stride;
      29           0 :         src1 += src1_stride;
      30           0 :         dst += dst_stride;
      31             :     }
      32           0 : }
      33             : 
      34           0 : void picture_average_kernel1_line_c(
      35             :     EbByte   src0,
      36             :     EbByte   src1,
      37             :     EbByte   dst,
      38             :     uint32_t   areaWidth)
      39             : {
      40             :     uint32_t i;
      41           0 :     for (i = 0; i < areaWidth; i++)
      42           0 :         dst[i] = (src0[i] + src1[i] + 1) / 2;
      43           0 : }
      44             : 
      45             : /*********************************
      46             : * Picture Copy Kernel
      47             : *********************************/
      48           0 : void picture_copy_kernel(
      49             :     EbByte                  src,
      50             :     uint32_t                   src_stride,
      51             :     EbByte                  dst,
      52             :     uint32_t                   dst_stride,
      53             :     uint32_t                   area_width,
      54             :     uint32_t                   area_height,
      55             :     uint32_t                   bytes_per_sample)  //=1 always)
      56             : {
      57           0 :     uint32_t sampleCount = 0;
      58           0 :     const uint32_t sampleTotalCount = area_width * area_height;
      59           0 :     const uint32_t copyLength = area_width * bytes_per_sample;
      60             : 
      61           0 :     src_stride *= bytes_per_sample;
      62           0 :     dst_stride *= bytes_per_sample;
      63             : 
      64           0 :     while (sampleCount < sampleTotalCount) {
      65           0 :         EB_MEMCPY(dst, src, copyLength);
      66           0 :         src += src_stride;
      67           0 :         dst += dst_stride;
      68           0 :         sampleCount += area_width;
      69             :     }
      70             : 
      71           0 :     return;
      72             : }
      73             : 
      74             : // C equivalents
      75             : 
      76           0 : uint64_t spatial_full_distortion_kernel_c(
      77             :     uint8_t   *input,
      78             :     uint32_t   input_offset,
      79             :     uint32_t   input_stride,
      80             :     uint8_t   *recon,
      81             :     uint32_t   recon_offset,
      82             :     uint32_t   recon_stride,
      83             :     uint32_t   area_width,
      84             :     uint32_t   area_height)
      85             : {
      86             :     uint32_t  columnIndex;
      87           0 :     uint32_t  row_index = 0;
      88           0 :     uint64_t  spatialDistortion = 0;
      89           0 :     input += input_offset;
      90           0 :     recon += recon_offset;
      91             : 
      92           0 :     while (row_index < area_height) {
      93           0 :         columnIndex = 0;
      94           0 :         while (columnIndex < area_width) {
      95           0 :             spatialDistortion += (int64_t)SQR((int64_t)(input[columnIndex]) - (recon[columnIndex]));
      96           0 :             ++columnIndex;
      97             :         }
      98             : 
      99           0 :         input += input_stride;
     100           0 :         recon += recon_stride;
     101           0 :         ++row_index;
     102             :     }
     103           0 :     return spatialDistortion;
     104             : }

Generated by: LCOV version 1.14