--- branches/dev-api-4/xvidcore/vfw/src/codec.c 2004/01/03 12:06:11 1305 +++ branches/dev-api-4/xvidcore/vfw/src/codec.c 2004/02/09 10:14:54 1358 @@ -57,6 +57,18 @@ #include "codec.h" #include "status.h" +HINSTANCE m_hdll; +int (*xvid_global_func)(void *handle, int opt, void *param1, void *param2); +int (*xvid_encore_func)(void *handle, int opt, void *param1, void *param2); +int (*xvid_decore_func)(void *handle, int opt, void *param1, void *param2); + +xvid_plugin_func *xvid_plugin_single_func, + *xvid_plugin_2pass1_func, + *xvid_plugin_2pass2_func, + *xvid_plugin_lumimasking_func, + *xvid_plugin_psnr_func; + + static const int pmvfast_presets[7] = { 0, 0, 0, 0, @@ -72,7 +84,7 @@ or XVID_CSP_NULL if failure */ -int get_colorspace(BITMAPINFOHEADER * hdr) +static int get_colorspace(BITMAPINFOHEADER * hdr) { /* rgb only: negative height specifies top down image */ int rgb_flip = (hdr->biHeight < 0 ? 0 : XVID_CSP_VFLIP); @@ -153,10 +165,10 @@ default : DPRINTF("unsupported colorspace %c%c%c%c", - hdr->biCompression&0xff, - (hdr->biCompression>>8)&0xff, - (hdr->biCompression>>16)&0xff, - (hdr->biCompression>>24)&0xff); + hdr->biCompression&0xff, + (hdr->biCompression>>8)&0xff, + (hdr->biCompression>>16)&0xff, + (hdr->biCompression>>24)&0xff); return XVID_CSP_NULL; } } @@ -172,10 +184,10 @@ BITMAPINFOHEADER * inhdr = &lpbiInput->bmiHeader; BITMAPINFOHEADER * outhdr = &lpbiOutput->bmiHeader; - /* VFWEXT detection */ - if (inhdr->biCompression == VFWEXT_FOURCC) { - return (ICM_USER+0x0fff); - } + /* VFWEXT detection */ + if (inhdr->biCompression == VFWEXT_FOURCC) { + return (ICM_USER+0x0fff); + } if (get_colorspace(inhdr) == XVID_CSP_NULL) { @@ -246,7 +258,7 @@ LRESULT compress_frames_info(CODEC * codec, ICCOMPRESSFRAMES * icf) { #if 0 - DPRINTF("%i %i", icf->lStartFrame, icf->lFrameCount); + DPRINTF("%i %i", icf->lStartFrame, icf->lFrameCount); #endif codec->fincr = icf->dwScale; codec->fbase = icf->dwRate; @@ -254,25 +266,26 @@ } -const char type2char(int type) +static char type2char(int type) { - if (type==XVID_TYPE_IVOP) - return 'I'; - if (type==XVID_TYPE_PVOP) - return 'P'; - if (type==XVID_TYPE_BVOP) - return 'B'; - return 'S'; + if (type==XVID_TYPE_IVOP) + return 'I'; + if (type==XVID_TYPE_PVOP) + return 'P'; + if (type==XVID_TYPE_BVOP) + return 'B'; + return 'S'; } -int vfw_debug(void *handle, +static int vfw_debug(void *handle, int opt, void *param1, void *param2) { switch (opt) { - case XVID_PLG_INFO: case XVID_PLG_CREATE: + *((void**)param2) = NULL; + case XVID_PLG_INFO: case XVID_PLG_DESTROY: case XVID_PLG_BEFORE: return 0; @@ -309,7 +322,7 @@ m_hdll = LoadLibrary(XVID_DLL_NAME); if (m_hdll == NULL) { DPRINTF("dll load failed"); - MessageBox(0, XVID_DLL_NAME " not found","Error", 0); + MessageBox(0, XVID_DLL_NAME " not found!","Error!", MB_ICONEXCLAMATION|MB_OK); return XVID_ERR_FAIL; } @@ -345,97 +358,163 @@ return 0; } +/* constant-quant zones for fixed quant encoding */ +static void +prepare_cquant_zones(CONFIG * config) { + + int i = 0; + if (config->num_zones == 0 || config->zones[0].frame != 0) { + /* first zone does not start at frame 0 or doesn't exist */ + + if (config->num_zones >= MAX_ZONES) config->num_zones--; /* we scrifice last zone */ + + config->zones[config->num_zones].frame = 0; + config->zones[config->num_zones].mode = RC_ZONE_QUANT; + config->zones[config->num_zones].weight = 100; + config->zones[config->num_zones].quant = config->desired_quant; + config->zones[config->num_zones].type = XVID_TYPE_AUTO; + config->zones[config->num_zones].greyscale = 0; + config->zones[config->num_zones].chroma_opt = 0; + config->zones[config->num_zones].bvop_threshold = 0; + config->num_zones++; + + sort_zones(config->zones, config->num_zones, &i); + } + + /* step 2: let's change all weight zones into quant zones */ + + for(i = 0; i < config->num_zones; i++) + if (config->zones[i].mode == RC_ZONE_WEIGHT) { + config->zones[i].mode = RC_ZONE_QUANT; + config->zones[i].quant = (100*config->desired_quant) / config->zones[i].weight; + } +} + +/* full first pass zones */ +static void +prepare_full1pass_zones(CONFIG * config) { + + int i = 0; + if (config->num_zones == 0 || config->zones[0].frame != 0) { + /* first zone does not start at frame 0 or doesn't exist */ + + if (config->num_zones >= MAX_ZONES) config->num_zones--; /* we scrifice last zone */ + + config->zones[config->num_zones].frame = 0; + config->zones[config->num_zones].mode = RC_ZONE_QUANT; + config->zones[config->num_zones].weight = 100; + config->zones[config->num_zones].quant = 200; + config->zones[config->num_zones].type = XVID_TYPE_AUTO; + config->zones[config->num_zones].greyscale = 0; + config->zones[config->num_zones].chroma_opt = 0; + config->zones[config->num_zones].bvop_threshold = 0; + config->num_zones++; + + sort_zones(config->zones, config->num_zones, &i); + } + + /* step 2: let's change all weight zones into quant zones */ + + for(i = 0; i < config->num_zones; i++) + if (config->zones[i].mode == RC_ZONE_WEIGHT) { + config->zones[i].mode = RC_ZONE_QUANT; + config->zones[i].quant = 200; + } +} + LRESULT compress_begin(CODEC * codec, BITMAPINFO * lpbiInput, BITMAPINFO * lpbiOutput) { xvid_gbl_init_t init; xvid_enc_create_t create; - xvid_enc_plugin_t plugins[3]; + xvid_enc_plugin_t plugins[3]; xvid_plugin_single_t single; xvid_plugin_2pass1_t pass1; xvid_plugin_2pass2_t pass2; - int i; + int i; + HANDLE hFile; + + CONFIG tmpCfg; /* if we want to alter config to suit our needs, it shouldn't be visible to user later */ + memcpy(&tmpCfg, &codec->config, sizeof(CONFIG)); if (init_dll() != 0) return ICERR_ERROR; - /* destroy previously created codec */ + /* destroy previously created codec */ if(codec->ehandle) { xvid_encore_func(codec->ehandle, XVID_ENC_DESTROY, NULL, NULL); codec->ehandle = NULL; } - memset(&init, 0, sizeof(init)); + memset(&init, 0, sizeof(init)); init.version = XVID_VERSION; init.cpu_flags = codec->config.cpu; - init.debug = codec->config.debug; + init.debug = codec->config.debug; xvid_global_func(0, XVID_GBL_INIT, &init, NULL); memset(&create, 0, sizeof(create)); create.version = XVID_VERSION; - /* zones */ - create.zones = malloc(sizeof(xvid_enc_zone_t) * codec->config.num_zones); - create.num_zones = codec->config.num_zones; - for (i=0; i < create.num_zones; i++) { - create.zones[i].frame = codec->config.zones[i].frame; - if (codec->config.zones[i].mode == RC_ZONE_QUANT) { - create.zones[i].mode = XVID_ZONE_QUANT; - create.zones[i].increment = codec->config.zones[i].quant; - }else{ - create.zones[i].mode = XVID_ZONE_WEIGHT; - create.zones[i].increment = codec->config.zones[i].weight; - } - create.zones[i].base = 100; - } - - /* plugins */ + /* plugins */ create.plugins = plugins; switch (codec->config.mode) { case RC_MODE_1PASS : - memset(&single, 0, sizeof(single)); - single.version = XVID_VERSION; - single.bitrate = codec->config.bitrate * CONFIG_KBPS; - single.reaction_delay_factor = codec->config.rc_reaction_delay_factor; + memset(&single, 0, sizeof(single)); + single.version = XVID_VERSION; + single.bitrate = codec->config.bitrate * CONFIG_KBPS; + single.reaction_delay_factor = codec->config.rc_reaction_delay_factor; single.averaging_period = codec->config.rc_averaging_period; single.buffer = codec->config.rc_buffer; - plugins[create.num_plugins].func = xvid_plugin_single_func; - plugins[create.num_plugins].param = &single; - create.num_plugins++; - break; + plugins[create.num_plugins].func = xvid_plugin_single_func; + plugins[create.num_plugins].param = &single; + create.num_plugins++; + if (!codec->config.use_2pass_bitrate) /* constant-quant mode */ + prepare_cquant_zones(&tmpCfg); + break; case RC_MODE_2PASS1 : - memset(&pass1, 0, sizeof(pass1)); - pass1.version = XVID_VERSION; - pass1.filename = codec->config.stats; - - plugins[create.num_plugins].func = xvid_plugin_2pass1_func; - plugins[create.num_plugins].param = &pass1; - create.num_plugins++; + memset(&pass1, 0, sizeof(pass1)); + pass1.version = XVID_VERSION; + pass1.filename = codec->config.stats; + if (codec->config.full1pass) + prepare_full1pass_zones(&tmpCfg); + plugins[create.num_plugins].func = xvid_plugin_2pass1_func; + plugins[create.num_plugins].param = &pass1; + create.num_plugins++; break; case RC_MODE_2PASS2 : - memset(&pass2, 0, sizeof(pass2)); - pass2.version = XVID_VERSION; - if (codec->config.use_2pass_bitrate) { - pass2.bitrate = codec->config.bitrate * CONFIG_KBPS; - }else{ - pass2.bitrate = -codec->config.desired_size; /* kilobytes */ - } + memset(&pass2, 0, sizeof(pass2)); + pass2.version = XVID_VERSION; + if (codec->config.use_2pass_bitrate) { + pass2.bitrate = codec->config.bitrate * CONFIG_KBPS; + } else { + pass2.bitrate = -codec->config.desired_size; /* kilobytes */ + } pass2.filename = codec->config.stats; - pass2.keyframe_boost = codec->config.keyframe_boost; /* keyframe boost percentage: [0..100...]; */ - pass2.curve_compression_high = codec->config.curve_compression_high; - pass2.curve_compression_low = codec->config.curve_compression_low; + hFile = CreateFile(pass2.filename, 0, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL); + if (hFile == INVALID_HANDLE_VALUE) + { + MessageBox(0, "Statsfile not found!","Error!", MB_ICONEXCLAMATION|MB_OK); + return XVID_ERR_FAIL; + } else + { + CloseHandle(hFile); + } + + pass2.keyframe_boost = codec->config.keyframe_boost; /* keyframe boost percentage: [0..100...]; */ + pass2.curve_compression_high = codec->config.curve_compression_high; + pass2.curve_compression_low = codec->config.curve_compression_low; pass2.overflow_control_strength = codec->config.overflow_control_strength; - pass2.max_overflow_improvement = codec->config.twopass_max_overflow_improvement; - pass2.max_overflow_degradation = codec->config.twopass_max_overflow_degradation; - pass2.kfreduction = codec->config.kfreduction; - pass2.kfthreshold = codec->config.kfthreshold; - pass2.container_frame_overhead = 24; /* AVI */ - - plugins[create.num_plugins].func = xvid_plugin_2pass2_func; - plugins[create.num_plugins].param = &pass2; - create.num_plugins++; + pass2.max_overflow_improvement = codec->config.twopass_max_overflow_improvement; + pass2.max_overflow_degradation = codec->config.twopass_max_overflow_degradation; + pass2.kfreduction = codec->config.kfreduction; + pass2.kfthreshold = codec->config.kfthreshold; + pass2.container_frame_overhead = 24; /* AVI */ + + plugins[create.num_plugins].func = xvid_plugin_2pass2_func; + plugins[create.num_plugins].param = &pass2; + create.num_plugins++; break; case RC_MODE_NULL : @@ -445,48 +524,64 @@ break; } + /* zones - copy from tmpCfg in case we automatically altered them above */ + create.zones = malloc(sizeof(xvid_enc_zone_t) * tmpCfg.num_zones); + create.num_zones = tmpCfg.num_zones; + for (i=0; i < create.num_zones; i++) { + create.zones[i].frame = tmpCfg.zones[i].frame; + if (tmpCfg.zones[i].mode == RC_ZONE_QUANT) { + create.zones[i].mode = XVID_ZONE_QUANT; + create.zones[i].increment = tmpCfg.zones[i].quant; + }else{ + create.zones[i].mode = XVID_ZONE_WEIGHT; + create.zones[i].increment = tmpCfg.zones[i].weight; + } + create.zones[i].base = 100; + } + + /* lumimasking plugin */ if ((profiles[codec->config.profile].flags & PROFILE_ADAPTQUANT) && codec->config.lum_masking) { - plugins[create.num_plugins].func = xvid_plugin_lumimasking_func; - plugins[create.num_plugins].param = NULL; - create.num_plugins++; + plugins[create.num_plugins].func = xvid_plugin_lumimasking_func; + plugins[create.num_plugins].param = NULL; + create.num_plugins++; } - plugins[create.num_plugins].func = vfw_debug; - plugins[create.num_plugins].param = NULL; - create.num_plugins++; + plugins[create.num_plugins].func = vfw_debug; + plugins[create.num_plugins].param = NULL; + create.num_plugins++; - create.profile = profiles[codec->config.profile].id; + create.profile = profiles[codec->config.profile].id; create.width = lpbiInput->bmiHeader.biWidth; create.height = lpbiInput->bmiHeader.biHeight; create.fincr = codec->fincr; create.fbase = codec->fbase; - create.max_key_interval = codec->config.max_key_interval; + create.max_key_interval = codec->config.max_key_interval; - create.min_quant[0] = codec->config.min_iquant; - create.max_quant[0] = codec->config.max_iquant; - create.min_quant[1] = codec->config.min_pquant; - create.max_quant[1] = codec->config.max_pquant; - create.min_quant[2] = codec->config.min_bquant; - create.max_quant[2] = codec->config.max_bquant; - - if ((profiles[codec->config.profile].flags & PROFILE_BVOP) && codec->config.use_bvop) { - create.max_bframes = codec->config.max_bframes; - create.bquant_ratio = codec->config.bquant_ratio; - create.bquant_offset = codec->config.bquant_offset; + create.min_quant[0] = codec->config.min_iquant; + create.max_quant[0] = codec->config.max_iquant; + create.min_quant[1] = codec->config.min_pquant; + create.max_quant[1] = codec->config.max_pquant; + create.min_quant[2] = codec->config.min_bquant; + create.max_quant[2] = codec->config.max_bquant; + + if ((profiles[codec->config.profile].flags & PROFILE_BVOP) && codec->config.use_bvop) { + create.max_bframes = codec->config.max_bframes; + create.bquant_ratio = codec->config.bquant_ratio; + create.bquant_offset = codec->config.bquant_offset; - if (codec->config.packed) - create.global |= XVID_GLOBAL_PACKED; + if (codec->config.packed) + create.global |= XVID_GLOBAL_PACKED; - if (codec->config.closed_gov) - create.global |= XVID_GLOBAL_CLOSED_GOP; + if (codec->config.closed_gov) + create.global |= XVID_GLOBAL_CLOSED_GOP; - } + } create.frame_drop_ratio = codec->config.frame_drop_ratio; - create.num_threads = codec->config.num_threads; + create.num_threads = codec->config.num_threads; switch(xvid_encore_func(0, XVID_ENC_CREATE, &create, NULL)) { @@ -507,10 +602,10 @@ codec->framenum = 0; codec->keyspacing = 0; - if (codec->config.display_status) { - status_destroy_always(&codec->status); - status_create(&codec->status, codec->fincr, codec->fbase); - } + if (codec->config.display_status) { + status_destroy_always(&codec->status); + status_create(&codec->status, codec->fincr, codec->fbase); + } return ICERR_OK; } @@ -518,7 +613,7 @@ LRESULT compress_end(CODEC * codec) { - if (m_hdll != NULL) { + if (m_hdll != NULL) { if (codec->ehandle != NULL) { xvid_encore_func(codec->ehandle, XVID_ENC_DESTROY, NULL, NULL); codec->ehandle = NULL; @@ -527,8 +622,8 @@ m_hdll = NULL; } - if (codec->config.display_status) - status_destroy(&codec->status); + if (codec->config.display_status) + status_destroy(&codec->status); return ICERR_OK; } @@ -536,26 +631,26 @@ static void apply_zone_modifiers(xvid_enc_frame_t * frame, CONFIG * config, int framenum) { - int i; + int i; - for (i=0; inum_zones && config->zones[i].frame <= framenum; i++) ; + for (i=0; inum_zones && config->zones[i].frame <= framenum; i++) ; - if (--i < 0) return; /* there are no zones, or we're before the first zone */ + if (--i < 0) return; /* there are no zones, or we're before the first zone */ - if (framenum == config->zones[i].frame) + if (framenum == config->zones[i].frame) frame->type = config->zones[i].type; - if (config->zones[i].greyscale) { - frame->vop_flags |= XVID_VOP_GREYSCALE; - } - - if (config->zones[i].chroma_opt) { - frame->vop_flags |= XVID_VOP_CHROMAOPT; - } - - if ((profiles[config->profile].flags & PROFILE_BVOP) && config->use_bvop) { - frame->bframe_threshold = config->zones[i].bvop_threshold; - } + if (config->zones[i].greyscale) { + frame->vop_flags |= XVID_VOP_GREYSCALE; + } + + if (config->zones[i].chroma_opt) { + frame->vop_flags |= XVID_VOP_CHROMAOPT; + } + + if ((profiles[config->profile].flags & PROFILE_BVOP) && config->use_bvop) { + frame->bframe_threshold = config->zones[i].bvop_threshold; + } } @@ -570,12 +665,12 @@ memset(&frame, 0, sizeof(frame)); frame.version = XVID_VERSION; - frame.type = XVID_TYPE_AUTO; + frame.type = XVID_TYPE_AUTO; /* vol stuff */ - if ((profiles[codec->config.profile].flags & PROFILE_MPEGQUANT) && - codec->config.quant_type != QUANT_MODE_H263) + if ((profiles[codec->config.profile].flags & PROFILE_MPEGQUANT) && + codec->config.quant_type != QUANT_MODE_H263) { frame.vol_flags |= XVID_VOL_MPEGQUANT; @@ -588,8 +683,8 @@ } } - if ((profiles[codec->config.profile].flags & PROFILE_REDUCED) && - codec->config.reduced_resolution) { + 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 */ } @@ -622,7 +717,7 @@ frame.par_height= (100 * inhdr->biWidth) / codec->config.ar_x; } - /* vop stuff */ + /* vop stuff */ frame.vop_flags |= XVID_VOP_HALFPEL; frame.vop_flags |= XVID_VOP_HQACPRED; @@ -630,11 +725,11 @@ if (codec->config.vop_debug) frame.vop_flags |= XVID_VOP_DEBUG; - if (codec->config.trellis_quant) { - frame.vop_flags |= XVID_VOP_TRELLISQUANT; - } + if (codec->config.trellis_quant) { + frame.vop_flags |= XVID_VOP_TRELLISQUANT; + } - if (codec->config.motion_search > 4) + if (codec->config.motion_search > 4) frame.vop_flags |= XVID_VOP_INTER4V; if (codec->config.chromame) @@ -693,33 +788,35 @@ if ((frame.input.csp = get_colorspace(inhdr)) == XVID_CSP_NULL) return ICERR_BADFORMAT; - if (frame.input.csp == XVID_CSP_I420 || frame.input.csp == XVID_CSP_YV12) - frame.input.stride[0] = (frame.input.stride[0]*2)/3; + if (frame.input.csp == XVID_CSP_I420 || frame.input.csp == XVID_CSP_YV12) { + frame.input.stride[0] = (4 * icc->lpbiInput->biWidth + 3) / 4; + frame.input.stride[1] = frame.input.stride[2] = frame.input.stride[0] / 2 ; + } frame.bitstream = icc->lpOutput; frame.length = icc->lpbiOutput->biSizeImage; - frame.quant = 0; + frame.quant = 0; - if (codec->config.mode == RC_MODE_NULL) { + if (codec->config.mode == RC_MODE_NULL) { outhdr->biSizeImage = 0; *icc->lpdwFlags = AVIIF_KEYFRAME; return ICERR_OK; - } + } // force keyframe spacing in 2-pass 1st pass if (codec->config.motion_search == 0) frame.type = XVID_TYPE_IVOP; - /* frame-based stuff */ - apply_zone_modifiers(&frame, &codec->config, codec->framenum); + /* frame-based stuff */ + apply_zone_modifiers(&frame, &codec->config, codec->framenum); - /* call encore */ + /* call encore */ memset(&stats, 0, sizeof(stats)); stats.version = XVID_VERSION; - length = xvid_encore_func(codec->ehandle, XVID_ENC_ENCODE, &frame, &stats); + length = xvid_encore_func(codec->ehandle, XVID_ENC_ENCODE, &frame, &stats); switch (length) { case XVID_ERR_FAIL : @@ -735,13 +832,13 @@ return ICERR_UNSUPPORTED; } - if (codec->config.display_status && stats.type>0) { - status_update(&codec->status, stats.type, stats.length, stats.quant); - } + if (codec->config.display_status && stats.type>0) { + status_update(&codec->status, stats.type, stats.length, stats.quant); + } DPRINTF("{type=%i len=%i} length=%i", stats.type, stats.length, length); - if (length == 0) /* no encoder output */ + if (length == 0) /* no encoder output */ { *icc->lpdwFlags = 0; ((char*)icc->lpOutput)[0] = 0x7f; /* virtual dub skip frame */ @@ -749,22 +846,22 @@ }else{ if (frame.out_flags & XVID_KEYFRAME) - { - codec->keyspacing = 0; - *icc->lpdwFlags = AVIIF_KEYFRAME; - } - else - { - *icc->lpdwFlags = 0; - } - - outhdr->biSizeImage = length; - - if (codec->config.mode == RC_MODE_2PASS1 && codec->config.discard1pass) - { - outhdr->biSizeImage = 0; - } - } + { + codec->keyspacing = 0; + *icc->lpdwFlags = AVIIF_KEYFRAME; + } + else + { + *icc->lpdwFlags = 0; + } + + outhdr->biSizeImage = length; + + if (codec->config.mode == RC_MODE_2PASS1 && codec->config.discard1pass) + { + outhdr->biSizeImage = 0; + } + } codec->framenum++; codec->keyspacing++; @@ -848,11 +945,19 @@ return ICERR_OK; } +#define REG_GET_N(X, Y, Z) \ +{ \ + DWORD size = sizeof(int); \ + if (RegQueryValueEx(hKey, X, 0, 0, (LPBYTE)&Y, &size) != ERROR_SUCCESS) { \ + Y=Z; \ + } \ +}while(0) LRESULT decompress_begin(CODEC * codec, BITMAPINFO * lpbiInput, BITMAPINFO * lpbiOutput) { xvid_gbl_init_t init; xvid_dec_create_t create; + HKEY hKey; if (init_dll() != 0) return ICERR_ERROR; @@ -868,7 +973,7 @@ switch(xvid_decore_func(0, XVID_DEC_CREATE, &create, NULL)) { - case XVID_ERR_FAIL : + case XVID_ERR_FAIL : return ICERR_ERROR; case XVID_ERR_MEMORY : @@ -883,6 +988,15 @@ codec->dhandle = create.handle; + RegOpenKeyEx(XVID_REG_KEY, XVID_REG_PARENT "\\" XVID_REG_CHILD, 0, KEY_READ, &hKey); + + 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("FilmEffect", pp_fe, 0) + + RegCloseKey(hKey); + return ICERR_OK; } @@ -914,14 +1028,14 @@ xvid_gbl_convert_t convert; DPRINTF("input=%c%c%c%c output=%c%c%c%c", - icd->lpbiInput->biCompression&0xff, - (icd->lpbiInput->biCompression>>8)&0xff, - (icd->lpbiInput->biCompression>>16)&0xff, - (icd->lpbiInput->biCompression>>24)&0xff, - icd->lpbiOutput->biCompression&0xff, - (icd->lpbiOutput->biCompression>>8)&0xff, - (icd->lpbiOutput->biCompression>>16)&0xff, - (icd->lpbiOutput->biCompression>>24)&0xff); + icd->lpbiInput->biCompression&0xff, + (icd->lpbiInput->biCompression>>8)&0xff, + (icd->lpbiInput->biCompression>>16)&0xff, + (icd->lpbiInput->biCompression>>24)&0xff, + icd->lpbiOutput->biCompression&0xff, + (icd->lpbiOutput->biCompression>>8)&0xff, + (icd->lpbiOutput->biCompression>>16)&0xff, + (icd->lpbiOutput->biCompression>>24)&0xff); memset(&convert, 0, sizeof(convert)); convert.version = XVID_VERSION; @@ -951,9 +1065,9 @@ } /* --- yv12 --- */ - memset(&frame, 0, sizeof(frame)); - frame.version = XVID_VERSION; - frame.general = XVID_LOWDELAY; /* force low_delay_default mode */ + memset(&frame, 0, sizeof(frame)); + frame.version = XVID_VERSION; + frame.general = XVID_LOWDELAY; /* force low_delay_default mode */ frame.bitstream = icd->lpInput; frame.length = icd->lpbiInput->biSizeImage; @@ -973,6 +1087,11 @@ frame.output.csp = XVID_CSP_NULL; } + if (pp_dy)frame.general |= XVID_DEBLOCKY; + if (pp_duv) frame.general |= XVID_DEBLOCKUV; +/* if (pp_dr) frame.general |= XVID_DERING; */ + if (pp_fe) frame.general |= XVID_FILMEFFECT; + switch (xvid_decore_func(codec->dhandle, XVID_DEC_DECODE, &frame, NULL)) { case XVID_ERR_FAIL :