Signed-off-by: Mans Rullgard <mans@mansr.com>
filter_level += s->lf_delta.mode[mb->mode];
}
-/* Like av_clip for inputs 0 and max, where max is equal to (2^n-1) */
-#define POW2CLIP(x,max) (((x) & ~max) ? (-(x))>>31 & max : (x));
- filter_level = POW2CLIP(filter_level, 63);
+ filter_level = av_clip_uintp2(filter_level, 6);
interior_limit = filter_level;
if (s->filter.sharpness) {
else return a;
}
+/**
+ * Clip a signed integer to an unsigned power of two range.
+ * @param a value to clip
+ * @param p bit position to clip at
+ * @return clipped value
+ */
+static av_always_inline av_const unsigned av_clip_uintp2_c(int a, int p)
+{
+ if (a & ~((1<<p) - 1)) return -a >> 31 & ((1<<p) - 1);
+ else return a;
+}
+
/**
* Clip a float value into the amin-amax range.
* @param a value to clip
#ifndef av_clipl_int32
# define av_clipl_int32 av_clipl_int32_c
#endif
+#ifndef av_clip_uintp2
+# define av_clip_uintp2 av_clip_uintp2_c
+#endif
#ifndef av_clipf
# define av_clipf av_clipf_c
#endif