libavcodec/bitstream.h File Reference

bitstream api header. More...

#include <stdint.h>
#include <stdlib.h>
#include <assert.h>
#include "common.h"
#include "bswap.h"
#include "intreadwrite.h"
#include "log.h"

Go to the source code of this file.

Data Structures

struct  PutBitContext
struct  GetBitContext
struct  VLC
struct  RL_VLC_ELEM

Defines

#define ALT_BITSTREAM_READER
#define LIBMPEG2_BITSTREAM_READER_HACK
#define NEG_SSR32(a, s)   ((( int32_t)(a))>>(32-(s)))
#define NEG_USR32(a, s)   (((uint32_t)(a))>>(32-(s)))
#define VLC_TYPE   int16_t
#define unaligned(x)
#define MIN_CACHE_BITS   25
#define OPEN_READER(name, gb)
#define CLOSE_READER(name, gb)   (gb)->index= name##_index;\
#define UPDATE_CACHE(name, gb)   name##_cache= AV_RB32( ((const uint8_t *)(gb)->buffer)+(name##_index>>3) ) << (name##_index&0x07);\
#define SKIP_CACHE(name, gb, num)   name##_cache <<= (num);
#define SKIP_COUNTER(name, gb, num)   name##_index += (num);\
#define SKIP_BITS(name, gb, num)
#define LAST_SKIP_BITS(name, gb, num)   SKIP_COUNTER(name, gb, num)
#define LAST_SKIP_CACHE(name, gb, num)   ;
#define SHOW_UBITS(name, gb, num)   NEG_USR32(name##_cache, num)
#define SHOW_SBITS(name, gb, num)   NEG_SSR32(name##_cache, num)
#define GET_CACHE(name, gb)   ((uint32_t)name##_cache)
#define init_vlc(vlc, nb_bits, nb_codes, bits, bits_wrap, bits_size, codes, codes_wrap, codes_size, flags)
#define INIT_VLC_USE_STATIC   1
#define INIT_VLC_LE   2
#define GET_VLC(code, name, gb, table, bits, max_depth)
 if the vlc code is invalid and max_depth=1 than no bits will be removed if the vlc code is invalid and max_depth>1 than the number of bits removed is undefined
#define GET_RL_VLC(level, run, name, gb, table, bits, max_depth, need_update)
#define tprintf(p,...)   {}

Functions

static void init_put_bits (PutBitContext *s, uint8_t *buffer, int buffer_size)
static int put_bits_count (PutBitContext *s)
static void flush_put_bits (PutBitContext *s)
void align_put_bits (PutBitContext *s)
void ff_put_string (PutBitContext *pbc, const char *s, int put_zero)
void ff_copy_bits (PutBitContext *pb, const uint8_t *src, int length)
 unaligned (16) unaligned(32) unaligned(64) static inline void put_bits(PutBitContext *s
void free_vlc (VLC *vlc)
static av_always_inline int get_vlc2 (GetBitContext *s, VLC_TYPE(*table)[2], int bits, int max_depth)
 parses a vlc code, faster then get_vlc()
static int decode012 (GetBitContext *gb)
static int decode210 (GetBitContext *gb)

Variables

const uint8_t ff_reverse [256]
int n


Detailed Description

bitstream api header.

Definition in file bitstream.h.


Define Documentation

#define ALT_BITSTREAM_READER

Definition at line 47 of file bitstream.h.

#define CLOSE_READER ( name,
gb   )     (gb)->index= name##_index;\

#define GET_CACHE ( name,
gb   )     ((uint32_t)name##_cache)

#define GET_RL_VLC ( level,
run,
name,
gb,
table,
bits,
max_depth,
need_update   ) 

Value:

{\
    int n, index, nb_bits;\
\
    index= SHOW_UBITS(name, gb, bits);\
    level = table[index].level;\
    n     = table[index].len;\
\
    if(max_depth > 1 && n < 0){\
        SKIP_BITS(name, gb, bits)\
        if(need_update){\
            UPDATE_CACHE(name, gb)\
        }\
\
        nb_bits = -n;\
\
        index= SHOW_UBITS(name, gb, nb_bits) + level;\
        level = table[index].level;\
        n     = table[index].len;\
    }\
    run= table[index].run;\
    SKIP_BITS(name, gb, n)\
}

Definition at line 844 of file bitstream.h.

Referenced by ff_msmpeg4_decode_block(), mdec_decode_block_intra(), mpeg1_decode_block_inter(), mpeg1_decode_block_intra(), mpeg1_fast_decode_block_inter(), mpeg2_decode_block_intra(), mpeg2_decode_block_non_intra(), mpeg2_fast_decode_block_intra(), mpeg2_fast_decode_block_non_intra(), and mpeg4_decode_block().

#define GET_VLC ( code,
name,
gb,
table,
bits,
max_depth   ) 

Value:

