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) | ((d) << 24))
#define MKBETAG(a, b, c, d)   ((d) | ((c) << 8) | ((b) << 16) | ((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)
#define PUT_UTF16(val, tmp, PUT_16BIT)

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.

Variables

const uint8_t ff_log2_tab [256]
const uint8_t av_reverse [256]


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 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(), av_compare_ts(), 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_fixed_vector(), decode_frame_header(), decode_q_branch(), decode_tile(), dering_TMPL(), do_a_deblock_C(), do_apply_filter(), doHorizDefFilter_C(), doHorizLowPass_C(), doVertDefFilter_TMPL(), doVertLowPass_TMPL(), dpcm_predict(), draw_line(), dv_init_enc_block(), encode_block(), estimate_stereo_mode(), ff_h264_direct_ref_list_init(), ff_init_me(), ff_jpegls_update_state_regular(), ff_mpeg1_encode_init(), ff_msmpeg4_decode_block(), ff_nelly_get_sample_bits(), find_frame_rate_index(), flashsv_encode_frame(), get_diff_limited_q(), get_needed_flags(), get_qminmax(), get_rrp(), get_sae(), get_scale_factor(), guess_mv(), gxf_seek(), h263_encode_picture_header(), 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(), init_uni_ac_vlc(), initFilter(), ls_decode_line(), ls_encode_line(), ls_encode_regular(), ls_get_code_runterm(), mov_find_next_sample(), mpc8_decode_frame(), mpeg1_encode_sequence_header(), mpeg4_decode_block(), mpeg4_encode_mb(), 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(), reverse_dc_prediction(), rv40_adaptive_loop_filter(), rv40_weak_loop_filter(), sab_diamond_search(), search_for_quantizers_faac(), seq_unpack_rle_block(), simple_limit(), skip_check(), start_frame(), sum_abs_dctelem_c(), sws_getShiftedVec(), transcode(), try_8x8basis_TMPL(), 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 ac3_bit_alloc_calc_bap_c(), ac3_eac3_probe(), adaptive_quantization(), add_codec(), addTonalComponents(), adjust_frame_information(), adts_aac_probe(), allocate_buffers(), apply_channel_coupling(), apply_tns(), asf_build_simple_index(), asf_write_packet(), av_append_packet(), av_d2q(), av_estimate_timings_from_pts(), av_fast_malloc(), av_fast_realloc(), av_image_copy(), av_probe_input_buffer(), av_resample(), av_resample_init(), av_seek_frame_binary(), avcodec_align_dimensions(), avcodec_default_get_buffer(), avformat_find_stream_info(), avi_read_header(), avi_read_packet(), avi_read_seek(), avi_write_counters(), avpicture_layout(), await_reference_row(), bidir_refine(), bink_decode_plane(), bit_allocation(), blend_slice(), build_feed_streams(), build_filter(), build_table(), calc_bit_demand(), calc_input_response(), calc_lowcomp(), calc_lowcomp1(), calc_reduced_thr_3gpp(), calc_reduction_3gpp(), cavs_decode_frame(), cdg_scroll(), compute_pkt_fields2(), compute_target_time(), copy(), copy_backptr(), copy_chapters(), create_vorbis_context(), dca_decode_frame(), dct_error(), dct_max8x8_c(), decode(), decode_audio_block(), decode_chunks(), decode_frame(), decode_lspf(), decode_p_frame(), decode_scale_factors(), decode_var_block_data(), decodeChannelSoundUnit(), decorrelation(), direct_search(), dnxhd_encode_rdo(), dnxhd_find_qscale(), do_a_deblock_C(), do_audio_out(), doHorizDefFilter_C(), doVertDefFilter_TMPL(), draw_slice(), draw_text(), encode_block(), encode_cblk(), encode_picture(), epzs_motion_search_internal(), execute_code(), ff_ac3_bit_alloc_calc_mask(), ff_ac3_bit_alloc_calc_psd(), ff_ac3_parse_header(), ff_acelp_reorder_lsf(), ff_acelp_update_past_gain(), ff_ass_add_rect(), ff_emulated_edge_mc(), ff_gen_syncpoint_search(), ff_get_best_fcode(), ff_gradfun_filter_line_c(), ff_h264_execute_ref_pic_marking(), ff_init_me(), ff_j2k_dwt_init(), ff_jpegls_init_state(), ff_jpegls_reset_coding_parameters(), ff_jpegls_update_state_regular(), ff_mjpeg_decode_dqt(), ff_nelly_get_sample_bits(), ff_pca(), ff_set_min_dist_lsf(), ff_timefilter_update(), ffio_rewind_with_probe_data(), ffm_seek1(), filter(), filter_level_for_mb(), filter_line_c(), find_best_state(), find_hb_gain(), find_max_val(), find_new_headers(), findCode(), flac_parse(), flv_write_packet(), full_search(), 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_siz(), get_tag(), get_video_frame(), get_visual_weight(), getpix(), guess_mv(), gxf_seek(), h_block_filter(), horizX1Filter(), http_start_receive_data(), init_exp(), init_luts(), init_offset(), init_pass2(), init_tile(), initFilter(), is_intra_more_likely(), kalman_smoothen(), lag_rac_init(), lame_calc_attack_threshold(), libopenjpeg_decode_frame(), main(), match_format(), matroska_parse_block(), matroska_read_seek(), median4(), mkv_write_ass_blocks(), mkv_write_packet_internal(), modify_qscale(), mov_build_index(), mov_read_ctts(), mov_write_stsz_tag(), mp3_read_probe(), MPV_common_init(), MPV_encode_picture(), MPV_lowest_referenced_row(), noise_enhancer(), output_packet(), paint_mouse_pointer(), parse_media_type(), postProcess_TMPL(), pp_postprocess(), ps_tableinit(), put_codebook_header(), put_image(), put_subframe(), quantize_lpc_coefs(), queue_picture(), read_header(), read_packet(), read_sbr_grid(), read_seek(), read_shape_from_file(), read_var_block_data(), render_charset(), residue_encode(), retry_transfer_wrapper(), rv34_gen_vlc(), sbr_hf_calc_npatches(), sbr_make_f_derived(), sbr_x_gen(), search_for_ms(), search_for_quantizers_anmr(), search_for_quantizers_faac(), select_input_picture(), shorten_decode_frame(), skip_check(), stability_factor(), stabilize_lsps(), start_frame(), sws_diffVec(), sws_init_context(), sws_sumVec(), transcode(), try_decode_frame(), umh_search(), v_block_filter(), var_diamond_search(), vc1_decode_frame(), vertX1Filter_TMPL(), video_image_display(), video_refresh(), wmv2_pred_motion(), write_header(), 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_metadata(), aiff_read_packet(), ape_decode_frame(), apply_channel_coupling(), apply_ltp(), apply_pitch_filters(), apply_rematrixing(), apply_tns(), array_min_int16(), asf_read_stream_properties(), asfrtp_parse_packet(), audio_write_packet(), 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(), avfilter_insert_pad(), avfilter_merge_formats(), avfilter_poll_frame(), avi_read_header(), avi_read_nikon(), avi_read_seek(), avio_get_str(), avio_write(), aw_parse_coords(), await_reference_mb_row(), await_references(), bidir_refine(), blend_slice(), build_filter(), build_table(), calc_bit_demand(), cdg_scroll(), chomp6(), chroma_4mv_motion_lowres(), chrRangeToJpeg_c(), cin_decode_lzss(), cin_decode_rle(), cinaudio_decode_frame(), circular_buffer_task(), clean_index(), commit_bitstream_and_slice_buffer(), compute_rematrixing_strategy(), copy_bits(), copy_chapters(), count_mantissa_bits_update_ch(), count_pixels(), create_adapt_vect(), crypto_read(), dca_decode_frame(), dct_quantize_trellis_c(), DECLARE_ASM_CONST(), decode_block(), decode_block_refinement(), decode_byterun(), decode_finish_row(), decode_frame(), decode_frame_ilbm(), decode_header(), decode_lspf(), decode_ltp(), decode_mb_i(), decode_prediction(), decode_rgb_frame(), decode_rle(), decode_slice_header(), decode_subframe(), decode_tag(), 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_text(), dxa_read_packet(), eightsvx_decode_frame(), encode_exponents_blk_ch(), encode_ext_header(), encode_frame(), encode_init(), encode_scalar(), encode_superframe(), encode_tile(), end_frame(), epzs_motion_search_internal(), execute_code(), extract_header(), extrapolate_isf(), ff_aac_ac3_parse(), ff_ac3_bit_alloc_calc_mask(), ff_ac3_bit_alloc_calc_psd(), ff_acelp_reorder_lsf(), ff_alsa_open(), ff_amf_get_field_value(), ff_amf_tag_contents(), ff_cmap_read_palette(), ff_copy_and_dup(), ff_draw_horiz_band(), ff_eac3_apply_spectral_extension(), ff_emulated_edge_mc(), ff_estimate_p_frame_motion(), ff_find_start_code(), ff_get_best_fcode(), ff_init_long_region(), ff_init_me(), ff_interleave_new_audio_packet(), 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_pca(), ff_region_offset2size(), ff_rtmp_packet_read(), ff_rtmp_packet_write(), ff_rtp_send_aac(), ff_rtp_send_h263(), ff_rtp_send_latm(), ff_rtp_send_vp8(), ff_sipr_decode_frame_16k(), ff_spatial_idwt_buffered_slice(), ff_spatial_idwt_slice(), ff_vorbis_floor1_render_list(), ffio_fill(), ffm_seek1(), ffurl_alloc(), fill_rectangle(), filter_common(), filter_level_for_mb(), find_best_state(), find_optimal_param(), flac_fifo_read(), flac_fifo_read_wrap(), flac_parse(), floor_encode(), full_search(), get_exponent_dynamic(), get_floor_average(), get_limits(), get_max_p_order(), get_new_centroids(), get_quants(), get_sockaddr(), get_str(), get_symbol(), get_symbol_inline(), get_visual_weight(), getpix(), gif_image_write_image(), guess_mv(), hpel_motion_lowres(), hScale16_c(), hScale16X_c(), hScale_altivec_real(), hScale_c(), http_read(), http_receive_data(), huffman_decode(), init_poc(), init_tile(), init_tiles(), initFilter(), interleave_buffer(), inverse_channel_transform(), iv_decode_frame(), kalman_smoothen(), lag_decode_line(), lag_decode_zero_run_line(), lsf_decode_fp(), 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(), mp_decode_frame(), mp_read_changes_map(), mpc8_get_mask(), mpeg4_decode_mb(), mpeg4_decode_sprite_trajectory(), mpeg4_encode_gop_header(), mpeg4_encode_mb(), mpeg_decode_slice(), mpeg_motion_lowres(), mpegaudio_parse(), MPV_lowest_referenced_row(), mszh_decomp(), mxpeg_decode_app(), mxpeg_decode_com(), noise_enhancer(), nsv_read_chunk(), ogg_buffer_data(), ogg_packet(), op(), paint_mouse_pointer(), parse_chunks(), pcm_decode_frame(), pitch_sharpening(), postProcess_TMPL(), 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_probe(), read_seek(), read_ttag(), read_var_block_data(), render_charset(), render_slice(), rm_assemble_video_frame(), rtcp_parse_packet(), rtp_check_and_send_back_rr(), rtp_send_samples(), rv30_decode_init(), rv34_gen_vlc(), save_bits(), sbr_gain_calc(), sbr_make_f_master(), 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(), stream_component_open(), sub_left_prediction_bgr32(), subframe_count_exact(), svq3_decode_mb(), svq3_get_ue_golomb(), swScale(), swScale_c(), synth_frame(), synthesis(), to_meta_with_crop(), truespeech_decode_frame(), udp_read(), umh_search(), unpack(), unpack_coeffs(), var_diamond_search(), vc1_decode_frame(), vc1_filter_line(), vf_next_put_image(), video_audio_display(), voc_get_packet(), vorbis_decode_init(), vp5_parse_coeff(), vp6_parse_coeff_huffman(), vp8_init(), vqf_read_header(), wavpack_decode_block(), wiener_denoise(), write_packet(), write_subframes(), wtvfile_read_packet(), x8_get_prediction(), x8_loop_filter(), x8_setup_spatial_compensation(), xan_decode_frame(), xan_decode_frame_type0(), xan_wc3_output_pixel_run(), 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 mpeg4_encode_gop_header(), and mpeg4_encode_picture_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 261 of file common.h.

