--- trunk/xvidcore/vfw/src/codec.c 2004/04/05 20:39:49 1413 +++ trunk/xvidcore/vfw/src/codec.c 2004/07/15 11:53:46 1495 @@ -588,6 +588,7 @@ return ICERR_UNSUPPORTED; } + free(create.zones); codec->ehandle = create.handle; codec->framenum = 0; codec->keyspacing = 0; @@ -642,6 +643,8 @@ } +#define CALC_BI_STRIDE(width,bitcount) ((((width * bitcount) + 31) & ~31) >> 3) + LRESULT compress(CODEC * codec, ICCOMPRESS * icc) { BITMAPINFOHEADER * inhdr = icc->lpbiInput; @@ -710,6 +713,10 @@ frame.vop_flags |= XVID_VOP_HALFPEL; frame.vop_flags |= XVID_VOP_HQACPRED; + if (codec->config.interlacing && codec->config.tff) + frame.vop_flags |= XVID_VOP_TOPFIELDFIRST; + + if (codec->config.vop_debug) frame.vop_flags |= XVID_VOP_DEBUG; @@ -771,7 +778,7 @@ } frame.input.plane[0] = icc->lpInput; - frame.input.stride[0] = (((icc->lpbiInput->biWidth * icc->lpbiInput->biBitCount) + 31) & ~31) >> 3; + frame.input.stride[0] = CALC_BI_STRIDE(icc->lpbiInput->biWidth, icc->lpbiInput->biBitCount); if ((frame.input.csp = get_colorspace(inhdr)) == XVID_CSP_NULL) return ICERR_BADFORMAT; @@ -924,7 +931,8 @@ outhdr->biPlanes = 1; outhdr->biBitCount = 24; outhdr->biCompression = BI_RGB; /* sonic foundry vegas video v3 only supports BI_RGB */ - outhdr->biSizeImage = outhdr->biWidth * outhdr->biHeight * outhdr->biBitCount; + outhdr->biSizeImage = outhdr->biHeight * CALC_BI_STRIDE(outhdr->biWidth, outhdr->biBitCount); + outhdr->biXPelsPerMeter = 0; outhdr->biYPelsPerMeter = 0; outhdr->biClrUsed = 0; @@ -981,7 +989,8 @@ REG_GET_N("Brightness", pp_brightness, 0); REG_GET_N("Deblock_Y", pp_dy, 0) REG_GET_N("Deblock_UV", pp_duv, 0) - REG_GET_N("Dering", pp_dr, 0) + REG_GET_N("Dering_Y", pp_dry, 0) + REG_GET_N("Dering_UV", pp_druv, 0) REG_GET_N("FilmEffect", pp_fe, 0) RegCloseKey(hKey); @@ -1029,13 +1038,13 @@ convert.input.csp = get_colorspace(icd->lpbiInput); convert.input.plane[0] = icd->lpInput; - convert.input.stride[0] = (((icd->lpbiInput->biWidth *icd->lpbiInput->biBitCount) + 31) & ~31) >> 3; + convert.input.stride[0] = CALC_BI_STRIDE(icd->lpbiInput->biWidth, icd->lpbiInput->biBitCount); if (convert.input.csp == XVID_CSP_I420 || convert.input.csp == XVID_CSP_YV12) convert.input.stride[0] = (convert.input.stride[0]*2)/3; convert.output.csp = get_colorspace(icd->lpbiOutput); convert.output.plane[0] = icd->lpOutput; - convert.output.stride[0] = (((icd->lpbiOutput->biWidth *icd->lpbiOutput->biBitCount) + 31) & ~31) >> 3; + convert.output.stride[0] = CALC_BI_STRIDE(icd->lpbiOutput->biWidth, icd->lpbiOutput->biBitCount); if (convert.output.csp == XVID_CSP_I420 || convert.output.csp == XVID_CSP_YV12) convert.output.stride[0] = (convert.output.stride[0]*2)/3; @@ -1065,7 +1074,7 @@ return ICERR_BADFORMAT; } frame.output.plane[0] = icd->lpOutput; - frame.output.stride[0] = (((icd->lpbiOutput->biWidth * icd->lpbiOutput->biBitCount) + 31) & ~31) >> 3; + frame.output.stride[0] = CALC_BI_STRIDE(icd->lpbiOutput->biWidth, icd->lpbiOutput->biBitCount); if (frame.output.csp == XVID_CSP_I420 || frame.output.csp == XVID_CSP_YV12) frame.output.stride[0] = (frame.output.stride[0]*2)/3; } @@ -1076,7 +1085,8 @@ if (pp_dy)frame.general |= XVID_DEBLOCKY; if (pp_duv) frame.general |= XVID_DEBLOCKUV; -/* if (pp_dr) frame.general |= XVID_DERING; */ + if (pp_dry) frame.general |= XVID_DERINGY; + if (pp_druv) frame.general |= XVID_DERINGUV; if (pp_fe) frame.general |= XVID_FILMEFFECT; frame.brightness = pp_brightness;