Skip to content

Instantly share code, notes, and snippets.

@arichardson
Created June 21, 2017 13:43
Show Gist options
  • Save arichardson/98c725e6fd2cdd9738128507dc45fd17 to your computer and use it in GitHub Desktop.
Save arichardson/98c725e6fd2cdd9738128507dc45fd17 to your computer and use it in GitHub Desktop.
Crash repro
# 1 "<built-in>"
# 1 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/rdopt.c"
/*!
***************************************************************************
* \file rdopt.c
*
* \brief
* Rate-Distortion optimized mode decision
*
* \author
* - Heiko Schwarz <[email protected]>
* - Valeri George <[email protected]>
* - Lowell Winger <[email protected]>
* - Alexis Michael Tourapis <[email protected]>
* \date
* 12. April 2001
**************************************************************************
*/
#if 0 /* expanded by -frewrite-includes */
#include <stdlib.h>
#endif /* expanded by -frewrite-includes */
# 19 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/rdopt.c"
# 1 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/stdlib.h" 1 3 4
/*-
* Copyright (c) 1990, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)stdlib.h 8.5 (Berkeley) 5/19/95
* $FreeBSD$
*/
#ifndef _STDLIB_H_
#define _STDLIB_H_
#if 0 /* expanded by -frewrite-includes */
#include <sys/cdefs.h>
#endif /* expanded by -frewrite-includes */
# 36 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/stdlib.h" 3 4
# 1 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 1 3 4
/*-
* Copyright (c) 1991, 1993
* The Regents of the University of California. All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* Berkeley Software Design, Inc.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)cdefs.h 8.8 (Berkeley) 1/9/95
* $FreeBSD$
*/
#ifndef _SYS_CDEFS_H_
#define _SYS_CDEFS_H_
/*
* Testing against Clang-specific extensions.
*/
#ifndef __has_attribute
#define __has_attribute(x) 0
#endif
# 45 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#ifndef __has_extension
#define __has_extension __has_feature
#endif
# 48 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#ifndef __has_feature
#define __has_feature(x) 0
#endif
# 51 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#ifndef __has_include
#define __has_include(x) 0
#endif
# 54 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#ifndef __has_builtin
#define __has_builtin(x) 0
#endif
# 57 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#if defined(__cplusplus)
#define __BEGIN_DECLS extern "C" {
#define __END_DECLS }
#else
# 62 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#define __BEGIN_DECLS
#define __END_DECLS
#endif
# 65 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
/*
* This code has been put in place to help reduce the addition of
* compiler specific defines in FreeBSD code. It helps to aid in
* having a compiler-agnostic source tree.
*/
#if defined(__GNUC__) || defined(__INTEL_COMPILER)
#if __GNUC__ >= 3 || defined(__INTEL_COMPILER)
#define __GNUCLIKE_ASM 3
#define __GNUCLIKE_MATH_BUILTIN_CONSTANTS
#else
# 78 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#define __GNUCLIKE_ASM 2
#endif
# 80 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#define __GNUCLIKE___TYPEOF 1
#define __GNUCLIKE___OFFSETOF 1
#define __GNUCLIKE___SECTION 1
#ifndef __INTEL_COMPILER
#define __GNUCLIKE_CTOR_SECTION_HANDLING 1
#endif
# 87 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#define __GNUCLIKE_BUILTIN_CONSTANT_P 1
#if defined(__INTEL_COMPILER) && defined(__cplusplus) && \
__INTEL_COMPILER < 800
#undef __GNUCLIKE_BUILTIN_CONSTANT_P
#endif
# 93 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#if (__GNUC_MINOR__ > 95 || __GNUC__ >= 3)
#define __GNUCLIKE_BUILTIN_VARARGS 1
#define __GNUCLIKE_BUILTIN_STDARG 1
#define __GNUCLIKE_BUILTIN_VAALIST 1
#endif
# 99 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#if defined(__GNUC__)
#define __GNUC_VA_LIST_COMPATIBILITY 1
#endif
# 103 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
/*
* Compiler memory barriers, specific to gcc and clang.
*/
#if defined(__GNUC__)
#define __compiler_membar() __asm __volatile(" " : : : "memory")
#endif
# 110 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#ifndef __INTEL_COMPILER
#define __GNUCLIKE_BUILTIN_NEXT_ARG 1
#define __GNUCLIKE_MATH_BUILTIN_RELOPS
#endif
# 115 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#define __GNUCLIKE_BUILTIN_MEMCPY 1
/* XXX: if __GNUC__ >= 2: not tested everywhere originally, where replaced */
#define __CC_SUPPORTS_INLINE 1
#define __CC_SUPPORTS___INLINE 1
#define __CC_SUPPORTS___INLINE__ 1
#define __CC_SUPPORTS___FUNC__ 1
#define __CC_SUPPORTS_WARNING 1
#define __CC_SUPPORTS_VARADIC_XXX 1 /* see varargs.h */
#define __CC_SUPPORTS_DYNAMIC_ARRAY_INIT 1
#endif /* __GNUC__ || __INTEL_COMPILER */
# 131 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
/*
* Macro to test if we're using a specific version of gcc or later.
*/
#if defined(__GNUC__) && !defined(__INTEL_COMPILER)
#define __GNUC_PREREQ__(ma, mi) \
(__GNUC__ > (ma) || __GNUC__ == (ma) && __GNUC_MINOR__ >= (mi))
#else
# 139 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#define __GNUC_PREREQ__(ma, mi) 0
#endif
# 141 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
/*
* The __CONCAT macro is used to concatenate parts of symbol names, e.g.
* with "#define OLD(foo) __CONCAT(old,foo)", OLD(foo) produces oldfoo.
* The __CONCAT macro is a bit tricky to use if it must work in non-ANSI
* mode -- there must be no spaces between its arguments, and for nested
* __CONCAT's, all the __CONCAT's must be at the left. __CONCAT can also
* concatenate double-quoted strings produced by the __STRING macro, but
* this only works with ANSI C.
*
* __XSTRING is like __STRING, but it expands any macros in its argument
* first. It is only available with ANSI C.
*/
#if defined(__STDC__) || defined(__cplusplus)
#define __P(protos) protos /* full-blown ANSI C */
#define __CONCAT1(x,y) x ## y
#define __CONCAT(x,y) __CONCAT1(x,y)
#define __STRING(x) #x /* stringify without expanding x */
#define __XSTRING(x) __STRING(x) /* expand x, then stringify */
#define __const const /* define reserved names to standard */
#define __signed signed
#define __volatile volatile
#if defined(__cplusplus)
#define __inline inline /* convert to C++ keyword */
#else
# 167 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#if !(defined(__CC_SUPPORTS___INLINE))
#define __inline /* delete GCC keyword */
#endif /* ! __CC_SUPPORTS___INLINE */
# 170 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#endif /* !__cplusplus */
# 171 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#else /* !(__STDC__ || __cplusplus) */
# 173 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#define __P(protos) () /* traditional C preprocessor */
#define __CONCAT(x,y) x/**/y
#define __STRING(x) "x"
#if !defined(__CC_SUPPORTS___INLINE)
#define __const /* delete pseudo-ANSI C keywords */
#define __inline
#define __signed
#define __volatile
/*
* In non-ANSI C environments, new programs will want ANSI-only C keywords
* deleted from the program and old programs will want them left alone.
* When using a compiler other than gcc, programs using the ANSI C keywords
* const, inline etc. as normal identifiers should define -DNO_ANSI_KEYWORDS.
* When using "gcc -traditional", we assume that this is the intent; if
* __GNUC__ is defined but __STDC__ is not, we leave the new keywords alone.
*/
#ifndef NO_ANSI_KEYWORDS
#define const /* delete ANSI C keywords */
#define inline
#define signed
#define volatile
#endif /* !NO_ANSI_KEYWORDS */
# 196 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#endif /* !__CC_SUPPORTS___INLINE */
# 197 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#endif /* !(__STDC__ || __cplusplus) */
# 198 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
/*
* Compiler-dependent macros to help declare dead (non-returning) and
* pure (no side effects) functions, and unused variables. They are
* null except for versions of gcc that are known to support the features
* properly (old versions of gcc-2 supported the dead and pure features
* in a different (wrong) way). If we do not provide an implementation
* for a given compiler, let the compile fail if it is told to use
* a feature that we cannot live without.
*/
#ifdef lint
#define __dead2
#define __pure2
#define __unused
#define __packed
#define __aligned(x)
#define __alloc_align(x)
#define __alloc_size(x)
#define __section(x)
#define __weak_symbol
#else
# 219 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#define __weak_symbol __attribute__((__weak__))
#if !__GNUC_PREREQ__(2, 5) && !defined(__INTEL_COMPILER)
#define __dead2
#define __pure2
#define __unused
#endif
# 225 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#if __GNUC__ == 2 && __GNUC_MINOR__ >= 5 && __GNUC_MINOR__ < 7 && !defined(__INTEL_COMPILER)
#define __dead2 __attribute__((__noreturn__))
#define __pure2 __attribute__((__const__))
#define __unused
/* XXX Find out what to do for __packed, __aligned and __section */
#endif
# 231 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#if __GNUC_PREREQ__(2, 7) || defined(__INTEL_COMPILER)
#define __dead2 __attribute__((__noreturn__))
#define __pure2 __attribute__((__const__))
#define __unused __attribute__((__unused__))
#define __used __attribute__((__used__))
#define __packed __attribute__((__packed__))
#define __aligned(x) __attribute__((__aligned__(x)))
#define __section(x) __attribute__((__section__(x)))
#endif
# 240 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#if __GNUC_PREREQ__(4, 3) || __has_attribute(__alloc_size__)
#define __alloc_size(x) __attribute__((__alloc_size__(x)))
#else
# 243 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#define __alloc_size(x)
#endif
# 245 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#if __GNUC_PREREQ__(4, 9) || __has_attribute(__alloc_align__)
#define __alloc_align(x) __attribute__((__alloc_align__(x)))
#else
# 248 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#define __alloc_align(x)
#endif
# 250 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#endif /* lint */
# 251 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#if !__GNUC_PREREQ__(2, 95)
#define __alignof(x) __offsetof(struct { char __a; x __b; }, __b)
#endif
# 255 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
/*
* Keywords added in C11.
*/
#if !defined(__STDC_VERSION__) || __STDC_VERSION__ < 201112L || defined(lint)
#if !__has_extension(c_alignas)
#if (defined(__cplusplus) && __cplusplus >= 201103L) || \
__has_extension(cxx_alignas)
#define _Alignas(x) alignas(x)
#else
# 267 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
/* XXX: Only emulates _Alignas(constant-expression); not _Alignas(type-name). */
#define _Alignas(x) __aligned(x)
#endif
# 270 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#endif
# 271 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#if defined(__cplusplus) && __cplusplus >= 201103L
#define _Alignof(x) alignof(x)
#else
# 275 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#define _Alignof(x) __alignof(x)
#endif
# 277 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#if !defined(__cplusplus) && !__has_extension(c_atomic) && \
!__has_extension(cxx_atomic)
/*
* No native support for _Atomic(). Place object in structure to prevent
* most forms of direct non-atomic access.
*/
#define _Atomic(T) struct { T volatile __val; }
#endif
# 286 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#if defined(__cplusplus) && __cplusplus >= 201103L
#define _Noreturn [[noreturn]]
#else
# 290 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#define _Noreturn __dead2
#endif
# 292 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#if !__has_extension(c_static_assert)
#if (defined(__cplusplus) && __cplusplus >= 201103L) || \
__has_extension(cxx_static_assert)
#define _Static_assert(x, y) static_assert(x, y)
#elif __GNUC_PREREQ__(4,6)
# 298 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
/* Nothing, gcc 4.6 and higher has _Static_assert built-in */
#elif defined(__COUNTER__)
# 300 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#define _Static_assert(x, y) __Static_assert(x, __COUNTER__)
#define __Static_assert(x, y) ___Static_assert(x, y)
#define ___Static_assert(x, y) typedef char __assert_ ## y[(x) ? 1 : -1] \
__unused
#else
# 305 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#define _Static_assert(x, y) struct __hack
#endif
# 307 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#endif
# 308 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#if !__has_extension(c_thread_local)
/*
* XXX: Some compilers (Clang 3.3, GCC 4.7) falsely announce C++11 mode
* without actually supporting the thread_local keyword. Don't check for
* the presence of C++11 when defining _Thread_local.
*/
#if /* (defined(__cplusplus) && __cplusplus >= 201103L) || */ \
__has_extension(cxx_thread_local)
#define _Thread_local thread_local
#else
# 319 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#define _Thread_local __thread
#endif
# 321 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#endif
# 322 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#endif /* __STDC_VERSION__ || __STDC_VERSION__ < 201112L */
# 324 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
/*
* Emulation of C11 _Generic(). Unlike the previously defined C11
* keywords, it is not possible to implement this using exactly the same
* syntax. Therefore implement something similar under the name
* __generic(). Unlike _Generic(), this macro can only distinguish
* between a single type, so it requires nested invocations to
* distinguish multiple cases.
*/
#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) || \
__has_extension(c_generic_selections)
#define __generic(expr, t, yes, no) \
_Generic(expr, t: yes, default: no)
#elif __GNUC_PREREQ__(3, 1) && !defined(__cplusplus)
# 339 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#define __generic(expr, t, yes, no) \
__builtin_choose_expr( \
__builtin_types_compatible_p(__typeof(expr), t), yes, no)
#endif
# 343 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
/*
* C99 Static array indices in function parameter declarations. Syntax such as:
* void bar(int myArray[static 10]);
* is allowed in C99 but not in C++. Define __min_size appropriately so
* headers using it can be compiled in either language. Use like this:
* void bar(int myArray[__min_size(10)]);
*/
#if !defined(__cplusplus) && \
(defined(__clang__) || __GNUC_PREREQ__(4, 6)) && \
(!defined(__STDC_VERSION__) || (__STDC_VERSION__ >= 199901))
#define __min_size(x) static (x)
#else
# 356 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#define __min_size(x) (x)
#endif
# 358 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#if __GNUC_PREREQ__(2, 96)
#define __malloc_like __attribute__((__malloc__))
#define __pure __attribute__((__pure__))
#else
# 363 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#define __malloc_like
#define __pure
#endif
# 366 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#if __GNUC_PREREQ__(3, 1) || (defined(__INTEL_COMPILER) && __INTEL_COMPILER >= 800)
#define __always_inline __attribute__((__always_inline__))
#else
# 370 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#define __always_inline
#endif
# 372 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#if __GNUC_PREREQ__(3, 1)
#define __noinline __attribute__ ((__noinline__))
#else
# 376 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#define __noinline
#endif
# 378 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#if __GNUC_PREREQ__(3, 4)
#define __fastcall __attribute__((__fastcall__))
#define __result_use_check __attribute__((__warn_unused_result__))
#else
# 383 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#define __fastcall
#define __result_use_check
#endif
# 386 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#if __GNUC_PREREQ__(4, 1)
#define __returns_twice __attribute__((__returns_twice__))
#else
# 390 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#define __returns_twice
#endif
# 392 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#if __GNUC_PREREQ__(4, 6) || __has_builtin(__builtin_unreachable)
#define __unreachable() __builtin_unreachable()
#else
# 396 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#define __unreachable() ((void)0)
#endif
# 398 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
/* XXX: should use `#if __STDC_VERSION__ < 199901'. */
#if !__GNUC_PREREQ__(2, 7) && !defined(__INTEL_COMPILER)
#define __func__ NULL
#endif
# 403 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#if (defined(__INTEL_COMPILER) || (defined(__GNUC__) && __GNUC__ >= 2)) && !defined(__STRICT_ANSI__) || __STDC_VERSION__ >= 199901
#define __LONG_LONG_SUPPORTED
#endif
# 407 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
/* C++11 exposes a load of C99 stuff */
#if defined(__cplusplus) && __cplusplus >= 201103L
#define __LONG_LONG_SUPPORTED
#ifndef __STDC_LIMIT_MACROS
#define __STDC_LIMIT_MACROS
#endif
# 414 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#ifndef __STDC_CONSTANT_MACROS
#define __STDC_CONSTANT_MACROS
#endif
# 417 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#endif
# 418 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
/*
* GCC 2.95 provides `__restrict' as an extension to C90 to support the
* C99-specific `restrict' type qualifier. We happen to use `__restrict' as
* a way to define the `restrict' type qualifier without disturbing older
* software that is unaware of C99 keywords.
*/
#if !(__GNUC__ == 2 && __GNUC_MINOR__ == 95)
#if !defined(__STDC_VERSION__) || __STDC_VERSION__ < 199901 || defined(lint)
#define __restrict
#else
# 429 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#define __restrict restrict
#endif
# 431 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#endif
# 432 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
/*
* GNU C version 2.96 adds explicit branch prediction so that
* the CPU back-end can hint the processor and also so that
* code blocks can be reordered such that the predicted path
* sees a more linear flow, thus improving cache behavior, etc.
*
* The following two macros provide us with a way to utilize this
* compiler feature. Use __predict_true() if you expect the expression
* to evaluate to true, and __predict_false() if you expect the
* expression to evaluate to false.
*
* A few notes about usage:
*
* * Generally, __predict_false() error condition checks (unless
* you have some _strong_ reason to do otherwise, in which case
* document it), and/or __predict_true() `no-error' condition
* checks, assuming you want to optimize for the no-error case.
*
* * Other than that, if you don't know the likelihood of a test
* succeeding from empirical or other `hard' evidence, don't
* make predictions.
*
* * These are meant to be used in places that are run `a lot'.
* It is wasteful to make predictions in code that is run
* seldomly (e.g. at subsystem initialization time) as the
* basic block reordering that this affects can often generate
* larger code.
*/
#if __GNUC_PREREQ__(2, 96)
#define __predict_true(exp) __builtin_expect((exp), 1)
#define __predict_false(exp) __builtin_expect((exp), 0)
#else
# 465 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#define __predict_true(exp) (exp)
#define __predict_false(exp) (exp)
#endif
# 468 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#if __GNUC_PREREQ__(4, 0)
#define __null_sentinel __attribute__((__sentinel__))
#define __exported __attribute__((__visibility__("default")))
#define __hidden __attribute__((__visibility__("hidden")))
#else
# 474 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#define __null_sentinel
#define __exported
#define __hidden
#endif
# 478 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
/*
* We define this here since <stddef.h>, <sys/queue.h>, and <sys/types.h>
* require it.
*/
#if __GNUC_PREREQ__(4, 1)
#define __offsetof(type, field) __builtin_offsetof(type, field)
#else
# 486 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#ifndef __cplusplus
#define __offsetof(type, field) \
((__size_t)(__uintptr_t)((const volatile void *)&((type *)0)->field))
#else
# 490 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#define __offsetof(type, field) \
(__offsetof__ (reinterpret_cast <__size_t> \
(&reinterpret_cast <const volatile char &> \
(static_cast<type *> (0)->field))))
#endif
# 495 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#endif
# 496 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#define __rangeof(type, start, end) \
(__offsetof(type, end) - __offsetof(type, start))
/*
* Given the pointer x to the member m of the struct s, return
* a pointer to the containing structure. When using GCC, we first
* assign pointer x to a local variable, to check that its type is
* compatible with member m.
*/
#if __GNUC_PREREQ__(3, 1)
#define __containerof(x, s, m) ({ \
const volatile __typeof(((s *)0)->m) *__x = (x); \
__DEQUALIFY(s *, (const volatile char *)__x - __offsetof(s, m));\
})
#else
# 511 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#define __containerof(x, s, m) \
__DEQUALIFY(s *, (const volatile char *)(x) - __offsetof(s, m))
#endif
# 514 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
/*
* Compiler-dependent macros to declare that functions take printf-like
* or scanf-like arguments. They are null except for versions of gcc
* that are known to support the features properly (old versions of gcc-2
* didn't permit keeping the keywords out of the application namespace).
*/
#if !__GNUC_PREREQ__(2, 7) && !defined(__INTEL_COMPILER)
#define __printflike(fmtarg, firstvararg)
#define __scanflike(fmtarg, firstvararg)
#define __format_arg(fmtarg)
#define __strfmonlike(fmtarg, firstvararg)
#define __strftimelike(fmtarg, firstvararg)
#else
# 528 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#define __printflike(fmtarg, firstvararg) \
__attribute__((__format__ (__printf__, fmtarg, firstvararg)))
#define __scanflike(fmtarg, firstvararg) \
__attribute__((__format__ (__scanf__, fmtarg, firstvararg)))
#define __format_arg(fmtarg) __attribute__((__format_arg__ (fmtarg)))
#define __strfmonlike(fmtarg, firstvararg) \
__attribute__((__format__ (__strfmon__, fmtarg, firstvararg)))
#define __strftimelike(fmtarg, firstvararg) \
__attribute__((__format__ (__strftime__, fmtarg, firstvararg)))
#endif
# 538 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
/* Compiler-dependent macros that rely on FreeBSD-specific extensions. */
#if defined(__FreeBSD_cc_version) && __FreeBSD_cc_version >= 300001 && \
defined(__GNUC__) && !defined(__INTEL_COMPILER)
#define __printf0like(fmtarg, firstvararg) \
__attribute__((__format__ (__printf0__, fmtarg, firstvararg)))
#else
# 545 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#define __printf0like(fmtarg, firstvararg)
#endif
# 547 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#if defined(__GNUC__) || defined(__INTEL_COMPILER)
#ifndef __INTEL_COMPILER
#define __strong_reference(sym,aliassym) \
extern __typeof (sym) aliassym __attribute__ ((__alias__ (#sym)))
#endif
# 553 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#ifdef __STDC__
#define __weak_reference(sym,alias) \
__asm__(".weak " #alias); \
__asm__(".equ " #alias ", " #sym)
#define __warn_references(sym,msg) \
__asm__(".section .gnu.warning." #sym); \
__asm__(".asciz \"" msg "\""); \
__asm__(".previous")
#define __sym_compat(sym,impl,verid) \
__asm__(".symver " #impl ", " #sym "@" #verid)
#define __sym_default(sym,impl,verid) \
__asm__(".symver " #impl ", " #sym "@@" #verid)
#else
# 566 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#define __weak_reference(sym,alias) \
__asm__(".weak alias"); \
__asm__(".equ alias, sym")
#define __warn_references(sym,msg) \
__asm__(".section .gnu.warning.sym"); \
__asm__(".asciz \"msg\""); \
__asm__(".previous")
#define __sym_compat(sym,impl,verid) \
__asm__(".symver impl, sym@verid")
#define __sym_default(impl,sym,verid) \
__asm__(".symver impl, sym@@verid")
#endif /* __STDC__ */
# 578 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#endif /* __GNUC__ || __INTEL_COMPILER */
# 579 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#define __GLOBL1(sym) __asm__(".globl " #sym)
#define __GLOBL(sym) __GLOBL1(sym)
#if defined(__GNUC__) || defined(__INTEL_COMPILER)
#define __IDSTRING(name,string) __asm__(".ident\t\"" string "\"")
#else
# 586 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
/*
* The following definition might not work well if used in header files,
* but it should be better than nothing. If you want a "do nothing"
* version, then it should generate some harmless declaration, such as:
* #define __IDSTRING(name,string) struct __hack
*/
#define __IDSTRING(name,string) static const char name[] __unused = string
#endif
# 594 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
/*
* Embed the rcs id of a source file in the resulting library. Note that in
* more recent ELF binutils, we use .ident allowing the ID to be stripped.
* Usage:
* __FBSDID("$FreeBSD$");
*/
#ifndef __FBSDID
#if !defined(lint) && !defined(STRIP_FBSDID)
#define __FBSDID(s) __IDSTRING(__CONCAT(__rcsid_,__LINE__),s)
#else
# 605 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#define __FBSDID(s) struct __hack
#endif
# 607 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#endif
# 608 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#ifndef __RCSID
#ifndef NO__RCSID
#define __RCSID(s) __IDSTRING(__CONCAT(__rcsid_,__LINE__),s)
#else
# 613 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#define __RCSID(s) struct __hack
#endif
# 615 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#endif
# 616 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#ifndef __RCSID_SOURCE
#ifndef NO__RCSID_SOURCE
#define __RCSID_SOURCE(s) __IDSTRING(__CONCAT(__rcsid_source_,__LINE__),s)
#else
# 621 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#define __RCSID_SOURCE(s) struct __hack
#endif
# 623 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#endif
# 624 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#ifndef __SCCSID
#ifndef NO__SCCSID
#define __SCCSID(s) __IDSTRING(__CONCAT(__sccsid_,__LINE__),s)
#else
# 629 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#define __SCCSID(s) struct __hack
#endif
# 631 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#endif
# 632 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#ifndef __COPYRIGHT
#ifndef NO__COPYRIGHT
#define __COPYRIGHT(s) __IDSTRING(__CONCAT(__copyright_,__LINE__),s)
#else
# 637 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#define __COPYRIGHT(s) struct __hack
#endif
# 639 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#endif
# 640 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#ifndef __DECONST
#if !__has_feature(capabilities)
#define __DECONST(type, var) ((type)(__uintptr_t)(const void *)(var))
#else
# 645 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#define __DECONST(type, var) ((type)(__intcap_t)(__capability const void *)(var))
#endif
# 647 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#endif
# 648 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#ifndef __DEVOLATILE
#if !__has_feature(capabilities)
#define __DEVOLATILE(type, var) ((type)(__uintptr_t)(volatile void *)(var))
#else
# 653 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#define __DEVOLATILE(type, var) ((type)(__intcap_t)(__capability volatile void *)(var))
#endif
# 655 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#endif
# 656 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#ifndef __DEQUALIFY
#if !__has_feature(capabilities)
#define __DEQUALIFY(type, var) ((type)(__uintptr_t)(const volatile void *)(var))
#else
# 661 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#define __DEQUALIFY(type, var) ((type)(__intcap_t)(__capability const volatile void *)(var))
#endif
# 663 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#endif
# 664 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
/*-
* The following definitions are an extension of the behavior originally
* implemented in <sys/_posix.h>, but with a different level of granularity.
* POSIX.1 requires that the macros we test be defined before any standard
* header file is included.
*
* Here's a quick run-down of the versions:
* defined(_POSIX_SOURCE) 1003.1-1988
* _POSIX_C_SOURCE == 1 1003.1-1990
* _POSIX_C_SOURCE == 2 1003.2-1992 C Language Binding Option
* _POSIX_C_SOURCE == 199309 1003.1b-1993
* _POSIX_C_SOURCE == 199506 1003.1c-1995, 1003.1i-1995,
* and the omnibus ISO/IEC 9945-1: 1996
* _POSIX_C_SOURCE == 200112 1003.1-2001
* _POSIX_C_SOURCE == 200809 1003.1-2008
*
* In addition, the X/Open Portability Guide, which is now the Single UNIX
* Specification, defines a feature-test macro which indicates the version of
* that specification, and which subsumes _POSIX_C_SOURCE.
*
* Our macros begin with two underscores to avoid namespace screwage.
*/
/* Deal with IEEE Std. 1003.1-1990, in which _POSIX_C_SOURCE == 1. */
#if defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE == 1
#undef _POSIX_C_SOURCE /* Probably illegal, but beyond caring now. */
#define _POSIX_C_SOURCE 199009
#endif
# 693 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
/* Deal with IEEE Std. 1003.2-1992, in which _POSIX_C_SOURCE == 2. */
#if defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE == 2
#undef _POSIX_C_SOURCE
#define _POSIX_C_SOURCE 199209
#endif
# 699 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
/* Deal with various X/Open Portability Guides and Single UNIX Spec. */
#ifdef _XOPEN_SOURCE
#if _XOPEN_SOURCE - 0 >= 700
#define __XSI_VISIBLE 700
#undef _POSIX_C_SOURCE
#define _POSIX_C_SOURCE 200809
#elif _XOPEN_SOURCE - 0 >= 600
# 707 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#define __XSI_VISIBLE 600
#undef _POSIX_C_SOURCE
#define _POSIX_C_SOURCE 200112
#elif _XOPEN_SOURCE - 0 >= 500
# 711 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#define __XSI_VISIBLE 500
#undef _POSIX_C_SOURCE
#define _POSIX_C_SOURCE 199506
#endif
# 715 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#endif
# 716 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
/*
* Deal with all versions of POSIX. The ordering relative to the tests above is
* important.
*/
#if defined(_POSIX_SOURCE) && !defined(_POSIX_C_SOURCE)
#define _POSIX_C_SOURCE 198808
#endif
# 724 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#ifdef _POSIX_C_SOURCE
#if _POSIX_C_SOURCE >= 200809
#define __POSIX_VISIBLE 200809
#define __ISO_C_VISIBLE 1999
#elif _POSIX_C_SOURCE >= 200112
# 729 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#define __POSIX_VISIBLE 200112
#define __ISO_C_VISIBLE 1999
#elif _POSIX_C_SOURCE >= 199506
# 732 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#define __POSIX_VISIBLE 199506
#define __ISO_C_VISIBLE 1990
#elif _POSIX_C_SOURCE >= 199309
# 735 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#define __POSIX_VISIBLE 199309
#define __ISO_C_VISIBLE 1990
#elif _POSIX_C_SOURCE >= 199209
# 738 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#define __POSIX_VISIBLE 199209
#define __ISO_C_VISIBLE 1990
#elif _POSIX_C_SOURCE >= 199009
# 741 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#define __POSIX_VISIBLE 199009
#define __ISO_C_VISIBLE 1990
#else
# 744 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#define __POSIX_VISIBLE 198808
#define __ISO_C_VISIBLE 0
#endif /* _POSIX_C_SOURCE */
# 747 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#else
# 748 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
/*-
* Deal with _ANSI_SOURCE:
* If it is defined, and no other compilation environment is explicitly
* requested, then define our internal feature-test macros to zero. This
* makes no difference to the preprocessor (undefined symbols in preprocessing
* expressions are defined to have value zero), but makes it more convenient for
* a test program to print out the values.
*
* If a program mistakenly defines _ANSI_SOURCE and some other macro such as
* _POSIX_C_SOURCE, we will assume that it wants the broader compilation
* environment (and in fact we will never get here).
*/
#if defined(_ANSI_SOURCE) /* Hide almost everything. */
#define __POSIX_VISIBLE 0
#define __XSI_VISIBLE 0
#define __BSD_VISIBLE 0
#define __ISO_C_VISIBLE 1990
#define __EXT1_VISIBLE 0
#elif defined(_C99_SOURCE) /* Localism to specify strict C99 env. */
# 767 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#define __POSIX_VISIBLE 0
#define __XSI_VISIBLE 0
#define __BSD_VISIBLE 0
#define __ISO_C_VISIBLE 1999
#define __EXT1_VISIBLE 0
#elif defined(_C11_SOURCE) /* Localism to specify strict C11 env. */
# 773 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#define __POSIX_VISIBLE 0
#define __XSI_VISIBLE 0
#define __BSD_VISIBLE 0
#define __ISO_C_VISIBLE 2011
#define __EXT1_VISIBLE 0
#else /* Default environment: show everything. */
# 779 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#define __POSIX_VISIBLE 200809
#define __XSI_VISIBLE 700
#define __BSD_VISIBLE 1
#define __ISO_C_VISIBLE 2011
#define __EXT1_VISIBLE 1
#endif
# 785 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#endif
# 786 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
/* User override __EXT1_VISIBLE */
#if defined(__STDC_WANT_LIB_EXT1__)
#undef __EXT1_VISIBLE
#if __STDC_WANT_LIB_EXT1__
#define __EXT1_VISIBLE 1
#else
# 793 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#define __EXT1_VISIBLE 0
#endif
# 795 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#endif /* __STDC_WANT_LIB_EXT1__ */
# 796 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#if defined(__mips) || defined(__powerpc64__) || defined(__riscv__)
#define __NO_TLS 1
#endif
# 800 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
/*
* Old versions of GCC use non-standard ARM arch symbols; acle-compat.h
* translates them to __ARM_ARCH and the modern feature symbols defined by ARM.
*/
#if defined(__arm__) && !defined(__ARM_ARCH)
#if 0 /* expanded by -frewrite-includes */
#include <machine/acle-compat.h>
#endif /* expanded by -frewrite-includes */
# 806 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
# 807 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#endif
# 808 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
/*
* Nullability qualifiers: currently only supported by Clang.
*/
#if !(defined(__clang__) && __has_feature(nullability))
#define _Nonnull
#define _Nullable
#define _Null_unspecified
#define __NULLABILITY_PRAGMA_PUSH
#define __NULLABILITY_PRAGMA_POP
#else
# 819 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#define __NULLABILITY_PRAGMA_PUSH _Pragma("clang diagnostic push") \
_Pragma("clang diagnostic ignored \"-Wnullability-completeness\"")
#define __NULLABILITY_PRAGMA_POP _Pragma("clang diagnostic pop")
#endif
# 823 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
/*
* Type Safety Checking
*
* Clang provides additional attributes to enable checking type safety
* properties that cannot be enforced by the C type system.
*/
#if __has_attribute(__argument_with_type_tag__) && \
__has_attribute(__type_tag_for_datatype__) && !defined(lint)
#define __arg_type_tag(arg_kind, arg_idx, type_tag_idx) \
__attribute__((__argument_with_type_tag__(arg_kind, arg_idx, type_tag_idx)))
#define __datatype_type_tag(kind, type) \
__attribute__((__type_tag_for_datatype__(kind, type)))
#else
# 838 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#define __arg_type_tag(arg_kind, arg_idx, type_tag_idx)
#define __datatype_type_tag(kind, type)
#endif
# 841 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
/*
* Lock annotations.
*
* Clang provides support for doing basic thread-safety tests at
* compile-time, by marking which locks will/should be held when
* entering/leaving a functions.
*
* Furthermore, it is also possible to annotate variables and structure
* members to enforce that they are only accessed when certain locks are
* held.
*/
#if __has_extension(c_thread_safety_attributes)
#define __lock_annotate(x) __attribute__((x))
#else
# 857 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#define __lock_annotate(x)
#endif
# 859 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
/* Structure implements a lock. */
#define __lockable __lock_annotate(lockable)
/* Function acquires an exclusive or shared lock. */
#define __locks_exclusive(...) \
__lock_annotate(exclusive_lock_function(__VA_ARGS__))
#define __locks_shared(...) \
__lock_annotate(shared_lock_function(__VA_ARGS__))
/* Function attempts to acquire an exclusive or shared lock. */
#define __trylocks_exclusive(...) \
__lock_annotate(exclusive_trylock_function(__VA_ARGS__))
#define __trylocks_shared(...) \
__lock_annotate(shared_trylock_function(__VA_ARGS__))
/* Function releases a lock. */
#define __unlocks(...) __lock_annotate(unlock_function(__VA_ARGS__))
/* Function asserts that an exclusive or shared lock is held. */
#define __asserts_exclusive(...) \
__lock_annotate(assert_exclusive_lock(__VA_ARGS__))
#define __asserts_shared(...) \
__lock_annotate(assert_shared_lock(__VA_ARGS__))
/* Function requires that an exclusive or shared lock is or is not held. */
#define __requires_exclusive(...) \
__lock_annotate(exclusive_locks_required(__VA_ARGS__))
#define __requires_shared(...) \
__lock_annotate(shared_locks_required(__VA_ARGS__))
#define __requires_unlocked(...) \
__lock_annotate(locks_excluded(__VA_ARGS__))
/* Function should not be analyzed. */
#define __no_lock_analysis __lock_annotate(no_thread_safety_analysis)
/* Guard variables and structure members by lock. */
#define __guarded_by(x) __lock_annotate(guarded_by(x))
#define __pt_guarded_by(x) __lock_annotate(pt_guarded_by(x))
/* Specify that a file requires capabilities */
#if __has_feature(capabilities)
#define __REQUIRE_CAPABILITIES
#else
# 903 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#define __REQUIRE_CAPABILITIES \
_Pragma("GCC error \"This file requires a capability-aware compiler\"")
#endif
# 906 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
#endif /* !_SYS_CDEFS_H_ */
# 908 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/cdefs.h" 3 4
# 37 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/stdlib.h" 2 3 4
#if 0 /* expanded by -frewrite-includes */
#include <sys/_null.h>
#endif /* expanded by -frewrite-includes */
# 37 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/stdlib.h" 3 4
# 1 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/_null.h" 1 3 4
/*-
* Copyright (c) 2003 Marcel Moolenaar
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $FreeBSD$
*/
#ifndef NULL
#if !defined(__cplusplus)
#define NULL ((void *)0)
#else
# 34 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/_null.h" 3 4
#if __cplusplus >= 201103L
#define NULL nullptr
#elif defined(__GNUG__) && defined(__GNUC__) && __GNUC__ >= 4
# 37 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/_null.h" 3 4
#define NULL __null
#else
# 39 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/_null.h" 3 4
#if defined(__LP64__)
#define NULL (0L)
#else
# 42 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/_null.h" 3 4
#define NULL 0
#endif /* __LP64__ */
# 44 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/_null.h" 3 4
#endif /* __GNUG__ */
# 45 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/_null.h" 3 4
#endif /* !__cplusplus */
# 46 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/_null.h" 3 4
#endif
# 48 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/_null.h" 3 4
# 38 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/stdlib.h" 2 3 4
#if 0 /* expanded by -frewrite-includes */
#include <sys/_types.h>
#endif /* expanded by -frewrite-includes */
# 38 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/stdlib.h" 3 4
# 1 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/_types.h" 1 3 4
/*-
* Copyright (c) 2002 Mike Barcroft <[email protected]>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $FreeBSD$
*/
#ifndef _SYS__TYPES_H_
#define _SYS__TYPES_H_
#if 0 /* expanded by -frewrite-includes */
#include <sys/cdefs.h>
#endif /* expanded by -frewrite-includes */
# 32 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/_types.h" 3 4
# 33 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/_types.h" 3 4
#if 0 /* expanded by -frewrite-includes */
#include <machine/_types.h>
#endif /* expanded by -frewrite-includes */
# 33 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/_types.h" 3 4
# 1 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/machine/_types.h" 1 3 4
/*-
* Copyright (c) 2002 Mike Barcroft <[email protected]>
* Copyright (c) 1990, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* From: @(#)ansi.h 8.2 (Berkeley) 1/4/94
* From: @(#)types.h 8.3 (Berkeley) 1/5/94
* from: src/sys/i386/include/_types.h,v 1.12 2005/07/02 23:13:31 thompsa
* $FreeBSD$
*/
#ifndef _MACHINE__TYPES_H_
#define _MACHINE__TYPES_H_
#ifndef _SYS_CDEFS_H_
#error this file needs sys/cdefs.h as a prerequisite
#endif
# 46 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/machine/_types.h" 3 4
/*
* Basic types upon which most other types are built.
*/
typedef signed char __int8_t;
typedef unsigned char __uint8_t;
typedef short __int16_t;
typedef unsigned short __uint16_t;
typedef int __int32_t;
typedef unsigned int __uint32_t;
#ifdef __mips_n64
typedef long __int64_t;
typedef unsigned long __uint64_t;
#else
# 60 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/machine/_types.h" 3 4
#ifndef lint
__extension__
#endif
# 63 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/machine/_types.h" 3 4
/* LONGLONG */
typedef long long __int64_t;
#ifndef lint
__extension__
#endif
# 68 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/machine/_types.h" 3 4
/* LONGLONG */
typedef unsigned long long __uint64_t;
#endif
# 71 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/machine/_types.h" 3 4
/*
* Standard type definitions.
*/
typedef __int32_t __clock_t; /* clock()... */
typedef double __double_t;
typedef float __float_t;
#ifdef __mips_n64
#ifndef __CHERI_PURE_CAPABILITY__
typedef __int64_t __critical_t;
typedef __int64_t __intfptr_t;
typedef __int64_t __intptr_t;
#else
# 84 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/machine/_types.h" 3 4
typedef __intcap_t __critical_t;
typedef __intcap_t __intfptr_t;
typedef __intcap_t __intptr_t;
#endif
# 88 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/machine/_types.h" 3 4
#else
# 89 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/machine/_types.h" 3 4
typedef __int32_t __critical_t;
typedef __int32_t __intfptr_t;
typedef __int32_t __intptr_t;
#endif
# 93 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/machine/_types.h" 3 4
typedef __int64_t __intmax_t;
typedef __int32_t __int_fast8_t;
typedef __int32_t __int_fast16_t;
typedef __int32_t __int_fast32_t;
typedef __int64_t __int_fast64_t;
typedef __int8_t __int_least8_t;
typedef __int16_t __int_least16_t;
typedef __int32_t __int_least32_t;
typedef __int64_t __int_least64_t;
#if defined(__mips_n64) || defined(__mips_n32)
typedef __int64_t __register_t;
typedef __int64_t f_register_t;
#else
# 106 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/machine/_types.h" 3 4
typedef __int32_t __register_t;
typedef __int32_t f_register_t;
#endif
# 109 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/machine/_types.h" 3 4
#ifdef __mips_n64
typedef __int64_t __ptrdiff_t;
typedef __int64_t __segsz_t;
typedef __uint64_t __size_t;
typedef __int64_t __ssize_t;
#ifndef __CHERI_PURE_CAPABILITY__
typedef __uint64_t __uintfptr_t;
typedef __uint64_t __uintptr_t;
#else
# 118 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/machine/_types.h" 3 4
typedef __uintcap_t __uintfptr_t;
typedef __uintcap_t __uintptr_t;
#endif
# 121 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/machine/_types.h" 3 4
#else
# 122 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/machine/_types.h" 3 4
typedef __int32_t __ptrdiff_t; /* ptr1 - ptr2 */
typedef __int32_t __segsz_t; /* segment size (in pages) */
typedef __uint32_t __size_t; /* sizeof() */
typedef __int32_t __ssize_t; /* byte count or error */
typedef __uint32_t __uintfptr_t;
typedef __uint32_t __uintptr_t;
#endif
# 129 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/machine/_types.h" 3 4
typedef __int64_t __time_t; /* time()... */
typedef __uint64_t __uintmax_t;
typedef __uint32_t __uint_fast8_t;
typedef __uint32_t __uint_fast16_t;
typedef __uint32_t __uint_fast32_t;
typedef __uint64_t __uint_fast64_t;
typedef __uint8_t __uint_least8_t;
typedef __uint16_t __uint_least16_t;
typedef __uint32_t __uint_least32_t;
typedef __uint64_t __uint_least64_t;
#if defined(__mips_n64) || defined(__mips_n32)
typedef __uint64_t __u_register_t;
#else
# 142 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/machine/_types.h" 3 4
typedef __uint32_t __u_register_t;
#endif
# 144 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/machine/_types.h" 3 4
#ifdef __mips_n64
typedef __uint64_t __vm_offset_t;
typedef __uint64_t __vm_size_t;
#else
# 148 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/machine/_types.h" 3 4
typedef __uint32_t __vm_offset_t;
typedef __uint32_t __vm_size_t;
#endif
# 151 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/machine/_types.h" 3 4
#if defined(__mips_n64) || defined(__mips_n32) /* PHYSADDR_64_BIT */
typedef __uint64_t __vm_paddr_t;
#else
# 154 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/machine/_types.h" 3 4
typedef __uint32_t __vm_paddr_t;
#endif
# 156 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/machine/_types.h" 3 4
typedef int ___wchar_t;
#define __WCHAR_MIN __INT_MIN /* min value for a wchar_t */
#define __WCHAR_MAX __INT_MAX /* max value for a wchar_t */
/*
* Unusual type definitions.
*/
#ifdef __GNUCLIKE_BUILTIN_VARARGS
typedef __builtin_va_list __va_list; /* internally known to gcc */
#else
# 168 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/machine/_types.h" 3 4
typedef char * __va_list;
#endif /* __GNUCLIKE_BUILTIN_VARARGS */
# 170 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/machine/_types.h" 3 4
#if defined(__GNUC_VA_LIST_COMPATIBILITY) && !defined(__GNUC_VA_LIST) \
&& !defined(__NO_GNUC_VA_LIST)
#define __GNUC_VA_LIST
typedef __va_list __gnuc_va_list; /* compatibility w/GNU headers*/
#endif
# 175 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/machine/_types.h" 3 4
#endif /* !_MACHINE__TYPES_H_ */
# 177 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/machine/_types.h" 3 4
# 34 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/_types.h" 2 3 4
/*
* Standard type definitions.
*/
typedef __int32_t __blksize_t; /* file block size */
typedef __int64_t __blkcnt_t; /* file block count */
typedef __int32_t __clockid_t; /* clock_gettime()... */
typedef __uint32_t __fflags_t; /* file flags */
typedef __uint64_t __fsblkcnt_t;
typedef __uint64_t __fsfilcnt_t;
typedef __uint32_t __gid_t;
typedef __int64_t __id_t; /* can hold a gid_t, pid_t, or uid_t */
typedef __uint64_t __ino_t; /* inode number */
typedef long __key_t; /* IPC key (for Sys V IPC) */
typedef __int32_t __lwpid_t; /* Thread ID (a.k.a. LWP) */
typedef __uint16_t __mode_t; /* permissions */
typedef int __accmode_t; /* access permissions */
typedef int __nl_item;
typedef __uint64_t __nlink_t; /* link count */
typedef __int64_t __off_t; /* file offset */
typedef __int64_t __off64_t; /* file offset (alias) */
typedef __int32_t __pid_t; /* process [group] */
typedef __int64_t __rlim_t; /* resource limit - intentionally */
/* signed, because of legacy code */
/* that uses -1 for RLIM_INFINITY */
typedef __uint8_t __sa_family_t;
typedef __uint32_t __socklen_t;
typedef long __suseconds_t; /* microseconds (signed) */
typedef struct __timer *__timer_t; /* timer_gettime()... */
typedef struct __mq *__mqd_t; /* mq_open()... */
typedef __uint32_t __uid_t;
typedef unsigned int __useconds_t; /* microseconds (unsigned) */
typedef int __cpuwhich_t; /* which parameter for cpuset. */
typedef int __cpulevel_t; /* level parameter for cpuset. */
typedef int __cpusetid_t; /* cpuset identifier. */
/*
* Unusual type definitions.
*/
/*
* rune_t is declared to be an ``int'' instead of the more natural
* ``unsigned long'' or ``long''. Two things are happening here. It is not
* unsigned so that EOF (-1) can be naturally assigned to it and used. Also,
* it looks like 10646 will be a 31 bit standard. This means that if your
* ints cannot hold 32 bits, you will be in trouble. The reason an int was
* chosen over a long is that the is*() and to*() routines take ints (says
* ANSI C), but they use __ct_rune_t instead of int.
*
* NOTE: rune_t is not covered by ANSI nor other standards, and should not
* be instantiated outside of lib/libc/locale. Use wchar_t. wint_t and
* rune_t must be the same type. Also, wint_t should be able to hold all
* members of the largest character set plus one extra value (WEOF), and
* must be at least 16 bits.
*/
typedef int __ct_rune_t; /* arg type for ctype funcs */
typedef __ct_rune_t __rune_t; /* rune_t (see above) */
typedef __ct_rune_t __wint_t; /* wint_t (see above) */
/* Clang already provides these types as built-ins, but only in C++ mode. */
#if !defined(__clang__) || !defined(__cplusplus)
typedef __uint_least16_t __char16_t;
typedef __uint_least32_t __char32_t;
#endif
# 97 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/_types.h" 3 4
/* In C++11, char16_t and char32_t are built-in types. */
#if defined(__cplusplus) && __cplusplus >= 201103L
#define _CHAR16_T_DECLARED
#define _CHAR32_T_DECLARED
#endif
# 102 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/_types.h" 3 4
typedef struct {
long long __max_align1 __aligned(_Alignof(long long));
long double __max_align2 __aligned(_Alignof(long double));
} __max_align_t;
typedef __uint64_t __dev_t; /* device number */
typedef __uint32_t __fixpt_t; /* fixed point number */
/*
* mbstate_t is an opaque object to keep conversion state during multibyte
* stream conversions.
*/
typedef union {
char __mbstate8[128];
__int64_t _mbstateL; /* for alignment */
} __mbstate_t;
typedef __uintmax_t __rman_res_t;
/*
* When the following macro is defined, the system uses 64-bit inode numbers.
* Programs can use this to avoid including <sys/param.h>, with its associated
* namespace pollution.
*/
#define __INO64
#endif /* !_SYS__TYPES_H_ */
# 131 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/_types.h" 3 4
# 39 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/stdlib.h" 2 3 4
__NULLABILITY_PRAGMA_PUSH
#if __BSD_VISIBLE
#ifndef _RUNE_T_DECLARED
typedef __rune_t rune_t;
#define _RUNE_T_DECLARED
#endif
# 47 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/stdlib.h" 3 4
#endif
# 48 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/stdlib.h" 3 4
#ifndef _SIZE_T_DECLARED
typedef __size_t size_t;
#define _SIZE_T_DECLARED
#endif
# 53 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/stdlib.h" 3 4
#ifndef __cplusplus
#ifndef _WCHAR_T_DECLARED
typedef ___wchar_t wchar_t;
#define _WCHAR_T_DECLARED
#endif
# 59 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/stdlib.h" 3 4
#endif
# 60 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/stdlib.h" 3 4
typedef struct {
int quot; /* quotient */
int rem; /* remainder */
} div_t;
typedef struct {
long quot;
long rem;
} ldiv_t;
#define EXIT_FAILURE 1
#define EXIT_SUCCESS 0
#define RAND_MAX 0x7ffffffd
__BEGIN_DECLS
#ifdef _XLOCALE_H_
#if 0 /* expanded by -frewrite-includes */
#include <xlocale/_stdlib.h>
#endif /* expanded by -frewrite-includes */
# 78 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/stdlib.h" 3 4
# 79 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/stdlib.h" 3 4
#endif
# 80 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/stdlib.h" 3 4
extern int __mb_cur_max;
extern int ___mb_cur_max(void);
#define MB_CUR_MAX ((size_t)___mb_cur_max())
_Noreturn void abort(void);
int abs(int) __pure2;
int atexit(void (* _Nonnull)(void));
double atof(const char *);
int atoi(const char *);
long atol(const char *);
void *bsearch(const void *, const void *, size_t,
size_t, int (*)(const void * _Nonnull, const void *));
void *calloc(size_t, size_t) __malloc_like __result_use_check
__alloc_size(1) __alloc_size(2);
div_t div(int, int) __pure2;
_Noreturn void exit(int);
void free(void *);
char *getenv(const char *);
long labs(long) __pure2;
ldiv_t ldiv(long, long) __pure2;
void *malloc(size_t) __malloc_like __result_use_check __alloc_size(1);
int mblen(const char *, size_t);
size_t mbstowcs(wchar_t * __restrict , const char * __restrict, size_t);
int mbtowc(wchar_t * __restrict, const char * __restrict, size_t);
void qsort(void *, size_t, size_t,
int (* _Nonnull)(const void *, const void *));
int rand(void);
void *realloc(void *, size_t) __result_use_check __alloc_size(2);
void srand(unsigned);
double strtod(const char * __restrict, char ** __restrict);
float strtof(const char * __restrict, char ** __restrict);
long strtol(const char * __restrict, char ** __restrict, int);
long double
strtold(const char * __restrict, char ** __restrict);
unsigned long
strtoul(const char * __restrict, char ** __restrict, int);
int system(const char *);
int wctomb(char *, wchar_t);
size_t wcstombs(char * __restrict, const wchar_t * __restrict, size_t);
/*
* Functions added in C99 which we make conditionally available in the
* BSD^C89 namespace if the compiler supports `long long'.
* The #if test is more complicated than it ought to be because
* __BSD_VISIBLE implies __ISO_C_VISIBLE == 1999 *even if* `long long'
* is not supported in the compilation environment (which therefore means
* that it can't really be ISO C99).
*
* (The only other extension made by C99 in thie header is _Exit().)
*/
#if __ISO_C_VISIBLE >= 1999 || defined(__cplusplus)
#ifdef __LONG_LONG_SUPPORTED
/* LONGLONG */
typedef struct {
long long quot;
long long rem;
} lldiv_t;
/* LONGLONG */
long long
atoll(const char *);
/* LONGLONG */
long long
llabs(long long) __pure2;
/* LONGLONG */
lldiv_t lldiv(long long, long long) __pure2;
/* LONGLONG */
long long
strtoll(const char * __restrict, char ** __restrict, int);
/* LONGLONG */
unsigned long long
strtoull(const char * __restrict, char ** __restrict, int);
#endif /* __LONG_LONG_SUPPORTED */
# 153 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/stdlib.h" 3 4
_Noreturn void _Exit(int);
#endif /* __ISO_C_VISIBLE >= 1999 */
# 156 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/stdlib.h" 3 4
/*
* If we're in a mode greater than C99, expose C11 functions.
*/
#if __ISO_C_VISIBLE >= 2011 || __cplusplus >= 201103L
void * aligned_alloc(size_t, size_t) __malloc_like __alloc_align(1)
__alloc_size(2);
int at_quick_exit(void (*)(void));
_Noreturn void
quick_exit(int);
#endif /* __ISO_C_VISIBLE >= 2011 */
# 167 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/stdlib.h" 3 4
/*
* Extensions made by POSIX relative to C.
*/
#if __POSIX_VISIBLE >= 199506 || __XSI_VISIBLE
char *realpath(const char * __restrict, char * __restrict);
#endif
# 173 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/stdlib.h" 3 4
#if __POSIX_VISIBLE >= 199506
int rand_r(unsigned *); /* (TSF) */
#endif
# 176 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/stdlib.h" 3 4
#if __POSIX_VISIBLE >= 200112
int posix_memalign(void **, size_t, size_t); /* (ADV) */
int setenv(const char *, const char *, int);
int unsetenv(const char *);
#endif
# 181 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/stdlib.h" 3 4
#if __POSIX_VISIBLE >= 200809 || __XSI_VISIBLE
int getsubopt(char **, char *const *, char **);
#ifndef _MKDTEMP_DECLARED
char *mkdtemp(char *);
#define _MKDTEMP_DECLARED
#endif
# 188 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/stdlib.h" 3 4
#ifndef _MKSTEMP_DECLARED
int mkstemp(char *);
#define _MKSTEMP_DECLARED
#endif
# 192 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/stdlib.h" 3 4
#endif /* __POSIX_VISIBLE >= 200809 || __XSI_VISIBLE */
# 193 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/stdlib.h" 3 4
/*
* The only changes to the XSI namespace in revision 6 were the deletion
* of the ttyslot() and valloc() functions, which FreeBSD never declared
* in this header. For revision 7, ecvt(), fcvt(), and gcvt(), which
* FreeBSD also does not have, and mktemp(), are to be deleted.
*/
#if __XSI_VISIBLE
/* XXX XSI requires pollution from <sys/wait.h> here. We'd rather not. */
long a64l(const char *);
double drand48(void);
/* char *ecvt(double, int, int * __restrict, int * __restrict); */
double erand48(unsigned short[3]);
/* char *fcvt(double, int, int * __restrict, int * __restrict); */
/* char *gcvt(double, int, int * __restrict, int * __restrict); */
int grantpt(int);
char *initstate(unsigned int, char *, size_t);
long jrand48(unsigned short[3]);
char *l64a(long);
void lcong48(unsigned short[7]);
long lrand48(void);
#if !defined(_MKTEMP_DECLARED) && (__BSD_VISIBLE || __XSI_VISIBLE <= 600)
char *mktemp(char *);
#define _MKTEMP_DECLARED
#endif
# 218 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/stdlib.h" 3 4
long mrand48(void);
long nrand48(unsigned short[3]);
int posix_openpt(int);
char *ptsname(int);
int putenv(char *);
long random(void);
unsigned short
*seed48(unsigned short[3]);
char *setstate(/* const */ char *);
void srand48(long);
void srandom(unsigned int);
int unlockpt(int);
#endif /* __XSI_VISIBLE */
# 231 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/stdlib.h" 3 4
#if __BSD_VISIBLE
extern const char *malloc_conf;
extern void (*malloc_message)(void *, const char *);
/*
* The alloca() function can't be implemented in C, and on some
* platforms it can't be implemented at all as a callable function.
* The GNU C compiler provides a built-in alloca() which we can use;
* in all other cases, provide a prototype, mainly to pacify various
* incarnations of lint. On platforms where alloca() is not in libc,
* programs which use it will fail to link when compiled with non-GNU
* compilers.
*/
#if __GNUC__ >= 2 || defined(__INTEL_COMPILER)
#undef alloca /* some GNU bits try to get cute and define this on their own */
#define alloca(sz) __builtin_alloca(sz)
#elif defined(lint)
# 249 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/stdlib.h" 3 4
void *alloca(size_t);
#endif
# 251 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/stdlib.h" 3 4
void abort2(const char *, int, void **) __dead2;
__uint32_t
arc4random(void);
void arc4random_addrandom(unsigned char *, int);
void arc4random_buf(void *, size_t);
void arc4random_stir(void);
__uint32_t
arc4random_uniform(__uint32_t);
#ifdef __BLOCKS__
int atexit_b(void (^ _Nonnull)(void));
void *bsearch_b(const void *, const void *, size_t,
size_t, int (^ _Nonnull)(const void *, const void *));
#endif
# 265 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/stdlib.h" 3 4
char *getbsize(int *, long *);
/* getcap(3) functions */
char *cgetcap(char *, const char *, int);
int cgetclose(void);
int cgetent(char **, char **, const char *);
int cgetfirst(char **, char **);
int cgetmatch(const char *, const char *);
int cgetnext(char **, char **);
int cgetnum(char *, const char *, long *);
int cgetset(const char *);
int cgetstr(char *, const char *, char **);
int cgetustr(char *, const char *, char **);
int daemon(int, int);
char *devname(__dev_t, __mode_t);
char *devname_r(__dev_t, __mode_t, char *, int);
char *fdevname(int);
char *fdevname_r(int, char *, int);
int getloadavg(double [], int);
const char *
getprogname(void);
int heapsort(void *, size_t, size_t,
int (* _Nonnull)(const void *, const void *));
#ifdef __BLOCKS__
int heapsort_b(void *, size_t, size_t,
int (^ _Nonnull)(const void *, const void *));
void qsort_b(void *, size_t, size_t,
int (^ _Nonnull)(const void *, const void *));
#endif
# 295 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/stdlib.h" 3 4
int l64a_r(long, char *, int);
int mergesort(void *, size_t, size_t, int (*)(const void *, const void *));
#ifdef __BLOCKS__
int mergesort_b(void *, size_t, size_t, int (^)(const void *, const void *));
#endif
# 300 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/stdlib.h" 3 4
int mkostemp(char *, int);
int mkostemps(char *, int, int);
void qsort_r(void *, size_t, size_t, void *,
int (*)(void *, const void *, const void *));
int radixsort(const unsigned char **, int, const unsigned char *,
unsigned);
void *reallocarray(void *, size_t, size_t) __result_use_check __alloc_size(2)
__alloc_size(3);
void *reallocf(void *, size_t) __alloc_size(2);
int rpmatch(const char *);
void setprogname(const char *);
int sradixsort(const unsigned char **, int, const unsigned char *,
unsigned);
void sranddev(void);
void srandomdev(void);
long long
strtonum(const char *, long long, long long, const char **);
/* Deprecated interfaces, to be removed. */
__int64_t
strtoq(const char *, char **, int);
__uint64_t
strtouq(const char *, char **, int);
#if __has_feature(capabilities)
long strtol_c(__capability const char * __restrict,
char * __capability * __capability __restrict, int);
long double
strtold_c(__capability const char * __restrict,
char * __capability * __restrict);
#endif
# 331 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/stdlib.h" 3 4
int timsort(void *base, size_t nel, size_t width,
int (*compar) (const void *, const void *));
extern char *suboptarg; /* getsubopt(3) external variable */
#endif /* __BSD_VISIBLE */
# 337 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/stdlib.h" 3 4
#if __EXT1_VISIBLE
#ifndef _ERRNO_T_DEFINED
#define _ERRNO_T_DEFINED
typedef int errno_t;
#endif
# 344 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/stdlib.h" 3 4
/* K.3.6 */
typedef void (*constraint_handler_t)(const char * __restrict,
void * __restrict, errno_t);
/* K.3.6.1.1 */
constraint_handler_t set_constraint_handler_s(constraint_handler_t handler);
/* K.3.6.1.2 */
_Noreturn void abort_handler_s(const char * __restrict, void * __restrict,
errno_t);
/* K3.6.1.3 */
void ignore_handler_s(const char * __restrict, void * __restrict, errno_t);
#endif /* __EXT1_VISIBLE */
# 356 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/stdlib.h" 3 4
__END_DECLS
__NULLABILITY_PRAGMA_POP
#endif /* !_STDLIB_H_ */
# 361 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/stdlib.h" 3 4
# 20 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/rdopt.c" 2
#if 0 /* expanded by -frewrite-includes */
#include <math.h>
#endif /* expanded by -frewrite-includes */
# 20 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/rdopt.c"
# 1 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/math.h" 1 3 4
/*
* ====================================================
* Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
*
* Developed at SunPro, a Sun Microsystems, Inc. business.
* Permission to use, copy, modify, and distribute this
* software is freely granted, provided that this notice
* is preserved.
* ====================================================
*/
/*
* from: @(#)fdlibm.h 5.1 93/09/24
* $FreeBSD$
*/
#ifndef _MATH_H_
#define _MATH_H_
#if 0 /* expanded by -frewrite-includes */
#include <sys/cdefs.h>
#endif /* expanded by -frewrite-includes */
# 20 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/math.h" 3 4
# 21 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/math.h" 3 4
#if 0 /* expanded by -frewrite-includes */
#include <sys/_types.h>
#endif /* expanded by -frewrite-includes */
# 21 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/math.h" 3 4
# 22 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/math.h" 3 4
#if 0 /* expanded by -frewrite-includes */
#include <machine/_limits.h>
#endif /* expanded by -frewrite-includes */
# 22 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/math.h" 3 4
# 1 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/machine/_limits.h" 1 3 4
/*-
* Copyright (c) 1988, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)limits.h 8.3 (Berkeley) 1/4/94
* from: src/sys/i386/include/_limits.h,v 1.27 2005/01/06 22:18:15 imp
* $FreeBSD$
*/
#ifndef _MACHINE__LIMITS_H_
#define _MACHINE__LIMITS_H_
/*
* According to ANSI (section 2.2.4.2), the values below must be usable by
* #if preprocessing directives. Additionally, the expression must have the
* same type as would an expression that is an object of the corresponding
* type converted according to the integral promotions. The subtraction for
* INT_MIN, etc., is so the value is not unsigned; e.g., 0x80000000 is an
* unsigned int for 32-bit two's complement ANSI compilers (section 3.1.3.2).
*/
#define __CHAR_BIT 8 /* number of bits in a char */
#define __SCHAR_MAX 0x7f /* max value for a signed char */
#define __SCHAR_MIN (-0x7f - 1) /* min value for a signed char */
#define __UCHAR_MAX 0xff /* max value for an unsigned char */
#define __USHRT_MAX 0xffff /* max value for an unsigned short */
#define __SHRT_MAX 0x7fff /* max value for a short */
#define __SHRT_MIN (-0x7fff - 1) /* min value for a short */
#define __UINT_MAX 0xffffffff /* max value for an unsigned int */
#define __INT_MAX 0x7fffffff /* max value for an int */
#define __INT_MIN (-0x7fffffff - 1) /* min value for an int */
#ifdef __mips_n64
#define __ULONG_MAX 0xffffffffffffffff
#define __LONG_MAX 0x7fffffffffffffff
#define __LONG_MIN (-0x7fffffffffffffff - 1)
#define __LONG_BIT 64
#else
# 67 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/machine/_limits.h" 3 4
#define __ULONG_MAX 0xffffffffUL /* max value for an unsigned long */
#define __LONG_MAX 0x7fffffffL /* max value for a long */
#define __LONG_MIN (-0x7fffffffL - 1) /* min value for a long */
#define __LONG_BIT 32
#endif
# 72 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/machine/_limits.h" 3 4
/* max value for an unsigned long long */
#define __ULLONG_MAX 0xffffffffffffffffULL
#define __LLONG_MAX 0x7fffffffffffffffLL /* max value for a long long */
#define __LLONG_MIN (-0x7fffffffffffffffLL - 1) /* min for a long long */
#define __SSIZE_MAX __LONG_MAX /* max value for a ssize_t */
#define __SIZE_T_MAX __ULONG_MAX /* max value for a size_t */
#define __OFF_MAX __LLONG_MAX /* max value for an off_t */
#define __OFF_MIN __LLONG_MIN /* min value for an off_t */
/* Quads and long longs are the same size. Ensure they stay in sync. */
#define __UQUAD_MAX __ULLONG_MAX /* max value for a uquad_t */
#define __QUAD_MAX __LLONG_MAX /* max value for a quad_t */
#define __QUAD_MIN __LLONG_MIN /* min value for a quad_t */
#define __WORD_BIT 32
#define __MINSIGSTKSZ (512 * 4)
#endif /* !_MACHINE__LIMITS_H_ */
# 95 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/machine/_limits.h" 3 4
# 23 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/math.h" 2 3 4
/*
* ANSI/POSIX
*/
extern const union __infinity_un {
unsigned char __uc[8];
double __ud;
} __infinity;
extern const union __nan_un {
unsigned char __uc[sizeof(float)];
float __uf;
} __nan;
#if __GNUC_PREREQ__(3, 3) || (defined(__INTEL_COMPILER) && __INTEL_COMPILER >= 800)
#define __MATH_BUILTIN_CONSTANTS
#endif
# 40 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/math.h" 3 4
#if __GNUC_PREREQ__(3, 0) && !defined(__INTEL_COMPILER)
#define __MATH_BUILTIN_RELOPS
#endif
# 44 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/math.h" 3 4
#ifdef __MATH_BUILTIN_CONSTANTS
#define HUGE_VAL __builtin_huge_val()
#else
# 48 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/math.h" 3 4
#define HUGE_VAL (__infinity.__ud)
#endif
# 50 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/math.h" 3 4
#if __ISO_C_VISIBLE >= 1999
#define FP_ILOGB0 (-__INT_MAX)
#define FP_ILOGBNAN __INT_MAX
#ifdef __MATH_BUILTIN_CONSTANTS
#define HUGE_VALF __builtin_huge_valf()
#define HUGE_VALL __builtin_huge_vall()
#define INFINITY __builtin_inff()
#define NAN __builtin_nanf("")
#else
# 61 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/math.h" 3 4
#define HUGE_VALF (float)HUGE_VAL
#define HUGE_VALL (long double)HUGE_VAL
#define INFINITY HUGE_VALF
#define NAN (__nan.__uf)
#endif /* __MATH_BUILTIN_CONSTANTS */
# 66 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/math.h" 3 4
#define MATH_ERRNO 1
#define MATH_ERREXCEPT 2
#define math_errhandling MATH_ERREXCEPT
#define FP_FAST_FMAF 1
/* Symbolic constants to classify floating point numbers. */
#define FP_INFINITE 0x01
#define FP_NAN 0x02
#define FP_NORMAL 0x04
#define FP_SUBNORMAL 0x08
#define FP_ZERO 0x10
#if (__STDC_VERSION__ >= 201112L && defined(__clang__)) || \
__has_extension(c_generic_selections)
#define __fp_type_select(x, f, d, ld) _Generic((x), \
float: f(x), \
double: d(x), \
long double: ld(x), \
volatile float: f(x), \
volatile double: d(x), \
volatile long double: ld(x), \
volatile const float: f(x), \
volatile const double: d(x), \
volatile const long double: ld(x), \
const float: f(x), \
const double: d(x), \
const long double: ld(x))
#elif __GNUC_PREREQ__(3, 1) && !defined(__cplusplus)
# 96 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/math.h" 3 4
#define __fp_type_select(x, f, d, ld) __builtin_choose_expr( \
__builtin_types_compatible_p(__typeof(x), long double), ld(x), \
__builtin_choose_expr( \
__builtin_types_compatible_p(__typeof(x), double), d(x), \
__builtin_choose_expr( \
__builtin_types_compatible_p(__typeof(x), float), f(x), (void)0)))
#else
# 103 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/math.h" 3 4
#define __fp_type_select(x, f, d, ld) \
((sizeof(x) == sizeof(float)) ? f(x) \
: (sizeof(x) == sizeof(double)) ? d(x) \
: ld(x))
#endif
# 108 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/math.h" 3 4
#define fpclassify(x) \
__fp_type_select(x, __fpclassifyf, __fpclassifyd, __fpclassifyl)
#define isfinite(x) __fp_type_select(x, __isfinitef, __isfinite, __isfinitel)
#define isinf(x) __fp_type_select(x, __isinff, __isinf, __isinfl)
#define isnan(x) \
__fp_type_select(x, __inline_isnanf, __inline_isnan, __inline_isnanl)
#define isnormal(x) __fp_type_select(x, __isnormalf, __isnormal, __isnormall)
#ifdef __MATH_BUILTIN_RELOPS
#define isgreater(x, y) __builtin_isgreater((x), (y))
#define isgreaterequal(x, y) __builtin_isgreaterequal((x), (y))
#define isless(x, y) __builtin_isless((x), (y))
#define islessequal(x, y) __builtin_islessequal((x), (y))
#define islessgreater(x, y) __builtin_islessgreater((x), (y))
#define isunordered(x, y) __builtin_isunordered((x), (y))
#else
# 125 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/math.h" 3 4
#define isgreater(x, y) (!isunordered((x), (y)) && (x) > (y))
#define isgreaterequal(x, y) (!isunordered((x), (y)) && (x) >= (y))
#define isless(x, y) (!isunordered((x), (y)) && (x) < (y))
#define islessequal(x, y) (!isunordered((x), (y)) && (x) <= (y))
#define islessgreater(x, y) (!isunordered((x), (y)) && \
((x) > (y) || (y) > (x)))
#define isunordered(x, y) (isnan(x) || isnan(y))
#endif /* __MATH_BUILTIN_RELOPS */
# 133 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/math.h" 3 4
#define signbit(x) __fp_type_select(x, __signbitf, __signbit, __signbitl)
typedef __double_t double_t;
typedef __float_t float_t;
#endif /* __ISO_C_VISIBLE >= 1999 */
# 139 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/math.h" 3 4
/*
* XOPEN/SVID
*/
#if __BSD_VISIBLE || __XSI_VISIBLE
#define M_E 2.7182818284590452354 /* e */
#define M_LOG2E 1.4426950408889634074 /* log 2e */
#define M_LOG10E 0.43429448190325182765 /* log 10e */
#define M_LN2 0.69314718055994530942 /* log e2 */
#define M_LN10 2.30258509299404568402 /* log e10 */
#define M_PI 3.14159265358979323846 /* pi */
#define M_PI_2 1.57079632679489661923 /* pi/2 */
#define M_PI_4 0.78539816339744830962 /* pi/4 */
#define M_1_PI 0.31830988618379067154 /* 1/pi */
#define M_2_PI 0.63661977236758134308 /* 2/pi */
#define M_2_SQRTPI 1.12837916709551257390 /* 2/sqrt(pi) */
#define M_SQRT2 1.41421356237309504880 /* sqrt(2) */
#define M_SQRT1_2 0.70710678118654752440 /* 1/sqrt(2) */
#define MAXFLOAT ((float)3.40282346638528860e+38)
extern int signgam;
#endif /* __BSD_VISIBLE || __XSI_VISIBLE */
# 161 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/math.h" 3 4
#if __BSD_VISIBLE
#if 0
/* Old value from 4.4BSD-Lite math.h; this is probably better. */
#define HUGE HUGE_VAL
#else
# 167 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/math.h" 3 4
#define HUGE MAXFLOAT
#endif
# 169 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/math.h" 3 4
#endif /* __BSD_VISIBLE */
# 170 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/math.h" 3 4
/*
* Most of these functions depend on the rounding mode and have the side
* effect of raising floating-point exceptions, so they are not declared
* as __pure2. In C99, FENV_ACCESS affects the purity of these functions.
*/
__BEGIN_DECLS
/*
* ANSI/POSIX
*/
int __fpclassifyd(double) __pure2;
int __fpclassifyf(float) __pure2;
int __fpclassifyl(long double) __pure2;
int __isfinitef(float) __pure2;
int __isfinite(double) __pure2;
int __isfinitel(long double) __pure2;
int __isinff(float) __pure2;
int __isinf(double) __pure2;
int __isinfl(long double) __pure2;
int __isnormalf(float) __pure2;
int __isnormal(double) __pure2;
int __isnormall(long double) __pure2;
int __signbit(double) __pure2;
int __signbitf(float) __pure2;
int __signbitl(long double) __pure2;
static __inline int
__inline_isnan(__const double __x)
{
return (__x != __x);
}
static __inline int
__inline_isnanf(__const float __x)
{
return (__x != __x);
}
static __inline int
__inline_isnanl(__const long double __x)
{
return (__x != __x);
}
/*
* Version 2 of the Single UNIX Specification (UNIX98) defined isnan() and
* isinf() as functions taking double. C99, and the subsequent POSIX revisions
* (SUSv3, POSIX.1-2001, define it as a macro that accepts any real floating
* point type. If we are targeting SUSv2 and C99 or C11 (or C++11) then we
* expose the newer definition, assuming that the language spec takes
* precedence over the operating system interface spec.
*/
#if __XSI_VISIBLE > 0 && __XSI_VISIBLE < 600 && __ISO_C_VISIBLE < 1999
#undef isinf
#undef isnan
int isinf(double);
int isnan(double);
#endif
# 231 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/math.h" 3 4
double acos(double);
double asin(double);
double atan(double);
double atan2(double, double);
double cos(double);
double sin(double);
double tan(double);
double cosh(double);
double sinh(double);
double tanh(double);
double exp(double);
double frexp(double, int *); /* fundamentally !__pure2 */
double ldexp(double, int);
double log(double);
double log10(double);
double modf(double, double *); /* fundamentally !__pure2 */
double pow(double, double);
double sqrt(double);
double ceil(double);
double fabs(double) __pure2;
double floor(double);
double fmod(double, double);
/*
* These functions are not in C90.
*/
#if __BSD_VISIBLE || __ISO_C_VISIBLE >= 1999 || __XSI_VISIBLE
double acosh(double);
double asinh(double);
double atanh(double);
double cbrt(double);
double erf(double);
double erfc(double);
double exp2(double);
double expm1(double);
double fma(double, double, double);
double hypot(double, double);
int ilogb(double) __pure2;
double lgamma(double);
long long llrint(double);
long long llround(double);
double log1p(double);
double log2(double);
double logb(double);
long lrint(double);
long lround(double);
double nan(const char *) __pure2;
double nextafter(double, double);
double remainder(double, double);
double remquo(double, double, int *);
double rint(double);
#endif /* __BSD_VISIBLE || __ISO_C_VISIBLE >= 1999 || __XSI_VISIBLE */
# 288 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/math.h" 3 4
#if __BSD_VISIBLE || __XSI_VISIBLE
double j0(double);
double j1(double);
double jn(int, double);
double y0(double);
double y1(double);
double yn(int, double);
#if __XSI_VISIBLE <= 500 || __BSD_VISIBLE
double gamma(double);
#endif
# 300 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/math.h" 3 4
#if __XSI_VISIBLE <= 600 || __BSD_VISIBLE
double scalb(double, double);
#endif
# 304 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/math.h" 3 4
#endif /* __BSD_VISIBLE || __XSI_VISIBLE */
# 305 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/math.h" 3 4
#if __BSD_VISIBLE || __ISO_C_VISIBLE >= 1999
double copysign(double, double) __pure2;
double fdim(double, double);
double fmax(double, double) __pure2;
double fmin(double, double) __pure2;
double nearbyint(double);
double round(double);
double scalbln(double, long);
double scalbn(double, int);
double tgamma(double);
double trunc(double);
#endif
# 318 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/math.h" 3 4
/*
* BSD math library entry points
*/
#if __BSD_VISIBLE
double drem(double, double);
int finite(double) __pure2;
int isnanf(float) __pure2;
/*
* Reentrant version of gamma & lgamma; passes signgam back by reference
* as the second argument; user must allocate space for signgam.
*/
double gamma_r(double, int *);
double lgamma_r(double, int *);
/*
* IEEE Test Vector
*/
double significand(double);
#endif /* __BSD_VISIBLE */
# 339 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/math.h" 3 4
/* float versions of ANSI/POSIX functions */
#if __ISO_C_VISIBLE >= 1999
float acosf(float);
float asinf(float);
float atanf(float);
float atan2f(float, float);
float cosf(float);
float sinf(float);
float tanf(float);
float coshf(float);
float sinhf(float);
float tanhf(float);
float exp2f(float);
float expf(float);
float expm1f(float);
float frexpf(float, int *); /* fundamentally !__pure2 */
int ilogbf(float) __pure2;
float ldexpf(float, int);
float log10f(float);
float log1pf(float);
float log2f(float);
float logf(float);
float modff(float, float *); /* fundamentally !__pure2 */
float powf(float, float);
float sqrtf(float);
float ceilf(float);
float fabsf(float) __pure2;
float floorf(float);
float fmodf(float, float);
float roundf(float);
float erff(float);
float erfcf(float);
float hypotf(float, float);
float lgammaf(float);
float tgammaf(float);
float acoshf(float);
float asinhf(float);
float atanhf(float);
float cbrtf(float);
float logbf(float);
float copysignf(float, float) __pure2;
long long llrintf(float);
long long llroundf(float);
long lrintf(float);
long lroundf(float);
float nanf(const char *) __pure2;
float nearbyintf(float);
float nextafterf(float, float);
float remainderf(float, float);
float remquof(float, float, int *);
float rintf(float);
float scalblnf(float, long);
float scalbnf(float, int);
float truncf(float);
float fdimf(float, float);
float fmaf(float, float, float);
float fmaxf(float, float) __pure2;
float fminf(float, float) __pure2;
#endif
# 406 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/math.h" 3 4
/*
* float versions of BSD math library entry points
*/
#if __BSD_VISIBLE
float dremf(float, float);
int finitef(float) __pure2;
float gammaf(float);
float j0f(float);
float j1f(float);
float jnf(int, float);
float scalbf(float, float);
float y0f(float);
float y1f(float);
float ynf(int, float);
/*
* Float versions of reentrant version of gamma & lgamma; passes
* signgam back by reference as the second argument; user must
* allocate space for signgam.
*/
float gammaf_r(float, int *);
float lgammaf_r(float, int *);
/*
* float version of IEEE Test Vector
*/
float significandf(float);
#endif /* __BSD_VISIBLE */
# 435 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/math.h" 3 4
/*
* long double versions of ISO/POSIX math functions
*/
#if __ISO_C_VISIBLE >= 1999
long double acoshl(long double);
long double acosl(long double);
long double asinhl(long double);
long double asinl(long double);
long double atan2l(long double, long double);
long double atanhl(long double);
long double atanl(long double);
long double cbrtl(long double);
long double ceill(long double);
long double copysignl(long double, long double) __pure2;
long double coshl(long double);
long double cosl(long double);
long double erfcl(long double);
long double erfl(long double);
long double exp2l(long double);
long double expl(long double);
long double expm1l(long double);
long double fabsl(long double) __pure2;
long double fdiml(long double, long double);
long double floorl(long double);
long double fmal(long double, long double, long double);
long double fmaxl(long double, long double) __pure2;
long double fminl(long double, long double) __pure2;
long double fmodl(long double, long double);
long double frexpl(long double, int *); /* fundamentally !__pure2 */
long double hypotl(long double, long double);
int ilogbl(long double) __pure2;
long double ldexpl(long double, int);
long double lgammal(long double);
long long llrintl(long double);
long long llroundl(long double);
long double log10l(long double);
long double log1pl(long double);
long double log2l(long double);
long double logbl(long double);
long double logl(long double);
long lrintl(long double);
long lroundl(long double);
long double modfl(long double, long double *); /* fundamentally !__pure2 */
long double nanl(const char *) __pure2;
long double nearbyintl(long double);
long double nextafterl(long double, long double);
double nexttoward(double, long double);
float nexttowardf(float, long double);
long double nexttowardl(long double, long double);
long double powl(long double, long double);
long double remainderl(long double, long double);
long double remquol(long double, long double, int *);
long double rintl(long double);
long double roundl(long double);
long double scalblnl(long double, long);
long double scalbnl(long double, int);
long double sinhl(long double);
long double sinl(long double);
long double sqrtl(long double);
long double tanhl(long double);
long double tanl(long double);
long double tgammal(long double);
long double truncl(long double);
#endif /* __ISO_C_VISIBLE >= 1999 */
# 500 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/math.h" 3 4
#if __BSD_VISIBLE
long double lgammal_r(long double, int *);
#endif
# 504 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/math.h" 3 4
__END_DECLS
#endif /* !_MATH_H_ */
# 508 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/math.h" 3 4
# 21 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/rdopt.c" 2
#if 0 /* expanded by -frewrite-includes */
#include <assert.h>
#endif /* expanded by -frewrite-includes */
# 21 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/rdopt.c"
# 1 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/assert.h" 1 3 4
/*-
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
* (c) UNIX System Laboratories, Inc.
* All or some portions of this file are derived from material licensed
* to the University of California by American Telephone and Telegraph
* Co. or Unix System Laboratories, Inc. and are reproduced herein with
* the permission of UNIX System Laboratories, Inc.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)assert.h 8.2 (Berkeley) 1/21/94
* $FreeBSD$
*/
#if 0 /* expanded by -frewrite-includes */
#include <sys/cdefs.h>
#endif /* expanded by -frewrite-includes */
# 38 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/assert.h" 3 4
# 39 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/assert.h" 3 4
/*
* Unlike other ANSI header files, <assert.h> may usefully be included
* multiple times, with and without NDEBUG defined.
*/
#undef assert
#undef _assert
#ifdef NDEBUG
#define assert(e) ((void)0)
#define _assert(e) ((void)0)
#else
# 52 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/assert.h" 3 4
#define _assert(e) assert(e)
#define assert(e) ((e) ? (void)0 : __assert(__func__, __FILE__, \
__LINE__, #e))
#endif /* NDEBUG */
# 57 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/assert.h" 3 4
#ifndef _ASSERT_H_
#define _ASSERT_H_
/*
* Static assertions. In principle we could define static_assert for
* C++ older than C++11, but this breaks if _Static_assert is
* implemented as a macro.
*
* C++ template parameters may contain commas, even if not enclosed in
* parentheses, causing the _Static_assert macro to be invoked with more
* than two parameters.
*/
#if __ISO_C_VISIBLE >= 2011 && !defined(__cplusplus)
#define static_assert _Static_assert
#endif
# 73 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/assert.h" 3 4
__BEGIN_DECLS
void __assert(const char *, const char *, int, const char *) __dead2;
__END_DECLS
#endif /* !_ASSERT_H_ */
# 79 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/assert.h" 3 4
# 22 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/rdopt.c" 2
#if 0 /* expanded by -frewrite-includes */
#include <limits.h>
#endif /* expanded by -frewrite-includes */
# 22 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/rdopt.c"
# 1 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/limits.h" 1 3 4
/*-
* Copyright (c) 1988, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)limits.h 8.2 (Berkeley) 1/4/94
* $FreeBSD$
*/
#ifndef _LIMITS_H_
#define _LIMITS_H_
#if 0 /* expanded by -frewrite-includes */
#include <sys/cdefs.h>
#endif /* expanded by -frewrite-includes */
# 36 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/limits.h" 3 4
# 37 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/limits.h" 3 4
#if __POSIX_VISIBLE
#define _POSIX_ARG_MAX 4096
#define _POSIX_LINK_MAX 8
#define _POSIX_MAX_CANON 255
#define _POSIX_MAX_INPUT 255
#define _POSIX_NAME_MAX 14
#define _POSIX_PIPE_BUF 512
#define _POSIX_SSIZE_MAX 32767
#define _POSIX_STREAM_MAX 8
#if __POSIX_VISIBLE >= 200112
#define _POSIX_CHILD_MAX 25
#define _POSIX_NGROUPS_MAX 8
#define _POSIX_OPEN_MAX 20
#define _POSIX_PATH_MAX 256
#define _POSIX_TZNAME_MAX 6
#else
# 55 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/limits.h" 3 4
#define _POSIX_CHILD_MAX 6
#define _POSIX_NGROUPS_MAX 0
#define _POSIX_OPEN_MAX 16
#define _POSIX_PATH_MAX 255
#define _POSIX_TZNAME_MAX 3
#endif
# 61 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/limits.h" 3 4
#if __POSIX_VISIBLE >= 200112
#define BC_BASE_MAX 99 /* max ibase/obase values in bc(1) */
#define BC_DIM_MAX 2048 /* max array elements in bc(1) */
#define BC_SCALE_MAX 99 /* max scale value in bc(1) */
#define BC_STRING_MAX 1000 /* max const string length in bc(1) */
#define CHARCLASS_NAME_MAX 14 /* max character class name size */
#define COLL_WEIGHTS_MAX 10 /* max weights for order keyword */
#define EXPR_NEST_MAX 32 /* max expressions nested in expr(1) */
#define LINE_MAX 2048 /* max bytes in an input line */
#define RE_DUP_MAX 255 /* max RE's in interval notation */
#define _POSIX2_BC_BASE_MAX 99
#define _POSIX2_BC_DIM_MAX 2048
#define _POSIX2_BC_SCALE_MAX 99
#define _POSIX2_BC_STRING_MAX 1000
#define _POSIX2_CHARCLASS_NAME_MAX 14
#define _POSIX2_COLL_WEIGHTS_MAX 2
#define _POSIX2_EQUIV_CLASS_MAX 2
#define _POSIX2_EXPR_NEST_MAX 32
#define _POSIX2_LINE_MAX 2048
#define _POSIX2_RE_DUP_MAX 255
#endif
# 84 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/limits.h" 3 4
#endif
# 85 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/limits.h" 3 4
#if __POSIX_VISIBLE >= 199309
#define _POSIX_AIO_LISTIO_MAX 2
#define _POSIX_AIO_MAX 1
#define _POSIX_DELAYTIMER_MAX 32
#define _POSIX_MQ_OPEN_MAX 8
#define _POSIX_MQ_PRIO_MAX 32
#define _POSIX_RTSIG_MAX 8
#define _POSIX_SEM_NSEMS_MAX 256
#define _POSIX_SEM_VALUE_MAX 32767
#define _POSIX_SIGQUEUE_MAX 32
#define _POSIX_TIMER_MAX 32
#define _POSIX_CLOCKRES_MIN 20000000
#endif
# 100 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/limits.h" 3 4
#if __POSIX_VISIBLE >= 199506
#define _POSIX_THREAD_DESTRUCTOR_ITERATIONS 4
#define _POSIX_THREAD_KEYS_MAX 128
#define _POSIX_THREAD_THREADS_MAX 64
#endif
# 106 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/limits.h" 3 4
#if __POSIX_VISIBLE >= 200112
#define _POSIX_HOST_NAME_MAX 255
#define _POSIX_LOGIN_NAME_MAX 9
#define _POSIX_SS_REPL_MAX 4
#define _POSIX_SYMLINK_MAX 255
#define _POSIX_SYMLOOP_MAX 8
#define _POSIX_TRACE_EVENT_NAME_MAX 30
#define _POSIX_TRACE_NAME_MAX 8
#define _POSIX_TRACE_SYS_MAX 8
#define _POSIX_TRACE_USER_EVENT_MAX 32
#define _POSIX_TTY_NAME_MAX 9
#define _POSIX_RE_DUP_MAX _POSIX2_RE_DUP_MAX
#endif
# 121 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/limits.h" 3 4
#if __XSI_VISIBLE || __POSIX_VISIBLE >= 200809
#define NL_ARGMAX 65536 /* max # of position args for printf */
#define NL_MSGMAX 32767
#define NL_SETMAX 255
#define NL_TEXTMAX 2048
#endif
# 128 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/limits.h" 3 4
#if __XSI_VISIBLE
#define _XOPEN_IOV_MAX 16
#define _XOPEN_NAME_MAX 255
#define _XOPEN_PATH_MAX 1024
#define PASS_MAX 128 /* _PASSWORD_LEN from <pwd.h> */
#define NL_LANGMAX 31 /* max LANG name length */
#define NL_NMAX 1
#endif
# 138 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/limits.h" 3 4
#define MB_LEN_MAX 6 /* 31-bit UTF-8 */
#if 0 /* expanded by -frewrite-includes */
#include <sys/limits.h>
#endif /* expanded by -frewrite-includes */
# 141 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/limits.h" 3 4
# 1 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/limits.h" 1 3 4
/*-
* Copyright (c) 1988, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $FreeBSD$
*/
#ifndef _SYS_LIMITS_H_
#define _SYS_LIMITS_H_
#if 0 /* expanded by -frewrite-includes */
#include <sys/cdefs.h>
#endif /* expanded by -frewrite-includes */
# 35 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/limits.h" 3 4
# 36 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/limits.h" 3 4
#if 0 /* expanded by -frewrite-includes */
#include <machine/_limits.h>
#endif /* expanded by -frewrite-includes */
# 36 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/limits.h" 3 4
# 37 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/limits.h" 3 4
#define CHAR_BIT __CHAR_BIT /* number of bits in a char */
#define SCHAR_MAX __SCHAR_MAX /* max value for a signed char */
#define SCHAR_MIN __SCHAR_MIN /* min value for a signed char */
#define UCHAR_MAX __UCHAR_MAX /* max value for an unsigned char */
#ifdef __CHAR_UNSIGNED__
#define CHAR_MAX UCHAR_MAX /* max value for a char */
#define CHAR_MIN 0 /* min value for a char */
#else
# 49 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/limits.h" 3 4
#define CHAR_MAX SCHAR_MAX
#define CHAR_MIN SCHAR_MIN
#endif
# 52 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/limits.h" 3 4
#define USHRT_MAX __USHRT_MAX /* max value for an unsigned short */
#define SHRT_MAX __SHRT_MAX /* max value for a short */
#define SHRT_MIN __SHRT_MIN /* min value for a short */
#define UINT_MAX __UINT_MAX /* max value for an unsigned int */
#define INT_MAX __INT_MAX /* max value for an int */
#define INT_MIN __INT_MIN /* min value for an int */
#define ULONG_MAX __ULONG_MAX /* max for an unsigned long */
#define LONG_MAX __LONG_MAX /* max for a long */
#define LONG_MIN __LONG_MIN /* min for a long */
#ifdef __LONG_LONG_SUPPORTED
#define ULLONG_MAX __ULLONG_MAX /* max for an unsigned long long */
#define LLONG_MAX __LLONG_MAX /* max for a long long */
#define LLONG_MIN __LLONG_MIN /* min for a long long */
#endif
# 70 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/limits.h" 3 4
#if __POSIX_VISIBLE || __XSI_VISIBLE
#define SSIZE_MAX __SSIZE_MAX /* max value for an ssize_t */
#endif
# 74 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/limits.h" 3 4
#if __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE
#define SIZE_T_MAX __SIZE_T_MAX /* max value for a size_t */
#define OFF_MAX __OFF_MAX /* max value for an off_t */
#define OFF_MIN __OFF_MIN /* min value for an off_t */
#endif
# 81 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/limits.h" 3 4
#if __BSD_VISIBLE
#define GID_MAX UINT_MAX /* max value for a gid_t */
#define UID_MAX UINT_MAX /* max value for a uid_t */
#define UQUAD_MAX (__UQUAD_MAX) /* max value for a uquad_t */
#define QUAD_MAX (__QUAD_MAX) /* max value for a quad_t */
#define QUAD_MIN (__QUAD_MIN) /* min value for a quad_t */
#endif
# 90 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/limits.h" 3 4
#if __XSI_VISIBLE || __POSIX_VISIBLE >= 200809
#define LONG_BIT __LONG_BIT
#define WORD_BIT __WORD_BIT
#endif
# 95 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/limits.h" 3 4
#if __POSIX_VISIBLE
#define MQ_PRIO_MAX 64
#endif
# 99 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/limits.h" 3 4
#endif /* !_SYS_LIMITS_H_ */
# 101 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/limits.h" 3 4
# 142 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/limits.h" 2 3 4
#if __POSIX_VISIBLE
#if 0 /* expanded by -frewrite-includes */
#include <sys/syslimits.h>
#endif /* expanded by -frewrite-includes */
# 144 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/limits.h" 3 4
# 1 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/syslimits.h" 1 3 4
/*-
* Copyright (c) 1988, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)syslimits.h 8.1 (Berkeley) 6/2/93
* $FreeBSD$
*/
#ifndef _SYS_SYSLIMITS_H_
#define _SYS_SYSLIMITS_H_
#if !defined(_KERNEL) && !defined(_LIMITS_H_) && !defined(_SYS_PARAM_H_)
#ifndef _SYS_CDEFS_H_
#error this file needs sys/cdefs.h as a prerequisite
#endif
# 40 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/syslimits.h" 3 4
#ifdef __CC_SUPPORTS_WARNING
#warning "No user-serviceable parts inside."
#endif
# 43 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/syslimits.h" 3 4
#endif
# 44 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/syslimits.h" 3 4
/*
* Do not add any new variables here. (See the comment at the end of
* the file for why.)
*/
#define ARG_MAX 262144 /* max bytes for an exec function */
#ifndef CHILD_MAX
#define CHILD_MAX 40 /* max simultaneous processes */
#endif
# 53 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/syslimits.h" 3 4
#define LINK_MAX 32767 /* max file link count */
#define MAX_CANON 255 /* max bytes in term canon input line */
#define MAX_INPUT 255 /* max bytes in terminal input */
#define NAME_MAX 255 /* max bytes in a file name */
#ifndef NGROUPS_MAX
#define NGROUPS_MAX 1023 /* max supplemental group id's */
#endif
# 60 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/syslimits.h" 3 4
#ifndef OPEN_MAX
#define OPEN_MAX 64 /* max open files per process */
#endif
# 63 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/syslimits.h" 3 4
#define PATH_MAX 1024 /* max bytes in pathname */
#define PIPE_BUF 512 /* max bytes for atomic pipe writes */
#define IOV_MAX 1024 /* max elements in i/o vector */
/*
* We leave the following values undefined to force applications to either
* assume conservative values or call sysconf() to get the current value.
*
* HOST_NAME_MAX
*
* (We should do this for most of the values currently defined here,
* but many programs are not prepared to deal with this yet.)
*/
#endif
# 77 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/syslimits.h" 3 4
# 145 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/limits.h" 2 3 4
#endif
# 146 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/limits.h" 3 4
#endif /* !_LIMITS_H_ */
# 148 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/limits.h" 3 4
# 23 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/rdopt.c" 2
#if 0 /* expanded by -frewrite-includes */
#include <memory.h>
#endif /* expanded by -frewrite-includes */
# 23 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/rdopt.c"
# 1 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/memory.h" 1 3 4
/*
* Copyright (c) 1988, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)memory.h 8.1 (Berkeley) 6/2/93
*
* $FreeBSD$
*/
#if 0 /* expanded by -frewrite-includes */
#include <string.h>
#endif /* expanded by -frewrite-includes */
# 34 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/memory.h" 3 4
# 1 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/string.h" 1 3 4
/*-
* Copyright (c) 1990, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)string.h 8.1 (Berkeley) 6/2/93
* $FreeBSD$
*/
#ifndef _STRING_H_
#define _STRING_H_
#if 0 /* expanded by -frewrite-includes */
#include <sys/cdefs.h>
#endif /* expanded by -frewrite-includes */
# 36 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/string.h" 3 4
# 37 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/string.h" 3 4
#if 0 /* expanded by -frewrite-includes */
#include <sys/_null.h>
#endif /* expanded by -frewrite-includes */
# 37 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/string.h" 3 4
# 38 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/string.h" 3 4
#if 0 /* expanded by -frewrite-includes */
#include <sys/_types.h>
#endif /* expanded by -frewrite-includes */
# 38 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/string.h" 3 4
# 39 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/string.h" 3 4
/*
* Prototype functions which were historically defined in <string.h>, but
* are required by POSIX to be prototyped in <strings.h>.
*/
#if __BSD_VISIBLE
#if 0 /* expanded by -frewrite-includes */
#include <strings.h>
#endif /* expanded by -frewrite-includes */
# 45 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/string.h" 3 4
# 1 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/strings.h" 1 3 4
/*-
* Copyright (c) 2002 Mike Barcroft <[email protected]>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $FreeBSD$
*/
#ifndef _STRINGS_H_
#define _STRINGS_H_
#if 0 /* expanded by -frewrite-includes */
#include <sys/cdefs.h>
#endif /* expanded by -frewrite-includes */
# 32 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/strings.h" 3 4
# 33 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/strings.h" 3 4
#if 0 /* expanded by -frewrite-includes */
#include <sys/_types.h>
#endif /* expanded by -frewrite-includes */
# 33 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/strings.h" 3 4
# 34 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/strings.h" 3 4
#ifndef _SIZE_T_DECLARED
typedef __size_t size_t;
#define _SIZE_T_DECLARED
#endif
# 39 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/strings.h" 3 4
__BEGIN_DECLS
#if __BSD_VISIBLE || __POSIX_VISIBLE <= 200112
int bcmp(const void *, const void *, size_t) __pure; /* LEGACY */
void bcopy(const void *, void *, size_t); /* LEGACY */
void bzero(void *, size_t); /* LEGACY */
#endif
# 46 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/strings.h" 3 4
#if __BSD_VISIBLE
void explicit_bzero(void *, size_t);
#endif
# 49 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/strings.h" 3 4
#if __XSI_VISIBLE
int ffs(int) __pure2;
#endif
# 52 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/strings.h" 3 4
#if __BSD_VISIBLE
int ffsl(long) __pure2;
int ffsll(long long) __pure2;
int fls(int) __pure2;
int flsl(long) __pure2;
int flsll(long long) __pure2;
#endif
# 59 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/strings.h" 3 4
#if __BSD_VISIBLE || __POSIX_VISIBLE <= 200112
char *index(const char *, int) __pure; /* LEGACY */
char *rindex(const char *, int) __pure; /* LEGACY */
#endif
# 63 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/strings.h" 3 4
int strcasecmp(const char *, const char *) __pure;
int strncasecmp(const char *, const char *, size_t) __pure;
#if __POSIX_VISIBLE >= 200809 || defined(_XLOCALE_H_)
#if 0 /* expanded by -frewrite-includes */
#include <xlocale/_strings.h>
#endif /* expanded by -frewrite-includes */
# 67 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/strings.h" 3 4
# 1 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/xlocale/_strings.h" 1 3 4
/*-
* Copyright (c) 2011, 2012 The FreeBSD Foundation
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $FreeBSD$
*/
#ifndef _LOCALE_T_DEFINED
#define _LOCALE_T_DEFINED
typedef struct _xlocale *locale_t;
#endif
# 33 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/xlocale/_strings.h" 3 4
/*
* This file is included from both strings.h and xlocale.h. We need to expose
* the declarations unconditionally if we are included from xlocale.h, but only
* if we are in POSIX2008 mode if included from string.h.
*/
#ifndef _XLOCALE_STRINGS1_H
#define _XLOCALE_STRINGS1_H
/*
* POSIX2008 functions
*/
int strcasecmp_l(const char *, const char *, locale_t);
int strncasecmp_l(const char *, const char *, size_t, locale_t);
#endif /* _XLOCALE_STRINGS1_H */
# 49 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/xlocale/_strings.h" 3 4
# 68 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/strings.h" 2 3 4
#endif
# 69 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/strings.h" 3 4
__END_DECLS
#endif /* _STRINGS_H_ */
# 72 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/strings.h" 3 4
# 46 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/string.h" 2 3 4
#endif
# 47 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/string.h" 3 4
#ifndef _SIZE_T_DECLARED
typedef __size_t size_t;
#define _SIZE_T_DECLARED
#endif
# 52 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/string.h" 3 4
__BEGIN_DECLS
#if __XSI_VISIBLE >= 600
void *memccpy(void * __restrict, const void * __restrict, int, size_t);
#endif
# 57 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/string.h" 3 4
void *memchr(const void *, int, size_t) __pure;
#if __BSD_VISIBLE
void *memrchr(const void *, int, size_t) __pure;
#endif
# 61 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/string.h" 3 4
int memcmp(const void *, const void *, size_t) __pure;
void *memcpy(void * __restrict, const void * __restrict, size_t);
#if __BSD_VISIBLE
void *memmem(const void *, size_t, const void *, size_t) __pure;
#endif
# 66 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/string.h" 3 4
void *memmove(void *, const void *, size_t);
void *memset(void *, int, size_t);
#if __POSIX_VISIBLE >= 200809
char *stpcpy(char * __restrict, const char * __restrict);
char *stpncpy(char * __restrict, const char * __restrict, size_t);
#endif
# 72 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/string.h" 3 4
#if __BSD_VISIBLE
char *strcasestr(const char *, const char *) __pure;
#endif
# 75 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/string.h" 3 4
char *strcat(char * __restrict, const char * __restrict);
char *strchr(const char *, int) __pure;
#if __BSD_VISIBLE
char *strchrnul(const char*, int) __pure;
#endif
# 80 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/string.h" 3 4
int strcmp(const char *, const char *) __pure;
int strcoll(const char *, const char *);
char *strcpy(char * __restrict, const char * __restrict);
size_t strcspn(const char *, const char *) __pure;
#if __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE
char *strdup(const char *) __malloc_like;
#endif
# 87 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/string.h" 3 4
char *strerror(int);
#if __POSIX_VISIBLE >= 200112
int strerror_r(int, char *, size_t);
#endif
# 91 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/string.h" 3 4
#if __BSD_VISIBLE
size_t strlcat(char * __restrict, const char * __restrict, size_t);
size_t strlcpy(char * __restrict, const char * __restrict, size_t);
#endif
# 95 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/string.h" 3 4
size_t strlen(const char *) __pure;
#if __BSD_VISIBLE
void strmode(int, char *);
#endif
# 99 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/string.h" 3 4
char *strncat(char * __restrict, const char * __restrict, size_t);
int strncmp(const char *, const char *, size_t) __pure;
char *strncpy(char * __restrict, const char * __restrict, size_t);
#if __POSIX_VISIBLE >= 200809
char *strndup(const char *, size_t) __malloc_like;
size_t strnlen(const char *, size_t) __pure;
#endif
# 106 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/string.h" 3 4
#if __BSD_VISIBLE
char *strnstr(const char *, const char *, size_t) __pure;
#endif
# 109 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/string.h" 3 4
char *strpbrk(const char *, const char *) __pure;
char *strrchr(const char *, int) __pure;
#if __BSD_VISIBLE
char *strsep(char **, const char *);
#endif
# 114 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/string.h" 3 4
#if __POSIX_VISIBLE >= 200809
char *strsignal(int);
#endif
# 117 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/string.h" 3 4
size_t strspn(const char *, const char *) __pure;
char *strstr(const char *, const char *) __pure;
char *strtok(char * __restrict, const char * __restrict);
#if __POSIX_VISIBLE >= 199506 || __XSI_VISIBLE >= 500
char *strtok_r(char *, const char *, char **);
#endif
# 123 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/string.h" 3 4
size_t strxfrm(char * __restrict, const char * __restrict, size_t);
#if __BSD_VISIBLE
#ifndef _SWAB_DECLARED
#define _SWAB_DECLARED
#ifndef _SSIZE_T_DECLARED
typedef __ssize_t ssize_t;
#define _SSIZE_T_DECLARED
#endif /* _SIZE_T_DECLARED */
# 133 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/string.h" 3 4
void swab(const void * __restrict, void * __restrict, ssize_t);
#endif /* _SWAB_DECLARED */
# 136 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/string.h" 3 4
#if __has_feature(capabilities)
__capability const void *
memchr_c_const(__capability const void *, int, size_t) __pure;
__capability void
*memchr_c(__capability const void *, int, size_t) __pure;
int memcmp_c(__capability const void *, __capability const void *, size_t)
__pure;
__capability void
*memcpy_c(__capability void * __restrict,
__capability const void * __restrict, size_t);
void *memcpy_c_fromcap(void * __restrict,
__capability const void * __restrict, size_t);
__capability void
*memcpy_c_tocap(__capability void * __restrict,
const void * __restrict, size_t);
__capability void
*memmove_c(__capability void * __restrict,
__capability const void * __restrict, size_t);
__capability void
*memset_c(__capability void *, int, size_t);
__capability char
*strchr_c(__capability const char *, int) __pure;
int strcmp_c(__capability const char *,
__capability const char *s2) __pure;
__capability char
*strcpy_c(__capability char * __restrict,
__capability const char * __restrict);
int strncmp_c(__capability const char *, __capability const char *,
size_t) __pure;
__capability char
*strncpy_c(__capability char * __restrict, __capability const char * __restrict,
size_t);
char *strncpy_c_fromcap(char * __restrict,
__capability const char * __restrict, size_t);
__capability char
*strncpy_c_tocap(__capability char * __restrict,
const char * __restrict, size_t);
size_t strnlen_c(__capability const char *, size_t) __pure;
#endif
# 177 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/string.h" 3 4
int timingsafe_bcmp(const void *, const void *, size_t);
int timingsafe_memcmp(const void *, const void *, size_t);
#endif /* __BSD_VISIBLE */
# 181 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/string.h" 3 4
#if __POSIX_VISIBLE >= 200809 || defined(_XLOCALE_H_)
#if 0 /* expanded by -frewrite-includes */
#include <xlocale/_string.h>
#endif /* expanded by -frewrite-includes */
# 183 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/string.h" 3 4
# 1 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/xlocale/_string.h" 1 3 4
/*-
* Copyright (c) 2011, 2012 The FreeBSD Foundation
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $FreeBSD$
*/
#ifndef _LOCALE_T_DEFINED
#define _LOCALE_T_DEFINED
typedef struct _xlocale *locale_t;
#endif
# 33 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/xlocale/_string.h" 3 4
/*
* This file is included from both string.h and xlocale.h. We need to expose
* the declarations unconditionally if we are included from xlocale.h, but only
* if we are in POSIX2008 mode if included from string.h.
*/
#ifndef _XLOCALE_STRING1_H
#define _XLOCALE_STRING1_H
/*
* POSIX2008 functions
*/
int strcoll_l(const char *, const char *, locale_t);
size_t strxfrm_l(char *, const char *, size_t, locale_t);
#endif /* _XLOCALE_STRING1_H */
# 49 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/xlocale/_string.h" 3 4
/*
* xlocale extensions
*/
#ifdef _XLOCALE_H_
#ifndef _XLOCALE_STRING2_H
#define _XLOCALE_STRING2_H
char *strcasestr_l(const char *, const char *, locale_t);
#endif /* _XLOCALE_STRING2_H */
# 59 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/xlocale/_string.h" 3 4
#endif /* _XLOCALE_H_ */
# 60 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/xlocale/_string.h" 3 4
# 184 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/string.h" 2 3 4
#endif
# 185 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/string.h" 3 4
#if __EXT1_VISIBLE
#ifndef _RSIZE_T_DEFINED
#define _RSIZE_T_DEFINED
typedef size_t rsize_t;
#endif
# 192 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/string.h" 3 4
#ifndef _ERRNO_T_DEFINED
#define _ERRNO_T_DEFINED
typedef int errno_t;
#endif
# 197 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/string.h" 3 4
/* ISO/IEC 9899:2011 K.3.7.4.1.1 */
errno_t memset_s(void *, rsize_t, int, rsize_t);
#endif /* __EXT1_VISIBLE */
# 201 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/string.h" 3 4
__END_DECLS
#endif /* _STRING_H_ */
# 204 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/string.h" 3 4
# 35 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/memory.h" 2 3 4
# 24 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/rdopt.c" 2
#if 0 /* expanded by -frewrite-includes */
#include <string.h>
#endif /* expanded by -frewrite-includes */
# 24 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/rdopt.c"
# 25 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/rdopt.c"
#if 0 /* expanded by -frewrite-includes */
#include "global.h"
#endif /* expanded by -frewrite-includes */
# 26 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/rdopt.c"
# 1 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/global.h" 1
/*!
************************************************************************
* \file
* global.h
*
* \brief
* global definitions for H.264 encoder.
*
* \author
* Copyright (C) 1999 Telenor Satellite Services,Norway
* Ericsson Radio Systems, Sweden
*
* Inge Lille-Langoy <[email protected]>
*
* Telenor Satellite Services
* Keysers gt.13 tel.: +47 23 13 86 98
* N-0130 Oslo,Norway fax.: +47 22 77 79 80
*
* Rickard Sjoberg <[email protected]>
*
* Ericsson Radio Systems
* KI/ERA/T/VV
* 164 80 Stockholm, Sweden
*
************************************************************************
*/
#ifndef _GLOBAL_H_
#define _GLOBAL_H_
#if 0 /* expanded by -frewrite-includes */
#include <stdio.h>
#endif /* expanded by -frewrite-includes */
# 31 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/global.h"
# 1 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/stdio.h" 1 3 4
/*-
* Copyright (c) 1990, 1993
* The Regents of the University of California. All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* Chris Torek.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)stdio.h 8.5 (Berkeley) 4/29/95
* $FreeBSD$
*/
#ifndef _STDIO_H_
#define _STDIO_H_
#if 0 /* expanded by -frewrite-includes */
#include <sys/cdefs.h>
#endif /* expanded by -frewrite-includes */
# 39 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/stdio.h" 3 4
# 40 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/stdio.h" 3 4
#if 0 /* expanded by -frewrite-includes */
#include <sys/_null.h>
#endif /* expanded by -frewrite-includes */
# 40 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/stdio.h" 3 4
# 41 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/stdio.h" 3 4
#if 0 /* expanded by -frewrite-includes */
#include <sys/_types.h>
#endif /* expanded by -frewrite-includes */
# 41 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/stdio.h" 3 4
# 42 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/stdio.h" 3 4
__NULLABILITY_PRAGMA_PUSH
typedef __off_t fpos_t;
#ifndef _SIZE_T_DECLARED
typedef __size_t size_t;
#define _SIZE_T_DECLARED
#endif
# 51 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/stdio.h" 3 4
#if __POSIX_VISIBLE >= 200809
#ifndef _OFF_T_DECLARED
#define _OFF_T_DECLARED
typedef __off_t off_t;
#endif
# 57 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/stdio.h" 3 4
#ifndef _SSIZE_T_DECLARED
#define _SSIZE_T_DECLARED
typedef __ssize_t ssize_t;
#endif
# 61 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/stdio.h" 3 4
#endif
# 62 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/stdio.h" 3 4
#ifndef _OFF64_T_DECLARED
#define _OFF64_T_DECLARED
typedef __off64_t off64_t;
#endif
# 67 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/stdio.h" 3 4
#if __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE
#ifndef _VA_LIST_DECLARED
typedef __va_list va_list;
#define _VA_LIST_DECLARED
#endif
# 73 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/stdio.h" 3 4
#endif
# 74 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/stdio.h" 3 4
#define _FSTDIO /* Define for new stdio with functions. */
/*
* NB: to fit things in six character monocase externals, the stdio
* code uses the prefix `__s' for stdio objects, typically followed
* by a three-character attempt at a mnemonic.
*/
/* stdio buffers */
struct __sbuf {
unsigned char *_base;
int _size;
};
/*
* stdio state variables.
*
* The following always hold:
*
* if (_flags&(__SLBF|__SWR)) == (__SLBF|__SWR),
* _lbfsize is -_bf._size, else _lbfsize is 0
* if _flags&__SRD, _w is 0
* if _flags&__SWR, _r is 0
*
* This ensures that the getc and putc macros (or inline functions) never
* try to write or read from a file that is in `read' or `write' mode.
* (Moreover, they can, and do, automatically switch from read mode to
* write mode, and back, on "r+" and "w+" files.)
*
* _lbfsize is used only to make the inline line-buffered output stream
* code as compact as possible.
*
* _ub, _up, and _ur are used when ungetc() pushes back more characters
* than fit in the current _bf, or when ungetc() pushes back a character
* that does not match the previous one in _bf. When this happens,
* _ub._base becomes non-nil (i.e., a stream has ungetc() data iff
* _ub._base!=NULL) and _up and _ur save the current values of _p and _r.
*
* Certain members of __sFILE are accessed directly via macros or
* inline functions. To preserve ABI compat, these members must not
* be disturbed. These members are marked below with (*).
*/
struct __sFILE {
unsigned char *_p; /* (*) current position in (some) buffer */
int _r; /* (*) read space left for getc() */
int _w; /* (*) write space left for putc() */
short _flags; /* (*) flags, below; this FILE is free if 0 */
short _file; /* (*) fileno, if Unix descriptor, else -1 */
struct __sbuf _bf; /* (*) the buffer (at least 1 byte, if !NULL) */
int _lbfsize; /* (*) 0 or -_bf._size, for inline putc */
/* operations */
void *_cookie; /* (*) cookie passed to io functions */
int (* _Nullable _close)(void *);
int (* _Nullable _read)(void *, char *, int);
fpos_t (* _Nullable _seek)(void *, fpos_t, int);
int (* _Nullable _write)(void *, const char *, int);
/* separate buffer for long sequences of ungetc() */
struct __sbuf _ub; /* ungetc buffer */
unsigned char *_up; /* saved _p when _p is doing ungetc data */
int _ur; /* saved _r when _r is counting ungetc data */
/* tricks to meet minimum requirements even when malloc() fails */
unsigned char _ubuf[3]; /* guarantee an ungetc() buffer */
unsigned char _nbuf[1]; /* guarantee a getc() buffer */
/* separate buffer for fgetln() when line crosses buffer boundary */
struct __sbuf _lb; /* buffer for fgetln() */
/* Unix stdio files get aligned to block boundaries on fseek() */
int _blksize; /* stat.st_blksize (may be != _bf._size) */
fpos_t _offset; /* current lseek offset */
struct pthread_mutex *_fl_mutex; /* used for MT-safety */
struct pthread *_fl_owner; /* current owner */
int _fl_count; /* recursive lock count */
int _orientation; /* orientation for fwide() */
__mbstate_t _mbstate; /* multibyte conversion state */
int _flags2; /* additional flags */
};
#ifndef _STDFILE_DECLARED
#define _STDFILE_DECLARED
typedef struct __sFILE FILE;
#endif
# 160 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/stdio.h" 3 4
#ifndef _STDSTREAM_DECLARED
__BEGIN_DECLS
extern FILE *__stdinp;
extern FILE *__stdoutp;
extern FILE *__stderrp;
__END_DECLS
#define _STDSTREAM_DECLARED
#endif
# 168 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/stdio.h" 3 4
#define __SLBF 0x0001 /* line buffered */
#define __SNBF 0x0002 /* unbuffered */
#define __SRD 0x0004 /* OK to read */
#define __SWR 0x0008 /* OK to write */
/* RD and WR are never simultaneously asserted */
#define __SRW 0x0010 /* open for reading & writing */
#define __SEOF 0x0020 /* found EOF */
#define __SERR 0x0040 /* found error */
#define __SMBF 0x0080 /* _bf._base is from malloc */
#define __SAPP 0x0100 /* fdopen()ed in append mode */
#define __SSTR 0x0200 /* this is an sprintf/snprintf string */
#define __SOPT 0x0400 /* do fseek() optimization */
#define __SNPT 0x0800 /* do not do fseek() optimization */
#define __SOFF 0x1000 /* set iff _offset is in fact correct */
#define __SMOD 0x2000 /* true => fgetln modified _p text */
#define __SALC 0x4000 /* allocate string space dynamically */
#define __SIGN 0x8000 /* ignore this file in _fwalk */
#define __S2OAP 0x0001 /* O_APPEND mode is set */
/*
* The following three definitions are for ANSI C, which took them
* from System V, which brilliantly took internal interface macros and
* made them official arguments to setvbuf(), without renaming them.
* Hence, these ugly _IOxxx names are *supposed* to appear in user code.
*
* Although numbered as their counterparts above, the implementation
* does not rely on this.
*/
#define _IOFBF 0 /* setvbuf should set fully buffered */
#define _IOLBF 1 /* setvbuf should set line buffered */
#define _IONBF 2 /* setvbuf should set unbuffered */
#define BUFSIZ 1024 /* size of buffer used by setbuf */
#define EOF (-1)
/*
* FOPEN_MAX is a minimum maximum, and is the number of streams that
* stdio can provide without attempting to allocate further resources
* (which could fail). Do not use this for anything.
*/
/* must be == _POSIX_STREAM_MAX <limits.h> */
#ifndef FOPEN_MAX
#define FOPEN_MAX 20 /* must be <= OPEN_MAX <sys/syslimits.h> */
#endif
# 214 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/stdio.h" 3 4
#define FILENAME_MAX 1024 /* must be <= PATH_MAX <sys/syslimits.h> */
/* System V/ANSI C; this is the wrong way to do this, do *not* use these. */
#if __XSI_VISIBLE
#define P_tmpdir "/tmp/"
#endif
# 220 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/stdio.h" 3 4
#define L_tmpnam 1024 /* XXX must be == PATH_MAX */
#define TMP_MAX 308915776
#ifndef SEEK_SET
#define SEEK_SET 0 /* set file offset to offset */
#endif
# 226 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/stdio.h" 3 4
#ifndef SEEK_CUR
#define SEEK_CUR 1 /* set file offset to current plus offset */
#endif
# 229 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/stdio.h" 3 4
#ifndef SEEK_END
#define SEEK_END 2 /* set file offset to EOF plus offset */
#endif
# 232 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/stdio.h" 3 4
#define stdin __stdinp
#define stdout __stdoutp
#define stderr __stderrp
__BEGIN_DECLS
#ifdef _XLOCALE_H_
#if 0 /* expanded by -frewrite-includes */
#include <xlocale/_stdio.h>
#endif /* expanded by -frewrite-includes */
# 239 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/stdio.h" 3 4
# 240 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/stdio.h" 3 4
#endif
# 241 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/stdio.h" 3 4
/*
* Functions defined in ANSI C standard.
*/
void clearerr(FILE *);
int fclose(FILE *);
int feof(FILE *);
int ferror(FILE *);
int fflush(FILE *);
int fgetc(FILE *);
int fgetpos(FILE * __restrict, fpos_t * __restrict);
char *fgets(char * __restrict, int, FILE * __restrict);
FILE *fopen(const char * __restrict, const char * __restrict);
int fprintf(FILE * __restrict, const char * __restrict, ...) __printflike(2, 3);
int fputc(int, FILE *);
int fputs(const char * __restrict, FILE * __restrict);
size_t fread(void * __restrict, size_t, size_t, FILE * __restrict);
FILE *freopen(const char * __restrict, const char * __restrict, FILE * __restrict);
int fscanf(FILE * __restrict, const char * __restrict, ...) __scanflike(2, 3);;
int fseek(FILE *, long, int);
int fsetpos(FILE *, const fpos_t *);
long ftell(FILE *);
size_t fwrite(const void * __restrict, size_t, size_t, FILE * __restrict);
int getc(FILE *);
int getchar(void);
char *gets(char *);
void perror(const char *);
int printf(const char * __restrict, ...) __printflike(1, 2);
int putc(int, FILE *);
int putchar(int);
int puts(const char *);
int remove(const char *);
int rename(const char *, const char *);
void rewind(FILE *);
int scanf(const char * __restrict, ...) __scanflike(1, 2);
void setbuf(FILE * __restrict, char * __restrict);
int setvbuf(FILE * __restrict, char * __restrict, int, size_t);
int sprintf(char * __restrict, const char * __restrict, ...) __printflike(2, 3);
int sscanf(const char * __restrict, const char * __restrict, ...) __scanflike(2, 3);
FILE *tmpfile(void);
char *tmpnam(char *);
int ungetc(int, FILE *);
int vfprintf(FILE * __restrict, const char * __restrict,
__va_list);
int vprintf(const char * __restrict, __va_list);
int vsprintf(char * __restrict, const char * __restrict,
__va_list);
#if __ISO_C_VISIBLE >= 1999
int snprintf(char * __restrict, size_t, const char * __restrict,
...) __printflike(3, 4);
int vfscanf(FILE * __restrict, const char * __restrict, __va_list)
__scanflike(2, 0);
int vscanf(const char * __restrict, __va_list) __scanflike(1, 0);
int vsnprintf(char * __restrict, size_t, const char * __restrict,
__va_list) __printflike(3, 0);
int vsscanf(const char * __restrict, const char * __restrict, __va_list)
__scanflike(2, 0);
#endif
# 299 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/stdio.h" 3 4
/*
* Functions defined in all versions of POSIX 1003.1.
*/
#if __BSD_VISIBLE || (__POSIX_VISIBLE && __POSIX_VISIBLE <= 199506)
#define L_cuserid 17 /* size for cuserid(3); MAXLOGNAME, legacy */
#endif
# 306 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/stdio.h" 3 4
#if __POSIX_VISIBLE
#define L_ctermid 1024 /* size for ctermid(3); PATH_MAX */
char *ctermid(char *);
FILE *fdopen(int, const char *);
int fileno(FILE *);
#endif /* __POSIX_VISIBLE */
# 314 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/stdio.h" 3 4
#if __POSIX_VISIBLE >= 199209
int pclose(FILE *);
FILE *popen(const char *, const char *);
#endif
# 319 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/stdio.h" 3 4
#if __POSIX_VISIBLE >= 199506
int ftrylockfile(FILE *);
void flockfile(FILE *);
void funlockfile(FILE *);
/*
* These are normally used through macros as defined below, but POSIX
* requires functions as well.
*/
int getc_unlocked(FILE *);
int getchar_unlocked(void);
int putc_unlocked(int, FILE *);
int putchar_unlocked(int);
#endif
# 334 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/stdio.h" 3 4
#if __BSD_VISIBLE
void clearerr_unlocked(FILE *);
int feof_unlocked(FILE *);
int ferror_unlocked(FILE *);
int fileno_unlocked(FILE *);
#endif
# 340 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/stdio.h" 3 4
#if __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE >= 500
int fseeko(FILE *, __off_t, int);
__off_t ftello(FILE *);
#endif
# 345 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/stdio.h" 3 4
#if __BSD_VISIBLE || __XSI_VISIBLE > 0 && __XSI_VISIBLE < 600
int getw(FILE *);
int putw(int, FILE *);
#endif /* BSD or X/Open before issue 6 */
# 350 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/stdio.h" 3 4
#if __XSI_VISIBLE
char *tempnam(const char *, const char *);
#endif
# 354 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/stdio.h" 3 4
#if __POSIX_VISIBLE >= 200809
FILE *fmemopen(void * __restrict, size_t, const char * __restrict);
ssize_t getdelim(char ** __restrict, size_t * __restrict, int,
FILE * __restrict);
FILE *open_memstream(char **, size_t *);
int renameat(int, const char *, int, const char *);
int vdprintf(int, const char * __restrict, __va_list) __printflike(2, 0);
/* _WITH_GETLINE to allow pre 11 sources to build on 11+ systems */
ssize_t getline(char ** __restrict, size_t * __restrict, FILE * __restrict);
int dprintf(int, const char * __restrict, ...) __printflike(2, 3);
#endif /* __POSIX_VISIBLE >= 200809 */
# 366 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/stdio.h" 3 4
/*
* Routines that are purely local.
*/
#if __BSD_VISIBLE
int asprintf(char **, const char *, ...) __printflike(2, 3);
char *ctermid_r(char *);
void fcloseall(void);
int fdclose(FILE *, int *);
char *fgetln(FILE *, size_t *);
const char *fmtcheck(const char *, const char *) __format_arg(2);
int fpurge(FILE *);
void setbuffer(FILE *, char *, int);
int setlinebuf(FILE *);
int vasprintf(char **, const char *, __va_list)
__printflike(2, 0);
/*
* The system error table contains messages for the first sys_nerr
* positive errno values. Use strerror() or strerror_r() from <string.h>
* instead.
*/
extern const int sys_nerr;
extern const char * const sys_errlist[];
/*
* Stdio function-access interface.
*/
FILE *funopen(const void *,
int (* _Nullable)(void *, char *, int),
int (* _Nullable)(void *, const char *, int),
fpos_t (* _Nullable)(void *, fpos_t, int),
int (* _Nullable)(void *));
#define fropen(cookie, fn) funopen(cookie, fn, 0, 0, 0)
#define fwopen(cookie, fn) funopen(cookie, 0, fn, 0, 0)
typedef __ssize_t cookie_read_function_t(void *, char *, size_t);
typedef __ssize_t cookie_write_function_t(void *, const char *, size_t);
typedef int cookie_seek_function_t(void *, off64_t *, int);
typedef int cookie_close_function_t(void *);
typedef struct {
cookie_read_function_t *read;
cookie_write_function_t *write;
cookie_seek_function_t *seek;
cookie_close_function_t *close;
} cookie_io_functions_t;
FILE *fopencookie(void *, const char *, cookie_io_functions_t);
/*
* Portability hacks. See <sys/types.h>.
*/
#ifndef _FTRUNCATE_DECLARED
#define _FTRUNCATE_DECLARED
int ftruncate(int, __off_t);
#endif
# 421 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/stdio.h" 3 4
#ifndef _LSEEK_DECLARED
#define _LSEEK_DECLARED
__off_t lseek(int, __off_t, int);
#endif
# 425 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/stdio.h" 3 4
#ifndef _MMAP_DECLARED
#define _MMAP_DECLARED
void *mmap(void *, size_t, int, int, int, __off_t);
#endif
# 429 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/stdio.h" 3 4
#ifndef _TRUNCATE_DECLARED
#define _TRUNCATE_DECLARED
int truncate(const char *, __off_t);
#endif
# 433 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/stdio.h" 3 4
#endif /* __BSD_VISIBLE */
# 434 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/stdio.h" 3 4
/*
* Functions internal to the implementation.
*/
int __srget(FILE *);
int __swbuf(int, FILE *);
/*
* The __sfoo macros are here so that we can
* define function versions in the C library.
*/
#define __sgetc(p) (--(p)->_r < 0 ? __srget(p) : (int)(*(p)->_p++))
#if defined(__GNUC__) && defined(__STDC__)
static __inline int __sputc(int _c, FILE *_p) {
if (--_p->_w >= 0 || (_p->_w >= _p->_lbfsize && (char)_c != '\n'))
return (*_p->_p++ = _c);
else
return (__swbuf(_c, _p));
}
#else
# 454 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/stdio.h" 3 4
/*
* This has been tuned to generate reasonable code on the vax using pcc.
*/
#define __sputc(c, p) \
(--(p)->_w < 0 ? \
(p)->_w >= (p)->_lbfsize ? \
(*(p)->_p = (c)), *(p)->_p != '\n' ? \
(int)*(p)->_p++ : \
__swbuf('\n', p) : \
__swbuf((int)(c), p) : \
(*(p)->_p = (c), (int)*(p)->_p++))
#endif
# 466 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/stdio.h" 3 4
extern int __isthreaded;
#ifndef __cplusplus
#define __sfeof(p) (((p)->_flags & __SEOF) != 0)
#define __sferror(p) (((p)->_flags & __SERR) != 0)
#define __sclearerr(p) ((void)((p)->_flags &= ~(__SERR|__SEOF)))
#define __sfileno(p) ((p)->_file)
#define feof(p) (!__isthreaded ? __sfeof(p) : (feof)(p))
#define ferror(p) (!__isthreaded ? __sferror(p) : (ferror)(p))
#define clearerr(p) (!__isthreaded ? __sclearerr(p) : (clearerr)(p))
#if __POSIX_VISIBLE
#define fileno(p) (!__isthreaded ? __sfileno(p) : (fileno)(p))
#endif
# 484 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/stdio.h" 3 4
#define getc(fp) (!__isthreaded ? __sgetc(fp) : (getc)(fp))
#define putc(x, fp) (!__isthreaded ? __sputc(x, fp) : (putc)(x, fp))
#define getchar() getc(stdin)
#define putchar(x) putc(x, stdout)
#if __BSD_VISIBLE
/*
* See ISO/IEC 9945-1 ANSI/IEEE Std 1003.1 Second Edition 1996-07-12
* B.8.2.7 for the rationale behind the *_unlocked() macros.
*/
#define feof_unlocked(p) __sfeof(p)
#define ferror_unlocked(p) __sferror(p)
#define clearerr_unlocked(p) __sclearerr(p)
#define fileno_unlocked(p) __sfileno(p)
#endif
# 501 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/stdio.h" 3 4
#if __POSIX_VISIBLE >= 199506
#define getc_unlocked(fp) __sgetc(fp)
#define putc_unlocked(x, fp) __sputc(x, fp)
#define getchar_unlocked() getc_unlocked(stdin)
#define putchar_unlocked(x) putc_unlocked(x, stdout)
#endif
# 508 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/stdio.h" 3 4
#endif /* __cplusplus */
# 509 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/stdio.h" 3 4
__END_DECLS
__NULLABILITY_PRAGMA_POP
#endif /* !_STDIO_H_ */
# 514 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/stdio.h" 3 4
# 32 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/global.h" 2
#if 0 /* expanded by -frewrite-includes */
#include <time.h>
#endif /* expanded by -frewrite-includes */
# 32 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/global.h"
# 1 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/time.h" 1 3 4
/*
* Copyright (c) 1989, 1993
* The Regents of the University of California. All rights reserved.
* (c) UNIX System Laboratories, Inc.
* All or some portions of this file are derived from material licensed
* to the University of California by American Telephone and Telegraph
* Co. or Unix System Laboratories, Inc. and are reproduced herein with
* the permission of UNIX System Laboratories, Inc.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)time.h 8.3 (Berkeley) 1/21/94
*/
/*
* $FreeBSD$
*/
#ifndef _TIME_H_
#define _TIME_H_
#if 0 /* expanded by -frewrite-includes */
#include <sys/cdefs.h>
#endif /* expanded by -frewrite-includes */
# 44 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/time.h" 3 4
# 45 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/time.h" 3 4
#if 0 /* expanded by -frewrite-includes */
#include <sys/_null.h>
#endif /* expanded by -frewrite-includes */
# 45 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/time.h" 3 4
# 46 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/time.h" 3 4
#if 0 /* expanded by -frewrite-includes */
#include <sys/_types.h>
#endif /* expanded by -frewrite-includes */
# 46 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/time.h" 3 4
# 47 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/time.h" 3 4
#if __POSIX_VISIBLE > 0 && __POSIX_VISIBLE < 200112 || __BSD_VISIBLE
/*
* Frequency of the clock ticks reported by times(). Deprecated - use
* sysconf(_SC_CLK_TCK) instead. (Removed in 1003.1-2001.)
*/
#define CLK_TCK 128
#endif
# 55 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/time.h" 3 4
/* Frequency of the clock ticks reported by clock(). */
#define CLOCKS_PER_SEC 128
#ifndef _CLOCK_T_DECLARED
typedef __clock_t clock_t;
#define _CLOCK_T_DECLARED
#endif
# 63 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/time.h" 3 4
#ifndef _TIME_T_DECLARED
typedef __time_t time_t;
#define _TIME_T_DECLARED
#endif
# 68 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/time.h" 3 4
#ifndef _SIZE_T_DECLARED
typedef __size_t size_t;
#define _SIZE_T_DECLARED
#endif
# 73 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/time.h" 3 4
#if __POSIX_VISIBLE >= 199309
/*
* New in POSIX 1003.1b-1993.
*/
#ifndef _CLOCKID_T_DECLARED
typedef __clockid_t clockid_t;
#define _CLOCKID_T_DECLARED
#endif
# 82 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/time.h" 3 4
#ifndef _TIMER_T_DECLARED
typedef __timer_t timer_t;
#define _TIMER_T_DECLARED
#endif
# 87 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/time.h" 3 4
#if 0 /* expanded by -frewrite-includes */
#include <sys/timespec.h>
#endif /* expanded by -frewrite-includes */
# 88 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/time.h" 3 4
# 1 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/timespec.h" 1 3 4
/*-
* Copyright (c) 1982, 1986, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)time.h 8.5 (Berkeley) 5/4/95
* from: FreeBSD: src/sys/sys/time.h,v 1.43 2000/03/20 14:09:05 phk Exp
* $FreeBSD$
*/
#ifndef _SYS_TIMESPEC_H_
#define _SYS_TIMESPEC_H_
#if 0 /* expanded by -frewrite-includes */
#include <sys/cdefs.h>
#endif /* expanded by -frewrite-includes */
# 37 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/timespec.h" 3 4
# 38 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/timespec.h" 3 4
#if 0 /* expanded by -frewrite-includes */
#include <sys/_timespec.h>
#endif /* expanded by -frewrite-includes */
# 38 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/timespec.h" 3 4
# 1 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/_timespec.h" 1 3 4
/*-
* Copyright (c) 1982, 1986, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)time.h 8.5 (Berkeley) 5/4/95
* from: FreeBSD: src/sys/sys/time.h,v 1.43 2000/03/20 14:09:05 phk Exp
* $FreeBSD$
*/
#ifndef _SYS__TIMESPEC_H_
#define _SYS__TIMESPEC_H_
#if 0 /* expanded by -frewrite-includes */
#include <sys/_types.h>
#endif /* expanded by -frewrite-includes */
# 37 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/_timespec.h" 3 4
# 38 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/_timespec.h" 3 4
#ifndef _TIME_T_DECLARED
typedef __time_t time_t;
#define _TIME_T_DECLARED
#endif
# 43 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/_timespec.h" 3 4
struct timespec {
time_t tv_sec; /* seconds */
long tv_nsec; /* and nanoseconds */
};
#endif /* !_SYS__TIMESPEC_H_ */
# 50 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/_timespec.h" 3 4
# 39 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/timespec.h" 2 3 4
#if __BSD_VISIBLE
#define TIMEVAL_TO_TIMESPEC(tv, ts) \
do { \
(ts)->tv_sec = (tv)->tv_sec; \
(ts)->tv_nsec = (tv)->tv_usec * 1000; \
} while (0)
#define TIMESPEC_TO_TIMEVAL(tv, ts) \
do { \
(tv)->tv_sec = (ts)->tv_sec; \
(tv)->tv_usec = (ts)->tv_nsec / 1000; \
} while (0)
#endif /* __BSD_VISIBLE */
# 53 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/timespec.h" 3 4
/*
* Structure defined by POSIX.1b to be like a itimerval, but with
* timespecs. Used in the timer_*() system calls.
*/
struct itimerspec {
struct timespec it_interval;
struct timespec it_value;
};
#endif /* _SYS_TIMESPEC_H_ */
# 64 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/timespec.h" 3 4
# 89 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/time.h" 2 3 4
#endif /* __POSIX_VISIBLE >= 199309 */
# 90 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/time.h" 3 4
#if __POSIX_VISIBLE >= 200112
#ifndef _PID_T_DECLARED
typedef __pid_t pid_t;
#define _PID_T_DECLARED
#endif
# 96 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/time.h" 3 4
#endif
# 97 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/time.h" 3 4
/* These macros are also in sys/time.h. */
#if !defined(CLOCK_REALTIME) && __POSIX_VISIBLE >= 200112
#define CLOCK_REALTIME 0
#ifdef __BSD_VISIBLE
#define CLOCK_VIRTUAL 1
#define CLOCK_PROF 2
#endif
# 105 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/time.h" 3 4
#define CLOCK_MONOTONIC 4
#define CLOCK_UPTIME 5 /* FreeBSD-specific. */
#define CLOCK_UPTIME_PRECISE 7 /* FreeBSD-specific. */
#define CLOCK_UPTIME_FAST 8 /* FreeBSD-specific. */
#define CLOCK_REALTIME_PRECISE 9 /* FreeBSD-specific. */
#define CLOCK_REALTIME_FAST 10 /* FreeBSD-specific. */
#define CLOCK_MONOTONIC_PRECISE 11 /* FreeBSD-specific. */
#define CLOCK_MONOTONIC_FAST 12 /* FreeBSD-specific. */
#define CLOCK_SECOND 13 /* FreeBSD-specific. */
#define CLOCK_THREAD_CPUTIME_ID 14
#define CLOCK_PROCESS_CPUTIME_ID 15
#endif /* !defined(CLOCK_REALTIME) && __POSIX_VISIBLE >= 200112 */
# 117 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/time.h" 3 4
#if !defined(TIMER_ABSTIME) && __POSIX_VISIBLE >= 200112
#if __BSD_VISIBLE
#define TIMER_RELTIME 0x0 /* relative timer */
#endif
# 122 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/time.h" 3 4
#define TIMER_ABSTIME 0x1 /* absolute timer */
#endif /* !defined(TIMER_ABSTIME) && __POSIX_VISIBLE >= 200112 */
# 124 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/time.h" 3 4
struct tm {
int tm_sec; /* seconds after the minute [0-60] */
int tm_min; /* minutes after the hour [0-59] */
int tm_hour; /* hours since midnight [0-23] */
int tm_mday; /* day of the month [1-31] */
int tm_mon; /* months since January [0-11] */
int tm_year; /* years since 1900 */
int tm_wday; /* days since Sunday [0-6] */
int tm_yday; /* days since January 1 [0-365] */
int tm_isdst; /* Daylight Savings Time flag */
long tm_gmtoff; /* offset from UTC in seconds */
char *tm_zone; /* timezone abbreviation */
};
#if __POSIX_VISIBLE
extern char *tzname[];
#endif
# 142 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/time.h" 3 4
__BEGIN_DECLS
char *asctime(const struct tm *);
clock_t clock(void);
char *ctime(const time_t *);
double difftime(time_t, time_t);
/* XXX missing: getdate() */
struct tm *gmtime(const time_t *);
struct tm *localtime(const time_t *);
time_t mktime(struct tm *);
size_t strftime(char * __restrict, size_t, const char * __restrict,
const struct tm * __restrict);
time_t time(time_t *);
#if __POSIX_VISIBLE >= 200112
struct sigevent;
int timer_create(clockid_t, struct sigevent *__restrict, timer_t *__restrict);
int timer_delete(timer_t);
int timer_gettime(timer_t, struct itimerspec *);
int timer_getoverrun(timer_t);
int timer_settime(timer_t, int, const struct itimerspec *__restrict,
struct itimerspec *__restrict);
#endif
# 164 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/time.h" 3 4
#if __POSIX_VISIBLE
void tzset(void);
#endif
# 167 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/time.h" 3 4
#if __POSIX_VISIBLE >= 199309
int clock_getres(clockid_t, struct timespec *);
int clock_gettime(clockid_t, struct timespec *);
int clock_settime(clockid_t, const struct timespec *);
int nanosleep(const struct timespec *, struct timespec *);
#endif /* __POSIX_VISIBLE >= 199309 */
# 174 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/time.h" 3 4
#if __POSIX_VISIBLE >= 200112
int clock_getcpuclockid(pid_t, clockid_t *);
int clock_nanosleep(clockid_t, int, const struct timespec *, struct timespec *);
#endif
# 179 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/time.h" 3 4
#if __POSIX_VISIBLE >= 199506
char *asctime_r(const struct tm *, char *);
char *ctime_r(const time_t *, char *);
struct tm *gmtime_r(const time_t *, struct tm *);
struct tm *localtime_r(const time_t *, struct tm *);
#endif
# 186 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/time.h" 3 4
#if __XSI_VISIBLE
char *strptime(const char * __restrict, const char * __restrict,
struct tm * __restrict);
#endif
# 191 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/time.h" 3 4
#if __BSD_VISIBLE
char *timezone(int, int); /* XXX XSI conflict */
void tzsetwall(void);
time_t timelocal(struct tm * const);
time_t timegm(struct tm * const);
int timer_oshandle_np(timer_t timerid);
#endif /* __BSD_VISIBLE */
# 199 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/time.h" 3 4
#if __POSIX_VISIBLE >= 200809 || defined(_XLOCALE_H_)
#if 0 /* expanded by -frewrite-includes */
#include <xlocale/_time.h>
#endif /* expanded by -frewrite-includes */
# 201 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/time.h" 3 4
# 1 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/xlocale/_time.h" 1 3 4
/*-
* Copyright (c) 2011, 2012 The FreeBSD Foundation
* All rights reserved.
*
* This software was developed by David Chisnall under sponsorship from
* the FreeBSD Foundation.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $FreeBSD$
*/
#ifndef _LOCALE_T_DEFINED
#define _LOCALE_T_DEFINED
typedef struct _xlocale *locale_t;
#endif
# 36 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/xlocale/_time.h" 3 4
/*
* This file is included from both locale.h and xlocale.h. We need to expose
* the declarations unconditionally if we are included from xlocale.h, but only
* if we are in POSIX2008 mode if included from locale.h.
*/
#ifndef _XLOCALE_LOCALE1_H
#define _XLOCALE_LOCALE1_H
size_t strftime_l(char * __restrict, size_t, const char * __restrict,
const struct tm * __restrict, locale_t) __strftimelike(3, 0);
#endif /* _XLOCALE_LOCALE1_H */
# 49 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/xlocale/_time.h" 3 4
#ifdef _XLOCALE_H_
#ifndef _XLOCALE_LOCALE2_H
#define _XLOCALE_LOCALE2_H
char *strptime_l(const char * __restrict, const char * __restrict,
struct tm * __restrict, locale_t);
#endif /* _XLOCALE_LOCALE2_H */
# 58 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/xlocale/_time.h" 3 4
#endif /* _XLOCALE_H_ */
# 59 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/xlocale/_time.h" 3 4
# 202 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/time.h" 2 3 4
#endif
# 203 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/time.h" 3 4
__END_DECLS
#endif /* !_TIME_H_ */
# 206 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/time.h" 3 4
# 33 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/global.h" 2
#if 0 /* expanded by -frewrite-includes */
#include "win32.h"
#endif /* expanded by -frewrite-includes */
# 34 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/global.h"
# 1 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/win32.h" 1
/*!
************************************************************************
* \file
* win32.h
*
* \brief
* win32 definitions for H.264 encoder.
*
* \author
*
************************************************************************
*/
#ifndef _WIN32_H_
#define _WIN32_H_
#if 0 /* expanded by -frewrite-includes */
# include <fcntl.h>
#endif /* expanded by -frewrite-includes */
# 17 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/win32.h"
# 1 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/fcntl.h" 1 3 4
/*-
* Copyright (c) 1983, 1990, 1993
* The Regents of the University of California. All rights reserved.
* (c) UNIX System Laboratories, Inc.
* All or some portions of this file are derived from material licensed
* to the University of California by American Telephone and Telegraph
* Co. or Unix System Laboratories, Inc. and are reproduced herein with
* the permission of UNIX System Laboratories, Inc.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)fcntl.h 8.3 (Berkeley) 1/21/94
* $FreeBSD$
*/
#ifndef _SYS_FCNTL_H_
#define _SYS_FCNTL_H_
/*
* This file includes the definitions for open and fcntl
* described by POSIX for <fcntl.h>; it also includes
* related kernel definitions.
*/
#if 0 /* expanded by -frewrite-includes */
#include <sys/cdefs.h>
#endif /* expanded by -frewrite-includes */
# 47 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/fcntl.h" 3 4
# 48 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/fcntl.h" 3 4
#if 0 /* expanded by -frewrite-includes */
#include <sys/_types.h>
#endif /* expanded by -frewrite-includes */
# 48 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/fcntl.h" 3 4
# 49 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/fcntl.h" 3 4
#ifndef _MODE_T_DECLARED
typedef __mode_t mode_t;
#define _MODE_T_DECLARED
#endif
# 54 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/fcntl.h" 3 4
#ifndef _OFF_T_DECLARED
typedef __off_t off_t;
#define _OFF_T_DECLARED
#endif
# 59 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/fcntl.h" 3 4
#ifndef _PID_T_DECLARED
typedef __pid_t pid_t;
#define _PID_T_DECLARED
#endif
# 64 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/fcntl.h" 3 4
/*
* File status flags: these are used by open(2), fcntl(2).
* They are also used (indirectly) in the kernel file structure f_flags,
* which is a superset of the open/fcntl flags. Open flags and f_flags
* are inter-convertible using OFLAGS(fflags) and FFLAGS(oflags).
* Open/fcntl flags begin with O_; kernel-internal flags begin with F.
*/
/* open-only flags */
#define O_RDONLY 0x0000 /* open for reading only */
#define O_WRONLY 0x0001 /* open for writing only */
#define O_RDWR 0x0002 /* open for reading and writing */
#define O_ACCMODE 0x0003 /* mask for above modes */
/*
* Kernel encoding of open mode; separate read and write bits that are
* independently testable: 1 greater than the above.
*
* XXX
* FREAD and FWRITE are excluded from the #ifdef _KERNEL so that TIOCFLUSH,
* which was documented to use FREAD/FWRITE, continues to work.
*/
#if __BSD_VISIBLE
#define FREAD 0x0001
#define FWRITE 0x0002
#endif
# 90 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/fcntl.h" 3 4
#define O_NONBLOCK 0x0004 /* no delay */
#define O_APPEND 0x0008 /* set append mode */
#if __BSD_VISIBLE
#define O_SHLOCK 0x0010 /* open with shared file lock */
#define O_EXLOCK 0x0020 /* open with exclusive file lock */
#define O_ASYNC 0x0040 /* signal pgrp when data ready */
#define O_FSYNC 0x0080 /* synchronous writes */
#endif
# 98 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/fcntl.h" 3 4
#define O_SYNC 0x0080 /* POSIX synonym for O_FSYNC */
#if __POSIX_VISIBLE >= 200809
#define O_NOFOLLOW 0x0100 /* don't follow symlinks */
#endif
# 102 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/fcntl.h" 3 4
#define O_CREAT 0x0200 /* create if nonexistent */
#define O_TRUNC 0x0400 /* truncate to zero length */
#define O_EXCL 0x0800 /* error if already exists */
#ifdef _KERNEL
#define FHASLOCK 0x4000 /* descriptor holds advisory lock */
#endif
# 108 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/fcntl.h" 3 4
/* Defined by POSIX 1003.1; BSD default, but must be distinct from O_RDONLY. */
#define O_NOCTTY 0x8000 /* don't assign controlling terminal */
#if __BSD_VISIBLE
/* Attempt to bypass buffer cache */
#define O_DIRECT 0x00010000
#endif
# 116 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/fcntl.h" 3 4
#if __POSIX_VISIBLE >= 200809
#define O_DIRECTORY 0x00020000 /* Fail if not directory */
#define O_EXEC 0x00040000 /* Open for execute only */
#endif
# 121 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/fcntl.h" 3 4
#ifdef _KERNEL
#define FEXEC O_EXEC
#endif
# 124 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/fcntl.h" 3 4
#if __POSIX_VISIBLE >= 200809
/* Defined by POSIX 1003.1-2008; BSD default, but reserve for future use. */
#define O_TTY_INIT 0x00080000 /* Restore default termios attributes */
#define O_CLOEXEC 0x00100000
#endif
# 131 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/fcntl.h" 3 4
#if __BSD_VISIBLE
#define O_VERIFY 0x00200000 /* open only after verification */
#endif
# 135 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/fcntl.h" 3 4
/*
* XXX missing O_DSYNC, O_RSYNC.
*/
#ifdef _KERNEL
/* Only for devfs d_close() flags. */
#define FLASTCLOSE O_DIRECTORY
#define FREVOKE O_VERIFY
/* Only for fo_close() from half-succeeded open */
#define FOPENFAILED O_TTY_INIT
/* convert from open() flags to/from fflags; convert O_RD/WR to FREAD/FWRITE */
#define FFLAGS(oflags) ((oflags) & O_EXEC ? (oflags) : (oflags) + 1)
#define OFLAGS(fflags) ((fflags) & O_EXEC ? (fflags) : (fflags) - 1)
/* bits to save after open */
#define FMASK (FREAD|FWRITE|FAPPEND|FASYNC|FFSYNC|FNONBLOCK|O_DIRECT|FEXEC)
/* bits settable by fcntl(F_SETFL, ...) */
#define FCNTLFLAGS (FAPPEND|FASYNC|FFSYNC|FNONBLOCK|FRDAHEAD|O_DIRECT)
#if defined(COMPAT_FREEBSD7) || defined(COMPAT_FREEBSD6) || \
defined(COMPAT_FREEBSD5) || defined(COMPAT_FREEBSD4)
/*
* Set by shm_open(3) in older libc's to get automatic MAP_ASYNC
* behavior for POSIX shared memory objects (which are otherwise
* implemented as plain files).
*/
#define FPOSIXSHM O_NOFOLLOW
#undef FCNTLFLAGS
#define FCNTLFLAGS (FAPPEND|FASYNC|FFSYNC|FNONBLOCK|FPOSIXSHM|FRDAHEAD| \
O_DIRECT)
#endif
# 169 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/fcntl.h" 3 4
#endif
# 170 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/fcntl.h" 3 4
/*
* The O_* flags used to have only F* names, which were used in the kernel
* and by fcntl. We retain the F* names for the kernel f_flag field
* and for backward compatibility for fcntl. These flags are deprecated.
*/
#if __BSD_VISIBLE
#define FAPPEND O_APPEND /* kernel/compat */
#define FASYNC O_ASYNC /* kernel/compat */
#define FFSYNC O_FSYNC /* kernel */
#define FNONBLOCK O_NONBLOCK /* kernel */
#define FNDELAY O_NONBLOCK /* compat */
#define O_NDELAY O_NONBLOCK /* compat */
#endif
# 184 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/fcntl.h" 3 4
/*
* We are out of bits in f_flag (which is a short). However,
* the flag bits not set in FMASK are only meaningful in the
* initial open syscall. Those bits can thus be given a
* different meaning for fcntl(2).
*/
#if __BSD_VISIBLE
/* Read ahead */
#define FRDAHEAD O_CREAT
#endif
# 195 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/fcntl.h" 3 4
#if __POSIX_VISIBLE >= 200809
/*
* Magic value that specify the use of the current working directory
* to determine the target of relative file paths in the openat() and
* similar syscalls.
*/
#define AT_FDCWD -100
/*
* Miscellaneous flags for the *at() syscalls.
*/
#define AT_EACCESS 0x100 /* Check access using effective user and group ID */
#define AT_SYMLINK_NOFOLLOW 0x200 /* Do not follow symbolic links */
#define AT_SYMLINK_FOLLOW 0x400 /* Follow symbolic link */
#define AT_REMOVEDIR 0x800 /* Remove directory instead of file */
#endif
# 212 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/fcntl.h" 3 4
/*
* Constants used for fcntl(2)
*/
/* command values */
#define F_DUPFD 0 /* duplicate file descriptor */
#define F_GETFD 1 /* get file descriptor flags */
#define F_SETFD 2 /* set file descriptor flags */
#define F_GETFL 3 /* get file status flags */
#define F_SETFL 4 /* set file status flags */
#if __XSI_VISIBLE || __POSIX_VISIBLE >= 200112
#define F_GETOWN 5 /* get SIGIO/SIGURG proc/pgrp */
#define F_SETOWN 6 /* set SIGIO/SIGURG proc/pgrp */
#endif
# 227 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/fcntl.h" 3 4
#if __BSD_VISIBLE
#define F_OGETLK 7 /* get record locking information */
#define F_OSETLK 8 /* set record locking information */
#define F_OSETLKW 9 /* F_SETLK; wait if blocked */
#define F_DUP2FD 10 /* duplicate file descriptor to arg */
#endif
# 233 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/fcntl.h" 3 4
#define F_GETLK 11 /* get record locking information */
#define F_SETLK 12 /* set record locking information */
#define F_SETLKW 13 /* F_SETLK; wait if blocked */
#if __BSD_VISIBLE
#define F_SETLK_REMOTE 14 /* debugging support for remote locks */
#define F_READAHEAD 15 /* read ahead */
#define F_RDAHEAD 16 /* Darwin compatible read ahead */
#endif
# 241 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/fcntl.h" 3 4
#if __POSIX_VISIBLE >= 200809
#define F_DUPFD_CLOEXEC 17 /* Like F_DUPFD, but FD_CLOEXEC is set */
#endif
# 244 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/fcntl.h" 3 4
#if __BSD_VISIBLE
#define F_DUP2FD_CLOEXEC 18 /* Like F_DUP2FD, but FD_CLOEXEC is set */
#endif
# 247 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/fcntl.h" 3 4
/* file descriptor flags (F_GETFD, F_SETFD) */
#define FD_CLOEXEC 1 /* close-on-exec flag */
/* record locking flags (F_GETLK, F_SETLK, F_SETLKW) */
#define F_RDLCK 1 /* shared or read lock */
#define F_UNLCK 2 /* unlock */
#define F_WRLCK 3 /* exclusive or write lock */
#if __BSD_VISIBLE
#define F_UNLCKSYS 4 /* purge locks for a given system ID */
#define F_CANCEL 5 /* cancel an async lock request */
#endif
# 259 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/fcntl.h" 3 4
#ifdef _KERNEL
#define F_WAIT 0x010 /* Wait until lock is granted */
#define F_FLOCK 0x020 /* Use flock(2) semantics for lock */
#define F_POSIX 0x040 /* Use POSIX semantics for lock */
#define F_REMOTE 0x080 /* Lock owner is remote NFS client */
#define F_NOINTR 0x100 /* Ignore signals when waiting */
#endif
# 266 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/fcntl.h" 3 4
/*
* Advisory file segment locking data type -
* information passed to system by user
*/
struct flock {
off_t l_start; /* starting offset */
off_t l_len; /* len = 0 means until end of file */
pid_t l_pid; /* lock owner */
short l_type; /* lock type: read/write, etc. */
short l_whence; /* type of l_start */
int l_sysid; /* remote system id or zero for local */
};
#if __BSD_VISIBLE
/*
* Old advisory file segment locking data type,
* before adding l_sysid.
*/
struct __oflock {
off_t l_start; /* starting offset */
off_t l_len; /* len = 0 means until end of file */
pid_t l_pid; /* lock owner */
short l_type; /* lock type: read/write, etc. */
short l_whence; /* type of l_start */
};
#endif
# 293 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/fcntl.h" 3 4
#if __BSD_VISIBLE
/* lock operations for flock(2) */
#define LOCK_SH 0x01 /* shared file lock */
#define LOCK_EX 0x02 /* exclusive file lock */
#define LOCK_NB 0x04 /* don't block when locking */
#define LOCK_UN 0x08 /* unlock file */
#endif
# 301 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/fcntl.h" 3 4
#if __POSIX_VISIBLE >= 200112
/*
* Advice to posix_fadvise
*/
#define POSIX_FADV_NORMAL 0 /* no special treatment */
#define POSIX_FADV_RANDOM 1 /* expect random page references */
#define POSIX_FADV_SEQUENTIAL 2 /* expect sequential page references */
#define POSIX_FADV_WILLNEED 3 /* will need these pages */
#define POSIX_FADV_DONTNEED 4 /* dont need these pages */
#define POSIX_FADV_NOREUSE 5 /* access data only once */
#endif
# 313 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/fcntl.h" 3 4
#ifndef _KERNEL
__BEGIN_DECLS
int open(const char *, int, ...);
int creat(const char *, mode_t);
int fcntl(int, int, ...);
#if __BSD_VISIBLE
int flock(int, int);
#endif
# 322 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/fcntl.h" 3 4
#if __POSIX_VISIBLE >= 200809
int openat(int, const char *, int, ...);
#endif
# 325 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/fcntl.h" 3 4
#if __POSIX_VISIBLE >= 200112
int posix_fadvise(int, off_t, off_t, int);
int posix_fallocate(int, off_t, off_t);
#endif
# 329 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/fcntl.h" 3 4
__END_DECLS
#endif
# 331 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/fcntl.h" 3 4
#endif /* !_SYS_FCNTL_H_ */
# 333 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/fcntl.h" 3 4
# 18 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/win32.h" 2
#if 0 /* expanded by -frewrite-includes */
# include <stdio.h>
#endif /* expanded by -frewrite-includes */
# 18 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/win32.h"
# 19 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/win32.h"
#if defined(WIN32)
#if 0 /* expanded by -frewrite-includes */
# include <io.h>
#endif /* expanded by -frewrite-includes */
# 21 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/win32.h"
# 22 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/win32.h"
#if 0 /* expanded by -frewrite-includes */
# include <sys/types.h>
#endif /* expanded by -frewrite-includes */
# 22 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/win32.h"
# 23 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/win32.h"
#if 0 /* expanded by -frewrite-includes */
# include <sys/stat.h>
#endif /* expanded by -frewrite-includes */
# 23 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/win32.h"
# 24 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/win32.h"
# define strcasecmp _strcmpi
# define snprintf _snprintf
# define open _open
# define close _close
# define read _read
# define write _write
# define lseek _lseeki64
# define fsync _commit
# define tell _tell
# define TIMEB _timeb
# define ftime _ftime
# define OPENFLAGS_WRITE _O_WRONLY|_O_CREAT|_O_BINARY|_O_TRUNC
# define OPEN_PERMISSIONS _S_IREAD | _S_IWRITE
# define OPENFLAGS_READ _O_RDONLY|_O_BINARY
# define inline _inline
#else
# 41 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/win32.h"
#if 0 /* expanded by -frewrite-includes */
# include <unistd.h>
#endif /* expanded by -frewrite-includes */
# 41 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/win32.h"
# 1 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/unistd.h" 1 3 4
/*-
* Copyright (c) 1991, 1993, 1994
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)unistd.h 8.12 (Berkeley) 4/27/95
* $FreeBSD$
*/
#ifndef _UNISTD_H_
#define _UNISTD_H_
#if 0 /* expanded by -frewrite-includes */
#include <sys/cdefs.h>
#endif /* expanded by -frewrite-includes */
# 36 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/unistd.h" 3 4
# 37 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/unistd.h" 3 4
#if 0 /* expanded by -frewrite-includes */
#include <sys/types.h> /* XXX adds too much pollution. */
#endif /* expanded by -frewrite-includes */
# 37 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/unistd.h" 3 4
# 1 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/types.h" 1 3 4
/*-
* Copyright (c) 1982, 1986, 1991, 1993, 1994
* The Regents of the University of California. All rights reserved.
* (c) UNIX System Laboratories, Inc.
* All or some portions of this file are derived from material licensed
* to the University of California by American Telephone and Telegraph
* Co. or Unix System Laboratories, Inc. and are reproduced herein with
* the permission of UNIX System Laboratories, Inc.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)types.h 8.6 (Berkeley) 2/19/95
* $FreeBSD$
*/
#ifndef _SYS_TYPES_H_
#define _SYS_TYPES_H_
#if 0 /* expanded by -frewrite-includes */
#include <sys/cdefs.h>
#endif /* expanded by -frewrite-includes */
# 41 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/types.h" 3 4
# 42 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/types.h" 3 4
/* Machine type dependent parameters. */
#if 0 /* expanded by -frewrite-includes */
#include <machine/endian.h>
#endif /* expanded by -frewrite-includes */
# 44 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/types.h" 3 4
# 1 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/machine/endian.h" 1 3 4
/*-
* Copyright (c) 1987, 1991 Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)endian.h 7.8 (Berkeley) 4/3/91
* $FreeBSD$
*/
#ifndef _MACHINE_ENDIAN_H_
#define _MACHINE_ENDIAN_H_
#if 0 /* expanded by -frewrite-includes */
#include <sys/cdefs.h>
#endif /* expanded by -frewrite-includes */
# 36 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/machine/endian.h" 3 4
# 37 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/machine/endian.h" 3 4
#ifndef __ASSEMBLER__
#if 0 /* expanded by -frewrite-includes */
#include <sys/_types.h>
#endif /* expanded by -frewrite-includes */
# 38 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/machine/endian.h" 3 4
# 39 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/machine/endian.h" 3 4
#endif
# 40 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/machine/endian.h" 3 4
#ifdef __cplusplus
extern "C" {
#endif
# 44 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/machine/endian.h" 3 4
/*
* Definitions for byte order, according to byte significance from low
* address to high.
*/
#define _LITTLE_ENDIAN 1234 /* LSB first: i386, vax */
#define _BIG_ENDIAN 4321 /* MSB first: 68000, ibm, net */
#define _PDP_ENDIAN 3412 /* LSB first in word, MSW first in long */
#ifdef __MIPSEB__
#define _BYTE_ORDER _BIG_ENDIAN
#else
# 56 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/machine/endian.h" 3 4
#define _BYTE_ORDER _LITTLE_ENDIAN
#endif /* __MIBSEB__ */
# 58 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/machine/endian.h" 3 4
/*
* Deprecated variants that don't have enough underscores to be useful in more
* strict namespaces.
*/
#if __BSD_VISIBLE
#define LITTLE_ENDIAN _LITTLE_ENDIAN
#define BIG_ENDIAN _BIG_ENDIAN
#define PDP_ENDIAN _PDP_ENDIAN
#define BYTE_ORDER _BYTE_ORDER
#endif
# 69 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/machine/endian.h" 3 4
#ifndef __ASSEMBLER__
#if defined(__GNUCLIKE_BUILTIN_CONSTANT_P) && defined(__OPTIMIZE__)
#define __is_constant(x) __builtin_constant_p(x)
#else
# 74 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/machine/endian.h" 3 4
#define __is_constant(x) 0
#endif
# 76 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/machine/endian.h" 3 4
#define __bswap16_const(x) (((x) >> 8) | (((x) << 8) & 0xff00))
#define __bswap32_const(x) (((x) >> 24) | (((x) >> 8) & 0xff00) | \
(((x) << 8) & 0xff0000) | (((x) << 24) & 0xff000000))
#define __bswap64_const(x) (((x) >> 56) | (((x) >> 40) & 0xff00) | \
(((x) >> 24) & 0xff0000) | (((x) >> 8) & 0xff000000) | \
(((x) << 8) & ((__uint64_t)0xff << 32)) | \
(((x) << 24) & ((__uint64_t)0xff << 40)) | \
(((x) << 40) & ((__uint64_t)0xff << 48)) | (((x) << 56)))
static __inline __uint16_t
__bswap16_var(__uint16_t _x)
{
return ((_x >> 8) | ((_x << 8) & 0xff00));
}
static __inline __uint32_t
__bswap32_var(__uint32_t _x)
{
return ((_x >> 24) | ((_x >> 8) & 0xff00) | ((_x << 8) & 0xff0000) |
((_x << 24) & 0xff000000));
}
static __inline __uint64_t
__bswap64_var(__uint64_t _x)
{
return ((_x >> 56) | ((_x >> 40) & 0xff00) | ((_x >> 24) & 0xff0000) |
((_x >> 8) & 0xff000000) | ((_x << 8) & ((__uint64_t)0xff << 32)) |
((_x << 24) & ((__uint64_t)0xff << 40)) |
((_x << 40) & ((__uint64_t)0xff << 48)) | ((_x << 56)));
}
#define __bswap16(x) ((__uint16_t)(__is_constant((x)) ? \
__bswap16_const((__uint16_t)(x)) : __bswap16_var((__uint16_t)(x))))
#define __bswap32(x) ((__uint32_t)(__is_constant((x)) ? \
__bswap32_const((__uint32_t)(x)) : __bswap32_var((__uint32_t)(x))))
#define __bswap64(x) ((__uint64_t)(__is_constant((x)) ? \
__bswap64_const((__uint64_t)(x)) : __bswap64_var((__uint64_t)(x))))
#ifdef __MIPSEB__
#define __htonl(x) ((__uint32_t)(x))
#define __htons(x) ((__uint16_t)(x))
#define __ntohl(x) ((__uint32_t)(x))
#define __ntohs(x) ((__uint16_t)(x))
/*
* Define the order of 32-bit words in 64-bit words.
*/
/*
* XXXMIPS: Additional parentheses to make gcc more happy.
*/
#define _QUAD_HIGHWORD 0
#define _QUAD_LOWWORD 1
#else
# 132 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/machine/endian.h" 3 4
#define _QUAD_HIGHWORD 1
#define _QUAD_LOWWORD 0
#define __ntohl(x) (__bswap32((x)))
#define __ntohs(x) (__bswap16((x)))
#define __htonl(x) (__bswap32((x)))
#define __htons(x) (__bswap16((x)))
#endif /* _MIPSEB */
# 139 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/machine/endian.h" 3 4
#endif /* _ASSEMBLER_ */
# 141 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/machine/endian.h" 3 4
#ifdef __cplusplus
}
#endif
# 145 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/machine/endian.h" 3 4
#endif /* !_MACHINE_ENDIAN_H_ */
# 147 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/machine/endian.h" 3 4
# 45 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/types.h" 2 3 4
#if 0 /* expanded by -frewrite-includes */
#include <sys/_types.h>
#endif /* expanded by -frewrite-includes */
# 45 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/types.h" 3 4
# 46 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/types.h" 3 4
#if 0 /* expanded by -frewrite-includes */
#include <sys/_pthreadtypes.h>
#endif /* expanded by -frewrite-includes */
# 47 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/types.h" 3 4
# 1 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/_pthreadtypes.h" 1 3 4
/*
* Copyright (c) 1993, 1994 by Chris Provenzano, [email protected]
* Copyright (c) 1995-1998 by John Birrell <[email protected]>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by Chris Provenzano.
* 4. The name of Chris Provenzano may not be used to endorse or promote
* products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY CHRIS PROVENZANO ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL CHRIS PROVENZANO BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $FreeBSD$
*/
#ifndef _SYS__PTHREADTYPES_H_
#define _SYS__PTHREADTYPES_H_
/*
* Forward structure definitions.
*
* These are mostly opaque to the user.
*/
struct pthread;
struct pthread_attr;
struct pthread_cond;
struct pthread_cond_attr;
struct pthread_mutex;
struct pthread_mutex_attr;
struct pthread_once;
struct pthread_rwlock;
struct pthread_rwlockattr;
struct pthread_barrier;
struct pthread_barrier_attr;
struct pthread_spinlock;
/*
* Primitive system data type definitions required by P1003.1c.
*
* Note that P1003.1c specifies that there are no defined comparison
* or assignment operators for the types pthread_attr_t, pthread_cond_t,
* pthread_condattr_t, pthread_mutex_t, pthread_mutexattr_t.
*/
#ifndef _PTHREAD_T_DECLARED
typedef struct pthread *pthread_t;
#define _PTHREAD_T_DECLARED
#endif
# 68 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/_pthreadtypes.h" 3 4
typedef struct pthread_attr *pthread_attr_t;
typedef struct pthread_mutex *pthread_mutex_t;
typedef struct pthread_mutex_attr *pthread_mutexattr_t;
typedef struct pthread_cond *pthread_cond_t;
typedef struct pthread_cond_attr *pthread_condattr_t;
typedef int pthread_key_t;
typedef struct pthread_once pthread_once_t;
typedef struct pthread_rwlock *pthread_rwlock_t;
typedef struct pthread_rwlockattr *pthread_rwlockattr_t;
typedef struct pthread_barrier *pthread_barrier_t;
typedef struct pthread_barrierattr *pthread_barrierattr_t;
typedef struct pthread_spinlock *pthread_spinlock_t;
/*
* Additional type definitions:
*
* Note that P1003.1c reserves the prefixes pthread_ and PTHREAD_ for
* use in header symbols.
*/
typedef void *pthread_addr_t;
typedef void *(*pthread_startroutine_t)(void *);
/*
* Once definitions.
*/
struct pthread_once {
int state;
pthread_mutex_t mutex;
};
#endif /* ! _SYS__PTHREADTYPES_H_ */
# 99 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/_pthreadtypes.h" 3 4
# 48 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/types.h" 2 3 4
#if __BSD_VISIBLE
typedef unsigned char u_char;
typedef unsigned short u_short;
typedef unsigned int u_int;
typedef unsigned long u_long;
#ifndef _KERNEL
typedef unsigned short ushort; /* Sys V compatibility */
typedef unsigned int uint; /* Sys V compatibility */
#endif
# 58 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/types.h" 3 4
#endif
# 59 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/types.h" 3 4
/*
* XXX POSIX sized integrals that should appear only in <sys/stdint.h>.
*/
#if 0 /* expanded by -frewrite-includes */
#include <sys/_stdint.h>
#endif /* expanded by -frewrite-includes */
# 63 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/types.h" 3 4
# 1 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/_stdint.h" 1 3 4
/*-
* Copyright (c) 2011 David E. O'Brien <[email protected]>
* Copyright (c) 2001 Mike Barcroft <[email protected]>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $FreeBSD$
*/
#ifndef _SYS__STDINT_H_
#define _SYS__STDINT_H_
#ifndef _INT8_T_DECLARED
typedef __int8_t int8_t;
#define _INT8_T_DECLARED
#endif
# 37 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/_stdint.h" 3 4
#ifndef _INT16_T_DECLARED
typedef __int16_t int16_t;
#define _INT16_T_DECLARED
#endif
# 42 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/_stdint.h" 3 4
#ifndef _INT32_T_DECLARED
typedef __int32_t int32_t;
#define _INT32_T_DECLARED
#endif
# 47 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/_stdint.h" 3 4
#ifndef _INT64_T_DECLARED
typedef __int64_t int64_t;
#define _INT64_T_DECLARED
#endif
# 52 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/_stdint.h" 3 4
#ifndef _UINT8_T_DECLARED
typedef __uint8_t uint8_t;
#define _UINT8_T_DECLARED
#endif
# 57 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/_stdint.h" 3 4
#ifndef _UINT16_T_DECLARED
typedef __uint16_t uint16_t;
#define _UINT16_T_DECLARED
#endif
# 62 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/_stdint.h" 3 4
#ifndef _UINT32_T_DECLARED
typedef __uint32_t uint32_t;
#define _UINT32_T_DECLARED
#endif
# 67 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/_stdint.h" 3 4
#ifndef _UINT64_T_DECLARED
typedef __uint64_t uint64_t;
#define _UINT64_T_DECLARED
#endif
# 72 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/_stdint.h" 3 4
#ifndef _INTPTR_T_DECLARED
typedef __intptr_t intptr_t;
#define _INTPTR_T_DECLARED
#endif
# 77 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/_stdint.h" 3 4
#ifndef _UINTPTR_T_DECLARED
typedef __uintptr_t uintptr_t;
#define _UINTPTR_T_DECLARED
#endif
# 81 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/_stdint.h" 3 4
#ifndef _INTMAX_T_DECLARED
typedef __intmax_t intmax_t;
#define _INTMAX_T_DECLARED
#endif
# 85 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/_stdint.h" 3 4
#ifndef _UINTMAX_T_DECLARED
typedef __uintmax_t uintmax_t;
#define _UINTMAX_T_DECLARED
#endif
# 89 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/_stdint.h" 3 4
#ifndef _VADDR_T_DECLARED
#ifndef __CHERI_PURE_CAPABILITY__
typedef __uintptr_t vaddr_t;
#else
# 94 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/_stdint.h" 3 4
typedef __uint64_t vaddr_t;
#endif
# 96 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/_stdint.h" 3 4
#define _VADDR_T_DECLARED
#endif
# 98 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/_stdint.h" 3 4
#endif /* !_SYS__STDINT_H_ */
# 100 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/_stdint.h" 3 4
# 64 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/types.h" 2 3 4
typedef __uint8_t u_int8_t; /* unsigned integrals (deprecated) */
typedef __uint16_t u_int16_t;
typedef __uint32_t u_int32_t;
typedef __uint64_t u_int64_t;
typedef __uint64_t u_quad_t; /* quads (deprecated) */
typedef __int64_t quad_t;
typedef quad_t * qaddr_t;
typedef char * caddr_t; /* core address */
typedef const char * c_caddr_t; /* core address, pointer to const */
#ifndef _BLKSIZE_T_DECLARED
typedef __blksize_t blksize_t;
#define _BLKSIZE_T_DECLARED
#endif
# 81 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/types.h" 3 4
typedef __cpuwhich_t cpuwhich_t;
typedef __cpulevel_t cpulevel_t;
typedef __cpusetid_t cpusetid_t;
#ifndef _BLKCNT_T_DECLARED
typedef __blkcnt_t blkcnt_t;
#define _BLKCNT_T_DECLARED
#endif
# 90 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/types.h" 3 4
#ifndef _CLOCK_T_DECLARED
typedef __clock_t clock_t;
#define _CLOCK_T_DECLARED
#endif
# 95 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/types.h" 3 4
#ifndef _CLOCKID_T_DECLARED
typedef __clockid_t clockid_t;
#define _CLOCKID_T_DECLARED
#endif
# 100 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/types.h" 3 4
typedef __critical_t critical_t; /* Critical section value */
typedef __int64_t daddr_t; /* disk address */
#ifndef _DEV_T_DECLARED
typedef __dev_t dev_t; /* device number or struct cdev */
#define _DEV_T_DECLARED
#endif
# 108 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/types.h" 3 4
#ifndef _FFLAGS_T_DECLARED
typedef __fflags_t fflags_t; /* file flags */
#define _FFLAGS_T_DECLARED
#endif
# 113 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/types.h" 3 4
typedef __fixpt_t fixpt_t; /* fixed point number */
#ifndef _FSBLKCNT_T_DECLARED /* for statvfs() */
typedef __fsblkcnt_t fsblkcnt_t;
typedef __fsfilcnt_t fsfilcnt_t;
#define _FSBLKCNT_T_DECLARED
#endif
# 121 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/types.h" 3 4
#ifndef _GID_T_DECLARED
typedef __gid_t gid_t; /* group id */
#define _GID_T_DECLARED
#endif
# 126 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/types.h" 3 4
#ifndef _IN_ADDR_T_DECLARED
typedef __uint32_t in_addr_t; /* base type for internet address */
#define _IN_ADDR_T_DECLARED
#endif
# 131 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/types.h" 3 4
#ifndef _IN_PORT_T_DECLARED
typedef __uint16_t in_port_t;
#define _IN_PORT_T_DECLARED
#endif
# 136 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/types.h" 3 4
#ifndef _ID_T_DECLARED
typedef __id_t id_t; /* can hold a uid_t or pid_t */
#define _ID_T_DECLARED
#endif
# 141 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/types.h" 3 4
#ifndef _INO_T_DECLARED
typedef __ino_t ino_t; /* inode number */
#define _INO_T_DECLARED
#endif
# 146 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/types.h" 3 4
#ifndef _KEY_T_DECLARED
typedef __key_t key_t; /* IPC key (for Sys V IPC) */
#define _KEY_T_DECLARED
#endif
# 151 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/types.h" 3 4
#ifndef _LWPID_T_DECLARED
typedef __lwpid_t lwpid_t; /* Thread ID (a.k.a. LWP) */
#define _LWPID_T_DECLARED
#endif
# 156 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/types.h" 3 4
#ifndef _MODE_T_DECLARED
typedef __mode_t mode_t; /* permissions */
#define _MODE_T_DECLARED
#endif
# 161 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/types.h" 3 4
#ifndef _ACCMODE_T_DECLARED
typedef __accmode_t accmode_t; /* access permissions */
#define _ACCMODE_T_DECLARED
#endif
# 166 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/types.h" 3 4
#ifndef _NLINK_T_DECLARED
typedef __nlink_t nlink_t; /* link count */
#define _NLINK_T_DECLARED
#endif
# 171 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/types.h" 3 4
#ifndef _OFF_T_DECLARED
typedef __off_t off_t; /* file offset */
#define _OFF_T_DECLARED
#endif
# 176 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/types.h" 3 4
#ifndef _OFF64_T_DECLARED
typedef __off64_t off64_t; /* file offset (alias) */
#define _OFF64_T_DECLARED
#endif
# 181 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/types.h" 3 4
#ifndef _PID_T_DECLARED
typedef __pid_t pid_t; /* process id */
#define _PID_T_DECLARED
#endif
# 186 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/types.h" 3 4
typedef __register_t register_t;
#ifndef _RLIM_T_DECLARED
typedef __rlim_t rlim_t; /* resource limit */
#define _RLIM_T_DECLARED
#endif
# 193 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/types.h" 3 4
typedef __int64_t sbintime_t;
typedef __segsz_t segsz_t; /* segment size (in pages) */
#ifndef _SIZE_T_DECLARED
typedef __size_t size_t;
#define _SIZE_T_DECLARED
#endif
# 202 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/types.h" 3 4
#ifndef _SSIZE_T_DECLARED
typedef __ssize_t ssize_t;
#define _SSIZE_T_DECLARED
#endif
# 207 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/types.h" 3 4
#ifndef _SUSECONDS_T_DECLARED
typedef __suseconds_t suseconds_t; /* microseconds (signed) */
#define _SUSECONDS_T_DECLARED
#endif
# 212 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/types.h" 3 4
#ifndef _TIME_T_DECLARED
typedef __time_t time_t;
#define _TIME_T_DECLARED
#endif
# 217 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/types.h" 3 4
#ifndef _TIMER_T_DECLARED
typedef __timer_t timer_t;
#define _TIMER_T_DECLARED
#endif
# 222 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/types.h" 3 4
#ifndef _MQD_T_DECLARED
typedef __mqd_t mqd_t;
#define _MQD_T_DECLARED
#endif
# 227 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/types.h" 3 4
typedef __u_register_t u_register_t;
#ifndef _UID_T_DECLARED
typedef __uid_t uid_t; /* user id */
#define _UID_T_DECLARED
#endif
# 234 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/types.h" 3 4
#ifndef _USECONDS_T_DECLARED
typedef __useconds_t useconds_t; /* microseconds (unsigned) */
#define _USECONDS_T_DECLARED
#endif
# 239 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/types.h" 3 4
#ifndef _CAP_IOCTL_T_DECLARED
#define _CAP_IOCTL_T_DECLARED
typedef unsigned long cap_ioctl_t;
#endif
# 244 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/types.h" 3 4
#ifndef _CAP_RIGHTS_T_DECLARED
#define _CAP_RIGHTS_T_DECLARED
struct cap_rights;
typedef struct cap_rights cap_rights_t;
#endif
# 251 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/types.h" 3 4
typedef __vm_offset_t vm_offset_t;
typedef __int64_t vm_ooffset_t;
typedef __vm_paddr_t vm_paddr_t;
typedef __uint64_t vm_pindex_t;
typedef __vm_size_t vm_size_t;
typedef __rman_res_t rman_res_t;
#ifdef _KERNEL
typedef int boolean_t;
typedef struct device *device_t;
typedef __intfptr_t intfptr_t;
/*
* XXX this is fixed width for historical reasons. It should have had type
* __int_fast32_t. Fixed-width types should not be used unless binary
* compatibility is essential. Least-width types should be used even less
* since they provide smaller benefits.
*
* XXX should be MD.
*
* XXX this is bogus in -current, but still used for spl*().
*/
typedef __uint32_t intrmask_t; /* Interrupt mask (spl, xxx_imask...) */
typedef __uintfptr_t uintfptr_t;
typedef __uint64_t uoff_t;
typedef char vm_memattr_t; /* memory attribute codes */
typedef struct vm_page *vm_page_t;
#if !defined(__bool_true_false_are_defined) && !defined(__cplusplus)
#define __bool_true_false_are_defined 1
#define false 0
#define true 1
#if __STDC_VERSION__ < 199901L && __GNUC__ < 3 && !defined(__INTEL_COMPILER)
typedef int _Bool;
#endif
# 289 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/types.h" 3 4
typedef _Bool bool;
#endif /* !__bool_true_false_are_defined && !__cplusplus */
# 291 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/types.h" 3 4
#define offsetof(type, field) __offsetof(type, field)
#endif /* !_KERNEL */
# 295 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/types.h" 3 4
/*
* The following are all things that really shouldn't exist in this header,
* since its purpose is to provide typedefs, not miscellaneous doodads.
*/
#ifdef __POPCNT__
#define __bitcount64(x) __builtin_popcountll((__uint64_t)(x))
#define __bitcount32(x) __builtin_popcount((__uint32_t)(x))
#define __bitcount16(x) __builtin_popcount((__uint16_t)(x))
#define __bitcountl(x) __builtin_popcountl((unsigned long)(x))
#define __bitcount(x) __builtin_popcount((unsigned int)(x))
#else
# 308 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/types.h" 3 4
/*
* Population count algorithm using SWAR approach
* - "SIMD Within A Register".
*/
static __inline __uint16_t
__bitcount16(__uint16_t _x)
{
_x = (_x & 0x5555) + ((_x & 0xaaaa) >> 1);
_x = (_x & 0x3333) + ((_x & 0xcccc) >> 2);
_x = (_x + (_x >> 4)) & 0x0f0f;
_x = (_x + (_x >> 8)) & 0x00ff;
return (_x);
}
static __inline __uint32_t
__bitcount32(__uint32_t _x)
{
_x = (_x & 0x55555555) + ((_x & 0xaaaaaaaa) >> 1);
_x = (_x & 0x33333333) + ((_x & 0xcccccccc) >> 2);
_x = (_x + (_x >> 4)) & 0x0f0f0f0f;
_x = (_x + (_x >> 8));
_x = (_x + (_x >> 16)) & 0x000000ff;
return (_x);
}
#ifdef __LP64__
static __inline __uint64_t
__bitcount64(__uint64_t _x)
{
_x = (_x & 0x5555555555555555) + ((_x & 0xaaaaaaaaaaaaaaaa) >> 1);
_x = (_x & 0x3333333333333333) + ((_x & 0xcccccccccccccccc) >> 2);
_x = (_x + (_x >> 4)) & 0x0f0f0f0f0f0f0f0f;
_x = (_x + (_x >> 8));
_x = (_x + (_x >> 16));
_x = (_x + (_x >> 32)) & 0x000000ff;
return (_x);
}
#define __bitcountl(x) __bitcount64((unsigned long)(x))
#else
# 351 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/types.h" 3 4
static __inline __uint64_t
__bitcount64(__uint64_t _x)
{
return (__bitcount32(_x >> 32) + __bitcount32(_x));
}
#define __bitcountl(x) __bitcount32((unsigned long)(x))
#endif
# 360 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/types.h" 3 4
#define __bitcount(x) __bitcount32((unsigned int)(x))
#endif
# 362 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/types.h" 3 4
#if __BSD_VISIBLE
#if 0 /* expanded by -frewrite-includes */
#include <sys/select.h>
#endif /* expanded by -frewrite-includes */
# 365 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/types.h" 3 4
# 1 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/select.h" 1 3 4
/*-
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $FreeBSD$
*/
#ifndef _SYS_SELECT_H_
#define _SYS_SELECT_H_
#if 0 /* expanded by -frewrite-includes */
#include <sys/cdefs.h>
#endif /* expanded by -frewrite-includes */
# 35 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/select.h" 3 4
# 36 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/select.h" 3 4
#if 0 /* expanded by -frewrite-includes */
#include <sys/_types.h>
#endif /* expanded by -frewrite-includes */
# 36 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/select.h" 3 4
# 37 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/select.h" 3 4
#if 0 /* expanded by -frewrite-includes */
#include <sys/_sigset.h>
#endif /* expanded by -frewrite-includes */
# 38 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/select.h" 3 4
# 1 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/_sigset.h" 1 3 4
/*-
* Copyright (c) 1982, 1986, 1989, 1991, 1993
* The Regents of the University of California. All rights reserved.
* (c) UNIX System Laboratories, Inc.
* All or some portions of this file are derived from material licensed
* to the University of California by American Telephone and Telegraph
* Co. or Unix System Laboratories, Inc. and are reproduced herein with
* the permission of UNIX System Laboratories, Inc.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)signal.h 8.4 (Berkeley) 5/4/95
* $FreeBSD$
*/
#ifndef _SYS__SIGSET_H_
#define _SYS__SIGSET_H_
/*
* sigset_t macros.
*/
#define _SIG_WORDS 4
#define _SIG_MAXSIG 128
#define _SIG_IDX(sig) ((sig) - 1)
#define _SIG_WORD(sig) (_SIG_IDX(sig) >> 5)
#define _SIG_BIT(sig) (1 << (_SIG_IDX(sig) & 31))
#define _SIG_VALID(sig) ((sig) <= _SIG_MAXSIG && (sig) > 0)
typedef struct __sigset {
__uint32_t __bits[_SIG_WORDS];
} __sigset_t;
#if defined(_KERNEL) && defined(COMPAT_43)
typedef unsigned int osigset_t;
#endif
# 58 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/_sigset.h" 3 4
#endif /* !_SYS__SIGSET_H_ */
# 60 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/_sigset.h" 3 4
# 39 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/select.h" 2 3 4
#if 0 /* expanded by -frewrite-includes */
#include <sys/_timeval.h>
#endif /* expanded by -frewrite-includes */
# 39 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/select.h" 3 4
# 1 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/_timeval.h" 1 3 4
/*-
* Copyright (c) 2002 Mike Barcroft <[email protected]>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $FreeBSD$
*/
#ifndef _SYS__TIMEVAL_H_
#define _SYS__TIMEVAL_H_
#if 0 /* expanded by -frewrite-includes */
#include <sys/_types.h>
#endif /* expanded by -frewrite-includes */
# 32 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/_timeval.h" 3 4
# 33 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/_timeval.h" 3 4
#ifndef _SUSECONDS_T_DECLARED
typedef __suseconds_t suseconds_t;
#define _SUSECONDS_T_DECLARED
#endif
# 38 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/_timeval.h" 3 4
#ifndef _TIME_T_DECLARED
typedef __time_t time_t;
#define _TIME_T_DECLARED
#endif
# 43 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/_timeval.h" 3 4
/*
* Structure returned by gettimeofday(2) system call, and used in other calls.
*/
struct timeval {
time_t tv_sec; /* seconds */
suseconds_t tv_usec; /* and microseconds */
};
#endif /* !_SYS__TIMEVAL_H_ */
# 53 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/_timeval.h" 3 4
# 40 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/select.h" 2 3 4
#if 0 /* expanded by -frewrite-includes */
#include <sys/timespec.h>
#endif /* expanded by -frewrite-includes */
# 40 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/select.h" 3 4
# 41 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/select.h" 3 4
typedef unsigned long __fd_mask;
#if __BSD_VISIBLE
typedef __fd_mask fd_mask;
#endif
# 46 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/select.h" 3 4
#ifndef _SIGSET_T_DECLARED
#define _SIGSET_T_DECLARED
typedef __sigset_t sigset_t;
#endif
# 51 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/select.h" 3 4
/*
* Select uses bit masks of file descriptors in longs. These macros
* manipulate such bit fields (the filesystem macros use chars).
* FD_SETSIZE may be defined by the user, but the default here should
* be enough for most uses.
*/
#ifndef FD_SETSIZE
#define FD_SETSIZE 1024
#endif
# 61 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/select.h" 3 4
#define _NFDBITS (sizeof(__fd_mask) * 8) /* bits per mask */
#if __BSD_VISIBLE
#define NFDBITS _NFDBITS
#endif
# 66 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/select.h" 3 4
#ifndef _howmany
#define _howmany(x, y) (((x) + ((y) - 1)) / (y))
#endif
# 70 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/select.h" 3 4
typedef struct fd_set {
__fd_mask __fds_bits[_howmany(FD_SETSIZE, _NFDBITS)];
} fd_set;
#if __BSD_VISIBLE
#define fds_bits __fds_bits
#endif
# 77 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/select.h" 3 4
#define __fdset_mask(n) ((__fd_mask)1 << ((n) % _NFDBITS))
#define FD_CLR(n, p) ((p)->__fds_bits[(n)/_NFDBITS] &= ~__fdset_mask(n))
#if __BSD_VISIBLE
#define FD_COPY(f, t) (void)(*(t) = *(f))
#endif
# 83 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/select.h" 3 4
#define FD_ISSET(n, p) (((p)->__fds_bits[(n)/_NFDBITS] & __fdset_mask(n)) != 0)
#define FD_SET(n, p) ((p)->__fds_bits[(n)/_NFDBITS] |= __fdset_mask(n))
#define FD_ZERO(p) do { \
fd_set *_p; \
__size_t _n; \
\
_p = (p); \
_n = _howmany(FD_SETSIZE, _NFDBITS); \
while (_n > 0) \
_p->__fds_bits[--_n] = 0; \
} while (0)
#ifndef _KERNEL
__BEGIN_DECLS
int pselect(int, fd_set *__restrict, fd_set *__restrict, fd_set *__restrict,
const struct timespec *__restrict, const sigset_t *__restrict);
#ifndef _SELECT_DECLARED
#define _SELECT_DECLARED
/* XXX missing restrict type-qualifier */
int select(int, fd_set *, fd_set *, fd_set *, struct timeval *);
#endif
# 105 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/select.h" 3 4
__END_DECLS
#endif /* !_KERNEL */
# 107 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/select.h" 3 4
#endif /* _SYS_SELECT_H_ */
# 109 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/select.h" 3 4
# 366 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/types.h" 2 3 4
/*
* minor() gives a cookie instead of an index since we don't want to
* change the meanings of bits 0-15 or waste time and space shifting
* bits 16-31 for devices that don't use them.
*/
#define major(x) ((int)(((u_int)(x) >> 8)&0xff)) /* major number */
#define minor(x) ((int)((x)&0xffff00ff)) /* minor number */
#define makedev(x,y) ((dev_t)(((x) << 8) | (y))) /* create dev_t */
/*
* These declarations belong elsewhere, but are repeated here and in
* <stdio.h> to give broken programs a better chance of working with
* 64-bit off_t's.
*/
#ifndef _KERNEL
__BEGIN_DECLS
#ifndef _FTRUNCATE_DECLARED
#define _FTRUNCATE_DECLARED
int ftruncate(int, off_t);
#endif
# 387 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/types.h" 3 4
#ifndef _LSEEK_DECLARED
#define _LSEEK_DECLARED
off_t lseek(int, off_t, int);
#endif
# 391 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/types.h" 3 4
#ifndef _MMAP_DECLARED
#define _MMAP_DECLARED
void * mmap(void *, size_t, int, int, int, off_t);
#endif
# 395 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/types.h" 3 4
#ifndef _TRUNCATE_DECLARED
#define _TRUNCATE_DECLARED
int truncate(const char *, off_t);
#endif
# 399 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/types.h" 3 4
__END_DECLS
#endif /* !_KERNEL */
# 401 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/types.h" 3 4
#endif /* __BSD_VISIBLE */
# 403 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/types.h" 3 4
#endif /* !_SYS_TYPES_H_ */
# 405 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/types.h" 3 4
# 38 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/unistd.h" 2 3 4
#if 0 /* expanded by -frewrite-includes */
#include <sys/unistd.h>
#endif /* expanded by -frewrite-includes */
# 38 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/unistd.h" 3 4
# 1 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/unistd.h" 1 3 4
/*-
* Copyright (c) 1989, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)unistd.h 8.2 (Berkeley) 1/7/94
* $FreeBSD$
*/
#ifndef _SYS_UNISTD_H_
#define _SYS_UNISTD_H_
#if 0 /* expanded by -frewrite-includes */
#include <sys/cdefs.h>
#endif /* expanded by -frewrite-includes */
# 36 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/unistd.h" 3 4
# 37 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/unistd.h" 3 4
/*
* POSIX options and option groups we unconditionally do or don't
* implement. Those options which are implemented (or not) entirely
* in user mode are defined in <unistd.h>. Please keep this list in
* alphabetical order.
*
* Anything which is defined as zero below **must** have an
* implementation for the corresponding sysconf() which is able to
* determine conclusively whether or not the feature is supported.
* Anything which is defined as other than -1 below **must** have
* complete headers, types, and function declarations as specified by
* the POSIX standard; however, if the relevant sysconf() function
* returns -1, the functions may be stubbed out.
*/
#define _POSIX_ADVISORY_INFO 200112L
#define _POSIX_ASYNCHRONOUS_IO 200112L
#define _POSIX_CHOWN_RESTRICTED 1
#define _POSIX_CLOCK_SELECTION (-1)
#define _POSIX_CPUTIME 200112L
#define _POSIX_FSYNC 200112L
#define _POSIX_IPV6 0
#define _POSIX_JOB_CONTROL 1
#define _POSIX_MAPPED_FILES 200112L
#define _POSIX_MEMLOCK (-1)
#define _POSIX_MEMLOCK_RANGE 200112L
#define _POSIX_MEMORY_PROTECTION 200112L
#define _POSIX_MESSAGE_PASSING 200112L
#define _POSIX_MONOTONIC_CLOCK 200112L
#define _POSIX_NO_TRUNC 1
#define _POSIX_PRIORITIZED_IO (-1)
#define _POSIX_PRIORITY_SCHEDULING 0
#define _POSIX_RAW_SOCKETS 200112L
#define _POSIX_REALTIME_SIGNALS 200112L
#define _POSIX_SEMAPHORES 200112L
#define _POSIX_SHARED_MEMORY_OBJECTS 200112L
#define _POSIX_SPORADIC_SERVER (-1)
#define _POSIX_SYNCHRONIZED_IO (-1)
#define _POSIX_TIMEOUTS 200112L
#define _POSIX_TIMERS 200112L
#define _POSIX_TYPED_MEMORY_OBJECTS (-1)
#define _POSIX_VDISABLE 0xff
#if __XSI_VISIBLE
#define _XOPEN_SHM 1
#define _XOPEN_STREAMS (-1)
#endif
# 84 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/unistd.h" 3 4
/*
* Although we have saved user/group IDs, we do not use them in setuid
* as described in POSIX 1003.1, because the feature does not work for
* root. We use the saved IDs in seteuid/setegid, which are not currently
* part of the POSIX 1003.1 specification. XXX revisit for 1003.1-2001
* as this is now mandatory.
*/
#ifdef _NOT_AVAILABLE
#define _POSIX_SAVED_IDS 1 /* saved set-user-ID and set-group-ID */
#endif
# 95 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/unistd.h" 3 4
/* Define the POSIX.1 version we target for compliance. */
#define _POSIX_VERSION 200112L
/* access function */
#define F_OK 0 /* test for existence of file */
#define X_OK 0x01 /* test for execute or search permission */
#define W_OK 0x02 /* test for write permission */
#define R_OK 0x04 /* test for read permission */
/* whence values for lseek(2) */
#ifndef SEEK_SET
#define SEEK_SET 0 /* set file offset to offset */
#define SEEK_CUR 1 /* set file offset to current plus offset */
#define SEEK_END 2 /* set file offset to EOF plus offset */
#endif
# 111 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/unistd.h" 3 4
#if __BSD_VISIBLE
#define SEEK_DATA 3 /* set file offset to next data past offset */
#define SEEK_HOLE 4 /* set file offset to next hole past offset */
#endif
# 115 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/unistd.h" 3 4
#ifndef _POSIX_SOURCE
/* whence values for lseek(2); renamed by POSIX 1003.1 */
#define L_SET SEEK_SET
#define L_INCR SEEK_CUR
#define L_XTND SEEK_END
#endif
# 122 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/unistd.h" 3 4
/* configurable pathname variables */
#define _PC_LINK_MAX 1
#define _PC_MAX_CANON 2
#define _PC_MAX_INPUT 3
#define _PC_NAME_MAX 4
#define _PC_PATH_MAX 5
#define _PC_PIPE_BUF 6
#define _PC_CHOWN_RESTRICTED 7
#define _PC_NO_TRUNC 8
#define _PC_VDISABLE 9
#if __POSIX_VISIBLE >= 199309
#define _PC_ASYNC_IO 53
#define _PC_PRIO_IO 54
#define _PC_SYNC_IO 55
#endif
# 139 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/unistd.h" 3 4
#if __POSIX_VISIBLE >= 200112
#define _PC_ALLOC_SIZE_MIN 10
#define _PC_FILESIZEBITS 12
#define _PC_REC_INCR_XFER_SIZE 14
#define _PC_REC_MAX_XFER_SIZE 15
#define _PC_REC_MIN_XFER_SIZE 16
#define _PC_REC_XFER_ALIGN 17
#define _PC_SYMLINK_MAX 18
#endif
# 149 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/unistd.h" 3 4
#if __BSD_VISIBLE
#define _PC_ACL_EXTENDED 59
#define _PC_ACL_PATH_MAX 60
#define _PC_CAP_PRESENT 61
#define _PC_INF_PRESENT 62
#define _PC_MAC_PRESENT 63
#define _PC_ACL_NFS4 64
#endif
# 158 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/unistd.h" 3 4
/* From OpenSolaris, used by SEEK_DATA/SEEK_HOLE. */
#define _PC_MIN_HOLE_SIZE 21
#if __BSD_VISIBLE
/*
* rfork() options.
*
* XXX currently, some operations without RFPROC set are not supported.
*/
#define RFNAMEG (1<<0) /* UNIMPL new plan9 `name space' */
#define RFENVG (1<<1) /* UNIMPL copy plan9 `env space' */
#define RFFDG (1<<2) /* copy fd table */
#define RFNOTEG (1<<3) /* UNIMPL create new plan9 `note group' */
#define RFPROC (1<<4) /* change child (else changes curproc) */
#define RFMEM (1<<5) /* share `address space' */
#define RFNOWAIT (1<<6) /* give child to init */
#define RFCNAMEG (1<<10) /* UNIMPL zero plan9 `name space' */
#define RFCENVG (1<<11) /* UNIMPL zero plan9 `env space' */
#define RFCFDG (1<<12) /* close all fds, zero fd table */
#define RFTHREAD (1<<13) /* enable kernel thread support */
#define RFSIGSHARE (1<<14) /* share signal handlers */
#define RFLINUXTHPN (1<<16) /* do linux clone exit parent notification */
#define RFSTOPPED (1<<17) /* leave child in a stopped state */
#define RFHIGHPID (1<<18) /* use a pid higher than 10 (idleproc) */
#define RFTSIGZMB (1<<19) /* select signal for exit parent notification */
#define RFTSIGSHIFT 20 /* selected signal number is in bits 20-27 */
#define RFTSIGMASK 0xFF
#define RFTSIGNUM(flags) (((flags) >> RFTSIGSHIFT) & RFTSIGMASK)
#define RFTSIGFLAGS(signum) ((signum) << RFTSIGSHIFT)
#define RFPROCDESC (1<<28) /* return a process descriptor */
#define RFPPWAIT (1<<31) /* parent sleeps until child exits (vfork) */
#define RFFLAGS (RFFDG | RFPROC | RFMEM | RFNOWAIT | RFCFDG | \
RFTHREAD | RFSIGSHARE | RFLINUXTHPN | RFSTOPPED | RFHIGHPID | RFTSIGZMB | \
RFPROCDESC | RFPPWAIT)
#define RFKERNELONLY (RFSTOPPED | RFHIGHPID | RFPPWAIT | RFPROCDESC)
#endif /* __BSD_VISIBLE */
# 196 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/unistd.h" 3 4
#endif /* !_SYS_UNISTD_H_ */
# 198 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/sys/unistd.h" 3 4
# 39 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/unistd.h" 2 3 4
#if 0 /* expanded by -frewrite-includes */
#include <sys/_null.h>
#endif /* expanded by -frewrite-includes */
# 39 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/unistd.h" 3 4
# 40 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/unistd.h" 3 4
#if 0 /* expanded by -frewrite-includes */
#include <sys/_types.h>
#endif /* expanded by -frewrite-includes */
# 40 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/unistd.h" 3 4
# 41 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/unistd.h" 3 4
#ifndef _GID_T_DECLARED
typedef __gid_t gid_t;
#define _GID_T_DECLARED
#endif
# 46 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/unistd.h" 3 4
#ifndef _OFF_T_DECLARED
typedef __off_t off_t;
#define _OFF_T_DECLARED
#endif
# 51 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/unistd.h" 3 4
#ifndef _PID_T_DECLARED
typedef __pid_t pid_t;
#define _PID_T_DECLARED
#endif
# 56 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/unistd.h" 3 4
#ifndef _SIZE_T_DECLARED
typedef __size_t size_t;
#define _SIZE_T_DECLARED
#endif
# 61 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/unistd.h" 3 4
#ifndef _SSIZE_T_DECLARED
typedef __ssize_t ssize_t;
#define _SSIZE_T_DECLARED
#endif
# 66 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/unistd.h" 3 4
#ifndef _UID_T_DECLARED
typedef __uid_t uid_t;
#define _UID_T_DECLARED
#endif
# 71 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/unistd.h" 3 4
#ifndef _USECONDS_T_DECLARED
typedef __useconds_t useconds_t;
#define _USECONDS_T_DECLARED
#endif
# 76 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/unistd.h" 3 4
#define STDIN_FILENO 0 /* standard input file descriptor */
#define STDOUT_FILENO 1 /* standard output file descriptor */
#define STDERR_FILENO 2 /* standard error file descriptor */
#if __XSI_VISIBLE || __POSIX_VISIBLE >= 200112
#define F_ULOCK 0 /* unlock locked section */
#define F_LOCK 1 /* lock a section for exclusive use */
#define F_TLOCK 2 /* test and lock a section for exclusive use */
#define F_TEST 3 /* test a section for locks by other procs */
#endif
# 87 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/unistd.h" 3 4
/*
* POSIX options and option groups we unconditionally do or don't
* implement. This list includes those options which are exclusively
* implemented (or not) in user mode. Please keep this list in
* alphabetical order.
*
* Anything which is defined as zero below **must** have an
* implementation for the corresponding sysconf() which is able to
* determine conclusively whether or not the feature is supported.
* Anything which is defined as other than -1 below **must** have
* complete headers, types, and function declarations as specified by
* the POSIX standard; however, if the relevant sysconf() function
* returns -1, the functions may be stubbed out.
*/
#define _POSIX_BARRIERS 200112L
#define _POSIX_CPUTIME 200112L
#define _POSIX_READER_WRITER_LOCKS 200112L
#define _POSIX_REGEXP 1
#define _POSIX_SHELL 1
#define _POSIX_SPAWN 200112L
#define _POSIX_SPIN_LOCKS 200112L
#define _POSIX_THREAD_ATTR_STACKADDR 200112L
#define _POSIX_THREAD_ATTR_STACKSIZE 200112L
#define _POSIX_THREAD_CPUTIME 200112L
#define _POSIX_THREAD_PRIO_INHERIT 200112L
#define _POSIX_THREAD_PRIO_PROTECT 200112L
#define _POSIX_THREAD_PRIORITY_SCHEDULING 200112L
#define _POSIX_THREAD_PROCESS_SHARED 200112L
#define _POSIX_THREAD_SAFE_FUNCTIONS -1
#define _POSIX_THREAD_SPORADIC_SERVER -1
#define _POSIX_THREADS 200112L
#define _POSIX_TRACE -1
#define _POSIX_TRACE_EVENT_FILTER -1
#define _POSIX_TRACE_INHERIT -1
#define _POSIX_TRACE_LOG -1
#define _POSIX2_C_BIND 200112L /* mandatory */
#define _POSIX2_C_DEV -1 /* need c99 utility */
#define _POSIX2_CHAR_TERM 1
#define _POSIX2_FORT_DEV -1 /* need fort77 utility */
#define _POSIX2_FORT_RUN 200112L
#define _POSIX2_LOCALEDEF -1
#define _POSIX2_PBS -1
#define _POSIX2_PBS_ACCOUNTING -1
#define _POSIX2_PBS_CHECKPOINT -1
#define _POSIX2_PBS_LOCATE -1
#define _POSIX2_PBS_MESSAGE -1
#define _POSIX2_PBS_TRACK -1
#define _POSIX2_SW_DEV -1 /* XXX ??? */
#define _POSIX2_UPE 200112L
#define _V6_ILP32_OFF32 -1
#define _V6_ILP32_OFFBIG 0
#define _V6_LP64_OFF64 0
#define _V6_LPBIG_OFFBIG -1
#if __XSI_VISIBLE
#define _XOPEN_CRYPT -1 /* XXX ??? */
#define _XOPEN_ENH_I18N -1 /* mandatory in XSI */
#define _XOPEN_LEGACY -1
#define _XOPEN_REALTIME -1
#define _XOPEN_REALTIME_THREADS -1
#define _XOPEN_UNIX -1
#endif
# 150 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/unistd.h" 3 4
/* Define the POSIX.2 version we target for compliance. */
#define _POSIX2_VERSION 199212L
/*
* POSIX-style system configuration variable accessors (for the
* sysconf function). The kernel does not directly implement the
* sysconf() interface; rather, a C library stub translates references
* to sysconf() into calls to sysctl() using a giant switch statement.
* Those that are marked `user' are implemented entirely in the C
* library and never query the kernel. pathconf() is implemented
* directly by the kernel so those are not defined here.
*/
#define _SC_ARG_MAX 1
#define _SC_CHILD_MAX 2
#define _SC_CLK_TCK 3
#define _SC_NGROUPS_MAX 4
#define _SC_OPEN_MAX 5
#define _SC_JOB_CONTROL 6
#define _SC_SAVED_IDS 7
#define _SC_VERSION 8
#define _SC_BC_BASE_MAX 9 /* user */
#define _SC_BC_DIM_MAX 10 /* user */
#define _SC_BC_SCALE_MAX 11 /* user */
#define _SC_BC_STRING_MAX 12 /* user */
#define _SC_COLL_WEIGHTS_MAX 13 /* user */
#define _SC_EXPR_NEST_MAX 14 /* user */
#define _SC_LINE_MAX 15 /* user */
#define _SC_RE_DUP_MAX 16 /* user */
#define _SC_2_VERSION 17 /* user */
#define _SC_2_C_BIND 18 /* user */
#define _SC_2_C_DEV 19 /* user */
#define _SC_2_CHAR_TERM 20 /* user */
#define _SC_2_FORT_DEV 21 /* user */
#define _SC_2_FORT_RUN 22 /* user */
#define _SC_2_LOCALEDEF 23 /* user */
#define _SC_2_SW_DEV 24 /* user */
#define _SC_2_UPE 25 /* user */
#define _SC_STREAM_MAX 26 /* user */
#define _SC_TZNAME_MAX 27 /* user */
#if __POSIX_VISIBLE >= 199309
#define _SC_ASYNCHRONOUS_IO 28
#define _SC_MAPPED_FILES 29
#define _SC_MEMLOCK 30
#define _SC_MEMLOCK_RANGE 31
#define _SC_MEMORY_PROTECTION 32
#define _SC_MESSAGE_PASSING 33
#define _SC_PRIORITIZED_IO 34
#define _SC_PRIORITY_SCHEDULING 35
#define _SC_REALTIME_SIGNALS 36
#define _SC_SEMAPHORES 37
#define _SC_FSYNC 38
#define _SC_SHARED_MEMORY_OBJECTS 39
#define _SC_SYNCHRONIZED_IO 40
#define _SC_TIMERS 41
#define _SC_AIO_LISTIO_MAX 42
#define _SC_AIO_MAX 43
#define _SC_AIO_PRIO_DELTA_MAX 44
#define _SC_DELAYTIMER_MAX 45
#define _SC_MQ_OPEN_MAX 46
#define _SC_PAGESIZE 47
#define _SC_RTSIG_MAX 48
#define _SC_SEM_NSEMS_MAX 49
#define _SC_SEM_VALUE_MAX 50
#define _SC_SIGQUEUE_MAX 51
#define _SC_TIMER_MAX 52
#endif
# 218 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/unistd.h" 3 4
#if __POSIX_VISIBLE >= 200112
#define _SC_2_PBS 59 /* user */
#define _SC_2_PBS_ACCOUNTING 60 /* user */
#define _SC_2_PBS_CHECKPOINT 61 /* user */
#define _SC_2_PBS_LOCATE 62 /* user */
#define _SC_2_PBS_MESSAGE 63 /* user */
#define _SC_2_PBS_TRACK 64 /* user */
#define _SC_ADVISORY_INFO 65
#define _SC_BARRIERS 66 /* user */
#define _SC_CLOCK_SELECTION 67
#define _SC_CPUTIME 68
#define _SC_FILE_LOCKING 69
#define _SC_GETGR_R_SIZE_MAX 70 /* user */
#define _SC_GETPW_R_SIZE_MAX 71 /* user */
#define _SC_HOST_NAME_MAX 72
#define _SC_LOGIN_NAME_MAX 73
#define _SC_MONOTONIC_CLOCK 74
#define _SC_MQ_PRIO_MAX 75
#define _SC_READER_WRITER_LOCKS 76 /* user */
#define _SC_REGEXP 77 /* user */
#define _SC_SHELL 78 /* user */
#define _SC_SPAWN 79 /* user */
#define _SC_SPIN_LOCKS 80 /* user */
#define _SC_SPORADIC_SERVER 81
#define _SC_THREAD_ATTR_STACKADDR 82 /* user */
#define _SC_THREAD_ATTR_STACKSIZE 83 /* user */
#define _SC_THREAD_CPUTIME 84 /* user */
#define _SC_THREAD_DESTRUCTOR_ITERATIONS 85 /* user */
#define _SC_THREAD_KEYS_MAX 86 /* user */
#define _SC_THREAD_PRIO_INHERIT 87 /* user */
#define _SC_THREAD_PRIO_PROTECT 88 /* user */
#define _SC_THREAD_PRIORITY_SCHEDULING 89 /* user */
#define _SC_THREAD_PROCESS_SHARED 90 /* user */
#define _SC_THREAD_SAFE_FUNCTIONS 91 /* user */
#define _SC_THREAD_SPORADIC_SERVER 92 /* user */
#define _SC_THREAD_STACK_MIN 93 /* user */
#define _SC_THREAD_THREADS_MAX 94 /* user */
#define _SC_TIMEOUTS 95 /* user */
#define _SC_THREADS 96 /* user */
#define _SC_TRACE 97 /* user */
#define _SC_TRACE_EVENT_FILTER 98 /* user */
#define _SC_TRACE_INHERIT 99 /* user */
#define _SC_TRACE_LOG 100 /* user */
#define _SC_TTY_NAME_MAX 101 /* user */
#define _SC_TYPED_MEMORY_OBJECTS 102
#define _SC_V6_ILP32_OFF32 103 /* user */
#define _SC_V6_ILP32_OFFBIG 104 /* user */
#define _SC_V6_LP64_OFF64 105 /* user */
#define _SC_V6_LPBIG_OFFBIG 106 /* user */
#define _SC_IPV6 118
#define _SC_RAW_SOCKETS 119
#define _SC_SYMLOOP_MAX 120
#endif
# 272 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/unistd.h" 3 4
#if __XSI_VISIBLE
#define _SC_ATEXIT_MAX 107 /* user */
#define _SC_IOV_MAX 56
#define _SC_PAGE_SIZE _SC_PAGESIZE
#define _SC_XOPEN_CRYPT 108 /* user */
#define _SC_XOPEN_ENH_I18N 109 /* user */
#define _SC_XOPEN_LEGACY 110 /* user */
#define _SC_XOPEN_REALTIME 111
#define _SC_XOPEN_REALTIME_THREADS 112
#define _SC_XOPEN_SHM 113
#define _SC_XOPEN_STREAMS 114
#define _SC_XOPEN_UNIX 115
#define _SC_XOPEN_VERSION 116
#define _SC_XOPEN_XCU_VERSION 117 /* user */
#endif
# 288 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/unistd.h" 3 4
#if __BSD_VISIBLE
#define _SC_NPROCESSORS_CONF 57
#define _SC_NPROCESSORS_ONLN 58
#define _SC_CPUSET_SIZE 122
#endif
# 294 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/unistd.h" 3 4
/* Extensions found in Solaris and Linux. */
#define _SC_PHYS_PAGES 121
/* Keys for the confstr(3) function. */
#if __POSIX_VISIBLE >= 199209
#define _CS_PATH 1 /* default value of PATH */
#endif
# 302 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/unistd.h" 3 4
#if __POSIX_VISIBLE >= 200112
#define _CS_POSIX_V6_ILP32_OFF32_CFLAGS 2
#define _CS_POSIX_V6_ILP32_OFF32_LDFLAGS 3
#define _CS_POSIX_V6_ILP32_OFF32_LIBS 4
#define _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS 5
#define _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS 6
#define _CS_POSIX_V6_ILP32_OFFBIG_LIBS 7
#define _CS_POSIX_V6_LP64_OFF64_CFLAGS 8
#define _CS_POSIX_V6_LP64_OFF64_LDFLAGS 9
#define _CS_POSIX_V6_LP64_OFF64_LIBS 10
#define _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS 11
#define _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS 12
#define _CS_POSIX_V6_LPBIG_OFFBIG_LIBS 13
#define _CS_POSIX_V6_WIDTH_RESTRICTED_ENVS 14
#endif
# 318 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/unistd.h" 3 4
__BEGIN_DECLS
/* 1003.1-1990 */
void _exit(int) __dead2;
int access(const char *, int);
unsigned int alarm(unsigned int);
int chdir(const char *);
int chown(const char *, uid_t, gid_t);
int close(int);
void closefrom(int);
int dup(int);
int dup2(int, int);
int execl(const char *, const char *, ...) __null_sentinel;
int execle(const char *, const char *, ...);
int execlp(const char *, const char *, ...) __null_sentinel;
int execv(const char *, char * const *);
int execve(const char *, char * const *, char * const *);
int execvp(const char *, char * const *);
pid_t fork(void);
long fpathconf(int, int);
char *getcwd(char *, size_t);
gid_t getegid(void);
uid_t geteuid(void);
gid_t getgid(void);
int getgroups(int, gid_t []);
char *getlogin(void);
pid_t getpgrp(void);
pid_t getpid(void);
pid_t getppid(void);
uid_t getuid(void);
int isatty(int);
int link(const char *, const char *);
#ifndef _LSEEK_DECLARED
#define _LSEEK_DECLARED
off_t lseek(int, off_t, int);
#endif
# 354 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/unistd.h" 3 4
long pathconf(const char *, int);
int pause(void);
int pipe(int *);
ssize_t read(int, void *, size_t);
int rmdir(const char *);
int setgid(gid_t);
int setpgid(pid_t, pid_t);
pid_t setsid(void);
int setuid(uid_t);
unsigned int sleep(unsigned int);
long sysconf(int);
pid_t tcgetpgrp(int);
int tcsetpgrp(int, pid_t);
char *ttyname(int);
int ttyname_r(int, char *, size_t);
int unlink(const char *);
ssize_t write(int, const void *, size_t);
/* 1003.2-1992 */
#if __POSIX_VISIBLE >= 199209 || __XSI_VISIBLE
size_t confstr(int, char *, size_t);
#ifndef _GETOPT_DECLARED
#define _GETOPT_DECLARED
int getopt(int, char * const [], const char *);
extern char *optarg; /* getopt(3) external variables */
extern int optind, opterr, optopt;
#endif /* _GETOPT_DECLARED */
# 382 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/unistd.h" 3 4
#endif
# 383 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/unistd.h" 3 4
/* ISO/IEC 9945-1: 1996 */
#if __POSIX_VISIBLE >= 199506 || __XSI_VISIBLE
int fsync(int);
int fdatasync(int);
/*
* ftruncate() was in the POSIX Realtime Extension (it's used for shared
* memory), but truncate() was not.
*/
#ifndef _FTRUNCATE_DECLARED
#define _FTRUNCATE_DECLARED
int ftruncate(int, off_t);
#endif
# 397 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/unistd.h" 3 4
#endif
# 398 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/unistd.h" 3 4
#if __POSIX_VISIBLE >= 199506
int getlogin_r(char *, int);
#endif
# 402 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/unistd.h" 3 4
/* 1003.1-2001 */
#if __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE
int fchown(int, uid_t, gid_t);
ssize_t readlink(const char * __restrict, char * __restrict, size_t);
#endif
# 408 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/unistd.h" 3 4
#if __POSIX_VISIBLE >= 200112
int gethostname(char *, size_t);
int setegid(gid_t);
int seteuid(uid_t);
#endif
# 413 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/unistd.h" 3 4
/* 1003.1-2008 */
#if __POSIX_VISIBLE >= 200809 || __XSI_VISIBLE
int getsid(pid_t _pid);
int fchdir(int);
int getpgid(pid_t _pid);
int lchown(const char *, uid_t, gid_t);
ssize_t pread(int, void *, size_t, off_t);
ssize_t pwrite(int, const void *, size_t, off_t);
/* See comment at ftruncate() above. */
#ifndef _TRUNCATE_DECLARED
#define _TRUNCATE_DECLARED
int truncate(const char *, off_t);
#endif
# 428 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/unistd.h" 3 4
#endif /* __POSIX_VISIBLE >= 200809 || __XSI_VISIBLE */
# 429 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/unistd.h" 3 4
#if __POSIX_VISIBLE >= 200809
int faccessat(int, const char *, int, int);
int fchownat(int, const char *, uid_t, gid_t, int);
int fexecve(int, char *const [], char *const []);
int linkat(int, const char *, int, const char *, int);
ssize_t readlinkat(int, const char * __restrict, char * __restrict, size_t);
int symlinkat(const char *, int, const char *);
int unlinkat(int, const char *, int);
#endif /* __POSIX_VISIBLE >= 200809 */
# 439 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/unistd.h" 3 4
/*
* symlink() was originally in POSIX.1a, which was withdrawn after
* being overtaken by events (1003.1-2001). It was in XPG4.2, and of
* course has been in BSD since 4.2.
*/
#if __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE >= 402
int symlink(const char * __restrict, const char * __restrict);
#endif
# 448 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/unistd.h" 3 4
/* X/Open System Interfaces */
#if __XSI_VISIBLE
char *crypt(const char *, const char *);
long gethostid(void);
int lockf(int, int, off_t);
int nice(int);
int setregid(gid_t, gid_t);
int setreuid(uid_t, uid_t);
#ifndef _SWAB_DECLARED
#define _SWAB_DECLARED
void swab(const void * __restrict, void * __restrict, ssize_t);
#endif /* _SWAB_DECLARED */
# 462 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/unistd.h" 3 4
void sync(void);
#endif /* __XSI_VISIBLE */
# 466 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/unistd.h" 3 4
#if (__XSI_VISIBLE && __XSI_VISIBLE <= 500) || __BSD_VISIBLE
int brk(const void *);
int chroot(const char *);
int getdtablesize(void);
int getpagesize(void) __pure2;
char *getpass(const char *);
void *sbrk(intptr_t);
#endif
# 475 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/unistd.h" 3 4
#if (__XSI_VISIBLE && __XSI_VISIBLE <= 600) || __BSD_VISIBLE
char *getwd(char *); /* obsoleted by getcwd() */
useconds_t
ualarm(useconds_t, useconds_t);
int usleep(useconds_t);
pid_t vfork(void) __returns_twice;
#endif
# 483 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/unistd.h" 3 4
#if __BSD_VISIBLE
struct timeval; /* select(2) */
struct crypt_data {
int initialized; /* For compatibility with glibc. */
char __buf[256]; /* Buffer returned by crypt_r(). */
};
int acct(const char *);
int async_daemon(void);
int check_utility_compat(const char *);
const char *
crypt_get_format(void);
char *crypt_r(const char *, const char *, struct crypt_data *);
int crypt_set_format(const char *);
int dup3(int, int, int);
int eaccess(const char *, int);
void endusershell(void);
int exect(const char *, char * const *, char * const *);
int execvP(const char *, const char *, char * const *);
int feature_present(const char *);
char *fflagstostr(u_long);
int getdomainname(char *, int);
int getgrouplist(const char *, gid_t, gid_t *, int *);
int getloginclass(char *, size_t);
mode_t getmode(const void *, mode_t);
int getosreldate(void);
int getpeereid(int, uid_t *, gid_t *);
int getresgid(gid_t *, gid_t *, gid_t *);
int getresuid(uid_t *, uid_t *, uid_t *);
char *getusershell(void);
int initgroups(const char *, gid_t);
int iruserok(unsigned long, int, const char *, const char *);
int iruserok_sa(const void *, int, int, const char *, const char *);
int issetugid(void);
void __FreeBSD_libc_enter_restricted_mode(void);
long lpathconf(const char *, int);
#ifndef _MKDTEMP_DECLARED
char *mkdtemp(char *);
#define _MKDTEMP_DECLARED
#endif
# 525 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/unistd.h" 3 4
#ifndef _MKNOD_DECLARED
int mknod(const char *, mode_t, dev_t);
#define _MKNOD_DECLARED
#endif
# 529 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/unistd.h" 3 4
#ifndef _MKSTEMP_DECLARED
int mkstemp(char *);
#define _MKSTEMP_DECLARED
#endif
# 533 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/unistd.h" 3 4
int mkstemps(char *, int);
#ifndef _MKTEMP_DECLARED
char *mktemp(char *);
#define _MKTEMP_DECLARED
#endif
# 538 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/unistd.h" 3 4
int nfssvc(int, void *);
int nlm_syscall(int, int, int, char **);
int pipe2(int *, int);
int profil(char *, size_t, vm_offset_t, int);
int rcmd(char **, int, const char *, const char *, const char *, int *);
int rcmd_af(char **, int, const char *,
const char *, const char *, int *, int);
int rcmdsh(char **, int, const char *,
const char *, const char *, const char *);
char *re_comp(const char *);
int re_exec(const char *);
int reboot(int);
int revoke(const char *);
pid_t rfork(int);
pid_t rfork_thread(int, void *, int (*)(void *), void *);
int rresvport(int *);
int rresvport_af(int *, int);
int ruserok(const char *, int, const char *, const char *);
#if __BSD_VISIBLE
#ifndef _SELECT_DECLARED
#define _SELECT_DECLARED
int select(int, fd_set *, fd_set *, fd_set *, struct timeval *);
#endif
# 561 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/unistd.h" 3 4
#endif
# 562 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/unistd.h" 3 4
int setdomainname(const char *, int);
int setgroups(int, const gid_t *);
void sethostid(long);
int sethostname(const char *, int);
int setlogin(const char *);
int setloginclass(const char *);
void *setmode(const char *);
int setpgrp(pid_t, pid_t); /* obsoleted by setpgid() */
void setproctitle(const char *_fmt, ...) __printf0like(1, 2);
int setresgid(gid_t, gid_t, gid_t);
int setresuid(uid_t, uid_t, uid_t);
int setrgid(gid_t);
int setruid(uid_t);
void setusershell(void);
int strtofflags(char **, u_long *, u_long *);
int swapon(const char *);
int swapoff(const char *);
int syscall(int, ...);
off_t __syscall(quad_t, ...);
int undelete(const char *);
int unwhiteout(const char *);
void *valloc(size_t); /* obsoleted by malloc() */
#ifndef _OPTRESET_DECLARED
#define _OPTRESET_DECLARED
extern int optreset; /* getopt(3) external variable */
#endif
# 589 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/unistd.h" 3 4
#if __has_feature(capabilities)
ssize_t write_c(int, __capability const void *, size_t);
#endif
# 593 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/unistd.h" 3 4
#endif /* __BSD_VISIBLE */
# 594 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/unistd.h" 3 4
__END_DECLS
#endif /* !_UNISTD_H_ */
# 597 "/local/scratch/alr48/cheri/output-release/sdk256/sysroot/usr/include/unistd.h" 3 4
# 42 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/win32.h" 2
#if 0 /* expanded by -frewrite-includes */
# include <strings.h>
#endif /* expanded by -frewrite-includes */
# 42 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/win32.h"
# 43 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/win32.h"
# define TIMEB timeb
# define OPENFLAGS_WRITE O_WRONLY|O_CREAT|O_TRUNC
# define OPENFLAGS_READ O_RDONLY
# define OPEN_PERMISSIONS S_IRUSR | S_IWUSR
# if __STDC_VERSION__ >= 199901L
/* "inline" is a keyword */
# else
# 51 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/win32.h"
# define inline /* nothing */
# endif
# 53 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/win32.h"
#endif
# 54 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/win32.h"
#if defined(WIN32) && !defined(__GNUC__)
typedef __int64 int64;
# define FORMAT_OFF_T "I64d"
# ifndef INT64_MIN
# define INT64_MIN (-9223372036854775807i64 - 1i64)
# endif
# 61 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/win32.h"
#else
# 62 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/win32.h"
typedef long long int64;
# define FORMAT_OFF_T "lld"
# ifndef INT64_MIN
# define INT64_MIN (-9223372036854775807LL - 1LL)
# endif
# 67 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/win32.h"
#endif
# 68 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/win32.h"
#endif
# 70 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/win32.h"
# 35 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/global.h" 2
#if 0 /* expanded by -frewrite-includes */
#include "defines.h"
#endif /* expanded by -frewrite-includes */
# 35 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/global.h"
# 1 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/defines.h" 1
/*!
**************************************************************************
* \file defines.h
*
* \brief
* Header file containing some useful global definitions
*
* \author
* Detlev Marpe
* Copyright (C) 2000 HEINRICH HERTZ INSTITUTE All Rights Reserved.
*
* \date
* 21. March 2001
**************************************************************************
*/
#ifndef _DEFINES_H_
#define _DEFINES_H_
#if defined _DEBUG
#define TRACE 0 //!< 0:Trace off 1:Trace on 2:detailed CABAC context information
#else
# 25 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/defines.h"
#define TRACE 0 //!< 0:Trace off 1:Trace on 2:detailed CABAC context information
#endif
# 27 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/defines.h"
#define GET_METIME 1 //!< Enables or disables ME computation time
#define DUMP_DPB 0 //!< Dump dbp for debug purposes
typedef unsigned char byte; //!< byte type definition
#define RC_MAX_TEMPORAL_LEVELS 5
//#define BEST_NZ_COEFF 1 // yuwen 2005.11.03 => for high complexity mode decision (CAVLC, #TotalCoeff)
//FREXT Profile IDC definitions
#define FREXT_HP 100 //!< YUV 4:2:0/8 "High"
#define FREXT_Hi10P 110 //!< YUV 4:2:0/10 "High 10"
#define FREXT_Hi422 122 //!< YUV 4:2:2/10 "High 4:2:2"
#define FREXT_Hi444 144 //!< YUV 4:4:4/12 "High 4:4:4"
#define ZEROSNR 1
// CAVLC
#define LUMA 0
#define LUMA_INTRA16x16DC 1
#define LUMA_INTRA16x16AC 2
#define LEVEL_NUM 6
#define TOTRUN_NUM 15
#define RUNBEFORE_NUM 7
#define CAVLC_LEVEL_LIMIT 2063
//--- block types for CABAC
#define LUMA_16DC 0
#define LUMA_16AC 1
#define LUMA_8x8 2
#define LUMA_8x4 3
#define LUMA_4x8 4
#define LUMA_4x4 5
#define CHROMA_DC 6
#define CHROMA_AC 7
#define CHROMA_DC_2x4 8
#define CHROMA_DC_4x4 9
#define NUM_BLOCK_TYPES 10
#define _FULL_SEARCH_RANGE_
#define _ADAPT_LAST_GROUP_
#define _CHANGE_QP_
#define _LEAKYBUCKET_
// ---------------------------------------------------------------------------------
// FLAGS and DEFINES for new chroma intra prediction, Dzung Hoang
// Threshold values to zero out quantized transform coefficients.
// Recommend that _CHROMA_COEFF_COST_ be low to improve chroma quality
#define _LUMA_COEFF_COST_ 4 //!< threshold for luma coeffs
#define _CHROMA_COEFF_COST_ 4 //!< threshold for chroma coeffs, used to be 7
#define _LUMA_MB_COEFF_COST_ 5 //!< threshold for luma coeffs of inter Macroblocks
#define _LUMA_8x8_COEFF_COST_ 5 //!< threshold for luma coeffs of 8x8 Inter Partition
#define IMG_PAD_SIZE 20 //!< Number of pixels padded around the reference frame (>=4)
#define IMG_PAD_SIZE_TIMES4 80 //!< Number of pixels padded around the reference frame in subpel units(>=16)
#define MAX_VALUE 999999 //!< used for start value for some variables
#define INVALIDINDEX (-135792468)
#define P8x8 8
#define I4MB 9
#define I16MB 10
#define IBLOCK 11
#define SI4MB 12
#define I8MB 13
#define IPCM 14
#define MAXMODE 15
#define LAMBDA_ACCURACY_BITS 16
#define LAMBDA_FACTOR(lambda) ((int)((double)(1<<LAMBDA_ACCURACY_BITS)*lambda+0.5))
#define WEIGHTED_COST(factor,bits) (((factor)*(bits))>>LAMBDA_ACCURACY_BITS)
#define MV_COST(f,s,cx,cy,px,py) (WEIGHTED_COST(f,mvbits[((cx)<<(s))-px]+mvbits[((cy)<<(s))-py]))
#define MV_COST_SMP(f,cx,cy,px,py) (WEIGHTED_COST(f,mvbits[cx-px]+mvbits[cy-py]))
#define REF_COST(f,ref,list_offset) (WEIGHTED_COST(f,((listXsize[list_offset]<=1)? 0:refbits[(ref)])))
#define IS_INTRA(MB) ((MB)->mb_type==I4MB || (MB)->mb_type==I16MB || (MB)->mb_type==I8MB || (MB)->mb_type==IPCM)
#define IS_NEWINTRA(MB) ((MB)->mb_type==I16MB)
#define IS_OLDINTRA(MB) ((MB)->mb_type==I4MB)
#define IS_IPCM(MB) ((MB)->mb_type==IPCM)
#define IS_INTER(MB) ((MB)->mb_type!=I4MB && (MB)->mb_type!=I16MB && (MB)->mb_type!=I8MB)
#define IS_INTERMV(MB) ((MB)->mb_type!=I4MB && (MB)->mb_type!=I16MB && (MB)->mb_type!=I8MB && (MB)->mb_type!=0)
#define IS_DIRECT(MB) ((MB)->mb_type==0 && (img->type==B_SLICE))
#define IS_COPY(MB) ((MB)->mb_type==0 && (img->type==P_SLICE||img ->type==SP_SLICE))
#define IS_P8x8(MB) ((MB)->mb_type==P8x8)
// Quantization parameter range
#define MIN_QP 0
#define MAX_QP 51
#define SHIFT_QP 12
// Direct Mode types
#define DIR_TEMPORAL 0 //!< Temporal Direct Mode
#define DIR_SPATIAL 1 //!< Spatial Direct Mode
#define MAX_REFERENCE_PICTURES 32
#define BLOCK_SHIFT 2
#define BLOCK_SIZE 4
#define BLOCK_SIZE8x8 8
#define MB_BLOCK_SIZE 16
#define MB_BLOCK_SHIFT 4
// These variables relate to the subpel accuracy supported by the software (1/4)
#define BLOCK_SIZE_SP 16 // BLOCK_SIZE << 2
#define BLOCK_SIZE8x8_SP 32 // BLOCK_SIZE8x8 << 2
// number of intra prediction modes
#define NO_INTRA_PMODE 9
// 4x4 intra prediction modes
#define VERT_PRED 0
#define HOR_PRED 1
#define DC_PRED 2
#define DIAG_DOWN_LEFT_PRED 3
#define DIAG_DOWN_RIGHT_PRED 4
#define VERT_RIGHT_PRED 5
#define HOR_DOWN_PRED 6
#define VERT_LEFT_PRED 7
#define HOR_UP_PRED 8
// 16x16 intra prediction modes
#define VERT_PRED_16 0
#define HOR_PRED_16 1
#define DC_PRED_16 2
#define PLANE_16 3
// 8x8 chroma intra prediction modes
#define DC_PRED_8 0
#define HOR_PRED_8 1
#define VERT_PRED_8 2
#define PLANE_8 3
#define INIT_FRAME_RATE 30
#define EOS 1 //!< End Of Sequence
#define MVPRED_MEDIAN 0
#define MVPRED_L 1
#define MVPRED_U 2
#define MVPRED_UR 3
#define BLOCK_MULTIPLE 4 //(MB_BLOCK_SIZE/BLOCK_SIZE)
#define MB_BLOCK_PARTITIONS 16 //(BLOCK_MULTIPLE * BLOCK_MULTIPLE)
#define MB_PIXELS 256 //(MB_BLOCK_SIZE * MB_BLOCK_SIZE)
#define BLOCK_CONTEXT 64 //(4 * MB_BLOCK_PARTITIONS)
#define MAX_SYMBOLS_PER_MB 1200 //!< Maximum number of different syntax elements for one MB
// CAVLC needs more symbols per MB
#define MAX_PART_NR 3 /*!< Maximum number of different data partitions.
Some reasonable number which should reflect
what is currently defined in the SE2Partition map (elements.h) */
//Start code and Emulation Prevention need this to be defined in identical manner at encoder and decoder
#define ZEROBYTES_SHORTSTARTCODE 2 //indicates the number of zero bytes in the short start-code prefix
#define Q_BITS 15
#define DQ_BITS 6
#define DQ_ROUND (1<<(DQ_BITS-1))
#define Q_BITS_8 16
#define DQ_BITS_8 6
#define DQ_ROUND_8 (1<<(DQ_BITS_8-1))
// Context Adaptive Lagrange Multiplier (CALM)
#define CALM_MF_FACTOR_THRESHOLD 512.0
#endif
# 201 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/defines.h"
# 36 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/global.h" 2
#if 0 /* expanded by -frewrite-includes */
#include "parsetcommon.h"
#endif /* expanded by -frewrite-includes */
# 36 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/global.h"
# 1 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/parsetcommon.h" 1
/*!
**************************************************************************************
* \file
* parsetcommon.h
* \brief
* Picture and Sequence Parameter Sets, structures common to encoder and decoder
* This code reflects JVT version xxx
* \date 25 November 2002
* \author
* Main contributors (see contributors.h for copyright, address and affiliation details)
* - Stephan Wenger <[email protected]>
***************************************************************************************
*/
// In the JVT syntax, frequently flags are used that indicate the presence of
// certain pieces of information in the NALU. Here, these flags are also
// present. In the encoder, those bits indicate that the values signalled to
// be present are meaningful and that this part of the syntax should be
// written to the NALU. In the decoder, the flag indicates that information
// was received from the decoded NALU and should be used henceforth.
// The structure names were chosen as indicated in the JVT syntax
#ifndef _PARSETCOMMON_H_
#define _PARSETCOMMON_H_
#define MAXIMUMPARSETRBSPSIZE 1500
#define MAXIMUMPARSETNALUSIZE 1500
#define MAXSPS 32
#define MAXPPS 256
//! Boolean Type
#ifdef FALSE
# define Boolean int
#else
# 39 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/parsetcommon.h"
typedef enum {
FALSE,
TRUE
} Boolean;
#endif
# 44 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/parsetcommon.h"
#define MAXIMUMVALUEOFcpb_cnt 32
typedef struct
{
unsigned int cpb_cnt; // ue(v)
unsigned int bit_rate_scale; // u(4)
unsigned int cpb_size_scale; // u(4)
unsigned int bit_rate_value [MAXIMUMVALUEOFcpb_cnt]; // ue(v)
unsigned int cpb_size_value[MAXIMUMVALUEOFcpb_cnt]; // ue(v)
unsigned int vbr_cbr_flag[MAXIMUMVALUEOFcpb_cnt]; // u(1)
unsigned int initial_cpb_removal_delay_length_minus1; // u(5)
unsigned int cpb_removal_delay_length_minus1; // u(5)
unsigned int dpb_output_delay_length_minus1; // u(5)
unsigned int time_offset_length; // u(5)
} hrd_parameters_t;
typedef struct
{
Boolean aspect_ratio_info_present_flag; // u(1)
unsigned int aspect_ratio_idc; // u(8)
unsigned int sar_width; // u(16)
unsigned int sar_height; // u(16)
Boolean overscan_info_present_flag; // u(1)
Boolean overscan_appropriate_flag; // u(1)
Boolean video_signal_type_present_flag; // u(1)
unsigned int video_format; // u(3)
Boolean video_full_range_flag; // u(1)
Boolean colour_description_present_flag; // u(1)
unsigned int colour_primaries; // u(8)
unsigned int transfer_characteristics; // u(8)
unsigned int matrix_coefficients; // u(8)
Boolean chroma_location_info_present_flag; // u(1)
unsigned int chroma_location_frame; // ue(v)
unsigned int chroma_location_field; // ue(v)
Boolean timing_info_present_flag; // u(1)
unsigned int num_units_in_tick; // u(32)
unsigned int time_scale; // u(32)
Boolean fixed_frame_rate_flag; // u(1)
Boolean nal_hrd_parameters_present_flag; // u(1)
hrd_parameters_t nal_hrd_parameters; // hrd_paramters_t
Boolean vcl_hrd_parameters_present_flag; // u(1)
hrd_parameters_t vcl_hrd_parameters; // hrd_paramters_t
// if ((nal_hrd_parameters_present_flag || (vcl_hrd_parameters_present_flag))
Boolean low_delay_hrd_flag; // u(1)
Boolean bitstream_restriction_flag; // u(1)
Boolean motion_vectors_over_pic_boundaries_flag; // u(1)
unsigned int max_bytes_per_pic_denom; // ue(v)
unsigned int max_bits_per_mb_denom; // ue(v)
unsigned int log2_max_mv_length_vertical; // ue(v)
unsigned int log2_max_mv_length_horizontal; // ue(v)
unsigned int max_dec_frame_reordering; // ue(v)
unsigned int max_dec_frame_buffering; // ue(v)
} vui_seq_parameters_t;
#define MAXnum_slice_groups_minus1 8
typedef struct
{
Boolean Valid; // indicates the parameter set is valid
unsigned int pic_parameter_set_id; // ue(v)
unsigned int seq_parameter_set_id; // ue(v)
Boolean entropy_coding_mode_flag; // u(1)
Boolean transform_8x8_mode_flag; // u(1)
Boolean pic_scaling_matrix_present_flag; // u(1)
int pic_scaling_list_present_flag[8]; // u(1)
// if( pic_order_cnt_type < 2 ) in the sequence parameter set
Boolean pic_order_present_flag; // u(1)
unsigned int num_slice_groups_minus1; // ue(v)
unsigned int slice_group_map_type; // ue(v)
// if( slice_group_map_type = = 0 )
unsigned int run_length_minus1[MAXnum_slice_groups_minus1]; // ue(v)
// else if( slice_group_map_type = = 2 )
unsigned int top_left[MAXnum_slice_groups_minus1]; // ue(v)
unsigned int bottom_right[MAXnum_slice_groups_minus1]; // ue(v)
// else if( slice_group_map_type = = 3 || 4 || 5
Boolean slice_group_change_direction_flag; // u(1)
unsigned int slice_group_change_rate_minus1; // ue(v)
// else if( slice_group_map_type = = 6 )
unsigned int pic_size_in_map_units_minus1; // ue(v)
byte *slice_group_id; // complete MBAmap u(v)
int num_ref_idx_l0_active_minus1; // ue(v)
int num_ref_idx_l1_active_minus1; // ue(v)
Boolean weighted_pred_flag; // u(1)
unsigned int weighted_bipred_idc; // u(2)
int pic_init_qp_minus26; // se(v)
int pic_init_qs_minus26; // se(v)
int chroma_qp_index_offset; // se(v)
int cb_qp_index_offset; // se(v)
int cr_qp_index_offset; // se(v)
Boolean deblocking_filter_control_present_flag; // u(1)
Boolean constrained_intra_pred_flag; // u(1)
Boolean redundant_pic_cnt_present_flag; // u(1)
Boolean vui_pic_parameters_flag; // u(1)
} pic_parameter_set_rbsp_t;
#define MAXnum_ref_frames_in_pic_order_cnt_cycle 256
typedef struct
{
Boolean Valid; // indicates the parameter set is valid
unsigned int profile_idc; // u(8)
Boolean constrained_set0_flag; // u(1)
Boolean constrained_set1_flag; // u(1)
Boolean constrained_set2_flag; // u(1)
Boolean constrained_set3_flag; // u(1)
unsigned int level_idc; // u(8)
unsigned int seq_parameter_set_id; // ue(v)
unsigned int chroma_format_idc; // ue(v)
Boolean seq_scaling_matrix_present_flag; // u(1)
int seq_scaling_list_present_flag[8]; // u(1)
unsigned int bit_depth_luma_minus8; // ue(v)
unsigned int bit_depth_chroma_minus8; // ue(v)
unsigned int log2_max_frame_num_minus4; // ue(v)
unsigned int pic_order_cnt_type;
// if( pic_order_cnt_type == 0 )
unsigned int log2_max_pic_order_cnt_lsb_minus4; // ue(v)
// else if( pic_order_cnt_type == 1 )
Boolean delta_pic_order_always_zero_flag; // u(1)
int offset_for_non_ref_pic; // se(v)
int offset_for_top_to_bottom_field; // se(v)
unsigned int num_ref_frames_in_pic_order_cnt_cycle; // ue(v)
// for( i = 0; i < num_ref_frames_in_pic_order_cnt_cycle; i++ )
int offset_for_ref_frame[MAXnum_ref_frames_in_pic_order_cnt_cycle]; // se(v)
unsigned int num_ref_frames; // ue(v)
Boolean gaps_in_frame_num_value_allowed_flag; // u(1)
unsigned int pic_width_in_mbs_minus1; // ue(v)
unsigned int pic_height_in_map_units_minus1; // ue(v)
Boolean frame_mbs_only_flag; // u(1)
// if( !frame_mbs_only_flag )
Boolean mb_adaptive_frame_field_flag; // u(1)
Boolean direct_8x8_inference_flag; // u(1)
Boolean frame_cropping_flag; // u(1)
unsigned int frame_cropping_rect_left_offset; // ue(v)
unsigned int frame_cropping_rect_right_offset; // ue(v)
unsigned int frame_cropping_rect_top_offset; // ue(v)
unsigned int frame_cropping_rect_bottom_offset; // ue(v)
Boolean vui_parameters_present_flag; // u(1)
vui_seq_parameters_t vui_seq_parameters; // vui_seq_parameters_t
} seq_parameter_set_rbsp_t;
pic_parameter_set_rbsp_t *AllocPPS (void);
seq_parameter_set_rbsp_t *AllocSPS (void);
void FreePPS (pic_parameter_set_rbsp_t *pps);
void FreeSPS (seq_parameter_set_rbsp_t *sps);
#endif
# 199 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/parsetcommon.h"
# 37 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/global.h" 2
#if 0 /* expanded by -frewrite-includes */
#include "q_matrix.h"
#endif /* expanded by -frewrite-includes */
# 37 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/global.h"
# 1 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/q_matrix.h" 1
/*!
***************************************************************************
* \file
* q_matrix.h
*
* \brief
* Headerfile for q_matrix array
*
* \date
* 07. Apr 2004
***************************************************************************
*/
#ifndef _Q_MATRIX_H_
#define _Q_MATRIX_H_
extern int ****LevelScale4x4Luma;
extern int *****LevelScale4x4Chroma;
extern int ****LevelScale8x8Luma;
extern int ****InvLevelScale4x4Luma;
extern int *****InvLevelScale4x4Chroma;
extern int ****InvLevelScale8x8Luma;
extern short ScalingList4x4input[6][16];
extern short ScalingList8x8input[2][64];
extern short ScalingList4x4[6][16];
extern short ScalingList8x8[2][64];
extern short UseDefaultScalingMatrix4x4Flag[6];
extern short UseDefaultScalingMatrix8x8Flag[2];
extern int *qp_per_matrix;
extern int *qp_rem_matrix;
void Init_QMatrix (void);
void CalculateQuantParam(void);
void CalculateQuant8Param(void);
void free_QMatrix(void);
#endif
# 44 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/q_matrix.h"
# 38 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/global.h" 2
#if 0 /* expanded by -frewrite-includes */
#include "q_offsets.h"
#endif /* expanded by -frewrite-includes */
# 38 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/global.h"
# 1 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/q_offsets.h" 1
/*!
***************************************************************************
* \file
* q_offsets.h
*
* \brief
* Headerfile for q_offsets array
*
* \date
* 18. Nov 2004
***************************************************************************
*/
#ifndef _Q_OFFSETS_H_
#define _Q_OFFSETS_H_
extern int ****LevelOffset4x4Luma;
extern int *****LevelOffset4x4Chroma;
extern int ****LevelOffset8x8Luma;
extern short **OffsetList4x4;
extern short **OffsetList8x8;
extern const int OffsetBits;
extern int AdaptRndWeight;
extern int AdaptRndCrWeight;
void Init_QOffsetMatrix (void);
void CalculateOffsetParam(void);
void CalculateOffset8Param(void);
void free_QOffsets (void);
#endif
# 34 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/q_offsets.h"
# 39 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/global.h" 2
#if 0 /* expanded by -frewrite-includes */
#include "minmax.h"
#endif /* expanded by -frewrite-includes */
# 39 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/global.h"
# 1 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/minmax.h" 1
/*!
************************************************************************
* \file
* minmax.h
* \brief
* defines min and max macros for non WIN32 environments
************************************************************************
*/
#ifndef _MINMAX_
#define _MINMAX_
#if !defined(WIN32) || defined(__GNUC__)
#endif
# 15 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/minmax.h"
#endif
# 17 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/minmax.h"
# 40 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/global.h" 2
#if 0 /* expanded by -frewrite-includes */
#include "ifunctions.h"
#endif /* expanded by -frewrite-includes */
# 40 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/global.h"
# 1 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/ifunctions.h" 1
/*!
************************************************************************
* \file
* ifunctions.h
*
* \brief
* define some inline functions that are used within the encoder.
*
* \author
* Main contributors (see contributors.h for copyright, address and affiliation details)
* - Karsten Sühring <[email protected]>
* - Alexis Tourapis <[email protected]>
*
************************************************************************
*/
#ifndef _IFUNCTIONS_H_
#define _IFUNCTIONS_H_
static inline int imin(int a, int b)
{
return ((a) < (b)) ? (a) : (b);
}
static inline int imax(int a, int b)
{
return ((a) > (b)) ? (a) : (b);
}
static inline double dmin(double a, double b)
{
return ((a) < (b)) ? (a) : (b);
}
static inline double dmax(double a, double b)
{
return ((a) > (b)) ? (a) : (b);
}
static inline int64 i64min(int64 a, int64 b)
{
return ((a) < (b)) ? (a) : (b);
}
static inline int64 i64max(int64 a, int64 b)
{
return ((a) > (b)) ? (a) : (b);
}
static inline int iabs(int x)
{
return ((x) < 0) ? -(x) : (x);
}
static inline double dabs(double x)
{
return ((x) < 0) ? -(x) : (x);
}
static inline int isign(int x)
{
return ((x) < 0) ? -1 : 1;
}
static inline int isignab(int a, int b)
{
return ((b) < 0) ? -iabs(a) : iabs(a);
}
static inline int rshift_rnd(int x, int a)
{
return (a > 0) ? ((x + (1 << (a-1) )) >> a) : (x << (-a));
}
static inline unsigned int rshift_rnd_us(unsigned int x, unsigned int a)
{
return (a > 0) ? ((x + (1 << (a-1))) >> a) : x;
}
static inline int rshift_rnd_sf(int x, int a)
{
return ((x + (1 << (a-1) )) >> a);
}
static inline unsigned int rshift_rnd_us_sf(unsigned int x, unsigned int a)
{
return ((x + (1 << (a-1))) >> a);
}
static inline int iClip1(int high, int x)
{
x = imax(x, 0);
x = imin(x, high);
return x;
}
static inline int iClip3(int low, int high, int x)
{
x = imax(x, low);
x = imin(x, high);
return x;
}
static inline double dClip3(double low, double high, double x)
{
x = dmax(x, low);
x = dmin(x, high);
return x;
}
static inline int weighted_cost(int factor, int bits)
{
return (((factor)*(bits))>>LAMBDA_ACCURACY_BITS);
}
static inline int RSD(int x)
{
return ((x&2)?(x|1):(x&(~1)));
}
#endif
# 125 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/ifunctions.h"
# 41 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/global.h" 2
/***********************************************************************
* T y p e d e f i n i t i o n s f o r T M L
***********************************************************************
*/
//typedef byte imgpel;
//typedef unsigned short distpel;
typedef unsigned short imgpel;
typedef int distpel;
enum {
YUV400 = 0,
YUV420 = 1,
YUV422 = 2,
YUV444 = 3
} color_formats;
enum {
LIST_0 = 0,
LIST_1 = 1,
BI_PRED = 2,
BI_PRED_L0 = 3,
BI_PRED_L1 = 4
};
enum {
ERROR_SAD = 0,
ERROR_SSE = 1,
ERROR_SATD = 2,
ERROR_PSATD = 3
};
enum {
ME_Y_ONLY = 0,
ME_YUV_FP = 1,
ME_YUV_FP_SP = 2
};
enum {
DISTORTION_MSE = 0,
DISTORTION_WEIGHTED_MSE = 1,
DISTORTION_OVERLAP_TRANSFORM = 2,
DISTORTION_EDGE_MSE = 3
};
//! Data Partitioning Modes
typedef enum
{
PAR_DP_1, //!< no data partitioning is supported
PAR_DP_3 //!< data partitioning with 3 partitions
} PAR_DP_TYPE;
//! Output File Types
typedef enum
{
PAR_OF_ANNEXB, //!< Annex B byte stream format
PAR_OF_RTP //!< RTP packets in outfile
} PAR_OF_TYPE;
//! Field Coding Types
typedef enum
{
FRAME_CODING,
FIELD_CODING,
ADAPTIVE_CODING,
FRAME_MB_PAIR_CODING
} CodingType;
//! definition of H.264 syntax elements
typedef enum
{
SE_HEADER,
SE_PTYPE,
SE_MBTYPE,
SE_REFFRAME,
SE_INTRAPREDMODE,
SE_MVD,
SE_CBP,
SE_LUM_DC_INTRA,
SE_CHR_DC_INTRA,
SE_LUM_AC_INTRA,
SE_CHR_AC_INTRA,
SE_LUM_DC_INTER,
SE_CHR_DC_INTER,
SE_LUM_AC_INTER,
SE_CHR_AC_INTER,
SE_DELTA_QUANT,
SE_BFRAME,
SE_EOS,
SE_MAX_ELEMENTS //!< number of maximum syntax elements
} SE_type; // substituting the definitions in elements.h
typedef enum
{
INTER_MB,
INTRA_MB_4x4,
INTRA_MB_16x16
} IntraInterDecision;
typedef enum
{
BITS_HEADER,
BITS_TOTAL_MB,
BITS_MB_MODE,
BITS_INTER_MB,
BITS_CBP_MB,
BITS_COEFF_Y_MB,
BITS_COEFF_UV_MB,
BITS_DELTA_QUANT_MB,
MAX_BITCOUNTER_MB
} BitCountType;
typedef enum
{
NO_SLICES,
FIXED_MB,
FIXED_RATE,
CALLBACK,
FMO
} SliceMode;
typedef enum
{
UVLC,
CABAC
} SymbolMode;
typedef enum
{
FULL_SEARCH = -1,
FAST_FULL_SEARCH = 0,
UM_HEX = 1,
UM_HEX_SIMPLE = 2,
EPZS = 3
} SearchType;
typedef enum
{
FRAME,
TOP_FIELD,
BOTTOM_FIELD
} PictureStructure; //!< New enum for field processing
typedef enum
{
P_SLICE = 0,
B_SLICE = 1,
I_SLICE = 2,
SP_SLICE = 3,
SI_SLICE = 4
} SliceType;
//Motion Estimation levels
typedef enum
{
F_PEL, //!< Full Pel refinement
H_PEL, //!< Half Pel refinement
Q_PEL //!< Quarter Pel refinement
} MELevel;
typedef enum
{
FAST_ACCESS = 0, //!< Fast/safe reference access
UMV_ACCESS = 1 //!< unconstrained reference access
} REF_ACCESS_TYPE;
typedef enum
{
IS_LUMA = 0,
IS_CHROMA = 1
} Component_Type;
typedef enum
{
RC_MODE_0 = 0,
RC_MODE_1 = 1,
RC_MODE_2 = 2,
RC_MODE_3 = 3
} RCModeType;
/***********************************************************************
* D a t a t y p e s f o r C A B A C
***********************************************************************
*/
//! struct to characterize the state of the arithmetic coding engine
typedef struct
{
unsigned int Elow, Erange;
unsigned int Ebuffer;
unsigned int Ebits_to_go;
unsigned int Ebits_to_follow;
byte *Ecodestrm;
int *Ecodestrm_len;
int C;
int E;
} EncodingEnvironment;
typedef EncodingEnvironment *EncodingEnvironmentPtr;
//! struct for context management
typedef struct
{
unsigned short state; // index into state-table CP
unsigned char MPS; // Least Probable Symbol 0/1 CP
unsigned long count;
} BiContextType;
typedef BiContextType *BiContextTypePtr;
/**********************************************************************
* C O N T E X T S F O R T M L S Y N T A X E L E M E N T S
**********************************************************************
*/
#define NUM_MB_TYPE_CTX 11
#define NUM_B8_TYPE_CTX 9
#define NUM_MV_RES_CTX 10
#define NUM_REF_NO_CTX 6
#define NUM_DELTA_QP_CTX 4
#define NUM_MB_AFF_CTX 4
#define NUM_TRANSFORM_SIZE_CTX 3
typedef struct
{
BiContextType mb_type_contexts [3][NUM_MB_TYPE_CTX];
BiContextType b8_type_contexts [2][NUM_B8_TYPE_CTX];
BiContextType mv_res_contexts [2][NUM_MV_RES_CTX];
BiContextType ref_no_contexts [2][NUM_REF_NO_CTX];
BiContextType delta_qp_contexts [NUM_DELTA_QP_CTX];
BiContextType mb_aff_contexts [NUM_MB_AFF_CTX];
BiContextType transform_size_contexts [NUM_TRANSFORM_SIZE_CTX];
} MotionInfoContexts;
#define NUM_IPR_CTX 2
#define NUM_CIPR_CTX 4
#define NUM_CBP_CTX 4
#define NUM_BCBP_CTX 4
#define NUM_MAP_CTX 15
#define NUM_LAST_CTX 15
#define NUM_ONE_CTX 5
#define NUM_ABS_CTX 5
typedef struct
{
BiContextType ipr_contexts [NUM_IPR_CTX];
BiContextType cipr_contexts[NUM_CIPR_CTX];
BiContextType cbp_contexts [3][NUM_CBP_CTX];
BiContextType bcbp_contexts[NUM_BLOCK_TYPES][NUM_BCBP_CTX];
BiContextType map_contexts [NUM_BLOCK_TYPES][NUM_MAP_CTX];
BiContextType last_contexts[NUM_BLOCK_TYPES][NUM_LAST_CTX];
BiContextType one_contexts [NUM_BLOCK_TYPES][NUM_ONE_CTX];
BiContextType abs_contexts [NUM_BLOCK_TYPES][NUM_ABS_CTX];
BiContextType fld_map_contexts [NUM_BLOCK_TYPES][NUM_MAP_CTX];
BiContextType fld_last_contexts[NUM_BLOCK_TYPES][NUM_LAST_CTX];
} TextureInfoContexts;
//*********************** end of data type definition for CABAC *******************
//! Pixel position for checking neighbors
typedef struct pix_pos
{
int available;
int mb_addr;
int x;
int y;
int pos_x;
int pos_y;
} PixelPos;
//! Buffer structure for decoded reference picture marking commands
typedef struct DecRefPicMarking_s
{
int memory_management_control_operation;
int difference_of_pic_nums_minus1;
int long_term_pic_num;
int long_term_frame_idx;
int max_long_term_frame_idx_plus1;
struct DecRefPicMarking_s *Next;
} DecRefPicMarking_t;
//! Syntax Element
typedef struct syntaxelement
{
int type; //!< type of syntax element for data part.
int value1; //!< numerical value of syntax element
int value2; //!< for blocked symbols, e.g. run/level
int len; //!< length of code
int inf; //!< info part of UVLC code
unsigned int bitpattern; //!< UVLC bitpattern
int context; //!< CABAC context
#if TRACE
#define TRACESTRING_SIZE 100 //!< size of trace string
char tracestring[TRACESTRING_SIZE]; //!< trace string
#endif
# 351 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/global.h"
//!< for mapping of syntaxElement to UVLC
void (*mapping)(int value1, int value2, int* len_ptr, int* info_ptr);
} SyntaxElement;
//! Macroblock
typedef struct macroblock
{
int slice_nr;
int delta_qp;
int qp; //!< QP luma
int qpc[2]; //!< QP chroma
int qpsp ;
int bitcounter[MAX_BITCOUNTER_MB];
struct macroblock *mb_available_up; //!< pointer to neighboring MB (CABAC)
struct macroblock *mb_available_left; //!< pointer to neighboring MB (CABAC)
int mb_type;
int mvd[2][BLOCK_MULTIPLE][BLOCK_MULTIPLE][2]; //!< indices correspond to [list][block_y][block_x][x,y]
signed char intra_pred_modes[MB_BLOCK_PARTITIONS];
signed char intra_pred_modes8x8[MB_BLOCK_PARTITIONS]; //!< four 8x8 blocks in a macroblock
int cbp ;
int64 cbp_blk ; //!< 1 bit set for every 4x4 block with coefs (not implemented for INTRA)
int b8mode[4];
int b8pdir[4];
int64 cbp_bits;
int c_ipred_mode; //!< chroma intra prediction mode
int IntraChromaPredModeFlag;
int mb_field;
int is_field_mode;
int list_offset;
int mbAddrA, mbAddrB, mbAddrC, mbAddrD;
int mbAvailA, mbAvailB, mbAvailC, mbAvailD;
int all_blk_8x8;
int luma_transform_size_8x8_flag;
int NoMbPartLessThan8x8Flag;
short bi_pred_me;
// rate control
double actj; // macroblock activity measure for macroblock j
int prev_qp;
int prev_delta_qp;
int prev_cbp;
int predict_qp;
int predict_error;
int LFDisableIdc;
int LFAlphaC0Offset;
int LFBetaOffset;
int skip_flag;
} Macroblock;
//! Bitstream
typedef struct
{
int byte_pos; //!< current position in bitstream;
int bits_to_go; //!< current bitcounter
byte byte_buf; //!< current buffer for last written byte
int stored_byte_pos; //!< storage for position in bitstream;
int stored_bits_to_go; //!< storage for bitcounter
byte stored_byte_buf; //!< storage for buffer of last written byte
byte byte_buf_skip; //!< current buffer for last written byte
int byte_pos_skip; //!< storage for position in bitstream;
int bits_to_go_skip; //!< storage for bitcounter
byte *streamBuffer; //!< actual buffer for written bytes
int write_flag; //!< Bitstream contains data and needs to be written
#if TRACE
Boolean trace_enabled;
#endif
# 433 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/global.h"
} Bitstream;
//! DataPartition
typedef struct datapartition
{
Bitstream *bitstream;
EncodingEnvironment ee_cabac;
EncodingEnvironment ee_recode;
} DataPartition;
//! Slice
typedef struct
{
int picture_id;
int qp;
int picture_type; //!< picture type
int start_mb_nr;
int max_part_nr; //!< number of different partitions
int num_mb; //!< number of MBs in the slice
DataPartition *partArr; //!< array of partitions
MotionInfoContexts *mot_ctx; //!< pointer to struct of context models for use in CABAC
TextureInfoContexts *tex_ctx; //!< pointer to struct of context models for use in CABAC
int ref_pic_list_reordering_flag_l0;
int *reordering_of_pic_nums_idc_l0;
int *abs_diff_pic_num_minus1_l0;
int *long_term_pic_idx_l0;
int ref_pic_list_reordering_flag_l1;
int *reordering_of_pic_nums_idc_l1;
int *abs_diff_pic_num_minus1_l1;
int *long_term_pic_idx_l1;
Boolean (*slice_too_big)(int bits_slice); //!< for use of callback functions
int field_ctx[3][2]; //GB
} Slice;
#define MAXSLICEPERPICTURE 100
typedef struct
{
int no_slices;
int idr_flag;
Slice *slices[MAXSLICEPERPICTURE];
int bits_per_picture;
float distortion_y;
float distortion_u;
float distortion_v;
} Picture;
Picture *top_pic;
Picture *bottom_pic;
Picture *frame_pic;
Picture *frame_pic_1;
Picture *frame_pic_2;
Picture *frame_pic_3;
Picture *frame_pic_si;
#ifdef _LEAKYBUCKET_
long *Bit_Buffer;
#endif
# 498 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/global.h"
// global picture format dependend buffers, mem allocation in image.c
imgpel **imgY_org; //!< Reference luma image
imgpel ***imgUV_org; //!< Reference chroma image
int **imgY_sub_tmp; //!< Y picture temporary component (Quarter pel)
int **PicPos;
unsigned int log2_max_frame_num_minus4;
unsigned int log2_max_pic_order_cnt_lsb_minus4;
time_t me_tot_time,me_time;
pic_parameter_set_rbsp_t *active_pps;
seq_parameter_set_rbsp_t *active_sps;
int dsr_new_search_range; //!<Dynamic Search Range.
//////////////////////////////////////////////////////////////////////////
// B pictures
// motion vector : forward, backward, direct
int mb_adaptive; //!< For MB level field/frame coding tools
int MBPairIsField; //!< For MB level field/frame coding tools
//Weighted prediction
int ***wp_weight; // weight in [list][index][component] order
int ***wp_offset; // offset in [list][index][component] order
int ****wbp_weight; // weight in [list][fwd_index][bwd_idx][component] order
int luma_log_weight_denom;
int chroma_log_weight_denom;
int wp_luma_round;
int wp_chroma_round;
// global picture format dependend buffers, mem allocation in image.c (field picture)
imgpel **imgY_org_top;
imgpel **imgY_org_bot;
imgpel ***imgUV_org_top;
imgpel ***imgUV_org_bot;
imgpel **imgY_org_frm;
imgpel ***imgUV_org_frm;
imgpel **imgY_com; //!< Encoded luma images
imgpel ***imgUV_com; //!< Encoded croma images
signed char ***direct_ref_idx; //!< direct mode reference index buffer
signed char **direct_pdir; //!< direct mode reference index buffer
// Buffers for rd optimization with packet losses, Dim. Kontopodis
byte **pixel_map; //!< Shows the latest reference frame that is reliable for each pixel
byte **refresh_map; //!< Stores the new values for pixel_map
int intras; //!< Counts the intra updates in each frame.
int frame_ctr[5];
int frame_no, nextP_tr_fld, nextP_tr_frm;
time_t tot_time;
#define ET_SIZE 300 //!< size of error text buffer
char errortext[ET_SIZE]; //!< buffer for error message for exit with error()
// Residue Color Transform
signed char b8_ipredmode8x8[4][4], b8_intra_pred_modes8x8[16];
//! Info for the "decoders-in-the-encoder" used for rdoptimization with packet losses
typedef struct
{
int **resY; //!< Residue of Luminance
imgpel ***decY; //!< Decoded values at the simulated decoders
imgpel ****decref; //!< Reference frames of the simulated decoders
imgpel ***decY_best; //!< Decoded frames for the best mode for all decoders
imgpel **RefBlock;
byte **status_map;
byte **dec_mb_mode;
} Decoders;
extern Decoders *decs;
//! SNRParameters
typedef struct
{
float snr_y; //!< current Y SNR
float snr_u; //!< current U SNR
float snr_v; //!< current V SNR
float snr_y1; //!< SNR Y(dB) first frame
float snr_u1; //!< SNR U(dB) first frame
float snr_v1; //!< SNR V(dB) first frame
float snr_yt[5]; //!< SNR Y(dB) based on frame type
float snr_ut[5]; //!< SNR U(dB) based on frame type
float snr_vt[5]; //!< SNR V(dB) based on frame type
float snr_ya; //!< Average SNR Y(dB) remaining frames
float snr_ua; //!< Average SNR U(dB) remaining frames
float snr_va; //!< Average SNR V(dB) remaining frames
float sse_y; //!< SSE Y
float sse_u; //!< SSE U
float sse_v; //!< SSE V
float msse_y; //!< Average SSE Y
float msse_u; //!< Average SSE U
float msse_v; //!< Average SSE V
int frame_ctr; //!< number of coded frames
} SNRParameters;
#define FILE_NAME_SIZE 256
//! all input parameters
typedef struct
{
int ProfileIDC; //!< value of syntax element profile_idc
int LevelIDC; //!< value of syntax element level_idc
int no_frames; //!< number of frames to be encoded
int qp0; //!< QP of first frame
int qpN; //!< QP of remaining frames
int jumpd; //!< number of frames to skip in input sequence (e.g 2 takes frame 0,3,6,9...)
int DisableSubpelME; //!< Disable sub-pixel motion estimation
int search_range; /*!< search range - integer pel search and 16x16 blocks. The search window is
generally around the predicted vector. Max vector is 2xmcrange. For 8x8
and 4x4 block sizes the search range is 1/2 of that for 16x16 blocks. */
int num_ref_frames; //!< number of reference frames to be used
int P_List0_refs; //!< number of reference picture in list 0 in P pictures
int B_List0_refs; //!< number of reference picture in list 0 in B pictures
int B_List1_refs; //!< number of reference picture in list 1 in B pictures
int Log2MaxFNumMinus4; //!< value of syntax element log2_max_frame_num
int Log2MaxPOCLsbMinus4; //!< value of syntax element log2_max_pic_order_cnt_lsb_minus4
int img_width; //!< image width (must be a multiple of 16 pels)
int img_height; //!< image height (must be a multiple of 16 pels)
int yuv_format; //!< YUV format (0=4:0:0, 1=4:2:0, 2=4:2:2, 3=4:4:4)
int intra_upd; /*!< For error robustness. 0: no special action. 1: One GOB/frame is intra coded
as regular 'update'. 2: One GOB every 2 frames is intra coded etc.
In connection with this intra update, restrictions is put on motion vectors
to prevent errors to propagate from the past */
int blc_size[8][2]; //!< array for different block sizes
int part_size[8][2]; //!< array for different partition sizes
int blocktype_lut[4][4]; //!< array for different partition sizes
int slice_mode; //!< Indicate what algorithm to use for setting slices
int slice_argument; //!< Argument to the specified slice algorithm
int UseConstrainedIntraPred; //!< 0: Inter MB pixels are allowed for intra prediction 1: Not allowed
int infile_header; //!< If input file has a header set this to the length of the header
char infile[FILE_NAME_SIZE]; //!< YUV 4:2:0 input format
char outfile[FILE_NAME_SIZE]; //!< H.264 compressed output bitstream
char ReconFile[FILE_NAME_SIZE]; //!< Reconstructed Pictures
char TraceFile[FILE_NAME_SIZE]; //!< Trace Outputs
char QmatrixFile[FILE_NAME_SIZE]; //!< Q matrix cfg file
int intra_period; //!< Random Access period though intra
int EnableOpenGOP; //!< support for open gops.
int idr_enable; //!< Encode intra slices as IDR
int start_frame; //!< Encode sequence starting from Frame start_frame
int GenerateMultiplePPS;
int Generate_SEIVUI;
char SEIMessageText[500];
int VUISupport;
int ResendSPS;
int ResendPPS;
// B pictures
int successive_Bframe; //!< number of B frames that will be used
int PReplaceBSlice;
int qpB; //!< QP for non-reference B slice coded pictures
int qpBRSOffset; //!< QP for reference B slice coded pictures
int direct_spatial_mv_pred_flag; //!< Direct Mode type to be used (0: Temporal, 1: Spatial)
int directInferenceFlag; //!< Direct Mode Inference Flag
int BiPredMotionEstimation;
int BiPredMERefinements;
int BiPredMESearchRange;
int BiPredMESubPel;
// SP Pictures
int sp_periodicity; //!< The periodicity of SP-pictures
int qpsp; //!< SP Picture QP for prediction error
int qpsp_pred; //!< SP Picture QP for predicted block
int si_frame_indicator; //!< Flag indicating whether SI frames should be encoded rather than SP frames (0: not used, 1: used)
int sp2_frame_indicator; //!< Flag indicating whether switching SP frames should be encoded rather than SP frames (0: not used, 1: used)
int sp_output_indicator; //!< Flag indicating whether coefficients are output to allow future encoding of switchin SP frames (0: not used, 1: used)
char sp_output_filename[FILE_NAME_SIZE]; //!<Filename where SP coefficients are output
char sp2_input_filename1[FILE_NAME_SIZE]; //!<Filename of coefficients of the first bitstream when encoding SP frames to switch bitstreams
char sp2_input_filename2[FILE_NAME_SIZE]; //!<Filenames of coefficients of the second bitstream when encoding SP frames to switch bitstreams
int WeightedPrediction; //!< Weighted prediction for P frames (0: not used, 1: explicit)
int WeightedBiprediction; //!< Weighted prediction for B frames (0: not used, 1: explicit, 2: implicit)
int UseWeightedReferenceME; //!< Use Weighted Reference for ME.
int RDPictureDecision; //!< Perform RD optimal decision between various coded versions of same picture
int RDPictureIntra; //!< Enabled RD pic decision for intra as well.
int RDPSliceWeightOnly; //!< If enabled, does not check QP variations for P slices.
int RDPSliceBTest; //!< Tests B slice replacement for P.
int RDBSliceWeightOnly; //!< If enabled, does not check QP variations for B slices.
int SkipIntraInInterSlices; //!< Skip intra type checking in inter slices if best_mode is skip/direct
int BRefPictures; //!< B coded reference pictures replace P pictures (0: not used, 1: used)
int HierarchicalCoding;
int HierarchyLevelQPEnable;
char ExplicitHierarchyFormat[1024];//!< Explicit GOP format (HierarchicalCoding==3).
int ReferenceReorder; //!< Reordering based on Poc distances
int PocMemoryManagement; //!< Memory management based on Poc distances for hierarchical coding
int symbol_mode; //!< Specifies the mode the symbols are mapped on bits
int of_mode; //!< Specifies the mode of the output file
int partition_mode; //!< Specifies the mode of data partitioning
int InterSearch16x16;
int InterSearch16x8;
int InterSearch8x16;
int InterSearch8x8;
int InterSearch8x4;
int InterSearch4x8;
int InterSearch4x4;
int IntraDisableInterOnly;
int Intra4x4ParDisable;
int Intra4x4DiagDisable;
int Intra4x4DirDisable;
int Intra16x16ParDisable;
int Intra16x16PlaneDisable;
int ChromaIntraDisable;
int EnableIPCM;
double FrameRate;
int EPZSPattern;
int EPZSDual;
int EPZSFixed;
int EPZSTemporal;
int EPZSSpatialMem;
int EPZSMinThresScale;
int EPZSMaxThresScale;
int EPZSMedThresScale;
int EPZSSubPelGrid;
int EPZSSubPelME;
int EPZSSubPelMEBiPred;
int EPZSSubPelThresScale;
int chroma_qp_index_offset;
#ifdef _FULL_SEARCH_RANGE_
int full_search;
#endif
# 737 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/global.h"
#ifdef _ADAPT_LAST_GROUP_
int last_frame;
#endif
# 740 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/global.h"
#ifdef _CHANGE_QP_
int qpN2, qpB2, qp2start;
int qp02, qpBRS2Offset;
#endif
# 744 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/global.h"
int rdopt;
int CtxAdptLagrangeMult; //!< context adaptive lagrangian multiplier
int FastCrIntraDecision;
int disthres;
int nobskip;
#ifdef _LEAKYBUCKET_
int NumberLeakyBuckets;
char LeakyBucketRateFile[FILE_NAME_SIZE];
char LeakyBucketParamFile[FILE_NAME_SIZE];
#endif
# 755 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/global.h"
int PicInterlace; //!< picture adaptive frame/field
int MbInterlace; //!< macroblock adaptive frame/field
int IntraBottom; //!< Force Intra Bottom at GOP periods.
int LossRateA; //!< assumed loss probablility of partition A (or full slice), in per cent, used for loss-aware R/D optimization
int LossRateB; //!< assumed loss probablility of partition B, in per cent, used for loss-aware R/D
int LossRateC; //!< assumed loss probablility of partition C, in per cent, used for loss-aware R/D
int NoOfDecoders;
int RestrictRef;
int NumFramesInELSubSeq;
int NumFrameIn2ndIGOP;
int RandomIntraMBRefresh; //!< Number of pseudo-random intra-MBs per picture
int LFSendParameters;
int LFDisableIdc;
int LFAlphaC0Offset;
int LFBetaOffset;
int SparePictureOption;
int SPDetectionThreshold;
int SPPercentageThreshold;
// FMO
char SliceGroupConfigFileName[FILE_NAME_SIZE]; //!< Filename for config info fot type 0, 2, 6
int num_slice_groups_minus1; //!< "FmoNumSliceGroups" in encoder.cfg, same as FmoNumSliceGroups, which should be erased later
int slice_group_map_type;
int *top_left; //!< top_left and bottom_right store values indicating foregrounds
int *bottom_right;
byte *slice_group_id; //!< slice_group_id is for slice group type being 6
int *run_length_minus1; //!< run_length_minus1 is for slice group type being 0
int slice_group_change_direction_flag;
int slice_group_change_rate_minus1;
int slice_group_change_cycle;
int redundant_pic_flag; //! encoding of redundant pictures
int pic_order_cnt_type; //! POC type
int context_init_method;
int model_number;
int Transform8x8Mode;
int ReportFrameStats;
int DisplayEncParams;
int Verbose;
//! Rate Control on JVT standard
int RCEnable;
int bit_rate;
int SeinitialQP;
unsigned int basicunit;
int channel_type;
int RCUpdateMode;
double RCIoverPRatio;
double RCBoverPRatio;
double RCISliceBitRatio;
double RCBSliceBitRatio[RC_MAX_TEMPORAL_LEVELS];
int ScalingMatrixPresentFlag;
int ScalingListPresentFlag[8];
// Search Algorithm
SearchType SearchMode;
int UMHexDSR;//!< Dynamic Search Range
int UMHexScale;
//////////////////////////////////////////////////////////////////////////
// Fidelity Range Extensions
int BitDepthLuma;
int BitDepthChroma;
int img_height_cr;
int img_width_cr;
int rgb_input_flag;
int cb_qp_index_offset;
int cr_qp_index_offset;
// Lossless Coding
int lossless_qpprime_y_zero_flag;
// Lambda Params
int UseExplicitLambdaParams;
double LambdaWeight[6];
double FixedLambda[6];
char QOffsetMatrixFile[FILE_NAME_SIZE]; //!< Quantization Offset matrix cfg file
int OffsetMatrixPresentFlag; //!< Enable Explicit Quantization Offset Matrices
int AdaptiveRounding; //!< Adaptive Rounding parameter based on JVT-N011
int AdaptRndPeriod; //!< Set period for adaptive rounding of JVT-N011 in MBs
int AdaptRndChroma;
int AdaptRndWFactor[2][5]; //!< Weighting factors for luma component based on reference indicator and slice type
int AdaptRndCrWFactor[2][5]; //!< Weighting factors for chroma components based on reference indicator and slice type
// Fast Mode Decision
int EarlySkipEnable;
int SelectiveIntraEnable;
int DisposableP;
int DispPQPOffset;
//Redundant picture
int NumRedundantHierarchy; //!< number of entries to allocate redundant pictures in a GOP
int PrimaryGOPLength; //!< GOP length of primary pictures
int NumRefPrimary; //!< number of reference frames for primary picture
// Chroma interpolation and buffering
int ChromaMCBuffer;
int ChromaMEEnable;
int MEErrorMetric[3];
int ModeDecisionMetric;
} InputParameters;
//! ImageParameters
typedef struct
{
int number; //!< current image number to be encoded
int pn; //!< picture number
int LevelIndex; //!< mapped level idc
int current_mb_nr;
int current_slice_nr;
int type;
int structure; //!< picture structure
int num_ref_frames; //!< number of reference frames to be used
int max_num_references; //!< maximum number of reference pictures that may occur
int qp; //!< quant for the current frame
int qpsp; //!< quant for the prediction frame of SP-frame
int qp_scaled;
float framerate;
int width; //!< Number of pels
int width_padded; //!< Width in pels of padded picture
int width_blk; //!< Number of columns in blocks
int width_cr; //!< Number of pels chroma
int height; //!< Number of lines
int height_padded; //!< Number in lines of padded picture
int height_blk; //!< Number of lines in blocks
int height_cr; //!< Number of lines chroma
int height_cr_frame; //!< Number of lines chroma frame
int size; //!< Luma Picture size in pels
int size_cr; //!< Chroma Picture size in pels
int subblock_x; //!< current subblock horizontal
int subblock_y; //!< current subblock vertical
int is_intra_block;
int is_v_block;
int mb_y_upd;
int mb_y_intra; //!< which GOB to intra code
int block_c_x; //!< current block chroma vertical
signed char **ipredmode; //!< intra prediction mode
signed char **ipredmode8x8; //!< help storage for 8x8 modes, inserted by YV
int cod_counter; //!< Current count of number of skipped macroblocks in a row
int ***nz_coeff; //!< number of coefficients per block (CAVLC)
int mb_x; //!< current MB horizontal
int mb_y; //!< current MB vertical
int block_x; //!< current block horizontal
int block_y; //!< current block vertical
int pix_x; //!< current pixel horizontal
int pix_y; //!< current pixel vertical
int pix_c_x; //!< current pixel chroma horizontal
int pix_c_y; //!< current pixel chroma vertical
int opix_x; //!< current original picture pixel horizontal
int opix_y; //!< current original picture pixel vertical
int opix_c_x; //!< current original picture pixel chroma horizontal
int opix_c_y; //!< current original picture pixel chroma vertical
// some temporal buffers
imgpel mprr[9][16][16]; //!< all 9 prediction modes? // enlarged from 4 to 16 for ABT (is that neccessary?)
imgpel mprr_2[5][16][16]; //!< all 4 new intra prediction modes
imgpel mprr_3[9][8][8]; //!< all 9 prediction modes for 8x8 transformation
imgpel mprr_c[2][4][16][16]; //!< chroma intra prediction modes
imgpel mpr[16][16]; //!< current best prediction mode
int m7[16][16]; //!< the diff pixel values between orginal image and prediction
int ****cofAC; //!< AC coefficients [8x8block][4x4block][level/run][scan_pos]
int ***cofDC; //!< DC coefficients [yuv][level/run][scan_pos]
int ***fadjust4x4; //!< Transform coefficients for 4x4 luma. Excludes DC for I16x16
int ***fadjust8x8; //!< Transform coefficients for 8x8 luma
int ****fadjust4x4Cr; //!< Transform coefficients for 4x4 chroma. Excludes DC chroma.
int ****fadjust8x8Cr; //!< Transform coefficients for 4x4 chroma within 8x8 inter blocks.
Picture *currentPicture; //!< The coded picture currently in the works (typically frame_pic, top_pic, or bottom_pic)
Slice *currentSlice; //!< pointer to current Slice data struct
Macroblock *mb_data; //!< array containing all MBs of a whole frame
int *quad; //!< Array containing square values,used for snr computation */ /* Values are limited to 5000 for pixel differences over 70 (sqr(5000)).
int *intra_block;
int tr;
int fld_type; //!< top or bottom field
unsigned int fld_flag;
unsigned int rd_pass;
int direct_intraP_ref[4][4];
int pstruct_next_P;
int imgtr_next_P_frm;
int imgtr_last_P_frm;
int imgtr_next_P_fld;
int imgtr_last_P_fld;
// B pictures
double b_interval;
int p_interval;
int b_frame_to_code;
int fw_mb_mode;
int bw_mb_mode;
short****** pred_mv; //!< motion vector predictors for all block types and all reference frames
short****** all_mv; //!< replaces local all_mv
short****** bipred_mv1; //!< Biprediction MVs
short****** bipred_mv2; //!< Biprediction MVs
short bi_pred_me[MAXMODE];
int LFDisableIdc;
int LFAlphaC0Offset;
int LFBetaOffset;
int direct_spatial_mv_pred_flag; //!< Direct Mode type to be used (0: Temporal, 1: Spatial)
int num_ref_idx_l0_active;
int num_ref_idx_l1_active;
int field_mode; //!< For MB level field/frame -- field mode on flag
int top_field; //!< For MB level field/frame -- top field flag
int mvscale[6][MAX_REFERENCE_PICTURES];
int buf_cycle;
int i16offset;
int layer; //!< which layer this picture belonged to
int old_layer; //!< old layer number
int NoResidueDirect;
int AdaptiveRounding; //!< Adaptive Rounding parameter based on JVT-N011
int redundant_pic_cnt; // JVT-D101
int MbaffFrameFlag; //!< indicates frame with mb aff coding
//the following should probably go in sequence parameters
unsigned int pic_order_cnt_type;
// for poc mode 1
Boolean delta_pic_order_always_zero_flag;
int offset_for_non_ref_pic;
int offset_for_top_to_bottom_field;
unsigned int num_ref_frames_in_pic_order_cnt_cycle;
int offset_for_ref_frame[1];
//the following is for slice header syntax elements of poc
// for poc mode 0.
unsigned int pic_order_cnt_lsb;
int delta_pic_order_cnt_bottom;
// for poc mode 1.
int delta_pic_order_cnt[2];
unsigned int field_picture;
signed int toppoc; //!< poc for this frame or field
signed int bottompoc; //!< for completeness - poc of bottom field of a frame (always = poc+1)
signed int framepoc; //!< min (toppoc, bottompoc)
signed int ThisPOC; //!< current picture POC
unsigned int frame_num; //!< frame_num for this frame
unsigned int PicWidthInMbs;
unsigned int PicHeightInMapUnits;
unsigned int FrameHeightInMbs;
unsigned int PicSizeInMbs;
unsigned int FrameSizeInMbs;
//the following should probably go in picture parameters
Boolean pic_order_present_flag; // ????????
//the following are sent in the slice header
// int delta_pic_order_cnt[2];
int nal_reference_idc;
int adaptive_ref_pic_buffering_flag;
int no_output_of_prior_pics_flag;
int long_term_reference_flag;
DecRefPicMarking_t *dec_ref_pic_marking_buffer;
int model_number;
// rate control variables
int NumberofCodedMacroBlocks;
int BasicUnitQP;
int NumberofMBTextureBits;
int NumberofMBHeaderBits;
unsigned int BasicUnit;
int write_macroblock;
int bot_MB;
int write_mbaff_frame;
int DeblockCall;
int last_pic_bottom_field;
int last_has_mmco_5;
int pre_frame_num;
int slice_group_change_cycle;
int pic_unit_size_on_disk;
int bitdepth_luma;
int bitdepth_chroma;
int bitdepth_luma_qp_scale;
int bitdepth_chroma_qp_scale;
int bitdepth_lambda_scale;
int max_bitCount;
int max_qp_delta;
int min_qp_delta;
// Lagrangian Parameters
double **lambda_md; //!< Mode decision Lambda
double ***lambda_me; //!< Motion Estimation Lambda
int ***lambda_mf; //!< Integer formatted Motion Estimation Lambda
double **lambda_mf_factor; //!< Motion Estimation Lamda Scale Factor
unsigned int dc_pred_value_luma; //!< luma value for DC prediction (depends on luma pel bit depth)
unsigned int dc_pred_value_chroma; //!< chroma value for DC prediction (depends on chroma pel bit depth)
int max_imgpel_value; //!< max value that one picture element (pixel) can take (depends on pic_unit_bitdepth)
int max_imgpel_value_uv;
int num_blk8x8_uv;
int num_cdc_coeff;
int yuv_format;
int lossless_qpprime_flag;
int mb_cr_size_x;
int mb_cr_size_y;
int mb_size[3][2];
int chroma_qp_offset[2]; //!< offset for qp for chroma [0-Cb, 1-Cr]
int auto_crop_right;
int auto_crop_bottom;
short checkref;
int last_valid_reference;
int bytes_in_picture;
int AverageFrameQP;
int SumFrameQP;
int GopLevels;
} ImageParameters;
#define NUM_PIC_TYPE 5
//!< statistics
typedef struct
{
int quant0; //!< quant for the first frame
int quant1; //!< average quant for the remaining frames
float bitr; //!< bit rate for current frame, used only for output til terminal
float bitrate; //!< average bit rate for the sequence except first frame
int64 bit_ctr; //!< counter for bit usage
int64 bit_ctr_n; //!< bit usage for the current frame
int bit_slice; //!< number of bits in current slice
int stored_bit_slice; //!< keep number of bits in current slice (to restore status in case of MB re-encoding)
int bit_ctr_emulationprevention; //!< stored bits needed to prevent start code emulation
int b8_mode_0_use[NUM_PIC_TYPE][2];
int mode_use_transform_8x8[NUM_PIC_TYPE][MAXMODE];
int mode_use_transform_4x4[NUM_PIC_TYPE][MAXMODE];
int intra_chroma_mode[4];
// B pictures
int successive_Bframe;
int *mode_use_Bframe;
int *bit_use_mode_Bframe;
int64 bit_ctr_I;
int64 bit_ctr_P;
int64 bit_ctr_B;
float bitrate_I;
float bitrate_P;
float bitrate_B;
int64 mode_use [NUM_PIC_TYPE][MAXMODE]; //!< Macroblock mode usage for Intra frames
int64 bit_use_mode [NUM_PIC_TYPE][MAXMODE]; //!< statistics of bit usage
int64 bit_use_stuffingBits[NUM_PIC_TYPE];
int64 bit_use_mb_type [NUM_PIC_TYPE];
int64 bit_use_header [NUM_PIC_TYPE];
int64 tmp_bit_use_cbp [NUM_PIC_TYPE];
int64 bit_use_coeffY [NUM_PIC_TYPE];
int64 bit_use_coeffC [NUM_PIC_TYPE];
int64 bit_use_delta_quant [NUM_PIC_TYPE];
int em_prev_bits_frm;
int em_prev_bits_fld;
int *em_prev_bits;
int bit_ctr_parametersets;
int bit_ctr_parametersets_n;
} StatParameters;
//! For MB level field/frame coding tools
//! temporary structure to store MB data for field/frame coding
typedef struct
{
double min_rdcost;
imgpel rec_mbY[16][16]; // hold the Y component of reconstructed MB
imgpel rec_mbU[16][16], rec_mbV[16][16];
int ****cofAC;
int ***cofDC;
int mb_type;
short bi_pred_me;
int b8mode[4], b8pdir[4];
signed char **ipredmode;
signed char intra_pred_modes[16];
signed char intra_pred_modes8x8[16];
int cbp;
int64 cbp_blk;
int mode;
short ******pred_mv; //!< predicted motion vectors
short ******all_mv; //!< all modes motion vectors
signed char refar[2][4][4];//!< reference frame array [list][y][x]
int i16offset;
int c_ipred_mode;
int luma_transform_size_8x8_flag;
int NoMbPartLessThan8x8Flag;
int qp;
int prev_qp;
int prev_delta_qp;
int delta_qp;
int prev_cbp;
} RD_DATA;
//! Set Explicit GOP Parameters.
//! Currently only supports Enhancement GOP but could be easily extended
typedef struct
{
int slice_type; //! Slice type
int display_no; //! GOP Display order
int reference_idc; //! Is reference?
int slice_qp; //! Assigned QP
int hierarchy_layer; //! Hierarchy layer (used with GOP Hierarchy option 2)
int hierarchyPocDelta; //! Currently unused
} GOP_DATA;
typedef struct
{
int cost8x8;
int rec_resG_8x8[16][16];
int resTrans_R_8x8[16][16];
int resTrans_B_8x8[16][16];
int mprRGB_8x8[3][16][16];
short part8x8mode[4];
signed char part8x8pdir[4];
signed char part8x8fwref[4];
signed char part8x8bwref[4];
imgpel rec_mbY8x8[16][16];
imgpel mpr8x8[16][16];
int lrec[16][16]; // transform and quantized coefficients will be stored here for SP frames
} RD_8x8DATA;
typedef struct
{
double lambda_md; //!< Mode decision Lambda
double lambda_me[3]; //!< Motion Estimation Lambda
int lambda_mf[3]; //!< Integer formatted Motion Estimation Lambda
short valid[MAXMODE];
short list_offset[2];
short curr_mb_field;
short best_ref[2];
int best_mcost[2];
} RD_PARAMS;
GOP_DATA *gop_structure;
RD_DATA *rdopt;
RD_DATA rddata_top_frame_mb, rddata_bot_frame_mb; //!< For MB level field/frame coding tools
RD_DATA rddata_top_field_mb, rddata_bot_field_mb; //!< For MB level field/frame coding tools
extern InputParameters *input;
extern ImageParameters *img;
extern StatParameters *stats;
extern SNRParameters *snr;
// files
FILE *p_stat; //!< status file for the last encoding session
FILE *p_log; //!< SNR file
FILE *p_trace; //!< Trace file
int p_in; //!< original YUV file handle
int p_dec; //!< decoded image file handle
/***********************************************************************
* P r o t o t y p e s f o r T M L
***********************************************************************
*/
void intrapred_luma(int CurrPixX,int CurrPixY, int *left_available, int *up_available, int *all_available);
int dct_luma(int pos_mb1,int pos_mb2,int *cnt_nonz, int intra);
int dct_luma_sp(int pos_mb1,int pos_mb2,int *cnt_nonz);
void copyblock_sp(int pos_mb1,int pos_mb2);
int dct_chroma(int uv,int i11);
int dct_chroma_sp(int uv,int i11);
void intrapred_luma_16x16(void);
int dct_luma_16x16(int);
void init_poc(void);
void init_img(void);
void report(void);
int get_picture_type(void);
void DeblockFrame(ImageParameters *img, imgpel **, imgpel ***) ;
int distortion4x4(int*);
int distortion8x8(int*);
extern int* refbits;
extern int**** motion_cost;
double *mb16x16_cost_frame;
void Get_Direct_Motion_Vectors (void);
void PartitionMotionSearch (int, int, int*);
int BIDPartitionCost (int, int, short, short, int);
int writeAbpCoeffIndex (int, int, int, int);
void estimate_weighting_factor_B_slice(void);
void estimate_weighting_factor_P_slice(int offset);
int test_wp_P_slice(int offset);
int test_wp_B_slice(int method);
void poc_based_ref_management(int current_pic_num);
int picture_coding_decision (Picture *picture1, Picture *picture2, int qp);
unsigned CeilLog2( unsigned uiVal);
int GetDirectCost8x8 (int, int*);
int BPredPartitionCost (int, int, short, short, int, int);
int GetDirectCostMB (void);
int GetSkipCostMB (void);
void FindSkipModeMotionVector (void);
// dynamic mem allocation
int init_global_buffers(void);
void free_global_buffers(void);
void no_mem_exit (char *where);
int get_mem_mv (short*******);
void free_mem_mv (short******);
void free_img (void);
int get_mem_ACcoeff (int*****);
int get_mem_DCcoeff (int****);
void free_mem_ACcoeff (int****);
void free_mem_DCcoeff (int***);
int decide_fld_frame(float snr_frame_Y, float snr_field_Y, int bit_field, int bit_frame, double lambda_picture);
void combine_field(void);
Picture *malloc_picture(void);
void free_picture (Picture *pic);
int encode_one_slice(int SLiceGroupId, Picture *pic, int TotalCodedMBs); //! returns the number of MBs in the slice
void free_slice_list(Picture *currPic);
void report_stats_on_error(void);
#if TRACE
void trace2out(SyntaxElement *se);
void trace2out_cabac(SyntaxElement *se);
#endif
# 1333 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/global.h"
void error(char *text, int code);
int start_sequence(void);
int rewrite_paramsets(void);
int terminate_sequence(void);
int start_slice(void);
int terminate_slice(int);
int write_PPS(int, int);
// B pictures
int get_fwMV(int *min_fw_sad, int tot_intra_sad);
void get_bwMV(int *min_bw_sad);
void get_bid(int *bid_sad, int fw_predframe_no);
void get_dir(int *dir_sad);
void compare_sad(int tot_intra_sad, int fw_sad, int bw_sad, int bid_sad, int dir_sad, int);
int BlkSize2CodeNumber(int blc_size_h, int blc_size_v);
void InitMotionVectorSearchModule(void);
int field_flag_inference(void);
void set_mbaff_parameters(void); // For MB AFF
void writeVlcByteAlign(Bitstream* currStream);
int writeMB_bits_for_4x4_luma (int, int, int);
int writeMB_bits_for_16x16_luma (void);
int writeMB_bits_for_luma (int);
int writeMB_bits_for_DC_chroma (int);
int writeMB_bits_for_AC_chroma (int);
int writeMB_bits_for_CBP (void);
int SingleUnifiedMotionSearch (int, int, int**, int***, int*****, int, int*****, double);
//============= rate-distortion optimization ===================
void clear_rdopt (void);
void init_rdopt (void);
void RD_Mode_Decision (void);
//============= rate-distortion opt with packet losses ===========
void decode_one_macroblock(void);
void decode_one_mb (int, Macroblock*);
void decode_one_b8block (int, int, int, int, int);
void Get_Reference_Block(imgpel **imY, int block_y, int block_x, int mvhor, int mvver, imgpel **out);
byte Get_Reference_Pixel(imgpel **imY, int y, int x);
int Half_Upsample(imgpel **imY, int j, int i);
void DecOneForthPix(imgpel **dY, imgpel ***dref);
void compute_residue(int mode);
void compute_residue_b8block (int, int);
void compute_residue_mb (int);
void UpdateDecoders(void);
void Build_Status_Map(byte **s_map);
void Error_Concealment(imgpel **inY, byte **s_map, imgpel ***refY);
void Conceal_Error(imgpel **inY, int mb_y, int mb_x, imgpel ***refY, byte **s_map);
//============= restriction of reference frames based on the latest intra-refreshes==========
void UpdatePixelMap(void);
//============= fast full integer search =======================
void ClearFastFullIntegerSearch (void);
void ResetFastFullIntegerSearch (void);
void process_2nd_IGOP(void);
void SetImgType(void);
// Tian Dong: for IGOPs
extern Boolean In2ndIGOP;
extern int start_frame_no_in_this_IGOP;
extern int start_tr_in_this_IGOP;
extern int FirstFrameIn2ndIGOP;
#define IMG_NUMBER (img->number - start_frame_no_in_this_IGOP)
void AllocNalPayloadBuffer(void);
void FreeNalPayloadBuffer(void);
void SODBtoRBSP(Bitstream *currStream);
int RBSPtoEBSP(byte *streamBuffer, int begin_bytepos, int end_bytepos, int min_num_bytes);
int Bytes_After_Header;
// Fast ME enable
int BlockMotionSearch (short,int,int,int,int,int, int*);
void low_complexity_encode_md (void);
void encode_one_macroblock_low (void);
void encode_one_macroblock_high (void);
void encode_one_macroblock_highfast (void);
void encode_one_macroblock_highloss (void);
void (*encode_one_macroblock) (void);
void set_chroma_qp(Macroblock *currMB);
#if 0 /* expanded by -frewrite-includes */
#include "context_ini.h"
#endif /* expanded by -frewrite-includes */
# 1423 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/global.h"
# 1 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/context_ini.h" 1
/*!
*************************************************************************************
* \file context_ini.h
*
* \brief
* CABAC context initializations
*
* \author
* Main contributors (see contributors.h for copyright, address and affiliation details)
* - Detlev Marpe <[email protected]>
* - Heiko Schwarz <[email protected]>
**************************************************************************************
*/
#ifndef _CONTEXT_INI_
#define _CONTEXT_INI_
void create_context_memory (void);
void free_context_memory (void);
void init_contexts (void);
void store_contexts (void);
void update_field_frame_contexts (int);
void update_rd_picture_contexts (int);
void SetCtxModelNumber (void);
#endif
# 32 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/context_ini.h"
# 1424 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/global.h" 2
void store_coding_state_cs_cm(void);
void reset_coding_state_cs_cm(void);
int writeIPCMBytes(Bitstream *currStream);
int writePCMByteAlign(Bitstream *currStream);
int dct_luma_sp2(int pos_mb1,int pos_mb2,int *cnt_nonz);
int dct_chroma_sp2(int ,int);
int check_for_SI16(void);
int **lrec ;
int ***lrec_uv;
int si_frame_indicator;
int sp2_frame_indicator;
int number_sp2_frames;
//#define sp_output_indicator 0 //will be in the config file
//#define sp_output_filename "sp_stored.txt" // will be in the config file
void output_SP_coefficients(void);
void read_SP_coefficients(void);
int giRDOpt_B8OnlyFlag;
#ifdef BEST_NZ_COEFF
int gaaiMBAFF_NZCoeff[4][12];
#endif
# 1452 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/global.h"
// Redundant picture
imgpel **imgY_tmp;
imgpel **imgUV_tmp[2];
int frameNuminGOP;
int redundant_coding;
int key_frame;
int redundant_ref_idx;
void Init_redundant_frame(void);
void Set_redundant_frame(void);
void encode_one_redundant_frame(void);
int img_pad_size_uv_x;
int img_pad_size_uv_y;
unsigned char chroma_mask_mv_y;
unsigned char chroma_mask_mv_x;
int chroma_shift_y, chroma_shift_x;
int shift_cr_x, shift_cr_y;
int img_padded_size_x;
int img_cr_padded_size_x;
// struct with pointers to the sub-images
typedef struct {
imgpel ****luma; // component 0 (usually Y, X, or R)
imgpel ****crcb[2]; // component 2 (usually U/V, Y/Z, or G/B)
} SubImageContainer;
int start_me_refinement_hp; // if set then recheck the center position when doing half-pel motion refinement
int start_me_refinement_qp; // if set then recheck the center position when doing quarter-pel motion refinement
#endif
# 1484 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/global.h"
# 27 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/rdopt.c" 2
#if 0 /* expanded by -frewrite-includes */
#include "rdopt_coding_state.h"
#endif /* expanded by -frewrite-includes */
# 28 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/rdopt.c"
# 1 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/rdopt_coding_state.h" 1
/*!
***************************************************************************
* \file
* rdopt_coding_state.h
*
* \author
* Heiko Schwarz
*
* \date
* 17. April 2001
*
* \brief
* Headerfile for storing/restoring coding state
* (for rd-optimized mode decision)
**************************************************************************
*/
#ifndef _RD_OPT_CS_H_
#define _RD_OPT_CS_H_
typedef struct {
// important variables of data partition array
int no_part;
EncodingEnvironment *encenv;
Bitstream *bitstream;
// contexts for binary arithmetic coding
int symbol_mode;
MotionInfoContexts *mot_ctx;
TextureInfoContexts *tex_ctx;
// bit counter
int bitcounter[MAX_BITCOUNTER_MB];
// elements of current macroblock
int mvd[2][BLOCK_MULTIPLE][BLOCK_MULTIPLE][2];
int64 cbp_bits;
} CSobj;
typedef CSobj* CSptr;
void delete_coding_state (CSptr); //!< delete structure
CSptr create_coding_state (void); //!< create structure
void store_coding_state (CSptr); //!< store parameters
void reset_coding_state (CSptr); //!< restore parameters
#endif
# 52 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/rdopt_coding_state.h"
# 29 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/rdopt.c" 2
#if 0 /* expanded by -frewrite-includes */
#include "memalloc.h"
#endif /* expanded by -frewrite-includes */
# 29 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/rdopt.c"
# 1 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/memalloc.h" 1
/*!
************************************************************************
* \file memalloc.h
*
* \brief
* Memory allocation and free helper funtions
*
* \author
* Main contributors (see contributors.h for copyright, address and affiliation details)
************************************************************************
*/
#ifndef _MEMALLOC_H_
#define _MEMALLOC_H_
int get_mem2D(byte ***array2D, int rows, int columns);
int get_mem3D(byte ****array2D, int frames, int rows, int columns);
int get_mem2Dint(int ***array2D, int rows, int columns);
int get_mem3Dint(int ****array3D, int frames, int rows, int columns);
int get_mem4Dint(int *****array4D, int idx, int frames, int rows, int columns );
int get_mem5Dint(int ******array5D, int refs, int blocktype, int rows, int columns, int component);
int get_mem2Dint64(int64 ***array2D, int rows, int columns);
int get_mem3Dint64(int64 ****array3D, int frames, int rows, int columns);
int get_mem2Dshort(short ***array2D, int rows, int columns);
int get_mem3Dshort(short ****array3D, int frames, int rows, int columns);
int get_mem4Dshort(short *****array4D, int idx, int frames, int rows, int columns );
int get_mem5Dshort(short ******array5D, int refs, int blocktype, int rows, int columns, int component);
int get_mem6Dshort(short *******array6D, int list, int refs, int blocktype, int rows, int columns, int component);
int get_mem2Dpel(imgpel ***array2D, int rows, int columns);
int get_mem3Dpel(imgpel ****array3D, int frames, int rows, int columns);
int get_mem4Dpel(imgpel *****array4D, int sub_x, int sub_y, int rows, int columns);
int get_mem5Dpel(imgpel ******array5D, int dims, int sub_x, int sub_y, int rows, int columns);
int get_mem2Ddouble(double ***array2D, int rows, int columns);
int get_mem2Ddb_offset(double ***array2D, int rows, int columns, int offset);
int get_mem3Ddb_offset(double ****array2D, int rows, int columns, int pels, int offset);
int get_mem2Dint_offset(int ***array2D, int rows, int columns, int offset);
int get_mem3Dint_offset(int ****array3D, int rows, int columns, int pels, int offset);
void free_mem2D(byte **array2D);
void free_mem3D(byte ***array2D, int frames);
void free_mem2Dint(int **array2D);
void free_mem3Dint(int ***array3D, int frames);
void free_mem4Dint(int ****array4D, int idx, int frames);
void free_mem5Dint(int *****array5D, int refs, int blocktype, int rows);
void free_mem2Dint64(int64 **array2D);
void free_mem3Dint64(int64 ***array3D64, int frames);
void free_mem2Dshort(short **array2D);
void free_mem3Dshort(short ***array3D, int frames);
void free_mem4Dshort(short ****array4D, int idx, int frames);
void free_mem5Dshort(short *****array5D, int refs, int blocktype, int height);
void free_mem6Dshort(short ******array5D, int list, int refs, int blocktype, int height);
void free_mem2Dpel(imgpel **array2D);
void free_mem3Dpel(imgpel ***array3D, int frames);
void free_mem4Dpel(imgpel ****array4D, int sub_x, int sub_y);
void free_mem5Dpel(imgpel *****array5D, int dims, int sub_x, int sub_y);
void free_mem2Ddouble(double **array2D);
void free_mem2Ddb_offset(double **array2D, int offset);
void free_mem2Dint_offset(int **array2D, int offset);
void free_mem3Ddb_offset(double ***array3D, int rows, int columns, int offset);
void free_mem3Dint_offset(int ***array3D, int rows, int columns, int offset);
int init_top_bot_planes(imgpel **imgFrame, int rows, int columns, imgpel ***imgTopField, imgpel ***imgBotField);
void free_top_bot_planes(imgpel **imgTopField, imgpel **imgBotField);
void no_mem_exit(char *where);
#endif
# 81 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/memalloc.h"
# 30 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/rdopt.c" 2
#if 0 /* expanded by -frewrite-includes */
#include "mb_access.h"
#endif /* expanded by -frewrite-includes */
# 30 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/rdopt.c"
# 1 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/mb_access.h" 1
/*!
*************************************************************************************
* \file mb_access.h
*
* \brief
* Functions for macroblock neighborhoods
*
* \author
* Main contributors (see contributors.h for copyright, address and affiliation details)
* - Karsten Sühring <[email protected]>
*************************************************************************************
*/
#ifndef _MB_ACCESS_H_
#define _MB_ACCESS_H_
void CheckAvailabilityOfNeighbors(void);
void (*getNeighbour)(unsigned int curr_mb_nr, int xN, int yN, int is_chroma, PixelPos *pix);
void getAffNeighbour(unsigned int curr_mb_nr, int xN, int yN, int is_chroma, PixelPos *pix);
void getNonAffNeighbour(unsigned int curr_mb_nr, int xN, int yN, int is_chroma, PixelPos *pix);
void getLuma4x4Neighbour (int curr_mb_nr, int block_x, int block_y, PixelPos *pix);
void getChroma4x4Neighbour (int curr_mb_nr, int block_x, int block_y, PixelPos *pix);
int mb_is_available(int mbAddr, int currMbAddr);
void get_mb_pos (int mb_addr, int *x, int*y, int is_chroma);
void (*get_mb_block_pos) (int mb_addr, int *x, int*y);
void get_mb_block_pos_normal (int mb_addr, int *x, int*y);
void get_mb_block_pos_mbaff (int mb_addr, int *x, int*y);
#endif
# 34 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/mb_access.h"
# 31 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/rdopt.c" 2
#if 0 /* expanded by -frewrite-includes */
#include "elements.h"
#endif /* expanded by -frewrite-includes */
# 31 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/rdopt.c"
# 1 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/elements.h" 1
/*!
**************************************************************************
* \file elements.h
* \brief Header file for elements in H.264 streams
* \date 6.10.2000,
* \version
* 1.1
*
* \note
* Version 1.0 included three partition modes, no DP, 2 partitionsper slice
* and 4 partitions per slice. As per document VCEG-N72 this is changed
* in version 1.1 to only two partition modes, one without DP and one with
* 3 partition per slice
*
* \author Sebastian Purreiter <[email protected]>
* \author Stephan Wenger <[email protected]>
*
**************************************************************************
*/
#ifndef _ELEMENTS_H_
#define _ELEMENTS_H_
/*!
* definition of H.264 syntax elements
* order of elements follow dependencies for picture reconstruction
*/
#define MAXPARTITIONMODES 2 //!< maximum possible partition modes as defined in assignSE2partition[][]
/*!
* \brief lookup-table to assign different elements to partition
*
* \note here we defined up to 6 different partitions similar to
* document Q15-k-18 described in the PROGFRAMEMODE.
* The Sliceheader contains the PSYNC information. \par
*
* Elements inside a partition are not ordered. They are
* ordered by occurence in the stream.
* Assumption: Only partitionlosses are considered. \par
*
* The texture elements luminance and chrominance are
* not ordered in the progressive form
* This may be changed in image.c \par
*
* -IMPORTANT:
* Picture- or Sliceheaders must be assigned to partition 0. \par
* Furthermore partitions must follow syntax dependencies as
* outlined in document Q15-J-23.
*/
// A note on this table:
//
// While the assignment of values in enum data types is specified in C, it is not
// very ood style to have an "elementnumber", not even as a comment.
//
// Hence a copy of the relevant structure from global.h here
/*
typedef enum {
0 SE_HEADER,
1 SE_PTYPE,
2 SE_MBTYPE,
3 SE_REFFRAME,
4 SE_INTRAPREDMODE,
5 SE_MVD,
6 SE_CBP
7 SE_LUM_DC_INTRA,
8 SE_CHR_DC_INTRA,
9 SE_LUM_AC_INTRA,
10 SE_CHR_AC_INTRA,
12 SE_LUM_DC_INTER,
13 SE_CHR_DC_INTER,
14 SE_LUM_AC_INTER,
15 SE_CHR_AC_INTER,
16 SE_DELTA_QUANT,
18 SE_BFRAME,
19 SE_EOS,
20 SE_MAX_ELEMENTS */ // number of maximum syntax elements
//} SE_type;
extern int * assignSE2partition[2];
extern int assignSE2partition_NoDP[SE_MAX_ELEMENTS];
extern int assignSE2partition_DP[SE_MAX_ELEMENTS];
#endif
# 89 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/elements.h"
# 32 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/rdopt.c" 2
#if 0 /* expanded by -frewrite-includes */
#include "intrarefresh.h"
#endif /* expanded by -frewrite-includes */
# 32 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/rdopt.c"
# 1 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/intrarefresh.h" 1
/*!
***************************************************************************
*
* \file intrarefresh.h
*
* \brief
* Pseudo-Raqndom Intra macroblock refresh support
*
* \date
* 16 June 2002
*
* \author
* Stephan Wenger [email protected]
**************************************************************************/
#ifndef _INTRAREFRESH_H_
#define _INTRAREFRESH_H_
void RandomIntraInit(int xsize, int ysize, int refresh);
void RandomIntraUninit(void);
int RandomIntra (int mb); //! returns 1 for MBs that need forced Intra
void RandomIntraNewPicture (void); //! to be called once per picture
#endif //_INTRAREFRESH_H_
# 27 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/intrarefresh.h"
# 33 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/rdopt.c" 2
#if 0 /* expanded by -frewrite-includes */
#include "image.h"
#endif /* expanded by -frewrite-includes */
# 33 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/rdopt.c"
# 1 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/image.h" 1
/*!
************************************************************************
* \file image.h
*
* \brief
* headers for image processing
*
* \author
* Inge Lille-Langoy <[email protected]>
* Copyright (C) 1999 Telenor Satellite Services, Norway
************************************************************************
*/
#ifndef _IMAGE_H_
#define _IMAGE_H_
#if 0 /* expanded by -frewrite-includes */
#include "mbuffer.h"
#endif /* expanded by -frewrite-includes */
# 17 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/image.h"
# 1 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/mbuffer.h" 1
/*!
***********************************************************************
* \file
* mbuffer.h
*
* \brief
* Frame buffer functions
*
* \author
* Main contributors (see contributors.h for copyright, address and affiliation details)
* - Karsten Sühring <[email protected]>
***********************************************************************
*/
#ifndef _MBUFFER_H_
#define _MBUFFER_H_
#define MAX_LIST_SIZE 33
//! definition a picture (field or frame)
typedef struct storable_picture
{
PictureStructure structure;
int poc;
int top_poc;
int bottom_poc;
int frame_poc;
int order_num;
int64 ref_pic_num[6][MAX_LIST_SIZE];
int64 frm_ref_pic_num[6][MAX_LIST_SIZE];
int64 top_ref_pic_num[6][MAX_LIST_SIZE];
int64 bottom_ref_pic_num[6][MAX_LIST_SIZE];
unsigned frame_num;
int pic_num;
int long_term_pic_num;
int long_term_frame_idx;
int is_long_term;
int used_for_reference;
int is_output;
int non_existing;
int size_x, size_y, size_x_cr, size_y_cr;
int size_x_pad, size_y_pad;
int size_x_cr_pad, size_y_cr_pad;
int chroma_vector_adjustment;
int coded_frame;
int MbaffFrameFlag;
imgpel ** imgY; //!< Y picture component
imgpel **** imgY_sub; //!< Y picture component upsampled (Quarter pel)
imgpel **** imgY_sub_w; //!< Y picture component upsampled (Quarter pel) for weighted prediction
imgpel ***** imgUV_sub; //!< UV picture component upsampled (Quarter/One-Eighth pel)
imgpel *** imgUV; //!< U and V picture components
byte * mb_field; //!< field macroblock indicator
signed char *** ref_idx; //!< reference picture [list][subblock_y][subblock_x]
int64 *** ref_pic_id; //!< reference picture identifier [list][subblock_y][subblock_x]
// (not simply index)
int64 *** ref_id; //!< reference picture identifier [list][subblock_y][subblock_x]
// (not simply index)
short **** mv; //!< motion vector [list][subblock_x][subblock_y][component]
byte ** moving_block;
byte ** field_frame; //!< indicates if co_located is field or frame.
struct storable_picture *top_field; // for mb aff, if frame for referencing the top field
struct storable_picture *bottom_field; // for mb aff, if frame for referencing the bottom field
struct storable_picture *frame; // for mb aff, if field for referencing the combined frame
int chroma_format_idc;
int frame_mbs_only_flag;
int frame_cropping_flag;
int frame_cropping_rect_left_offset;
int frame_cropping_rect_right_offset;
int frame_cropping_rect_top_offset;
int frame_cropping_rect_bottom_offset;
} StorablePicture;
//! definition a picture (field or frame)
typedef struct colocated_params
{
int mb_adaptive_frame_field_flag;
int size_x, size_y;
int64 ref_pic_num[6][MAX_LIST_SIZE];
signed char *** ref_idx; //!< reference picture [list][subblock_y][subblock_x]
int64 *** ref_pic_id; //!< reference picture identifier [list][subblock_y][subblock_x]
short **** mv; //!< motion vector [list][subblock_x][subblock_y][component]
byte ** moving_block;
// Top field params
int64 top_ref_pic_num[6][MAX_LIST_SIZE];
signed char *** top_ref_idx; //!< reference picture [list][subblock_y][subblock_x]
int64 *** top_ref_pic_id; //!< reference picture identifier [list][subblock_y][subblock_x]
short **** top_mv; //!< motion vector [list][subblock_x][subblock_y][component]
byte ** top_moving_block;
// Bottom field params
int64 bottom_ref_pic_num[6][MAX_LIST_SIZE];
signed char *** bottom_ref_idx; //!< reference picture [list][subblock_y][subblock_x]
int64 *** bottom_ref_pic_id; //!< reference picture identifier [list][subblock_y][subblock_x]
short **** bottom_mv; //!< motion vector [list][subblock_x][subblock_y][component]
byte ** bottom_moving_block;
byte is_long_term;
byte ** field_frame; //!< indicates if co_located is field or frame.
} ColocatedParams;
//! Frame Stores for Decoded Picture Buffer
typedef struct frame_store
{
int is_used; //!< 0=empty; 1=top; 2=bottom; 3=both fields (or frame)
int is_reference; //!< 0=not used for ref; 1=top used; 2=bottom used; 3=both fields (or frame) used
int is_long_term; //!< 0=not used for ref; 1=top used; 2=bottom used; 3=both fields (or frame) used
int is_orig_reference; //!< original marking by nal_ref_idc: 0=not used for ref; 1=top used; 2=bottom used; 3=both fields (or frame) used
int is_non_existent;
unsigned frame_num;
int frame_num_wrap;
int long_term_frame_idx;
int is_output;
int poc;
StorablePicture *frame;
StorablePicture *top_field;
StorablePicture *bottom_field;
} FrameStore;
//! Decoded Picture Buffer
typedef struct decoded_picture_buffer
{
FrameStore **fs;
FrameStore **fs_ref;
FrameStore **fs_ltref;
unsigned size;
unsigned used_size;
unsigned ref_frames_in_buffer;
unsigned ltref_frames_in_buffer;
int last_output_poc;
int max_long_term_pic_idx;
int init_done;
FrameStore *last_picture;
} DecodedPictureBuffer;
extern DecodedPictureBuffer dpb;
extern StorablePicture **listX[6];
extern int listXsize[6];
void init_dpb(void);
void free_dpb(void);
FrameStore* alloc_frame_store(void);
void free_frame_store(FrameStore* f);
StorablePicture* alloc_storable_picture(PictureStructure type, int size_x, int size_y, int size_x_cr, int size_y_cr);
void free_storable_picture(StorablePicture* p);
void store_picture_in_dpb(StorablePicture* p);
void replace_top_pic_with_frame(StorablePicture* p);
void flush_dpb(void);
void dpb_split_field(FrameStore *fs);
void dpb_combine_field(FrameStore *fs);
void dpb_combine_field_yuv(FrameStore *fs);
void init_lists(int currSliceType, PictureStructure currPicStructure);
void reorder_ref_pic_list(StorablePicture **list, int *list_size,
int num_ref_idx_lX_active_minus1, int *reordering_of_pic_nums_idc,
int *abs_diff_pic_num_minus1, int *long_term_pic_idx);
void init_mbaff_lists(void);
void alloc_ref_pic_list_reordering_buffer(Slice *currSlice);
void free_ref_pic_list_reordering_buffer(Slice *currSlice);
void fill_frame_num_gap(ImageParameters *img);
ColocatedParams* alloc_colocated(int size_x, int size_y,int mb_adaptive_frame_field_flag);
void free_colocated(ColocatedParams* p);
void compute_colocated(ColocatedParams* p, StorablePicture **listX[6]);
#endif
# 194 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/mbuffer.h"
# 18 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/image.h" 2
extern StorablePicture *enc_picture;
extern StorablePicture *enc_frame_picture;
extern StorablePicture *enc_frame_picture2;
extern StorablePicture *enc_frame_picture3;
extern StorablePicture *enc_top_picture;
extern StorablePicture *enc_bottom_picture;
int encode_one_frame (void);
void report_frame_statistic(void);
Boolean dummy_slice_too_big(int bits_slice);
void copy_rdopt_data (int field_type); // For MB level field/frame coding tools
void UnifiedOneForthPix (StorablePicture *s);
#endif
# 34 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/image.h"
# 34 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/rdopt.c" 2
#if 0 /* expanded by -frewrite-includes */
#include "transform8x8.h"
#endif /* expanded by -frewrite-includes */
# 34 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/rdopt.c"
# 1 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/transform8x8.h" 1
/*!
***************************************************************************
*
* \file transform8x8.h
*
* \brief
* prototypes of 8x8 transform functions
*
* \date
* 9. October 2003
*
* \author
* Main contributors (see contributors.h for copyright, address and affiliation details)
* Yuri Vatis [email protected]
**************************************************************************/
#ifndef _TRANSFORM8X8_H_
#define _TRANSFORM8X8_H_
int Mode_Decision_for_new_Intra8x8Macroblock (double lambda, int *min_cost);
int Mode_Decision_for_new_8x8IntraBlocks (int b8, double lambda, int *min_cost);
void intrapred_luma8x8(int img_x,int img_y, int *left_available, int *up_available, int *all_available);
double RDCost_for_8x8IntraBlocks(int *c_nz, int b8, int ipmode, double lambda, double min_rdcost, int mostProbableMode);
int dct_luma8x8(int b8,int *coeff_cost, int intra);
void LowPassForIntra8x8Pred(imgpel *PredPel, int block_up_left, int block_up, int block_left);
#endif //_TRANSFORM8X8_H_
# 33 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/transform8x8.h"
# 35 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/rdopt.c" 2
#if 0 /* expanded by -frewrite-includes */
#include "cabac.h"
#endif /* expanded by -frewrite-includes */
# 35 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/rdopt.c"
# 1 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/cabac.h" 1
/*!
***************************************************************************
* \file
* cabac.h
*
* \brief
* Headerfile for entropy coding routines
*
* \author
* Detlev Marpe \n
* Copyright (C) 2000 HEINRICH HERTZ INSTITUTE All Rights Reserved.
*
* \date
* 21. Oct 2000 (Changes by Tobias Oelbaum 28.08.2001)
***************************************************************************
*/
#ifndef _CABAC_H_
#define _CABAC_H_
// CABAC
int get_pic_bin_count(void);
void reset_pic_bin_count(void);
void arienco_start_encoding(EncodingEnvironmentPtr eep, unsigned char *code_buffer, int *code_len);
int arienco_bits_written(EncodingEnvironmentPtr eep);
void arienco_done_encoding(EncodingEnvironmentPtr eep);
void biari_init_context (BiContextTypePtr ctx, const int* ini);
void rescale_cum_freq(BiContextTypePtr bi_ct);
void biari_encode_symbol(EncodingEnvironmentPtr eep, signed short symbol, BiContextTypePtr bi_ct );
void biari_encode_symbol_eq_prob(EncodingEnvironmentPtr eep, signed short symbol);
void biari_encode_symbol_final(EncodingEnvironmentPtr eep, signed short symbol);
MotionInfoContexts* create_contexts_MotionInfo(void);
TextureInfoContexts* create_contexts_TextureInfo(void);
void init_contexts_MotionInfo (MotionInfoContexts *enco_ctx);
void init_contexts_TextureInfo(TextureInfoContexts *enco_ctx);
void delete_contexts_MotionInfo(MotionInfoContexts *enco_ctx);
void delete_contexts_TextureInfo(TextureInfoContexts *enco_ctx);
void writeHeaderToBuffer(void);
void writeMB_typeInfo_CABAC(SyntaxElement *se, DataPartition *dp);
void writeIntraPredMode_CABAC(SyntaxElement *se, DataPartition *dp);
void writeB8_typeInfo_CABAC(SyntaxElement *se, DataPartition *dp);
void writeRefFrame_CABAC(SyntaxElement *se, DataPartition *dp);
void writeMVD_CABAC(SyntaxElement *se, DataPartition *dp);
void writeCBP_CABAC(SyntaxElement *se, DataPartition *dp);
void writeDquant_CABAC(SyntaxElement *se, DataPartition *dp);
void writeRunLevel_CABAC(SyntaxElement *se, DataPartition *dp);
void writeCIPredMode_CABAC(SyntaxElement *se, DataPartition *dp);
void print_ctx_TextureInfo(TextureInfoContexts *enco_ctx);
void writeMB_skip_flagInfo_CABAC(SyntaxElement *se, DataPartition *dp);
void writeFieldModeInfo_CABAC(SyntaxElement *se, DataPartition *dp); //GB
void writeCBP_BIT_CABAC (int b8, int bit, int cbp, Macroblock* currMB, int inter, EncodingEnvironmentPtr eep_dp);
void cabac_new_slice(void);
void CheckAvailabilityOfNeighborsCABAC(void);
void writeMB_transform_size_CABAC(SyntaxElement *se, DataPartition *dp);
#endif // CABAC_H
# 62 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/cabac.h"
# 36 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/rdopt.c" 2
#if 0 /* expanded by -frewrite-includes */
#include "vlc.h"
#endif /* expanded by -frewrite-includes */
# 36 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/rdopt.c"
# 1 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/vlc.h" 1
/*!
*************************************************************************************
* \file vlc.h
*
* \brief
* Prototypes for VLC coding funtions
* \author
* Karsten Suehring
*************************************************************************************
*/
#ifndef _VLC_H_
#define _VLC_H_
Boolean u_1 (char *tracestring, int value, Bitstream *bitstream);
int se_v (char *tracestring, int value, Bitstream *bitstream);
int ue_v (char *tracestring, int value, Bitstream *bitstream);
int u_v (int n, char *tracestring, int value, Bitstream *bitstream);
void levrun_linfo_c2x2(int level,int run,int *len,int *info);
void levrun_linfo_inter(int level,int run,int *len,int *info);
void writeSE_UVLC (SyntaxElement *se, DataPartition *dp);
void writeSE_SVLC (SyntaxElement *se, DataPartition *dp);
void writeSE_Fix (SyntaxElement *se, DataPartition *dp);
void writeSE_Flag (SyntaxElement *se, DataPartition *dp);
void writeSE_invFlag(SyntaxElement *se, DataPartition *dp);
void writeSE_Dummy (SyntaxElement *se, DataPartition *dp);
void writeCBP_VLC (SyntaxElement *se, DataPartition *dp);
void writeIntraPredMode_CAVLC(SyntaxElement *se, DataPartition *dp);
int writeSyntaxElement2Buf_UVLC(SyntaxElement *se, Bitstream* this_streamBuffer );
void writeUVLC2buffer(SyntaxElement *se, Bitstream *currStream);
int writeSyntaxElement2Buf_Fixed(SyntaxElement *se, Bitstream* this_streamBuffer );
int symbol2uvlc(SyntaxElement *se);
void ue_linfo(int n, int dummy, int *len,int *info);
void se_linfo(int mvd, int dummy, int *len,int *info);
void cbp_linfo_intra(int cbp, int dummy, int *len,int *info);
void cbp_linfo_inter(int cbp, int dummy, int *len,int *info);
// CAVLC
void CAVLC_init(void);
int writeSyntaxElement_VLC(SyntaxElement *se, DataPartition *this_dataPart);
int writeSyntaxElement_TotalZeros(SyntaxElement *se, DataPartition *this_dataPart);
int writeSyntaxElement_TotalZerosChromaDC(SyntaxElement *se, DataPartition *this_dataPart);
int writeSyntaxElement_Run(SyntaxElement *se, DataPartition *this_dataPart);
int writeSyntaxElement_NumCoeffTrailingOnes(SyntaxElement *se, DataPartition *this_dataPart);
int writeSyntaxElement_NumCoeffTrailingOnesChromaDC(SyntaxElement *se, DataPartition *this_dataPart);
int writeSyntaxElement_Level_VLC1(SyntaxElement *se, DataPartition *this_dataPart, int profile_idc);
int writeSyntaxElement_Level_VLCN(SyntaxElement *se, int vlc, DataPartition *this_dataPart, int profile_idc);
#endif
# 57 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/vlc.h"
# 37 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/rdopt.c" 2
#if 0 /* expanded by -frewrite-includes */
#include "me_umhex.h"
#endif /* expanded by -frewrite-includes */
# 37 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/rdopt.c"
# 1 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/me_umhex.h" 1
/*!
************************************************************************
*
* \file me_umhex.h
*
* \brief
* Macro definitions and global variables for UMHEX fast
* integer pel motion estimation and fractional pel motion estimation
*
* \author
* Main contributors: (see contributors.h for copyright, address and affiliation details)
* - Zhibo Chen <[email protected]>
* - JianFeng Xu <[email protected]>
* - Wenfang Fu <[email protected]>
* - Xiaozhong Xu <[email protected]>
*
* \date
* 2006.1
************************************************************************
*/
#ifndef _ME_UMHEX_H_
#define _ME_UMHEX_H_
#if 0 /* expanded by -frewrite-includes */
#include "mbuffer.h"
#endif /* expanded by -frewrite-includes */
# 26 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/me_umhex.h"
# 27 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/me_umhex.h"
#define EARLY_TERMINATION \
if ((min_mcost-pred_SAD)<pred_SAD*betaFourth_2) \
goto fourth_2_step; \
else if((min_mcost-pred_SAD)<pred_SAD*betaFourth_1) \
goto fourth_1_step;
#define SEARCH_ONE_PIXEL \
if(iabs(cand_x - center_x) <=search_range && iabs(cand_y - center_y)<= search_range)\
{ \
if(!McostState[cand_y-center_y+search_range][cand_x-center_x+search_range]) \
{ \
mcost = MV_COST (lambda_factor, mvshift, cand_x, cand_y, pred_x, pred_y); \
if(mcost<min_mcost) \
{ \
mcost += computeUniPred[dist_method](orig_pic, \
blocksize_y,blocksize_x, min_mcost - mcost, \
(cand_x << 2) + IMG_PAD_SIZE_TIMES4, (cand_y << 2) + IMG_PAD_SIZE_TIMES4); \
McostState[cand_y-center_y+search_range][cand_x-center_x+search_range] = 1; \
if (mcost < min_mcost) \
{ \
best_x = cand_x; \
best_y = cand_y; \
min_mcost = mcost; \
} \
} \
} \
}
#define SEARCH_ONE_PIXEL_BIPRED \
if(iabs(cand_x - center2_x) <=search_range && iabs(cand_y - center2_y)<= search_range)\
{ \
if(!McostState[cand_y-center2_y+search_range][cand_x-center2_x+search_range]) \
{ \
mcost = MV_COST (lambda_factor, mvshift, center1_x, center1_y, pred_x1, pred_y1);\
mcost += MV_COST (lambda_factor, mvshift, cand_x, cand_y, pred_x2, pred_y2); \
if(mcost<min_mcost) \
{ \
mcost += computeBiPred(cur_pic, blocksize_y, blocksize_x, \
min_mcost - mcost, \
(center1_x << 2) + IMG_PAD_SIZE_TIMES4, \
(center1_y << 2) + IMG_PAD_SIZE_TIMES4, \
(cand_x << 2) + IMG_PAD_SIZE_TIMES4, \
(cand_y << 2) + IMG_PAD_SIZE_TIMES4); \
McostState[cand_y-center2_y+search_range][cand_x-center2_x+search_range] = 1; \
if (mcost < min_mcost) \
{ \
best_x = cand_x; \
best_y = cand_y; \
min_mcost = mcost; \
} \
} \
} \
}
byte **McostState; //!< state for integer pel search
byte **SearchState; //!< state for fractional pel search
int ****fastme_ref_cost; //!< store SAD information needed for forward ref-frame prediction
int ***fastme_l0_cost; //!< store SAD information needed for forward median and uplayer prediction
int ***fastme_l1_cost; //!< store SAD information needed for backward median and uplayer prediction
int ***fastme_l0_cost_bipred; //!< store SAD information for bipred mode
int ***fastme_l1_cost_bipred; //!< store SAD information for bipred mode
int bipred_flag; //!< flag for bipred
int **fastme_best_cost; //!< for multi ref early termination threshold
int pred_SAD; //!< SAD prediction in use.
int pred_MV_ref[2], pred_MV_uplayer[2]; //!< pred motion vector by space or temporal correlation,Median is provided
int UMHEX_blocktype; //!< blocktype for UMHEX SetMotionVectorPredictor
int predict_point[5][2];
int SAD_a,SAD_b,SAD_c,SAD_d;
int Threshold_DSR_MB[8]; //!< Threshold for usage of DSR. DSR refer to JVT-Q088
//for early termination
float Bsize[8];
float AlphaFourth_1[8];
float AlphaFourth_2[8];
byte *flag_intra;
int flag_intra_SAD;
void UMHEX_DefineThreshold(void);
void UMHEX_DefineThresholdMB(void);
int UMHEX_get_mem(void);
void UMHEX_free_mem(void);
void UMHEX_decide_intrabk_SAD(void);
void UMHEX_skip_intrabk_SAD(int best_mode, int ref_max);
void UMHEX_setup(short ref, int list, int block_y, int block_x, int blocktype, short ******all_mv);
int // ==> minimum motion cost after search
UMHEXIntegerPelBlockMotionSearch (
imgpel *orig_pic, // <-- not used
short ref, // <-- reference frame (0... or -1 (backward))
int list, // <-- reference picture list
int pic_pix_x, // <-- absolute x-coordinate of regarded AxB block
int pic_pix_y, // <-- absolute y-coordinate of regarded AxB block
int blocktype, // <-- block type (1-16x16 ... 7-4x4)
short pred_mv_x, // <-- motion vector predictor (x) in sub-pel units
short pred_mv_y, // <-- motion vector predictor (y) in sub-pel units
short* mv_x, // --> motion vector (x) - in pel units
short* mv_y, // --> motion vector (y) - in pel units
int search_range, // <-- 1-d search range in pel units
int min_mcost, // <-- minimum motion cost (cost for center or huge value)
int lambda_factor);// <-- lagrangian parameter for determining motion cost
int // ==> minimum motion cost after search
UMHEXSubPelBlockMotionSearch (
imgpel* orig_pic, // <-- original pixel values for the AxB block
short ref, // <-- reference frame (0... or -1 (backward))
int list, // <-- reference picture list
int pic_pix_x, // <-- absolute x-coordinate of regarded AxB block
int pic_pix_y, // <-- absolute y-coordinate of regarded AxB block
int blocktype, // <-- block type (1-16x16 ... 7-4x4)
short pred_mv_x, // <-- motion vector predictor (x) in sub-pel units
short pred_mv_y, // <-- motion vector predictor (y) in sub-pel units
short* mv_x, // <--> in: search center (x) / out: motion vector (x) - in pel units
short* mv_y, // <--> in: search center (y) / out: motion vector (y) - in pel units
int search_pos2, // <-- search positions for half-pel search (default: 9)
int search_pos4, // <-- search positions for quarter-pel search (default: 9)
int min_mcost, // <-- minimum motion cost (cost for center or huge value)
int lambda_factor);// <-- lagrangian parameter for determining motion cost
extern int // ==> minimum motion cost after search
SubPelBlockMotionSearch (imgpel* orig_pic, // <-- original pixel values for the AxB block
short ref, // <-- reference frame (0... or -1 (backward))
int list,
int pic_pix_x, // <-- absolute x-coordinate of regarded AxB block
int pic_pix_y, // <-- absolute y-coordinate of regarded AxB block
int blocktype, // <-- block type (1-16x16 ... 7-4x4)
short pred_mv_x, // <-- motion vector predictor (x) in sub-pel units
short pred_mv_y, // <-- motion vector predictor (y) in sub-pel units
short* mv_x, // <--> in: search center (x) / out: motion vector (x) - in pel units
short* mv_y, // <--> in: search center (y) / out: motion vector (y) - in pel units
int search_pos2, // <-- search positions for half-pel search (default: 9)
int search_pos4, // <-- search positions for quarter-pel search (default: 9)
int min_mcost, // <-- minimum motion cost (cost for center or huge value)
int *lambda_factor // <-- lagrangian parameter for determining motion cost
);
int // ==> minimum motion cost after search
UMHEXBipredIntegerPelBlockMotionSearch (
imgpel* orig_pic, // <-- original pixel values for the AxB block
short ref, // <-- reference frame (0... or -1 (backward))
int list,
int pic_pix_x, // <-- absolute x-coordinate of regarded AxB block
int pic_pix_y, // <-- absolute y-coordinate of regarded AxB block
int blocktype, // <-- block type (1-16x16 ... 7-4x4)
short pred_mv_x1, // <-- motion vector predictor (x) in sub-pel units
short pred_mv_y1, // <-- motion vector predictor (y) in sub-pel units
short pred_mv_x2, // <-- motion vector predictor (x) in sub-pel units
short pred_mv_y2, // <-- motion vector predictor (y) in sub-pel units
short* mv_x, // <--> in: search center (x) / out: motion vector (x) - in pel units
short* mv_y, // <--> in: search center (y) / out: motion vector (y) - in pel units
short* s_mv_x, // <--> in: search center (x) / out: motion vector (x) - in pel units
short* s_mv_y, // <--> in: search center (y) / out: motion vector (y) - in pel units
int search_range, // <-- 1-d search range in pel units
int min_mcost, // <-- minimum motion cost (cost for center or huge value)
int lambda_factor // <-- lagrangian parameter for determining motion cost
);
void UMHEXSetMotionVectorPredictor (short pmv[2], signed char **refPic, short ***tmp_mv,
short ref_frame, int list, int block_x, int block_y,
int blockshape_x, int blockshape_y, int *search_range);
#endif
# 192 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/me_umhex.h"
# 38 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/rdopt.c" 2
#if 0 /* expanded by -frewrite-includes */
#include "ratectl.h" // head file for rate control
#endif /* expanded by -frewrite-includes */
# 38 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/rdopt.c"
# 1 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/ratectl.h" 1
/*!
***************************************************************************
* \file
* ratectl.h
*
* \author
* Zhengguo LI
*
* \date
* 14 Jan 2003
*
* \brief
* Headerfile for rate control
**************************************************************************
*/
#ifndef _RATE_CTL_H_
#define _RATE_CTL_H_
/* generic rate control variables */
typedef struct {
// RC flags
int TopFieldFlag;
int FieldControl;
int FieldFrame;
int NoGranularFieldRC;
// bits stats
int NumberofHeaderBits;
int NumberofTextureBits;
int NumberofBasicUnitHeaderBits;
int NumberofBasicUnitTextureBits;
// frame stats
int NumberofCodedBFrame;
int NumberofCodedPFrame;
int NumberofGOP;
int TotalQpforPPicture;
int NumberofPPicture;
// MAD stats
int64 TotalMADBasicUnit;
int *MADofMB;
// buffer and budget
int64 CurrentBufferFullness; //LIZG 25/10/2002
int RemainingBits;
// bit allocations for RC_MODE_3
int RCPSliceBits;
int RCISliceBits;
int RCBSliceBits[RC_MAX_TEMPORAL_LEVELS];
int temporal_levels;
int hierNb[RC_MAX_TEMPORAL_LEVELS];
int NPslice;
int NIslice;
} rc_generic;
// macroblock activity
int diffy[16][16];
int qp_mbaff[2][2], qp_mbaff[2][2];
int delta_qp_mbaff[2][2], delta_qp_mbaff[2][2];
// generic functions
int Qstep2QP( double Qstep );
double QP2Qstep( int QP );
int calc_MAD( void );
double ComputeFrameMAD( void );
void update_rc(Macroblock *currMB, short best_mode);
// rate control functions
// init/copy
void generic_alloc( rc_generic **prc );
void generic_free( rc_generic **prc );
void copy_rc_generic( rc_generic *dst, rc_generic *src );
// rate control CURRENT pointers
rc_generic *generic_RC;
// rate control object pointers for RDPictureDecision buffering...
rc_generic *generic_RC_init, *generic_RC_best;
#endif
# 80 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/ratectl.h"
# 39 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/rdopt.c" 2
#if 0 /* expanded by -frewrite-includes */
#include "mode_decision.h"
#endif /* expanded by -frewrite-includes */
# 39 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/rdopt.c"
# 1 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/mode_decision.h" 1
/*!
***************************************************************************
* \file
* mode_decision.h
*
* \author
* Alexis Michael Tourapis
*
* \date
* 21. February 2005
*
* \brief
* Headerfile for mode decision
**************************************************************************
*/
#ifndef _MODE_DECISION_H_
#define _MODE_DECISION_H_
extern CSptr cs_mb, cs_b8, cs_cm, cs_imb, cs_ib8, cs_ib4, cs_pc;
//extern imgpel mpr_8x8ts[16][16];
//extern imgpel rec_mbY[16][16], rec_mbU[16][16], rec_mbV[16][16]; // reconstruction values
extern RD_8x8DATA tr4x4, tr8x8;
// Adaptive Lagrangian variables
extern double mb16x16_cost;
extern double lambda_mf_factor;
extern const int LEVELMVLIMIT[17][6];
extern int ****cofAC_8x8ts; // [8x8block][4x4block][level/run][scan_pos]
extern int ****cofAC, ****cofAC8x8; // [8x8block][4x4block][level/run][scan_pos]
extern int QP2QUANT[40];
extern int cbp_blk8x8;
extern int cbp, cbp8x8, cnt_nonz_8x8;
extern int64 cbp_blk;
extern int64 cbp_blk8_8x8ts;
extern int cbp8_8x8ts;
extern int cnt_nonz8_8x8ts;
extern int qp_mbaff[2][2], qp_mbaff[2][2];
extern int delta_qp_mbaff[2][2],delta_qp_mbaff[2][2];
// Residue Color Transform
extern signed char b4_ipredmode[16], b4_intra_pred_modes[16];
extern short bi_pred_me;
extern short best_mode;
extern short best8x8mode [4]; // [block]
extern signed char best8x8pdir [MAXMODE][4]; // [mode][block]
extern signed char best8x8fwref[MAXMODE][4]; // [mode][block]
extern signed char best8x8bwref[MAXMODE][4]; // [mode][block]
extern imgpel pred[16][16];
extern void set_stored_macroblock_parameters (void);
extern void StoreMV8x8(int);
extern void RestoreMV8x8(int);
extern void store_macroblock_parameters (int);
extern void SetModesAndRefframeForBlocks (int);
extern void SetRefAndMotionVectors (int, int, int, int, int);
extern void StoreNewMotionVectorsBlock8x8(int, int, int, int, int, int, int);
extern void assign_enc_picture_params(int, signed char, int, int, int, int, int);
extern void update_refresh_map(int intra, int intra1, Macroblock *currMB);
extern void SetMotionVectorsMB (Macroblock*, int);
extern void SetCoeffAndReconstruction8x8 (Macroblock*);
extern void fast_mode_intra_decision(short *intra_skip, double min_rate);
extern int GetBestTransformP8x8(void);
extern int I16Offset (int, int);
extern int CheckReliabilityOfRef (int, int, int, int);
extern int Mode_Decision_for_Intra4x4Macroblock (double, int*);
extern int RDCost_for_macroblocks (double, int, double*, double*, int);
extern double RDCost_for_8x8blocks (int*, int64*, double, int, int, short, short, short);
extern double *mb16x16_cost_frame;
extern const int b8_mode_table[6];
extern const int mb_mode_table[9];
void rc_store_diff(int cpix_x, int cpix_y, imgpel prediction[16][16]);
void submacroblock_mode_decision(RD_PARAMS, RD_8x8DATA *, Macroblock *,int ***, int *, short, int, int *, int *, int *, int);
void init_enc_mb_params(Macroblock* currMB, RD_PARAMS *enc_mb, int intra, int bslice);
void list_prediction_cost(int list, int block, int mode, RD_PARAMS enc_mb, int bmcost[5], signed char best_ref[2]);
void determine_prediction_list(int, int [5], signed char [2], signed char *, int *, short *);
void compute_mode_RD_cost(int mode, Macroblock *currMB, RD_PARAMS enc_mb,
double *min_rdcost, double *min_rate,
int i16mode, short bslice, short *inter_skip);
void get_initial_mb16x16_cost(void);
void adjust_mb16x16_cost(int);
#endif
# 91 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/mode_decision.h"
# 40 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/rdopt.c" 2
#if 0 /* expanded by -frewrite-includes */
#include "fmo.h"
#endif /* expanded by -frewrite-includes */
# 40 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/rdopt.c"
# 1 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/fmo.h" 1
/*!
***************************************************************************
*
* \file fmo.h
*
* \brief
* Support for Flexible Macroblock Ordering
*
* \date
* 16 June 2002
*
* \author
* Stephan Wenger [email protected]
**************************************************************************/
#ifndef _FMO_H_
#define _FMO_H_
#define MAXSLICEGROUPIDS 8
int FmoInit(ImageParameters * img, pic_parameter_set_rbsp_t * pps, seq_parameter_set_rbsp_t * sps);
void FmoUninit (void);
int FmoFinit (seq_parameter_set_rbsp_t * sps);
int FmoMB2SliceGroup (int mb);
int FmoGetFirstMBOfSliceGroup (int SliceGroupID);
int FmoGetFirstMacroblockInSlice (int SliceGroup);
int FmoGetNextMBNr (int CurrentMbNr);
int FmoGetLastCodedMBOfSliceGroup (int SliceGroupID);
int FmoStartPicture (void);
int FmoEndPicture(void);
int FmoSliceGroupCompletelyCoded(int SliceGroupID);
void FmoSetLastMacroblockInSlice (int mb);
int FmoGetPreviousMBNr (int CurrentMbNr);
extern byte *MBAmap;
#endif
# 40 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/fmo.h"
# 41 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/rdopt.c" 2
#if 0 /* expanded by -frewrite-includes */
#include "macroblock.h"
#endif /* expanded by -frewrite-includes */
# 41 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/rdopt.c"
# 1 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/macroblock.h" 1
/*!
************************************************************************
* \file
* macroblock.h
*
* \brief
* Arrays for macroblock processing
*
* \author
* Inge Lille-Langoy <[email protected]> \n
* Telenor Satellite Services \n
* P.O.Box 6914 St.Olavs plass \n
* N-0130 Oslo, Norway
*
************************************************************************/
#ifndef _MACROBLOCK_H_
#define _MACROBLOCK_H_
void proceed2nextMacroblock(void);
void start_macroblock(int mb_addr, int mb_field);
void terminate_macroblock(Boolean *end_of_slice, Boolean *recode_macroblock);
void write_one_macroblock(int eos_bit);
void LumaPrediction4x4 (int, int, int, int, int, short, short);
void LumaPrediction4x4Bi (int, int, int, int, short, short, int );
int LumaResidualCoding8x8 (int*, int64*, int, short, int, int, short, short);
void LumaResidualCoding (void);
void ChromaResidualCoding (int*);
void IntraChromaPrediction (int*, int*, int*);
void IntraChromaRDDecision (RD_PARAMS);
int TransformDecision(int, int*);
int B8Mode2Value (int b8mode, int b8pdir);
int writeMBLayer (int rdopt, int *coeff_rate);
void write_terminating_bit (short bit);
int writeReferenceFrame (int mode, int i, int j, int fwd_flag, int ref);
int writeMotionVector8x8 (int i0, int j0, int i1, int j1, int refframe, int list_idx, int mv_mode);
int writeLumaCoeff4x4_CABAC (int, int, int);
int writeLumaCoeff8x8_CABAC (int, int);
int writeLumaCoeff8x8 (int, int, int);
int writeCoeff4x4_CAVLC (int block_type, int b8, int b4, int param);
int find_sad_16x16 (int *intra_mode);
#endif
# 58 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/macroblock.h"
# 42 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/rdopt.c" 2
#if 0 /* expanded by -frewrite-includes */
#include "symbol.h"
#endif /* expanded by -frewrite-includes */
# 42 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/rdopt.c"
# 1 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/symbol.h" 1
/*!
***************************************************************************
*
* \file symbol.h
*
* \brief
* Generic Symbol writing interface
*
* \date
* 18 Jan 2006
*
* \author
* Karsten Suehring [email protected]
**************************************************************************/
extern void (*writeMB_typeInfo) (SyntaxElement *se, DataPartition *dP);
extern void (*writeIntraPredMode) (SyntaxElement *se, DataPartition *dP);
extern void (*writeB8_typeInfo) (SyntaxElement *se, DataPartition *dP);
extern void (*writeRefFrame[6]) (SyntaxElement *se, DataPartition *dP);
extern void (*writeMVD) (SyntaxElement *se, DataPartition *dP);
extern void (*writeCBP) (SyntaxElement *se, DataPartition *dP);
extern void (*writeDquant) (SyntaxElement *se, DataPartition *dP);
extern void (*writeCIPredMode) (SyntaxElement *se, DataPartition *dP);
extern void (*writeFieldModeInfo) (SyntaxElement *se, DataPartition *dP);
extern void (*writeMB_transform_size)(SyntaxElement *se, DataPartition *dP);
# 43 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/rdopt.c" 2
imgpel pred[16][16];
#define FASTMODE 1
//#define RESET_STATE
extern const int LEVELMVLIMIT[17][6];
extern int QP2QUANT[40];
const int AdaptRndCrPos[2][5] =
{
// P, B, I, SP, SI
{ 4, 7, 1, 4, 1}, // Intra MB
{ 10, 13, 10, 10, 10} // Inter MB
};
const int AdaptRndPos[4][5] =
{
// P, B, I, SP, SI
{ 3, 6, 0, 3, 0}, // 4x4 Intra MB
{ 1, 2, 0, 1, 2}, // 8x8 Intra MB
{ 9, 12, 9, 9, 9}, // 4x4 Inter MB
{ 3, 4, 3, 3, 3}, // 8x8 Inter MB
};
imgpel rec_mbY[16][16], rec_mbU[16][16], rec_mbV[16][16]; // reconstruction values
int lrec_rec[16][16],lrec_rec_U[16][16],lrec_rec_V[16][16]; // store the transf. and quantized coefficients for SP frames
static int diff[16];
static int diff4x4[64];
static int diff8x8[64];
RD_8x8DATA tr4x4, tr8x8;
int **bestInterFAdjust4x4=NULL, **bestIntraFAdjust4x4=NULL;
int **bestInterFAdjust8x8=NULL, **bestIntraFAdjust8x8=NULL;
int ***bestInterFAdjust4x4Cr=NULL, ***bestIntraFAdjust4x4Cr=NULL;
int **fadjust8x8=NULL, **fadjust4x4=NULL, ***fadjust4x4Cr=NULL, ***fadjust8x8Cr=NULL;
int ****cofAC=NULL, ****cofAC8x8=NULL; // [8x8block][4x4block][level/run][scan_pos]
int ***cofDC=NULL; // [yuv][level/run][scan_pos]
int **cofAC4x4=NULL, ****cofAC4x4intern=NULL; // [level/run][scan_pos]
int cbp, cbp8x8, cnt_nonz_8x8;
int64 cbp_blk;
int cbp_blk8x8;
signed char frefframe[4][4], brefframe[4][4];
int b8mode[4], b8pdir[4];
short best8x8mode [4]; // [block]
signed char best8x8pdir [MAXMODE][4]; // [mode][block]
signed char best8x8fwref [MAXMODE][4]; // [mode][block]
signed char best8x8bwref [MAXMODE][4]; // [mode][block]
CSptr cs_mb=NULL, cs_b8=NULL, cs_cm=NULL, cs_imb=NULL, cs_ib8=NULL, cs_ib4=NULL, cs_pc=NULL;
int best_c_imode;
int best_i16offset;
short best_mode;
short bi_pred_me;
//mixed transform sizes definitions
int luma_transform_size_8x8_flag;
short all_mv8x8[2][2][4][4][2]; //[8x8_data/temp_data][LIST][block_x][block_y][MVx/MVy]
short pred_mv8x8[2][2][4][4][2];
int ****cofAC_8x8ts = NULL; // [8x8block][4x4block][level/run][scan_pos]
int64 cbp_blk8_8x8ts;
int cbp8_8x8ts;
int cost8_8x8ts;
int cnt_nonz8_8x8ts;
// adaptive langrangian parameters
double mb16x16_cost;
double lambda_mf_factor;
void StoreMV8x8(int dir);
void RestoreMV8x8(int dir);
// end of mixed transform sizes definitions
//Adaptive Rounding update function
void update_offset_params(int mode, int luma_transform_size_8x8_flag);
signed char b4_ipredmode[16], b4_intra_pred_modes[16];
/*!
************************************************************************
* \brief
* delete structure for RD-optimized mode decision
************************************************************************
*/
void clear_rdopt ()
{
free_mem_DCcoeff (cofDC);
free_mem_ACcoeff (cofAC);
free_mem_ACcoeff (cofAC8x8);
free_mem_ACcoeff (cofAC4x4intern);
if (input->Transform8x8Mode)
{
free_mem_ACcoeff (cofAC_8x8ts);
}
if (input->AdaptiveRounding)
{
free_mem2Dint(bestInterFAdjust4x4);
free_mem2Dint(bestIntraFAdjust4x4);
free_mem2Dint(bestInterFAdjust8x8);
free_mem2Dint(bestIntraFAdjust8x8);
free_mem3Dint(bestInterFAdjust4x4Cr, 2);
free_mem3Dint(bestIntraFAdjust4x4Cr, 2);
free_mem2Dint(fadjust8x8);
free_mem2Dint(fadjust4x4);
free_mem3Dint(fadjust4x4Cr, 2);
free_mem3Dint(fadjust8x8Cr, 2);
}
// structure for saving the coding state
delete_coding_state (cs_mb);
delete_coding_state (cs_b8);
delete_coding_state (cs_cm);
delete_coding_state (cs_imb);
delete_coding_state (cs_ib8);
delete_coding_state (cs_ib4);
delete_coding_state (cs_pc);
}
/*!
************************************************************************
* \brief
* create structure for RD-optimized mode decision
************************************************************************
*/
void init_rdopt ()
{
rdopt = NULL;
get_mem_DCcoeff (&cofDC);
get_mem_ACcoeff (&cofAC);
get_mem_ACcoeff (&cofAC8x8);
get_mem_ACcoeff (&cofAC4x4intern);
cofAC4x4 = cofAC4x4intern[0][0];
if (input->Transform8x8Mode)
{
get_mem_ACcoeff (&cofAC_8x8ts);
}
switch (input->rdopt)
{
case 0:
encode_one_macroblock = encode_one_macroblock_low;
break;
case 1:
encode_one_macroblock = encode_one_macroblock_high;
break;
case 2:
encode_one_macroblock = encode_one_macroblock_highfast;
break;
case 3:
encode_one_macroblock = encode_one_macroblock_highloss;
break;
default:
encode_one_macroblock = encode_one_macroblock_high;
break;
}
if (input->AdaptiveRounding)
{
get_mem2Dint(&bestInterFAdjust4x4, 16, 16);
get_mem2Dint(&bestIntraFAdjust4x4, 16, 16);
get_mem2Dint(&bestInterFAdjust8x8, 16, 16);
get_mem2Dint(&bestIntraFAdjust8x8, 16, 16);
get_mem3Dint(&bestInterFAdjust4x4Cr, 2, img->mb_cr_size_y, img->mb_cr_size_x);
get_mem3Dint(&bestIntraFAdjust4x4Cr, 2, img->mb_cr_size_y, img->mb_cr_size_x);
get_mem2Dint(&fadjust8x8, 16, 16);
get_mem2Dint(&fadjust4x4, 16, 16);
get_mem3Dint(&fadjust4x4Cr, 2, img->mb_cr_size_y, img->mb_cr_size_x);
get_mem3Dint(&fadjust8x8Cr, 2, img->mb_cr_size_y, img->mb_cr_size_x);
}
// structure for saving the coding state
cs_mb = create_coding_state ();
cs_b8 = create_coding_state ();
cs_cm = create_coding_state ();
cs_imb = create_coding_state ();
cs_ib8 = create_coding_state ();
cs_ib4 = create_coding_state ();
cs_pc = create_coding_state ();
if (input->CtxAdptLagrangeMult == 1)
{
mb16x16_cost = CALM_MF_FACTOR_THRESHOLD;
lambda_mf_factor = 1.0;
}
}
/*!
*************************************************************************************
* \brief
* Updates the pixel map that shows, which reference frames are reliable for
* each MB-area of the picture.
*
* \note
* The new values of the pixel_map are taken from the temporary buffer refresh_map
*
*************************************************************************************
*/
void UpdatePixelMap()
{
int mx,my,y,x,i,j;
if (img->type==I_SLICE)
{
for (y=0; y<img->height; y++)
for (x=0; x<img->width; x++)
{
pixel_map[y][x]=1;
}
}
else
{
for (my=0; my<img->height >> 3; my++)
for (mx=0; mx<img->width >> 3; mx++)
{
j = my*8 + 8;
i = mx*8 + 8;
if (refresh_map[my][mx])
{
for (y=my*8; y<j; y++)
for (x=mx*8; x<i; x++)
pixel_map[y][x] = 1;
}
else
{
for (y=my*8; y<j; y++)
for (x=mx*8; x<i; x++)
{
pixel_map[y][x] = imin(pixel_map[y][x] + 1, input->num_ref_frames+1);
}
}
}
}
}
/*!
*************************************************************************************
* \brief
* Checks if a given reference frame is reliable for the current
* macroblock, given the motion vectors that the motion search has
* returned.
*
* \return
* If the return value is 1, the reference frame is reliable. If it
* is 0, then it is not reliable.
*
* \note
* A specific area in each reference frame is assumed to be unreliable
* if the same area has been intra-refreshed in a subsequent frame.
* The information about intra-refreshed areas is kept in the pixel_map.
*
*************************************************************************************
*/
int CheckReliabilityOfRef (int block, int list_idx, int ref, int mode)
{
int y,x, block_y, block_x, dy, dx, y_pos, x_pos, yy, xx, pres_x, pres_y;
int maxold_x = img->width-1;
int maxold_y = img->height-1;
int ref_frame = ref+1;
int by0 = (mode>=4?2*(block >> 1):mode==2?2*block:0);
int by1 = by0 + (mode>=4||mode==2?2:4);
int bx0 = (mode>=4?2*(block & 0x01):mode==3?2*block:0);
int bx1 = bx0 + (mode>=4||mode==3?2:4);
for (block_y=by0; block_y<by1; block_y++)
{
for (block_x=bx0; block_x<bx1; block_x++)
{
y_pos = img->all_mv[block_y][block_x][list_idx][ref][mode][1];
y_pos += (img->block_y + block_y) * BLOCK_SIZE * 4;
x_pos = img->all_mv[block_y][block_x][list_idx][ref][mode][0];
x_pos += (img->block_x + block_x) * BLOCK_SIZE * 4;
/* Here we specify which pixels of the reference frame influence
the reference values and check their reliability. This is
based on the function Get_Reference_Pixel */
dy = y_pos & 3;
dx = x_pos & 3;
y_pos = (y_pos-dy) >> 2;
x_pos = (x_pos-dx) >> 2;
if (dy==0 && dx==0) //full-pel
{
for (y=y_pos ; y < y_pos + BLOCK_SIZE ; y++)
for (x=x_pos ; x < x_pos + BLOCK_SIZE ; x++)
if (pixel_map[iClip3(0,maxold_y,y)][iClip3(0,maxold_x,x)] < ref_frame)
return 0;
}
else /* other positions */
{
if (dy == 0)
{
for (y = y_pos ; y < y_pos + BLOCK_SIZE ; y++)
{
pres_y = iClip3(0,maxold_y,y);
for (x = x_pos ; x < x_pos + BLOCK_SIZE ; x++)
{
for(xx = -2 ; xx < 4 ; xx++) {
pres_x = iClip3(0, maxold_x, x + xx);
if (pixel_map[pres_y][pres_x] < ref_frame)
return 0;
}
}
}
}
else if (dx == 0)
{
for (y = y_pos ; y < y_pos + BLOCK_SIZE ; y++)
for (x=x_pos ; x < x_pos + BLOCK_SIZE ; x++)
{
pres_x = iClip3(0,maxold_x,x);
for(yy=-2;yy<4;yy++) {
pres_y = iClip3(0,maxold_y, yy + y);
if (pixel_map[pres_y][pres_x] < ref_frame)
return 0;
}
}
}
else if (dx == 2)
{
for (y = y_pos ; y < y_pos + BLOCK_SIZE ; y++)
for (x = x_pos ; x < x_pos + BLOCK_SIZE ; x++)
{
for(yy=-2;yy<4;yy++) {
pres_y = iClip3(0,maxold_y, yy + y);
for(xx=-2;xx<4;xx++) {
pres_x = iClip3(0,maxold_x, xx + x);
if (pixel_map[pres_y][pres_x] < ref_frame)
return 0;
}
}
}
}
else if (dy == 2)
{
for (y = y_pos ; y < y_pos + BLOCK_SIZE ; y++)
for (x = x_pos ; x < x_pos + BLOCK_SIZE ; x++)
{
for(xx=-2;xx<4;xx++) {
pres_x = iClip3(0,maxold_x, xx + x);
for(yy=-2;yy<4;yy++) {
pres_y = iClip3(0,maxold_y, yy + y);
if (pixel_map[pres_y][pres_x] < ref_frame)
return 0;
}
}
}
}
else
{
for (y = y_pos ; y < y_pos + BLOCK_SIZE ; y++)
{
for (x = x_pos ; x < x_pos + BLOCK_SIZE ; x++)
{
pres_y = dy == 1 ? y : y + 1;
pres_y = iClip3(0,maxold_y,pres_y);
for(xx=-2;xx<4;xx++)
{
pres_x = iClip3(0,maxold_x,xx + x);
if (pixel_map[pres_y][pres_x] < ref_frame)
return 0;
}
pres_x = dx == 1 ? x : x + 1;
pres_x = iClip3(0,maxold_x,pres_x);
for(yy=-2;yy<4;yy++)
{
pres_y = iClip3(0,maxold_y, yy + y);
if (pixel_map[pres_y][pres_x] < ref_frame)
return 0;
}
}
}
}
}
}
}
return 1;
}
/*!
*************************************************************************************
* \brief
* R-D Cost for an 4x4 Intra block
*************************************************************************************
*/
double RDCost_for_4x4IntraBlocks (int* nonzero,
int b8,
int b4,
int ipmode,
double lambda,
double min_rdcost,
int mostProbableMode)
{
double rdcost;
int dummy, x, y, rate;
int64 distortion = 0;
int block_x = 8*(b8 & 0x01)+4*(b4 & 0x01);
int block_y = 8*(b8 >> 1)+4*(b4 >> 1);
int pic_pix_x = img->pix_x+block_x;
int pic_pix_y = img->pix_y+block_y;
int pic_opix_y = img->opix_y+block_y;
imgpel **imgY = enc_picture->imgY;
Slice *currSlice = img->currentSlice;
SyntaxElement se;
const int *partMap = assignSE2partition[input->partition_mode];
DataPartition *dataPart;
//===== perform DCT, Q, IQ, IDCT, Reconstruction =====
dummy = 0;
if(img->type!=SP_SLICE)
*nonzero = dct_luma (block_x, block_y, &dummy, 1);
else if(!si_frame_indicator && !sp2_frame_indicator)
{
*nonzero = dct_luma_sp(block_x, block_y, &dummy);
}
else
{
*nonzero = dct_luma_sp2(block_x, block_y, &dummy);
}
//===== get distortion (SSD) of 4x4 block =====
for (y=0; y<4; y++)
{
for (x=pic_pix_x; x<pic_pix_x+4; x++)
{
distortion += img->quad [imgY_org[pic_opix_y+y][x] - imgY[pic_pix_y+y][x]];
}
}
//===== RATE for INTRA PREDICTION MODE (SYMBOL MODE MUST BE SET TO UVLC) =====
se.value1 = (mostProbableMode == ipmode) ? -1 : ipmode < mostProbableMode ? ipmode : ipmode-1;
//--- set position and type ---
se.context = 4*b8 + b4;
se.type = SE_INTRAPREDMODE;
//--- choose data partition ---
dataPart = &(currSlice->partArr[partMap[SE_INTRAPREDMODE]]);
//--- encode and update rate ---
writeIntraPredMode (&se, dataPart);
rate = se.len;
//===== RATE for LUMINANCE COEFFICIENTS =====
if (input->symbol_mode == UVLC)
{
rate += writeCoeff4x4_CAVLC (LUMA, b8, b4, 0);
}
else
{
rate += writeLumaCoeff4x4_CABAC (b8, b4, 1);
}
//reset_coding_state (cs_cm);
rdcost = (double)distortion + lambda*(double)rate;
return rdcost;
}
/*!
*************************************************************************************
* \brief
* Mode Decision for an 4x4 Intra block
*************************************************************************************
*/
int Mode_Decision_for_4x4IntraBlocks (int b8, int b4, double lambda, int* min_cost)
{
int ipmode, best_ipmode = 0, i, j, k, y, cost, dummy;
int c_nz, nonzero = 0;
imgpel rec4x4[4][4];
double rdcost;
int block_x = 8 * (b8 & 0x01) + 4 * (b4 & 0x01);
int block_y = 8 * (b8 >> 1) + 4 * (b4 >> 1);
int pic_pix_x = img->pix_x + block_x;
int pic_pix_y = img->pix_y + block_y;
int pic_opix_x = img->opix_x + block_x;
int pic_opix_y = img->opix_y + block_y;
int pic_block_x = pic_pix_x >> 2;
int pic_block_y = pic_pix_y >> 2;
double min_rdcost = 1e30;
int left_available, up_available, all_available;
signed char upMode;
signed char leftMode;
int mostProbableMode;
PixelPos left_block;
PixelPos top_block;
int lrec4x4[4][4];
int fixedcost = (int) floor(4 * lambda );
#ifdef BEST_NZ_COEFF
int best_nz_coeff = 0;
int best_coded_block_flag = 0;
int bit_pos = 1 + ((((b8>>1)<<1)+(b4>>1))<<2) + (((b8&1)<<1)+(b4&1));
static int64 cbp_bits;
if (b8==0 && b4==0)
cbp_bits = 0;
#endif
# 566 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/rdopt.c"
getLuma4x4Neighbour(img->current_mb_nr, block_x - 1, block_y, &left_block);
getLuma4x4Neighbour(img->current_mb_nr, block_x, block_y-1, &top_block);
// constrained intra pred
if (input->UseConstrainedIntraPred)
{
left_block.available = left_block.available ? img->intra_block[left_block.mb_addr] : 0;
top_block.available = top_block.available ? img->intra_block[top_block.mb_addr] : 0;
}
upMode = top_block.available ? img->ipredmode[top_block.pos_y ][top_block.pos_x ] : -1;
leftMode = left_block.available ? img->ipredmode[left_block.pos_y][left_block.pos_x] : -1;
mostProbableMode = (upMode < 0 || leftMode < 0) ? DC_PRED : upMode < leftMode ? upMode : leftMode;
*min_cost = INT_MAX;
//===== INTRA PREDICTION FOR 4x4 BLOCK =====
intrapred_luma (pic_pix_x, pic_pix_y, &left_available, &up_available, &all_available);
//===== LOOP OVER ALL 4x4 INTRA PREDICTION MODES =====
for (ipmode=0; ipmode<NO_INTRA_PMODE; ipmode++)
{
int available_mode = (ipmode==DC_PRED) ||
((ipmode==VERT_PRED||ipmode==VERT_LEFT_PRED||ipmode==DIAG_DOWN_LEFT_PRED) && up_available ) ||
((ipmode==HOR_PRED||ipmode==HOR_UP_PRED) && left_available ) ||(all_available);
if (input->IntraDisableInterOnly==0 || img->type != I_SLICE)
{
if (input->Intra4x4ParDisable && (ipmode==VERT_PRED||ipmode==HOR_PRED))
continue;
if (input->Intra4x4DiagDisable && (ipmode==DIAG_DOWN_LEFT_PRED||ipmode==DIAG_DOWN_RIGHT_PRED))
continue;
if (input->Intra4x4DirDisable && ipmode>=VERT_RIGHT_PRED)
continue;
}
if( available_mode)
{
if (!input->rdopt)
{
for (k=j=0; j<4; j++)
{
int jj = pic_opix_y+j;
for (i=0; i<4; i++, k++)
{
diff[k] = imgY_org[jj][pic_opix_x+i] - img->mprr[ipmode][j][i];
}
}
cost = (ipmode == mostProbableMode) ? 0 : fixedcost;
cost += distortion4x4 (diff);
if (cost < *min_cost)
{
best_ipmode = ipmode;
*min_cost = cost;
}
}
else
{
// get prediction and prediction error
for (j=0; j<4; j++)
{
memcpy(&img->mpr[block_y+j][block_x], img->mprr[ipmode][j], BLOCK_SIZE * sizeof(imgpel));
for (i=0; i<4; i++)
{
img->m7[j][i] = (int) (imgY_org[pic_opix_y+j][pic_opix_x+i] - img->mprr[ipmode][j][i]);
}
}
//===== store the coding state =====
//store_coding_state (cs_cm);
// get and check rate-distortion cost
#ifdef BEST_NZ_COEFF
img->mb_data[img->current_mb_nr].cbp_bits = cbp_bits;
#endif
# 644 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/rdopt.c"
if ((rdcost = RDCost_for_4x4IntraBlocks (&c_nz, b8, b4, ipmode, lambda, min_rdcost, mostProbableMode)) < min_rdcost)
{
//--- set coefficients ---
memcpy(cofAC4x4[0],img->cofAC[b8][b4][0], 18 * sizeof(int));
memcpy(cofAC4x4[1],img->cofAC[b8][b4][1], 18 * sizeof(int));
//--- set reconstruction ---
for (y=0; y<4; y++)
{
memcpy(rec4x4[y],&enc_picture->imgY[pic_pix_y+y][pic_pix_x], BLOCK_SIZE * sizeof(imgpel));
if(img->type==SP_SLICE &&(!si_frame_indicator && !sp2_frame_indicator))
memcpy(lrec4x4[y],&lrec[pic_pix_y+y][pic_pix_x], BLOCK_SIZE * sizeof(int));// stores the mode coefficients
}
//--- flag if dct-coefficients must be coded ---
nonzero = c_nz;
//--- set best mode update minimum cost ---
min_rdcost = rdcost;
best_ipmode = ipmode;
#ifdef BEST_NZ_COEFF
best_nz_coeff = img->nz_coeff [img->current_mb_nr][block_x4][block_y4];
best_coded_block_flag = (int)((img->mb_data[img->current_mb_nr].cbp_bits>>bit_pos)&(int64)(1));
#endif
# 667 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/rdopt.c"
//store_coding_state (cs_ib4);
if (img->AdaptiveRounding)
{
for (j=0; j<4; j++)
memcpy(&fadjust4x4[block_y+j][block_x],&img->fadjust4x4[1][block_y+j][block_x], BLOCK_SIZE * sizeof(int));
}
}
#ifndef RESET_STATE
reset_coding_state (cs_cm);
#endif
# 678 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/rdopt.c"
}
}
}
#ifdef BEST_NZ_COEFF
img->nz_coeff [img->current_mb_nr][block_x4][block_y4] = best_nz_coeff;
cbp_bits &= (~(int64)(1<<bit_pos));
cbp_bits |= (int64)(best_coded_block_flag<<bit_pos);
#endif
# 687 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/rdopt.c"
//===== set intra mode prediction =====
img->ipredmode[pic_block_y][pic_block_x] = (signed char) best_ipmode;
img->mb_data[img->current_mb_nr].intra_pred_modes[4*b8+b4] =
(signed char) (mostProbableMode == best_ipmode ? -1 : (best_ipmode < mostProbableMode ? best_ipmode : best_ipmode-1));
if (!input->rdopt)
{
// get prediction and prediction error
for (j=0; j<4; j++)
{
int jj = pic_opix_y+j;
for (i=0; i<4; i++)
{
img->mpr[block_y+j][block_x+i] = img->mprr[best_ipmode][j][i];
img->m7[j][i] = imgY_org[jj][pic_opix_x+i] - img->mprr[best_ipmode][j][i];
}
}
nonzero = dct_luma (block_x, block_y, &dummy, 1);
}
else
{
//===== restore coefficients =====
for (j=0; j<2; j++)
{
memcpy (img->cofAC[b8][b4][j],cofAC4x4[j], 18 * sizeof(int));
}
//===== restore reconstruction and prediction (needed if single coeffs are removed) =====
for (y=0; y<BLOCK_SIZE; y++)
{
memcpy (&enc_picture->imgY[pic_pix_y+y][pic_pix_x],rec4x4[y], BLOCK_SIZE * sizeof(imgpel));
memcpy (&img->mpr[block_y+y][block_x],img->mprr[best_ipmode][y], BLOCK_SIZE * sizeof(imgpel));
if(img->type==SP_SLICE &&(!si_frame_indicator && !sp2_frame_indicator))
memcpy (&lrec[pic_pix_y+y][pic_pix_x],lrec4x4[y], BLOCK_SIZE * sizeof(int));//restore coefficients when encoding primary SP frame
}
if (img->AdaptiveRounding)
{
for (j=0; j<BLOCK_SIZE; j++)
memcpy (&img->fadjust4x4[1][block_y+j][block_x],&fadjust4x4[block_y+j][block_x], BLOCK_SIZE * sizeof(int));
}
}
return nonzero;
}
/*!
*************************************************************************************
* \brief
* Mode Decision for an 8x8 Intra block
*************************************************************************************
*/
int Mode_Decision_for_8x8IntraBlocks(int b8,double lambda,int *cost)
{
int nonzero=0, b4;
int cost4x4;
*cost = (int)floor(6.0 * lambda + 0.4999);
for (b4=0; b4<4; b4++)
{
if (Mode_Decision_for_4x4IntraBlocks (b8, b4, lambda, &cost4x4))
{
nonzero = 1;
}
*cost += cost4x4;
}
#ifdef RESET_STATE
//reset_coding_state (cs_cm);
#endif
# 758 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/rdopt.c"
return nonzero;
}
/*!
*************************************************************************************
* \brief
* 4x4 Intra mode decision for an macroblock
*************************************************************************************
*/
int Mode_Decision_for_Intra4x4Macroblock (double lambda, int* cost)
{
int cbp=0, b8, cost8x8;
for (*cost=0, b8=0; b8<4; b8++)
{
if (Mode_Decision_for_8x8IntraBlocks (b8, lambda, &cost8x8))
{
cbp |= (1<<b8);
}
*cost += cost8x8;
}
return cbp;
}
/*!
*************************************************************************************
* \brief
* R-D Cost for an 8x8 Partition
*************************************************************************************
*/
double RDCost_for_8x8blocks (int* cnt_nonz, // --> number of nonzero coefficients
int64* cbp_blk, // --> cbp blk
double lambda, // <-- lagrange multiplier
int block, // <-- 8x8 block number
int mode, // <-- partitioning mode
short pdir, // <-- prediction direction
short l0_ref, // <-- L0 reference picture
short l1_ref) // <-- L1 reference picture
{
int i, j, k;
int rate=0;
int64 distortion=0;
int dummy = 0, mrate;
int fw_mode, bw_mode;
int cbp = 0;
int pax = 8*(block & 0x01);
int pay = 8*(block >> 1);
int i0 = pax >> 2;
int j0 = pay >> 2;
int bframe = (img->type==B_SLICE);
int direct = (bframe && mode==0);
int b8value = B8Mode2Value (mode, pdir);
Macroblock *currMB = &img->mb_data[img->current_mb_nr];
SyntaxElement se;
Slice *currSlice = img->currentSlice;
DataPartition *dataPart;
const int *partMap = assignSE2partition[input->partition_mode];
EncodingEnvironmentPtr eep_dp;
//=====
//===== GET COEFFICIENTS, RECONSTRUCTIONS, CBP
//=====
currMB->bi_pred_me=0;
if (direct)
{
if (direct_pdir[img->block_y+j0][img->block_x+i0]<0) // mode not allowed
return (1e20);
else
*cnt_nonz = LumaResidualCoding8x8 (&cbp, cbp_blk, block, direct_pdir[img->block_y+j0][img->block_x+i0], 0, 0,
(short)imax(0,direct_ref_idx[LIST_0][img->block_y+j0][img->block_x+i0]),
direct_ref_idx[LIST_1][img->block_y+j0][img->block_x+i0]);
}
else
{
if (pdir == 2 && active_pps->weighted_bipred_idc == 1)
{
int weight_sum = (active_pps->weighted_bipred_idc == 1)? wbp_weight[0][l0_ref][l1_ref][0] + wbp_weight[1][l0_ref][l1_ref][0] : 0;
if (weight_sum < -128 || weight_sum > 127)
{
return (1e20);
}
}
fw_mode = (pdir==0||pdir==2 ? mode : 0);
bw_mode = (pdir==1||pdir==2 ? mode : 0);
*cnt_nonz = LumaResidualCoding8x8 (&cbp, cbp_blk, block, pdir, fw_mode, bw_mode, l0_ref, l1_ref);
}
//===== get residue =====
if (input->rdopt==3 && img->type!=B_SLICE)
{
// We need the reconstructed prediction residue for the simulated decoders.
compute_residue_b8block (block, -1);
}
//=====
//===== GET DISTORTION
//=====
if (input->rdopt==3 && img->type!=B_SLICE)
{
for (k=0; k<input->NoOfDecoders ;k++)
{
decode_one_b8block (k, P8x8, block, mode, l0_ref);
for (j=img->opix_y+pay; j<img->opix_y+pay+8; j++)
for (i=img->opix_x+pax; i<img->opix_x+pax+8; i++)
{
distortion += img->quad[imgY_org[j][i] - decs->decY[k][j][i]];
}
}
distortion /= input->NoOfDecoders;
}
else
{
for (j=pay; j<pay+8; j++)
for (i=img->pix_x+pax; i<img->pix_x+pax+8; i++)
{
distortion += img->quad [imgY_org[img->opix_y+j][i] - enc_picture->imgY[img->pix_y+j][i]];
}
}
//=====
//===== GET RATE
//=====
//----- block 8x8 mode -----
if (input->symbol_mode == UVLC)
{
ue_linfo (b8value, dummy, &mrate, &dummy);
rate += mrate;
}
else
{
se.value1 = b8value;
se.type = SE_MBTYPE;
dataPart = &(currSlice->partArr[partMap[se.type]]);
writeB8_typeInfo(&se, dataPart);
rate += se.len;
}
//----- motion information -----
if (!direct)
{
if ((img->num_ref_idx_l0_active > 1 ) && (pdir==0 || pdir==2))
rate += writeReferenceFrame (mode, i0, j0, 1, l0_ref);
if(img->num_ref_idx_l1_active > 1 && img->type== B_SLICE)
{
if (pdir==1 || pdir==2)
{
rate += writeReferenceFrame (mode, i0, j0, 0, l1_ref);
}
}
if (pdir==0 || pdir==2)
{
rate += writeMotionVector8x8 (i0, j0, i0+2, j0+2, l0_ref,LIST_0, mode);
}
if (pdir==1 || pdir==2)
{
rate += writeMotionVector8x8 (i0, j0, i0+2, j0+2, l1_ref, LIST_1, mode);
}
}
//----- coded block pattern (for CABAC only) -----
if (input->symbol_mode == CABAC)
{
dataPart = &(currSlice->partArr[partMap[SE_CBP]]);
eep_dp = &(dataPart->ee_cabac);
mrate = arienco_bits_written (eep_dp);
writeCBP_BIT_CABAC (block, ((*cnt_nonz>0)?1:0), cbp8x8, currMB, 1, eep_dp);
mrate = arienco_bits_written (eep_dp) - mrate;
rate += mrate;
}
//----- luminance coefficients -----
if (*cnt_nonz)
{
rate += writeLumaCoeff8x8 (block, mode, currMB->luma_transform_size_8x8_flag);
}
return (double)distortion + lambda * (double)rate;
}
/*!
*************************************************************************************
* \brief
* Gets mode offset for intra16x16 mode
*************************************************************************************
*/
int I16Offset (int cbp, int i16mode)
{
return (cbp&15?13:1) + i16mode + ((cbp&0x30)>>2);
}
/*!
*************************************************************************************
* \brief
* Sets modes and reference frames for a macroblock
*************************************************************************************
*/
void SetModesAndRefframeForBlocks (int mode)
{
int i,j,k,l;
Macroblock *currMB = &img->mb_data[img->current_mb_nr];
int bframe = (img->type==B_SLICE);
int block_x, block_y;
int cur_ref[2];
//--- macroblock type ---
currMB->mb_type = mode;
currMB->bi_pred_me= (mode == 1 ? img->bi_pred_me[mode] : 0);
//--- block 8x8 mode and prediction direction ---
switch (mode)
{
case 0:
for(i=0;i<4;i++)
{
currMB->b8mode[i] = 0;
currMB->b8pdir[i] = (bframe ? direct_pdir[img->block_y + (i >> 1)*2][img->block_x + (i & 0x01)*2] : 0);
}
break;
case 1:
case 2:
case 3:
for(i=0;i<4;i++)
{
currMB->b8mode[i] = mode;
currMB->b8pdir[i] = best8x8pdir[mode][i];
}
break;
case P8x8:
for(i=0;i<4;i++)
{
currMB->b8mode[i] = best8x8mode[i];
currMB->b8pdir[i] = best8x8pdir[mode][i];
}
break;
case I4MB:
for(i=0;i<4;i++)
{
currMB->b8mode[i] = IBLOCK;
currMB->b8pdir[i] = -1;
}
break;
case I16MB:
for(i=0;i<4;i++)
{
currMB->b8mode[i] = 0;
currMB->b8pdir[i] = -1;
}
break;
case I8MB:
for(i=0;i<4;i++)
{
currMB->b8mode[i] = I8MB;
currMB->b8pdir[i] = -1;
}
//switch to 8x8 transform
currMB->luma_transform_size_8x8_flag = 1;
break;
case IPCM:
for(i=0;i<4;i++)
{
currMB->b8mode[i] = IPCM;
currMB->b8pdir[i] = -1;
}
currMB->luma_transform_size_8x8_flag = 0;
break;
default:
printf ("Unsupported mode in SetModesAndRefframeForBlocks!\n");
exit (1);
}
#define IS_FW ((best8x8pdir[mode][k]==0 || best8x8pdir[mode][k]==2) && (mode!=P8x8 || best8x8mode[k]!=0 || !bframe))
#define IS_BW ((best8x8pdir[mode][k]==1 || best8x8pdir[mode][k]==2) && (mode!=P8x8 || best8x8mode[k]!=0))
//--- reference frame arrays ---
if (mode==0 || mode==I4MB || mode==I16MB || mode==I8MB)
{
if (bframe)
{
if (!mode)
{
for (j = img->block_y; j < img->block_y + 4; j++)
{
memcpy(&enc_picture->ref_idx[LIST_0][j][img->block_x],&direct_ref_idx[LIST_0][j][img->block_x], 4 * sizeof(char));
memcpy(&enc_picture->ref_idx[LIST_1][j][img->block_x],&direct_ref_idx[LIST_1][j][img->block_x], 4 * sizeof(char));
}
}
else
{
for (j = img->block_y; j < img->block_y + 4; j++)
{
memset(&enc_picture->ref_idx[LIST_0][j][img->block_x],-1, 4 * sizeof(char));
memset(&enc_picture->ref_idx[LIST_1][j][img->block_x],-1, 4 * sizeof(char));
}
}
}
else
{
if (!mode)
{
for (j = img->block_y; j < img->block_y + 4; j++)
memset(&enc_picture->ref_idx[LIST_0][j][img->block_x],0, 4 * sizeof(char));
}
else
{
for (j = img->block_y; j < img->block_y + 4; j++)
memset(&enc_picture->ref_idx[LIST_0][j][img->block_x],-1, 4 * sizeof(char));
}
}
}
else
{
if (bframe)
{
for (j=0;j<4;j++)
{
block_y = img->block_y + j;
for (i=0;i<4;i++)
{
block_x = img->block_x + i;
k = 2*(j >> 1) + (i >> 1);
l = 2*(j & 0x01) + (i & 0x01);
if(mode == P8x8 && best8x8mode[k]==0)
{
enc_picture->ref_idx[LIST_0][block_y][block_x] = direct_ref_idx[LIST_0][block_y][block_x];
enc_picture->ref_idx[LIST_1][block_y][block_x] = direct_ref_idx[LIST_1][block_y][block_x];
}
else if (mode ==1 && currMB->bi_pred_me && IS_FW && IS_BW)
{
enc_picture->ref_idx[LIST_0][block_y][block_x] = 0;
enc_picture->ref_idx[LIST_1][block_y][block_x] = 0;
}
else
{
enc_picture->ref_idx[LIST_0][block_y][block_x] = (IS_FW ? best8x8fwref[mode][k] : -1);
enc_picture->ref_idx[LIST_1][block_y][block_x] = (IS_BW ? best8x8bwref[mode][k] : -1);
}
}
}
}
else
{
for (j=0;j<4;j++)
{
block_y = img->block_y + j;
for (i=0;i<4;i++)
{
block_x = img->block_x + i;
k = 2*(j >> 1) + (i >> 1);
l = 2*(j & 0x01) + (i & 0x01);
enc_picture->ref_idx[LIST_0][block_y][block_x] = (IS_FW ? best8x8fwref[mode][k] : -1);
}
}
}
}
if (bframe)
{
for (j = img->block_y; j < img->block_y + 4; j++)
for (i = img->block_x; i < img->block_x + 4;i++)
{
cur_ref[LIST_0] = (int) enc_picture->ref_idx[LIST_0][j][i];
cur_ref[LIST_1] = (int) enc_picture->ref_idx[LIST_1][j][i];
enc_picture->ref_pic_id [LIST_0][j][i] = (cur_ref[LIST_0]>=0
? enc_picture->ref_pic_num[LIST_0 + currMB->list_offset][cur_ref[LIST_0]]
: -1);
enc_picture->ref_pic_id [LIST_1][j][i] = (cur_ref[LIST_1]>=0
? enc_picture->ref_pic_num[LIST_1 + currMB->list_offset][cur_ref[LIST_1]]
: -1);
}
}
else
{
for (j = img->block_y; j < img->block_y + 4; j++)
for (i = img->block_x; i < img->block_x + 4;i++)
{
cur_ref[LIST_0] = (int) enc_picture->ref_idx[LIST_0][j][i];
enc_picture->ref_pic_id [LIST_0][j][i] = (cur_ref[LIST_0]>=0
? enc_picture->ref_pic_num[LIST_0 + currMB->list_offset][cur_ref[LIST_0]]
: -1);
}
}
#undef IS_FW
#undef IS_BW
}
/*!
*************************************************************************************
* \brief
* Intra 16x16 mode decision
*************************************************************************************
*/
void Intra16x16_Mode_Decision (Macroblock* currMB, int* i16mode)
{
intrapred_luma_16x16 (); /* make intra pred for all 4 new modes */
find_sad_16x16 (i16mode); /* get best new intra mode */
currMB->cbp = dct_luma_16x16 (*i16mode);
}
/*!
*************************************************************************************
* \brief
* Sets Coefficients and reconstruction for an 8x8 block
*************************************************************************************
*/
void SetCoeffAndReconstruction8x8 (Macroblock* currMB)
{
int block, k, j, i;
int cur_ref[2];
//============= MIXED TRANSFORM SIZES FOR 8x8 PARTITION ==============
//--------------------------------------------------------------------
int l;
int bframe = img->type==B_SLICE;
if (currMB->luma_transform_size_8x8_flag)
{
//============= set mode and ref. frames ==============
for(i = 0;i<4;i++)
{
currMB->b8mode[i] = tr8x8.part8x8mode[i];
currMB->b8pdir[i] = tr8x8.part8x8pdir[i];
}
if (bframe)
{
for (j = 0;j<4;j++)
for (i = 0;i<4;i++)
{
k = 2*(j >> 1)+(i >> 1);
l = 2*(j & 0x01)+(i & 0x01);
enc_picture->ref_idx[LIST_0][img->block_y+j][img->block_x+i] = ((currMB->b8pdir[k] & 0x01) == 0) ? tr8x8.part8x8fwref[k] : - 1;
enc_picture->ref_idx[LIST_1][img->block_y+j][img->block_x+i] = (currMB->b8pdir[k] > 0) ? tr8x8.part8x8bwref[k] : - 1;
}
}
else
{
for (j = 0;j<4;j++)
for (i = 0;i<4;i++)
{
k = 2*(j >> 1)+(i >> 1);
l = 2*(j & 0x01)+(i & 0x01);
enc_picture->ref_idx[LIST_0][img->block_y+j][img->block_x+i] = tr8x8.part8x8fwref[k];
}
}
for (j = img->block_y;j<img->block_y + BLOCK_MULTIPLE;j++)
{
for (i = img->block_x;i<img->block_x + BLOCK_MULTIPLE;i++)
{
cur_ref[LIST_0] = (int) enc_picture->ref_idx[LIST_0][j][i];
enc_picture->ref_pic_id [LIST_0][j][i] =(cur_ref[LIST_0]>=0
? enc_picture->ref_pic_num[LIST_0 + currMB->list_offset][cur_ref[LIST_0]]
: -1);
}
}
if (bframe)
{
for (j = img->block_y; j < img->block_y + BLOCK_MULTIPLE; j++)
{
for (i = img->block_x;i<img->block_x + BLOCK_MULTIPLE;i++)
{
cur_ref[LIST_1] = (int) enc_picture->ref_idx[LIST_1][j][i];
enc_picture->ref_pic_id [LIST_1][j][i] = (cur_ref[LIST_1]>=0
? enc_picture->ref_pic_num[LIST_1 + currMB->list_offset][cur_ref[LIST_1]]
: -1);
}
}
}
//====== set the mv's for 8x8 partition with transform size 8x8 ======
//save the mv data for 4x4 transform
StoreMV8x8(1);
//set new mv data for 8x8 transform
RestoreMV8x8(0);
//============= get pre-calculated data ==============
//restore coefficients from 8x8 transform
for (block = 0; block<4; block++)
{
for (k = 0; k<4; k++)
for (j = 0; j<2; j++)
memcpy (img->cofAC[block][k][j],cofAC_8x8ts[block][k][j], 65 * sizeof(int));
}
//restore reconstruction
if (cnt_nonz8_8x8ts <= _LUMA_8x8_COEFF_COST_ &&
((img->qp_scaled)!=0 || img->lossless_qpprime_flag==0) &&
(img->type!=SP_SLICE))// modif ES added last condition (we probably never go there so is the next modification useful ? check)
{
currMB->cbp = 0;
currMB->cbp_blk = 0;
for (j = 0; j < MB_BLOCK_SIZE; j++)
{
memcpy(&enc_picture->imgY[img->pix_y+j][img->pix_x], tr8x8.mpr8x8[j], MB_BLOCK_SIZE * sizeof(imgpel));
if(img->type==SP_SLICE &&(!si_frame_indicator && !sp2_frame_indicator ))
memcpy(&lrec[img->pix_y+j][img->pix_x],tr8x8.lrec[j], MB_BLOCK_SIZE * sizeof(int));
}
}
else
{
currMB->cbp = cbp8_8x8ts;
currMB->cbp_blk = cbp_blk8_8x8ts;
for (j = 0; j < MB_BLOCK_SIZE; j++)
{
memcpy (&enc_picture->imgY[img->pix_y+j][img->pix_x],tr8x8.rec_mbY8x8[j], MB_BLOCK_SIZE * sizeof(imgpel));
if(img->type==SP_SLICE &&(!si_frame_indicator && !sp2_frame_indicator))
memcpy (&lrec[img->pix_y+j][img->pix_x],tr8x8.lrec[j], MB_BLOCK_SIZE * sizeof(int));
}
}
}
else
{
//============= get pre-calculated data ==============
//---------------------------------------------------
//--- restore coefficients ---
for (block = 0; block<4+img->num_blk8x8_uv; block++)
{
for (k = 0; k<4; k++)
for (j = 0; j<2; j++)
memcpy (img->cofAC[block][k][j],cofAC8x8[block][k][j], 65 * sizeof(int));
}
if (cnt_nonz_8x8<=5 && img->type!=SP_SLICE &&
((img->qp_scaled)!=0 || img->lossless_qpprime_flag==0))
{
currMB->cbp = 0;
currMB->cbp_blk = 0;
for (j = 0; j < MB_BLOCK_SIZE; j++)
{
memcpy (&enc_picture->imgY[img->pix_y+j][img->pix_x],tr4x4.mpr8x8[j], MB_BLOCK_SIZE * sizeof(imgpel));
if(img->type ==SP_SLICE &&(!si_frame_indicator && !sp2_frame_indicator))
memcpy (&lrec[img->pix_y+j][img->pix_x],tr4x4.lrec[j], MB_BLOCK_SIZE * sizeof(int)); // restore coeff. SP frame
}
}
else
{
currMB->cbp = cbp8x8;
currMB->cbp_blk = cbp_blk8x8;
for (j = 0; j < MB_BLOCK_SIZE; j++)
{
memcpy (&enc_picture->imgY[img->pix_y+j][img->pix_x],tr4x4.rec_mbY8x8[j], MB_BLOCK_SIZE * sizeof(imgpel));
if(img->type==SP_SLICE &&(!si_frame_indicator && !sp2_frame_indicator))
memcpy (&lrec[img->pix_y+j][img->pix_x],tr4x4.lrec[j], MB_BLOCK_SIZE * sizeof(int));
}
}
}
}
/*!
*************************************************************************************
* \brief
* Sets motion vectors for a macroblock
*************************************************************************************
*/
void SetMotionVectorsMB (Macroblock* currMB, int bframe)
{
int i, j, k, l, m, mode8, pdir8, ref, by, bx;
short ******all_mv = img->all_mv;
short ******pred_mv = img->pred_mv;
int bw_ref;
int jdiv, jmod;
if (!bframe)
{
for (j = 0; j<4; j++)
{
jmod = j & 0x01;
jdiv = j >> 1;
by = img->block_y+j;
for (i = 0; i<4; i++)
{
mode8 = currMB->b8mode[k=2*jdiv+(i>>1)];
l = 2*jmod + (i & 0x01);
bx = img->block_x+i;
pdir8 = currMB->b8pdir[k];
ref = enc_picture->ref_idx[LIST_0][by][bx];
if (pdir8>=0)
{
enc_picture->mv[LIST_0][by][bx][0] = all_mv [j][i][LIST_0][ ref][mode8][0];
enc_picture->mv[LIST_0][by][bx][1] = all_mv [j][i][LIST_0][ ref][mode8][1];
}
else
{
enc_picture->mv[LIST_0][by][bx][0] = 0;
enc_picture->mv[LIST_0][by][bx][1] = 0;
}
}
}
}
else
{
for (j = 0; j<4; j++)
{
jmod = j & 0x01;
jdiv = j >> 1;
by = img->block_y+j;
for (i = 0; i<4; i++)
{
mode8 = currMB->b8mode[k=2*jdiv+(i>>1)];
l = 2*jmod + (i & 0x01);
bx = img->block_x+i;
pdir8 = currMB->b8pdir[k];
ref = enc_picture->ref_idx[LIST_0][by][bx];
bw_ref = enc_picture->ref_idx[LIST_1][by][bx];
if (currMB->bi_pred_me && (pdir8 == 2) && currMB->mb_type==1)
{
all_mv = currMB->bi_pred_me == 1 ? img->bipred_mv1 : img->bipred_mv2;
ref = 0;
bw_ref = 0;
}
if (pdir8==-1) // intra
{
enc_picture->mv[LIST_0][by][bx][0] = 0;
enc_picture->mv[LIST_0][by][bx][1] = 0;
enc_picture->mv[LIST_1][by][bx][0] = 0;
enc_picture->mv[LIST_1][by][bx][1] = 0;
}
else if (pdir8==0) // list 0
{
enc_picture->mv[LIST_0][by][bx][0] = all_mv [j][i][LIST_0][ ref][mode8][0];
enc_picture->mv[LIST_0][by][bx][1] = all_mv [j][i][LIST_0][ ref][mode8][1];
enc_picture->mv[LIST_1][by][bx][0] = 0;
enc_picture->mv[LIST_1][by][bx][1] = 0;
enc_picture->ref_idx[LIST_1][by][bx] = -1;
}
else if (pdir8==1) // list 1
{
enc_picture->mv[LIST_0][by][bx][0] = 0;
enc_picture->mv[LIST_0][by][bx][1] = 0;
enc_picture->ref_idx[LIST_0][by][bx] = -1;
enc_picture->mv[LIST_1][by][bx][0] = all_mv [j][i][LIST_1][bw_ref][mode8][0];
enc_picture->mv[LIST_1][by][bx][1] = all_mv [j][i][LIST_1][bw_ref][mode8][1];
}
else if (pdir8==2) // bipredictive
{
enc_picture->mv[LIST_0][by][bx][0] = all_mv [j][i][LIST_0][ ref][mode8][0];
enc_picture->mv[LIST_0][by][bx][1] = all_mv [j][i][LIST_0][ ref][mode8][1];
enc_picture->mv[LIST_1][by][bx][0] = all_mv [j][i][LIST_1][bw_ref][mode8][0];
enc_picture->mv[LIST_1][by][bx][1] = all_mv [j][i][LIST_1][bw_ref][mode8][1];
}
else
{
error("invalid direction mode", 255);
}
}
}
}
// copy all the motion vectors into rdopt structure
// Can simplify this by copying the MV's of the best mode (TBD)
if(img->MbaffFrameFlag)
{
for(i = 0;i<4;i++)
{
for(j = 0;j<4;j++)
{
for (k = 0;k<2;k++)
{
for(l = 0;l<img->max_num_references;l++)
{
for(m = 0;m<9;m++)
{
rdopt->all_mv [j][i][k][l][m][0] = all_mv [j][i][k][l][m][0];
rdopt->pred_mv[j][i][k][l][m][0] = pred_mv[j][i][k][l][m][0];
rdopt->all_mv [j][i][k][l][m][1] = all_mv [j][i][k][l][m][1];
rdopt->pred_mv[j][i][k][l][m][1] = pred_mv[j][i][k][l][m][1];
}
}
}
}
}
}
}
/*!
*************************************************************************************
* \brief
* R-D Cost for a macroblock
*************************************************************************************
*/
int RDCost_for_macroblocks (double lambda, // <-- lagrange multiplier
int mode, // <-- modus (0-COPY/DIRECT, 1-16x16, 2-16x8, 3-8x16, 4-8x8(+), 5-Intra4x4, 6-Intra16x16)
double* min_rdcost, // <-> minimum rate-distortion cost
double* min_rate, // --> bitrate of mode which has minimum rate-distortion cost.
int i16mode )
{
int i, j, k; //, k, ****ip4;
int j1, j2;
int rate = 0, coeff_rate = 0;
int64 distortion = 0;
double rdcost;
int prev_mb_nr = FmoGetPreviousMBNr(img->current_mb_nr);
Macroblock *currMB = &img->mb_data[img->current_mb_nr];
Macroblock *prevMB = (prev_mb_nr >= 0) ? &img->mb_data[prev_mb_nr] : NULL;
int bframe = (img->type==B_SLICE);
int tmp_cc;
int use_of_cc = (img->type!=I_SLICE && input->symbol_mode!=CABAC);
int cc_rate, dummy;
//=====
//===== SET REFERENCE FRAMES AND BLOCK MODES
//=====
SetModesAndRefframeForBlocks (mode);
//=====
//===== GET COEFFICIENTS, RECONSTRUCTIONS, CBP
//=====
if (bframe && mode==0)
{
int block_x=img->pix_x>>2;
int block_y=img->pix_y>>2;
for (j = block_y;j< block_y + 4;j++)
for (i = block_x;i<block_x + 4;i++)
if (direct_pdir[j][i] < 0)
return 0;
}
// Test MV limits for Skip Mode. This could be necessary for MBAFF case Frame MBs.
if ((img->MbaffFrameFlag) && (!currMB->mb_field) && (img->type==P_SLICE) && (mode==0) )
{
if ( img->all_mv[0][0][0][0][0][0] < -8192
|| img->all_mv[0][0][0][0][0][0] > 8191
|| img->all_mv[0][0][0][0][0][1] < LEVELMVLIMIT[img->LevelIndex][4]
|| img->all_mv[0][0][0][0][0][1] > LEVELMVLIMIT[img->LevelIndex][5])
return 0;
}
if (img->AdaptiveRounding)
{
memset(&(img->fadjust4x4[0][0][0]), 0, MB_PIXELS * sizeof(int));
memset(&(img->fadjust8x8[0][0][0]), 0, MB_PIXELS * sizeof(int));
memset(&(img->fadjust4x4Cr[0][0][0][0]), 0, img->mb_cr_size_y * img->mb_cr_size_x * sizeof(int));
memset(&(img->fadjust4x4Cr[0][1][0][0]), 0, img->mb_cr_size_y * img->mb_cr_size_x * sizeof(int));
}
if (mode<P8x8)
{
LumaResidualCoding ();
if(mode==0 && currMB->cbp!=0 && (img->type != B_SLICE || img->NoResidueDirect==1))
return 0;
if(mode==0 && currMB->cbp==0 && currMB->luma_transform_size_8x8_flag==1) //for B_skip, luma_transform_size_8x8_flag=0 only
return 0;
}
else if (mode==P8x8)
{
SetCoeffAndReconstruction8x8 (currMB);
}
else if (mode==I4MB)
{
currMB->cbp = Mode_Decision_for_Intra4x4Macroblock (lambda, &dummy);
}
else if (mode==I16MB)
{
Intra16x16_Mode_Decision (currMB, &i16mode);
}
else if(mode==I8MB)
{
currMB->cbp = Mode_Decision_for_new_Intra8x8Macroblock(lambda, &dummy);
}
else if(mode==IPCM)
{
for (j = 0; j < MB_BLOCK_SIZE; j++)
{
j1 = j + img->opix_y;
j2 = j + img->pix_y;
for (i=img->opix_x; i<img->opix_x+MB_BLOCK_SIZE; i++)
enc_picture->imgY[j2][i] = imgY_org[j1][i];
}
if (img->yuv_format != YUV400)
{
// CHROMA
for (j = 0; j<img->mb_cr_size_y; j++)
{
j1 = j + img->opix_c_y;
j2 = j + img->pix_c_y;
for (i=img->opix_c_x; i<img->opix_c_x+img->mb_cr_size_x; i++)
{
enc_picture->imgUV[0][j2][i] = imgUV_org[0][j1][i];
enc_picture->imgUV[1][j2][i] = imgUV_org[1][j1][i];
}
}
}
for (j=0;j<4;j++)
for (i=0; i<(4+img->num_blk8x8_uv); i++)
img->nz_coeff[img->current_mb_nr][j][i] = 16;
}
if (input->rdopt==3 && img->type!=B_SLICE)
{
// We need the reconstructed prediction residue for the simulated decoders.
compute_residue_mb (mode==I16MB?i16mode:-1);
}
//Rate control
if (input->RCEnable)
{
if (mode == I16MB)
memcpy(pred,img->mprr_2[i16mode],MB_PIXELS * sizeof(imgpel));
else
memcpy(pred,img->mpr,MB_PIXELS * sizeof(imgpel));
}
img->i16offset = 0;
dummy = 0;
if ((img->yuv_format!=YUV400) && (mode != IPCM))
ChromaResidualCoding (&dummy);
if (mode==I16MB)
img->i16offset = I16Offset (currMB->cbp, i16mode);
//=====
//===== GET DISTORTION
//=====
// LUMA
if (input->rdopt==3 && img->type!=B_SLICE)
{
for (k = 0; k<input->NoOfDecoders ;k++)
{
decode_one_mb (k, currMB);
for (j = 0; j<MB_BLOCK_SIZE; j++)
{
for (i=img->opix_x; i<img->opix_x+MB_BLOCK_SIZE; i++)
distortion += img->quad [imgY_org[img->opix_y+j][i] - decs->decY[k][img->opix_y+j][i]];
}
}
distortion /= input->NoOfDecoders;
if (img->yuv_format != YUV400)
{
// CHROMA
for (j = 0; j<img->mb_cr_size_y; j++)
{
j1 = j + img->opix_c_y;
j2 = j + img->pix_c_y;
for (i=img->opix_c_x; i<img->opix_c_x+img->mb_cr_size_x; i++)
{
distortion += img->quad [imgUV_org[0][j1][i] - enc_picture->imgUV[0][j2][i]];
distortion += img->quad [imgUV_org[1][j1][i] - enc_picture->imgUV[1][j2][i]];
}
}
}
}
else
{
// LUMA
for (j = 0; j < MB_BLOCK_SIZE; j++)
{
j1 = j + img->opix_y;
j2 = j + img->pix_y;
for (i=img->opix_x; i<img->opix_x+MB_BLOCK_SIZE; i++)
distortion += img->quad [imgY_org[j1][i] - enc_picture->imgY[j2][i]];
}
if (img->yuv_format != YUV400)
{
// CHROMA
for (j = 0; j<img->mb_cr_size_y; j++)
{
j1 = j + img->opix_c_y;
j2 = j + img->pix_c_y;
for (i=img->opix_c_x; i<img->opix_c_x+img->mb_cr_size_x; i++)
{
distortion += img->quad [imgUV_org[0][j1][i] - enc_picture->imgUV[0][j2][i]];
distortion += img->quad [imgUV_org[1][j1][i] - enc_picture->imgUV[1][j2][i]];
}
}
}
}
//===== S T O R E C O D I N G S T A T E =====
//---------------------------------------------------
store_coding_state (cs_cm);
//=====
//===== GET RATE
//=====
//----- macroblock header -----
if (use_of_cc)
{
if (currMB->mb_type!=0 || (bframe && currMB->cbp!=0))
{
// cod counter and macroblock mode are written ==> do not consider code counter
tmp_cc = img->cod_counter;
rate = writeMBLayer (1, &coeff_rate);
ue_linfo (tmp_cc, dummy, &cc_rate, &dummy);
rate -= cc_rate;
img->cod_counter = tmp_cc;
}
else
{
// cod counter is just increased ==> get additional rate
ue_linfo (img->cod_counter+1, dummy, &rate, &dummy);
ue_linfo (img->cod_counter, dummy, &cc_rate, &dummy);
rate -= cc_rate;
}
}
else
{
rate = writeMBLayer (1, &coeff_rate);
}
//===== R E S T O R E C O D I N G S T A T E =====
//-------------------------------------------------------
reset_coding_state (cs_cm);
rdcost = (double)distortion + lambda * dmax(0.5,(double)rate);
if (rdcost >= *min_rdcost ||
((img->qp_scaled)==0 && img->lossless_qpprime_flag==1 && distortion!=0))
{
#if FASTMODE
// Reordering RDCost comparison order of mode 0 and mode 1 in P_SLICE
// if RDcost of mode 0 and mode 1 is same, we choose best_mode is 0
// This might not always be good since mode 0 is more biased towards rate than quality.
if((img->type!=P_SLICE || mode != 0 || rdcost != *min_rdcost) || input->ProfileIDC>=FREXT_HP)
#endif
# 1712 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/rdopt.c"
return 0;
}
if ((img->MbaffFrameFlag) && (mode ? 0: ((img->type == B_SLICE) ? !currMB->cbp:1))) // AFF and current is skip
{
if (img->current_mb_nr & 0x01) //bottom
{
if (prevMB->mb_type ? 0:((img->type == B_SLICE) ? !prevMB->cbp:1)) //top is skip
{
if (!(field_flag_inference() == currMB->mb_field)) //skip only allowed when correct inference
return 0;
}
}
}
//===== U P D A T E M I N I M U M C O S T =====
//-----------------------------------------------------
*min_rdcost = rdcost;
*min_rate = lambda * (double)coeff_rate;
#ifdef BEST_NZ_COEFF
for (j=0;j<4;j++)
for (i=0; i<(4+img->num_blk8x8_uv); i++)
gaaiMBAFF_NZCoeff[j][i] = img->nz_coeff[img->current_mb_nr][j][i];
#endif
# 1738 "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/rdopt.c"
return 1;
}
/*!
*************************************************************************************
* \brief
* Store adaptive rounding parameters
*************************************************************************************
*/
void store_adaptive_rounding_parameters (int mode, Macroblock *currMB)
{
int j;
int is_inter = (mode != I4MB)&&(mode != I16MB)&&(mode != I8MB);
if (currMB->luma_transform_size_8x8_flag)
{
if ((mode == P8x8))
memcpy(&(bestInterFAdjust8x8[0][0]),&(img->fadjust8x8[2][0][0]),MB_PIXELS * sizeof(int));
else if (is_inter)
memcpy(&(bestInterFAdjust8x8[0][0]),&(img->fadjust8x8[0][0][0]),MB_PIXELS * sizeof(int));
else
memcpy(&(bestIntraFAdjust8x8[0][0]),&(img->fadjust8x8[1][0][0]),MB_PIXELS * sizeof(int));
}
else
{
if ((mode == P8x8))
memcpy(&(bestInterFAdjust4x4[0][0]),&(img->fadjust4x4[3][0][0]),MB_PIXELS * sizeof(int));
else if (is_inter)
memcpy(&(bestInterFAdjust4x4[0][0]),&(img->fadjust4x4[0][0][0]),MB_PIXELS * sizeof(int));
else
memcpy(&(bestIntraFAdjust4x4[0][0]),&(img->fadjust4x4[1 + mode == I16MB][0][0]),MB_PIXELS * sizeof(int));
}
if (input->AdaptRndChroma)
{
if (currMB->luma_transform_size_8x8_flag && mode == P8x8)
{
for (j = 0; j < img->mb_cr_size_y; j++)
{
memcpy(bestInterFAdjust4x4Cr[0][j],img->fadjust8x8Cr[0][0][j],img->mb_cr_size_x * sizeof(int));
memcpy(bestInterFAdjust4x4Cr[1][j],img->fadjust8x8Cr[0][1][j],img->mb_cr_size_x * sizeof(int));
}
}
else if (mode == P8x8)
{
for (j = 0; j < img->mb_cr_size_y; j++)
{
memcpy(bestInterFAdjust4x4Cr[0][j],img->fadjust4x4Cr[2][0][j],img->mb_cr_size_x * sizeof(int));
memcpy(bestInterFAdjust4x4Cr[1][j],img->fadjust4x4Cr[2][1][j],img->mb_cr_size_x * sizeof(int));
}
}
else if (is_inter)
{
for (j = 0; j < img->mb_cr_size_y; j++)
{
memcpy(bestInterFAdjust4x4Cr[0][j],img->fadjust4x4Cr[0][0][j],img->mb_cr_size_x * sizeof(int));
memcpy(bestInterFAdjust4x4Cr[1][j],img->fadjust4x4Cr[0][1][j],img->mb_cr_size_x * sizeof(int));
}
}
else
{
for (j = 0; j < img->mb_cr_size_y; j++)
{
memcpy(bestIntraFAdjust4x4Cr[0][j],img->fadjust4x4Cr[1][0][j],img->mb_cr_size_x * sizeof(int));
memcpy(bestIntraFAdjust4x4Cr[1][j],img->fadjust4x4Cr[1][1][j],img->mb_cr_size_x * sizeof(int));
}
}
}
}
/*!
*************************************************************************************
* \brief
* Store macroblock parameters
*************************************************************************************
*/
void store_macroblock_parameters (int mode)
{
int i, j, k, ****i4p, ***i3p;
Macroblock *currMB = &img->mb_data[img->current_mb_nr];
int bframe = (img->type==B_SLICE);
//--- store best mode ---
best_mode = mode;
best_c_imode = currMB->c_ipred_mode;
best_i16offset = img->i16offset;
// If condition is not really necessary.
bi_pred_me = (mode == 1) ? currMB->bi_pred_me : 0;
memcpy(b8mode, currMB->b8mode, BLOCK_MULTIPLE * sizeof(int));
memcpy(b8pdir, currMB->b8pdir, BLOCK_MULTIPLE * sizeof(int));
memcpy(b4_intra_pred_modes,currMB->intra_pred_modes, MB_BLOCK_PARTITIONS * sizeof(char));
memcpy(b8_intra_pred_modes8x8,currMB->intra_pred_modes8x8, MB_BLOCK_PARTITIONS * sizeof(char));
for (j = 0 ; j < BLOCK_MULTIPLE; j++)
{
memcpy(&b4_ipredmode[j * BLOCK_MULTIPLE],&img->ipredmode[img->block_y + j][img->block_x],BLOCK_MULTIPLE * sizeof(char));
memcpy(b8_ipredmode8x8[j],&img->ipredmode8x8[img->block_y + j][img->block_x],BLOCK_MULTIPLE * sizeof(char));
}
//--- reconstructed blocks ----
for (j = 0; j < MB_BLOCK_SIZE; j++)
{
memcpy(rec_mbY[j],&enc_picture->imgY[img->pix_y+j][img->pix_x], MB_BLOCK_SIZE * sizeof(imgpel));
}
if((img->type==SP_SLICE) && (si_frame_indicator==0 && sp2_frame_indicator==0))
{
for (j = 0; j < MB_BLOCK_SIZE; j++)
{
memcpy(lrec_rec[j],&lrec[img->pix_y+j][img->pix_x], MB_BLOCK_SIZE * sizeof(int));//store coefficients SP frame
}
}
if (img->AdaptiveRounding)
store_adaptive_rounding_parameters (mode, currMB);
if (img->yuv_format != YUV400)
{
for (j = 0; j<img->mb_cr_size_y; j++)
{
memcpy(rec_mbU[j],&enc_picture->imgUV[0][img->pix_c_y+j][img->pix_c_x], img->mb_cr_size_x * sizeof(imgpel));
memcpy(rec_mbV[j],&enc_picture->imgUV[1][img->pix_c_y+j][img->pix_c_x], img->mb_cr_size_x * sizeof(imgpel));
}
if((img->type==SP_SLICE) && (si_frame_indicator==0 && sp2_frame_indicator==0))
{
//store uv coefficients SP frame
for (j = 0; j<img->mb_cr_size_y; j++)
{
memcpy(lrec_rec_U[j],&lrec_uv[0][img->pix_c_y+j][img->pix_c_x], img->mb_cr_size_x * sizeof(int));
memcpy(lrec_rec_V[j],&lrec_uv[1][img->pix_c_y+j][img->pix_c_x], img->mb_cr_size_x * sizeof(int));
}
}
}
//--- store results of decoders ---
if (input->rdopt==3 && img->type!=B_SLICE)
{
for (k = 0; k<input->NoOfDecoders; k++)
{
for (j=img->pix_y; j<img->pix_y+16; j++)
for (i=img->pix_x; i<img->pix_x+16; i++)
{
// Keep the decoded values of each MB for updating the ref frames
decs->decY_best[k][j][i] = decs->decY[k][j][i];
}
}
}
//--- coeff, cbp, kac ---
if (mode || bframe)
{
i4p=cofAC; cofAC=img->cofAC; img->cofAC=i4p;
i3p=cofDC; cofDC=img->cofDC; img->cofDC=i3p;
cbp = currMB->cbp;
cbp_blk = currMB->cbp_blk;
}
else
{
cbp_blk = cbp = 0;
}
//--- store transform size ---
luma_transform_size_8x8_flag = currMB->luma_transform_size_8x8_flag;
for (j = 0; j<4; j++)
memcpy(frefframe[j],&enc_picture->ref_idx[LIST_0][img->block_y+j][img->block_x], BLOCK_MULTIPLE * sizeof(char));
if (bframe)
{
for (j = 0; j<4; j++)
memcpy(brefframe[j],&enc_picture->ref_idx[LIST_1][img->block_y+j][img->block_x], BLOCK_MULTIPLE * sizeof(char));
}
}
/*!
*************************************************************************************
* \brief
* Set stored macroblock parameters
*************************************************************************************
*/
void set_stored_macroblock_parameters ()
{
Macroblock *currMB = &img->mb_data[img->current_mb_nr];
imgpel **imgY = enc_picture->imgY;
imgpel ***imgUV = enc_picture->imgUV;
int mode = best_mode;
int bframe = (img->type==B_SLICE);
int i, j, k, ****i4p, ***i3p;
int block_x, block_y;
signed char **ipredmodes = img->ipredmode;
short *cur_mv;
//===== reconstruction values =====
for (j = 0; j < MB_BLOCK_SIZE; j++)
{
memcpy(&imgY[img->pix_y+j][img->pix_x],rec_mbY[j], MB_BLOCK_SIZE * sizeof(imgpel));
}
if((img->type==SP_SLICE) &&(si_frame_indicator==0 && sp2_frame_indicator==0 ))
{
for (j = 0; j < MB_BLOCK_SIZE; j++)
memcpy(&lrec[img->pix_y+j][img->pix_x],lrec_rec[j], MB_BLOCK_SIZE * sizeof(int)); //restore coeff SP frame
}
if(img->MbaffFrameFlag)
{
for (j = 0; j < MB_BLOCK_SIZE; j++)
memcpy(rdopt->rec_mbY[j],rec_mbY[j], MB_BLOCK_SIZE * sizeof(imgpel));
}
if (img->AdaptiveRounding)
{
update_offset_params(mode,luma_transform_size_8x8_flag);
}
if (img->yuv_format != YUV400)
{
for (j = 0; j<img->mb_cr_size_y; j++)
{
memcpy(&imgUV[0][img->pix_c_y+j][img->pix_c_x],rec_mbU[j], img->mb_cr_size_x * sizeof(imgpel));
memcpy(&imgUV[1][img->pix_c_y+j][img->pix_c_x],rec_mbV[j], img->mb_cr_size_x * sizeof(imgpel));
if((img->type==SP_SLICE) &&(!si_frame_indicator && !sp2_frame_indicator))
{
memcpy(&lrec_uv[0][img->pix_c_y+j][img->pix_c_x],lrec_rec_U[j], img->mb_cr_size_x * sizeof(int));
memcpy(&lrec_uv[1][img->pix_c_y+j][img->pix_c_x],lrec_rec_V[j], img->mb_cr_size_x * sizeof(int));
}
if(img->MbaffFrameFlag)
{
memcpy(rdopt->rec_mbU[j],rec_mbU[j], img->mb_cr_size_x * sizeof(imgpel));
memcpy(rdopt->rec_mbV[j],rec_mbV[j], img->mb_cr_size_x * sizeof(imgpel));
}
}
if((img->type==SP_SLICE) &&(!si_frame_indicator && !sp2_frame_indicator))
{
for (j = 0; j<img->mb_cr_size_y; j++)
{
memcpy(&lrec_uv[0][img->pix_c_y+j][img->pix_c_x],lrec_rec_U[j], img->mb_cr_size_x * sizeof(int));
memcpy(&lrec_uv[1][img->pix_c_y+j][img->pix_c_x],lrec_rec_V[j], img->mb_cr_size_x * sizeof(int));
}
}
if(img->MbaffFrameFlag)
{
for (j = 0; j<img->mb_cr_size_y; j++)
{
memcpy(rdopt->rec_mbU[j],rec_mbU[j], img->mb_cr_size_x * sizeof(imgpel));
memcpy(rdopt->rec_mbV[j],rec_mbV[j], img->mb_cr_size_x * sizeof(imgpel));
}
}
}
//===== coefficients and cbp =====
i4p=cofAC; cofAC=img->cofAC; img->cofAC=i4p;
i3p=cofDC; cofDC=img->cofDC; img->cofDC=i3p;
currMB->cbp = cbp;
currMB->cbp_blk = cbp_blk;
//==== macroblock type ====
currMB->mb_type = mode;
if(img->MbaffFrameFlag)
{
rdopt->mode = mode;
rdopt->i16offset = img->i16offset;
rdopt->cbp = cbp;
rdopt->cbp_blk = cbp_blk;
rdopt->mb_type = mode;
rdopt->prev_qp = currMB->prev_qp;
rdopt->prev_delta_qp = currMB->prev_delta_qp;
rdopt->delta_qp = currMB->delta_qp;
rdopt->qp = currMB->qp;
rdopt->prev_cbp = currMB->prev_cbp;
for(i = 0;i<4+img->num_blk8x8_uv;i++)
{
for(j = 0;j<4;j++)
for(k = 0;k<2;k++)
memcpy(rdopt->cofAC[i][j][k], img->cofAC[i][j][k], 65 * sizeof(int));
}
for(i = 0;i<3;i++)
for(k = 0;k<2;k++)
memcpy(rdopt->cofDC[i][k], img->cofDC[i][k], 18 * sizeof(int));
}
memcpy(currMB->b8mode,b8mode, BLOCK_MULTIPLE * sizeof(int));
memcpy(currMB->b8pdir,b8pdir, BLOCK_MULTIPLE * sizeof(int));
if(img->MbaffFrameFlag)
{
memcpy(rdopt->b8mode,b8mode, BLOCK_MULTIPLE * sizeof(int));
memcpy(rdopt->b8pdir,b8pdir, BLOCK_MULTIPLE * sizeof(int));
}
currMB->bi_pred_me = currMB->mb_type == 1 ? bi_pred_me : 0;
//if P8x8 mode and transform size 4x4 choosen, restore motion vector data for this transform size
if (mode == P8x8 && !luma_transform_size_8x8_flag && input->Transform8x8Mode)
RestoreMV8x8(1);
//==== transform size flag ====
if (((currMB->cbp & 15) == 0) && !(IS_OLDINTRA(currMB) || currMB->mb_type == I8MB))
currMB->luma_transform_size_8x8_flag = 0;
else
currMB->luma_transform_size_8x8_flag = luma_transform_size_8x8_flag;
rdopt->luma_transform_size_8x8_flag = currMB->luma_transform_size_8x8_flag;
if (input->rdopt==3 && img->type!=B_SLICE)
{
//! save the MB Mode of every macroblock
decs->dec_mb_mode[img->mb_y][img->mb_x] = mode;
}
//==== reference frames =====
for (j = 0; j < 4; j++)
{
block_y = img->block_y + j;
for (i = 0; i < 4; i++)
{
block_x = img->block_x + i;
k = 2*(j >> 1)+(i >> 1);
// backward prediction or intra
if ((currMB->b8pdir[k] == 1) || IS_INTRA(currMB))
{
enc_picture->ref_idx [LIST_0][block_y][block_x] = -1;
enc_picture->ref_pic_id [LIST_0][block_y][block_x] = -1;
enc_picture->mv [LIST_0][block_y][block_x][0] = 0;
enc_picture->mv [LIST_0][block_y][block_x][1] = 0;
if(img->MbaffFrameFlag)
rdopt->refar[LIST_0][j][i] = -1;
}
else
{
if (currMB->bi_pred_me && (currMB->b8pdir[k] == 2) && currMB->mb_type==1)
{
cur_mv = currMB->bi_pred_me == 1
? img->bipred_mv1[j][i][LIST_0][0][currMB->b8mode[k]]
: img->bipred_mv2[j][i][LIST_0][0][currMB->b8mode[k]];
enc_picture->ref_idx [LIST_0][block_y][block_x] = 0;
enc_picture->ref_pic_id [LIST_0][block_y][block_x] = enc_picture->ref_pic_num[LIST_0 + currMB->list_offset][0];
enc_picture->mv [LIST_0][block_y][block_x][0] = cur_mv[0];
enc_picture->mv [LIST_0][block_y][block_x][1] = cur_mv[1];
if(img->MbaffFrameFlag)
rdopt->refar[LIST_0][j][i] = 0;
}
else
{
cur_mv = img->all_mv[j][i][LIST_0][(short)frefframe[j][i]][currMB->b8mode[k]];
enc_picture->ref_idx [LIST_0][block_y][block_x] = frefframe[j][i];
enc_picture->ref_pic_id [LIST_0][block_y][block_x] = enc_picture->ref_pic_num[LIST_0 + currMB->list_offset][(short)frefframe[j][i]];
enc_picture->mv [LIST_0][block_y][block_x][0] = cur_mv[0];
enc_picture->mv [LIST_0][block_y][block_x][1] = cur_mv[1];
if(img->MbaffFrameFlag)
rdopt->refar[LIST_0][j][i] = frefframe[j][i];
}
}
// forward prediction or intra
if ((currMB->b8pdir[k] == 0) || IS_INTRA(currMB))
{
enc_picture->ref_idx [LIST_1][block_y][block_x] = -1;
enc_picture->ref_pic_id [LIST_1][block_y][block_x] = -1;
enc_picture->mv [LIST_1][block_y][block_x][0] = 0;
enc_picture->mv [LIST_1][block_y][block_x][1] = 0;
if(img->MbaffFrameFlag)
rdopt->refar[LIST_1][j][i] = -1;
}
}
}
if (bframe)
{
for (j=0; j<4; j++)
{
block_y = img->block_y + j;
for (i=0; i<4; i++)
{
block_x = img->block_x + i;
k = 2*(j >> 1)+(i >> 1);
// forward
if (IS_INTRA(currMB)||(currMB->b8pdir[k] == 0))
{
enc_picture->ref_idx [LIST_1][block_y][block_x] = -1;
enc_picture->ref_pic_id [LIST_1][block_y][block_x] = -1;
enc_picture->mv [LIST_1][block_y][block_x][0] = 0;
enc_picture->mv [LIST_1][block_y][block_x][1] = 0;
if(img->MbaffFrameFlag)
rdopt->refar[LIST_1][j][i] = -1;
}
else
{
if (currMB->bi_pred_me && (currMB->b8pdir[k] == 2) && currMB->mb_type==1)
{
cur_mv = currMB->bi_pred_me == 1
? img->bipred_mv1[j][i][LIST_1][0][currMB->b8mode[k]]
: img->bipred_mv2[j][i][LIST_1][0][currMB->b8mode[k]];
enc_picture->ref_idx [LIST_1][block_y][block_x] = 0;
enc_picture->ref_pic_id [LIST_1][block_y][block_x] = enc_picture->ref_pic_num[LIST_1 + currMB->list_offset][0];
enc_picture->mv [LIST_1][block_y][block_x][0] = cur_mv[0];
enc_picture->mv [LIST_1][block_y][block_x][1] = cur_mv[1];
if(img->MbaffFrameFlag)
rdopt->refar[LIST_1][j][i] = 0;
}
else
{
cur_mv = img->all_mv[j][i][LIST_1][(short)brefframe[j][i]][currMB->b8mode[k]];
enc_picture->ref_idx [LIST_1][block_y][block_x] = brefframe[j][i];
enc_picture->ref_pic_id [LIST_1][block_y][block_x] = enc_picture->ref_pic_num[LIST_1 + currMB->list_offset][(short)brefframe[j][i]];
enc_picture->mv [LIST_1][block_y][block_x][0] = cur_mv[0];
enc_picture->mv [LIST_1][block_y][block_x][1] = cur_mv[1];
if(img->MbaffFrameFlag)
rdopt->refar[LIST_1][j][i] = brefframe[j][i];
}
}
}
}
}
//==== intra prediction modes ====
currMB->c_ipred_mode = best_c_imode;
img->i16offset = best_i16offset;
if(currMB->mb_type == I8MB)
{
memcpy(currMB->intra_pred_modes8x8,b8_intra_pred_modes8x8, MB_BLOCK_PARTITIONS * sizeof(char));
memcpy(currMB->intra_pred_modes,b8_intra_pred_modes8x8, MB_BLOCK_PARTITIONS * sizeof(char));
for(j = 0; j < BLOCK_MULTIPLE; j++)
{
memcpy(&img->ipredmode[img->block_y+j][img->block_x],b8_ipredmode8x8[j], BLOCK_MULTIPLE * sizeof(char));
memcpy(&img->ipredmode8x8[img->block_y+j][img->block_x], b8_ipredmode8x8[j], BLOCK_MULTIPLE * sizeof(char));
}
}
else if (mode!=I4MB && mode!=I8MB)
{
memset(currMB->intra_pred_modes,DC_PRED, MB_BLOCK_PARTITIONS * sizeof(char));
for(j = img->block_y; j < img->block_y + BLOCK_MULTIPLE; j++)
memset(&img->ipredmode[j][img->block_x], DC_PRED, BLOCK_MULTIPLE * sizeof(char));
}
// Residue Color Transform
else if (mode == I4MB)
{
memcpy(currMB->intra_pred_modes,b4_intra_pred_modes, MB_BLOCK_PARTITIONS * sizeof(char));
for(j = 0; j < BLOCK_MULTIPLE; j++)
memcpy(&img->ipredmode[img->block_y + j][img->block_x],&b4_ipredmode[BLOCK_MULTIPLE * j], BLOCK_MULTIPLE * sizeof(char));
}
if(img->MbaffFrameFlag)
{
rdopt->c_ipred_mode = currMB->c_ipred_mode;
rdopt->i16offset = img->i16offset;
memcpy(rdopt->intra_pred_modes,currMB->intra_pred_modes, MB_BLOCK_PARTITIONS * sizeof(char));
memcpy(rdopt->intra_pred_modes8x8,currMB->intra_pred_modes8x8, MB_BLOCK_PARTITIONS * sizeof(char));
for(j = img->block_y; j < img->block_y +BLOCK_MULTIPLE; j++)
memcpy(&rdopt->ipredmode[j][img->block_x],&ipredmodes[j][img->block_x], BLOCK_MULTIPLE * sizeof(char));
}
//==== motion vectors =====
SetMotionVectorsMB (currMB, bframe);
}
/*!
*************************************************************************************
* \brief
* Set reference frames and motion vectors
*************************************************************************************
*/
void SetRefAndMotionVectors (int block, int mode, int pdir, int fwref, int bwref)
{
int i, j=0;
int bslice = (img->type==B_SLICE);
int pmode = (mode==1||mode==2||mode==3?mode:4);
int j0 = ((block >> 1)<<1);
int i0 = ((block & 0x01)<<1);
int j1 = j0 + (input->part_size[pmode][1]);
int i1 = i0 + (input->part_size[pmode][0]);
int block_x, block_y;
short *cur_mv;
Macroblock *currMB = &img->mb_data[img->current_mb_nr];
if (pdir<0)
{
for (j = img->block_y + j0; j < img->block_y + j1; j++)
{
for (i=img->block_x + i0; i<img->block_x +i1; i++)
{
enc_picture->ref_pic_id[LIST_0][j][i] = -1;
enc_picture->ref_pic_id[LIST_1][j][i] = -1;
}
memset(&enc_picture->ref_idx[LIST_0][j][img->block_x + i0], -1, (input->part_size[pmode][0]) * sizeof(char));
memset(&enc_picture->ref_idx[LIST_1][j][img->block_x + i0], -1, (input->part_size[pmode][0]) * sizeof(char));
memset(enc_picture->mv[LIST_0][j][img->block_x + i0], 0, 2*(input->part_size[pmode][0]) * sizeof(short));
memset(enc_picture->mv[LIST_1][j][img->block_x + i0], 0, 2*(input->part_size[pmode][0]) * sizeof(short));
}
return;
}
if (!bslice)
{
for (j=j0; j<j1; j++)
{
block_y = img->block_y + j;
memset(&enc_picture->ref_idx [LIST_0][block_y][img->block_x + i0], fwref, (input->part_size[pmode][0]) * sizeof(char));
for (i=i0; i<i1; i++)
{
block_x = img->block_x + i;
cur_mv = img->all_mv[j][i][LIST_0][fwref][mode];
enc_picture->mv [LIST_0][block_y][block_x][0] = cur_mv[0];
enc_picture->mv [LIST_0][block_y][block_x][1] = cur_mv[1];
enc_picture->ref_pic_id[LIST_0][block_y][block_x] = enc_picture->ref_pic_num[LIST_0+currMB->list_offset][fwref];
}
}
return;
}
else
{
for (j=j0; j<j1; j++)
{
block_y = img->block_y + j;
for (i=i0; i<i1; i++)
{
block_x = img->block_x + i;
if (mode==0)
{
pdir = direct_pdir[block_y][block_x];
fwref = direct_ref_idx[LIST_0][block_y][block_x];
bwref = direct_ref_idx[LIST_1][block_y][block_x];
}
if ((pdir==0 || pdir==2))
{
if (currMB->bi_pred_me && (pdir == 2) && mode == 1)
{
cur_mv = currMB->bi_pred_me == 1
? img->bipred_mv1[j][i][LIST_0][0][mode]
: img->bipred_mv2[j][i][LIST_0][0][mode];
enc_picture->mv [LIST_0][block_y][block_x][0] = cur_mv[0];
enc_picture->mv [LIST_0][block_y][block_x][1] = cur_mv[1];
enc_picture->ref_idx [LIST_0][block_y][block_x] = 0;
enc_picture->ref_pic_id[LIST_0][block_y][block_x] = enc_picture->ref_pic_num[LIST_0+currMB->list_offset][0];
}
else
{
cur_mv = img->all_mv[j][i][LIST_0][fwref][mode];
enc_picture->mv [LIST_0][block_y][block_x][0] = cur_mv[0];
enc_picture->mv [LIST_0][block_y][block_x][1] = cur_mv[1];
enc_picture->ref_idx [LIST_0][block_y][block_x] = fwref;
enc_picture->ref_pic_id[LIST_0][block_y][block_x] =
enc_picture->ref_pic_num[LIST_0+currMB->list_offset][(short)enc_picture->ref_idx[LIST_0][block_y][block_x]];
}
}
else
{
enc_picture->mv [LIST_0][block_y][block_x][0] = 0;
enc_picture->mv [LIST_0][block_y][block_x][1] = 0;
enc_picture->ref_idx [LIST_0][block_y][block_x] = -1;
enc_picture->ref_pic_id[LIST_0][block_y][block_x] = -1;
}
if ((pdir==1 || pdir==2))
{
if (currMB->bi_pred_me && (pdir == 2) && mode == 1)
{
cur_mv = currMB->bi_pred_me == 1
? img->bipred_mv1[j][i][LIST_1][0][mode]
: img->bipred_mv2[j][i][LIST_1][0][mode];
enc_picture->mv [LIST_1][block_y][block_x][0] = cur_mv[0];
enc_picture->mv [LIST_1][block_y][block_x][1] = cur_mv[1];
enc_picture->ref_idx [LIST_1][block_y][block_x] = 0;
enc_picture->ref_pic_id[LIST_1][block_y][block_x] = enc_picture->ref_pic_num[LIST_1+currMB->list_offset][0];
}
else
{
cur_mv = img->all_mv[j][i][LIST_1][bwref][mode];
enc_picture->mv [LIST_1][block_y][block_x][0] = cur_mv[0];
enc_picture->mv [LIST_1][block_y][block_x][1] = cur_mv[1];
enc_picture->ref_idx [LIST_1][block_y][block_x] = bwref;
enc_picture->ref_pic_id[LIST_1][block_y][block_x] =
enc_picture->ref_pic_num[LIST_1+currMB->list_offset][(short)enc_picture->ref_idx[LIST_1][block_y][block_x]];
}
}
else
{
enc_picture->mv [LIST_1][block_y][block_x][0] = 0;
enc_picture->mv [LIST_1][block_y][block_x][1] = 0;
enc_picture->ref_idx [LIST_1][block_y][block_x] = -1;
enc_picture->ref_pic_id[LIST_1][block_y][block_x] = -1;
}
}
}
}
}
/*!
*************************************************************************************
* \brief
* skip macroblock field inference
* \return
* inferred field flag
*************************************************************************************
*/
int field_flag_inference()
{
int mb_field;
Macroblock *currMB = &img->mb_data[img->current_mb_nr];
if (currMB->mbAvailA)
{
mb_field = img->mb_data[currMB->mbAddrA].mb_field;
}
else
{
// check top macroblock pair
if (currMB->mbAvailB)
mb_field = img->mb_data[currMB->mbAddrB].mb_field;
else
mb_field = 0;
}
return mb_field;
}
/*!
*************************************************************************************
* \brief
* Store motion vectors for 8x8 partition
*************************************************************************************
*/
void StoreMVBlock8x8(int dir, int block8x8, int mode, int ref, int bw_ref, int pdir8, int bframe)
{
int i, j, i0, j0, ii, jj;
short ******all_mv = img->all_mv;
short ******pred_mv = img->pred_mv;
short (*lc_l0_mv8x8)[4][2] = all_mv8x8[dir][LIST_0];
short (*lc_l1_mv8x8)[4][2] = all_mv8x8[dir][LIST_1];
short (*lc_pr_mv8x8)[4][2] = NULL;
i0 = (block8x8 & 0x01) << 1;
j0 = (block8x8 >> 1) << 1;
ii = i0+2;
jj = j0+2;
if (!bframe)
{
if (pdir8>=0) //(mode8!=IBLOCK)&&(mode8!=I16MB)) // && ref != -1)
{
lc_pr_mv8x8 = pred_mv8x8[dir][LIST_0];
for (j=j0; j<jj; j++)
for (i=i0; i<ii; i++)
{
lc_l0_mv8x8[j][i][0] = all_mv [j][i][LIST_0][ref][4][0];
lc_l0_mv8x8[j][i][1] = all_mv [j][i][LIST_0][ref][4][1];
lc_pr_mv8x8[j][i][0] = pred_mv[j][i][LIST_0][ref][4][0];
lc_pr_mv8x8[j][i][1] = pred_mv[j][i][LIST_0][ref][4][1];
}
}
}
else
{
if (pdir8 == 0) // list0
{
lc_pr_mv8x8 = pred_mv8x8[dir][LIST_0];
for (j=j0; j<jj; j++)
for (i=i0; i<ii; i++)
{
lc_l0_mv8x8[j][i][0] = all_mv [j][i][LIST_0][ref][mode][0];
lc_l0_mv8x8[j][i][1] = all_mv [j][i][LIST_0][ref][mode][1];
lc_pr_mv8x8[j][i][0] = pred_mv[j][i][LIST_0][ref][mode][0];
lc_pr_mv8x8[j][i][1] = pred_mv[j][i][LIST_0][ref][mode][1];
}
}
else if (pdir8 == 1) // list1
{
lc_pr_mv8x8 = pred_mv8x8[dir][LIST_1];
for (j=j0; j<jj; j++)
for (i=i0; i<ii; i++)
{
lc_l1_mv8x8[j][i][0] = all_mv [j][i][LIST_1][bw_ref][mode][0];
lc_l1_mv8x8[j][i][1] = all_mv [j][i][LIST_1][bw_ref][mode][1];
lc_pr_mv8x8[j][i][0] = pred_mv[j][i][LIST_1][bw_ref][mode][0];
lc_pr_mv8x8[j][i][1] = pred_mv[j][i][LIST_1][bw_ref][mode][1];
}
}
else if (pdir8==2) // bipred
{
lc_pr_mv8x8 = pred_mv8x8[dir][LIST_0];
for (j=j0; j<jj; j++)
{
for (i=i0; i<ii; i++)
{
lc_l0_mv8x8[j][i][0] = all_mv [j][i][LIST_0][ref][mode][0];
lc_l0_mv8x8[j][i][1] = all_mv [j][i][LIST_0][ref][mode][1];
lc_pr_mv8x8[j][i][0] = pred_mv[j][i][LIST_0][ref][mode][0];
lc_pr_mv8x8[j][i][1] = pred_mv[j][i][LIST_0][ref][mode][1];
}
}
lc_pr_mv8x8 = pred_mv8x8[dir][LIST_1];
for (j=j0; j<jj; j++)
{
for (i=i0; i<ii; i++)
{
lc_l1_mv8x8[j][i][0] = all_mv [j][i][LIST_1][bw_ref][mode][0];
lc_l1_mv8x8[j][i][1] = all_mv [j][i][LIST_1][bw_ref][mode][1];
lc_pr_mv8x8[j][i][0] = pred_mv[j][i][LIST_1][bw_ref][mode][0];
lc_pr_mv8x8[j][i][1] = pred_mv[j][i][LIST_1][bw_ref][mode][1];
}
}
}
else
{
error("invalid direction mode", 255);
}
}
}
/*!
*************************************************************************************
* \brief
* Store motion vectors of 8x8 partitions of one macroblock
*************************************************************************************
*/
void StoreMV8x8(int dir)
{
int block8x8;
int bframe = (img->type == B_SLICE);
for (block8x8=0; block8x8<4; block8x8++)
StoreMVBlock8x8(dir, block8x8, tr8x8.part8x8mode[block8x8], tr8x8.part8x8fwref[block8x8],
tr8x8.part8x8bwref[block8x8], tr8x8.part8x8pdir[block8x8], bframe);
}
/*!
*************************************************************************************
* \brief
* Restore motion vectors for 8x8 partition
*************************************************************************************
*/
void RestoreMVBlock8x8(int dir, int block8x8, RD_8x8DATA tr, int bframe)
{
int i, j, i0, j0, ii, jj;
short ******all_mv = img->all_mv;
short ******pred_mv = img->pred_mv;
short (*lc_l0_mv8x8)[4][2] = all_mv8x8[dir][LIST_0];
short (*lc_l1_mv8x8)[4][2] = all_mv8x8[dir][LIST_1];
short (*lc_pr_mv8x8)[4][2] = NULL;
short pdir8 = tr.part8x8pdir [block8x8];
short mode = tr.part8x8mode [block8x8];
short ref = tr.part8x8fwref[block8x8];
short bw_ref = tr.part8x8bwref[block8x8];
i0 = (block8x8 & 0x01) << 1;
j0 = (block8x8 >> 1) << 1;
ii = i0+2;
jj = j0+2;
if (!bframe)
{
if (pdir8>=0) //(mode8!=IBLOCK)&&(mode8!=I16MB)) // && ref != -1)
{
lc_pr_mv8x8 = pred_mv8x8[dir][LIST_0];
for (j=j0; j<jj; j++)
for (i=i0; i<ii; i++)
{
all_mv [j][i][LIST_0][ref][4][0] = lc_l0_mv8x8[j][i][0] ;
all_mv [j][i][LIST_0][ref][4][1] = lc_l0_mv8x8[j][i][1] ;
pred_mv[j][i][LIST_0][ref][4][0] = lc_pr_mv8x8[j][i][0];
pred_mv[j][i][LIST_0][ref][4][1] = lc_pr_mv8x8[j][i][1];
}
}
}
else
{
if (pdir8==0) // forward
{
lc_pr_mv8x8 = pred_mv8x8[dir][LIST_0];
for (j=j0; j<jj; j++)
{
for (i=i0; i<ii; i++)
{
all_mv [j][i][LIST_0][ref][mode][0] = lc_l0_mv8x8[j][i][0] ;
all_mv [j][i][LIST_0][ref][mode][1] = lc_l0_mv8x8[j][i][1] ;
pred_mv[j][i][LIST_0][ref][mode][0] = lc_pr_mv8x8[j][i][0];
pred_mv[j][i][LIST_0][ref][mode][1] = lc_pr_mv8x8[j][i][1];
}
}
}
else if (pdir8==1) // backward
{
lc_pr_mv8x8 = pred_mv8x8[dir][LIST_1];
for (j=j0; j<jj; j++)
{
for (i=i0; i<ii; i++)
{
all_mv [j][i][LIST_1][bw_ref][mode][0] = lc_l1_mv8x8[j][i][0] ;
all_mv [j][i][LIST_1][bw_ref][mode][1] = lc_l1_mv8x8[j][i][1] ;
pred_mv[j][i][LIST_1][bw_ref][mode][0] = lc_pr_mv8x8[j][i][0];
pred_mv[j][i][LIST_1][bw_ref][mode][1] = lc_pr_mv8x8[j][i][1];
}
}
}
else if (pdir8==2) // bidir
{
lc_pr_mv8x8 = pred_mv8x8[dir][LIST_0];
for (j=j0; j<jj; j++)
{
for (i=i0; i<ii; i++)
{
all_mv [j][i][LIST_0][ref][mode][0] = lc_l0_mv8x8[j][i][0] ;
all_mv [j][i][LIST_0][ref][mode][1] = lc_l0_mv8x8[j][i][1] ;
pred_mv[j][i][LIST_0][ref][mode][0] = lc_pr_mv8x8[j][i][0];
pred_mv[j][i][LIST_0][ref][mode][1] = lc_pr_mv8x8[j][i][1];
}
}
lc_pr_mv8x8 = pred_mv8x8[dir][LIST_1];
for (j=j0; j<jj; j++)
{
for (i=i0; i<ii; i++)
{
all_mv [j][i][LIST_1][bw_ref][mode][0] = lc_l1_mv8x8[j][i][0] ;
all_mv [j][i][LIST_1][bw_ref][mode][1] = lc_l1_mv8x8[j][i][1] ;
pred_mv[j][i][LIST_1][bw_ref][mode][0] = lc_pr_mv8x8[j][i][0];
pred_mv[j][i][LIST_1][bw_ref][mode][1] = lc_pr_mv8x8[j][i][1];
}
}
}
else
{
error("invalid direction mode", 255);
}
}
}
/*!
*************************************************************************************
* \brief
* Restore motion vectors of 8x8 partitions of one macroblock
*************************************************************************************
*/
void RestoreMV8x8(int dir)
{
int block8x8;
int bframe = (img->type == B_SLICE);
for (block8x8=0; block8x8<4; block8x8++)
RestoreMVBlock8x8(dir, block8x8, tr8x8, bframe);
}
/*!
*************************************************************************************
* \brief
* Store predictors for 8x8 partition
*************************************************************************************
*/
void StoreNewMotionVectorsBlock8x8(int dir, int block8x8, int mode, int fw_ref, int bw_ref, int pdir8, int bframe)
{
int i, j, i0, j0, ii, jj;
short ******all_mv = img->all_mv;
short ******pred_mv = img->pred_mv;
short (*lc_l0_mv8x8)[4][2] = all_mv8x8[dir][LIST_0];
short (*lc_l1_mv8x8)[4][2] = all_mv8x8[dir][LIST_1];
short (*lc_pr_mv8x8)[4][2] = NULL;
i0 = (block8x8 & 0x01) << 1;
j0 = (block8x8 >> 1) << 1;
ii = i0+2;
jj = j0+2;
if (pdir8<0)
{
for (j=j0; j<jj; j++)
{
memset(&lc_l0_mv8x8[j][i0], 0, 4 * sizeof(short));
memset(&lc_l1_mv8x8[j][i0], 0, 4 * sizeof(short));
}
return;
}
if (!bframe)
{
lc_pr_mv8x8 = pred_mv8x8[dir][LIST_0];
for (j=j0; j<jj; j++)
{
for (i=i0; i<ii; i++)
{
lc_l0_mv8x8[j][i][0] = all_mv [j][i][LIST_0][fw_ref][4][0];
lc_l0_mv8x8[j][i][1] = all_mv [j][i][LIST_0][fw_ref][4][1];
lc_pr_mv8x8[j][i][0] = pred_mv[j][i][LIST_0][fw_ref][4][0];
lc_pr_mv8x8[j][i][1] = pred_mv[j][i][LIST_0][fw_ref][4][1];
}
memset(&lc_l1_mv8x8[j][i0], 0, 4 * sizeof(short));
}
return;
}
else
{
if ((pdir8==0 || pdir8==2))
{
lc_pr_mv8x8 = pred_mv8x8[dir][LIST_0];
for (j=j0; j<jj; j++)
for (i=i0; i<ii; i++)
{
lc_l0_mv8x8[j][i][0] = all_mv [j][i][LIST_0][fw_ref][mode][0];
lc_l0_mv8x8[j][i][1] = all_mv [j][i][LIST_0][fw_ref][mode][1];
lc_pr_mv8x8[j][i][0] = pred_mv[j][i][LIST_0][fw_ref][mode][0];
lc_pr_mv8x8[j][i][1] = pred_mv[j][i][LIST_0][fw_ref][mode][1];
}
}
else
{
for (j=j0; j<jj; j++)
memset(&lc_l0_mv8x8[j][i0], 0, 4 * sizeof(short));
}
if ((pdir8==1 || pdir8==2))
{
lc_pr_mv8x8 = pred_mv8x8[dir][LIST_1];
for (j=j0; j<jj; j++)
for (i=i0; i<ii; i++)
{
lc_l1_mv8x8[j][i][0] = all_mv [j][i][LIST_1][bw_ref][mode][0];
lc_l1_mv8x8[j][i][1] = all_mv [j][i][LIST_1][bw_ref][mode][1];
lc_pr_mv8x8[j][i][0] = pred_mv[j][i][LIST_1][bw_ref][mode][0];
lc_pr_mv8x8[j][i][1] = pred_mv[j][i][LIST_1][bw_ref][mode][1];
}
}
else
{
for (j=j0; j<jj; j++)
memset(&lc_l1_mv8x8[j][i0], 0, 4 * sizeof(short));
}
}
}
/*!
************************************************************************
* \brief
* Makes the decision if 8x8 tranform will be used (for RD-off)
************************************************************************
*/
int GetBestTransformP8x8()
{
int block_y, block_x, pic_pix_y, pic_pix_x, i, j, k;
int mb_y, mb_x, block8x8;
int cost8x8=0, cost4x4=0;
int *diff_ptr;
if(input->Transform8x8Mode==2) //always allow 8x8 transform
return 1;
for (block8x8=0; block8x8<4; block8x8++)
{
mb_y = (block8x8 >> 1) << 3;
mb_x = (block8x8 & 0x01) << 3;
//===== loop over 4x4 blocks =====
k=0;
for (block_y=mb_y; block_y<mb_y+8; block_y+=4)
{
pic_pix_y = img->opix_y + block_y;
//get cost for transform size 4x4
for (block_x=mb_x; block_x<mb_x+8; block_x+=4)
{
pic_pix_x = img->opix_x + block_x;
//===== get displaced frame difference ======
diff_ptr=&diff4x4[k];
for (j=0; j<4; j++)
{
for (i=0; i<4; i++, k++)
{
//4x4 transform size
diff4x4[k] = imgY_org[pic_pix_y+j][pic_pix_x+i] - tr4x4.mpr8x8[j+block_y][i+block_x];
//8x8 transform size
diff8x8[k] = imgY_org[pic_pix_y+j][pic_pix_x+i] - tr8x8.mpr8x8[j+block_y][i+block_x];
}
}
cost4x4 += distortion4x4 (diff_ptr);
}
}
cost8x8 += distortion8x8 (diff8x8);
}
return (cost8x8 < cost4x4);
}
/*!
************************************************************************
* \brief
* Sets MBAFF RD parameters
************************************************************************
*/
void set_mbaff_parameters()
{
int i, j, k;
Macroblock *currMB = &img->mb_data[img->current_mb_nr];
int mode = best_mode;
int bframe = (img->type==B_SLICE);
signed char **ipredmodes = img->ipredmode;
//===== reconstruction values =====
for (j=0; j < MB_BLOCK_SIZE; j++)
memcpy(rdopt->rec_mbY[j],&enc_picture->imgY[img->pix_y + j][img->pix_x], MB_BLOCK_SIZE * sizeof(imgpel));
if (img->yuv_format != YUV400)
{
for (j=0; j<img->mb_cr_size_y; j++)
{
memcpy(rdopt->rec_mbU[j],&enc_picture->imgUV[0][img->pix_c_y + j][img->pix_c_x], img->mb_cr_size_x * sizeof(imgpel));
memcpy(rdopt->rec_mbV[j],&enc_picture->imgUV[1][img->pix_c_y + j][img->pix_c_x], img->mb_cr_size_x * sizeof(imgpel));
}
}
//===== coefficients and cbp =====
rdopt->mode = mode;
rdopt->i16offset = img->i16offset;
rdopt->cbp = currMB->cbp;
rdopt->cbp_blk = currMB->cbp_blk;
rdopt->mb_type = currMB->mb_type;
rdopt->luma_transform_size_8x8_flag = currMB->luma_transform_size_8x8_flag;
if(rdopt->mb_type == 0 && mode != 0)
{
mode=0;
rdopt->mode=0;
}
for(i=0;i<4+img->num_blk8x8_uv;i++)
{
for(j=0;j<4;j++)
for(k=0;k<2;k++)
memcpy(rdopt->cofAC[i][j][k], img->cofAC[i][j][k], 65 * sizeof(int));
}
for(i=0;i<3;i++)
{
for(k=0;k<2;k++)
memcpy(rdopt->cofDC[i][k], img->cofDC[i][k], 18 * sizeof(int));
}
memcpy(rdopt->b8mode,currMB->b8mode, BLOCK_MULTIPLE * sizeof(int));
memcpy(rdopt->b8pdir,currMB->b8pdir, BLOCK_MULTIPLE * sizeof(int));
//==== reference frames =====
if (bframe)
{
for (j = 0; j < BLOCK_MULTIPLE; j++)
{
memcpy(rdopt->refar[LIST_0][j],&enc_picture->ref_idx[LIST_0][img->block_y + j][img->block_x] , BLOCK_MULTIPLE * sizeof(char));
memcpy(rdopt->refar[LIST_1][j],&enc_picture->ref_idx[LIST_1][img->block_y + j][img->block_x] , BLOCK_MULTIPLE * sizeof(char));
}
rdopt->bi_pred_me = currMB->bi_pred_me;
}
else
{
for (j = 0; j < BLOCK_MULTIPLE; j++)
memcpy(rdopt->refar[LIST_0][j],&enc_picture->ref_idx[LIST_0][img->block_y + j][img->block_x] , BLOCK_MULTIPLE * sizeof(char));
}
memcpy(rdopt->intra_pred_modes,currMB->intra_pred_modes, MB_BLOCK_PARTITIONS * sizeof(char));
memcpy(rdopt->intra_pred_modes8x8,currMB->intra_pred_modes8x8, MB_BLOCK_PARTITIONS * sizeof(char));
for (j = img->block_y; j < img->block_y + 4; j++)
{
memcpy(&rdopt->ipredmode[j][img->block_x],&ipredmodes[j][img->block_x], BLOCK_MULTIPLE * sizeof(char));
}
}
/*!
************************************************************************
* \brief
* store coding state (for rd-optimized mode decision), used for 8x8 transformation
************************************************************************
*/
void store_coding_state_cs_cm()
{
store_coding_state(cs_cm);
}
/*!
************************************************************************
* \brief
* restore coding state (for rd-optimized mode decision), used for 8x8 transformation
************************************************************************
*/
void reset_coding_state_cs_cm()
{
reset_coding_state(cs_cm);
}
/*!
************************************************************************
* \brief
* update rounding offsets based on JVT-N011
************************************************************************
*/
void update_offset_params(int mode, int luma_transform_size_8x8_flag)
{
int is_inter = (mode != I4MB)&&(mode != I16MB) && (mode != I8MB);
int luma_pos = AdaptRndPos[(is_inter<<1) + luma_transform_size_8x8_flag][img->type];
int i,j;
int temp = 0;
int offsetRange = 1 << (OffsetBits - 1);
int blk_mask = 0x03 + (luma_transform_size_8x8_flag<<2);
int blk_shift = 2 + luma_transform_size_8x8_flag;
short **offsetList = luma_transform_size_8x8_flag ? OffsetList8x8 : OffsetList4x4;
int **fAdjust = is_inter
? (luma_transform_size_8x8_flag ? bestInterFAdjust8x8 : bestInterFAdjust4x4)
: (luma_transform_size_8x8_flag ? bestIntraFAdjust8x8 : bestIntraFAdjust4x4);
for (j=0; j < MB_BLOCK_SIZE; j++)
{
int j_pos = ((j & blk_mask)<<blk_shift);
for (i=0; i < MB_BLOCK_SIZE; i++)
{
temp = j_pos + (i & blk_mask);
offsetList[luma_pos][temp] += fAdjust[j][i];
offsetList[luma_pos][temp] = iClip3(0,offsetRange,offsetList[luma_pos][temp]);
}
}
if (input->AdaptRndChroma)
{
int u_pos = AdaptRndCrPos[is_inter][img->type];
int v_pos = u_pos + 1;
int jpos;
int ***fAdjustCr = is_inter ? bestInterFAdjust4x4Cr : bestIntraFAdjust4x4Cr;
for (j=0; j < img->mb_cr_size_y; j++)
{
jpos = ((j & 0x03)<<2);
for (i=0; i < img->mb_cr_size_x; i++)
{
temp = jpos + (i & 0x03);
OffsetList4x4[u_pos][temp] += fAdjustCr[0][j][i];
OffsetList4x4[u_pos][temp] = iClip3(0,offsetRange,OffsetList4x4[u_pos][temp]);
OffsetList4x4[v_pos][temp] += fAdjustCr[1][j][i];
OffsetList4x4[v_pos][temp] = iClip3(0,offsetRange,OffsetList4x4[v_pos][temp]);
}
}
}
}
void assign_enc_picture_params(int mode, signed char best_pdir, int block, int list_offset, int best_fw_ref, int best_bw_ref, int bframe)
{
int i,j;
int block_x, block_y;
short *cur_mv;
if (mode==1)
{
if (best_pdir==1)
{
for (j=img->block_y+(block&2); j<img->block_y+(block&2) + BLOCK_MULTIPLE; j++)
{
block_x = img->block_x+(block&1)*2;
memset(&enc_picture->ref_idx[LIST_0][j][block_x], -1 , BLOCK_MULTIPLE * sizeof(char));
memset(enc_picture->mv [LIST_0][j][block_x], 0 , 2 * BLOCK_MULTIPLE * sizeof(short));
for (i=block_x; i<block_x + BLOCK_MULTIPLE; i++)
{
enc_picture->ref_pic_id [LIST_0][j][i] = -1;
}
}
}
else if (img->bi_pred_me[mode])
{
for (j=0; j<BLOCK_MULTIPLE; j++)
{
block_y = img->block_y+(block&2)+j;
block_x = img->block_x+(block&1)*2;
memset(&enc_picture->ref_idx[LIST_0][block_y][block_x], 0, BLOCK_MULTIPLE * sizeof(char));
for (i=0; i<BLOCK_MULTIPLE; i++)
{
cur_mv = img->bi_pred_me[mode] == 1
? img->bipred_mv1[i][j][LIST_0][0][mode]
: img->bipred_mv2[i][j][LIST_0][0][mode];
enc_picture->ref_pic_id [LIST_0][block_y][block_x + i] = enc_picture->ref_pic_num[LIST_0 + list_offset][0];
enc_picture->mv [LIST_0][block_y][block_x + i][0] = cur_mv[0];
enc_picture->mv [LIST_0][block_y][block_x + i][1] = cur_mv[1];
}
}
}
else
{
for (j=0; j<BLOCK_MULTIPLE; j++)
{
block_y = img->block_y+(block&2)+j;
block_x = img->block_x+(block&1)*2;
memset(&enc_picture->ref_idx[LIST_0][block_y][block_x], best_fw_ref , BLOCK_MULTIPLE * sizeof(char));
for (i=0; i<BLOCK_MULTIPLE; i++)
{
cur_mv = img->all_mv[j][i][LIST_0][best_fw_ref][mode];
enc_picture->ref_pic_id [LIST_0][block_y][block_x + i] = enc_picture->ref_pic_num[LIST_0 + list_offset][best_fw_ref];
enc_picture->mv [LIST_0][block_y][block_x + i][0] = cur_mv[0];
enc_picture->mv [LIST_0][block_y][block_x + i][1] = cur_mv[1];
}
}
}
if (bframe)
{
if (best_pdir==0)
{
for (j=img->block_y+(block&2); j<img->block_y+(block&2) + BLOCK_MULTIPLE; j++)
{
block_x = img->block_x+(block&1)*2;
memset(&enc_picture->ref_idx[LIST_1][j][block_x], -1 , BLOCK_MULTIPLE * sizeof(char));
memset(enc_picture->mv[LIST_1][j][block_x], 0 , 2 * BLOCK_MULTIPLE * sizeof(short));
for (i=block_x; i<block_x + BLOCK_MULTIPLE; i++)
{
enc_picture->ref_pic_id [LIST_1][j][i] = -1;
}
}
}
else
{
if (img->bi_pred_me[mode])
{
for (j=0; j<BLOCK_MULTIPLE; j++)
{
block_y = img->block_y+(block&2)+j;
block_x = img->block_x+(block&1)*2;
memset(&enc_picture->ref_idx[LIST_1][block_y][block_x], 0, BLOCK_MULTIPLE * sizeof(char));
for (i=0; i<BLOCK_MULTIPLE; i++)
{
cur_mv = img->bi_pred_me[mode] == 1
? img->bipred_mv1[i][j][LIST_1][0][mode]
: img->bipred_mv2[i][j][LIST_1][0][mode];
enc_picture->ref_pic_id [LIST_1][block_y][block_x + i] =
enc_picture->ref_pic_num[LIST_1 + list_offset][0];
enc_picture->mv [LIST_1][block_y][block_x + i][0] = cur_mv[0];
enc_picture->mv [LIST_1][block_y][block_x + i][1] = cur_mv[1];
}
}
}
else
{
for (j=0; j<BLOCK_MULTIPLE; j++)
{
block_y = img->block_y+(block&2)+j;
block_x = img->block_x+(block&1)*2;
memset(&enc_picture->ref_idx[LIST_1][block_y][block_x], best_bw_ref, BLOCK_MULTIPLE * sizeof(char));
for (i=0; i<BLOCK_MULTIPLE; i++)
{
enc_picture->ref_pic_id [LIST_1][block_y][block_x + i] =
enc_picture->ref_pic_num[LIST_1 + list_offset][best_bw_ref];
if(best_bw_ref>=0)
{
cur_mv = img->all_mv[j][i][LIST_1][best_bw_ref][mode];
enc_picture->mv[LIST_1][block_y][block_x + i][0] = cur_mv[0];
enc_picture->mv[LIST_1][block_y][block_x + i][1] = cur_mv[1];
}
}
}
}
}
}
}
else if (mode==2)
{
for (j=0; j<2; j++)
{
block_y = img->block_y + block * 2 + j;
for (i=0; i<BLOCK_MULTIPLE; i++)
{
block_x = img->block_x + i;
if (best_pdir==1)
{
enc_picture->ref_idx [LIST_0][block_y][block_x] = -1;
enc_picture->ref_pic_id [LIST_0][block_y][block_x] = -1;
enc_picture->mv [LIST_0][block_y][block_x][0] = 0;
enc_picture->mv [LIST_0][block_y][block_x][1] = 0;
}
else
{
cur_mv = img->all_mv[j+block*2][i][LIST_0][best_fw_ref][mode];
enc_picture->ref_idx [LIST_0][block_y][block_x] = best_fw_ref;
enc_picture->ref_pic_id [LIST_0][block_y][block_x] =
enc_picture->ref_pic_num[LIST_0 + list_offset][best_fw_ref];
enc_picture->mv [LIST_0][block_y][block_x][0] = cur_mv[0];
enc_picture->mv [LIST_0][block_y][block_x][1] = cur_mv[1];
}
if (bframe)
{
if (best_pdir==0)
{
enc_picture->ref_idx [LIST_1][block_y][block_x] = -1;
enc_picture->ref_pic_id [LIST_1][block_y][block_x] = -1;
enc_picture->mv [LIST_1][block_y][block_x][0] = 0;
enc_picture->mv [LIST_1][block_y][block_x][1] = 0;
}
else
{
enc_picture->ref_idx[LIST_1][block_y][block_x] = best_bw_ref;
if(best_bw_ref>=0)
{
cur_mv = img->all_mv[j+ block*2][i][LIST_1][best_bw_ref][mode];
enc_picture->ref_pic_id [LIST_1][block_y][block_x] =
enc_picture->ref_pic_num[LIST_1 + list_offset][best_bw_ref];
enc_picture->mv[LIST_1][block_y][block_x][0] = cur_mv[0];
enc_picture->mv[LIST_1][block_y][block_x][1] = cur_mv[1];
}
}
}
}
}
}
else
{
for (j=0; j<BLOCK_MULTIPLE; j++)
{
block_y = img->block_y+j;
for (i=0; i<2; i++)
{
block_x = img->block_x + block*2 + i;
if (best_pdir==1)
{
enc_picture->ref_idx [LIST_0][block_y][block_x] = -1;
enc_picture->ref_pic_id [LIST_0][block_y][block_x] = -1;
enc_picture->mv [LIST_0][block_y][block_x][0] = 0;
enc_picture->mv [LIST_0][block_y][block_x][1] = 0;
}
else
{
cur_mv = img->all_mv[j][block*2+i][LIST_0][best_fw_ref][mode];
enc_picture->ref_idx [LIST_0][block_y][block_x] = best_fw_ref;
enc_picture->ref_pic_id [LIST_0][block_y][block_x] =
enc_picture->ref_pic_num[LIST_0 + list_offset][best_fw_ref];
enc_picture->mv[LIST_0][block_y][block_x][0] = cur_mv[0];
enc_picture->mv[LIST_0][block_y][block_x][1] = cur_mv[1];
}
if (bframe)
{
if (best_pdir==0)
{
enc_picture->ref_idx [LIST_1][block_y][block_x] = -1;
enc_picture->ref_pic_id [LIST_1][block_y][block_x] = -1;
enc_picture->mv [LIST_1][block_y][block_x][0] = 0;
enc_picture->mv [LIST_1][block_y][block_x][1] = 0;
}
else
{
enc_picture->ref_idx[LIST_1][block_y][block_x] = best_bw_ref;
if(best_bw_ref>=0)
{
cur_mv = img->all_mv[j][block*2+i][LIST_1][best_bw_ref][mode];
enc_picture->ref_pic_id [LIST_1][block_y][block_x] =
enc_picture->ref_pic_num[LIST_1 + list_offset][best_bw_ref];
enc_picture->mv[LIST_1][block_y][block_x][0] = cur_mv[0];
enc_picture->mv[LIST_1][block_y][block_x][1] = cur_mv[1];
}
}
}
}
}
}
}
void update_refresh_map(int intra, int intra1, Macroblock *currMB)
{
if (input->RestrictRef==1)
{
// Modified for Fast Mode Decision. Inchoon Choi, SungKyunKwan Univ.
if (input->rdopt<2)
{
refresh_map[2*img->mb_y ][2*img->mb_x ] = (intra ? 1 : 0);
refresh_map[2*img->mb_y ][2*img->mb_x+1] = (intra ? 1 : 0);
refresh_map[2*img->mb_y+1][2*img->mb_x ] = (intra ? 1 : 0);
refresh_map[2*img->mb_y+1][2*img->mb_x+1] = (intra ? 1 : 0);
}
else if (input->rdopt==3)
{
refresh_map[2*img->mb_y ][2*img->mb_x ] = (intra1==0 && (currMB->mb_type==I16MB || currMB->mb_type==I4MB) ? 1 : 0);
refresh_map[2*img->mb_y ][2*img->mb_x+1] = (intra1==0 && (currMB->mb_type==I16MB || currMB->mb_type==I4MB) ? 1 : 0);
refresh_map[2*img->mb_y+1][2*img->mb_x ] = (intra1==0 && (currMB->mb_type==I16MB || currMB->mb_type==I4MB) ? 1 : 0);
refresh_map[2*img->mb_y+1][2*img->mb_x+1] = (intra1==0 && (currMB->mb_type==I16MB || currMB->mb_type==I4MB) ? 1 : 0);
}
}
else if (input->RestrictRef==2)
{
refresh_map[2*img->mb_y ][2*img->mb_x ] = (currMB->mb_type==I16MB || currMB->mb_type==I4MB ? 1 : 0);
refresh_map[2*img->mb_y ][2*img->mb_x+1] = (currMB->mb_type==I16MB || currMB->mb_type==I4MB ? 1 : 0);
refresh_map[2*img->mb_y+1][2*img->mb_x ] = (currMB->mb_type==I16MB || currMB->mb_type==I4MB ? 1 : 0);
refresh_map[2*img->mb_y+1][2*img->mb_x+1] = (currMB->mb_type==I16MB || currMB->mb_type==I4MB ? 1 : 0);
}
}
# Crash reproducer for clang version 5.0.0
# Driver args: "--target=cheri-unknown-freebsd" "--sysroot=/local/scratch/alr48/cheri/output-release/sdk256/sysroot" "-D" "NDEBUG" "-I" "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod" "-I" "MultiSource/Applications/JM/lencod" "-fintegrated-as" "-pipe" "-msoft-float" "-G" "0" "-mabi=purecap" "-mxgot" "-g" "-B" "/local/scratch/alr48/cheri/output-release/sdk256/bin" "-Wno-error=format" "--target=cheri-unknown-freebsd12" "-g" "-w" "-Werror=date-time" "-D" "__USE_LARGEFILE64" "-D" "_FILE_OFFSET_BITS=64" "-MD" "-MT" "MultiSource/Applications/JM/lencod/CMakeFiles/lencod.dir/rdopt.c.o" "-MF" "MultiSource/Applications/JM/lencod/CMakeFiles/lencod.dir/rdopt.c.o.d" "-o" "MultiSource/Applications/JM/lencod/CMakeFiles/lencod.dir/rdopt.c.o" "-c" "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/rdopt.c"
# Original command: "/local/scratch/alr48/cheri/output-release/sdk256/bin/clang-5.0" "-cc1" "-triple" "cheri-unknown-freebsd12" "-emit-obj" "-mrelax-all" "-disable-free" "-disable-llvm-verifier" "-discard-value-names" "-main-file-name" "rdopt.c" "-mrelocation-model" "pic" "-pic-level" "2" "-mthread-model" "posix" "-mdisable-fp-elim" "-masm-verbose" "-mconstructor-aliases" "-target-cpu" "cheri" "-target-feature" "+soft-float" "-target-abi" "purecap" "-Wmips-cheri-prototypes" "-msoft-float" "-mfloat-abi" "soft" "-mllvm" "-mxgot" "-mllvm" "-mips-ssection-threshold=0" "-dwarf-column-info" "-debug-info-kind=standalone" "-dwarf-version=2" "-debugger-tuning=gdb" "-coverage-notes-file" "/local/scratch/alr48/cheri/build-release/llvm-test-suite-256-build/MultiSource/Applications/JM/lencod/CMakeFiles/lencod.dir/rdopt.c.gcno" "-resource-dir" "/local/scratch/alr48/cheri/output-release/sdk256/lib/clang/5.0.0" "-dependency-file" "MultiSource/Applications/JM/lencod/CMakeFiles/lencod.dir/rdopt.c.o.d" "-sys-header-deps" "-MT" "MultiSource/Applications/JM/lencod/CMakeFiles/lencod.dir/rdopt.c.o" "-D" "NDEBUG" "-I" "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod" "-I" "MultiSource/Applications/JM/lencod" "-D" "__USE_LARGEFILE64" "-D" "_FILE_OFFSET_BITS=64" "-isysroot" "/local/scratch/alr48/cheri/output-release/sdk256/sysroot" "-Wno-error=format" "-Werror=date-time" "-w" "-fdebug-compilation-dir" "/local/scratch/alr48/cheri/build-release/llvm-test-suite-256-build" "-ferror-limit" "19" "-fmessage-length" "0" "-fobjc-runtime=gnustep" "-fdiagnostics-show-option" "-cheri-linker" "-o" "MultiSource/Applications/JM/lencod/CMakeFiles/lencod.dir/rdopt.c.o" "-x" "c" "/local/scratch/alr48/cheri/llvm-test-suite/MultiSource/Applications/JM/lencod/rdopt.c"
"/local/scratch/alr48/cheri/output-release/sdk256/bin/clang-5.0" "-cc1" "-triple" "cheri-unknown-freebsd12" "-emit-obj" "-mrelax-all" "-disable-free" "-disable-llvm-verifier" "-discard-value-names" "-main-file-name" "rdopt.c" "-mrelocation-model" "pic" "-pic-level" "2" "-mthread-model" "posix" "-mdisable-fp-elim" "-masm-verbose" "-mconstructor-aliases" "-target-cpu" "cheri" "-target-feature" "+soft-float" "-target-abi" "purecap" "-Wmips-cheri-prototypes" "-msoft-float" "-mfloat-abi" "soft" "-mllvm" "-mxgot" "-mllvm" "-mips-ssection-threshold=0" "-dwarf-column-info" "-debug-info-kind=standalone" "-dwarf-version=2" "-debugger-tuning=gdb" "-coverage-notes-file" "/local/scratch/alr48/cheri/build-release/llvm-test-suite-256-build/MultiSource/Applications/JM/lencod/CMakeFiles/lencod.dir/rdopt.c.gcno" "-sys-header-deps" "-D" "NDEBUG" "-D" "__USE_LARGEFILE64" "-D" "_FILE_OFFSET_BITS=64" "-Wno-error=format" "-Werror=date-time" "-w" "-ferror-limit" "19" "-fmessage-length" "0" "-fobjc-runtime=gnustep" "-fdiagnostics-show-option" "-cheri-linker" "-x" "c" "rdopt-b55bd8.c"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment