intel / vpl-gpu-rt

MIT License
112 stars 92 forks source link

[Bug]: Decoding mpeg2 by OneVPL #342

Closed kohshin-tokunaga closed 3 weeks ago

kohshin-tokunaga commented 3 months ago

Which component impacted?

Decode

Is it regression? Good in old configuration?

None

What happened?

Hello,

While using OneVPL to decode MPEG2, I encountered an issue. Please see the attached document for details.

This issue is very similar to a problem that occurred in the past: https://community.intel.com/t5/Media-Intel-Video-Processing/decoding-mpeg2-by-Media-SDK/m-p/1294492

Also, I would like to send the project file used for decoding, but the file size is too large to attach to the message. Is there any way to send it? README.xlsx mediasdk_system_analyzer_64.txt

Thank you.

What's the usage scenario when you are seeing the problem?

Others

What impacted?

Our company writes decoders for surveillance systems for IP cameras, and over time they fail almost 100% when using mpeg2.

Debug Information

The files required for reproduction are large, so we would like to use an ftp transfer system. Could you please contact us by email?

Do you want to contribute a patch to fix the issue?

None

Jexu commented 3 months ago

Please give more descriptions about the issue. It is decoding error, output corruption or SW crash? Any avaiable failure log? Do you try the sample decoder on your side if it decodes mpeg2 well?

kohshin-tokunaga commented 3 months ago

This is decoding error. It's a bug that causes an infinite loop when certain mpeg2 data is input.

I can send you the project I fixed to decode mpeg2, and the mpeg2 data where the error occurs.

But the file is too big to upload on this thread. I'd like to send it to you using an ftp file transfer system, so could you please let me know your email address?

intel-mediadev commented 3 months ago

Auto Created VSMGWL-75002 for further analysis.

kohshin-tokunaga commented 2 months ago

Data_including_source_code.zip

Hi

I have prepared the minimum data to reproduce the bug.

hello-decode.exe -i OK.mpeg2 hello-decode.exe -i NG.mpeg2

OK.mpeg2 can be decoded, but NG.mpeg2 seems to enter an infinite loop.

Last time I pointed this out to MediaSDK, I asked the development team to analyze it. Can you also ask the development team to analyze it? https://community.intel.com/t5/Media-Intel-Video-Processing/decoding-mpeg2-by-Media-SDK/m-p/1294492

Regards.

Jexu commented 2 months ago

Which plafrrom did you try?

With your provided NG.mpeg2, sample_decode works well without infinite loop as you saw. ./msdk_vpl_open/sample_decode mpeg2 -i NG.mpeg2 -hw -o out.yuv

You can get try to the sample_decode. hello-decode is minimum app for development reference, it may have potetial issue inside.

kohshin-tokunaga commented 2 months ago

Sorry. Where is ./msdk_vpl_open/sample_decode?

I cloned the source code from below, but I can't find sample_decode.

https://github.com/intel/libvpl.git https://github.com/intel/vpl-gpu-rt.git

Jexu commented 2 months ago

Intel® VPL Tools have all been moved to https://github.com/intel/libvpl-tools

kohshin-tokunaga commented 2 months ago

Hi

my platform is Windows.

I treid sample_decode.exe. But an error occured. Do you have any advice?

C:\work\new_20240611\libvpl-tools\libvpl-tools_build\Release>sample_decode.exe mpeg2 -i NG.mpeg2 -hw -o out.yuv CONFIGURE LOADER: required implementation: hw CONFIGURE LOADER: required implementation mfxAccelerationMode: MFX_ACCEL_MODE_VIA_D3D11 CONFIGURE LOADER: Use dispatcher's low-latency mode

[ERROR], sts=MFX_ERR_NOT_FOUND(-9), CDecodingPipeline::InitMfxParams, SetParameters failed at pipeline_decode.cpp:1032 SetParameters_error

[ERROR], sts=MFX_ERR_NOT_FOUND(-9), CDecodingPipeline::Init, InitMfxParams failed at pipeline_decode.cpp:558

[ERROR], sts=MFX_ERR_NOT_FOUND(-9), main, Pipeline.Init failed at sample_decode.cpp:846

kohshin-tokunaga commented 2 months ago

Hello.

I found a way to reproduce this problem, so I'm letting you know.

(Settings)

  1. Unzip movie_data.zip and copy it to C:.
  2. Unzip Debug.zip to a location of your choice.

(Execution)

  1. Run sample_decode_NORMAL.exe under Debug. sample_decode_NORMAL.exe mpeg2 -i meaged_data.dat -o out.yuv

This command should run without errors.

  1. Run sample_decode_NG.exe. sample_decode_NG.exe mpeg2 -i meaged_data.dat -o out.yuv

This command will stop with MFX_ERR_UNKNOWN(-1).

(Considerations) sample_decode_NG.exe has been modified to read data from C:\movie_data sequentially. (sample_util.h, sample_util.cpp) An error occurs when filename = C:\movie_data\data_000445.dat. This file only contains 1 byte of 00 data. As I pointed out before, this phenomenon a lso occurred with MediaSDK. Please check with the development team. https://community.intel.com/t5/Media-Intel-Video-Processing/decoding-mpeg2-by-Media-SDK/m-p/1294492

Last time, it was improved by updating the driver. I hope for such a quick response this time as well.

movie_data.zip Debug.zip

kohshin-tokunaga commented 2 months ago

This is the modified source code for sample_decode_NG.exe.

sample_utils.zip

Jexu commented 2 months ago

For 'data_000445', it only contains 1 byte of '00' and splittter will treat it as end of bitstream. In vpl rt https://github.com/intel/vpl-gpu-rt/blob/main/_studio/shared/umc/codec/mpeg2_dec/src/umc_mpeg2_splitter.cpp#L87, the 'readSize' is overflow here that is an issue needing to fix. After fix, the readSize will become zero. I may want to know if this piece of bitstream accutully is end of bitstream for frame.

Jexu commented 2 months ago

Try fix in https://github.com/intel/vpl-gpu-rt/pull/349

Jexu commented 2 months ago

Also add fix in example hello-*: https://github.com/intel/libvpl/pull/155

kohshin-tokunaga commented 2 months ago

Hi.

Do I need to take any action on this issue?

Regards.

Jexu commented 2 months ago

No, when you verify it works for your test, I will get the PRs merged.

Jexu commented 1 month ago

Hi may I know if above fix could solve your issue now?

kohshin-tokunaga commented 1 month ago

Hi

Thank you for replay.

I tried to build but my environment is Windows. I think that vpl-gpu-rt is for Linux.

How should I do?

kohshin-tokunaga commented 1 week ago

Hello.

When will this fix be reflected in the Windows version?