2 * Copyright (c) 2016, Alliance for Open Media. All rights reserved
4 * 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.
12 #ifndef AV1_COMMON_RECONINTRA_H_
13 #define AV1_COMMON_RECONINTRA_H_
15 #include "aom/aom_integer.h"
16 #include "av1/common/blockd.h"
17 #include "av1/common/onyxc_int.h"
23 void av1_init_intra_predictors(void);
24 void av1_predict_intra_block_facade(const AV1_COMMON
*cm
, MACROBLOCKD
*xd
,
25 int plane
, int blk_col
, int blk_row
,
27 void av1_predict_intra_block(const AV1_COMMON
*cm
, const MACROBLOCKD
*xd
,
28 int bw
, int bh
, TX_SIZE tx_size
,
29 PREDICTION_MODE mode
, int angle_delta
,
31 FILTER_INTRA_MODE filter_intra_mode
,
32 const uint8_t *ref
, int ref_stride
, uint8_t *dst
,
33 int dst_stride
, int aoff
, int loff
, int plane
);
35 // Mapping of interintra to intra mode for use in the intra component
36 static const PREDICTION_MODE interintra_to_intra_mode
[INTERINTRA_MODES
] = {
37 DC_PRED
, V_PRED
, H_PRED
, SMOOTH_PRED
40 // Mapping of intra mode to the interintra mode
41 static const INTERINTRA_MODE intra_to_interintra_mode
[INTRA_MODES
] = {
42 II_DC_PRED
, II_V_PRED
, II_H_PRED
, II_V_PRED
, II_SMOOTH_PRED
, II_V_PRED
,
43 II_H_PRED
, II_H_PRED
, II_V_PRED
, II_SMOOTH_PRED
, II_SMOOTH_PRED
46 #define FILTER_INTRA_SCALE_BITS 4
48 static INLINE
int av1_is_directional_mode(PREDICTION_MODE mode
) {
49 return mode
>= V_PRED
&& mode
<= D67_PRED
;
52 static INLINE
int av1_use_angle_delta(BLOCK_SIZE bsize
) {
53 return bsize
>= BLOCK_8X8
;
56 static INLINE
int av1_allow_intrabc(const AV1_COMMON
*const cm
) {
57 return frame_is_intra_only(cm
) && cm
->allow_screen_content_tools
&&
61 static INLINE
int av1_filter_intra_allowed_bsize(const AV1_COMMON
*const cm
,
63 if (!cm
->seq_params
.enable_filter_intra
|| bs
== BLOCK_INVALID
) return 0;
65 return block_size_wide
[bs
] <= 32 && block_size_high
[bs
] <= 32;
68 static INLINE
int av1_filter_intra_allowed(const AV1_COMMON
*const cm
,
69 const MB_MODE_INFO
*mbmi
) {
70 return mbmi
->mode
== DC_PRED
&&
71 mbmi
->palette_mode_info
.palette_size
[0] == 0 &&
72 av1_filter_intra_allowed_bsize(cm
, mbmi
->sb_type
);
75 extern const int8_t av1_filter_intra_taps
[FILTER_INTRA_MODES
][8][8];
77 // Get the shift (up-scaled by 256) in X w.r.t a unit change in Y.
78 // If angle > 0 && angle < 90, dx = -((int)(256 / t));
79 // If angle > 90 && angle < 180, dx = (int)(256 / t);
80 // If angle > 180 && angle < 270, dx = 1;
81 static INLINE
int av1_get_dx(int angle
) {
82 if (angle
> 0 && angle
< 90) {
83 return dr_intra_derivative
[angle
];
84 } else if (angle
> 90 && angle
< 180) {
85 return dr_intra_derivative
[180 - angle
];
87 // In this case, we are not really going to use dx. We may return any value.
92 // Get the shift (up-scaled by 256) in Y w.r.t a unit change in X.
93 // If angle > 0 && angle < 90, dy = 1;
94 // If angle > 90 && angle < 180, dy = (int)(256 * t);
95 // If angle > 180 && angle < 270, dy = -((int)(256 * t));
96 static INLINE
int av1_get_dy(int angle
) {
97 if (angle
> 90 && angle
< 180) {
98 return dr_intra_derivative
[angle
- 90];
99 } else if (angle
> 180 && angle
< 270) {
100 return dr_intra_derivative
[270 - angle
];
102 // In this case, we are not really going to use dy. We may return any value.
109 #endif // AV1_COMMON_RECONINTRA_H_