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 "mem.h"
#include "config.h"
#include "internal.h"

Go to the source code of this file.


#define AV_GCC_VERSION_AT_LEAST(x, y)   0
#define av_always_inline   inline
#define av_cold
#define av_unused
#define av_uninit(x)   x
#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 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) | (d << 24))
#define MKBETAG(a, b, c, d)   (d | (c << 8) | (b << 16) | (a << 24))
#define GET_UTF8(val, GET_BYTE, ERROR)
#define PUT_UTF8(val, tmp, PUT_BYTE)


static av_const int av_log2 (unsigned int v)
static av_const int av_log2_16bit (unsigned int v)
static av_const int av_clip (int a, int amin, int amax)
 Clips a signed integer value into the amin-amax range.
static av_const uint8_t av_clip_uint8 (int a)
 Clips a signed integer value into the 0-255 range.
static av_const int16_t av_clip_int16 (int a)
 Clips a signed integer value into the -32768,32767 range.
static av_const float av_clipf (float a, float amin, float amax)
 Clips a float value into the amin-amax range.


const uint8_t ff_log2_tab [256]

Detailed Description

common internal and external API header

Definition in file common.h.

Define Documentation

#define av_always_inline   inline

Definition at line 48 of file common.h.

#define av_cold

Definition at line 80 of file common.h.

 )     0

Definition at line 41 of file common.h.

#define av_uninit (  )     x

#define av_unused

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

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

Definition at line 120 of file common.h.

Referenced by add_8x8basis_TMPL(), av_encode(), av_reduce(), av_resample(), avi_read_header(), 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_frame_header(), decode_q_branch(), dering_TMPL(), do_a_deblock_C(), doHorizDefFilter_C(), doHorizLowPass_C(), doVertDefFilter_TMPL(), doVertLowPass_TMPL(), dpcm_predict(), draw_line(), dv_init_enc_block(), encode_block(), encode_header(), encode_q_branch(), encode_q_branch2(), encode_subband_c0run(), estimate_stereo_mode(), ff_ac3_bit_alloc_calc_psd(), ff_init_me(), ff_jpegls_update_state_regular(), ff_mpeg1_encode_init(), ff_msmpeg4_decode_block(), ff_nelly_get_sample_bits(), filter_mb_dir(), filter_mb_mbaff_edgecv(), filter_mb_mbaff_edgev(), find_frame_rate_index(), flashsv_encode_frame(), funny_diamond_search(), get_block_bits(), get_diff_limited_q(), get_needed_flags(), get_qminmax(), get_sae(), get_scale_factor(), guess_mv(), gxf_seek(), h263_h_loop_filter_c(), h263_v_loop_filter_c(), h264_loop_filter_chroma_c(), h264_loop_filter_chroma_intra_c(), h264_loop_filter_luma_c(), h264_loop_filter_luma_intra_c(), h_block_filter(), hadamard8_intra8x8_c(), headroom(), horizX1Filter(), implicit_weight_table(), init_uni_ac_vlc(), initFilter(), ls_decode_line(), ls_encode_line(), ls_encode_regular(), ls_get_code_runterm(), mov_read_ctts(), mov_read_packet(), mpc8_decode_frame(), mpeg1_encode_sequence_header(), mpeg4_decode_block(), nsse16_c(), nsse16_mmx(), nsse8_c(), nsse8_mmx(), packedCopy(), postProcess_TMPL(), pp_postprocess(), pred_direct_motion(), put_s(), put_symbol(), read_rle_sgi(), render_line(), render_slice(), reverse_dc_prediction(), rv40_adaptive_loop_filter(), rv40_weak_loop_filter(), sab_diamond_search(), seq_unpack_rle_block(), skip_check(), sum_abs_dctelem_c(), sws_getShiftedVec(), try_8x8basis_TMPL(), update_vlc_state(), v_block_filter(), var_diamond_search(), vc1_filter_line(), vc1_pred_b_mv(), vc1_pred_mv(), vertX1Filter_TMPL(), vorbis_floor1_decode(), vp6_filter(), vsad16_c(), wmv2_pred_motion(), and x8_loop_filter().

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

