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.

H.264 sample encode for quality parameter

Lu_N_
Beginner
638 Views

Hi all,

I'm using Media SDK for the H.264 encoder by sample code(sample_encode).

As the document menstined =>[-q quality] - quality parameter for JPEG codec. In range [1,100]. 100 is the best quality.

But when I trace the source code, I can not find any parameter for the quality parameter.

Does Media SDK create the interface for "quality parameter" ?  thanks !

0 Kudos
4 Replies
Petter_L_Intel
Employee
638 Views

Hi Lu,

The "sample_encode" sample code handles the MJPEG quality parameter both in sample_encode.cpp (when parsing the cmd line) and in pipeline_encode.cpp (in InitMfxEncParams() when setting the Media SDK API parameter named Quality).

Please check the sample source code again. I'm assuming you are using Media SDK 2013 release?

Regards,
Petter 

0 Kudos
Lu_N_
Beginner
638 Views

Hi Petter, 

Thanks for your reply.

Yes, I'm using Media SDK 2013.

I also check the "sampe_encode.cpp" for parsing the cmd line and  "pipeline_encode.cpp" for InitMfxEncParams.

But I can not find anu related parameter for processing the quality.

Ex: I can find the code for parsing the bit rate or frame rate in "sampe_encode.cpp".  But it's without the quality parameter.

case MSDK_CHAR('b'):
GET_OPTION_POINTER(strArgument);
pParams->nBitRate = (mfxU16)msdk_strtol(strArgument, &stopCharacter, 10);
break;

And in "pipeline_encode.cpp" , I can find the "m_mfxEncParams.mfx.TargetKbps." for bit rate setting. But it's still without quality parameter.

Do I miss the other items?  Thanks. 

0 Kudos
celli4
New Contributor I
638 Views

I was curious, so I looked:

On lines 211-214 of sample_encode.cpp, you will find:

case MSDK_CHAR('q'):
GET_OPTION_POINTER(strArgument);
pParams->nQuality = (mfxU16)msdk_strtol(strArgument, &stopCharacter, 10);
break;

and this is where it is used to setup the appropriate element in the mfxVideoParam struct.

pipeline_encode.cpp(381): m_mfxEncParams.mfx.Quality = pInParams->nQuality;

Are you aware of the mouse right click -> find all references in VS2010/VS2012? 

While editing a successfully compiling solution, such as sample_encode, right click with the mouse on an element such as 'nQuality' and select 'find all references', it should show you all the lines the symbol in question is used on.

That's how I found that reference mentioned above.

Cameron

0 Kudos
Lu_N_
Beginner
638 Views

Hi camkego,

Thanks for your help.

I think I found the root cause. I use Media SDK R3 (Version 3.5.915.45249), it's without the prarameter as you menstioned.

But when I upgrade it to Version 4.0.0000554.52230, it appears  "pParams->nQuality" and" m_mfxEncParams.mfx.Quality" these two parameters.

Now, it's working. Thanks for your help again.

0 Kudos
Reply