ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/freemol/trunk/src/mpeg_encode/src/mquant.c
Revision: 22
Committed: Mon Jul 7 22:16:37 2008 UTC (11 years, 1 month ago) by wdelano
File size: 1022 byte(s)
Log Message:
initial checkin of mpeg_encode source
Line User Rev File contents
1 wdelano 22 #include "mtypes.h"
2     #include "mproto.h"
3    
4     static int qtable[][8] = {
5     { 8,16,19,22,26,27,29,34},
6     {16,16,22,24,27,29,34,37},
7     {19,22,26,27,29,34,34,38},
8     {22,22,26,27,29,34,37,40},
9     {22,26,27,29,32,35,40,48},
10     {26,27,29,32,35,40,48,58},
11     {26,27,29,34,38,46,56,69},
12     {27,29,35,38,46,56,69,83} };
13    
14    
15     /*
16     *--------------------------------------------------------------
17     *
18     * mp_quant_block --
19     *
20     * Quantizes a block -- removing information
21     * It's safe for out == in.
22     *
23     * Results:
24     * None.
25     *
26     * Side effects:
27     * Modifies the out block.
28     *
29     *--------------------------------------------------------------
30     */
31     void mp_quant_block(Block in, Block out) {
32     int i;
33    
34     for(i=0;i<8;i++) {
35     out[i][0] = in[i][0] / qtable[i][0];
36     out[i][1] = in[i][1] / qtable[i][1];
37     out[i][2] = in[i][2] / qtable[i][2];
38     out[i][3] = in[i][3] / qtable[i][3];
39     out[i][4] = in[i][4] / qtable[i][4];
40     out[i][5] = in[i][5] / qtable[i][5];
41     out[i][6] = in[i][6] / qtable[i][6];
42     out[i][7] = in[i][7] / qtable[i][7];
43     }
44     }