Media (Intel® Video Processing Library, Intel Media SDK)
Access community support with transcoding, decoding, and encoding in applications using media tools like Intel® oneAPI Video Processing Library and Intel® Media SDK
Announcements
The Intel Media SDK project is no longer active. For continued support and access to new features, Intel Media SDK users are encouraged to read the transition guide on upgrading from Intel® Media SDK to Intel® Video Processing Library (VPL), and to move to VPL as soon as possible.
For more information, see the VPL website.

Question to CalculateDefaultBitrate in sample_utils.cpp

boukhalfa__zakaria
254 Views

I have a question regarding the function: 'CalculateDefaultBitrate' in sample_utils.cpp

 

mfxU16 CalculateDefaultBitrate(mfxU32 nCodecId, mfxU32 nTargetUsage, mfxU32 nWidth, mfxU32 nHeight, mfxF64 dFrameRate)
{
    PartiallyLinearFNC fnc;
    mfxF64 bitrate = 0;

    switch (nCodecId)
    {
    case MFX_CODEC_AVC :
        {
            fnc.AddPair(0, 0);
            fnc.AddPair(25344, 225);
            fnc.AddPair(101376, 1000);
            fnc.AddPair(414720, 4000);
            fnc.AddPair(2058240, 5000);
            break;
        }
    case MFX_CODEC_MPEG2:
        {
            fnc.AddPair(0, 0);
            fnc.AddPair(414720, 12000);
            break;
        }
    default:
        {
            fnc.AddPair(0, 0);
            fnc.AddPair(414720, 12000);
            break;
        }
    }

    mfxF64 at = nWidth * nHeight * dFrameRate / 30.0;

//....
}

 

  1. What happes when my input framerate is higher then 30? We want to use this calculation function for framerates higher then 30.
  2. What are the X and Y values of the used PartiallyLinearFNC?
0 Kudos
1 Reply
Mark_L_Intel1
Moderator
254 Views

Hi Zack,

For #1, I did a simple experiment and have the following code:

    unsigned long nWidth, nHeight;

    double dFrameRate, at; 

    nWidth = 640;

    nHeight = 480;

    dFrameRate = 30.0; 

    at = nWidth * nHeight * dFrameRate / 30.0;

the results: dFrameRate = 30.0, output = 307200; dFrameRate = 31.0, output = 317440

So the final result should be the linear interpolation of the at after you applied PartiallyLinearFNC::at() function

For #2, are you asking how the function PartiallyLinearFNC::at() works?

Mark

0 Kudos
Reply