Definition at line 123 of file common.h.

Referenced by adaptive_quantization(), add_codec(), addTonalComponents(), allocate_buffers(), apply_tns(), asf_write_packet(), av_build_filter(), av_d2q(), av_encode(), av_fast_realloc(), av_fifo_init(), av_resample(), av_resample_init(), av_seek_frame_binary(), avcodec_default_get_buffer(), avi_read_header(), avi_read_idx1(), avi_read_packet(), avi_write_counters(), bit_allocation(), calc_lowcomp(), calc_lowcomp1(), cavs_decode_frame(), compute_frame_delay(), compute_pkt_fields2(), copy(), copy_backptr(), create_vorbis_context(), dct_error(), dct_max8x8_c(), decode(), decode_audio_block(), decode_chunks(), decode_frame(), decode_lspf(), decode_p_frame(), decodeChannelSoundUnit(), direct_search(), dnxhd_encode_rdo(), dnxhd_find_qscale(), do_a_deblock_C(), do_audio_out(), doHorizDefFilter_C(), doVertDefFilter_TMPL(), encode_block(), encode_init(), encode_picture(), epzs_motion_search_internal(), ff_ac3_bit_alloc_calc_bap(), 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_emulated_edge_mc(), ff_get_best_fcode(), ff_init_me(), 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(), findCode(), flac_decode_frame(), flv_write_packet(), full_search(), get_block_rd(), get_dc(), get_exponent_dynamic(), get_floor_average(), get_limits(), get_new_centroids(), get_quant_quality(), get_visual_weight(), guess_mv(), gxf_seek(), h_block_filter(), horizX1Filter(), init_dequantizer(), init_exp(), init_offset(), initFilter(), is_intra_more_likely(), iterative_me(), libopenjpeg_decode_frame(), match_format(), matroska_parse_block(), matroska_read_seek(), median4(), mkv_write_ass_blocks(), mkv_write_packet(), modify_qscale(), mov_write_esds_tag(), mp3_read_probe(), MPV_encode_picture(), output_packet(), postProcess_TMPL(), pp_postprocess(), put_codebook_header(), quantize_lpc_coefs(), read_braindead_odml_indx(), residue_encode(), rv34_gen_vlc(), select_input_picture(), shorten_decode_frame(), skip_check(), sp5x_decode_frame(), sws_diffVec(), sws_getContext(), sws_sumVec(), try_decode_frame(), umh_search(), v_block_filter(), var_diamond_search(), vertX1Filter_TMPL(), wmv2_pred_motion(), write_header(), x8_ac_compensation(), x8_loop_filter(), x8_setup_spatial_compensation(), and zmbv_me().

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

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

Definition at line 125 of file common.h.

