Libav
Macros | Functions
common.h File Reference

common internal and external API header More...

#include <errno.h>
#include <inttypes.h>
#include <limits.h>
#include <math.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "attributes.h"
#include "macros.h"
#include "version.h"
#include "libavutil/avconfig.h"
#include "common.h"
#include "mem.h"

Go to the source code of this file.

Macros

#define AV_NE(be, le)   (le)
 
#define RSHIFT(a, b)   ((a) > 0 ? ((a) + ((1<<(b))>>1))>>(b) : ((a) + ((1<<(b))>>1)-1)>>(b))
 
#define ROUNDED_DIV(a, b)   (((a)>0 ? (a) + ((b)>>1) : (a) - ((b)>>1))/(b))
 
#define AV_CEIL_RSHIFT(a, b)
 Fast a / (1 << b) rounded toward +inf, assuming a >= 0 and b >= 0. More...
 
#define FFABS(a)   ((a) >= 0 ? (a) : (-(a)))
 
#define FFSIGN(a)   ((a) > 0 ? 1 : -1)
 
#define FFMAX(a, b)   ((a) > (b) ? (a) : (b))
 
#define FFMAX3(a, b, c)   FFMAX(FFMAX(a,b),c)
 
#define FFMIN(a, b)   ((a) > (b) ? (b) : (a))
 
#define FFMIN3(a, b, c)   FFMIN(FFMIN(a,b),c)
 
#define FFSWAP(type, a, b)   do{type SWAP_tmp= b; b= a; a= SWAP_tmp;}while(0)
 
#define FF_ARRAY_ELEMS(a)   (sizeof(a) / sizeof((a)[0]))
 
#define MKTAG(a, b, c, d)   ((a) | ((b) << 8) | ((c) << 16) | ((unsigned)(d) << 24))
 
#define MKBETAG(a, b, c, d)   ((d) | ((c) << 8) | ((b) << 16) | ((unsigned)(a) << 24))
 
#define GET_UTF8(val, GET_BYTE, ERROR)
 Convert a UTF-8 character (up to 4 bytes) to its 32-bit UCS-4 encoded form. More...
 
#define GET_UTF16(val, GET_16BIT, ERROR)
 Convert a UTF-16 character (2 or 4 bytes) to its 32-bit UCS-4 encoded form. More...
 
#define PUT_UTF8(val, tmp, PUT_BYTE)
 Convert a 32-bit Unicode character to its UTF-8 encoded form (up to 4 bytes long). More...
 
#define PUT_UTF16(val, tmp, PUT_16BIT)
 Convert a 32-bit Unicode character to its UTF-16 encoded form (2 or 4 bytes). More...
 

Functions

av_const int av_log2 (unsigned v)
 
av_const int av_log2_16bit (unsigned v)
 
static av_always_inline av_const int av_clip_c (int a, int amin, int amax)
 Clip a signed integer value into the amin-amax range. More...
 
static av_always_inline av_const uint8_t av_clip_uint8_c (int a)
 Clip a signed integer value into the 0-255 range. More...
 
static av_always_inline av_const int8_t av_clip_int8_c (int a)
 Clip a signed integer value into the -128,127 range. More...
 
static av_always_inline av_const uint16_t av_clip_uint16_c (int a)
 Clip a signed integer value into the 0-65535 range. More...
 
static av_always_inline av_const int16_t av_clip_int16_c (int a)
 Clip a signed integer value into the -32768,32767 range. More...
 
static av_always_inline av_const int32_t av_clipl_int32_c (int64_t a)
 Clip a signed 64-bit integer value into the -2147483648,2147483647 range. More...
 
static av_always_inline av_const int av_clip_intp2_c (int a, int p)
 Clip a signed integer into the -(2^p),(2^p-1) range. More...
 
static av_always_inline av_const unsigned av_clip_uintp2_c (int a, int p)
 Clip a signed integer to an unsigned power of two range. More...
 
static av_always_inline int av_sat_add32_c (int a, int b)
 Add two signed 32-bit values with saturation. More...
 
static av_always_inline int av_sat_dadd32_c (int a, int b)
 Add a doubled value to another value with saturation at both stages. More...
 
static av_always_inline av_const float av_clipf_c (float a, float amin, float amax)
 Clip a float value into the amin-amax range. More...
 
static av_always_inline av_const int av_ceil_log2_c (int x)
 Compute ceil(log2(x)). More...
 
static av_always_inline av_const int av_popcount_c (uint32_t x)
 Count number of bits set to one in x. More...
 
static av_always_inline av_const int av_popcount64_c (uint64_t x)
 Count number of bits set to one in x. More...
 

Detailed Description

common internal and external API header

Definition in file common.h.

Macro Definition Documentation

◆ AV_NE

#define AV_NE (   be,
  le 
)    (le)

Definition at line 46 of file common.h.

Referenced by init_multbl2(), and query_formats().

◆ RSHIFT

#define RSHIFT (   a,
  b 
)    ((a) > 0 ? ((a) + ((1<<(b))>>1))>>(b) : ((a) + ((1<<(b))>>1)-1)>>(b))

Definition at line 50 of file common.h.

Referenced by get_amv(), unpack_vectors(), and vp56_decode_4mv().

◆ ROUNDED_DIV

#define ROUNDED_DIV (   a,
  b 
)    (((a)>0 ? (a) + ((b)>>1) : (a) - ((b)>>1))/(b))

◆ AV_CEIL_RSHIFT

#define AV_CEIL_RSHIFT (   a,
  b 
)

◆ FFABS

#define FFABS (   a)    ((a) >= 0 ? (a) : (-(a)))

Definition at line 61 of file common.h.

