blob: 67e5706d6895f7c702d74c026421532f3c09f8fe [file] [log] [blame]
Yaowu Xuc27fc142016-08-22 16:08:15 -07001/*
Yaowu Xu2ab7ff02016-09-02 12:04:54 -07002 * Copyright (c) 2016, Alliance for Open Media. All rights reserved
Yaowu Xuc27fc142016-08-22 16:08:15 -07003 *
Yaowu Xu2ab7ff02016-09-02 12:04:54 -07004 * This source code is subject to the terms of the BSD 2 Clause License and
5 * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
6 * was not distributed with this source code in the LICENSE file, you can
7 * obtain it at www.aomedia.org/license/software. If the Alliance for Open
8 * Media Patent License 1.0 was not distributed with this source code in the
9 * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
Yaowu Xuc27fc142016-08-22 16:08:15 -070010 */
11
Yaowu Xuf883b422016-08-30 14:01:10 -070012#ifndef AV1_COMMON_RECONINTRA_H_
13#define AV1_COMMON_RECONINTRA_H_
Yaowu Xuc27fc142016-08-22 16:08:15 -070014
Yaowu Xuf883b422016-08-30 14:01:10 -070015#include "aom/aom_integer.h"
Yaowu Xuc27fc142016-08-22 16:08:15 -070016#include "av1/common/blockd.h"
17
18#ifdef __cplusplus
19extern "C" {
20#endif
21
hui sub8a6fd62017-05-10 10:57:57 -070022#if CONFIG_DPCM_INTRA
23static INLINE int av1_use_dpcm_intra(int plane, PREDICTION_MODE mode,
24 TX_TYPE tx_type,
25 const MB_MODE_INFO *const mbmi) {
26 (void)mbmi;
27 (void)plane;
28#if CONFIG_EXT_INTRA
29 if (mbmi->sb_type >= BLOCK_8X8 && mbmi->angle_delta[plane != 0]) return 0;
30#endif // CONFIG_EXT_INTRA
31 return (mode == V_PRED && (tx_type == IDTX || tx_type == H_DCT)) ||
32 (mode == H_PRED && (tx_type == IDTX || tx_type == V_DCT));
33}
34#endif // CONFIG_DPCM_INTRA
35
Yaowu Xuf883b422016-08-30 14:01:10 -070036void av1_init_intra_predictors(void);
Angie Chiang752ccce2017-04-09 13:41:13 -070037void av1_predict_intra_block_facade(MACROBLOCKD *xd, int plane, int block_idx,
38 int blk_col, int blk_row, TX_SIZE tx_size);
Jingning Hanc4c99da2016-10-24 10:27:28 -070039void av1_predict_intra_block(const MACROBLOCKD *xd, int bw, int bh,
David Barker839467f2017-01-19 11:06:15 +000040 BLOCK_SIZE bsize, PREDICTION_MODE mode,
Yaowu Xuf883b422016-08-30 14:01:10 -070041 const uint8_t *ref, int ref_stride, uint8_t *dst,
42 int dst_stride, int aoff, int loff, int plane);
Debargha Mukherjeecb603792016-10-04 13:10:23 -070043
Yue Chen4d26acb2017-05-01 12:28:34 -070044#if CONFIG_EXT_INTER && CONFIG_INTERINTRA
Debargha Mukherjeecb603792016-10-04 13:10:23 -070045// Mapping of interintra to intra mode for use in the intra component
Yue Chen4d26acb2017-05-01 12:28:34 -070046static const PREDICTION_MODE interintra_to_intra_mode[INTERINTRA_MODES] = {
47 DC_PRED, V_PRED, H_PRED,
48#if CONFIG_ALT_INTRA
49 SMOOTH_PRED
50#else
51 TM_PRED
52#endif
53};
54
55// Mapping of intra mode to the interintra mode
56static const INTERINTRA_MODE intra_to_interintra_mode[INTRA_MODES] = {
57 II_DC_PRED, II_V_PRED, II_H_PRED, II_V_PRED,
58#if CONFIG_ALT_INTRA
59 II_SMOOTH_PRED,
60#else
61 II_TM_PRED,
62#endif
63 II_V_PRED, II_H_PRED, II_H_PRED, II_V_PRED,
64#if CONFIG_ALT_INTRA
65 II_SMOOTH_PRED, II_SMOOTH_PRED
66#else
67 II_TM_PRED
68#endif
69};
Yue Chen4d26acb2017-05-01 12:28:34 -070070#endif // CONFIG_EXT_INTER && CONFIG_INTERINTRA
Yaowu Xuc27fc142016-08-22 16:08:15 -070071
hui su344b6432016-10-18 16:07:04 -070072#if CONFIG_FILTER_INTRA
73#define FILTER_INTRA_PREC_BITS 10
hui su344b6432016-10-18 16:07:04 -070074#endif // CONFIG_FILTER_INTRA
75
Joe Young830d4ce2017-05-30 17:48:13 -070076#define CONFIG_INTRA_EDGE_UPSAMPLE CONFIG_INTRA_EDGE
77#define CONFIG_USE_ANGLE_DELTA_SUB8X8 0
78
hui su0c628e62016-11-30 15:20:48 -080079#if CONFIG_EXT_INTRA
80static INLINE int av1_is_directional_mode(PREDICTION_MODE mode,
81 BLOCK_SIZE bsize) {
Joe Young830d4ce2017-05-30 17:48:13 -070082#if CONFIG_INTRA_EDGE_UPSAMPLE
83 (void)bsize;
84 return mode >= V_PRED && mode <= D63_PRED;
85#else
Urvang Joshi875a6672017-06-05 11:59:35 -070086 return mode >= V_PRED && mode <= D63_PRED && bsize >= BLOCK_8X8;
Joe Young830d4ce2017-05-30 17:48:13 -070087#endif
88}
89
90static INLINE int av1_use_angle_delta(BLOCK_SIZE bsize) {
91 (void)bsize;
92#if CONFIG_USE_ANGLE_DELTA_SUB8X8
93 return 1;
94#else
95 return bsize >= BLOCK_8X8;
96#endif
hui su0c628e62016-11-30 15:20:48 -080097}
98#endif // CONFIG_EXT_INTRA
99
Yue Chen94d84462017-05-18 12:02:47 -0700100#ifdef __cplusplus
101} // extern "C"
102#endif
Yaowu Xuf883b422016-08-30 14:01:10 -0700103#endif // AV1_COMMON_RECONINTRA_H_