2010-05-18 11:58:33 -04:00
|
|
|
/*
|
2010-09-09 08:16:39 -04:00
|
|
|
* Copyright (c) 2010 The WebM project authors. All Rights Reserved.
|
2010-05-18 11:58:33 -04:00
|
|
|
*
|
2010-06-18 12:39:21 -04:00
|
|
|
* Use of this source code is governed by a BSD-style license
|
2010-06-04 16:19:40 -04:00
|
|
|
* that can be found in the LICENSE file in the root of the source
|
|
|
|
* tree. An additional intellectual property rights grant can be found
|
2010-06-18 12:39:21 -04:00
|
|
|
* in the file PATENTS. All contributing project authors may
|
2010-06-04 16:19:40 -04:00
|
|
|
* be found in the AUTHORS file in the root of the source tree.
|
2010-05-18 11:58:33 -04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef tree_reader_h
|
|
|
|
#define tree_reader_h 1
|
|
|
|
|
2011-02-10 14:41:38 -05:00
|
|
|
#include "vp8/common/treecoder.h"
|
2010-05-18 11:58:33 -04:00
|
|
|
|
|
|
|
#include "dboolhuff.h"
|
|
|
|
|
2012-10-31 14:40:53 -07:00
|
|
|
typedef BOOL_DECODER vp9_reader;
|
2010-05-18 11:58:33 -04:00
|
|
|
|
2012-10-31 14:40:53 -07:00
|
|
|
#define vp9_read decode_bool
|
|
|
|
#define vp9_read_literal decode_value
|
|
|
|
#define vp9_read_bit(R) vp9_read(R, vp9_prob_half)
|
2010-05-18 11:58:33 -04:00
|
|
|
|
|
|
|
/* Intent of tree data structure is to make decoding trivial. */
|
|
|
|
|
2012-10-31 14:40:53 -07:00
|
|
|
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;
|
2010-05-18 11:58:33 -04:00
|
|
|
|
2012-10-31 14:40:53 -07:00
|
|
|
while ((i = t[ i + vp9_read(r, p[i >> 1])]) > 0);
|
2010-05-18 11:58:33 -04:00
|
|
|
|
2012-07-13 15:21:29 -07:00
|
|
|
return -i;
|
2010-05-18 11:58:33 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* tree_reader_h */
|