FFmpeg
Data Structures | Macros | Functions
internal.h File Reference
#include <stdint.h>
#include "libavutil/buffer.h"
#include "libavutil/channel_layout.h"
#include "libavutil/mathematics.h"
#include "libavutil/pixfmt.h"
#include "avcodec.h"
#include "config.h"

Go to the source code of this file.

Data Structures

struct  AVCodecInternal
 

Macros

#define FF_SANE_NB_CHANNELS   512U
 
#define STRIDE_ALIGN   8
 
#define FF_MAX_EXTRADATA_SIZE   ((1 << 28) - AV_INPUT_BUFFER_PADDING_SIZE)
 Maximum size in bytes of extradata. More...
 
#define FF_REGET_BUFFER_FLAG_READONLY   1
 the returned buffer does not need to be writable More...
 

Functions

int ff_match_2uint16 (const uint16_t(*tab)[2], int size, int a, int b)
 Return the index into tab at which {a,b} match elements {[0],[1]} of tab. More...
 
unsigned int ff_toupper4 (unsigned int x)
 
void ff_color_frame (AVFrame *frame, const int color[4])
 
static av_always_inline int64_t ff_samples_to_time_base (AVCodecContext *avctx, int64_t samples)
 Rescale from sample rate to AVCodecContext.time_base. More...
 
static av_always_inline float ff_exp2fi (int x)
 2^(x) for integer x More...
 
int ff_get_buffer (AVCodecContext *avctx, AVFrame *frame, int flags)
 Get a buffer for a frame. More...
 
int ff_reget_buffer (AVCodecContext *avctx, AVFrame *frame, int flags)
 Identical in function to ff_get_buffer(), except it reuses the existing buffer if available. More...
 
int ff_thread_can_start_frame (AVCodecContext *avctx)
 
int avpriv_h264_has_num_reorder_frames (AVCodecContext *avctx)
 
int avpriv_codec_get_cap_skip_frame_fill_param (const AVCodec *codec)
 
int ff_set_dimensions (AVCodecContext *s, int width, int height)
 Check that the provided frame dimensions are valid and set them on the codec context. More...
 
int ff_set_sar (AVCodecContext *avctx, AVRational sar)
 Check that the provided sample aspect ratio is valid and set it on the codec context. More...
 
int ff_side_data_update_matrix_encoding (AVFrame *frame, enum AVMatrixEncoding matrix_encoding)
 Add or update AV_FRAME_DATA_MATRIXENCODING side data. More...
 
int ff_get_format (AVCodecContext *avctx, const enum AVPixelFormat *fmt)
 Select the (possibly hardware accelerated) pixel format. More...
 
AVCPBPropertiesff_add_cpb_side_data (AVCodecContext *avctx)
 Add a CPB properties side data to an encoding context. More...
 
int ff_alloc_timecode_sei (const AVFrame *frame, AVRational rate, size_t prefix_len, void **data, size_t *sei_size)
 Check AVFrame for S12M timecode side data and allocate and fill TC SEI message with timecode info. More...
 
int64_t ff_guess_coded_bitrate (AVCodecContext *avctx)
 Get an estimated video bitrate based on frame size, frame rate and coded bits per pixel. More...
 
int ff_int_from_list_or_default (void *ctx, const char *val_name, int val, const int *array_valid_values, int default_value)
 Check if a value is in the list. More...
 
void ff_dvdsub_parse_palette (uint32_t *palette, const char *p)
 

Detailed Description

common internal api header.

Definition in file internal.h.

Macro Definition Documentation

◆ FF_SANE_NB_CHANNELS

#define FF_SANE_NB_CHANNELS   512U

Definition at line 36 of file internal.h.

◆ STRIDE_ALIGN

#define STRIDE_ALIGN   8

Definition at line 45 of file internal.h.

◆ FF_MAX_EXTRADATA_SIZE

#define FF_MAX_EXTRADATA_SIZE   ((1 << 28) - AV_INPUT_BUFFER_PADDING_SIZE)

Maximum size in bytes of extradata.

This value was chosen such that every bit of the buffer is addressable by a 32-bit signed integer as used by get_bits.

Definition at line 168 of file internal.h.

◆ FF_REGET_BUFFER_FLAG_READONLY

#define FF_REGET_BUFFER_FLAG_READONLY   1

the returned buffer does not need to be writable

Definition at line 208 of file internal.h.

Function Documentation

◆ ff_match_2uint16()

