FFmpeg
Data Structures | Macros | Functions | Variables
bitstream.c File Reference

bitstream api. More...

#include "libavutil/avassert.h"
#include "libavutil/qsort.h"
#include "avcodec.h"
#include "internal.h"
#include "mathops.h"
#include "put_bits.h"
#include "vlc.h"

Go to the source code of this file.

Data Structures

struct   VLCcode
 

Macros

#define  GET_DATA(v, table, i, wrap, size)
 
#define  COPY(condition)
 

Functions

  Pad the bitstream with zeros up to the next byte boundary. More...
 
void  avpriv_put_string (PutBitContext *pb, const char *string, int terminate_string)
  Put the string string in the bitstream. More...
 
  Copy the content of src to the bitstream. More...
 
static int  alloc_table (VLC *vlc, int size, int use_static)
 
static int  compare_vlcspec (const void *a, const void *b)
 
static int  build_table (VLC *vlc, int table_nb_bits, int nb_codes, VLCcode *codes, int flags)
  Build VLC decoding tables suitable for use with get_vlc(). More...
 
int  ff_init_vlc_sparse (VLC *vlc_arg, int nb_bits, int nb_codes, const void *bits, int bits_wrap, int bits_size, const void *codes, int codes_wrap, int codes_size, const void *symbols, int symbols_wrap, int symbols_size, int flags)
 
void  ff_free_vlc (VLC *vlc)
 

Variables

const uint8_t  ff_log2_run [41]
 

Detailed Description

bitstream api.

Definition in file bitstream.c.

Macro Definition Documentation

#define GET_DATA (   v,
  table,
  i,
  wrap,
  size 
)
Value:
{ \
const uint8_t *ptr = (const uint8_t *)table + i * wrap; \
switch(size) { \
case 1: \
v = *(const uint8_t *)ptr; \
break; \
case 2: \
v = *(const uint16_t *)ptr; \
break; \
case 4: \
v = *(const uint32_t *)ptr; \
break; \
default: \
} \
}
uint8_t
Definition: audio_convert.c:194
ptrdiff_t size
Definition: opengl_enc.c:101
static const struct endianess table[]
#define wrap(func)
Definition: neontest.h:65
#define av_assert1(cond)
assert() equivalent, that does not lie in speed critical code.
Definition: avassert.h:53

Definition at line 91 of file bitstream.c.

#define COPY (   condition )
Value:
for (i = 0; i < nb_codes; i++) { \
GET_DATA(buf[j].bits, bits, i, bits_wrap, bits_size); \
if (!(condition)) \
continue; \
if (buf[j].bits > 3*nb_bits || buf[j].bits>32) { \
av_log(NULL, AV_LOG_ERROR, "Too long VLC (%d) in init_vlc\n", buf[j].bits);\
return -1; \
} \
GET_DATA(buf[j].code, codes, i, codes_wrap, codes_size); \
if (buf[j].code >= (1LL<<buf[j].bits)) { \
av_log(NULL, AV_LOG_ERROR, "Invalid code %"PRIx32" for %d in " \
"init_vlc\n", buf[j].code, i); \
return -1; \
} \
buf[j].code = bitswap_32(buf[j].code); \
buf[j].code <<= 32 - buf[j].bits; \
if (symbols) \
GET_DATA(buf[j].symbol, symbols, i, symbols_wrap, symbols_size) \
buf[j].symbol = i; \
j++; \
}
#define NULL
Definition: coverity.c:32
#define GET_DATA(v, table, i, wrap, size)
Definition: bitstream.c:91
static av_always_inline uint32_t bitswap_32(uint32_t x)
Definition: mathops.h:243
uint8_t bits
Definition: crc.c:296
static int flags
Definition: log.c:57
#define av_log(a,...)
Definition: tableprint_vlc.h:28
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:176
return
Definition: audio_convert.c:415
#define INIT_VLC_LE
Definition: vlc.h:54
void * buf
Definition: avisynth_c.h:690
if(ret< 0)
Definition: vf_mcdeint.c:282
#define INIT_VLC_USE_NEW_STATIC
Definition: vlc.h:55
#define av_free(p)
Definition: tableprint_vlc.h:34

Referenced by ff_init_vlc_sparse().

Function Documentation

void avpriv_align_put_bits ( PutBitContexts )

Pad the bitstream with zeros up to the next byte boundary.

Definition at line 48 of file bitstream.c.

