forked from rockcarry/ffjpeg
-
Notifications
You must be signed in to change notification settings - Fork 0
/
quant.c
executable file
·46 lines (34 loc) · 983 Bytes
/
quant.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/* 包含头文件 */
#include "quant.h"
/* 全局变量定义 */
const int STD_QUANT_TAB_LUMIN[64] =
{
16, 11, 10, 16, 24, 40, 51, 61,
12, 12, 14, 19, 26, 58, 60, 55,
14, 13, 16, 24, 40, 57, 69, 56,
14, 17, 22, 29, 51, 87, 80, 62,
18, 22, 37, 56, 68, 109,103,77,
24, 35, 55, 64, 81, 104,113,92,
49, 64, 78, 87, 103,121,120,101,
72, 92, 95, 98, 112,100,103,99,
};
const int STD_QUANT_TAB_CHROM[64] =
{
17, 18, 24, 47, 99, 99, 99, 99,
18, 21, 26, 66, 99, 99, 99, 99,
24, 26, 56, 99, 99, 99, 99, 99,
47, 66, 99, 99, 99, 99, 99, 99,
99, 99, 99, 99, 99, 99, 99, 99,
99, 99, 99, 99, 99, 99, 99, 99,
99, 99, 99, 99, 99, 99, 99, 99,
99, 99, 99, 99, 99, 99, 99, 99,
};
/* 函数实现 */
void quant_encode(int du[64], int qtab[64])
{
int i; for (i=0; i<64; i++) du[i] /= qtab[i];
}
void quant_decode(int du[64], int qtab[64])
{
int i; for (i=0; i<64; i++) du[i] *= qtab[i];
}