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;
30  int framerate_factor;
31  int64_t layer_target_bitrate;
32  int scaling_factor_num;
33  int scaling_factor_den;
34  int64_t target_bandwidth;
35  int64_t spatial_layer_target_bandwidth;
36  double framerate;
37  int avg_frame_size;
38  int max_q;
39  int min_q;
40  int frames_from_key_frame;
46  int sb_index;
50  int8_t *map;
55 
64 
68  uint8_t speed;
72  unsigned char group_index;
82 
87 typedef struct SVC {
89  int spatial_layer_id;
90  int temporal_layer_id;
91  int number_spatial_layers;
92  int number_temporal_layers;
93  int set_ref_frame_config;
94  int non_reference_frame;
95  int use_flexible_mode;
96  int ksvc_fixed_mode;
97  int ref_frame_comp[3];
104  int reference[INTER_REFS_PER_FRAME];
106  int ref_idx[INTER_REFS_PER_FRAME];
107  int refresh[REF_FRAMES];
108  int gld_idx_1layer;
109  double base_framerate;
110  unsigned int current_superframe;
111  unsigned int buffer_time_index[REF_FRAMES];
112  unsigned char buffer_spatial_layer[REF_FRAMES];
113  int skip_mvsearch_last;
114  int skip_mvsearch_gf;
115  int spatial_layer_fb[REF_FRAMES];
116  int temporal_layer_fb[REF_FRAMES];
117  int num_encoded_top_layer;
118  int first_layer_denoise;
119  int high_source_sad_superframe;
126 
131 
137 
142 } SVC;
143 
144 struct AV1_COMP;
145 
156 void av1_init_layer_context(struct AV1_COMP *const cpi);
157 
169 void av1_update_layer_context_change_config(struct AV1_COMP *const cpi,
170  const int64_t target_bandwidth);
171 
184 void av1_update_temporal_layer_framerate(struct AV1_COMP *const cpi);
185 
197 void av1_restore_layer_context(struct AV1_COMP *const cpi);
198 
209 void av1_save_layer_context(struct AV1_COMP *const cpi);
210 
221 void av1_free_svc_cyclic_refresh(struct AV1_COMP *const cpi);
222 
234 void av1_svc_reset_temporal_layers(struct AV1_COMP *const cpi, int is_key);
235 
246 void av1_one_pass_cbr_svc_start_layer(struct AV1_COMP *const cpi);
247 
258 int av1_svc_primary_ref_frame(const struct AV1_COMP *const cpi);
259 
272 void av1_get_layer_resolution(const int width_org, const int height_org,
273  const int num, const int den, int *width_out,
274  int *height_out);
275 
276 void av1_set_svc_fixed_mode(struct AV1_COMP *const cpi);
277 
278 void av1_svc_check_reset_layer_rc_flag(struct AV1_COMP *const cpi);
279 
280 #ifdef __cplusplus
281 } // extern "C"
282 #endif
283 
284 #endif // AOM_AV1_ENCODER_SVC_LAYERCONTEXT_H_
Declares top-level encoder structures and functions.
int av1_svc_primary_ref_frame(const struct AV1_COMP *const cpi)
Get primary reference frame for current layer.
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:144
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:294
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:168
void av1_save_layer_context(struct AV1_COMP *const cpi)
Save the layer context after encoding the frame.
Definition: svc_layercontext.c:214
void av1_init_layer_context(struct AV1_COMP *const cpi)
Initialize layer context data from init_config().
Definition: svc_layercontext.c:24
struct SVC SVC
The stucture of SVC.
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:283
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:321
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:307
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:88
#define AOM_MAX_LAYERS
Definition: aomcx.h:1566
#define AOM_MAX_SS_LAYERS
Definition: aomcx.h:1567
Top level encoder structure.
Definition: encoder.h:2664
The stucture of quantities related to each spatial and temporal layer.
Definition: svc_layercontext.h:26
int actual_num_seg1_blocks
Definition: svc_layercontext.h:54
int sb_index
Definition: svc_layercontext.h:46
int counter_encode_maxq_scene_change
Definition: svc_layercontext.h:63
uint8_t speed
Definition: svc_layercontext.h:68
int actual_num_seg2_blocks
Definition: svc_layercontext.h:59
int max_mv_magnitude
Definition: svc_layercontext.h:80
int is_key_frame
Definition: svc_layercontext.h:76
unsigned char group_index
Definition: svc_layercontext.h:72
int8_t * map
Definition: svc_layercontext.h:50
Primary Rate Control parameters and status.
Definition: ratectrl.h:261
Rate Control parameters and status.
Definition: ratectrl.h:134
The stucture of SVC.
Definition: svc_layercontext.h:87
LAYER_CONTEXT layer_context[32]
Definition: svc_layercontext.h:125
int force_zero_mode_spatial_ref
Definition: svc_layercontext.h:141
int reference[INTER_REFS_PER_FRAME]
Definition: svc_layercontext.h:104
InterpFilter downsample_filter_type[4]
Definition: svc_layercontext.h:130
int downsample_filter_phase[4]
Definition: svc_layercontext.h:136