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.4 2002-09-28 13:01:02 chl Exp $ |
* $Id: encoder.c,v 1.76.2.7 2002-09-30 09:19:26 chl Exp $ |
43 |
* |
* |
44 |
****************************************************************************/ |
****************************************************************************/ |
45 |
|
|
411 |
pEnc->queue_size = 0; |
pEnc->queue_size = 0; |
412 |
|
|
413 |
pEnc->mbParam.m_stamp = 0; |
pEnc->mbParam.m_stamp = 0; |
414 |
|
|
415 |
pEnc->m_framenum = 0; |
pEnc->m_framenum = 0; |
416 |
|
pEnc->current->stamp = 0; |
417 |
|
pEnc->reference->stamp = 0; |
418 |
|
|
419 |
pParam->handle = (void *) pEnc; |
pParam->handle = (void *) pEnc; |
420 |
|
|
603 |
|
|
604 |
static __inline void inc_frame_num(Encoder * pEnc) |
static __inline void inc_frame_num(Encoder * pEnc) |
605 |
{ |
{ |
606 |
|
pEnc->current->stamp = pEnc->mbParam.m_stamp; // first frame is zero |
607 |
pEnc->mbParam.m_stamp += pEnc->mbParam.fincr; |
pEnc->mbParam.m_stamp += pEnc->mbParam.fincr; |
|
pEnc->current->stamp = pEnc->mbParam.m_stamp; |
|
608 |
} |
} |
609 |
|
|
610 |
|
|
640 |
pCur->ticks = (int32_t)pCur->stamp % time_base; |
pCur->ticks = (int32_t)pCur->stamp % time_base; |
641 |
pCur->seconds = ((int32_t)pCur->stamp / time_base) - ((int32_t)pRef->stamp / time_base) ; |
pCur->seconds = ((int32_t)pCur->stamp / time_base) - ((int32_t)pRef->stamp / time_base) ; |
642 |
|
|
643 |
/* HEAVY DEBUG OUTPUT remove when timecodes prove to be stable |
//HEAVY DEBUG OUTPUT remove when timecodes prove to be stable |
644 |
|
|
645 |
fprintf(stderr,"WriteVop: %d - %d \n", |
/* fprintf(stderr,"WriteVop: %d - %d \n", |
646 |
((int32_t)pCur->stamp / time_base), ((int32_t)pRef->stamp / time_base)); |
((int32_t)pCur->stamp / time_base), ((int32_t)pRef->stamp / time_base)); |
647 |
fprintf(stderr,"set_timecodes: VOP %1d stamp=%lld ref_stamp=%lld base=%d\n", |
fprintf(stderr,"set_timecodes: VOP %1d stamp=%lld ref_stamp=%lld base=%d\n", |
648 |
pCur->coding_type, pCur->stamp, pRef->stamp, time_base); |
pCur->coding_type, pCur->stamp, pRef->stamp, time_base); |
1545 |
pEnc->sStat.iMvCount = 0; |
pEnc->sStat.iMvCount = 0; |
1546 |
pEnc->mbParam.m_fcode = 2; |
pEnc->mbParam.m_fcode = 2; |
1547 |
|
|
|
// pEnc->time_pp = ((int32_t)(pEnc->current->stamp - pEnc->reference->stamp)); |
|
|
|
|
1548 |
if (pEnc->current->global_flags & XVID_HINTEDME_GET) { |
if (pEnc->current->global_flags & XVID_HINTEDME_GET) { |
1549 |
HintedMEGet(pEnc, 1); |
HintedMEGet(pEnc, 1); |
1550 |
} |
} |
|
// pEnc->last_pframe = (int32_t)pEnc->mbParam.m_stamp; |
|
1551 |
|
|
1552 |
return 1; // intra |
return 1; // intra |
1553 |
} |
} |
1794 |
|
|
1795 |
*pBits = BitstreamPos(bs) - *pBits; |
*pBits = BitstreamPos(bs) - *pBits; |
1796 |
|
|
|
// pEnc->time_pp = ((int32_t)(pEnc->current->stamp - pEnc->reference->stamp)); |
|
|
// pEnc->last_pframe = (int32_t)pEnc->mbParam.m_stamp; |
|
|
|
|
1797 |
return 0; // inter |
return 0; // inter |
1798 |
} |
} |
1799 |
|
|
1846 |
start_timer(); |
start_timer(); |
1847 |
|
|
1848 |
MotionEstimationBVOP(&pEnc->mbParam, frame, |
MotionEstimationBVOP(&pEnc->mbParam, frame, |
1849 |
((int32_t)(frame->stamp - pEnc->reference->stamp)), // time_bp |
((int32_t)(pEnc->current->stamp - frame->stamp)), // time_bp |
1850 |
((int32_t)(pEnc->current->stamp - pEnc->reference->stamp)), // time_pp |
((int32_t)(pEnc->current->stamp - pEnc->reference->stamp)), // time_pp |
1851 |
pEnc->reference->mbs, f_ref, |
pEnc->reference->mbs, f_ref, |
1852 |
&pEnc->f_refh, &pEnc->f_refv, &pEnc->f_refhv, |
&pEnc->f_refh, &pEnc->f_refv, &pEnc->f_refhv, |