示例#1
0
/*
 * BF_BitStreamFrame:
 * ------------------
 * This is the public interface to the bitstream
 * formatting package. It writes one frame of main data per call.
 *
 * Assumptions:
 * - The back pointer is zero on the first call
 * - An integral number of bytes is written each frame
 *
 * You should be able to change the frame length, side info
 * length, #channels, #granules on a frame-by-frame basis.
 *
 * See formatBitstream.h for more information about the data
 * structures and the bitstream syntax.
 */
void shine_BF_BitstreamFrame(shine_global_config *config)
{
  /* get ptr to bit writing function */
  /* save SI and compute its length */
  store_side_info( config );

  /* write the main data, inserting SI to maintain framing */
  main_data( config );

  /*
   * Caller must ensure that back SI and main data are
   * an integral number of bytes, since the back pointer
   * can only point to a byte boundary and this code
   * does not add stuffing bits
   */
  /* assert( (BitsRemaining % 8) == 0 );*/
}
示例#2
0
/*
 * BF_BitStreamFrame:
 * ------------------
 * This is the public interface to the bitstream
 * formatting package. It writes one frame of main data per call.
 *
 * Assumptions:
 * - The back pointer is zero on the first call
 * - An integral number of bytes is written each frame
 *
 * You should be able to change the frame length, side info
 * length, #channels, #granules on a frame-by-frame basis.
 *
 * See formatBitstream.h for more information about the data
 * structures and the bitstream syntax.
 */
void BF_BitstreamFrame( BF_FrameData *frameInfo, BF_FrameResults *results, void *config )
{
/*  assert( frameInfo->nGranules <= MAX_GRANULES );*/
/*  assert( frameInfo->nChannels <= MAX_CHANNELS );*/

  /* get ptr to bit writing function */
  PutBits = frameInfo->putbits;
  user_config=config;
  /*  assert( PutBits );*/
  /* save SI and compute its length */
  results->SILength = store_side_info( frameInfo );

  /* write the main data, inserting SI to maintain framing */
  results->mainDataLength = main_data( frameInfo, results );

  /*
   * Caller must ensure that back SI and main data are
   * an integral number of bytes, since the back pointer
   * can only point to a byte boundary and this code
   * does not add stuffing bits
   */
/*  assert( (BitsRemaining % 8) == 0 );*/
}