comparison dsputil.c @ 2448:bfa9192a22ce libavcodec

use clip_uint8()
author michael
date Sun, 23 Jan 2005 11:08:18 +0000
parents db2cf6005d19
children e25782262d7d
comparison
equal deleted inserted replaced
2447:0237bb5ca0f0 2448:bfa9192a22ce
2372 #undef op_put 2372 #undef op_put
2373 #undef op2_avg 2373 #undef op2_avg
2374 #undef op2_put 2374 #undef op2_put
2375 #endif 2375 #endif
2376 2376
2377 static inline uint8_t clip1(int x){ 2377 #define op_scale1(x) block[x] = clip_uint8( (block[x]*weight + offset) >> log2_denom )
2378 if(x > 255) return 255; 2378 #define op_scale2(x) dst[x] = clip_uint8( (src[x]*weights + dst[x]*weightd + offset) >> (log2_denom+1))
2379 if(x < 0) return 0;
2380 return x;
2381 }
2382 #define op_scale1(x) block[x] = clip1( (block[x]*weight + offset) >> log2_denom )
2383 #define op_scale2(x) dst[x] = clip( (src[x]*weights + dst[x]*weightd + offset) >> (log2_denom+1), 0, 255 )
2384 #define H264_WEIGHT(W,H) \ 2379 #define H264_WEIGHT(W,H) \
2385 static void weight_h264_pixels ## W ## x ## H ## _c(uint8_t *block, int stride, int log2_denom, int weight, int offset){ \ 2380 static void weight_h264_pixels ## W ## x ## H ## _c(uint8_t *block, int stride, int log2_denom, int weight, int offset){ \
2386 int x, y; \ 2381 int x, y; \
2387 offset <<= log2_denom; \ 2382 offset <<= log2_denom; \
2388 if(log2_denom) offset += 1<<(log2_denom-1); \ 2383 if(log2_denom) offset += 1<<(log2_denom-1); \