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

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

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

revision 1.44.2.15, Fri Oct 3 13:47:00 2003 UTC revision 1.45, Mon Feb 24 11:15:33 2003 UTC
# Line 1  Line 1 
1  /*****************************************************************************   /******************************************************************************
2   *    *                                                                            *
3   *  XVID MPEG-4 VIDEO CODEC    *  This file is part of XviD, a free MPEG-4 video encoder/decoder            *
4   *  - MB coding -    *                                                                            *
5   *    *  XviD is an implementation of a part of one or more MPEG-4 Video tools     *
6   *  Copyright (C) 2002 Michael Militzer <isibaar@xvid.org>    *  as specified in ISO/IEC 14496-2 standard.  Those intending to use this    *
7   *    *  software module in hardware or software products are advised that its     *
8   *  This program is free software ; you can redistribute it and/or modify    *  use may infringe existing patents or copyrights, and any such use         *
9   *  it under the terms of the GNU General Public License as published by    *  would be at such party's own risk.  The original developer of this        *
10   *  the Free Software Foundation ; either version 2 of the License, or    *  software module and his/her company, and subsequent editors and their     *
11   *  (at your option) any later version.    *  companies, will have no liability for use of this software or             *
12   *    *  modifications or derivatives thereof.                                     *
13   *  This program is distributed in the hope that it will be useful,    *                                                                            *
14   *  but WITHOUT ANY WARRANTY ; without even the implied warranty of    *  XviD is free software; you can redistribute it and/or modify it           *
15   *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the    *  under the terms of the GNU General Public License as published by         *
16   *  GNU General Public License for more details.    *  the Free Software Foundation; either version 2 of the License, or         *
17   *    *  (at your option) any later version.                                       *
18   *  You should have received a copy of the GNU General Public License    *                                                                            *
19   *  along with this program ; if not, write to the Free Software    *  XviD is distributed in the hope that it will be useful, but               *
20   *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA    *  WITHOUT ANY WARRANTY; without even the implied warranty of                *
21   *    *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the             *
22   * $Id$    *  GNU General Public License for more details.                              *
23   *    *                                                                            *
24   ****************************************************************************/    *  You should have received a copy of the GNU General Public License         *
25      *  along with this program; if not, write to the Free Software               *
26      *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA  *
27      *                                                                            *
28      ******************************************************************************/
29    
30     /******************************************************************************
31      *                                                                            *
32      *  mbcoding.c                                                                *
33      *                                                                            *
34      *  Copyright (C) 2002 - Michael Militzer <isibaar@xvid.org>                  *
35      *                                                                            *
36      *  For more information visit the XviD homepage: http://www.xvid.org         *
37      *                                                                            *
38      ******************************************************************************/
39    
40     /******************************************************************************
41      *                                                                                                                                                        *
42      *  Revision history:                                                         *
43      *                                                                            *
44      *  28.10.2002 GMC support - gruel                                                                                        *
45      *  28.06.2002 added check_resync_marker()                                    *
46      *  14.04.2002 bframe encoding                                                                                            *
47      *  08.03.2002 initial version; isibaar                                                           *
48      *                                                                                                                                                        *
49      ******************************************************************************/
50    
51    
52  #include <stdio.h>  #include <stdio.h>
53  #include <stdlib.h>  #include <stdlib.h>
 #include <string.h>  
   
54  #include "../portab.h"  #include "../portab.h"
55  #include "../global.h"  #include "../global.h"
56  #include "bitstream.h"  #include "bitstream.h"
# Line 62  Line 86 
86          const int code2 = sprite_trajectory_len[len].code;          const int code2 = sprite_trajectory_len[len].code;
87          const int len2 = sprite_trajectory_len[len].len;          const int len2 = sprite_trajectory_len[len].len;
88    
89  #if 0  //      printf("GMC=%d Code/Len  = %d / %d ",val, code,len);
90          printf("GMC=%d Code/Len  = %d / %d ",val, code,len);  //      printf("Code2 / Len2 = %d / %d \n",code2,len2);
         printf("Code2 / Len2 = %d / %d \n",code2,len2);  
 #endif  