{\
    int n, index, nb_bits;\
\
    index= SHOW_UBITS(name, gb, bits);\
    code = table[index][0];\
    n    = table[index][1];\
\
    if(max_depth > 1 && n < 0){\
        LAST_SKIP_BITS(name, gb, bits)\
        UPDATE_CACHE(name, gb)\
\
        nb_bits = -n;\
\
        index= SHOW_UBITS(name, gb, nb_bits) + code;\
        code = table[index][0];\
        n    = table[index][1];\
        if(max_depth > 2 && n < 0){\
            LAST_SKIP_BITS(name, gb, nb_bits)\
            UPDATE_CACHE(name, gb)\
\
            nb_bits = -n;\
\
            index= SHOW_UBITS(name, gb, nb_bits) + code;\
            code = table[index][0];\
            n    = table[index][1];\
        }\
    }\
    SKIP_BITS(name, gb, n)\
}
if the vlc code is invalid and max_depth=1 than no bits will be removed if the vlc code is invalid and max_depth>1 than the number of bits removed is undefined

Definition at line 813 of file bitstream.h.

Referenced by decode_block(), decode_block_progressive(), and get_vlc2().

#define init_vlc ( vlc,
nb_bits,
nb_codes,
bits,
bits_wrap,
bits_size,
codes,
codes_wrap,
codes_size,
flags   ) 

#define INIT_VLC_LE   2

#define INIT_VLC_USE_STATIC   1

#define LAST_SKIP_BITS ( name,
gb,
num   )     SKIP_COUNTER(name, gb, num)

#define LAST_SKIP_CACHE ( name,
gb,
num   )     ;

#define LIBMPEG2_BITSTREAM_READER_HACK

Definition at line 52 of file bitstream.h.

#define MIN_CACHE_BITS   25

#define NEG_SSR32 ( a,
 )     ((( int32_t)(a))>>(32-(s)))

Definition at line 73 of file bitstream.h.

#define NEG_USR32 ( a,
 )     (((uint32_t)(a))>>(32-(s)))

Definition at line 74 of file bitstream.h.

Referenced by decode_block(), decode_block_progressive(), and dv_decode_ac().

#define OPEN_READER ( name,
gb   ) 

#define SHOW_SBITS ( name,
gb,
num   )     NEG_SSR32(name##_cache, num)

#define SHOW_UBITS ( name,
gb,
num   )     NEG_USR32(name##_cache, num)

#define SKIP_BITS ( name,
gb,
num   ) 

#define SKIP_CACHE ( name,
gb,
num   )     name##_cache <<= (num);

#define SKIP_COUNTER ( name,
gb,
num   )     name##_index += (num);\

#define tprintf ( p,
...   )     {}

#define unaligned (  ) 

Value:

static inline uint##x##_t unaligned##x(const void *v) {         \
    return *(const uint##x##_t *) v;                            \
}

Definition at line 201 of file bitstream.h.

#define UPDATE_CACHE ( name,
gb   )     name##_cache= AV_RB32( ((const uint8_t *)(gb)->buffer)+(name##_index>>3) ) << (name##_index&0x07);\

#define VLC_TYPE   int16_t

Definition at line 162 of file bitstream.h.

Referenced by alloc_table(), and build_table().


Function Documentation

void align_put_bits ( PutBitContext s  ) 

static int decode012 ( GetBitContext gb  )  [inline, static]

static int decode210 ( GetBitContext gb  )  [inline, static]

Definition at line 953 of file bitstream.h.

Referenced by vc1_decode_ac_coeff().

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

Definition at line 63 of file bitstream.c.

Referenced by encode_thread(), merge_context_after_encode(), and svq1_encode_plane().

void ff_put_string ( PutBitContext pbc,
const char *  s,
int  put_zero 
)

Definition at line 53 of file bitstream.c.

Referenced by jpeg_put_comments().

static void flush_put_bits ( PutBitContext s  )  [inline, static]

void free_vlc ( VLC vlc  ) 

static av_always_inline int get_vlc2 ( GetBitContext s,
VLC_TYPE(*)  table[2],
int  bits,
int  max_depth 
) [static]

parses a vlc code, faster then get_vlc()

Parameters:
bits is the number of bits which will be read at once, must be identical to nb_bits in init_vlc()
max_depth is the number of times bits bits must be read to completely read the longest vlc code = (max_vlc_length + bits - 1) / bits

Definition at line 877 of file bitstream.h.

