draft-ietf-avt-cellb-profile-01.txt   draft-ietf-avt-cellb-profile-02.txt 
Internet Engineering Task Force Michael F. Speer Internet Engineering Task Force Michael F. Speer
Audio-Video Transport Working Group Don Hoffman Audio-Video Transport Working Group Don Hoffman
draft-ietf-avt-cellb-profile-01.txt Sun Microsystems, Inc. draft-ietf-avt-cellb-profile-02.txt Sun Microsystems, Inc.
November 11, 1994 November 11, 1994
Expires: 5/31//94 Expires: 5/31/94
RTP Encapsulation of CellB Video Encoding RTP Encapsulation of CellB Video Encoding
Status of this Memo Status of this Memo
This document is an Internet Draft. Internet Drafts are working documents This document is an Internet Draft. Internet Drafts are working documents
of the Internet Engineering Task Force (IETF), its Areas, and its Working of the Internet Engineering Task Force (IETF), its Areas, and its Working
Groups. Note that other groups may also distribute working documents as Groups. Note that other groups may also distribute working documents as
Internet Drafts. Internet Drafts.
skipping to change at page 2, line 33 skipping to change at page 2, line 33
2 Structure of the CellB Video Stream 2 Structure of the CellB Video Stream
The CellB bytestream consists of cell codes, skip codes and The CellB bytestream consists of cell codes, skip codes and
quantization-table specific codes. These are now described. quantization-table specific codes. These are now described.
2.1 CellB Cell Code 2.1 CellB Cell Code
Cell codes are 4 bytes in length, and describe a 4x4 pixel cell. There Cell codes are 4 bytes in length, and describe a 4x4 pixel cell. There
are two possible luminance (Y) levels for each cell, but only one pair are two possible luminance (Y) levels for each cell, but only one pair
of chronminance (UV) values. The CellB cell code is shown below: of chrominance (UV) values. The CellB cell code is shown below:
0 1 2 3 0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|0 M M M M M M M M M M M M M M M|U V U V U V U V|Y Y Y Y Y Y Y Y| |0 M M M M M M M M M M M M M M M|U V U V U V U V|Y Y Y Y Y Y Y Y|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
4x4 Bitmask U/V Code Y/Y Code 4x4 Bitmask U/V Code Y/Y Code
The first two bytes of the cell code are a bitmask. Each bit in the The first two bytes of the cell code are a bitmask. Each bit in the
mask represents a pixel in a 16-pixel cell. Bit 0 represents the value mask represents a pixel in a 16-pixel cell. Bit 0 represents the value
skipping to change at page 3, line 31 skipping to change at page 3, line 31
0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7
+-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+
|1 0 0 S S S S S| |1 0 0 S S S S S|
+-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+
2.3 CellB Y/Y Table Code 2.3 CellB Y/Y Table Code
The single byte "new Y/Y table" code is used to tell the decoder that the The single byte "new Y/Y table" code is used to tell the decoder that the
next 512 bytes are a new Y/Y quantization table. The code and the next 512 bytes are a new Y/Y quantization table. The code and the
representation of the table are shown below. representation of the table are shown below. The sample encoder/decoder pair
in this document do not implement this feature of the CellB compression.
However, future CellB codecs may implement this feature.
0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7
+-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+
|1 1 1 1 1 1 1 0| |1 1 1 1 1 1 1 0|
+-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+
The format of the new Y/Y table is: The format of the new Y/Y table is:
Y1_000 Y2_000 0 1 2 3
Y1_001 Y2_001 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Y1_000 | Y2_000 | Y1_001 | Y2_001 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
. .
. .
. .
Y1_255 Y2_255
Implementation of this code is optional and the reference software codecs 0 1 2 3
provided in this memo do not support it. Future CellB codecs may implement 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7
this feature. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Y1_254 | Y2_254 | Y1_255 | Y2_255 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2.4 CellB U/V Table Code 2.4 CellB U/V Table Code
The single byte "new U/V table" code is used to tell the decoder that the The single byte "new U/V table" code is used to tell the decoder that the
next 512 bytes represent a new U/V quantization table. The code is shown next 512 bytes represent a new U/V quantization table. The code is shown
below: below. The sample encoder/decoder pair provided in this document do not
implement this feature of the CellB compression. However, future CellB
codecs may implement this feature.
0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7
+-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+
|1 1 1 1 1 1 1 1| |1 1 1 1 1 1 1 1|
+-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+
The bytes of the new U/V quantization table are arranged as: The bytes of the new U/V quantization table are arranged as:
U_000 V_000 0 1 2 3
U_001 V_001 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| U_000 | V_000 | U_001 | V_001 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
. .
. .
. .
U_255 V_255
Implementation of this code is optional and the reference software codecs 0 1 2 3
provided in this memo do not support it. Future CellB codecs may implement 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7
this feature. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| U_254 | V_254 | U_255 | V_255 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
3 Network Packetization and Encapsulation 3 Network Packetization and Encapsulation
3.1 RTP Fixed Header Usage 3.1 RTP Fixed Header Usage
The RTP encapsulation of CellB makes no use of any special RTP The RTP encapsulation of CellB makes no use of any special RTP
options. The following summarizes the CellB-specific content of the options. The following summarizes the CellB-specific content of the
standard RTP header when transporting CellB data: standard RTP header when transporting CellB data:
0 1 2 3 0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|T=2|P|X| CC |M| PT | sequence number | |T=2|P|X| CC |M| PT | sequence number |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| timestamp | | timestamp |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| synchronization source identifier (SSRC) | | synchronization source identifier (SSRC) |
+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+ +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
| content source identifiers (CSRCs) | | content source identifiers (CSRCs) |
| .... | | .... |
+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+ +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
Type (T): 2 Bits - RTP Packet Type. Type (T): 2 Bits - RTP Packet Type.
Padding (P): 1 Bit - The RTP packet contains padding Padding (P): 1 Bit - The RTP packet contains padding
Extension (X): 1 Bit - Indicates that the fixed header is Extension (X): 1 Bit - Indicates that the fixed header is
followed by exactly one header extension. followed by exactly one header extension.
CSRC Count (CC): 4 Bits - Contains the number os CSRC CSRC Count (CC): 4 Bits - Contains the number os CSRC
identifiers that follow the fixed header. identifiers that follow the fixed header.
Marker (M): 1 Bit - This profile will interpret this bit to Marker (M): 1 Bit - This profile will interpret this bit to
mean that the packet demarks the frame boundry. mean that the packet demarks the end of frame boundary.
Sequence Number: 16 Bits - Used to restore packet sequence or Sequence Number: 16 Bits - Used to restore packet sequence or
detect packet loss. detect packet loss.
TimeStamp: 32 Bits - The frequency of the timestamp is profile TimeStamp: 32 Bits - This profile utilizes the middle 32 bits of
defined. This profile defines the timestamp to be 64 bit NTP timestamp as defined in RFC 1305. Utilizing the
incremented by one for each sample of the video stream. middle 32 bits of the NTP timestamp makes the this timestamp
cycle at 65536 hz. The timestamp will wrap around every 18
hours. The timestamp will be of the same value for the packets
that constitute 1 frame of video data. Where possible,
the timestamp should be generated at video sampling time.
SSRC: 32 Bits - Synchronization Source identifier. See the RTP SSRC: 32 Bits - Synchronization Source identifier. See the RTP
specification for how to generate this. specification for how to generate this.
CSRC: Up to 15 items, 32 Bits each. See the RTP specification CSRC: Up to 15 items, 32 Bits each. See the RTP specification
for more details. for more details.
3.2 CellB-specific Header Information 3.2 CellB-specific Header Information
The encapsulation and packetization of the CellB bytestream is The encapsulation and packetization of the CellB bytestream is
designed to make the resulting packet stream robust to packet loss. designed to make the resulting packet stream robust to packet loss.
To achieve this, an additional header is added to each RTP To achieve this, an additional header is added to each RTP
packet to uniquely identify the location of the first cell of the packet to uniquely identify the location of the first cell of the
packet within the current frame. In addition, the width and height of packet within the current frame. In addition, the width and height of
the frame in pixels is carried in each CellB packet header. Although the frame in pixels is carried in each CellB packet header. Although
the size can only change between frames, it is carried in every the size can only change between frames, it is carried in every
packet to simplify the packet encoding. packet to simplify the packet encoding.
|------------------| 0 1 2 3
| Cell X Location | 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7
|------------------| +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Cell Y Location | | Cell X Location | Cell Y Location |
|------------------| +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Width of Image | | Width of Image | Height of Image |
|------------------| +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
| Height of Image | | Compressed CellB Data |
|------------------| | .... |
| First code of | +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
| packet |
.
.
.
All fields are 16-bit unsigned integers in network byte order, and are All fields are 16-bit unsigned integers in network byte order, and are
placed at the beginning of the payload for each RTP packet. The Cell X and placed at the beginning of the payload for each RTP packet. The Cell X and
the Cell Y Location coordinates are expressed as cell coordinates, not pixel the Cell Y Location coordinates are expressed as cell coordinates, not pixel
coordinates. Since cells represent 4x4 blocks of pixels, the X or Y dimension coordinates. Since cells represent 4x4 blocks of pixels, the X or Y dimension
of the cell coordinates range in value from 0 through 1/4 of the of the of the cell coordinates range in value from 0 through 1/4 of the of the
same dimension in pixel coordinates. same dimension in pixel coordinates.
3.3 Packetization Rules 3.3 Packetization Rules
skipping to change at page 6, line 48 skipping to change at page 6, line 48
The following code is placed here as sample codec for CellB. The code is The following code is placed here as sample codec for CellB. The code is
integrated into NV release 3.3 and later. integrated into NV release 3.3 and later.
4.1 Sample Encoder 4.1 Sample Encoder
The C code included here represents a reference software encoder for The C code included here represents a reference software encoder for
CellB. For complete source refer to [3]. CellB. For complete source refer to [3].
/* /*
Netvideo version 3.3
Written by Ron Frederick <frederick@parc.xerox.com>
Sun CellB encode routine
Based heavily on code by Michael Speer <Michael.Speer@eng.sun.com>
*/
/*
* Copyright (c) Sun Microsystems, Inc. 1992, 1993, 1994. All rights reserved. * Copyright (c) Sun Microsystems, Inc. 1992, 1993, 1994. All rights reserved.
* *
* License is granted to copy, to use, and to make and to use derivative * License is granted to copy, to use, and to make and to use derivative
* works for research and evaluation purposes, provided that Sun Microsystems is * works for research and evaluation purposes, provided that Sun Microsystems is
* acknowledged in all documentation pertaining to any such copy or derivative * acknowledged in all documentation pertaining to any such copy or derivative
* work. Sun Microsystems grants no other licenses expressed or implied. The * work. Sun Microsystems grants no other licenses expressed or implied. The
* Sun Microsystems trade name should not be used in any advertising without * Sun Microsystems trade name should not be used in any advertising without
* its written permission. * its written permission.
* *
* This software is provided "as-is" without express or implied warranty of * This software is provided "as-is" without express or implied warranty of
* any kind. These notices must be retained in any copies of any part of * any kind. These notices must be retained in any copies of any part of
* this software. * this software.
*/ */
/* Header for CellB packet. */ /* Header for CellB packet. */
static struct { static struct {
u_short x, y; u_int16 x, y;
u_short w, h; u_int16 w, h;
} xilhdr; } xilhdr;
int int
CellB_Encode_Init(int width, int height) CellB_Encode_Init(int width, int height)
{ {
int i,j; int i,j;
int size; int size;
u_char *dptr; u_int8 *dptr;
size = height * width; size = height * width;
cb_data = (u_char *)malloc(sizeof(u_char) * size); cb_data = (u_int8 *)malloc(sizeof(u_int8) * size);
if (!cb_data) if (!cb_data)
return (0); return (0);
size /= 16; size /= 16;
cellkount = (u_char *)malloc(size*sizeof(u_char)); cellkount = (u_int8 *)malloc(size*sizeof(u_int8));
cellhistory = (unsigned int *)malloc(size*sizeof(int)); cellhistory = (u_int32*)malloc(size*sizeof(u_int32));
for (i=0;i<size;i++) { for (i=0;i<size;i++) {
cellkount[i] = 0; cellkount[i] = 0;
cellhistory[i] = 0xffffffff; cellhistory[i] = 0xffffffff;
} }
/* .... initialize division table .... */ /* .... initialize division table .... */
dptr = table; dptr = table;
divtable[0] = dptr; divtable[0] = dptr;
for (i = 1; i < 17; i++) { for (i = 1; i < 17; i++) {
skipping to change at page 9, line 4 skipping to change at page 8, line 44
xilhdr.w = htons(width); xilhdr.w = htons(width);
xilhdr.h = htons(height); xilhdr.h = htons(height);
return 1; return 1;
} }
int int
CellB_Encode(uint8 *old_y_data, uint8 *cb_yy_data, int8 *cb_uv_data, CellB_Encode(uint8 *old_y_data, uint8 *cb_yy_data, int8 *cb_uv_data,
int packlen, int aging_bytes, nv_xmitproc_t *callback) int packlen, int aging_bytes, nv_xmitproc_t *callback)
{ {
u_char *data, *dataLim, *pack, *packLim; u_int8 *data, *dataLim, *pack, *packLim;
u_short cellx, celly, width; u_int16 cellx, celly, width;
int len, nframes, pattern; int len, nframes, pattern;
int res; int res;
int x,y,k; int x,y,k;
int xmax = xilhdr.w/4; int xmax = xilhdr.w/4;
int ymax = xilhdr.h/4; int ymax = xilhdr.h/4;
u_char *tyy; u_int8 *tyy;
signed char *tuv; signed char *tuv;
int skipcount; int skipcount;
int index; int index;
int bcnt; int bcnt;
width = xilhdr.w>>2; width = xilhdr.w>>2;
len = width*12; len = width*12;
data = cb_data; data = cb_data;
skipping to change at page 10, line 41 skipping to change at page 10, line 34
cellx++; cellx++;
} }
while (cellx >= width) { while (cellx >= width) {
cellx -= width; cellx -= width;
celly++; celly++;
} }
} }
/* Send out the packet. */ /* Send out the packet. */
(*callback)((data < dataLim) ? 0 : 1, RTPCONT_CELLB, (u_char *)&xilhdr, (*callback)((data < dataLim) ? 0 : 1, RTPCONT_CELLB, (u_int8 *)&xilhdr,
sizeof(xilhdr), pack, data-pack); sizeof(xilhdr), pack, data-pack);
} while (data < dataLim); } while (data < dataLim);
return (len); return (len);
} }
#define SetMaskBit(YVAL, BIT) if ((YVAL) < ymean) { ylo += (YVAL); tmp += 1; } else { yhi += (YVAL); mask += (1 << (BIT)); } #define SetMaskBit(YVAL, BIT) if ((YVAL) < ymean) { ylo += (YVAL); tmp += 1; } else { yhi += (YVAL); mask += (1 << (BIT)); }
unsigned int u_int32
encode_cell(unsigned char *tyy, signed char *tuv, int stride) encode_cell(u_int8 *tyy, int8 *tuv, int stride)
{ {
register int ymean, uvindx; register int ymean, uvindx;
register unsigned int mask, yhi, ylo, tmp, yval; register u_int32 mask, yhi, ylo, tmp, yval;
register unsigned int q0, q1, q2, q3; register u_int32 q0, q1, q2, q3;
{ {
register int umean, vmean; register int umean, vmean;
register signed int t0, t1, t2, t3; register signed int t0, t1, t2, t3;
t0 = ((int *)tuv)[0]; t0 = ((int *)tuv)[0];
t1 = ((int *)tuv)[stride]; t1 = ((int *)tuv)[stride];
t2 = ((int *)tuv)[stride+stride]; t2 = ((int *)tuv)[stride+stride];
t3 = ((int *)tuv)[stride+stride+stride]; t3 = ((int *)tuv)[stride+stride+stride];
umean = (t0<<24)>>24; vmean = (t0<<16)>>24; umean = (t0<<24)>>24; vmean = (t0<<16)>>24;
skipping to change at page 14, line 24 skipping to change at page 14, line 18
COUNT &= mask3333; \ COUNT &= mask3333; \
COUNT += PATTERN; \ COUNT += PATTERN; \
PATTERN = COUNT & 0x0f0f; \ PATTERN = COUNT & 0x0f0f; \
COUNT >>= 4; \ COUNT >>= 4; \
COUNT &= 0x0f0f; \ COUNT &= 0x0f0f; \
COUNT += PATTERN; \ COUNT += PATTERN; \
PATTERN = COUNT & 0xff; \ PATTERN = COUNT & 0xff; \
COUNT >>= 8; \ COUNT >>= 8; \
COUNT += PATTERN COUNT += PATTERN
unsigned int u_int32
skip_cell(int index, unsigned int ccell) skip_cell(int index, u_int32 ccell)
{ {
/* /*
.... this routine determines if a given cell should .... this routine determines if a given cell should
be skipped or updated. To start, each cell should be be skipped or updated. To start, each cell should be
updated approximately once every 8 frames and never updated approximately once every 8 frames and never
less that once in 10 frames. A pseudo-random update less that once in 10 frames. A pseudo-random update
strategy has been adopted since it tends to equalize strategy has been adopted since it tends to equalize
the number of bytes required for each frame, avoiding the number of bytes required for each frame, avoiding
the a sudden burst of activity every 10 frames for a the a sudden burst of activity every 10 frames for a
relatively static image .... Further determination relatively static image .... Further determination
of when a cell should be skipped is done by comparing of when a cell should be skipped is done by comparing
the current, or update, cell value with the value the current, or update, cell value with the value
last transmitted for that cell position .... last transmitted for that cell position ....
*/ */
if (cellkount[index] != 0) { if (cellkount[index] != 0) {
unsigned int rmask, rtmp, ctmp; u_int32 rmask, rtmp, ctmp;
/* /*
.... grab the UV fields of the reference and .... grab the UV fields of the reference and
current cells, then check if the two fields are current cells, then check if the two fields are
"close". this is accomplished with a table called "close". this is accomplished with a table called
uvlookup[]. this table is actually a bitvector uvlookup[]. this table is actually a bitvector
where each bit-position is set or cleared according where each bit-position is set or cleared according
to whether, UV(old) is close to UV(new), The to whether, UV(old) is close to UV(new), The
heuristic for closeness is embodied by the heuristic for closeness is embodied by the
uvclose[ ] vector which in the first version uvclose[ ] vector which in the first version
was based on euclidean distances .... was based on euclidean distances ....
*/ */
rmask = cellhistory[index]; rmask = cellhistory[index];
rtmp = (rmask << 16) >> 24; rtmp = (rmask << 16) >> 24;
ctmp = (ccell << 16) >> 24; ctmp = (ccell << 16) >> 24;
rtmp = (rtmp << 5) + (ctmp >> 3); rtmp = (rtmp << 5) + (ctmp >> 3);
ctmp = ctmp & 7; ctmp = ctmp & 7;
if ((uvlookup[rtmp] & (1 << ctmp)) != 0) { if ((uvlookup[rtmp] & (1 << ctmp)) != 0) {
unsigned int cmask, pattern; u_int32 cmask, pattern;
int cy0, cy1, ry0, ry1; int cy0, cy1, ry0, ry1;
int bits, diff, count; int bits, diff, count;
unsigned int mask5555 = 0x5555; u_int32 mask5555 = 0x5555;
unsigned int mask3333 = 0x3333; u_int32 mask3333 = 0x3333;
/* /*
.... if the colors were close then the .... if the colors were close then the
total absolute luminance difference between total absolute luminance difference between
the reference tile and the current tile is the reference tile and the current tile is
calculated ... The Y/Y vectors are first calculated ... The Y/Y vectors are first
de-quantized, via yytable lookups, and the de-quantized, via yytable lookups, and the
difference corresponding to each of the difference corresponding to each of the
possible bitmask differences between the possible bitmask differences between the
reference mask and the current mask are reference mask and the current mask are
skipping to change at page 17, line 33 skipping to change at page 17, line 27
} }
cellhistory[index] = ccell; cellhistory[index] = ccell;
cellkount[index] = (randbyte( ) & 7) + 13; cellkount[index] = (randbyte( ) & 7) + 13;
return 0; return 0;
} }
#define STATES 23 #define STATES 23
static int nextindex = 0; static int nextindex = 0;
static u_char rtable[STATES] = { static u_int8 rtable[STATES] = {
146, 75, 3, 95, 189, 165, 106, 229, 146, 75, 3, 95, 189, 165, 106, 229,
239, 14, 208, 90, 8, 222, 122, 236, 239, 14, 208, 90, 8, 222, 122, 236,
200, 171, 225, 131, 94, 12, 74 200, 171, 225, 131, 94, 12, 74
}; };
/* /*
.... randbyte( ) does not repeat after 100,000,000 calls .... .... randbyte( ) does not repeat after 100,000,000 calls ....
*/ */
int int
skipping to change at page 19, line 11 skipping to change at page 19, line 11
} }
return rval; return rval;
} }
4.2 Sample Decoder 4.2 Sample Decoder
The C code included here represents a reference decoder for CellB. For The C code included here represents a reference decoder for CellB. For
complete source refer to [3]. complete source refer to [3].
/* /*
Netvideo version 3.3
Written by Ron Frederick <frederick@parc.xerox.com>
Sun CellB decode routine
Based heavily on code by Michael Speer <Michael.Speer@eng.sun.com>
*/
/*
* Copyright (c) Sun Microsystems, Inc. 1992, 1993, 1994. All rights reserved. * Copyright (c) Sun Microsystems, Inc. 1992, 1993, 1994. All rights reserved.
* *
* License is granted to copy, to use, and to make and to use derivative * License is granted to copy, to use, and to make and to use derivative
* works for research and evaluation purposes, provided that Sun Microsystems is * works for research and evaluation purposes, provided that Sun Microsystems is
* acknowledged in all documentation pertaining to any such copy or derivative * acknowledged in all documentation pertaining to any such copy or derivative
* work. Sun Microsystems grants no other licenses expressed or implied. The * work. Sun Microsystems grants no other licenses expressed or implied. The
* Sun Microsystems trade name should not be used in any advertising without * Sun Microsystems trade name should not be used in any advertising without
* its written permission. * its written permission.
* *
* This software is provided "as-is" without express or implied warranty of * This software is provided "as-is" without express or implied warranty of
skipping to change at page 21, line 13 skipping to change at page 21, line 5
0x6058, 0x6858, 0x605c, 0x6460, 0x6860, 0x7060, 0x8060, 0x9060, 0x6058, 0x6858, 0x605c, 0x6460, 0x6860, 0x7060, 0x8060, 0x9060,
0xa060, 0x6864, 0x6c68, 0x7068, 0x7868, 0x706c, 0x7470, 0x7870, 0xa060, 0x6864, 0x6c68, 0x7068, 0x7868, 0x706c, 0x7470, 0x7870,
0x8070, 0x9070, 0xa070, 0xb070, 0xd070, 0xf070, 0x8078, 0x8878, 0x8070, 0x9070, 0xa070, 0xb070, 0xd070, 0xf070, 0x8078, 0x8878,
0x8880, 0x9080, 0xa080, 0xb080, 0xc080, 0x9088, 0x9888, 0x9890, 0x8880, 0x9080, 0xa080, 0xb080, 0xc080, 0x9088, 0x9888, 0x9890,
0xa090, 0xb090, 0xc090, 0xd090, 0xf090, 0xa098, 0xa898, 0xa8a0, 0xa090, 0xb090, 0xc090, 0xd090, 0xf090, 0xa098, 0xa898, 0xa8a0,
0xb0a0, 0xc0a0, 0xd0a0, 0xe0a0, 0xb0a8, 0xb8a8, 0xb8b0, 0xc0b0, 0xb0a0, 0xc0a0, 0xd0a0, 0xe0a0, 0xb0a8, 0xb8a8, 0xb8b0, 0xc0b0,
0xd0b0, 0xe0b0, 0xf0b0, 0xc0b8, 0xc8b8, 0xc8c0, 0xd0c0, 0xe0c0, 0xd0b0, 0xe0b0, 0xf0b0, 0xc0b8, 0xc8b8, 0xc8c0, 0xd0c0, 0xe0c0,
0xf0c0, 0xd0c8, 0xd8c8, 0xd8d0, 0xe0d0, 0xf0d0, 0xe8d8, 0xf0e0 0xf0c0, 0xd0c8, 0xd8c8, 0xd8d0, 0xe0d0, 0xf0d0, 0xe8d8, 0xf0e0
}; };
int CellB_Decode(vidimage_t *image, uint8 *data, int len) int
CellB_Decode(vidimage_t *image, uint8 *data, int len)
{ {
int orig_cellx, orig_celly, cellx, celly, width, offset; int orig_cellx, orig_celly, cellx, celly, width, offset;
int pattern, yyindx, uvindx; int pattern, yyindx, uvindx;
uint32 *yorigin, *uvorigin, *yptr, *uvptr, yout, uvout; uint32 *yorigin, *uvorigin, *yptr, *uvptr, yout, uvout;
uint8 *dataLim=data+len, y1, y2, uu, vv; uint8 *dataLim=data+len, y1, y2, uu, vv;
width = image->width / 4; width = image->width / 4;
if (dataLim-data < 8) return 1; if (dataLim-data < 8) return 1;
skipping to change at page 22, line 51 skipping to change at page 22, line 43
cellx++; cellx++;
if (cellx >= width) { if (cellx >= width) {
cellx -= width; cellx -= width;
celly++; celly++;
} }
data += 4; data += 4;
} }
} }
if (cellx == 0) celly--; if (cellx == 0)
VidImage_UpdateRect(image, 0, orig_celly*4, width*4, celly--;
(celly-orig_celly+1)*4); return (0);
return 0;
} }
5 References 5 References
1. "Cell Image Compression Byte Stream Description," 1. "Cell Image Compression Byte Stream Description,"
Available via anonymous ftp: Available via anonymous ftp:
playground.sun.com:/pub/multimedia/video. playground.sun.com:/pub/multimedia/video.
2. Henning Schulzrinne, Stephen Casner "RTP: A Transport 2. Henning Schulzrinne, Stephen Casner "RTP: A Transport
Protocol for Real-Time Applications," Internet Draft, Protocol for Real-Time Applications," Internet Draft,
skipping to change at page 24, line 25 skipping to change at page 23, line 25
3. Nv Video Compression Software, Unpublished work by Ron 3. Nv Video Compression Software, Unpublished work by Ron
Frederick, Xerox PARC. Frederick, Xerox PARC.
4. Thierry Turletti, Christian Huitema INRIA, "H.261 4. Thierry Turletti, Christian Huitema INRIA, "H.261
Packetization", Internet Draft, May 28th, 1993. Packetization", Internet Draft, May 28th, 1993.
6 Address of the Authors 6 Address of the Authors
Michael F. Speer Michael F. Speer
Sun Microsystems Computer Corporation Sun Microsystems Computer Corporation
2550 Garcia Ave MailStop MailStop UMPK14-305 2550 Garcia Ave MailStop UMPK14-305
Mountain View, CA 94043 Mountain View, CA 94043
Voice: (415)786-6368 Voice: +1 415 786 6368
Fax: (415)786-6445 Fax: +1 415 786 6445
E-mail: michael.speer@eng.sun.com E-mail: michael.speer@eng.sun.com
Don Hoffman Don Hoffman
Sun Microsystems Computer Corporation Sun Microsystems Computer Corporation
2550 Garcia Ave MailStop MailStop UMPK14-305 2550 Garcia Ave MailStop UMPK14-305
Mountain View, CA 94043 Mountain View, CA 94043
Voice: (415)786-6370 Voice: +1 415 786 6370
Fax:(415)786-6445 Fax: +1 415 786 6445
E-mail: don.hoffman@eng.sun.com E-mail: don.hoffman@eng.sun.com
 End of changes. 

This html diff was produced by rfcdiff 1.23, available from http://www.levkowetz.com/ietf/tools/rfcdiff/