mirror of
https://gitee.com/Vancouver2017/luban-lite-t3e-pro.git
synced 2025-12-14 02:18:54 +00:00
99 lines
3.2 KiB
C
99 lines
3.2 KiB
C
/*
|
|
* copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at>
|
|
*
|
|
* This file is part of FFmpeg.
|
|
*
|
|
* FFmpeg is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
* License as published by the Free Software Foundation; either
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
*
|
|
* FFmpeg is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
* Lesser General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
* License along with FFmpeg; if not, write to the Free Software
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
*/
|
|
|
|
/**
|
|
* @file
|
|
* common internal and external API header
|
|
*/
|
|
|
|
#ifndef AVUTIL_COMMON_H
|
|
#define AVUTIL_COMMON_H
|
|
|
|
#include <errno.h>
|
|
#include <inttypes.h>
|
|
#include <limits.h>
|
|
#include <math.h>
|
|
#include <stdint.h>
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
|
|
|
|
#if AV_HAVE_BIGENDIAN
|
|
# define AV_NE(be, le) (be)
|
|
#else
|
|
# define AV_NE(be, le) (le)
|
|
#endif
|
|
|
|
//rounded division & shift
|
|
#define RSHIFT(a,b) ((a) > 0 ? ((a) + ((1<<(b))>>1))>>(b) : ((a) + ((1<<(b))>>1)-1)>>(b))
|
|
/* assume b>0 */
|
|
#define ROUNDED_DIV(a,b) (((a)>=0 ? (a) + ((b)>>1) : (a) - ((b)>>1))/(b))
|
|
/* Fast a/(1<<b) rounded toward +inf. Assume a>=0 and b>=0 */
|
|
#define AV_CEIL_RSHIFT(a,b) (!av_builtin_constant_p(b) ? -((-(a)) >> (b)) \
|
|
: ((a) + (1<<(b)) - 1) >> (b))
|
|
/* Backwards compat. */
|
|
#define FF_CEIL_RSHIFT AV_CEIL_RSHIFT
|
|
|
|
#define FFUDIV(a,b) (((a)>0 ?(a):(a)-(b)+1) / (b))
|
|
#define FFUMOD(a,b) ((a)-(b)*FFUDIV(a,b))
|
|
|
|
/**
|
|
* Absolute value, Note, INT_MIN / INT64_MIN result in undefined behavior as they
|
|
* are not representable as absolute values of their type. This is the same
|
|
* as with *abs()
|
|
* @see FFNABS()
|
|
*/
|
|
#define FFABS(a) ((a) >= 0 ? (a) : (-(a)))
|
|
#define FFSIGN(a) ((a) > 0 ? 1 : -1)
|
|
|
|
/**
|
|
* Negative Absolute value.
|
|
* this works for all integers of all types.
|
|
* As with many macros, this evaluates its argument twice, it thus must not have
|
|
* a sideeffect, that is FFNABS(x++) has undefined behavior.
|
|
*/
|
|
#define FFNABS(a) ((a) <= 0 ? (a) : (-(a)))
|
|
|
|
/**
|
|
* Comparator.
|
|
* For two numerical expressions x and y, gives 1 if x > y, -1 if x < y, and 0
|
|
* if x == y. This is useful for instance in a qsort comparator callback.
|
|
* Furthermore, compilers are able to optimize this to branchless code, and
|
|
* there is no risk of overflow with signed types.
|
|
* As with many macros, this evaluates its argument multiple times, it thus
|
|
* must not have a side-effect.
|
|
*/
|
|
#define FFDIFFSIGN(x,y) (((x)>(y)) - ((x)<(y)))
|
|
|
|
#define FFMAX(a,b) ((a) > (b) ? (a) : (b))
|
|
#define FFMAX3(a,b,c) FFMAX(FFMAX(a,b),c)
|
|
#define FFMIN(a,b) ((a) > (b) ? (b) : (a))
|
|
#define FFMIN3(a,b,c) FFMIN(FFMIN(a,b),c)
|
|
|
|
#define FFSWAP(type,a,b) do{type SWAP_tmp= b; b= a; a= SWAP_tmp;}while(0)
|
|
#define FF_ARRAY_ELEMS(a) (sizeof(a) / sizeof((a)[0]))
|
|
|
|
|
|
#define AAC_RENAME(x) x
|
|
typedef float INTFLOAT;
|
|
|
|
#endif
|