The intention is to separate externally used parts of cabac.h from the
rest of the file and especially the CABAC inline functions in cabac.h.

This fixes standalone compilation of some decoders with --disable-optimizations.
cabac.h defines some inline functions that use symbols from cabac.c.  Without
optimizations these inline functions are not eliminated and linking fails with
references to non-existing symbols.
---
 libavcodec/cabac.h         |   11 +----------
 libavcodec/h264.h          |   11 ++++++++++-
 libavcodec/x86/h264_i386.h |    2 +-
 3 files changed, 12 insertions(+), 12 deletions(-)

This still needs to pass further testing with my script to fix compilation
of individual components with --disable-optimization.  However, as I am
confident that it will work, I'm already sending it for review.

diff --git a/libavcodec/cabac.h b/libavcodec/cabac.h
index b0d056d..ad10710 100644
--- a/libavcodec/cabac.h
+++ b/libavcodec/cabac.h
@@ -29,6 +29,7 @@
 
 #include <stddef.h>
 
+#include "h264.h"
 #include "put_bits.h"
 
 //#undef NDEBUG
@@ -37,16 +38,6 @@
 #define CABAC_BITS 16
 #define CABAC_MASK ((1<<CABAC_BITS)-1)
 
-typedef struct CABACContext{
-    int low;
-    int range;
-    int outstanding_count;
-    const uint8_t *bytestream_start;
-    const uint8_t *bytestream;
-    const uint8_t *bytestream_end;
-    PutBitContext pb;
-}CABACContext;
-
 extern uint8_t ff_h264_mlps_state[4*64];
 extern uint8_t ff_h264_lps_range[4*2*64];  ///< rangeTabLPS
 extern uint8_t ff_h264_mps_state[2*64];     ///< transIdxMPS
diff --git a/libavcodec/h264.h b/libavcodec/h264.h
index 5025538..9cc1455 100644
--- a/libavcodec/h264.h
+++ b/libavcodec/h264.h
@@ -30,7 +30,6 @@
 
 #include "libavutil/intreadwrite.h"
 #include "dsputil.h"
-#include "cabac.h"
 #include "mpegvideo.h"
 #include "h264dsp.h"
 #include "h264pred.h"
@@ -253,6 +252,16 @@ typedef struct MMCO{
     int long_arg;       ///< index, pic_num, or num long refs depending on 
opcode
 } MMCO;
 
+typedef struct CABACContext{
+    int low;
+    int range;
+    int outstanding_count;
+    const uint8_t *bytestream_start;
+    const uint8_t *bytestream;
+    const uint8_t *bytestream_end;
+    PutBitContext pb;
+}CABACContext;
+
 /**
  * H264Context
  */
diff --git a/libavcodec/x86/h264_i386.h b/libavcodec/x86/h264_i386.h
index e195e04..7fac89a 100644
--- a/libavcodec/x86/h264_i386.h
+++ b/libavcodec/x86/h264_i386.h
@@ -31,7 +31,7 @@
 
 #include <stddef.h>
 
-#include "libavcodec/cabac.h"
+#include "libavcodec/h264.h"
 #include "cabac.h"
 
 //FIXME use some macros to avoid duplicating get_cabac (cannot be done yet
-- 
1.7.1

_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to