[svn] / tags / branch-release-1-0 / xvidcore / src / encoder.c Repository:
ViewVC logotype

Diff of /tags/branch-release-1-0/xvidcore/src/encoder.c

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

revision 530, Mon Sep 23 20:36:02 2002 UTC revision 545, Fri Sep 27 17:25:17 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.1 2002-09-23 20:36:01 chl Exp $   *  $Id: encoder.c,v 1.76.2.3 2002-09-27 17:25:17 h Exp $
43   *   *
44   ****************************************************************************/   ****************************************************************************/
45    
# Line 659  Line 659 
659  {  {
660          uint16_t x, y;          uint16_t x, y;
661          Bitstream bs;          Bitstream bs;
662          uint32_t bits;          uint32_t bits, mode;
663    
664          int input_valid = 1;          int input_valid = 1;
665    
# Line 907  Line 907 
907          if (pEnc->iFrameNum == 0 || pFrame->intra == 1 || pEnc->bframenum_dx50bvop >= 0 ||          if (pEnc->iFrameNum == 0 || pFrame->intra == 1 || pEnc->bframenum_dx50bvop >= 0 ||
908                  (pFrame->intra < 0 && pEnc->iMaxKeyInterval > 0 &&                  (pFrame->intra < 0 && pEnc->iMaxKeyInterval > 0 &&
909                   pEnc->iFrameNum >= pEnc->iMaxKeyInterval)                   pEnc->iFrameNum >= pEnc->iMaxKeyInterval)
910                  || image_mad(&pEnc->reference->image, &pEnc->current->image,                  || /*image_mad(&pEnc->reference->image, &pEnc->current->image,
911                                           pEnc->mbParam.edged_width, pEnc->mbParam.width,                                           pEnc->mbParam.edged_width, pEnc->mbParam.width,
912                                           pEnc->mbParam.height) > 30) {                                           pEnc->mbParam.height) > 30) {*/
913                            2 == (mode = MEanalysis(&pEnc->reference->image, &pEnc->current->image,
914                                             &pEnc->mbParam, pEnc->current->mbs, pEnc->current->fcode))) {
915    
916                  /*                  /*
917                   * This will be coded as an Intra Frame                   * This will be coded as an Intra Frame
918                   */                   */
# Line 957  Line 960 
960                   * NB : sequences like "IIBB" decode fine with msfdam but,                   * NB : sequences like "IIBB" decode fine with msfdam but,
961                   *      go screwy with divx 5.00                   *      go screwy with divx 5.00
962                   */                   */
963          } else if (pEnc->bframenum_tail >= pEnc->mbParam.max_bframes) {          } else if (pEnc->bframenum_tail >= pEnc->mbParam.max_bframes || mode != 0) {
964                  /*                  /*
965                   * This will be coded as a Predicted Frame                   * This will be coded as a Predicted Frame
966                   */                   */
# Line 1100  Line 1103 
1103          pEnc->current->ticks = pEnc->mbParam.m_ticks;          pEnc->current->ticks = pEnc->mbParam.m_ticks;
1104          pEnc->mbParam.hint = &pFrame->hint;          pEnc->mbParam.hint = &pFrame->hint;
1105    
1106            /* disable alternate scan flag if interlacing is not enabled */
1107            if ((pEnc->current->global_flags & XVID_ALTERNATESCAN) &&
1108                    !(pEnc->current->global_flags & XVID_INTERLACING))
1109            {
1110                    pEnc->current->global_flags -= XVID_ALTERNATESCAN;
1111            }
1112    
1113          start_timer();          start_timer();
1114          if (image_input          if (image_input
1115                  (&pEnc->current->image, pEnc->mbParam.width, pEnc->mbParam.height,                  (&pEnc->current->image, pEnc->mbParam.width, pEnc->mbParam.height,
# Line 1560  Line 1570 
1570    
1571          start_timer();          start_timer();
1572          image_setedges(pRef, pEnc->mbParam.edged_width, pEnc->mbParam.edged_height,          image_setedges(pRef, pEnc->mbParam.edged_width, pEnc->mbParam.edged_height,
1573                                     pEnc->mbParam.width, pEnc->mbParam.height,                                     pEnc->mbParam.width, pEnc->mbParam.height);
                                    pEnc->current->global_flags & XVID_INTERLACING);  
1574          stop_edges_timer();          stop_edges_timer();
1575    
1576          pEnc->mbParam.m_rounding_type = 1 - pEnc->mbParam.m_rounding_type;          pEnc->mbParam.m_rounding_type = 1 - pEnc->mbParam.m_rounding_type;
# Line 1809  Line 1818 
1818          // forward          // forward
1819          image_setedges(f_ref, pEnc->mbParam.edged_width,          image_setedges(f_ref, pEnc->mbParam.edged_width,
1820                                     pEnc->mbParam.edged_height, pEnc->mbParam.width,                                     pEnc->mbParam.edged_height, pEnc->mbParam.width,
1821                                     pEnc->mbParam.height,                                     pEnc->mbParam.height);
                                    frame->global_flags & XVID_INTERLACING);  
1822          start_timer();          start_timer();
1823          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,
1824                                            pEnc->mbParam.edged_width, pEnc->mbParam.edged_height,                                            pEnc->mbParam.edged_width, pEnc->mbParam.edged_height,
# Line 1820  Line 1828 
1828          // backward          // backward
1829          image_setedges(b_ref, pEnc->mbParam.edged_width,          image_setedges(b_ref, pEnc->mbParam.edged_width,
1830                                     pEnc->mbParam.edged_height, pEnc->mbParam.width,                                     pEnc->mbParam.edged_height, pEnc->mbParam.width,
1831                                     pEnc->mbParam.height,                                     pEnc->mbParam.height);
                                    frame->global_flags & XVID_INTERLACING);  
1832          start_timer();          start_timer();
1833          image_interpolate(b_ref, &pEnc->vInterH, &pEnc->vInterV, &pEnc->vInterHV,          image_interpolate(b_ref, &pEnc->vInterH, &pEnc->vInterV, &pEnc->vInterHV,
1834                                            pEnc->mbParam.edged_width, pEnc->mbParam.edged_height,                                            pEnc->mbParam.edged_width, pEnc->mbParam.edged_height,
# Line 1859  Line 1866 
1866          for (y = 0; y < pEnc->mbParam.mb_height; y++) {          for (y = 0; y < pEnc->mbParam.mb_height; y++) {
1867                  for (x = 0; x < pEnc->mbParam.mb_width; x++) {                  for (x = 0; x < pEnc->mbParam.mb_width; x++) {
1868                          MACROBLOCK * const mb = &frame->mbs[x + y * pEnc->mbParam.mb_width];                          MACROBLOCK * const mb = &frame->mbs[x + y * pEnc->mbParam.mb_width];
1869                            int direction = pEnc->global & XVID_ALTERNATESCAN ? 2 : 0;
1870    
1871                          // decoder ignores mb when refence block is INTER(0,0), CBP=0                          // decoder ignores mb when refence block is INTER(0,0), CBP=0
1872                          if (mb->mode == MODE_NOT_CODED) {                          if (mb->mode == MODE_NOT_CODED) {
# Line 1890  Line 1898 
1898  #endif  #endif
1899                          start_timer();                          start_timer();
1900                          MBCodingBVOP(mb, qcoeff, frame->fcode, frame->bcode, bs,                          MBCodingBVOP(mb, qcoeff, frame->fcode, frame->bcode, bs,
1901                                                   &pEnc->sStat);                                                   &pEnc->sStat, direction);
1902                          stop_coding_timer();                          stop_coding_timer();
1903                  }                  }
1904          }          }

Legend:
Removed from v.530  
changed lines
  Added in v.545

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