libavutil/common.h File Reference

common internal and external API header More...

#include <ctype.h>
#include <errno.h>
#include <inttypes.h>
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "attributes.h"
#include "libavutil/avconfig.h"
#include "config.h"
#include "intmath.h"
#include "common.h"
#include "mem.h"
#include "internal.h"
#include "intmath.h"

Go to the source code of this file.

Defines

#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 FFUDIV(a, b)   (((a)>0 ?(a):(a)-(b)+1) / (b))
#define FFUMOD(a, b)   ((a)-(b)*FFUDIV(a,b))
#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 FFALIGN(x, a)   (((x)+(a)-1)&~((a)-1))
#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.
#define GET_UTF16(val, GET_16BIT, ERROR)
 Convert a UTF-16 character (2 or 4 bytes) to its 32-bit UCS-4 encoded form.
#define PUT_UTF8(val, tmp, PUT_BYTE)
 Convert a 32-bit Unicode character to its UTF-8 encoded form (up to 4 bytes long).
#define PUT_UTF16(val, tmp, PUT_16BIT)
 Convert a 32-bit Unicode character to its UTF-16 encoded form (2 or 4 bytes).

Functions

static av_always_inline
av_const int 
av_log2_c (unsigned int v)
static av_always_inline
av_const int 
av_log2_16bit_c (unsigned int 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.
static av_always_inline
av_const uint8_t 
av_clip_uint8_c (int a)
 Clip a signed integer value into the 0-255 range.
static av_always_inline
av_const int8_t 
av_clip_int8_c (int a)
 Clip a signed integer value into the -128,127 range.
static av_always_inline
av_const uint16_t 
av_clip_uint16_c (int a)
 Clip a signed integer value into the 0-65535 range.
static av_always_inline
av_const int16_t 
av_clip_int16_c (int a)
 Clip a signed integer value into the -32768,32767 range.
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.
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.
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.
static av_always_inline
av_const int 
av_ceil_log2_c (int x)
 Compute ceil(log2(x)).
static av_always_inline
av_const int 
av_popcount_c (uint32_t x)
 Count number of bits set to one in x.
static av_always_inline
av_const int 
av_popcount64_c (uint64_t x)
 Count number of bits set to one in x.

Variables

const uint8_t ff_log2_tab [256]
const uint8_t av_reverse [256]
 Reverse the order of the bits of an 8-bits unsigned integer.


Detailed Description

common internal and external API header

Definition in file common.h.


Define Documentation

#define AV_NE ( be,
le   )     (le)

Definition at line 43 of file common.h.

Referenced by av_get_pcm_codec(), get_al_format_info(), init_multbl2(), and query_formats().

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

Definition at line 61 of file common.h.

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

Definition at line 52 of file common.h.

Referenced by add_8x8basis_TMPL(), apply_channel_coupling(), apply_tilt_comp(), av_compare_ts(), av_parse_ratio(), av_reduce(), av_resample(), avformat_write_header(), avi_read_header(), await_reference_row(), check_mv(), codebook_sanity_check_for_rate_quarter(), compute_pkt_fields(), dct_error(), dct_max8x8_c(), dct_quantize_refine(), dct_quantize_trellis_c(), dct_single_coeff_elimination(), decode_bmv_frame(), decode_dc_coeffs(), decode_fixed_vector(), decode_frame(), decode_frame_header(), decode_q_branch(), decode_tile(), dering_TMPL(), dirac_decode_picture_header(), do_a_deblock_C(), do_apply_filter(), doHorizDefFilter_C(), doHorizLowPass_C(), doVertDefFilter_TMPL(), doVertLowPass_TMPL(), dpcm_predict(), draw_line(), dv_init_enc_block(), encode_acs(), encode_block(), encode_header(), encode_picture_ls(), encode_q_branch(), encode_q_branch2(), encode_subband_c0run(), estimate_acs(), estimate_dcs(), estimate_stereo_mode(), ff_h263_encode_picture_header(), ff_h264_direct_ref_list_init(), ff_init_me(), ff_jpegls_update_state_regular(), ff_mpeg1_encode_init(), ff_mpeg4_encode_mb(), ff_msmpeg4_decode_block(), ff_nelly_get_sample_bits(), filter_line_c(), filter_line_c_16bit(), find_frame_rate_index(), flashsv_encode_frame(), flv_read_packet(), get_block_bits(), get_diff_limited_q(), get_needed_flags(), get_qminmax(), get_rrp(), get_sae(), get_scale_factor(), get_shift(), get_tilt_comp(), 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(), horizX1Filter(), implicit_weight_table(), init_uni_ac_vlc(), initFilter(), interpol(), long_term_filter(), ls_decode_line(), ls_encode_line(), ls_encode_regular(), ls_get_code_runterm(), main(), mov_find_next_sample(), mov_read_ctts(), mp3_write_xing(), mpc8_decode_frame(), mpeg1_encode_sequence_header(), mpeg4_decode_block(), msrle_decode_8_16_24_32(), normal_limit(), nsse16_c(), nsse16_mmx(), nsse8_c(), nsse8_mmx(), packedCopyWrapper(), postProcess_TMPL(), pp_postprocess(), PrecalcCoefs(), pred_spatial_direct_motion(), put_s(), put_subframe(), put_symbol(), put_symbol_inline(), read_rle_sgi(), read_seek2(), render_line(), resample(), reverse_dc_prediction(), rv40_loop_filter_strength(), rv40_strong_loop_filter(), rv40_weak_loop_filter(), sab_diamond_search(), scale_vector(), scaleforopp_x(), scaleforopp_y(), scaleforsame_x(), scaleforsame_y(), search_for_quantizers_faac(), seq_unpack_rle_block(), simple_limit(), skip_check(), start_frame(), sum_abs_dctelem_c(), swri_resample_TMPL(), sws_getShiftedVec(), sws_scale(), try_8x8basis_TMPL(), ts_str(), update_vlc_state(), v_block_filter(), vc1_filter_line(), vc1_pred_b_mv(), vc1_pred_mv(), vertX1Filter_TMPL(), vorbis_floor1_decode(), vp6_filter(), vsad16_c(), w_c(), wmv2_pred_motion(), and x8_loop_filter().

#define FFALIGN ( x,
 )     (((x)+(a)-1)&~((a)-1))

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

Definition at line 55 of file common.h.

