[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.49, Wed Feb 19 21:59:30 2003 UTC revision 1.49.2.4, Sat May 17 13:24:10 2003 UTC
# Line 158  Line 158 
158    
159          memset(dec->last_mbs, 0, sizeof(MACROBLOCK) * dec->mb_width * dec->mb_height);          memset(dec->last_mbs, 0, sizeof(MACROBLOCK) * dec->mb_width * dec->mb_height);
160    
161          return XVID_ERR_OK;          return 0;
162  }  }
163    
164    
165  int  int
166  decoder_create(XVID_DEC_PARAM * param)  decoder_create(xvid_dec_create_t * create)
167  {  {
168          DECODER *dec;          DECODER *dec;
169    
170            if (XVID_MAJOR(create->version) != 1)   /* v1.x.x */
171                    return XVID_ERR_VERSION;
172    
173          dec = xvid_malloc(sizeof(DECODER), CACHE_LINE);          dec = xvid_malloc(sizeof(DECODER), CACHE_LINE);
174          if (dec == NULL) {          if (dec == NULL) {
175                  return XVID_ERR_MEMORY;                  return XVID_ERR_MEMORY;
176          }          }
177          memset(dec, 0, sizeof(DECODER));          memset(dec, 0, sizeof(DECODER));
178    
179          param->handle = dec;          create->handle = dec;
180    
181          dec->width = param->width;          dec->width = create->width;
182          dec->height = param->height;          dec->height = create->height;
183    
184          image_null(&dec->cur);          image_null(&dec->cur);
185          image_null(&dec->refn[0]);          image_null(&dec->refn[0]);
# Line 204  Line 207 
207          if (dec->fixed_dimensions)          if (dec->fixed_dimensions)
208                  return decoder_resize(dec);                  return decoder_resize(dec);
209          else          else
210                  return XVID_ERR_OK;                  return 0;
211  }  }
212    
213    
# Line 225  Line 228 
228          xvid_free(dec);          xvid_free(dec);
229    
230          write_timer();          write_timer();
231          return XVID_ERR_OK;          return 0;
232  }  }
233    
234    
# Line 301  Line 304 
304                          block[i * 64 + 0] = dc_dif;                          block[i * 64 + 0] = dc_dif;
305                          start_coeff = 1;                          start_coeff = 1;
306    
307                          DPRINTF(DPRINTF_COEFF,"block[0] %i", dc_dif);                          DPRINTF(XVID_DEBUG_COEFF,"block[0] %i", dc_dif);
308                  } else {                  } else {
309                          start_coeff = 0;                          start_coeff = 0;
310                  }                  }
# Line 734  Line 737 
737                          }                          }
738                          mb = &dec->mbs[y * dec->mb_width + x];                          mb = &dec->mbs[y * dec->mb_width + x];
739    
740                          DPRINTF(DPRINTF_MB, "macroblock (%i,%i) %08x", x, y, BitstreamShowBits(bs, 32));                          DPRINTF(XVID_DEBUG_MB, "macroblock (%i,%i) %08x", x, y, BitstreamShowBits(bs, 32));
741    
742                          mcbpc = get_mcbpc_intra(bs);                          mcbpc = get_mcbpc_intra(bs);
743                          mb->mode = mcbpc & 7;                          mb->mode = mcbpc & 7;
# Line 761  Line 764 
764    
765                          if (dec->interlacing) {                          if (dec->interlacing) {
766                                  mb->field_dct = BitstreamGetBit(bs);                                  mb->field_dct = BitstreamGetBit(bs);
767                                  DPRINTF(DPRINTF_MB,"deci: field_dct: %i", mb->field_dct);                                  DPRINTF(XVID_DEBUG_MB,"deci: field_dct: %i", mb->field_dct);
768                          }                          }
769    
770                          decoder_mbintra(dec, mb, x, y, acpred_flag, cbp, bs, quant,                          decoder_mbintra(dec, mb, x, y, acpred_flag, cbp, bs, quant,
# Line 799  Line 802 
802          mv.x = get_mv(bs, fcode);          mv.x = get_mv(bs, fcode);
803          mv.y = get_mv(bs, fcode);          mv.y = get_mv(bs, fcode);
804    
805          DPRINTF(DPRINTF_MV,"mv_diff (%i,%i) pred (%i,%i) result (%i,%i)", mv.x, mv.y, pmv.x, pmv.y, mv.x+pmv.x, mv.y+pmv.y);          DPRINTF(XVID_DEBUG_MV,"mv_diff (%i,%i) pred (%i,%i) result (%i,%i)", mv.x, mv.y, pmv.x, pmv.y, mv.x+pmv.x, mv.y+pmv.y);
806    
807          mv.x += pmv.x;          mv.x += pmv.x;
808          mv.y += pmv.y;          mv.y += pmv.y;
# Line 898  Line 901 
901                          }                          }
902                          mb = &dec->mbs[y * dec->mb_width + x];                          mb = &dec->mbs[y * dec->mb_width + x];
903    
904                          DPRINTF(DPRINTF_MB, "macroblock (%i,%i) %08x", x, y, BitstreamShowBits(bs, 32));                          DPRINTF(XVID_DEBUG_MB, "macroblock (%i,%i) %08x", x, y, BitstreamShowBits(bs, 32));
905    
906                          /* 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 */
907                          if (!(BitstreamGetBit(bs)))     /* block _is_ coded */                          if (!(BitstreamGetBit(bs)))     /* block _is_ coded */
# Line 916  Line 919 
919                                  mb->mode = mcbpc & 7;                                  mb->mode = mcbpc & 7;
920                                  cbpc = (mcbpc >> 4);                                  cbpc = (mcbpc >> 4);
921    
922                                  DPRINTF(DPRINTF_MB, "mode %i", mb->mode);                                  DPRINTF(XVID_DEBUG_MB, "mode %i", mb->mode);
923                                  DPRINTF(DPRINTF_MB, "cbpc %i", cbpc);                                  DPRINTF(XVID_DEBUG_MB, "cbpc %i", cbpc);
924                                  acpred_flag = 0;                                  acpred_flag = 0;
925    
926                                  intra = (mb->mode == MODE_INTRA || mb->mode == MODE_INTRA_Q);                                  intra = (mb->mode == MODE_INTRA || mb->mode == MODE_INTRA_Q);
# Line 932  Line 935 
935                                  }                                  }
936    
937                                  cbpy = get_cbpy(bs, intra);                                  cbpy = get_cbpy(bs, intra);
938                                  DPRINTF(DPRINTF_MB, "cbpy %i  mcsel %i ", cbpy,mcsel);                                  DPRINTF(XVID_DEBUG_MB, "cbpy %i  mcsel %i ", cbpy,mcsel);
939    
940                                  cbp = (cbpy << 2) | cbpc;                                  cbp = (cbpy << 2) | cbpc;
941    
942                                  if (mb->mode == MODE_INTER_Q || mb->mode == MODE_INTRA_Q) {                                  if (mb->mode == MODE_INTER_Q || mb->mode == MODE_INTRA_Q) {
943                                          int dquant = dquant_table[BitstreamGetBits(bs, 2)];                                          int dquant = dquant_table[BitstreamGetBits(bs, 2)];
944                                          DPRINTF(DPRINTF_MB, "dquant %i", dquant);                                          DPRINTF(XVID_DEBUG_MB, "dquant %i", dquant);
945                                          quant += dquant;                                          quant += dquant;
946                                          if (quant > 31) {                                          if (quant > 31) {
947                                                  quant = 31;                                                  quant = 31;
948                                          } else if (quant < 1) {                                          } else if (quant < 1) {
949                                                  quant = 1;                                                  quant = 1;
950                                          }                                          }
951                                          DPRINTF(DPRINTF_MB, "quant %i", quant);                                          DPRINTF(XVID_DEBUG_MB, "quant %i", quant);
952                                  }                                  }
953                                  mb->quant = quant;                                  mb->quant = quant;
954    
955                                  if (dec->interlacing) {                                  if (dec->interlacing) {
956                                          if (cbp || intra) {                                          if (cbp || intra) {
957                                                  mb->field_dct = BitstreamGetBit(bs);                                                  mb->field_dct = BitstreamGetBit(bs);
958                                                  DPRINTF(DPRINTF_MB,"decp: field_dct: %i", mb->field_dct);                                                  DPRINTF(XVID_DEBUG_MB,"decp: field_dct: %i", mb->field_dct);
959                                          }                                          }
960    
961                                          if (mb->mode == MODE_INTER || mb->mode == MODE_INTER_Q) {                                          if (mb->mode == MODE_INTER || mb->mode == MODE_INTER_Q) {
962                                                  mb->field_pred = BitstreamGetBit(bs);                                                  mb->field_pred = BitstreamGetBit(bs);
963                                                  DPRINTF(DPRINTF_MB, "decp: field_pred: %i", mb->field_pred);                                                  DPRINTF(XVID_DEBUG_MB, "decp: field_pred: %i", mb->field_pred);
964    
965                                                  if (mb->field_pred) {                                                  if (mb->field_pred) {
966                                                          mb->field_for_top = BitstreamGetBit(bs);                                                          mb->field_for_top = BitstreamGetBit(bs);
967                                                          DPRINTF(DPRINTF_MB,"decp: field_for_top: %i", mb->field_for_top);                                                          DPRINTF(XVID_DEBUG_MB,"decp: field_for_top: %i", mb->field_for_top);
968                                                          mb->field_for_bot = BitstreamGetBit(bs);                                                          mb->field_for_bot = BitstreamGetBit(bs);
969                                                          DPRINTF(DPRINTF_MB,"decp: field_for_bot: %i", mb->field_for_bot);                                                          DPRINTF(XVID_DEBUG_MB,"decp: field_for_bot: %i", mb->field_for_bot);
970                                                  }                                                  }
971                                          }                                          }
972                                  }                                  }
# Line 1688  Line 1691 
1691                                  break;                                  break;
1692    
1693                          default:                          default:
1694                                  DPRINTF(DPRINTF_ERROR,"Not support B-frame mb_type = %i", mb->mb_type);                                  DPRINTF(XVID_DEBUG_ERROR,"Not support B-frame mb_type = %i", mb->mb_type);
1695                          }                          }
1696                  } /* End of for */                  } /* End of for */
1697          }          }
# Line 1702  Line 1705 
1705  #endif  #endif
1706  }  }
1707    
 /* swap two MACROBLOCK array */  
 void  
 mb_swap(MACROBLOCK ** mb1,  
                 MACROBLOCK ** mb2)  
 {  
         MACROBLOCK *temp = *mb1;  
   
         *mb1 = *mb2;  
         *mb2 = temp;  
 }  
