Revision 1550f45a

View differences:

libavcodec/vp8.c
1329 1329
        filter_level += s->lf_delta.mode[mb->mode];
1330 1330
    }
1331 1331

  
1332
/* Like av_clip for inputs 0 and max, where max is equal to (2^n-1) */
1333
#define POW2CLIP(x,max) (((x) & ~max) ? (-(x))>>31 & max : (x));
1334
    filter_level = POW2CLIP(filter_level, 63);
1332
    filter_level = av_clip_uintp2(filter_level, 6);
1335 1333

  
1336 1334
    interior_limit = filter_level;
1337 1335
    if (s->filter.sharpness) {
libavutil/common.h
170 170
}
171 171

  
172 172
/**
173
 * Clip a signed integer to an unsigned power of two range.
174
 * @param  a value to clip
175
 * @param  p bit position to clip at
176
 * @return clipped value
177
 */
178
static av_always_inline av_const unsigned av_clip_uintp2_c(int a, int p)
179
{
180
    if (a & ~((1<<p) - 1)) return -a >> 31 & ((1<<p) - 1);
181
    else                   return  a;
182
}
183

  
184
/**
173 185
 * Clip a float value into the amin-amax range.
174 186
 * @param a value to clip
175 187
 * @param amin minimum value of the clip range
......
362 374
#ifndef av_clipl_int32
363 375
#   define av_clipl_int32   av_clipl_int32_c
364 376
#endif
377
#ifndef av_clip_uintp2
378
#   define av_clip_uintp2   av_clip_uintp2_c
379
#endif
365 380
#ifndef av_clipf
366 381
#   define av_clipf         av_clipf_c
367 382
#endif

Also available in: Unified diff