From 68569dee1416593955c1570d638b3d9250b33012 Mon Sep 17 00:00:00 2001 From: trav90 Date: Mon, 15 Oct 2018 21:45:30 -0500 Subject: Import aom library This is the reference implementation for the Alliance for Open Media's av1 video code. The commit used was 4d668d7feb1f8abd809d1bca0418570a7f142a36. --- third_party/aom/av1/common/seg_common.h | 86 +++++++++++++++++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 third_party/aom/av1/common/seg_common.h (limited to 'third_party/aom/av1/common/seg_common.h') diff --git a/third_party/aom/av1/common/seg_common.h b/third_party/aom/av1/common/seg_common.h new file mode 100644 index 000000000..03ed38e79 --- /dev/null +++ b/third_party/aom/av1/common/seg_common.h @@ -0,0 +1,86 @@ +/* + * 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 AV1_COMMON_SEG_COMMON_H_ +#define AV1_COMMON_SEG_COMMON_H_ + +#include "aom_dsp/prob.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define SEGMENT_DELTADATA 0 +#define SEGMENT_ABSDATA 1 + +#define MAX_SEGMENTS 8 +#define SEG_TREE_PROBS (MAX_SEGMENTS - 1) + +#define PREDICTION_PROBS 3 + +// Segment level features. +typedef enum { + SEG_LVL_ALT_Q = 0, // Use alternate Quantizer .... + SEG_LVL_ALT_LF = 1, // Use alternate loop filter value... + SEG_LVL_REF_FRAME = 2, // Optional Segment reference frame + SEG_LVL_SKIP = 3, // Optional Segment (0,0) + skip mode + SEG_LVL_MAX = 4 // Number of features supported +} SEG_LVL_FEATURES; + +struct segmentation { + uint8_t enabled; + uint8_t update_map; + uint8_t update_data; + uint8_t abs_delta; + uint8_t temporal_update; + + int16_t feature_data[MAX_SEGMENTS][SEG_LVL_MAX]; + unsigned int feature_mask[MAX_SEGMENTS]; +}; + +struct segmentation_probs { + aom_prob tree_probs[SEG_TREE_PROBS]; +#if CONFIG_EC_MULTISYMBOL + aom_cdf_prob tree_cdf[CDF_SIZE(MAX_SEGMENTS)]; +#endif + aom_prob pred_probs[PREDICTION_PROBS]; +}; + +static INLINE int segfeature_active(const struct segmentation *seg, + int segment_id, + SEG_LVL_FEATURES feature_id) { + return seg->enabled && (seg->feature_mask[segment_id] & (1 << feature_id)); +} + +void av1_clearall_segfeatures(struct segmentation *seg); + +void av1_enable_segfeature(struct segmentation *seg, int segment_id, + SEG_LVL_FEATURES feature_id); + +int av1_seg_feature_data_max(SEG_LVL_FEATURES feature_id); + +int av1_is_segfeature_signed(SEG_LVL_FEATURES feature_id); + +void av1_set_segdata(struct segmentation *seg, int segment_id, + SEG_LVL_FEATURES feature_id, int seg_data); + +static INLINE int get_segdata(const struct segmentation *seg, int segment_id, + SEG_LVL_FEATURES feature_id) { + return seg->feature_data[segment_id][feature_id]; +} + +extern const aom_tree_index av1_segment_tree[TREE_SIZE(MAX_SEGMENTS)]; + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif // AV1_COMMON_SEG_COMMON_H_ -- cgit v1.2.3 From df9477dfa60ebb5d31bc142e58ce46535c17abce Mon Sep 17 00:00:00 2001 From: trav90 Date: Wed, 17 Oct 2018 05:59:08 -0500 Subject: Update aom to slightly newer commit ID --- third_party/aom/av1/common/seg_common.h | 2 -- 1 file changed, 2 deletions(-) (limited to 'third_party/aom/av1/common/seg_common.h') diff --git a/third_party/aom/av1/common/seg_common.h b/third_party/aom/av1/common/seg_common.h index 03ed38e79..69a63874a 100644 --- a/third_party/aom/av1/common/seg_common.h +++ b/third_party/aom/av1/common/seg_common.h @@ -48,9 +48,7 @@ struct segmentation { struct segmentation_probs { aom_prob tree_probs[SEG_TREE_PROBS]; -#if CONFIG_EC_MULTISYMBOL aom_cdf_prob tree_cdf[CDF_SIZE(MAX_SEGMENTS)]; -#endif aom_prob pred_probs[PREDICTION_PROBS]; }; -- cgit v1.2.3 From 7369c7d7a5eed32963d8af37658286617919f91c Mon Sep 17 00:00:00 2001 From: trav90 Date: Thu, 18 Oct 2018 06:04:57 -0500 Subject: Update aom to commit id f5bdeac22930ff4c6b219be49c843db35970b918 --- third_party/aom/av1/common/seg_common.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'third_party/aom/av1/common/seg_common.h') diff --git a/third_party/aom/av1/common/seg_common.h b/third_party/aom/av1/common/seg_common.h index 69a63874a..8b199e64e 100644 --- a/third_party/aom/av1/common/seg_common.h +++ b/third_party/aom/av1/common/seg_common.h @@ -50,6 +50,9 @@ struct segmentation_probs { aom_prob tree_probs[SEG_TREE_PROBS]; aom_cdf_prob tree_cdf[CDF_SIZE(MAX_SEGMENTS)]; aom_prob pred_probs[PREDICTION_PROBS]; +#if CONFIG_NEW_MULTISYMBOL + aom_cdf_prob pred_cdf[PREDICTION_PROBS][CDF_SIZE(2)]; +#endif }; static INLINE int segfeature_active(const struct segmentation *seg, -- cgit v1.2.3 From ec910d81405c736a4490383a250299a7837c2e64 Mon Sep 17 00:00:00 2001 From: trav90 Date: Thu, 18 Oct 2018 21:53:44 -0500 Subject: Update aom to commit id e87fb2378f01103d5d6e477a4ef6892dc714e614 --- third_party/aom/av1/common/seg_common.h | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) (limited to 'third_party/aom/av1/common/seg_common.h') diff --git a/third_party/aom/av1/common/seg_common.h b/third_party/aom/av1/common/seg_common.h index 8b199e64e..6d16aedb6 100644 --- a/third_party/aom/av1/common/seg_common.h +++ b/third_party/aom/av1/common/seg_common.h @@ -26,14 +26,37 @@ extern "C" { #define PREDICTION_PROBS 3 +#if CONFIG_LOOPFILTER_LEVEL +typedef enum { + SEG_LVL_ALT_Q, // Use alternate Quantizer .... + SEG_LVL_ALT_LF_Y_V, // Use alternate loop filter value on y plane vertical + SEG_LVL_ALT_LF_Y_H, // Use alternate loop filter value on y plane horizontal + SEG_LVL_ALT_LF_U, // Use alternate loop filter value on u plane + SEG_LVL_ALT_LF_V, // Use alternate loop filter value on v plane + SEG_LVL_REF_FRAME, // Optional Segment reference frame + SEG_LVL_SKIP, // Optional Segment (0,0) + skip mode +#if CONFIG_SEGMENT_ZEROMV + SEG_LVL_ZEROMV, + SEG_LVL_MAX +#else + SEG_LVL_MAX +#endif +} SEG_LVL_FEATURES; +#else // CONFIG_LOOPFILTER_LEVEL // Segment level features. typedef enum { SEG_LVL_ALT_Q = 0, // Use alternate Quantizer .... SEG_LVL_ALT_LF = 1, // Use alternate loop filter value... SEG_LVL_REF_FRAME = 2, // Optional Segment reference frame - SEG_LVL_SKIP = 3, // Optional Segment (0,0) + skip mode - SEG_LVL_MAX = 4 // Number of features supported + SEG_LVL_SKIP = 3, // Optional Segment (0,0) + skip mode +#if CONFIG_SEGMENT_ZEROMV + SEG_LVL_ZEROMV = 4, + SEG_LVL_MAX = 5 +#else + SEG_LVL_MAX = 4 +#endif } SEG_LVL_FEATURES; +#endif // CONFIG_LOOPFILTER_LEVEL struct segmentation { uint8_t enabled; -- cgit v1.2.3 From bbcc64772580c8a979288791afa02d30bc476d2e Mon Sep 17 00:00:00 2001 From: trav90 Date: Fri, 19 Oct 2018 21:52:15 -0500 Subject: Update aom to v1.0.0 Update aom to commit id d14c5bb4f336ef1842046089849dee4a301fbbf0. --- third_party/aom/av1/common/seg_common.h | 60 +++++++++++++++------------------ 1 file changed, 27 insertions(+), 33 deletions(-) (limited to 'third_party/aom/av1/common/seg_common.h') diff --git a/third_party/aom/av1/common/seg_common.h b/third_party/aom/av1/common/seg_common.h index 6d16aedb6..c851d65fd 100644 --- a/third_party/aom/av1/common/seg_common.h +++ b/third_party/aom/av1/common/seg_common.h @@ -18,15 +18,12 @@ extern "C" { #endif -#define SEGMENT_DELTADATA 0 -#define SEGMENT_ABSDATA 1 - #define MAX_SEGMENTS 8 #define SEG_TREE_PROBS (MAX_SEGMENTS - 1) -#define PREDICTION_PROBS 3 +#define SEG_TEMPORAL_PRED_CTXS 3 +#define SPATIAL_PREDICTION_PROBS 3 -#if CONFIG_LOOPFILTER_LEVEL typedef enum { SEG_LVL_ALT_Q, // Use alternate Quantizer .... SEG_LVL_ALT_LF_Y_V, // Use alternate loop filter value on y plane vertical @@ -35,47 +32,31 @@ typedef enum { SEG_LVL_ALT_LF_V, // Use alternate loop filter value on v plane SEG_LVL_REF_FRAME, // Optional Segment reference frame SEG_LVL_SKIP, // Optional Segment (0,0) + skip mode -#if CONFIG_SEGMENT_ZEROMV - SEG_LVL_ZEROMV, - SEG_LVL_MAX -#else + SEG_LVL_GLOBALMV, SEG_LVL_MAX -#endif -} SEG_LVL_FEATURES; -#else // CONFIG_LOOPFILTER_LEVEL -// Segment level features. -typedef enum { - SEG_LVL_ALT_Q = 0, // Use alternate Quantizer .... - SEG_LVL_ALT_LF = 1, // Use alternate loop filter value... - SEG_LVL_REF_FRAME = 2, // Optional Segment reference frame - SEG_LVL_SKIP = 3, // Optional Segment (0,0) + skip mode -#if CONFIG_SEGMENT_ZEROMV - SEG_LVL_ZEROMV = 4, - SEG_LVL_MAX = 5 -#else - SEG_LVL_MAX = 4 -#endif } SEG_LVL_FEATURES; -#endif // CONFIG_LOOPFILTER_LEVEL struct segmentation { uint8_t enabled; uint8_t update_map; uint8_t update_data; - uint8_t abs_delta; uint8_t temporal_update; int16_t feature_data[MAX_SEGMENTS][SEG_LVL_MAX]; unsigned int feature_mask[MAX_SEGMENTS]; + int last_active_segid; // The highest numbered segment id that has some + // enabled feature. + uint8_t segid_preskip; // Whether the segment id will be read before the + // skip syntax element. + // 1: the segment id will be read first. + // 0: the skip syntax element will be read first. }; struct segmentation_probs { - aom_prob tree_probs[SEG_TREE_PROBS]; aom_cdf_prob tree_cdf[CDF_SIZE(MAX_SEGMENTS)]; - aom_prob pred_probs[PREDICTION_PROBS]; -#if CONFIG_NEW_MULTISYMBOL - aom_cdf_prob pred_cdf[PREDICTION_PROBS][CDF_SIZE(2)]; -#endif + aom_cdf_prob pred_cdf[SEG_TEMPORAL_PRED_CTXS][CDF_SIZE(2)]; + aom_cdf_prob spatial_pred_seg_cdf[SPATIAL_PREDICTION_PROBS] + [CDF_SIZE(MAX_SEGMENTS)]; }; static INLINE int segfeature_active(const struct segmentation *seg, @@ -84,11 +65,26 @@ static INLINE int segfeature_active(const struct segmentation *seg, return seg->enabled && (seg->feature_mask[segment_id] & (1 << feature_id)); } +static INLINE void segfeatures_copy(struct segmentation *dst, + const struct segmentation *src) { + int i, j; + for (i = 0; i < MAX_SEGMENTS; i++) { + dst->feature_mask[i] = src->feature_mask[i]; + for (j = 0; j < SEG_LVL_MAX; j++) { + dst->feature_data[i][j] = src->feature_data[i][j]; + } + } + dst->segid_preskip = src->segid_preskip; + dst->last_active_segid = src->last_active_segid; +} + void av1_clearall_segfeatures(struct segmentation *seg); void av1_enable_segfeature(struct segmentation *seg, int segment_id, SEG_LVL_FEATURES feature_id); +void calculate_segdata(struct segmentation *seg); + int av1_seg_feature_data_max(SEG_LVL_FEATURES feature_id); int av1_is_segfeature_signed(SEG_LVL_FEATURES feature_id); @@ -101,8 +97,6 @@ static INLINE int get_segdata(const struct segmentation *seg, int segment_id, return seg->feature_data[segment_id][feature_id]; } -extern const aom_tree_index av1_segment_tree[TREE_SIZE(MAX_SEGMENTS)]; - #ifdef __cplusplus } // extern "C" #endif -- cgit v1.2.3 From d2499ead93dc4298c0882fe98902acb1b5209f99 Mon Sep 17 00:00:00 2001 From: trav90 Date: Fri, 19 Oct 2018 23:05:00 -0500 Subject: Update libaom to commit ID 1e227d41f0616de9548a673a83a21ef990b62591 --- third_party/aom/av1/common/seg_common.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'third_party/aom/av1/common/seg_common.h') diff --git a/third_party/aom/av1/common/seg_common.h b/third_party/aom/av1/common/seg_common.h index c851d65fd..8c35bba86 100644 --- a/third_party/aom/av1/common/seg_common.h +++ b/third_party/aom/av1/common/seg_common.h @@ -9,8 +9,8 @@ * PATENTS file, you can obtain it at www.aomedia.org/license/patent. */ -#ifndef AV1_COMMON_SEG_COMMON_H_ -#define AV1_COMMON_SEG_COMMON_H_ +#ifndef AOM_AV1_COMMON_SEG_COMMON_H_ +#define AOM_AV1_COMMON_SEG_COMMON_H_ #include "aom_dsp/prob.h" @@ -101,4 +101,4 @@ static INLINE int get_segdata(const struct segmentation *seg, int segment_id, } // extern "C" #endif -#endif // AV1_COMMON_SEG_COMMON_H_ +#endif // AOM_AV1_COMMON_SEG_COMMON_H_ -- cgit v1.2.3