FFmpeg
|
#include <inttypes.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include "config.h"
#include "libavutil/avassert.h"
#include "libavutil/bswap.h"
#include "libavutil/common.h"
#include "libavutil/error.h"
#include "libavutil/internal.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/log.h"
#include "libavutil/mem.h"
#include "libavutil/qsort.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 | LOCALBUF_ELEMS 1500 |
#define | COPY(condition) |
Functions | |
void | ff_put_string (PutBitContext *pb, const char *string, int terminate_string) |
Put the string string in the bitstream. More... | |
void | ff_copy_bits (PutBitContext *pb, const uint8_t *src, int length) |
Copy the content of src to the bitstream. More... | |
static int | alloc_table (VLC *vlc, int size, int use_static) |
static int | vlc_common_init (VLC *vlc_arg, int nb_bits, int nb_codes, VLC **vlc, VLC *localvlc, VLCcode **buf, int flags) |
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... | |
static int | vlc_common_end (VLC *vlc, int nb_bits, int nb_codes, VLCcode *codes, int flags, VLC *vlc_arg, VLCcode localbuf[LOCALBUF_ELEMS]) |
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) |
int | ff_init_vlc_from_lengths (VLC *vlc_arg, int nb_bits, int nb_codes, const int8_t *lens, int lens_wrap, const void *symbols, int symbols_wrap, int symbols_size, int offset, int flags, void *logctx) |
Build VLC decoding tables suitable for use with get_vlc2() More... | |
void | ff_free_vlc (VLC *vlc) |
Variables | |
const uint8_t | ff_log2_run [41] |
bitstream api.
Definition in file bitstream.c.
Definition at line 96 of file bitstream.c.
#define LOCALBUF_ELEMS 1500 |
Definition at line 135 of file bitstream.c.
#define COPY | ( | condition | ) |
void ff_put_string | ( | PutBitContext * | pb, |
const char * | string, | ||
int | terminate_string | ||
) |
Put the string string in the bitstream.
terminate_string | 0-terminates the written string if value is 1 |
Definition at line 59 of file bitstream.c.
Referenced by encode_frame(), encode_parse_info(), jpeg_put_comments(), mpeg4_encode_vol_header(), and put_pce().
void ff_copy_bits | ( | PutBitContext * | pb, |
const uint8_t * | src, | ||
int | length | ||
) |
Copy the content of src to the bitstream.
length | the number of bits of src to copy |
Definition at line 69 of file bitstream.c.
Referenced by copy_bits(), encode_thread(), ff_mpeg4_merge_partitions(), merge_context_after_encode(), save_bits(), and svq1_encode_plane().
Definition at line 115 of file bitstream.c.
Referenced by build_table(), and mp_decode_layer2().
|
static |
Definition at line 145 of file bitstream.c.
Referenced by ff_init_vlc_from_lengths(), and ff_init_vlc_sparse().
|
static |
Definition at line 170 of file bitstream.c.
Referenced by ff_init_vlc_sparse().
|
static |
Build VLC decoding tables suitable for use with get_vlc().
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 189 of file bitstream.c.
Referenced by vlc_common_end().
|
static |
Definition at line 278 of file bitstream.c.
Referenced by ff_init_vlc_from_lengths(), and ff_init_vlc_sparse().
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 | ||
) |
Definition at line 323 of file bitstream.c.
Referenced by aac_static_table_init(), build_huff(), build_huff_tree(), build_vlc(), ccitt_unpack_init(), generate_joint_tables(), huf_build_dec_table(), init_ralf_vlc(), read_hufftable(), and rv34_gen_vlc().
int ff_init_vlc_from_lengths | ( | VLC * | vlc, |
int | nb_bits, | ||
int | nb_codes, | ||
const int8_t * | lens, | ||
int | lens_wrap, | ||
const void * | symbols, | ||
int | symbols_wrap, | ||
int | symbols_size, | ||
int | offset, | ||
int | flags, | ||
void * | logctx | ||
) |
Build VLC decoding tables suitable for use with get_vlc2()
This function takes lengths and symbols and calculates the codes from them. For this the input lengths and symbols have to be sorted according to "left nodes in the corresponding tree first".
[in,out] | vlc | The VLC to be initialized; table and table_allocated must have been set when initializing a static VLC, otherwise this will be treated as uninitialized. |
[in] | nb_bits | The number of bits to use for the VLC table; higher values take up more memory and cache, but allow to read codes with fewer reads. |
[in] | nb_codes | The number of provided length and (if supplied) symbol entries. |
[in] | lens | The lengths of the codes. Entries > 0 correspond to valid codes; entries == 0 will be skipped and entries with len < 0 indicate that the tree is incomplete and has an open end of length -len at this position. |
[in] | lens_wrap | Stride (in bytes) of the lengths. |
[in] | symbols | The symbols, i.e. what is returned from get_vlc2() when the corresponding code is encountered. May be NULL, then 0, 1, 2, 3, 4,... will be used. |
[in] | symbols_wrap | Stride (in bytes) of the symbols. |
[in] | symbols_size | Size of the symbols. 1 and 2 are supported. |
[in] | offset | An offset to apply to all the valid symbols. |
[in] | flags | A combination of the INIT_VLC_* flags; notice that INIT_VLC_INPUT_LE is pointless and ignored. |
Definition at line 381 of file bitstream.c.
Referenced by atrac3_init_static_data(), atrac9_init_vlc(), build_canonical_huff(), build_huff(), build_vlc(), clv_init_static(), ff_mjpeg_build_vlc(), huff_build(), imc_init_static(), mobiclip_init_static(), mp_decode_frame(), mpc7_init_static(), mpeg4_init_static(), mpegaudiodec_common_init_static(), mss4_init_vlc(), on2avc_decode_init(), qdmc_init_static_data(), read_code_table(), rv10_build_vlc(), rv40_init_table(), rv40_init_tables(), smacker_decode_header_tree(), smka_decode_frame(), tm2_build_huff_table(), tscc2_init_vlc(), vp3_decode_init(), wma_decode_init(), and x8_init_vlc().
void ff_free_vlc | ( | VLC * | vlc | ) |
Definition at line 431 of file bitstream.c.
Referenced by build_huff(), build_vlc(), cfhd_close(), 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_ivi_dec_huff_desc(), ff_ivi_decode_close(), ff_mjpeg_decode_dht(), ff_mjpeg_decode_end(), ff_wma_end(), fraps2_decode_plane(), generate_joint_tables(), hq_hqa_decode_close(), hqx_decode_close(), huf_build_dec_table(), huff_build(), image_ctx_free(), init_default_huffman_tables(), ivi_free_buffers(), jpg_free_context(), magy_decode_end(), mp_decode_frame(), on2avc_free_vlcs(), photocd_decode_close(), read_huffman_code_normal(), read_huffman_tables(), read_hufftable(), 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().
const uint8_t ff_log2_run[41] |
Definition at line 50 of file bitstream.c.
Referenced by decode_line_TMPL(), encode_line_TMPL(), ls_decode_line(), ls_encode_line(), and ls_encode_run().