FFmpeg
|
bitstream writer API More...
#include <stdint.h>
#include <stddef.h>
#include "libavutil/intreadwrite.h"
#include "libavutil/avassert.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. More... | |
static void | rebase_put_bits (PutBitContext *s, uint8_t *buffer, int buffer_size) |
Rebase the bit writer onto a reallocated buffer. More... | |
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. More... | |
static void | flush_put_bits_le (PutBitContext *s) |
void | avpriv_align_put_bits (PutBitContext *s) |
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... | |
void | avpriv_copy_bits (PutBitContext *pb, const uint8_t *src, int length) |
Copy the content of src to the bitstream. More... | |
static void | put_bits (PutBitContext *s, int n, unsigned int value) |
Write up to 31 bits into a bitstream. More... | |
static void | put_bits_le (PutBitContext *s, int n, unsigned int value) |
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. More... | |
static void | put_bits64 (PutBitContext *s, int n, uint64_t value) |
Write up to 64 bits into a bitstream. More... | |
static uint8_t * | put_bits_ptr (PutBitContext *s) |
Return the pointer to the byte where the bitstream writer will put the next bit. More... | |
static void | skip_put_bytes (PutBitContext *s, int n) |
Skip the given number of bytes. More... | |
static void | skip_put_bits (PutBitContext *s, int n) |
Skip the given number of bits. More... | |
static void | set_put_bits_buffer_size (PutBitContext *s, int size) |
Change the end of the buffer. More... | |
bitstream writer API
Definition in file put_bits.h.
|
inlinestatic |
Initialize the PutBitContext s.
buffer | the buffer where to put bits |
buffer_size | the size in bytes of buffer |
Definition at line 48 of file put_bits.h.
Referenced by aac_adtstoasc_filter(), aac_encode_frame(), adpcm_encode_frame(), adts_decode_extradata(), adts_write_frame_header(), adx_encode(), avpriv_dca_convert_bitstream(), binary_export(), cbs_av1_write_unit(), cbs_h2645_write_nal_unit(), cbs_jpeg_write_unit(), cbs_mpeg2_write_unit(), cbs_vp9_assemble_fragment(), cbs_vp9_write_unit(), convert_input(), decode_init(), decode_packet(), dnxhd_encode_thread(), dv_decode_video_segment(), dv_encode_video_segment(), encode_bitstream(), encode_block(), encode_ext_header(), encode_frame(), encode_init(), encode_picture_ls(), encode_slice(), encode_slice_plane(), encode_slices(), encode_thread(), ff_ac3_output_frame(), ff_hevc_encode_nal_vps(), ff_init_cabac_encoder(), ff_isom_write_av1c(), ff_lzw_encode_init(), ff_mjpeg_find_marker(), ff_mpeg4_init_partitions(), ff_mpv_encode_picture(), flush(), flv_write_codec_header(), latm_write_packet(), ljpeg_encode_frame(), magy_encode_frame(), main(), mov_write_ac3_tag(), mov_write_dvc1_structs(), mov_write_eac3_tag(), MPA_encode_frame(), pack_bitstream(), pnm_decode_frame(), put_audio_specific_config(), put_line(), put_main_header(), put_pack_header(), put_swf_matrix(), put_swf_rect(), put_system_header(), ra144_encode_frame(), s302m_encode2_frame(), save_bits(), sbc_pack_frame(), send_mode_a(), send_mode_b(), svq1_encode_frame(), svq1_encode_plane(), swf_write_header(), tta_encode_frame(), vorbis_encode_frame(), vp9_raw_reorder_make_output(), wavpack_encode_block(), wmavoice_decode_packet(), write_frame(), write_header(), write_huff_codes(), write_major_sync(), write_streaminfo(), write_substrs(), and xsub_encode().
|
inlinestatic |
Rebase the bit writer onto a reallocated buffer.
buffer | the buffer where to put bits |
buffer_size | the size in bytes of buffer, must be larger than the previous size |
Definition at line 71 of file put_bits.h.
Referenced by ff_mpv_reallocate_putbitbuffer().
|
inlinestatic |
Definition at line 85 of file put_bits.h.
Referenced by aac_encode_frame(), avpriv_copy_bits(), avpriv_dca_convert_bitstream(), binary_export(), cbs_av1_write_increment(), cbs_av1_write_leb128(), cbs_av1_write_ns(), cbs_av1_write_obu(), cbs_av1_write_su(), cbs_av1_write_subexp(), cbs_av1_write_unit(), cbs_av1_write_uvlc(), cbs_h2645_write_nal_unit(), cbs_h264_write_nal_unit(), cbs_h265_write_nal_unit(), cbs_jpeg_write_unit(), cbs_mpeg2_write_slice(), cbs_mpeg2_write_unit(), cbs_vp9_write_increment(), cbs_vp9_write_le(), cbs_vp9_write_s(), cbs_vp9_write_unit(), cbs_write_se_golomb(), cbs_write_ue_golomb(), copy_bits(), dnxhd_encode_thread(), dv_decode_video_segment(), dv_encode_video_segment(), encode_422_bitstream(), encode_alpha_plane(), encode_bgra_bitstream(), encode_block(), encode_frame(), encode_gray_bitstream(), encode_hq_slice(), encode_init(), encode_line_TMPL(), encode_mb(), encode_mb_hq(), encode_parse_info(), encode_picture(), encode_picture_ls(), encode_plane_bitstream(), encode_slice(), encode_slice_plane(), encode_superframe(), encode_thread(), ff_cbs_write_unsigned(), ff_copy_pce_data(), ff_hevc_encode_nal_vps(), ff_mjpeg_encode_picture_header(), ff_mjpeg_encode_stuffing(), ff_mjpeg_escape_FF(), ff_mpeg1_encode_picture_header(), ff_mpeg4_merge_partitions(), ff_mpeg4_stuffing(), ff_mpv_encode_picture(), ff_mpv_reallocate_putbitbuffer(), floor_encode(), frame_header_obu(), get_bits_diff(), latm_write_packet(), ljpeg_encode_bgr(), ljpeg_encode_frame(), ljpeg_encode_yuv(), magy_encode_frame(), merge_context_after_encode(), MPA_encode_frame(), output_frame_end(), put_audio_specific_config(), put_bitstream_info(), put_cabac_terminate(), put_codeword(), put_main_header(), save_bits(), sbc_pack_frame(), sei_payload(), skip_put_bytes(), svq1_encode_frame(), svq1_encode_plane(), tta_encode_frame(), update_mb_info(), vc2_encode_frame(), vorbis_encode_frame(), vp9_raw_reorder_make_output(), wavpack_encode_block(), write_frame(), write_frame_footer(), write_frame_header(), write_huff_codes(), write_mb_info(), write_restart_header(), write_substrs(), writtenBytes(), xsub_encode(), and xsub_encode_rle().
|
inlinestatic |
Definition at line 93 of file put_bits.h.
Referenced by avpriv_copy_bits(), cbs_av1_write_increment(), cbs_av1_write_ns(), cbs_av1_write_obu(), cbs_av1_write_su(), cbs_h264_write_nal_unit(), cbs_h265_write_nal_unit(), cbs_jpeg_write_scan(), cbs_mpeg2_write_slice(), cbs_vp9_assemble_fragment(), cbs_vp9_write_increment(), cbs_vp9_write_le(), cbs_vp9_write_s(), cbs_write_se_golomb(), cbs_write_ue_golomb(), dv_encode_ac(), encode_slice(), ff_cbs_write_unsigned(), save_bits(), and tta_encode_frame().
|
inlinestatic |
Pad the end of the output stream with zeros.
Definition at line 101 of file put_bits.h.
Referenced by aac_adtstoasc_filter(), aac_encode_frame(), adpcm_encode_frame(), adts_decode_extradata(), adts_write_frame_header(), adx_encode(), avpriv_copy_bits(), avpriv_dca_convert_bitstream(), binary_export(), cbs_av1_write_obu(), cbs_av1_write_unit(), cbs_h2645_write_nal_unit(), cbs_jpeg_write_unit(), cbs_mpeg2_write_unit(), cbs_vp9_assemble_fragment(), cbs_vp9_write_unit(), convert_input(), dnxhd_encode_thread(), dv_decode_video_segment(), dv_encode_video_segment(), encode_alpha_plane(), encode_bitstream(), encode_block(), encode_ext_header(), encode_frame(), encode_hq_slice(), encode_init(), encode_picture_ls(), encode_slice(), encode_slice_plane(), encode_slices(), encode_superframe(), encode_thread(), ff_isom_write_av1c(), ff_mjpeg_escape_FF(), ff_mjpeg_find_marker(), ff_mpeg4_merge_partitions(), ff_mpv_encode_picture(), flv_write_codec_header(), frame_header_obu(), gif_image_write_image(), jpeg_put_comments(), jpeg_table_header(), latm_write_packet(), ljpeg_encode_frame(), main(), merge_context_after_encode(), mov_write_ac3_tag(), mov_write_dvc1_structs(), mov_write_eac3_tag(), output_frame_end(), pack_bitstream(), pnm_decode_frame(), put_audio_specific_config(), put_cabac_terminate(), put_line(), put_main_header(), put_pack_header(), put_swf_matrix(), put_swf_rect(), put_system_header(), ra144_encode_frame(), s302m_encode2_frame(), save_bits(), sbc_pack_frame(), send_mode_a(), send_mode_b(), svq1_encode_frame(), svq1_encode_plane(), swf_write_header(), tta_encode_frame(), vc2_encode_frame(), vorbis_encode_frame(), vp9_raw_reorder_make_output(), wavpack_encode_block(), wmavoice_decode_packet(), write_frame(), write_frame_footer(), write_frame_header(), write_header(), write_huff_codes(), write_major_sync(), write_restart_header(), write_slice_end(), write_streaminfo(), write_substrs(), and xsub_encode().
|
inlinestatic |
Definition at line 122 of file put_bits.h.
void avpriv_align_put_bits | ( | PutBitContext * | s | ) |
Pad the bitstream with zeros up to the next byte boundary.
Definition at line 48 of file bitstream.c.
Referenced by 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_copy_pce_data(), 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(), put_pce(), write_slice_end(), xsub_encode(), and xsub_encode_rle().
void avpriv_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 53 of file bitstream.c.
Referenced by encode_frame(), encode_parse_info(), jpeg_put_comments(), mpeg4_encode_vol_header(), and put_pce().
void avpriv_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 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().
|
inlinestatic |
Write up to 31 bits into a bitstream.
Use put_bits32 to write 32 bits.
Definition at line 164 of file put_bits.h.
Referenced by put_bits64(), and put_sbits().
|
inlinestatic |
Definition at line 212 of file put_bits.h.
|
inlinestatic |
Definition at line 240 of file put_bits.h.
Referenced by adpcm_encode_frame(), adx_encode(), asv1_put_level(), dv_encode_video_segment(), encode_acs(), encode_block(), encode_codeword(), encode_vlc_codeword(), ff_flv2_encode_ac_esc(), ff_h261_encode_picture_header(), ff_h263_encode_picture_header(), ff_mjpeg_encode_dc(), ff_mjpeg_encode_picture_frame(), ff_msmpeg4_encode_block(), ff_rv20_encode_picture_header(), h261_encode_block(), h263_encode_block(), mpeg1_encode_block(), mpeg1_encode_mb_internal(), mpeg1_encode_sequence_header(), output_audio_block(), pack_float_sample(), pack_int32(), put_header(), put_line(), put_subframe_samples(), quantize_and_encode_band_cost_template(), set_ur_golomb_jpegls(), write_block_data(), write_decoding_params(), write_element(), write_filter_params(), write_matrix_params(), and write_subframes().
|
static |
Write exactly 32 bits into a bitstream.
Definition at line 250 of file put_bits.h.
Referenced by binary_export(), cbs_av1_write_obu(), cbs_write_se_golomb(), cbs_write_ue_golomb(), dv_decode_video_segment(), encode_parse_info(), encode_picture_header(), ff_cbs_write_unsigned(), ff_hevc_encode_nal_vps(), mov_write_dvc1_structs(), put_bits64(), put_float(), put_main_header(), put_pack_header(), put_system_header(), tta_encode_frame(), write_element_header(), and write_ptl_layer().
|
inlinestatic |
Write up to 64 bits into a bitstream.
Definition at line 288 of file put_bits.h.
Referenced by set_ue_golomb_long().
|
inlinestatic |
Return the pointer to the byte where the bitstream writer will put the next bit.
Definition at line 324 of file put_bits.h.
Referenced by avpriv_copy_bits(), encode_block(), encode_hq_slice(), encode_slice_plane(), encode_slices(), encode_superframe(), encode_thread(), ff_h261_encode_picture_header(), ff_h263_encode_picture_header(), ff_mpeg4_init_partitions(), jpeg_put_comments(), jpeg_table_header(), ljpeg_encode_frame(), output_frame_end(), put_pack_header(), put_swf_matrix(), put_swf_rect(), put_system_header(), and swf_write_header().
|
inlinestatic |
Skip the given number of bytes.
PutBitContext must be flushed & aligned to a byte boundary before calling this.
Definition at line 333 of file put_bits.h.
Referenced by avpriv_copy_bits(), cbs_av1_write_obu(), encode_hq_slice(), encode_slices(), and ff_mjpeg_escape_FF().
|
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 346 of file put_bits.h.
Referenced by ff_h263_encode_motion_vector(), mpeg4_encode_blocks(), and pack_bitstream().
|
inlinestatic |
Change the end of the buffer.
size | the new size in bytes of the buffer where to put bits |
Definition at line 358 of file put_bits.h.
Referenced by encode_picture(), ff_mpeg4_init_partitions(), and ff_mpeg4_merge_partitions().