av1/encoder/temporal_filter.c
// Normalizes the accumulated filtering result to produce the filtered frame.
// Inputs:
//   mbd: Pointer to the block for filtering, which is ONLY used to get
//        subsampling information of all planes.
//   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.
//   accum: Pointer to the pre-computed accumulator.
//   count: Pointer to the pre-computed count.
//   result_buffer: Pointer to result buffer.
// Returns:
//   Nothing will be returned. But the content to which `result_buffer` point
//   will be modified.
Normalizes the accumulated filtering result to produce the filtered frame.
Inputs:
mbd: Pointer to the block for filtering, which is ONLY used to get
subsampling information of all planes.
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.
accum: Pointer to the pre-computed accumulator.
count: Pointer to the pre-computed count.
result_buffer: Pointer to result buffer.
Returns:
Nothing will be returned. But the content to which `result_buffer` point
will be modified.
Normalizes the accumulated filtering result to produce the filtered frame . Inputs : mbd : Pointer to the block for filtering which is ONLY used to get subsampling information of all planes . 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 . accum : Pointer to the pre - computed accumulator . count : Pointer to the pre - computed count . result_buffer : Pointer to result buffer . Returns : Nothing will be returned . But the content to which ` result_buffer ` point will be modified .
static void tf_normalize_filtered_frame(
    const MACROBLOCKD *mbd, const BLOCK_SIZE block_size, const int mb_row,
    const int mb_col, const int num_planes, const uint32_t *accum,
    const uint16_t *count, YV12_BUFFER_CONFIG *result_buffer) {
  assert(num_planes >= 1 && num_planes <= MAX_MB_PLANE);
  const int mb_height = block_size_high[block_size];
  const int mb_width = block_size_wide[block_size];
  const int mb_pels = mb_height * mb_width;
  const int is_high_bitdepth = is_frame_high_bitdepth(result_buffer);
  int plane_offset = 0;
  for (int plane = 0; plane < num_planes; ++plane) {
    const int plane_h = mb_height >> mbd->plane[plane].subsampling_y;
    const int plane_w = mb_width >> mbd->plane[plane].subsampling_x;
    const int frame_stride = result_buffer->strides[plane == 0 ? 0 : 1];
    const int frame_offset = mb_row * plane_h * frame_stride + mb_col * plane_w;
    uint8_t *const buf = result_buffer->buffers[plane];
    uint16_t *const buf16 = CONVERT_TO_SHORTPTR(buf);
    int plane_idx = 0;             
    int frame_idx = frame_offset;  
    for (int i = 0; i < plane_h; ++i) {
      for (int j = 0; j < plane_w; ++j) {
        const int idx = plane_idx + plane_offset;
        const uint16_t rounding = count[idx] >> 1;
        if (is_high_bitdepth) {
          buf16[frame_idx] =
              (uint16_t)OD_DIVU(accum[idx] + rounding, count[idx]);
        } else {
          buf[frame_idx] = (uint8_t)OD_DIVU(accum[idx] + rounding, count[idx]);
        }
        ++plane_idx;
        ++frame_idx;
      }
      frame_idx += (frame_stride - plane_w);
    }
    plane_offset += mb_pels;
  }
}
static void tf_normalize_filtered_frame ( const MACROBLOCKD * mbd , const BLOCK_SIZE block_size , const int mb_row , const int mb_col , const int num_planes , const uint32_t * accum , const uint16_t * count , YV12_BUFFER_CONFIG * result_buffer ) { assert ( num_planes >= 1 && num_planes <= MAX_MB_PLANE ) ; const int mb_height = block_size_high [ block_size ] ; const int mb_width = block_size_wide [ block_size ] ; const int mb_pels = mb_height * mb_width ; const int is_high_bitdepth = is_frame_high_bitdepth ( result_buffer ) ; int plane_offset = 0 ; for ( int plane = 0 ; plane < num_planes ; ++ plane ) { const int plane_h = mb_height >> mbd -> plane [ plane ] . subsampling_y ; const int plane_w = mb_width >> mbd -> plane [ plane ] . subsampling_x ; const int frame_stride = result_buffer -> strides [ plane == 0 ? 0 : 1 ] ; const int frame_offset = mb_row * plane_h * frame_stride + mb_col * plane_w ; uint8_t * const buf = result_buffer -> buffers [ plane ] ; uint16_t * const buf16 = CONVERT_TO_SHORTPTR ( buf ) ; int plane_idx = 0 ; int frame_idx = frame_offset ; for ( int i = 0 ; i < plane_h ; ++ i ) { for ( int j = 0 ; j < plane_w ; ++ j ) { const int idx = plane_idx + plane_offset ; const uint16_t rounding = count [ idx ] >> 1 ; if ( is_high_bitdepth ) { buf16 [ frame_idx ] = ( uint16_t ) OD_DIVU ( accum [ idx ] + rounding , count [ idx ] ) ; } else { buf [ frame_idx ] = ( uint8_t ) OD_DIVU ( accum [ idx ] + rounding , count [ idx ] ) ; } ++ plane_idx ; ++ frame_idx ; } frame_idx += ( frame_stride - plane_w ) ; } plane_offset += mb_pels ; } }
Normalizes the accumulated filtering result to produce the filtered frame.
Normalizes the accumulated filtering result to produce the filtered frame .
// Block information. // Pixel index on current plane (block-base). // Pixel index on the entire frame.