LCOV - code coverage report
Current view: top level - third_party/aom/av1/encoder - cost.h (source / functions) Hit Total Coverage
Test: output.info Lines: 0 2 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 1 0.0 %
Legend: Lines: hit not hit

          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_ENCODER_COST_H_
      13             : #define AV1_ENCODER_COST_H_
      14             : 
      15             : #include "aom_dsp/prob.h"
      16             : #include "aom/aom_integer.h"
      17             : 
      18             : #ifdef __cplusplus
      19             : extern "C" {
      20             : #endif
      21             : 
      22             : extern const uint16_t av1_prob_cost[256];
      23             : 
      24             : // The factor to scale from cost in bits to cost in av1_prob_cost units.
      25             : #define AV1_PROB_COST_SHIFT 9
      26             : 
      27             : #define av1_cost_zero(prob) (av1_prob_cost[prob])
      28             : 
      29             : #define av1_cost_one(prob) av1_cost_zero(256 - (prob))
      30             : 
      31             : #define av1_cost_bit(prob, bit) av1_cost_zero((bit) ? 256 - (prob) : (prob))
      32             : 
      33             : // Cost of coding an n bit literal, using 128 (i.e. 50%) probability
      34             : // for each bit.
      35             : #define av1_cost_literal(n) ((n) * (1 << AV1_PROB_COST_SHIFT))
      36             : 
      37           0 : static INLINE unsigned int cost_branch256(const unsigned int ct[2],
      38             :                                           aom_prob p) {
      39           0 :   return ct[0] * av1_cost_zero(p) + ct[1] * av1_cost_one(p);
      40             : }
      41             : 
      42             : static INLINE int treed_cost(aom_tree tree, const aom_prob *probs, int bits,
      43             :                              int len) {
      44             :   int cost = 0;
      45             :   aom_tree_index i = 0;
      46             : 
      47             :   do {
      48             :     const int bit = (bits >> --len) & 1;
      49             :     cost += av1_cost_bit(probs[i >> 1], bit);
      50             :     i = tree[i + bit];
      51             :   } while (len);
      52             : 
      53             :   return cost;
      54             : }
      55             : 
      56             : void av1_cost_tokens(int *costs, const aom_prob *probs, aom_tree tree);
      57             : void av1_cost_tokens_skip(int *costs, const aom_prob *probs, aom_tree tree);
      58             : 
      59             : #ifdef __cplusplus
      60             : }  // extern "C"
      61             : #endif
      62             : 
      63             : #endif  // AV1_ENCODER_COST_H_

Generated by: LCOV version 1.13