Back Forum Reply New

Prediction-Code for HCEnc by Amnon82

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 lt; 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)
gt; 81 MB
essmb = round((102786578 / 1024) /1024)
gt; 98 MB
pvess=(98/81)*100
gt; 120,99
pv2 = (((5/120,99)*100)-5)*2
gt; -1,7348541201
ncqv = 5--1,7348541201
gt; 6.734

We underrun the wanted target:

acqv = 5
wms = 4476
es = 300
mv = 117
pv = 2

wss=round(((4476 - 300 - 117) / 100)*2)
gt; 81 MB
essmb = round((78645187 / 1024) /1024)
gt; 75 MB
pvess=(75/81)*100
gt; 92,59
pv2=(((5/92,59)*100)-5)/2
gt;0,2000756021
ncqv=5-0,2000756021
gt; 4.799

(C) 2006 by Amnon82

Here the last CQGet version:

0.16.1.2 lt;12.12.05gt;
* Fixed prediction engine
* Same size/%-value is fixed now

Download Build 0.16.1.2 + HIG 0.16.1.0 (FIXED)
Multiplex Tools
Good Work Amnon,

when is the new release coming out, using your learning and more precise routines used in AutoQ2 .

And why not use directly 2 pass mode ... ???

Some people don't have the time for 2Pass

@techmule: AutoQ2 uses CCE. There is the prediction more precise than with HC. The prediction routine is my newest one and is actually used also in AutoQ2. AutoQ2 has only some older routines which only working with CCE better. The HC prediction routine is the sum of all routines I'm using in AutoQ2. When you're a coder, maybe I'll give you some code snipes of AutoQ2.

I only posted this routine, cos many people asked me how it works and I didn't wanted to answer all the mails  The best way was to post it public. Darksoul71 will come up with his prediction tool based on this routine. PM him for more information.


Originally Posted by Amnon82@techmule: AutoQ2 uses CCE. There is the prediction more precise than with HC. The prediction routine is my newest one and is actually used also in AutoQ2. AutoQ2 has only some older routines which only working with CCE better. The HC prediction routine is the sum of all routines I'm using in AutoQ2. When you're a coder, maybe I'll give you some code snipes of AutoQ2.

Yeah, I know, but the quality is much better in HCEnc using OPV.

I know. HC is incredible in quality. Even in SVCD mode. I think I'll release a new version of GetCQ today


Originally Posted by Amnon82I know. HC is incredible in quality. Even in SVCD mode. I think I'll release a new version of GetCQ today
¥
Back Forum Reply New