Eliminating Pentium I support
With this change, we have finally eliminated support for all x86 CPUs that don’t support MMXEXT. More correctly, x264 compiled on an MMXEXT-supporting system will not run a non-MMXEXT system, so people who still use Pentium Is for their encoding will have to compile their own versions.
What exactly did we do? Its quite nice to be able to use MMX, CMOV, and other such extended x86 instructions in ordinary C code. Normal assembly code in x264 uses function pointers so that the best function is selected on runtime. But in a case where a performance gain can only be achieved through inlining, function pointers are useless. This is especially the case with small, simple functions that are called often, such as the x264_median in the above diff, used for motion vector prediction. A more extreme example was the CABAC asm, which got a >20% performance boost for CABAC encoding merely by changing a branch to a cmov (but which required the whole function to be rewritten in assembly).
Now, having officially eliminated support for all x86 CPU architectures prior to MMXEXT, we can feel free to throw MMX/CMOV code basically wherever we want in the code, allowing all kinds of small speedups in cases that groups of simple operations can be easily SIMD’d. Another note: the median assembly referenced at the start of this post is the first use of GCC inline assembly in x264′s history.
Edit: Since it appears that some people aren’t exactly clear on the point of this post, the program will still compile on a non-MMX machine; its just that code compiled on an MMX machine will not work on a non-MMX machine, whereas before it did.
May 22nd, 2008 at 11:11 am
I can’t understand who could be such idiot to feel joy when he makes his program crash for whole (sub)segment of users.
It is trivial to make HAVE_MMXEXT check in configure and compile this code when available. It won’t detect it at runtime, but it won’t require hacking the source to make it work.
This is what FFmpeg already does. Wish you luck in reinventing the wheel.
May 22nd, 2008 at 11:23 am
First of all, you’re wrong, we have HAVE_MMX; might want to look at the code before you complain. If you compile the code on a Pentium 1, it will work on a Pentium 1 (though I admit I’d rather have a configure check that checks for this, rather than just going off the yasm/nasm check. Loren didn’t want this though).
Moreover, to paraphrase Loren, there are many actual existing users who have support issues (example: Windows 64-bit) which we haven’t dealt with. The idea of someone who encodes on a Pentium 1 is a complete hypothetical, so there’s no possible worry on this issue unless someone who actually does encode on a Pentium 1 starts complaining about it. I have yet to see a single commercial encoder that still supports non-MMX systems at all, so x264 is a complete oddball in that regard.
There are tons of other “segments” of users that we have broken support for: middle-endian systems, non-twos-complement systems, etc, etc, etc. Of course, I highly doubt anyone actually uses x264 on such systems; breaking support for them is beneficial to absolutely everyone and doesn’t hurt anyone.
Finally, the CMOV-using CABAC asm (which also breaks on pre-Pentium Pro systems) has been in for 3 months now and, honestly, nobody has complained
May 22nd, 2008 at 6:37 pm
@iive, honestly who would even attempt to use x264 on a Pentium 1?
Who really wants to wait two weeks to finish 320×240 at subme 1. THAT sounds like fun….
June 5th, 2008 at 9:17 am
I doubt anyone uses something pre pentium 4 or Athlon XP to encode in h.264.
Dropping support makes it easier to maintain code, better fail-proof and faster.
Now I do think that the lack of Windows 64-bit support is a mayor issue.
June 23rd, 2008 at 10:45 am
So, uhm, what about my Pentium 2?
I’d really like to use those hand written MMX functions that don’t require MMXEXT…
June 23rd, 2008 at 11:08 am
We have very few MMX-only functions; almost all use MMXEXT. Unlike ffmpeg, there was not much work done to provide MMX versions of functions for older machines without MMXEXT.
July 1st, 2008 at 5:58 pm
Just to toss in, and not that I care because anyone using one for video encoding has got to be a bit off, but this will have broken Via C3 processors as well as they are missing the CMOV instruction.
August 1st, 2008 at 12:12 pm
Hello Dark Shikari,
You state that “If you compile the code on a Pentium 1, it will work on a Pentium 1″, however this does not seem to be the case with the version I am building on a VIA C3 system, here:
http://bugzilla.livna.org/show_bug.cgi?id=2066
I’d appreciate any help you can give me to build binaries compatible with K6/C3. Thanks.
Also, does videolan.org have a bugzilla system so I can report this problem though an official channnel, or should I just join the mailing list?
August 18th, 2008 at 3:46 pm
@Slated: How does it make sense to encode on a VIA C3?
I’m not trying to make fun of you, but I am genuinely curious.
I can easily see people using old systems but I just don’t get how encoding comes into the picture.
Good luck to you regardless, may a Pentium 2 drop into your hand from the sky.
December 30th, 2008 at 8:50 am
LOL I got a VIA C3 too and wanted to off load some of the processing to that PC but it won’t work. Its NOT a Pentium 1….
December 18th, 2009 at 12:56 pm
BTW, don’t assume all CPUs that have MMXEXT have CMOV. The AMD K6-2/III+ have MMXEXT but NO CMOV!
December 18th, 2009 at 1:14 pm
“LOL I got a VIA C3 too and wanted to off load some of the processing to that PC but it won’t work. Its NOT a Pentium 1…”
Except that it is a Pentium 1 from an instruction set point of view. You see, the VIA C3 pre-Nehemiah instrction set from a user-mode view was similar to the K6-2 instruction set, which in turn was an extension of the Pentium MMX instruction set with AMD-specific instruction set extensions like 3DNow! which I doubt x264 uses.
December 18th, 2009 at 1:50 pm
“BTW, don’t assume all CPUs that have MMXEXT have CMOV. The AMD K6-2/III+ have MMXEXT but NO CMOV!”
Actually, more research proves that this CPU has no MMXEXT, so ignore!