Referenced by acb_search(), add_8x8basis(), alloc_scratch_buffers(), apply_channel_coupling(), av_reduce(), avi_read_header(), await_reference_row(), check_mv(), codebook_sanity_check_for_rate_quarter(), comp_harmonic_coeff(), dct_error(), dct_max8x8_c(), dct_quantize_refine(), dct_quantize_trellis_c(), dct_single_coeff_elimination(), decode_bmv_frame(), decode_dc_coeffs(), decode_dct(), decode_fixed_vector(), decode_frame(), decode_frame_header(), decode_pic(), decode_tones_amplitude(), do_apply_filter(), dpcm_predict(), dss_sp_get_normalize_bits(), dss_sp_vector_sum(), dv_init_enc_block(), encode_acs(), encode_block(), estimate_acs(), estimate_dcs(), estimate_stereo_mode(), ff_g723_1_scale_vector(), ff_h263_encode_picture_header(), ff_h264_direct_ref_list_init(), ff_init_me(), ff_jpegls_update_state_regular(), ff_mpeg1_encode_init(), ff_mpeg_framesize_alloc(), ff_nelly_get_sample_bits(), ff_vc1_pred_b_mv(), ff_vc1_pred_mv(), filter_frame(), find_frame_rate_index(), flashsv_encode_frame(), flv_read_packet(), generate_noise(), get_diff_limited_q(), get_fcb_param(), get_needed_flags(), get_qminmax(), get_rrp(), get_sae(), get_scale_factor(), guess_mv(), gxf_seek(), h263_h_loop_filter_c(), h263_v_loop_filter_c(), h264_loop_filter_chroma(), h264_loop_filter_chroma_intra(), h264_loop_filter_luma(), h264_loop_filter_luma_intra(), h_block_filter(), hadamard8_intra8x8_c(), headroom(), hev(), implicit_weight_table(), init_uni_ac_vlc(), initFilter(), intra_pred(), inv_predict_11(), levinson_durbin(), loop_filter(), lpc2lsp(), ls_decode_line(), ls_encode_line(), ls_encode_regular(), ls_get_code_runterm(), make_glyphs(), mov_find_next_sample(), mp3_update_xing(), mp3_write_xing(), mpc8_decode_frame(), mpeg1_encode_sequence_header(), msrle_decode_8_16_24_32(), msrle_decode_pal4(), mss4_decode_dct(), nsse16_c(), nsse8_c(), packedCopyWrapper(), paf_video_decode(), precalc_coefs(), pred_spatial_direct_motion(), process_input(), put_alpha_diff(), put_s(), put_symbol_inline(), read_seek2(), render_line(), reverse_dc_prediction(), rtcp_update_jitter(), rv40_loop_filter_strength(), rv40_strong_loop_filter(), rv40_weak_loop_filter(), sab_diamond_search(), scaleforopp_x(), scaleforopp_y(), scaleforsame_x(), scaleforsame_y(), search_for_quantizers_faac(), seq_unpack_rle_block(), silk_is_lpc_stable(), silk_lsf2lpc(), skip_check(), sum_abs_dctelem_c(), sws_getShiftedVec(), try_8x8basis(), update_vlc_state(), v_block_filter(), vc1_filter_line(), vorbis_floor1_decode(), vp3_decode_frame(), vp6_filter(), vp7_simple_limit(), vp8_simple_limit(), vsad16_c(), wmv2_pred_motion(), and x8_loop_filter().

◆ FFSIGN

#define FFSIGN (   a)    ((a) > 0 ? 1 : -1)

◆ FFMAX

#define FFMAX (   a,
  b 
)    ((a) > (b) ? (a) : (b))

Definition at line 64 of file common.h.

