Checkin of validated codec used during development
[opal.git] / plugins / video / H.261-vic / vic / bsd-endian.h
blob38bbba44f26de9c980c99e28ff00e8f405730854
1 /*
2 * Copyright (c) 1993-1994 Regents of the University of California.
3 * All rights reserved.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * 3. All advertising materials mentioning features or use of this software
14 * must display the following acknowledgement:
15 * This product includes software developed by the University of
16 * California, Berkeley and the Network Research Group at
17 * Lawrence Berkeley Laboratory.
18 * 4. Neither the name of the University nor of the Laboratory may be used
19 * to endorse or promote products derived from this software without
20 * specific prior written permission.
22 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 * SUCH DAMAGE.
36 /************ Change log
38 * $Log$
39 * Revision 1.2 2006/07/31 09:09:21 csoutheren
40 * Checkin of validated codec used during development
42 * Revision 1.1.2.1 2006/04/06 01:17:17 csoutheren
43 * Initial version of H.261 video codec plugin for OPAL
45 * Revision 2.2 2006/02/11 21:09:28 dsandras
46 * More OpenSolaris fixes thanks to Brian Lu <brian lu sun com>. Thanks!
48 * Revision 2.1 2003/03/15 23:42:59 robertj
49 * Update to OpenH323 v1.11.7
51 * Revision 1.8 2003/03/14 07:25:55 robertj
52 * Removed $header keyword so is not different on alternate repositories
54 * Revision 1.7 2002/10/10 05:35:42 robertj
55 * VxWorks port, thanks Martijn Roest
57 * Revision 1.6 2001/05/25 04:32:25 yurik
58 * Added Arm based to list of little endian machines
60 * Revision 1.5 2001/05/16 06:30:16 yurik
61 * Moved int_64 it to config.h
63 * Revision 1.4 2001/05/16 05:37:13 yurik
64 * Fixed crash on video receive by #define INT_64
66 * Revision 1.3 2000/08/25 03:18:49 dereks
67 * Add change log facility (Thanks Robert for the info on implementation)
71 ********/
75 #include "config.h"
77 #ifdef WIN32
78 #include <winsock.h>
79 #else
80 #ifndef P_VXWORKS
81 #include <sys/param.h>
82 #endif
83 #endif
84 #ifdef __linux__
85 #include <endian.h>
86 #endif
87 #ifndef IPPROTO_IP
88 #include <netinet/in.h>
89 #endif
90 #ifndef BYTE_ORDER
91 #define LITTLE_ENDIAN 1234
92 #define BIG_ENDIAN 4321
93 #if defined(ultrix) || defined(__alpha) || defined(__i386__) || defined (i386) || defined(__i486__) || defined(_X86_) || defined(_ARM_)
94 #define BYTE_ORDER LITTLE_ENDIAN
95 #else
96 #define BYTE_ORDER BIG_ENDIAN
97 #endif
98 #endif
100 #if BYTE_ORDER == LITTLE_ENDIAN
101 #define SHIFT(n) (24 - (n))
102 #else
103 #define SHIFT(n) (n)
104 #endif
105 #define EXTRACT(v, n) (((v) >> SHIFT(n)) & 0xff)
106 #define SPLICE(v, p, n) (v) |= (p) << SHIFT(n)