LCOV - code coverage report
Current view: top level - third_party/aom/aom_dsp - daalaboolwriter.h (source / functions) Hit Total Coverage
Test: output.info Lines: 0 7 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 2 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 AOM_DSP_DAALABOOLWRITER_H_
      13             : #define AOM_DSP_DAALABOOLWRITER_H_
      14             : 
      15             : #include <stdio.h>
      16             : 
      17             : #include "aom_dsp/entenc.h"
      18             : #include "aom_dsp/prob.h"
      19             : #if CONFIG_BITSTREAM_DEBUG
      20             : #include "aom_util/debug_util.h"
      21             : #endif  // CONFIG_BITSTREAM_DEBUG
      22             : 
      23             : #ifdef __cplusplus
      24             : extern "C" {
      25             : #endif
      26             : 
      27             : struct daala_writer {
      28             :   unsigned int pos;
      29             :   uint8_t *buffer;
      30             :   od_ec_enc ec;
      31             : };
      32             : 
      33             : typedef struct daala_writer daala_writer;
      34             : 
      35             : void aom_daala_start_encode(daala_writer *w, uint8_t *buffer);
      36             : void aom_daala_stop_encode(daala_writer *w);
      37             : 
      38           0 : static INLINE void aom_daala_write(daala_writer *w, int bit, int prob) {
      39             : #if CONFIG_EC_SMALLMUL
      40           0 :   int p = (0x7FFFFF - (prob << 15) + prob) >> 8;
      41             : #else
      42             :   int p = ((prob << 15) + 256 - prob) >> 8;
      43             : #endif
      44             : #if CONFIG_BITSTREAM_DEBUG
      45             :   aom_cdf_prob cdf[2] = { (aom_cdf_prob)p, 32767 };
      46             :   /*int queue_r = 0;
      47             :   int frame_idx_r = 0;
      48             :   int queue_w = bitstream_queue_get_write();
      49             :   int frame_idx_w = bitstream_queue_get_frame_write();
      50             :   if (frame_idx_w == frame_idx_r && queue_w == queue_r) {
      51             :     fprintf(stderr, "\n *** bitstream queue at frame_idx_w %d queue_w %d\n",
      52             :     frame_idx_w, queue_w);
      53             :   }*/
      54             :   bitstream_queue_push(bit, cdf, 2);
      55             : #endif
      56             : 
      57           0 :   od_ec_encode_bool_q15(&w->ec, bit, p);
      58           0 : }
      59             : 
      60             : #if CONFIG_RAWBITS
      61             : static INLINE void aom_daala_write_bit(daala_writer *w, int bit) {
      62             :   od_ec_enc_bits(&w->ec, bit, 1);
      63             : }
      64             : #endif
      65             : 
      66           0 : static INLINE void daala_write_symbol(daala_writer *w, int symb,
      67             :                                       const aom_cdf_prob *cdf, int nsymbs) {
      68             : #if CONFIG_BITSTREAM_DEBUG
      69             :   /*int queue_r = 0;
      70             :   int frame_idx_r = 0;
      71             :   int queue_w = bitstream_queue_get_write();
      72             :   int frame_idx_w = bitstream_queue_get_frame_write();
      73             :   if (frame_idx_w == frame_idx_r && queue_w == queue_r) {
      74             :     fprintf(stderr, "\n *** bitstream queue at frame_idx_w %d queue_w %d\n",
      75             :     frame_idx_w, queue_w);
      76             :   }*/
      77             :   bitstream_queue_push(symb, cdf, nsymbs);
      78             : #endif
      79             : 
      80           0 :   od_ec_encode_cdf_q15(&w->ec, symb, cdf, nsymbs);
      81           0 : }
      82             : 
      83             : #ifdef __cplusplus
      84             : }  // extern "C"
      85             : #endif
      86             : 
      87             : #endif

Generated by: LCOV version 1.13