Referenced by aac_encode_frame(), ac3_bit_alloc_calc_bap_c(), ac3_eac3_probe(), acb_search(), adaptive_quantization(), add_tonal_components(), adjust_frame_information(), adpcm_compress_trellis(), adpcm_decode_frame(), adts_aac_probe(), allocate_buffers(), append_packet_chunked(), apply_8x8(), apply_channel_coupling(), apply_delogo(), apply_lpc(), apply_tns(), asf_write_packet(), av_d2q(), av_fast_malloc(), av_fast_realloc(), av_image_copy(), av_image_copy_to_buffer(), av_match_name(), av_probe_input_buffer(), av_probe_input_format2(), avcodec_align_dimensions(), avformat_write_header(), avi_read_header(), avi_read_seek(), avi_write_counters(), avpriv_ac3_parse_header(), avresample_build_matrix(), avresample_get_delay(), avresample_open(), await_reference_row(), bidir_refine(), bink_decode_plane(), bit_allocation(), blend_frame(), build_filter(), build_table(), calc_bit_demand(), calc_input_response(), calc_lowcomp(), calc_lowcomp1(), calc_reduced_thr_3gpp(), calc_reduction_3gpp(), calculate_scales(), cavs_decode_frame(), cdg_scroll(), celt_decode_allocation(), celt_decode_bands(), celt_decode_coarse_energy(), check(), check_stream_max_drift(), checkasm_report(), chroma_4mv_motion(), comp_harmonic_coeff(), comp_ppf_coeff(), compute_target_time(), config_input(), copy(), copy_backptr(), copy_chapters(), create_vorbis_context(), dash_write_packet(), dct_error(), dct_max8x8_c(), decode(), decode_audio_block(), decode_channel_residues(), decode_channel_sound_unit(), decode_chunks(), decode_entropy_coded_image(), decode_entropy_image(), decode_frame(), decode_frame_header(), decode_init(), decode_lspf(), decode_p_frame(), decode_scale_factors(), decode_var_block_data(), decorrelation(), direct_search(), dnxhd_encode_rdo(), dnxhd_find_qscale(), dtext_prepare_text(), encode_block(), encode_frame(), encode_picture(), epzs_motion_search_internal(), estimate_timings(), estimate_timings_from_pts(), execute_code(), ff_ac3_bit_alloc_calc_mask(), ff_ac3_bit_alloc_calc_psd(), ff_acelp_reorder_lsf(), ff_acelp_update_past_gain(), ff_ass_add_rect(), ff_atrac3p_power_compensation(), ff_audio_mix(), ff_audio_resample(), ff_audio_resample_init(), ff_celt_decode_frame(), ff_dither_alloc(), ff_emulated_edge_mc(), ff_g723_1_inverse_quant(), ff_get_best_fcode(), ff_get_buffer(), ff_gradfun_filter_line_c(), ff_imdct15_init(), ff_init_me(), ff_interleave_packet_per_dts(), ff_jpeg2000_dwt_init(), ff_jpegls_init_state(), ff_jpegls_reset_coding_parameters(), ff_jpegls_update_state_regular(), ff_lag_rac_init(), ff_mjpeg_decode_dqt(), ff_mov_write_packet(), ff_mpv_encode_picture(), ff_nelly_get_sample_bits(), ff_seek_frame_binary(), ff_set_min_dist_lsf(), ff_srtp_decrypt(), ff_timefilter_update(), ff_vp9_decode_block(), ffio_rewind_with_probe_data(), ffmal_update_format(), ffmmal_init_decoder(), ffv1_encode_init(), filter_frame(), filter_level_for_mb(), find_best_state(), find_hb_gain(), find_max_val(), find_new_headers(), findCode(), flac_parse(), flv_write_packet(), full_search(), gain_scale(), get_channel_layout_single(), get_exponent_dynamic(), get_floor_average(), get_limits(), get_lowest_part_list_y(), get_lowest_part_y(), get_new_centroids(), get_qcx(), get_quant_quality(), get_quants(), get_sample_rate(), get_siz(), get_tag(), get_video_frame(), get_visual_weight(), gmc1_motion(), guess_mv(), gxf_seek(), h264_select_output_frame(), h_block_filter(), handle_file(), hap_encode(), hls_residual_coding(), hls_window(), hpel_motion(), huff_reader_build_canonical(), hvcc_parse_sps(), hvcc_parse_vps(), hvcc_update_ptl(), img_read_header(), init_exp(), init_offset(), init_prec(), init_ralf_vlc(), init_tile(), init_video_param(), initFilter(), is_intra_more_likely(), kalman_smoothen(), lame_calc_attack_threshold(), libopenjpeg_copy_to_packed16(), libopenjpeg_encode_init(), lowest_referenced_row(), lpc2lsp(), lsp_quantize(), main(), make_glyphs(), matroska_parse_block(), matroska_read_seek(), mc_chroma_dir(), mc_luma_dir(), median4(), mkv_write_ass_blocks(), mkv_write_packet_internal(), mmap_read_frame(), modify_qscale(), mov_read_ctts(), mov_write_esds_tag(), mov_write_stsz_tag(), mp3_read_probe(), mp_decode_layer3(), mpeg_motion_internal(), mxf_compute_ptses_fake_index(), mxf_edit_unit_absolute_offset(), mxf_read_seek(), ni_prepare_read(), noise_enhancer(), nut_write_header(), nvenc_setup_h264_config(), nvenc_setup_hevc_config(), nvenc_setup_surfaces(), opus_decode_packet(), opus_packet(), output_chunk_list(), output_packet(), output_segment_list(), parse_adts_frame_header(), parse_media_type(), parse_postfilter(), parse_video_info(), process_anticollapse(), process_frame_obj(), process_input(), ps_tableinit(), put_codebook_header(), qpel_motion(), quantize_lpc_coefs(), queue_picture(), read_header(), read_packet(), read_sbr_grid(), read_seek(), read_shape_from_file(), read_trun_duration(), read_var_block_data(), render_charset(), reposition(), residue_encode(), retry_transfer_wrapper(), revert_channel_correlation(), roq_dpcm_encode_frame(), rv10_decode_frame(), rv10_decode_packet(), rv34_decode_mv(), rv34_gen_vlc(), sbr_hf_calc_npatches(), sbr_make_f_derived(), sbr_x_gen(), scan_for_extensions(), search_for_ms(), search_for_quantizers_anmr(), search_for_quantizers_faac(), seek_chapter(), segment_hls_window(), select_input_picture(), select_sample_rate(), set_sample_rate_params(), silk_decode_frame(), silk_stabilize_lsf(), skip_check(), smjpeg_write_packet(), stability_factor(), stabilize_lsps(), svc_encode_init(), swf_read_packet(), sws_diffVec(), sws_init_context(), sws_sumVec(), swscale(), tak_parse(), umh_search(), update_stream_timings(), v_block_filter(), var_diamond_search(), vc1_decode_frame(), video_refresh_timer(), wait_frame(), wav_write_packet(), wmv2_pred_motion(), write_abst(), write_manifest(), write_packet(), x8_ac_compensation(), x8_loop_filter(), x8_setup_spatial_compensation(), xcbgrab_reposition(), yop_read_seek(), and zmbv_me().

◆ FFMAX3

#define FFMAX3 (   a,
  b,
 
)    FFMAX(FFMAX(a,b),c)

◆ FFMIN

#define FFMIN (   a,
  b 
)    ((a) > (b) ? (b) : (a))

Definition at line 66 of file common.h.

