From 05e850cb9e75b96c0a4f656c9dbcbe4bb761e52c Mon Sep 17 00:00:00 2001
From: Yaowu Xu <yaowu@google.com>
Date: Sat, 22 Feb 2014 12:41:06 -0800
Subject: [PATCH] added clamp of segment loop filter level

for ABSDATA mode, so segment loop filter level always fall in valid
range for both Absolute and delta modes.

Change-Id: If90df3411479533dbdab63f8ae088d2f5dd174a9
---
 vp9/common/vp9_loopfilter.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/vp9/common/vp9_loopfilter.c b/vp9/common/vp9_loopfilter.c
index fe2056d14e..868a66ae42 100644
--- a/vp9/common/vp9_loopfilter.c
+++ b/vp9/common/vp9_loopfilter.c
@@ -262,9 +262,9 @@ void vp9_loop_filter_frame_init(VP9_COMMON *cm, int default_filt_lvl) {
     int lvl_seg = default_filt_lvl;
     if (vp9_segfeature_active(seg, seg_id, SEG_LVL_ALT_LF)) {
       const int data = vp9_get_segdata(seg, seg_id, SEG_LVL_ALT_LF);
-      lvl_seg = seg->abs_delta == SEGMENT_ABSDATA
-                  ? data
-                  : clamp(default_filt_lvl + data, 0, MAX_LOOP_FILTER);
+      lvl_seg = clamp(seg->abs_delta == SEGMENT_ABSDATA ?
+                      data : default_filt_lvl + data,
+                      0, MAX_LOOP_FILTER);
     }
 
     if (!lf->mode_ref_delta_enabled) {
-- 
GitLab