91    
92          BitstreamPutBits(bs, code2, len2);          BitstreamPutBits(bs, code2, len2);
93          if (len) BitstreamPutBits(bs, code, len);          if (len) BitstreamPutBits(bs, code, len);
# Line 476  Line 498 
498          {          {
499                  if ((level = qcoeff[zigzag[i++]]) != 0)                  if ((level = qcoeff[zigzag[i++]]) != 0)
500                  {                  {
501                          abs_level = abs(prev_level);                          abs_level = ABS(prev_level);
502                          abs_level = abs_level < 64 ? abs_level : 0;                          abs_level = abs_level < 64 ? abs_level : 0;
503                          code      = coeff_VLC[1][0][abs_level][prev_run].code;                          code      = coeff_VLC[1][0][abs_level][prev_run].code;
504                          len               = coeff_VLC[1][0][abs_level][prev_run].len;                          len               = coeff_VLC[1][0][abs_level][prev_run].len;
# Line 496  Line 518 
518                          run++;                          run++;
519          }          }
520    
521          abs_level = abs(prev_level);          abs_level = ABS(prev_level);
522          abs_level = abs_level < 64 ? abs_level : 0;          abs_level = abs_level < 64 ? abs_level : 0;
523          code      = coeff_VLC[1][1][abs_level][prev_run].code;          code      = coeff_VLC[1][1][abs_level][prev_run].code;
524          len               = coeff_VLC[1][1][abs_level][prev_run].len;          len               = coeff_VLC[1][1][abs_level][prev_run].len;
# Line 537  Line 559 
559          {          {
560                  if ((level = qcoeff[zigzag[i++]]) != 0)                  if ((level = qcoeff[zigzag[i++]]) != 0)
561                  {                  {
562                          abs_level = abs(prev_level);                          abs_level = ABS(prev_level);
563                          abs_level = abs_level < 64 ? abs_level : 0;                          abs_level = abs_level < 64 ? abs_level : 0;
564                          len               = coeff_VLC[1][0][abs_level][prev_run].len;                          len               = coeff_VLC[1][0][abs_level][prev_run].len;
565                          bits      += len!=128 ? len : 30;                          bits      += len!=128 ? len : 30;
# Line 550  Line 572 
572                          run++;                          run++;
573          }          }
574    
575          abs_level = abs(prev_level);          abs_level = ABS(prev_level);
576          abs_level = abs_level < 64 ? abs_level : 0;          abs_level = abs_level < 64 ? abs_level : 0;
577          len               = coeff_VLC[1][1][abs_level][prev_run].len;          len               = coeff_VLC[1][1][abs_level][prev_run].len;
578          bits      += len!=128 ? len : 30;          bits      += len!=128 ? len : 30;
# Line 605  Line 627 
627    
628  #endif  #endif
629    
   
 static int iDQtab[5] = {  
         1, 0, -1 /* no change */, 2, 3  
 };  
 #define DQ_VALUE2INDEX(value)  iDQtab[(value)+2]  
   
   
630  static __inline void  static __inline void
631  CodeBlockIntra(const FRAMEINFO * const frame,  CodeBlockIntra(const FRAMEINFO * const frame,
632                             const MACROBLOCK * pMB,                             const MACROBLOCK * pMB,
# Line 624  Line 639 
639    
640          cbpy = pMB->cbp >> 2;          cbpy = pMB->cbp >> 2;
641    
642          /* write mcbpc */          // write mcbpc
643          if (frame->coding_type == I_VOP) {          if (frame->coding_type == I_VOP) {
644                  mcbpc = ((pMB->mode >> 1) & 3) | ((pMB->cbp & 3) << 2);                  mcbpc = ((pMB->mode >> 1) & 3) | ((pMB->cbp & 3) << 2);
645                  BitstreamPutBits(bs, mcbpc_intra_tab[mcbpc].code,                  BitstreamPutBits(bs, mcbpc_intra_tab[mcbpc].code,
# Line 635  Line 650 
650                                                   mcbpc_inter_tab[mcbpc].len);                                                   mcbpc_inter_tab[mcbpc].len);
651          }          }
652    
653          /* ac prediction flag */          // ac prediction flag
654          if (pMB->acpred_directions[0])          if (pMB->acpred_directions[0])
655                  BitstreamPutBits(bs, 1, 1);                  BitstreamPutBits(bs, 1, 1);
656          else          else
657                  BitstreamPutBits(bs, 0, 1);                  BitstreamPutBits(bs, 0, 1);
658    
659          /* write cbpy */          // write cbpy
660          BitstreamPutBits(bs, xvid_cbpy_tab[cbpy].code, xvid_cbpy_tab[cbpy].len);          BitstreamPutBits(bs, xvid_cbpy_tab[cbpy].code, xvid_cbpy_tab[cbpy].len);
661    
662          /* write dquant */          // write dquant
663          if (pMB->mode == MODE_INTRA_Q)          if (pMB->mode == MODE_INTRA_Q)
664                  BitstreamPutBits(bs, DQ_VALUE2INDEX(pMB->dquant), 2);                  BitstreamPutBits(bs, pMB->dquant, 2);
665    
666          /* write interlacing */          // write interlacing
667          if (frame->vol_flags & XVID_VOL_INTERLACING) {          if (frame->global_flags & XVID_INTERLACING) {
668                  BitstreamPutBit(bs, pMB->field_dct);                  BitstreamPutBit(bs, pMB->field_dct);
669          }          }
670          /* code block coeffs */          // code block coeffs
671          for (i = 0; i < 6; i++) {          for (i = 0; i < 6; i++) {
672                  if (i < 4)                  if (i < 4)
673                          BitstreamPutBits(bs, dcy_tab[qcoeff[i * 64 + 0] + 255].code,                          BitstreamPutBits(bs, dcy_tab[qcoeff[i * 64 + 0] + 255].code,
# Line 663  Line 678 
678    
679                  if (pMB->cbp & (1 << (5 - i))) {                  if (pMB->cbp & (1 << (5 - i))) {
680                          const uint16_t *scan_table =                          const uint16_t *scan_table =
681                                  frame->vop_flags & XVID_VOP_ALTERNATESCAN ?                                  frame->global_flags & XVID_ALTERNATESCAN ?
682                                  scan_tables[2] : scan_tables[pMB->acpred_directions[i]];                                  scan_tables[2] : scan_tables[pMB->acpred_directions[i]];
683    
684                          bits = BitstreamPos(bs);                          bits = BitstreamPos(bs);
# Line 696  Line 711 
711          mcbpc = (pMB->mode & 7) | ((pMB->cbp & 3) << 3);          mcbpc = (pMB->mode & 7) | ((pMB->cbp & 3) << 3);
712          cbpy = 15 - (pMB->cbp >> 2);          cbpy = 15 - (pMB->cbp >> 2);
713    
714          /* write mcbpc */          // write mcbpc
715          BitstreamPutBits(bs, mcbpc_inter_tab[mcbpc].code,          BitstreamPutBits(bs, mcbpc_inter_tab[mcbpc].code,
716                                           mcbpc_inter_tab[mcbpc].len);                                           mcbpc_inter_tab[mcbpc].len);
717    
718          if ( (frame->coding_type == S_VOP) && (pMB->mode == MODE_INTER || pMB->mode == MODE_INTER_Q) )          if ( (frame->coding_type == S_VOP) && (pMB->mode == MODE_INTER || pMB->mode == MODE_INTER_Q) )
719                  BitstreamPutBit(bs, pMB->mcsel);                /* mcsel: '0'=local motion, '1'=GMC */                  BitstreamPutBit(bs, pMB->mcsel);                // mcsel: '0'=local motion, '1'=GMC
720    
721          /* write cbpy */          // write cbpy
722          BitstreamPutBits(bs, xvid_cbpy_tab[cbpy].code, xvid_cbpy_tab[cbpy].len);          BitstreamPutBits(bs, xvid_cbpy_tab[cbpy].code, xvid_cbpy_tab[cbpy].len);
723    
724          /* write dquant */          // write dquant
725          if (pMB->mode == MODE_INTER_Q)          if (pMB->mode == MODE_INTER_Q)
726                  BitstreamPutBits(bs, DQ_VALUE2INDEX(pMB->dquant), 2);                  BitstreamPutBits(bs, pMB->dquant, 2);
727    
728          /* interlacing */          // interlacing
729          if (frame->vol_flags & XVID_VOL_INTERLACING) {          if (frame->global_flags & XVID_INTERLACING) {
730                  if (pMB->cbp) {                  if (pMB->cbp) {
731                          BitstreamPutBit(bs, pMB->field_dct);                          BitstreamPutBit(bs, pMB->field_dct);
732                          DPRINTF(XVID_DEBUG_MB,"codep: field_dct: %i\n", pMB->field_dct);                          DPRINTF(DPRINTF_MB,"codep: field_dct: %i", pMB->field_dct);
733                  }                  }
734    
735                  /* if inter block, write field ME flag */                  // if inter block, write field ME flag
736                  if (pMB->mode == MODE_INTER || pMB->mode == MODE_INTER_Q) {                  if (pMB->mode == MODE_INTER || pMB->mode == MODE_INTER_Q) {
737                          BitstreamPutBit(bs, pMB->field_pred);                          BitstreamPutBit(bs, pMB->field_pred);
738                          DPRINTF(XVID_DEBUG_MB,"codep: field_pred: %i\n", pMB->field_pred);                          DPRINTF(DPRINTF_MB,"codep: field_pred: %i", pMB->field_pred);
739    
740                          /* write field prediction references */                          // write field prediction references
741                          if (pMB->field_pred) {                          if (pMB->field_pred) {
742                                  BitstreamPutBit(bs, pMB->field_for_top);                                  BitstreamPutBit(bs, pMB->field_for_top);
743                                  BitstreamPutBit(bs, pMB->field_for_bot);                                  BitstreamPutBit(bs, pMB->field_for_bot);
744                          }                          }
745                  }                  }
746          }          }
747          /* code motion vector(s) if motion is local  */          // code motion vector(s) if motion is local
748          if (!pMB->mcsel)          if (!pMB->mcsel)
749                  for (i = 0; i < (pMB->mode == MODE_INTER4V ? 4 : 1); i++) {                  for (i = 0; i < (pMB->mode == MODE_INTER4V ? 4 : 1); i++) {
750                          CodeVector(bs, pMB->pmvs[i].x, frame->fcode, pStat);                          CodeVector(bs, pMB->pmvs[i].x, frame->fcode, pStat);
# Line 738  Line 753 
753    
754          bits = BitstreamPos(bs);          bits = BitstreamPos(bs);
755    
756          /* code block coeffs */          // code block coeffs
757          for (i = 0; i < 6; i++)          for (i = 0; i < 6; i++)
758                  if (pMB->cbp & (1 << (5 - i)))                  if (pMB->cbp & (1 << (5 - i)))
759                  {                  {
760                          const uint16_t *scan_table =                          const uint16_t *scan_table =
761                                  frame->vop_flags & XVID_VOP_ALTERNATESCAN ?                                  frame->global_flags & XVID_ALTERNATESCAN ?
762                                  scan_tables[2] : scan_tables[0];                                  scan_tables[2] : scan_tables[0];
763    
764  #ifdef BIGLUT  #ifdef BIGLUT
# Line 766  Line 781 
781                   Statistics * pStat)                   Statistics * pStat)
782  {  {
783          if (frame->coding_type != I_VOP)          if (frame->coding_type != I_VOP)
784                          BitstreamPutBit(bs, 0); /* not_coded */                          BitstreamPutBit(bs, 0); // not_coded
785    
786          if (pMB->mode == MODE_INTRA || pMB->mode == MODE_INTRA_Q)          if (pMB->mode == MODE_INTRA || pMB->mode == MODE_INTRA_Q)
787                  CodeBlockIntra(frame, pMB, qcoeff, bs, pStat);                  CodeBlockIntra(frame, pMB, qcoeff, bs, pStat);
# Line 775  Line 790 
790    
791  }  }
792    
793    /*
794    // moved to mbcoding.h so that in can be 'static __inline'
795    void
796    MBSkip(Bitstream * bs)
797    {
798            BitstreamPutBit(bs, 1); // not coded
799    }
800    */
801    
802  /***************************************************************  /***************************************************************
803   * bframe encoding start   * bframe encoding start
804   ***************************************************************/   ***************************************************************/
# Line 831  Line 855 
855                  BitstreamPutBit(bs, 1);                  BitstreamPutBit(bs, 1);
856                  return;                  return;
857    
858          default:;                                       /* invalid */          default:;                                       // invalid
859          }          }
860  }  }
861    
862    
863    
864  void  void
865  MBCodingBVOP(const FRAMEINFO * const frame,  MBCodingBVOP(const MACROBLOCK * mb,
                          const MACROBLOCK * mb,  
866                           const int16_t qcoeff[6 * 64],                           const int16_t qcoeff[6 * 64],
867                           const int32_t fcode,                           const int32_t fcode,
868                           const int32_t bcode,                           const int32_t bcode,
869                           Bitstream * bs,                           Bitstream * bs,
870                           Statistics * pStat)                           Statistics * pStat,
871                             int direction)
872  {  {
873          int vcode = fcode;          int vcode = fcode;
874          unsigned int i;          unsigned int i;
875    
         const uint16_t *scan_table =  
                 frame->vop_flags & XVID_VOP_ALTERNATESCAN ?  
                 scan_tables[2] : scan_tables[0];  
   
   
876  /*      ------------------------------------------------------------------  /*      ------------------------------------------------------------------
877                  when a block is skipped it is decoded DIRECT(0,0)                  when a block is skipped it is decoded DIRECT(0,0)
878                  hence is interpolated from forward & backward frames                  hence is interpolated from forward & backward frames
879          ------------------------------------------------------------------ */          ------------------------------------------------------------------ */
880    
881          if (mb->mode == MODE_DIRECT_NONE_MV) {          if (mb->mode == MODE_DIRECT_NONE_MV) {
882                  BitstreamPutBit(bs, 1); /* skipped */                  BitstreamPutBit(bs, 1); // skipped
883                  return;                  return;
884          }          }
885    
886          BitstreamPutBit(bs, 0);         /* not skipped */          BitstreamPutBit(bs, 0);         // not skipped
887    
888          if (mb->cbp == 0) {          if (mb->cbp == 0) {
889                  BitstreamPutBit(bs, 1); /* cbp == 0 */                  BitstreamPutBit(bs, 1); // cbp == 0
890          } else {          } else {
891                  BitstreamPutBit(bs, 0); /* cbp == xxx */                  BitstreamPutBit(bs, 0); // cbp == xxx
892          }          }
893    
894          put_bvop_mbtype(bs, mb->mode);          put_bvop_mbtype(bs, mb->mode);
# Line 879  Line 898 
898          }          }
899    
900          if (mb->mode != MODE_DIRECT && mb->cbp != 0) {          if (mb->mode != MODE_DIRECT && mb->cbp != 0) {
901                  put_bvop_dbquant(bs, 0);        /* todo: mb->dquant = 0 */                  put_bvop_dbquant(bs, 0);        // todo: mb->dquant = 0
         }  
   
         if (frame->vol_flags & XVID_VOL_INTERLACING) {  
                 if (mb->cbp) {  
                         BitstreamPutBit(bs, mb->field_dct);  
                         DPRINTF(XVID_DEBUG_MB,"codep: field_dct: %i\n", mb->field_dct);  
902                  }                  }
903    
                 /* if not direct block, write field ME flag */  
                 if (mb->mode != MODE_DIRECT) {  
                         BitstreamPutBit(bs, 0 /*mb->field_pred*/); /* field ME not implemented */  
   
                         /* write field prediction references */  
                 /*      if (mb->field_pred) {  
                                 BitstreamPutBit(bs, mb->field_for_top);  
                                 BitstreamPutBit(bs, mb->field_for_bot);  
                         }*/  
                 }  
         }  
   
   
904          switch (mb->mode) {          switch (mb->mode) {
905                  case MODE_INTERPOLATE:                  case MODE_INTERPOLATE:
906                          CodeVector(bs, mb->pmvs[1].x, vcode, pStat); /* forward vector of interpolate mode */                          CodeVector(bs, mb->pmvs[1].x, vcode, pStat); //forward vector of interpolate mode
907                          CodeVector(bs, mb->pmvs[1].y, vcode, pStat);                          CodeVector(bs, mb->pmvs[1].y, vcode, pStat);
908                  case MODE_BACKWARD:                  case MODE_BACKWARD:
909                          vcode = bcode;                          vcode = bcode;
# Line 912  Line 912 
912                          CodeVector(bs, mb->pmvs[0].y, vcode, pStat);                          CodeVector(bs, mb->pmvs[0].y, vcode, pStat);
913                          break;                          break;
914                  case MODE_DIRECT:                  case MODE_DIRECT:
915                          CodeVector(bs, mb->pmvs[3].x, 1, pStat);        /* fcode is always 1 for delta vector */                          CodeVector(bs, mb->pmvs[3].x, 1, pStat);        // fcode is always 1 for delta vector
916                          CodeVector(bs, mb->pmvs[3].y, 1, pStat);        /* prediction is always (0,0) */                          CodeVector(bs, mb->pmvs[3].y, 1, pStat);        // prediction is always (0,0)
917                  default: break;                  default: break;
918          }          }
919    
# Line 935  Line 935 
935   ***************************************************************/   ***************************************************************/
936    
937    
938  /*  // for IVOP addbits == 0
939   * for IVOP addbits == 0  // for PVOP addbits == fcode - 1
940   * for PVOP addbits == fcode - 1  // for BVOP addbits == max(fcode,bcode) - 1
941   * for BVOP addbits == max(fcode,bcode) - 1  // returns true or false
  * returns true or false  
  */  
942  int  int
943  check_resync_marker(Bitstream * bs, int addbits)  check_resync_marker(Bitstream * bs, int addbits)
944  {  {
# Line 1054  Line 1052 
1052                  return data;                  return data;
1053    
1054          res = BitstreamGetBits(bs, fcode - 1);          res = BitstreamGetBits(bs, fcode - 1);
1055          mv = ((abs(data) - 1) * scale_fac) + res + 1;          mv = ((ABS(data) - 1) * scale_fac) + res + 1;
1056    
1057          return data < 0 ? -mv : mv;          return data < 0 ? -mv : mv;
1058    
# Line 1155  Line 1153 
1153                  level = BitstreamGetBits(bs, 8);                  level = BitstreamGetBits(bs, 8);
1154    
1155                  if (level == 0 || level == 128)                  if (level == 0 || level == 128)
1156                          DPRINTF(XVID_DEBUG_ERROR, "Illegal LEVEL for ESCAPE mode 4: %d\n", level);                          DPRINTF(DPRINTF_ERROR, "Illegal LEVEL for ESCAPE mode 4: %d", level);
1157    
1158                  return (level << 24) >> 24;                  return (level << 24) >> 24;
1159          }          }
# Line 1211  Line 1209 
1209          do {          do {
1210                  level = get_coeff(bs, &run, &last, 1, 0);                  level = get_coeff(bs, &run, &last, 1, 0);
1211                  if (run == -1) {                  if (run == -1) {
1212                          DPRINTF(XVID_DEBUG_ERROR,"fatal: invalid run");                          DPRINTF(DPRINTF_ERROR,"fatal: invalid run");
1213                          break;                          break;
1214                  }                  }
1215                  coeff += run;                  coeff += run;
1216                  block[scan[coeff]] = level;                  block[scan[coeff]] = level;
1217    
1218                  DPRINTF(XVID_DEBUG_COEFF,"block[%i] %i\n", scan[coeff], level);                  DPRINTF(DPRINTF_COEFF,"block[%i] %i", scan[coeff], level);
1219  #if 0                  //DPRINTF(DPRINTF_COEFF,"block[%i] %i %08x", scan[coeff], level, BitstreamShowBits(bs, 32));
                 DPRINTF(XVID_DEBUG_COEFF,"block[%i] %i %08x\n", scan[coeff], level, BitstreamShowBits(bs, 32));  
 #endif  
1220    
1221                  if (level < -2047 || level > 2047) {                  if (level < -2047 || level > 2047) {
1222                          DPRINTF(XVID_DEBUG_ERROR,"warning: intra_overflow %i\n", level);                          DPRINTF(DPRINTF_ERROR,"warning: intra_overflow %i", level);
1223                  }                  }
1224                  coeff++;                  coeff++;
1225          } while (!last);          } while (!last);
# Line 1246  Line 1242 
1242          do {          do {
1243                  level = get_coeff(bs, &run, &last, 0, 0);                  level = get_coeff(bs, &run, &last, 0, 0);
1244                  if (run == -1) {                  if (run == -1) {
1245                          DPRINTF(XVID_DEBUG_ERROR,"fatal: invalid run");                          DPRINTF(DPRINTF_ERROR,"fatal: invalid run");
1246                          break;                          break;
1247                  }                  }
1248                  p += run;                  p += run;
1249    
1250                  block[scan[p]] = level;                  block[scan[p]] = level;
1251    
1252                  DPRINTF(XVID_DEBUG_COEFF,"block[%i] %i\n", scan[p], level);                  DPRINTF(DPRINTF_COEFF,"block[%i] %i", scan[p], level);
1253                  /* DPRINTF(XVID_DEBUG_COEFF,"block[%i] %i %08x\n", scan[p], level, BitstreamShowBits(bs, 32)); */                  // DPRINTF(DPRINTF_COEFF,"block[%i] %i %08x", scan[p], level, BitstreamShowBits(bs, 32));
1254    
1255                  if (level < -2047 || level > 2047) {                  if (level < -2047 || level > 2047) {
1256                          DPRINTF(XVID_DEBUG_ERROR,"warning: inter overflow %i\n", level);                          DPRINTF(DPRINTF_ERROR,"warning: inter overflow %i", level);
1257                  }                  }
1258                  p++;                  p++;
1259          } while (!last);          } while (!last);
1260    
1261  }  }
1262    
   
1263  /*****************************************************************************  /*****************************************************************************
1264   * VLC tables and other constant arrays   * VLC tables and other constant arrays
1265   ****************************************************************************/   ****************************************************************************/
# Line 1595  Line 1590 
1590  VLC sprite_trajectory_len[15] = {  VLC sprite_trajectory_len[15] = {
1591          { 0x00 , 2},          { 0x00 , 2},
1592          { 0x02 , 3}, { 0x03, 3}, { 0x04, 3}, { 0x05, 3}, { 0x06, 3},          { 0x02 , 3}, { 0x03, 3}, { 0x04, 3}, { 0x05, 3}, { 0x06, 3},
1593          { 0x0E , 4}, { 0x1E, 5}, { 0x3E, 6}, { 0x7E, 7}, { 0xFE, 8},          { 0x0E , 4}, { 0x1E, 5}, { 0x3E, 6}, { 0x7F, 7}, { 0xFE, 8},
1594          { 0x1FE, 9}, {0x3FE,10}, {0x7FE,11}, {0xFFE,12} };          { 0x1FE, 9}, {0x3FE,10}, {0x7FE,11}, {0xFFE,12} };
1595    
1596    

Legend:
Removed from v.1.44.2.15  
changed lines
  Added in v.1.45

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