Line data Source code
1 : /* 2 : * Copyright(c) 2019 Intel Corporation 3 : * SPDX - License - Identifier: BSD - 2 - Clause - Patent 4 : */ 5 : 6 : #include <stdlib.h> 7 : 8 : #include "EbDefinitions.h" 9 : #include "EbSystemResourceManager.h" 10 : #include "EbPictureControlSet.h" 11 : #include "EbSequenceControlSet.h" 12 : 13 : #include "EbSourceBasedOperationsProcess.h" 14 : #include "EbInitialRateControlResults.h" 15 : #include "EbPictureDemuxResults.h" 16 : #include "EbMotionEstimationContext.h" 17 : #include "emmintrin.h" 18 : 19 : /************************************** 20 : * Macros 21 : **************************************/ 22 : #define VARIANCE_PRECISION 16 23 : #define PAN_LCU_PERCENTAGE 75 24 : #define LOW_AMPLITUDE_TH 16 25 : 26 : #define Y_MEAN_RANGE_02 70 27 : #define Y_MEAN_RANGE_01 130 28 : #define CB_MEAN_RANGE_02 115 29 : #define CR_MEAN_RANGE_00 110 30 : #define CR_MEAN_RANGE_02 135 31 : 32 : #define DARK_FRM_TH 45 33 : #define CB_MEAN_RANGE_00 80 34 : 35 : #define SAD_DEVIATION_LCU_TH 15 36 : #define SAD_DEVIATION_LCU_NON_M4_TH 20 37 : 38 : #define MAX_DELTA_QP_SHAPE_TH 4 39 : #define MIN_DELTA_QP_SHAPE_TH 1 40 : 41 : #define MIN_BLACK_AREA_PERCENTAGE 20 42 : #define LOW_MEAN_THLD 25 43 : 44 : #define MIN_WHITE_AREA_PERCENTAGE 1 45 : #define LOW_MEAN_THLD1 40 46 : #define HIGH_MEAN_THLD1 210 47 : #define NORM_FACTOR 10 // Used ComplexityClassifier32x32 48 : const int8_t MinDeltaQPdefault[3] = { 49 : -4, -3, -2 50 : }; 51 : const uint8_t MaxDeltaQPdefault[3] = { 52 : 4, 5, 6 53 : }; 54 : 55 : /************************************************ 56 : * Initial Rate Control Context Constructor 57 : ************************************************/ 58 6 : EbErrorType source_based_operations_context_ctor( 59 : SourceBasedOperationsContext *context_ptr, 60 : EbFifo *initialRateControlResultsInputFifoPtr, 61 : EbFifo *picture_demux_results_output_fifo_ptr, 62 : SequenceControlSet *sequence_control_set_ptr) 63 : { 64 : UNUSED(sequence_control_set_ptr); 65 : 66 6 : context_ptr->initial_rate_control_results_input_fifo_ptr = initialRateControlResultsInputFifoPtr; 67 6 : context_ptr->picture_demux_results_output_fifo_ptr = picture_demux_results_output_fifo_ptr; 68 6 : return EB_ErrorNone; 69 : } 70 : 71 : /*************************************************** 72 : * Derives BEA statistics and set activity flags 73 : ***************************************************/ 74 120 : void DerivePictureActivityStatistics( 75 : SequenceControlSet *sequence_control_set_ptr, 76 : PictureParentControlSet *picture_control_set_ptr) 77 : 78 : { 79 120 : uint64_t nonMovingIndexMin = ~0u; 80 120 : uint64_t nonMovingIndexMax = 0; 81 120 : uint64_t nonMovingIndexSum = 0; 82 120 : uint32_t complete_sb_count = 0; 83 120 : uint32_t non_moving_sb_count = 0; 84 120 : uint32_t sb_total_count = picture_control_set_ptr->sb_total_count; 85 120 : uint32_t totNmvIdx = 0; 86 : 87 : uint32_t sb_index; 88 7320 : for (sb_index = 0; sb_index < sb_total_count; ++sb_index) { 89 7200 : SbParams *sb_params = &sequence_control_set_ptr->sb_params_array[sb_index]; 90 7200 : if (sb_params->is_complete_sb) 91 : { 92 6000 : nonMovingIndexMin = picture_control_set_ptr->non_moving_index_array[sb_index] < nonMovingIndexMin ? 93 : picture_control_set_ptr->non_moving_index_array[sb_index] : 94 : nonMovingIndexMin; 95 : 96 6000 : nonMovingIndexMax = picture_control_set_ptr->non_moving_index_array[sb_index] > nonMovingIndexMax ? 97 : picture_control_set_ptr->non_moving_index_array[sb_index] : 98 : nonMovingIndexMax; 99 6000 : if (picture_control_set_ptr->non_moving_index_array[sb_index] < NON_MOVING_SCORE_1) 100 2624 : non_moving_sb_count++; 101 6000 : complete_sb_count++; 102 : 103 6000 : nonMovingIndexSum += picture_control_set_ptr->non_moving_index_array[sb_index]; 104 : 105 6000 : if (picture_control_set_ptr->non_moving_index_array[sb_index] < NON_MOVING_SCORE_1) 106 2624 : totNmvIdx++; 107 : } 108 : } 109 : 110 120 : if (complete_sb_count > 0) { 111 120 : picture_control_set_ptr->non_moving_index_average = (uint16_t)(nonMovingIndexSum / complete_sb_count); 112 120 : picture_control_set_ptr->kf_zeromotion_pct = (non_moving_sb_count * 100) / complete_sb_count; 113 : } 114 120 : picture_control_set_ptr->non_moving_index_min_distance = (uint16_t)(ABS((int32_t)(picture_control_set_ptr->non_moving_index_average) - (int32_t)nonMovingIndexMin)); 115 120 : picture_control_set_ptr->non_moving_index_max_distance = (uint16_t)(ABS((int32_t)(picture_control_set_ptr->non_moving_index_average) - (int32_t)nonMovingIndexMax)); 116 120 : return; 117 : } 118 : 119 7072 : void GrassLcu( 120 : SourceBasedOperationsContext *context_ptr, 121 : SequenceControlSet *sequence_control_set_ptr, 122 : PictureParentControlSet *picture_control_set_ptr, 123 : uint32_t sb_index) { 124 : uint32_t childIndex; 125 : 126 7072 : EbBool lcuGrassFlag = EB_FALSE; 127 : 128 : uint32_t grassLcuInrange; 129 : uint32_t processedCus; 130 : uint32_t rasterScanCuIndex; 131 : 132 7072 : SbParams *sb_params = &sequence_control_set_ptr->sb_params_array[sb_index]; 133 7072 : SbStat *sb_stat_ptr = &(picture_control_set_ptr->sb_stat_array[sb_index]); 134 : 135 7072 : _mm_prefetch((const char*)sb_stat_ptr, _MM_HINT_T0); 136 : 137 7073 : lcuGrassFlag = EB_FALSE; 138 7073 : grassLcuInrange = 0; 139 7073 : processedCus = 0; 140 : 141 103910 : for (rasterScanCuIndex = RASTER_SCAN_CU_INDEX_16x16_0; rasterScanCuIndex <= RASTER_SCAN_CU_INDEX_16x16_15; rasterScanCuIndex++) { 142 96837 : if (sb_params->raster_scan_cu_validity[rasterScanCuIndex]) { 143 87863 : const uint32_t mdScanCuIndex = raster_scan_to_md_scan[rasterScanCuIndex]; 144 87863 : const uint32_t rasterScanParentCuIndex = raster_scan_cu_parent_index[rasterScanCuIndex]; 145 87863 : const uint32_t mdScanParentCuIndex = raster_scan_to_md_scan[rasterScanParentCuIndex]; 146 87863 : CuStat *cuStatPtr = &(sb_stat_ptr->cu_stat_array[mdScanCuIndex]); 147 : 148 87863 : const uint32_t perfectCondition = 7; 149 87863 : const uint8_t y_mean = context_ptr->y_mean_ptr[rasterScanCuIndex]; 150 87863 : const uint8_t cbMean = context_ptr->cb_mean_ptr[rasterScanCuIndex]; 151 87863 : const uint8_t crMean = context_ptr->cr_mean_ptr[rasterScanCuIndex]; 152 87863 : uint32_t grassCondition = 0; 153 87863 : uint32_t skinCondition = 0; 154 : 155 : // GRASS 156 87863 : grassCondition += (y_mean > Y_MEAN_RANGE_02 && y_mean < Y_MEAN_RANGE_01) ? 1 : 0; 157 87863 : grassCondition += (cbMean > CB_MEAN_RANGE_00 && cbMean < CB_MEAN_RANGE_02) ? 2 : 0; 158 87863 : grassCondition += (crMean > CR_MEAN_RANGE_00 && crMean < CR_MEAN_RANGE_02) ? 4 : 0; 159 : 160 87863 : grassLcuInrange += (grassCondition == perfectCondition) ? 1 : 0; 161 87863 : processedCus++; 162 : 163 87863 : lcuGrassFlag = grassCondition == perfectCondition ? EB_TRUE : lcuGrassFlag; 164 : 165 87863 : cuStatPtr->grass_area = (EbBool)(grassCondition == perfectCondition); 166 : // SKIN 167 87863 : skinCondition += (y_mean > Y_MEAN_RANGE_02 && y_mean < Y_MEAN_RANGE_01) ? 1 : 0; 168 87863 : skinCondition += (cbMean > 100 && cbMean < 120) ? 2 : 0; 169 87863 : skinCondition += (crMean > 135 && crMean < 160) ? 4 : 0; 170 : 171 87863 : cuStatPtr->skin_area = (EbBool)(skinCondition == perfectCondition); 172 426636 : for (childIndex = mdScanCuIndex + 1; childIndex < mdScanCuIndex + 5; ++childIndex) { 173 338773 : sb_stat_ptr->cu_stat_array[childIndex].grass_area = cuStatPtr->grass_area; 174 338773 : sb_stat_ptr->cu_stat_array[childIndex].skin_area = cuStatPtr->skin_area; 175 : } 176 : 177 87863 : sb_stat_ptr->cu_stat_array[mdScanParentCuIndex].grass_area = cuStatPtr->grass_area ? EB_TRUE : 178 : sb_stat_ptr->cu_stat_array[mdScanParentCuIndex].grass_area; 179 87863 : sb_stat_ptr->cu_stat_array[0].grass_area = cuStatPtr->grass_area ? EB_TRUE : 180 : sb_stat_ptr->cu_stat_array[0].grass_area; 181 87863 : sb_stat_ptr->cu_stat_array[mdScanParentCuIndex].skin_area = cuStatPtr->skin_area ? EB_TRUE : 182 : sb_stat_ptr->cu_stat_array[mdScanParentCuIndex].skin_area; 183 87863 : sb_stat_ptr->cu_stat_array[0].skin_area = cuStatPtr->skin_area ? EB_TRUE : 184 : sb_stat_ptr->cu_stat_array[0].skin_area; 185 : } 186 : } 187 : 188 7073 : context_ptr->picture_num_grass_sb += lcuGrassFlag ? 1 : 0; 189 7073 : } 190 : 191 120 : void GrassSkinPicture( 192 : SourceBasedOperationsContext *context_ptr, 193 : PictureParentControlSet *picture_control_set_ptr) { 194 120 : picture_control_set_ptr->grass_percentage_in_picture = (uint8_t)(context_ptr->picture_num_grass_sb * 100 / picture_control_set_ptr->sb_total_count); 195 120 : } 196 : 197 120 : void SetDefaultDeltaQpRange( 198 : SourceBasedOperationsContext *context_ptr, 199 : PictureParentControlSet *picture_control_set_ptr, 200 : EbBool scene_transition_flag) { 201 : int8_t min_delta_qp; 202 : uint8_t max_delta_qp; 203 120 : if (picture_control_set_ptr->temporal_layer_index == 0) { 204 10 : min_delta_qp = MinDeltaQPdefault[0]; 205 10 : max_delta_qp = MaxDeltaQPdefault[0]; 206 : } 207 110 : else if (picture_control_set_ptr->is_used_as_reference_flag) { 208 58 : min_delta_qp = MinDeltaQPdefault[1]; 209 58 : max_delta_qp = MaxDeltaQPdefault[1]; 210 : } 211 : else { 212 52 : min_delta_qp = MinDeltaQPdefault[2]; 213 52 : max_delta_qp = MaxDeltaQPdefault[2]; 214 : } 215 : 216 : // Shape the min degrade 217 120 : min_delta_qp = (((int8_t)(min_delta_qp + MIN_DELTA_QP_SHAPE_TH) > 0) ? 0 : (min_delta_qp + MIN_DELTA_QP_SHAPE_TH)); 218 : 219 : // Shape the max degrade 220 120 : max_delta_qp = (((int8_t)(max_delta_qp - MAX_DELTA_QP_SHAPE_TH) < 0) ? 0 : (max_delta_qp - MAX_DELTA_QP_SHAPE_TH)); 221 : 222 : // Check on Scene Transition Flag 223 120 : max_delta_qp = scene_transition_flag ? 0 : max_delta_qp; 224 : 225 120 : context_ptr->min_delta_qp = min_delta_qp; 226 120 : context_ptr->max_delta_qp = max_delta_qp; 227 120 : } 228 : 229 120 : void DetermineMorePotentialAuraAreas( 230 : SequenceControlSet *sequence_control_set_ptr, 231 : PictureParentControlSet *picture_control_set_ptr) 232 : { 233 : uint16_t sb_index; 234 : int32_t lcuHor, lcuVer, lcuVerOffset; 235 : uint8_t sb_x, sb_y; 236 120 : uint32_t countOfEdgeBlocks = 0, countOfNonEdgeBlocks = 0; 237 : 238 120 : uint32_t lightLumaValue = 150; 239 : 240 120 : uint16_t sb_total_count = picture_control_set_ptr->sb_total_count; 241 : 242 7320 : for (sb_index = 0; sb_index < picture_control_set_ptr->sb_total_count; ++sb_index) { 243 7200 : SbParams *sb_params = &sequence_control_set_ptr->sb_params_array[sb_index]; 244 : 245 7200 : sb_x = sb_params->horizontal_index; 246 7200 : sb_y = sb_params->vertical_index; 247 : // For all the internal LCUs 248 7200 : if ((sb_x > 0) && (sb_x < sequence_control_set_ptr->picture_width_in_sb - 1) && (sb_y > 0) && (sb_y < sequence_control_set_ptr->picture_height_in_sb - 1)) { 249 3840 : countOfNonEdgeBlocks = 0; 250 3840 : if (picture_control_set_ptr->edge_results_ptr[sb_index].edge_block_num 251 1568 : && picture_control_set_ptr->y_mean[sb_index][ME_TIER_ZERO_PU_64x64] >= lightLumaValue) { 252 1152 : for (lcuVer = -1; lcuVer <= 1; lcuVer++) { 253 864 : lcuVerOffset = lcuVer * (int32_t)sequence_control_set_ptr->picture_width_in_sb; 254 3456 : for (lcuHor = -1; lcuHor <= 1; lcuHor++) { 255 3820 : countOfNonEdgeBlocks += (!picture_control_set_ptr->edge_results_ptr[sb_index + lcuVerOffset + lcuHor].edge_block_num) && 256 1228 : (picture_control_set_ptr->non_moving_index_array[sb_index + lcuVerOffset + lcuHor] < 30); 257 : } 258 : } 259 : } 260 : 261 3840 : if (countOfNonEdgeBlocks > 1) 262 284 : countOfEdgeBlocks++; 263 : } 264 : } 265 : 266 : // To check the percentage of potential aura in the picture.. If a large area is detected then this is not isolated 267 120 : picture_control_set_ptr->percentage_of_edgein_light_background = (uint8_t)(countOfEdgeBlocks * 100 / sb_total_count); 268 120 : } 269 : 270 : /*************************************************** 271 : * Detects the presence of dark area 272 : ***************************************************/ 273 120 : void DeriveHighDarkAreaDensityFlag( 274 : SequenceControlSet *sequence_control_set_ptr, 275 : PictureParentControlSet *picture_control_set_ptr) { 276 : uint32_t regionInPictureWidthIndex; 277 : uint32_t regionInPictureHeightIndex; 278 : uint32_t lumaHistogramBin; 279 120 : uint32_t blackSamplesCount = 0; 280 : uint32_t blackAreaPercentage; 281 : // Loop over regions inside the picture 282 599 : for (regionInPictureWidthIndex = 0; regionInPictureWidthIndex < sequence_control_set_ptr->picture_analysis_number_of_regions_per_width; regionInPictureWidthIndex++) { // loop over horizontal regions 283 2392 : for (regionInPictureHeightIndex = 0; regionInPictureHeightIndex < sequence_control_set_ptr->picture_analysis_number_of_regions_per_height; regionInPictureHeightIndex++) { // loop over vertical regions 284 49708 : for (lumaHistogramBin = 0; lumaHistogramBin < LOW_MEAN_THLD; lumaHistogramBin++) { // loop over the 1st LOW_MEAN_THLD bins 285 47795 : blackSamplesCount += picture_control_set_ptr->picture_histogram[regionInPictureWidthIndex][regionInPictureHeightIndex][0][lumaHistogramBin]; 286 : } 287 : } 288 : } 289 : 290 120 : blackAreaPercentage = (blackSamplesCount * 100) / (sequence_control_set_ptr->seq_header.max_frame_width * sequence_control_set_ptr->seq_header.max_frame_height); 291 120 : picture_control_set_ptr->high_dark_area_density_flag = (EbBool)(blackAreaPercentage >= MIN_BLACK_AREA_PERCENTAGE); 292 : 293 120 : blackSamplesCount = 0; 294 120 : uint32_t whiteSamplesCount = 0; 295 : uint32_t whiteAreaPercentage; 296 : // Loop over regions inside the picture 297 600 : for (regionInPictureWidthIndex = 0; regionInPictureWidthIndex < sequence_control_set_ptr->picture_analysis_number_of_regions_per_width; regionInPictureWidthIndex++) { // loop over horizontal regions 298 2396 : for (regionInPictureHeightIndex = 0; regionInPictureHeightIndex < sequence_control_set_ptr->picture_analysis_number_of_regions_per_height; regionInPictureHeightIndex++) { // loop over vertical regions 299 78279 : for (lumaHistogramBin = 0; lumaHistogramBin < LOW_MEAN_THLD1; lumaHistogramBin++) { // loop over the 1st LOW_MEAN_THLD bins 300 76363 : blackSamplesCount += picture_control_set_ptr->picture_histogram[regionInPictureWidthIndex][regionInPictureHeightIndex][0][lumaHistogramBin]; 301 : } 302 89761 : for (lumaHistogramBin = HIGH_MEAN_THLD1; lumaHistogramBin < HISTOGRAM_NUMBER_OF_BINS; lumaHistogramBin++) 303 87845 : whiteSamplesCount += picture_control_set_ptr->picture_histogram[regionInPictureWidthIndex][regionInPictureHeightIndex][0][lumaHistogramBin]; 304 : } 305 : } 306 : 307 120 : blackAreaPercentage = (blackSamplesCount * 100) / (sequence_control_set_ptr->seq_header.max_frame_width * sequence_control_set_ptr->seq_header.max_frame_height); 308 120 : whiteAreaPercentage = (whiteSamplesCount * 100) / (sequence_control_set_ptr->seq_header.max_frame_width * sequence_control_set_ptr->seq_header.max_frame_height); 309 120 : picture_control_set_ptr->high_dark_low_light_area_density_flag = (EbBool)(blackAreaPercentage >= MIN_BLACK_AREA_PERCENTAGE) && (whiteAreaPercentage >= MIN_WHITE_AREA_PERCENTAGE); 310 120 : } 311 : #define NORM_FACTOR 10 312 : #define VAR_MIN 10 313 : #define VAR_MAX 300 314 : #define MIN_Y 70 315 : #define MAX_Y 145 316 : #define MID_CB 140 317 : #define MID_CR 115 318 : #define TH_CB 10 319 : #define TH_CR 15 320 5892 : void SpatialHighContrastClassifier( 321 : SourceBasedOperationsContext *context_ptr, 322 : PictureParentControlSet *picture_control_set_ptr, 323 : uint32_t sb_index) 324 : { 325 : uint32_t blkIt; 326 : 327 5892 : context_ptr->high_contrast_num = 0; 328 5892 : context_ptr->high_contrast_num_ii = 0; 329 : //16x16 blocks 330 97518 : for (blkIt = 0; blkIt < 16; blkIt++) { 331 91626 : uint8_t y_mean = context_ptr->y_mean_ptr[5 + blkIt]; 332 91626 : uint8_t umean = context_ptr->cb_mean_ptr[5 + blkIt]; 333 91626 : uint8_t vmean = context_ptr->cr_mean_ptr[5 + blkIt]; 334 : 335 91626 : uint16_t var = picture_control_set_ptr->variance[sb_index][5 + blkIt]; 336 : 337 91626 : if (var > VAR_MIN && var<VAR_MAX && //medium texture 338 3399 : y_mean>MIN_Y && y_mean < MAX_Y && //medium brightness(not too dark and not too bright) 339 720 : ABS((int64_t)umean - MID_CB) < TH_CB && //middle of the color plane 340 0 : ABS((int64_t)vmean - MID_CR) < TH_CR //middle of the color plane 341 : ) 342 : { 343 0 : context_ptr->high_contrast_num++; 344 : } 345 : 346 91626 : if ( 347 0 : y_mean < 30 && //medium brightness(not too dark and not too bright) 348 0 : ABS((int64_t)umean - 128) < 5 && //middle of the color plane 349 0 : ABS((int64_t)vmean - 128) < 5 //middle of the color plane 350 : ) 351 : { 352 0 : context_ptr->high_contrast_num_ii++; 353 : } 354 : } 355 5892 : } 356 : /************************************************ 357 : * Source Based Operations Kernel 358 : ************************************************/ 359 5 : void* source_based_operations_kernel(void *input_ptr) 360 : { 361 5 : SourceBasedOperationsContext *context_ptr = (SourceBasedOperationsContext*)input_ptr; 362 : PictureParentControlSet *picture_control_set_ptr; 363 : SequenceControlSet *sequence_control_set_ptr; 364 : EbObjectWrapper *inputResultsWrapperPtr; 365 : InitialRateControlResults *inputResultsPtr; 366 : EbObjectWrapper *outputResultsWrapperPtr; 367 : PictureDemuxResults *outputResultsPtr; 368 : 369 120 : for (;;) { 370 : // Get Input Full Object 371 125 : eb_get_full_object( 372 : context_ptr->initial_rate_control_results_input_fifo_ptr, 373 : &inputResultsWrapperPtr); 374 : 375 120 : inputResultsPtr = (InitialRateControlResults*)inputResultsWrapperPtr->object_ptr; 376 120 : picture_control_set_ptr = (PictureParentControlSet*)inputResultsPtr->picture_control_set_wrapper_ptr->object_ptr; 377 120 : sequence_control_set_ptr = (SequenceControlSet*)picture_control_set_ptr->sequence_control_set_wrapper_ptr->object_ptr; 378 : 379 120 : picture_control_set_ptr->dark_back_groundlight_fore_ground = EB_FALSE; 380 120 : context_ptr->picture_num_grass_sb = 0; 381 : 382 120 : context_ptr->sb_cmplx_contrast_count = 0; 383 120 : context_ptr->sb_high_contrast_count = 0; 384 120 : context_ptr->complete_sb_count = 0; 385 120 : uint32_t sb_total_count = picture_control_set_ptr->sb_total_count; 386 : uint32_t sb_index; 387 : 388 : /***********************************************LCU-based operations************************************************************/ 389 7151 : for (sb_index = 0; sb_index < sb_total_count; ++sb_index) { 390 7035 : SbParams *sb_params = &sequence_control_set_ptr->sb_params_array[sb_index]; 391 7035 : EbBool is_complete_sb = sb_params->is_complete_sb; 392 7035 : uint8_t *y_mean_ptr = picture_control_set_ptr->y_mean[sb_index]; 393 : 394 7035 : _mm_prefetch((const char*)y_mean_ptr, _MM_HINT_T0); 395 7052 : uint8_t *cr_mean_ptr = picture_control_set_ptr->crMean[sb_index]; 396 7052 : uint8_t *cb_mean_ptr = picture_control_set_ptr->cbMean[sb_index]; 397 : 398 7052 : _mm_prefetch((const char*)cr_mean_ptr, _MM_HINT_T0); 399 7057 : _mm_prefetch((const char*)cb_mean_ptr, _MM_HINT_T0); 400 : 401 7064 : context_ptr->y_mean_ptr = y_mean_ptr; 402 7064 : context_ptr->cr_mean_ptr = cr_mean_ptr; 403 7064 : context_ptr->cb_mean_ptr = cb_mean_ptr; 404 : 405 : // Grass detection 406 7064 : GrassLcu( 407 : context_ptr, 408 : sequence_control_set_ptr, 409 : picture_control_set_ptr, 410 : sb_index); 411 : 412 : // Spatial high contrast classifier 413 7056 : if (is_complete_sb) { 414 5891 : SpatialHighContrastClassifier( 415 : context_ptr, 416 : picture_control_set_ptr, 417 : sb_index); 418 : } 419 : 420 7031 : if (is_complete_sb) { 421 5865 : context_ptr->complete_sb_count++; 422 : } 423 : } 424 : 425 : /*********************************************Picture-based operations**********************************************************/ 426 : // Delta QP range adjustments 427 116 : SetDefaultDeltaQpRange( 428 : context_ptr, 429 : picture_control_set_ptr, 430 116 : picture_control_set_ptr->slice_type == I_SLICE ? EB_FALSE : picture_control_set_ptr->scene_transition_flag[REF_LIST_0]); 431 : // Dark density derivation (histograms not available when no SCD) 432 : 433 120 : DeriveHighDarkAreaDensityFlag( 434 : sequence_control_set_ptr, 435 : picture_control_set_ptr); 436 : // Detect aura areas in lighter background when subject is moving similar to background 437 120 : DetermineMorePotentialAuraAreas( 438 : sequence_control_set_ptr, 439 : picture_control_set_ptr); 440 : 441 : // Activity statistics derivation 442 120 : DerivePictureActivityStatistics( 443 : sequence_control_set_ptr, 444 : picture_control_set_ptr); 445 : 446 : // Skin & Grass detection 447 120 : GrassSkinPicture( 448 : context_ptr, 449 : picture_control_set_ptr); 450 : // Get Empty Results Object 451 120 : eb_get_empty_object( 452 : context_ptr->picture_demux_results_output_fifo_ptr, 453 : &outputResultsWrapperPtr); 454 : 455 120 : outputResultsPtr = (PictureDemuxResults*)outputResultsWrapperPtr->object_ptr; 456 120 : outputResultsPtr->picture_control_set_wrapper_ptr = inputResultsPtr->picture_control_set_wrapper_ptr; 457 120 : outputResultsPtr->picture_type = EB_PIC_INPUT; 458 : 459 : // Release the Input Results 460 120 : eb_release_object(inputResultsWrapperPtr); 461 : 462 : // Post the Full Results Object 463 120 : eb_post_full_object(outputResultsWrapperPtr); 464 : } 465 : return EB_NULL; 466 : }