TUT HEVC Encoder
Loading...
Searching...
No Matches
bitstream.h File Reference

Appending bits into an Annex-B coded bitstream.

#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)
 
#define WRITE_UE(stream, data, name)
 
#define WRITE_SE(stream, data, name)
 

Typedefs

typedef struct bitstream_t bitstream_t
 A stream of bits.
 

Functions

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

Macro Definition Documentation

◆ WRITE_SE

#define WRITE_SE ( stream,
data,
name )
Value:
void kvz_bitstream_put_se(bitstream_t *stream, int32_t data)
Write signed Exp-Golomb bit string.
Definition bitstream.c:267
static kvz_rc_data * data
Definition rate_control.c:48

◆ WRITE_U

#define WRITE_U ( stream,
data,
bits,
name )
Value:
{ kvz_bitstream_put(stream,data,bits); }
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.
Definition bitstream.c:232

◆ WRITE_UE

#define WRITE_UE ( stream,
data,
name )
Value:
void kvz_bitstream_put_ue(bitstream_t *stream, uint32_t data)
Write unsigned Exp-Golomb bit string.
Definition bitstream.c:253

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: