[cvs] / xvidcore / src / bitstream / vlc_codes.h Repository:
ViewVC logotype

Diff of /xvidcore/src/bitstream/vlc_codes.h

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

revision 1.6.2.3, Thu Jan 16 21:16:04 2003 UTC revision 1.14, Thu Feb 13 17:31:33 2003 UTC
# Line 1  Line 1 
1    /*****************************************************************************
2     *
3     *  XVID MPEG-4 VIDEO CODEC
4     *  - Variable Length Coding tables -
5     *
6     *  Copyright(C) 2002 Michael Militzer <isibaar@xvid.org>
7     *
8     *  This file is part of XviD, a free MPEG-4 video encoder/decoder
9     *
10     *  XviD is free software; you can redistribute it and/or modify it
11     *  under the terms of the GNU General Public License as published by
12     *  the Free Software Foundation; either version 2 of the License, or
13     *  (at your option) any later version.
14     *
15     *  This program is distributed in the hope that it will be useful,
16     *  but WITHOUT ANY WARRANTY; without even the implied warranty of
17     *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18     *  GNU General Public License for more details.
19     *
20     *  You should have received a copy of the GNU General Public License
21     *  along with this program; if not, write to the Free Software
22     *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
23     *
24     *  Under section 8 of the GNU General Public License, the copyright
25     *  holders of XVID explicitly forbid distribution in the following
26     *  countries:
27     *
28     *    - Japan
29     *    - United States of America
30     *
31     *  Linking XviD statically or dynamically with other modules is making a
32     *  combined work based on XviD.  Thus, the terms and conditions of the
33     *  GNU General Public License cover the whole combination.
34     *
35     *  As a special exception, the copyright holders of XviD give you
36     *  permission to link XviD with independent modules that communicate with
37     *  XviD solely through the VFW1.1 and DShow interfaces, regardless of the
38     *  license terms of these independent modules, and to copy and distribute
39     *  the resulting combined work under terms of your choice, provided that
40     *  every copy of the combined work is accompanied by a complete copy of
41     *  the source code of XviD (the version of XviD used to produce the
42     *  combined work), being distributed under the terms of the GNU General
43     *  Public License plus this exception.  An independent module is a module
44     *  which is not derived from or based on XviD.
45     *
46     *  Note that people who make modified versions of XviD are not obligated
47     *  to grant this special exception for their modified versions; it is
48     *  their choice whether to do so.  The GNU General Public License gives
49     *  permission to release a modified version without this exception; this
50     *  exception also makes it possible to release a modified version which
51     *  carries forward this exception.
52     *
53     * $Id$
54     *
55     ****************************************************************************/
56    
57  #ifndef _VLC_CODES_H_  #ifndef _VLC_CODES_H_
58  #define _VLC_CODES_H_  #define _VLC_CODES_H_
59    
# Line 11  Line 67 
67  #define ESCAPE2 14  #define ESCAPE2 14
68  #define ESCAPE3 15  #define ESCAPE3 15
69    
70    /*****************************************************************************
71     * The Vector Length Coding structure
72     ****************************************************************************/
73    
74  typedef struct  typedef struct
75  {  {
76          uint32_t code;          uint32_t code;
# Line 41  Line 101 
101  VLC_TABLE;  VLC_TABLE;
102    
103    
104  /******************************************************************  /*****************************************************************************
105   * common tables between encoder/decoder                          *   * common tables between encoder/decoder
106   ******************************************************************/   ****************************************************************************/
107    
108  static VLC_TABLE const coeff_tab[2][102] =  static VLC_TABLE const coeff_tab[2][102] =
109  {  {
# Line 362  Line 422 
422          }          }
423  };  };
424    
425    
426  /******************************************************************  /******************************************************************
427   * encoder tables                                                 *   * encoder tables                                                 *
428   ******************************************************************/   ******************************************************************/
429    
430  static VLC sprite_trajectory_code[32768];  /*
431     * MCBPC Indexing by cbpc in first two bits, mode in last two.
432  static VLC sprite_trajectory_len[15] = {   * CBPC as in table 4/H.263, MB type (mode): 3 = 01, 4 = 10.
433          { 0x00 , 2},   * Example: cbpc = 01 and mode = 4 gives index = 0110 = 6.
434          { 0x02 , 3}, { 0x03, 3}, { 0x04, 3}, { 0x05, 3}, { 0x06, 3},   */
         { 0x0E , 4}, { 0x1E, 5}, { 0x3E, 6}, { 0x7F, 7}, { 0xFE, 8},  
         { 0x1FE, 9}, {0x3FE,10}, {0x7FE,11}, {0xFFE,12} };  
