AOMedia AV1 Codec: av1/encoder/svc_layercontext.h Source File

| AOMedia AV1 Codec

svc_layercontext.h
1 /*
2 * Copyright (c) 2019, Alliance for Open Media. All Rights Reserved.
3 *
4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
11 #ifndef AOM_AV1_ENCODER_SVC_LAYERCONTEXT_H_
12 #define AOM_AV1_ENCODER_SVC_LAYERCONTEXT_H_
13
14 #include "av1/encoder/aq_cyclicrefresh.h"
15 #include "av1/encoder/encoder.h"
16 #include "av1/encoder/ratectrl.h"
17
18 #ifdef __cplusplus
19 extern "C" {
20 #endif
21
26 typedef struct {
28 RATE_CONTROL rc;
29 int framerate_factor;
30 int64_t layer_target_bitrate;
31 int scaling_factor_num;
32 int scaling_factor_den;
33 int64_t target_bandwidth;
34 int64_t spatial_layer_target_bandwidth;
35 double framerate;
36 int avg_frame_size;
37 int max_q;
38 int min_q;
39 int frames_from_key_frame;
45 int sb_index;
49 int8_t *map;
53 uint8_t *last_coded_q_map;
54
58 int actual_num_seg1_blocks;
59
63 int actual_num_seg2_blocks;
67 int counter_encode_maxq_scene_change;
68
72 uint8_t speed;
76 unsigned char group_index;
80 int is_key_frame;
84 int max_mv_magnitude;
85 } LAYER_CONTEXT;
86
91 typedef struct SVC {
93 int spatial_layer_id;
94 int temporal_layer_id;
95 int number_spatial_layers;
96 int number_temporal_layers;
97 int set_ref_frame_config;
98 int non_reference_frame;
99 int use_flexible_mode;
100 int ksvc_fixed_mode;
107 int reference[INTER_REFS_PER_FRAME];
109 int ref_idx[INTER_REFS_PER_FRAME];
110 int refresh[REF_FRAMES];
111 double base_framerate;
112 unsigned int current_superframe;
113 unsigned int buffer_time_index[REF_FRAMES];
114 unsigned char buffer_spatial_layer[REF_FRAMES];
115 int skip_mvsearch_last;
116 int skip_mvsearch_gf;
117 int spatial_layer_fb[REF_FRAMES];
118 int temporal_layer_fb[REF_FRAMES];
119 int num_encoded_top_layer;
120 int first_layer_denoise;
126 LAYER_CONTEXT layer_context[AOM_MAX_LAYERS];
127
131 InterpFilter downsample_filter_type[AOM_MAX_SS_LAYERS];
132
137 int downsample_filter_phase[AOM_MAX_SS_LAYERS];
138
142 int force_zero_mode_spatial_ref;
143 } SVC;
144
145 struct AV1_COMP;
146
157 void av1_init_layer_context(struct AV1_COMP *const cpi);
158
170 void av1_update_layer_context_change_config(struct AV1_COMP *const cpi,
171 const int64_t target_bandwidth);
172
185 void av1_update_temporal_layer_framerate(struct AV1_COMP *const cpi);
186
198 void av1_restore_layer_context(struct AV1_COMP *const cpi);
199
210 void av1_save_layer_context(struct AV1_COMP *const cpi);
211
222 void av1_free_svc_cyclic_refresh(struct AV1_COMP *const cpi);
223
235 void av1_svc_reset_temporal_layers(struct AV1_COMP *const cpi, int is_key);
236
247 void av1_one_pass_cbr_svc_start_layer(struct AV1_COMP *const cpi);
248
259 int av1_svc_primary_ref_frame(const struct AV1_COMP *const cpi);
260
273 void av1_get_layer_resolution(const int width_org, const int height_org,
274 const int num, const int den, int *width_out,
275 int *height_out);
276
277 void av1_set_svc_fixed_mode(struct AV1_COMP *const cpi);
278
279 #ifdef __cplusplus
280 } // extern "C"
281 #endif
282
283 #endif // AOM_AV1_ENCODER_SVC_LAYERCONTEXT_H_
encoder.h
Declares top-level encoder structures and functions.
av1_svc_primary_ref_frame
int av1_svc_primary_ref_frame(const struct AV1_COMP *const cpi)
Get primary reference frame for current layer.
av1_update_temporal_layer_framerate
void av1_update_temporal_layer_framerate(struct AV1_COMP *const cpi)
Prior to encoding the frame, update framerate-related quantities for the current temporal layer.
Definition: svc_layercontext.c:143
av1_svc_reset_temporal_layers
void av1_svc_reset_temporal_layers(struct AV1_COMP *const cpi, int is_key)
Reset on key frame: reset counters, references and buffer updates.
Definition: svc_layercontext.c:300
av1_restore_layer_context
void av1_restore_layer_context(struct AV1_COMP *const cpi)
Prior to encoding the frame, set the layer context, for the current layer to be encoded,...
Definition: svc_layercontext.c:167
av1_save_layer_context
void av1_save_layer_context(struct AV1_COMP *const cpi)
Save the layer context after encoding the frame.
Definition: svc_layercontext.c:213
av1_init_layer_context
void av1_init_layer_context(struct AV1_COMP *const cpi)
Initialize layer context data from init_config().
Definition: svc_layercontext.c:23
SVC
struct SVC SVC
The stucture of SVC.
av1_free_svc_cyclic_refresh
void av1_free_svc_cyclic_refresh(struct AV1_COMP *const cpi)
Free the memory used for cyclic refresh in layer context.
Definition: svc_layercontext.c:288
av1_one_pass_cbr_svc_start_layer
void av1_one_pass_cbr_svc_start_layer(struct AV1_COMP *const cpi)
Before encoding, set resolutions and allocate compressor data.
Definition: svc_layercontext.c:327
av1_get_layer_resolution
void av1_get_layer_resolution(const int width_org, const int height_org, const int num, const int den, int *width_out, int *height_out)
Get resolution for current layer.
Definition: svc_layercontext.c:313
av1_update_layer_context_change_config
void av1_update_layer_context_change_config(struct AV1_COMP *const cpi, const int64_t target_bandwidth)
Update the layer context from a change_config() call.
Definition: svc_layercontext.c:91
AOM_MAX_LAYERS
#define AOM_MAX_LAYERS
Definition: aomcx.h:1430
AOM_MAX_SS_LAYERS
#define AOM_MAX_SS_LAYERS
Definition: aomcx.h:1431
AV1_COMP
Top level encoder structure.
Definition: encoder.h:2095
LAYER_CONTEXT
The stucture of quantities related to each spatial and temporal layer.
Definition: svc_layercontext.h:26
LAYER_CONTEXT::actual_num_seg1_blocks
int actual_num_seg1_blocks
Definition: svc_layercontext.h:58
LAYER_CONTEXT::sb_index
int sb_index
Definition: svc_layercontext.h:45
LAYER_CONTEXT::counter_encode_maxq_scene_change
int counter_encode_maxq_scene_change
Definition: svc_layercontext.h:67
LAYER_CONTEXT::speed
uint8_t speed
Definition: svc_layercontext.h:72
LAYER_CONTEXT::actual_num_seg2_blocks
int actual_num_seg2_blocks
Definition: svc_layercontext.h:63
LAYER_CONTEXT::max_mv_magnitude
int max_mv_magnitude
Definition: svc_layercontext.h:84
LAYER_CONTEXT::last_coded_q_map
uint8_t * last_coded_q_map
Definition: svc_layercontext.h:53
LAYER_CONTEXT::is_key_frame
int is_key_frame
Definition: svc_layercontext.h:80
LAYER_CONTEXT::group_index
unsigned char group_index
Definition: svc_layercontext.h:76
LAYER_CONTEXT::map
int8_t * map
Definition: svc_layercontext.h:49
RATE_CONTROL
Rate Control parameters and status.
Definition: ratectrl.h:118
SVC
The stucture of SVC.
Definition: svc_layercontext.h:91
SVC::layer_context
LAYER_CONTEXT layer_context[32]
Definition: svc_layercontext.h:126
SVC::force_zero_mode_spatial_ref
int force_zero_mode_spatial_ref
Definition: svc_layercontext.h:142
SVC::reference
int reference[INTER_REFS_PER_FRAME]
Definition: svc_layercontext.h:107
SVC::downsample_filter_type
InterpFilter downsample_filter_type[4]
Definition: svc_layercontext.h:131
SVC::downsample_filter_phase
int downsample_filter_phase[4]
Definition: svc_layercontext.h:137