Amnon82
9th March 2006, 15:52
I coded GetCQ for a while. Some peoples still ask me how I did it. I like open source my self so I post now the magic behind GetCQ.
First of all we must calculate the wanted sample size (wss).
For this we need some values to calculate with:
Wanted Media Size (wms), Extra Size (es), %-Value (pv), Mux Value (mv), Actual CQ Value (acqv);
Now we start to calculate wss. Format is X:
wss = round(((wms- es -mv) / 100)*pv)
With the new value we can go on.
We start a prediction run and getting a new value, the encoded sample size in bytes (ess).
We need the encoded sample size in MB (essmb). Again format is X:
essmb = round((ess / 1024) /1024)
Now we have the essmb. We need for the next step the %-value of essmb (pvess). pvess has a format of X.XX:
pvess = (essmb/wss)*100
If pvess < 100 then we calculate %-Value2 (pv2) this way:
pv2=(((acqv/pv)*100)-acqv)/2
otherwise this way:
pv2=(((acqv/pv)*100)-acqv)*2
It is almost done! We've all for the last step.
To get the new CQ-Value (ncqv) we do this (ncqv has a format of X.XXX):
ncqv=acqv-pv2
Now we can loop until we hit the target.
With this method you maybe never reach 100% so you can do this:
You can set min and max CQ-Values (1.000|31.000) or add a routine which stops the loop and take the closest encoded %-Value and his CQ-Value.
Here some examples:
We overrun the wanted target:
acqv = 5
wms = 4476
es = 300
mv = 117
pv = 2
wss=round(((4476 - 300 - 117) / 100)*2)
> 81 MB
essmb = round((102786578 / 1024) /1024)
> 98 MB
pvess=(98/81)*100
> 120,99
pv2 = (((5/120,99)*100)-5)*2
> -1,7348541201
ncqv = 5--1,7348541201
> 6.734
We underrun the wanted target:
acqv = 5
wms = 4476
es = 300
mv = 117
pv = 2
wss=round(((4476 - 300 - 117) / 100)*2)
> 81 MB
essmb = round((78645187 / 1024) /1024)
> 75 MB
pvess=(75/81)*100
> 92,59
pv2=(((5/92,59)*100)-5)/2
>0,2000756021
ncqv=5-0,2000756021
> 4.799
(C) 2006 by Amnon82
Here the last CQGet version:
0.16.1.2 <12.12.05>
* Fixed prediction engine
* Same size/%-value is fixed now
Download Build 0.16.1.2 + HIG 0.16.1.0 (FIXED) (http://rapidshare.de/files/9062848/GetCQ_01612.rar.html)
Multiplex Tools (http://rapidshare.de/files/8611745/GetCQ_Tools.rar.html)
First of all we must calculate the wanted sample size (wss).
For this we need some values to calculate with:
Wanted Media Size (wms), Extra Size (es), %-Value (pv), Mux Value (mv), Actual CQ Value (acqv);
Now we start to calculate wss. Format is X:
wss = round(((wms- es -mv) / 100)*pv)
With the new value we can go on.
We start a prediction run and getting a new value, the encoded sample size in bytes (ess).
We need the encoded sample size in MB (essmb). Again format is X:
essmb = round((ess / 1024) /1024)
Now we have the essmb. We need for the next step the %-value of essmb (pvess). pvess has a format of X.XX:
pvess = (essmb/wss)*100
If pvess < 100 then we calculate %-Value2 (pv2) this way:
pv2=(((acqv/pv)*100)-acqv)/2
otherwise this way:
pv2=(((acqv/pv)*100)-acqv)*2
It is almost done! We've all for the last step.
To get the new CQ-Value (ncqv) we do this (ncqv has a format of X.XXX):
ncqv=acqv-pv2
Now we can loop until we hit the target.
With this method you maybe never reach 100% so you can do this:
You can set min and max CQ-Values (1.000|31.000) or add a routine which stops the loop and take the closest encoded %-Value and his CQ-Value.
Here some examples:
We overrun the wanted target:
acqv = 5
wms = 4476
es = 300
mv = 117
pv = 2
wss=round(((4476 - 300 - 117) / 100)*2)
> 81 MB
essmb = round((102786578 / 1024) /1024)
> 98 MB
pvess=(98/81)*100
> 120,99
pv2 = (((5/120,99)*100)-5)*2
> -1,7348541201
ncqv = 5--1,7348541201
> 6.734
We underrun the wanted target:
acqv = 5
wms = 4476
es = 300
mv = 117
pv = 2
wss=round(((4476 - 300 - 117) / 100)*2)
> 81 MB
essmb = round((78645187 / 1024) /1024)
> 75 MB
pvess=(75/81)*100
> 92,59
pv2=(((5/92,59)*100)-5)/2
>0,2000756021
ncqv=5-0,2000756021
> 4.799
(C) 2006 by Amnon82
Here the last CQGet version:
0.16.1.2 <12.12.05>
* Fixed prediction engine
* Same size/%-value is fixed now
Download Build 0.16.1.2 + HIG 0.16.1.0 (FIXED) (http://rapidshare.de/files/9062848/GetCQ_01612.rar.html)
Multiplex Tools (http://rapidshare.de/files/8611745/GetCQ_Tools.rar.html)