int ff_match_2uint16 ( const uint16_t(*)  tab[2],
int  size,
int  a,
int  b 
)

Return the index into tab at which {a,b} match elements {[0],[1]} of tab.

If there is no such matching pair then size is returned.

Definition at line 872 of file utils.c.

Referenced by ff_h263_encode_picture_header(), ff_mpv_encode_init(), and svq1_write_header().

◆ ff_toupper4()

unsigned int ff_toupper4 ( unsigned int  x)

◆ ff_color_frame()

void ff_color_frame ( AVFrame frame,
const int  color[4] 
)

Definition at line 414 of file utils.c.

Referenced by h264_field_start().

◆ ff_samples_to_time_base()

static av_always_inline int64_t ff_samples_to_time_base ( AVCodecContext avctx,
int64_t  samples 
)
static

◆ ff_exp2fi()

static av_always_inline float ff_exp2fi ( int  x)
static

2^(x) for integer x

Returns
correctly rounded float

Definition at line 186 of file internal.h.

Referenced by init_band_stepsize(), and sbr_dequant().

◆ ff_get_buffer()

int ff_get_buffer ( AVCodecContext avctx,
AVFrame frame,
int  flags 
)

Get a buffer for a frame.

This is a wrapper around AVCodecContext.get_buffer() and should be used instead calling get_buffer() directly.

Definition at line 1403 of file decode.c.

Referenced by ac3_decode_frame(), adpcm_decode_frame(), adx_decode_frame(), alloc_frame(), amrnb_decode_frame(), amrwb_decode_frame(), aom_decode(), ape_decode_frame(), aptx_decode_frame(), atrac1_decode_frame(), atrac3_decode_frame(), atrac3al_decode_frame(), atrac3p_decode_frame(), atrac9_decode_frame(), aura_decode_frame(), avui_decode_frame(), bfi_decode_frame(), binkaudio_receive_frame(), bmp_decode_frame(), bmv_aud_decode_frame(), cdg_decode_frame(), cdxl_decode_frame(), cinaudio_decode_frame(), cmv_decode_frame(), cng_decode_frame(), cook_decode_frame(), copy_frame(), copy_output(), cuvid_output_frame(), cyuv_decode_frame(), dds_decode(), decode_frame(), decode_pic(), decode_tag(), dfa_decode_frame(), dfpwm_dec_frame(), dpcm_decode_frame(), dss_sp_decode_frame(), eightsvx_decode_frame(), escape124_decode_frame(), escape130_decode_frame(), evrc_decode_frame(), execute_code(), fastaudio_decode(), fdk_aac_decode_frame(), ff_dca_lbr_filter_frame(), ff_dca_xll_filter_frame(), ff_ivi_decode_frame(), ff_mjpeg_decode_sof(), ff_snow_common_init_after_header(), ff_snow_get_buffer(), ff_thread_get_buffer(), ff_thread_get_ext_buffer(), ff_twinvq_decode_frame(), ff_vp56_decode_frame(), ffat_decode(), ffmal_copy_frame(), filter_frame(), filter_frame_fixed(), filter_frame_float(), fits_decode_frame(), frame_configure_elements(), g2m_decode_frame(), g722_decode_frame(), g723_1_decode_frame(), gdv_decode_frame(), gem_decode_frame(), get_buffer(), get_buffer_with_edge(), gif_decode_frame(), gsm_decode_frame(), hcom_decode(), hnm_decode_frame(), hq_decode_frame(), hqa_decode_frame(), idcin_decode_frame(), ilbc_decode_frame(), imc_decode_frame(), init_frames(), ipu_decode_frame(), ipvideo_decode_frame(), libcelt_dec_decode(), libcodec2_decode(), libgsm_decode_frame(), libjxl_decode_frame(), libopus_decode(), librsvg_decode_frame(), libspeex_decode_frame(), libuavs3d_decode_frame(), m101_decode_frame(), mace_decode_frame(), mediacodec_wrap_sw_buffer(), mp_decode_frame(), mpc7_decode_frame(), mpc8_decode_frame(), msp2_decode_frame(), mss2_decode_frame(), mvc_decode_frame(), mxpeg_decode_frame(), oggvorbis_decode_frame(), on2avc_decode_frame(), opus_decode_packet(), output_data(), paf_audio_decode(), pcm_bluray_decode_frame(), pcm_decode_frame(), pcm_dvd_decode_frame(), pcx_decode_frame(), pgx_decode_frame(), pix_decode_frame(), pnm_decode_frame(), ptx_decode_frame(), qcelp_decode_frame(), qdm2_decode_frame(), qdmc_decode_frame(), ra144_decode_frame(), ra288_decode_frame(), reget_buffer_internal(), rl2_decode_frame(), s302m_decode_frame(), sbc_decode_frame(), sga_decode_frame(), sgirle_decode_frame(), shorten_decode_frame(), sipr_decode_frame(), siren_decode(), smka_decode_frame(), speex_decode_frame(), submit_packet(), sunrast_decode_frame(), svc_decode_frame(), svq1_decode_frame(), synth_superframe(), tdsc_decode_frame(), tgq_decode_frame(), tgv_decode_frame(), thread_get_buffer_internal(), tmv_decode_frame(), tqi_decode_frame(), truemotion2rt_decode_frame(), truespeech_decode_frame(), txd_decode_frame(), v308_decode_frame(), v408_decode_frame(), vbn_decode_frame(), vcr1_decode_frame(), vmdaudio_decode_frame(), vmdvideo_decode_frame(), vorbis_decode_frame(), vpx_decode(), wavesynth_decode(), wma_decode_superframe(), wmapro_decode_packet(), ws_snd_decode_frame(), xan_decode_frame(), xbm_decode_frame(), xface_decode_frame(), xma_decode_packet(), xpm_decode_frame(), xwd_decode_frame(), y216_decode_frame(), y41p_decode_frame(), yuv4_decode_frame(), zero12v_decode_frame(), and zerocodec_decode_frame().

