[x264-devel] Wrong instruction

SIEGERSTEIN siegerstein at pochta.ru
Tue Oct 23 17:47:12 CEST 2007


Hi! I found, that x264 encoder convert with wrong instruction:

$ x264 --bitrate=700 --fps=30 --me=umh --merange=32 --subme=7 --analyse=all -o 
output.mkv colourbars_420.yuv 640x480
x264 [info]: using cpu capabilities: MMX MMXEXT SSE SSE2
x264 [info]: slice I:1     Avg QP:34.00  size: 16866  PSNR Mean Y:34.77 
U:35.79 V:34.82 Avg:34.93 Global:34.93
x264 [info]: mb I  I16..4: 26.8%  0.0% 73.2%
x264 [info]: final ratefactor: 37.49
x264 [info]: SSIM Mean Y:0.9979993
x264 [info]: PSNR Mean Y:34.768 U:35.790 V:34.817 Avg:34.931 Global:34.931 
kb/s:4047.84

encoded 1 frames, 4.97 fps, 4173.84 kb/s
$

I have Intel processor, so there is only MMX but not MMXEXT instruction.

$ cat /proc/cpuinfo
processor       : 0
vendor_id       : GenuineIntel
cpu family      : 15
model           : 3
model name      : Intel(R) Pentium(R) 4 CPU 3.00GHz
stepping        : 4
cpu MHz         : 2998.753
cache size      : 1024 KB
physical id     : 0
siblings        : 2
core id         : 0
cpu cores       : 1
fdiv_bug        : no
hlt_bug         : no
f00f_bug        : no
coma_bug        : no
fpu             : yes
fpu_exception   : yes
cpuid level     : 5
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca 
cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe constant_tsc 
pebs bts sync_rdtsc pni monitor ds_cpl cid xtpr
bogomips        : 6001.69
clflush size    : 64
.....

$ x86info
x86info v1.20.  Dave Jones 2001-2006
Feedback to <davej at redhat.com>.

Found 2 CPUs
--------------------------------------------------------------------------
CPU #1
/dev/cpu/0/cpuid: Permission denied
Family: 15 Model: 3 Stepping: 4 Type: 0 Brand: 0
CPU Model: Pentium 4 (Prescott) [D0] Original OEM
Processor name string: Intel(R) Pentium(R) 4 CPU 3.00GHz

Feature flags:
 fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 
clflsh ds acpi mmx fxsr sse sse2 ss ht tm pbe sse3 monitor ds-cpl cntx-id 
xTPR
Extended feature flags:

Cache info
 Instruction trace cache: 12K uOps, 8-way associative.
 L1 Data cache: 16KB, sectored, 8-way associative. 64 byte line size.
 L2 unified cache: 1MB, sectored, 8-way associative. 64 byte line size.
TLB info
 Instruction TLB: 4K, 2MB or 4MB pages, fully associative, 64 entries.
 Data TLB: 4KB or 4MB pages, fully associative, 64 entries.
The physical package supports 2 logical processors
....

How you can see, there is no MMXEXT instruction.

Why I'm writing this, because, when I try to using transcode with x264 
encoder, I have fail:

