[x264-devel] Getting the quantization stepsize (not QP)

BugMaster BugMaster at narod.ru
Wed Dec 7 21:33:40 CET 2016


On Wed, 07 Dec 2016 20:08:36 +0000, Eymen Kurdoglu wrote:
> Thanks for your quick reply. I've been told that what I've referred
> to as QS might be the qscale in x264. 

> Essentially I'm interested in the quantity given by 4+6*log2( QP ).

I am dunno where you have taken this formula but if you need
linearized quantizer (not logarithmic as QP) than yes qscale is what
you need. It is calculated as:

/* Terminology:
 * qp = h.264's quantizer
 * qscale = linearized quantizer = Lagrange multiplier
 */
static inline float qp2qscale( float qp )
{
    return 0.85f * powf( 2.0f, ( qp - (12.0f + QP_BD_OFFSET) ) / 6.0f );
}

where QP_BD_OFFSET is 0 for 8-bit and 12 for 10-bit encoding.

> If getting this quantity for each MB is not possible/difficult, it
> would also help me to just record the mean QP used in each MB of each frame.

As you feature request is of very limited benefit (if any) to others
libx264 users I doubt it would be added (at least I am not going to
add it). I even don't understand what for you needed it and what
benefit you get. So if this for some research project and not
production need than you have better chance to patch libx264 yourself
and change API to whatever you need.



More information about the x264-devel mailing list