chromium/third_party/libaom/source/libaom/av1/encoder/pickcdef.h

/*
 * Copyright (c) 2016, Alliance for Open Media. All rights reserved.
 *
 * This source code is subject to the terms of the BSD 2 Clause License and
 * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
 * was not distributed with this source code in the LICENSE file, you can
 * obtain it at www.aomedia.org/license/software. If the Alliance for Open
 * Media Patent License 1.0 was not distributed with this source code in the
 * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
 */
#ifndef AOM_AV1_ENCODER_PICKCDEF_H_
#define AOM_AV1_ENCODER_PICKCDEF_H_

#include "av1/common/cdef.h"
#include "av1/encoder/speed_features.h"

#ifdef __cplusplus
extern "C" {
#endif

/*!\enum CDEF_CONTROL
 * \brief This enum controls to which frames CDEF is applied.
 */
CDEF_CONTROL;

/*!\cond */
struct MultiThreadInfo;

#define REDUCED_PRI_STRENGTHS_LVL1
#define REDUCED_PRI_STRENGTHS_LVL2
#define REDUCED_SEC_STRENGTHS_LVL3
#define REDUCED_SEC_STRENGTHS_LVL5
#define REDUCED_PRI_STRENGTHS_LVL4

#define REDUCED_TOTAL_STRENGTHS_LVL1
#define REDUCED_TOTAL_STRENGTHS_LVL2
#define REDUCED_TOTAL_STRENGTHS_LVL3
#define REDUCED_TOTAL_STRENGTHS_LVL4
#define REDUCED_TOTAL_STRENGTHS_LVL5
#define TOTAL_STRENGTHS

static const int priconv_lvl1[REDUCED_PRI_STRENGTHS_LVL1] =;
static const int priconv_lvl2[REDUCED_PRI_STRENGTHS_LVL2] =;
static const int priconv_lvl4[REDUCED_PRI_STRENGTHS_LVL4] =;
static const int priconv_lvl5[REDUCED_PRI_STRENGTHS_LVL4] =;
static const int secconv_lvl3[REDUCED_SEC_STRENGTHS_LVL3] =;
static const int secconv_lvl5[REDUCED_SEC_STRENGTHS_LVL5] =;
static const int nb_cdef_strengths[CDEF_PICK_METHODS] =;

copy_fn_t;
compute_cdef_dist_t;

/*! \brief CDEF search context.
 */
CdefSearchCtx;

static inline int sb_all_skip(const CommonModeInfoParams *const mi_params,
                              int mi_row, int mi_col) {}

// Checks if cdef processing can be skipped for particular sb.
// Inputs:
//   cdef_search_ctx: Pointer to the structure containing parameters related to
//   CDEF search context.
//   fbr: Row index in units of 64x64 block
//   fbc: Column index in units of 64x64 block
// Returns:
//   1/0 will be returned to indicate skip/don't skip cdef processing of sb
//   respectively.
static inline int cdef_sb_skip(const CommonModeInfoParams *const mi_params,
                               int fbr, int fbc) {}

void av1_cdef_dealloc_data(CdefSearchCtx *cdef_search_ctx);

void av1_cdef_mse_calc_block(CdefSearchCtx *cdef_search_ctx,
                             struct aom_internal_error_info *error_info,
                             int fbr, int fbc, int sb_count);
/*!\endcond */

/*!\brief AV1 CDEF parameter search
 *
 * \ingroup in_loop_cdef
 *
 * Searches for optimal CDEF parameters for frame
 *
 * \param[in,out]  cpi                 Top level encoder structure
 *
 * \remark Nothing is returned. Instead, optimal CDEF parameters are stored
 * in the \c cdef_info structure of type \ref CdefInfo inside \c cm:
 * \arg \c cdef_bits: Bits of strength parameters
 * \arg \c nb_cdef_strengths: Number of strength parameters
 * \arg \c cdef_strengths: list of \c nb_cdef_strengths strength parameters
 * for the luma plane.
 * \arg \c uv_cdef_strengths: list of \c nb_cdef_strengths strength parameters
 * for the chroma planes.
 * \arg \c damping_factor: CDEF damping factor.
 *
 */
void av1_cdef_search(struct AV1_COMP *cpi);

/*!\brief AV1 CDEF level from QP
 *
 * \ingroup in_loop_cdef
 *
 * Calculates CDEF levels from frame QP. Only used for speed 7+ with RT mode.
 *
 * \param[in,out]  cm                 Pointer to top level common structure
 * \param[in]      skip_cdef          Flag to skip CDEF filtering
 * \param[in]      is_screen_content  Flag indicating screen content
 *
 */
void av1_pick_cdef_from_qp(AV1_COMMON *const cm, int skip_cdef,
                           int is_screen_content);

#ifdef __cplusplus
}  // extern "C"
#endif
#endif  // AOM_AV1_ENCODER_PICKCDEF_H_