[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 233, Sat Jun 22 07:23:10 2002 UTC revision 234, Sun Jun 23 03:58:32 2002 UTC
# Line 37  Line 37 
37   *             MinChen <chenm001@163.com>   *             MinChen <chenm001@163.com>
38   *  14.04.2002 added FrameCodeB()   *  14.04.2002 added FrameCodeB()
39   *   *
40   *  $Id: encoder.c,v 1.45 2002-06-22 07:23:10 suxen_drol Exp $   *  $Id: encoder.c,v 1.46 2002-06-23 03:58:32 suxen_drol Exp $
41   *   *
42   ****************************************************************************/   ****************************************************************************/
43    
# Line 51  Line 51 
51  #include "global.h"  #include "global.h"
52  #include "utils/timer.h"  #include "utils/timer.h"
53  #include "image/image.h"  #include "image/image.h"
54    #include "image/font.h"
55  #include "motion/motion.h"  #include "motion/motion.h"
56  #include "bitstream/cbp.h"  #include "bitstream/cbp.h"
57  #include "utils/mbfunctions.h"  #include "utils/mbfunctions.h"
# Line 330  Line 331 
331          /* B Frames specific init */          /* B Frames specific init */
332  #ifdef BFRAMES  #ifdef BFRAMES
333    
334          pEnc->packed = pParam->packed;          pEnc->global = pParam->global;
335          pEnc->mbParam.max_bframes = pParam->max_bframes;          pEnc->mbParam.max_bframes = pParam->max_bframes;
336          pEnc->bquant_ratio = pParam->bquant_ratio;          pEnc->bquant_ratio = pParam->bquant_ratio;
337          pEnc->bframes = NULL;          pEnc->bframes = NULL;
# Line 408  Line 409 
409    
410          pEnc->mbParam.m_seconds = 0;          pEnc->mbParam.m_seconds = 0;
411          pEnc->mbParam.m_ticks = 0;          pEnc->mbParam.m_ticks = 0;
412            pEnc->m_framenum = 0;
413  #endif  #endif
414    
415          pParam->handle = (void *) pEnc;          pParam->handle = (void *) pEnc;
# Line 608  Line 610 
610  {  {
611          pEnc->iFrameNum++;          pEnc->iFrameNum++;
612          pEnc->mbParam.m_ticks += pEnc->mbParam.fincr;          pEnc->mbParam.m_ticks += pEnc->mbParam.fincr;
613          if (pEnc->mbParam.m_ticks > pEnc->mbParam.fbase) {  
614                  pEnc->mbParam.m_seconds = pEnc->mbParam.m_ticks % pEnc->mbParam.fbase;          pEnc->mbParam.m_seconds = pEnc->mbParam.m_ticks / pEnc->mbParam.fbase;
615                  pEnc->mbParam.m_ticks = pEnc->mbParam.m_ticks % pEnc->mbParam.fbase;                  pEnc->mbParam.m_ticks = pEnc->mbParam.m_ticks % pEnc->mbParam.fbase;
616          }          }
 }  
617  #endif  #endif
618    
619    
# Line 732  Line 733 
733          if (pEnc->bframenum_head > 0) {          if (pEnc->bframenum_head > 0) {
734                  pEnc->bframenum_head = pEnc->bframenum_tail = 0;                  pEnc->bframenum_head = pEnc->bframenum_tail = 0;
735    
736                  if (pEnc->packed) {                  if ((pEnc->global & XVID_GLOBAL_PACKED)) {
737    
738                          DPRINTF("*** EMPTY bf: head=%i tail=%i   queue: head=%i tail=%i size=%i",                          DPRINTF("*** EMPTY bf: head=%i tail=%i   queue: head=%i tail=%i size=%i",
739                                  pEnc->bframenum_head, pEnc->bframenum_tail,                                  pEnc->bframenum_head, pEnc->bframenum_tail,
# Line 852  Line 853 
853    
854          emms();          emms();
855    
856            if ((pEnc->global & XVID_GLOBAL_DEBUG)) {
857                    image_printf(&pEnc->current->image, pEnc->mbParam.edged_width, pEnc->mbParam.height, 5, 5,
858                            "%i  if:%i  st:%i:%i", pEnc->m_framenum++, pEnc->iFrameNum, pEnc->current->seconds, pEnc->current->ticks);
859            }
860    
861    
862          /* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%          /* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
863           * Luminance masking           * Luminance masking
864           * %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% */           * %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% */
# Line 906  Line 913 
913                                  pEnc->bframenum_head, pEnc->bframenum_tail,                                  pEnc->bframenum_head, pEnc->bframenum_tail,
914                                  pEnc->queue_head, pEnc->queue_tail, pEnc->queue_size);                                  pEnc->queue_head, pEnc->queue_tail, pEnc->queue_size);
915    
916                    if ((pEnc->global & XVID_GLOBAL_DEBUG)) {
917                            image_printf(&pEnc->current->image, pEnc->mbParam.edged_width, pEnc->mbParam.height, 5, 200, "IVOP");
918                    }
919    
920                  FrameCodeI(pEnc, &bs, &bits);                  FrameCodeI(pEnc, &bs, &bits);
921    
922                  pFrame->intra = 1;                  pFrame->intra = 1;
# Line 913  Line 924 
924    
925                  inc_frame_num(pEnc);                  inc_frame_num(pEnc);
926    
927                  if (pEnc->packed) {                  if ((pEnc->global & XVID_GLOBAL_PACKED)) {
928                          BitstreamPad(&bs);                          BitstreamPad(&bs);
929                          input_valid = 0;                          input_valid = 0;
930                          goto ipvop_loop;                          goto ipvop_loop;
# Line 932  Line 943 
943                                  pEnc->bframenum_head, pEnc->bframenum_tail,                                  pEnc->bframenum_head, pEnc->bframenum_tail,
944                                  pEnc->queue_head, pEnc->queue_tail, pEnc->queue_size);                                  pEnc->queue_head, pEnc->queue_tail, pEnc->queue_size);
945    
946                    if ((pEnc->global & XVID_GLOBAL_DEBUG)) {
947                            image_printf(&pEnc->current->image, pEnc->mbParam.edged_width, pEnc->mbParam.height, 5, 200, "PVOP");
948                    }
949    
950                  FrameCodeP(pEnc, &bs, &bits, 1, 0);                  FrameCodeP(pEnc, &bs, &bits, 1, 0);
951                  pFrame->intra = 0;                  pFrame->intra = 0;
952                  pEnc->flush_bframes = 1;                  pEnc->flush_bframes = 1;
953    
954                  inc_frame_num(pEnc);                  inc_frame_num(pEnc);
955    
956                  if (pEnc->packed) {                  if ((pEnc->global & XVID_GLOBAL_PACKED)) {
957                          BitstreamPad(&bs);                          BitstreamPad(&bs);
958                          input_valid = 0;                          input_valid = 0;
959                          goto ipvop_loop;                          goto ipvop_loop;
# Line 953  Line 968 
968                                  pEnc->bframenum_head, pEnc->bframenum_tail,                                  pEnc->bframenum_head, pEnc->bframenum_tail,
969                                  pEnc->queue_head, pEnc->queue_tail, pEnc->queue_size);                                  pEnc->queue_head, pEnc->queue_tail, pEnc->queue_size);
970    
971                    if ((pEnc->global & XVID_GLOBAL_DEBUG)) {
972                            image_printf(&pEnc->current->image, pEnc->mbParam.edged_width, pEnc->mbParam.height, 5, 200, "BVOP");
973                    }
974    
975                  if (pFrame->bquant < 1) {                  if (pFrame->bquant < 1) {
976                          pEnc->current->quant =                          pEnc->current->quant =
977                                  ((pEnc->reference->quant +                                  ((pEnc->reference->quant +
# Line 1444  Line 1463 
1463          BitstreamWriteVolHeader(bs, &pEnc->mbParam, pEnc->current);          BitstreamWriteVolHeader(bs, &pEnc->mbParam, pEnc->current);
1464  #ifdef BFRAMES  #ifdef BFRAMES
1465  #define DIVX501B481P "DivX501b481p"  #define DIVX501B481P "DivX501b481p"
1466          if (pEnc->packed) {          if ((pEnc->global & XVID_GLOBAL_PACKED)) {
1467                  BitstreamWriteUserData(bs, DIVX501B481P, strlen(DIVX501B481P));                  BitstreamWriteUserData(bs, DIVX501B481P, strlen(DIVX501B481P));
1468          }          }
1469  #endif  #endif
# Line 1780  Line 1799 
1799                                  backward.x = mb->b_mvs[0].x;                                  backward.x = mb->b_mvs[0].x;
1800                                  backward.y = mb->b_mvs[0].y;                                  backward.y = mb->b_mvs[0].y;
1801                          }                          }
1802  //          printf("[%i %i] M=%i CBP=%i MVX=%i MVY=%i %i,%i  %i,%i\n", x, y, pMB->mode, pMB->cbp, pMB->mvs[0].x, bmb->pmvs[0].x, bmb->pmvs[0].y, forward.x, forward.y);  //                      DPRINTF("%05i : [%i %i] M=%i CBP=%i MVS=%i,%i forward=%i,%i", pEnc->m_framenum, x, y, mb->mode, mb->cbp, mb->mvs[0].x, mb->mvs[0].y, forward.x, forward.y);
1803    
1804                          start_timer();                          start_timer();
1805                          MBCodingBVOP(mb, qcoeff, frame->fcode, frame->bcode, bs,                          MBCodingBVOP(mb, qcoeff, frame->fcode, frame->bcode, bs,

Legend:
Removed from v.233  
changed lines
  Added in v.234

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