oneVPL-intel-gpu icon indicating copy to clipboard operation
oneVPL-intel-gpu copied to clipboard

[Bug]: Decoding mpeg2 by OneVPL

Open kohshin-tokunaga opened this issue 1 year ago • 17 comments

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

kohshin-tokunaga avatar Jul 18 '24 00:07 kohshin-tokunaga

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?

Jexu avatar Jul 18 '24 07:07 Jexu

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?

kohshin-tokunaga avatar Jul 18 '24 09:07 kohshin-tokunaga

Auto Created VSMGWL-75002 for further analysis.

intel-mediadev avatar Jul 18 '24 10:07 intel-mediadev

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.

kohshin-tokunaga avatar Aug 07 '24 01:08 kohshin-tokunaga

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.

Jexu avatar Aug 07 '24 02:08 Jexu

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

kohshin-tokunaga avatar Aug 07 '24 04:08 kohshin-tokunaga

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

Jexu avatar Aug 07 '24 05:08 Jexu

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 avatar Aug 07 '24 06:08 kohshin-tokunaga

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 avatar Aug 21 '24 02:08 kohshin-tokunaga

This is the modified source code for sample_decode_NG.exe.

sample_utils.zip

kohshin-tokunaga avatar Aug 21 '24 04:08 kohshin-tokunaga

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 avatar Aug 22 '24 03:08 Jexu

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

Jexu avatar Aug 22 '24 03:08 Jexu

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

Jexu avatar Aug 22 '24 06:08 Jexu

Hi.

Do I need to take any action on this issue?

Regards.

kohshin-tokunaga avatar Aug 23 '24 00:08 kohshin-tokunaga

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

Jexu avatar Aug 23 '24 01:08 Jexu

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

Jexu avatar Sep 09 '24 02:09 Jexu

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 avatar Sep 12 '24 05:09 kohshin-tokunaga

Hello.

When will this fix be reflected in the Windows version?

kohshin-tokunaga avatar Oct 21 '24 01:10 kohshin-tokunaga