/*************************************************************************** * Copyright (c) 2002, Broadcom Corporation * All Rights Reserved * Confidential Property of Broadcom Corporation * * THIS SOFTWARE MAY ONLY BE USED SUBJECT TO AN EXECUTED SOFTWARE LICENSE * AGREEMENT BETWEEN THE USER AND BROADCOM. YOU HAVE NO RIGHT TO USE OR * EXPLOIT THIS MATERIAL EXCEPT SUBJECT TO THE TERMS OF SUCH AN AGREEMENT. * * $brcm_Workfile: bcmDccBits.h $ * $brcm_Revision: SanJose_MSTV_Devel\2 $ * $brcm_Date: 5/13/02 1:14p $ * * Module Description: * * This module contains functions useful for extracting bits * from a byte stream. * * Revision History: * * $brcm_Log: \SetTop\applications\vbi\Common\bcmDccBits.h $ * * SanJose_MSTV_Devel\2 5/13/02 1:14p erikg * snapshot of dtvcc code Merge from * SanJose_MSTV_Devel_erikg_DTVCC_Int_2002_05_02_1128_00 13-May- * 02.11:55:52 \SetTop\applications\vbi Added directory element * "DTVCCLib". --- 13-May-02.13:08:38 \SetTop\applications\vbi\Common * First version of the Dcc 708 Rendering Libraries --- 13-May- * 02.13:08:10 \SetTop\applications\vbi\Common\bcmDccBits.h Added ifdef * to ensure included only once. * Added extern "C" for __cplusplus --- 13-May-02.13:07:04 * \SetTop\applications\vbi\MPEGCCTransportLib\source\bcmDccTransportPars * e.c NextStartCode() now specifically scans for start codes until it * finds * 00 00 01 B2. --- 13-May-02.13:08:40 * \SetTop\applications\vbi\Common@@\main\SanJose_MSTV_Devel\SanJose_MSTV * _Devel_erikg_DTVCC_Int_2002_05_02_1128_00\1\bcmDccCBuf.c First version * of the Dcc 708 Rendering Libraries --- 13-May-02.13:08:43 * \SetTop\applications\vbi\Common@@\main\SanJose_MSTV_Devel\SanJose_MSTV * _Devel_erikg_DTVCC_Int_2002_05_02_1128_00\1\bcmDccCBuf.h First version * of the Dcc 708 Rendering Libraries --- 13-May-02.11:55:59 * \SetTop\applications\vbi@@\main\SanJose_MSTV_Devel\SanJose_MSTV_Devel_ * erikg_DTVCC_Int_2002_05_02_1128_00\1\DTVCCLib Added directory element * "source". Added directory element "public_inc". --- * * SanJose_MSTV_Devel\SanJose_MSTV_Devel_erikg_DTVCC_Int_2002_05_02_1128_00\1 5/13/02 1:8p erikg * Added ifdef to ensure included only once. * Added extern "C" for __cplusplus * * \main\SanJose_MSTV_Devel\1 3/12/02 4:46p erikg * Merge from SanJose_MSTV_Devel_erikg_mpegccxport2_2002_03_06_1118_38 * * \main\SanJose_MSTV_Devel_erikg_mpegccxport2_2002_03_06_1118_38\1 3/6/02 11:29a erikg * new source files * ***************************************************************************/ /************************************************************************* * * MODULE DETAILS: * * The functions in this module operate on bits in a byte buffer (array). * Each function is given a pointer to the buffer and a byte offset and a * bit offset indicating the current position in the buffer. The byte/bit * offsets are either ints or int pointers, depending on whether or not * the current position is to be updated. * * It is assumed that the first bit to be operated on is in the msb position, * that is, 0x80. * *************************************************************************/ #ifndef BCMDCCBITS_H #define BCMDCCBITS_H #ifdef __cplusplus extern "C" { #endif /************************************************************************* * * FUNCTION: getnextbit * * Inputs: * pBuf - stream buffer * pbyteoff - current byte offset into pBuf * pbitoff - bit offset into current byte * * Outputs: * pbyteoff - current byte offset into pBuf * pbitoff - bit offset into current byte * * Returns: the requested bit, 0 or 1 * * Description: * * This function returns the next bit and increments the position. * *************************************************************************/ unsigned int getnextbit(unsigned char * pBuf, int * pbyteoff, int * pbitoff) ; /************************************************************************* * * FUNCTION: getnextbits * * Inputs: * pBuf - stream buffer * pbyteoff - current byte offset into pBuf * pbitoff - bit offset into current byte * numbits - number of bits to get (max 32) * * Outputs: * pbyteoff - current byte offset into pBuf * pbitoff - bit offset into current byte * * Returns: the requested bits, lsb justified * * Description: * * This function returns the requested number of bits and * updates the position. * *************************************************************************/ unsigned int getnextbits(unsigned char * pBuf, int * pbyteoff, int * pbitoff, int numbits) ; /************************************************************************* * * FUNCTION: getnextbits_rev * * Inputs: * pBuf - stream buffer * pbyteoff - current byte offset into pBuf * pbitoff - bit offset into current byte * numbits - number of bits to get (max 32) * * Outputs: * pbyteoff - current byte offset into pBuf * pbitoff - bit offset into current byte * * Returns: the requested bits, bit reversed, lsb justified * * Description: * * This function returns the requested number of bits in reverse * order and updates the position. * *************************************************************************/ unsigned int getnextbits_rev(unsigned char * pBuf, int * pbyteoff, int * pbitoff, int numbits) ; /************************************************************************* * * FUNCTION: nextbits * * Inputs: * pBuf - stream buffer * byteoff - current byte offset into pBuf * bitoff - bit offset into current byte * numbits - number of bits to get (max 32) * * Outputs: * * * Returns: the requested bits, lsb justified * * Description: * * This function returns the requested number of bits but does * not update the position. * *************************************************************************/ unsigned int nextbits(unsigned char * pBuf, int byteoff, int bitoff, int numbits) ; /************************************************************************* * * FUNCTION: next_start_code * * Inputs: * pBuf - stream buffer * pbyteoff - current byte offset into pBuf * pbitoff - bit offset into current byte * numbytes - max bytes to scan forward * * Outputs: * pbyteoff - current byte offset into pBuf * pbitoff - bit offset into current byte * * Returns: 0 for success * * Description: * * This function updates the position to the next start code. * *************************************************************************/ int next_start_code(unsigned char * pBuf, int * pbyteoff, int * pbitoff, int numbytes) ; #ifdef __cplusplus } #endif #endif /* BCMDCCBITS_H */