[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 573, Mon Sep 30 14:16:02 2002 UTC revision 642, Mon Nov 11 20:53:34 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.8 2002-09-30 14:16:02 chl Exp $   *  $Id: encoder.c,v 1.76.2.17 2002-11-11 20:53:34 Isibaar Exp $
43   *   *
44   ****************************************************************************/   ****************************************************************************/
45    
# Line 54  Line 54 
54  #include "global.h"  #include "global.h"
55  #include "utils/timer.h"  #include "utils/timer.h"
56  #include "image/image.h"  #include "image/image.h"
 #ifdef BFRAMES  
57  #include "image/font.h"  #include "image/font.h"
58  #include "motion/sad.h"  #include "motion/sad.h"
 #endif  
59  #include "motion/motion.h"  #include "motion/motion.h"
60  #include "bitstream/cbp.h"  #include "bitstream/cbp.h"
61  #include "utils/mbfunctions.h"  #include "utils/mbfunctions.h"
# Line 109  Line 107 
107  };  };
108    
109    
 static void __inline  
 image_null(IMAGE * image)  
 {  
         image->y = image->u = image->v = NULL;  
 }  
   
   
110  /*****************************************************************************  /*****************************************************************************
111   * Encoder creation   * Encoder creation
112   *   *
# Line 625  Line 616 
616          start_timer();          start_timer();
617          if (image_input          if (image_input
618                  (&pEnc->queue[pEnc->queue_tail], pEnc->mbParam.width, pEnc->mbParam.height,                  (&pEnc->queue[pEnc->queue_tail], pEnc->mbParam.width, pEnc->mbParam.height,
619                   pEnc->mbParam.edged_width, pFrame->image, pFrame->colorspace))                   pEnc->mbParam.edged_width, pFrame->image, pFrame->stride, pFrame->colorspace, pFrame->general & XVID_INTERLACING))
620                  return;                  return;
621          stop_conv_timer();          stop_conv_timer();
622    
# Line 720  Line 711 
711                          pFrame->length = BitstreamLength(&bs);                          pFrame->length = BitstreamLength(&bs);
712                          pFrame->intra = 0;                          pFrame->intra = 0;
713    
714                            emms();
715    
716                          return XVID_ERR_OK;                          return XVID_ERR_OK;
717                  }                  }
718    
# Line 738  Line 731 
731                  if (input_valid)                  if (input_valid)
732                          queue_image(pEnc, pFrame);                          queue_image(pEnc, pFrame);
733    
734                    emms();
735    
736                  return XVID_ERR_OK;                  return XVID_ERR_OK;
737          }          }
738    
739          if (pEnc->bframenum_head > 0) {          if (pEnc->bframenum_head > 0) {
740                  pEnc->bframenum_head = pEnc->bframenum_tail = 0;                  pEnc->bframenum_head = pEnc->bframenum_tail = 0;
741    
742                    /* write an empty marker to the bitstream.
743    
744                       for divx5 decoder compatibility, this marker must consist
745                       of a not-coded p-vop, with a time_base of zero, and time_increment
746                       indentical to the future-referece frame.
747                    */
748    
749                  if ((pEnc->global & XVID_GLOBAL_PACKED)) {                  if ((pEnc->global & XVID_GLOBAL_PACKED)) {
750                            int tmp;
751    
752                          DPRINTF(DPRINTF_DEBUG,"*** EMPTY bf: head=%i tail=%i   queue: head=%i tail=%i size=%i",                          DPRINTF(DPRINTF_DEBUG,"*** EMPTY bf: head=%i tail=%i   queue: head=%i tail=%i size=%i",
753                                  pEnc->bframenum_head, pEnc->bframenum_tail,                                  pEnc->bframenum_head, pEnc->bframenum_tail,
754                                  pEnc->queue_head, pEnc->queue_tail, pEnc->queue_size);                                  pEnc->queue_head, pEnc->queue_tail, pEnc->queue_size);
755    
                         set_timecodes(pEnc->current,pEnc->reference,pEnc->mbParam.fbase);  
                         BitstreamWriteVopHeader(&bs, &pEnc->mbParam, pEnc->current, 0);  
756                          BitstreamPad(&bs);                          BitstreamPad(&bs);
757                          BitstreamPutBits(&bs, 0x7f, 8);  
758                            tmp = pEnc->current->seconds;
759                            pEnc->current->seconds = 0; /* force time_base = 0 */
760                            BitstreamWriteVopHeader(&bs, &pEnc->mbParam, pEnc->current, 0);
761                            pEnc->current->seconds = tmp;
762    
763                          pFrame->length = BitstreamLength(&bs);                          pFrame->length = BitstreamLength(&bs);
764                          pFrame->intra = 0;                          pFrame->intra = 0;
# Line 761  Line 766 
766                          if (input_valid)                          if (input_valid)
767                                  queue_image(pEnc, pFrame);                                  queue_image(pEnc, pFrame);
768    
769                            emms();
770    
771                          return XVID_ERR_OK;                          return XVID_ERR_OK;
772                  }                  }
773          }          }
# Line 791  Line 798 
798                  start_timer();                  start_timer();
799                  if (image_input                  if (image_input
800                          (&pEnc->current->image, pEnc->mbParam.width, pEnc->mbParam.height,                          (&pEnc->current->image, pEnc->mbParam.width, pEnc->mbParam.height,
801                          pEnc->mbParam.edged_width, pFrame->image, pFrame->colorspace))                          pEnc->mbParam.edged_width, pFrame->image, pFrame->stride, pFrame->colorspace, pFrame->general & XVID_INTERLACING))
802                    {
803                            emms();
804                          return XVID_ERR_FORMAT;                          return XVID_ERR_FORMAT;
805                    }
806                  stop_conv_timer();                  stop_conv_timer();
807    
808                  // queue input frame, and dequue next image                  // queue input frame, and dequue next image
# Line 815  Line 825 
825                  pEnc->queue_head =  (pEnc->queue_head + 1) % pEnc->mbParam.max_bframes;                  pEnc->queue_head =  (pEnc->queue_head + 1) % pEnc->mbParam.max_bframes;
826                  pEnc->queue_size--;                  pEnc->queue_size--;
827    
828          } else if (BitstreamPos(&bs) == 0) {          } else {
829    
830                    /* if nothing was encoded, write an 'ignore this frame' flag
831                       to the bitstream */
832    
833                    if (BitstreamPos(&bs) == 0) {
834    
835                  DPRINTF(DPRINTF_DEBUG,"*** SKIP bf: head=%i tail=%i   queue: head=%i tail=%i size=%i",                  DPRINTF(DPRINTF_DEBUG,"*** SKIP bf: head=%i tail=%i   queue: head=%i tail=%i size=%i",
836                                  pEnc->bframenum_head, pEnc->bframenum_tail,                                  pEnc->bframenum_head, pEnc->bframenum_tail,
837                                  pEnc->queue_head, pEnc->queue_tail, pEnc->queue_size);                                  pEnc->queue_head, pEnc->queue_tail, pEnc->queue_size);
838    
839                            BitstreamPutBits(&bs, 0x7f, 8);
840                  pFrame->intra = 0;                  pFrame->intra = 0;
841                    }
                 set_timecodes(pEnc->current,pEnc->reference,pEnc->mbParam.fbase);  
                 BitstreamWriteVopHeader(&bs, &pEnc->mbParam, pEnc->current, 0); // write N_VOP  
                 BitstreamPad(&bs);  
                 pFrame->length = BitstreamLength(&bs);  
   
                 return XVID_ERR_OK;  
   
         } else {  
842    
843                  pFrame->length = BitstreamLength(&bs);                  pFrame->length = BitstreamLength(&bs);
844                    emms();
845                  return XVID_ERR_OK;                  return XVID_ERR_OK;
846          }          }
847    
# Line 872  Line 881 
881    
882                  if ((pEnc->global & XVID_GLOBAL_DEBUG)) {                  if ((pEnc->global & XVID_GLOBAL_DEBUG)) {
883                          image_printf(&pEnc->current->image, pEnc->mbParam.edged_width, pEnc->mbParam.height, 5, 5,                          image_printf(&pEnc->current->image, pEnc->mbParam.edged_width, pEnc->mbParam.height, 5, 5,
884                                  "%i  if:%i  st:%i:%i", pEnc->m_framenum++, pEnc->iFrameNum, pEnc->current->seconds, pEnc->current->ticks);                                  "%i  if:%i  st:%i", pEnc->m_framenum++, pEnc->iFrameNum, pEnc->current->stamp);
885                  }                  }
886    
887          /* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%          /* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# Line 963  Line 972 
972                  pEnc->flush_bframes = 1;                  pEnc->flush_bframes = 1;
973    
974                  if ((pEnc->global & XVID_GLOBAL_PACKED) && pEnc->bframenum_tail > 0) {                  if ((pEnc->global & XVID_GLOBAL_PACKED) && pEnc->bframenum_tail > 0) {
975                          BitstreamPad(&bs);                          BitstreamPadAlways(&bs);
976                          input_valid = 0;                          input_valid = 0;
977                          goto ipvop_loop;                          goto ipvop_loop;
978                  }                  }
# Line 972  Line 981 
981                   * NB : sequences like "IIBB" decode fine with msfdam but,                   * NB : sequences like "IIBB" decode fine with msfdam but,
982                   *      go screwy with divx 5.00                   *      go screwy with divx 5.00
983                   */                   */
984          } else if (pEnc->bframenum_tail >= pEnc->mbParam.max_bframes || mode != 0) {          } else if ((pEnc->bframenum_tail >= pEnc->mbParam.max_bframes) || (mode != 0)) {
985    
986                  /*                  /*
987                   * This will be coded as a Predicted Frame                   * This will be coded as a Predicted Frame
988                   */                   */
# Line 989  Line 999 
999                  pFrame->intra = 0;                  pFrame->intra = 0;
1000                  pEnc->flush_bframes = 1;                  pEnc->flush_bframes = 1;
1001    
1002                  if ((pEnc->global & XVID_GLOBAL_PACKED)) {                  if ((pEnc->global & XVID_GLOBAL_PACKED) && (pEnc->bframenum_tail > 0)) {
1003                          BitstreamPad(&bs);                          BitstreamPadAlways(&bs);
1004                          input_valid = 0;                          input_valid = 0;
1005                          goto ipvop_loop;                          goto ipvop_loop;
1006                  }                  }
# Line 1070  Line 1080 
1080          stop_global_timer();          stop_global_timer();
1081          write_timer();          write_timer();
1082    
1083            emms();
1084          return XVID_ERR_OK;          return XVID_ERR_OK;
1085  }  }
1086    
# Line 1124  Line 1135 
1135          start_timer();          start_timer();
1136          if (image_input          if (image_input
1137                  (&pEnc->current->image, pEnc->mbParam.width, pEnc->mbParam.height,                  (&pEnc->current->image, pEnc->mbParam.width, pEnc->mbParam.height,
1138                   pEnc->mbParam.edged_width, pFrame->image, pFrame->colorspace) < 0)                   pEnc->mbParam.edged_width, pFrame->image, pFrame->stride, pFrame->colorspace, pFrame->general & XVID_INTERLACING) < 0)
1139                  return XVID_ERR_FORMAT;                  return XVID_ERR_FORMAT;
1140          stop_conv_timer();          stop_conv_timer();
1141    
# Line 1143  Line 1154 
1154                  pEnc->current->quant = pFrame->quant;                  pEnc->current->quant = pFrame->quant;
1155          }          }
1156    
1157            if ((pEnc->current->global_flags & XVID_QUARTERPEL))
1158                    pEnc->mbParam.m_quarterpel = 1;
1159            else
1160                    pEnc->mbParam.m_quarterpel = 0;
1161    
1162          if ((pEnc->current->global_flags & XVID_LUMIMASKING)) {          if ((pEnc->current->global_flags & XVID_LUMIMASKING)) {
1163                  int *temp_dquants =                  int *temp_dquants =
1164                          (int *) xvid_malloc(pEnc->mbParam.mb_width *                          (int *) xvid_malloc(pEnc->mbParam.mb_width *
# Line 1496  Line 1512 
1512          pEnc->iFrameNum = 0;          pEnc->iFrameNum = 0;
1513          pEnc->mbParam.m_rounding_type = 1;          pEnc->mbParam.m_rounding_type = 1;
1514          pEnc->current->rounding_type = pEnc->mbParam.m_rounding_type;          pEnc->current->rounding_type = pEnc->mbParam.m_rounding_type;
1515            pEnc->current->quarterpel =  pEnc->mbParam.m_quarterpel;
1516          pEnc->current->coding_type = I_VOP;          pEnc->current->coding_type = I_VOP;
1517    
1518          BitstreamWriteVolHeader(bs, &pEnc->mbParam, pEnc->current);          BitstreamWriteVolHeader(bs, &pEnc->mbParam, pEnc->current);
# Line 1505  Line 1522 
1522                  BitstreamWriteUserData(bs, DIVX501B481P, strlen(DIVX501B481P));                  BitstreamWriteUserData(bs, DIVX501B481P, strlen(DIVX501B481P));
1523          }          }
1524    
1525    #define XVID_ID "XviD" XVID_BS_VERSION
1526            BitstreamWriteUserData(bs, XVID_ID, strlen(XVID_ID));
1527    
1528          set_timecodes(pEnc->current,pEnc->reference,pEnc->mbParam.fbase);          set_timecodes(pEnc->current,pEnc->reference,pEnc->mbParam.fbase);
1529          BitstreamWriteVopHeader(bs, &pEnc->mbParam, pEnc->current, 1);          BitstreamWriteVopHeader(bs, &pEnc->mbParam, pEnc->current, 1);
1530    
# Line 1572  Line 1592 
1592          int iLimit;          int iLimit;
1593          int x, y, k;          int x, y, k;
1594          int iSearchRange;          int iSearchRange;
1595          int bIntra;          int bIntra, skip_possible;
1596    
1597          /* IMAGE *pCurrent = &pEnc->current->image; */          /* IMAGE *pCurrent = &pEnc->current->image; */
1598          IMAGE *pRef = &pEnc->reference->image;          IMAGE *pRef = &pEnc->reference->image;
# Line 1584  Line 1604 
1604    
1605          pEnc->mbParam.m_rounding_type = 1 - pEnc->mbParam.m_rounding_type;          pEnc->mbParam.m_rounding_type = 1 - pEnc->mbParam.m_rounding_type;
1606          pEnc->current->rounding_type = pEnc->mbParam.m_rounding_type;          pEnc->current->rounding_type = pEnc->mbParam.m_rounding_type;
1607            pEnc->current->quarterpel =  pEnc->mbParam.m_quarterpel;
1608          pEnc->current->fcode = pEnc->mbParam.m_fcode;          pEnc->current->fcode = pEnc->mbParam.m_fcode;
1609    
1610          if (!force_inter)          if (!force_inter)
# Line 1598  Line 1619 
1619                  image_interpolate(pRef, &pEnc->vInterH, &pEnc->vInterV,                  image_interpolate(pRef, &pEnc->vInterH, &pEnc->vInterV,
1620                                                    &pEnc->vInterHV, pEnc->mbParam.edged_width,                                                    &pEnc->vInterHV, pEnc->mbParam.edged_width,
1621                                                    pEnc->mbParam.edged_height,                                                    pEnc->mbParam.edged_height,
1622                                                      pEnc->mbParam.m_quarterpel,
1623                                                    pEnc->current->rounding_type);                                                    pEnc->current->rounding_type);
1624                  stop_inter_timer();                  stop_inter_timer();
1625          }          }
1626    
1627            if (pEnc->current->global_flags & XVID_GMC) {
1628    //              printf("Global Motion = %d %d quarterpel=%d\n", pEnc->current->GMC_MV.x, pEnc->current->GMC_MV.y,pEnc->current->quarterpel);
1629                    DPRINTF(DPRINTF_HEADER, "Global Motion = %d %d quarterpel=%d\n", pEnc->current->GMC_MV.x, pEnc->current->GMC_MV.y,pEnc->current->quarterpel);
1630                    pEnc->current->coding_type = S_VOP;
1631            } else
1632                    pEnc->current->coding_type = P_VOP;
1633    
1634          start_timer();          start_timer();
1635          if (pEnc->current->global_flags & XVID_HINTEDME_SET) {          if (pEnc->current->global_flags & XVID_HINTEDME_SET) {
1636                  HintedMESet(pEnc, &bIntra);                  HintedMESet(pEnc, &bIntra);
1637                  if (bIntra == 0) MotionEstimationHinted(&pEnc->mbParam, pEnc->current, pEnc->reference,          if (bIntra == 0) {
1638                            pEnc->current->fcode = FindFcode(&pEnc->mbParam, pEnc->current);
1639                            MotionEstimationHinted(&pEnc->mbParam, pEnc->current, pEnc->reference,
1640                                                                                          &pEnc->vInterH, &pEnc->vInterV, &pEnc->vInterHV);                                                                                          &pEnc->vInterH, &pEnc->vInterV, &pEnc->vInterHV);
1641                    }
1642    
1643          } else {          } else {
1644    
# Line 1614  Line 1646 
1646                  MotionEstimation(&pEnc->mbParam, pEnc->current, pEnc->reference,                  MotionEstimation(&pEnc->mbParam, pEnc->current, pEnc->reference,
1647                           &pEnc->vInterH, &pEnc->vInterV, &pEnc->vInterHV,                           &pEnc->vInterH, &pEnc->vInterV, &pEnc->vInterHV,
1648                           iLimit);                           iLimit);
   
1649          }          }
1650          stop_motion_timer();          stop_motion_timer();
1651    
1652          if (bIntra == 1) return FrameCodeI(pEnc, bs, pBits);          if (bIntra == 1) return FrameCodeI(pEnc, bs, pBits);
1653    
1654          pEnc->current->coding_type = P_VOP;          if ( (pEnc->current->GMC_MV.x == 0) && (pEnc->current->GMC_MV.y == 0) )
1655                            pEnc->current->coding_type = P_VOP;             /* no global motion -> no GMC */
1656    
1657    
1658          if (vol_header)          if (vol_header)
1659                  BitstreamWriteVolHeader(bs, &pEnc->mbParam, pEnc->current);                  BitstreamWriteVolHeader(bs, &pEnc->mbParam, pEnc->current);
# Line 1649  Line 1682 
1682                                                                           dct_codes, pEnc->mbParam.width,                                                                           dct_codes, pEnc->mbParam.width,
1683                                                                           pEnc->mbParam.height,                                                                           pEnc->mbParam.height,
1684                                                                           pEnc->mbParam.edged_width,                                                                           pEnc->mbParam.edged_width,
1685                                                                             pEnc->mbParam.m_quarterpel,
1686                                                                           pEnc->current->rounding_type);                                                                           pEnc->current->rounding_type);
1687                                  stop_comp_timer();                                  stop_comp_timer();
1688    
# Line 1694  Line 1728 
1728    
1729                          /* Finished processing the MB, now check if to CODE or SKIP */                          /* Finished processing the MB, now check if to CODE or SKIP */
1730    
1731                          if ((pMB->mode == MODE_NOT_CODED) ||                          skip_possible = (pMB->cbp == 0) & (pMB->mode == MODE_INTER) &
1732                                  (pMB->cbp == 0 && pMB->mode == MODE_INTER && pMB->mvs[0].x == 0 &&                                                          (pMB->dquant == NO_CHANGE);
1733                                  pMB->mvs[0].y == 0 && pMB->dquant == NO_CHANGE)) {  
1734                            if(pEnc->mbParam.m_quarterpel)
1735                            {       skip_possible &= (pMB->qmvs[0].x == pEnc->current->GMC_MV.x) & (pMB->qmvs[0].y == pEnc->current->GMC_MV.y);
1736                            }
1737                            else
1738                            {       skip_possible &= (pMB->mvs[0].x == pEnc->current->GMC_MV.x) & (pMB->mvs[0].y == pEnc->current->GMC_MV.y);
1739                            }
1740    
1741  /* This is a candidate for SKIPping, but check intermediate B-frames first */                          if ( (pMB->mode == MODE_NOT_CODED) || (skip_possible)) {
1742    
1743    /* This is a candidate for SKIPping, but for P-VOPs check intermediate B-frames first */
1744                                  int bSkip = 1;                                  int bSkip = 1;
                                 pMB->mode = MODE_NOT_CODED;  
1745    
1746                                    if (pEnc->current->coding_type == P_VOP)        /* special rule for P-VOP's SKIP */
1747                                  for (k=pEnc->bframenum_head; k< pEnc->bframenum_tail; k++)                                  for (k=pEnc->bframenum_head; k< pEnc->bframenum_tail; k++)
1748                                  {                                  {
1749                                          int iSAD;                                          int iSAD;
# Line 1714  Line 1755 
1755                                                  break;                                                  break;
1756                                          }                                          }
1757                                  }                                  }
1758    
1759                                  if (!bSkip)                                  if (!bSkip)
1760                                  {                                  {
1761                                          VECTOR predMV;                                          VECTOR predMV;
1762                                            if(pEnc->mbParam.m_quarterpel) {
1763                                                    predMV = get_qpmv2(pEnc->current->mbs, pEnc->mbParam.mb_width, 0, x, y, 0);
1764                                                    pMB->pmvs[0].x = pMB->qmvs[0].x - predMV.x;  /* with GMC, qmvs doesn't have to be (0,0)! */
1765                                                    pMB->pmvs[0].y = pMB->qmvs[0].y - predMV.y;
1766                                            }
1767                                            else {
1768                                          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);
1769                                          pMB->pmvs[0].x = -predMV.x; pMB->pmvs[0].y = -predMV.y;                                                  pMB->pmvs[0].x = pMB->mvs[0].x - predMV.x; /* with GMC, mvs doesn't have to be (0,0)! */
1770                                                    pMB->pmvs[0].y = pMB->mvs[0].y - predMV.y;
1771                                            }
1772                                          pMB->mode = MODE_INTER;                                          pMB->mode = MODE_INTER;
1773                                          pMB->cbp = 0;                                          pMB->cbp = 0;
1774                                          MBCoding(pEnc->current, pMB, qcoeff, bs, &pEnc->sStat);                                          MBCoding(pEnc->current, pMB, qcoeff, bs, &pEnc->sStat);
1775                                  }                                  }
1776                                  else MBSkip(bs);                                  else
1777                                    {
1778                                            pMB->mode = MODE_NOT_CODED;
1779                                            MBSkip(bs);
1780                                    }
1781    
1782                          } else {                          } else {
1783                                  if (pEnc->current->global_flags & XVID_GREYSCALE)                                  if (pEnc->current->global_flags & XVID_GREYSCALE)
# Line 1752  Line 1806 
1806          iSearchRange = 1 << (3 + pEnc->mbParam.m_fcode);          iSearchRange = 1 << (3 + pEnc->mbParam.m_fcode);
1807    
1808          if ((fSigma > iSearchRange / 3)          if ((fSigma > iSearchRange / 3)
1809                  && (pEnc->mbParam.m_fcode <= 3))        // maximum search range 128                  && (pEnc->mbParam.m_fcode <= (3 + pEnc->mbParam.m_quarterpel))) // maximum search range 128
1810          {          {
1811                  pEnc->mbParam.m_fcode++;                  pEnc->mbParam.m_fcode++;
1812                  iSearchRange *= 2;                  iSearchRange *= 2;
1813          } else if ((fSigma < iSearchRange / 6)          } else if ((fSigma < iSearchRange / 6)
1814                             && (pEnc->sStat.fMvPrevSigma >= 0)                             && (pEnc->sStat.fMvPrevSigma >= 0)
1815                             && (pEnc->sStat.fMvPrevSigma < iSearchRange / 6)                             && (pEnc->sStat.fMvPrevSigma < iSearchRange / 6)
1816                             && (pEnc->mbParam.m_fcode >= 2))     // minimum search range 16                          && (pEnc->mbParam.m_fcode >= (2 + pEnc->mbParam.m_quarterpel))) // minimum search range 16
1817          {          {
1818                  pEnc->mbParam.m_fcode--;                  pEnc->mbParam.m_fcode--;
1819                  iSearchRange /= 2;                  iSearchRange /= 2;
# Line 1785  Line 1839 
1839                  pEnc->current->quant = pEnc->reference->quant;                  pEnc->current->quant = pEnc->reference->quant;
1840                  pEnc->current->motion_flags = pEnc->reference->motion_flags;                  pEnc->current->motion_flags = pEnc->reference->motion_flags;
1841                  pEnc->current->rounding_type = pEnc->reference->rounding_type;                  pEnc->current->rounding_type = pEnc->reference->rounding_type;
1842                    pEnc->current->quarterpel =  pEnc->reference->quarterpel;
1843                  pEnc->current->fcode = pEnc->reference->fcode;                  pEnc->current->fcode = pEnc->reference->fcode;
1844                  pEnc->current->bcode = pEnc->reference->bcode;                  pEnc->current->bcode = pEnc->reference->bcode;
1845                  image_copy(&pEnc->current->image, &pEnc->reference->image, pEnc->mbParam.edged_width, pEnc->mbParam.height);                  image_copy(&pEnc->current->image, &pEnc->reference->image, pEnc->mbParam.edged_width, pEnc->mbParam.height);
# Line 1824  Line 1879 
1879          }          }
1880  #endif  #endif
1881    
1882            frame->quarterpel =  pEnc->mbParam.m_quarterpel;
1883    
1884          // forward          // forward
1885          image_setedges(f_ref, pEnc->mbParam.edged_width,          image_setedges(f_ref, pEnc->mbParam.edged_width,
1886                                     pEnc->mbParam.edged_height, pEnc->mbParam.width,                                     pEnc->mbParam.edged_height, pEnc->mbParam.width,
# Line 1831  Line 1888 
1888          start_timer();          start_timer();
1889          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,
1890                                            pEnc->mbParam.edged_width, pEnc->mbParam.edged_height,                                            pEnc->mbParam.edged_width, pEnc->mbParam.edged_height,
1891                                            0);                                            pEnc->mbParam.m_quarterpel, 0);
1892          stop_inter_timer();          stop_inter_timer();
1893    
1894          // backward          // backward
# Line 1841  Line 1898 
1898          start_timer();          start_timer();
1899          image_interpolate(b_ref, &pEnc->vInterH, &pEnc->vInterV, &pEnc->vInterHV,          image_interpolate(b_ref, &pEnc->vInterH, &pEnc->vInterV, &pEnc->vInterHV,
1900                                            pEnc->mbParam.edged_width, pEnc->mbParam.edged_height,                                            pEnc->mbParam.edged_width, pEnc->mbParam.edged_height,
1901                                            0);                                            pEnc->mbParam.m_quarterpel, 0);
1902          stop_inter_timer();          stop_inter_timer();
1903    
1904          start_timer();          start_timer();

Legend:
Removed from v.573  
changed lines
  Added in v.642

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