Coverage Report

Created: 2026-05-16 06:41

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/work/aom/aom_dsp/bitwriter.c
Line
Count
Source
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
#include <string.h>
13
#include "aom_dsp/bitwriter.h"
14
15
842
void aom_start_encode(aom_writer *w, uint8_t *source) {
16
842
  w->buffer = source;
17
842
  w->pos = 0;
18
842
  od_ec_enc_init(&w->ec, 62025);
19
842
}
20
21
842
int aom_stop_encode(aom_writer *w) {
22
842
  int nb_bits;
23
842
  uint32_t bytes;
24
842
  unsigned char *data;
25
842
  data = od_ec_enc_done(&w->ec, &bytes);
26
842
  nb_bits = od_ec_enc_tell(&w->ec);
27
842
  memcpy(w->buffer, data, bytes);
28
842
  w->pos = bytes;
29
842
  od_ec_enc_clear(&w->ec);
30
842
  return nb_bits;
31
842
}
32
33
51.8k
int aom_tell_size(aom_writer *w) {
34
51.8k
  const int nb_bits = od_ec_enc_tell(&w->ec);
35
51.8k
  return nb_bits;
36
51.8k
}