Skip to content
This repository has been archived by the owner on May 17, 2023. It is now read-only.

Different AVC low power encoding quality on free and non-free media drivers #1735

Open
dvrogozh opened this issue Oct 18, 2019 · 7 comments
Open
Assignees

Comments

@dvrogozh
Copy link
Contributor

dvrogozh commented Oct 18, 2019

Following the article https://github.com/Intel-Media-SDK/MediaSDK/wiki/Intel-media-stack-on-Ubuntu, let's compare AVC low power encoding outputs from free and non-free drivers:

wget https://fate-suite.libav.org/h264-conformance/AUD_MW_E.264
/usr/share/mfx/samples/sample_decode h264 -i AUD_MW_E.264 -o AUD_MW_E.yuv -i420

# free driver:
apt-get install intel-media-va-driver
/usr/share/mfx/samples/sample_encode h264   -w 176 -h 144 -f 30 -cqp -qpi 30 -qpp 30 -qpb 30 -qsv-ff    -i AUD_MW_E.yuv -o encoded_free_AUD_MW_E.264

# non-free driver:
apt-get install intel-media-va-driver-non-free
/usr/share/mfx/samples/sample_encode h264   -w 176 -h 144 -f 30 -cqp -qpi 30 -qpp 30 -qpb 30 -qsv-ff    -i AUD_MW_E.yuv -o encoded_nonfree_AUD_MW_E.264

sha1sum encoded*
2d4baa6a75e9ae5c7f1e57d4127cd8849360dc29  encoded_free_AUD_MW_E.264
52c1b787b16f51c7ba30eebb67deec8cf35a5354  encoded_nonfree_AUD_MW_E.264

Why free/non-free drivers output differs?

Above results obtained under Ubuntu 19.10 running on SKL.

@dvrogozh
Copy link
Contributor Author

That's likely media driver bug, but free/nonfree drivers return different caps and potentially mediasdk might do something different after reading caps. So, I suggest to investigate from mediasdk side.

@dmitryermilov
Copy link
Contributor

On which platform did you find the issue?

@dvrogozh
Copy link
Contributor Author

SKL

@AntonGrishin
Copy link

AntonGrishin commented Nov 1, 2019

Issue reproduced with latest media-driver master.
By driver dumps:
With free driver sets TU = 7 by default, instead of TU = 4 w/ non-free.
I found that with -DENABLE_NONFREE_KERNELS=OFF, also enables flag _FULL_OPEN_SOURCE.

This code is cause of issue:

#ifdef _FULL_OPEN_SOURCE
    if (!GFX_IS_PRODUCT(m_encodeCtx->pMediaCtx->platform, IGFX_ICELAKE_LP))
    {
        if (m_encodeCtx->targetUsage >= 1 && m_encodeCtx->targetUsage <= 2)
        {
            m_encodeCtx->targetUsage = 4;
        }
        else if (m_encodeCtx->targetUsage >= 3 &&m_encodeCtx->targetUsage <= 5)
        {
            m_encodeCtx->targetUsage = 7;
        }
    }
#endif

I checked with m_encodeCtx->targetUsage = 4; in second else if block. Files w/ free/non-free drivers are bit match.

So, problem is on driver side.

@dmitryermilov
Copy link
Contributor

@AntonGrishin , thanks! Indeed. it doesn't make sense why VDENC in CQP mode behaves differently for free and non free build. Can you please submit issue against media driver?

@egorovdanil
Copy link
Contributor

Not reproduced with latest media-driver master.

52c1b787b16f51c7ba30eebb67deec8cf35a5354  encoded_free_AUD_MW_E.264
52c1b787b16f51c7ba30eebb67deec8cf35a5354  encoded_nonfree_AUD_MW_E.264

@daleksan
Copy link
Contributor

daleksan commented Jun 9, 2021

Hi @dvrogozh can we close this issue?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants