[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.30, Mon Jul 15 23:50:31 2002 UTC revision 1.37.2.3, Thu Oct 10 12:16:00 2002 UTC
# Line 136  Line 136 
136                  return XVID_ERR_MEMORY;                  return XVID_ERR_MEMORY;
137          }          }
138    
139            if (image_create(&dec->refh, dec->edged_width, dec->edged_height)) {
140                    image_destroy(&dec->cur, dec->edged_width, dec->edged_height);
141                    image_destroy(&dec->refn[0], dec->edged_width, dec->edged_height);
142                    image_destroy(&dec->refn[1], dec->edged_width, dec->edged_height);
143                    image_destroy(&dec->refn[2], dec->edged_width, dec->edged_height);
144                    xvid_free(dec);
145                    return XVID_ERR_MEMORY;
146            }
147    
148          dec->mbs =          dec->mbs =
149                  xvid_malloc(sizeof(MACROBLOCK) * dec->mb_width * dec->mb_height,                  xvid_malloc(sizeof(MACROBLOCK) * dec->mb_width * dec->mb_height,
150                                          CACHE_LINE);                                          CACHE_LINE);
# Line 144  Line 153 
153                  image_destroy(&dec->refn[0], dec->edged_width, dec->edged_height);                  image_destroy(&dec->refn[0], dec->edged_width, dec->edged_height);
154                  image_destroy(&dec->refn[1], dec->edged_width, dec->edged_height);                  image_destroy(&dec->refn[1], dec->edged_width, dec->edged_height);
155                  image_destroy(&dec->refn[2], dec->edged_width, dec->edged_height);                  image_destroy(&dec->refn[2], dec->edged_width, dec->edged_height);
156                    image_destroy(&dec->refh, dec->edged_width, dec->edged_height);
157                  xvid_free(dec);                  xvid_free(dec);
158                  return XVID_ERR_MEMORY;                  return XVID_ERR_MEMORY;
159          }          }
# Line 161  Line 171 
171                  image_destroy(&dec->refn[0], dec->edged_width, dec->edged_height);                  image_destroy(&dec->refn[0], dec->edged_width, dec->edged_height);
172                  image_destroy(&dec->refn[1], dec->edged_width, dec->edged_height);                  image_destroy(&dec->refn[1], dec->edged_width, dec->edged_height);
173                  image_destroy(&dec->refn[2], dec->edged_width, dec->edged_height);                  image_destroy(&dec->refn[2], dec->edged_width, dec->edged_height);
174                    image_destroy(&dec->refh, dec->edged_width, dec->edged_height);
175                  xvid_free(dec);                  xvid_free(dec);
176                  return XVID_ERR_MEMORY;                  return XVID_ERR_MEMORY;
177          }          }
# Line 186  Line 197 
197          image_destroy(&dec->refn[0], dec->edged_width, dec->edged_height);          image_destroy(&dec->refn[0], dec->edged_width, dec->edged_height);
198          image_destroy(&dec->refn[1], dec->edged_width, dec->edged_height);          image_destroy(&dec->refn[1], dec->edged_width, dec->edged_height);
199          image_destroy(&dec->refn[2], dec->edged_width, dec->edged_height);          image_destroy(&dec->refn[2], dec->edged_width, dec->edged_height);
200            image_destroy(&dec->refh, dec->edged_width, dec->edged_height);
201          image_destroy(&dec->cur, dec->edged_width, dec->edged_height);          image_destroy(&dec->cur, dec->edged_width, dec->edged_height);
202          xvid_free(dec);          xvid_free(dec);
203    
# Line 268  Line 280 
280                  start_timer();                  start_timer();
281                  if (cbp & (1 << (5 - i)))       // coded                  if (cbp & (1 << (5 - i)))       // coded
282                  {                  {
283                          get_intra_block(bs, &block[i * 64], pMB->acpred_directions[i],                          int direction = dec->alternate_vertical_scan ?
284                                                          start_coeff);                                  2 : pMB->acpred_directions[i];
285    
286                            get_intra_block(bs, &block[i * 64], direction, start_coeff);
287                  }                  }
288                  stop_coding_timer();                  stop_coding_timer();
289    
# Line 348  Line 362 
362                  uv_dx = pMB->mvs[0].x;                  uv_dx = pMB->mvs[0].x;
363                  uv_dy = pMB->mvs[0].y;                  uv_dy = pMB->mvs[0].y;
364    
365                    if (dec->quarterpel)
366                    {
367                            uv_dx = (uv_dx >> 1) | (uv_dx & 1);
368                            uv_dy = (uv_dy >> 1) | (uv_dy & 1);
369                    }
370    
371                  uv_dx = (uv_dx & 3) ? (uv_dx >> 1) | 1 : uv_dx / 2;                  uv_dx = (uv_dx & 3) ? (uv_dx >> 1) | 1 : uv_dx / 2;
372                  uv_dy = (uv_dy & 3) ? (uv_dy >> 1) | 1 : uv_dy / 2;                  uv_dy = (uv_dy & 3) ? (uv_dy >> 1) | 1 : uv_dy / 2;
373    
374                    start_timer();
375                    if(dec->quarterpel) {
376                            interpolate16x16_quarterpel(dec->cur.y, dec->refn[0].y, dec->refh.y, dec->refh.y + 64,
377                                                                                dec->refh.y + 128, 16*x_pos, 16*y_pos,
378                                                                                pMB->mvs[0].x, pMB->mvs[0].y, stride,  rounding);
379                    }
380                    else {
381                            interpolate8x8_switch(dec->cur.y, dec->refn[0].y, 16*x_pos, 16*y_pos,
382                                                                      pMB->mvs[0].x, pMB->mvs[0].y, stride,  rounding);
383                            interpolate8x8_switch(dec->cur.y, dec->refn[0].y, 16*x_pos + 8, 16*y_pos,
384                                                                  pMB->mvs[1].x, pMB->mvs[1].y, stride,  rounding);
385                            interpolate8x8_switch(dec->cur.y, dec->refn[0].y, 16*x_pos, 16*y_pos + 8,
386                                                                      pMB->mvs[2].x, pMB->mvs[2].y, stride,  rounding);
387                            interpolate8x8_switch(dec->cur.y, dec->refn[0].y, 16*x_pos + 8, 16*y_pos + 8,
388                                                                      pMB->mvs[3].x, pMB->mvs[3].y, stride,  rounding);
389                    }
390    
391                    interpolate8x8_switch(dec->cur.u, dec->refn[0].u, 8 * x_pos, 8 * y_pos,
392                                                              uv_dx, uv_dy, stride2, rounding);
393                    interpolate8x8_switch(dec->cur.v, dec->refn[0].v, 8 * x_pos, 8 * y_pos,
394                                                              uv_dx, uv_dy, stride2, rounding);
395                    stop_comp_timer();
396    
397          } else {          } else {
398                  int sum;                  int sum;
   
399                  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;
400                  uv_dx =  
401                          (sum ==                  if (dec->quarterpel)
402                           0 ? 0 : SIGN(sum) * (roundtab[ABS(sum) % 16] +                  {
403                                                                    (ABS(sum) / 16) * 2));                          sum /= 2;
404                    }
405    
406                    uv_dx = (sum == 0 ? 0 : SIGN(sum) * (roundtab[ABS(sum) % 16] + (ABS(sum) / 16) * 2));
407    
408                  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;
409                  uv_dy =  
410                          (sum ==                  if (dec->quarterpel)
411                           0 ? 0 : SIGN(sum) * (roundtab[ABS(sum) % 16] +                  {
412                                                                    (ABS(sum) / 16) * 2));                          sum /= 2;
413          }          }
414    
415                    uv_dy = (sum == 0 ? 0 : SIGN(sum) * (roundtab[ABS(sum) % 16] + (ABS(sum) / 16) * 2));
416    
417          start_timer();          start_timer();
418                    if(dec->quarterpel) {
419                            interpolate8x8_quarterpel(dec->cur.y, dec->refn[0].y, dec->refh.y, dec->refh.y + 64,
420                                                                              dec->refh.y + 128, 16*x_pos, 16*y_pos,
421                                                                              pMB->mvs[0].x, pMB->mvs[0].y, stride,  rounding);
422                            interpolate8x8_quarterpel(dec->cur.y, dec->refn[0].y, dec->refh.y, dec->refh.y + 64,
423                                                                              dec->refh.y + 128, 16*x_pos + 8, 16*y_pos,
424                                                                              pMB->mvs[1].x, pMB->mvs[1].y, stride,  rounding);
425                            interpolate8x8_quarterpel(dec->cur.y, dec->refn[0].y, dec->refh.y, dec->refh.y + 64,
426                                                                              dec->refh.y + 128, 16*x_pos, 16*y_pos + 8,
427                                                                              pMB->mvs[2].x, pMB->mvs[2].y, stride,  rounding);
428                            interpolate8x8_quarterpel(dec->cur.y, dec->refn[0].y, dec->refh.y, dec->refh.y + 64,
429                                                                              dec->refh.y + 128, 16*x_pos + 8, 16*y_pos + 8,
430                                                                              pMB->mvs[3].x, pMB->mvs[3].y, stride,  rounding);
431                    }
432                    else {
433          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,
434                                                    pMB->mvs[0].x, pMB->mvs[0].y, stride, rounding);                                                    pMB->mvs[0].x, pMB->mvs[0].y, stride, rounding);
435          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,
436                                                    16 * y_pos, pMB->mvs[1].x, pMB->mvs[1].y, stride,                                                                    pMB->mvs[1].x, pMB->mvs[1].y, stride,  rounding);
437                                                    rounding);                          interpolate8x8_switch(dec->cur.y, dec->refn[0].y, 16*x_pos, 16*y_pos + 8,
438          interpolate8x8_switch(dec->cur.y, dec->refn[0].y, 16 * x_pos,                                                                    pMB->mvs[2].x, pMB->mvs[2].y, stride,  rounding);
439                                                    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,
440                                                    rounding);                                                                    pMB->mvs[3].x, pMB->mvs[3].y, stride,  rounding);
441          interpolate8x8_switch(dec->cur.y, dec->refn[0].y, 16 * x_pos + 8,                  }
442                                                    16 * y_pos + 8, pMB->mvs[3].x, pMB->mvs[3].y, stride,  
                                                   rounding);  
