View Full Version : dynamically set the xvid zone quantizer?
Lawbreaker
11th August 2005, 11:54
Hi,
Can the zone quantizer be changed as the xvid vfw is running? I've tried to change the reg key directly, but the vfw can't react simultaneously.
Thanks.
Doom9
11th August 2005, 13:25
with what little I have seen in the code, I do think that it is possible, however, you'll have to plug into the encoder. For each frame the encoder checks if there's a matching zone and applies the modifiers accordingly, so you'd have to be able to modify the actual zones in memory. The registry won't help you there, you effectively have to rewrite the encoder and make a plugin feature that allows you to access the zone configuration at any given time.
Koepi
11th August 2005, 16:19
Why would you want to do that? This is a kind of abuse what zones are meant for.
If you dislike the rate control, go ahead and start modifying the code there, this will sure be of a cleaner (and more predictable) result.
Lawbreaker
11th August 2005, 16:20
Firstly, thanks for ur reply.
I've also tried that. I've tried to modify the encoder to check before it compress a frame, but the zone function seems to be pre-set at the beginning of compression.
Here is my modification:
int i;
CONFIG tmp;
config_reg_get(&tmp);
for (i=0; i < tmp.num_zones; i++)
{
if (tmp.zones[i].mode == RC_ZONE_QUANT)
{ codec->config.zones[i].mode = XVID_ZONE_QUANT; codec->config.zones[i].quant = tmp.zones[i].quant; }else{
codec->config.zones[i].mode = XVID_ZONE_WEIGHT; codec->config.zones[i].weight = tmp.zones[i].weight; }
}
I've added this code to the drvierproc.c, just before the compress function is called.
Can anyone please give some comment on that.
Thanks.
Lawbreaker
11th August 2005, 16:31
Why would you want to do that? This is a kind of abuse what zones are meant for.........
Thanks for your reply.
In fact, I am trying to directly compress the video sequence that sources from a cam; and I've also added some process (e.g. facedetect) to the sequence before it got compress.
That's why I wanna change the quantizer simultaneously.
Is there any other methods to accomplish that?
Thanks.
bond
11th August 2005, 16:50
special treatments of faces might be best done via the adaptive quantisation tool
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.