--- encoder.c 2002/08/07 10:09:00 1.73 +++ encoder.c 2002/09/04 21:16:02 1.77 @@ -3,6 +3,8 @@ * XVID MPEG-4 VIDEO CODEC * - Encoder main module - * + * Copyright(C) 2002 Michael Militzer + * * This program is an implementation of a part of one or more MPEG-4 * Video tools as specified in ISO/IEC 14496-2 standard. Those intending * to use this software module in hardware or software products are @@ -28,22 +30,6 @@ * ****************************************************************************/ -/***************************************************************************** - * - * History - * - * 10.07.2002 added BFRAMES_DEC_DEBUG support - * MinChen - * 20.06.2002 bframe patch - * 08.05.2002 fix some problem in DEBUG mode; - * MinChen - * 14.04.2002 added FrameCodeB() - * - * $Id: encoder.c,v 1.73 2002/08/07 10:09:00 chl Exp $ - * - ****************************************************************************/ - - #include #include #include @@ -621,18 +607,12 @@ } -#ifdef BFRAMES void inc_frame_num(Encoder * pEnc) { pEnc->mbParam.m_ticks += pEnc->mbParam.fincr; +#ifdef BFRAMES pEnc->mbParam.m_ticks = pEnc->mbParam.m_ticks % pEnc->mbParam.fbase; - -/* fprintf(stderr, "ENC %c %i:%i %i\n", - pEnc->current->coding_type == I_VOP ? 'I' : pEnc->current->coding_type == P_VOP ? 'P' : 'B', - pEnc->mbParam.m_seconds, pEnc->mbParam.m_ticks,pEnc->last_sync); -*/ - if (pEnc->mbParam.m_ticks < pEnc->last_sync) pEnc->mbParam.m_seconds = 1; // more than 1 second since last I or P is not supported. else @@ -640,10 +620,15 @@ if (pEnc->current->coding_type != B_VOP) pEnc->last_sync = pEnc->mbParam.m_ticks; +#else -} + pEnc->mbParam.m_seconds = pEnc->mbParam.m_ticks / pEnc->mbParam.fbase; + pEnc->mbParam.m_ticks = pEnc->mbParam.m_ticks % pEnc->mbParam.fbase; + #endif +} + #ifdef BFRAMES void queue_image(Encoder * pEnc, XVID_ENC_FRAME * pFrame) @@ -1133,10 +1118,8 @@ pEnc->current->global_flags = pFrame->general; pEnc->current->motion_flags = pFrame->motion; -#ifdef BFRAMES pEnc->current->seconds = pEnc->mbParam.m_seconds; pEnc->current->ticks = pEnc->mbParam.m_ticks; -#endif pEnc->mbParam.hint = &pFrame->hint; start_timer(); @@ -1266,9 +1249,7 @@ DEBUG(temp); #endif -#ifdef BFRAMES inc_frame_num(pEnc); -#endif pEnc->iFrameNum++; stop_global_timer(); @@ -1949,8 +1930,7 @@ mb->quant = frame->quant; mb->cbp = - MBTransQuantInter(&pEnc->mbParam, frame, mb, x, y, dct_codes, - qcoeff); + MBTransQuantInterBVOP(&pEnc->mbParam, frame, mb, dct_codes, qcoeff); //mb->cbp = MBTransQuantBVOP(&pEnc->mbParam, x, y, dct_codes, qcoeff, &frame->image, frame->quant); if ( (mb->mode == MODE_DIRECT) && (mb->cbp == 0)