- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
My enumerator goes through available implementations. Right now there's one, the software impl (I haven't plugged in my Arc yet), as follows:
parameters.AsyncDepth = 4;
parameters.IOPattern = MFX_IOPATTERN_IN_SYSTEM_MEMORY;
parameters.mfx.CodecId = MFX_CODEC_AVC;
parameters.mfx.CodecProfile = MFX_PROFILE_AVC_MAIN;
parameters.mfx.FrameInfo.FourCC = MFX_FOURCC_NV12;
parameters.mfx.EncodedOrder = 0;
parameters.mfx.FrameInfo.ChromaFormat = MFX_CHROMAFORMAT_YUV420;
parameters.mfx.FrameInfo.PicStruct = MFX_PICSTRUCT_PROGRESSIVE;
parameters.mfx.FrameInfo.Width = static_cast<mfxU16>(1280);
parameters.mfx.FrameInfo.Height = static_cast<mfxU16>(720);
parameters.mfx.FrameInfo.CropX = 0;
parameters.mfx.FrameInfo.CropY = 0;
parameters.mfx.FrameInfo.CropW = parameters.mfx.FrameInfo.Width;
parameters.mfx.FrameInfo.CropH = parameters.mfx.FrameInfo.Height;
parameters.mfx.GopRefDist = 4;
parameters.mfx.GopPicSize = 60;
parameters.mfx.GopPicSize = 0;
parameters.mfx.GopOptFlag = MFX_GOP_STRICT;
parameters.mfx.NumRefFrame = 3;
parameters.mfx.NumSlice = 0;
parameters.mfx.IdrInterval = 0;
parameters.mfx.RateControlMethod = MFX_RATECONTROL_CBR;
parameters.mfx.TargetKbps = static_cast<mfxU16>(20000);
parameters.mfx.TargetUsage = MFX_TARGETUSAGE_BEST_QUALITY;
Convert_Frame_Rate(60, ¶meters.mfx.FrameInfo.FrameRateExtN, ¶meters.mfx.FrameInfo.FrameRateExtD);
result = Make_Error_Result(MFXVideoENCODE_Query(session, ¶meters, ¶meters));
if (Failed(result))
{
continue;
}
This is fairly simple attempt to query for an H264 encoder. In fact it doesn't seem to matter which I'm querying for, I always get the same result back from MFXVideoEncode_Query, MFX_ERR_UNSUPPORTED. I know they're available because when I enumerate them instead I can see them in the list. I have called MFXLoad() successfully and created a session successfully.
So the question is what mistake have I made here?
Before you answer, I know you're going to tell me to play around with sample_encode. Well that's where things get irritating/annoying. Which sample_encode, where? I'm pretty sure Intel samples now no longer come with Visual Studio support, i.e. there's no .sln and I have to use CMake or some other godforsaken build system that never works unless I spend two or three hours trying to figure it out. sample_encode is "legacy" from the Media SK. I've already got a layer that implements that in my previous software version. The whole point of doing the VPL implementation is to not use that.
For reference, here's the description, result from MFXEnumImplementations showing I have the software impl loaded fine and it's advertising 4 codecs:
I also ran hello_encode (made my own solution for it) and successfully encoded a single frame to HEVC with the software impl.
Thanks for any assistance you can give me and I apologise. I'm extremely frustrated right now.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I discovered that the software reference library does not support NV12. It's MFX_FOURCC_I420. I noted the following in hello_encode:
if (MFX_IMPL_SOFTWARE == cliParams.impl) {
encodeParams.mfx.FrameInfo.FourCC = MFX_FOURCC_I420;
}
else {
encodeParams.mfx.FrameInfo.FourCC = MFX_FOURCC_NV12;
}
I find this quite odd and I'm fairly certain it wasn't the case with the Media SDK. Making the change to I420 allows me to initialise an encoder in my codebase. Unfortunately I will also have to put code into it to convert from NV12, making my software reference impl even slower (that's OK as this software is designed to be used with CPU-side or Intel Arc hardware, as we ship systems to our customers - the software reference is just for completeness).
Anyway given I've solved the problem in two respects, you can close the ticket!
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
So, apparently I have to make a config in order to do this? i.e. after MFXLoad, I have to MFXCreateConfig and that is instantiating objects in the loader internally that are then used by the session?
From hello_encode:
// Implementation used must be the type requested from command line
cfg[0] = MFXCreateConfig(loader);
VERIFY(NULL != cfg[0], "MFXCreateConfig failed")
sts =
MFXSetConfigFilterProperty(cfg[0], (mfxU8 *)"mfxImplDescription.Impl", cliParams.implValue);
VERIFY(MFX_ERR_NONE == sts, "MFXSetConfigFilterProperty failed for Impl");
// Implementation must provide an HEVC encoder
cfg[1] = MFXCreateConfig(loader);
VERIFY(NULL != cfg[1], "MFXCreateConfig failed")
cfgVal[1].Type = MFX_VARIANT_TYPE_U32;
cfgVal[1].Data.U32 = MFX_CODEC_HEVC;
sts = MFXSetConfigFilterProperty(
cfg[1],
(mfxU8 *)"mfxImplDescription.mfxEncoderDescription.encoder.CodecID",
cfgVal[1]);
VERIFY(MFX_ERR_NONE == sts, "MFXSetConfigFilterProperty failed for encoder CodecID");
// Implementation used must provide API version 2.2 or newer
cfg[2] = MFXCreateConfig(loader);
VERIFY(NULL != cfg[2], "MFXCreateConfig failed")
cfgVal[2].Type = MFX_VARIANT_TYPE_U32;
cfgVal[2].Data.U32 = VPLVERSION(MAJOR_API_VERSION_REQUIRED, MINOR_API_VERSION_REQUIRED);
sts = MFXSetConfigFilterProperty(cfg[2],
(mfxU8 *)"mfxImplDescription.ApiVersion.Version",
cfgVal[2]);
VERIFY(MFX_ERR_NONE == sts, "MFXSetConfigFilterProperty failed for API version");
Given cfg isn't used thereafter. This implies I need a new or different loader for every configuration I want to query. e.g. I want to check support for AVC, HEVC and AV1. This code just does it for MFX_CODEC_HEVC. Is that correct?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I solved my immediate problem by using MFXEnumImplementations to query available implementations, get some basic info about them, etc. (for my log). Though unlike the NVIDIA SDK I can't query any other caps so it's not as granular (it cannot be unless I actually start creating sessions for all conceivable parameters in order to work out limits, which I don't want to do). I think perhaps NVIDIA's way of doing it is better from a caps query perspective.
When I get around to the actual impl this weekend we'll see if Vpl is a better interface (from the sample it looks simpler at least).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi
Thanks for posting in Intel Communities.
We apologize for the inconvenience you are currently experiencing. We fully understand your frustration. We could see that you have modified the code. To assist you more effectively, we kindly request the following: your code file and a detailed description of your system infrastructure.
Regards
Thasneem Vazim
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I discovered that the software reference library does not support NV12. It's MFX_FOURCC_I420. I noted the following in hello_encode:
if (MFX_IMPL_SOFTWARE == cliParams.impl) {
encodeParams.mfx.FrameInfo.FourCC = MFX_FOURCC_I420;
}
else {
encodeParams.mfx.FrameInfo.FourCC = MFX_FOURCC_NV12;
}
I find this quite odd and I'm fairly certain it wasn't the case with the Media SDK. Making the change to I420 allows me to initialise an encoder in my codebase. Unfortunately I will also have to put code into it to convert from NV12, making my software reference impl even slower (that's OK as this software is designed to be used with CPU-side or Intel Arc hardware, as we ship systems to our customers - the software reference is just for completeness).
Anyway given I've solved the problem in two respects, you can close the ticket!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Glad to know that your issue is resolved. If you need any additional information, please post a new question as this thread will no longer be monitored by Intel.
Regards,
Thasneem Vazim
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page