internal.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. /********************************************************************
  2. * *
  3. * THIS FILE IS PART OF THE OggTheora SOFTWARE CODEC SOURCE CODE. *
  4. * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
  5. * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
  6. * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
  7. * *
  8. * THE Theora SOURCE CODE IS COPYRIGHT (C) 2002-2009 *
  9. * by the Xiph.Org Foundation and contributors http://www.xiph.org/ *
  10. * *
  11. ********************************************************************
  12. function:
  13. last mod: $Id$
  14. ********************************************************************/
  15. #if !defined(_internal_H)
  16. # define _internal_H (1)
  17. # include <stdlib.h>
  18. # include <limits.h>
  19. # if defined(HAVE_CONFIG_H)
  20. # include "config.h"
  21. # endif
  22. # include "theora/codec.h"
  23. # include "theora/theora.h"
  24. # include "ocintrin.h"
  25. # if !defined(__GNUC_PREREQ)
  26. # if defined(__GNUC__)&&defined(__GNUC_MINOR__)
  27. # define __GNUC_PREREQ(_maj,_min) \
  28. ((__GNUC__<<16)+__GNUC_MINOR__>=((_maj)<<16)+(_min))
  29. # else
  30. # define __GNUC_PREREQ(_maj,_min) 0
  31. # endif
  32. # endif
  33. # if defined(_MSC_VER)
  34. /*Disable missing EMMS warnings.*/
  35. # pragma warning(disable:4799)
  36. /*Thank you Microsoft, I know the order of operations.*/
  37. # pragma warning(disable:4554)
  38. # endif
  39. /*You, too, gcc.*/
  40. # if __GNUC_PREREQ(4,2)
  41. # pragma GCC diagnostic ignored "-Wparentheses"
  42. # endif
  43. /*Some assembly constructs require aligned operands.
  44. The following macros are _only_ intended for structure member declarations.
  45. Although they will sometimes work on stack variables, gcc will often silently
  46. ignore them.
  47. A separate set of macros could be made for manual stack alignment, but we
  48. don't actually require it anywhere.*/
  49. # if defined(OC_X86_ASM)||defined(OC_ARM_ASM)
  50. # if defined(__GNUC__)
  51. # define OC_ALIGN8(expr) expr __attribute__((aligned(8)))
  52. # define OC_ALIGN16(expr) expr __attribute__((aligned(16)))
  53. # elif defined(_MSC_VER)
  54. # define OC_ALIGN8(expr) __declspec (align(8)) expr
  55. # define OC_ALIGN16(expr) __declspec (align(16)) expr
  56. # else
  57. # error "Alignment macros required for this platform."
  58. # endif
  59. # endif
  60. # if !defined(OC_ALIGN8)
  61. # define OC_ALIGN8(expr) expr
  62. # endif
  63. # if !defined(OC_ALIGN16)
  64. # define OC_ALIGN16(expr) expr
  65. # endif
  66. /*This library's version.*/
  67. # define OC_VENDOR_STRING "Xiph.Org libtheora 1.2.0alpha 20100924 (Ptalarbvorm)"
  68. /*Theora bitstream version.*/
  69. # define TH_VERSION_MAJOR (3)
  70. # define TH_VERSION_MINOR (2)
  71. # define TH_VERSION_SUB (1)
  72. # define TH_VERSION_CHECK(_info,_maj,_min,_sub) \
  73. ((_info)->version_major>(_maj)||(_info)->version_major==(_maj)&& \
  74. ((_info)->version_minor>(_min)||(_info)->version_minor==(_min)&& \
  75. (_info)->version_subminor>=(_sub)))
  76. /*A map from the index in the zig zag scan to the coefficient number in a
  77. block.*/
  78. extern const unsigned char OC_FZIG_ZAG[128];
  79. /*A map from the coefficient number in a block to its index in the zig zag
  80. scan.*/
  81. extern const unsigned char OC_IZIG_ZAG[64];
  82. /*A map from physical macro block ordering to bitstream macro block
  83. ordering within a super block.*/
  84. extern const unsigned char OC_MB_MAP[2][2];
  85. /*A list of the indices in the oc_mb_map array that can be valid for each of
  86. the various chroma decimation types.*/
  87. extern const unsigned char OC_MB_MAP_IDXS[TH_PF_NFORMATS][12];
  88. /*The number of indices in the oc_mb_map array that can be valid for each of
  89. the various chroma decimation types.*/
  90. extern const unsigned char OC_MB_MAP_NIDXS[TH_PF_NFORMATS];
  91. int oc_ilog(unsigned _v);
  92. void *oc_aligned_malloc(size_t _sz,size_t _align);
  93. void oc_aligned_free(void *_ptr);
  94. void **oc_malloc_2d(size_t _height,size_t _width,size_t _sz);
  95. void **oc_calloc_2d(size_t _height,size_t _width,size_t _sz);
  96. void oc_free_2d(void *_ptr);
  97. void oc_ycbcr_buffer_flip(th_ycbcr_buffer _dst,
  98. const th_ycbcr_buffer _src);
  99. #endif