Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Video Encoding > MPEG-4 AVC / H.264

Reply
 
Thread Tools Search this Thread Display Modes
Old 30th July 2023, 09:40   #1  |  Link
dungeonlords
Registered User
 
Join Date: Jul 2023
Posts: 3
x264 SIMD asm

There is x264. It use a lot of x86 asm files. For example pixel-32.asm. This files can use different SIMD instruction set: mmx, 3DNow!, sse family, others

I need the simple way to automatically analyze every file. I want get which SIMD family in which file are used. How?

I think every asm file must contain information about which SIMD family it use (or information that no SIMD). Without this information it is very bad idea try to use this files...
I am angry, my x86 CPU support mmx and 3DNow! only, but x264 try call sse, so I get "Illegal instruction" sometimes. I plan to make patch for x264.

Let's communicate in this post
dungeonlords is offline   Reply With Quote
Old 30th July 2023, 12:56   #2  |  Link
FranceBB
Broadcast Encoder
 
FranceBB's Avatar
 
Join Date: Nov 2013
Location: Royal Borough of Kensington & Chelsea, UK
Posts: 3,019
Can't you just target the plain C on compile time with --disable-asm and produce a slow plain C executable that you can then run with --no-asm in the command line?
That should work.
FranceBB is offline   Reply With Quote
Old 1st August 2023, 06:13   #3  |  Link
dungeonlords
Registered User
 
Join Date: Jul 2023
Posts: 3
Quote:
Originally Posted by FranceBB View Post
Can't you just target the plain C on compile time with --disable-asm and produce a slow plain C executable that you can then run with --no-asm in the command line?
That should work.
1) In which case I should use --disable-asm ?
When my CPU doesn't support ... what? What if minimal requirement to use x264 asm files? Can I use x264 if my CPU doesn't support AVX-512? Can I use x264 if my CPU doesn't support sse2? Can I use x264 if my CPU doesn't support sse? And so on...

2) Ok, Let's think my CPU doesn't support anything... Anyway, no, I can't use --disable-asm. Because x264 try use not unisex CFLAGS without any cheking, this is code from x264/git/configure
CFLAGS="$CFLAGS -mfpmath=sse -msse -msse2"
x264 should checking SIMD support before use this CFLAGS, isn't it? x264 can check using GNU autoconf. But my dream is change build system to cmake or meson like OpenH264. What are you thinking about it?

Let's communicate in this post

Last edited by dungeonlords; 1st August 2023 at 06:25.
dungeonlords is offline   Reply With Quote
Old 1st August 2023, 09:13   #4  |  Link
MasterNobody
Registered User
 
Join Date: Jul 2007
Posts: 555
1) When you trying to use it on something unsupported. i.e. doesn't support at least SSE2 for x86. Very minimum is SSE which implies MMXExt but need extra params to configure from item 2.
2) Add
Code:
--extra-cflags="-mfpmath=387"
to configure and it wouldn't add this options. But dunno if inline asm will work or would it be disabled. You probably may need to specify `-march` option also.
MasterNobody is offline   Reply With Quote
Old 1st August 2023, 11:27   #5  |  Link
dungeonlords
Registered User
 
Join Date: Jul 2023
Posts: 3
Quote:
Originally Posted by MasterNobody View Post
1) When you trying to use it on something unsupported. i.e. doesn't support at least SSE2 for x86. Very minimum is SSE which implies MMXExt but need extra params to configure from item 2.
2) Add
Code:
--extra-cflags="-mfpmath=387"
to configure and it wouldn't add this options. But dunno if inline asm will work or would it be disabled. You probably may need to specify `-march` option also.
Thank you.

1) "1) When you trying to use it on something unsupported. i.e. doesn't support at least SSE2 for x86. Very minimum is SSE which implies MMXExt but need extra params to configure from item 2."
SSE2 for x86? Are you sure? If my x86 CPU supports SSE, SSE2 and not support SSE3, SSSE3, SSE4.1,... then I can use x264 asm files or not?

2) But I have not i686 but i586. How change it? This way?
Code:
--extra-cflags="-march=i586 -mfpmath=387"
3) I still think x264 should at least check does x86 CPU support sse and show Error if not. At now I can build x264 for my CPU and I get "Illegal instruction" and linux session restart... Best way I think is adaptive current settings to CPU capabilities like openh264 project.

4) Because of 3) many scripts like buildroot doesn't provide capabilities to change x264 build script...

5) my dream is change build system to cmake or meson like OpenH264. What are you thinking about it?

Let's communicate in this post

Last edited by dungeonlords; 1st August 2023 at 13:05.
dungeonlords is offline   Reply With Quote
Old 1st August 2023, 21:57   #6  |  Link
MasterNobody
Registered User
 
Join Date: Jul 2007
Posts: 555
Quote:
Originally Posted by dungeonlords View Post
1) SSE2 for x86? Are you sure? If my x86 CPU supports SSE, SSE2 and not support SSE3, SSSE3, SSE4.1,... then I can use x264 asm files or not?
Yes, you can use it because x264 autodetects supported instruction set.
Quote:
Originally Posted by dungeonlords View Post
2) But I have not i686 but i586. How change it? This way?
Code:
--extra-cflags="-march=i586 -mfpmath=387"
Yes, you need to specify -march=i586 for configure. But it also doesn't make sense to bloat binary with handwritten asm which wouldn't be used in this case (on your CPU). So you need to use:
Code:
--disable-asm --extra-cflags="-march=i586 -mfpmath=387"
Quote:
Originally Posted by dungeonlords View Post
3) I still think x264 should at least check does x86 CPU support sse and show Error if not. At now I can build x264 for my CPU and I get "Illegal instruction" and linux session restart... Best way I think is adaptive current settings to CPU capabilities like openh264 project.
It checks CPU support but your main problem is C compiled code and inlined asm, not the handwritten external asm. So if C compiler used instructions not supported by your CPU it can SIGILL even before we run CPU detection code. So no, it is not possible.
Quote:
Originally Posted by dungeonlords View Post
4) Because of 3) many scripts like buildroot doesn't provide capabilities to change x264 build script...

5) my dream is change build system to cmake or meson like OpenH264. What are you thinking about it?
That is your problem, and not x264 problem, so I don't care.
MasterNobody is offline   Reply With Quote
Reply

Tags
x264 development

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 21:56.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.