• Home
  • Raw
  • Download

Lines Matching +full:- +full:ne

30   return (!cpi->ppi->use_svc ||  in noise_est_svc()
31 (cpi->ppi->use_svc && in noise_est_svc()
32 cpi->svc.spatial_layer_id == cpi->svc.number_spatial_layers - 1)); in noise_est_svc()
36 void av1_noise_estimate_init(NOISE_ESTIMATE *const ne, int width, int height) { in av1_noise_estimate_init() argument
38 ne->enabled = 0; in av1_noise_estimate_init()
39 ne->level = (area < 1280 * 720) ? kLowLow : kLow; in av1_noise_estimate_init()
40 ne->value = 0; in av1_noise_estimate_init()
41 ne->count = 0; in av1_noise_estimate_init()
42 ne->thresh = 90; in av1_noise_estimate_init()
43 ne->last_w = 0; in av1_noise_estimate_init()
44 ne->last_h = 0; in av1_noise_estimate_init()
46 ne->thresh = 200; in av1_noise_estimate_init()
48 ne->thresh = 140; in av1_noise_estimate_init()
50 ne->thresh = 115; in av1_noise_estimate_init()
52 ne->num_frames_estimate = 15; in av1_noise_estimate_init()
53 ne->adapt_thresh = (3 * ne->thresh) >> 1; in av1_noise_estimate_init()
60 if (cpi->common.seq_params->use_highbitdepth) return 0; in enable_noise_estimation()
64 if (cpi->oxcf.noise_sensitivity > 0 && noise_est_svc(cpi) && in enable_noise_estimation()
65 cpi->common.width >= 320 && cpi->common.height >= 180) in enable_noise_estimation()
72 if (cpi->oxcf.pass == AOM_RC_ONE_PASS && cpi->oxcf.rc_cfg.mode == AOM_CBR && in enable_noise_estimation()
73 cpi->oxcf.q_cfg.aq_mode == CYCLIC_REFRESH_AQ && cpi->oxcf.speed >= 5 && in enable_noise_estimation()
74 resize_pending == 0 && !cpi->ppi->use_svc && in enable_noise_estimation()
75 cpi->oxcf.tune_cfg.content != AOM_CONTENT_SCREEN && in enable_noise_estimation()
76 cpi->common.width * cpi->common.height >= 640 * 360) in enable_noise_estimation()
85 const uint8_t *srcbuf = src->y_buffer; in copy_frame()
86 uint8_t *destbuf = dest->y_buffer; in copy_frame()
88 assert(dest->y_width == src->y_width); in copy_frame()
89 assert(dest->y_height == src->y_height); in copy_frame()
91 for (int r = 0; r < dest->y_height; ++r) { in copy_frame()
92 memcpy(destbuf, srcbuf, dest->y_width); in copy_frame()
93 destbuf += dest->y_stride; in copy_frame()
94 srcbuf += src->y_stride; in copy_frame()
99 NOISE_LEVEL av1_noise_estimate_extract_level(NOISE_ESTIMATE *const ne) { in av1_noise_estimate_extract_level() argument
101 if (ne->value > (ne->thresh << 1)) { in av1_noise_estimate_extract_level()
104 if (ne->value > ne->thresh) in av1_noise_estimate_extract_level()
106 else if (ne->value > (ne->thresh >> 1)) in av1_noise_estimate_extract_level()
115 const AV1_COMMON *const cm = &cpi->common; in av1_update_noise_estimate()
116 const CommonModeInfoParams *const mi_params = &cm->mi_params; in av1_update_noise_estimate()
118 NOISE_ESTIMATE *const ne = &cpi->noise_estimate; in av1_update_noise_estimate() local
119 const int low_res = (cm->width <= 352 && cm->height <= 288); in av1_update_noise_estimate()
123 int frame_counter = cm->current_frame.frame_number; in av1_update_noise_estimate()
125 YV12_BUFFER_CONFIG *last_source = cpi->last_source; in av1_update_noise_estimate()
127 if (cpi->oxcf.noise_sensitivity > 0 && noise_est_svc(cpi)) { in av1_update_noise_estimate()
128 last_source = &cpi->denoiser.last_source; in av1_update_noise_estimate()
131 if (cm->width > 640 && cm->width <= 1920) { in av1_update_noise_estimate()
136 ne->enabled = enable_noise_estimation(cpi); in av1_update_noise_estimate()
137 if (cpi->svc.number_spatial_layers > 1) in av1_update_noise_estimate()
138 frame_counter = cpi->svc.current_superframe; in av1_update_noise_estimate()
139 if (!ne->enabled || frame_counter % frame_period != 0 || in av1_update_noise_estimate()
141 (cpi->svc.number_spatial_layers == 1 && in av1_update_noise_estimate()
142 (ne->last_w != cm->width || ne->last_h != cm->height))) { in av1_update_noise_estimate()
144 if (cpi->oxcf.noise_sensitivity > 0 && noise_est_svc(cpi)) in av1_update_noise_estimate()
145 copy_frame(&cpi->denoiser.last_source, cpi->source); in av1_update_noise_estimate()
148 ne->last_w = cm->width; in av1_update_noise_estimate()
149 ne->last_h = cm->height; in av1_update_noise_estimate()
152 } else if (frame_counter > 60 && cpi->svc.num_encoded_top_layer > 1 && in av1_update_noise_estimate()
153 cpi->rc.frames_since_key > cpi->svc.number_spatial_layers && in av1_update_noise_estimate()
154 cpi->svc.spatial_layer_id == cpi->svc.number_spatial_layers - 1 && in av1_update_noise_estimate()
155 cpi->rc.avg_frame_low_motion < (low_res ? 60 : 40)) { in av1_update_noise_estimate()
157 ne->level = kLowLow; in av1_update_noise_estimate()
158 ne->count = 0; in av1_update_noise_estimate()
159 ne->num_frames_estimate = 10; in av1_update_noise_estimate()
161 if (cpi->oxcf.noise_sensitivity > 0 && noise_est_svc(cpi) && in av1_update_noise_estimate()
162 cpi->svc.current_superframe > 1) { in av1_update_noise_estimate()
163 av1_denoiser_set_noise_level(cpi, ne->level); in av1_update_noise_estimate()
164 copy_frame(&cpi->denoiser.last_source, cpi->source); in av1_update_noise_estimate()
176 // Loop over sub-sample of 16x16 blocks of frame, and for blocks that have in av1_update_noise_estimate()
179 const uint8_t *src_y = cpi->source->y_buffer; in av1_update_noise_estimate()
180 const int src_ystride = cpi->source->y_stride; in av1_update_noise_estimate()
181 const uint8_t *last_src_y = last_source->y_buffer; in av1_update_noise_estimate()
182 const int last_src_ystride = last_source->y_stride; in av1_update_noise_estimate()
186 for (mi_row = 0; mi_row < mi_params->mi_rows; mi_row += 2) { in av1_update_noise_estimate()
187 for (mi_col = 0; mi_col < mi_params->mi_cols; mi_col += 2) { in av1_update_noise_estimate()
189 (mi_row >> 1) * (mi_params->mi_cols >> 1) + (mi_col >> 1); in av1_update_noise_estimate()
190 if (cpi->consec_zero_mv[bl_index] > thresh_consec_zeromv) in av1_update_noise_estimate()
195 (((3 * (mi_params->mi_rows * mi_params->mi_cols) >> 2)) >> 3)) in av1_update_noise_estimate()
197 for (mi_row = 0; mi_row < mi_params->mi_rows; mi_row++) { in av1_update_noise_estimate()
198 for (mi_col = 0; mi_col < mi_params->mi_cols; mi_col++) { in av1_update_noise_estimate()
201 mi_row < mi_params->mi_rows - 3 && in av1_update_noise_estimate()
202 mi_col < mi_params->mi_cols - 3) { in av1_update_noise_estimate()
204 (mi_row >> 1) * (mi_params->mi_cols >> 1) + (mi_col >> 1); in av1_update_noise_estimate()
206 int bl_index2 = bl_index + (mi_params->mi_cols >> 1); in av1_update_noise_estimate()
209 AOMMIN(cpi->consec_zero_mv[bl_index], in av1_update_noise_estimate()
210 AOMMIN(cpi->consec_zero_mv[bl_index1], in av1_update_noise_estimate()
211 AOMMIN(cpi->consec_zero_mv[bl_index2], in av1_update_noise_estimate()
212 cpi->consec_zero_mv[bl_index3]))); in av1_update_noise_estimate()
216 // 4 sub-blocks for 16x16 block. And exclude this frame if in av1_update_noise_estimate()
219 !cpi->rc.high_source_sad) { in av1_update_noise_estimate()
221 // Compute variance between co-located blocks from current and in av1_update_noise_estimate()
223 unsigned int variance = cpi->ppi->fn_ptr[bsize].vf( in av1_update_noise_estimate()
229 hist[MAX_VAR_HIST_BINS - 1]++; // Account for the tail in av1_update_noise_estimate()
235 src_y += (src_ystride << 2) - (mi_params->mi_cols << 2); in av1_update_noise_estimate()
236 last_src_y += (last_src_ystride << 2) - (mi_params->mi_cols << 2); in av1_update_noise_estimate()
238 ne->last_w = cm->width; in av1_update_noise_estimate()
239 ne->last_h = cm->height; in av1_update_noise_estimate()
242 if (hist[0] > 10 && (hist[MAX_VAR_HIST_BINS - 1] > hist[0] >> 2)) { in av1_update_noise_estimate()
250 hist[MAX_VAR_HIST_BINS - 1] >>= 1; in av1_update_noise_estimate()
257 else if (bin_cnt == MAX_VAR_HIST_BINS - 1) in av1_update_noise_estimate()
258 hist_avg[bin_cnt] = hist[MAX_VAR_HIST_BINS - 1] >> 2; in av1_update_noise_estimate()
259 else if (bin_cnt == MAX_VAR_HIST_BINS - 2) in av1_update_noise_estimate()
260 hist_avg[bin_cnt] = (hist[bin_cnt - 1] + 2 * hist[bin_cnt] + in av1_update_noise_estimate()
265 (hist[bin_cnt - 1] + 2 * hist[bin_cnt] + hist[bin_cnt + 1] + 2) >> in av1_update_noise_estimate()
274 ne->value = (int)((3 * ne->value + max_bin * 40) >> 2); in av1_update_noise_estimate()
276 if (ne->level < kMedium && ne->value > ne->adapt_thresh) { in av1_update_noise_estimate()
277 ne->count = ne->num_frames_estimate; in av1_update_noise_estimate()
279 ne->count++; in av1_update_noise_estimate()
281 if (ne->count == ne->num_frames_estimate) { in av1_update_noise_estimate()
283 ne->num_frames_estimate = 30; in av1_update_noise_estimate()
284 ne->count = 0; in av1_update_noise_estimate()
285 ne->level = av1_noise_estimate_extract_level(ne); in av1_update_noise_estimate()
287 if (cpi->oxcf.noise_sensitivity > 0 && noise_est_svc(cpi)) in av1_update_noise_estimate()
288 av1_denoiser_set_noise_level(cpi, ne->level); in av1_update_noise_estimate()
293 if (cpi->oxcf.noise_sensitivity > 0 && noise_est_svc(cpi)) in av1_update_noise_estimate()
294 copy_frame(&cpi->denoiser.last_source, cpi->source); in av1_update_noise_estimate()