Intel® Integrated Performance Primitives
Deliberate problems developing high-performance vision, signal, security, and storage applications.

UMC: MPEG2 Decoder Crash

Scott_Danahy
Beginner
1,000 Views
Hi,
I've encountered a case where the MPEG2 decoder crashes. I havenumThreads set to 8 and there appears to be a problem correctly setting up the internal worker threads. One of theMPEG2VideoDecoderBase::ThreadWorkingRoutine instances will callDecodeSlices with null buffer pointers (IppVideoContext::bs_* values are all NULL or zero).
This seems to happen whenm_nNumberOfThreads andcurr_thread do not match after the thread initialization loop inMPEG2VideoDecoderBase::DecodePicture.
I can reproduce this with simple_player like this:
simple_player.exeD:\\crash.m2v -vnul -t 8
This only happens for certain MPEG2 bistreams. Has anyone else seen this issue? Any suggestions on how to work around it?
Scott
0 Kudos
25 Replies
Vladimir_Dudnik
Employee
823 Views
Hi Scott,

what version of IPP and sample do you use, what is your target cpu, OS? Is it possible to attach problem stream here to help us reproduce and investigate the problem?

Regards,
Vladimir
0 Kudos
Scott_Danahy
Beginner
823 Views
Hi,
I'm using IPP 6.1 and samples 6.1.6.065. I reproduced this with Windows 7 running on two Xeon X5550processors. I'll have to check and see if I can share the stream in question.
Thank you,
Scott
0 Kudos
Scott_Danahy
Beginner
823 Views
Hi Vladimir,
I've also found a couple of files that show bad visual errors in the decoded frames. Two other MPEG2 decoders do not show these errors and I am fairly confident that the file itself is good. Can I share this clip with you as well?
Scott
0 Kudos
Vladimir_Dudnik
Employee
823 Views
yes, of course that will be useful

Thanks,
Vladimir
0 Kudos
Scott_Danahy
Beginner
823 Views
Hi Vladimir,
Do you know when I might get some more info on the files I provided?
Thank you,
Scott
0 Kudos
Vladimir_Dudnik
Employee
823 Views
Hi Scott,

we are still looking at your issue.

Regards,
Vladimir
0 Kudos
Alexander_Modenov__I
New Contributor I
823 Views
Hi Scott,
Looks like we've the solution.
Please make the following changes in the codec/mpeg2_dec/src/umc_mpeg2_dec_pic.cpp file :
Ipp32s curr_thread;-----------> should be moved from line 925 to line 918
Lines 981,982 should be written as :
if (curr_thread < m_nNumberOfThreads)
m_nNumberOfThreads = curr_thread;
Regards,
Alexander
0 Kudos
Scott_Danahy
Beginner
823 Views
Thank you very much, I'll apply thisimmediately.
Do you have any more information on the other 'bad frame' issue I reported? I attached the 'bad-frames-intel.m2v' sample file in an earlier private response toVladimir.
0 Kudos
Alexander_Modenov__I
New Contributor I
823 Views
What do you mean under "bad frames" - horizontal color bands on two or more frames ?
Regards,
Alexander
0 Kudos
Scott_Danahy
Beginner
823 Views
Hi Alexander,
Yes, I'm talking about the horizontal color bands. Those are not present with other decoders.
Thanks for looking into this.
Scott
0 Kudos
Scott_Danahy
Beginner
823 Views
Hi Vladimir andAlexander,
Is there any update on the horizontal color band issue?
Scott
0 Kudos
Scott_Danahy
Beginner
823 Views
Hi Guys,
Any update on this issue?
Scott
0 Kudos
Alexander_Modenov__I
New Contributor I
823 Views
Hi Scott,
Thanks for the stream. We've reproduced the problem on IPP 7.0 too. The problem is under investigation now.
We'll inform you about our progress.
Regards,
Alexander
0 Kudos
Scott_Danahy
Beginner
823 Views
Hi Alexander,
Thanks for the update, please let me know if I can provide any more information.
Scott
0 Kudos
Alexander_Modenov__I
New Contributor I
823 Views

Hi Scott,

I've just found the problem case in MPEG2 decoder.

The solution is the following :

file umc_mpeg2_dec_blk.cpp line 212, column 45 0xab shall be written instead of 0xbb

After this change everything should be OK.

Regards,
Alexander

0 Kudos
Scott_Danahy
Beginner
823 Views
Thank you! I'll test it and get back to you.
0 Kudos
Scott_Danahy
Beginner
823 Views
Hi Alexander,
I applied the fix, and it resolves the issue with the specific segment I sent you, however I see many more similar errors in the complete file. I will send another sample.
Thank you,
Scott
0 Kudos
Scott_Danahy
Beginner
823 Views
Hi Alexander,
Happy new year. Any update on the latest visual errors?
Thanks,
Scott
0 Kudos
Alexander_Modenov__I
New Contributor I
823 Views
Hi Scott,
Happy new Year.
I've just found the problem root case.
Please add the following changes:
File umc_mpeg2_dec_bstream.h

write
#define SHOW_HI9BITS(video, CODE) \
CODE = (((video##_curr_ptr[0] << 24) | (video##_curr_ptr[1] << 16) | (video##_curr_ptr[2] << 8)) << video##_bit_offset);
#define SHOW_HI9BITS(video, CODE) \CODE = (((video##_curr_ptr[0] << 24) | (video##_curr_ptr[1] << 16) | (video##_curr_ptr[2] << 8)) << video##_bit_offset);
instead of
#define SHOW_HI9BITS(video, CODE) \
CODE = (((video##_curr_ptr[0] << 24) | (video##_curr_ptr[1] << 16)) << video##_bit_offset);
Thanks for testing.
Regards,
Alexander
0 Kudos
Scott_Danahy
Beginner
779 Views
Hi Alexander,
Thanks for the reply.
This fixdoesn'tmake a lot of sense to me. The cause of the problem seems to be not having enough bits loaded to property use the MPEG2_DCSIZE_TABtable. I'm not sure that every invocation of SHOW_HI9BITS should be loading an additional 8 bits.Wouldn'ta bettersolutionbe to modifyDECODE_DC() in umc_mpeg2_bstream.h to invokeEXPAND_17BITS() at thebeginningof the outer else branch before it needs the additional bits?
Replace this:
} else { \
tbl = pTab[32 + (UHBITS(code, 10) & 0x1f)]; \
dct_dc_size = tbl & 0xF; \
len = tbl >> 4; \
EXPAND_17BITS(BS, code); \
EXPAND_25BITS(BS, code); \
code <<= len; \
val = UHBITS(code, dct_dc_size) - UHBITS(SHBITS(~code, 1), dct_dc_size); \
SKIP_BITS(BS, len + dct_dc_size); \
} \
With this:
} else { \
EXPAND_17BITS(BS, code); \
tbl = pTab[32 + (UHBITS(code, 10) & 0x1f)]; \
dct_dc_size = tbl & 0xF; \
len = tbl >> 4; \
EXPAND_25BITS(BS, code); \
code <<= len; \
val = UHBITS(code, dct_dc_size) - UHBITS(SHBITS(~code, 1), dct_dc_size); \
SKIP_BITS(BS, len + dct_dc_size); \
} \
Does that make sense? Is the behavior ofSHOW_HI9BITS really incorrect?
Thank you,
Scott
0 Kudos
Reply