[mythtv] New MPEG2 commercial-cut code ready for testing

Bryan Mayland bmayland at leoninedev.com
Tue Nov 15 16:06:27 EST 2005


Geoffrey Hausheer wrote:
> You'd need to recompile with debug enabled, and might need a
> thread-capable gdb.  make sure to always use 'thread apply all bt'
> when debugging.  But this looks like a failure inside of libavcodec,
> which makes little sense.  My guess is that the problem is happening
> in build_frame.  
    With debug enabled it faults in the avcodec_encode_video() function 
(specifically in the dct_quantize_SSE2 method).  Here's a backtrace from 
the thread:
(gdb) bt
#0  0xb740f246 in dct_quantize_SSE2 (s=0xb71e7783, block=0x8229450,
    n=135775936, qscale=0, overflow=0x2) at mpegvideo_mmx_template.c:152
#1  0x08229450 in ?? ()
#2  0xb71e7783 in encode_mb (s=0x8229450, motion_x=0, motion_y=0)
    at mpegvideo.c:4243
#3  0xb71ecb9d in encode_thread (c=0x84555f0, arg=0x8229450)
    at mpegvideo.c:5146
#4  0xb71ceaa4 in avcodec_default_execute (c=0x84555f0,
    func=0xb71ea590 <encode_thread>, arg=0x8229514, ret=0x0, count=1)
    at utils.c:420
#5  0xb71de764 in MPV_encode_picture (avctx=0x84555f0, buf=0xb5d9d008 "",
    buf_size=-128, data=0x8140f60) at mpegvideo.c:5457
#6  0xb71d022a in avcodec_encode_video (avctx=0x84555f0,
    buf=0xffffff80 <Address 0xffffff80 out of bounds>, buf_size=614400,
    pict=0x8140f60) at utils.c:868
#7  0x0804c838 in MPEG2fixup::build_frame (this=0xbfa71084, pkt=0xbfa70c2c,
    fname=0x0) at mpeg2fix.cpp:929
#8  0x0804ce67 in MPEG2fixup::convert_to_i (this=0xbfa71084, frameNum=0,
    numFrames=2, headPos=0) at mpeg2fix.cpp:1194
#9  0x08050699 in MPEG2fixup::start (this=0xbfa71084) at mpeg2fix.cpp:1458
#10 0x08051a89 in main (argc=7, argv=0xbfa72404) at mpeg2fix.cpp:1775

It is interesting to not that the buf paramter to avcodec_encode_video() 
is bad in the bt, but was valid when it was passed.  Since it appears to 
be an alignment issue, I changed the passed Context to disable all 
MMX/SSE routines.  I got this output, no segfaults, and a working mpg 
file it seems:
Opening /mnt/store/1015_20051108183000.mpg
[mpeg2video @ 0xb7454f04]libavcodec: CPU flags: mmx mmxext sse sse2
Input #0, mpeg, from '/mnt/store/1015_20051108183000.mpg':
  Duration: N/A, bitrate: N/A
  Stream #0.0[0x1e0], 29.97 fps: Video: mpeg2video, yuv420p, 640x480, 
6000 kb/s
  Stream #0.1[0x1c0]: Audio: mp2, 48000 Hz, stereo, 384 kb/s
#0 PTS:36039 Delta: 0.000000ms queue: 11
#1 PTS:34685 Delta: 15.044444ms queue: 2
Mux rate: 6.49 Mbit/s
[mpeg2video @ 0xb7454f04]libavcodec: CPU flags:
Warning, QMAT_SHIFT is larger then 21, overflows possible
Converting frame 0 to an I-frame ((null))
[mpeg2video @ 0xb7454f04]libavcodec: CPU flags:
Warning, QMAT_SHIFT is larger then 21, overflows possible
Converting frame 1 to an I-frame ((null))
[mpeg2video @ 0xb7454f04]libavcodec: CPU flags:
Warning, QMAT_SHIFT is larger then 21, overflows possible
Converting frame 9 to an I-frame ((null))
[mpeg2video @ 0xb7454f04]libavcodec: CPU flags:
Warning, QMAT_SHIFT is larger then 21, overflows possible
Converting frame 10 to an I-frame ((null))
[mpeg2video @ 0xb7454f04]libavcodec: CPU flags:
Warning, QMAT_SHIFT is larger then 21, overflows possible
Converting frame 11 to an I-frame ((null))

> Just be awate, this tool is still in the debugging stage. You
> certainly won't want to replace the orginal files with processed ones
> at this point.  As soon as I am convinced the code is working pretty
> well, it will be added to myth, at which times such scripts won't be
> needed.
>   
    Yeah the shell script is just nice to have so I don't have to figure 
out what the cutpoints are for every file I want to test with.


More information about the mythtv-dev mailing list