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; |
226 |
pEnc->mbParam.fbase = pParam->fbase; |
pEnc->mbParam.fbase = pParam->fbase; |
227 |
pEnc->mbParam.fincr = pParam->fincr; |
pEnc->mbParam.fincr = pParam->fincr; |
228 |
|
|
229 |
|
pEnc->mbParam.m_quant_type = H263_QUANT; |
230 |
|
|
231 |
pEnc->sStat.fMvPrevSigma = -1; |
pEnc->sStat.fMvPrevSigma = -1; |
232 |
|
|
233 |
/* Fill rate control parameters */ |
/* Fill rate control parameters */ |
647 |
|
|
648 |
SWAP(pEnc->current, pEnc->reference); |
SWAP(pEnc->current, pEnc->reference); |
649 |
|
|
650 |
EMMS(); |
emms(); |
651 |
|
|
652 |
if (pFrame->quant == 0) |
if (pFrame->quant == 0) |
653 |
pEnc->current->quant = RateControlGetQ(&pEnc->rate_control, 0); |
pEnc->current->quant = RateControlGetQ(&pEnc->rate_control, 0); |
680 |
pEnc->mbParam.edged_width, pEnc->mbParam.height); |
pEnc->mbParam.edged_width, pEnc->mbParam.height); |
681 |
#endif |
#endif |
682 |
|
|
683 |
EMMS(); |
emms(); |
684 |
|
|
685 |
/* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
/* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
686 |
* Luminance masking |
* Luminance masking |
809 |
pResult->ublks = pEnc->sStat.ublks; |
pResult->ublks = pEnc->sStat.ublks; |
810 |
} |
} |
811 |
|
|
812 |
EMMS(); |
emms(); |
813 |
|
|
814 |
#ifdef _DEBUG |
#ifdef _DEBUG |
815 |
psnr = |
psnr = |
883 |
pEnc->mbParam.edged_width, pEnc->mbParam.height); |
pEnc->mbParam.edged_width, pEnc->mbParam.height); |
884 |
#endif |
#endif |
885 |
|
|
886 |
EMMS(); |
emms(); |
887 |
|
|
888 |
BitstreamInit(&bs, pFrame->bitstream, 0); |
BitstreamInit(&bs, pFrame->bitstream, 0); |
889 |
|
|
982 |
pResult->ublks = pEnc->sStat.ublks; |
pResult->ublks = pEnc->sStat.ublks; |
983 |
} |
} |
984 |
|
|
985 |
EMMS(); |
emms(); |
986 |
|
|
987 |
if (pFrame->quant == 0) { |
if (pFrame->quant == 0) { |
988 |
RateControlUpdate(&pEnc->rate_control, pEnc->current->quant, |
RateControlUpdate(&pEnc->rate_control, pEnc->current->quant, |