[FFmpeg-devel] [PATCH] VC-1 MMX DSP functions

infernix infernix
Sat Jul 7 16:34:58 CEST 2007


Zuxy Meng wrote:
> I wonder if it's caused by "m"(sstr) and things like that. Maybe it
> can be corrected by using "g"((intptr_t)sstr).

IANAC, but i applied:

sed -i 's|\([SDrmRg]" *((\)long)|\1intptr_t)|g' libavcodec/i386/*.[ch]

and changed libavcodec/i386/vc1dsp_mmx.c line 252-253 to:

         : "g"((intptr_t)sstr), "g"((intptr_t)dstr), 
"r"((intptr_t)offset), "r"((intptr_t)3*offset), \
           "g"((intptr_t)rnd) 
            \

But it still crashes. Backtrace looks the same to me:

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 1098918240 (LWP 10637)]
0x00002b1b36f08db8 in vc1_put_shift2_mmx (dst=0x36f4e7d641801ce8 
<Address 0x36f4e7d641801ce8 out of bounds>,
     dst_stride=8, src=0x2ab2aaefdfee <Address 0x2ab2aaefdfee out of 
bounds>, src_stride=1920, h=10, rnd=7,
     offset=1) at i386/vc1dsp_mmx.c:52
52          asm volatile(
(gdb) bt
#0  0x00002b1b36f08db8 in vc1_put_shift2_mmx (dst=0x36f4e7d641801ce8 
<Address 0x36f4e7d641801ce8 out of bounds>,
     dst_stride=8, src=0x2ab2aaefdfee <Address 0x2ab2aaefdfee out of 
bounds>, src_stride=1920, h=10, rnd=7,
     offset=1) at i386/vc1dsp_mmx.c:52
#1  0x00002b1b36f4e7d6 in put_vc1_mspel_mc22_mmx (dst=0x2aaaab2900e0 
'\200' <repeats 200 times>...,
     src=<value optimized out>, stride=1, rnd=1) at i386/vc1dsp_mmx.c:191
#2  0x00002b1b37089e95 in vc1_mc_1mv (v=0x563740, dir=<value optimized 
out>) at vc1.c:559
#3  0x00002b1b3709009b in vc1_decode_p_blocks (v=0x36f4e7d641801ce8) at 
vc1.c:3122
#4  0x00002b1b37098f11 in vc1_decode_frame (avctx=0x53d7b0, 
data=0x5d4d80, data_size=0x4180216c,
     buf=0x1 <Address 0x1 out of bounds>, buf_size=211988) at vc1.c:3813
#5  0x00002b1b36ded2a1 in avcodec_decode_video (avctx=0x53d7b0, 
picture=0x5d4d80, got_picture_ptr=0x4180216c,
     buf=0x2aaaaada3010 "", buf_size=211988) at utils.c:920
#6  0x0000000000405409 in sdl_audio_callback ()
#7  0x00002b1b376d6477 in SDL_GetThreadID () from /usr/lib/libSDL-1.2.so.0
#8  0x00002b1b3771bfa9 in SDL_ThreadID () from /usr/lib/libSDL-1.2.so.0
#9  0x00002b1b37886f1a in start_thread () from /lib/libpthread.so.0
#10 0x00002b1b37a5f602 in clone () from /lib/libc.so.6
#11 0x0000000000000000 in ?? ()
(gdb)   disass $pc-32 $pc+32
Dump of assembler code from 0x2b1b36f08d98 to 0x2b1b36f08dd8:
0x00002b1b36f08d98 <vc1_put_shift2_mmx+17>:     or     %al,(%rax)
0x00002b1b36f08d9a <vc1_put_shift2_mmx+19>:     add    %al,(%rax)
0x00002b1b36f08d9c <vc1_put_shift2_mmx+21>:     sub    %r9d,%eax
0x00002b1b36f08d9f <vc1_put_shift2_mmx+24>:     mov 
%eax,0xfffffffffffffff4(%rsp)
0x00002b1b36f08da3 <vc1_put_shift2_mmx+28>:     lea    (%rcx,%rcx,2),%rax
0x00002b1b36f08da7 <vc1_put_shift2_mmx+32>:     movd 
0xfffffffffffffff4(%rsp),%mm7
0x00002b1b36f08dac <vc1_put_shift2_mmx+37>:     punpcklwd %mm7,%mm7
0x00002b1b36f08daf <vc1_put_shift2_mmx+40>:     punpckldq %mm7,%mm7
0x00002b1b36f08db2 <vc1_put_shift2_mmx+43>:     data16
0x00002b1b36f08db3 <vc1_put_shift2_mmx+44>:     data16
0x00002b1b36f08db4 <vc1_put_shift2_mmx+45>:     nop
0x00002b1b36f08db5 <vc1_put_shift2_mmx+46>:     data16
0x00002b1b36f08db6 <vc1_put_shift2_mmx+47>:     data16
0x00002b1b36f08db7 <vc1_put_shift2_mmx+48>:     nop
0x00002b1b36f08db8 <vc1_put_shift2_mmx+49>:     movd   (%rdx,%rcx,1),%mm3
0x00002b1b36f08dbc <vc1_put_shift2_mmx+53>:     movd   0x4(%rdx,%rcx,1),%mm4
0x00002b1b36f08dc1 <vc1_put_shift2_mmx+58>:     movd   (%rdx,%rcx,2),%mm1
0x00002b1b36f08dc5 <vc1_put_shift2_mmx+62>:     movd   0x4(%rdx,%rcx,2),%mm2
0x00002b1b36f08dca <vc1_put_shift2_mmx+67>:     punpcklbw %mm0,%mm3
0x00002b1b36f08dcd <vc1_put_shift2_mmx+70>:     punpcklbw %mm0,%mm4
0x00002b1b36f08dd0 <vc1_put_shift2_mmx+73>:     punpcklbw %mm0,%mm1
0x00002b1b36f08dd3 <vc1_put_shift2_mmx+76>:     punpcklbw %mm0,%mm2
0x00002b1b36f08dd6 <vc1_put_shift2_mmx+79>:     paddw  %mm1,%mm3
End of assembler dump.
(gdb)   info all-registers
rax            0x3      3
rbx            0x780    1920
rcx            0x1      1
rdx            0x2ab2aaefdfee   46946860392430
rsi            0x8      8
rdi            0x36f4e7d641801ce8       3960044879773441256
rbp            0x41801ce0       0x41801ce0
rsp            0x41801cd0       0x41801cd0
r8             0xa      10
r9             0x1      1
r10            0x780    1920
r11            0x780    1920
r12            0x1      1
r13            0x2aaaab2900e0   46912504398048
r14            0x2aaaab0eba3f   46912502676031
r15            0xfffffe3e       4294966846
rip            0x2b1b36f08db8   0x2b1b36f08db8 <vc1_put_shift2_mmx+49>
eflags         0x10206  [ PF IF RF ]
cs             0x33     51
ss             0x2b     43
ds             0x0      0
es             0x0      0
fs             0x63     99
gs             0x0      0
st0            <invalid float value>    (raw 0xffff0000000000000000)
st1            -nan(0x15001600160017)   (raw 0xffff0015001600160017)
st2            -nan(0x15001500150015)   (raw 0xffff0015001500150015)
st3            -nan(0x1515151516161717) (raw 0xffff1515151516161717)
st4            -nan(0x15001500150015)   (raw 0xffff0015001500150015)
st5            -nan(0x35003500350035)   (raw 0xffff0035003500350035)
st6            -nan(0x12001200120012)   (raw 0xffff0012001200120012)
st7            -nan(0x7000700070007)    (raw 0xffff0007000700070007)
fctrl          0x37f    895
fstat          0x0      0
ftag           0xaaaa   43690
fiseg          0x0      0
fioff          0x0      0
foseg          0x0      0
fooff          0x0      0
fop            0x0      0
xmm0           {v4_float = {0x0, 0x1a, 0x0, 0x0}, v2_double = 
{0x468fa3f1, 0x0}, v16_int8 = {0x50, 0x70, 0x42,
     0xfc, 0xe8, 0xa3, 0xd1, 0x41, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 
0x0}, v8_int16 = {0x7050, 0xfc42, 0xa3e8,
     0x41d1, 0x0, 0x0, 0x0, 0x0}, v4_int32 = {0xfc427050, 0x41d1a3e8, 
0x0, 0x0}, v2_int64 = {0x41d1a3e8fc427050,
     0x0}, uint128 = 0x000000000000000041d1a3e8fc427050}
xmm1           {v4_float = {0x0, 0x2, 0x0, 0x0}, v2_double = {0x2, 0x0}, 
v16_int8 = {0x0, 0x0, 0x0, 0x0, 0x0,
---Type <return> to continue, or q <return> to quit---
     0x0, 0x0, 0x40, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, v8_int16 = 
{0x0, 0x0, 0x0, 0x4000, 0x0, 0x0, 0x0,
     0x0}, v4_int32 = {0x0, 0x40000000, 0x0, 0x0}, v2_int64 = 
{0x4000000000000000, 0x0},
   uint128 = 0x00000000000000004000000000000000}
xmm2           {v4_float = {0x0, 0x1, 0x0, 0x0}, v2_double = {0x1, 0x0}, 
v16_int8 = {0x0, 0x0, 0x0, 0x0, 0x0,
     0x0, 0xf0, 0x3f, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, v8_int16 
= {0x0, 0x0, 0x0, 0x3ff0, 0x0, 0x0, 0x0,
     0x0}, v4_int32 = {0x0, 0x3ff00000, 0x0, 0x0}, v2_int64 = 
{0x3ff0000000000000, 0x0},
   uint128 = 0x00000000000000003ff0000000000000}
xmm3           {v4_float = {0x0, 0x1, 0x0, 0x0}, v2_double = {0x1, 0x0}, 
v16_int8 = {0x0, 0x0, 0x0, 0x0, 0x0,
     0x0, 0xf0, 0x3f, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, v8_int16 
= {0x0, 0x0, 0x0, 0x3ff0, 0x0, 0x0, 0x0,
     0x0}, v4_int32 = {0x0, 0x3ff00000, 0x0, 0x0}, v2_int64 = 
{0x3ff0000000000000, 0x0},
   uint128 = 0x00000000000000003ff0000000000000}
xmm4           {v4_float = {0x0, 0xfffffffd, 0x0, 0x0}, v2_double = 
{0xffffffffffffffd2, 0x0}, v16_int8 = {0x5b,
     0xaa, 0xa2, 0x2a, 0x9e, 0x6, 0x47, 0xc0, 0x0, 0x0, 0x0, 0x0, 0x0, 
0x0, 0x0, 0x0}, v8_int16 = {0xaa5b,
     0x2aa2, 0x69e, 0xc047, 0x0, 0x0, 0x0, 0x0}, v4_int32 = {0x2aa2aa5b, 
0xc047069e, 0x0, 0x0}, v2_int64 = {
     0xc047069e2aa2aa5b, 0x0}, uint128 = 0x0000000000000000c047069e2aa2aa5b}
xmm5           {v4_float = {0x0, 0xffffffff, 0x0, 0x0}, v2_double = 
{0x0, 0x0}, v16_int8 = {0xf6, 0x8f, 0xee,
     0x21, 0xa8, 0x74, 0xd3, 0xbf, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 
0x0}, v8_int16 = {0x8ff6, 0x21ee, 0x74a8,
     0xbfd3, 0x0, 0x0, 0x0, 0x0}, v4_int32 = {0x21ee8ff6, 0xbfd374a8, 
0x0, 0x0}, v2_int64 = {0xbfd374a821ee8ff6,
     0x0}, uint128 = 0x0000000000000000bfd374a821ee8ff6}
xmm6           {v4_float = {0x0, 0x0, 0x0, 0x0}, v2_double = {0x0, 0x0}, 
v16_int8 = {0x0, 0x0, 0x0, 0x0, 0x0,
     0x80, 0x59, 0xbc, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, v8_int16 
= {0x0, 0x0, 0x8000, 0xbc59, 0x0, 0x0,
     0x0, 0x0}, v4_int32 = {0x0, 0xbc598000, 0x0, 0x0}, v2_int64 = 
{0xbc59800000000000, 0x0},
   uint128 = 0x0000000000000000bc59800000000000}
xmm7           {v4_float = {0x0, 0xffffffff, 0x0, 0x0}, v2_double = 
{0x0, 0x0}, v16_int8 = {0x17, 0x11, 0xbe,
     0x76, 0x67, 0x6b, 0xd3, 0xbf, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 
0x0}, v8_int16 = {0x1117, 0x76be, 0x6b67,
     0xbfd3, 0x0, 0x0, 0x0, 0x0}, v4_int32 = {0x76be1117, 0xbfd36b67, 
0x0, 0x0}, v2_int64 = {0xbfd36b6776be1117,
     0x0}, uint128 = 0x0000000000000000bfd36b6776be1117}
xmm8           {v4_float = {0x0, 0x0, 0x0, 0x0}, v2_double = {0x0, 0x0}, 
v16_int8 = {0x54, 0xec, 0x35, 0x16,
     0xb3, 0xe9, 0x8f, 0xbd, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, 
v8_int16 = {0xec54, 0x1635, 0xe9b3, 0xbd8f,
     0x0, 0x0, 0x0, 0x0}, v4_int32 = {0x1635ec54, 0xbd8fe9b3, 0x0, 0x0}, 
v2_int64 = {0xbd8fe9b31635ec54, 0x0},
   uint128 = 0x0000000000000000bd8fe9b31635ec54}
xmm9           {v4_float = {0x0, 0x1, 0x0, 0x0}, v2_double = {0x1, 0x0}, 
v16_int8 = {0x6d, 0x7d, 0xbf, 0xbb,
     0x27, 0xaf, 0xf5, 0x3f, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, 
v8_int16 = {0x7d6d, 0xbbbf, 0xaf27, 0x3ff5,
     0x0, 0x0, 0x0, 0x0}, v4_int32 = {0xbbbf7d6d, 0x3ff5af27, 0x0, 0x0}, 
v2_int64 = {0x3ff5af27bbbf7d6d, 0x0},
   uint128 = 0x00000000000000003ff5af27bbbf7d6d}
xmm10          {v4_float = {0x0, 0xfffffffd, 0x0, 0x0}, v2_double = 
{0xffffffffffffffd2, 0x0}, v16_int8 = {0xe0,
     0xe6, 0x35, 0x67, 0x9e, 0x6, 0x47, 0xc0, 0x0, 0x0, 0x0, 0x0, 0x0, 
0x0, 0x0, 0x0}, v8_int16 = {0xe6e0,
     0x6735, 0x69e, 0xc047, 0x0, 0x0, 0x0, 0x0}, v4_int32 = {0x6735e6e0, 
0xc047069e, 0x0, 0x0}, v2_int64 = {
     0xc047069e6735e6e0, 0x0}, uint128 = 0x0000000000000000c047069e6735e6e0}
xmm11          {v4_float = {0x0, 0x0, 0x0, 0x0}, v2_double = {0x0, 0x0}, 
v16_int8 = {0x29, 0xf2, 0x88, 0x6c,
     0xa6, 0x49, 0xde, 0x3e, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, 
v8_int16 = {0xf229, 0x6c88, 0x49a6, 0x3ede,
     0x0, 0x0, 0x0, 0x0}, v4_int32 = {0x6c88f229, 0x3ede49a6, 0x0, 0x0}, 
v2_int64 = {0x3ede49a66c88f229, 0x0},
   uint128 = 0x00000000000000003ede49a66c88f229}
xmm12          {v4_float = {0x9689a800, 0x0, 0x0, 0x0}, v2_double = 
{0x0, 0x0}, v16_int8 = {0x6a, 0xa2, 0x65,
     0x50, 0xf2, 0xea, 0x8f, 0xbd, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 
0x0}, v8_int16 = {0xa26a, 0x5065, 0xeaf2,
---Type <return> to continue, or q <return> to quit---
     0xbd8f, 0x0, 0x0, 0x0, 0x0}, v4_int32 = {0x5065a26a, 0xbd8feaf2, 
0x0, 0x0}, v2_int64 = {0xbd8feaf25065a26a,
     0x0}, uint128 = 0x0000000000000000bd8feaf25065a26a}
xmm13          {v4_float = {0x0, 0x0, 0x0, 0x0}, v2_double = {0x0, 0x0}, 
v16_int8 = {0x0 <repeats 16 times>},
   v8_int16 = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, v4_int32 = {0x0, 
0x0, 0x0, 0x0}, v2_int64 = {0x0, 0x0},
   uint128 = 0x00000000000000000000000000000000}
xmm14          {v4_float = {0x0, 0x0, 0x0, 0x0}, v2_double = {0x0, 0x0}, 
v16_int8 = {0x0, 0x0, 0x46, 0x84, 0x24,
     0x59, 0xd6, 0x3e, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, v8_int16 
= {0x0, 0x8446, 0x5924, 0x3ed6, 0x0,
     0x0, 0x0, 0x0}, v4_int32 = {0x84460000, 0x3ed65924, 0x0, 0x0}, 
v2_int64 = {0x3ed6592484460000, 0x0},
   uint128 = 0x00000000000000003ed6592484460000}
xmm15          {v4_float = {0x0, 0x1, 0x0, 0x0}, v2_double = {0x1, 0x0}, 
v16_int8 = {0x0, 0x0, 0x0, 0x0, 0x0,
     0x0, 0xf0, 0x3f, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, v8_int16 
= {0x0, 0x0, 0x0, 0x3ff0, 0x0, 0x0, 0x0,
     0x0}, v4_int32 = {0x0, 0x3ff00000, 0x0, 0x0}, v2_int64 = 
{0x3ff0000000000000, 0x0},
   uint128 = 0x00000000000000003ff0000000000000}
mxcsr          0x1fa0   [ PE IM DM ZM OM UM PM ]




More information about the ffmpeg-devel mailing list