◆ ff_reget_buffer()

int ff_reget_buffer ( AVCodecContext avctx,
AVFrame frame,
int  flags 
)

◆ ff_thread_can_start_frame()

int ff_thread_can_start_frame ( AVCodecContext avctx)

Definition at line 934 of file pthread_frame.c.

Referenced by ff_mpv_frame_start(), and h264_frame_start().

◆ avpriv_h264_has_num_reorder_frames()

int avpriv_h264_has_num_reorder_frames ( AVCodecContext avctx)

Definition at line 57 of file h264dec.c.

Referenced by has_decode_delay_been_guessed().

◆ avpriv_codec_get_cap_skip_frame_fill_param()

int avpriv_codec_get_cap_skip_frame_fill_param ( const AVCodec codec)

Definition at line 443 of file utils.c.

Referenced by try_decode_frame().

◆ ff_set_dimensions()

int ff_set_dimensions ( AVCodecContext s,
int  width,
int  height 
)

Check that the provided frame dimensions are valid and set them on the codec context.

Definition at line 90 of file utils.c.

Referenced by alloc_buffers(), aom_decode(), apply_param_change(), avcodec_open2(), avs_decode_init(), bmp_decode_frame(), cdg_decode_init(), cdxl_decode_frame(), cfhd_decode(), clv_decode_init(), cmv_process_header(), codec_reinit(), cri_decode_frame(), dds_decode(), decode_blocks(), decode_fint(), decode_frame(), decode_frame_header(), decode_frame_headers(), decode_header(), decode_idat_chunk(), decode_init(), decode_seq_header(), dirac_decode_data_unit(), dnxhd_decode_frame(), dvbsub_parse_display_definition_segment(), dvdsub_parse_extradata(), dvvideo_decode_frame(), execute_code(), ff_h263_decode_frame(), ff_ivi_decode_frame(), ff_mjpeg_decode_sof(), ff_pnm_decode_header(), ff_rv34_decode_frame(), ff_vc1_decode_entry_point(), ff_vc1_decode_sequence_header(), ff_vp56_decode_frame(), ffmal_update_format(), fits_decode_frame(), flashsv_decode_frame(), g2m_decode_frame(), gem_decode_frame(), get_siz(), gif_decode_frame(), h261_decode_frame(), hqa_decode_frame(), init_image(), libdav1d_parse_extradata(), libdav1d_receive_frame(), libjxl_decode_frame(), libopenjpeg_decode_frame(), librsvg_decode_frame(), libuavs3d_decode_frame(), magy_decode_frame(), mediacodec_dec_parse_format(), mimic_decode_frame(), mpeg4_decode_header(), mpeg_decode_postinit(), mpegvideo_extract_headers(), mvc_decode_init(), parse_presentation_segment(), pcx_decode_frame(), pgx_decode_frame(), photocd_decode_frame(), pix_decode_frame(), pixlet_decode_frame(), process_frame_obj(), ptx_decode_frame(), qoi_decode_frame(), rl2_decode_init(), rv20_decode_picture_header(), seqvideo_decode_init(), set_context_with_sequence(), sga_decode_frame(), sunrast_decode_frame(), svc_decode_frame(), svq1_decode_frame(), svq3_decode_init(), tdsc_parse_tdsf(), tgq_decode_frame(), tgv_decode_frame(), tqi_decode_frame(), truemotion1_decode_header(), truemotion2rt_decode_header(), txd_decode_frame(), update_context_with_frame_header(), update_dimensions(), update_size(), v4l2_handle_event(), vbn_decode_frame(), vp56_size_changed(), vp5_parse_header(), vp6_parse_header(), vp8_lossless_decode_frame(), vpx_decode(), vqa_decode_init(), xbm_decode_frame(), xpm_decode_frame(), and xwd_decode_frame().

