2008-07-30 06:38:23 +00:00
|
|
|
/********************************************************************
|
|
|
|
* *
|
|
|
|
* THIS FILE IS PART OF THE OggTheora SOFTWARE CODEC SOURCE CODE. *
|
|
|
|
* USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
|
|
|
|
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
|
|
|
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
|
|
|
* *
|
2009-09-27 22:14:21 +00:00
|
|
|
* THE Theora SOURCE CODE IS COPYRIGHT (C) 2002-2009 *
|
2009-01-22 00:00:49 +00:00
|
|
|
* by the Xiph.Org Foundation and contributors http://www.xiph.org/ *
|
2008-07-30 06:38:23 +00:00
|
|
|
* *
|
|
|
|
********************************************************************
|
|
|
|
|
|
|
|
function:
|
2010-11-08 07:47:34 +00:00
|
|
|
last mod: $Id: internal.h 17578 2010-10-29 04:21:26Z tterribe $
|
2008-07-30 06:38:23 +00:00
|
|
|
|
|
|
|
********************************************************************/
|
|
|
|
#if !defined(_internal_H)
|
|
|
|
# define _internal_H (1)
|
|
|
|
# include <stdlib.h>
|
2009-09-27 22:14:21 +00:00
|
|
|
# include <limits.h>
|
2008-07-30 06:38:23 +00:00
|
|
|
# if defined(HAVE_CONFIG_H)
|
2010-11-08 07:47:34 +00:00
|
|
|
# include "config.h"
|
2008-07-30 06:38:23 +00:00
|
|
|
# endif
|
|
|
|
# include "theora/codec.h"
|
|
|
|
# include "theora/theora.h"
|
2010-11-08 07:47:34 +00:00
|
|
|
# include "ocintrin.h"
|
|
|
|
|
|
|
|
# if !defined(__GNUC_PREREQ)
|
|
|
|
# if defined(__GNUC__)&&defined(__GNUC_MINOR__)
|
|
|
|
# define __GNUC_PREREQ(_maj,_min) \
|
|
|
|
((__GNUC__<<16)+__GNUC_MINOR__>=((_maj)<<16)+(_min))
|
|
|
|
# else
|
|
|
|
# define __GNUC_PREREQ(_maj,_min) 0
|
|
|
|
# endif
|
|
|
|
# endif
|
2008-07-30 06:38:23 +00:00
|
|
|
|
|
|
|
# if defined(_MSC_VER)
|
2009-09-27 22:14:21 +00:00
|
|
|
/*Disable missing EMMS warnings.*/
|
|
|
|
# pragma warning(disable:4799)
|
|
|
|
/*Thank you Microsoft, I know the order of operations.*/
|
|
|
|
# pragma warning(disable:4554)
|
|
|
|
# endif
|
|
|
|
/*You, too, gcc.*/
|
2010-11-08 07:47:34 +00:00
|
|
|
# if __GNUC_PREREQ(4,2)
|
|
|
|
# pragma GCC diagnostic ignored "-Wparentheses"
|
2009-09-27 22:14:21 +00:00
|
|
|
# endif
|
|
|
|
|
2010-11-08 07:47:34 +00:00
|
|
|
/*Some assembly constructs require aligned operands.
|
|
|
|
The following macros are _only_ intended for structure member declarations.
|
|
|
|
Although they will sometimes work on stack variables, gcc will often silently
|
|
|
|
ignore them.
|
|
|
|
A separate set of macros could be made for manual stack alignment, but we
|
|
|
|
don't actually require it anywhere.*/
|
|
|
|
# if defined(OC_X86_ASM)||defined(OC_ARM_ASM)
|
2009-09-27 22:14:21 +00:00
|
|
|
# if defined(__GNUC__)
|
|
|
|
# define OC_ALIGN8(expr) expr __attribute__((aligned(8)))
|
|
|
|
# define OC_ALIGN16(expr) expr __attribute__((aligned(16)))
|
|
|
|
# elif defined(_MSC_VER)
|
|
|
|
# define OC_ALIGN8(expr) __declspec (align(8)) expr
|
|
|
|
# define OC_ALIGN16(expr) __declspec (align(16)) expr
|
2010-11-08 07:47:34 +00:00
|
|
|
# else
|
|
|
|
# error "Alignment macros required for this platform."
|
2009-09-27 22:14:21 +00:00
|
|
|
# endif
|
|
|
|
# endif
|
|
|
|
# if !defined(OC_ALIGN8)
|
|
|
|
# define OC_ALIGN8(expr) expr
|
|
|
|
# endif
|
|
|
|
# if !defined(OC_ALIGN16)
|
|
|
|
# define OC_ALIGN16(expr) expr
|
2008-07-30 06:38:23 +00:00
|
|
|
# endif
|
|
|
|
|
2009-09-27 22:14:21 +00:00
|
|
|
|
|
|
|
|
2008-07-30 06:38:23 +00:00
|
|
|
/*This library's version.*/
|
2010-11-08 07:47:34 +00:00
|
|
|
# define OC_VENDOR_STRING "Xiph.Org libtheora 1.2.0alpha 20100924 (Ptalarbvorm)"
|
2008-07-30 06:38:23 +00:00
|
|
|
|
|
|
|
/*Theora bitstream version.*/
|
|
|
|
# define TH_VERSION_MAJOR (3)
|
|
|
|
# define TH_VERSION_MINOR (2)
|
|
|
|
# define TH_VERSION_SUB (1)
|
|
|
|
# define TH_VERSION_CHECK(_info,_maj,_min,_sub) \
|
|
|
|
((_info)->version_major>(_maj)||(_info)->version_major==(_maj)&& \
|
|
|
|
((_info)->version_minor>(_min)||(_info)->version_minor==(_min)&& \
|
|
|
|
(_info)->version_subminor>=(_sub)))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*A map from the index in the zig zag scan to the coefficient number in a
|
2009-09-27 22:14:21 +00:00
|
|
|
block.*/
|
|
|
|
extern const unsigned char OC_FZIG_ZAG[128];
|
2008-07-30 06:38:23 +00:00
|
|
|
/*A map from the coefficient number in a block to its index in the zig zag
|
|
|
|
scan.*/
|
2009-09-27 22:14:21 +00:00
|
|
|
extern const unsigned char OC_IZIG_ZAG[64];
|
2008-07-30 06:38:23 +00:00
|
|
|
/*A map from physical macro block ordering to bitstream macro block
|
|
|
|
ordering within a super block.*/
|
2009-09-27 22:14:21 +00:00
|
|
|
extern const unsigned char OC_MB_MAP[2][2];
|
|
|
|
/*A list of the indices in the oc_mb_map array that can be valid for each of
|
2008-07-30 06:38:23 +00:00
|
|
|
the various chroma decimation types.*/
|
2009-09-27 22:14:21 +00:00
|
|
|
extern const unsigned char OC_MB_MAP_IDXS[TH_PF_NFORMATS][12];
|
|
|
|
/*The number of indices in the oc_mb_map array that can be valid for each of
|
2008-07-30 06:38:23 +00:00
|
|
|
the various chroma decimation types.*/
|
2009-09-27 22:14:21 +00:00
|
|
|
extern const unsigned char OC_MB_MAP_NIDXS[TH_PF_NFORMATS];
|
2008-07-30 06:38:23 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int oc_ilog(unsigned _v);
|
2010-11-08 07:47:34 +00:00
|
|
|
void *oc_aligned_malloc(size_t _sz,size_t _align);
|
|
|
|
void oc_aligned_free(void *_ptr);
|
2008-07-30 06:38:23 +00:00
|
|
|
void **oc_malloc_2d(size_t _height,size_t _width,size_t _sz);
|
|
|
|
void **oc_calloc_2d(size_t _height,size_t _width,size_t _sz);
|
|
|
|
void oc_free_2d(void *_ptr);
|
|
|
|
|
|
|
|
void oc_ycbcr_buffer_flip(th_ycbcr_buffer _dst,
|
|
|
|
const th_ycbcr_buffer _src);
|
|
|
|
|
|
|
|
#endif
|