mqc.c
Go to the documentation of this file.
1 /*
2  * MQ-coder encoder and decoder common functions
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 /**
23  * MQ-coder ecoder and decoder common functions
24  * @file
25  * @author Kamil Nowosad
26  */
27 
28 #include "mqc.h"
29 
30 typedef struct {
31  uint16_t qe;
35 } MqcCxState;
36 
37 const static MqcCxState cx_states[47] = {
38  {0x5601, 1, 1, 1},
39  {0x3401, 2, 6, 0},
40  {0x1801, 3, 9, 0},
41  {0x0AC1, 4, 12, 0},
42  {0x0521, 5, 29, 0},
43  {0x0221, 38, 33, 0},
44  {0x5601, 7, 6, 1},
45  {0x5401, 8, 14, 0},
46  {0x4801, 9, 14, 0},
47  {0x3801, 10, 14, 0},
48  {0x3001, 11, 17, 0},
49  {0x2401, 12, 18, 0},
50  {0x1C01, 13, 20, 0},
51  {0x1601, 29, 21, 0},
52  {0x5601, 15, 14, 1},
53  {0x5401, 16, 14, 0},
54  {0x5101, 17, 15, 0},
55  {0x4801, 18, 16, 0},
56  {0x3801, 19, 17, 0},
57  {0x3401, 20, 18, 0},
58  {0x3001, 21, 19, 0},
59  {0x2801, 22, 19, 0},
60  {0x2401, 23, 20, 0},
61  {0x2201, 24, 21, 0},
62  {0x1C01, 25, 22, 0},
63  {0x1801, 26, 23, 0},
64  {0x1601, 27, 24, 0},
65  {0x1401, 28, 25, 0},
66  {0x1201, 29, 26, 0},
67  {0x1101, 30, 27, 0},
68  {0x0AC1, 31, 28, 0},
69  {0x09C1, 32, 29, 0},
70  {0x08A1, 33, 30, 0},
71  {0x0521, 34, 31, 0},
72  {0x0441, 35, 32, 0},
73  {0x02A1, 36, 33, 0},
74  {0x0221, 37, 34, 0},
75  {0x0141, 38, 35, 0},
76  {0x0111, 39, 36, 0},
77  {0x0085, 40, 37, 0},
78  {0x0049, 41, 38, 0},
79  {0x0025, 42, 39, 0},
80  {0x0015, 43, 40, 0},
81  {0x0009, 44, 41, 0},
82  {0x0005, 45, 42, 0},
83  {0x0001, 45, 43, 0},
84  {0x5601, 46, 46, 0}
85 };
86 
87 uint16_t ff_mqc_qe [2*47];
90 
92 {
93  int i;
94  memset(mqc->cx_states, 0, sizeof(mqc->cx_states));
95  mqc->cx_states[MQC_CX_UNI] = 2 * 46;
96  mqc->cx_states[MQC_CX_RL] = 2 * 3;
97  mqc->cx_states[0] = 2 * 4;
98 
99  for (i = 0; i < 47; i++){
100  ff_mqc_qe[2*i ] =
101  ff_mqc_qe[2*i+1] = cx_states[i].qe;
102 
103  ff_mqc_nlps[2*i ] = 2*cx_states[i].nlps + cx_states[i].sw;
104  ff_mqc_nlps[2*i+1] = 2*cx_states[i].nlps + 1 - cx_states[i].sw;
105  ff_mqc_nmps[2*i ] = 2*cx_states[i].nmps;
106  ff_mqc_nmps[2*i+1] = 2*cx_states[i].nmps + 1;
107  }
108 }
void ff_mqc_init_contexts(MqcState *mqc)
initialize the contexts
Definition: mqc.c:91
MQ-coder.
uint8_t
uint8_t nmps
Definition: mqc.c:32
uint8_t nlps
Definition: mqc.c:33
uint16_t ff_mqc_qe[2 *47]
Definition: mqc.c:87
static const MqcCxState cx_states[47]
Definition: mqc.c:37
uint8_t ff_mqc_nlps[2 *47]
Definition: mqc.c:88
#define MQC_CX_RL
Definition: mqc.h:34
uint8_t ff_mqc_nmps[2 *47]
Definition: mqc.c:89
Definition: mqc.c:30
synthesis window for stochastic i
#define MQC_CX_UNI
Definition: mqc.h:33
uint16_t qe
Definition: mqc.c:31
Definition: mqc.h:40
uint8_t cx_states[19]
Definition: mqc.h:45
uint8_t sw
Definition: mqc.c:34