Community
cancel
Showing results for 
Search instead for 
Did you mean: 
yoe
Beginner
160 Views

There is a problem when using the flip model of Dx11 in decoding.

Based on the solution on the link below, I have another problem that can't be solved.

https://community.intel.com/t5/Media-Intel-oneAPI-Video/Issue-of-Render-video-with-directX11-Hardwar... 

 

I have another problem. When I use flipped models, this hWnd will no longer be able to render with Direct3D9. However, there is a scene on my side that may lead to using the scheme provided above first, and then switching to using DX9 to render on the same hWnd.
At this point, DX9 rendering fails
Is there any other solution to the problem mentioned in this article without using the flipped model?

Using the sample of Intel mediasdk sample_decode will occur blur on the computer, but using the sample I wrote won't occur.

0 Kudos
8 Replies
AthiraM_Intel
Moderator
139 Views

Hi,


Thanks for reaching out to us.

We are checking on it internally, will get back to you soon.


Could you please let us know whether you are using the same OS and the Media SDK version as mentioned in the pervious thread:

https://community.intel.com/t5/Media-Intel-oneAPI-Video/Issue-of-Render-video-with-directX11-Hardwar...



Thanks.


yoe
Beginner
128 Views

No, now version info is:

Library version:1.33

OS info and version:windows 10 专业版64位(10.0,内部版本19041)

CPU model: Core (TM) i5-1035G7

Intel Graphics driver version:27.20.100.8681

Visual Studio 2015

----

You can modify the code of sample, first use Dx11 (flip model) to decode the display, and then use DX9 to display on the same hWnd, and the screen will freeze, similar to this change:

notice these code:

msdk_printf(MSDK_STRING("\nNow Decode and render with DX9\n"));
Pipeline->Close();
Params.memType = D3D9_MEMORY;
sts = Pipeline->Init(&Params);
MSDK_CHECK_STATUS(sts, "Pipeline.Init failed");

// print stream info
Pipeline->PrintInfo();

msdk_printf(MSDK_STRING("Decoding started\n"));