435    
436    static VLC const mcbpc_intra_tab[15] = {
 /* DCT coefficients. Four tables, two for last = 0, two for last = 1.  
    the sign bit must be added afterwards. */  
   
 /* MCBPC Indexing by cbpc in first two bits, mode in last two.  
  CBPC as in table 4/H.263, MB type (mode): 3 = 01, 4 = 10.  
  Example: cbpc = 01 and mode = 4 gives index = 0110 = 6. */  
   
 static VLC mcbpc_intra_tab[15] = {  
437          {0x01, 9}, {0x01, 1}, {0x01, 4}, {0x00, 0},          {0x01, 9}, {0x01, 1}, {0x01, 4}, {0x00, 0},
438          {0x00, 0}, {0x01, 3}, {0x01, 6}, {0x00, 0},          {0x00, 0}, {0x01, 3}, {0x01, 6}, {0x00, 0},
439          {0x00, 0}, {0x02, 3}, {0x02, 6}, {0x00, 0},          {0x00, 0}, {0x02, 3}, {0x02, 6}, {0x00, 0},
# Line 392  Line 443 
443  /* MCBPC inter.  /* MCBPC inter.
444     Addressing: 5 bit ccmmm (cc = CBPC, mmm = mode (1-4 binary)) */     Addressing: 5 bit ccmmm (cc = CBPC, mmm = mode (1-4 binary)) */
445    
446  static VLC mcbpc_inter_tab[29] = {  static VLC const mcbpc_inter_tab[29] = {
447          {1, 1}, {3, 3}, {2, 3}, {3, 5}, {4, 6}, {1, 9}, {0, 0}, {0, 0},          {1, 1}, {3, 3}, {2, 3}, {3, 5}, {4, 6}, {1, 9}, {0, 0}, {0, 0},
448          {3, 4}, {7, 7}, {5, 7}, {4, 8}, {4, 9}, {0, 0}, {0, 0}, {0, 0},          {3, 4}, {7, 7}, {5, 7}, {4, 8}, {4, 9}, {0, 0}, {0, 0}, {0, 0},
449          {2, 4}, {6, 7}, {4, 7}, {3, 8}, {3, 9}, {0, 0}, {0, 0}, {0, 0},          {2, 4}, {6, 7}, {4, 7}, {3, 8}, {3, 9}, {0, 0}, {0, 0}, {0, 0},
450          {5, 6}, {5, 9}, {5, 8}, {3, 7}, {2, 9}          {5, 6}, {5, 9}, {5, 8}, {3, 7}, {2, 9}
451  };  };
452    
453  static const VLC cbpy_tab[16] = {  static VLC const cbpy_tab[16] = {
454          {3, 4}, {5, 5}, {4, 5}, {9, 4}, {3, 5}, {7, 4}, {2, 6}, {11, 4},          {3, 4}, {5, 5}, {4, 5}, {9, 4}, {3, 5}, {7, 4}, {2, 6}, {11, 4},
455          {2, 5}, {3, 6}, {5, 4}, {10, 4}, {4, 4}, {8, 4}, {6, 4}, {3, 2}          {2, 5}, {3, 6}, {5, 4}, {10, 4}, {4, 4}, {8, 4}, {6, 4}, {3, 2}
456  };  };
457    
458  static const VLC dcy_tab[511] = {  static VLC const dcy_tab[511] = {
459          {0x100, 15}, {0x101, 15}, {0x102, 15}, {0x103, 15},          {0x100, 15}, {0x101, 15}, {0x102, 15}, {0x103, 15},
460          {0x104, 15}, {0x105, 15}, {0x106, 15}, {0x107, 15},          {0x104, 15}, {0x105, 15}, {0x106, 15}, {0x107, 15},
461          {0x108, 15}, {0x109, 15}, {0x10a, 15}, {0x10b, 15},          {0x108, 15}, {0x109, 15}, {0x10a, 15}, {0x10b, 15},
# Line 535  Line 586 
586          {0x1fd, 15}, {0x1fe, 15}, {0x1ff, 15},          {0x1fd, 15}, {0x1fe, 15}, {0x1ff, 15},
587  };  };
588    
589  static const VLC dcc_tab[511] = {  static VLC const dcc_tab[511] = {
590          {0x100, 16}, {0x101, 16}, {0x102, 16}, {0x103, 16},          {0x100, 16}, {0x101, 16}, {0x102, 16}, {0x103, 16},
591          {0x104, 16}, {0x105, 16}, {0x106, 16}, {0x107, 16},          {0x104, 16}, {0x105, 16}, {0x106, 16}, {0x107, 16},
592          {0x108, 16}, {0x109, 16}, {0x10a, 16}, {0x10b, 16},          {0x108, 16}, {0x109, 16}, {0x10a, 16}, {0x10b, 16},
# Line 667  Line 718 
718  };  };
719    
720    
721  static const VLC mb_motion_table[65] = {  static VLC const mb_motion_table[65] = {
722          {0x05, 13}, {0x07, 13}, {0x05, 12}, {0x07, 12},          {0x05, 13}, {0x07, 13}, {0x05, 12}, {0x07, 12},
723          {0x09, 12}, {0x0b, 12}, {0x0d, 12}, {0x0f, 12},          {0x09, 12}, {0x0b, 12}, {0x0d, 12}, {0x0f, 12},
724          {0x09, 11}, {0x0b, 11}, {0x0d, 11}, {0x0f, 11},          {0x09, 11}, {0x0b, 11}, {0x0d, 11}, {0x0f, 11},
# Line 703  Line 754 
754          {3, 1},  {3, 1},  {3, 1},  {3, 1},  {3, 1},  {3, 1},  {3, 1},  {3, 1}          {3, 1},  {3, 1},  {3, 1},  {3, 1},  {3, 1},  {3, 1},  {3, 1},  {3, 1}
755  };  };
756    
757    
758  static VLC const mcbpc_inter_table[257] = {  static VLC const mcbpc_inter_table[257] = {
759          {VLC_ERROR, 0}, {255, 9}, {52, 9}, {36, 9}, {20, 9}, {49, 9}, {35, 8}, {35, 8},          {VLC_ERROR, 0}, {255, 9}, {52, 9}, {36, 9}, {20, 9}, {49, 9}, {35, 8}, {35, 8},
760          {19, 8}, {19, 8}, {50, 8}, {50, 8}, {51, 7}, {51, 7}, {51, 7}, {51, 7},          {19, 8}, {19, 8}, {50, 8}, {50, 8}, {51, 7}, {51, 7}, {51, 7}, {51, 7},
# Line 750  Line 802 
802          {15, 2}, {15, 2}, {15, 2}, {15, 2}, {15, 2}, {15, 2}, {15, 2}, {15, 2}          {15, 2}, {15, 2}, {15, 2}, {15, 2}, {15, 2}, {15, 2}, {15, 2}, {15, 2}
803  };  };
804    
805    
806  static VLC const TMNMVtab0[] = {  static VLC const TMNMVtab0[] = {
807          {3, 4}, {-3, 4}, {2, 3}, {2, 3}, {-2, 3}, {-2, 3}, {1, 2},          {3, 4}, {-3, 4}, {2, 3}, {2, 3}, {-2, 3}, {-2, 3}, {1, 2},
808          {1, 2}, {1, 2}, {1, 2}, {-1, 2}, {-1, 2}, {-1, 2}, {-1, 2}          {1, 2}, {1, 2}, {1, 2}, {-1, 2}, {-1, 2}, {-1, 2}, {-1, 2}
# Line 820  Line 873 
873          21514, 26984,  8307, 28531, 29798, 24951, 25970, 26912,          21514, 26984,  8307, 28531, 29798, 24951, 25970, 26912,
874           8307, 25956, 26994, 25974,  8292, 29286, 28015, 29728,           8307, 25956, 26994, 25974,  8292, 29286, 28015, 29728,
875          25960, 18208, 21838, 18208, 19536, 22560, 26998,  8260,          25960, 18208, 21838, 18208, 19536, 22560, 26998,  8260,
876          28515, 25956,  8291, 25640, 30309, 27749, 11817, 22794,          28515, 25956,  8291, 12328, 14638, 12590, 11817, 22794,
877          30063,  8306, 28531, 29798, 24951, 25970, 25632, 29545,          30063,  8306, 28531, 29798, 24951, 25970, 25632, 29545,
878          29300, 25193, 29813, 29295, 26656, 29537, 29728,  8303,          29300, 25193, 29813, 29295, 26656, 29537, 29728,  8303,
879          26983, 25974, 24864, 25443, 29541,  8307, 28532, 26912,          26983, 25974, 24864, 25443, 29541,  8307, 28532, 26912,

Legend:
Removed from v.1.6.2.3  
changed lines
  Added in v.1.14

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