On Mon, 26 Dec 2011, Reinhard Tartler wrote:

On Mo, Dez 26, 2011 at 00:32:39 (CET), Reinhard Tartler wrote:

On Wed, Dec 21, 2011 at 11:54 AM, Diego Biurrun <di...@biurrun.de> wrote:
On 32-bit OS X with gcc 4.0/4.2 and shared libraries enabled, the ebx register
is not available, but required to assemble the functions.

This reverts commit 8742a4f to a simplified version of the original constraints.
---
 libavcodec/h264_cabac.c    |    2 +-
 libavcodec/x86/h264_i386.h |    4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/libavcodec/h264_cabac.c b/libavcodec/h264_cabac.c
index fdeb1ba..a96f52e 100644
--- a/libavcodec/h264_cabac.c
+++ b/libavcodec/h264_cabac.c
@@ -1656,7 +1656,7 @@ decode_cabac_residual_internal(H264Context *h, DCTELEM 
*block,
            index[coeff_count++] = last;\
        }
        const uint8_t *sig_off = significant_coeff_flag_offset_8x8[MB_FIELD];
-#if ARCH_X86 && HAVE_6REGS && !defined(BROKEN_RELOCATIONS)
+#if ARCH_X86 && HAVE_EBX_AVAILABLE && !defined(BROKEN_RELOCATIONS)
        coeff_count= decode_significance_8x8_x86(CC, 
significant_coeff_ctx_base, index,
                                                 last_coeff_ctx_base, sig_off);
    } else {
diff --git a/libavcodec/x86/h264_i386.h b/libavcodec/x86/h264_i386.h
index 50e80d0..6cd81fe 100644
--- a/libavcodec/x86/h264_i386.h
+++ b/libavcodec/x86/h264_i386.h
@@ -36,7 +36,7 @@

 //FIXME use some macros to avoid duplicating get_cabac (cannot be done yet
 //as that would make optimization work hard)
-#if HAVE_6REGS && !defined(BROKEN_RELOCATIONS)
+#if HAVE_EBX_AVAILABLE && !defined(BROKEN_RELOCATIONS)
 static int decode_significance_x86(CABACContext *c, int max_coeff,
                                   uint8_t *significant_coeff_ctx_base,
                                   int *index, x86_reg last_off){
@@ -144,6 +144,6 @@ static int decode_significance_8x8_x86(CABACContext *c,
    );
    return coeff_count;
 }
-#endif /* HAVE_6REGS && !defined(BROKEN_RELOCATIONS) */
+#endif /* HAVE_EBX_AVAILABLE && !defined(BROKEN_RELOCATIONS) */

 #endif /* AVCODEC_X86_H264_I386_H */
--

This 'simplified' version still breaks mplayer compilation with

./configure --enable-debug --enable-runtime-cpudetection

What error do you get? And what do HAVE_EBX_AVAILABLE and HAVE_EBP_AVAILABLE say in config.h?

This patch seems to unbreak it:

grr. gmail killed it:

diff --git a/libavcodec/h264_cabac.c b/libavcodec/h264_cabac.c index a96f52e..fdeb1ba 100644 --- a/libavcodec/h264_cabac.c +++ b/libavcodec/h264_cabac.c @@ -1656,7 +1656,7 @@ decode_cabac_residual_internal(H264Context *h, DCTELEM *block,
            index[coeff_count++] = last;\
        }
const uint8_t *sig_off = significant_coeff_flag_offset_8x8[MB_FIELD]; -#if ARCH_X86 && HAVE_EBX_AVAILABLE && !defined(BROKEN_RELOCATIONS) +#if ARCH_X86 && HAVE_6REGS && !defined(BROKEN_RELOCATIONS)
        coeff_count= decode_significance_8x8_x86(CC, 
significant_coeff_ctx_base, index,
                                                 last_coeff_ctx_base, sig_off);
    } else {

Hmm, this doesn't work on OS X i386 with shared libraries.


btw, I don't see how using HAVE_EBX_AVAILABLE is "simpler" in any way
compared to HAVE_6REGS. It just seems to be wrong.

Originally, prior to 8742a4ff87b5d6ff9f8b5095a29f2e7e7147b5d8, this code was compiled within this condition:

#if ARCH_X86 && HAVE_7REGS && HAVE_EBX_AVAILABLE && !defined(BROKEN_RELOCATIONS)

The function in libavcodec/x86/h264_i386.h that this calls used to be defined within this condition:

#if HAVE_6REGS && !defined(BROKEN_RELOCATIONS)

This is more loose than the condition for the called code, which Diego tried to make coherent in 8742a4ff87b5d6ff9f8b5095a29f2e7e7147b5d8, but it loosened the constraints too much, which made the i386 shared library build on OS X fail, which we tried to fix up in 6fdb2ce34a765de95c0fe341cbcbfa0b1a21a82d - but it seems to me now that we made a mistake in that commit.


The HAVE_7REGS and HAVE_6REGS macros are defined in libavutil/x86_cpu.h as follows:

#define HAVE_7REGS (ARCH_X86_64 || (HAVE_EBX_AVAILABLE && HAVE_EBP_AVAILABLE))
#define HAVE_6REGS (ARCH_X86_64 || (HAVE_EBX_AVAILABLE || HAVE_EBP_AVAILABLE))

Thus, the subcondition "7regs && ebx" == "(ebx && ebp) && ebx" == "(ebx && ebp)" == 7regs.

Thus, apparently we made a mistake when simplifying the conditions - I think we did the condition simplification based on "6regs && ebx" for some reason. I'll send a patch fixing it.

// Martin
_______________________________________________
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to