Main Page | Class List | File List | Class Members | File Members

vid_vlc.h

Go to the documentation of this file.
00001 /************************************************************************
00002  *
00003  *  vid_vlc.h, VLC tables for tmn (TMN encoder)
00004  *  Copyright (C) 1995, 1996  Telenor R&D, Norway
00005  *        Karl Olav Lillevold <Karl.Lillevold@nta.no>
00006  *  
00007  *  Contacts: 
00008  *  Karl Olav Lillevold               <Karl.Lillevold@nta.no>, or
00009  *  Robert Danielsen                  <Robert.Danielsen@nta.no>
00010  *
00011  *  Telenor Research and Development  http://www.nta.no/brukere/DVC/
00012  *  P.O.Box 83                        tel.:   +47 63 84 84 00
00013  *  N-2007 Kjeller, Norway            fax.:   +47 63 81 00 76
00014  *  
00015  ************************************************************************/
00016 
00017 /*
00018  * Disclaimer of Warranty
00019  *
00020  * These software programs are available to the user without any
00021  * license fee or royalty on an "as is" basis.  Telenor Research and
00022  * Development disclaims any and all warranties, whether express,
00023  * implied, or statuary, including any implied warranties or
00024  * merchantability or of fitness for a particular purpose.  In no
00025  * event shall the copyright-holder be liable for any incidental,
00026  * punitive, or consequential damages of any kind whatsoever arising
00027  * from the use of these programs.
00028  *
00029  * This disclaimer of warranty extends to the user of these programs
00030  * and user's customers, employees, agents, transferees, successors,
00031  * and assigns.
00032  *
00033  * Telenor Research and Development does not represent or warrant that
00034  * the programs furnished hereunder are free of infringement of any
00035  * third-party patents.
00036  *
00037  * Commercial implementations of H.263, including shareware, are
00038  * subject to royalty fees to patent holders.  Many of these patents
00039  * are general enough such that they are unavoidable regardless of
00040  * implementation design.
00041  * */
00042 
00043 /************************************************************************
00044  *        
00045  *  Author:     Robert.Danielsen@nta.no
00046  *  Date:       06.05.96
00047  *
00048  *  Comment:    struct idea from MPEG-2 Simulation Software Group.
00049  *        
00050  ************************************************************************/
00051 
00052 /* type definitions for variable length code table entries */
00053 
00054 typedef struct
00055 {
00056   unsigned int code; /* right justified */
00057   int len;
00058 } VLCtable;
00059 
00060 
00061 /* Motion vectors */
00062 
00063 static VLCtable mvtab[33] =
00064 {
00065   {1,1}, {1,2}, {1,3}, {1,4}, {3,6}, {5,7}, {4,7}, {3,7},
00066   {11,9}, {10,9}, {9,9}, {17,10}, {16,10}, {15,10}, {14,10}, {13,10},
00067   {12,10}, {11,10}, {10,10}, {9,10}, {8,10}, {7,10}, {6,10}, {5,10},
00068   {4,10}, {7,11}, {6,11}, {5,11}, {4,11}, {3,11}, {2,11}, {3,12},
00069   {2,12}
00070 };
00071 
00072 
00073 /* CBPCM (MCBPC) Indexing by cbpc in first two bits, mode in last two.
00074  CBPC as in table 4/H.263, MB type (mode): 3 = 01, 4 = 10.
00075  Example: cbpc = 01 and mode = 4 gives index = 0110 = 6. */
00076 
00077 static VLCtable cbpcm_intra_tab[15] =
00078 {
00079   {0x01,9}, {0x01,1}, {0x01,4}, {0x00,0},
00080   {0x00,0}, {0x01,3}, {0x01,6}, {0x00,0},
00081   {0x00,0}, {0x02,3}, {0x02,6}, {0x00,0},
00082   {0x00,0}, {0x03,3}, {0x03,6}
00083 };
00084 
00085 
00086 /* CBPCM inter.
00087    Addressing: 5 bit ccmmm (cc = CBPC, mmm = mode (1-4 binary)) */
00088 
00089 static VLCtable cbpcm_inter_tab[29] =
00090 {
00091   {1,1}, {3,3}, {2,3}, {3,5}, {4,6}, {1,9}, {0,0}, {0,0},
00092   {3,4}, {7,7}, {5,7}, {4,8}, {4,9}, {0,0}, {0,0}, {0,0},
00093   {2,4}, {6,7}, {4,7}, {3,8}, {3,9}, {0,0}, {0,0}, {0,0},
00094   {5,6}, {5,9}, {5,8}, {3,7}, {2,9}
00095 };
00096 
00097 
00098 /* CBPY. Straightforward indexing */
00099 
00100 static VLCtable cbpy_tab[16] =
00101 {
00102   {3,4}, {5,5}, {4,5}, {9,4}, {3,5}, {7,4}, {2,6}, {11,4},
00103   {2,5}, {3,6}, {5,4}, {10,4}, {4,4}, {8,4}, {6,4}, {3,2}
00104 };
00105 
00106 
00107 /* DCT coefficients. Four tables, two for last = 0, two for last = 1.
00108    the sign bit must be added afterwards. */
00109 
00110 /* first part of coeffs for last = 0. Indexed by [run][level-1] */
00111 
00112 static VLCtable coeff_tab0[2][12] =
00113 {
00114   /* run = 0 */
00115   {
00116     {0x02, 2}, {0x0f, 4}, {0x15, 6}, {0x17, 7},
00117     {0x1f, 8}, {0x25, 9}, {0x24, 9}, {0x21,10},
00118     {0x20,10}, {0x07,11}, {0x06,11}, {0x20,11}
00119   },
00120   /* run = 1 */
00121   {
00122     {0x06, 3}, {0x14, 6}, {0x1e, 8}, {0x0f,10},
00123     {0x21,11}, {0x50,12}, {0x00, 0}, {0x00, 0},
00124     {0x00, 0}, {0x00, 0}, {0x00, 0}, {0x00, 0}
00125   }
00126 };
00127 
00128 /* rest of coeffs for last = 0. indexing by [run-2][level-1] */
00129 
00130 static VLCtable coeff_tab1[25][4] =
00131 {
00132   /* run = 2 */
00133   {
00134     {0x0e, 4}, {0x1d, 8}, {0x0e,10}, {0x51,12}
00135   },
00136   /* run = 3 */
00137   {
00138     {0x0d, 5}, {0x23, 9}, {0x0d,10}, {0x00, 0}
00139   },
00140   /* run = 4-26 */
00141   {
00142     {0x0c, 5}, {0x22, 9}, {0x52,12}, {0x00, 0}
00143   },
00144   {
00145     {0x0b, 5}, {0x0c,10}, {0x53,12}, {0x00, 0}
00146   },
00147   {
00148     {0x13, 6}, {0x0b,10}, {0x54,12}, {0x00, 0}
00149   },
00150   {
00151     {0x12, 6}, {0x0a,10}, {0x00, 0}, {0x00, 0}
00152   },
00153   {
00154     {0x11, 6}, {0x09,10}, {0x00, 0}, {0x00, 0}
00155   },
00156   {
00157     {0x10, 6}, {0x08,10}, {0x00, 0}, {0x00, 0}
00158   },
00159   {
00160     {0x16, 7}, {0x55,12}, {0x00, 0}, {0x00, 0}
00161   },
00162   {
00163     {0x15, 7}, {0x00, 0}, {0x00, 0}, {0x00, 0}
00164   },
00165   {
00166     {0x14, 7}, {0x00, 0}, {0x00, 0}, {0x00, 0}
00167   },
00168   {
00169     {0x1c, 8}, {0x00, 0}, {0x00, 0}, {0x00, 0}
00170   },
00171   {
00172     {0x1b, 8}, {0x00, 0}, {0x00, 0}, {0x00, 0}
00173   },
00174   {
00175     {0x21, 9}, {0x00, 0}, {0x00, 0}, {0x00, 0}
00176   },
00177   {
00178     {0x20, 9}, {0x00, 0}, {0x00, 0}, {0x00, 0}
00179   },
00180   {
00181     {0x1f, 9}, {0x00, 0}, {0x00, 0}, {0x00, 0}
00182   },
00183   {
00184     {0x1e, 9}, {0x00, 0}, {0x00, 0}, {0x00, 0}
00185   },
00186   {
00187     {0x1d, 9}, {0x00, 0}, {0x00, 0}, {0x00, 0}
00188   },
00189   {
00190     {0x1c, 9}, {0x00, 0}, {0x00, 0}, {0x00, 0}
00191   },
00192   {
00193     {0x1b, 9}, {0x00, 0}, {0x00, 0}, {0x00, 0}
00194   },
00195   {
00196     {0x1a, 9}, {0x00, 0}, {0x00, 0}, {0x00, 0}
00197   },
00198   {
00199     {0x22,11}, {0x00, 0}, {0x00, 0}, {0x00, 0}
00200   },
00201   {
00202     {0x23,11}, {0x00, 0}, {0x00, 0}, {0x00, 0}
00203   },
00204   {
00205     {0x56,12}, {0x00, 0}, {0x00, 0}, {0x00, 0}
00206   },
00207   {
00208     {0x57,12}, {0x00, 0}, {0x00, 0}, {0x00, 0}
00209   }
00210 };
00211 
00212 /* first coeffs of last = 1. indexing by [run][level-1] */
00213 
00214 static VLCtable coeff_tab2[2][3] =
00215 {
00216   /* run = 0 */
00217   {
00218     {0x07, 4}, {0x19, 9}, {0x05,11}
00219   },
00220   /* run = 1 */
00221   {
00222     {0x0f, 6}, {0x04,11}, {0x00, 0}
00223   }
00224 };
00225 
00226 /* rest of coeffs for last = 1. indexing by [run-2] */
00227 
00228 static VLCtable coeff_tab3[40] =
00229 {
00230   {0x0e, 6}, {0x0d, 6}, {0x0c, 6},
00231   {0x13, 7}, {0x12, 7}, {0x11, 7}, {0x10, 7},
00232   {0x1a, 8}, {0x19, 8}, {0x18, 8}, {0x17, 8},
00233   {0x16, 8}, {0x15, 8}, {0x14, 8}, {0x13, 8},
00234   {0x18, 9}, {0x17, 9}, {0x16, 9}, {0x15, 9},    
00235   {0x14, 9}, {0x13, 9}, {0x12, 9}, {0x11, 9},    
00236   {0x07,10}, {0x06,10}, {0x05,10}, {0x04,10},    
00237   {0x24,11}, {0x25,11}, {0x26,11}, {0x27,11},    
00238   {0x58,12}, {0x59,12}, {0x5a,12}, {0x5b,12},    
00239   {0x5c,12}, {0x5d,12}, {0x5e,12}, {0x5f,12},
00240   {0x00, 0}               
00241 };

Generated on Sun Jul 16 16:27:45 2006 by  doxygen 1.3.9.1