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.5 2002-09-29 15:53:42 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 |
|
|
417 |
pParam->handle = (void *) pEnc; |
pParam->handle = (void *) pEnc; |
601 |
|
|
602 |
static __inline void inc_frame_num(Encoder * pEnc) |
static __inline void inc_frame_num(Encoder * pEnc) |
603 |
{ |
{ |
604 |
|
pEnc->current->stamp = pEnc->mbParam.m_stamp; // first frame is zero |
605 |
pEnc->mbParam.m_stamp += pEnc->mbParam.fincr; |
pEnc->mbParam.m_stamp += pEnc->mbParam.fincr; |
|
pEnc->current->stamp = pEnc->mbParam.m_stamp; |
|
606 |
} |
} |
607 |
|
|
608 |
|
|
638 |
pCur->ticks = (int32_t)pCur->stamp % time_base; |
pCur->ticks = (int32_t)pCur->stamp % time_base; |
639 |
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) ; |
640 |
|
|
641 |
/* HEAVY DEBUG OUTPUT remove when timecodes prove to be stable |
//HEAVY DEBUG OUTPUT remove when timecodes prove to be stable |
642 |
|
|
643 |
fprintf(stderr,"WriteVop: %d - %d \n", |
fprintf(stderr,"WriteVop: %d - %d \n", |
644 |
((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 seconds=%d ticks=%d (ref-sec=%d ref-tick=%d)\n", |
fprintf(stderr,"set_timecodes: VOP %1d seconds=%d ticks=%d (ref-sec=%d ref-tick=%d)\n", |
648 |
pCur->coding_type, pCur->seconds, pCur->ticks, pRef->seconds, pRef->ticks); |
pCur->coding_type, pCur->seconds, pCur->ticks, pRef->seconds, pRef->ticks); |
649 |
|
|
650 |
*/ |
|
651 |
} |
} |
652 |
|
|
653 |
|
|
1543 |
pEnc->sStat.iMvCount = 0; |
pEnc->sStat.iMvCount = 0; |
1544 |
pEnc->mbParam.m_fcode = 2; |
pEnc->mbParam.m_fcode = 2; |
1545 |
|
|
|
// pEnc->time_pp = ((int32_t)(pEnc->current->stamp - pEnc->reference->stamp)); |
|
|
|
|
1546 |
if (pEnc->current->global_flags & XVID_HINTEDME_GET) { |
if (pEnc->current->global_flags & XVID_HINTEDME_GET) { |
1547 |
HintedMEGet(pEnc, 1); |
HintedMEGet(pEnc, 1); |
1548 |
} |
} |
|
// pEnc->last_pframe = (int32_t)pEnc->mbParam.m_stamp; |
|
1549 |
|
|
1550 |
return 1; // intra |
return 1; // intra |
1551 |
} |
} |
1792 |
|
|
1793 |
*pBits = BitstreamPos(bs) - *pBits; |
*pBits = BitstreamPos(bs) - *pBits; |
1794 |
|
|
|
// pEnc->time_pp = ((int32_t)(pEnc->current->stamp - pEnc->reference->stamp)); |
|
|
// pEnc->last_pframe = (int32_t)pEnc->mbParam.m_stamp; |
|
|
|
|
1795 |
return 0; // inter |
return 0; // inter |
1796 |
} |
} |
1797 |
|
|
1844 |
start_timer(); |
start_timer(); |
1845 |
|
|
1846 |
MotionEstimationBVOP(&pEnc->mbParam, frame, |
MotionEstimationBVOP(&pEnc->mbParam, frame, |
1847 |
((int32_t)(frame->stamp - pEnc->reference->stamp)), // time_bp |
((int32_t)(pEnc->current->stamp - frame->stamp)), // time_bp |
1848 |
((int32_t)(pEnc->current->stamp - pEnc->reference->stamp)), // time_pp |
((int32_t)(pEnc->current->stamp - pEnc->reference->stamp)), // time_pp |
1849 |
pEnc->reference->mbs, f_ref, |
pEnc->reference->mbs, f_ref, |
1850 |
&pEnc->f_refh, &pEnc->f_refv, &pEnc->f_refhv, |
&pEnc->f_refh, &pEnc->f_refv, &pEnc->f_refhv, |