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.

Controlling Look Ahead Depth Externally

Rishab_G_2
Beginner
507 Views

I need to use quick Encoder with RC in look Ahead mode (=MFX_RATECONTROL_LA) os in sample_encode application I was setting this value. The application returned an error :MFX_ERR_MEMORY_ALLOC . I guess it is configuring the look ahead Depth to maximum value that is why allocation failed. I am found one parameter LookAheadDepth in mfxExtCodingOption2 but unable to understand how to extend mfxVideoParam structure to use this parameter.

If anybody have any idea please reply.

 

Regards

Rishab

0 Kudos
9 Replies
Harshdeep_B_Intel
507 Views

Hi,

We have a article describing about  Lookahead in depth. This can be found in  LookaheadDepth. There are also few members to be set along with LookAheadDepth in mfxExtCodingOption2 like MFX_EXTBUFF_LOOKAHEAD_CTRL , LookAheadDS. Please refer to the documentation manual and all the above parameters are briefly explained with definitions. Hope this helps. 

Thanks,

0 Kudos
Surbhi_M_Intel
Employee
507 Views

Hi Rishab,

Thank you for the question.

1. You can pass the value of the LA depth as an input argument for sample_encode, -lad ranging from 10 to 100.
For eg: sample_encode h264 -i input.yuv -o output.h264 –w 720 –h 480 –b 10000
–f 30 -la -lad 20 -hw

2. If you pass this argument, it should take that as the look ahead depth, but regardless it should not give MFX_ERR_MEMORY_ALLOC  failure. Can you please let us know, what changes you have made in the sample_encode, this will help us to point out to the problem which has caused this failure. Also can you give us the system analyzer of your machine, details can be found from this post - https://software.intel.com/en-us/forums/topic/531083
3. You don't need to do this in the sample_encode, as it is already done. Please check InitMfxEncParams in pipeline_encode.cpp
    // configure the depth of the look ahead BRC if specified in command line
    if (pInParams->nLADepth)
    {
        m_CodingOption2.LookAheadDepth = pInParams->nLADepth;
        m_EncExtParams.push_back((mfxExtBuffer *)&m_CodingOption2);
    }
 

Thanks,
-Surbhi

 

0 Kudos
Rishab_G_2
Beginner
507 Views

Thanks Surbhi and Harish for your suggestions and prompt reply.

I need to clarify that I am using simple_encode application (in C) while the application Surbhi you pointed out was sample_encode (in C++) . I have observed the simple_encode application don't have any configuration parameters while sample_encode has it. I understood from the code except the liberty of configuration in sample_encode both these applications. 

I believe that same concept of LookaheadDepth to   m_EncExtParams then to mfxEncparams can be implemented in simple_encode so could you explain how thus the codec access this parameter inside the codec. Thus it scan all the members of  m_EncExtParams or there is a particular id for each type of m_EncExtParams.

Please correct me if I am wrong somewhere.

Regards

Rishab

 

 

0 Kudos
Rishab_G_2
Beginner
507 Views

I also like to add that when I configure mfxEncParams.mfx.RateControlMethod = MFX_RATECONTROL_LA then I am getting an invalid surface index(MFX_ERR_NOT_FOUND= -9) and application returns an error code MFX_ERR_MEMORY_ALLOC.

I need to configure in Lookahead mode so could I shed  any light on how to resolve this error. I am even setting Async_depth to a large value. but NumFrameSuggested does not increase more than 9 in any case.

Regards

Rishab

 

 

0 Kudos
Harshdeep_B_Intel
507 Views

Hi 

"I also like to add that when I configure mfxEncParams.mfx.RateControlMethod = MFX_RATECONTROL_LA then I am getting an invalid surface index(MFX_ERR_NOT_FOUND= -9) and application returns an error code MFX_ERR_MEMORY_ALLOC." I tried this using a simple_encode and could not see any issue or error. MFX_RATECONTROL_LA = 8 has already been allocated. 

I highly suggest to take a look into the documentation available which briefly explains the mfxExtLAControl with a definition  and if you are trying pass a standalone look ahead statistics to SDK encoder please refer to mfxExtLAFrameStatistics. Also if you can send in your modified code, we can take a look and can give in more details. 

Thanks,

0 Kudos
Rishab_G_2
Beginner
507 Views

Hello Harsh,

I went through the manual then only was able to configure these parameters. I have currently got it working by hard coding NumFrameSuggested to a higher value in the application. I noticed that NumFrameSuggested ws going up to maximum 9 no matter how much I increase the LookAheadDepth. In our application we have set it to 50 . 

Please could you suggest some solution to get rid of this hard coding.

There is also a sincere request if anybody knows about encoder integration in Media SDK platform.Please reply with the same.

Regards

Rishab

 

0 Kudos
Harshdeep_B_Intel
507 Views

Hi,

Can you please give us more details on the platform and the driver you are using. Please send in the logs from these tools which will help us in better understanding of your setup environment. 

"mfxEncParams.mfx.RateControlMethod = MFX_RATECONTROL_LA then I am getting an invalid surface index(MFX_ERR_NOT_FOUND= -9) and application returns an error code MFX_ERR_MEMORY_ALLOC" --Can you please let me know what are changes you are making to the configuration using this format. If you can send in your modified code, we can take a look and can give in more details. 

"encoder integration in Media SDK platform"--Media SDK platform includes a H.264 encoder . You can use plugins to create your own encoder with Media SDK platform. Let me know if that answers your question. 

Thanks,

0 Kudos
Rishab_G_2
Beginner
507 Views

Hello All ,

I have created a Intel Media SDK which gives me a .dll so I am trying to register this dll using regsvr32.dll . I am getting a message Dll entrypoint not found(). Do I need to implement some api for this or there is some other method?.

If I manually register the plugin then MFXVideoUSR_Load call in the sample application goes to my Create_plugin which goes fine but MFXVideoUSR_Load returns an error MFX_ERR_NOT_FOUND. I am mapping all my functions implemented under mfxPlugin strcuture in CreatePlugin, so what else could not be found ?

The manual directs me ti implement as MFXVideoUSER_Register and MFXVideoUSER_Unregister functions , but I am unable to understand their usage and what should they contain or do.

It would be great if anybody could help me on this .

 

Regards,

Rishab

0 Kudos
Rishab_G_2
Beginner
507 Views

Hello Harsh / Surabhi ,

Do you have idea about the above query ??

 

Regards

Rishab

0 Kudos
Reply