vp9_treereader.h 948 Bytes
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"
16
#include "vp9/decoder/vp9_dboolhuff.h"
John Koleszar's avatar
John Koleszar committed
17

18
// Intent of tree data structure is to make decoding trivial.
19
20
21
22
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
23

Jim Bankoski's avatar
Jim Bankoski committed
24
25
  while ((i = t[ i + vp9_read(r, p[i >> 1])]) > 0)
    continue;
John Koleszar's avatar
John Koleszar committed
26

John Koleszar's avatar
John Koleszar committed
27
  return -i;
John Koleszar's avatar
John Koleszar committed
28
29
}

30
#endif  // VP9_DECODER_VP9_TREEREADER_H_