TUT HEVC Encoder
Data Structures | Macros | Typedefs | Functions
bitstream.h File Reference

Appending bits into an Annex-B coded bitstream. More...

#include "global.h"
#include "kvazaar.h"
Include dependency graph for bitstream.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  bitstream_t
 A stream of bits. More...
 
struct  bit_table_t
 

Macros

#define WRITE_U(stream, data, bits, name)   { kvz_bitstream_put(stream,data,bits); }
 
#define WRITE_UE(stream, data, name)   { kvz_bitstream_put_ue(stream,data); }
 
#define WRITE_SE(stream, data, name)   { kvz_bitstream_put_se(stream,data); }
 

Typedefs

typedef struct bitstream_t bitstream_t
 A stream of bits. More...
 

Functions

void kvz_bitstream_init (bitstream_t *stream)
 Initialize a new bitstream. More...
 
kvz_data_chunkkvz_bitstream_alloc_chunk ()
 Allocates a new bitstream chunk. More...
 
kvz_data_chunkkvz_bitstream_take_chunks (bitstream_t *stream)
 Take chunks from a bitstream. More...
 
void kvz_bitstream_free_chunks (kvz_data_chunk *chunk)
 Free a list of chunks. More...
 
void kvz_bitstream_finalize (bitstream_t *stream)
 Free resources used by a bitstream. More...
 
uint64_t kvz_bitstream_tell (const bitstream_t *stream)
 Get the number of bits written. More...
 
void kvz_bitstream_writebyte (bitstream_t *stream, uint8_t byte)
 Write a byte to bitstream. More...
 
void kvz_bitstream_move (bitstream_t *dst, bitstream_t *src)
 Move data from one stream to another. More...
 
void kvz_bitstream_clear (bitstream_t *stream)
 Reset stream. More...
 
void kvz_bitstream_put (bitstream_t *stream, uint32_t data, uint8_t bits)
 Write bits to bitstream Buffers individual bits untill they make a full byte. More...
 
void kvz_bitstream_put_byte (bitstream_t *const stream, const uint32_t data)
 Write a byte to a byte aligned bitstream. More...
 
void kvz_bitstream_put_ue (bitstream_t *stream, uint32_t data)
 Write unsigned Exp-Golomb bit string. More...
 
void kvz_bitstream_put_se (bitstream_t *stream, int32_t data)
 Write signed Exp-Golomb bit string. More...
 
void kvz_bitstream_add_rbsp_trailing_bits (bitstream_t *stream)
 Add rbsp_trailing_bits syntax element, which aligns the bitstream. More...
 
void kvz_bitstream_align (bitstream_t *stream)
 Align the bitstream, unless it's already aligned. More...
 
void kvz_bitstream_align_zero (bitstream_t *stream)
 Align the bitstream with zero. More...
 

Macro Definition Documentation

◆ WRITE_SE

#define WRITE_SE (   stream,
  data,
  name 
)    { kvz_bitstream_put_se(stream,data); }

◆ WRITE_U

#define WRITE_U (   stream,
  data,
  bits,
  name 
)    { kvz_bitstream_put(stream,data,bits); }

◆ WRITE_UE

#define WRITE_UE (   stream,
  data,
  name 
)    { kvz_bitstream_put_ue(stream,data); }

Typedef Documentation

◆ bitstream_t

typedef struct bitstream_t bitstream_t

Function Documentation

◆ kvz_bitstream_add_rbsp_trailing_bits()

void kvz_bitstream_add_rbsp_trailing_bits ( bitstream_t stream)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ kvz_bitstream_align()

void kvz_bitstream_align ( bitstream_t stream)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ kvz_bitstream_align_zero()

void kvz_bitstream_align_zero ( bitstream_t stream)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ kvz_bitstream_alloc_chunk()

kvz_data_chunk * kvz_bitstream_alloc_chunk ( )
Returns
Pointer to the new chunk, or NULL.
Here is the caller graph for this function:

◆ kvz_bitstream_clear()

void kvz_bitstream_clear ( bitstream_t stream)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ kvz_bitstream_finalize()

void kvz_bitstream_finalize ( bitstream_t stream)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ kvz_bitstream_free_chunks()

void kvz_bitstream_free_chunks ( kvz_data_chunk chunk)
Here is the caller graph for this function:

◆ kvz_bitstream_init()

void kvz_bitstream_init ( bitstream_t stream)
Here is the caller graph for this function:

◆ kvz_bitstream_move()

void kvz_bitstream_move ( bitstream_t *const  dst,
bitstream_t *const  src 
)

Destination stream must be byte-aligned. Source stream will be cleared.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ kvz_bitstream_put()

void kvz_bitstream_put ( bitstream_t *const  stream,
const uint32_t  data,
uint8_t  bits 
)
Parameters
streamstream the data is to be appended to
datainput data
bitsnumber of bits to write from data to stream
Here is the call graph for this function:
Here is the caller graph for this function:

◆ kvz_bitstream_put_byte()

void kvz_bitstream_put_byte ( bitstream_t *const  stream,
uint32_t  data 
)
Parameters
streamstream the data is to be appended to
datainput data
Here is the call graph for this function:
Here is the caller graph for this function:

◆ kvz_bitstream_put_se()

void kvz_bitstream_put_se ( bitstream_t stream,
int32_t  data 
)
Here is the call graph for this function:

◆ kvz_bitstream_put_ue()

void kvz_bitstream_put_ue ( bitstream_t stream,
uint32_t  data 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ kvz_bitstream_take_chunks()

kvz_data_chunk * kvz_bitstream_take_chunks ( bitstream_t *const  stream)

Move ownership of the chunks to the caller and clear the bitstream.

The bitstream must be byte-aligned.

Here is the caller graph for this function:

◆ kvz_bitstream_tell()

uint64_t kvz_bitstream_tell ( const bitstream_t *const  stream)
Parameters
streambitstream
Returns
position
Here is the caller graph for this function:

◆ kvz_bitstream_writebyte()

void kvz_bitstream_writebyte ( bitstream_t *const  stream,
const uint8_t  byte 
)

The stream must be byte-aligned.

Parameters
streampointer bitstream to put the data
bytebyte to write
Here is the call graph for this function:
Here is the caller graph for this function: