summaryrefslogtreecommitdiffstats
path: root/third_party/aom/av1/encoder/rd.h
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/aom/av1/encoder/rd.h')
-rw-r--r--third_party/aom/av1/encoder/rd.h150
1 files changed, 125 insertions, 25 deletions
diff --git a/third_party/aom/av1/encoder/rd.h b/third_party/aom/av1/encoder/rd.h
index 5c3eee493..ea5115b41 100644
--- a/third_party/aom/av1/encoder/rd.h
+++ b/third_party/aom/av1/encoder/rd.h
@@ -30,12 +30,13 @@ extern "C" {
#define RDDIV_BITS 7
#define RD_EPB_SHIFT 6
-#define RDCOST(RM, DM, R, D) \
- (ROUND_POWER_OF_TWO(((int64_t)R) * (RM), AV1_PROB_COST_SHIFT) + (D << DM))
+#define RDCOST(RM, R, D) \
+ (ROUND_POWER_OF_TWO(((int64_t)R) * (RM), AV1_PROB_COST_SHIFT) + \
+ (D << RDDIV_BITS))
-#define RDCOST_DBL(RM, DM, R, D) \
+#define RDCOST_DBL(RM, R, D) \
(((((double)(R)) * (RM)) / (double)(1 << AV1_PROB_COST_SHIFT)) + \
- ((double)(D) * (1 << (DM))))
+ ((double)(D) * (1 << RDDIV_BITS)))
#define QIDX_SKIP_THRESH 115
@@ -96,6 +97,54 @@ typedef enum {
#if CONFIG_EXT_INTER
+#if CONFIG_COMPOUND_SINGLEREF
+ THR_SR_NEAREST_NEARMV,
+#if CONFIG_EXT_REFS
+ THR_SR_NEAREST_NEARL2,
+ THR_SR_NEAREST_NEARL3,
+ THR_SR_NEAREST_NEARB,
+#endif // CONFIG_EXT_REFS
+ THR_SR_NEAREST_NEARG,
+ THR_SR_NEAREST_NEARA,
+
+ /*
+ THR_SR_NEAREST_NEWMV,
+#if CONFIG_EXT_REFS
+ THR_SR_NEAREST_NEWL2,
+ THR_SR_NEAREST_NEWL3,
+ THR_SR_NEAREST_NEWB,
+#endif // CONFIG_EXT_REFS
+ THR_SR_NEAREST_NEWG,
+ THR_SR_NEAREST_NEWA,*/
+
+ THR_SR_NEAR_NEWMV,
+#if CONFIG_EXT_REFS
+ THR_SR_NEAR_NEWL2,
+ THR_SR_NEAR_NEWL3,
+ THR_SR_NEAR_NEWB,
+#endif // CONFIG_EXT_REFS
+ THR_SR_NEAR_NEWG,
+ THR_SR_NEAR_NEWA,
+
+ THR_SR_ZERO_NEWMV,
+#if CONFIG_EXT_REFS
+ THR_SR_ZERO_NEWL2,
+ THR_SR_ZERO_NEWL3,
+ THR_SR_ZERO_NEWB,
+#endif // CONFIG_EXT_REFS
+ THR_SR_ZERO_NEWG,
+ THR_SR_ZERO_NEWA,
+
+ THR_SR_NEW_NEWMV,
+#if CONFIG_EXT_REFS
+ THR_SR_NEW_NEWL2,
+ THR_SR_NEW_NEWL3,
+ THR_SR_NEW_NEWB,
+#endif // CONFIG_EXT_REFS
+ THR_SR_NEW_NEWG,
+ THR_SR_NEW_NEWA,
+#endif // CONFIG_COMPOUND_SINGLEREF
+
THR_COMP_NEAREST_NEARESTLA,
#if CONFIG_EXT_REFS
THR_COMP_NEAREST_NEARESTL2A,
@@ -107,6 +156,12 @@ typedef enum {
THR_COMP_NEAREST_NEARESTL2B,
THR_COMP_NEAREST_NEARESTL3B,
THR_COMP_NEAREST_NEARESTGB,
+#if CONFIG_EXT_COMP_REFS
+ THR_COMP_NEAREST_NEARESTLL2,
+ THR_COMP_NEAREST_NEARESTLL3,
+ THR_COMP_NEAREST_NEARESTLG,
+ THR_COMP_NEAREST_NEARESTBA,
+#endif // CONFIG_EXT_COMP_REFS
#endif // CONFIG_EXT_REFS
#else // CONFIG_EXT_INTER
@@ -122,6 +177,12 @@ typedef enum {
THR_COMP_NEARESTL2B,
THR_COMP_NEARESTL3B,
THR_COMP_NEARESTGB,
+#if CONFIG_EXT_COMP_REFS
+ THR_COMP_NEARESTLL2,
+ THR_COMP_NEARESTLL3,
+ THR_COMP_NEARESTLG,
+ THR_COMP_NEARESTBA,
+#endif // CONFIG_EXT_COMP_REFS
#endif // CONFIG_EXT_REFS
#endif // CONFIG_EXT_INTER
@@ -138,8 +199,6 @@ typedef enum {
#if CONFIG_EXT_INTER
- THR_COMP_NEAR_NEARESTLA,
- THR_COMP_NEAREST_NEARLA,
THR_COMP_NEAR_NEARLA,
THR_COMP_NEW_NEARESTLA,
THR_COMP_NEAREST_NEWLA,
@@ -149,8 +208,6 @@ typedef enum {
THR_COMP_ZERO_ZEROLA,
#if CONFIG_EXT_REFS
- THR_COMP_NEAR_NEARESTL2A,
- THR_COMP_NEAREST_NEARL2A,
THR_COMP_NEAR_NEARL2A,
THR_COMP_NEW_NEARESTL2A,
THR_COMP_NEAREST_NEWL2A,
@@ -159,8 +216,6 @@ typedef enum {
THR_COMP_NEW_NEWL2A,
THR_COMP_ZERO_ZEROL2A,
- THR_COMP_NEAR_NEARESTL3A,
- THR_COMP_NEAREST_NEARL3A,
THR_COMP_NEAR_NEARL3A,
THR_COMP_NEW_NEARESTL3A,
THR_COMP_NEAREST_NEWL3A,
@@ -170,8 +225,6 @@ typedef enum {
THR_COMP_ZERO_ZEROL3A,
#endif // CONFIG_EXT_REFS
- THR_COMP_NEAR_NEARESTGA,
- THR_COMP_NEAREST_NEARGA,
THR_COMP_NEAR_NEARGA,
THR_COMP_NEW_NEARESTGA,
THR_COMP_NEAREST_NEWGA,
@@ -181,8 +234,6 @@ typedef enum {
THR_COMP_ZERO_ZEROGA,
#if CONFIG_EXT_REFS
- THR_COMP_NEAR_NEARESTLB,
- THR_COMP_NEAREST_NEARLB,
THR_COMP_NEAR_NEARLB,
THR_COMP_NEW_NEARESTLB,
THR_COMP_NEAREST_NEWLB,
@@ -191,8 +242,6 @@ typedef enum {
THR_COMP_NEW_NEWLB,
THR_COMP_ZERO_ZEROLB,
- THR_COMP_NEAR_NEARESTL2B,
- THR_COMP_NEAREST_NEARL2B,
THR_COMP_NEAR_NEARL2B,
THR_COMP_NEW_NEARESTL2B,
THR_COMP_NEAREST_NEWL2B,
@@ -201,8 +250,6 @@ typedef enum {
THR_COMP_NEW_NEWL2B,
THR_COMP_ZERO_ZEROL2B,
- THR_COMP_NEAR_NEARESTL3B,
- THR_COMP_NEAREST_NEARL3B,
THR_COMP_NEAR_NEARL3B,
THR_COMP_NEW_NEARESTL3B,
THR_COMP_NEAREST_NEWL3B,
@@ -211,8 +258,6 @@ typedef enum {
THR_COMP_NEW_NEWL3B,
THR_COMP_ZERO_ZEROL3B,
- THR_COMP_NEAR_NEARESTGB,
- THR_COMP_NEAREST_NEARGB,
THR_COMP_NEAR_NEARGB,
THR_COMP_NEW_NEARESTGB,
THR_COMP_NEAREST_NEWGB,
@@ -220,6 +265,40 @@ typedef enum {
THR_COMP_NEAR_NEWGB,
THR_COMP_NEW_NEWGB,
THR_COMP_ZERO_ZEROGB,
+
+#if CONFIG_EXT_COMP_REFS
+ THR_COMP_NEAR_NEARLL2,
+ THR_COMP_NEW_NEARESTLL2,
+ THR_COMP_NEAREST_NEWLL2,
+ THR_COMP_NEW_NEARLL2,
+ THR_COMP_NEAR_NEWLL2,
+ THR_COMP_NEW_NEWLL2,
+ THR_COMP_ZERO_ZEROLL2,
+
+ THR_COMP_NEAR_NEARLL3,
+ THR_COMP_NEW_NEARESTLL3,
+ THR_COMP_NEAREST_NEWLL3,
+ THR_COMP_NEW_NEARLL3,
+ THR_COMP_NEAR_NEWLL3,
+ THR_COMP_NEW_NEWLL3,
+ THR_COMP_ZERO_ZEROLL3,
+
+ THR_COMP_NEAR_NEARLG,
+ THR_COMP_NEW_NEARESTLG,
+ THR_COMP_NEAREST_NEWLG,
+ THR_COMP_NEW_NEARLG,
+ THR_COMP_NEAR_NEWLG,
+ THR_COMP_NEW_NEWLG,
+ THR_COMP_ZERO_ZEROLG,
+
+ THR_COMP_NEAR_NEARBA,
+ THR_COMP_NEW_NEARESTBA,
+ THR_COMP_NEAREST_NEWBA,
+ THR_COMP_NEW_NEARBA,
+ THR_COMP_NEAR_NEWBA,
+ THR_COMP_NEW_NEWBA,
+ THR_COMP_ZERO_ZEROBA,
+#endif // CONFIG_EXT_COMP_REFS
#endif // CONFIG_EXT_REFS
#else // CONFIG_EXT_INTER
@@ -244,6 +323,17 @@ typedef enum {
THR_COMP_NEWL3B,
THR_COMP_NEARGB,
THR_COMP_NEWGB,
+
+#if CONFIG_EXT_COMP_REFS
+ THR_COMP_NEARLL2,
+ THR_COMP_NEWLL2,
+ THR_COMP_NEARLL3,
+ THR_COMP_NEWLL3,
+ THR_COMP_NEARLG,
+ THR_COMP_NEWLG,
+ THR_COMP_NEARBA,
+ THR_COMP_NEWBA,
+#endif // CONFIG_EXT_COMP_REFS
#endif // CONFIG_EXT_REFS
THR_COMP_ZEROLA,
@@ -258,6 +348,13 @@ typedef enum {
THR_COMP_ZEROL2B,
THR_COMP_ZEROL3B,
THR_COMP_ZEROGB,
+
+#if CONFIG_EXT_COMP_REFS
+ THR_COMP_ZEROLL2,
+ THR_COMP_ZEROLL3,
+ THR_COMP_ZEROLG,
+ THR_COMP_ZEROBA,
+#endif // CONFIG_EXT_COMP_REFS
#endif // CONFIG_EXT_REFS
#endif // CONFIG_EXT_INTER
@@ -344,12 +441,11 @@ typedef struct RD_OPT {
int thresh_mult[MAX_MODES];
int thresh_mult_sub8x8[MAX_REFS];
- int threshes[MAX_SEGMENTS][BLOCK_SIZES][MAX_MODES];
+ int threshes[MAX_SEGMENTS][BLOCK_SIZES_ALL][MAX_MODES];
int64_t prediction_type_threshes[TOTAL_REFS_PER_FRAME][REFERENCE_MODES];
int RDMULT;
- int RDDIV;
} RD_OPT;
static INLINE void av1_init_rd_stats(RD_STATS *rd_stats) {
@@ -361,7 +457,9 @@ static INLINE void av1_init_rd_stats(RD_STATS *rd_stats) {
rd_stats->rdcost = 0;
rd_stats->sse = 0;
rd_stats->skip = 1;
-#if CONFIG_DAALA_DIST && CONFIG_CB4X4
+ rd_stats->zero_rate = 0;
+ rd_stats->ref_rdcost = INT64_MAX;
+#if CONFIG_DIST_8X8 && CONFIG_CB4X4
rd_stats->dist_y = 0;
#endif
#if CONFIG_RD_DEBUG
@@ -388,7 +486,9 @@ static INLINE void av1_invalid_rd_stats(RD_STATS *rd_stats) {
rd_stats->rdcost = INT64_MAX;
rd_stats->sse = INT64_MAX;
rd_stats->skip = 0;
-#if CONFIG_DAALA_DIST && CONFIG_CB4X4
+ rd_stats->zero_rate = 0;
+ rd_stats->ref_rdcost = INT64_MAX;
+#if CONFIG_DIST_8X8 && CONFIG_CB4X4
rd_stats->dist_y = INT64_MAX;
#endif
#if CONFIG_RD_DEBUG
@@ -415,7 +515,7 @@ static INLINE void av1_merge_rd_stats(RD_STATS *rd_stats_dst,
rd_stats_dst->dist += rd_stats_src->dist;
rd_stats_dst->sse += rd_stats_src->sse;
rd_stats_dst->skip &= rd_stats_src->skip;
-#if CONFIG_DAALA_DIST && CONFIG_CB4X4
+#if CONFIG_DIST_8X8 && CONFIG_CB4X4
rd_stats_dst->dist_y += rd_stats_src->dist_y;
#endif
#if CONFIG_RD_DEBUG