◆ ff_set_sar()

int ff_set_sar ( AVCodecContext avctx,
AVRational  sar 
)

◆ ff_side_data_update_matrix_encoding()

int ff_side_data_update_matrix_encoding ( AVFrame frame,
enum AVMatrixEncoding  matrix_encoding 
)

Add or update AV_FRAME_DATA_MATRIXENCODING side data.

Definition at line 120 of file utils.c.

Referenced by ac3_decode_frame(), ff_dca_core_filter_frame(), ff_dca_lbr_filter_frame(), ff_dca_xll_filter_frame(), and output_data().

◆ ff_get_format()

int ff_get_format ( AVCodecContext avctx,
const enum AVPixelFormat fmt 
)

Select the (possibly hardware accelerated) pixel format.

This is a wrapper around AVCodecContext.get_format() and should be used instead of calling get_format() directly.

The list of pixel formats must contain at least one valid entry, and is terminated with AV_PIX_FMT_NONE. If it is possible to decode to software, the last entry in the list must be the most accurate software format. If it is not possible to decode to software, AVCodecContext.sw_pix_fmt must be set before calling this function.

Definition at line 1100 of file decode.c.

Referenced by cuvid_decode_init(), decode_init(), ff_mediacodec_dec_init(), ff_mjpeg_decode_sof(), ff_thread_get_format(), ffmmal_init_decoder(), get_pixel_format(), h263_get_format(), qsv_decode_preinit(), submit_packet(), and vc1_decode_init().

◆ ff_add_cpb_side_data()

AVCPBProperties* ff_add_cpb_side_data ( AVCodecContext avctx)

◆ ff_alloc_timecode_sei()

int ff_alloc_timecode_sei ( const AVFrame frame,
AVRational  rate,
size_t  prefix_len,
void **  data,
size_t *  sei_size 
)

Check AVFrame for S12M timecode side data and allocate and fill TC SEI message with timecode info.

Parameters
frameRaw frame to get S12M timecode side data from
rateThe frame rate
prefix_lenNumber of bytes to allocate before SEI message
dataPointer to a variable to store allocated memory Upon return the variable will hold NULL on error or if frame has no S12M timecode info. Otherwise it will point to prefix_len uninitialized bytes followed by *sei_size SEI message
sei_sizePointer to a variable to store generated SEI message length
Returns
Zero on success, negative error code on failure

Definition at line 1072 of file utils.c.

Referenced by prepare_sei_data_array().

◆ ff_guess_coded_bitrate()

int64_t ff_guess_coded_bitrate ( AVCodecContext avctx)

Get an estimated video bitrate based on frame size, frame rate and coded bits per pixel.

Definition at line 1136 of file utils.c.

Referenced by encode_init(), raw_encode_init(), v308_encode_init(), v408_encode_init(), v410_encode_init(), and y41p_encode_init().

◆ ff_int_from_list_or_default()

int ff_int_from_list_or_default ( void *  ctx,
const char *  val_name,
int  val,
const int array_valid_values,
int  default_value 
)

Check if a value is in the list.

If not, return the default value

Parameters
ctxContext for the log msg
val_nameName of the checked value, for log msg
array_valid_valuesArray of valid int, ended with INT_MAX
default_valueValue return if checked value is not in the array
Returns
Value or default_value.

Definition at line 1157 of file utils.c.

Referenced by prores_encode_frame().

◆ ff_dvdsub_parse_palette()

void ff_dvdsub_parse_palette ( uint32_t *  palette,
const char *  p 
)

Definition at line 26 of file dvdsub.c.

Referenced by dvdsub_init(), and dvdsub_parse_extradata().