CDEF
Encoder Algorithm

## Functions

void | av1_cdef_frame (YV12_BUFFER_CONFIG *frame, AV1_COMMON *const cm, MACROBLOCKD *xd, cdef_init_fb_row_t cdef_init_fb_row_fn)
| Function for applying CDEF to a frame.
void | av1_cdef_search (struct AV1_COMP *cpi)
| AV1 CDEF parameter search.
void | av1_pick_cdef_from_qp (AV1_COMMON *const cm, int skip_cdef, int is_screen_content, bool avoid_uv_cdef)
| AV1 CDEF level from QP.

## Detailed Description

This module describes the CDEF parameter search algorithm in AV1. More details will be added.

## Function Documentation

## av1_cdef_frame()

void av1_cdef_frame | ( | YV12_BUFFER_CONFIG * | frame,
|  | AV1_COMMON *const | cm,
|  | MACROBLOCKD * | xd,
|  | cdef_init_fb_row_t | cdef_init_fb_row_fn )

Function for applying CDEF to a frame.

This function applies CDEF to a frame.

Parameters

  [in,out] | frame | Compressed frame buffer
  [in,out] | cm | Pointer to top level common structure
  [in] | xd | Pointer to common current coding block structure
  [in] | cdef_init_fb_row_fn | Function Pointer

Remarks
  Nothing is returned. Instead, the filtered frame is output in `frame`.

Referenced by cdef_restoration_frame().

## av1_cdef_search()

void av1_cdef_search | ( | struct AV1_COMP * | cpi | ) |

AV1 CDEF parameter search.

Searches for optimal CDEF parameters for frame

Parameters

  [in,out] | cpi | Top level encoder structure

Remarks
  Nothing is returned. Instead, optimal CDEF parameters are stored in the `cdef_info` structure of type CdefInfo inside `cm:`
  - `cdef_bits:` Bits of strength parameters
  - `nb_cdef_strengths:` Number of strength parameters
  - `cdef_strengths:` list of `nb_cdef_strengths` strength parameters for the luma plane.
  - `uv_cdef_strengths:` list of `nb_cdef_strengths` strength parameters for the chroma planes.
  - `damping_factor:` CDEF damping factor.

Referenced by cdef_restoration_frame().

## av1_pick_cdef_from_qp()

void av1_pick_cdef_from_qp | ( | AV1_COMMON *const | cm,
|  | int | skip_cdef,
|  | int | is_screen_content,
|  | bool | avoid_uv_cdef )

AV1 CDEF level from QP.

Calculates CDEF levels from frame QP. Only used for speed 7+ with RT mode.

Parameters

  [in,out] | cm | Pointer to top level common structure
  [in] | skip_cdef | Flag to skip CDEF filtering
  [in] | is_screen_content | Flag indicating screen content
  [in] | avoid_uv_cdef | Flag to avoid assigning UV CDEF strengths