[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.55, Thu Apr 15 12:05:19 2004 UTC revision 1.61, Sat Jul 10 17:49:31 2004 UTC
# Line 222  Line 222 
222          dec->time = dec->time_base = dec->last_time_base = 0;          dec->time = dec->time_base = dec->last_time_base = 0;
223          dec->low_delay = 0;          dec->low_delay = 0;
224          dec->packed_mode = 0;          dec->packed_mode = 0;
225            dec->time_inc_resolution = 1; /* until VOL header says otherwise */
226    
227          dec->fixed_dimensions = (dec->width > 0 && dec->height > 0);          dec->fixed_dimensions = (dec->width > 0 && dec->height > 0);
228    
# Line 338  Line 339 
339                  stop_coding_timer();                  stop_coding_timer();
340    
341                  start_timer();                  start_timer();
342                  add_acdc(pMB, i, &block[i * 64], iDcScaler, predictors);                  add_acdc(pMB, i, &block[i * 64], iDcScaler, predictors, dec->bs_version);
343                  stop_prediction_timer();                  stop_prediction_timer();
344    
345                  start_timer();                  start_timer();
# Line 392  Line 393 
393                                  const int reduced_resolution,                                  const int reduced_resolution,
394                                  const MACROBLOCK * pMB)                                  const MACROBLOCK * pMB)
395  {  {
         DECLARE_ALIGNED_MATRIX(block, 1, 64, int16_t, CACHE_LINE);  
396          DECLARE_ALIGNED_MATRIX(data, 6, 64, int16_t, CACHE_LINE);          DECLARE_ALIGNED_MATRIX(data, 6, 64, int16_t, CACHE_LINE);
397    
398          int stride = dec->edged_width;          int stride = dec->edged_width;
# Line 401  Line 401 
401          int i;          int i;
402          const uint32_t iQuant = pMB->quant;          const uint32_t iQuant = pMB->quant;
403          const int direction = dec->alternate_vertical_scan ? 2 : 0;          const int direction = dec->alternate_vertical_scan ? 2 : 0;
404          const quant_interFuncPtr dequant = dec->quant_type == 0 ? dequant_h263_inter : dequant_mpeg_inter;          typedef void (*get_inter_block_function_t)(
405                            Bitstream * bs,
406                            int16_t * block,
407                            int direction,
408                            const int quant,
409                            const uint16_t *matrix);
410    
411            const get_inter_block_function_t get_inter_block = (dec->quant_type == 0)
412                    ? get_inter_block_h263
413                    : get_inter_block_mpeg;
414    
415            memset(&data[0], 0, 6*64*sizeof(int16_t));      /* clear */
416    
417          for (i = 0; i < 6; i++) {          for (i = 0; i < 6; i++) {
418    
419                  if (cbp & (1 << (5 - i))) {     /* coded */                  if (cbp & (1 << (5 - i))) {     /* coded */
420    
                         memset(block, 0, 64 * sizeof(int16_t)); /* clear */  
421    
422                            /* Decode coeffs and dequantize on the fly */
423                          start_timer();                          start_timer();
424                          get_inter_block(bs, block, direction);                          get_inter_block(bs, &data[i*64], direction, iQuant, get_inter_matrix(dec->mpeg_quant_matrices));
425                          stop_coding_timer();                          stop_coding_timer();
426    
427                          start_timer();                          start_timer();
                         dequant(&data[i * 64], block, iQuant, dec->mpeg_quant_matrices);  
                         stop_iquant_timer();  
   
                         start_timer();  
428                          idct(&data[i * 64]);                          idct(&data[i * 64]);
429                          stop_idct_timer();                          stop_idct_timer();
430                  }                  }
# Line 814  Line 821 
821                  mb_height = (dec->height + 31) / 32;                  mb_height = (dec->height + 31) / 32;
822          }          }
823    
824            if (!dec->is_edged[0]) {
825          start_timer();          start_timer();
826          image_setedges(&dec->refn[0], dec->edged_width, dec->edged_height,          image_setedges(&dec->refn[0], dec->edged_width, dec->edged_height,
827                                          dec->width, dec->height, dec->bs_version);                                          dec->width, dec->height, dec->bs_version);
828                    dec->is_edged[0] = 1;
829          stop_edges_timer();          stop_edges_timer();
830            }
831    
832          if (gmc_warp) {          if (gmc_warp) {
833                  /* accuracy: 0==1/2, 1=1/4, 2=1/8, 3=1/16 */                  /* accuracy: 0==1/2, 1=1/4, 2=1/8, 3=1/16 */
# Line 1214  Line 1224 
1224          uint32_t x, y;          uint32_t x, y;
1225          VECTOR mv;          VECTOR mv;
1226          const VECTOR zeromv = {0,0};          const VECTOR zeromv = {0,0};
         const int64_t TRB = dec->time_pp - dec->time_bp, TRD = dec->time_pp;  
1227          int i;          int i;
1228    
1229            if (!dec->is_edged[0]) {
1230          start_timer();          start_timer();
1231          image_setedges(&dec->refn[0], dec->edged_width, dec->edged_height,          image_setedges(&dec->refn[0], dec->edged_width, dec->edged_height,
1232                                          dec->width, dec->height, dec->bs_version);                                          dec->width, dec->height, dec->bs_version);
1233                    dec->is_edged[0] = 1;
1234                    stop_edges_timer();
1235            }
1236    
1237            if (!dec->is_edged[1]) {
1238                    start_timer();
1239          image_setedges(&dec->refn[1], dec->edged_width, dec->edged_height,          image_setedges(&dec->refn[1], dec->edged_width, dec->edged_height,
1240                                          dec->width, dec->height, dec->bs_version);                                          dec->width, dec->height, dec->bs_version);
1241                    dec->is_edged[1] = 1;
1242          stop_edges_timer();          stop_edges_timer();
1243            }
1244    
1245          for (y = 0; y < dec->mb_height; y++) {          for (y = 0; y < dec->mb_height; y++) {
1246                  /* Initialize Pred Motion Vector */                  /* Initialize Pred Motion Vector */
# Line 1309  Line 1327 
1327    
1328                          case MODE_DIRECT_NONE_MV:                          case MODE_DIRECT_NONE_MV:
1329                                  for (i = 0; i < 4; i++) {                                  for (i = 0; i < 4; i++) {
1330                                          mb->mvs[i].x = (int32_t) ((TRB * last_mb->mvs[i].x) / TRD + mv.x);                                          mb->mvs[i].x = last_mb->mvs[i].x*dec->time_bp/dec->time_pp + mv.x;
1331                                          mb->b_mvs[i].x = (int32_t) ((mv.x == 0)                                          mb->mvs[i].y = last_mb->mvs[i].y*dec->time_bp/dec->time_pp + mv.y;
1332                                                                          ? ((TRB - TRD) * last_mb->mvs[i].x) / TRD  
1333                                                                          : mb->mvs[i].x - last_mb->mvs[i].x);                                          mb->b_mvs[i].x = (mv.x)
1334                                          mb->mvs[i].y = (int32_t) ((TRB * last_mb->mvs[i].y) / TRD + mv.y);                                                  ?  mb->mvs[i].x - last_mb->mvs[i].x
1335                                          mb->b_mvs[i].y = (int32_t) ((mv.y == 0)                                                  : last_mb->mvs[i].x*(dec->time_bp - dec->time_pp)/dec->time_pp;
1336                                                                          ? ((TRB - TRD) * last_mb->mvs[i].y) / TRD                                          mb->b_mvs[i].y = (mv.y)
1337                                                                          : mb->mvs[i].y - last_mb->mvs[i].y);                                                  ? mb->mvs[i].y - last_mb->mvs[i].y
1338                                                    : last_mb->mvs[i].y*(dec->time_bp - dec->time_pp)/dec->time_pp;
1339                                  }                                  }
1340    
1341                                  decoder_bf_interpolate_mbinter(dec, dec->refn[1], dec->refn[0],                                  decoder_bf_interpolate_mbinter(dec, dec->refn[1], dec->refn[0],
# Line 1492  Line 1511 
1511                  goto repeat;                  goto repeat;
1512          }          }
1513    
1514            if(dec->frames == 0 && coding_type != I_VOP) {
1515                    /* 1st frame is not an i-vop */
1516                    goto repeat;
1517            }
1518    
1519          dec->p_bmv.x = dec->p_bmv.y = dec->p_fmv.y = dec->p_fmv.y = 0;  /* init pred vector to 0 */          dec->p_bmv.x = dec->p_bmv.y = dec->p_fmv.y = dec->p_fmv.y = 0;  /* init pred vector to 0 */
1520    
1521          /* packed_mode: special-N_VOP treament */          /* packed_mode: special-N_VOP treament */
# Line 1541  Line 1565 
1565                  }                  }
1566    
1567                  image_swap(&dec->refn[0], &dec->refn[1]);                  image_swap(&dec->refn[0], &dec->refn[1]);
1568                    dec->is_edged[1] = dec->is_edged[0];
1569                  image_swap(&dec->cur, &dec->refn[0]);                  image_swap(&dec->cur, &dec->refn[0]);
1570                    dec->is_edged[0] = 0;
1571                  SWAP(MACROBLOCK *, dec->mbs, dec->last_mbs);                  SWAP(MACROBLOCK *, dec->mbs, dec->last_mbs);
1572                  dec->last_reduced_resolution = reduced_resolution;                  dec->last_reduced_resolution = reduced_resolution;
1573                  dec->last_coding_type = coding_type;                  dec->last_coding_type = coding_type;
# Line 1553  Line 1579 
1579    
1580                  if (dec->low_delay) {                  if (dec->low_delay) {
1581                          DPRINTF(XVID_DEBUG_ERROR, "warning: bvop found in low_delay==1 stream\n");                          DPRINTF(XVID_DEBUG_ERROR, "warning: bvop found in low_delay==1 stream\n");
1582                          dec->low_delay = 1;                          dec->low_delay = 0;
1583                  }                  }
1584    
1585                  if (dec->frames < 2) {                  if (dec->frames < 2) {

Legend:
Removed from v.1.55  
changed lines
  Added in v.1.61

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