Referenced by aac_encode_frame(), ac3_bit_alloc_calc_bap_c(), ac3_eac3_probe(), adaptive_quantization(), add_codec(), addTonalComponents(), adjust_frame_information(), adpcm_compress_trellis(), adpcm_decode_frame(), adts_aac_probe(), alloc_array_elem(), alloc_sequence_buffers(), allocate_buffers(), apply_channel_coupling(), apply_delogo(), apply_lpc(), apply_tns(), asf_build_simple_index(), asf_write_packet(), auto_matrix(), av_append_packet(), av_d2q(), av_fast_realloc(), av_fifo_grow(), av_image_copy(), av_probe_input_buffer(), av_probe_input_format3(), av_resample(), av_resample_init(), avcodec_align_dimensions(), avcodec_align_dimensions2(), avfilter_graph_dump_to_buf(), avformat_find_stream_info(), avi_read_header(), avi_read_packet(), avi_read_seek(), avi_write_counters(), avpicture_layout(), avpriv_ac3_parse_header(), avresample_build_matrix(), avresample_open(), await_reference_row(), bidir_refine(), bink_decode_plane(), bit_allocation(), blend_slice(), blur_pixel(), build_feed_streams(), 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(), chroma_4mv_motion(), chroma_4mv_motion_lowres(), comp_ppf_coeff(), compute_pkt_fields2(), compute_target_delay(), config_input(), copy(), copy_backptr(), copy_chapters(), create_vorbis_context(), dc_test(), dca_decode_frame(), dct_error(), dct_max8x8_c(), decode(), decode_audio_block(), decode_channel_residues(), decode_chunks(), decode_component(), decode_frame(), decode_init(), decode_lowdelay_slice(), decode_lspf(), decode_p_frame(), decode_postinit(), decode_scale_factors(), decode_var_block_data(), decodeChannelSoundUnit(), dirac_decode_frame_internal(), dirac_unpack_prediction_parameters(), direct_search(), dnxhd_encode_rdo(), dnxhd_find_qscale(), do_a_deblock_C(), doHorizDefFilter_C(), doVertDefFilter_TMPL(), draw_slice(), draw_text(), encode_block(), encode_cblk(), encode_frame(), encode_init(), 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_audio_resample_init(), ff_cmap_read_palette(), ff_draw_init(), ff_emulated_edge_mc(), ff_fast_malloc(), ff_g729_postfilter(), ff_gen_syncpoint_search(), ff_get_best_fcode(), ff_gradfun_filter_line_c(), ff_h264_alloc_tables(), ff_h264_execute_ref_pic_marking(), ff_init_me(), ff_interleave_packet_per_dts(), ff_j2k_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_MPV_common_init(), ff_MPV_encode_picture(), ff_MPV_lowest_referenced_row(), ff_msmpeg4_encode_ext_header(), ff_nelly_get_sample_bits(), ff_pca(), ff_seek_frame_binary(), ff_set_min_dist_lsf(), ff_timefilter_update(), ffio_limit(), ffio_rewind_with_probe_data(), ffm_seek1(), filter(), filter_level_for_mb(), find_best_state(), find_hb_gain(), find_max_val(), find_new_headers(), findCode(), flac_parse(), flv_write_packet(), full_search(), g729d_onset_decision(), gain_scale(), generate_intervals(), generate_transition(), get_block_rd(), get_channel_layout_single(), get_dc(), get_exponent_dynamic(), get_floor_average(), get_fps(), get_limits(), get_lowest_part_list_y(), get_lowest_part_y(), get_new_centroids(), get_pix_fmt_depth(), get_qcx(), get_quant_quality(), get_quants(), get_sample_rate(), get_siz(), get_tag(), get_visual_weight(), getpix(), gmc1_motion(), guess_dc(), guess_mv(), guess_ni_flag(), gxf_seek(), h_block_filter(), horizX1Filter(), hpel_motion(), hpel_motion_lowres(), http_start_receive_data(), init(), init_exp(), init_luts(), init_offset(), init_pass2(), init_pattern_from_file(), init_ralf_vlc(), init_tile(), initFilter(), interpol(), inverse_quant(), is_intra_more_likely(), iterative_me(), kalman_smoothen(), lame_calc_attack_threshold(), libopenjpeg_copy_to_packed16(), libopenjpeg_encode_init(), loas_probe(), long_term_filter(), main(), match_format(), matroska_parse_block(), matroska_read_seek(), median4(), mkv_write_ass_blocks(), mkv_write_packet_internal(), mmsh_read_seek(), modify_qscale(), mov_build_index(), mov_read_ctts(), mov_write_stsz_tag(), mp3_read_probe(), mp_decode_layer3(), mpeg_motion_internal(), mpeg_motion_lowres(), MPV_motion_internal(), mxf_compute_ptses_fake_index(), mxf_edit_unit_absolute_offset(), mxf_read_seek(), noise_enhancer(), normalize_bits(), nut_write_header(), opt_report(), output_packet(), paint_mouse_pointer(), parse_adts_frame_header(), parse_media_type(), postProcess_TMPL(), pp_postprocess(), ps_tableinit(), put_codebook_header(), put_image(), put_subframe(), qpel_motion(), quantize_lpc_coefs(), read_header(), read_packet(), read_sbr_grid(), read_seek(), read_shape_from_file(), read_var_block_data(), read_whole_file(), render_charset(), resample(), residue_encode(), retry_transfer_wrapper(), roq_dpcm_encode_frame(), rv10_decode_frame(), rv10_decode_packet(), rv34_decode_mv(), rv34_gen_vlc(), sbg_read_header(), sbr_hf_calc_npatches(), sbr_make_f_derived(), sbr_x_gen(), scale_vector(), search_for_ms(), search_for_quantizers_anmr(), search_for_quantizers_faac(), select_input_picture(), skip_check(), smjpeg_write_packet(), stability_factor(), stabilize_lsps(), start_frame(), swr_convert_internal(), swri_resample_init(), swri_resample_TMPL(), sws_diffVec(), sws_init_context(), sws_sumVec(), swScale(), synchronize_audio(), umh_search(), update_index(), update_stream_timings(), v_block_filter(), var_diamond_search(), vc1_decode_frame(), vertX1Filter_TMPL(), video_image_display(), video_refresh(), vorbis_packet(), wmv2_pred_motion(), x11grab_read_header(), x11grab_read_packet(), x8_ac_compensation(), x8_loop_filter(), x8_setup_spatial_compensation(), yop_read_seek(), and zmbv_me().

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

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

