mqc.h
Go to the documentation of this file.
1 /*
2  * MQ-coder
3  * Copyright (c) 2007 Kamil Nowosad
4  *
5  * This file is part of FFmpeg.
6  *
7  * FFmpeg 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  * FFmpeg 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 FFmpeg; 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 "avcodec.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 {
42  unsigned int a;
43  unsigned int c;
44  unsigned int ct;
46 } MqcState;
47 
48 /* encoder */
49 
50 /** initialize the encoder */
51 void ff_mqc_initenc(MqcState *mqc, uint8_t *bp);
52 
53 /** code bit d with context cx */
54 void ff_mqc_encode(MqcState *mqc, uint8_t *cxstate, int d);
55 
56 /** number of encoded bytes */
57 int ff_mqc_length(MqcState *mqc);
58 
59 /** flush the encoder [returns number of bytes encoded] */
60 int ff_mqc_flush(MqcState *mqc);
61 
62 /* decoder */
63 
64 /** initialize the decoder */
65 void ff_mqc_initdec(MqcState *mqc, uint8_t *bp);
66 
67 /** returns decoded bit with context cx */
68 int ff_mqc_decode(MqcState *mqc, uint8_t *cxstate);
69 
70 /* common */
71 
72 /** initialize the contexts */
74 
75 #endif /* AVCODEC_MQC_H */
void ff_mqc_init_contexts(MqcState *mqc)
initialize the contexts
Definition: mqc.c:91
void ff_mqc_initenc(MqcState *mqc, uint8_t *bp)
initialize the encoder
Definition: mqcenc.c:68
set threshold d
uint8_t
void ff_mqc_initdec(MqcState *mqc, uint8_t *bp)
initialize the decoder
Definition: mqcdec.c:71
static const MqcCxState cx_states[47]
Definition: mqc.c:37
external API header
uint16_t ff_mqc_qe[2 *47]
Definition: mqc.c:87
unsigned int a
Definition: mqc.h:42
unsigned int ct
Definition: mqc.h:44
int ff_mqc_decode(MqcState *mqc, uint8_t *cxstate)
returns decoded bit with context cx
Definition: mqcdec.c:81
unsigned int c
Definition: mqc.h:43
uint8_t * bpstart
Definition: mqc.h:41
int ff_mqc_flush(MqcState *mqc)
flush the encoder [returns number of bytes encoded]
Definition: mqcenc.c:109
uint8_t ff_mqc_nlps[2 *47]
Definition: mqc.c:88
int ff_mqc_length(MqcState *mqc)
number of encoded bytes
Definition: mqcenc.c:104
Definition: mqc.h:40
uint8_t ff_mqc_nmps[2 *47]
Definition: mqc.c:89
void ff_mqc_encode(MqcState *mqc, uint8_t *cxstate, int d)
code bit d with context cx
Definition: mqcenc.c:78