Skip to content

Commit 7ff45ce

Browse files
authored
Removing -irefresh-type option from VP9 encoder (#98)
Force idr_flag on (VP9 does not appear to support cra in bitstreams) Signed-off-by: Mark Feldman <mark.feldman@intel.com>
1 parent fee9c46 commit 7ff45ce

18 files changed

+31
-150
lines changed

Config/Sample.cfg

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ BaseLayerSwitchMode : 0 # 0 : Use B-frames in the base l
4444
PredStructure : 2 # 2: Random Access
4545

4646
IntraPeriod : 47 # Period of I-Frame (-1 = only first, -2 = auto) [-2 - 255]
47-
IntraRefreshType : 2 # Random Access 1:CRA, 2:IDR (when intra_period > 0) - [1-2]
4847

4948
#====================== Quantization ===============================
5049
QP : 56 # Quantization parameter - [0-63]

Docs/svt-vp9_encoder_user_guide.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ The number of frames of the sequence to encode. e.g. 100. If the input frame co
6060

6161
>-intra-period integer **[Optional]**
6262
63-
The intra period defines the interval of frames after which you insert an Intra refresh. It is strongly recommended to use (multiple of 8) -1 the closest to 1 second (e.g. 55, 47, 31, 23 should be used for 60, 50, 30, (24 or 25) respectively). When using closed gop (-irefresh-type 2) add 1 to the value above (e.g. 56 instead of 55).
63+
The intra period defines the interval of frames after which you insert an Intra refresh. It is strongly recommended to use (multiple of 8) -1 the closest to 1 second (e.g. 55, 47, 31, 23 should be used for 60, 50, 30, (24 or 25) respectively). Because all intra refreshes are closed gop add 1 to the value above (e.g. 56 instead of 55).
6464

6565
>-rc integer **[Optional]**
6666
@@ -102,7 +102,6 @@ The encoder parameters present in the Sample.cfg file are listed in this table b
102102
| **BaseLayerSwitchMode** | -base-layer-switch-mode | [0 - 1] | 0 | 0 = Use B-frames in the base layer pointing to the same past picture. <br>1 = Use P-frames in the base layer|
103103
| **PredStructure** | -pred-struct | [2] | 2 | 2 = Random Access.|
104104
| **IntraPeriod** | -intra-period | [-2 - 255] | -2 | Distance Between Intra Frame inserted. -1 denotes no intra update. -2 denotes auto. |
105-
| **IntraRefreshType** | -irefresh-type | [1 - 2] | 2 | 1 = CRA (Open GOP) <br>2 = IDR (Closed GOP) |
106105
| **QP** | -q | [0 - 63] | 50 | Initial quantization parameter for the Intra pictures used when RateControlMode 0 (CQP) |
107106
| **LoopFilter** | -loop-filter | [0 - 1] | 1 | Enables or disables the loop filter, <br>0 = OFF, 1 = ON |
108107
| **UseDefaultMeHme** | -use-default-me-hme | [0 - 1] | 1 | 0 = Overwrite Default ME HME parameters. <br>1 = Use default ME HME parameters, dependent on width and height |
@@ -117,7 +116,8 @@ The encoder parameters present in the Sample.cfg file are listed in this table b
117116
| **MinQpAllowed** | -min-qp | [0 - 63] | 10 | Minimum QP value allowed for rate control use. Only used when RateControlMode is set to 1. Has to be < MaxQpAllowed |
118117
| **AsmType** | -asm | [0 - 1] | 1 | Assembly instruction set (0 = C Only, 1 = Automatically select highest assembly instruction set supported) |
119118
| **LogicalProcessorNumber** | -lp | [0, total number of logical processor] | 0 | The number of logical processor which encoder threads run on.Refer to Appendix A.1 |
120-
| **TargetSocket** | -ss | [-1,1] | -1 | For dual socket systems, this can specify which socket the encoder runs on.Refer to Appendix A.1 || **SwitchThreadsToRtPriority** | -rt | [0 - 1] | 1 | Enables or disables threads to real time priority, 0 = OFF, 1 = ON (only works on Linux) |
119+
| **TargetSocket** | -ss | [-1,1] | -1 | For dual socket systems, this can specify which socket the encoder runs on.Refer to Appendix A.1 |
120+
| **SwitchThreadsToRtPriority** | -rt | [0 - 1] | 1 | Enables or disables threads to real time priority, 0 = OFF, 1 = ON (only works on Linux) |
121121
| **Profile** | -profile | [0] | 0 | 0 = 8-bit 4:2:0 |
122122
| **Level** | -level | [1, 2, 2.1,3, 3.1, 4, 4.1, 5, 5.1, 5.2, 6, 6.1, 6.2] | 0 | 0 to 6.2 [0 for auto determine Level] |
123123

Source/API/EbSvtVp9Enc.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -153,12 +153,6 @@ typedef struct EbSvtVp9EncConfiguration
153153
* Deault is -2. */
154154
int32_t intra_period;
155155

156-
/* Random access.
157-
* 1 = CRA, open GOP.
158-
* 2 = IDR, closed GOP.
159-
* Default is 1. */
160-
uint32_t intra_refresh_type;
161-
162156
/* Prediction structure used to construct GOP. There are two main structures
163157
* supported, which are: Low Delay (P or B) and Random Access.
164158
*

Source/App/EbAppConfig.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@
4747
#define LEVEL_TOKEN "-level"
4848
#define INTERLACED_VIDEO_TOKEN "-interlaced-video"
4949
#define SEPERATE_FILDS_TOKEN "-separate-fields"
50-
#define INTRA_REFRESH_TYPE_TOKEN "-irefresh-type" // no Eval
5150
#define LOOP_FILTER_TOKEN "-loop-filter"
5251
#define USE_DEFAULT_ME_HME_TOKEN "-use-default-me-hme"
5352
#define HME_ENABLE_TOKEN "-hme" // no Eval
@@ -145,7 +144,6 @@ static void set_encoder_bit_depth (const char *value, EbCon
145144
static void set_base_layer_switch_mode (const char *value, EbConfig *cfg) {cfg->base_layer_switch_mode = (uint8_t) strtoul(value, NULL, 0);};
146145
static void set_enc_mode (const char *value, EbConfig *cfg) {cfg->enc_mode = (uint8_t)strtoul(value, NULL, 0);};
147146
static void set_cfg_intra_period (const char *value, EbConfig *cfg) {cfg->intra_period = strtol(value, NULL, 0);};
148-
static void set_cfg_intra_refresh_type (const char *value, EbConfig *cfg) {cfg->intra_refresh_type = strtol(value, NULL, 0);};
149147
static void set_cfg_pred_structure (const char *value, EbConfig *cfg) { cfg->pred_structure = strtol(value, NULL, 0); };
150148
static void set_cfg_qp (const char *value, EbConfig *cfg) {cfg->qp = strtoul(value, NULL, 0);};
151149
static void set_cfg_use_qp_file (const char *value, EbConfig *cfg) {cfg->use_qp_file = (uint8_t)strtol(value, NULL, 0); };
@@ -222,7 +220,6 @@ ConfigEntry config_entry[] = {
222220
{ SINGLE_INPUT, BASE_LAYER_SWITCH_MODE_TOKEN, "BaseLayerSwitchMode", set_base_layer_switch_mode },
223221
{ SINGLE_INPUT, ENCMODE_TOKEN, "EncoderMode", set_enc_mode},
224222
{ SINGLE_INPUT, INTRA_PERIOD_TOKEN, "IntraPeriod", set_cfg_intra_period },
225-
{ SINGLE_INPUT, INTRA_REFRESH_TYPE_TOKEN, "IntraRefreshType", set_cfg_intra_refresh_type },
226223
{ SINGLE_INPUT, FRAME_RATE_TOKEN, "FrameRate", set_frame_rate },
227224
{ SINGLE_INPUT, FRAME_RATE_NUMERATOR_TOKEN, "FrameRateNumerator", set_frame_rate_numerator },
228225
{ SINGLE_INPUT, FRAME_RATE_DENOMINATOR_TOKEN, "FrameRateDenominator", set_frame_rate_denominator },
@@ -311,7 +308,6 @@ void eb_config_ctor(EbConfig *config_ptr)
311308

312309
config_ptr->enc_mode = 9;
313310
config_ptr->intra_period = -2;
314-
config_ptr->intra_refresh_type = 2;
315311

316312
config_ptr->pred_structure = 2;
317313

Source/App/EbAppConfig.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,6 @@ typedef struct EbConfig
220220
uint32_t base_layer_switch_mode;
221221
uint8_t enc_mode;
222222
int32_t intra_period;
223-
uint32_t intra_refresh_type;
224223
uint32_t pred_structure;
225224

226225
/****************************************

Source/App/EbAppContext.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,6 @@ EbErrorType copy_configuration_parameters(
158158
callback_data->eb_enc_parameters.source_width = config->source_width;
159159
callback_data->eb_enc_parameters.source_height = config->source_height;
160160
callback_data->eb_enc_parameters.intra_period = config->intra_period;
161-
callback_data->eb_enc_parameters.intra_refresh_type = config->intra_refresh_type;
162161
callback_data->eb_enc_parameters.base_layer_switch_mode = config->base_layer_switch_mode;
163162
callback_data->eb_enc_parameters.enc_mode = (uint8_t)config->enc_mode;
164163
callback_data->eb_enc_parameters.frame_rate = config->frame_rate;

Source/Lib/Codec/EbDefinitions.h

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -320,15 +320,6 @@ typedef struct EbH265DynEncConfiguration {
320320
uint32_t available_target_bitrate;
321321
} EbH265DynEncConfiguration;
322322

323-
/** The EbIntraRefreshType is used to describe the intra refresh type.
324-
*/
325-
typedef enum EbIntraRefreshType
326-
{
327-
NO_REFRESH = 0,
328-
CRA_REFRESH = 1,
329-
IDR_REFRESH = 2
330-
} EbIntraRefreshType;
331-
332323
#ifdef __GNUC__
333324
#define EB_ALIGN(n) __attribute__((__aligned__(n)))
334325
#elif defined(_MSC_VER)

Source/Lib/Codec/EbEncHandle.c

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1669,7 +1669,6 @@ EbErrorType eb_vp9_svt_enc_init_parameter(
16691669
config_ptr->base_layer_switch_mode = 0;
16701670
config_ptr->enc_mode = 3;
16711671
config_ptr->intra_period = 31;
1672-
config_ptr->intra_refresh_type = 1;
16731672
config_ptr->pred_structure = EB_PRED_RANDOM_ACCESS;
16741673
config_ptr->loop_filter = EB_TRUE;
16751674
config_ptr->use_default_me_hme = EB_TRUE;
@@ -1915,9 +1914,6 @@ static int32_t compute_default_intra_period(
19151914

19161915
intra_period = (ABS((fps - max_ip)) > ABS((fps - min_ip))) ? min_ip : max_ip;
19171916

1918-
if (config->intra_refresh_type == 1)
1919-
intra_period -= 1;
1920-
19211917
return intra_period;
19221918
}
19231919

@@ -1965,14 +1961,12 @@ void copy_api_from_app(
19651961

19661962
// Coding Structure
19671963
sequence_control_set_ptr->static_config.intra_period = ((EbSvtVp9EncConfiguration*)p_component_parameter_structure)->intra_period;
1968-
sequence_control_set_ptr->static_config.intra_refresh_type = ((EbSvtVp9EncConfiguration*)p_component_parameter_structure)->intra_refresh_type;
19691964
sequence_control_set_ptr->static_config.pred_structure = ((EbSvtVp9EncConfiguration*)p_component_parameter_structure)->pred_structure;
19701965
sequence_control_set_ptr->static_config.base_layer_switch_mode = ((EbSvtVp9EncConfiguration*)p_component_parameter_structure)->base_layer_switch_mode;
19711966
sequence_control_set_ptr->static_config.tune = ((EbSvtVp9EncConfiguration*)p_component_parameter_structure)->tune;
19721967
sequence_control_set_ptr->static_config.enc_mode = ((EbSvtVp9EncConfiguration*)p_component_parameter_structure)->enc_mode;
19731968

19741969
sequence_control_set_ptr->intra_period = sequence_control_set_ptr->static_config.intra_period;
1975-
sequence_control_set_ptr->intra_refresh_type = sequence_control_set_ptr->static_config.intra_refresh_type;
19761970
sequence_control_set_ptr->max_ref_count = 1;
19771971

19781972
// Quantization
@@ -2279,10 +2273,6 @@ static EbErrorType verify_settings(
22792273
return_error = EB_ErrorBadParameter;
22802274
}
22812275

2282-
if (config->intra_refresh_type > 2 || config->intra_refresh_type < 1) {
2283-
SVT_LOG("Error Instance %u: Invalid intra Refresh Type [1-2]\n", channel_number + 1);
2284-
return_error = EB_ErrorBadParameter;
2285-
}
22862276
if (config->base_layer_switch_mode > 1) {
22872277
SVT_LOG("Error Instance %u: Invalid Base Layer Switch Mode [0-1] \n", channel_number + 1);
22882278
return_error = EB_ErrorBadParameter;
@@ -2475,10 +2465,9 @@ static void print_lib_params(
24752465
SVT_LOG("\nSVT [config]: EncoderBitDepth \t\t\t\t\t\t\t: %d ", config->encoder_bit_depth);
24762466
SVT_LOG("\nSVT [config]: SourceWidth / SourceHeight\t\t\t\t\t: %d / %d ", config->source_width, config->source_height);
24772467
if (config->frame_rate_denominator != 0 && config->frame_rate_numerator != 0)
2478-
SVT_LOG("\nSVT [config]: Fps_Numerator / Fps_Denominator / Gop Size / IntraRefreshType \t: %d / %d / %d / %d", config->frame_rate_numerator > (1 << 16) ? config->frame_rate_numerator >> 16 : config->frame_rate_numerator,
2468+
SVT_LOG("\nSVT [config]: Fps_Numerator / Fps_Denominator / Gop Size\t\t: %d / %d / %d", config->frame_rate_numerator > (1 << 16) ? config->frame_rate_numerator >> 16 : config->frame_rate_numerator,
24792469
config->frame_rate_denominator > (1 << 16) ? config->frame_rate_denominator >> 16 : config->frame_rate_denominator,
2480-
config->intra_period + 1,
2481-
config->intra_refresh_type);
2470+
config->intra_period + 1);
24822471
else
24832472
SVT_LOG("\nSVT [config]: FrameRate / Gop Size\t\t\t\t\t\t: %d / %d ", config->frame_rate > 1000 ? config->frame_rate >> 16 : config->frame_rate, config->intra_period + 1);
24842473
SVT_LOG("\nSVT [config]: HierarchicalLevels / BaseLayerSwitchMode / PredStructure\t\t: %d / %d / %d ", scs->hierarchical_levels, config->base_layer_switch_mode, config->pred_structure);

Source/Lib/Codec/EbEncodeContext.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,6 @@ EbErrorType eb_vp9_encode_context_ctor(
168168
encode_context_ptr->pred_struct_position = 0;
169169
encode_context_ptr->current_input_poc = -1;
170170
encode_context_ptr->elapsed_non_idr_count = 0;
171-
encode_context_ptr->elapsed_non_cra_count = 0;
172171
encode_context_ptr->initial_picture = EB_TRUE;
173172

174173
encode_context_ptr->last_idr_picture = 0;

Source/Lib/Codec/EbEncodeContext.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,6 @@ typedef struct EncodeContext
110110
uint32_t pred_struct_position; // Current position within a prediction structure
111111

112112
uint32_t elapsed_non_idr_count;
113-
uint32_t elapsed_non_cra_count;
114113
int64_t current_input_poc;
115114
EB_BOOL initial_picture;
116115

0 commit comments

Comments
 (0)