[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.32, Fri Jul 19 11:15:21 2002 UTC revision 1.37.2.1, Thu Sep 26 01:54:54 2002 UTC
# Line 268  Line 268 
268                  start_timer();                  start_timer();
269                  if (cbp & (1 << (5 - i)))       // coded                  if (cbp & (1 << (5 - i)))       // coded
270                  {                  {
271                          get_intra_block(bs, &block[i * 64], pMB->acpred_directions[i],                          int direction = dec->alternate_vertical_scan ?
272                                                          start_coeff);                                  2 : pMB->acpred_directions[i];
273    
274                            get_intra_block(bs, &block[i * 64], direction, start_coeff);
275                  }                  }
276                  stop_coding_timer();                  stop_coding_timer();
277    
# Line 348  Line 350 
350                  uv_dx = pMB->mvs[0].x;                  uv_dx = pMB->mvs[0].x;
351                  uv_dy = pMB->mvs[0].y;                  uv_dy = pMB->mvs[0].y;
352    
353                    if (dec->quarterpel)
354                    {
355                            uv_dx = (uv_dx >> 1) | (uv_dx & 1);
356                            uv_dy = (uv_dy >> 1) | (uv_dy & 1);
357                    }
358    
359                  uv_dx = (uv_dx & 3) ? (uv_dx >> 1) | 1 : uv_dx / 2;                  uv_dx = (uv_dx & 3) ? (uv_dx >> 1) | 1 : uv_dx / 2;
360                  uv_dy = (uv_dy & 3) ? (uv_dy >> 1) | 1 : uv_dy / 2;                  uv_dy = (uv_dy & 3) ? (uv_dy >> 1) | 1 : uv_dy / 2;
361          } else {          } else {
362                  int sum;                  int sum;
   
363                  sum = pMB->mvs[0].x + pMB->mvs[1].x + pMB->mvs[2].x + pMB->mvs[3].x;                  sum = pMB->mvs[0].x + pMB->mvs[1].x + pMB->mvs[2].x + pMB->mvs[3].x;
364                  uv_dx =  
365                          (sum ==                  if (dec->quarterpel)
366                           0 ? 0 : SIGN(sum) * (roundtab[ABS(sum) % 16] +                  {
367                                                                    (ABS(sum) / 16) * 2));                          sum /= 2;
368                    }
369    
370                    uv_dx = (sum == 0 ? 0 : SIGN(sum) * (roundtab[ABS(sum) % 16] + (ABS(sum) / 16) * 2));
371    
372                  sum = pMB->mvs[0].y + pMB->mvs[1].y + pMB->mvs[2].y + pMB->mvs[3].y;                  sum = pMB->mvs[0].y + pMB->mvs[1].y + pMB->mvs[2].y + pMB->mvs[3].y;
373                  uv_dy =  
374                          (sum ==                  if (dec->quarterpel)
375                           0 ? 0 : SIGN(sum) * (roundtab[ABS(sum) % 16] +                  {
376                                                                    (ABS(sum) / 16) * 2));                          sum /= 2;
377                    }
378    
379                    uv_dy = (sum == 0 ? 0 : SIGN(sum) * (roundtab[ABS(sum) % 16] + (ABS(sum) / 16) * 2));
380          }          }
381    
382          start_timer();          start_timer();
383            if(dec->quarterpel) {
384                    DEBUG("QUARTERPEL");
385                    interpolate8x8_quarterpel(dec->cur.y, dec->refn[0].y, 16*x_pos, 16*y_pos,
386                                                                      pMB->mvs[0].x, pMB->mvs[0].y, stride,  rounding);
387                    interpolate8x8_quarterpel(dec->cur.y, dec->refn[0].y, 16*x_pos + 8, 16*y_pos,
388                                                                      pMB->mvs[1].x, pMB->mvs[1].y, stride,  rounding);
389                    interpolate8x8_quarterpel(dec->cur.y, dec->refn[0].y, 16*x_pos, 16*y_pos + 8,
390                                                                      pMB->mvs[2].x, pMB->mvs[2].y, stride,  rounding);
391                    interpolate8x8_quarterpel(dec->cur.y, dec->refn[0].y, 16*x_pos + 8, 16*y_pos + 8,
392                                                                      pMB->mvs[3].x, pMB->mvs[3].y, stride,  rounding);
393            }
394            else {
395          interpolate8x8_switch(dec->cur.y, dec->refn[0].y, 16 * x_pos, 16 * y_pos,          interpolate8x8_switch(dec->cur.y, dec->refn[0].y, 16 * x_pos, 16 * y_pos,
396                                                    pMB->mvs[0].x, pMB->mvs[0].y, stride, rounding);                                                    pMB->mvs[0].x, pMB->mvs[0].y, stride, rounding);
397          interpolate8x8_switch(dec->cur.y, dec->refn[0].y, 16 * x_pos + 8,                  interpolate8x8_switch(dec->cur.y, dec->refn[0].y, 16*x_pos + 8, 16*y_pos,
398                                                    16 * y_pos, pMB->mvs[1].x, pMB->mvs[1].y, stride,                                                            pMB->mvs[1].x, pMB->mvs[1].y, stride,  rounding);
399                                                    rounding);                  interpolate8x8_switch(dec->cur.y, dec->refn[0].y, 16*x_pos, 16*y_pos + 8,
400          interpolate8x8_switch(dec->cur.y, dec->refn[0].y, 16 * x_pos,                                                            pMB->mvs[2].x, pMB->mvs[2].y, stride,  rounding);
401                                                    16 * y_pos + 8, pMB->mvs[2].x, pMB->mvs[2].y, stride,                  interpolate8x8_switch(dec->cur.y, dec->refn[0].y, 16*x_pos + 8, 16*y_pos + 8,
402                                                    rounding);                                                            pMB->mvs[3].x, pMB->mvs[3].y, stride,  rounding);
403          interpolate8x8_switch(dec->cur.y, dec->refn[0].y, 16 * x_pos + 8,          }
404                                                    16 * y_pos + 8, pMB->mvs[3].x, pMB->mvs[3].y, stride,  
                                                   rounding);  
