FFmpeg
|
#include <stdint.h>
#include <stddef.h>
#include "config.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/avassert.h"
#include "libavutil/common.h"
Go to the source code of this file.
Data Structures | |
struct | PutBitContext |
Macros | |
#define | AV_WBBUF AV_WB32 |
#define | AV_WLBUF AV_WL32 |
Typedefs | |
typedef uint32_t | BitBuf |
Functions | |
static void | init_put_bits (PutBitContext *s, uint8_t *buffer, int buffer_size) |
Initialize the PutBitContext s. More... | |
static int | put_bits_count (PutBitContext *s) |
static int | put_bytes_output (const PutBitContext *s) |
static int | put_bytes_count (const PutBitContext *s, int round_up) |
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_left (PutBitContext *s) |
static int | put_bytes_left (const PutBitContext *s, int round_up) |
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 | 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 void | put_bits_no_assert (PutBitContext *s, int n, BitBuf value) |
static void | put_bits (PutBitContext *s, int n, BitBuf value) |
Write up to 31 bits into a bitstream. More... | |
static void | put_bits_le (PutBitContext *s, int n, BitBuf 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 void | put_sbits63 (PutBitContext *pb, int n, int64_t value) |
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... | |
static void | align_put_bits (PutBitContext *s) |
Pad the bitstream with zeros up to the next byte boundary. More... | |
Variables | |
static const int | BUF_BITS = 8 * sizeof(BitBuf) |
bitstream writer API
Definition in file put_bits.h.
#define AV_WBBUF AV_WB32 |
Definition at line 44 of file put_bits.h.
#define AV_WLBUF AV_WL32 |
Definition at line 45 of file put_bits.h.
typedef uint32_t BitBuf |
Definition at line 43 of 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 62 of file put_bits.h.
Referenced by aac_adtstoasc_filter(), aac_encode_frame(), ac3_output_frame(), adts_decode_extradata(), adts_write_frame_header(), adx_encode(), av_dynamic_hdr_plus_to_t35(), avpriv_dca_convert_bitstream(), binary_export(), cbs_vp9_assemble_fragment(), cbs_write_unit_data(), cfhd_encode_frame(), decode_init(), decode_packet(), dnxhd_encode_thread(), dv_decode_video_segment(), dv_encode_video_segment(), encode_alpha_slice_data(), encode_bitstream(), encode_block(), encode_ext_header(), encode_frame(), encode_hq_slice(), encode_init(), encode_picture(), encode_picture_ls(), encode_plane_slice(), encode_slice(), encode_slice_plane(), encode_thread(), encode_yuv422p10(), ff_alloc_timecode_sei(), ff_dolby_e_convert_input(), ff_dovi_rpu_generate(), ff_hevc_encode_nal_vps(), ff_iamf_write_audio_frame(), ff_isom_put_dvcc_dvvc(), ff_isom_write_av1c(), ff_lzw_encode_init(), ff_mjpeg_find_marker(), ff_mpeg4_init_partitions(), flush(), flv_write_codec_header(), iamf_write_audio_element(), iamf_write_codec_config(), iamf_write_mixing_presentation(), init_cabac_encoder(), 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(), rpza_encode_frame(), s302m_encode2_frame(), save_bits(), sbc_pack_frame(), scalable_channel_layout_config(), send_mode_a(), send_mode_b(), svq1_encode_frame(), svq1_encode_plane(), swf_write_header(), tta_encode_frame(), update_extradata(), vorbis_encode_frame(), vp9_raw_reorder_make_output(), vvcc_write(), wavpack_encode_block(), wmavoice_decode_packet(), write_frame(), write_header(), write_huff_codes(), write_major_sync(), write_parameter_block(), write_streaminfo(), write_substr(), and xsub_encode().
|
inlinestatic |
Definition at line 80 of file put_bits.h.
Referenced by aac_encode_frame(), cbs_av1_write_obu(), cbs_h2645_write_slice_data(), cbs_jpeg_write_scan(), cbs_mpeg2_write_slice(), cbs_vp9_write_unit(), cbs_write_unit_data(), dv_decode_video_segment(), encode_block(), encode_frame(), encode_line(), encode_mb_hq(), encode_picture(), encode_picture_ls(), encode_plane_slice(), encode_superframe(), encode_thread(), ff_cbs_trace_write_log(), ff_copy_bits(), ff_copy_pce_data(), ff_mjpeg_encode_stuffing(), ff_mjpeg_escape_FF(), ff_mpeg4_merge_partitions(), ff_mpeg4_stuffing(), ff_mpv_encode_picture(), frame_header_obu(), generate_ext_v1(), generate_ext_v2(), get_bits_diff(), ljpeg_encode_frame(), merge_context_after_encode(), message(), output_frame_end(), put_bitstream_info(), rebase_put_bits(), save_bits(), skip_put_bytes(), svq1_encode_frame(), svq1_encode_plane(), vaapi_encode_av1_trace_write_log(), vp9_raw_reorder_make_output(), write_huff_codes(), write_mb_info(), write_restart_header(), and write_substr().
|
inlinestatic |
Definition at line 89 of file put_bits.h.
Referenced by aac_encode_frame(), avpriv_dca_convert_bitstream(), binary_export(), cbs_write_unit_data(), cfhd_encode_frame(), encode_alpha_slice_data(), encode_frame(), encode_hq_slice(), encode_init(), encode_plane_slice(), encode_slice(), ff_dovi_rpu_generate(), ff_hevc_encode_nal_vps(), ff_mjpeg_escape_FF(), ff_speedhq_end_slice(), latm_write_packet(), mov_write_eac3_tag(), MPA_encode_frame(), put_audio_specific_config(), put_main_header(), rpza_encode_frame(), sbc_pack_frame(), svq1_encode_frame(), tta_encode_frame(), update_extradata(), vc2_encode_frame(), vorbis_encode_frame(), vvcc_write(), wavpack_encode_block(), write_frame(), write_frame_footer(), write_frame_header(), write_huff_codes(), write_substr(), and xsub_encode().
|
inlinestatic |
round_up | When set, the number of bits written so far will be rounded up to the next byte. |
Definition at line 100 of file put_bits.h.
Referenced by encode_hq_slice(), encode_parse_info(), encode_picture_ls(), encode_superframe(), encode_thread(), ff_iamf_write_audio_frame(), ff_mjpeg_encode_stuffing(), iamf_write_audio_element(), iamf_write_codec_config(), iamf_write_mixing_presentation(), magy_encode_frame(), mjpeg_encode_picture_header(), put_cabac_terminate(), scalable_channel_layout_config(), update_mb_info(), write_parameter_block(), writtenBytes(), 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 large enough to hold everything written so far |
Definition at line 112 of file put_bits.h.
Referenced by ff_mpv_reallocate_putbitbuffer().
|
inlinestatic |
Definition at line 125 of file put_bits.h.
Referenced by cbs_av1_write_increment(), cbs_av1_write_leb128(), cbs_av1_write_ns(), cbs_av1_write_obu(), cbs_av1_write_uvlc(), cbs_h2645_write_slice_data(), 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_vp9_write_unit(), cbs_write_se_golomb(), cbs_write_ue_golomb(), copy_bits(), dv_encode_ac(), encode_alpha_slice_data(), encode_plane_slice(), ff_cbs_write_signed(), ff_cbs_write_unsigned(), ff_copy_bits(), floor_encode(), put_codeword(), save_bits(), tta_encode_frame(), and update_extradata().
|
inlinestatic |
round_up | When set, the number of bits written will be rounded up to the next byte. |
Definition at line 135 of file put_bits.h.
Referenced by dnxhd_encode_thread(), dv_encode_video_segment(), encode_422_bitstream(), encode_bgra_bitstream(), encode_frame(), encode_gray_bitstream(), encode_line(), encode_mb(), encode_plane_bitstream(), encode_thread(), ff_mpv_encode_picture(), ff_mpv_reallocate_putbitbuffer(), ljpeg_encode_bgr(), ljpeg_encode_yuv(), svq1_encode_plane(), and xsub_encode_rle().
|
inlinestatic |
Pad the end of the output stream with zeros.
Definition at line 143 of file put_bits.h.
Referenced by aac_adtstoasc_filter(), aac_encode_frame(), adts_decode_extradata(), adts_write_frame_header(), adx_encode(), av_dynamic_hdr_plus_to_t35(), avpriv_dca_convert_bitstream(), binary_export(), cbs_av1_write_obu(), cbs_h2645_write_slice_data(), cbs_jpeg_write_scan(), cbs_mpeg2_write_slice(), cbs_vp9_assemble_fragment(), cbs_vp9_write_unit(), cbs_write_unit_data(), cfhd_encode_frame(), dnxhd_encode_thread(), dv_decode_video_segment(), dv_encode_video_segment(), encode_alpha_slice_data(), encode_bitstream(), encode_block(), encode_ext_header(), encode_frame(), encode_hq_slice(), encode_init(), encode_picture_ls(), encode_plane_slice(), encode_slice(), encode_slice_plane(), encode_slices(), encode_superframe(), encode_thread(), encode_yuv422p10(), ff_alloc_timecode_sei(), ff_cbs_trace_write_log(), ff_copy_bits(), ff_dolby_e_convert_input(), ff_dovi_rpu_generate(), ff_hevc_encode_nal_vps(), ff_iamf_write_audio_frame(), ff_isom_put_dvcc_dvvc(), ff_isom_write_av1c(), ff_lzw_encode_flush(), ff_mjpeg_escape_FF(), ff_mjpeg_find_marker(), ff_mpeg4_merge_partitions(), ff_mpv_encode_picture(), flv_write_codec_header(), frame_header_obu(), iamf_write_audio_element(), iamf_write_codec_config(), iamf_write_mixing_presentation(), 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(), MPA_encode_frame(), 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(), rpza_encode_frame(), s302m_encode2_frame(), save_bits(), sbc_pack_frame(), scalable_channel_layout_config(), send_mode_a(), send_mode_b(), svq1_encode_frame(), svq1_encode_plane(), swf_write_header(), tta_encode_frame(), update_extradata(), vc2_encode_frame(), vorbis_encode_frame(), vp9_raw_reorder_make_output(), vvcc_write(), wavpack_encode_block(), wmavoice_decode_packet(), write_frame(), write_frame_footer(), write_frame_header(), write_header(), write_huff_codes(), write_major_sync(), write_parameter_block(), write_restart_header(), write_slice_end(), write_streaminfo(), write_substr(), and xsub_encode().
|
inlinestatic |
Definition at line 164 of file put_bits.h.
Referenced by encode_frame(), ff_lzw_encode_flush(), and ff_speedhq_end_slice().
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 39 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 49 of file bitstream.c.
Referenced by copy_bits(), encode_thread(), ff_dovi_rpu_generate(), ff_mpeg4_merge_partitions(), merge_context_after_encode(), save_bits(), and svq1_encode_plane().
|
inlinestatic |
Definition at line 197 of file put_bits.h.
Referenced by put_bits(), and put_bits32().
|
inlinestatic |
Write up to 31 bits into a bitstream.
Use put_bits32 to write 32 bits.
Definition at line 247 of file put_bits.h.
Referenced by align_put_bits(), put_bits64(), and put_sbits().
|
inlinestatic |
Definition at line 253 of file put_bits.h.
Referenced by asv2_encode_block(), asv2_put_level(), encode_block(), encode_dc(), ff_lzw_encode_flush(), ff_speedhq_encode_picture_header(), ff_speedhq_end_slice(), and writeCode().
|
inlinestatic |
Definition at line 281 of file put_bits.h.
Referenced by adx_encode(), asv1_put_level(), dv_encode_video_segment(), encode_acs(), encode_block(), encode_vlc_codeword(), ff_cbs_write_signed(), ff_dovi_rpu_generate(), ff_flv2_encode_ac_esc(), ff_h261_encode_picture_header(), ff_h263_encode_picture_header(), ff_mjpeg_encode_dc(), ff_msmpeg4_encode_block(), ff_rv20_encode_picture_header(), generate_ext_v1(), h261_encode_block(), h263_encode_block(), main(), output_audio_block(), pack_float_sample(), pack_int32(), put_cie_xy(), put_line(), put_subframe_samples(), quantize_and_encode_band_cost_template(), set_ur_golomb_jpegls(), 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 291 of file put_bits.h.
Referenced by binary_export(), cbs_av1_write_obu(), cbs_h2645_write_slice_data(), cbs_mpeg2_write_slice(), cbs_write_se_golomb(), cbs_write_ue_golomb(), dv_decode_video_segment(), encode_parse_info(), encode_picture_header(), ff_cbs_write_signed(), ff_cbs_write_unsigned(), ff_dovi_rpu_generate(), ff_hevc_encode_nal_vps(), ff_isom_put_dvcc_dvvc(), ff_mpeg4_encode_picture_header(), main(), mov_write_dvc1_structs(), mpeg4_encode_gop_header(), mpeg4_encode_visual_object_header(), mpeg4_encode_vol_header(), put_bits64(), put_float(), put_main_header(), put_pack_header(), put_system_header(), rpza_encode_frame(), tta_encode_frame(), update_extradata(), write_element_header(), write_ptl_layer(), write_subframes(), and write_substr().
|
inlinestatic |
Write up to 64 bits into a bitstream.
Definition at line 334 of file put_bits.h.
Referenced by main(), put_sbits63(), put_se_coef(), put_ue_coef(), put_vc2_ue_uint(), set_ue_golomb_long(), and update_extradata().
|
inlinestatic |
Definition at line 366 of file put_bits.h.
Referenced by write_subframes().
|
inlinestatic |
Return the pointer to the byte where the bitstream writer will put the next bit.
Definition at line 377 of file put_bits.h.
Referenced by cbs_h2645_write_slice_data(), cbs_jpeg_write_scan(), cbs_mpeg2_write_slice(), cbs_vp9_write_unit(), dnxhd_encode_thread(), dv_encode_video_segment(), encode_block(), encode_frame(), encode_hq_slice(), encode_slice_plane(), encode_slices(), encode_superframe(), encode_thread(), ff_copy_bits(), 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 386 of file put_bits.h.
Referenced by cbs_av1_write_obu(), cbs_h2645_write_slice_data(), cbs_jpeg_write_scan(), cbs_mpeg2_write_slice(), cbs_vp9_write_unit(), encode_hq_slice(), encode_slices(), ff_copy_bits(), ff_mjpeg_escape_FF(), and jpeg_put_comments().
|
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 399 of file put_bits.h.
Referenced by mpeg4_encode_blocks().
|
inlinestatic |
Change the end of the buffer.
size | the new size in bytes of the buffer where to put bits |
Definition at line 411 of file put_bits.h.
Referenced by encode_picture(), ff_mpeg4_init_partitions(), and ff_mpeg4_merge_partitions().
|
inlinestatic |
Pad the bitstream with zeros up to the next byte boundary.
Definition at line 420 of file put_bits.h.
Referenced by encode_block(), encode_frame(), encode_parse_info(), encode_picture_header(), encode_picture_start(), encode_seq_header(), encode_wavelet_transform(), ff_copy_pce_data(), ff_dovi_rpu_generate(), ff_flv_encode_picture_header(), ff_h261_encode_picture_header(), ff_h263_encode_picture_header(), ff_msmpeg4_encode_picture_header(), ff_rv10_encode_picture_header(), put_bitstream_info(), put_pce(), and xsub_encode_rle().
|
static |
Definition at line 48 of file put_bits.h.
Referenced by encode_picture(), flush_put_bits(), flush_put_bits_le(), init_put_bits(), put_bits32(), put_bits_count(), put_bits_le(), put_bits_left(), put_bits_no_assert(), put_bytes_count(), put_bytes_left(), put_bytes_output(), set_put_bits_buffer_size(), skip_put_bits(), and skip_put_bytes().