[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.21, Sat Jun 22 07:23:09 2002 UTC revision 1.22, Fri Jun 28 15:14:40 2002 UTC
# Line 32  Line 32 
32   *   *
33   *  History:   *  History:
34   *   *
35     *  28.06.2002  added basic resync support to iframe/pframe_decode()
36   *      22.06.2002      added primative N_VOP support   *      22.06.2002      added primative N_VOP support
37   *                              #define BFRAMES_DEC now enables Minchenm's bframe decoder   *                              #define BFRAMES_DEC now enables Minchenm's bframe decoder
38   *  08.05.2002  add low_delay support for B_VOP decode   *  08.05.2002  add low_delay support for B_VOP decode
# Line 203  Line 204 
204                                  const uint32_t cbp,                                  const uint32_t cbp,
205                                  Bitstream * bs,                                  Bitstream * bs,
206                                  const uint32_t quant,                                  const uint32_t quant,
207                                  const uint32_t intra_dc_threshold)                                  const uint32_t intra_dc_threshold,
208                                    const unsigned int bound_x,
209                                    const unsigned int bound_y)
210  {  {
211    
212          DECLARE_ALIGNED_MATRIX(block, 6, 64, int16_t, CACHE_LINE);          DECLARE_ALIGNED_MATRIX(block, 6, 64, int16_t, CACHE_LINE);
# Line 229  Line 232 
232    
233                  start_timer();                  start_timer();
234                  predict_acdc(dec->mbs, x_pos, y_pos, dec->mb_width, i, &block[i * 64],                  predict_acdc(dec->mbs, x_pos, y_pos, dec->mb_width, i, &block[i * 64],
235                                           iQuant, iDcScaler, predictors);                                           iQuant, iDcScaler, predictors, bound_x, bound_y);
236                  if (!acpred_flag) {                  if (!acpred_flag) {
237                          pMB->acpred_directions[i] = 0;                          pMB->acpred_directions[i] = 0;
238                  }                  }
# Line 422  Line 425 
425                             int quant,                             int quant,
426                             int intra_dc_threshold)                             int intra_dc_threshold)
427  {  {
428            uint32_t bound_x, bound_y;
429          uint32_t x, y;          uint32_t x, y;
430    
431            bound_x = bound_y = 0;
432    
433          for (y = 0; y < dec->mb_height; y++) {          for (y = 0; y < dec->mb_height; y++) {
434                  for (x = 0; x < dec->mb_width; x++) {                  for (x = 0; x < dec->mb_width; x++) {
435                          MACROBLOCK *mb = &dec->mbs[y * dec->mb_width + x];                          MACROBLOCK *mb;
436    
437                          uint32_t mcbpc;                          uint32_t mcbpc;
438                          uint32_t cbpc;                          uint32_t cbpc;
# Line 435  Line 440 
440                          uint32_t cbpy;                          uint32_t cbpy;
441                          uint32_t cbp;                          uint32_t cbp;
442    
443                            skip_stuffing(bs);
444                            if (check_resync_marker(bs, 0))
445                            {
446                                    int mbnum = read_video_packet_header(bs, 0);
447                                    x = bound_x = mbnum % dec->mb_width;
448                                    y = bound_y = mbnum / dec->mb_width;
449                            }
450    
451                            mb = &dec->mbs[y * dec->mb_width + x];
452    
453                          mcbpc = get_mcbpc_intra(bs);                          mcbpc = get_mcbpc_intra(bs);
454                          mb->mode = mcbpc & 7;                          mb->mode = mcbpc & 7;
455                          cbpc = (mcbpc >> 4);                          cbpc = (mcbpc >> 4);
456    
457                          acpred_flag = BitstreamGetBit(bs);                          acpred_flag = BitstreamGetBit(bs);
458    
                         if (mb->mode == MODE_STUFFING) {  
                                 DEBUG("-- STUFFING ?");  
                                 continue;  
                         }  
   
459                          cbpy = get_cbpy(bs, 1);                          cbpy = get_cbpy(bs, 1);
460                          cbp = (cbpy << 2) | cbpc;                          cbp = (cbpy << 2) | cbpc;
461    
# Line 465  Line 475 
475                          }                          }
476    
477                          decoder_mbintra(dec, mb, x, y, acpred_flag, cbp, bs, quant,                          decoder_mbintra(dec, mb, x, y, acpred_flag, cbp, bs, quant,
478                                                          intra_dc_threshold);                                                          intra_dc_threshold, bound_x, bound_y);
479                  }                  }
480          }          }
481    
# Line 479  Line 489 
489                                    int y,                                    int y,
490                                    int k,                                    int k,
491                                    VECTOR * mv,                                    VECTOR * mv,
492                                    int fcode)                                    int fcode,
493                                      const int bound_x,
494                                      const int bound_y)
495  {  {
496    
497          int scale_fac = 1 << (fcode - 1);          int scale_fac = 1 << (fcode - 1);
# Line 494  Line 506 
506          int pmv_x, pmv_y;          int pmv_x, pmv_y;
507    
508    
509          get_pmvdata(dec->mbs, x, y, dec->mb_width, k, pmv, psad);          get_pmvdata(dec->mbs, x, y, dec->mb_width, k, pmv, psad, bound_x, bound_y);
510    
511          pmv_x = pmv[0].x;          pmv_x = pmv[0].x;
512          pmv_y = pmv[0].y;          pmv_y = pmv[0].y;
# Line 533  Line 545 
545  {  {
546    
547          uint32_t x, y;          uint32_t x, y;
548            uint32_t bound_x, bound_y;
549    
550          start_timer();          start_timer();
551          image_setedges(&dec->refn[0], dec->edged_width, dec->edged_height,          image_setedges(&dec->refn[0], dec->edged_width, dec->edged_height,
552                                     dec->width, dec->height, dec->interlacing);                                     dec->width, dec->height, dec->interlacing);
553          stop_edges_timer();          stop_edges_timer();
554    
555            bound_x = bound_y = 0;
556    
557          for (y = 0; y < dec->mb_height; y++) {          for (y = 0; y < dec->mb_height; y++) {
558                  for (x = 0; x < dec->mb_width; x++) {                  for (x = 0; x < dec->mb_width; x++) {
559                          MACROBLOCK *mb = &dec->mbs[y * dec->mb_width + x];                          MACROBLOCK *mb;
560    
561                            skip_stuffing(bs);
562                            if (check_resync_marker(bs, 0))
563                            {
564                                    int mbnum = read_video_packet_header(bs, 0);
565                                    x = bound_x = mbnum % dec->mb_width;
566                                    y = bound_y = mbnum / dec->mb_width;
567                            }
568                            mb = &dec->mbs[y * dec->mb_width + x];
569    
570                          //if (!(dec->mb_skip[y*dec->mb_width + x]=BitstreamGetBit(bs)))         // not_coded                          //if (!(dec->mb_skip[y*dec->mb_width + x]=BitstreamGetBit(bs)))         // not_coded
571                          if (!(BitstreamGetBit(bs)))     // not_coded                          if (!(BitstreamGetBit(bs)))     // not_coded
# Line 564  Line 588 
588                                          acpred_flag = BitstreamGetBit(bs);                                          acpred_flag = BitstreamGetBit(bs);
589                                  }                                  }
590    
                                 if (mb->mode == MODE_STUFFING) {  
                                         DEBUG("-- STUFFING ?");  
                                         continue;  
                                 }  
   
591                                  cbpy = get_cbpy(bs, intra);                                  cbpy = get_cbpy(bs, intra);
592                                  cbp = (cbpy << 2) | cbpc;                                  cbp = (cbpy << 2) | cbpc;
593    
# Line 602  Line 621 
621                                  if (mb->mode == MODE_INTER || mb->mode == MODE_INTER_Q) {                                  if (mb->mode == MODE_INTER || mb->mode == MODE_INTER_Q) {
622                                          if (dec->interlacing && mb->field_pred) {                                          if (dec->interlacing && mb->field_pred) {
623                                                  get_motion_vector(dec, bs, x, y, 0, &mb->mvs[0],                                                  get_motion_vector(dec, bs, x, y, 0, &mb->mvs[0],
624                                                                                    fcode);                                                                                    fcode, bound_x, bound_y);
625                                                  get_motion_vector(dec, bs, x, y, 0, &mb->mvs[1],                                                  get_motion_vector(dec, bs, x, y, 0, &mb->mvs[1],
626                                                                                    fcode);                                                                                    fcode, bound_x, bound_y);
627                                          } else {                                          } else {
628                                                  get_motion_vector(dec, bs, x, y, 0, &mb->mvs[0],                                                  get_motion_vector(dec, bs, x, y, 0, &mb->mvs[0],
629                                                                                    fcode);                                                                                    fcode, bound_x, bound_y);
630                                                  mb->mvs[1].x = mb->mvs[2].x = mb->mvs[3].x =                                                  mb->mvs[1].x = mb->mvs[2].x = mb->mvs[3].x =
631                                                          mb->mvs[0].x;                                                          mb->mvs[0].x;
632                                                  mb->mvs[1].y = mb->mvs[2].y = mb->mvs[3].y =                                                  mb->mvs[1].y = mb->mvs[2].y = mb->mvs[3].y =
# Line 615  Line 634 
634                                          }                                          }
635                                  } else if (mb->mode ==                                  } else if (mb->mode ==
636                                                     MODE_INTER4V /* || mb->mode == MODE_INTER4V_Q */ ) {                                                     MODE_INTER4V /* || mb->mode == MODE_INTER4V_Q */ ) {
637                                          get_motion_vector(dec, bs, x, y, 0, &mb->mvs[0], fcode);                                          get_motion_vector(dec, bs, x, y, 0, &mb->mvs[0], fcode, bound_x, bound_y);
638                                          get_motion_vector(dec, bs, x, y, 1, &mb->mvs[1], fcode);                                          get_motion_vector(dec, bs, x, y, 1, &mb->mvs[1], fcode, bound_x, bound_y);
639                                          get_motion_vector(dec, bs, x, y, 2, &mb->mvs[2], fcode);                                          get_motion_vector(dec, bs, x, y, 2, &mb->mvs[2], fcode, bound_x, bound_y);
640                                          get_motion_vector(dec, bs, x, y, 3, &mb->mvs[3], fcode);                                          get_motion_vector(dec, bs, x, y, 3, &mb->mvs[3], fcode, bound_x, bound_y);
641                                  } else                  // MODE_INTRA, MODE_INTRA_Q                                  } else                  // MODE_INTRA, MODE_INTRA_Q
642                                  {                                  {
643                                          mb->mvs[0].x = mb->mvs[1].x = mb->mvs[2].x = mb->mvs[3].x =                                          mb->mvs[0].x = mb->mvs[1].x = mb->mvs[2].x = mb->mvs[3].x =
# Line 626  Line 645 
645                                          mb->mvs[0].y = mb->mvs[1].y = mb->mvs[2].y = mb->mvs[3].y =                                          mb->mvs[0].y = mb->mvs[1].y = mb->mvs[2].y = mb->mvs[3].y =
646                                                  0;                                                  0;
647                                          decoder_mbintra(dec, mb, x, y, acpred_flag, cbp, bs, quant,                                          decoder_mbintra(dec, mb, x, y, acpred_flag, cbp, bs, quant,
648                                                                          intra_dc_threshold);                                                                          intra_dc_threshold, bound_x, bound_y);
649                                          continue;                                          continue;
650                                  }                                  }
651    

Legend:
Removed from v.1.21  
changed lines
  Added in v.1.22

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