LCOV - code coverage report
Current view: top level - Codec - convolve.h (source / functions) Hit Total Coverage
Test: coverage.info Lines: 15 17 88.2 %
Date: 2019-11-25 17:38:06 Functions: 2 2 100.0 %

          Line data    Source code
       1             : /*
       2             :  * Copyright (c) 2016, Alliance for Open Media. All rights reserved
       3             :  *
       4             :  * This source code is subject to the terms of the BSD 2 Clause License and
       5             :  * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
       6             :  * was not distributed with this source code in the LICENSE file, you can
       7             :  * obtain it at www.aomedia.org/license/software. If the Alliance for Open
       8             :  * Media Patent License 1.0 was not distributed with this source code in the
       9             :  * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
      10             :  */
      11             : 
      12             : #ifndef AV1_COMMON_AV1_CONVOLVE_H_
      13             : #define AV1_COMMON_AV1_CONVOLVE_H_
      14             : 
      15             : #ifdef __cplusplus
      16             : extern "C" {
      17             : #endif
      18             : 
      19             : #include "EbDefinitions.h"
      20             : #include "filter.h"
      21             : 
      22             : #define ROUND0_BITS 3
      23             : #define COMPOUND_ROUND1_BITS 7
      24             : #define WIENER_ROUND0_BITS 3
      25             : 
      26             : #define WIENER_CLAMP_LIMIT(r0, bd) (1 << ((bd) + 1 + FILTER_BITS - r0))
      27             : 
      28             :     typedef void(*aom_convolve_fn_t)(const uint8_t *src, int32_t src_stride,
      29             :         uint8_t *dst, int32_t dst_stride, int32_t w, int32_t h,
      30             :         InterpFilterParams *filter_params_x,
      31             :         InterpFilterParams *filter_params_y,
      32             :         const int32_t subpel_x_q4, const int32_t subpel_y_q4,
      33             :         ConvolveParams *conv_params);
      34             : 
      35             :     typedef void(*aom_highbd_convolve_fn_t)(
      36             :         const uint16_t *src, int32_t src_stride, uint16_t *dst, int32_t dst_stride, int32_t w,
      37             :         int32_t h, const InterpFilterParams *filter_params_x,
      38             :         const InterpFilterParams *filter_params_y, const int32_t subpel_x_q4,
      39             :         const int32_t subpel_y_q4, ConvolveParams *conv_params, int32_t bd);
      40             : 
      41             :     struct AV1Common;
      42             :     struct scale_factors;
      43             : 
      44   454267661 :     static INLINE ConvolveParams get_conv_params_no_round(int32_t ref, int32_t do_average,
      45             :         int32_t plane,
      46             :         ConvBufType *dst,
      47             :         int32_t dst_stride,
      48             :         int32_t is_compound, int32_t bd) {
      49             :         (void)plane;
      50             :         (void)ref;
      51             :         ConvolveParams conv_params;
      52             :         // conv_params.ref = ref;
      53   454267661 :         conv_params.do_average = do_average;
      54   454267661 :         assert(IMPLIES(do_average, is_compound));
      55   454267661 :         conv_params.is_compound = is_compound;
      56   454267661 :         conv_params.round_0 = ROUND0_BITS;
      57   454267661 :         conv_params.round_1 = is_compound ? COMPOUND_ROUND1_BITS
      58   454267661 :             : 2 * FILTER_BITS - conv_params.round_0;
      59   454267661 :         const int32_t intbufrange = bd + FILTER_BITS - conv_params.round_0 + 2;
      60             :         ASSERT(IMPLIES(bd < 12, intbufrange <= 16));
      61   454267661 :         if (intbufrange > 16) {
      62           0 :             conv_params.round_0 += intbufrange - 16;
      63           0 :             if (!is_compound) conv_params.round_1 -= intbufrange - 16;
      64             :         }
      65             :         // TODO(yunqing): The following dst should only be valid while
      66             :         // is_compound = 1;
      67   454267661 :         conv_params.dst = dst;
      68   454267661 :         conv_params.dst_stride = dst_stride;
      69             :         // conv_params.plane = plane;
      70   454267661 :         conv_params.use_jnt_comp_avg = 0;
      71             : 
      72   454267661 :         return conv_params;
      73             :     }
      74             : 
      75       91233 :     static INLINE ConvolveParams get_conv_params(int32_t ref, int32_t do_average, int32_t plane,
      76             :         int32_t bd) {
      77       91233 :         return get_conv_params_no_round(ref, do_average, plane, NULL, 0, 0, bd);
      78             :     }
      79             : 
      80             :     static INLINE ConvolveParams get_conv_params_wiener(int32_t bd) {
      81             :         ConvolveParams conv_params;
      82             :         (void)bd;
      83             :         conv_params.ref = 0;
      84             :         conv_params.do_average = 0;
      85             :         conv_params.is_compound = 0;
      86             :         conv_params.round_0 = WIENER_ROUND0_BITS;
      87             :         conv_params.round_1 = 2 * FILTER_BITS - conv_params.round_0;
      88             :         const int32_t intbufrange = bd + FILTER_BITS - conv_params.round_0 + 2;
      89             :         ASSERT(IMPLIES(bd < 12, intbufrange <= 16));
      90             :         if (intbufrange > 16) {
      91             :             conv_params.round_0 += intbufrange - 16;
      92             :             conv_params.round_1 -= intbufrange - 16;
      93             :         }
      94             :         conv_params.dst = NULL;
      95             :         conv_params.dst_stride = 0;
      96             :         conv_params.plane = 0;
      97             :         return conv_params;
      98             :     }
      99             : 
     100             :     void av1_highbd_convolve_2d_facade(const uint8_t *src8, int32_t src_stride,
     101             :         uint8_t *dst, int32_t dst_stride, int32_t w, int32_t h,
     102             :         InterpFilters interp_filters,
     103             :         const int32_t subpel_x_q4, int32_t x_step_q4,
     104             :         const int32_t subpel_y_q4, int32_t y_step_q4,
     105             :         int32_t scaled, ConvolveParams *conv_params,
     106             :         const struct scale_factors *sf, int32_t bd);
     107             : 
     108             : #ifdef __cplusplus
     109             : }  // extern "C"
     110             : #endif
     111             : 
     112             : #endif  // AV1_COMMON_AV1_CONVOLVE_H_

Generated by: LCOV version 1.14