Referenced by a64multi_encode_frame(), aac_encode_frame(), aac_parse_packet(), ac3_bit_alloc_calc_bap_c(), ac3_decode_frame(), acb_search(), adapt_prob(), add_metadata(), adpcm_ima_compress_sample(), adpcm_yamaha_compress_sample(), aic_decode_slice(), aiff_read_packet(), alac_decode_close(), allocate_buffers(), amf_tag_contents(), ape_decode_frame(), append_packet_chunked(), apply_channel_coupling(), apply_lpc(), apply_ltp(), apply_pitch_filters(), apply_tns(), array_min_int16(), asfrtp_parse_packet(), audio_get_buffer(), audio_write_packet(), autocorr_max(), av_audio_fifo_drain(), av_audio_fifo_read(), av_buffer_realloc(), av_fifo_generic_read(), av_fifo_generic_write(), av_grow_packet(), av_parse_color(), av_probe_input_buffer(), av_reduce(), av_url_split(), avcodec_get_pix_fmt_loss(), avi_read_header(), avi_read_nikon(), avio_get_str(), avio_write(), avpriv_find_start_code(), avresample_open(), aw_parse_coords(), await_reference_mb_row(), await_references(), bidir_refine(), blend_frame(), bmp_parse(), buffer_offset(), build_huff(), build_table(), bwf_write_bext_string(), bytestream2_copy_buffer(), bytestream2_get_buffer(), bytestream2_put_buffer(), bytestream2_set_buffer(), bytestream2_skip(), bytestream2_skip_p(), calc_bit_demand(), calc_cpl_coord(), cdg_scroll(), celt_decode_allocation(), celt_decode_band(), celt_decode_bands(), celt_decode_coarse_energy(), channelmap_filter_frame(), check_stream_max_drift(), chomp6(), chrRangeToJpeg16_c(), chrRangeToJpeg_c(), cin_decode_lzss(), cin_decode_rle(), cinepak_decode(), cinvideo_decode_frame(), clean_index(), cmap_read_palette(), cng_decode_frame(), commit_bitstream_and_slice_buffer(), compand_drain(), compute_rematrixing_strategy(), config_output(), copy_bits(), copy_chapters(), copy_moof(), copy_tag(), count_mantissa_bits_update_ch(), create_adapt_vect(), crypto_read(), cuda_transfer_data_from(), cuda_transfer_data_to(), dash_fill_tmpl_params(), dct_quantize_trellis_c(), decode_555(), decode_ac_coeffs(), decode_array_0000(), decode_block(), decode_block_refinement(), decode_byterun(), decode_coeffs(), decode_dc_coeffs(), decode_finish_row(), decode_frame(), decode_frame_headers(), decode_frame_ilbm(), decode_lspf(), decode_ltp(), decode_mb_i(), decode_mode(), decode_mvc2(), decode_pixel(), decode_prediction(), decode_rle(), decode_sgirle8(), decode_subframe(), decode_tonal_components(), decompress_texture_thread(), derive_spatial_merge_candidates(), dfa_decode_frame(), direct_search(), dnxhd_encode_rdo(), dnxhd_find_qscale(), dnxhd_mb_var_thread(), do_rematrixing(), dpx_parse(), dtext_prepare_text(), dxa_read_packet(), eightsvx_decode_frame(), encode_acs(), encode_dcs(), encode_exponents_blk_ch(), encode_ext_header(), encode_frame(), encode_init(), encode_scalar(), epic_jb_decode_tile(), epzs_motion_search_internal(), estimate_acs(), estimate_dcs(), estimate_sid_gain(), execute_code(), extrapolate_isf(), ff_aac_ac3_parse(), ff_ac3_apply_rematrixing(), ff_ac3_bit_alloc_calc_mask(), ff_ac3_bit_alloc_calc_psd(), ff_acelp_reorder_lsf(), ff_af_queue_remove(), ff_alsa_open(), ff_amf_get_field_value(), ff_amf_get_string(), ff_audio_resample_init(), ff_celt_decode_frame(), ff_convert_dither(), ff_copy_and_dup(), ff_draw_horiz_band(), ff_eac3_apply_spectral_extension(), ff_els_decode_bit(), ff_els_decoder_init(), ff_emulated_edge_mc(), ff_estimate_p_frame_motion(), ff_flac_parse_picture(), ff_frame_thread_init(), ff_g723_1_inverse_quant(), ff_g723_1_scale_vector(), ff_get_best_fcode(), ff_get_wav_header(), ff_h264_decode_seq_parameter_set(), ff_h264_draw_horiz_band(), ff_h264_execute_decode_slices(), ff_h264_init_poc(), ff_hevc_annexb2mp4(), ff_hevc_parse_sps(), ff_hevc_ref_idx_lx_decode(), ff_hevc_sao_offset_abs_decode(), ff_hevc_significant_coeff_flag_decode(), ff_hevc_significant_coeff_group_flag_decode(), ff_hevc_slice_rpl(), ff_init_me(), ff_insert_pad(), ff_isom_write_avcc(), ff_isom_write_hvcc(), ff_jpegls_reset_coding_parameters(), ff_jpegls_update_state_regular(), ff_lag_rac_init(), ff_mms_read_data(), ff_mms_read_header(), ff_mpv_common_init(), ff_msmpeg4_encode_ext_header(), ff_poll_frame(), ff_rle_count_pixels(), ff_rtmp_packet_write(), ff_rtp_check_and_send_back_rr(), ff_rtp_send_aac(), ff_rtp_send_h261(), ff_rtp_send_h263(), ff_rtp_send_h263_rfc2190(), ff_rtp_send_jpeg(), ff_rtp_send_latm(), ff_rtp_send_vp8(), ff_sipr_decode_frame_16k(), ff_slice_thread_init(), ff_voc_get_packet(), ff_vorbis_floor1_render_list(), ff_vp9_decode_block(), ffio_fill(), ffmmal_add_packet(), ffurl_alloc(), fic_draw_cursor(), filter(), filter_common(), filter_frame(), filter_level_for_mb(), filter_slice_chroma(), find_best_state(), find_optimal_param(), flac_fifo_read(), flac_fifo_read_wrap(), flac_parse(), floor_encode(), full_search(), g2m_load_cursor(), generate_noise(), get_alpha_data(), get_audio_buffer(), get_available_samples(), get_exponent_dynamic(), get_floor_average(), get_interleaved_ue_golomb(), get_limits(), get_max_p_order(), get_nb_samples(), get_new_centroids(), get_qPy_pred(), get_quants(), get_slice_data(), get_sockaddr(), get_str(), get_symbol_inline(), get_visual_weight(), gif_image_write_image(), guess_mv(), h264_slice_init(), handle_trimming(), hex_log(), hls_decode_neighbour(), hls_residual_coding(), hls_sao_param(), hScale16To15_c(), hScale16To19_c(), hScale8To15_c(), hScale8To19_c(), http_read_stream(), huff_build(), huffman_decode(), hvcc_parse_sps(), hvcc_parse_vui(), if(), init_band(), init_long_region(), init_prec(), init_ralf_vlc(), init_tile(), initFilter(), inter_recon(), interleave_new_audio_packet(), intra_pred(), intra_recon(), inverse_channel_transform(), ivi_init_tiles(), join_request_frame(), kalman_smoothen(), kempf_decode_tile(), kset(), lag_decode_line(), lag_decode_zero_run_line(), latm_decode_audio_specific_config(), libopenjpeg_copy_to_packed16(), load_encode_and_write(), loop_filter(), lowest_referenced_row(), lsf_decode_fp(), lsp_quantize(), lumRangeToJpeg16_c(), lumRangeToJpeg_c(), magy_decode_slice(), matroska_ebmlnum_uint(), matroska_parse_tracks(), median4(), mjpegb_decode_frame(), mkv_write_ass_blocks(), model_calc_threshold(), mov2textsub(), mov_build_index(), mov_read_default(), mov_read_dref(), mov_write_chpl_tag(), mov_write_edts_tag(), mov_write_uuidprof_tag(), mp3_update_xing(), mp3_write_xing(), mp_decode_frame(), mp_get_vlc(), mp_read_changes_map(), mpc8_get_mask(), mpeg4_decode_mb(), mpeg4_decode_sprite_trajectory(), mpeg4_encode_gop_header(), mpeg_decode_slice(), mpegaudio_parse(), mpegts_handle_packet(), mss4_init_vlc(), mszh_decomp(), mxf_read_packet(), mxf_read_random_index_pack(), mxf_read_seek(), mxpeg_decode_app(), mxpeg_decode_com(), noise_enhancer(), nsv_read_chunk(), nut_write_packet(), nvenc_setup_surfaces(), ogg_buffer_data(), ogg_packet(), op(), opt_default(), opus_decode_frame(), opus_decode_packet(), opus_packet(), opus_rc_getsymbol(), opus_rc_laplace(), opus_rc_stepmodel(), opus_rc_trimodel(), opus_rc_unimodel(), output_plane(), packed_16bpc_bswap(), param_write_hex(), parse_chunks(), pitch_sharpening(), piz_uncompress(), png_decode_idat(), png_parse(), precalc_coefs(), pred_intra_mode(), process_anticollapse(), process_input(), psy_3gpp_init(), put_bitstream_info(), put_symbol_inline(), pva_read_timestamp(), qcp_read_header(), qdm2_parse_subpacket(), qdm2_restore_block(), qtrle_encode_line(), quantize_bands(), rac_init(), raw_decode(), raw_read_packet(), read_access_unit(), read_dcs(), read_major_sync(), read_packet(), read_probe(), read_seek(), read_var_block_data(), reduce_matrix(), region_offset2size(), render_charset(), render_slice(), request_frame(), resample(), return_audio_frame(), revert_channel_correlation(), rice_decompress(), rm_assemble_video_frame(), rpza_decode_stream(), rtcp_parse_packet(), rtcp_send_sr(), rtmp_open(), rtmp_packet_read_one_chunk(), rtmp_write(), rtp_send_samples(), rtp_write_header(), rv20_decode_picture_header(), rv30_decode_init(), rv34_gen_vlc(), sao_filter_CTB(), save_bits(), sbr_gain_calc(), sbr_make_f_master(), scaleforopp(), scaleforopp_x(), scaleforopp_y(), scaleforsame(), scaling_list_data(), scan_for_extensions(), search_for_ms(), search_for_quantizers_anmr(), search_for_quantizers_faac(), search_for_quantizers_fast(), search_for_quantizers_twoloop(), seq_unpack_rle_block(), set_bandwidth(), set_deblocking_bypass(), set_tile_offset(), shorten_decode_frame(), silk_decode_excitation(), silk_lsf2lpc(), silk_stabilize_lsf(), skip_scaling_list_data(), spatial_compensation_1(), spatial_compensation_9(), spdif_probe(), srt_to_ass(), srtp_open(), stabilize_lsps(), store_icy(), sub_left_prediction_bgr32(), sub_left_prediction_rgb24(), subframe_count_exact(), svq3_decode_mb(), swscale(), synth_frame(), synthesis(), tak_parse(), targa_decode_rle(), tdsc_load_cursor(), tgq_decode_mb(), tiff_decode_tag(), to_meta_with_crop(), umh_search(), unpack(), update_dimensions(), update_stream_timings(), var_diamond_search(), vc1_decode_frame(), vc1_decode_init(), vc1_filter_line(), video_audio_display(), vmdaudio_decode_frame(), vp5_parse_coeff(), vp6_parse_coeff_huffman(), vp78_decode_frame(), vp7_get_quants(), vpx_init(), vqf_read_header(), wait_frame(), wav_write_packet(), wiener_denoise(), write_manifest(), write_packet(), write_subframes(), wtvfile_read_packet(), x8_get_prediction(), x8_loop_filter(), x8_setup_spatial_compensation(), xan_decode_frame(), xan_wc3_output_pixel_run(), xcbgrab_reposition(), xmv_fetch_audio_packet(), xsub_encode_rle(), xwma_read_packet(), yop_read_seek(), and zmbv_me().

