/* * 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.
*/
// Can we use CfL for the current block? staticinline CFL_ALLOWED_TYPE is_cfl_allowed(const MACROBLOCKD *xd) { const MB_MODE_INFO *mbmi = xd->mi[0]; const BLOCK_SIZE bsize = mbmi->bsize;
assert(bsize < BLOCK_SIZES_ALL); if (xd->lossless[mbmi->segment_id]) { // In lossless, CfL is available when the partition size is equal to the // transform size. constint ssx = xd->plane[AOM_PLANE_U].subsampling_x; constint ssy = xd->plane[AOM_PLANE_U].subsampling_y; constint plane_bsize = get_plane_block_size(bsize, ssx, ssy); return (CFL_ALLOWED_TYPE)(plane_bsize == BLOCK_4X4);
} // Spec: CfL is available to luma partitions lesser than or equal to 32x32 return (CFL_ALLOWED_TYPE)(block_size_wide[bsize] <= 32 &&
block_size_high[bsize] <= 32);
}
// Do we need to save the luma pixels from the current block, // for a possible future CfL prediction? staticinline CFL_ALLOWED_TYPE store_cfl_required(const AV1_COMMON *cm, const MACROBLOCKD *xd) { const MB_MODE_INFO *mbmi = xd->mi[0];
if (cm->seq_params->monochrome) return CFL_DISALLOWED;
if (!xd->is_chroma_ref) { // For non-chroma-reference blocks, we should always store the luma pixels, // in case the corresponding chroma-reference block uses CfL. // Note that this can only happen for block sizes which are <8 on // their shortest side, as otherwise they would be chroma reference // blocks. return CFL_ALLOWED;
}
// If this block has chroma information, we know whether we're // actually going to perform a CfL prediction return (CFL_ALLOWED_TYPE)(!is_inter_block(mbmi) &&
mbmi->uv_mode == UV_CFL_PRED);
}
// Allows the CFL_SUBSAMPLE function to switch types depending on the bitdepth. #define CFL_lbd_TYPE uint8_t *cfl_type #define CFL_hbd_TYPE uint16_t *cfl_type
// Declare a size-specific wrapper for the size-generic function. The compiler // will inline the size generic function in here, the advantage is that the size // will be constant allowing for loop unrolling and other constant propagated // goodness. #define CFL_SUBSAMPLE(arch, sub, bd, width, height) \ void cfl_subsample_##bd##_##sub##_##width##x##height##_##arch( \ const CFL_##bd##_TYPE, int input_stride, uint16_t *output_q3); \ void cfl_subsample_##bd##_##sub##_##width##x##height##_##arch( \ const CFL_##bd##_TYPE, int input_stride, uint16_t *output_q3) { \
cfl_luma_subsampling_##sub##_##bd##_##arch(cfl_type, input_stride, \
output_q3, width, height); \
}
// The RTCD script does not support passing in an array, so we wrap it in this // function. #if CONFIG_AV1_HIGHBITDEPTH #define CFL_GET_SUBSAMPLE_FUNCTION(arch) \
CFL_SUBSAMPLE_FUNCTIONS(arch, 420, lbd) \
CFL_SUBSAMPLE_FUNCTIONS(arch, 422, lbd) \
CFL_SUBSAMPLE_FUNCTIONS(arch, 444, lbd) \
CFL_SUBSAMPLE_FUNCTIONS(arch, 420, hbd) \
CFL_SUBSAMPLE_FUNCTIONS(arch, 422, hbd) \
CFL_SUBSAMPLE_FUNCTIONS(arch, 444, hbd) #else #define CFL_GET_SUBSAMPLE_FUNCTION(arch) \
CFL_SUBSAMPLE_FUNCTIONS(arch, 420, lbd) \
CFL_SUBSAMPLE_FUNCTIONS(arch, 422, lbd) \
CFL_SUBSAMPLE_FUNCTIONS(arch, 444, lbd) #endif
// Declare a size-specific wrapper for the size-generic function. The compiler // will inline the size generic function in here, the advantage is that the size // will be constant allowing for loop unrolling and other constant propagated // goodness. #define CFL_SUB_AVG_X(arch, width, height, round_offset, num_pel_log2) \ void cfl_subtract_average_##width##x##height##_##arch(const uint16_t *src, \
int16_t *dst); \ void cfl_subtract_average_##width##x##height##_##arch(const uint16_t *src, \
int16_t *dst) { \
subtract_average_##arch(src, dst, width, height, round_offset, \
num_pel_log2); \
}
#if CONFIG_AV1_HIGHBITDEPTH #define CFL_PREDICT_hbd(arch, width, height) \ void cfl_predict_hbd_##width##x##height##_##arch( \ const int16_t *pred_buf_q3, uint16_t *dst, int dst_stride, int alpha_q3, \ int bd); \ void cfl_predict_hbd_##width##x##height##_##arch( \ const int16_t *pred_buf_q3, uint16_t *dst, int dst_stride, int alpha_q3, \ int bd) { \
cfl_predict_hbd_##arch(pred_buf_q3, dst, dst_stride, alpha_q3, bd, width, \
height); \
} #endif
// This wrapper exists because clang format does not like calling macros with // lowercase letters. #define CFL_PREDICT_X(arch, width, height, bd) \
CFL_PREDICT_##bd(arch, width, height)
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.