media/libvpx/vp8/decoder/treereader.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/media/libvpx/vp8/decoder/treereader.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,40 @@
     1.4 +/*
     1.5 + *  Copyright (c) 2010 The WebM project authors. All Rights Reserved.
     1.6 + *
     1.7 + *  Use of this source code is governed by a BSD-style license
     1.8 + *  that can be found in the LICENSE file in the root of the source
     1.9 + *  tree. An additional intellectual property rights grant can be found
    1.10 + *  in the file PATENTS.  All contributing project authors may
    1.11 + *  be found in the AUTHORS file in the root of the source tree.
    1.12 + */
    1.13 +
    1.14 +
    1.15 +#ifndef TREEREADER_H_
    1.16 +#define TREEREADER_H_
    1.17 +
    1.18 +#include "vp8/common/treecoder.h"
    1.19 +#include "dboolhuff.h"
    1.20 +
    1.21 +typedef BOOL_DECODER vp8_reader;
    1.22 +
    1.23 +#define vp8_read vp8dx_decode_bool
    1.24 +#define vp8_read_literal vp8_decode_value
    1.25 +#define vp8_read_bit(R) vp8_read(R, vp8_prob_half)
    1.26 +
    1.27 +
    1.28 +/* Intent of tree data structure is to make decoding trivial. */
    1.29 +
    1.30 +static int vp8_treed_read(
    1.31 +    vp8_reader *const r,        /* !!! must return a 0 or 1 !!! */
    1.32 +    vp8_tree t,
    1.33 +    const vp8_prob *const p
    1.34 +)
    1.35 +{
    1.36 +    register vp8_tree_index i = 0;
    1.37 +
    1.38 +    while ((i = t[ i + vp8_read(r, p[i>>1])]) > 0) ;
    1.39 +
    1.40 +    return -i;
    1.41 +}
    1.42 +
    1.43 +#endif  // TREEREADER_H_

mercurial