405          interpolate8x8_switch(dec->cur.u, dec->refn[0].u, 8 * x_pos, 8 * y_pos,          interpolate8x8_switch(dec->cur.u, dec->refn[0].u, 8 * x_pos, 8 * y_pos,
406                                                    uv_dx, uv_dy, stride2, rounding);                                                    uv_dx, uv_dy, stride2, rounding);
407          interpolate8x8_switch(dec->cur.v, dec->refn[0].v, 8 * x_pos, 8 * y_pos,          interpolate8x8_switch(dec->cur.v, dec->refn[0].v, 8 * x_pos, 8 * y_pos,
# Line 385  Line 409 
409          stop_comp_timer();          stop_comp_timer();
410    
411          for (i = 0; i < 6; i++) {          for (i = 0; i < 6; i++) {
412                    int direction = dec->alternate_vertical_scan ? 2 : 0;
413    
414                  if (cbp & (1 << (5 - i)))       // coded                  if (cbp & (1 << (5 - i)))       // coded
415                  {                  {
416                          memset(&block[i * 64], 0, 64 * sizeof(int16_t));        // clear                          memset(&block[i * 64], 0, 64 * sizeof(int16_t));        // clear
417    
418                          start_timer();                          start_timer();
419                          get_inter_block(bs, &block[i * 64]);                          get_inter_block(bs, &block[i * 64], direction);
420                          stop_coding_timer();                          stop_coding_timer();
421    
422                          start_timer();                          start_timer();
# Line 563  Line 589 
589    
590          start_timer();          start_timer();
591          image_setedges(&dec->refn[0], dec->edged_width, dec->edged_height,          image_setedges(&dec->refn[0], dec->edged_width, dec->edged_height,
592                                     dec->width, dec->height, dec->interlacing);                                     dec->width, dec->height);
593          stop_edges_timer();          stop_edges_timer();
594    
595          bound = 0;          bound = 0;
# Line 631  Line 657 
657                                  mb->quant = quant;                                  mb->quant = quant;
658    
659                                  if (dec->interlacing) {                                  if (dec->interlacing) {
660                                            if (cbp || intra) {
661                                          mb->field_dct = BitstreamGetBit(bs);                                          mb->field_dct = BitstreamGetBit(bs);
662                                          DEBUG1("decp: field_dct: ", mb->field_dct);                                          DEBUG1("decp: field_dct: ", mb->field_dct);
663                                            }
664    
665                                          if (mb->mode == MODE_INTER || mb->mode == MODE_INTER_Q) {                                          if (mb->mode == MODE_INTER || mb->mode == MODE_INTER_Q) {
666                                                  mb->field_pred = BitstreamGetBit(bs);                                                  mb->field_pred = BitstreamGetBit(bs);
# Line 661  Line 689 
689                                                  mb->mvs[1].y = mb->mvs[2].y = mb->mvs[3].y =                                                  mb->mvs[1].y = mb->mvs[2].y = mb->mvs[3].y =
690                                                          mb->mvs[0].y;                                                          mb->mvs[0].y;
691                                          }                                          }
692                                  } else if (mb->mode ==                                  } else if (mb->mode == MODE_INTER4V ) {
693                                                     MODE_INTER4V /* || mb->mode == MODE_INTER4V_Q */ ) {  
694                                          get_motion_vector(dec, bs, x, y, 0, &mb->mvs[0], fcode, bound);                                          get_motion_vector(dec, bs, x, y, 0, &mb->mvs[0], fcode, bound);
695                                          get_motion_vector(dec, bs, x, y, 1, &mb->mvs[1], fcode, bound);                                          get_motion_vector(dec, bs, x, y, 1, &mb->mvs[1], fcode, bound);
696                                          get_motion_vector(dec, bs, x, y, 2, &mb->mvs[2], fcode, bound);                                          get_motion_vector(dec, bs, x, y, 2, &mb->mvs[2], fcode, bound);
# Line 682  Line 710 
710                                                                  rounding);                                                                  rounding);
711                          } else                          // not coded                          } else                          // not coded
712                          {                          {
713                                  //DEBUG2("P-frame MB at (X,Y)=",x,y);                                  DEBUG2("P-frame MB at (X,Y)=",x,y);
714                                  mb->mode = MODE_NOT_CODED;                                  mb->mode = MODE_NOT_CODED;
715                                  mb->mvs[0].x = mb->mvs[1].x = mb->mvs[2].x = mb->mvs[3].x = 0;                                  mb->mvs[0].x = mb->mvs[1].x = mb->mvs[2].x = mb->mvs[3].x = 0;
716                                  mb->mvs[0].y = mb->mvs[1].y = mb->mvs[2].y = mb->mvs[3].y = 0;                                  mb->mvs[0].y = mb->mvs[1].y = mb->mvs[2].y = mb->mvs[3].y = 0;
# Line 852  Line 880 
880          stop_comp_timer();          stop_comp_timer();
881    
882          for (i = 0; i < 6; i++) {          for (i = 0; i < 6; i++) {
883                    int direction = dec->alternate_vertical_scan ? 2 : 0;
884    
885                  if (cbp & (1 << (5 - i)))       // coded                  if (cbp & (1 << (5 - i)))       // coded
886                  {                  {
887                          memset(&block[i * 64], 0, 64 * sizeof(int16_t));        // clear                          memset(&block[i * 64], 0, 64 * sizeof(int16_t));        // clear
888    
889                          start_timer();                          start_timer();
890                          get_inter_block(bs, &block[i * 64]);                          get_inter_block(bs, &block[i * 64], direction);
891                          stop_coding_timer();                          stop_coding_timer();
892    
893                          start_timer();                          start_timer();
# Line 1018  Line 1048 
1048          stop_comp_timer();          stop_comp_timer();
1049    
1050          for (i = 0; i < 6; i++) {          for (i = 0; i < 6; i++) {
1051                    int direction = dec->alternate_vertical_scan ? 2 : 0;
1052    
1053                  if (cbp & (1 << (5 - i)))       // coded                  if (cbp & (1 << (5 - i)))       // coded
1054                  {                  {
1055                          memset(&block[i * 64], 0, 64 * sizeof(int16_t));        // clear                          memset(&block[i * 64], 0, 64 * sizeof(int16_t));        // clear
1056    
1057                          start_timer();                          start_timer();
1058                          get_inter_block(bs, &block[i * 64]);                          get_inter_block(bs, &block[i * 64], direction);
1059                          stop_coding_timer();                          stop_coding_timer();
1060    
1061                          start_timer();                          start_timer();
# Line 1118  Line 1150 
1150    
1151          start_timer();          start_timer();
1152          image_setedges(&dec->refn[0], dec->edged_width, dec->edged_height,          image_setedges(&dec->refn[0], dec->edged_width, dec->edged_height,
1153                                     dec->width, dec->height, dec->interlacing);                                     dec->width, dec->height);
1154          image_setedges(&dec->refn[1], dec->edged_width, dec->edged_height,          image_setedges(&dec->refn[1], dec->edged_width, dec->edged_height,
1155                                     dec->width, dec->height, dec->interlacing);                                     dec->width, dec->height);
1156          stop_edges_timer();          stop_edges_timer();
1157    
1158  #ifdef BFRAMES_DEC_DEBUG  #ifdef BFRAMES_DEC_DEBUG
# Line 1188  Line 1220 
1220  #ifdef BFRAMES_DEC_DEBUG  #ifdef BFRAMES_DEC_DEBUG
1221          BFRAME_DEBUG          BFRAME_DEBUG
1222  #endif  #endif
1223    
1224                          switch (mb->mb_type) {                          switch (mb->mb_type) {
1225                          case MODE_DIRECT:                          case MODE_DIRECT:
1226                                  get_b_motion_vector(dec, bs, x, y, &mv, 1, zeromv);                                  get_b_motion_vector(dec, bs, x, y, &mv, 1, zeromv);
1227    
1228                          case MODE_DIRECT_NONE_MV:                          case MODE_DIRECT_NONE_MV:
1229                                  {                               // Because this file is a C file not C++ so I use '{' to define var                                  {
1230                                          const int64_t TRB = dec->time_pp - dec->time_bp, TRD = dec->time_pp;                                          const int64_t TRB = dec->time_pp - dec->time_bp, TRD = dec->time_pp;
1231                                          int i;                                          int i;
1232    
# Line 1253  Line 1286 
1286                                  break;                                  break;
1287    
1288                          default:                          default:
1289                                  //DEBUG1("Not support B-frame mb_type =", mb->mb_type);                                  DEBUG1("Not support B-frame mb_type =", mb->mb_type);
                                 ;  
1290                          }                          }
1291    
1292                  }                                               // end of FOR                  }                                               // end of FOR
# Line 1355  Line 1387 
1387    
1388  #ifdef BFRAMES_DEC  #ifdef BFRAMES_DEC
1389          // test if no B_VOP          // test if no B_VOP
1390          if (dec->low_delay) {          if (dec->low_delay || dec->frames == 0) {
1391  #endif  #endif
1392          image_output(&dec->cur, dec->width, dec->height, dec->edged_width,          image_output(&dec->cur, dec->width, dec->height, dec->edged_width,
1393                                           frame->image, frame->stride, frame->colorspace);                                           frame->image, frame->stride, frame->colorspace);
1394    
1395  #ifdef BFRAMES_DEC  #ifdef BFRAMES_DEC
1396          } else {          } else {
1397                  if (dec->frames >= 0) {                  if (dec->frames >= 1) {
1398                          start_timer();                          start_timer();
1399                          if ((vop_type == I_VOP || vop_type == P_VOP)) {                          if ((vop_type == I_VOP || vop_type == P_VOP)) {
1400                                  image_output(&dec->refn[0], dec->width, dec->height,                                  image_output(&dec->refn[0], dec->width, dec->height,

Legend:
Removed from v.1.32  
changed lines
  Added in v.1.37.2.1

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