Checkin of validated codec used during development
[opal.git] / plugins / video / H.261-vic / vic / crdef.h
blobf5a92769bb9722d1449f62a500522d0af15fbac9
1 /* crdef.h (c) 1999-2000 Derek J Smithies (dereks@ibm.net)
2 * Indranet Technologies ltd (lara@indranet.co.nz)
4 * This file is derived from vic, http://www-nrg.ee.lbl.gov/vic/
5 * Their copyright notice is below.
6 */
7 /*
8 * Copyright (c) 1993-1994 Regents of the University of California.
9 * All rights reserved.
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions and the following disclaimer.
16 * 2. Redistributions in binary form must reproduce the above copyright
17 * notice, this list of conditions and the following disclaimer in the
18 * documentation and/or other materials provided with the distribution.
19 * 3. All advertising materials mentioning features or use of this software
20 * must display the following acknowledgement:
21 * This product includes software developed by the University of
22 * California, Berkeley and the Network Research Group at
23 * Lawrence Berkeley Laboratory.
24 * 4. Neither the name of the University nor of the Laboratory may be used
25 * to endorse or promote products derived from this software without
26 * specific prior written permission.
28 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
29 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
30 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
31 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
32 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
33 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
34 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
35 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
36 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
37 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
38 * SUCH DAMAGE.
43 * The bit definitions for the values stored in the conditional
44 * replenishment vector. We use a variant of the algorithm used
45 * in nv (which is very similar to the algorithms in many hardware
46 * codecs) where we only send a block if it changes beyond some threshold
47 * due to scene motion. In this case, we send it at a "low-quality"
48 * to trade of quality for frame rate in areas of high motion.
49 * We then age the block and after it hasn't changed for a few frames
50 * we send a higher quality version. Finally, the process that scans
51 * the background filling in blocks sends the highest quality version.
53 * A finite state machine defines the algorithm. When motion is detected,
54 * the block is reset to state MOTION. On no motion, it is aged to AGE1,
55 * AGE2, ... etc., until it reaches state AGEn (the age threshold), and
56 * then it transitions to IDLE. If the background process finds a block
57 * in the IDLE state, it can promote it to the BG state. On the next
58 * frame, it reverts to the IDLE state.
60 * Blocks are transmitted only in the MOTION, AGEn, and BG state,
61 * at low, medium, and high quality, respectively. The high bit
62 * is reserved to indicate the block is in one of these states
63 * and should be sent.
66 /************ Change log
68 * $Log$
69 * Revision 1.2 2006/07/31 09:09:21 csoutheren
70 * Checkin of validated codec used during development
72 * Revision 1.1.2.1 2006/04/06 01:17:17 csoutheren
73 * Initial version of H.261 video codec plugin for OPAL
75 * Revision 2.1 2003/03/15 23:42:59 robertj
76 * Update to OpenH323 v1.11.7
78 * Revision 1.3 2003/03/14 07:25:55 robertj
79 * Removed $header keyword so is not different on alternate repositories
81 * Revision 1.2 2000/08/25 03:18:49 dereks
82 * Add change log facility (Thanks Robert for the info on implementation)
86 ********/
90 #define CR_MOTION 0
91 #define CR_AGETHRESH 31
92 #define CR_IDLE 0x40
93 #define CR_BG 0x41
94 #define CR_SEND 0x80
95 #define CR_STATE(s) ((s) & 0x7f)