1 /*
2  * gstvp8rangedecoder.h - VP8 range decoder interface
3  *
4  * Copyright (C) 2014 Intel Corporation
5  *   Author: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Library General Public
9  * License as published by the Free Software Foundation; either
10  * version 2 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * Library General Public License for more details.
16  *
17  * You should have received a copy of the GNU Library General Public
18  * License along with this library; if not, write to the
19  * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
20  * Boston, MA 02110-1301, USA.
21  */
22 
23 #ifndef GST_VP8_RANGE_DECODER_H
24 #define GST_VP8_RANGE_DECODER_H
25 
26 #include <glib.h>
27 #include <gst/gstconfig.h>
28 #include <gst/codecparsers/codecparsers-prelude.h>
29 
30 typedef struct _GstVp8RangeDecoder      GstVp8RangeDecoder;
31 typedef struct _GstVp8RangeDecoderState GstVp8RangeDecoderState;
32 
33 /**
34 * GstVp8RangeDecoder:
35 * @buf: the original bitstream buffer start
36 * @buf_size: the original bitstream buffer size
37 *
38 * Range decoder.
39 */
40 struct _GstVp8RangeDecoder {
41   const guchar *buf;
42   guint buf_size;
43 
44   /*< private >*/
45   gpointer _gst_reserved[GST_PADDING_LARGE];
46 };
47 
48 /**
49 * GstVp8RangeDecoderState:
50 * @range: current "Range" value
51 * @value: current "Value" value
52 * @count: number of bits left in "Value" for decoding
53 *
54 * Range decoder state.
55 */
56 struct _GstVp8RangeDecoderState {
57   guint8 range;
58   guint8 value;
59   guint8 count;
60 };
61 
62 GST_CODEC_PARSERS_API
63 gboolean  gst_vp8_range_decoder_init (GstVp8RangeDecoder * rd,
64                                       const guchar * buf,
65                                       guint buf_size);
66 
67 GST_CODEC_PARSERS_API
68 gint       gst_vp8_range_decoder_read (GstVp8RangeDecoder * rd, guint8 prob);
69 
70 GST_CODEC_PARSERS_API
71 gint       gst_vp8_range_decoder_read_literal (GstVp8RangeDecoder * rd, gint bits);
72 
73 GST_CODEC_PARSERS_API
74 guint      gst_vp8_range_decoder_get_pos (GstVp8RangeDecoder * rd);
75 
76 GST_CODEC_PARSERS_API
77 void       gst_vp8_range_decoder_get_state (GstVp8RangeDecoder      * rd,
78                                             GstVp8RangeDecoderState * state);
79 
80 #endif /* GST_VP8_RANGE_DECODER_H */
81