AN2121 Freescale Semiconductor / Motorola, AN2121 Datasheet - Page 35

no-image

AN2121

Manufacturer Part Number
AN2121
Description
JPEG2000 Arithmetic Encoding on StarCore SC140
Manufacturer
Freescale Semiconductor / Motorola
Datasheet

Available stocks

Company
Part Number
Manufacturer
Quantity
Price
Part Number:
AN2121SC
Manufacturer:
TERIDIAN
Quantity:
40
#include <stdlib.h>
#include "types.h"
#include "fileIO.h"
/* Store the encoded bytes for testing */
extern uint8 arrayOut[];
/* Keep track of the total number of bytes written */
static uint32 bytesWritten = 0;
/* This writes out bits as text, ’0’ for a 0 bit and ’1’ for a 1 bit */
#undef WRITE_BITS
/* This writes bytes out as binary bytes */
#define WRITE_BYTES
/* This doesn’t write out anything - only counts */
#undef NO_WRITE
/* ======================================================================== */
/*
*/
void TransmitByte(uint8 byte)
{
#ifdef WRITE_BITS
#endif
#ifdef WRITE_BYTES
#endif
} /* TransmitByte */
/* ======================================================================== */
/*
Read a byte of data.
*/
uint8 ReceiveByte(FILE* inFile)
{
#ifdef WRITE_BITS
parameter: byte - The byte to write out.
For this testing code, this function just prints out the binary pattern
for the bytes (most significant bit first) to standard output.
brief Write a byte of data.
int bit = 1 << 7;
while (bit)
{
}
arrayOut[bytesWritten++] = byte;
uint8 byte = 0;
int i;
for (i = 0; i < 8; i++)
{
putc((byte & bit) ? ’1’ : ’0’, outFile);
bit >>= 1;
byte <<= 1;
if (getc(inFile) == ’1’)
/* If reading past the end of the file, read in 1 bits */
byte |= 0x01;
Freescale Semiconductor, Inc.
Appendix A. Arithmetic Encoder: C Code
For More Information On This Product,
Go to: www.freescale.com
31

Related parts for AN2121