av1/encoder/temporal_filter.c
// Computes temporal filter weights and accumulators from all reference frames
// excluding the current frame to be filtered.
// Inputs:
//   frame_to_filter: Pointer to the frame to be filtered, which is used as
//                    reference to compute squared differece from the predictor.
//   mbd: Pointer to the block for filtering, which is ONLY used to get
//        subsampling information of all planes and the bit-depth.
//   block_size: Size of the block.
//   mb_row: Row index of the block in the entire frame.
//   mb_col: Column index of the block in the entire frame.
//   num_planes: Number of planes in the frame.
//   use_planewise_strategy: Whether to use plane-wise strategy or YUV strategy.
//   strength: Strength for filter weight adjustment. (Used in YUV strategy)
//   use_subblock: Whether to use 4 sub-blocks to replace the original block.
//                 (Used in YUV strategy)
//   subblock_filter_weights: The filter weights for each sub-block (row-major
//                            order). If `use_subblock` is set as 0, the first
//                            weight will be applied to the entire block. (Used
//                            in YUV strategy)
//   noise_levels: Pointer to the noise levels of the to-filter frame, estimated
//                 with each plane (in Y, U, V order). (Used in plane-wise
//                 strategy)
//   pred: Pointer to the well-built predictors.
//   accum: Pointer to the pixel-wise accumulator for filtering.
//   count: Pointer to the pixel-wise counter fot filtering.
// Returns:
//   Nothing will be returned. But the content to which `accum` and `pred`
//   point will be modified.
Computes temporal filter weights and accumulators from all reference frames
excluding the current frame to be filtered.
Inputs:
frame_to_filter: Pointer to the frame to be filtered, which is used as
reference to compute squared differece from the predictor.
mbd: Pointer to the block for filtering, which is ONLY used to get
subsampling information of all planes and the bit-depth.
block_size: Size of the block.
mb_row: Row index of the block in the entire frame.
mb_col: Column index of the block in the entire frame.
num_planes: Number of planes in the frame.
use_planewise_strategy: Whether to use plane-wise strategy or YUV strategy.
strength: Strength for filter weight adjustment. (Used in YUV strategy)
use_subblock: Whether to use 4 sub-blocks to replace the original block.
(Used in YUV strategy)
subblock_filter_weights: The filter weights for each sub-block (row-major
order). If `use_subblock` is set as 0, the first
weight will be applied to the entire block. (Used
in YUV strategy)
noise_levels: Pointer to the noise levels of the to-filter frame, estimated
with each plane (in Y, U, V order). (Used in plane-wise
strategy)
pred: Pointer to the well-built predictors.
accum: Pointer to the pixel-wise accumulator for filtering.
count: Pointer to the pixel-wise counter fot filtering.
Returns:
Nothing will be returned. But the content to which `accum` and `pred`
point will be modified.
Computes temporal filter weights and accumulators from all reference frames excluding the current frame to be filtered . Inputs : frame_to_filter : Pointer to the frame to be filtered which is used as reference to compute squared differece from the predictor . mbd : Pointer to the block for filtering which is ONLY used to get subsampling information of all planes and the bit - depth . block_size : Size of the block . mb_row : Row index of the block in the entire frame . mb_col : Column index of the block in the entire frame . num_planes : Number of planes in the frame . use_planewise_strategy : Whether to use plane - wise strategy or YUV strategy . strength : Strength for filter weight adjustment . ( Used in YUV strategy ) use_subblock : Whether to use 4 sub - blocks to replace the original block . ( Used in YUV strategy ) subblock_filter_weights : The filter weights for each sub - block ( row - major order ) . If ` use_subblock ` is set as 0 the first weight will be applied to the entire block . ( Used in YUV strategy ) noise_levels : Pointer to the noise levels of the to - filter frame estimated with each plane ( in Y U V order ) . ( Used in plane - wise strategy ) pred : Pointer to the well - built predictors . accum : Pointer to the pixel - wise accumulator for filtering . count : Pointer to the pixel - wise counter fot filtering . Returns : Nothing will be returned . But the content to which ` accum ` and ` pred ` point will be modified .
void av1_apply_temporal_filter_others(
    const YV12_BUFFER_CONFIG *frame_to_filter, const MACROBLOCKD *mbd,
    const BLOCK_SIZE block_size, const int mb_row, const int mb_col,
    const int num_planes, const int use_planewise_strategy, const int strength,
    const int use_subblock, const int *subblock_filter_weights,
    const double *noise_levels, const uint8_t *pred, uint32_t *accum,
    uint16_t *count) {
  assert(num_planes >= 1 && num_planes <= MAX_MB_PLANE);
  if (use_planewise_strategy) {  
    if (is_frame_high_bitdepth(frame_to_filter)) {
      av1_apply_temporal_filter_planewise_c(frame_to_filter, mbd, block_size,
                                            mb_row, mb_col, num_planes,
                                            noise_levels, pred, accum, count);
    } else {
      av1_apply_temporal_filter_planewise(frame_to_filter, mbd, block_size,
                                          mb_row, mb_col, num_planes,
                                          noise_levels, pred, accum, count);
    }
  } else {  
    if (subblock_filter_weights[0] == 0 && subblock_filter_weights[1] == 0 &&
        subblock_filter_weights[2] == 0 && subblock_filter_weights[3] == 0) {
      return;
    }
    const int adj_strength = strength + 2 * (mbd->bd - 8);
    if (num_planes == 3 && TF_YUV_FILTER_WEIGHT_SCALE == 3) {
      av1_apply_temporal_filter_yuv(frame_to_filter, mbd, block_size, mb_row,
                                    mb_col, num_planes, adj_strength,
                                    use_subblock, subblock_filter_weights, pred,
                                    accum, count);
    } else {
      av1_apply_temporal_filter_yuv_c(frame_to_filter, mbd, block_size, mb_row,
                                      mb_col, num_planes, adj_strength,
                                      use_subblock, subblock_filter_weights,
                                      pred, accum, count);
    }
  }
}
void av1_apply_temporal_filter_others ( const YV12_BUFFER_CONFIG * frame_to_filter , const MACROBLOCKD * mbd , const BLOCK_SIZE block_size , const int mb_row , const int mb_col , const int num_planes , const int use_planewise_strategy , const int strength , const int use_subblock , const int * subblock_filter_weights , const double * noise_levels , const uint8_t * pred , uint32_t * accum , uint16_t * count ) { assert ( num_planes >= 1 && num_planes <= MAX_MB_PLANE ) ; if ( use_planewise_strategy ) { if ( is_frame_high_bitdepth ( frame_to_filter ) ) { av1_apply_temporal_filter_planewise_c ( frame_to_filter , mbd , block_size , mb_row , mb_col , num_planes , noise_levels , pred , accum , count ) ; } else { av1_apply_temporal_filter_planewise ( frame_to_filter , mbd , block_size , mb_row , mb_col , num_planes , noise_levels , pred , accum , count ) ; } } else { if ( subblock_filter_weights [ 0 ] == 0 && subblock_filter_weights [ 1 ] == 0 && subblock_filter_weights [ 2 ] == 0 && subblock_filter_weights [ 3 ] == 0 ) { return ; } const int adj_strength = strength + 2 * ( mbd -> bd - 8 ) ; if ( num_planes == 3 && TF_YUV_FILTER_WEIGHT_SCALE == 3 ) { av1_apply_temporal_filter_yuv ( frame_to_filter , mbd , block_size , mb_row , mb_col , num_planes , adj_strength , use_subblock , subblock_filter_weights , pred , accum , count ) ; } else { av1_apply_temporal_filter_yuv_c ( frame_to_filter , mbd , block_size , mb_row , mb_col , num_planes , adj_strength , use_subblock , subblock_filter_weights , pred , accum , count ) ; } } }
Computes temporal filter weights and accumulators from all reference frames
excluding the current frame to be filtered.
Computes temporal filter weights and accumulators from all reference frames excluding the current frame to be filtered .
// Commonly used for high-resolution video. // TODO(any): avx2 and sse2 version should also support high bit-depth. // Commonly used for low-resolution video. // TODO(any): sse4 version should be changed to align with C function // before using.