[svn] / trunk / xvidcore / src / bitstream / mbcoding.c Repository:
ViewVC logotype

Diff of /trunk/xvidcore/src/bitstream/mbcoding.c

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

revision 453, Sun Sep 8 15:39:01 2002 UTC revision 497, Sat Sep 21 02:26:12 2002 UTC
# Line 29  Line 29 
29   *  along with this program; if not, write to the Free Software   *  along with this program; if not, write to the Free Software
30   *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA   *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
31   *   *
32   * $Id: mbcoding.c,v 1.27 2002-09-08 15:39:01 edgomez Exp $   * $Id: mbcoding.c,v 1.31 2002-09-21 02:26:12 suxen_drol Exp $
33   *   *
34   ****************************************************************************/   ****************************************************************************/
35    
# Line 49  Line 49 
49   * Local data   * Local data
50   ****************************************************************************/   ****************************************************************************/
51    
52  static VLC intra_table[524032];  /* msvc sp5+pp gets confused if they globals are made static */
53  static VLC inter_table[524032];  VLC intra_table[524032];
54    VLC inter_table[524032];
55    
56  static VLC DCT3Dintra[4096];  static VLC DCT3Dintra[4096];
57  static VLC DCT3Dinter[4096];  static VLC DCT3Dinter[4096];
# Line 65  Line 66 
66    
67          int32_t k, l, i, intra, last;          int32_t k, l, i, intra, last;
68          VLC *vlc[2];          VLC *vlc[2];
69          VLC **coeff_ptr;          VLC const **coeff_ptr;
70          VLC *vlc1, *vlc2;          VLC *vlc1, *vlc2;
71    
72          vlc1 = DCT3Dintra;          vlc1 = DCT3Dintra;
# Line 86  Line 87 
87                  coeff_ptr = coeff_vlc[last + 2 * intra];                  coeff_ptr = coeff_vlc[last + 2 * intra];
88    
89                  for (k = -2047; k < 2048; k++) {        // level                  for (k = -2047; k < 2048; k++) {        // level
90                          int8_t *max_level_ptr = max_level[last + 2 * intra];                          int8_t const *max_level_ptr = max_level[last + 2 * intra];
91                          int8_t *max_run_ptr = max_run[last + 2 * intra];                          int8_t const *max_run_ptr = max_run[last + 2 * intra];
92    
93                          for (l = 0; l < 64; l++) {      // run                          for (l = 0; l < 64; l++) {      // run
94                                  int32_t level = k;                                  int32_t level = k;
# Line 437  Line 438 
438          return;          return;
439  }  }
440    
   
 /***************************************************************  
  * bframe encoding start  
  ***************************************************************/  
   
 /*  
         mbtype  
         0       1b              direct(h263)            mvdb  
         1       01b             interpolate mc+q        dbquant, mvdf, mvdb  
         2       001b    backward mc+q           dbquant, mvdb  
         3       0001b   forward mc+q            dbquant, mvdf  
 */  
   
 void  
 put_bvop_mbtype(Bitstream * bs,  
                                 int value)  
 {  
         switch (value) {  
         case 0:  
                 BitstreamPutBit(bs, 1);  
                 return;  
   
         case 1:  
                 BitstreamPutBit(bs, 0);  
                 BitstreamPutBit(bs, 1);  
                 return;  
   
         case 2:  
                 BitstreamPutBit(bs, 0);  
                 BitstreamPutBit(bs, 0);  
                 BitstreamPutBit(bs, 1);  
                 return;  
   
         case 3:  
                 BitstreamPutBit(bs, 0);  
                 BitstreamPutBit(bs, 0);  
                 BitstreamPutBit(bs, 0);  
                 BitstreamPutBit(bs, 1);  
                 return;  
   
         default:;                                       // invalid!  
   
         }  
   
 }  
   
 /*  
         dbquant  
         -2      10b  
         0       0b  
         +2      11b  
 */  
   
 void  
 put_bvop_dbquant(Bitstream * bs,  
                                  int value)  
 {  
         switch (value) {  
         case 0:  
                 BitstreamPutBit(bs, 0);  
                 return;  
   
         case -2:  
                 BitstreamPutBit(bs, 1);  
                 BitstreamPutBit(bs, 0);  
                 return;  
   
         case 2:  
                 BitstreamPutBit(bs, 1);  
                 BitstreamPutBit(bs, 1);  
                 return;  
   
         default:;                                       // invalid  
         }  
 }  
   
 #if 0  
 void  
 MBCodingBVOP(const MACROBLOCK * mb,  
                          const int16_t qcoeff[6 * 64],  
                          const int32_t fcode,  
                          const int32_t bcode,  
                          Bitstream * bs,  
                          Statistics * pStat)  
 {  
         int i;  
   
 /*      ------------------------------------------------------------------  
                 when a block is skipped it is decoded DIRECT(0,0)  
                 hence is interpolated from forward & backward frames  
         ------------------------------------------------------------------ */  
   
         if (mb->mode == MODE_DIRECT_NONE_MV) {  
                 BitstreamPutBit(bs, 1); // skipped  
                 return;  
         }  
   
         BitstreamPutBit(bs, 0);         // not skipped  
   
         if (mb->cbp == 0) {  
                 BitstreamPutBit(bs, 1); // cbp == 0  
         } else {  
                 BitstreamPutBit(bs, 0); // cbp == xxx  
         }  
   
         put_bvop_mbtype(bs, mb->mode);  
   
         if (mb->cbp) {  
                 BitstreamPutBits(bs, mb->cbp, 6);  
         }  
   
         if (mb->mode != MODE_DIRECT && mb->cbp != 0) {  
                 put_bvop_dbquant(bs, 0);        // todo: mb->dquant = 0  
         }  
   
         if (mb->mode == MODE_INTERPOLATE || mb->mode == MODE_FORWARD) {  
                 CodeVector(bs, mb->pmvs[0].x, fcode, pStat);  
                 CodeVector(bs, mb->pmvs[0].y, fcode, pStat);  
         }  
   
         if (mb->mode == MODE_INTERPOLATE || mb->mode == MODE_BACKWARD) {  
                 CodeVector(bs, mb->b_pmvs[0].x, bcode, pStat);  
                 CodeVector(bs, mb->b_pmvs[0].y, bcode, pStat);  
         }  
   
         if (mb->mode == MODE_DIRECT) {  
                 CodeVector(bs, mb->deltamv.x, 1, pStat);                /* fcode is always 1 for delta vector */  
                 CodeVector(bs, mb->deltamv.y, 1, pStat);                /* prediction is always (0,0) */  
         }  
   
         for (i = 0; i < 6; i++) {  
                 if (mb->cbp & (1 << (5 - i))) {  
                         CodeCoeff(bs, &qcoeff[i * 64], inter_table, scan_tables[0], 0);  
                 }  
         }  
 }  
 #endif  
   
   
441  /*****************************************************************************  /*****************************************************************************
442   * decoding stuff starts here   * decoding stuff starts here
443   ****************************************************************************/   ****************************************************************************/

Legend:
Removed from v.453  
changed lines
  Added in v.497

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