Referenced by avpriv_copy_pce_data(), binary_export(), encode_block(), encode_frame(), encode_hq_slice(), encode_parse_info(), encode_picture_header(), encode_picture_ls(), encode_picture_start(), encode_seq_header(), encode_slices(), encode_wavelet_transform(), ff_flv_encode_picture_header(), ff_h261_encode_picture_header(), ff_h263_encode_picture_header(), ff_hevc_encode_nal_vps(), ff_msmpeg4_encode_picture_header(), ff_rv10_encode_picture_header(), latm_write_packet(), put_bitstream_info(), put_header(), write_slice_end(), xsub_encode(), and xsub_encode_rle().

void avpriv_put_string ( PutBitContextpb,
const char *  string,
int  terminate_string 
)

Put the string string in the bitstream.

Parameters
terminate_string 0-terminates the written string if value is 1

Definition at line 53 of file bitstream.c.

Referenced by encode_frame(), encode_parse_info(), jpeg_put_comments(), and mpeg4_encode_vol_header().

void avpriv_copy_bits ( PutBitContextpb,
const uint8_tsrc,
int  length 
)

Copy the content of src to the bitstream.

Parameters
length the number of bits of src to copy

Definition at line 64 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 int alloc_table ( VLCvlc,
int  size,
int  use_static 
)
static

Definition at line 110 of file bitstream.c.

Referenced by build_table(), and mp_decode_layer2().

static int compare_vlcspec ( const voida,
const voidb 
)
static

Definition at line 138 of file bitstream.c.

Referenced by ff_init_vlc_sparse().

static int build_table ( VLCvlc,
int  table_nb_bits,
int  nb_codes,
VLCcodecodes,
int  flags 
)
static

Build VLC decoding tables suitable for use with get_vlc().

Parameters
vlc the context to be initialized
table_nb_bits max length of vlc codes to store directly in this table (Longer codes are delegated to subtables.)
nb_codes number of elements in codes[]
codes descriptions of the vlc codes These must be ordered such that codes going into the same subtable are contiguous. Sorting by VLCcode.code is sufficient, though not necessary.

Definition at line 157 of file bitstream.c.

Referenced by ff_init_vlc_sparse().

int ff_init_vlc_sparse ( VLCvlc_arg,
int  nb_bits,
int  nb_codes,
const voidbits,
int  bits_wrap,
int  bits_size,
const voidcodes,
int  codes_wrap,
int  codes_size,
const voidsymbols,
int  symbols_wrap,
int  symbols_size,
int  flags 
)

Definition at line 268 of file bitstream.c.

Referenced by build_canonical_huff(), build_huff(), build_huff10(), build_huff_tree(), build_vlc(), clv_decode_init(), ff_atrac3p_init_vlcs(), ff_ccitt_unpack_init(), generate_joint_tables(), huff_build(), huff_build10(), init_ralf_vlc(), init_vlcs(), mpc8_decode_init(), mss4_init_vlc(), on2avc_decode_init(), read_code_table(), rv34_gen_vlc(), and rv40_init_tables().

void ff_free_vlc ( VLCvlc )

Definition at line 354 of file bitstream.c.

Referenced by build_vlc(), cfhd_close_decoder(), clv_decode_end(), cook_decode_close(), decode_argb_frame(), decode_close(), decode_end(), decode_plane(), decode_plane10(), decode_rgb24_frame(), decode_rle(), decode_yuv_frame(), dnxhd_decode_close(), dnxhd_init_vlc(), ff_dvvideo_init(), ff_ivi_dec_huff_desc(), ff_ivi_decode_close(), ff_mjpeg_decode_dht(), ff_mjpeg_decode_end(), ff_wma_end(), fraps2_decode_plane(), free_vlcs(), generate_joint_tables(), hq_hqa_decode_close(), hqx_decode_close(), huff_build(), huff_build10(), image_ctx_free(), ivi_free_buffers(), jpg_free_context(), magy_decode_end(), mimic_decode_end(), mp_decode_frame(), mss4_free_vlcs(), on2avc_free_vlcs(), read_huffman_code_normal(), read_huffman_tables(), read_old_huffman_tables(), smacker_decode_header_tree(), smka_decode_frame(), tm2_free_codes(), vorbis_free(), vp3_decode_end(), vp6_build_huff_tree(), and vp6_decode_free_context().

Variable Documentation

const uint8_t ff_log2_run[41]
Initial value:
={
0, 0, 0, 0, 1, 1, 1, 1,
2, 2, 2, 2, 3, 3, 3, 3,
4, 4, 5, 5, 6, 6, 7, 7,
8, 9,10,11,12,13,14,15,
16,17,18,19,20,21,22,23,
24,
}

Definition at line 39 of file bitstream.c.

Referenced by decode_line_TMPL(), encode_line_TMPL(), ls_decode_line(), ls_encode_line(), and ls_encode_run().


Generated on Fri Jan 12 2018 01:46:04 for FFmpeg by   doxygen 1.8.6

AltStyle によって変換されたページ (->オリジナル) /