prevResetBytesCount = 0xFFFFFFFFFFFFFFFF;
for (;;)
{
sts = Pipeline->RunDecoding();

....

 

#if defined(_WIN32) || defined(_WIN64)
int _tmain(int argc, TCHAR *argv[])
#else
int main(int argc, char *argv[])
#endif
{
    sInputParams        Params;   // input parameters from command line
    CDecodingPipeline*   Pipeline =  new CDecodingPipeline(); // pipeline for decoding, includes input file reader, decoder and output file writer

    mfxStatus sts = MFX_ERR_NONE; // return value check

    sts = ParseInputString(argv, (mfxU8)argc, &Params);
    if (sts == MFX_ERR_ABORTED)
    {
        // No error, just need to close app normally
        return MFX_ERR_NONE;
    }
    MSDK_CHECK_PARSE_RESULT(sts, MFX_ERR_NONE, 1);

    if (Params.bIsMVC)
        Pipeline->SetMultiView();

    sts = Pipeline->Init(&Params);
    MSDK_CHECK_STATUS(sts, "Pipeline.Init failed");

    // print stream info
    Pipeline->PrintInfo();

    msdk_printf(MSDK_STRING("Decoding started\n"));

    mfxU64 prevResetBytesCount = 0xFFFFFFFFFFFFFFFF;
    for (;;)
    {
        sts = Pipeline->RunDecoding();

        if (MFX_ERR_INCOMPATIBLE_VIDEO_PARAM == sts || MFX_ERR_DEVICE_LOST == sts || MFX_ERR_DEVICE_FAILED == sts)
        {
            if (prevResetBytesCount == Pipeline->GetTotalBytesProcessed())
            {
                msdk_printf(MSDK_STRING("\nERROR: No input data was consumed since last reset. Quitting to avoid looping forever.\n"));
                break;
            }
            prevResetBytesCount = Pipeline->GetTotalBytesProcessed();


            if (MFX_ERR_INCOMPATIBLE_VIDEO_PARAM == sts)
            {
                msdk_printf(MSDK_STRING("\nERROR: Incompatible video parameters detected. Recovering...\n"));
            }
            else
            {
                msdk_printf(MSDK_STRING("\nERROR: Hardware device was lost or returned unexpected error. Recovering...\n"));
                sts = Pipeline->ResetDevice();
                MSDK_CHECK_STATUS(sts, "Pipeline.ResetDevice failed");
            }

            sts = Pipeline->ResetDecoder(&Params);
            MSDK_CHECK_STATUS(sts, "Pipeline.ResetDecoder failed");
            continue;
        }
        else
        {
            MSDK_CHECK_STATUS(sts, "Pipeline.RunDecoding failed");
            break;
        }
    }

    msdk_printf(MSDK_STRING("\nNow Decode and render with DX9\n"));
    Pipeline->Close();
    Params.memType = D3D9_MEMORY;
    sts = Pipeline->Init(&Params);
    MSDK_CHECK_STATUS(sts, "Pipeline.Init failed");

    // print stream info
    Pipeline->PrintInfo();

    msdk_printf(MSDK_STRING("Decoding started\n"));

    prevResetBytesCount = 0xFFFFFFFFFFFFFFFF;
    for (;;)
    {
        sts = Pipeline->RunDecoding();

 

 

 

Notice this code:

scd1.SwapEffect = DXGI_SWAP_EFFECT_FLIP_DISCARD;

 

mfxStatus CD3D11Device::FillSCD1(DXGI_SWAP_CHAIN_DESC1& scd1)
{
    scd1.Width = 0;                                     // Use automatic sizing.
    scd1.Height = 0;
    scd1.Format = (m_bIsA2rgb10) ? DXGI_FORMAT_R10G10B10A2_UNORM : DXGI_FORMAT_B8G8R8A8_UNORM;
    scd1.Stereo = m_nViews == 2 ? TRUE : FALSE;
    scd1.SampleDesc.Count = 1;                          // Don't use multi-sampling.
    scd1.SampleDesc.Quality = 0;
    scd1.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
    scd1.BufferCount = 2;                               // Use double buffering to minimize latency.
    scd1.Scaling = DXGI_SCALING_STRETCH;
    scd1.SwapEffect = DXGI_SWAP_EFFECT_FLIP_DISCARD;
    scd1.Flags = DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH;

    return MFX_ERR_NONE;
}

 

 

 

 

 

AthiraM_Intel
Moderator
108 Views

Hi,


Thanks for sharing the details.

We are checking on it internally, will get back to you soon.


Thanks


yoe
Beginner
76 Views

Mark_L_Intel1
Moderator
102 Views

Hi Yeo,

 

I am assuming you are using Media SDK API but what is "CDecodingPipeline" type?

 

If you are using DirectX API, I am afraid, this is out of our scope.

 

Mark

 

yoe
Beginner
95 Views

First, The above code is the sample code provided in Media SDK. (Those are ..\MediaSamples\sample_decode\sample_decode.sln).

Let me explain the background of this post:

1. When I use the Media SDK decoding provided by you and use the BitBlt model of DX11 to display the video, the video blur will appear. But I wrote a DX11 sample myself, and it won't produce video blur on the same computer.( A solution is provided by using the flip model of Dx11 to solve the problem of video blur:https://community.intel.com/t5/Media-Intel-oneAPI-Video/Issue-of-Render-video-with-directX11-Hardwar...).
2. But after using flip model to solve the blur problem, a new problem is introduced, so this post is to find a way to solve the video blur problem without using flip model.(note: "scd1.SwapEffect = DXGI_SWAP_EFFECT_FLIP_DISCARD" in the above code is to enable flip model)

thank you very much.

 


@Mark_L_Intel1 wrote:

Hi Yeo,

 

I am assuming you are using Media SDK API but what is "CDecodingPipeline" type?

 

If you are using DirectX API, I am afraid, this is out of our scope.

 

Mark

 


 

yoe
Beginner
76 Views

Please, thank you. 

I think this is a driver problem. Other people may have the same problem as me. I'm in a hurry to solve it. Thank you.

Mark_L_Intel1
Moderator
59 Views

Hi Yoe,


I saw your message and I am glad you will move forward on your side.


We fixed the previous issue since it causes our sample failed. The purpose of our sample is to show the feature in our library. DirectX happens to be the tool we used to show the features, so to fix any issue in DirectX which causes customized code not working is out of our scope.


About your comment "...a new problem is introduced...", if you can prove this issue can be reproduced by our original sample code, we will fix it.


I hope you can understand this and find a solution if this is caused by your own code.


Mark


Reply