[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.37.2.28, Sat Jan 11 20:37:46 2003 UTC revision 1.37.2.30, Sun Jan 12 13:11:50 2003 UTC
# Line 412  Line 412 
412                                  const MACROBLOCK * pMB,                                  const MACROBLOCK * pMB,
413                                  const uint32_t x_pos,                                  const uint32_t x_pos,
414                                  const uint32_t y_pos,                                  const uint32_t y_pos,
415                                  const uint32_t acpred_flag,                                  const uint32_t fcode,
416                                  const uint32_t cbp,                                  const uint32_t cbp,
417                                  Bitstream * bs,                                  Bitstream * bs,
418                                  const uint32_t quant,                                  const uint32_t quant,
# Line 621  Line 621 
621          stop_transfer_timer();          stop_transfer_timer();
622  }  }
623    
624    static __inline int gmc_sanitize(int value, int quarterpel, int fcode)
625    {
626            int length = 1 << (fcode+4);
627    
628    //      if (quarterpel) value *= 2;
629    
630            if (value < -length)
631                    return -length;
632            else if (value >= length)
633                    return length-1;
634            else return value;
635    }
636    
637    
638  static void  static void
639  decoder_mbgmc(DECODER * dec,  decoder_mbgmc(DECODER * dec,
640                                  MACROBLOCK * const pMB,                                  MACROBLOCK * const pMB,
641                                  const uint32_t x_pos,                                  const uint32_t x_pos,
642                                  const uint32_t y_pos,                                  const uint32_t y_pos,
643                                  const uint32_t acpred_flag,                                  const uint32_t fcode,
644                                  const uint32_t cbp,                                  const uint32_t cbp,
645                                  Bitstream * bs,                                  Bitstream * bs,
646                                  const uint32_t quant,                                  const uint32_t quant,
# Line 650  Line 663 
663          pMB->mvs[0] = pMB->mvs[1] = pMB->mvs[2] = pMB->mvs[3] = pMB->amv;          pMB->mvs[0] = pMB->mvs[1] = pMB->mvs[2] = pMB->mvs[3] = pMB->amv;
664    
665          start_timer();          start_timer();
666          transfer16x16_copy(pY_Cur, dec->gmc.y + (y_pos << 4)*stride + (x_pos  << 4), stride);  
667    /* this is where the calculations are done */
668    
669            {
670                    pMB->amv = generate_GMCimageMB(&dec->gmc_data, &dec->refn[0], x_pos, y_pos,
671                                            stride, stride2, dec->quarterpel, rounding, &dec->cur);
672    
673                    pMB->amv.x = gmc_sanitize(pMB->amv.x, dec->quarterpel, fcode);
674                    pMB->amv.y = gmc_sanitize(pMB->amv.y, dec->quarterpel, fcode);
675            }
676            pMB->mvs[0] = pMB->mvs[1] = pMB->mvs[2] = pMB->mvs[3] = pMB->amv;
677    
678    /*      transfer16x16_copy(pY_Cur, dec->gmc.y + (y_pos << 4)*stride + (x_pos  << 4), stride);
679          transfer8x8_copy(pU_Cur, dec->gmc.u + (y_pos << 3)*stride2 + (x_pos  << 3), stride2);          transfer8x8_copy(pU_Cur, dec->gmc.u + (y_pos << 3)*stride2 + (x_pos  << 3), stride2);
680          transfer8x8_copy(pV_Cur, dec->gmc.v + (y_pos << 3)*stride2 + (x_pos << 3), stride2);          transfer8x8_copy(pV_Cur, dec->gmc.v + (y_pos << 3)*stride2 + (x_pos << 3), stride2);
681    */
682    
683    
684          stop_transfer_timer();          stop_transfer_timer();
685    
686          if (!cbp) return;          if (!cbp) return;
# Line 834  Line 862 
862    
863    
864    
 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;  
 }  
865    
866    
867  /* for P_VOP set gmc_warp to NULL */  /* for P_VOP set gmc_warp to NULL */
# Line 866  Line 882 
882          uint32_t mb_width = dec->mb_width;          uint32_t mb_width = dec->mb_width;
883          uint32_t mb_height = dec->mb_height;          uint32_t mb_height = dec->mb_height;
884    
         static int framecount=0;  
885          if (reduced_resolution)          if (reduced_resolution)
886          {          {
887                  mb_width = (dec->width + 31) / 32;                  mb_width = (dec->width + 31) / 32;
# Line 893  Line 908 
908                                  (2 << dec->sprite_warping_accuracy), gmc_warp,                                  (2 << dec->sprite_warping_accuracy), gmc_warp,
909                                  dec->width, dec->height, &dec->gmc_data);                                  dec->width, dec->height, &dec->gmc_data);
910    
911    /* image warping is done block-based  in decoder_mbgmc(), now */
912    /*
913                  generate_GMCimage(&dec->gmc_data, &dec->refn[0],                  generate_GMCimage(&dec->gmc_data, &dec->refn[0],
914                                          mb_width, mb_height,                                          mb_width, mb_height,
915                                          dec->edged_width, dec->edged_width/2,                                          dec->edged_width, dec->edged_width/2,
916                                          fcode, dec->quarterpel, 0,                                          fcode, dec->quarterpel, 0,
917                                          rounding, dec->mbs, &dec->gmc);                                          rounding, dec->mbs, &dec->gmc);
918    */
919          }          }
920    
921          bound = 0;          bound = 0;
# Line 992  Line 1009 
1009                                  }                                  }
1010    
1011                                  if (mcsel) {                                  if (mcsel) {
1012                                          decoder_mbgmc(dec, mb, x, y, 0, cbp, bs, quant,                                          decoder_mbgmc(dec, mb, x, y, fcode, cbp, bs, quant,
1013                                                                  rounding, reduced_resolution);                                                                  rounding, reduced_resolution);
1014                                          continue;                                          continue;
1015    
# Line 1025  Line 1042 
1042                                          continue;                                          continue;
1043                                  }                                  }
1044    
1045                                  decoder_mbinter(dec, mb, x, y, 0, cbp, bs, quant,                                  decoder_mbinter(dec, mb, x, y, fcode, cbp, bs, quant,
1046                                                                  rounding, reduced_resolution);                                                                  rounding, reduced_resolution);
1047    
1048                          }                          }
# Line 1035  Line 1052 
1052    
1053                                  start_timer();                                  start_timer();
1054    
1055                                  decoder_mbgmc(dec, mb, x, y, 0, 0x00, bs, quant,                                  decoder_mbgmc(dec, mb, x, y, fcode, 0x00, bs, quant,
1056                                                                  rounding, reduced_resolution);                                                                  rounding, reduced_resolution);
1057    
1058                                  stop_transfer_timer();                                  stop_transfer_timer();

Legend:
Removed from v.1.37.2.28  
changed lines
  Added in v.1.37.2.30

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