Referenced by ac3_decode_frame(), ape_decode_frame(), ape_tag_read_field(), apply_pitch_filters(), apply_tns(), asf_read_header(), av_build_filter(), av_fifo_generic_read(), av_fifo_generic_write(), av_reduce(), av_resample(), av_resample_init(), avfilter_insert_pad(), avfilter_merge_formats(), avfilter_poll_frame(), avi_read_header(), chomp6(), cin_decode_lzss(), cin_decode_rle(), cinaudio_decode_frame(), clean_index(), copy_and_dup(), count_pixels(), dct_quantize_trellis_c(), decode_block_refinement(), decode_frame(), decode_lspf(), decode_mb_i(), decode_prediction(), decode_rgb_frame(), decode_rle(), decode_slice_header(), decodeTonalComponents(), dering_TMPL(), direct_search(), dnxhd_encode_rdo(), dnxhd_find_qscale(), do_a_deblock_C(), do_rematrixing(), do_video_out(), doHorizDefFilter_C(), doVertDefFilter_TMPL(), dxa_read_packet(), encode_exp(), encode_ext_header(), encode_frame(), encode_init(), encode_scalar(), encode_superframe(), epzs_motion_search_internal(), ff_aac_ac3_parse(), ff_ac3_bit_alloc_calc_bap(), ff_ac3_bit_alloc_calc_psd(), ff_acelp_reorder_lsf(), ff_draw_horiz_band(), 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_jpegls_reset_coding_parameters(), ff_jpegls_update_state_regular(), ff_pca(), ff_region_offset2size(), ff_rtp_send_aac(), ff_spatial_idwt_buffered_slice(), ff_spatial_idwt_slice(), ff_vorbis_floor1_render_list(), fill_rectangle(), find_optimal_param(), flac_decode_frame(), floor_encode(), full_search(), get_block_rd(), get_dc(), get_exponent_dynamic(), get_floor_average(), get_limits(), get_max_p_order(), get_meta(), get_new_centroids(), get_str(), get_symbol(), get_visual_weight(), guess_mv(), hcscale_TMPL(), hScale_altivec_real(), huffman_decode(), hyscale_TMPL(), id3v2_read_ttag(), init_poc(), initFilter(), interleave_buffer(), iv_decode_frame(), main(), median4(), mjpegb_decode_frame(), mkv_write_ass_blocks(), mkv_write_packet(), mov2textsub(), mov_read_default(), mov_read_dref(), mov_write_uuidprof_tag(), mp_decode_frame(), mp_read_changes_map(), mpc8_get_mask(), mpeg4_decode_sprite_trajectory(), mpeg_decode_slice(), mpegaudio_parse(), ogg_write_page(), paint_mouse_pointer(), pcm_decode_frame(), postProcess_TMPL(), pred_intra_mode(), predict_slice(), predict_slice_buffered(), put_bitstream_info(), put_symbol(), pva_read_timestamp(), qtrle_encode_line(), read_access_unit(), rm_assemble_video_frame(), rtp_check_and_send_back_rr(), rtp_send_samples(), rv30_decode_init(), rv34_gen_vlc(), seq_unpack_rle_block(), shorten_decode_frame(), spatial_compensation_1(), spatial_compensation_9(), stream_component_open(), sub_left_prediction_bgr32(), svq3_decode_mb(), svq3_get_ue_golomb(), truespeech_decode_frame(), umh_search(), unpack(), unpack_coeffs(), url_split(), var_diamond_search(), vc1_filter_line(), voc_get_packet(), vorbis_decode_init(), vp5_parse_coeff(), vp6_parse_coeff_huffman(), wav_read_packet(), write_packet(), x8_get_prediction(), x8_loop_filter(), x8_setup_spatial_compensation(), and zmbv_me().

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

Definition at line 126 of file common.h.

Referenced by mov_read_udta_string(), and pred_direct_motion().

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

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

#define GET_UTF8 ( val,
ERROR   ) 