Definition at line 57 of file common.h.

Referenced by a64multi_encode_frame(), aac_encode_frame(), ac3_bit_alloc_calc_bap_c(), ac3_decode_frame(), add_bell(), add_metadata(), adpcm_ima_compress_sample(), adpcm_yamaha_compress_sample(), adts_aac_probe(), aiff_read_packet(), alloc_array_elem(), ape_decode_frame(), apply_channel_coupling(), apply_lpc(), apply_ltp(), apply_pitch_filters(), apply_tns(), array_min_int16(), asf_read_stream_properties(), asfrtp_parse_packet(), audio_write_packet(), autocorr_max(), av_adler32_update(), av_audio_fifo_drain(), av_audio_fifo_read(), av_bprint_alloc(), av_bprint_chars(), av_bprint_finalize(), av_bprint_grow(), av_bprint_init(), av_fifo_generic_read(), av_fifo_generic_write(), av_parse_color(), av_probe_input_buffer(), av_reduce(), av_resample(), av_resample_init(), av_url_split(), avcodec_find_best_pix_fmt(), avfilter_get_audio_buffer_ref_from_arrays(), avfilter_insert_pad(), avfilter_poll_frame(), avi_read_header(), avi_read_nikon(), avi_read_seek(), avio_get_str(), avio_write(), avpriv_mpv_find_start_code(), avresample_open(), aw_parse_coords(), await_reference_mb_row(), await_references(), bidir_refine(), blend_slice(), blur_pixel(), build_filter(), build_huff(), build_table(), bytestream2_get_buffer(), bytestream2_put_buffer(), bytestream2_set_buffer(), bytestream2_skip(), bytestream2_skip_p(), cache_read(), calc_bit_demand(), calc_cpl_coord(), cdg_scroll(), chomp6(), chroma_4mv_motion_lowres(), chrRangeToJpeg16_c(), chrRangeToJpeg_c(), cin_decode_lzss(), cin_decode_rle(), cinepak_decode(), clean_index(), codeblock(), commit_bitstream_and_slice_buffer(), compute_rematrixing_strategy(), config_props(), copy_bits(), copy_chapters(), copy_tag(), count_mantissa_bits_update_ch(), count_pixels(), create_adapt_vect(), crypto_read(), dca_decode_frame(), dca_subframe_header(), dct_quantize_trellis_c(), DECLARE_ASM_CONST(), decode_ac_coeffs(), decode_block(), decode_block_refinement(), decode_byterun(), decode_component(), decode_dc_coeffs(), decode_finish_row(), decode_frame(), decode_frame_ilbm(), decode_header(), decode_lowdelay_slice(), decode_lspf(), decode_ltp(), decode_mb_i(), decode_prediction(), decode_rle(), decode_slice_header(), decode_subframe(), decode_tile(), decodeTonalComponents(), dering_TMPL(), dfa_decode_frame(), direct_search(), dnxhd_encode_rdo(), dnxhd_find_qscale(), do_a_deblock_C(), do_rematrixing(), do_video_out(), doHorizDefFilter_C(), doVertDefFilter_TMPL(), draw_mandelbrot(), draw_text(), dump_metadata(), dvb_encode_rle8(), dxa_read_packet(), eightsvx_decode_frame(), encode_ac_coeffs(), encode_acs(), encode_dc_coeffs(), encode_dcs(), encode_exponents_blk_ch(), encode_ext_header(), encode_frame(), encode_init(), encode_scalar(), encode_superframe(), encode_tile(), end_frame(), epzs_motion_search_internal(), estimate_acs(), estimate_dcs(), execute_code(), extract_header(), 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_tag_contents(), ff_audio_resample_init(), ff_cmap_read_palette(), ff_copy_and_dup(), ff_dirac_init_arith_decoder(), ff_draw_horiz_band(), ff_eac3_apply_spectral_extension(), ff_emulated_edge_mc(), ff_estimate_p_frame_motion(), ff_get_best_fcode(), ff_init_long_region(), ff_init_me(), ff_interleave_new_audio_packet(), ff_isom_write_avcc(), ff_ivi_init_tiles(), ff_j2k_init_component(), ff_jpegls_reset_coding_parameters(), ff_jpegls_update_state_regular(), ff_mms_read_data(), ff_mms_read_header(), ff_mpeg4_encode_mb(), ff_MPV_common_init(), ff_MPV_lowest_referenced_row(), ff_msmpeg4_encode_ext_header(), ff_pca(), ff_region_offset2size(), ff_rtmp_packet_read(), ff_rtmp_packet_write(), ff_rtp_check_and_send_back_rr(), ff_rtp_send_aac(), ff_rtp_send_h263(), ff_rtp_send_h263_rfc2190(), ff_rtp_send_latm(), ff_rtp_send_vp8(), ff_sipr_decode_frame_16k(), ff_spatial_idwt_buffered_slice(), ff_spatial_idwt_slice(), ff_spatial_idwt_slice2(), ff_voc_get_packet(), ff_vorbis_floor1_render_list(), ffio_fill(), ffm_seek1(), ffurl_alloc(), fill_picture_rgb(), fill_rectangle(), filter_common(), filter_level_for_mb(), filter_samples(), find_best_state(), find_frame_end(), find_optimal_param(), flac_fifo_read(), flac_fifo_read_wrap(), flac_parse(), floor_encode(), frame_thread_init(), full_search(), generate_half_size_image(), generate_intervals(), get_available_samples(), get_block_rd(), get_dc(), get_exponent_dynamic(), get_floor_average(), get_limits(), get_logical_cpus(), get_max_p_order(), get_nb_samples(), get_new_centroids(), get_pix_fmt_depth(), get_quants(), get_slice_data(), get_sockaddr(), get_str(), get_symbol(), get_symbol_inline(), get_visual_weight(), getpix(), gif_image_write_image(), guess_mv(), guess_ni_flag(), hex_log(), hpel_motion_lowres(), hScale16To15_c(), hScale16To19_c(), hScale8To15_c(), hScale8To19_c(), hScale_altivec_real(), http_read(), http_receive_data(), huffman_decode(), init_poc(), init_ralf_vlc(), init_tile(), init_tiles(), initFilter(), inverse_channel_transform(), inverse_quant(), kalman_smoothen(), kset(), lag_decode_line(), lag_decode_zero_run_line(), latm_decode_audio_specific_config(), libopenjpeg_copy_to_packed16(), loas_probe(), lowdelay_subband(), lsf_decode_fp(), lumRangeToJpeg16_c(), lumRangeToJpeg_c(), main(), matroska_ebmlnum_uint(), matroska_read_header(), median4(), mjpegb_decode_frame(), mkv_write_ass_blocks(), mov2textsub(), mov_build_index(), mov_read_default(), mov_read_dref(), mov_write_chpl_tag(), mov_write_uuidprof_tag(), mp3_fix_xing(), mp3_read_packet(), mp_decode_frame(), mp_read_changes_map(), mpc8_get_mask(), mpeg4_decode_mb(), mpeg4_decode_sprite_trajectory(), mpeg4_encode_gop_header(), mpeg_decode_slice(), mpeg_motion_lowres(), mpegaudio_parse(), mszh_decomp(), mxf_read_packet(), mxf_read_seek(), mxpeg_decode_app(), mxpeg_decode_com(), noise_enhancer(), nsv_read_chunk(), nut_write_packet(), ogg_buffer_data(), ogg_packet(), ogm_header(), op(), opt_default(), pack_yuv(), packed_16bpc_bswap(), paint_mouse_pointer(), param_write_hex(), parse_chunks(), pitch_sharpening(), png_decode_idat(), png_parse(), postProcess_TMPL(), pp_get_mode_by_name_and_quality(), pred_intra_mode(), predict_slice(), predict_slice_buffered(), print_report(), psy_3gpp_init(), put_bitstream_info(), put_image(), put_symbol(), put_symbol_inline(), pva_read_timestamp(), qcp_read_header(), qdm2_parse_subpacket(), qdm2_restore_block(), qtrle_encode_line(), quantize_bands(), read_access_unit(), read_dcs(), read_header(), read_packet(), read_seek(), read_var_block_data(), read_whole_file(), render_charset(), render_slice(), request_frame(), resample(), rm_assemble_video_frame(), rtcp_parse_packet(), rtmp_write(), rtp_send_samples(), rtp_write_header(), run_psnr(), rv20_decode_picture_header(), rv30_decode_init(), rv34_gen_vlc(), save_bits(), sbg_read_packet(), sbr_gain_calc(), sbr_make_f_master(), scaleforopp(), scaleforopp_x(), scaleforopp_y(), scaleforsame(), 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(), shorten_decode_frame(), spatial_compensation_1(), spatial_compensation_9(), spdif_probe(), srt_text_cb(), srt_to_ass(), stabilize_lsps(), sub_left_prediction_bgr32(), sub_left_prediction_rgb24(), subframe_count_exact(), subimage_with_fill(), subsampling_bounds(), super2xsai(), svq3_decode_mb(), svq3_get_ue_golomb(), swr_convert(), swr_convert_internal(), swri_resample_init(), swri_resample_TMPL(), swScale(), synchronize_audio(), synth_frame(), synthesis(), targa_decode_rle(), tgq_decode_mb(), thread_init(), to_meta_with_crop(), umh_search(), unpack(), unpack_coeffs(), update_stream_timings(), var_diamond_search(), vc1_decode_frame(), vc1_filter_line(), vf_next_put_image(), video_audio_display(), vp5_parse_coeff(), vp6_parse_coeff_huffman(), vp8_init(), vqf_read_header(), wiener_denoise(), write_subframes(), wtvfile_read_packet(), x11grab_read_header(), x11grab_read_packet(), x8_get_prediction(), x8_loop_filter(), x8_setup_spatial_compensation(), xan_decode_frame(), xan_decode_frame_type0(), xan_wc3_output_pixel_run(), xmv_fetch_audio_packet(), xsub_encode_rle(), xwma_read_packet(), yop_read_seek(), and zmbv_me().

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

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

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

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

