#include "av1/encoder/encoder.h"
#include "av1/encoder/level.h"
#define UNDEFINED_LEVEL …
static const AV1LevelSpec av1_level_defs[SEQ_LEVELS] = …;
TARGET_LEVEL_FAIL_ID;
static const char *level_fail_messages[TARGET_LEVEL_FAIL_IDS] = …;
static double get_max_bitrate(const AV1LevelSpec *const level_spec, int tier,
BITSTREAM_PROFILE profile) { … }
double av1_get_max_bitrate_for_level(AV1_LEVEL level_index, int tier,
BITSTREAM_PROFILE profile) { … }
void av1_get_max_tiles_for_level(AV1_LEVEL level_index, int *const max_tiles,
int *const max_tile_cols) { … }
#define INVALID_TIME …
static void release_buffer(DECODER_MODEL *const decoder_model, int idx) { … }
static void initialize_buffer_pool(DECODER_MODEL *const decoder_model) { … }
static int get_free_buffer(DECODER_MODEL *const decoder_model) { … }
static void update_ref_buffers(DECODER_MODEL *const decoder_model, int idx,
int refresh_frame_flags) { … }
static double time_to_decode_frame(const AV1_COMMON *const cm,
int64_t max_decode_rate) { … }
static void release_processed_frames(DECODER_MODEL *const decoder_model,
double removal_time) { … }
static int frames_in_buffer_pool(const DECODER_MODEL *const decoder_model) { … }
static double get_presentation_time(const DECODER_MODEL *const decoder_model,
int display_index) { … }
#define MAX_TIME …
static double time_next_buffer_is_free(int num_decoded_frame,
int decoder_buffer_delay,
const FRAME_BUFFER *frame_buffer_pool,
double current_time) { … }
#undef MAX_TIME
static double get_removal_time(int mode, int num_decoded_frame,
int decoder_buffer_delay,
const FRAME_BUFFER *frame_buffer_pool,
double current_time) { … }
#if 0
void av1_decoder_model_print_status(const DECODER_MODEL *const decoder_model) {
printf(
"\n status %d, num_frame %3d, num_decoded_frame %3d, "
"num_shown_frame %3d, current time %6.2f, frames in buffer %2d, "
"presentation delay %6.2f, total interval %6.2f\n",
decoder_model->status, decoder_model->num_frame,
decoder_model->num_decoded_frame, decoder_model->num_shown_frame,
decoder_model->current_time, frames_in_buffer_pool(decoder_model),
decoder_model->initial_presentation_delay,
decoder_model->dfg_interval_queue.total_interval);
for (int i = 0; i < 10; ++i) {
const FRAME_BUFFER *const this_buffer =
&decoder_model->frame_buffer_pool[i];
printf("buffer %d, decode count %d, display count %d, present time %6.4f\n",
i, this_buffer->decoder_ref_count, this_buffer->player_ref_count,
this_buffer->presentation_time);
}
}
#endif
static void decoder_model_init(const AV1_COMP *const cpi, AV1_LEVEL level,
int op_index,
DECODER_MODEL *const decoder_model) { … }
DECODER_MODEL_STATUS av1_decoder_model_try_smooth_buf(
const AV1_COMP *const cpi, size_t coded_bits,
const DECODER_MODEL *const decoder_model) { … }
static void decoder_model_process_frame(const AV1_COMP *const cpi,
size_t coded_bits,
DECODER_MODEL *const decoder_model) { … }
void av1_init_level_info(AV1_COMP *cpi) { … }
static double get_min_cr(const AV1LevelSpec *const level_spec, int tier,
int is_still_picture, int64_t decoded_sample_rate) { … }
double av1_get_min_cr_for_level(AV1_LEVEL level_index, int tier,
int is_still_picture) { … }
static void get_temporal_parallel_params(int scalability_mode_idc,
int *temporal_parallel_num,
int *temporal_parallel_denom) { … }
#define MIN_CROPPED_TILE_WIDTH …
#define MIN_CROPPED_TILE_HEIGHT …
#define MIN_FRAME_WIDTH …
#define MIN_FRAME_HEIGHT …
#define MAX_TILE_SIZE_HEADER_RATE_PRODUCT …
static TARGET_LEVEL_FAIL_ID check_level_constraints(
const AV1LevelInfo *const level_info, AV1_LEVEL level, int tier,
int is_still_picture, BITSTREAM_PROFILE profile, int check_bitrate) { … }
static void get_tile_stats(const AV1_COMMON *const cm,
const TileDataEnc *const tile_data,
int *max_tile_size, int *max_superres_tile_width,
int *min_cropped_tile_width,
int *min_cropped_tile_height,
int *tile_width_valid) { … }
static int store_frame_record(int64_t ts_start, int64_t ts_end,
size_t encoded_size, int pic_size,
int frame_header_count, int tiles, int show_frame,
int show_existing_frame,
FrameWindowBuffer *const buffer) { … }
static int count_frames(const FrameWindowBuffer *const buffer,
int64_t duration) { … }
static void scan_past_frames(const FrameWindowBuffer *const buffer,
int num_frames_to_scan,
AV1LevelSpec *const level_spec,
AV1LevelStats *const level_stats) { … }
void av1_update_level_info(AV1_COMP *cpi, size_t size, int64_t ts_start,
int64_t ts_end) { … }
aom_codec_err_t av1_get_seq_level_idx(const SequenceHeader *seq_params,
const AV1LevelParams *level_params,
int *seq_level_idx) { … }
aom_codec_err_t av1_get_target_seq_level_idx(const SequenceHeader *seq_params,
const AV1LevelParams *level_params,
int *target_seq_level_idx) { … }