FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Functions
put_bits.h File Reference

bitstream writer API More...

#include <stdint.h>
#include <stdlib.h>
#include <assert.h>
#include "libavutil/bswap.h"
#include "libavutil/common.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/log.h"
#include "libavutil/avassert.h"
#include "mathops.h"
#include "config.h"

Go to the source code of this file.

Data Structures

struct  PutBitContext
 

Functions

static void init_put_bits (PutBitContext *s, uint8_t *buffer, int buffer_size)
 Initialize the PutBitContext s.
 
static int put_bits_count (PutBitContext *s)
 
static int put_bits_left (PutBitContext *s)
 
static void flush_put_bits (PutBitContext *s)
 Pad the end of the output stream with zeros.
 
void avpriv_align_put_bits (PutBitContext *s)
 Pad the bitstream with zeros up to the next byte boundary.
 
void avpriv_put_string (PutBitContext *pb, const char *string, int terminate_string)
 Put the string string in the bitstream.
 
void avpriv_copy_bits (PutBitContext *pb, const uint8_t *src, int length)
 Copy the content of src to the bitstream.
 
static void put_bits (PutBitContext *s, int n, unsigned int value)
 Write up to 31 bits into a bitstream.
 
static void put_sbits (PutBitContext *pb, int n, int32_t value)
 
static void av_unused put_bits32 (PutBitContext *s, uint32_t value)
 Write exactly 32 bits into a bitstream.
 
static uint8_tput_bits_ptr (PutBitContext *s)
 Return the pointer to the byte where the bitstream writer will put the next bit.
 
static void skip_put_bytes (PutBitContext *s, int n)
 Skip the given number of bytes.
 
static void skip_put_bits (PutBitContext *s, int n)
 Skip the given number of bits.
 
static void set_put_bits_buffer_size (PutBitContext *s, int size)
 Change the end of the buffer.
 

Detailed Description

bitstream writer API

Definition in file put_bits.h.

Function Documentation

static void init_put_bits ( PutBitContext s,
uint8_t buffer,
int  buffer_size 
)
inlinestatic
static int put_bits_count ( PutBitContext s)
inlinestatic
static int put_bits_left ( PutBitContext s)
inlinestatic
Returns
the number of bits available in the bitstream.

Definition at line 81 of file put_bits.h.

Referenced by dv_encode_ac(), and save_bits().

static void flush_put_bits ( PutBitContext s)
inlinestatic
void avpriv_align_put_bits ( PutBitContext s)
void avpriv_put_string ( PutBitContext pb,
const char *  string,
int  terminate_string 
)

Put the string string in the bitstream.

Parameters
terminate_string0-terminates the written string if value is 1

Definition at line 52 of file bitstream.c.

Referenced by jpeg_put_comments(), and mpeg4_encode_vol_header().

void avpriv_copy_bits ( PutBitContext pb,
const uint8_t src,
int  length 
)

Copy the content of src to the bitstream.

Parameters
lengththe number of bits of src to copy

Definition at line 63 of file bitstream.c.

Referenced by copy_bits(), encode_thread(), ff_mpeg4_merge_partitions(), latm_write_frame_header(), latm_write_packet(), merge_context_after_encode(), save_bits(), and svq1_encode_plane().

static void put_bits ( PutBitContext s,
int  n,
unsigned int  value 
)
inlinestatic

Write up to 31 bits into a bitstream.

Use put_bits32 to write 32 bits.

Definition at line 140 of file put_bits.h.

Referenced by put_bits32(), and put_sbits().

static void put_sbits ( PutBitContext pb,
int  n,
int32_t  value 
)
inlinestatic
static void av_unused put_bits32 ( PutBitContext s,
uint32_t  value 
)
static
static uint8_t* put_bits_ptr ( PutBitContext s)
inlinestatic
static void skip_put_bytes ( PutBitContext s,
int  n 
)
inlinestatic

Skip the given number of bytes.

PutBitContext must be flushed & aligned to a byte boundary before calling this.

Definition at line 216 of file put_bits.h.

Referenced by avpriv_copy_bits(), and escape_FF().

static void skip_put_bits ( PutBitContext s,
int  n 
)
inlinestatic

Skip the given number of bits.

Must only be used if the actual values in the bitstream do not matter. If n is 0 the behavior is undefined.

Definition at line 228 of file put_bits.h.

Referenced by ff_h263_encode_motion_vector(), and mpeg4_encode_blocks().

static void set_put_bits_buffer_size ( PutBitContext s,
int  size 
)
inlinestatic

Change the end of the buffer.

Parameters
sizethe new size in bytes of the buffer where to put bits

Definition at line 240 of file put_bits.h.

Referenced by ff_mpeg4_init_partitions(), and ff_mpeg4_merge_partitions().