12 #ifndef AOM_AV1_ENCODER_TEMPORAL_FILTER_H_ 13 #define AOM_AV1_ENCODER_TEMPORAL_FILTER_H_ 28 #define TF_BLOCK_SIZE BLOCK_32X32 31 #define TF_WINDOW_LENGTH 5 37 #define TF_WEIGHT_SCALE 1000 41 #define TF_WINDOW_BLOCK_BALANCE_WEIGHT 5 47 #define TF_Q_DECAY_THRESHOLD 20 51 #define TF_SEARCH_ERROR_NORM_WEIGHT 20 57 #define TF_STRENGTH_THRESHOLD 4 66 #define TF_SEARCH_DISTANCE_THRESHOLD 0.1 68 #define NOISE_ESTIMATION_EDGE_THRESHOLD 50 95 struct scale_factors sf;
99 double noise_levels[MAX_MB_PLANE];
144 } TemporalFilterData;
148 #if CONFIG_MULTITHREAD 150 pthread_mutex_t *mutex_;
151 #endif // CONFIG_MULTITHREAD 154 } AV1TemporalFilterSync;
171 const int bit_depth);
214 const int filter_frame_lookahead_idx,
215 FRAME_UPDATE_TYPE update_type,
int is_forward_keyframe,
216 int *show_existing_arf);
220 int av1_get_q(
const struct AV1_COMP *cpi);
229 static AOM_INLINE
void tf_alloc_and_reset_data(TemporalFilterData *tf_data,
231 int is_high_bitdepth) {
232 tf_data->tmp_mbmi = (
MB_MODE_INFO *)malloc(
sizeof(*tf_data->tmp_mbmi));
233 memset(tf_data->tmp_mbmi, 0,
sizeof(*tf_data->tmp_mbmi));
235 (uint32_t *)aom_memalign(16, num_pels *
sizeof(*tf_data->accum));
237 (uint16_t *)aom_memalign(16, num_pels *
sizeof(*tf_data->count));
238 memset(&tf_data->diff, 0,
sizeof(tf_data->diff));
239 if (is_high_bitdepth)
240 tf_data->pred = CONVERT_TO_BYTEPTR(
241 aom_memalign(32, num_pels * 2 *
sizeof(*tf_data->pred)));
244 (uint8_t *)aom_memalign(32, num_pels *
sizeof(*tf_data->pred));
254 static AOM_INLINE
void tf_setup_macroblockd(
MACROBLOCKD *mbd,
255 TemporalFilterData *tf_data,
256 const struct scale_factors *scale) {
259 mbd->
mi = &tf_data->tmp_mbmi;
269 static AOM_INLINE
void tf_dealloc_data(TemporalFilterData *tf_data,
270 int is_high_bitdepth) {
271 if (is_high_bitdepth)
272 tf_data->pred = (uint8_t *)CONVERT_TO_SHORTPTR(tf_data->pred);
273 free(tf_data->tmp_mbmi);
274 aom_free(tf_data->accum);
275 aom_free(tf_data->count);
276 aom_free(tf_data->pred);
280 static INLINE
int get_num_blocks(
const int frame_length,
const int mb_length) {
281 return (frame_length + mb_length - 1) / mb_length;
294 uint8_t **input_buffer,
int num_planes) {
295 for (
int i = 0; i < num_planes; i++) {
296 input_buffer[i] = mbd->
plane[i].pre[0].buf;
298 *input_mbmi = mbd->
mi;
310 uint8_t **input_buffer,
int num_planes) {
311 for (
int i = 0; i < num_planes; i++) {
312 mbd->
plane[i].pre[0].buf = input_buffer[i];
314 mbd->
mi = input_mbmi;
322 #endif // AOM_AV1_ENCODER_TEMPORAL_FILTER_H_ int mb_cols
Definition: temporal_filter.h:111
Parameters related to temporal filtering.
Definition: temporal_filter.h:75
int check_show_existing
Definition: temporal_filter.h:91
int num_pels
Definition: temporal_filter.h:103
struct macroblockd_plane plane[3]
Definition: blockd.h:604
int filter_frame_idx
Definition: temporal_filter.h:87
int av1_temporal_filter(struct AV1_COMP *cpi, const int filter_frame_lookahead_idx, FRAME_UPDATE_TYPE update_type, int is_forward_keyframe, int *show_existing_arf)
Performs temporal filtering if needed on a source frame. For example to create a filtered alternate r...
const struct scale_factors * block_ref_scale_factors[2]
Definition: blockd.h:685
MOTION_MODE motion_mode
The motion mode used by the inter prediction.
Definition: blockd.h:244
int mb_rows
Definition: temporal_filter.h:107
YV12 frame buffer data structure.
Definition: yv12config.h:38
MB_MODE_INFO ** mi
Definition: blockd.h:615
Variables related to current coding block.
Definition: blockd.h:568
int q_factor
Definition: temporal_filter.h:119
Top level encoder structure.
Definition: encoder.h:2095
Stores the prediction/txfm mode of the current coding block.
Definition: blockd.h:216
int num_frames
Definition: temporal_filter.h:83
int is_highbitdepth
Definition: temporal_filter.h:115
void av1_tf_do_filtering_row(struct AV1_COMP *cpi, struct ThreadData *td, int mb_row)
Does temporal filter for a given macroblock row.
Definition: temporal_filter.c:755