/*
 * Copyright (c) 1993-1994 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 the Network Research Group at
 *      Lawrence Berkeley Laboratory.
 * 4. Neither the name of the University nor of the Laboratory 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.
 *
 * @(#) $Header: /cs/research/mice/starship/src/local/CVS_repository/vic/crdef.h,v 1.1.1.1 1998/02/18 18:03:22 ucacsva Exp $ (LBL)
 */

/*
 * The bit definitions for the values stored in the conditional
 * replenishment vector.  We use a variant of the algorithm used
 * in nv (which is very similar to the algorithms in many hardware
 * codecs) where we only send a block if it changes beyond some threshold
 * due to scene motion.  In this case, we send it at a "low-quality"
 * to trade of quality for frame rate in areas of high motion.
 * We then age the block and after it hasn't changed for a few frames
 * we send a higher quality version.  Finally, the process that scans
 * the background filling in blocks sends the highest quality version.
 *
 * A finite state machine defines the algorithm.  When motion is detected,
 * the block is reset to state MOTION.  On no motion, it is aged to AGE1,
 * AGE2, ... etc., until it reaches state AGEn (the age threshold), and
 * then it transitions to IDLE.  If the background process finds a block
 * in the IDLE state, it can promote it to the BG state.  On the next
 * frame, it reverts to the IDLE state.
 *
 * Blocks are transmitted only in the MOTION, AGEn, and BG state,
 * at low, medium, and high quality, respectively.  The high bit
 * is reserved to indicate the block is in one of these states
 * and should be sent.
 */

#define CR_MOTION	0
#define CR_AGETHRESH	31
#define CR_IDLE		0x40
#define CR_BG		0x41
#define CR_SEND		0x80
#define CR_STATE(s)	((s) & 0x7f)