443          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,
444                                                    uv_dx, uv_dy, stride2, rounding);                                                    uv_dx, uv_dy, stride2, rounding);
445          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,
446                                                    uv_dx, uv_dy, stride2, rounding);                                                    uv_dx, uv_dy, stride2, rounding);
447          stop_comp_timer();          stop_comp_timer();
448            }
449    
450          for (i = 0; i < 6; i++) {          for (i = 0; i < 6; i++) {
451                    int direction = dec->alternate_vertical_scan ? 2 : 0;
452    
453                  if (cbp & (1 << (5 - i)))       // coded                  if (cbp & (1 << (5 - i)))       // coded
454                  {                  {
455                          memset(&block[i * 64], 0, 64 * sizeof(int16_t));        // clear                          memset(&block[i * 64], 0, 64 * sizeof(int16_t));        // clear
456    
457                          start_timer();                          start_timer();
458                          get_inter_block(bs, &block[i * 64]);                          get_inter_block(bs, &block[i * 64], direction);
459                          stop_coding_timer();                          stop_coding_timer();
460    
461                          start_timer();                          start_timer();
# Line 493  Line 558 
558                          decoder_mbintra(dec, mb, x, y, acpred_flag, cbp, bs, quant,                          decoder_mbintra(dec, mb, x, y, acpred_flag, cbp, bs, quant,
559                                                          intra_dc_threshold, bound);                                                          intra_dc_threshold, bound);
560                  }                  }
561                    if(dec->out_frm)
562                      output_slice(&dec->cur, dec->edged_width,dec->width,dec->out_frm,0,y,dec->mb_width);
563    
564          }          }
565    
566  }  }
# Line 556  Line 624 
624    
625          uint32_t x, y;          uint32_t x, y;
626          uint32_t bound;          uint32_t bound;
627            int cp_mb, st_mb;
628    
629          start_timer();          start_timer();
630          image_setedges(&dec->refn[0], dec->edged_width, dec->edged_height,          image_setedges(&dec->refn[0], dec->edged_width, dec->edged_height,
631                                     dec->width, dec->height, dec->interlacing);                                     dec->width, dec->height);
632          stop_edges_timer();          stop_edges_timer();
633    
634          bound = 0;          bound = 0;
635    
636          for (y = 0; y < dec->mb_height; y++) {          for (y = 0; y < dec->mb_height; y++) {
637                    cp_mb = st_mb = 0;
638                  for (x = 0; x < dec->mb_width; x++) {                  for (x = 0; x < dec->mb_width; x++) {
639                          MACROBLOCK *mb;                          MACROBLOCK *mb;
640    
# Line 592  Line 662 
662                                  uint32_t cbp;                                  uint32_t cbp;
663                                  uint32_t intra;                                  uint32_t intra;
664    
665                                    cp_mb++;
666                                  mcbpc = get_mcbpc_inter(bs);                                  mcbpc = get_mcbpc_inter(bs);
667                                  mb->mode = mcbpc & 7;                                  mb->mode = mcbpc & 7;
668                                  cbpc = (mcbpc >> 4);                                  cbpc = (mcbpc >> 4);
# Line 625  Line 696 
696                                  mb->quant = quant;                                  mb->quant = quant;
697    
698                                  if (dec->interlacing) {                                  if (dec->interlacing) {
699                                            if (cbp || intra) {
700                                          mb->field_dct = BitstreamGetBit(bs);                                          mb->field_dct = BitstreamGetBit(bs);
701                                          DEBUG1("decp: field_dct: ", mb->field_dct);                                          DEBUG1("decp: field_dct: ", mb->field_dct);
702                                            }
703    
704                                          if (mb->mode == MODE_INTER || mb->mode == MODE_INTER_Q) {                                          if (mb->mode == MODE_INTER || mb->mode == MODE_INTER_Q) {
705                                                  mb->field_pred = BitstreamGetBit(bs);                                                  mb->field_pred = BitstreamGetBit(bs);
# Line 655  Line 728 
728                                                  mb->mvs[1].y = mb->mvs[2].y = mb->mvs[3].y =                                                  mb->mvs[1].y = mb->mvs[2].y = mb->mvs[3].y =
729                                                          mb->mvs[0].y;                                                          mb->mvs[0].y;
730                                          }                                          }
731                                  } else if (mb->mode ==                                  } else if (mb->mode == MODE_INTER4V ) {
732                                                     MODE_INTER4V /* || mb->mode == MODE_INTER4V_Q */ ) {  
733                                          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);
734                                          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);
735                                          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 676  Line 749 
749                                                                  rounding);                                                                  rounding);
750                          } else                          // not coded                          } else                          // not coded
751                          {                          {
752                                  //DEBUG2("P-frame MB at (X,Y)=",x,y);                                  DEBUG2("P-frame MB at (X,Y)=",x,y);
753                                  mb->mode = MODE_NOT_CODED;                                  mb->mode = MODE_NOT_CODED;
754                                  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;
755                                  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 718  Line 791 
791                                                                   dec->refn[0].v +                                                                   dec->refn[0].v +
792                                                                   (8 * y) * dec->edged_width / 2 + (8 * x),                                                                   (8 * y) * dec->edged_width / 2 + (8 * x),
793                                                                   dec->edged_width / 2);                                                                   dec->edged_width / 2);
   
794                                  stop_transfer_timer();                                  stop_transfer_timer();
795                                    if(dec->out_frm && cp_mb > 0) {
796                                      output_slice(&dec->cur, dec->edged_width,dec->width,dec->out_frm,st_mb,y,cp_mb);
797                                      cp_mb = 0;
798                                    }
799                                    st_mb = x+1;
800                          }                          }
801                  }                  }
802                    if(dec->out_frm && cp_mb > 0)
803                      output_slice(&dec->cur, dec->edged_width,dec->width,dec->out_frm,st_mb,y,cp_mb);
804          }          }
805  }  }
806    
# Line 840  Line 919 
919          stop_comp_timer();          stop_comp_timer();
920    
921          for (i = 0; i < 6; i++) {          for (i = 0; i < 6; i++) {
922                    int direction = dec->alternate_vertical_scan ? 2 : 0;
923    
924                  if (cbp & (1 << (5 - i)))       // coded                  if (cbp & (1 << (5 - i)))       // coded
925                  {                  {
926                          memset(&block[i * 64], 0, 64 * sizeof(int16_t));        // clear                          memset(&block[i * 64], 0, 64 * sizeof(int16_t));        // clear
927    
928                          start_timer();                          start_timer();
929                          get_inter_block(bs, &block[i * 64]);                          get_inter_block(bs, &block[i * 64], direction);
930                          stop_coding_timer();                          stop_coding_timer();
931    
932                          start_timer();                          start_timer();
# Line 991  Line 1072 
1072          interpolate8x8_switch(dec->refn[2].v, backward.v, 8 * x_pos, 8 * y_pos,          interpolate8x8_switch(dec->refn[2].v, backward.v, 8 * x_pos, 8 * y_pos,
1073                                                    b_uv_dx, b_uv_dy, stride2, 0);                                                    b_uv_dx, b_uv_dy, stride2, 0);
1074    
1075          interpolate8x8_c(dec->cur.y, dec->refn[2].y, 16 * x_pos, 16 * y_pos,          interpolate8x8_avg2(dec->cur.y + (16 * y_pos * stride) + 16 * x_pos,
1076                                           stride);                                                  dec->cur.y + (16 * y_pos * stride) + 16 * x_pos,
1077          interpolate8x8_c(dec->cur.y, dec->refn[2].y, 16 * x_pos + 8, 16 * y_pos,                                                  dec->refn[2].y + (16 * y_pos * stride) + 16 * x_pos,
1078                                           stride);                                                  stride, 0);
1079          interpolate8x8_c(dec->cur.y, dec->refn[2].y, 16 * x_pos, 16 * y_pos + 8,  
1080                                           stride);          interpolate8x8_avg2(dec->cur.y + (16 * y_pos * stride) + 16 * x_pos + 8,
1081          interpolate8x8_c(dec->cur.y, dec->refn[2].y, 16 * x_pos + 8,                                                  dec->cur.y + (16 * y_pos * stride) + 16 * x_pos + 8,
1082                                           16 * y_pos + 8, stride);                                                  dec->refn[2].y + (16 * y_pos * stride) + 16 * x_pos + 8,
1083          interpolate8x8_c(dec->cur.u, dec->refn[2].u, 8 * x_pos, 8 * y_pos,                                                  stride, 0);
1084                                           stride2);  
1085          interpolate8x8_c(dec->cur.v, dec->refn[2].v, 8 * x_pos, 8 * y_pos,          interpolate8x8_avg2(dec->cur.y + (16 * (y_pos + 8) * stride) + 16 * x_pos,
1086                                           stride2);                                                  dec->cur.y + (16 * (y_pos + 8) * stride) + 16 * x_pos,
1087                                                    dec->refn[2].y + (16 * (y_pos + 8) * stride) + 16 * x_pos,
1088                                                    stride, 0);
1089    
1090            interpolate8x8_avg2(dec->cur.y + (16 * (y_pos + 8) * stride) + 16 * x_pos + 8,
1091                                                    dec->cur.y + (16 * (y_pos + 8) * stride) + 16 * x_pos + 8,
1092                                                    dec->refn[2].y + (16 * (y_pos + 8) * stride) + 16 * x_pos + 8,
1093                                                    stride, 0);
1094    
1095            interpolate8x8_avg2(dec->cur.u + (8 * y_pos * stride) + 8 * x_pos,
1096                                                    dec->cur.u + (8 * y_pos * stride) + 8 * x_pos,
1097                                                    dec->refn[2].u + (8 * y_pos * stride) + 8 * x_pos,
1098                                                    stride2, 0);
1099    
1100            interpolate8x8_avg2(dec->cur.v + (8 * y_pos * stride) + 8 * x_pos,
1101                                                    dec->cur.v + (8 * y_pos * stride) + 8 * x_pos,
1102                                                    dec->refn[2].v + (8 * y_pos * stride) + 8 * x_pos,
1103                                                    stride2, 0);
1104    
1105          stop_comp_timer();          stop_comp_timer();
1106    
1107          for (i = 0; i < 6; i++) {          for (i = 0; i < 6; i++) {
1108                    int direction = dec->alternate_vertical_scan ? 2 : 0;
1109    
1110                  if (cbp & (1 << (5 - i)))       // coded                  if (cbp & (1 << (5 - i)))       // coded
1111                  {                  {
1112                          memset(&block[i * 64], 0, 64 * sizeof(int16_t));        // clear                          memset(&block[i * 64], 0, 64 * sizeof(int16_t));        // clear
1113    
1114                          start_timer();                          start_timer();
1115                          get_inter_block(bs, &block[i * 64]);                          get_inter_block(bs, &block[i * 64], direction);
1116                          stop_coding_timer();                          stop_coding_timer();
1117    
1118                          start_timer();                          start_timer();
# Line 1106  Line 1207 
1207    
1208          start_timer();          start_timer();
1209          image_setedges(&dec->refn[0], dec->edged_width, dec->edged_height,          image_setedges(&dec->refn[0], dec->edged_width, dec->edged_height,
1210                                     dec->width, dec->height, dec->interlacing);                                     dec->width, dec->height);
1211          image_setedges(&dec->refn[1], dec->edged_width, dec->edged_height,          image_setedges(&dec->refn[1], dec->edged_width, dec->edged_height,
1212                                     dec->width, dec->height, dec->interlacing);                                     dec->width, dec->height);
1213          stop_edges_timer();          stop_edges_timer();
1214    
1215  #ifdef BFRAMES_DEC_DEBUG  #ifdef BFRAMES_DEC_DEBUG
# Line 1176  Line 1277 
1277  #ifdef BFRAMES_DEC_DEBUG  #ifdef BFRAMES_DEC_DEBUG
1278          BFRAME_DEBUG          BFRAME_DEBUG
1279  #endif  #endif
1280    
1281                          switch (mb->mb_type) {                          switch (mb->mb_type) {
1282                          case MODE_DIRECT:                          case MODE_DIRECT:
1283                                  get_b_motion_vector(dec, bs, x, y, &mv, 1, zeromv);                                  get_b_motion_vector(dec, bs, x, y, &mv, 1, zeromv);
1284    
1285                          case MODE_DIRECT_NONE_MV:                          case MODE_DIRECT_NONE_MV:
1286                                  {                               // Because this file is a C file not C++ so I use '{' to define var                                  {
1287                                          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;
1288                                          int i;                                          int i;
1289    
# Line 1241  Line 1343 
1343                                  break;                                  break;
1344    
1345                          default:                          default:
1346                                  //DEBUG1("Not support B-frame mb_type =", mb->mb_type);                                  DEBUG1("Not support B-frame mb_type =", mb->mb_type);
                                 ;  
1347                          }                          }
1348    
1349                  }                                               // end of FOR                  }                                               // end of FOR
# Line 1282  Line 1383 
1383    
1384          start_global_timer();          start_global_timer();
1385    
1386            dec->out_frm = (frame->colorspace == XVID_CSP_EXTERN) ? frame->image : NULL;
1387    
1388          BitstreamInit(&bs, frame->bitstream, frame->length);          BitstreamInit(&bs, frame->bitstream, frame->length);
1389    
1390          // add by chenm001 <chenm001@163.com>          // add by chenm001 <chenm001@163.com>
# Line 1341  Line 1444 
1444    
1445  #ifdef BFRAMES_DEC  #ifdef BFRAMES_DEC
1446          // test if no B_VOP          // test if no B_VOP
1447          if (dec->low_delay) {          if (dec->low_delay || dec->frames == 0) {
1448  #endif  #endif
1449          image_output(&dec->cur, dec->width, dec->height, dec->edged_width,          image_output(&dec->cur, dec->width, dec->height, dec->edged_width,
1450                                           frame->image, frame->stride, frame->colorspace);                                           frame->image, frame->stride, frame->colorspace);
1451    
1452  #ifdef BFRAMES_DEC  #ifdef BFRAMES_DEC
1453          } else {          } else {
1454                  if (dec->frames >= 0) {                  if (dec->frames >= 1) {
1455                          start_timer();                          start_timer();
1456                          if ((vop_type == I_VOP || vop_type == P_VOP)) {                          if ((vop_type == I_VOP || vop_type == P_VOP)) {
1457                                  image_output(&dec->refn[0], dec->width, dec->height,                                  image_output(&dec->refn[0], dec->width, dec->height,
# Line 1367  Line 1470 
1470          if (vop_type == I_VOP || vop_type == P_VOP) {          if (vop_type == I_VOP || vop_type == P_VOP) {
1471                  image_swap(&dec->refn[0], &dec->refn[1]);                  image_swap(&dec->refn[0], &dec->refn[1]);
1472                  image_swap(&dec->cur, &dec->refn[0]);                  image_swap(&dec->cur, &dec->refn[0]);
1473    
1474                  // swap MACROBLOCK                  // swap MACROBLOCK
1475                  if (!dec->low_delay && vop_type == P_VOP)                  // the Divx will not set the low_delay flage some times
1476                    // so follow code will wrong to not swap at that time
1477                    // this will broken bitstream! so I'm change it,
1478                    // But that is not the best way! can anyone tell me how
1479                    // to do another way?
1480                    // 18-07-2002   MinChen<chenm001@163.com>
1481                    //if (!dec->low_delay && vop_type == P_VOP)
1482                    if (vop_type == P_VOP)
1483                          mb_swap(&dec->mbs, &dec->last_mbs);                          mb_swap(&dec->mbs, &dec->last_mbs);
1484          }          }
1485    

Legend:
Removed from v.1.30  
changed lines
  Added in v.1.37.2.3

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