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