[cvs] / xvidcore / src / encoder.c Repository:
ViewVC logotype

Diff of /xvidcore/src/encoder.c

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

revision 1.76.2.26, Mon Dec 9 10:47:05 2002 UTC revision 1.76.2.29, Thu Dec 12 12:42:31 2002 UTC
# Line 646  Line 646 
646    
647    
648    
649    /* convert pFrame->intra to coding_type */
650    static int intra2coding_type(int intra)
651    {
652            if (intra < 0)          return -1;
653            if (intra == 1)         return I_VOP;
654            if (intra == 2)         return B_VOP;
655    
656            return P_VOP;
657    }
658    
659    
660    
661  /*****************************************************************************  /*****************************************************************************
# Line 855  Line 865 
865          // only inc frame num, adapt quant, etc. if we havent seen it before          // only inc frame num, adapt quant, etc. if we havent seen it before
866          if (pEnc->bframenum_dx50bvop < 0 )          if (pEnc->bframenum_dx50bvop < 0 )
867          {          {
868                    mode = intra2coding_type(pFrame->intra);
869                  if (pFrame->quant == 0)                  if (pFrame->quant == 0)
870                          pEnc->current->quant = RateControlGetQ(&pEnc->rate_control, 0);                          pEnc->current->quant = RateControlGetQ(&pEnc->rate_control, 0);
871                  else                  else
# Line 928  Line 939 
939           * %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% */           * %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% */
940          pEnc->iFrameNum++;          pEnc->iFrameNum++;
941    
942          if (pEnc->iFrameNum == 0 || pFrame->intra == 1 || pEnc->bframenum_dx50bvop >= 0 ||          if (pEnc->iFrameNum == 0 || pEnc->bframenum_dx50bvop >= 0 ||
943                  (pFrame->intra < 0 && pEnc->mbParam.iMaxKeyInterval > 0 &&                  (mode < 0 && pEnc->mbParam.iMaxKeyInterval > 0 &&
944                   pEnc->iFrameNum >= pEnc->mbParam.iMaxKeyInterval)                          pEnc->iFrameNum >= pEnc->mbParam.iMaxKeyInterval))
945                  || 2 == (mode = MEanalysis(&pEnc->reference->image, pEnc->current,          {
946                    mode = I_VOP;
947            }else{
948                    mode = MEanalysis(&pEnc->reference->image, pEnc->current,
949                                                                          &pEnc->mbParam, pEnc->mbParam.iMaxKeyInterval,                                                                          &pEnc->mbParam, pEnc->mbParam.iMaxKeyInterval,
950                                                                          (pFrame->intra < 0) ? pEnc->iFrameNum : 0,                                          (mode < 0) ? pEnc->iFrameNum : 0,
951                                                                          bframes_count++))) {                                          bframes_count++);
952            }
953    
954            if (mode == I_VOP) {
955                  /*                  /*
956                   * This will be coded as an Intra Frame                   * This will be coded as an Intra Frame
957                   */                   */
# Line 999  Line 1015 
1015                   * NB : sequences like "IIBB" decode fine with msfdam but,                   * NB : sequences like "IIBB" decode fine with msfdam but,
1016                   *      go screwy with divx 5.00                   *      go screwy with divx 5.00
1017                   */                   */
1018          } else if (pEnc->bframenum_tail >= pEnc->mbParam.max_bframes || mode != 0) {          } else if (mode == P_VOP || pEnc->bframenum_tail >= pEnc->mbParam.max_bframes) {
 //      } else if (pFrame->intra == 0 || pEnc->bframenum_tail >= pEnc->mbParam.max_bframes || mode != 0) {  
1019                  /*                  /*
1020                   * This will be coded as a Predicted Frame                   * This will be coded as a Predicted Frame
1021                   */                   */
# Line 1024  Line 1039 
1039                          goto ipvop_loop;                          goto ipvop_loop;
1040                  }                  }
1041    
1042          } else {          } else {        /* mode == B_VOP */
1043                  /*                  /*
1044                   * This will be coded as a Bidirectional Frame                   * This will be coded as a Bidirectional Frame
1045                   */                   */
# Line 1590  Line 1605 
1605                          stop_coding_timer();                          stop_coding_timer();
1606                  }                  }
1607    
1608            if ((pEnc->current->global_flags & XVID_REDUCED))
1609            {
1610                    image_deblock_rrv(&pEnc->current->image, pEnc->mbParam.edged_width,
1611                            pEnc->current->mbs, mb_width, mb_height, pEnc->mbParam.mb_width);
1612            }
1613          emms();          emms();
1614    
1615          *pBits = BitstreamPos(bs) - *pBits;          *pBits = BitstreamPos(bs) - *pBits;
# Line 1632  Line 1652 
1652    
1653          if ((pEnc->current->global_flags & XVID_REDUCED))          if ((pEnc->current->global_flags & XVID_REDUCED))
1654          {          {
1655                  // mb_width = (pEnc->mbParam.width + 31) / 32;                  mb_width = (pEnc->mbParam.width + 31) / 32;
1656                  // mb_height = (pEnc->mbParam.height + 31) / 32;                  mb_height = (pEnc->mbParam.height + 31) / 32;
   
                 /* XXX: reduced resoltion not yet supported */  
                 pEnc->current->global_flags &= ~XVID_REDUCED;  
1657          }          }
1658    
1659    
# Line 1676  Line 1693 
1693          if (pEnc->current->global_flags & XVID_HINTEDME_SET) {          if (pEnc->current->global_flags & XVID_HINTEDME_SET) {
1694                  HintedMESet(pEnc, &bIntra);                  HintedMESet(pEnc, &bIntra);
1695          if (bIntra == 0) {          if (bIntra == 0) {
                         pEnc->current->fcode = FindFcode(&pEnc->mbParam, pEnc->current);  
1696                          MotionEstimationHinted(&pEnc->mbParam, pEnc->current, pEnc->reference,                          MotionEstimationHinted(&pEnc->mbParam, pEnc->current, pEnc->reference,
1697                                                                                          &pEnc->vInterH, &pEnc->vInterV, &pEnc->vInterHV);                                                                                          &pEnc->vInterH, &pEnc->vInterV, &pEnc->vInterHV);
1698                  }                  }
# Line 1834  Line 1850 
1850                  }                  }
1851          }          }
1852    
1853            if ((pEnc->current->global_flags & XVID_REDUCED))
1854            {
1855                    image_deblock_rrv(&pEnc->current->image, pEnc->mbParam.edged_width,
1856                            pEnc->current->mbs, mb_width, mb_height, pEnc->mbParam.mb_width);
1857            }
1858    
1859          emms();          emms();
1860    
1861          if (pEnc->current->global_flags & XVID_HINTEDME_GET) {          if (pEnc->current->global_flags & XVID_HINTEDME_GET) {
# Line 1902  Line 1924 
1924          }          }
1925          */          */
1926    
1927    
1928          *pBits = BitstreamPos(bs) - *pBits;          *pBits = BitstreamPos(bs) - *pBits;
1929    
1930          return 0;                                       // inter          return 0;                                       // inter

Legend:
Removed from v.1.76.2.26  
changed lines
  Added in v.1.76.2.29

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