vp8hwd_debug.h 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. /*------------------------------------------------------------------------------
  2. -- --
  3. -- This software is confidential and proprietary and may be used --
  4. -- only as expressly authorized by a licensing agreement from --
  5. -- --
  6. -- Hantro Products Oy. --
  7. -- --
  8. -- (C) COPYRIGHT 2006 HANTRO PRODUCTS OY --
  9. -- ALL RIGHTS RESERVED --
  10. -- --
  11. -- The entire notice above must be reproduced --
  12. -- on all copies and should not be removed. --
  13. -- --
  14. --------------------------------------------------------------------------------
  15. --
  16. -- Abstract : Utility macros for debugging and tracing
  17. --
  18. --------------------------------------------------------------------------------
  19. --
  20. -- Version control information, please leave untouched.
  21. --
  22. -- $RCSfile: vp8hwd_debug.h,v $
  23. -- $Date: 2009/11/17 13:35:15 $
  24. -- $Revision: 1.1 $
  25. --
  26. ------------------------------------------------------------------------------*/
  27. #ifndef __VP8_DEBUG_H__
  28. #define __VP8_DEBUG_H__
  29. /* macro for assertion, used only when _ASSERT_USED is defined */
  30. #ifdef _ASSERT_USED
  31. #ifndef ASSERT
  32. #include <assert.h>
  33. #define ASSERT(expr) assert(expr)
  34. #endif
  35. #else
  36. #define ASSERT(expr)
  37. #endif
  38. /* macros for range checking used only when _RANGE_CHECK is defined */
  39. #ifdef _RANGE_CHECK
  40. #include <stdio.h>
  41. /* macro for range checking an single value */
  42. #define RANGE_CHECK(value, minBound, maxBound) \
  43. { \
  44. if ((value) < (minBound) || (value) > (maxBound)) \
  45. fprintf(stderr, "Warning: Value exceeds given limit(s)!\n"); \
  46. }
  47. /* macro for range checking an array of values */
  48. #define RANGE_CHECK_ARRAY(array, minBound, maxBound, length) \
  49. { \
  50. i32 i; \
  51. for (i = 0; i < (length); i++) \
  52. if ((array)[i] < (minBound) || (array)[i] > (maxBound)) \
  53. fprintf(stderr,"Warning: Value [%d] exceeds given limit(s)!\n",i); \
  54. }
  55. #else /* _RANGE_CHECK */
  56. #define RANGE_CHECK_ARRAY(array, minBound, maxBound, length)
  57. #define RANGE_CHECK(value, minBound, maxBound)
  58. #endif /* _RANGE_CHECK */
  59. /* macro for debug printing, used only when _DEBUG_PRINT is defined */
  60. #ifdef _DEBUG_PRINT
  61. #include <stdio.h>
  62. #define DEBUG_PRINT(args) printf args
  63. #else
  64. #define DEBUG_PRINT(args)
  65. #endif
  66. /* macro for error printing, used only when _ERROR_PRINT is defined */
  67. #ifdef _ERROR_PRINT
  68. #include <stdio.h>
  69. #define ERROR_PRINT(msg) fprintf(stderr,"ERROR: %s\n",msg)
  70. #else
  71. #define ERROR_PRINT(msg)
  72. #endif
  73. #endif /* __VP8_DEBUG_H__ */