diff --git a/Config/Sample.cfg b/Config/Sample.cfg index 4b7f44b..76a31a8 100644 --- a/Config/Sample.cfg +++ b/Config/Sample.cfg @@ -44,7 +44,6 @@ BaseLayerSwitchMode : 0 # 0 : Use B-frames in the base l PredStructure : 2 # 2: Random Access IntraPeriod : 47 # Period of I-Frame (-1 = only first, -2 = auto) [-2 - 255] -IntraRefreshType : 2 # Random Access 1:CRA, 2:IDR (when intra_period > 0) - [1-2] #====================== Quantization =============================== QP : 56 # Quantization parameter - [0-63] diff --git a/Docs/svt-vp9_encoder_user_guide.md b/Docs/svt-vp9_encoder_user_guide.md index de38bbc..f57afc7 100644 --- a/Docs/svt-vp9_encoder_user_guide.md +++ b/Docs/svt-vp9_encoder_user_guide.md @@ -60,7 +60,7 @@ The number of frames of the sequence to encode. e.g. 100. If the input frame co >-intra-period integer **[Optional]** -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). +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). >-rc integer **[Optional]** @@ -102,7 +102,6 @@ The encoder parameters present in the Sample.cfg file are listed in this table b | **BaseLayerSwitchMode** | -base-layer-switch-mode | [0 - 1] | 0 | 0 = Use B-frames in the base layer pointing to the same past picture.
1 = Use P-frames in the base layer| | **PredStructure** | -pred-struct | [2] | 2 | 2 = Random Access.| | **IntraPeriod** | -intra-period | [-2 - 255] | -2 | Distance Between Intra Frame inserted. -1 denotes no intra update. -2 denotes auto. | -| **IntraRefreshType** | -irefresh-type | [1 - 2] | 2 | 1 = CRA (Open GOP)
2 = IDR (Closed GOP) | | **QP** | -q | [0 - 63] | 50 | Initial quantization parameter for the Intra pictures used when RateControlMode 0 (CQP) | | **LoopFilter** | -loop-filter | [0 - 1] | 1 | Enables or disables the loop filter,
0 = OFF, 1 = ON | | **UseDefaultMeHme** | -use-default-me-hme | [0 - 1] | 1 | 0 = Overwrite Default ME HME parameters.
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 | **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 | | **AsmType** | -asm | [0 - 1] | 1 | Assembly instruction set (0 = C Only, 1 = Automatically select highest assembly instruction set supported) | | **LogicalProcessorNumber** | -lp | [0, total number of logical processor] | 0 | The number of logical processor which encoder threads run on.Refer to Appendix A.1 | -| **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) | +| **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) | | **Profile** | -profile | [0] | 0 | 0 = 8-bit 4:2:0 | | **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] | diff --git a/Source/API/EbSvtVp9Enc.h b/Source/API/EbSvtVp9Enc.h index 66537f4..20add69 100644 --- a/Source/API/EbSvtVp9Enc.h +++ b/Source/API/EbSvtVp9Enc.h @@ -153,12 +153,6 @@ typedef struct EbSvtVp9EncConfiguration * Deault is -2. */ int32_t intra_period; - /* Random access. - * 1 = CRA, open GOP. - * 2 = IDR, closed GOP. - * Default is 1. */ - uint32_t intra_refresh_type; - /* Prediction structure used to construct GOP. There are two main structures * supported, which are: Low Delay (P or B) and Random Access. * diff --git a/Source/App/EbAppConfig.c b/Source/App/EbAppConfig.c index 08cb11f..7bd1c8a 100644 --- a/Source/App/EbAppConfig.c +++ b/Source/App/EbAppConfig.c @@ -47,7 +47,6 @@ #define LEVEL_TOKEN "-level" #define INTERLACED_VIDEO_TOKEN "-interlaced-video" #define SEPERATE_FILDS_TOKEN "-separate-fields" -#define INTRA_REFRESH_TYPE_TOKEN "-irefresh-type" // no Eval #define LOOP_FILTER_TOKEN "-loop-filter" #define USE_DEFAULT_ME_HME_TOKEN "-use-default-me-hme" #define HME_ENABLE_TOKEN "-hme" // no Eval @@ -145,7 +144,6 @@ static void set_encoder_bit_depth (const char *value, EbCon static void set_base_layer_switch_mode (const char *value, EbConfig *cfg) {cfg->base_layer_switch_mode = (uint8_t) strtoul(value, NULL, 0);}; static void set_enc_mode (const char *value, EbConfig *cfg) {cfg->enc_mode = (uint8_t)strtoul(value, NULL, 0);}; static void set_cfg_intra_period (const char *value, EbConfig *cfg) {cfg->intra_period = strtol(value, NULL, 0);}; -static void set_cfg_intra_refresh_type (const char *value, EbConfig *cfg) {cfg->intra_refresh_type = strtol(value, NULL, 0);}; static void set_cfg_pred_structure (const char *value, EbConfig *cfg) { cfg->pred_structure = strtol(value, NULL, 0); }; static void set_cfg_qp (const char *value, EbConfig *cfg) {cfg->qp = strtoul(value, NULL, 0);}; 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[] = { { SINGLE_INPUT, BASE_LAYER_SWITCH_MODE_TOKEN, "BaseLayerSwitchMode", set_base_layer_switch_mode }, { SINGLE_INPUT, ENCMODE_TOKEN, "EncoderMode", set_enc_mode}, { SINGLE_INPUT, INTRA_PERIOD_TOKEN, "IntraPeriod", set_cfg_intra_period }, - { SINGLE_INPUT, INTRA_REFRESH_TYPE_TOKEN, "IntraRefreshType", set_cfg_intra_refresh_type }, { SINGLE_INPUT, FRAME_RATE_TOKEN, "FrameRate", set_frame_rate }, { SINGLE_INPUT, FRAME_RATE_NUMERATOR_TOKEN, "FrameRateNumerator", set_frame_rate_numerator }, { SINGLE_INPUT, FRAME_RATE_DENOMINATOR_TOKEN, "FrameRateDenominator", set_frame_rate_denominator }, @@ -311,7 +308,6 @@ void eb_config_ctor(EbConfig *config_ptr) config_ptr->enc_mode = 9; config_ptr->intra_period = -2; - config_ptr->intra_refresh_type = 2; config_ptr->pred_structure = 2; diff --git a/Source/App/EbAppConfig.h b/Source/App/EbAppConfig.h index 885c439..4bc9f32 100644 --- a/Source/App/EbAppConfig.h +++ b/Source/App/EbAppConfig.h @@ -220,7 +220,6 @@ typedef struct EbConfig uint32_t base_layer_switch_mode; uint8_t enc_mode; int32_t intra_period; - uint32_t intra_refresh_type; uint32_t pred_structure; /**************************************** diff --git a/Source/App/EbAppContext.c b/Source/App/EbAppContext.c index 2951ff1..1517dbe 100644 --- a/Source/App/EbAppContext.c +++ b/Source/App/EbAppContext.c @@ -158,7 +158,6 @@ EbErrorType copy_configuration_parameters( callback_data->eb_enc_parameters.source_width = config->source_width; callback_data->eb_enc_parameters.source_height = config->source_height; callback_data->eb_enc_parameters.intra_period = config->intra_period; - callback_data->eb_enc_parameters.intra_refresh_type = config->intra_refresh_type; callback_data->eb_enc_parameters.base_layer_switch_mode = config->base_layer_switch_mode; callback_data->eb_enc_parameters.enc_mode = (uint8_t)config->enc_mode; callback_data->eb_enc_parameters.frame_rate = config->frame_rate; diff --git a/Source/Lib/Codec/EbDefinitions.h b/Source/Lib/Codec/EbDefinitions.h index dbdc4b3..6dd2025 100644 --- a/Source/Lib/Codec/EbDefinitions.h +++ b/Source/Lib/Codec/EbDefinitions.h @@ -320,15 +320,6 @@ typedef struct EbH265DynEncConfiguration { uint32_t available_target_bitrate; } EbH265DynEncConfiguration; -/** The EbIntraRefreshType is used to describe the intra refresh type. -*/ -typedef enum EbIntraRefreshType -{ - NO_REFRESH = 0, - CRA_REFRESH = 1, - IDR_REFRESH = 2 -} EbIntraRefreshType; - #ifdef __GNUC__ #define EB_ALIGN(n) __attribute__((__aligned__(n))) #elif defined(_MSC_VER) diff --git a/Source/Lib/Codec/EbEncHandle.c b/Source/Lib/Codec/EbEncHandle.c index 3878ec3..473d525 100644 --- a/Source/Lib/Codec/EbEncHandle.c +++ b/Source/Lib/Codec/EbEncHandle.c @@ -1669,7 +1669,6 @@ EbErrorType eb_vp9_svt_enc_init_parameter( config_ptr->base_layer_switch_mode = 0; config_ptr->enc_mode = 3; config_ptr->intra_period = 31; - config_ptr->intra_refresh_type = 1; config_ptr->pred_structure = EB_PRED_RANDOM_ACCESS; config_ptr->loop_filter = EB_TRUE; config_ptr->use_default_me_hme = EB_TRUE; @@ -1915,9 +1914,6 @@ static int32_t compute_default_intra_period( intra_period = (ABS((fps - max_ip)) > ABS((fps - min_ip))) ? min_ip : max_ip; - if (config->intra_refresh_type == 1) - intra_period -= 1; - return intra_period; } @@ -1965,14 +1961,12 @@ void copy_api_from_app( // Coding Structure sequence_control_set_ptr->static_config.intra_period = ((EbSvtVp9EncConfiguration*)p_component_parameter_structure)->intra_period; - sequence_control_set_ptr->static_config.intra_refresh_type = ((EbSvtVp9EncConfiguration*)p_component_parameter_structure)->intra_refresh_type; sequence_control_set_ptr->static_config.pred_structure = ((EbSvtVp9EncConfiguration*)p_component_parameter_structure)->pred_structure; sequence_control_set_ptr->static_config.base_layer_switch_mode = ((EbSvtVp9EncConfiguration*)p_component_parameter_structure)->base_layer_switch_mode; sequence_control_set_ptr->static_config.tune = ((EbSvtVp9EncConfiguration*)p_component_parameter_structure)->tune; sequence_control_set_ptr->static_config.enc_mode = ((EbSvtVp9EncConfiguration*)p_component_parameter_structure)->enc_mode; sequence_control_set_ptr->intra_period = sequence_control_set_ptr->static_config.intra_period; - sequence_control_set_ptr->intra_refresh_type = sequence_control_set_ptr->static_config.intra_refresh_type; sequence_control_set_ptr->max_ref_count = 1; // Quantization @@ -2279,10 +2273,6 @@ static EbErrorType verify_settings( return_error = EB_ErrorBadParameter; } - if (config->intra_refresh_type > 2 || config->intra_refresh_type < 1) { - SVT_LOG("Error Instance %u: Invalid intra Refresh Type [1-2]\n", channel_number + 1); - return_error = EB_ErrorBadParameter; - } if (config->base_layer_switch_mode > 1) { SVT_LOG("Error Instance %u: Invalid Base Layer Switch Mode [0-1] \n", channel_number + 1); return_error = EB_ErrorBadParameter; @@ -2475,10 +2465,9 @@ static void print_lib_params( SVT_LOG("\nSVT [config]: EncoderBitDepth \t\t\t\t\t\t\t: %d ", config->encoder_bit_depth); SVT_LOG("\nSVT [config]: SourceWidth / SourceHeight\t\t\t\t\t: %d / %d ", config->source_width, config->source_height); if (config->frame_rate_denominator != 0 && config->frame_rate_numerator != 0) - 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, + 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, config->frame_rate_denominator > (1 << 16) ? config->frame_rate_denominator >> 16 : config->frame_rate_denominator, - config->intra_period + 1, - config->intra_refresh_type); + config->intra_period + 1); else 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); SVT_LOG("\nSVT [config]: HierarchicalLevels / BaseLayerSwitchMode / PredStructure\t\t: %d / %d / %d ", scs->hierarchical_levels, config->base_layer_switch_mode, config->pred_structure); diff --git a/Source/Lib/Codec/EbEncodeContext.c b/Source/Lib/Codec/EbEncodeContext.c index 3eccc7e..8a15e7f 100644 --- a/Source/Lib/Codec/EbEncodeContext.c +++ b/Source/Lib/Codec/EbEncodeContext.c @@ -168,7 +168,6 @@ EbErrorType eb_vp9_encode_context_ctor( encode_context_ptr->pred_struct_position = 0; encode_context_ptr->current_input_poc = -1; encode_context_ptr->elapsed_non_idr_count = 0; - encode_context_ptr->elapsed_non_cra_count = 0; encode_context_ptr->initial_picture = EB_TRUE; encode_context_ptr->last_idr_picture = 0; diff --git a/Source/Lib/Codec/EbEncodeContext.h b/Source/Lib/Codec/EbEncodeContext.h index c640790..72f9797 100644 --- a/Source/Lib/Codec/EbEncodeContext.h +++ b/Source/Lib/Codec/EbEncodeContext.h @@ -110,7 +110,6 @@ typedef struct EncodeContext uint32_t pred_struct_position; // Current position within a prediction structure uint32_t elapsed_non_idr_count; - uint32_t elapsed_non_cra_count; int64_t current_input_poc; EB_BOOL initial_picture; diff --git a/Source/Lib/Codec/EbPictureControlSet.h b/Source/Lib/Codec/EbPictureControlSet.h index 3df4519..e523c23 100644 --- a/Source/Lib/Codec/EbPictureControlSet.h +++ b/Source/Lib/Codec/EbPictureControlSet.h @@ -239,8 +239,6 @@ typedef struct PictureParentControlSet EbObjectWrapper *pareference_picture_wrapper_ptr; EB_BOOL idr_flag; - EB_BOOL cra_flag; // Hsan - to remove - EB_BOOL open_gop_cra_flag; EB_BOOL scene_change_flag; EB_BOOL end_of_sequence_flag; diff --git a/Source/Lib/Codec/EbPictureDecisionProcess.c b/Source/Lib/Codec/EbPictureDecisionProcess.c index 7690af4..2d0c994 100644 --- a/Source/Lib/Codec/EbPictureDecisionProcess.c +++ b/Source/Lib/Codec/EbPictureDecisionProcess.c @@ -940,7 +940,7 @@ void generate_rps_info( // Set Frame Type if (picture_control_set_ptr->slice_type == I_SLICE) { - picture_control_set_ptr->cpi->common.frame_type = (picture_control_set_ptr->idr_flag || picture_control_set_ptr->cra_flag) ? KEY_FRAME : INTER_FRAME; + picture_control_set_ptr->cpi->common.frame_type = (picture_control_set_ptr->idr_flag) ? KEY_FRAME : INTER_FRAME; picture_control_set_ptr->cpi->common.intra_only = 1; } else { @@ -1610,12 +1610,6 @@ void* eb_vp9_picture_decision_kernel(void *input_ptr) if(window_avail == EB_TRUE){ picture_control_set_ptr->scene_change_flag = EB_FALSE; - -#if 0 // Hsan: to fix CRA insertion @ non-BASE - picture_control_set_ptr->cra_flag = (picture_control_set_ptr->scene_change_flag == EB_TRUE) ? - EB_TRUE : - picture_control_set_ptr->cra_flag; -#endif } if(window_avail == EB_TRUE ||frame_passe_thru == EB_TRUE) @@ -1644,33 +1638,20 @@ void* eb_vp9_picture_decision_kernel(void *input_ptr) // If the Intra period length is 0, then introduce an intra for every picture if (sequence_control_set_ptr->intra_period == 0 || picture_control_set_ptr->picture_number == 0 ) { - if (sequence_control_set_ptr->intra_refresh_type == CRA_REFRESH) - picture_control_set_ptr->cra_flag = EB_TRUE; - else - picture_control_set_ptr->idr_flag = EB_TRUE; + picture_control_set_ptr->idr_flag = EB_TRUE; } // If an #IntraPeriodLength has passed since the last Intra, then introduce a CRA or IDR based on Intra Refresh type else if (sequence_control_set_ptr->intra_period != -1) { if ((encode_context_ptr->intra_period_position == (uint32_t)sequence_control_set_ptr->intra_period) || (picture_control_set_ptr->scene_change_flag == EB_TRUE)) { - if (sequence_control_set_ptr->intra_refresh_type == CRA_REFRESH) - picture_control_set_ptr->cra_flag = EB_TRUE; - else - picture_control_set_ptr->idr_flag = EB_TRUE; - } - if ((encode_context_ptr->intra_period_position == (uint32_t)sequence_control_set_ptr->intra_period) || - (picture_control_set_ptr->scene_change_flag == EB_TRUE)) { - if (sequence_control_set_ptr->intra_refresh_type == CRA_REFRESH) - picture_control_set_ptr->cra_flag = EB_TRUE; - else - picture_control_set_ptr->idr_flag = EB_TRUE; + picture_control_set_ptr->idr_flag = EB_TRUE; } } encode_context_ptr->pre_assignment_buffer_eos_flag = (picture_control_set_ptr->end_of_sequence_flag) ? (uint32_t)EB_TRUE : encode_context_ptr->pre_assignment_buffer_eos_flag; // Increment the Pre-Assignment Buffer Intra Count - encode_context_ptr->pre_assignment_buffer_intra_count += (picture_control_set_ptr->idr_flag || picture_control_set_ptr->cra_flag); + encode_context_ptr->pre_assignment_buffer_intra_count += picture_control_set_ptr->idr_flag; encode_context_ptr->pre_assignment_buffer_idr_count += picture_control_set_ptr->idr_flag; encode_context_ptr->pre_assignment_buffer_count += 1; @@ -1768,8 +1749,7 @@ void* eb_vp9_picture_decision_kernel(void *input_ptr) if ((context_ptr->mini_gop_length[mini_gop_index] < picture_control_set_ptr->pred_struct_ptr->pred_struct_period || context_ptr->mini_gop_idr_count[mini_gop_index] > 0) && picture_control_set_ptr->pred_struct_ptr->pred_type == EB_PRED_RANDOM_ACCESS && - picture_control_set_ptr->idr_flag == EB_FALSE && - picture_control_set_ptr->cra_flag == EB_FALSE) + picture_control_set_ptr->idr_flag == EB_FALSE) { // Correct the Pred Index before switching structures if (pre_assignment_buffer_first_pass_flag == EB_TRUE) { @@ -1784,32 +1764,17 @@ void* eb_vp9_picture_decision_kernel(void *input_ptr) // Set the RPS Override Flag - this current only will convert a Random Access structure to a Low Delay structure picture_control_set_ptr->use_rps_in_sps = EB_FALSE; - picture_control_set_ptr->open_gop_cra_flag = EB_FALSE; picture_type = P_SLICE; } - // Open GOP CRA - adjust the RPS - else if ((context_ptr->mini_gop_length[mini_gop_index] == picture_control_set_ptr->pred_struct_ptr->pred_struct_period) && - - (picture_control_set_ptr->pred_struct_ptr->pred_type == EB_PRED_RANDOM_ACCESS || picture_control_set_ptr->pred_struct_ptr->temporal_layer_count == 1) && - picture_control_set_ptr->idr_flag == EB_FALSE && - picture_control_set_ptr->cra_flag == EB_TRUE) - { - picture_control_set_ptr->use_rps_in_sps = EB_FALSE; - picture_control_set_ptr->open_gop_cra_flag = EB_TRUE; - - picture_type = I_SLICE; - } else { picture_control_set_ptr->use_rps_in_sps = EB_FALSE; - picture_control_set_ptr->open_gop_cra_flag = EB_FALSE; // Set the Picture Type picture_type = (picture_control_set_ptr->idr_flag) ? I_SLICE : - (picture_control_set_ptr->cra_flag) ? I_SLICE : (picture_control_set_ptr->pred_structure == EB_PRED_LOW_DELAY_P) ? P_SLICE : (picture_control_set_ptr->pred_structure == EB_PRED_LOW_DELAY_B) ? B_SLICE : (picture_control_set_ptr->pre_assignment_buffer_count == picture_control_set_ptr->pred_struct_ptr->pred_struct_period) ? ((picture_index == context_ptr->mini_gop_end_index[mini_gop_index] && sequence_control_set_ptr->static_config.base_layer_switch_mode) ? P_SLICE : B_SLICE) : @@ -1827,13 +1792,8 @@ void* eb_vp9_picture_decision_kernel(void *input_ptr) if (picture_control_set_ptr->idr_flag == EB_TRUE) { encode_context_ptr->pred_struct_position = picture_control_set_ptr->pred_struct_ptr->init_pic_index; } - - else if (picture_control_set_ptr->cra_flag == EB_TRUE && context_ptr->mini_gop_length[mini_gop_index] < picture_control_set_ptr->pred_struct_ptr->pred_struct_period) { - - encode_context_ptr->pred_struct_position = picture_control_set_ptr->pred_struct_ptr->init_pic_index; - } - else if (encode_context_ptr->elapsed_non_cra_count == 0) { - // If we are the picture directly after a CRA, we have to not use references that violate the CRA + else if (encode_context_ptr->elapsed_non_idr_count == 0) { + // If we are the picture directly after a IDR, we have to not use references that violate the IDR encode_context_ptr->pred_struct_position = picture_control_set_ptr->pred_struct_ptr->init_pic_index + 1; } // Elif Scene Change, determine leading and trailing pictures @@ -1881,42 +1841,27 @@ void* eb_vp9_picture_decision_kernel(void *input_ptr) if (picture_control_set_ptr->picture_number == 0){ encode_context_ptr->intra_period_position = 0; } - encode_context_ptr->elapsed_non_cra_count = 0; //------------------------------- // IDR //------------------------------- if (picture_control_set_ptr->idr_flag == EB_TRUE) { - // Set CRA flag - picture_control_set_ptr->cra_flag = EB_FALSE; - // Reset the pictures since last IDR counter encode_context_ptr->elapsed_non_idr_count = 0; } - //------------------------------- - // CRA - //------------------------------- - else { - - // Set a Random Access Point if not an IDR - picture_control_set_ptr->cra_flag = EB_TRUE; - } - break; case P_SLICE: case B_SLICE: - // Reset CRA and IDR Flag - picture_control_set_ptr->cra_flag = EB_FALSE; + // Reset IDR Flag picture_control_set_ptr->idr_flag = EB_FALSE; // Increment & Clip the elapsed Non-IDR Counter. This is clipped rather than allowed to free-run // inorder to avoid rollover issues. This assumes that any the GOP period is less than MAX_ELAPSED_IDR_COUNT encode_context_ptr->elapsed_non_idr_count = MIN(encode_context_ptr->elapsed_non_idr_count + 1, MAX_ELAPSED_IDR_COUNT); - encode_context_ptr->elapsed_non_cra_count = MIN(encode_context_ptr->elapsed_non_cra_count + 1, MAX_ELAPSED_IDR_COUNT); CHECK_REPORT_ERROR( (picture_control_set_ptr->pred_struct_ptr->pred_struct_entry_count < MAX_ELAPSED_IDR_COUNT), diff --git a/Source/Lib/Codec/EbResourceCoordinationProcess.c b/Source/Lib/Codec/EbResourceCoordinationProcess.c index acb87ab..6c86c8b 100644 --- a/Source/Lib/Codec/EbResourceCoordinationProcess.c +++ b/Source/Lib/Codec/EbResourceCoordinationProcess.c @@ -686,7 +686,6 @@ void* eb_vp9_resource_coordination_kernel(void *input_ptr) // Set Picture Control Flags picture_control_set_ptr->idr_flag = sequence_control_set_ptr->encode_context_ptr->initial_picture || (picture_control_set_ptr->eb_input_ptr->pic_type == EB_IDR_PICTURE); - picture_control_set_ptr->cra_flag = (picture_control_set_ptr->eb_input_ptr->pic_type == EB_I_PICTURE) ? EB_TRUE : EB_FALSE; picture_control_set_ptr->scene_change_flag = EB_FALSE; picture_control_set_ptr->qp_on_the_fly = EB_FALSE; diff --git a/Source/Lib/Codec/EbSequenceControlSet.c b/Source/Lib/Codec/EbSequenceControlSet.c index 8b101f8..316b717 100644 --- a/Source/Lib/Codec/EbSequenceControlSet.c +++ b/Source/Lib/Codec/EbSequenceControlSet.c @@ -82,7 +82,6 @@ EbErrorType eb_vp9_sequence_control_set_ctor( // GOP Structure sequence_control_set_ptr->max_ref_count = 1; sequence_control_set_ptr->intra_period = 0; - sequence_control_set_ptr->intra_refresh_type = 0; // Rate Control sequence_control_set_ptr->rate_control_mode = 0; @@ -175,7 +174,6 @@ EbErrorType eb_vp9_copy_sequence_control_set( dst->output_bitdepth = src->output_bitdepth; write_count += sizeof(EbBitDepth); dst->pred_struct_ptr = src->pred_struct_ptr; write_count += sizeof(PredictionStructure*); dst->intra_period = src->intra_period; write_count += sizeof(int32_t); - dst->intra_refresh_type = src->intra_refresh_type; write_count += sizeof(uint32_t); dst->max_ref_count = src->max_ref_count; write_count += sizeof(uint32_t); dst->target_bit_rate = src->target_bit_rate; write_count += sizeof(uint32_t); dst->available_bandwidth = src->available_bandwidth; write_count += sizeof(uint32_t); diff --git a/Source/Lib/Codec/EbSequenceControlSet.h b/Source/Lib/Codec/EbSequenceControlSet.h index 0d51f2e..71de06f 100644 --- a/Source/Lib/Codec/EbSequenceControlSet.h +++ b/Source/Lib/Codec/EbSequenceControlSet.h @@ -61,7 +61,6 @@ typedef struct SequenceControlSet // entry can be less. PredictionStructure *pred_struct_ptr; int32_t intra_period; // The frequency of intra pictures - uint32_t intra_refresh_type; // 1: CRA, 2: IDR uint32_t look_ahead_distance; // Rate Control diff --git a/ffmpeg_plugin/0001-Add-ability-for-ffmpeg-to-run-svt-vp9-with-hevc-av1.patch b/ffmpeg_plugin/0001-Add-ability-for-ffmpeg-to-run-svt-vp9-with-hevc-av1.patch index 730ceaf..df1a121 100644 --- a/ffmpeg_plugin/0001-Add-ability-for-ffmpeg-to-run-svt-vp9-with-hevc-av1.patch +++ b/ffmpeg_plugin/0001-Add-ability-for-ffmpeg-to-run-svt-vp9-with-hevc-av1.patch @@ -12,12 +12,12 @@ Signed-off-by: Guo Jiansheng libavcodec/Makefile | 1 + libavcodec/allcodecs.c | 1 + libavcodec/avcodec.h | 2 + - libavcodec/libsvt_vp9.c | 485 ++++++++++++++++++++++++++++++++++++++ + libavcodec/libsvt_vp9.c | 482 ++++++++++++++++++++++++++++++++++++++ libavformat/dashenc.c | 49 +++- libavformat/ivfenc.c | 34 ++- libavformat/matroskaenc.c | 108 ++++++++- libavformat/movenc.c | 42 +++- - 9 files changed, 716 insertions(+), 10 deletions(-) + 9 files changed, 713 insertions(+), 10 deletions(-) create mode 100644 libavcodec/libsvt_vp9.c diff --git a/configure b/configure @@ -95,10 +95,10 @@ index d234271c5b..0d903571b3 100644 AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_COUNT = 0x0001, diff --git a/libavcodec/libsvt_vp9.c b/libavcodec/libsvt_vp9.c new file mode 100644 -index 0000000000..d51e2985c8 +index 0000000000..d2c4740e5c --- /dev/null +++ b/libavcodec/libsvt_vp9.c -@@ -0,0 +1,485 @@ +@@ -0,0 +1,482 @@ +/* +* Scalable Video Technology for VP9 encoder library plugin +* @@ -289,9 +289,6 @@ index 0000000000..d51e2985c8 + param->min_qp_allowed = avctx->qmin; + } + -+ param->intra_refresh_type = -+ !!(avctx->flags & AV_CODEC_FLAG_CLOSED_GOP) + 1; -+ + if (ten_bits) { + param->encoder_bit_depth = 10; + } @@ -884,10 +881,10 @@ index cef504fa05..de8e3872c1 100644 if (pkt->size > 2 && (AV_RB16(pkt->data) & 0xfff0) == 0xfff0) ret = ff_stream_add_bitstream_filter(st, "aac_adtstoasc", NULL); diff --git a/libavformat/movenc.c b/libavformat/movenc.c -index a96139077b..e73cbb24c4 100644 +index 4d4d0cd024..eeebf10147 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c -@@ -5622,7 +5622,43 @@ static int mov_write_single_packet(AVFormatContext *s, AVPacket *pkt) +@@ -5624,7 +5624,43 @@ static int mov_write_single_packet(AVFormatContext *s, AVPacket *pkt) } } @@ -932,7 +929,7 @@ index a96139077b..e73cbb24c4 100644 } static int mov_write_subtitle_end_packet(AVFormatContext *s, -@@ -6758,6 +6794,10 @@ static int mov_check_bitstream(struct AVFormatContext *s, const AVPacket *pkt) +@@ -6763,6 +6799,10 @@ static int mov_check_bitstream(struct AVFormatContext *s, const AVPacket *pkt) int ret = 1; AVStream *st = s->streams[pkt->stream_index]; @@ -944,5 +941,4 @@ index a96139077b..e73cbb24c4 100644 if (pkt->size > 2 && (AV_RB16(pkt->data) & 0xfff0) == 0xfff0) ret = ff_stream_add_bitstream_filter(st, "aac_adtstoasc", NULL); -- -2.20.1 - +2.20.1 \ No newline at end of file diff --git a/ffmpeg_plugin/0001-Add-ability-for-ffmpeg-to-run-svt-vp9.patch b/ffmpeg_plugin/0001-Add-ability-for-ffmpeg-to-run-svt-vp9.patch index da54d07..69ffcee 100644 --- a/ffmpeg_plugin/0001-Add-ability-for-ffmpeg-to-run-svt-vp9.patch +++ b/ffmpeg_plugin/0001-Add-ability-for-ffmpeg-to-run-svt-vp9.patch @@ -1,4 +1,4 @@ -From 8690dd16b653a54b797dc0dafea751ccec45ce3b Mon Sep 17 00:00:00 2001 +From 3eb3aa5e26fb0f0f2724ce8ec50b8a54d206cb25 Mon Sep 17 00:00:00 2001 From: hassene Date: Fri, 15 Feb 2019 17:43:54 -0800 Subject: [PATCH] Add ability for ffmpeg to run svt vp9 @@ -12,12 +12,12 @@ Signed-off-by: Guo Jiansheng libavcodec/Makefile | 1 + libavcodec/allcodecs.c | 1 + libavcodec/avcodec.h | 2 + - libavcodec/libsvt_vp9.c | 485 ++++++++++++++++++++++++++++++++++++++ + libavcodec/libsvt_vp9.c | 482 ++++++++++++++++++++++++++++++++++++++ libavformat/dashenc.c | 49 +++- libavformat/ivfenc.c | 34 ++- libavformat/matroskaenc.c | 108 ++++++++- libavformat/movenc.c | 42 +++- - 9 files changed, 716 insertions(+), 10 deletions(-) + 9 files changed, 713 insertions(+), 10 deletions(-) create mode 100644 libavcodec/libsvt_vp9.c diff --git a/configure b/configure @@ -95,10 +95,10 @@ index d234271c5b..0d903571b3 100644 AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_COUNT = 0x0001, diff --git a/libavcodec/libsvt_vp9.c b/libavcodec/libsvt_vp9.c new file mode 100644 -index 0000000000..d51e2985c8 +index 0000000000..d2c4740e5c --- /dev/null +++ b/libavcodec/libsvt_vp9.c -@@ -0,0 +1,485 @@ +@@ -0,0 +1,482 @@ +/* +* Scalable Video Technology for VP9 encoder library plugin +* @@ -289,9 +289,6 @@ index 0000000000..d51e2985c8 + param->min_qp_allowed = avctx->qmin; + } + -+ param->intra_refresh_type = -+ !!(avctx->flags & AV_CODEC_FLAG_CLOSED_GOP) + 1; -+ + if (ten_bits) { + param->encoder_bit_depth = 10; + } @@ -585,7 +582,7 @@ index 0000000000..d51e2985c8 + .wrapper_name = "libsvt_vp9", +}; diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c -index 24d43c34ea..f5f578c72b 100644 +index 24d43c34ea..ba47bd6413 100644 --- a/libavformat/dashenc.c +++ b/libavformat/dashenc.c @@ -1823,6 +1823,48 @@ static int dash_write_packet(AVFormatContext *s, AVPacket *pkt) @@ -884,10 +881,10 @@ index cef504fa05..de8e3872c1 100644 if (pkt->size > 2 && (AV_RB16(pkt->data) & 0xfff0) == 0xfff0) ret = ff_stream_add_bitstream_filter(st, "aac_adtstoasc", NULL); diff --git a/libavformat/movenc.c b/libavformat/movenc.c -index a96139077b..e73cbb24c4 100644 +index 4d4d0cd024..eeebf10147 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c -@@ -5622,7 +5622,43 @@ static int mov_write_single_packet(AVFormatContext *s, AVPacket *pkt) +@@ -5624,7 +5624,43 @@ static int mov_write_single_packet(AVFormatContext *s, AVPacket *pkt) } } @@ -932,7 +929,7 @@ index a96139077b..e73cbb24c4 100644 } static int mov_write_subtitle_end_packet(AVFormatContext *s, -@@ -6758,6 +6794,10 @@ static int mov_check_bitstream(struct AVFormatContext *s, const AVPacket *pkt) +@@ -6763,6 +6799,10 @@ static int mov_check_bitstream(struct AVFormatContext *s, const AVPacket *pkt) int ret = 1; AVStream *st = s->streams[pkt->stream_index]; @@ -944,5 +941,5 @@ index a96139077b..e73cbb24c4 100644 if (pkt->size > 2 && (AV_RB16(pkt->data) & 0xfff0) == 0xfff0) ret = ff_stream_add_bitstream_filter(st, "aac_adtstoasc", NULL); -- -2.17.1 +2.23.0.windows.1 diff --git a/gstreamer-plugin/gstsvtvp9enc.c b/gstreamer-plugin/gstsvtvp9enc.c index 832f294..659c486 100644 --- a/gstreamer-plugin/gstsvtvp9enc.c +++ b/gstreamer-plugin/gstsvtvp9enc.c @@ -83,7 +83,6 @@ enum PROP_P_FRAMES, PROP_PRED_STRUCTURE, PROP_GOP_SIZE, - PROP_INTRA_REFRESH, PROP_QP, PROP_DEBLOCKING, PROP_CONSTRAINED_INTRA, @@ -107,7 +106,6 @@ enum #define PROP_P_FRAMES_DEFAULT FALSE #define PROP_PRED_STRUCTURE_DEFAULT 2 #define PROP_GOP_SIZE_DEFAULT -1 -#define PROP_INTRA_REFRESH_DEFAULT 1 #define PROP_QP_DEFAULT 45 #define PROP_DEBLOCKING_DEFAULT TRUE #define PROP_CONSTRAINED_INTRA_DEFAULT FALSE @@ -238,13 +236,6 @@ gst_svtvp9enc_class_init (GstSvtVp9EncClass * klass) -1, 251, PROP_GOP_SIZE_DEFAULT, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - g_object_class_install_property (gobject_class, PROP_INTRA_REFRESH, - g_param_spec_int ("intra-refresh", "Intra refresh type", - "CRA (open GOP)" - "or IDR (closed GOP)", - 1, 2, PROP_INTRA_REFRESH_DEFAULT, - G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - g_object_class_install_property (gobject_class, PROP_QP, g_param_spec_uint ("qp", "Quantization parameter", "Quantization parameter used in CQP mode", @@ -364,9 +355,6 @@ gst_svtvp9enc_set_property (GObject * object, guint property_id, case PROP_GOP_SIZE: svtvp9enc->svt_config->intra_period = g_value_get_int(value) - 1; break; - case PROP_INTRA_REFRESH: - svtvp9enc->svt_config->intra_refresh_type = g_value_get_int(value); - break; case PROP_SPEEDCONTROL: if (g_value_get_uint (value) > 0) { svtvp9enc->svt_config->injector_frame_rate = g_value_get_uint (value); @@ -461,9 +449,6 @@ gst_svtvp9enc_get_property (GObject * object, guint property_id, case PROP_GOP_SIZE: g_value_set_int (value, svtvp9enc->svt_config->intra_period + 1); break; - case PROP_INTRA_REFRESH: - g_value_set_int(value, svtvp9enc->svt_config->intra_refresh_type); - break; case PROP_QP: g_value_set_uint (value, svtvp9enc->svt_config->qp); break; @@ -639,7 +624,6 @@ set_default_svt_configuration (EbSvtVp9EncConfiguration * svt_config) svt_config->source_width = 0; svt_config->source_height = 0; svt_config->intra_period = PROP_GOP_SIZE_DEFAULT - 1; - svt_config->intra_refresh_type = PROP_INTRA_REFRESH_DEFAULT; svt_config->enc_mode = PROP_ENCMODE_DEFAULT; svt_config->tune = PROP_TUNE_DEFAULT; svt_config->frame_rate = 25;