Referenced by read_ttag().

#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 237 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) | ((a) << 24))

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

Definition at line 223 of file common.h.

Referenced by aiff_read_header(), aiff_write_header(), amr_read_header(), ape_read_header(), asf_read_stream_properties(), au_read_header(), avi_load_index(), avi_read_header(), avi_read_nikon(), bfi_probe(), bfi_read_packet(), 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_flac_is_extradata_valid(), ff_mjpeg_decode_init(), 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(), ipod_get_codec_tag(), mmf_read_header(), mov_create_chapter_track(), mov_get_codec_tag(), mov_get_dv_codec_tag(), mov_probe(), mov_read_cmov(), mov_read_default(), mov_read_dref(), 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_header(), rm_read_header(), rm_read_index(), siff_parse_vbv1(), siff_read_header(), smacker_read_header(), sol_read_header(), start_command_packet(), thp_probe(), vc1_decode_init(), vfw_codecid(), vfw_pixfmt(), vfw_read_header(), vid_probe(), vp3_decode_init(), vqf_probe(), vqf_read_header(), 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 323 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 289 of file common.h.

Referenced by count_frame_header(), mov_read_mac_string(), read_ttag(), 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 204 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 112 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 157 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 135 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 146 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 124 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 180 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 193 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 168 of file common.h.

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

Definition at line 85 of file common.h.

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

Definition at line 69 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 214 of file common.h.


Variable Documentation

const uint8_t av_reverse[256]

const uint8_t ff_log2_tab[256]


Generated on Fri Oct 26 02:38:21 2012 for FFmpeg by  doxygen 1.5.8