]> granicus.if.org Git - libvpx/commitdiff
Move CHECK_MEM_ERROR implementation to aom/internal.
authorAlex Converse <aconverse@google.com>
Wed, 8 Jun 2016 23:14:57 +0000 (16:14 -0700)
committerYaowu Xu <yaowu@google.com>
Tue, 6 Sep 2016 21:23:36 +0000 (21:23 +0000)
Allow using it in aom_dsp.

Change-Id: Ide7d58b6d11f8a45d473fc13bf730ba5bccb5516

aom/internal/aom_codec_internal.h
av1/common/common.h

index fc758b8b873ae6c77ea0228c241e79aadc4d1394..439927940e021472c7160b9bd76b121559b66bb4 100644 (file)
@@ -43,6 +43,7 @@
  */
 #ifndef AOM_INTERNAL_AOM_CODEC_INTERNAL_H_
 #define AOM_INTERNAL_AOM_CODEC_INTERNAL_H_
+#include "./aom_config.h"
 #include "../aom_decoder.h"
 #include "../aom_encoder.h"
 #include <stdarg.h>
@@ -439,6 +440,24 @@ void aom_internal_error(struct aom_internal_error_info *info,
                         aom_codec_err_t error, const char *fmt,
                         ...) CLANG_ANALYZER_NORETURN;
 
+#if CONFIG_DEBUG
+#define AOM_CHECK_MEM_ERROR(error_info, lval, expr)                         \
+  do {                                                                      \
+    lval = (expr);                                                          \
+    if (!lval)                                                              \
+      aom_internal_error(error_info, AOM_CODEC_MEM_ERROR,                   \
+                         "Failed to allocate " #lval " at %s:%d", __FILE__, \
+                         __LINE__);                                         \
+  } while (0)
+#else
+#define AOM_CHECK_MEM_ERROR(error_info, lval, expr)       \
+  do {                                                    \
+    lval = (expr);                                        \
+    if (!lval)                                            \
+      aom_internal_error(error_info, AOM_CODEC_MEM_ERROR, \
+                         "Failed to allocate " #lval);    \
+  } while (0)
+#endif
 #ifdef __cplusplus
 }  // extern "C"
 #endif
index 5b8100b39df38ad4473233c84f0dd69a0105cc54..551055a76dcacca116eea14f5b748197d49428d2 100644 (file)
@@ -16,7 +16,6 @@
 
 #include <assert.h>
 
-#include "./aom_config.h"
 #include "aom_dsp/aom_dsp_common.h"
 #include "aom_mem/aom_mem.h"
 #include "aom/aom_integer.h"
@@ -49,24 +48,8 @@ static INLINE int get_unsigned_bits(unsigned int num_values) {
   return num_values > 0 ? get_msb(num_values) + 1 : 0;
 }
 
-#if CONFIG_DEBUG
-#define CHECK_MEM_ERROR(cm, lval, expr)                                     \
-  do {                                                                      \
-    lval = (expr);                                                          \
-    if (!lval)                                                              \
-      aom_internal_error(&cm->error, AOM_CODEC_MEM_ERROR,                   \
-                         "Failed to allocate " #lval " at %s:%d", __FILE__, \
-                         __LINE__);                                         \
-  } while (0)
-#else
-#define CHECK_MEM_ERROR(cm, lval, expr)                   \
-  do {                                                    \
-    lval = (expr);                                        \
-    if (!lval)                                            \
-      aom_internal_error(&cm->error, AOM_CODEC_MEM_ERROR, \
-                         "Failed to allocate " #lval);    \
-  } while (0)
-#endif
+#define CHECK_MEM_ERROR(cm, lval, expr) \
+  AOM_CHECK_MEM_ERROR(&cm->error, lval, expr)
 // TODO(yaowu: validate the usage of these codes or develop new ones.)
 #define AV1_SYNC_CODE_0 0x49
 #define AV1_SYNC_CODE_1 0x83