[svn] / branches / dev-api-3 / xvidcore / src / encoder.c Repository:
ViewVC logotype

Diff of /branches/dev-api-3/xvidcore/src/encoder.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 577, Thu Oct 3 12:06:42 2002 UTC revision 579, Sat Oct 5 21:37:44 2002 UTC
# Line 39  Line 39 
39   *             MinChen <chenm001@163.com>   *             MinChen <chenm001@163.com>
40   *  14.04.2002 added FrameCodeB()   *  14.04.2002 added FrameCodeB()
41   *   *
42   *  $Id: encoder.c,v 1.76.2.11 2002-10-03 12:06:42 suxen_drol Exp $   *  $Id: encoder.c,v 1.76.2.12 2002-10-05 21:36:35 Isibaar Exp $
43   *   *
44   ****************************************************************************/   ****************************************************************************/
45    
# Line 1151  Line 1151 
1151                  pEnc->current->quant = pFrame->quant;                  pEnc->current->quant = pFrame->quant;
1152          }          }
1153    
1154            if ((pEnc->current->global_flags & XVID_QUARTERPEL))
1155                    pEnc->mbParam.m_quarterpel = 1;
1156            else
1157                    pEnc->mbParam.m_quarterpel = 0;
1158    
1159          if ((pEnc->current->global_flags & XVID_LUMIMASKING)) {          if ((pEnc->current->global_flags & XVID_LUMIMASKING)) {
1160                  int *temp_dquants =                  int *temp_dquants =
1161                          (int *) xvid_malloc(pEnc->mbParam.mb_width *                          (int *) xvid_malloc(pEnc->mbParam.mb_width *
# Line 1580  Line 1585 
1585          int iLimit;          int iLimit;
1586          int x, y, k;          int x, y, k;
1587          int iSearchRange;          int iSearchRange;
1588          int bIntra;          int bIntra, skip_possible;
1589    
1590          /* IMAGE *pCurrent = &pEnc->current->image; */          /* IMAGE *pCurrent = &pEnc->current->image; */
1591          IMAGE *pRef = &pEnc->reference->image;          IMAGE *pRef = &pEnc->reference->image;
# Line 1606  Line 1611 
1611                  image_interpolate(pRef, &pEnc->vInterH, &pEnc->vInterV,                  image_interpolate(pRef, &pEnc->vInterH, &pEnc->vInterV,
1612                                                    &pEnc->vInterHV, pEnc->mbParam.edged_width,                                                    &pEnc->vInterHV, pEnc->mbParam.edged_width,
1613                                                    pEnc->mbParam.edged_height,                                                    pEnc->mbParam.edged_height,
1614                                                      pEnc->mbParam.m_quarterpel,
1615                                                    pEnc->current->rounding_type);                                                    pEnc->current->rounding_type);
1616                  stop_inter_timer();                  stop_inter_timer();
1617          }          }
# Line 1660  Line 1666 
1666                                                                           dct_codes, pEnc->mbParam.width,                                                                           dct_codes, pEnc->mbParam.width,
1667                                                                           pEnc->mbParam.height,                                                                           pEnc->mbParam.height,
1668                                                                           pEnc->mbParam.edged_width,                                                                           pEnc->mbParam.edged_width,
1669                                                                             pEnc->mbParam.m_quarterpel,
1670                                                                           pEnc->current->rounding_type);                                                                           pEnc->current->rounding_type);
1671                                  stop_comp_timer();                                  stop_comp_timer();
1672    
# Line 1705  Line 1712 
1712    
1713                          /* Finished processing the MB, now check if to CODE or SKIP */                          /* Finished processing the MB, now check if to CODE or SKIP */
1714    
1715                          if ((pMB->mode == MODE_NOT_CODED) ||                          skip_possible = (pMB->cbp == 0) & (pMB->mode == MODE_INTER) &
1716                                  (pMB->cbp == 0 && pMB->mode == MODE_INTER && pMB->mvs[0].x == 0 &&                                                          (pMB->dquant == NO_CHANGE);
                                 pMB->mvs[0].y == 0 && pMB->dquant == NO_CHANGE)) {  
1717    
1718                            if(pEnc->mbParam.m_quarterpel)
1719                                    skip_possible &= (pMB->qmvs[0].x == 0) & (pMB->qmvs[0].y == 0);
1720                            else
1721                                    skip_possible &= (pMB->mvs[0].x == 0) & (pMB->mvs[0].y == 0);
1722    
1723                            if ((pMB->mode == MODE_NOT_CODED) || (skip_possible)) {
1724  /* This is a candidate for SKIPping, but check intermediate B-frames first */  /* This is a candidate for SKIPping, but check intermediate B-frames first */
1725    
1726                                  int bSkip = 1;                                  int bSkip = 1;
# Line 1728  Line 1740 
1740                                  if (!bSkip)                                  if (!bSkip)
1741                                  {                                  {
1742                                          VECTOR predMV;                                          VECTOR predMV;
1743                                            if(pEnc->mbParam.m_quarterpel)
1744                                                    predMV = get_qpmv2(pEnc->current->mbs, pEnc->mbParam.mb_width, 0, x, y, 0);
1745                                            else
1746                                          predMV = get_pmv2(pEnc->current->mbs, pEnc->mbParam.mb_width, 0, x, y, 0);                                          predMV = get_pmv2(pEnc->current->mbs, pEnc->mbParam.mb_width, 0, x, y, 0);
1747                                          pMB->pmvs[0].x = -predMV.x; pMB->pmvs[0].y = -predMV.y;                                          pMB->pmvs[0].x = -predMV.x; pMB->pmvs[0].y = -predMV.y;
1748                                          pMB->mode = MODE_INTER;                                          pMB->mode = MODE_INTER;
# Line 1763  Line 1778 
1778          iSearchRange = 1 << (3 + pEnc->mbParam.m_fcode);          iSearchRange = 1 << (3 + pEnc->mbParam.m_fcode);
1779    
1780          if ((fSigma > iSearchRange / 3)          if ((fSigma > iSearchRange / 3)
1781                  && (pEnc->mbParam.m_fcode <= 3))        // maximum search range 128                  && (pEnc->mbParam.m_fcode <= (3 + pEnc->mbParam.m_quarterpel))) // maximum search range 128
1782          {          {
1783                  pEnc->mbParam.m_fcode++;                  pEnc->mbParam.m_fcode++;
1784                  iSearchRange *= 2;                  iSearchRange *= 2;
1785          } else if ((fSigma < iSearchRange / 6)          } else if ((fSigma < iSearchRange / 6)
1786                             && (pEnc->sStat.fMvPrevSigma >= 0)                             && (pEnc->sStat.fMvPrevSigma >= 0)
1787                             && (pEnc->sStat.fMvPrevSigma < iSearchRange / 6)                             && (pEnc->sStat.fMvPrevSigma < iSearchRange / 6)
1788                             && (pEnc->mbParam.m_fcode >= 2))     // minimum search range 16                          && (pEnc->mbParam.m_fcode >= (2 + pEnc->mbParam.m_quarterpel))) // minimum search range 16
1789          {          {
1790                  pEnc->mbParam.m_fcode--;                  pEnc->mbParam.m_fcode--;
1791                  iSearchRange /= 2;                  iSearchRange /= 2;
# Line 1842  Line 1857 
1857          start_timer();          start_timer();
1858          image_interpolate(f_ref, &pEnc->f_refh, &pEnc->f_refv, &pEnc->f_refhv,          image_interpolate(f_ref, &pEnc->f_refh, &pEnc->f_refv, &pEnc->f_refhv,
1859                                            pEnc->mbParam.edged_width, pEnc->mbParam.edged_height,                                            pEnc->mbParam.edged_width, pEnc->mbParam.edged_height,
1860                                            0);                                            pEnc->mbParam.m_quarterpel, 0);
1861          stop_inter_timer();          stop_inter_timer();
1862    
1863          // backward          // backward
# Line 1852  Line 1867 
1867          start_timer();          start_timer();
1868          image_interpolate(b_ref, &pEnc->vInterH, &pEnc->vInterV, &pEnc->vInterHV,          image_interpolate(b_ref, &pEnc->vInterH, &pEnc->vInterV, &pEnc->vInterHV,
1869                                            pEnc->mbParam.edged_width, pEnc->mbParam.edged_height,                                            pEnc->mbParam.edged_width, pEnc->mbParam.edged_height,
1870                                            0);                                            pEnc->mbParam.m_quarterpel, 0);
1871          stop_inter_timer();          stop_inter_timer();
1872    
1873          start_timer();          start_timer();

Legend:
Removed from v.577  
changed lines
  Added in v.579

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