openh264 icon indicating copy to clipboard operation
openh264 copied to clipboard

WelsReorderRefList is not working correctly for P or B Frame

Open xiaotianshicomcast opened this issue 8 years ago • 8 comments

Just discovered that WelsReorderRefList in manage_dec_ref.cpp is working correctly when ref list includes several pictures. This is not B-frame specific bug and has the same problem for P-frame.

Could someone help to fix the bug? I can provide the sample stream to reproduce bug.

Thanks a lot.

xiaotianshicomcast avatar Jun 29 '18 00:06 xiaotianshicomcast

could you please provide P frame stream for this bug? Thanks.

huili2 avatar Jun 29 '18 01:06 huili2

Hi Huili,

Great and I'll give you the complete instructions to reproduce the bug later tonight. The sample stream is 3MB, how can I send it you?

-Xiaotian

xiaotianshicomcast avatar Jun 29 '18 02:06 xiaotianshicomcast

you can send to my email ([email protected]) or paste here by the link.

huili2 avatar Jun 29 '18 02:06 huili2

Hi Huili,

The sample stream has B-frames. So you will need to use my fork https://github.com/xiaotianshicomcast/openh264 which has B-frame support.

For quick test I have VS project (x64) ready for you under openh264/codec/vsproject/windecoder.sln.

So you just need to build VS project in x64.

The debug command parameters is "solo.h264 solo.yuv" where solo.h264 is the input stream and solo.yuv is output stream.

The input stream has about 370 frames.

I notice that starting from frame 298 (P-frame) (0-based) in decoding order, the decoded yuv frame starts to show obvious artifacts. In facts, the artifacts start before frame 298. It is just not obvious yet. Eventually I found that ref list after the reordering is incorrect for the P-frame, which seems to be the source of the problem.

I notice that P frame 298 has the following ref list Ref list poc is 20, 18, 10, 14 before re-ordering Ref list poc is 20 20, 10, 14 after re-ordering.

As you can see, the ref picture 18 is lost after re-ordering.

By the way, I dumped all motion vectors and compared with those from reference decoders. They are identical.

Let me know if you need additional information.

Thanks.

-Xiaotian

xiaotianshicomcast avatar Jun 29 '18 05:06 xiaotianshicomcast

Ehhh... could you please generate some baseline multi-ref bitstream for easy debugging? Thanks in advance.

huili2 avatar Jun 29 '18 09:06 huili2

Hi Huili,

I found the problem in function WelsReorderRefList and know how to fix it and let me know if you want me to fix it?

xiaotianshi2 avatar Jul 10 '18 17:07 xiaotianshi2

Thanks, you can do of course!

huili2 avatar Jul 11 '18 00:07 huili2

@raypat56 I am pretty close to resolve the issue and let you know once I checked it in.

xiaotianshi2 avatar Jul 18 '18 03:07 xiaotianshi2