]> git.sesse.net Git - ffmpeg/blob - libavcodec/high_bit_depth.h
psymodel: Remove the single channel analysis function
[ffmpeg] / libavcodec / high_bit_depth.h
1 #include "dsputil.h"
2
3 #ifndef BIT_DEPTH
4 #define BIT_DEPTH 8
5 #endif
6
7 #ifdef AVCODEC_H264_HIGH_DEPTH_H
8 #   undef pixel
9 #   undef pixel2
10 #   undef pixel4
11 #   undef dctcoef
12 #   undef INIT_CLIP
13 #   undef no_rnd_avg_pixel4
14 #   undef rnd_avg_pixel4
15 #   undef AV_RN2P
16 #   undef AV_RN4P
17 #   undef AV_RN4PA
18 #   undef AV_WN2P
19 #   undef AV_WN4P
20 #   undef AV_WN4PA
21 #   undef CLIP
22 #   undef FUNC
23 #   undef FUNCC
24 #   undef av_clip_pixel
25 #   undef PIXEL_SPLAT_X4
26 #else
27 #   define AVCODEC_H264_HIGH_DEPTH_H
28 #   define CLIP_PIXEL(depth)\
29     static inline uint16_t av_clip_pixel_ ## depth (int p)\
30     {\
31         const int pixel_max = (1 << depth)-1;\
32         return (p & ~pixel_max) ? (-p)>>31 & pixel_max : p;\
33     }
34
35 CLIP_PIXEL( 9)
36 CLIP_PIXEL(10)
37 #endif
38
39 #if BIT_DEPTH > 8
40 #   define pixel  uint16_t
41 #   define pixel2 uint32_t
42 #   define pixel4 uint64_t
43 #   define dctcoef int32_t
44
45 #   define INIT_CLIP
46 #   define no_rnd_avg_pixel4 no_rnd_avg64
47 #   define    rnd_avg_pixel4    rnd_avg64
48 #   define AV_RN2P  AV_RN32
49 #   define AV_RN4P  AV_RN64
50 #   define AV_RN4PA AV_RN64A
51 #   define AV_WN2P  AV_WN32
52 #   define AV_WN4P  AV_WN64
53 #   define AV_WN4PA AV_WN64A
54 #   define PIXEL_SPLAT_X4(x) ((x)*0x0001000100010001ULL)
55 #else
56 #   define pixel  uint8_t
57 #   define pixel2 uint16_t
58 #   define pixel4 uint32_t
59 #   define dctcoef int16_t
60
61 #   define INIT_CLIP uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
62 #   define no_rnd_avg_pixel4 no_rnd_avg32
63 #   define    rnd_avg_pixel4    rnd_avg32
64 #   define AV_RN2P  AV_RN16
65 #   define AV_RN4P  AV_RN32
66 #   define AV_RN4PA AV_RN32A
67 #   define AV_WN2P  AV_WN16
68 #   define AV_WN4P  AV_WN32
69 #   define AV_WN4PA AV_WN32A
70 #   define PIXEL_SPLAT_X4(x) ((x)*0x01010101U)
71 #endif
72
73 #if BIT_DEPTH == 8
74 #   define av_clip_pixel(a) av_clip_uint8(a)
75 #   define CLIP(a) cm[a]
76 #   define FUNC(a)  a ## _8
77 #   define FUNCC(a) a ## _8_c
78 #elif BIT_DEPTH == 9
79 #   define av_clip_pixel(a) av_clip_pixel_9(a)
80 #   define CLIP(a)          av_clip_pixel_9(a)
81 #   define FUNC(a)  a ## _9
82 #   define FUNCC(a) a ## _9_c
83 #elif BIT_DEPTH == 10
84 #   define av_clip_pixel(a) av_clip_pixel_10(a)
85 #   define CLIP(a)          av_clip_pixel_10(a)
86 #   define FUNC(a)  a ## _10
87 #   define FUNCC(a) a ## _10_c
88 #endif