[cvs] / xvidcore / src / quant / quant_matrix.c Repository:
ViewVC logotype

Diff of /xvidcore/src/quant/quant_matrix.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.13, Sat Feb 15 15:22:19 2003 UTC revision 1.13.2.2, Tue Oct 7 13:02:35 2003 UTC
# Line 1  Line 1 
1    /*****************************************************************************
2     *
3     *  XVID MPEG-4 VIDEO CODEC
4     *  - Quantization matrix management code  -
5     *
6     *  Copyright(C) 2002 Michael Militzer <isibaar@xvid.org>
7     *               2002 Peter Ross <pross@xvid.org>
8     *
9     *  This program is free software ; you can redistribute it and/or modify
10     *  it under the terms of the GNU General Public License as published by
11     *  the Free Software Foundation ; either version 2 of the License, or
12     *  (at your option) any later version.
13     *
14     *  This program is distributed in the hope that it will be useful,
15     *  but WITHOUT ANY WARRANTY ; without even the implied warranty of
16     *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17     *  GNU General Public License for more details.
18     *
19     *  You should have received a copy of the GNU General Public License
20     *  along with this program ; if not, write to the Free Software
21     *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
22     *
23     * $Id$
24     *
25     ****************************************************************************/
26    
27  #include "quant_matrix.h"  #include "quant_matrix.h"
28    
29  #define FIX(X)   (((X)==1) ? 0xFFFF : ((1UL << 16) / (X) + 1))  #define FIX(X)   (((X)==1) ? 0xFFFF : ((1UL << 16) / (X) + 1))
30  #define FIXL(X)    ((1UL << 16) / (X) - 1)  #define FIXL(X)    ((1UL << 16) / (X) - 1)
31    
32  uint8_t custom_intra_matrix = 0;  static uint8_t custom_intra_matrix = 0;
33  uint8_t custom_inter_matrix = 0;  static uint8_t custom_inter_matrix = 0;
34    
35    /*****************************************************************************
36     * Default matrices
37     ****************************************************************************/
38    
39  uint8_t default_intra_matrix[64] = {  static const uint8_t default_intra_matrix[64] = {
40          8, 17, 18, 19, 21, 23, 25, 27,          8, 17, 18, 19, 21, 23, 25, 27,
41          17, 18, 19, 21, 23, 25, 27, 28,          17, 18, 19, 21, 23, 25, 27, 28,
42          20, 21, 22, 23, 24, 26, 28, 30,          20, 21, 22, 23, 24, 26, 28, 30,
# Line 17  Line 47 
47          27, 28, 30, 32, 35, 38, 41, 45          27, 28, 30, 32, 35, 38, 41, 45
48  };  };
49    
50    static const uint8_t default_inter_matrix[64] = {
51            16, 17, 18, 19, 20, 21, 22, 23,
52            17, 18, 19, 20, 21, 22, 23, 24,
53            18, 19, 20, 21, 22, 23, 24, 25,
54            19, 20, 21, 22, 23, 24, 26, 27,
55            20, 21, 22, 23, 25, 26, 27, 28,
56            21, 22, 23, 24, 26, 27, 28, 30,
57            22, 23, 24, 26, 27, 28, 30, 31,
58            23, 24, 25, 27, 28, 30, 31, 33
59    };
60    
61  int16_t intra_matrix[64] = {  int16_t intra_matrix[64] = {
62          8, 17, 18, 19, 21, 23, 25, 27,          8, 17, 18, 19, 21, 23, 25, 27,
63          17, 18, 19, 21, 23, 25, 27, 28,          17, 18, 19, 21, 23, 25, 27, 28,
# Line 95  Line 136 
136          FIXL(23), FIXL(24), FIXL(25), FIXL(27), FIXL(28), FIXL(30), FIXL(31), FIXL(33)          FIXL(23), FIXL(24), FIXL(25), FIXL(27), FIXL(28), FIXL(30), FIXL(31), FIXL(33)
137  };  };
138    
 uint8_t default_inter_matrix[64] = {  
         16, 17, 18, 19, 20, 21, 22, 23,  
         17, 18, 19, 20, 21, 22, 23, 24,  
         18, 19, 20, 21, 22, 23, 24, 25,  
         19, 20, 21, 22, 23, 24, 26, 27,  
         20, 21, 22, 23, 25, 26, 27, 28,  
         21, 22, 23, 24, 26, 27, 28, 30,  
         22, 23, 24, 26, 27, 28, 30, 31,  
         23, 24, 25, 27, 28, 30, 31, 33  
 };  
   
139  int16_t inter_matrix[64] = {  int16_t inter_matrix[64] = {
140          16, 17, 18, 19, 20, 21, 22, 23,          16, 17, 18, 19, 20, 21, 22, 23,
141          17, 18, 19, 20, 21, 22, 23, 24,          17, 18, 19, 20, 21, 22, 23, 24,
# Line 116  Line 146 
146          22, 23, 24, 26, 27, 28, 30, 31,          22, 23, 24, 26, 27, 28, 30, 31,
147          23, 24, 25, 27, 28, 30, 31, 33          23, 24, 25, 27, 28, 30, 31, 33
148  };  };
149    
150  uint16_t inter_matrix1[64] = {  uint16_t inter_matrix1[64] = {
151          16>>1, 17>>1, 18>>1, 19>>1, 20>>1, 21>>1, 22>>1, 23>>1,          16>>1, 17>>1, 18>>1, 19>>1, 20>>1, 21>>1, 22>>1, 23>>1,
152          17>>1, 18>>1, 19>>1, 20>>1, 21>>1, 22>>1, 23>>1, 24>>1,          17>>1, 18>>1, 19>>1, 20>>1, 21>>1, 22>>1, 23>>1, 24>>1,
# Line 162  Line 193 
193          custom_inter_matrix = status;          custom_inter_matrix = status;
194  }  }
195    
196  int16_t *  const int16_t *
197  get_intra_matrix(void)  get_intra_matrix(void)
198  {  {
199          return intra_matrix;          return intra_matrix;
200  }  }
201    
202  int16_t *  const int16_t *
203  get_inter_matrix(void)  get_inter_matrix(void)
204  {  {
205          return inter_matrix;          return inter_matrix;
206  }  }
207    
208  uint8_t *  const uint8_t *
209  get_default_intra_matrix(void)  get_default_intra_matrix(void)
210  {  {
211          return default_intra_matrix;          return default_intra_matrix;
212  }  }
213    
214  uint8_t *  const uint8_t *
215  get_default_inter_matrix(void)  get_default_inter_matrix(void)
216  {  {
217          return default_inter_matrix;          return default_inter_matrix;
218  }  }
219    
220  uint8_t  uint8_t
221  set_intra_matrix(uint8_t * matrix)  set_intra_matrix(const uint8_t * matrix)
222  {  {
223          int i, change = 0;          int i, change = 0;
224    
# Line 209  Line 240 
240    
241    
242  uint8_t  uint8_t
243  set_inter_matrix(uint8_t * matrix)  set_inter_matrix(const uint8_t * matrix)
244  {  {
245          int i, change = 0;          int i, change = 0;
246    

Legend:
Removed from v.1.13  
changed lines
  Added in v.1.13.2.2

No admin address has been configured
ViewVC Help
Powered by ViewVC 1.0.4