--- trunk/xvidcore/vfw/src/codec.c 2004/07/15 11:53:46 1495 +++ trunk/xvidcore/vfw/src/codec.c 2005/01/30 14:04:11 1597 @@ -502,6 +502,12 @@ pass2.kfthreshold = codec->config.kfthreshold; pass2.container_frame_overhead = 24; /* AVI */ + /* VBV */ + pass2.vbv_size = profiles[codec->config.profile].max_vbv_size; + pass2.vbv_initial = (profiles[codec->config.profile].max_vbv_size*3)/4; + pass2.vbv_maxrate = 1000*profiles[codec->config.profile].max_bitrate; + pass2.vbv_peakrate = 10000000; /* 10mbps -- fixme */ + plugins[create.num_plugins].func = codec->xvid_plugin_2pass2_func; plugins[create.num_plugins].param = &pass2; create.num_plugins++; @@ -564,8 +570,7 @@ if (codec->config.packed) create.global |= XVID_GLOBAL_PACKED; - if (codec->config.closed_gov) - create.global |= XVID_GLOBAL_CLOSED_GOP; + create.global |= XVID_GLOBAL_CLOSED_GOP; } @@ -637,6 +642,11 @@ frame->vop_flags |= XVID_VOP_CHROMAOPT; } + if (config->zones[i].cartoon_mode) { + frame->vop_flags |= XVID_VOP_CARTOON; + frame->motion |= XVID_ME_DETECT_STATIC_MOTION; + } + if ((profiles[config->profile].flags & PROFILE_BVOP) && config->use_bvop) { frame->bframe_threshold = config->zones[i].bvop_threshold; } @@ -674,12 +684,6 @@ } } - if ((profiles[codec->config.profile].flags & PROFILE_REDUCED) && - codec->config.reduced_resolution) { - frame.vol_flags |= XVID_VOL_REDUCED_ENABLE; - frame.vop_flags |= XVID_VOP_REDUCED; /* XXX: need auto decion mode */ - } - if ((profiles[codec->config.profile].flags & PROFILE_QPEL) && codec->config.qpel) { frame.vol_flags |= XVID_VOL_QUARTERPEL; frame.motion |= XVID_ME_QUARTERPELREFINE16 | XVID_ME_QUARTERPELREFINE8; @@ -730,11 +734,6 @@ if (codec->config.chromame) frame.motion |= XVID_ME_CHROMA_PVOP + XVID_ME_CHROMA_BVOP; - if (codec->config.cartoon_mode) { - frame.vop_flags |= XVID_VOP_CARTOON; - frame.motion |= XVID_ME_DETECT_STATIC_MOTION; - } - if (codec->config.turbo) frame.motion |= XVID_ME_FASTREFINE16 | XVID_ME_FASTREFINE8 | XVID_ME_SKIP_DELTASEARCH | XVID_ME_FAST_MODEINTERPOLATE | @@ -742,6 +741,9 @@ frame.motion |= pmvfast_presets[codec->config.motion_search]; + if (codec->config.vhq_bframe) frame.vop_flags |= XVID_VOP_RD_BVOP; + + switch (codec->config.vhq_mode) { case VHQ_MODE_DECISION : @@ -960,6 +962,7 @@ memset(&init, 0, sizeof(init)); init.version = XVID_VERSION; init.cpu_flags = codec->config.cpu; + init.debug = codec->config.debug; codec->xvid_global_func(0, XVID_GBL_INIT, &init, NULL); memset(&create, 0, sizeof(create)); @@ -1076,7 +1079,7 @@ frame.output.plane[0] = icd->lpOutput; 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; + frame.output.stride[0] = CALC_BI_STRIDE(icd->lpbiOutput->biWidth, 8); } else {