9/10-bit: simplify clipping macros
Signed-off-by: Mans Rullgard <mans@mansr.com>
This commit is contained in:
parent
f47ac3c6ca
commit
0f6fc8660e
@ -43,15 +43,6 @@
|
|||||||
# undef PIXEL_SPLAT_X4
|
# undef PIXEL_SPLAT_X4
|
||||||
#else
|
#else
|
||||||
# define AVCODEC_H264_HIGH_DEPTH_H
|
# define AVCODEC_H264_HIGH_DEPTH_H
|
||||||
# define CLIP_PIXEL(depth)\
|
|
||||||
static inline uint16_t av_clip_pixel_ ## depth (int p)\
|
|
||||||
{\
|
|
||||||
const int pixel_max = (1 << depth)-1;\
|
|
||||||
return (p & ~pixel_max) ? (-p)>>31 & pixel_max : p;\
|
|
||||||
}
|
|
||||||
|
|
||||||
CLIP_PIXEL( 9)
|
|
||||||
CLIP_PIXEL(10)
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if BIT_DEPTH > 8
|
#if BIT_DEPTH > 8
|
||||||
@ -70,6 +61,9 @@ CLIP_PIXEL(10)
|
|||||||
# define AV_WN4P AV_WN64
|
# define AV_WN4P AV_WN64
|
||||||
# define AV_WN4PA AV_WN64A
|
# define AV_WN4PA AV_WN64A
|
||||||
# define PIXEL_SPLAT_X4(x) ((x)*0x0001000100010001ULL)
|
# define PIXEL_SPLAT_X4(x) ((x)*0x0001000100010001ULL)
|
||||||
|
|
||||||
|
# define av_clip_pixel(a) av_clip_uintp2(a, BIT_DEPTH)
|
||||||
|
# define CLIP(a) av_clip_uintp2(a, BIT_DEPTH)
|
||||||
#else
|
#else
|
||||||
# define pixel uint8_t
|
# define pixel uint8_t
|
||||||
# define pixel2 uint16_t
|
# define pixel2 uint16_t
|
||||||
@ -86,21 +80,18 @@ CLIP_PIXEL(10)
|
|||||||
# define AV_WN4P AV_WN32
|
# define AV_WN4P AV_WN32
|
||||||
# define AV_WN4PA AV_WN32A
|
# define AV_WN4PA AV_WN32A
|
||||||
# define PIXEL_SPLAT_X4(x) ((x)*0x01010101U)
|
# define PIXEL_SPLAT_X4(x) ((x)*0x01010101U)
|
||||||
|
|
||||||
|
# define av_clip_pixel(a) av_clip_uint8(a)
|
||||||
|
# define CLIP(a) cm[a]
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if BIT_DEPTH == 8
|
#if BIT_DEPTH == 8
|
||||||
# define av_clip_pixel(a) av_clip_uint8(a)
|
|
||||||
# define CLIP(a) cm[a]
|
|
||||||
# define FUNC(a) a ## _8
|
# define FUNC(a) a ## _8
|
||||||
# define FUNCC(a) a ## _8_c
|
# define FUNCC(a) a ## _8_c
|
||||||
#elif BIT_DEPTH == 9
|
#elif BIT_DEPTH == 9
|
||||||
# define av_clip_pixel(a) av_clip_pixel_9(a)
|
|
||||||
# define CLIP(a) av_clip_pixel_9(a)
|
|
||||||
# define FUNC(a) a ## _9
|
# define FUNC(a) a ## _9
|
||||||
# define FUNCC(a) a ## _9_c
|
# define FUNCC(a) a ## _9_c
|
||||||
#elif BIT_DEPTH == 10
|
#elif BIT_DEPTH == 10
|
||||||
# define av_clip_pixel(a) av_clip_pixel_10(a)
|
|
||||||
# define CLIP(a) av_clip_pixel_10(a)
|
|
||||||
# define FUNC(a) a ## _10
|
# define FUNC(a) a ## _10
|
||||||
# define FUNCC(a) a ## _10_c
|
# define FUNCC(a) a ## _10_c
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user