Referenced by asv1_decode_block(), asv1_get_level(), asv2_decode_block(), asv2_get_level(), bitplane_decoding(), decode_bgr_1(), decode_coeff(), decode_dc(), decode_envelope(), decode_exp_vlc(), decode_i_block(), decode_i_frame(), decode_mv_component(), decode_p_block(), decode_residual(), decouple_info(), dnxhd_decode_dc(), dnxhd_decode_dct_block(), ff_h263_decode_mb(), ff_mpeg4_decode_mb(), ff_msmpeg4_decode_motion(), ff_wmv2_decode_mb(), fraps2_decode_plane(), get_bitalloc(), h261_decode_block(), h261_decode_mb(), h263_decode_block(), h263_decode_motion(), huffman_decode(), idx_to_quant(), imc_read_level_coeffs(), ir2_get_code(), mjpeg_decode_dc(), mpc7_decode_frame(), mpc8_decode_frame(), mpeg4_decode_dc(), mpeg4_decode_partition_a(), mpeg4_decode_partition_b(), mpeg4_decode_sprite_trajectory(), mpeg_decode_mb(), mpeg_decode_motion(), mpeg_decode_slice(), msmpeg4_decode_dc(), msmpeg4v12_decode_mb(), msmpeg4v2_decode_motion(), msmpeg4v34_decode_mb(), preview_obmc(), qdm2_get_vlc(), readQuantSpectralCoeffs(), rv34_decode_block(), rv34_decode_cbp(), rv40_decode_intra_types(), rv40_decode_mb_info(), rv_decode_dc(), smacker_decode_bigtree(), smka_decode_frame(), svq1_decode_block_intra(), svq1_decode_block_non_intra(), svq1_decode_delta_block(), svq1_decode_motion_vector(), tm2_get_token(), unpack_modes(), unpack_SQVH(), unpack_superblocks(), unpack_vectors(), unpack_vlcs(), vc1_decode_ac_coeff(), vc1_decode_b_mb(), vc1_decode_i_block(), vc1_decode_i_block_adv(), vc1_decode_i_blocks(), vc1_decode_i_blocks_adv(), vc1_decode_intra_block(), vc1_decode_p_block(), vc1_decode_p_mb(), vc1_parse_frame_header(), vc1_parse_frame_header_adv(), vorbis_floor0_decode(), vorbis_floor1_decode(), vorbis_residue_decode(), vp6_parse_coeff_huffman(), wma_decode_block(), wnv1_get_code(), x8_get_ac_rlf(), x8_get_dc_rlf(), and x8_get_orient_vlc().

static void init_put_bits ( PutBitContext s,
uint8_t buffer,
int  buffer_size 
) [inline, static]

static int put_bits_count ( PutBitContext s  )  [inline, static]

unaligned ( 16   ) 


Variable Documentation

const uint8_t ff_reverse[256]

int n

Definition at line 213 of file bitstream.h.

Referenced by ape_decode_frame(), apply_window_and_mdct(), asf_read_header(), asf_write_header1(), audio_decode_frame(), av_encode(), av_log2(), av_log2_16bit(), av_parse_video_frame_rate(), av_parse_video_frame_size(), av_xiphlacing(), average_quantized_coeffs(), avi_read_packet(), bmp_decode_frame(), bmp_encode_frame(), build_table(), channel_decorrelation(), cinepak_decode_codebook(), clean_index(), clear_blocks_axp(), compute_antialias_float(), compute_antialias_integer(), compute_scale_factors(), create_cel_evals(), create_map(), dca_subsubframe(), dct_quantize_TMPL(), decode_frame(), decode_gain_info(), decode_init(), decode_to16(), dnxhd_calc_bits_thread(), dnxhd_encode_thread(), dpcm_decode_frame(), ebml_read_num(), ebml_read_sint(), ebml_read_uint(), encode_block(), encode_frame(), encode_residual(), encode_residual_v(), ff_er_frame_end(), ff_fft_calc_altivec(), ff_fft_init(), ff_imdct_calc(), ff_imdct_calc_3dn2(), ff_imdct_calc_sse(), ff_mdct_calc(), ff_mdct_init(), ff_mjpeg_decode_dht(), ff_wma_init(), fft_init(), fft_ref(), fft_ref_init(), find_and_decode_index(), find_next_start_code(), get_block(), get_num(), gif_read_header1(), gif_read_image(), gray_to_mono(), guess_ni_flag(), h_resample(), hl_motion(), imdct_ref(), img_apply_table(), init_coef_vlc(), init_exp(), init_tone_level_dequantization(), init_uni_ac_vlc(), ljpeg_decode_yuv_scan(), matroska_clear_queue(), matroska_ebmlnum_uint(), matroska_parse_block(), matroska_probe(), matroska_read_close(), mdct_ref(), mjpeg_decode_scan(), mono_to_stereo(), mp_decode_layer1(), output_frame_end(), output_residual(), pam_encode_frame(), parse_date(), pcm_decode_frame(), pcm_encode_frame(), pnm_decode_frame(), pnm_encode_frame(), process_subpacket_9(), put_huffman_table(), qdm2_calculate_fft(), qdm2_fft_decode_tones(), read_key(), render_slice(), rm_write_header(), rtp_read(), rtp_send_samples(), rtp_write_header(), scale_mv(), stereo_to_mono(), svq1_decode_block_intra(), svq1_decode_block_non_intra(), synchronize_audio(), synthfilt_build_sb_samples(), targa_encode_normal(), udp_read_packet(), unpack(), video_audio_display(), vorbis_comment(), x8_decode_intra_mb(), and yuv4_generate_header().


Generated on Thu Apr 2 07:16:12 2009 for ffmpeg by  doxygen 1.5.6