36 |
* MinChen <chenm001@163.com> |
* MinChen <chenm001@163.com> |
37 |
* 14.04.2002 added FrameCodeB() |
* 14.04.2002 added FrameCodeB() |
38 |
* |
* |
39 |
* $Id: encoder.c,v 1.41 2002-06-12 20:38:40 edgomez Exp $ |
* $Id: encoder.c,v 1.42 2002-06-13 11:42:15 edgomez Exp $ |
40 |
* |
* |
41 |
****************************************************************************/ |
****************************************************************************/ |
42 |
|
|
43 |
#include <stdlib.h> |
#include <stdlib.h> |
44 |
#include <stdio.h> |
#include <stdio.h> |
45 |
#include <math.h> |
#include <math.h> |
46 |
|
#include <string.h> |
47 |
|
|
48 |
#include "encoder.h" |
#include "encoder.h" |
49 |
#include "prediction/mbprediction.h" |
#include "prediction/mbprediction.h" |
208 |
if (pEnc == NULL) |
if (pEnc == NULL) |
209 |
return XVID_ERR_MEMORY; |
return XVID_ERR_MEMORY; |
210 |
|
|
211 |
|
/* Zero the Encoder Structure */ |
212 |
|
|
213 |
|
memset(pEnc, 0, sizeof(Encoder)); |
214 |
|
|
215 |
/* Fill members of Encoder structure */ |
/* Fill members of Encoder structure */ |
216 |
|
|
217 |
pEnc->mbParam.width = pParam->width; |
pEnc->mbParam.width = pParam->width; |
645 |
|
|
646 |
SWAP(pEnc->current, pEnc->reference); |
SWAP(pEnc->current, pEnc->reference); |
647 |
|
|
648 |
EMMS(); |
emms(); |
649 |
|
|
650 |
if (pFrame->quant == 0) |
if (pFrame->quant == 0) |
651 |
pEnc->current->quant = RateControlGetQ(&pEnc->rate_control, 0); |
pEnc->current->quant = RateControlGetQ(&pEnc->rate_control, 0); |
678 |
pEnc->mbParam.edged_width, pEnc->mbParam.height); |
pEnc->mbParam.edged_width, pEnc->mbParam.height); |
679 |
#endif |
#endif |
680 |
|
|
681 |
EMMS(); |
emms(); |
682 |
|
|
683 |
/* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
/* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
684 |
* Luminance masking |
* Luminance masking |
807 |
pResult->ublks = pEnc->sStat.ublks; |
pResult->ublks = pEnc->sStat.ublks; |
808 |
} |
} |
809 |
|
|
810 |
EMMS(); |
emms(); |
811 |
|
|
812 |
#ifdef _DEBUG |
#ifdef _DEBUG |
813 |
psnr = |
psnr = |
881 |
pEnc->mbParam.edged_width, pEnc->mbParam.height); |
pEnc->mbParam.edged_width, pEnc->mbParam.height); |
882 |
#endif |
#endif |
883 |
|
|
884 |
EMMS(); |
emms(); |
885 |
|
|
886 |
BitstreamInit(&bs, pFrame->bitstream, 0); |
BitstreamInit(&bs, pFrame->bitstream, 0); |
887 |
|
|
980 |
pResult->ublks = pEnc->sStat.ublks; |
pResult->ublks = pEnc->sStat.ublks; |
981 |
} |
} |
982 |
|
|
983 |
EMMS(); |
emms(); |
984 |
|
|
985 |
if (pFrame->quant == 0) { |
if (pFrame->quant == 0) { |
986 |
RateControlUpdate(&pEnc->rate_control, pEnc->current->quant, |
RateControlUpdate(&pEnc->rate_control, pEnc->current->quant, |