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.59 2002-07-20 22:30:30 albeu Exp $ |
* $Id: encoder.c,v 1.60 2002-07-21 03:41:44 suxen_drol Exp $ |
43 |
* |
* |
44 |
****************************************************************************/ |
****************************************************************************/ |
45 |
|
|
344 |
pEnc->global = pParam->global; |
pEnc->global = pParam->global; |
345 |
pEnc->mbParam.max_bframes = pParam->max_bframes; |
pEnc->mbParam.max_bframes = pParam->max_bframes; |
346 |
pEnc->bquant_ratio = pParam->bquant_ratio; |
pEnc->bquant_ratio = pParam->bquant_ratio; |
347 |
|
pEnc->frame_drop_ratio = pParam->frame_drop_ratio; |
348 |
pEnc->bframes = NULL; |
pEnc->bframes = NULL; |
349 |
|
|
350 |
if (pEnc->mbParam.max_bframes > 0) { |
if (pEnc->mbParam.max_bframes > 0) { |
1723 |
|
|
1724 |
pEnc->sStat.fMvPrevSigma = fSigma; |
pEnc->sStat.fMvPrevSigma = fSigma; |
1725 |
|
|
1726 |
|
#ifdef BFRAMES |
1727 |
|
/* frame drop code */ |
1728 |
|
// DPRINTF(DPRINTF_DEBUG, "kmu %i %i %i", pEnc->sStat.kblks, pEnc->sStat.mblks, pEnc->sStat.ublks); |
1729 |
|
if (pEnc->sStat.kblks + pEnc->sStat.mblks <= |
1730 |
|
(pEnc->frame_drop_ratio * pEnc->mbParam.mb_width * pEnc->mbParam.mb_height) / 100) |
1731 |
|
{ |
1732 |
|
pEnc->sStat.kblks = pEnc->sStat.mblks = 0; |
1733 |
|
pEnc->sStat.ublks = pEnc->mbParam.mb_width * pEnc->mbParam.mb_height; |
1734 |
|
|
1735 |
|
BitstreamReset(bs); |
1736 |
|
BitstreamWriteVopHeader(bs, &pEnc->mbParam, pEnc->current, 0); |
1737 |
|
|
1738 |
|
// copy reference frame details into the current frame |
1739 |
|
pEnc->current->quant = pEnc->reference->quant; |
1740 |
|
pEnc->current->motion_flags = pEnc->reference->motion_flags; |
1741 |
|
pEnc->current->rounding_type = pEnc->reference->rounding_type; |
1742 |
|
pEnc->current->fcode = pEnc->reference->fcode; |
1743 |
|
pEnc->current->bcode = pEnc->reference->bcode; |
1744 |
|
image_copy(&pEnc->current->image, &pEnc->reference->image, pEnc->mbParam.edged_width, pEnc->mbParam.height); |
1745 |
|
memcpy(pEnc->current->mbs, pEnc->reference->mbs, sizeof(MACROBLOCK) * pEnc->mbParam.mb_width * pEnc->mbParam.mb_height); |
1746 |
|
|
1747 |
|
} |
1748 |
|
#endif |
1749 |
|
|
1750 |
*pBits = BitstreamPos(bs) - *pBits; |
*pBits = BitstreamPos(bs) - *pBits; |
1751 |
|
|
1752 |
#ifdef BFRAMES |
#ifdef BFRAMES |