vp9_treereader.h 1.05 KB
Newer Older
John Koleszar's avatar
John Koleszar committed
1
/*
2
 *  Copyright (c) 2010 The WebM project authors. All Rights Reserved.
John Koleszar's avatar
John Koleszar committed
3
 *
4
 *  Use of this source code is governed by a BSD-style license
5 6
 *  that can be found in the LICENSE file in the root of the source
 *  tree. An additional intellectual property rights grant can be found
7
 *  in the file PATENTS.  All contributing project authors may
8
 *  be found in the AUTHORS file in the root of the source tree.
John Koleszar's avatar
John Koleszar committed
9 10 11
 */


12 13
#ifndef VP9_DECODER_VP9_TREEREADER_H_
#define VP9_DECODER_VP9_TREEREADER_H_
John Koleszar's avatar
John Koleszar committed
14

15
#include "vp9/common/vp9_treecoder.h"
John Koleszar's avatar
John Koleszar committed
16

17
#include "vp9/decoder/vp9_dboolhuff.h"
John Koleszar's avatar
John Koleszar committed
18

19
typedef BOOL_DECODER vp9_reader;
John Koleszar's avatar
John Koleszar committed
20

21 22 23
#define vp9_read decode_bool
#define vp9_read_literal decode_value
#define vp9_read_bit(R) vp9_read(R, vp9_prob_half)
John Koleszar's avatar
John Koleszar committed
24 25 26

/* Intent of tree data structure is to make decoding trivial. */

27 28 29 30
static int treed_read(vp9_reader *const r, /* !!! must return a 0 or 1 !!! */
                      vp9_tree t,
                      const vp9_prob *const p) {
  register vp9_tree_index i = 0;
John Koleszar's avatar
John Koleszar committed
31

32
  while ((i = t[ i + vp9_read(r, p[i >> 1])]) > 0);
John Koleszar's avatar
John Koleszar committed
33

John Koleszar's avatar
John Koleszar committed
34
  return -i;
John Koleszar's avatar
John Koleszar committed
35 36 37
}

#endif /* tree_reader_h */