]> git.sesse.net Git - ffmpeg/blob - libavcodec/mqc.h
xsubdec: Convert to the new bitstream reader
[ffmpeg] / libavcodec / mqc.h
1 /*
2  * MQ-coder: structures, common and decoder functions
3  * Copyright (c) 2007 Kamil Nowosad
4  *
5  * This file is part of Libav.
6  *
7  * Libav is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * Libav 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  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with Libav; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20  */
21
22 #ifndef AVCODEC_MQC_H
23 #define AVCODEC_MQC_H
24
25 /**
26  * MQ-coder
27  * @file
28  * @author Kamil Nowosad
29  */
30
31 #include <stdint.h>
32
33 #define MQC_CX_UNI 17
34 #define MQC_CX_RL  18
35
36 extern uint16_t ff_mqc_qe[2 * 47];
37 extern uint8_t  ff_mqc_nlps[2 * 47];
38 extern uint8_t  ff_mqc_nmps[2 * 47];
39
40 typedef struct MqcState {
41     uint8_t *bp, *bpstart;
42     unsigned int a;
43     unsigned int c;
44     unsigned int ct;
45     uint8_t cx_states[19];
46 } MqcState;
47
48 /* decoder */
49
50 /**
51  * Initialize MQ-decoder.
52  * @param mqc   MQ decoder state
53  * @param bp    byte pointer
54  */
55 void ff_mqc_initdec(MqcState *mqc, uint8_t *bp);
56
57 /**
58  * MQ decoder.
59  * @param mqc       MQ decoder state
60  * @param cxstate   Context
61  * @return          Decision (0 to 1)
62  */
63 int ff_mqc_decode(MqcState *mqc, uint8_t *cxstate);
64
65 /* common */
66
67 /**
68  * MQ-coder Initialize context tables (QE, NLPS, NMPS)
69  */
70 void ff_mqc_init_context_tables(void);
71
72 /**
73  * MQ-coder context initialisations.
74  * @param mqc       MQ-coder context
75  */
76 void ff_mqc_init_contexts(MqcState *mqc);
77
78 #endif /* AVCODEC_MQC_H */