◆ FFMIN3

#define FFMIN3 (   a,
  b,
 
)    FFMIN(FFMIN(a,b),c)

◆ FFSWAP

#define FFSWAP (   type,
  a,
  b 
)    do{type SWAP_tmp= b; b= a; a= SWAP_tmp;}while(0)

Definition at line 69 of file common.h.

Referenced by at1_imdct(), at1_imdct_block(), av_aes_init(), av_rc4_crypt(), av_rc4_init(), avformat_write_header(), cbr_bit_allocation(), cinvideo_decode_frame(), compress_color(), compute_pkt_fields(), decode_band(), decode_bytes_and_gain(), decode_cell_data(), decode_frame(), decode_pic(), decode_residual_spectrum(), decode_tones_info(), decorrelate(), do_swizzle(), draw_char(), dxn3dc_block(), encode_frame(), escape130_decode_frame(), ff_acelp_reorder_lsf(), ff_atrac3p_imdct(), ff_ccitt_unpack(), ff_celp_lp_synthesis_filterf(), ff_eval_coefs(), ff_eval_refl(), ff_filter_graph_remove_filter(), ff_huff_build_tree(), ff_sort_nearly_sorted_floats(), ff_twinvq_decode_frame(), ff_vp56_decode_frame(), g722_encode_trellis(), get_channel_weights(), getsigctxno(), h264_initialise_ref_list(), heap_sift(), hls_residual_coding(), imlt(), ipvideo_decode_frame(), luma_intra_pred_mode(), magy_decode_frame(), make_lpc_coefs(), mss2_decode_frame(), nelly_decode_block(), on2avc_reconstruct_stereo(), png_choose_filter(), png_handle_row(), postfilter(), ra144_decode_frame(), ra144_encode_frame(), raw_decode(), read_tree(), reconstruct_frame(), request_frame(), rm_ac3_swap_bytes(), roq_decode_frame(), roq_encode_video(), rotate_bufs(), sniff_channel_order(), sort_stt(), svq1_encode_frame(), svq3_decode_frame(), swap_channel_layouts_on_filter(), swap_guid(), swap_sample_fmts_on_filter(), swap_samplerates_on_filter(), switch_buffers(), vaapi_map_frame(), vc1_decode_frame(), vdpau_transfer_data_from(), vdpau_transfer_data_to(), and vp8_decode_mvs().

◆ FF_ARRAY_ELEMS

#define FF_ARRAY_ELEMS (   a)    (sizeof(a) / sizeof((a)[0]))

Definition at line 70 of file common.h.

◆ MKTAG

#define MKTAG (   a,
  b,
  c,
 
)    ((a) | ((b) << 8) | ((c) << 16) | ((unsigned)(d) << 24))

Definition at line 256 of file common.h.