1708    
1709    
1710  /* perform post processing if necessary, and output the image */  /* perform post processing if necessary, and output the image */
1711  void decoder_output(DECODER * dec, IMAGE * img, MACROBLOCK * mbs,  void decoder_output(DECODER * dec, IMAGE * img, MACROBLOCK * mbs,
1712                                          const XVID_DEC_FRAME * frame, int pp_disable)                                          xvid_dec_frame_t * frame, xvid_dec_stats_t * stats, int coding_type)
1713  {  {
1714    
         if ((frame->general & (XVID_DEC_DEBLOCKY|XVID_DEC_DEBLOCKUV)) && !pp_disable)   /* post process */  
         {  
                 /* note: image is stored to tmp */  
                 image_copy(&dec->tmp, img, dec->edged_width, dec->height);  
                 image_deblock_rrv(&dec->tmp, dec->edged_width,  
                                                 mbs, dec->mb_width, dec->mb_height, dec->mb_width,  
                                                 8, frame->general);  
                 img = &dec->tmp;  
         }  
1715    
1716          image_output(img, dec->width, dec->height,          image_output(img, dec->width, dec->height,
1717                                   dec->edged_width, frame->image, frame->stride,                                   dec->edged_width, (uint8_t**)frame->output.plane, frame->output.stride,
1718                                   frame->colorspace, dec->interlacing);                                   frame->output.csp, dec->interlacing);
1719    
1720            if (stats)
1721            {
1722                    stats->type = coding2type(coding_type);
1723                    stats->data.vop.time_base = (int)dec->time_base;
1724                    stats->data.vop.time_increment = 0;     //XXX: todo
1725            }
1726  }  }
1727    
1728    
1729  int  int
1730  decoder_decode(DECODER * dec,  decoder_decode(DECODER * dec,
1731                             XVID_DEC_FRAME * frame, XVID_DEC_STATS * stats)                             xvid_dec_frame_t * frame, xvid_dec_stats_t * stats)
1732  {  {
1733    
1734          Bitstream bs;          Bitstream bs;
# Line 1748  Line 1739 
1739          uint32_t fcode_backward;          uint32_t fcode_backward;
1740          uint32_t intra_dc_threshold;          uint32_t intra_dc_threshold;
1741          WARPPOINTS gmc_warp;          WARPPOINTS gmc_warp;
1742          int vop_type;          int coding_type;
1743          int success = 0;          int success, output, seen_something;
         int output = 0;  
         int seen_something = 0;  
1744    
1745          start_global_timer();          if (XVID_MAJOR(frame->version) != 1 || (stats && XVID_MAJOR(stats->version) != 1))      /* v1.x.x */
1746                    return XVID_ERR_VERSION;
1747    
1748          dec->low_delay_default = (frame->general & XVID_DEC_LOWDELAY);          start_global_timer();
         dec->out_frm = (frame->colorspace == XVID_CSP_EXTERN) ? frame->image : NULL;  
1749    
1750          if ((frame->general & XVID_DEC_DISCONTINUITY))          dec->low_delay_default = (frame->general & XVID_LOWDELAY);
1751            if ((frame->general & XVID_DISCONTINUITY))
1752                  dec->frames = 0;                  dec->frames = 0;
1753            dec->out_frm = (frame->output.csp == XVID_CSP_SLICE) ? &frame->output : NULL;
1754    
1755          if (frame->length < 0)  /* decoder flush */          if (frame->length < 0)  /* decoder flush */
1756          {          {
1757            int ret;
1758                  /* if  not decoding "low_delay/packed", and this isn't low_delay and                  /* if  not decoding "low_delay/packed", and this isn't low_delay and
1759                      we have a reference frame, then outout the reference frame */                      we have a reference frame, then outout the reference frame */
1760                  if (!(dec->low_delay_default && dec->packed_mode) && !dec->low_delay && dec->frames>0)                  if (!(dec->low_delay_default && dec->packed_mode) && !dec->low_delay && dec->frames>0) {
1761                  {                          decoder_output(dec, &dec->refn[0], dec->last_mbs, frame, stats, dec->last_coding_type);
1762                          decoder_output(dec, &dec->refn[0], dec->mbs, frame, dec->last_reduced_resolution);              dec->frames = 0;
1763                          output = 1;              ret = 0;
1764                  }          }else{
1765                if (stats) stats->type = XVID_TYPE_NOTHING;
1766                  frame->length = 0;              ret = XVID_ERR_END;
                 if (stats)  
                 {  
                         stats->notify = output ? XVID_DEC_VOP : XVID_DEC_NOTHING;  
                         stats->data.vop.time_base = (int)dec->time_base;  
                         stats->data.vop.time_increment = 0;     /* XXX: todo */  
1767                  }                  }
1768    
1769                  emms();                  emms();
   
1770                  stop_global_timer();                  stop_global_timer();
1771                  return XVID_ERR_OK;                  return ret;
1772          }          }
1773    
1774          BitstreamInit(&bs, frame->bitstream, frame->length);          BitstreamInit(&bs, frame->bitstream, frame->length);
# Line 1790  Line 1776 
1776          /* XXX: 0x7f is only valid whilst decoding vfw xvid/divx5 avi's */          /* XXX: 0x7f is only valid whilst decoding vfw xvid/divx5 avi's */
1777          if(dec->low_delay_default && frame->length == 1 && BitstreamShowBits(&bs, 8) == 0x7f)          if(dec->low_delay_default && frame->length == 1 && BitstreamShowBits(&bs, 8) == 0x7f)
1778          {          {
                 if (stats)  
                         stats->notify = XVID_DEC_VOP;  
                 frame->length = 1;  
1779                  image_output(&dec->refn[0], dec->width, dec->height, dec->edged_width,                  image_output(&dec->refn[0], dec->width, dec->height, dec->edged_width,
1780                                           frame->image, frame->stride, frame->colorspace, dec->interlacing);                                           (uint8_t**)frame->output.plane, frame->output.stride, frame->output.csp, dec->interlacing);
1781                    if (stats) stats->type = XVID_TYPE_NOTHING;
1782                  emms();                  emms();
1783                  return XVID_ERR_OK;                  return 1;   /* one byte consumed */
1784          }          }
1785    
1786            success = 0;
1787            output = 0;
1788            seen_something = 0;
1789    
1790  repeat:  repeat:
1791    
1792          vop_type =      BitstreamReadHeaders(&bs, dec, &rounding, &reduced_resolution,          coding_type =   BitstreamReadHeaders(&bs, dec, &rounding, &reduced_resolution,
1793                          &quant, &fcode_forward, &fcode_backward, &intra_dc_threshold, &gmc_warp);                          &quant, &fcode_forward, &fcode_backward, &intra_dc_threshold, &gmc_warp);
1794    
1795          DPRINTF(DPRINTF_HEADER, "vop_type=%i,  packed=%i,  time=%lli,  time_pp=%i,  time_bp=%i",          DPRINTF(XVID_DEBUG_HEADER, "coding_type=%i,  packed=%i,  time=%lli,  time_pp=%i,  time_bp=%i",
1796                                                          vop_type,       dec->packed_mode, dec->time, dec->time_pp, dec->time_bp);                                                          coding_type,    dec->packed_mode, dec->time, dec->time_pp, dec->time_bp);
1797    
1798          if (vop_type == -1)          if (coding_type == -1) /* nothing */
1799          {          {
1800                  if (success) goto done;                  if (success) goto done;
1801            if (stats) stats->type = XVID_TYPE_NOTHING;
1802                  emms();                  emms();
1803                  return XVID_ERR_FAIL;          return BitstreamPos(&bs)/8;
1804          }          }
1805    
1806          if (vop_type == -2 || vop_type == -3)          if (coding_type == -2 || coding_type == -3)   /* vol and/or resize */
1807          {          {
1808                  if (vop_type == -3)                  if (coding_type == -3)
1809                          decoder_resize(dec);                          decoder_resize(dec);
1810    
1811                  if (stats)                  if (stats)
1812                  {                  {
1813                          stats->notify = XVID_DEC_VOL;                          stats->type = XVID_TYPE_VOL;
1814                          stats->data.vol.general = 0;                          stats->data.vol.general = 0;
1815                          if (dec->interlacing)                          /*XXX: if (dec->interlacing)
1816                                  stats->data.vol.general |= XVID_INTERLACING;                                  stats->data.vol.general |= ++INTERLACING; */
1817                          stats->data.vol.width = dec->width;                          stats->data.vol.width = dec->width;
1818                          stats->data.vol.height = dec->height;                          stats->data.vol.height = dec->height;
1819                          stats->data.vol.aspect_ratio = dec->aspect_ratio;                          stats->data.vol.par = dec->aspect_ratio;
1820                          stats->data.vol.par_width = dec->par_width;                          stats->data.vol.par_width = dec->par_width;
1821                          stats->data.vol.par_height = dec->par_height;                          stats->data.vol.par_height = dec->par_height;
                         frame->length = BitstreamPos(&bs) / 8;  
1822                          emms();                          emms();
1823                          return XVID_ERR_OK;                          return BitstreamPos(&bs)/8;     /* number of bytes consumed */
1824                  }                  }
1825                  goto repeat;                  goto repeat;
1826          }          }
# Line 1841  Line 1829 
1829    
1830    
1831          /* packed_mode: special-N_VOP treament */          /* packed_mode: special-N_VOP treament */
1832          if (dec->packed_mode && vop_type == N_VOP)          if (dec->packed_mode && coding_type == N_VOP)
1833          {          {
1834                  if (dec->low_delay_default && dec->frames > 0)                  if (dec->low_delay_default && dec->frames > 0)
1835                  {                  {
1836                          decoder_output(dec, &dec->refn[0], dec->last_mbs, frame, dec->last_reduced_resolution);                          decoder_output(dec, &dec->refn[0], dec->last_mbs, frame, stats, dec->last_coding_type);
1837                          output = 1;                          output = 1;
1838                  }                  }
1839                  /* ignore otherwise */                  /* ignore otherwise */
1840          }          }
1841          else if (vop_type != B_VOP)          else if (coding_type != B_VOP)
1842          {          {
1843                  switch(vop_type)                  switch(coding_type)
1844                  {                  {
1845                  case I_VOP :                  case I_VOP :
1846                          decoder_iframe(dec, &bs, reduced_resolution, quant, intra_dc_threshold);                          decoder_iframe(dec, &bs, reduced_resolution, quant, intra_dc_threshold);
# Line 1866  Line 1854 
1854                                                  fcode_forward, intra_dc_threshold, &gmc_warp);                                                  fcode_forward, intra_dc_threshold, &gmc_warp);
1855                          break;                          break;
1856                  case N_VOP :                  case N_VOP :
1857                            // XXX: not_coded vops are not used for forward prediction
1858                            //              we should not swap(last_mbs,mbs)
1859                          image_copy(&dec->cur, &dec->refn[0], dec->edged_width, dec->height);                          image_copy(&dec->cur, &dec->refn[0], dec->edged_width, dec->height);
1860                          break;                          break;
1861                  }                  }
# Line 1874  Line 1864 
1864                  {                  {
1865                          image_deblock_rrv(&dec->cur, dec->edged_width, dec->mbs,                          image_deblock_rrv(&dec->cur, dec->edged_width, dec->mbs,
1866                                  (dec->width + 31) / 32, (dec->height + 31) / 32, dec->mb_width,                                  (dec->width + 31) / 32, (dec->height + 31) / 32, dec->mb_width,
1867                                  16, XVID_DEC_DEBLOCKY|XVID_DEC_DEBLOCKUV);                                  16, 0);
1868                  }                  }
1869    
1870                  /* note: for packed_mode, output is performed when the special-N_VOP is decoded */                  /* note: for packed_mode, output is performed when the special-N_VOP is decoded */
# Line 1882  Line 1872 
1872                  {                  {
1873                          if (dec->low_delay)                          if (dec->low_delay)
1874                          {                          {
1875                                  decoder_output(dec, &dec->cur, dec->mbs, frame, reduced_resolution);                                  decoder_output(dec, &dec->cur, dec->mbs, frame, stats, coding_type);
1876                                  output = 1;                                  output = 1;
1877                          }                          }
1878                          else if (dec->frames > 0)       /* is the reference frame valid? */                          else if (dec->frames > 0)       /* is the reference frame valid? */
1879                          {                          {
1880                                  /* output the reference frame */                                  /* output the reference frame */
1881                                  decoder_output(dec, &dec->refn[0], dec->last_mbs, frame, dec->last_reduced_resolution);                                  decoder_output(dec, &dec->refn[0], dec->last_mbs, frame, stats, dec->last_coding_type);
1882                                  output = 1;                                  output = 1;
1883                          }                          }
1884                  }                  }
1885    
1886                  image_swap(&dec->refn[0], &dec->refn[1]);                  image_swap(&dec->refn[0], &dec->refn[1]);
1887                  image_swap(&dec->cur, &dec->refn[0]);                  image_swap(&dec->cur, &dec->refn[0]);
1888                  mb_swap(&dec->mbs, &dec->last_mbs);          SWAP(MACROBLOCK *, dec->mbs, dec->last_mbs);
1889                  dec->last_reduced_resolution = reduced_resolution;                  dec->last_reduced_resolution = reduced_resolution;
1890            dec->last_coding_type = coding_type;
1891    
1892                  dec->frames++;                  dec->frames++;
1893                  seen_something = 1;                  seen_something = 1;
# Line 1905  Line 1896 
1896    
1897                  if (dec->low_delay)                  if (dec->low_delay)
1898                  {                  {
1899                          DPRINTF(DPRINTF_ERROR, "warning: bvop found in low_delay==1 stream");                          DPRINTF(XVID_DEBUG_ERROR, "warning: bvop found in low_delay==1 stream");
1900                          dec->low_delay = 1;                          dec->low_delay = 1;
1901                  }                  }
1902    
# Line 1923  Line 1914 
1914                          decoder_bframe(dec, &bs, quant, fcode_forward, fcode_backward);                          decoder_bframe(dec, &bs, quant, fcode_forward, fcode_backward);
1915                  }                  }
1916    
1917                  decoder_output(dec, &dec->cur, dec->mbs, frame, reduced_resolution);                  decoder_output(dec, &dec->cur, dec->mbs, frame, stats, coding_type);
1918                  output = 1;                  output = 1;
1919                  dec->frames++;                  dec->frames++;
1920          }          }
# Line 1946  Line 1937 
1937                  if (dec->packed_mode && seen_something)                  if (dec->packed_mode && seen_something)
1938                  {                  {
1939                          /* output the recently decoded frame */                          /* output the recently decoded frame */
1940                          decoder_output(dec, &dec->refn[0], dec->last_mbs, frame, dec->last_reduced_resolution);                          decoder_output(dec, &dec->refn[0], dec->last_mbs, frame, stats, dec->last_coding_type);
                         output = 1;  
1941                  }                  }
1942                  else                  else
1943                  {                  {
# Line 1957  Line 1947 
1947                          image_printf(&dec->cur, dec->edged_width, dec->height, 16, 64,                          image_printf(&dec->cur, dec->edged_width, dec->height, 16, 64,
1948                                  "bframe decoder lag");                                  "bframe decoder lag");
1949    
1950                          decoder_output(dec, &dec->cur, NULL, frame, 1 /*disable pp*/);                          decoder_output(dec, &dec->cur, NULL, frame, stats, P_VOP);
1951                  }                          if (stats) stats->type = XVID_TYPE_NOTHING;
         }  
1952    
1953          frame->length = BitstreamPos(&bs) / 8;                  }
   
         if (stats)  
         {  
                 stats->notify = output ? XVID_DEC_VOP : XVID_DEC_NOTHING;  
                 stats->data.vop.time_base = (int)dec->time_base;  
                 stats->data.vop.time_increment = 0;     /* XXX: todo */  
1954          }          }
1955    
1956          emms();          emms();
   
1957          stop_global_timer();          stop_global_timer();
1958    
1959          return XVID_ERR_OK;          return BitstreamPos(&bs) / 8;   /* number of bytes consumed */
1960  }  }

Legend:
Removed from v.1.49  
changed lines
  Added in v.1.49.2.4

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