[svn] / branches / dev-api-3 / xvidcore / src / decoder.c Repository:
ViewVC logotype

Diff of /branches/dev-api-3/xvidcore/src/decoder.c

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

revision 773, Sat Jan 11 20:37:46 2003 UTC revision 774, Sat Jan 11 21:22:24 2003 UTC
# Line 55  Line 55 
55   *  22.12.2001  lock based interpolation   *  22.12.2001  lock based interpolation
56   *  01.12.2001  inital version; (c)2001 peter ross <pross@cs.rmit.edu.au>   *  01.12.2001  inital version; (c)2001 peter ross <pross@cs.rmit.edu.au>
57   *   *
58   *  $Id: decoder.c,v 1.37.2.28 2003-01-11 20:37:46 chl Exp $   *  $Id: decoder.c,v 1.37.2.29 2003-01-11 21:22:24 chl Exp $
59   *   *
60   *************************************************************************/   *************************************************************************/
61    
# 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    
679    /*      transfer16x16_copy(pY_Cur, dec->gmc.y + (y_pos << 4)*stride + (x_pos  << 4), stride);
680          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);
681          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);
682    */
683    
684    
685          stop_transfer_timer();          stop_transfer_timer();
686    
687          if (!cbp) return;          if (!cbp) return;
# Line 834  Line 863 
863    
864    
865    
 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;  
 }  
866    
867    
868  /* for P_VOP set gmc_warp to NULL */  /* for P_VOP set gmc_warp to NULL */
# Line 866  Line 883 
883          uint32_t mb_width = dec->mb_width;          uint32_t mb_width = dec->mb_width;
884          uint32_t mb_height = dec->mb_height;          uint32_t mb_height = dec->mb_height;
885    
         static int framecount=0;  
886          if (reduced_resolution)          if (reduced_resolution)
887          {          {
888                  mb_width = (dec->width + 31) / 32;                  mb_width = (dec->width + 31) / 32;
# Line 893  Line 909 
909                                  (2 << dec->sprite_warping_accuracy), gmc_warp,                                  (2 << dec->sprite_warping_accuracy), gmc_warp,
910                                  dec->width, dec->height, &dec->gmc_data);                                  dec->width, dec->height, &dec->gmc_data);
911    
912    /* image warping is done block-based  in decoder_mbgmc(), now */
913    /*
914                  generate_GMCimage(&dec->gmc_data, &dec->refn[0],                  generate_GMCimage(&dec->gmc_data, &dec->refn[0],
915                                          mb_width, mb_height,                                          mb_width, mb_height,
916                                          dec->edged_width, dec->edged_width/2,                                          dec->edged_width, dec->edged_width/2,
917                                          fcode, dec->quarterpel, 0,                                          fcode, dec->quarterpel, 0,
918                                          rounding, dec->mbs, &dec->gmc);                                          rounding, dec->mbs, &dec->gmc);
919    */
920          }          }
921    
922          bound = 0;          bound = 0;
# Line 992  Line 1010 
1010                                  }                                  }
1011    
1012                                  if (mcsel) {                                  if (mcsel) {
1013                                          decoder_mbgmc(dec, mb, x, y, 0, cbp, bs, quant,                                          decoder_mbgmc(dec, mb, x, y, fcode, cbp, bs, quant,
1014                                                                  rounding, reduced_resolution);                                                                  rounding, reduced_resolution);
1015                                          continue;                                          continue;
1016    
# Line 1025  Line 1043 
1043                                          continue;                                          continue;
1044                                  }                                  }
1045    
1046                                  decoder_mbinter(dec, mb, x, y, 0, cbp, bs, quant,                                  decoder_mbinter(dec, mb, x, y, fcode, cbp, bs, quant,
1047                                                                  rounding, reduced_resolution);                                                                  rounding, reduced_resolution);
1048    
1049                          }                          }
# Line 1035  Line 1053 
1053    
1054                                  start_timer();                                  start_timer();
1055    
1056                                  decoder_mbgmc(dec, mb, x, y, 0, 0x00, bs, quant,                                  decoder_mbgmc(dec, mb, x, y, fcode, 0x00, bs, quant,
1057                                                                  rounding, reduced_resolution);                                                                  rounding, reduced_resolution);
1058    
1059                                  stop_transfer_timer();                                  stop_transfer_timer();

Legend:
Removed from v.773  
changed lines
  Added in v.774

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