$ gdb
GNU gdb 6.7
Copyright (C) 2007 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "i686-pc-linux-gnu".
(gdb) file transcode
Reading symbols from /usr/bin/transcode...done.
Using host libthread_db library "/lib/libthread_db.so.1".
(gdb) set args -x v4l2,v4l2 -g 640x480 -i /dev/video0 -p /dev/dsp -y 
x264,lame,avi -N h264,mp3 -o video_out.avi
(gdb) run
Starting program: /usr/bin/transcode -x v4l2,v4l2 -g 
640x480 -i /dev/video0 -p /dev/dsp -y x264,lame,avi -N h264,mp3 -o 
video_out.avi
[Thread debugging using libthread_db enabled]
[New Thread 0xb7bab6c0 (LWP 3313)]
transcode v1.1.0-alpha4 (C) 2001-2003 Thomas Oestreich, 2003-2007 Transcode 
Team
[transcode] V: auto-probing     | /dev/video0 (OK)
[transcode] V: import format    | (null) in  (module=v4l2)
[transcode] A: auto-probing     | /dev/dsp (OK)
[transcode] A: import format    | PCM in  (module=v4l2)
[transcode] V: AV demux/sync    | (1) sync AV at initial MPEG sequence
[transcode] V: import frame     | 640x480  1.33:1  encoded @ UNKNOWN
[transcode] V: bits/pixel       | 0.234
[transcode] V: decoding fps,frc | 25.000,3
[transcode] V: video format     | YUV420 (4:2:0) aka I420
[transcode] A: import format    | 0x1     PCM          [48000,16,2]
[transcode] A: export format    | 0x55    MPEG ES Layer 3 [48000,16,2]  128 
kbps
[transcode] V: export format    | h264
[transcode] V: encoding fps,frc | 25.000,3
[transcode] A: bytes per frame  | 7680 (7680.000000)
[transcode] A: adjustment       | 0 at 1000
[transcode] V: IA32/AMD64 accel | sse3 sse2 sse mmx cmove asm
[transcode] V: video buffer     | 10 @ 640x480 [0x2]
[transcode] A: audio buffer     | 10 @ 48000x2x16
[import_v4l2.so] v1.4.0 (2005-10-08) (video) v4l2 | (audio) pcm
[encode_lame.so] v1.1 (2006-11-01) Encodes audio to MP3 using LAME
[encode_lame.so] Using LAME 3.97
[encode_x264.so] v0.2.1 (2006-01-27) x264 encoder
[multiplex_avi.so] v0.0.2 (2005-12-29) create an AVI stream using avilib
[New Thread 0xa5a4fb90 (LWP 3320)]
[New Thread 0xa524eb90 (LWP 3321)]
[New Thread 0xa4a4db90 (LWP 3322)]
[import_v4l2.so] v4l2 audio grabbing
[import_v4l2.so] v4l2 video grabbing
[import_v4l2.so] resync disabled
[import_v4l2.so] video grabbing, driver = saa7134, card = AverMedia AverTV 
Studio 305
[import_v4l2.so] Pixel format conversion: YUV420 [planar] -> YUV420 [planar] 
(no conversion)
[import_v4l2.so] warning: driver does not support setting parameters 
(ioctl(VIDIOC_S_PARM) returns "Invalid argument")
[import_v4l2.so] checking colour & framerate standards:
[import_v4l2.so] [PAL]
[import_v4l2.so] receiving 25 frames / sec
[import_v4l2.so] frame size: 640x480
[import_v4l2.so] cropcap bounds: 720x578 +0+46
[import_v4l2.so] cropcap defrect: 720x576 +0+48
[import_v4l2.so] cropcap pixelaspect: 54/59
[import_v4l2.so] default cropping: 720x576 +0+48
[import_v4l2.so] 8 buffers available
[New Thread 0xa3ec4b90 (LWP 3323)]
[New Thread 0xa36c3b90 (LWP 3324)]
[encode_x264.so] set display aspect ratio to input
[encode_x264.so] using SAR=1/1
[encode_x264.so] using cpu capabilities: MMX MMXEXT SSE SSE2 3DNow!

Program received signal SIGFPE, Arithmetic exception.
[Switching to Thread 0xb7bab6c0 (LWP 3313)]
0xa5a9b4d0 in get_qscale (h=0x80d47a0, rce=0xbf9d0690, 
rate_factor=64.667029215144737, frame_num=<value optimized out>) at 
encoder/ratecontrol.c:1003
1003        };
(gdb) 

Now I see +3DNow! instruction:

[encode_x264.so] using cpu capabilities: MMX MMXEXT SSE SSE2 3DNow!

I think problem in x264 not in transcode (I'm now devloper :))

encoder/encoder.c: (x264)

675      x264_log( h, X264_LOG_INFO, "using cpu 
capabilities: %s%s%s%s%s%s%s%s\n",
   676               param->cpu&X264_CPU_MMX ? "MMX " : "",
   677               param->cpu&X264_CPU_MMXEXT ? "MMXEXT " : "",
   678               param->cpu&X264_CPU_SSE ? "SSE " : "",
   679               param->cpu&X264_CPU_SSE2 ? "SSE2 " : "",
   680               param->cpu&X264_CPU_SSSE3 ? "SSSE3 " : "",
   681               param->cpu&X264_CPU_3DNOW ? "3DNow! " : "",
   682               param->cpu&X264_CPU_ALTIVEC ? "Altivec " : "",
   683               param->cpu ? "" : "none!" );

open discussion in transcode mail list:
http://article.gmane.org/gmane.comp.video.transcode.user/20861

How compile x264 withOUT 3dnow! & mmxext instruction?





More information about the x264-devel mailing list