[MPlayer-dev-eng] Compiling with --enable-debug and --enable-profile

Dmitry Antipov dmantipov at yandex.ru
Tue Nov 28 12:50:57 CET 2006


Hello,

I've found that current SVN trunk can't be compiled with --enable-debug
and --enable-profile on x86, mostly because a few inline assebmly bits
can't be compiled with optimizations less than -O3 and without
-fomit-frame-pointer. The patch included below is a minimal attempt to
restore debugging/profiling build.

Dmitry

Index: mp3lib/sr1.c
===================================================================
--- mp3lib/sr1.c	(revision 21349)
+++ mp3lib/sr1.c	(working copy)
@@ -411,7 +411,7 @@

      make_decode_tables(outscale);

-#ifdef CAN_COMPILE_X86_ASM
+#if defined(CAN_COMPILE_X86_ASM) && !defined(MP_DEBUG)

  #ifdef HAVE_MMX
      if (gCpuCaps.hasMMX)
@@ -463,7 +463,8 @@
  	mp_msg(MSGT_DECAUDIO,MSGL_V,"mp3lib: using Pentium optimized decore!\n");
      }
      else
-#endif
+#endif /* CAN_COMPILE_X86_ASM && ! MP_DEBUG */
+
  #ifdef HAVE_ALTIVEC
      if (gCpuCaps.hasAltiVec)
      {
Index: mp3lib/Makefile
===================================================================
--- mp3lib/Makefile	(revision 21349)
+++ mp3lib/Makefile	(working copy)
@@ -9,7 +9,9 @@

  SRCS = sr1.c
  ifeq ($(TARGET_ARCH_X86_32),yes)
+ifeq ($(MP_DEBUG),no)
  SRCS += decode_i586.c
+endif
  SRCS-$(TARGET_MMX)     += decode_MMX.c dct64_MMX.c tabinit_MMX.c
  SRCS-$(TARGET_3DNOW)   += dct36_3dnow.c dct64_3dnow.c
  SRCS-$(TARGET_3DNOWEX) += dct36_k7.c dct64_k7.c
Index: configure
===================================================================
--- configure	(revision 21349)
+++ configure	(working copy)
@@ -523,7 +523,7 @@
      _install=`echo $ac_option | cut -d '=' -f 2 `
      ;;
    --enable-profile)
-    _profile='-p'
+    _profile='-pg'
      ;;
    --disable-profile)
      _profile=
@@ -1531,7 +1531,10 @@
  # Checking for CFLAGS
  _stripbinaries=yes
  if test "$_profile" != "" || test "$_debug" != "" ; then
-  CFLAGS="-W -Wall -O2 $_march $_mcpu $_debug $_profile"
+  CFLAGS="-W -Wall -Wextra -O2 $_march $_mcpu $_debug $_profile"
+  _libs_mplayer="$_debug $_profile $_libs_mplayer"
+  _libs_mencoder="$_debug $_profile $_libs_mencoder"
+  _mp_debug="yes"
    if test "$_cc_major" -ge "3" ; then
      CFLAGS=`echo "$CFLAGS" | sed -e 's/\(-Wall\)/\1 -Wno-unused-parameter/'`
    fi
@@ -1542,6 +1545,7 @@
    else
      CFLAGS="-O4 $_march $_mcpu $_pipe -ffast-math -fomit-frame-pointer"
    fi
+  _mp_debug="no"
  else
    _warn_CFLAGS=yes
  fi
@@ -7383,6 +7387,7 @@
  HAVE_PTHREADS = $_pthreads

  HAVE_XVMC_ACCEL = $_xvmc
+MP_DEBUG = $_mp_debug

  # for FFmpeg
  SRC_PATH=..
Index: libavcodec/cabac.h
===================================================================
--- libavcodec/cabac.h	(revision 7178)
+++ libavcodec/cabac.h	(working copy)
@@ -376,7 +376,7 @@
  #define BYTE        "16"
  #define BYTEEND     "20"
  #endif
-#if defined(ARCH_X86) && !(defined(PIC) && defined(__GNUC__))
+#if defined(ARCH_X86) && !(defined(PIC) && defined(__GNUC__)) && !defined(MP_DEBUG)
      int bit;

  #ifndef BRANCHLESS_CABAC_DECODER
@@ -680,7 +680,7 @@

  //FIXME the x86 code from this file should be moved into i386/h264 or cabac something.c/h (note ill kill you if you move my code away from under my fingers before iam finished with it!)
  //FIXME use some macros to avoid duplicatin get_cabac (cant be done yet as that would make optimization work hard)
-#if defined(ARCH_X86) && !(defined(PIC) && defined(__GNUC__))
+#if defined(ARCH_X86) && !(defined(PIC) && defined(__GNUC__)) && !defined(MP_DEBUG)
  static int decode_significance_x86(CABACContext *c, int max_coeff, uint8_t *significant_coeff_ctx_base, int *index){
      void *end= significant_coeff_ctx_base + max_coeff - 1;
      int minusstart= -(int)significant_coeff_ctx_base;
Index: libavcodec/h264.c
===================================================================
--- libavcodec/h264.c	(revision 7178)
+++ libavcodec/h264.c	(working copy)
@@ -6139,7 +6139,7 @@
              index[coeff_count++] = last;\
          }
          const uint8_t *sig_off = significant_coeff_flag_offset_8x8[MB_FIELD];
-#if defined(ARCH_X86) && !(defined(PIC) && defined(__GNUC__))
+#if defined(ARCH_X86) && !(defined(PIC) && defined(__GNUC__)) && !defined(MP_DEBUG)
          coeff_count= decode_significance_8x8_x86(CC, significant_coeff_ctx_base, index, sig_off);
      } else {
          coeff_count= decode_significance_x86(CC, max_coeff, significant_coeff_ctx_base, index);




More information about the MPlayer-dev-eng mailing list