#define FFUMOD ( a,
 )     ((a)-(b)*FFUDIV(a,b))

Definition at line 51 of file common.h.

Referenced by ff_mpeg4_encode_picture_header(), and mpeg4_encode_gop_header().

#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:
val Output value, must be an lvalue of type uint32_t.
GET_16BIT Expression returning two bytes of UTF-16 data converted to native byte order. Evaluated one or two times.
ERROR Expression to be evaluated on invalid input, typically a goto statement.

Definition at line 274 of file common.h.

Referenced by decode_str().

#define GET_UTF8 ( val,
GET_BYTE,
ERROR   ) 

Value:

val= GET_BYTE;\
    {\
        int ones= 7 - av_log2(val ^ 255);\
        if(ones==1)\
            ERROR\
        val&= 127>>ones;\
        while(--ones > 0){\
            int tmp= GET_BYTE - 128;\
            if(tmp>>6)\
                ERROR\
            val= (val<<6) + tmp;\
        }\
    }
Convert a UTF-8 character (up to 4 bytes) to its 32-bit UCS-4 encoded form.

Parameters:
val Output value, must be an lvalue of type uint32_t.
GET_BYTE Expression 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++.
ERROR Expression to be evaluated on invalid input, typically a goto statement.

Definition at line 250 of file common.h.