val= GET_BYTE;\
        int ones= 7 - av_log2(val ^ 255);\
        val&= 127>>ones;\
        while(--ones > 0){\
            int tmp= GET_BYTE - 128;\
            val= (val<<6) + tmp;\
Converts a UTF-8 character (up to 4 bytes long) to its 32-bit UCS-4 encoded form
val is the output and should be of type uint32_t. It holds the converted UCS-4 character and should be a left value.
GET_BYTE gets UTF-8 encoded bytes from any proper source. It can be a function or a statement whose return value or evaluated value is of type uint8_t. It will be executed up to 4 times for values in the valid UTF-8 range, and up to 7 times in the general case.
ERROR action that should be taken when an invalid UTF-8 byte is returned from GET_BYTE. It should be a statement that jumps out of the macro, like exit(), goto, return, break, or continue.

Definition at line 228 of file common.h.

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

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

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

#define PUT_UTF8 ( val,


        int bytes, shift;\
        uint32_t in = val;\
        if (in < 0x80) {\
            tmp = in;\
        } else {\
            bytes = (av_log2(in) + 4) / 5;\
            shift = (bytes - 1) * 6;\
            tmp = (256 - (256 >> bytes)) | (in >> shift);\
            while (shift >= 6) {\
                shift -= 6;\
                tmp = 0x80 | ((in >> shift) & 0x3f);\
Converts a 32-bit Unicode character to its UTF-8 encoded form (up to 4 bytes long).
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 259 of file common.h.

Referenced by get_str16_nolen(), id3v2_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 117 of file common.h.

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

Function Documentation

static av_const int av_clip ( int  a,
int  amin,
int  amax 
) [inline, static]

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

a value to clip
amin minimum value of the clip range
amax maximum value of the clip range
clipped value

Definition at line 169 of file common.h.

Referenced by AC3_encode_init(), adpcm_ct_expand_nibble(), adpcm_decode_frame(), adpcm_sbpro_expand_nibble(), adpcm_yamaha_expand_nibble(), alac_encode_init(), av_build_filter(), bit_allocation(), blend_subrect(), build_qp_table(), categorize(), choose_vlc_set(), chroma_4mv_motion(), decode(), decode_gain_and_index(), decode_slice(), decode_subband_slice_buffered(), dequantize(), dequantize_slice_buffered(), direct_search(), do_audio_out(), draw_arrow(), draw_line(), encode_block(), encode_frame(), encode_mb_internal(), eval_expr(), ff_ac3_bit_alloc_calc_bap(), ff_er_add_slice(), ff_gmc_c(), ff_mspel_motion(), ff_nelly_get_sample_bits(), ff_vbv_update(), filter_mb_mbaff_edgecv(), filter_mb_mbaff_edgev(), flac_encode_init(), g726_decode(), get_dc(), get_qminmax(), get_scale_factor(), gmc1_motion(), gmc_c(), h263_h_loop_filter_c(), h263_v_loop_filter_c(), h264_loop_filter_chroma_c(), h264_loop_filter_luma_c(), hpel_motion(), implicit_weight_table(), init_dequantizer(), init_pass2(), loop_filter_c1(), loop_filter_l1(), ls_decode_line(), ls_encode_line(), mp_decode_frame_helper(), mp_decode_line(), MPV_motion_internal(), png_enc_init(), quant(), quantize(), quantize_lpc_coefs(), ratecontrol_1pass(), rv30_weak_loop_filter(), rv40_adaptive_loop_filter(), sum_bits(), svq3_mc_dir(), svq3_mc_dir_part(), truespeech_synth(), update_qscale(), vc1_interp_mc(), vc1_mc_1mv(), vc1_mc_4mv_chroma(), vc1_mc_4mv_luma(), vc1_pred_b_mv(), vp5_parse_coeff_models(), and vp6_parse_coeff_models().

static av_const int16_t av_clip_int16 ( int  a  )  [inline, static]

static av_const uint8_t av_clip_uint8 ( int  a  )  [inline, static]

static av_const float av_clipf ( float  a,
float  amin,
float  amax 
) [inline, static]

Clips a float value into the amin-amax range.

a value to clip
amin minimum value of the clip range
amax maximum value of the clip range
clipped value

Definition at line 205 of file common.h.

Referenced by decode(), and qcelp_decode_frame().

static av_const int av_log2 ( unsigned int  v  )  [inline, static]

static av_const int av_log2_16bit ( unsigned int  v  )  [inline, static]

Variable Documentation

const uint8_t ff_log2_tab[256]

Definition at line 42 of file mathematics.c.

Referenced by av_log2(), av_log2_16bit(), decode_frame(), rtsp_read_header(), and seq_decode_op1().

Generated on Fri Oct 26 02:35:46 2012 for FFmpeg by  doxygen 1.5.8