[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 619, Sat Nov 2 15:52:31 2002 UTC revision 643, Tue Nov 12 14:44:53 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.14 2002-11-02 15:52:30 chl Exp $   *  $Id: encoder.c,v 1.76.2.18 2002-11-12 14:44:53 syskin Exp $
43   *   *
44   ****************************************************************************/   ****************************************************************************/
45    
# Line 107  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 623  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 673  Line 666 
666          uint32_t bits, mode;          uint32_t bits, mode;
667    
668          int input_valid = 1;          int input_valid = 1;
669            int bframes_count = 0;
670    
671  #ifdef _DEBUG_PSNR  #ifdef _DEBUG_PSNR
672          float psnr;          float psnr;
# Line 713  Line 707 
707                          SWAP(pEnc->current, pEnc->bframes[pEnc->bframenum_tail]);                          SWAP(pEnc->current, pEnc->bframes[pEnc->bframenum_tail]);
708    
709                          FrameCodeP(pEnc, &bs, &bits, 1, 0);                          FrameCodeP(pEnc, &bs, &bits, 1, 0);
710                            bframes_count = 0;
711    
712                          BitstreamPad(&bs);                          BitstreamPad(&bs);
713                          pFrame->length = BitstreamLength(&bs);                          pFrame->length = BitstreamLength(&bs);
714                          pFrame->intra = 0;                          pFrame->intra = 0;
715    
716                            emms();
717    
718                          return XVID_ERR_OK;                          return XVID_ERR_OK;
719                  }                  }
720    
# Line 736  Line 733 
733                  if (input_valid)                  if (input_valid)
734                          queue_image(pEnc, pFrame);                          queue_image(pEnc, pFrame);
735    
736                    emms();
737    
738                  return XVID_ERR_OK;                  return XVID_ERR_OK;
739          }          }
740    
# Line 769  Line 768 
768                          if (input_valid)                          if (input_valid)
769                                  queue_image(pEnc, pFrame);                                  queue_image(pEnc, pFrame);
770    
771                            emms();
772    
773                          return XVID_ERR_OK;                          return XVID_ERR_OK;
774                  }                  }
775          }          }
# Line 799  Line 800 
800                  start_timer();                  start_timer();
801                  if (image_input                  if (image_input
802                          (&pEnc->current->image, pEnc->mbParam.width, pEnc->mbParam.height,                          (&pEnc->current->image, pEnc->mbParam.width, pEnc->mbParam.height,
803                          pEnc->mbParam.edged_width, pFrame->image, pFrame->colorspace))                          pEnc->mbParam.edged_width, pFrame->image, pFrame->stride, pFrame->colorspace, pFrame->general & XVID_INTERLACING))
804                    {
805                            emms();
806                          return XVID_ERR_FORMAT;                          return XVID_ERR_FORMAT;
807                    }
808                  stop_conv_timer();                  stop_conv_timer();
809    
810                  // queue input frame, and dequue next image                  // queue input frame, and dequue next image
# Line 839  Line 843 
843                  }                  }
844    
845                  pFrame->length = BitstreamLength(&bs);                  pFrame->length = BitstreamLength(&bs);
846                    emms();
847                  return XVID_ERR_OK;                  return XVID_ERR_OK;
848          }          }
849    
# Line 925  Line 930 
930          if (pEnc->iFrameNum == 0 || pFrame->intra == 1 || pEnc->bframenum_dx50bvop >= 0 ||          if (pEnc->iFrameNum == 0 || pFrame->intra == 1 || pEnc->bframenum_dx50bvop >= 0 ||
931                  (pFrame->intra < 0 && pEnc->iMaxKeyInterval > 0 &&                  (pFrame->intra < 0 && pEnc->iMaxKeyInterval > 0 &&
932                   pEnc->iFrameNum >= pEnc->iMaxKeyInterval)                   pEnc->iFrameNum >= pEnc->iMaxKeyInterval)
933                  || /*image_mad(&pEnc->reference->image, &pEnc->current->image,                  || 2 == (mode = MEanalysis(&pEnc->reference->image, pEnc->current,
934                                           pEnc->mbParam.edged_width, pEnc->mbParam.width,                                                                          &pEnc->mbParam, pEnc->iMaxKeyInterval,
935                                           pEnc->mbParam.height) > 30) {*/                                                                          (pFrame->intra < 0) ? pEnc->iFrameNum : 0,
936                          2 == (mode = MEanalysis(&pEnc->reference->image, &pEnc->current->image,                                                                          bframes_count++))) {
                                          &pEnc->mbParam, pEnc->current->mbs, pEnc->current->fcode))) {  
937    
938                  /*                  /*
939                   * This will be coded as an Intra Frame                   * This will be coded as an Intra Frame
# Line 955  Line 959 
959                                  image_printf(&pEnc->current->image, pEnc->mbParam.edged_width, pEnc->mbParam.height, 5, 100, "DX50 BVOP->PVOP");                                  image_printf(&pEnc->current->image, pEnc->mbParam.edged_width, pEnc->mbParam.height, 5, 100, "DX50 BVOP->PVOP");
960                          }                          }
961                          FrameCodeP(pEnc, &bs, &bits, 1, 0);                          FrameCodeP(pEnc, &bs, &bits, 1, 0);
962                            bframes_count = 0;
963    
964                          pFrame->intra = 0;                          pFrame->intra = 0;
965    
966                  } else {                  } else {
967    
968                          FrameCodeI(pEnc, &bs, &bits);                          FrameCodeI(pEnc, &bs, &bits);
969                            bframes_count = 0;
970                          pFrame->intra = 1;                          pFrame->intra = 1;
971    
972                          pEnc->bframenum_dx50bvop = -1;                          pEnc->bframenum_dx50bvop = -1;
# Line 992  Line 998 
998                  }                  }
999    
1000                  FrameCodeP(pEnc, &bs, &bits, 1, 0);                  FrameCodeP(pEnc, &bs, &bits, 1, 0);
1001                    bframes_count = 0;
1002                  pFrame->intra = 0;                  pFrame->intra = 0;
1003                  pEnc->flush_bframes = 1;                  pEnc->flush_bframes = 1;
1004    
1005                  if ((pEnc->global & XVID_GLOBAL_PACKED)) {                  if ((pEnc->global & XVID_GLOBAL_PACKED) && (pEnc->bframenum_tail > 0)) {
1006                          BitstreamPadAlways(&bs);                          BitstreamPadAlways(&bs);
1007                          input_valid = 0;                          input_valid = 0;
1008                          goto ipvop_loop;                          goto ipvop_loop;
# Line 1076  Line 1083 
1083          stop_global_timer();          stop_global_timer();
1084          write_timer();          write_timer();
1085    
1086            emms();
1087          return XVID_ERR_OK;          return XVID_ERR_OK;
1088  }  }
1089    
# Line 1130  Line 1138 
1138          start_timer();          start_timer();
1139          if (image_input          if (image_input
1140                  (&pEnc->current->image, pEnc->mbParam.width, pEnc->mbParam.height,                  (&pEnc->current->image, pEnc->mbParam.width, pEnc->mbParam.height,
1141                   pEnc->mbParam.edged_width, pFrame->image, pFrame->colorspace) < 0)                   pEnc->mbParam.edged_width, pFrame->image, pFrame->stride, pFrame->colorspace, pFrame->general & XVID_INTERLACING) < 0)
1142                  return XVID_ERR_FORMAT;                  return XVID_ERR_FORMAT;
1143          stop_conv_timer();          stop_conv_timer();
1144    
# Line 1620  Line 1628 
1628          }          }
1629    
1630          if (pEnc->current->global_flags & XVID_GMC) {          if (pEnc->current->global_flags & XVID_GMC) {
1631                  printf("Global Motion = %d %d quarterpel=%d\n", pEnc->current->GMC_MV.x, pEnc->current->GMC_MV.y,pEnc->current->quarterpel);  //              printf("Global Motion = %d %d quarterpel=%d\n", pEnc->current->GMC_MV.x, pEnc->current->GMC_MV.y,pEnc->current->quarterpel);
1632                    DPRINTF(DPRINTF_HEADER, "Global Motion = %d %d quarterpel=%d\n", pEnc->current->GMC_MV.x, pEnc->current->GMC_MV.y,pEnc->current->quarterpel);
1633                  pEnc->current->coding_type = S_VOP;                  pEnc->current->coding_type = S_VOP;
1634          } else          } else
1635                  pEnc->current->coding_type = P_VOP;                  pEnc->current->coding_type = P_VOP;
# Line 1902  Line 1911 
1911                  ((int32_t)(pEnc->current->stamp - pEnc->reference->stamp)),     // time_pp                  ((int32_t)(pEnc->current->stamp - pEnc->reference->stamp)),     // time_pp
1912                          pEnc->reference->mbs, f_ref,                          pEnc->reference->mbs, f_ref,
1913                                                   &pEnc->f_refh, &pEnc->f_refv, &pEnc->f_refhv,                                                   &pEnc->f_refh, &pEnc->f_refv, &pEnc->f_refhv,
1914                                                   pEnc->current->mbs, b_ref, &pEnc->vInterH,                                                   pEnc->current, b_ref, &pEnc->vInterH,
1915                                                   &pEnc->vInterV, &pEnc->vInterHV);                                                   &pEnc->vInterV, &pEnc->vInterHV);
1916    
1917    

Legend:
Removed from v.619  
changed lines
  Added in v.643

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