Referenced by ascii_to_wc(), avio_put_str16le(), draw_glyphs(), draw_text(), get_utf8(), and utf8len().

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

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

Definition at line 236 of file common.h.

Referenced by aasc_decode_frame(), aiff_read_header(), aiff_write_header(), amr_read_header(), ape_read_header(), asf_read_stream_properties(), au_read_header(), avformat_write_header(), avi_load_index(), avi_read_header(), avi_read_nikon(), avpriv_flac_is_extradata_valid(), bfi_probe(), bfi_read_packet(), caf_write_header(), daud_header(), decode_frame(), decode_frame_byterun1(), decode_frame_ilbm(), decode_init(), decode_wave_header(), dfa_probe(), dfa_read_header(), dfa_read_packet(), dirac_probe(), dshow_codecid(), dshow_pixfmt(), dxa_read_header(), dxa_read_packet(), encode_frame(), ff_mjpeg_decode_sos(), ff_mov_init_hinting(), ff_mov_read_stsd_entries(), ff_rm_read_mdpr_codecdata(), ffio_wfourcc(), ffm_read_header(), ffm_write_header(), flac_read_header(), get_codec_data(), ingenient_read_packet(), init_multbl2(), ipod_get_codec_tag(), mmf_read_header(), mov_create_chapter_track(), mov_find_codec_tag(), mov_get_codec_tag(), mov_get_dv_codec_tag(), mov_probe(), mov_read_cmov(), mov_read_default(), mov_read_dref(), mov_read_glbl(), mov_read_hdlr(), mov_read_meta(), mov_read_stco(), mov_read_stsz(), mov_read_udta_string(), mov_read_wide(), 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_trailer(), mov_write_trak_tag(), mov_write_video_tag(), mp4_get_codec_tag(), mpc_read_header(), msnwc_tcp_probe(), msnwc_tcp_read_header(), nsv_parse_NSVf_header(), nsv_read_chunk(), parse_ffconfig(), 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(), read_desc_chunk(), read_header(), rm_read_header(), rm_read_index(), siff_parse_vbv1(), siff_read_header(), smacker_read_header(), sol_read_header(), start_command_packet(), thp_probe(), utvideo_decode_init(), utvideo_encode_init(), v4l2_read_header(), vc1_decode_init(), vfw_codecid(), vfw_pixfmt(), vfw_read_header(), vid_probe(), vp3_decode_init(), vqf_probe(), vqf_read_header(), wavesynth_init(), write_packet(), wv_read_block_header(), wv_read_packet(), xsub_encoder_init(), and xwma_read_header().