Referenced by aiff_read_header(), aiff_write_header(), amr_read_header(), ape_read_header(), avi_load_index(), avi_read_header(), avi_read_nikon(), bfi_probe(), bfi_read_packet(), cllc_decode_frame(), daud_header(), dds_decode(), decode_frame(), decode_frame_byterun1(), decode_frame_ilbm(), decode_init(), decode_wave_header(), dfa_probe(), dfa_read_header(), dfa_read_packet(), dirac_probe(), dpx_parse(), dss_probe(), dxa_read_header(), dxa_read_packet(), dxva2_create_decoder(), encode_frame(), ff_flac_is_extradata_valid(), ff_mjpeg_decode_sos(), ff_mov_init_hinting(), ff_rm_read_mdpr_codecdata(), ff_wv_parse_header(), ffio_wfourcc(), find_index_range(), flac_read_header(), get_codec_data(), hap_init(), hap_parse_frame_header(), hq_hqa_decode_frame(), hqx_decode_frame(), ingenient_read_packet(), init_file(), init_multbl2(), ipod_get_codec_tag(), is_clcp_track(), magy_decode_frame(), matroska_parse_wavpack(), mmf_read_header(), mov_codec_id(), mov_create_chapter_track(), mov_finalize_stsd_codec(), mov_find_codec_tag(), mov_free(), mov_get_codec_tag(), mov_get_dv_codec_tag(), mov_parse_stsd_audio(), mov_parse_stsd_data(), mov_parse_stsd_video(), mov_probe(), mov_read_cmov(), mov_read_custom(), mov_read_default(), mov_read_dref(), mov_read_glbl(), mov_read_hdlr(), mov_read_meta(), mov_read_replaygain(), mov_read_sbgp(), mov_read_stco(), mov_read_stsz(), mov_read_udta_string(), mov_read_wide(), mov_skip_multiple_stsd(), mov_write_audio_tag(), mov_write_hdlr_tag(), mov_write_header(), mov_write_minf_tag(), mov_write_moov_tag(), mov_write_stbl_tag(), mov_write_stsd_tag(), mov_write_trak_tag(), mov_write_video_tag(), mp3_update_xing(), mp4_get_codec_tag(), mpc_read_header(), msnwc_tcp_probe(), msnwc_tcp_read_header(), nsv_parse_NSVf_header(), nsv_read_chunk(), parse_fragment(), parse_pixel_format(), png_write_row(), probe(), qcp_read_packet(), qt_rtp_parse_packet(), r3d_probe(), r3d_read_header(), r3d_read_packet(), raw_decode(), raw_init_decoder(), rdt_load_mdpr(), rm_read_header(), rm_read_index(), rscc_init(), set_codec_str(), siff_parse_vbv1(), siff_read_header(), smacker_read_header(), smush_read_probe(), sol_read_header(), start_command_packet(), tak_read_header(), tdsc_decode_frame(), tdsc_decode_tiles(), thp_probe(), utvideo_encode_init(), vfw_codecid(), vfw_pixfmt(), vfw_read_header(), vid_probe(), vp3_decode_init(), vqf_probe(), vqf_read_header(), webp_decode_frame(), write_abst(), write_packet(), xsub_encoder_init(), and xwma_read_header().

◆ MKBETAG

#define MKBETAG (   a,
  b,
  c,
 
)    ((d) | ((c) << 8) | ((b) << 16) | ((unsigned)(a) << 24))

◆ GET_UTF8

#define GET_UTF8 (   val,
  GET_BYTE,
  ERROR 
)
Value:
val= GET_BYTE;\
{\
uint32_t top = (val & 128) >> 1;\
if ((val & 0xc0) == 0x80)\
ERROR\
while (val & top) {\
int tmp= GET_BYTE - 128;\
if(tmp>>6)\
ERROR\
val= (val<<6) + tmp;\
top <<= 5;\
}\
val &= (top << 1) - 1;\
}
static uint8_t tmp[8]
Definition: des.c:38

Convert a UTF-8 character (up to 4 bytes) to its 32-bit UCS-4 encoded form.

Parameters
valOutput value, must be an lvalue of type uint32_t.
GET_BYTEExpression reading one byte from the input. Evaluated up to 7 times (4 for the currently assigned Unicode range). With a memory buffer input, this could be *ptr++.
ERRORExpression to be evaluated on invalid input, typically a goto statement.

Definition at line 270 of file common.h.

Referenced by ascii_to_wc(), draw_glyphs(), dtext_prepare_text(), get_utf8(), and utf8len().

◆ GET_UTF16

#define GET_UTF16 (   val,
  GET_16BIT,
  ERROR 
)
Value:
val = GET_16BIT;\
{\
unsigned int hi = val - 0xD800;\
if (hi < 0x800) {\
val = GET_16BIT - 0xDC00;\
if (val > 0x3FFU || hi > 0x3FFU)\
ERROR\
val += (hi<<10) + 0x10000;\
}\
}\

Convert a UTF-16 character (2 or 4 bytes) to its 32-bit UCS-4 encoded form.

Parameters
valOutput value, must be an lvalue of type uint32_t.
GET_16BITExpression returning two bytes of UTF-16 data converted to native byte order. Evaluated one or two times.
ERRORExpression to be evaluated on invalid input, typically a goto statement.

Definition at line 295 of file common.h.

Referenced by decode_str(), and get_asf_string().

◆ PUT_UTF8

