--- branches/dev-api-3/xvidcore/src/encoder.c 2002/11/02 15:52:31 619 +++ branches/dev-api-3/xvidcore/src/encoder.c 2002/11/11 20:53:34 642 @@ -39,7 +39,7 @@ * MinChen * 14.04.2002 added FrameCodeB() * - * $Id: encoder.c,v 1.76.2.14 2002-11-02 15:52:30 chl Exp $ + * $Id: encoder.c,v 1.76.2.17 2002-11-11 20:53:34 Isibaar Exp $ * ****************************************************************************/ @@ -107,13 +107,6 @@ }; -static void __inline -image_null(IMAGE * image) -{ - image->y = image->u = image->v = NULL; -} - - /***************************************************************************** * Encoder creation * @@ -623,7 +616,7 @@ start_timer(); if (image_input (&pEnc->queue[pEnc->queue_tail], pEnc->mbParam.width, pEnc->mbParam.height, - pEnc->mbParam.edged_width, pFrame->image, pFrame->colorspace)) + pEnc->mbParam.edged_width, pFrame->image, pFrame->stride, pFrame->colorspace, pFrame->general & XVID_INTERLACING)) return; stop_conv_timer(); @@ -718,6 +711,8 @@ pFrame->length = BitstreamLength(&bs); pFrame->intra = 0; + emms(); + return XVID_ERR_OK; } @@ -736,6 +731,8 @@ if (input_valid) queue_image(pEnc, pFrame); + emms(); + return XVID_ERR_OK; } @@ -769,6 +766,8 @@ if (input_valid) queue_image(pEnc, pFrame); + emms(); + return XVID_ERR_OK; } } @@ -799,8 +798,11 @@ start_timer(); if (image_input (&pEnc->current->image, pEnc->mbParam.width, pEnc->mbParam.height, - pEnc->mbParam.edged_width, pFrame->image, pFrame->colorspace)) + pEnc->mbParam.edged_width, pFrame->image, pFrame->stride, pFrame->colorspace, pFrame->general & XVID_INTERLACING)) + { + emms(); return XVID_ERR_FORMAT; + } stop_conv_timer(); // queue input frame, and dequue next image @@ -839,6 +841,7 @@ } pFrame->length = BitstreamLength(&bs); + emms(); return XVID_ERR_OK; } @@ -978,7 +981,8 @@ * NB : sequences like "IIBB" decode fine with msfdam but, * go screwy with divx 5.00 */ - } else if (pEnc->bframenum_tail >= pEnc->mbParam.max_bframes || mode != 0) { + } else if ((pEnc->bframenum_tail >= pEnc->mbParam.max_bframes) || (mode != 0)) { + /* * This will be coded as a Predicted Frame */ @@ -995,7 +999,7 @@ pFrame->intra = 0; pEnc->flush_bframes = 1; - if ((pEnc->global & XVID_GLOBAL_PACKED)) { + if ((pEnc->global & XVID_GLOBAL_PACKED) && (pEnc->bframenum_tail > 0)) { BitstreamPadAlways(&bs); input_valid = 0; goto ipvop_loop; @@ -1076,6 +1080,7 @@ stop_global_timer(); write_timer(); + emms(); return XVID_ERR_OK; } @@ -1130,7 +1135,7 @@ start_timer(); if (image_input (&pEnc->current->image, pEnc->mbParam.width, pEnc->mbParam.height, - pEnc->mbParam.edged_width, pFrame->image, pFrame->colorspace) < 0) + pEnc->mbParam.edged_width, pFrame->image, pFrame->stride, pFrame->colorspace, pFrame->general & XVID_INTERLACING) < 0) return XVID_ERR_FORMAT; stop_conv_timer(); @@ -1620,7 +1625,8 @@ } if (pEnc->current->global_flags & XVID_GMC) { - printf("Global Motion = %d %d quarterpel=%d\n", pEnc->current->GMC_MV.x, pEnc->current->GMC_MV.y,pEnc->current->quarterpel); +// printf("Global Motion = %d %d quarterpel=%d\n", pEnc->current->GMC_MV.x, pEnc->current->GMC_MV.y,pEnc->current->quarterpel); + DPRINTF(DPRINTF_HEADER, "Global Motion = %d %d quarterpel=%d\n", pEnc->current->GMC_MV.x, pEnc->current->GMC_MV.y,pEnc->current->quarterpel); pEnc->current->coding_type = S_VOP; } else pEnc->current->coding_type = P_VOP;