#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\
        }\
    }\
Convert a 32-bit Unicode character to its UTF-16 encoded form (2 or 4 bytes).

Parameters:
val is 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.
tmp is 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_16BIT writes 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 336 of file common.h.

Referenced by avio_put_str16le().

#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\
            }\
        }\
    }
Convert a 32-bit Unicode character to its UTF-8 encoded form (up to 4 bytes long).

Parameters:
val is 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.
tmp is 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_BYTE writes 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 302 of file common.h.

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

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

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

Definition at line 47 of file common.h.

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


Function Documentation

static av_always_inline av_const int av_ceil_log2_c ( int  x  )  [static]

Compute ceil(log2(x)).

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

Definition at line 207 of file common.h.

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:
a value to clip
amin minimum value of the clip range
amax maximum value of the clip range
Returns:
clipped value

Definition at line 115 of file common.h.

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:
a value to clip
Returns:
clipped value

Definition at line 160 of file common.h.

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:
a value to clip
Returns:
clipped value

Definition at line 138 of file common.h.

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:
a value to clip
Returns:
clipped value

Definition at line 149 of file common.h.

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:
a value to clip
Returns:
clipped value

Definition at line 127 of file common.h.

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:
a value to clip
p bit position to clip at
Returns:
clipped value

Definition at line 183 of file common.h.

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:
a value to clip
amin minimum value of the clip range
amax maximum value of the clip range
Returns:
clipped value

Definition at line 196 of file common.h.

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:
a value to clip
Returns:
clipped value

Definition at line 171 of file common.h.

static av_always_inline av_const int av_log2_16bit_c ( unsigned int  v  )  [static]

Definition at line 88 of file common.h.

static av_always_inline av_const int av_log2_c ( unsigned int  v  )  [static]

Definition at line 72 of file common.h.

static av_always_inline av_const int av_popcount64_c ( uint64_t  x  )  [static]

Count number of bits set to one in x.

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

Definition at line 231 of file common.h.

static av_always_inline av_const int av_popcount_c ( uint32_t  x  )  [static]

Count number of bits set to one in x.

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

Definition at line 217 of file common.h.


Variable Documentation

const uint8_t av_reverse[256]

const uint8_t ff_log2_tab[256]

Definition at line 43 of file mathematics.c.

Referenced by av_log2_16bit_c(), av_log2_c(), ebml_read_num(), put_xsub_rle(), and seq_decode_op1().


Generated on Fri Oct 26 02:48:03 2012 for FFmpeg by  doxygen 1.5.8