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

Diff of /xvidcore/src/decoder.c

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

revision 1.49.2.7, Mon Jun 9 13:49:50 2003 UTC revision 1.49.2.10, Sat Aug 2 15:08:12 2003 UTC
# Line 54  Line 54 
54  #include "utils/timer.h"  #include "utils/timer.h"
55  #include "utils/emms.h"  #include "utils/emms.h"
56  #include "motion/motion.h"  #include "motion/motion.h"
57    #include "motion/gmc.h"
58    
59  #include "image/image.h"  #include "image/image.h"
60  #include "image/colorspace.h"  #include "image/colorspace.h"
# Line 168  Line 169 
169  {  {
170          DECODER *dec;          DECODER *dec;
171    
172          if (XVID_MAJOR(create->version) != 1)   /* v1.x.x */          if (XVID_VERSION_MAJOR(create->version) != 1)   /* v1.x.x */
173                  return XVID_ERR_VERSION;                  return XVID_ERR_VERSION;
174    
175          dec = xvid_malloc(sizeof(DECODER), CACHE_LINE);          dec = xvid_malloc(sizeof(DECODER), CACHE_LINE);
# Line 583  Line 584 
584          stop_transfer_timer();          stop_transfer_timer();
585  }  }
586    
 static __inline int gmc_sanitize(int value, int quarterpel, int fcode)  
 {  
         int length = 1 << (fcode+4);  
   
 /*      if (quarterpel) value *= 2; */  
   
         if (value < -length)  
                 return -length;  
         else if (value >= length)  
                 return length-1;  
         else return value;  
 }  
   
587    
588  static void  static void
589  decoder_mbgmc(DECODER * dec,  decoder_mbgmc(DECODER * dec,
# Line 628  Line 616 
616    
617  /* this is where the calculations are done */  /* this is where the calculations are done */
618    
619          {          {       NEW_GMC_DATA * gmc_data = &dec->new_gmc_data;
620                  pMB->amv = generate_GMCimageMB(&dec->gmc_data, &dec->refn[0], x_pos, y_pos,  
621                                          stride, stride2, dec->quarterpel, rounding, &dec->cur);                          gmc_data->predict_16x16(gmc_data,
622                                            dec->cur.y + y_pos*16*stride + x_pos*16, dec->refn[0].y,
623                                            stride, stride, x_pos, y_pos, rounding);
624    
625                            gmc_data->predict_8x8(gmc_data,
626                                            dec->cur.u + y_pos*8*stride2 + x_pos*8, dec->refn[0].u,
627                                            dec->cur.v + y_pos*8*stride2 + x_pos*8, dec->refn[0].v,
628                                            stride2, stride2, x_pos, y_pos, rounding);
629    
630                            gmc_data->get_average_mv(gmc_data, &pMB->amv, x_pos, y_pos, dec->quarterpel);
631    
632                  pMB->amv.x = gmc_sanitize(pMB->amv.x, dec->quarterpel, fcode);                  pMB->amv.x = gmc_sanitize(pMB->amv.x, dec->quarterpel, fcode);
633                  pMB->amv.y = gmc_sanitize(pMB->amv.y, dec->quarterpel, fcode);                  pMB->amv.y = gmc_sanitize(pMB->amv.y, dec->quarterpel, fcode);
# Line 861  Line 858 
858          {          {
859    
860                  /* accuracy:  0==1/2, 1=1/4, 2=1/8, 3=1/16 */                  /* accuracy:  0==1/2, 1=1/4, 2=1/8, 3=1/16 */
861                  if ( (dec->sprite_warping_accuracy != 3) || (dec->sprite_warping_points != 2) )  /*              {
862                  {                          fprintf(stderr,"GMC parameters acc=%d(-> 1/%d), %d pts!!!\n",
                         fprintf(stderr,"Wrong GMC parameters acc=%d(-> 1/%d), %d!!!\n",  
863                                  dec->sprite_warping_accuracy,(2<<dec->sprite_warping_accuracy),                                  dec->sprite_warping_accuracy,(2<<dec->sprite_warping_accuracy),
864                                  dec->sprite_warping_points);                                  dec->sprite_warping_points);
865                  }                  }*/
866    
867                  generate_GMCparameters( dec->sprite_warping_points,                  generate_GMCparameters( dec->sprite_warping_points,
868                                  (2 << dec->sprite_warping_accuracy), gmc_warp,                                  dec->sprite_warping_accuracy, gmc_warp,
869                                  dec->width, dec->height, &dec->gmc_data);                                  dec->width, dec->height, &dec->new_gmc_data);
870    
871  /* image warping is done block-based  in decoder_mbgmc(), now */  /* image warping is done block-based  in decoder_mbgmc(), now */
 /*  
         generate_GMCimage(&dec->gmc_data, &dec->refn[0],  
                                         mb_width, mb_height,  
                                         dec->edged_width, dec->edged_width/2,  
                                         fcode, dec->quarterpel, 0,  
                                         rounding, dec->mbs, &dec->gmc);  
 */  
872          }          }
873    
874          bound = 0;          bound = 0;
# Line 1742  Line 1731 
1731          WARPPOINTS gmc_warp;          WARPPOINTS gmc_warp;
1732          int coding_type;          int coding_type;
1733          int success, output, seen_something;          int success, output, seen_something;
1734            idctFuncPtr idct_save;
1735    
1736          if (XVID_MAJOR(frame->version) != 1 || (stats && XVID_MAJOR(stats->version) != 1))      /* v1.x.x */          if (XVID_VERSION_MAJOR(frame->version) != 1 || (stats && XVID_VERSION_MAJOR(stats->version) != 1))      /* v1.x.x */
1737                  return XVID_ERR_VERSION;                  return XVID_ERR_VERSION;
1738    
1739          start_global_timer();          start_global_timer();
# Line 1787  Line 1777 
1777          success = 0;          success = 0;
1778          output = 0;          output = 0;
1779          seen_something = 0;          seen_something = 0;
1780            idct_save = idct;
1781    
1782  repeat:  repeat:
1783    
# Line 1828  Line 1819 
1819    
1820          dec->p_bmv.x = dec->p_bmv.y = dec->p_fmv.y = dec->p_fmv.y = 0;  /* init pred vector to 0 */          dec->p_bmv.x = dec->p_bmv.y = dec->p_fmv.y = dec->p_fmv.y = 0;  /* init pred vector to 0 */
1821    
1822    #if defined(ARCH_IS_IA32)
1823            /*
1824             * /!\ Ugly hack /!\
1825             * IA32: Prior to xvid bitstream 10, we were using Walten's mmx/xmm idct
1826             */
1827            if((idct == simple_idct_mmx) && (dec->bs_version < 10))
1828                    idct = idct_mmx;
1829    #endif
1830    
1831          /* packed_mode: special-N_VOP treament */          /* packed_mode: special-N_VOP treament */
1832          if (dec->packed_mode && coding_type == N_VOP)          if (dec->packed_mode && coding_type == N_VOP)
# Line 1957  Line 1956 
1956          emms();          emms();
1957          stop_global_timer();          stop_global_timer();
1958    
1959            idct = idct_save;
1960    
1961          return BitstreamPos(&bs) / 8;   /* number of bytes consumed */          return BitstreamPos(&bs) / 8;   /* number of bytes consumed */
1962  }  }

Legend:
Removed from v.1.49.2.7  
changed lines
  Added in v.1.49.2.10

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