Statistics
| Branch: | Revision:

ffmpeg / libavcodec / h264_high_depth.h @ 8dbe5856

History | View | Annotate | Download (2.06 KB)

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_WN2P
18
#   undef AV_WN4P
19
#   undef AV_WN4PA
20
#   undef CLIP
21
#   undef FUNC
22
#   undef FUNCC
23
#   undef av_clip_pixel
24
#   undef PIXEL_SPLAT_X4
25
#else
26
#   define AVCODEC_H264_HIGH_DEPTH_H
27
#   define CLIP_PIXEL(depth)\
28
    static inline uint16_t av_clip_pixel_ ## depth (int p)\
29
    {\
30
        const int pixel_max = (1 << depth)-1;\
31
        return (p & ~pixel_max) ? (-p)>>31 & pixel_max : p;\
32
    }
33

    
34
CLIP_PIXEL( 9)
35
CLIP_PIXEL(10)
36
#endif
37

    
38
#if BIT_DEPTH > 8
39
#   define pixel  uint16_t
40
#   define pixel2 uint32_t
41
#   define pixel4 uint64_t
42
#   define dctcoef int32_t
43

    
44
#   define INIT_CLIP
45
#   define no_rnd_avg_pixel4 no_rnd_avg64
46
#   define    rnd_avg_pixel4    rnd_avg64
47
#   define AV_RN2P  AV_RN32
48
#   define AV_RN4P  AV_RN64
49
#   define AV_WN2P  AV_WN32
50
#   define AV_WN4P  AV_WN64
51
#   define AV_WN4PA AV_WN64A
52
#   define PIXEL_SPLAT_X4(x) ((x)*0x0001000100010001ULL)
53
#else
54
#   define pixel  uint8_t
55
#   define pixel2 uint16_t
56
#   define pixel4 uint32_t
57
#   define dctcoef int16_t
58

    
59
#   define INIT_CLIP uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
60
#   define no_rnd_avg_pixel4 no_rnd_avg32
61
#   define    rnd_avg_pixel4    rnd_avg32
62
#   define AV_RN2P  AV_RN16
63
#   define AV_RN4P  AV_RN32
64
#   define AV_WN2P  AV_WN16
65
#   define AV_WN4P  AV_WN32
66
#   define AV_WN4PA AV_WN32A
67
#   define PIXEL_SPLAT_X4(x) ((x)*0x01010101U)
68
#endif
69

    
70
#if BIT_DEPTH == 8
71
#   define av_clip_pixel(a) av_clip_uint8(a)
72
#   define CLIP(a) cm[a]
73
#   define FUNC(a)  a ## _8
74
#   define FUNCC(a) a ## _8_c
75
#elif BIT_DEPTH == 9
76
#   define av_clip_pixel(a) av_clip_pixel_9(a)
77
#   define CLIP(a)          av_clip_pixel_9(a)
78
#   define FUNC(a)  a ## _9
79
#   define FUNCC(a) a ## _9_c
80
#elif BIT_DEPTH == 10
81
#   define av_clip_pixel(a) av_clip_pixel_10(a)
82
#   define CLIP(a)          av_clip_pixel_10(a)
83
#   define FUNC(a)  a ## _10
84
#   define FUNCC(a) a ## _10_c
85
#endif
86