#define PUT_UTF8 (   val,
  tmp,
  PUT_BYTE 
)
Value:
{\
int bytes, shift;\
uint32_t in = val;\
if (in < 0x80) {\
tmp = in;\
PUT_BYTE\
} else {\
bytes = (av_log2(in) + 4) / 5;\
shift = (bytes - 1) * 6;\
tmp = (256 - (256 >> bytes)) | (in >> shift);\
PUT_BYTE\
while (shift >= 6) {\
shift -= 6;\
tmp = 0x80 | ((in >> shift) & 0x3f);\
PUT_BYTE\
}\
}\
}
uint8_t pi<< 24) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_U8, uint8_t,(*(const uint8_t *) pi - 0x80) *(1.0f/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_U8, uint8_t,(*(const uint8_t *) pi - 0x80) *(1.0/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S16, int16_t,(*(const int16_t *) pi >> 8)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S16, int16_t, *(const int16_t *) pi *(1.0f/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S16, int16_t, *(const int16_t *) pi *(1.0/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S32, int32_t,(*(const int32_t *) pi >> 24)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S32, int32_t, *(const int32_t *) pi *(1.0f/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S32, int32_t, *(const int32_t *) pi *(1.0/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_FLT, float, av_clip_uint8(lrintf(*(const float *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_FLT, float, av_clip_int16(lrintf(*(const float *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_FLT, float, av_clipl_int32(llrintf(*(const float *) pi *(1U<< 31)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_DBL, double, av_clip_uint8(lrint(*(const double *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_DBL, double, av_clip_int16(lrint(*(const double *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_DBL, double, av_clipl_int32(llrint(*(const double *) pi *(1U<< 31)))) #define SET_CONV_FUNC_GROUP(ofmt, ifmt) static void set_generic_function(AudioConvert *ac) { } void ff_audio_convert_free(AudioConvert **ac) { if(! *ac) return;ff_dither_free(&(*ac) ->dc);av_freep(ac);} AudioConvert *ff_audio_convert_alloc(AVAudioResampleContext *avr, enum AVSampleFormat out_fmt, enum AVSampleFormat in_fmt, int channels, int sample_rate, int apply_map) { AudioConvert *ac;int in_planar, out_planar;ac=av_mallocz(sizeof(*ac));if(!ac) return NULL;ac->avr=avr;ac->out_fmt=out_fmt;ac->in_fmt=in_fmt;ac->channels=channels;ac->apply_map=apply_map;if(avr->dither_method !=AV_RESAMPLE_DITHER_NONE &&av_get_packed_sample_fmt(out_fmt)==AV_SAMPLE_FMT_S16 &&av_get_bytes_per_sample(in_fmt) > 2) { ac->dc=ff_dither_alloc(avr, out_fmt, in_fmt, channels, sample_rate, apply_map);if(!ac->dc) { av_free(ac);return NULL;} return ac;} in_planar=ff_sample_fmt_is_planar(in_fmt, channels);out_planar=ff_sample_fmt_is_planar(out_fmt, channels);if(in_planar==out_planar) { ac->func_type=CONV_FUNC_TYPE_FLAT;ac->planes=in_planar ? ac->channels :1;} else if(in_planar) ac->func_type=CONV_FUNC_TYPE_INTERLEAVE;else ac->func_type=CONV_FUNC_TYPE_DEINTERLEAVE;set_generic_function(ac);if(ARCH_AARCH64) ff_audio_convert_init_aarch64(ac);if(ARCH_ARM) ff_audio_convert_init_arm(ac);if(ARCH_X86) ff_audio_convert_init_x86(ac);return ac;} int ff_audio_convert(AudioConvert *ac, AudioData *out, AudioData *in) { int use_generic=1;int len=in->nb_samples;int p;if(ac->dc) { av_log(ac->avr, AV_LOG_TRACE, "%d samples - audio_convert: %s to %s (dithered)\", len, av_get_sample_fmt_name(ac->in_fmt), av_get_sample_fmt_name(ac->out_fmt));return ff_convert_dither(ac-> in
av_const int av_log2(unsigned v)
Definition: intmath.c:26

Convert a 32-bit Unicode character to its UTF-8 encoded form (up to 4 bytes long).

Parameters
valis an input-only argument and should be of type uint32_t. It holds a UCS-4 encoded Unicode character that is to be converted to UTF-8. If val is given as a function it is executed only once.
tmpis a temporary variable and should be of type uint8_t. It represents an intermediate value during conversion that is to be output by PUT_BYTE.
PUT_BYTEwrites the converted UTF-8 bytes to any proper destination. It could be a function or a statement, and uses tmp as the input byte. For example, PUT_BYTE could be "*output++ = tmp;" PUT_BYTE will be executed up to 4 times for values in the valid UTF-8 range and up to 7 times in the general case, depending on the length of the converted Unicode character.

Definition at line 323 of file common.h.

Referenced by count_frame_header(), decode_str(), get_asf_string(), mov_read_mac_string(), and write_utf8().

◆ PUT_UTF16

#define PUT_UTF16 (   val,
  tmp,
  PUT_16BIT 
)
Value:
{\
uint32_t in = val;\
if (in < 0x10000) {\
tmp = in;\
PUT_16BIT\
} else {\
tmp = 0xD800 | ((in - 0x10000) >> 10);\
PUT_16BIT\
tmp = 0xDC00 | ((in - 0x10000) & 0x3FF);\
PUT_16BIT\
}\
}\
uint8_t pi<< 24) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_U8, uint8_t,(*(const uint8_t *) pi - 0x80) *(1.0f/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_U8, uint8_t,(*(const uint8_t *) pi - 0x80) *(1.0/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S16, int16_t,(*(const int16_t *) pi >> 8)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S16, int16_t, *(const int16_t *) pi *(1.0f/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S16, int16_t, *(const int16_t *) pi *(1.0/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S32, int32_t,(*(const int32_t *) pi >> 24)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S32, int32_t, *(const int32_t *) pi *(1.0f/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S32, int32_t, *(const int32_t *) pi *(1.0/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_FLT, float, av_clip_uint8(lrintf(*(const float *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_FLT, float, av_clip_int16(lrintf(*(const float *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_FLT, float, av_clipl_int32(llrintf(*(const float *) pi *(1U<< 31)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_DBL, double, av_clip_uint8(lrint(*(const double *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_DBL, double, av_clip_int16(lrint(*(const double *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_DBL, double, av_clipl_int32(llrint(*(const double *) pi *(1U<< 31)))) #define SET_CONV_FUNC_GROUP(ofmt, ifmt) static void set_generic_function(AudioConvert *ac) { } void ff_audio_convert_free(AudioConvert **ac) { if(! *ac) return;ff_dither_free(&(*ac) ->dc);av_freep(ac);} AudioConvert *ff_audio_convert_alloc(AVAudioResampleContext *avr, enum AVSampleFormat out_fmt, enum AVSampleFormat in_fmt, int channels, int sample_rate, int apply_map) { AudioConvert *ac;int in_planar, out_planar;ac=av_mallocz(sizeof(*ac));if(!ac) return NULL;ac->avr=avr;ac->out_fmt=out_fmt;ac->in_fmt=in_fmt;ac->channels=channels;ac->apply_map=apply_map;if(avr->dither_method !=AV_RESAMPLE_DITHER_NONE &&av_get_packed_sample_fmt(out_fmt)==AV_SAMPLE_FMT_S16 &&av_get_bytes_per_sample(in_fmt) > 2) { ac->dc=ff_dither_alloc(avr, out_fmt, in_fmt, channels, sample_rate, apply_map);if(!ac->dc) { av_free(ac);return NULL;} return ac;} in_planar=ff_sample_fmt_is_planar(in_fmt, channels);out_planar=ff_sample_fmt_is_planar(out_fmt, channels);if(in_planar==out_planar) { ac->func_type=CONV_FUNC_TYPE_FLAT;ac->planes=in_planar ? ac->channels :1;} else if(in_planar) ac->func_type=CONV_FUNC_TYPE_INTERLEAVE;else ac->func_type=CONV_FUNC_TYPE_DEINTERLEAVE;set_generic_function(ac);if(ARCH_AARCH64) ff_audio_convert_init_aarch64(ac);if(ARCH_ARM) ff_audio_convert_init_arm(ac);if(ARCH_X86) ff_audio_convert_init_x86(ac);return ac;} int ff_audio_convert(AudioConvert *ac, AudioData *out, AudioData *in) { int use_generic=1;int len=in->nb_samples;int p;if(ac->dc) { av_log(ac->avr, AV_LOG_TRACE, "%d samples - audio_convert: %s to %s (dithered)\", len, av_get_sample_fmt_name(ac->in_fmt), av_get_sample_fmt_name(ac->out_fmt));return ff_convert_dither(ac-> in

Convert a 32-bit Unicode character to its UTF-16 encoded form (2 or 4 bytes).

Parameters
valis an input-only argument and should be of type uint32_t. It holds a UCS-4 encoded Unicode character that is to be converted to UTF-16. If val is given as a function it is executed only once.
tmpis a temporary variable and should be of type uint16_t. It represents an intermediate value during conversion that is to be output by PUT_16BIT.
PUT_16BITwrites the converted UTF-16 data to any proper destination in desired endianness. It could be a function or a statement, and uses tmp as the input byte. For example, PUT_BYTE could be "*output++ = tmp;" PUT_BYTE will be executed 1 or 2 times depending on input character.

Definition at line 357 of file common.h.

Function Documentation

◆ av_log2()

av_const int av_log2 ( unsigned  v)

Definition at line 26 of file intmath.c.

Referenced by av_ceil_log2_c().

◆ av_log2_16bit()

av_const int av_log2_16bit ( unsigned  v)

Definition at line 31 of file intmath.c.

◆ av_clip_c()

static av_always_inline av_const int av_clip_c ( int  a,
int  amin,
int  amax 
)
static

Clip a signed integer value into the amin-amax range.

Parameters
avalue to clip
aminminimum value of the clip range
amaxmaximum value of the clip range
Returns
clipped value

Definition at line 97 of file common.h.

◆ av_clip_uint8_c()

static av_always_inline av_const uint8_t av_clip_uint8_c ( int  a)
static

Clip a signed integer value into the 0-255 range.

Parameters
avalue to clip
Returns
clipped value

Definition at line 109 of file common.h.

◆ av_clip_int8_c()

static av_always_inline av_const int8_t av_clip_int8_c ( int  a)
static

Clip a signed integer value into the -128,127 range.

Parameters
avalue to clip
Returns
clipped value

Definition at line 120 of file common.h.

◆ av_clip_uint16_c()

static av_always_inline av_const uint16_t av_clip_uint16_c ( int  a)
static

Clip a signed integer value into the 0-65535 range.

Parameters
avalue to clip
Returns
clipped value

Definition at line 131 of file common.h.

◆ av_clip_int16_c()

static av_always_inline av_const int16_t av_clip_int16_c ( int  a)
static

Clip a signed integer value into the -32768,32767 range.

Parameters
avalue to clip
Returns
clipped value

Definition at line 142 of file common.h.

◆ av_clipl_int32_c()

static av_always_inline av_const int32_t av_clipl_int32_c ( int64_t  a)
static

Clip a signed 64-bit integer value into the -2147483648,2147483647 range.

Parameters
avalue to clip
Returns
clipped value

Definition at line 153 of file common.h.

◆ av_clip_intp2_c()

static av_always_inline av_const int av_clip_intp2_c ( int  a,
int  p 
)
static

Clip a signed integer into the -(2^p),(2^p-1) range.

Parameters
avalue to clip
pbit position to clip at
Returns
clipped value

Definition at line 165 of file common.h.

◆ av_clip_uintp2_c()

static av_always_inline av_const unsigned av_clip_uintp2_c ( int  a,
int  p 
)
static

Clip a signed integer to an unsigned power of two range.

Parameters
avalue to clip
pbit position to clip at
Returns
clipped value

Definition at line 179 of file common.h.

◆ av_sat_add32_c()

static av_always_inline int av_sat_add32_c ( int  a,
int  b 
)
static

Add two signed 32-bit values with saturation.

Parameters
aone value
banother value
Returns
sum with signed saturation

Definition at line 192 of file common.h.

◆ av_sat_dadd32_c()

static av_always_inline int av_sat_dadd32_c ( int  a,
int  b 
)
static

Add a doubled value to another value with saturation at both stages.

Parameters
afirst value
bvalue doubled and added to a
Returns
sum with signed saturation

Definition at line 204 of file common.h.

◆ av_clipf_c()

static av_always_inline av_const float av_clipf_c ( float  a,
float  amin,
float  amax 
)
static

Clip a float value into the amin-amax range.

Parameters
avalue to clip
aminminimum value of the clip range
amaxmaximum value of the clip range
Returns
clipped value

Definition at line 216 of file common.h.

◆ av_ceil_log2_c()

static av_always_inline av_const int av_ceil_log2_c ( int  x)
static

Compute ceil(log2(x)).

Parameters
xvalue used to compute ceil(log2(x))
Returns
computed ceiling of log2(x)

Definition at line 227 of file common.h.

◆ av_popcount_c()

static av_always_inline av_const int av_popcount_c ( uint32_t  x)
static

Count number of bits set to one in x.

Parameters
xvalue to count bits of
Returns
the number of bits set to one in x

Definition at line 237 of file common.h.

◆ av_popcount64_c()

static av_always_inline av_const int av_popcount64_c ( uint64_t  x)
static

Count number of bits set to one in x.

Parameters
xvalue to count bits of
Returns
the number of bits set to one in x

Definition at line 251 of file common.h.