Revision 8dbe5856

View differences:

libavcodec/alpha/dsputil_alpha.c
270 270

  
271 271
void dsputil_init_alpha(DSPContext* c, AVCodecContext *avctx)
272 272
{
273
    const int h264_high_depth = avctx->codec_id == CODEC_ID_H264 && avctx->bits_per_raw_sample > 8;
274

  
275
    if (!h264_high_depth) {
273 276
    c->put_pixels_tab[0][0] = put_pixels16_axp_asm;
274 277
    c->put_pixels_tab[0][1] = put_pixels16_x2_axp;
275 278
    c->put_pixels_tab[0][2] = put_pixels16_y2_axp;
......
311 314
    c->avg_no_rnd_pixels_tab[1][3] = avg_no_rnd_pixels_xy2_axp;
312 315

  
313 316
    c->clear_blocks = clear_blocks_axp;
317
    }
314 318

  
315 319
    /* amask clears all bits that correspond to present features.  */
316 320
    if (amask(AMASK_MVI) == 0) {
libavcodec/arm/dsputil_init_arm.c
75 75

  
76 76
void dsputil_init_arm(DSPContext* c, AVCodecContext *avctx)
77 77
{
78
    const int h264_high_depth = avctx->codec_id == CODEC_ID_H264 && avctx->bits_per_raw_sample > 8;
79

  
78 80
    ff_put_pixels_clamped = c->put_pixels_clamped;
79 81
    ff_add_pixels_clamped = c->add_pixels_clamped;
80 82

  
......
95 97

  
96 98
    c->add_pixels_clamped = ff_add_pixels_clamped_arm;
97 99

  
100
    if (!h264_high_depth) {
98 101
    c->put_pixels_tab[0][0] = ff_put_pixels16_arm;
99 102
    c->put_pixels_tab[0][1] = ff_put_pixels16_x2_arm;
100 103
    c->put_pixels_tab[0][2] = ff_put_pixels16_y2_arm;
......
112 115
    c->put_no_rnd_pixels_tab[1][1] = ff_put_no_rnd_pixels8_x2_arm;
113 116
    c->put_no_rnd_pixels_tab[1][2] = ff_put_no_rnd_pixels8_y2_arm;
114 117
    c->put_no_rnd_pixels_tab[1][3] = ff_put_no_rnd_pixels8_xy2_arm;
118
    }
115 119

  
116 120
    if (HAVE_ARMV5TE) ff_dsputil_init_armv5te(c, avctx);
117 121
    if (HAVE_ARMV6)   ff_dsputil_init_armv6(c, avctx);
libavcodec/arm/dsputil_init_armv6.c
72 72

  
73 73
void av_cold ff_dsputil_init_armv6(DSPContext* c, AVCodecContext *avctx)
74 74
{
75
    const int h264_high_depth = avctx->codec_id == CODEC_ID_H264 && avctx->bits_per_raw_sample > 8;
76

  
75 77
    if (!avctx->lowres && (avctx->idct_algo == FF_IDCT_AUTO ||
76 78
                           avctx->idct_algo == FF_IDCT_SIMPLEARMV6)) {
77 79
        c->idct_put              = ff_simple_idct_put_armv6;
......
80 82
        c->idct_permutation_type = FF_LIBMPEG2_IDCT_PERM;
81 83
    }
82 84

  
85
    if (!h264_high_depth) {
83 86
    c->put_pixels_tab[0][0] = ff_put_pixels16_armv6;
84 87
    c->put_pixels_tab[0][1] = ff_put_pixels16_x2_armv6;
85 88
    c->put_pixels_tab[0][2] = ff_put_pixels16_y2_armv6;
......
100 103

  
101 104
    c->avg_pixels_tab[0][0] = ff_avg_pixels16_armv6;
102 105
    c->avg_pixels_tab[1][0] = ff_avg_pixels8_armv6;
106
    }
103 107

  
104 108
    c->add_pixels_clamped = ff_add_pixels_clamped_armv6;
105 109
    c->get_pixels = ff_get_pixels_armv6;
libavcodec/arm/dsputil_init_neon.c
173 173

  
174 174
void ff_dsputil_init_neon(DSPContext *c, AVCodecContext *avctx)
175 175
{
176
    const int h264_high_depth = avctx->codec_id == CODEC_ID_H264 && avctx->bits_per_raw_sample > 8;
177

  
176 178
    if (!avctx->lowres) {
177 179
        if (avctx->idct_algo == FF_IDCT_AUTO ||
178 180
            avctx->idct_algo == FF_IDCT_SIMPLENEON) {
......
190 192
        }
191 193
    }
192 194

  
195
    if (!h264_high_depth) {
193 196
    c->clear_block  = ff_clear_block_neon;
194 197
    c->clear_blocks = ff_clear_blocks_neon;
195 198

  
......
213 216

  
214 217
    c->avg_pixels_tab[0][0] = ff_avg_pixels16_neon;
215 218
    c->avg_pixels_tab[1][0] = ff_avg_pixels8_neon;
219
    }
216 220

  
217 221
    c->add_pixels_clamped = ff_add_pixels_clamped_neon;
218 222
    c->put_pixels_clamped = ff_put_pixels_clamped_neon;
219 223
    c->put_signed_pixels_clamped = ff_put_signed_pixels_clamped_neon;
220 224

  
221 225
    if (CONFIG_H264_DECODER) {
226
        if (!h264_high_depth) {
222 227
        c->put_h264_chroma_pixels_tab[0] = ff_put_h264_chroma_mc8_neon;
223 228
        c->put_h264_chroma_pixels_tab[1] = ff_put_h264_chroma_mc4_neon;
224 229
        c->put_h264_chroma_pixels_tab[2] = ff_put_h264_chroma_mc2_neon;
......
294 299
        c->avg_h264_qpel_pixels_tab[1][13] = ff_avg_h264_qpel8_mc13_neon;
295 300
        c->avg_h264_qpel_pixels_tab[1][14] = ff_avg_h264_qpel8_mc23_neon;
296 301
        c->avg_h264_qpel_pixels_tab[1][15] = ff_avg_h264_qpel8_mc33_neon;
302
        }
297 303
    }
298 304

  
299 305
    if (CONFIG_VP3_DECODER) {
libavcodec/arm/dsputil_iwmmxt.c
155 155
void ff_dsputil_init_iwmmxt(DSPContext* c, AVCodecContext *avctx)
156 156
{
157 157
    int mm_flags = AV_CPU_FLAG_IWMMXT; /* multimedia extension flags */
158
    const int h264_high_depth = avctx->codec_id == CODEC_ID_H264 && avctx->bits_per_raw_sample > 8;
158 159

  
159 160
    if (avctx->dsp_mask) {
160 161
        if (avctx->dsp_mask & AV_CPU_FLAG_FORCE)
......
167 168

  
168 169
    c->add_pixels_clamped = add_pixels_clamped_iwmmxt;
169 170

  
171
    if (!h264_high_depth) {
170 172
    c->clear_blocks = clear_blocks_iwmmxt;
171 173

  
172 174
    c->put_pixels_tab[0][0] = put_pixels16_iwmmxt;
......
204 206
    c->avg_no_rnd_pixels_tab[1][1] = avg_no_rnd_pixels8_x2_iwmmxt;
205 207
    c->avg_no_rnd_pixels_tab[1][2] = avg_no_rnd_pixels8_y2_iwmmxt;
206 208
    c->avg_no_rnd_pixels_tab[1][3] = avg_no_rnd_pixels8_xy2_iwmmxt;
209
    }
207 210
}
libavcodec/arm/h264dsp_init_arm.c
92 92
                             DCTELEM *block, int stride,
93 93
                             const uint8_t nnzc[6*8]);
94 94

  
95
static void ff_h264dsp_init_neon(H264DSPContext *c)
95
static void ff_h264dsp_init_neon(H264DSPContext *c, const int bit_depth)
96 96
{
97
    if (bit_depth == 8) {
97 98
    c->h264_v_loop_filter_luma   = ff_h264_v_loop_filter_luma_neon;
98 99
    c->h264_h_loop_filter_luma   = ff_h264_h_loop_filter_luma_neon;
99 100
    c->h264_v_loop_filter_chroma = ff_h264_v_loop_filter_chroma_neon;
......
125 126
    c->h264_idct8_add       = ff_h264_idct8_add_neon;
126 127
    c->h264_idct8_dc_add    = ff_h264_idct8_dc_add_neon;
127 128
    c->h264_idct8_add4      = ff_h264_idct8_add4_neon;
129
    }
128 130
}
129 131

  
130
void ff_h264dsp_init_arm(H264DSPContext *c)
132
void ff_h264dsp_init_arm(H264DSPContext *c, const int bit_depth)
131 133
{
132
    if (HAVE_NEON) ff_h264dsp_init_neon(c);
134
    if (HAVE_NEON) ff_h264dsp_init_neon(c, bit_depth);
133 135
}
libavcodec/arm/h264pred_init_arm.c
42 42
void ff_pred8x8_l00_dc_neon(uint8_t *src, int stride);
43 43
void ff_pred8x8_0l0_dc_neon(uint8_t *src, int stride);
44 44

  
45
static void ff_h264_pred_init_neon(H264PredContext *h, int codec_id)
45
static void ff_h264_pred_init_neon(H264PredContext *h, int codec_id, const int bit_depth)
46 46
{
47
    const int high_depth = bit_depth > 8;
48

  
49
    if (high_depth)
50
        return;
51

  
47 52
    h->pred8x8[VERT_PRED8x8     ] = ff_pred8x8_vert_neon;
48 53
    h->pred8x8[HOR_PRED8x8      ] = ff_pred8x8_hor_neon;
49 54
    if (codec_id != CODEC_ID_VP8)
......
69 74
        h->pred16x16[PLANE_PRED8x8  ] = ff_pred16x16_plane_neon;
70 75
}
71 76

  
72
void ff_h264_pred_init_arm(H264PredContext *h, int codec_id)
77
void ff_h264_pred_init_arm(H264PredContext *h, int codec_id, bit_depth)
73 78
{
74
    if (HAVE_NEON)    ff_h264_pred_init_neon(h, codec_id);
79
    if (HAVE_NEON)    ff_h264_pred_init_neon(h, codec_id, bit_depth);
75 80
}
libavcodec/bfin/dsputil_bfin.c
197 197

  
198 198
void dsputil_init_bfin( DSPContext* c, AVCodecContext *avctx )
199 199
{
200
    const int h264_high_depth = avctx->codec_id == CODEC_ID_H264 && avctx->bits_per_raw_sample > 8;
201

  
200 202
    c->get_pixels         = ff_bfin_get_pixels;
201 203
    c->diff_pixels        = ff_bfin_diff_pixels;
202 204
    c->put_pixels_clamped = ff_bfin_put_pixels_clamped;
203 205
    c->add_pixels_clamped = ff_bfin_add_pixels_clamped;
204 206

  
207
    if (!h264_high_depth)
205 208
    c->clear_blocks       = bfin_clear_blocks;
206 209
    c->pix_sum            = ff_bfin_pix_sum;
207 210
    c->pix_norm1          = ff_bfin_pix_norm1;
......
228 231
    c->sse[1] = ff_bfin_sse8;
229 232
    c->sse[2] = ff_bfin_sse4;
230 233

  
234
    if (!h264_high_depth) {
231 235
    c->put_pixels_tab[0][0] = bfin_put_pixels16;
232 236
    c->put_pixels_tab[0][1] = bfin_put_pixels16_x2;
233 237
    c->put_pixels_tab[0][2] = bfin_put_pixels16_y2;
......
247 251
    c->put_no_rnd_pixels_tab[0][1] = bfin_put_pixels16_x2_nornd;
248 252
    c->put_no_rnd_pixels_tab[0][2] = bfin_put_pixels16_y2_nornd;
249 253
/*     c->put_no_rnd_pixels_tab[0][3] = ff_bfin_put_pixels16_xy2_nornd; */
254
    }
250 255

  
251 256
    if (avctx->dct_algo == FF_DCT_AUTO)
252 257
        c->fdct               = ff_bfin_fdct;
libavcodec/dsputil.c
43 43
uint8_t ff_cropTbl[256 + 2 * MAX_NEG_CROP] = {0, };
44 44
uint32_t ff_squareTbl[512] = {0, };
45 45

  
46
#define BIT_DEPTH 9
47
#include "dsputil_internal.h"
48
#undef BIT_DEPTH
49

  
50
#define BIT_DEPTH 10
51
#include "dsputil_internal.h"
52
#undef BIT_DEPTH
53

  
54
#define BIT_DEPTH 8
46 55
#include "dsputil_internal.h"
47 56

  
48 57
// 0x7f7f7f7f or 0x7f7f7f7f7f7f7f7f or whatever, depending on the cpu's native arithmetic size
......
619 628

  
620 629
static inline void put_tpel_pixels_mc00_c(uint8_t *dst, const uint8_t *src, int stride, int width, int height){
621 630
    switch(width){
622
    case 2: put_pixels2_c (dst, src, stride, height); break;
623
    case 4: put_pixels4_c (dst, src, stride, height); break;
624
    case 8: put_pixels8_c (dst, src, stride, height); break;
625
    case 16:put_pixels16_c(dst, src, stride, height); break;
631
    case 2: put_pixels2_8_c (dst, src, stride, height); break;
632
    case 4: put_pixels4_8_c (dst, src, stride, height); break;
633
    case 8: put_pixels8_8_c (dst, src, stride, height); break;
634
    case 16:put_pixels16_8_c(dst, src, stride, height); break;
626 635
    }
627 636
}
628 637

  
......
716 725

  
717 726
static inline void avg_tpel_pixels_mc00_c(uint8_t *dst, const uint8_t *src, int stride, int width, int height){
718 727
    switch(width){
719
    case 2: avg_pixels2_c (dst, src, stride, height); break;
720
    case 4: avg_pixels4_c (dst, src, stride, height); break;
721
    case 8: avg_pixels8_c (dst, src, stride, height); break;
722
    case 16:avg_pixels16_c(dst, src, stride, height); break;
728
    case 2: avg_pixels2_8_c (dst, src, stride, height); break;
729
    case 4: avg_pixels4_8_c (dst, src, stride, height); break;
730
    case 8: avg_pixels8_8_c (dst, src, stride, height); break;
731
    case 16:avg_pixels16_8_c(dst, src, stride, height); break;
723 732
    }
724 733
}
725 734

  
......
953 962
static void OPNAME ## qpel8_mc10_c(uint8_t *dst, uint8_t *src, int stride){\
954 963
    uint8_t half[64];\
955 964
    put ## RND ## mpeg4_qpel8_h_lowpass(half, src, 8, stride, 8);\
956
    OPNAME ## pixels8_l2(dst, src, half, stride, stride, 8, 8);\
965
    OPNAME ## pixels8_l2_8(dst, src, half, stride, stride, 8, 8);\
957 966
}\
958 967
\
959 968
static void OPNAME ## qpel8_mc20_c(uint8_t *dst, uint8_t *src, int stride){\
......
963 972
static void OPNAME ## qpel8_mc30_c(uint8_t *dst, uint8_t *src, int stride){\
964 973
    uint8_t half[64];\
965 974
    put ## RND ## mpeg4_qpel8_h_lowpass(half, src, 8, stride, 8);\
966
    OPNAME ## pixels8_l2(dst, src+1, half, stride, stride, 8, 8);\
975
    OPNAME ## pixels8_l2_8(dst, src+1, half, stride, stride, 8, 8);\
967 976
}\
968 977
\
969 978
static void OPNAME ## qpel8_mc01_c(uint8_t *dst, uint8_t *src, int stride){\
......
971 980
    uint8_t half[64];\
972 981
    copy_block9(full, src, 16, stride, 9);\
973 982
    put ## RND ## mpeg4_qpel8_v_lowpass(half, full, 8, 16);\
974
    OPNAME ## pixels8_l2(dst, full, half, stride, 16, 8, 8);\
983
    OPNAME ## pixels8_l2_8(dst, full, half, stride, 16, 8, 8);\
975 984
}\
976 985
\
977 986
static void OPNAME ## qpel8_mc02_c(uint8_t *dst, uint8_t *src, int stride){\
......
985 994
    uint8_t half[64];\
986 995
    copy_block9(full, src, 16, stride, 9);\
987 996
    put ## RND ## mpeg4_qpel8_v_lowpass(half, full, 8, 16);\
988
    OPNAME ## pixels8_l2(dst, full+16, half, stride, 16, 8, 8);\
997
    OPNAME ## pixels8_l2_8(dst, full+16, half, stride, 16, 8, 8);\
989 998
}\
990 999
void ff_ ## OPNAME ## qpel8_mc11_old_c(uint8_t *dst, uint8_t *src, int stride){\
991 1000
    uint8_t full[16*9];\
......
996 1005
    put ## RND ## mpeg4_qpel8_h_lowpass(halfH, full, 8, 16, 9);\
997 1006
    put ## RND ## mpeg4_qpel8_v_lowpass(halfV, full, 8, 16);\
998 1007
    put ## RND ## mpeg4_qpel8_v_lowpass(halfHV, halfH, 8, 8);\
999
    OPNAME ## pixels8_l4(dst, full, halfH, halfV, halfHV, stride, 16, 8, 8, 8, 8);\
1008
    OPNAME ## pixels8_l4_8(dst, full, halfH, halfV, halfHV, stride, 16, 8, 8, 8, 8);\
1000 1009
}\
1001 1010
static void OPNAME ## qpel8_mc11_c(uint8_t *dst, uint8_t *src, int stride){\
1002 1011
    uint8_t full[16*9];\
......
1004 1013
    uint8_t halfHV[64];\
1005 1014
    copy_block9(full, src, 16, stride, 9);\
1006 1015
    put ## RND ## mpeg4_qpel8_h_lowpass(halfH, full, 8, 16, 9);\
1007
    put ## RND ## pixels8_l2(halfH, halfH, full, 8, 8, 16, 9);\
1016
    put ## RND ## pixels8_l2_8(halfH, halfH, full, 8, 8, 16, 9);\
1008 1017
    put ## RND ## mpeg4_qpel8_v_lowpass(halfHV, halfH, 8, 8);\
1009
    OPNAME ## pixels8_l2(dst, halfH, halfHV, stride, 8, 8, 8);\
1018
    OPNAME ## pixels8_l2_8(dst, halfH, halfHV, stride, 8, 8, 8);\
1010 1019
}\
1011 1020
void ff_ ## OPNAME ## qpel8_mc31_old_c(uint8_t *dst, uint8_t *src, int stride){\
1012 1021
    uint8_t full[16*9];\
......
1017 1026
    put ## RND ## mpeg4_qpel8_h_lowpass(halfH, full, 8, 16, 9);\
1018 1027
    put ## RND ## mpeg4_qpel8_v_lowpass(halfV, full+1, 8, 16);\
1019 1028
    put ## RND ## mpeg4_qpel8_v_lowpass(halfHV, halfH, 8, 8);\
1020
    OPNAME ## pixels8_l4(dst, full+1, halfH, halfV, halfHV, stride, 16, 8, 8, 8, 8);\
1029
    OPNAME ## pixels8_l4_8(dst, full+1, halfH, halfV, halfHV, stride, 16, 8, 8, 8, 8);\
1021 1030
}\
1022 1031
static void OPNAME ## qpel8_mc31_c(uint8_t *dst, uint8_t *src, int stride){\
1023 1032
    uint8_t full[16*9];\
......
1025 1034
    uint8_t halfHV[64];\
1026 1035
    copy_block9(full, src, 16, stride, 9);\
1027 1036
    put ## RND ## mpeg4_qpel8_h_lowpass(halfH, full, 8, 16, 9);\
1028
    put ## RND ## pixels8_l2(halfH, halfH, full+1, 8, 8, 16, 9);\
1037
    put ## RND ## pixels8_l2_8(halfH, halfH, full+1, 8, 8, 16, 9);\
1029 1038
    put ## RND ## mpeg4_qpel8_v_lowpass(halfHV, halfH, 8, 8);\
1030
    OPNAME ## pixels8_l2(dst, halfH, halfHV, stride, 8, 8, 8);\
1039
    OPNAME ## pixels8_l2_8(dst, halfH, halfHV, stride, 8, 8, 8);\
1031 1040
}\
1032 1041
void ff_ ## OPNAME ## qpel8_mc13_old_c(uint8_t *dst, uint8_t *src, int stride){\
1033 1042
    uint8_t full[16*9];\
......
1038 1047
    put ## RND ## mpeg4_qpel8_h_lowpass(halfH, full, 8, 16, 9);\
1039 1048
    put ## RND ## mpeg4_qpel8_v_lowpass(halfV, full, 8, 16);\
1040 1049
    put ## RND ## mpeg4_qpel8_v_lowpass(halfHV, halfH, 8, 8);\
1041
    OPNAME ## pixels8_l4(dst, full+16, halfH+8, halfV, halfHV, stride, 16, 8, 8, 8, 8);\
1050
    OPNAME ## pixels8_l4_8(dst, full+16, halfH+8, halfV, halfHV, stride, 16, 8, 8, 8, 8);\
1042 1051
}\
1043 1052
static void OPNAME ## qpel8_mc13_c(uint8_t *dst, uint8_t *src, int stride){\
1044 1053
    uint8_t full[16*9];\
......
1046 1055
    uint8_t halfHV[64];\
1047 1056
    copy_block9(full, src, 16, stride, 9);\
1048 1057
    put ## RND ## mpeg4_qpel8_h_lowpass(halfH, full, 8, 16, 9);\
1049
    put ## RND ## pixels8_l2(halfH, halfH, full, 8, 8, 16, 9);\
1058
    put ## RND ## pixels8_l2_8(halfH, halfH, full, 8, 8, 16, 9);\
1050 1059
    put ## RND ## mpeg4_qpel8_v_lowpass(halfHV, halfH, 8, 8);\
1051
    OPNAME ## pixels8_l2(dst, halfH+8, halfHV, stride, 8, 8, 8);\
1060
    OPNAME ## pixels8_l2_8(dst, halfH+8, halfHV, stride, 8, 8, 8);\
1052 1061
}\
1053 1062
void ff_ ## OPNAME ## qpel8_mc33_old_c(uint8_t *dst, uint8_t *src, int stride){\
1054 1063
    uint8_t full[16*9];\
......
1059 1068
    put ## RND ## mpeg4_qpel8_h_lowpass(halfH, full  , 8, 16, 9);\
1060 1069
    put ## RND ## mpeg4_qpel8_v_lowpass(halfV, full+1, 8, 16);\
1061 1070
    put ## RND ## mpeg4_qpel8_v_lowpass(halfHV, halfH, 8, 8);\
1062
    OPNAME ## pixels8_l4(dst, full+17, halfH+8, halfV, halfHV, stride, 16, 8, 8, 8, 8);\
1071
    OPNAME ## pixels8_l4_8(dst, full+17, halfH+8, halfV, halfHV, stride, 16, 8, 8, 8, 8);\
1063 1072
}\
1064 1073
static void OPNAME ## qpel8_mc33_c(uint8_t *dst, uint8_t *src, int stride){\
1065 1074
    uint8_t full[16*9];\
......
1067 1076
    uint8_t halfHV[64];\
1068 1077
    copy_block9(full, src, 16, stride, 9);\
1069 1078
    put ## RND ## mpeg4_qpel8_h_lowpass(halfH, full, 8, 16, 9);\
1070
    put ## RND ## pixels8_l2(halfH, halfH, full+1, 8, 8, 16, 9);\
1079
    put ## RND ## pixels8_l2_8(halfH, halfH, full+1, 8, 8, 16, 9);\
1071 1080
    put ## RND ## mpeg4_qpel8_v_lowpass(halfHV, halfH, 8, 8);\
1072
    OPNAME ## pixels8_l2(dst, halfH+8, halfHV, stride, 8, 8, 8);\
1081
    OPNAME ## pixels8_l2_8(dst, halfH+8, halfHV, stride, 8, 8, 8);\
1073 1082
}\
1074 1083
static void OPNAME ## qpel8_mc21_c(uint8_t *dst, uint8_t *src, int stride){\
1075 1084
    uint8_t halfH[72];\
1076 1085
    uint8_t halfHV[64];\
1077 1086
    put ## RND ## mpeg4_qpel8_h_lowpass(halfH, src, 8, stride, 9);\
1078 1087
    put ## RND ## mpeg4_qpel8_v_lowpass(halfHV, halfH, 8, 8);\
1079
    OPNAME ## pixels8_l2(dst, halfH, halfHV, stride, 8, 8, 8);\
1088
    OPNAME ## pixels8_l2_8(dst, halfH, halfHV, stride, 8, 8, 8);\
1080 1089
}\
1081 1090
static void OPNAME ## qpel8_mc23_c(uint8_t *dst, uint8_t *src, int stride){\
1082 1091
    uint8_t halfH[72];\
1083 1092
    uint8_t halfHV[64];\
1084 1093
    put ## RND ## mpeg4_qpel8_h_lowpass(halfH, src, 8, stride, 9);\
1085 1094
    put ## RND ## mpeg4_qpel8_v_lowpass(halfHV, halfH, 8, 8);\
1086
    OPNAME ## pixels8_l2(dst, halfH+8, halfHV, stride, 8, 8, 8);\
1095
    OPNAME ## pixels8_l2_8(dst, halfH+8, halfHV, stride, 8, 8, 8);\
1087 1096
}\
1088 1097
void ff_ ## OPNAME ## qpel8_mc12_old_c(uint8_t *dst, uint8_t *src, int stride){\
1089 1098
    uint8_t full[16*9];\
......
1094 1103
    put ## RND ## mpeg4_qpel8_h_lowpass(halfH, full, 8, 16, 9);\
1095 1104
    put ## RND ## mpeg4_qpel8_v_lowpass(halfV, full, 8, 16);\
1096 1105
    put ## RND ## mpeg4_qpel8_v_lowpass(halfHV, halfH, 8, 8);\
1097
    OPNAME ## pixels8_l2(dst, halfV, halfHV, stride, 8, 8, 8);\
1106
    OPNAME ## pixels8_l2_8(dst, halfV, halfHV, stride, 8, 8, 8);\
1098 1107
}\
1099 1108
static void OPNAME ## qpel8_mc12_c(uint8_t *dst, uint8_t *src, int stride){\
1100 1109
    uint8_t full[16*9];\
1101 1110
    uint8_t halfH[72];\
1102 1111
    copy_block9(full, src, 16, stride, 9);\
1103 1112
    put ## RND ## mpeg4_qpel8_h_lowpass(halfH, full, 8, 16, 9);\
1104
    put ## RND ## pixels8_l2(halfH, halfH, full, 8, 8, 16, 9);\
1113
    put ## RND ## pixels8_l2_8(halfH, halfH, full, 8, 8, 16, 9);\
1105 1114
    OPNAME ## mpeg4_qpel8_v_lowpass(dst, halfH, stride, 8);\
1106 1115
}\
1107 1116
void ff_ ## OPNAME ## qpel8_mc32_old_c(uint8_t *dst, uint8_t *src, int stride){\
......
1113 1122
    put ## RND ## mpeg4_qpel8_h_lowpass(halfH, full, 8, 16, 9);\
1114 1123
    put ## RND ## mpeg4_qpel8_v_lowpass(halfV, full+1, 8, 16);\
1115 1124
    put ## RND ## mpeg4_qpel8_v_lowpass(halfHV, halfH, 8, 8);\
1116
    OPNAME ## pixels8_l2(dst, halfV, halfHV, stride, 8, 8, 8);\
1125
    OPNAME ## pixels8_l2_8(dst, halfV, halfHV, stride, 8, 8, 8);\
1117 1126
}\
1118 1127
static void OPNAME ## qpel8_mc32_c(uint8_t *dst, uint8_t *src, int stride){\
1119 1128
    uint8_t full[16*9];\
1120 1129
    uint8_t halfH[72];\
1121 1130
    copy_block9(full, src, 16, stride, 9);\
1122 1131
    put ## RND ## mpeg4_qpel8_h_lowpass(halfH, full, 8, 16, 9);\
1123
    put ## RND ## pixels8_l2(halfH, halfH, full+1, 8, 8, 16, 9);\
1132
    put ## RND ## pixels8_l2_8(halfH, halfH, full+1, 8, 8, 16, 9);\
1124 1133
    OPNAME ## mpeg4_qpel8_v_lowpass(dst, halfH, stride, 8);\
1125 1134
}\
1126 1135
static void OPNAME ## qpel8_mc22_c(uint8_t *dst, uint8_t *src, int stride){\
......
1132 1141
static void OPNAME ## qpel16_mc10_c(uint8_t *dst, uint8_t *src, int stride){\
1133 1142
    uint8_t half[256];\
1134 1143
    put ## RND ## mpeg4_qpel16_h_lowpass(half, src, 16, stride, 16);\
1135
    OPNAME ## pixels16_l2(dst, src, half, stride, stride, 16, 16);\
1144
    OPNAME ## pixels16_l2_8(dst, src, half, stride, stride, 16, 16);\
1136 1145
}\
1137 1146
\
1138 1147
static void OPNAME ## qpel16_mc20_c(uint8_t *dst, uint8_t *src, int stride){\
......
1142 1151
static void OPNAME ## qpel16_mc30_c(uint8_t *dst, uint8_t *src, int stride){\
1143 1152
    uint8_t half[256];\
1144 1153
    put ## RND ## mpeg4_qpel16_h_lowpass(half, src, 16, stride, 16);\
1145
    OPNAME ## pixels16_l2(dst, src+1, half, stride, stride, 16, 16);\
1154
    OPNAME ## pixels16_l2_8(dst, src+1, half, stride, stride, 16, 16);\
1146 1155
}\
1147 1156
\
1148 1157
static void OPNAME ## qpel16_mc01_c(uint8_t *dst, uint8_t *src, int stride){\
......
1150 1159
    uint8_t half[256];\
1151 1160
    copy_block17(full, src, 24, stride, 17);\
1152 1161
    put ## RND ## mpeg4_qpel16_v_lowpass(half, full, 16, 24);\
1153
    OPNAME ## pixels16_l2(dst, full, half, stride, 24, 16, 16);\
1162
    OPNAME ## pixels16_l2_8(dst, full, half, stride, 24, 16, 16);\
1154 1163
}\
1155 1164
\
1156 1165
static void OPNAME ## qpel16_mc02_c(uint8_t *dst, uint8_t *src, int stride){\
......
1164 1173
    uint8_t half[256];\
1165 1174
    copy_block17(full, src, 24, stride, 17);\
1166 1175
    put ## RND ## mpeg4_qpel16_v_lowpass(half, full, 16, 24);\
1167
    OPNAME ## pixels16_l2(dst, full+24, half, stride, 24, 16, 16);\
1176
    OPNAME ## pixels16_l2_8(dst, full+24, half, stride, 24, 16, 16);\
1168 1177
}\
1169 1178
void ff_ ## OPNAME ## qpel16_mc11_old_c(uint8_t *dst, uint8_t *src, int stride){\
1170 1179
    uint8_t full[24*17];\
......
1175 1184
    put ## RND ## mpeg4_qpel16_h_lowpass(halfH, full, 16, 24, 17);\
1176 1185
    put ## RND ## mpeg4_qpel16_v_lowpass(halfV, full, 16, 24);\
1177 1186
    put ## RND ## mpeg4_qpel16_v_lowpass(halfHV, halfH, 16, 16);\
1178
    OPNAME ## pixels16_l4(dst, full, halfH, halfV, halfHV, stride, 24, 16, 16, 16, 16);\
1187
    OPNAME ## pixels16_l4_8(dst, full, halfH, halfV, halfHV, stride, 24, 16, 16, 16, 16);\
1179 1188
}\
1180 1189
static void OPNAME ## qpel16_mc11_c(uint8_t *dst, uint8_t *src, int stride){\
1181 1190
    uint8_t full[24*17];\
......
1183 1192
    uint8_t halfHV[256];\
1184 1193
    copy_block17(full, src, 24, stride, 17);\
1185 1194
    put ## RND ## mpeg4_qpel16_h_lowpass(halfH, full, 16, 24, 17);\
1186
    put ## RND ## pixels16_l2(halfH, halfH, full, 16, 16, 24, 17);\
1195
    put ## RND ## pixels16_l2_8(halfH, halfH, full, 16, 16, 24, 17);\
1187 1196
    put ## RND ## mpeg4_qpel16_v_lowpass(halfHV, halfH, 16, 16);\
1188
    OPNAME ## pixels16_l2(dst, halfH, halfHV, stride, 16, 16, 16);\
1197
    OPNAME ## pixels16_l2_8(dst, halfH, halfHV, stride, 16, 16, 16);\
1189 1198
}\
1190 1199
void ff_ ## OPNAME ## qpel16_mc31_old_c(uint8_t *dst, uint8_t *src, int stride){\
1191 1200
    uint8_t full[24*17];\
......
1196 1205
    put ## RND ## mpeg4_qpel16_h_lowpass(halfH, full, 16, 24, 17);\
1197 1206
    put ## RND ## mpeg4_qpel16_v_lowpass(halfV, full+1, 16, 24);\
1198 1207
    put ## RND ## mpeg4_qpel16_v_lowpass(halfHV, halfH, 16, 16);\
1199
    OPNAME ## pixels16_l4(dst, full+1, halfH, halfV, halfHV, stride, 24, 16, 16, 16, 16);\
1208
    OPNAME ## pixels16_l4_8(dst, full+1, halfH, halfV, halfHV, stride, 24, 16, 16, 16, 16);\
1200 1209
}\
1201 1210
static void OPNAME ## qpel16_mc31_c(uint8_t *dst, uint8_t *src, int stride){\
1202 1211
    uint8_t full[24*17];\
......
1204 1213
    uint8_t halfHV[256];\
1205 1214
    copy_block17(full, src, 24, stride, 17);\
1206 1215
    put ## RND ## mpeg4_qpel16_h_lowpass(halfH, full, 16, 24, 17);\
1207
    put ## RND ## pixels16_l2(halfH, halfH, full+1, 16, 16, 24, 17);\
1216
    put ## RND ## pixels16_l2_8(halfH, halfH, full+1, 16, 16, 24, 17);\
1208 1217
    put ## RND ## mpeg4_qpel16_v_lowpass(halfHV, halfH, 16, 16);\
1209
    OPNAME ## pixels16_l2(dst, halfH, halfHV, stride, 16, 16, 16);\
1218
    OPNAME ## pixels16_l2_8(dst, halfH, halfHV, stride, 16, 16, 16);\
1210 1219
}\
1211 1220
void ff_ ## OPNAME ## qpel16_mc13_old_c(uint8_t *dst, uint8_t *src, int stride){\
1212 1221
    uint8_t full[24*17];\
......
1217 1226
    put ## RND ## mpeg4_qpel16_h_lowpass(halfH, full, 16, 24, 17);\
1218 1227
    put ## RND ## mpeg4_qpel16_v_lowpass(halfV, full, 16, 24);\
1219 1228
    put ## RND ## mpeg4_qpel16_v_lowpass(halfHV, halfH, 16, 16);\
1220
    OPNAME ## pixels16_l4(dst, full+24, halfH+16, halfV, halfHV, stride, 24, 16, 16, 16, 16);\
1229
    OPNAME ## pixels16_l4_8(dst, full+24, halfH+16, halfV, halfHV, stride, 24, 16, 16, 16, 16);\
1221 1230
}\
1222 1231
static void OPNAME ## qpel16_mc13_c(uint8_t *dst, uint8_t *src, int stride){\
1223 1232
    uint8_t full[24*17];\
......
1225 1234
    uint8_t halfHV[256];\
1226 1235
    copy_block17(full, src, 24, stride, 17);\
1227 1236
    put ## RND ## mpeg4_qpel16_h_lowpass(halfH, full, 16, 24, 17);\
1228
    put ## RND ## pixels16_l2(halfH, halfH, full, 16, 16, 24, 17);\
1237
    put ## RND ## pixels16_l2_8(halfH, halfH, full, 16, 16, 24, 17);\
1229 1238
    put ## RND ## mpeg4_qpel16_v_lowpass(halfHV, halfH, 16, 16);\
1230
    OPNAME ## pixels16_l2(dst, halfH+16, halfHV, stride, 16, 16, 16);\
1239
    OPNAME ## pixels16_l2_8(dst, halfH+16, halfHV, stride, 16, 16, 16);\
1231 1240
}\
1232 1241
void ff_ ## OPNAME ## qpel16_mc33_old_c(uint8_t *dst, uint8_t *src, int stride){\
1233 1242
    uint8_t full[24*17];\
......
1238 1247
    put ## RND ## mpeg4_qpel16_h_lowpass(halfH, full  , 16, 24, 17);\
1239 1248
    put ## RND ## mpeg4_qpel16_v_lowpass(halfV, full+1, 16, 24);\
1240 1249
    put ## RND ## mpeg4_qpel16_v_lowpass(halfHV, halfH, 16, 16);\
1241
    OPNAME ## pixels16_l4(dst, full+25, halfH+16, halfV, halfHV, stride, 24, 16, 16, 16, 16);\
1250
    OPNAME ## pixels16_l4_8(dst, full+25, halfH+16, halfV, halfHV, stride, 24, 16, 16, 16, 16);\
1242 1251
}\
1243 1252
static void OPNAME ## qpel16_mc33_c(uint8_t *dst, uint8_t *src, int stride){\
1244 1253
    uint8_t full[24*17];\
......
1246 1255
    uint8_t halfHV[256];\
1247 1256
    copy_block17(full, src, 24, stride, 17);\
1248 1257
    put ## RND ## mpeg4_qpel16_h_lowpass(halfH, full, 16, 24, 17);\
1249
    put ## RND ## pixels16_l2(halfH, halfH, full+1, 16, 16, 24, 17);\
1258
    put ## RND ## pixels16_l2_8(halfH, halfH, full+1, 16, 16, 24, 17);\
1250 1259
    put ## RND ## mpeg4_qpel16_v_lowpass(halfHV, halfH, 16, 16);\
1251
    OPNAME ## pixels16_l2(dst, halfH+16, halfHV, stride, 16, 16, 16);\
1260
    OPNAME ## pixels16_l2_8(dst, halfH+16, halfHV, stride, 16, 16, 16);\
1252 1261
}\
1253 1262
static void OPNAME ## qpel16_mc21_c(uint8_t *dst, uint8_t *src, int stride){\
1254 1263
    uint8_t halfH[272];\
1255 1264
    uint8_t halfHV[256];\
1256 1265
    put ## RND ## mpeg4_qpel16_h_lowpass(halfH, src, 16, stride, 17);\
1257 1266
    put ## RND ## mpeg4_qpel16_v_lowpass(halfHV, halfH, 16, 16);\
1258
    OPNAME ## pixels16_l2(dst, halfH, halfHV, stride, 16, 16, 16);\
1267
    OPNAME ## pixels16_l2_8(dst, halfH, halfHV, stride, 16, 16, 16);\
1259 1268
}\
1260 1269
static void OPNAME ## qpel16_mc23_c(uint8_t *dst, uint8_t *src, int stride){\
1261 1270
    uint8_t halfH[272];\
1262 1271
    uint8_t halfHV[256];\
1263 1272
    put ## RND ## mpeg4_qpel16_h_lowpass(halfH, src, 16, stride, 17);\
1264 1273
    put ## RND ## mpeg4_qpel16_v_lowpass(halfHV, halfH, 16, 16);\
1265
    OPNAME ## pixels16_l2(dst, halfH+16, halfHV, stride, 16, 16, 16);\
1274
    OPNAME ## pixels16_l2_8(dst, halfH+16, halfHV, stride, 16, 16, 16);\
1266 1275
}\
1267 1276
void ff_ ## OPNAME ## qpel16_mc12_old_c(uint8_t *dst, uint8_t *src, int stride){\
1268 1277
    uint8_t full[24*17];\
......
1273 1282
    put ## RND ## mpeg4_qpel16_h_lowpass(halfH, full, 16, 24, 17);\
1274 1283
    put ## RND ## mpeg4_qpel16_v_lowpass(halfV, full, 16, 24);\
1275 1284
    put ## RND ## mpeg4_qpel16_v_lowpass(halfHV, halfH, 16, 16);\
1276
    OPNAME ## pixels16_l2(dst, halfV, halfHV, stride, 16, 16, 16);\
1285
    OPNAME ## pixels16_l2_8(dst, halfV, halfHV, stride, 16, 16, 16);\
1277 1286
}\
1278 1287
static void OPNAME ## qpel16_mc12_c(uint8_t *dst, uint8_t *src, int stride){\
1279 1288
    uint8_t full[24*17];\
1280 1289
    uint8_t halfH[272];\
1281 1290
    copy_block17(full, src, 24, stride, 17);\
1282 1291
    put ## RND ## mpeg4_qpel16_h_lowpass(halfH, full, 16, 24, 17);\
1283
    put ## RND ## pixels16_l2(halfH, halfH, full, 16, 16, 24, 17);\
1292
    put ## RND ## pixels16_l2_8(halfH, halfH, full, 16, 16, 24, 17);\
1284 1293
    OPNAME ## mpeg4_qpel16_v_lowpass(dst, halfH, stride, 16);\
1285 1294
}\
1286 1295
void ff_ ## OPNAME ## qpel16_mc32_old_c(uint8_t *dst, uint8_t *src, int stride){\
......
1292 1301
    put ## RND ## mpeg4_qpel16_h_lowpass(halfH, full, 16, 24, 17);\
1293 1302
    put ## RND ## mpeg4_qpel16_v_lowpass(halfV, full+1, 16, 24);\
1294 1303
    put ## RND ## mpeg4_qpel16_v_lowpass(halfHV, halfH, 16, 16);\
1295
    OPNAME ## pixels16_l2(dst, halfV, halfHV, stride, 16, 16, 16);\
1304
    OPNAME ## pixels16_l2_8(dst, halfV, halfHV, stride, 16, 16, 16);\
1296 1305
}\
1297 1306
static void OPNAME ## qpel16_mc32_c(uint8_t *dst, uint8_t *src, int stride){\
1298 1307
    uint8_t full[24*17];\
1299 1308
    uint8_t halfH[272];\
1300 1309
    copy_block17(full, src, 24, stride, 17);\
1301 1310
    put ## RND ## mpeg4_qpel16_h_lowpass(halfH, full, 16, 24, 17);\
1302
    put ## RND ## pixels16_l2(halfH, halfH, full+1, 16, 16, 24, 17);\
1311
    put ## RND ## pixels16_l2_8(halfH, halfH, full+1, 16, 16, 24, 17);\
1303 1312
    OPNAME ## mpeg4_qpel16_v_lowpass(dst, halfH, stride, 16);\
1304 1313
}\
1305 1314
static void OPNAME ## qpel16_mc22_c(uint8_t *dst, uint8_t *src, int stride){\
......
1327 1336
#define put_qpel16_mc00_c ff_put_pixels16x16_c
1328 1337
#define avg_qpel16_mc00_c ff_avg_pixels16x16_c
1329 1338
#define put_no_rnd_qpel8_mc00_c  ff_put_pixels8x8_c
1330
#define put_no_rnd_qpel16_mc00_c ff_put_pixels16x16_c
1339
#define put_no_rnd_qpel16_mc00_c ff_put_pixels16x16_8_c
1331 1340

  
1332 1341
static void wmv2_mspel8_h_lowpass(uint8_t *dst, uint8_t *src, int dstStride, int srcStride, int h){
1333 1342
    uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
......
1349 1358

  
1350 1359
#if CONFIG_RV40_DECODER
1351 1360
static void put_rv40_qpel16_mc33_c(uint8_t *dst, uint8_t *src, int stride){
1352
    put_pixels16_xy2_c(dst, src, stride, 16);
1361
    put_pixels16_xy2_8_c(dst, src, stride, 16);
1353 1362
}
1354 1363
static void avg_rv40_qpel16_mc33_c(uint8_t *dst, uint8_t *src, int stride){
1355
    avg_pixels16_xy2_c(dst, src, stride, 16);
1364
    avg_pixels16_xy2_8_c(dst, src, stride, 16);
1356 1365
}
1357 1366
static void put_rv40_qpel8_mc33_c(uint8_t *dst, uint8_t *src, int stride){
1358
    put_pixels8_xy2_c(dst, src, stride, 8);
1367
    put_pixels8_xy2_8_c(dst, src, stride, 8);
1359 1368
}
1360 1369
static void avg_rv40_qpel8_mc33_c(uint8_t *dst, uint8_t *src, int stride){
1361
    avg_pixels8_xy2_c(dst, src, stride, 8);
1370
    avg_pixels8_xy2_8_c(dst, src, stride, 8);
1362 1371
}
1363 1372
#endif /* CONFIG_RV40_DECODER */
1364 1373

  
......
1394 1403
static void put_mspel8_mc10_c(uint8_t *dst, uint8_t *src, int stride){
1395 1404
    uint8_t half[64];
1396 1405
    wmv2_mspel8_h_lowpass(half, src, 8, stride, 8);
1397
    put_pixels8_l2(dst, src, half, stride, stride, 8, 8);
1406
    put_pixels8_l2_8(dst, src, half, stride, stride, 8, 8);
1398 1407
}
1399 1408

  
1400 1409
static void put_mspel8_mc20_c(uint8_t *dst, uint8_t *src, int stride){
......
1404 1413
static void put_mspel8_mc30_c(uint8_t *dst, uint8_t *src, int stride){
1405 1414
    uint8_t half[64];
1406 1415
    wmv2_mspel8_h_lowpass(half, src, 8, stride, 8);
1407
    put_pixels8_l2(dst, src+1, half, stride, stride, 8, 8);
1416
    put_pixels8_l2_8(dst, src+1, half, stride, stride, 8, 8);
1408 1417
}
1409 1418

  
1410 1419
static void put_mspel8_mc02_c(uint8_t *dst, uint8_t *src, int stride){
......
1418 1427
    wmv2_mspel8_h_lowpass(halfH, src-stride, 8, stride, 11);
1419 1428
    wmv2_mspel8_v_lowpass(halfV, src, 8, stride, 8);
1420 1429
    wmv2_mspel8_v_lowpass(halfHV, halfH+8, 8, 8, 8);
1421
    put_pixels8_l2(dst, halfV, halfHV, stride, 8, 8, 8);
1430
    put_pixels8_l2_8(dst, halfV, halfHV, stride, 8, 8, 8);
1422 1431
}
1423 1432
static void put_mspel8_mc32_c(uint8_t *dst, uint8_t *src, int stride){
1424 1433
    uint8_t halfH[88];
......
1427 1436
    wmv2_mspel8_h_lowpass(halfH, src-stride, 8, stride, 11);
1428 1437
    wmv2_mspel8_v_lowpass(halfV, src+1, 8, stride, 8);
1429 1438
    wmv2_mspel8_v_lowpass(halfHV, halfH+8, 8, 8, 8);
1430
    put_pixels8_l2(dst, halfV, halfHV, stride, 8, 8, 8);
1439
    put_pixels8_l2_8(dst, halfV, halfHV, stride, 8, 8, 8);
1431 1440
}
1432 1441
static void put_mspel8_mc22_c(uint8_t *dst, uint8_t *src, int stride){
1433 1442
    uint8_t halfH[88];
......
2870 2879
            c->idct_put= ff_jref_idct4_put;
2871 2880
            c->idct_add= ff_jref_idct4_add;
2872 2881
        }else{
2873
            c->idct_put= ff_h264_lowres_idct_put_c;
2874
            c->idct_add= ff_h264_lowres_idct_add_c;
2882
            if (avctx->codec_id != CODEC_ID_H264) {
2883
                c->idct_put= ff_h264_lowres_idct_put_8_c;
2884
                c->idct_add= ff_h264_lowres_idct_add_8_c;
2885
            } else {
2886
                switch (avctx->bits_per_raw_sample) {
2887
                    case 9:
2888
                        c->idct_put= ff_h264_lowres_idct_put_9_c;
2889
                        c->idct_add= ff_h264_lowres_idct_add_9_c;
2890
                        break;
2891
                    case 10:
2892
                        c->idct_put= ff_h264_lowres_idct_put_10_c;
2893
                        c->idct_add= ff_h264_lowres_idct_add_10_c;
2894
                        break;
2895
                    default:
2896
                        c->idct_put= ff_h264_lowres_idct_put_8_c;
2897
                        c->idct_add= ff_h264_lowres_idct_add_8_c;
2898
                }
2899
            }
2875 2900
        }
2876 2901
        c->idct    = j_rev_dct4;
2877 2902
        c->idct_permutation_type= FF_NO_IDCT_PERM;
......
2929 2954
    c->put_signed_pixels_clamped = ff_put_signed_pixels_clamped_c;
2930 2955
    c->put_pixels_nonclamped = put_pixels_nonclamped_c;
2931 2956
    c->add_pixels_clamped = ff_add_pixels_clamped_c;
2932
    c->add_pixels8 = add_pixels8_c;
2933
    c->add_pixels4 = add_pixels4_c;
2934 2957
    c->sum_abs_dctelem = sum_abs_dctelem_c;
2935
    c->emulated_edge_mc = ff_emulated_edge_mc;
2936 2958
    c->gmc1 = gmc1_c;
2937 2959
    c->gmc = ff_gmc_c;
2938
    c->clear_block = clear_block_c;
2939
    c->clear_blocks = clear_blocks_c;
2940 2960
    c->pix_sum = pix_sum_c;
2941 2961
    c->pix_norm1 = pix_norm1_c;
2942 2962

  
......
2954 2974
    c->pix_abs[1][2] = pix_abs8_y2_c;
2955 2975
    c->pix_abs[1][3] = pix_abs8_xy2_c;
2956 2976

  
2957
#define dspfunc(PFX, IDX, NUM) \
2958
    c->PFX ## _pixels_tab[IDX][0] = PFX ## _pixels ## NUM ## _c;     \
2959
    c->PFX ## _pixels_tab[IDX][1] = PFX ## _pixels ## NUM ## _x2_c;  \
2960
    c->PFX ## _pixels_tab[IDX][2] = PFX ## _pixels ## NUM ## _y2_c;  \
2961
    c->PFX ## _pixels_tab[IDX][3] = PFX ## _pixels ## NUM ## _xy2_c
2962

  
2963
    dspfunc(put, 0, 16);
2964
    dspfunc(put_no_rnd, 0, 16);
2965
    dspfunc(put, 1, 8);
2966
    dspfunc(put_no_rnd, 1, 8);
2967
    dspfunc(put, 2, 4);
2968
    dspfunc(put, 3, 2);
2969

  
2970
    dspfunc(avg, 0, 16);
2971
    dspfunc(avg_no_rnd, 0, 16);
2972
    dspfunc(avg, 1, 8);
2973
    dspfunc(avg_no_rnd, 1, 8);
2974
    dspfunc(avg, 2, 4);
2975
    dspfunc(avg, 3, 2);
2976
#undef dspfunc
2977

  
2978
    c->put_no_rnd_pixels_l2[0]= put_no_rnd_pixels16_l2_c;
2979
    c->put_no_rnd_pixels_l2[1]= put_no_rnd_pixels8_l2_c;
2980

  
2981 2977
    c->put_tpel_pixels_tab[ 0] = put_tpel_pixels_mc00_c;
2982 2978
    c->put_tpel_pixels_tab[ 1] = put_tpel_pixels_mc10_c;
2983 2979
    c->put_tpel_pixels_tab[ 2] = put_tpel_pixels_mc20_c;
......
3028 3024
    dspfunc(avg_qpel, 1, 8);
3029 3025
    /* dspfunc(avg_no_rnd_qpel, 1, 8); */
3030 3026

  
3031
    dspfunc(put_h264_qpel, 0, 16);
3032
    dspfunc(put_h264_qpel, 1, 8);
3033
    dspfunc(put_h264_qpel, 2, 4);
3034
    dspfunc(put_h264_qpel, 3, 2);
3035
    dspfunc(avg_h264_qpel, 0, 16);
3036
    dspfunc(avg_h264_qpel, 1, 8);
3037
    dspfunc(avg_h264_qpel, 2, 4);
3038

  
3039 3027
#undef dspfunc
3040
    c->put_h264_chroma_pixels_tab[0]= put_h264_chroma_mc8_c;
3041
    c->put_h264_chroma_pixels_tab[1]= put_h264_chroma_mc4_c;
3042
    c->put_h264_chroma_pixels_tab[2]= put_h264_chroma_mc2_c;
3043
    c->avg_h264_chroma_pixels_tab[0]= avg_h264_chroma_mc8_c;
3044
    c->avg_h264_chroma_pixels_tab[1]= avg_h264_chroma_mc4_c;
3045
    c->avg_h264_chroma_pixels_tab[2]= avg_h264_chroma_mc2_c;
3046

  
3047
    c->draw_edges = draw_edges_c;
3048 3028

  
3049 3029
#if CONFIG_MLP_DECODER || CONFIG_TRUEHD_DECODER
3050 3030
    ff_mlp_init(c, avctx);
......
3169 3149
    memset(c->put_2tap_qpel_pixels_tab, 0, sizeof(c->put_2tap_qpel_pixels_tab));
3170 3150
    memset(c->avg_2tap_qpel_pixels_tab, 0, sizeof(c->avg_2tap_qpel_pixels_tab));
3171 3151

  
3152
#undef FUNC
3153
#undef FUNCC
3154
#define FUNC(f, depth) f ## _ ## depth
3155
#define FUNCC(f, depth) f ## _ ## depth ## _c
3156

  
3157
#define dspfunc1(PFX, IDX, NUM, depth)\
3158
    c->PFX ## _pixels_tab[IDX][0] = FUNCC(PFX ## _pixels ## NUM        , depth);\
3159
    c->PFX ## _pixels_tab[IDX][1] = FUNCC(PFX ## _pixels ## NUM ## _x2 , depth);\
3160
    c->PFX ## _pixels_tab[IDX][2] = FUNCC(PFX ## _pixels ## NUM ## _y2 , depth);\
3161
    c->PFX ## _pixels_tab[IDX][3] = FUNCC(PFX ## _pixels ## NUM ## _xy2, depth)
3162

  
3163
#define dspfunc2(PFX, IDX, NUM, depth)\
3164
    c->PFX ## _pixels_tab[IDX][ 0] = FUNCC(PFX ## NUM ## _mc00, depth);\
3165
    c->PFX ## _pixels_tab[IDX][ 1] = FUNCC(PFX ## NUM ## _mc10, depth);\
3166
    c->PFX ## _pixels_tab[IDX][ 2] = FUNCC(PFX ## NUM ## _mc20, depth);\
3167
    c->PFX ## _pixels_tab[IDX][ 3] = FUNCC(PFX ## NUM ## _mc30, depth);\
3168
    c->PFX ## _pixels_tab[IDX][ 4] = FUNCC(PFX ## NUM ## _mc01, depth);\
3169
    c->PFX ## _pixels_tab[IDX][ 5] = FUNCC(PFX ## NUM ## _mc11, depth);\
3170
    c->PFX ## _pixels_tab[IDX][ 6] = FUNCC(PFX ## NUM ## _mc21, depth);\
3171
    c->PFX ## _pixels_tab[IDX][ 7] = FUNCC(PFX ## NUM ## _mc31, depth);\
3172
    c->PFX ## _pixels_tab[IDX][ 8] = FUNCC(PFX ## NUM ## _mc02, depth);\
3173
    c->PFX ## _pixels_tab[IDX][ 9] = FUNCC(PFX ## NUM ## _mc12, depth);\
3174
    c->PFX ## _pixels_tab[IDX][10] = FUNCC(PFX ## NUM ## _mc22, depth);\
3175
    c->PFX ## _pixels_tab[IDX][11] = FUNCC(PFX ## NUM ## _mc32, depth);\
3176
    c->PFX ## _pixels_tab[IDX][12] = FUNCC(PFX ## NUM ## _mc03, depth);\
3177
    c->PFX ## _pixels_tab[IDX][13] = FUNCC(PFX ## NUM ## _mc13, depth);\
3178
    c->PFX ## _pixels_tab[IDX][14] = FUNCC(PFX ## NUM ## _mc23, depth);\
3179
    c->PFX ## _pixels_tab[IDX][15] = FUNCC(PFX ## NUM ## _mc33, depth)
3180

  
3181

  
3182
#define BIT_DEPTH_FUNCS(depth)\
3183
    c->draw_edges                    = FUNCC(draw_edges            , depth);\
3184
    c->emulated_edge_mc              = FUNC (ff_emulated_edge_mc   , depth);\
3185
    c->clear_block                   = FUNCC(clear_block           , depth);\
3186
    c->clear_blocks                  = FUNCC(clear_blocks          , depth);\
3187
    c->add_pixels8                   = FUNCC(add_pixels8           , depth);\
3188
    c->add_pixels4                   = FUNCC(add_pixels4           , depth);\
3189
    c->put_no_rnd_pixels_l2[0]       = FUNCC(put_no_rnd_pixels16_l2, depth);\
3190
    c->put_no_rnd_pixels_l2[1]       = FUNCC(put_no_rnd_pixels8_l2 , depth);\
3191
\
3192
    c->put_h264_chroma_pixels_tab[0] = FUNCC(put_h264_chroma_mc8   , depth);\
3193
    c->put_h264_chroma_pixels_tab[1] = FUNCC(put_h264_chroma_mc4   , depth);\
3194
    c->put_h264_chroma_pixels_tab[2] = FUNCC(put_h264_chroma_mc2   , depth);\
3195
    c->avg_h264_chroma_pixels_tab[0] = FUNCC(avg_h264_chroma_mc8   , depth);\
3196
    c->avg_h264_chroma_pixels_tab[1] = FUNCC(avg_h264_chroma_mc4   , depth);\
3197
    c->avg_h264_chroma_pixels_tab[2] = FUNCC(avg_h264_chroma_mc2   , depth);\
3198
\
3199
    dspfunc1(put       , 0, 16, depth);\
3200
    dspfunc1(put       , 1,  8, depth);\
3201
    dspfunc1(put       , 2,  4, depth);\
3202
    dspfunc1(put       , 3,  2, depth);\
3203
    dspfunc1(put_no_rnd, 0, 16, depth);\
3204
    dspfunc1(put_no_rnd, 1,  8, depth);\
3205
    dspfunc1(avg       , 0, 16, depth);\
3206
    dspfunc1(avg       , 1,  8, depth);\
3207
    dspfunc1(avg       , 2,  4, depth);\
3208
    dspfunc1(avg       , 3,  2, depth);\
3209
    dspfunc1(avg_no_rnd, 0, 16, depth);\
3210
    dspfunc1(avg_no_rnd, 1,  8, depth);\
3211
\
3212
    dspfunc2(put_h264_qpel, 0, 16, depth);\
3213
    dspfunc2(put_h264_qpel, 1,  8, depth);\
3214
    dspfunc2(put_h264_qpel, 2,  4, depth);\
3215
    dspfunc2(put_h264_qpel, 3,  2, depth);\
3216
    dspfunc2(avg_h264_qpel, 0, 16, depth);\
3217
    dspfunc2(avg_h264_qpel, 1,  8, depth);\
3218
    dspfunc2(avg_h264_qpel, 2,  4, depth);
3219

  
3220
    if (avctx->codec_id != CODEC_ID_H264 || avctx->bits_per_raw_sample == 8) {
3221
        BIT_DEPTH_FUNCS(8)
3222
    } else {
3223
        switch (avctx->bits_per_raw_sample) {
3224
            case 9:
3225
                BIT_DEPTH_FUNCS(9)
3226
                break;
3227
            case 10:
3228
                BIT_DEPTH_FUNCS(10)
3229
                break;
3230
            default:
3231
                av_log(avctx, AV_LOG_DEBUG, "Unsupported bit depth: %d\n", avctx->bits_per_raw_sample);
3232
                BIT_DEPTH_FUNCS(8)
3233
                break;
3234
        }
3235
    }
3236

  
3237

  
3172 3238
    if (HAVE_MMX)        dsputil_init_mmx   (c, avctx);
3173 3239
    if (ARCH_ARM)        dsputil_init_arm   (c, avctx);
3174 3240
    if (CONFIG_MLIB)     dsputil_init_mlib  (c, avctx);
libavcodec/dsputil.h
53 53
void ff_fdct_mmx2(DCTELEM *block);
54 54
void ff_fdct_sse2(DCTELEM *block);
55 55

  
56
void ff_h264_idct8_add_c(uint8_t *dst, DCTELEM *block, int stride);
57
void ff_h264_idct_add_c(uint8_t *dst, DCTELEM *block, int stride);
58
void ff_h264_idct8_dc_add_c(uint8_t *dst, DCTELEM *block, int stride);
59
void ff_h264_idct_dc_add_c(uint8_t *dst, DCTELEM *block, int stride);
60
void ff_h264_lowres_idct_add_c(uint8_t *dst, int stride, DCTELEM *block);
61
void ff_h264_lowres_idct_put_c(uint8_t *dst, int stride, DCTELEM *block);
62
void ff_h264_idct_add16_c(uint8_t *dst, const int *blockoffset, DCTELEM *block, int stride, const uint8_t nnzc[6*8]);
63
void ff_h264_idct_add16intra_c(uint8_t *dst, const int *blockoffset, DCTELEM *block, int stride, const uint8_t nnzc[6*8]);
64
void ff_h264_idct8_add4_c(uint8_t *dst, const int *blockoffset, DCTELEM *block, int stride, const uint8_t nnzc[6*8]);
65
void ff_h264_idct_add8_c(uint8_t **dest, const int *blockoffset, DCTELEM *block, int stride, const uint8_t nnzc[6*8]);
66

  
67
void ff_h264_chroma_dc_dequant_idct_c(DCTELEM *block, int qmul);
68
void ff_h264_luma_dc_dequant_idct_c(DCTELEM *output, DCTELEM *input, int qmul);
56
#define H264_IDCT(depth) \
57
void ff_h264_idct8_add_ ## depth ## _c(uint8_t *dst, DCTELEM *block, int stride);\
58
void ff_h264_idct_add_ ## depth ## _c(uint8_t *dst, DCTELEM *block, int stride);\
59
void ff_h264_idct8_dc_add_ ## depth ## _c(uint8_t *dst, DCTELEM *block, int stride);\
60
void ff_h264_idct_dc_add_ ## depth ## _c(uint8_t *dst, DCTELEM *block, int stride);\
61
void ff_h264_lowres_idct_add_ ## depth ## _c(uint8_t *dst, int stride, DCTELEM *block);\
62
void ff_h264_lowres_idct_put_ ## depth ## _c(uint8_t *dst, int stride, DCTELEM *block);\
63
void ff_h264_idct_add16_ ## depth ## _c(uint8_t *dst, const int *blockoffset, DCTELEM *block, int stride, const uint8_t nnzc[6*8]);\
64
void ff_h264_idct_add16intra_ ## depth ## _c(uint8_t *dst, const int *blockoffset, DCTELEM *block, int stride, const uint8_t nnzc[6*8]);\
65
void ff_h264_idct8_add4_ ## depth ## _c(uint8_t *dst, const int *blockoffset, DCTELEM *block, int stride, const uint8_t nnzc[6*8]);\
66
void ff_h264_idct_add8_ ## depth ## _c(uint8_t **dest, const int *blockoffset, DCTELEM *block, int stride, const uint8_t nnzc[6*8]);\
67
void ff_h264_luma_dc_dequant_idct_ ## depth ## _c(DCTELEM *output, DCTELEM *input, int qmul);\
68
void ff_h264_chroma_dc_dequant_idct_ ## depth ## _c(DCTELEM *block, int qmul);
69

  
70
H264_IDCT( 8)
71
H264_IDCT( 9)
72
H264_IDCT(10)
73

  
69 74
void ff_svq3_luma_dc_dequant_idct_c(DCTELEM *output, DCTELEM *input, int qp);
70 75
void ff_svq3_add_idct_c(uint8_t *dst, DCTELEM *block, int stride, int qp, int dc);
71 76

  
......
82 87
extern uint32_t ff_squareTbl[512];
83 88
extern uint8_t ff_cropTbl[256 + 2 * MAX_NEG_CROP];
84 89

  
85
void ff_put_pixels8x8_c(uint8_t *dst, uint8_t *src, int stride);
86
void ff_avg_pixels8x8_c(uint8_t *dst, uint8_t *src, int stride);
87
void ff_put_pixels16x16_c(uint8_t *dst, uint8_t *src, int stride);
88
void ff_avg_pixels16x16_c(uint8_t *dst, uint8_t *src, int stride);
90
#define PUTAVG_PIXELS(depth)\
91
void ff_put_pixels8x8_ ## depth ## _c(uint8_t *dst, uint8_t *src, int stride);\
92
void ff_avg_pixels8x8_ ## depth ## _c(uint8_t *dst, uint8_t *src, int stride);\
93
void ff_put_pixels16x16_ ## depth ## _c(uint8_t *dst, uint8_t *src, int stride);\
94
void ff_avg_pixels16x16_ ## depth ## _c(uint8_t *dst, uint8_t *src, int stride);
95

  
96
PUTAVG_PIXELS( 8)
97
PUTAVG_PIXELS( 9)
98
PUTAVG_PIXELS(10)
99

  
100
#define ff_put_pixels8x8_c ff_put_pixels8x8_8_c
101
#define ff_avg_pixels8x8_c ff_avg_pixels8x8_8_c
102
#define ff_put_pixels16x16_c ff_put_pixels16x16_8_c
103
#define ff_avg_pixels16x16_c ff_avg_pixels16x16_8_c
89 104

  
90 105
/* VP3 DSP functions */
91 106
void ff_vp3_idct_c(DCTELEM *block/* align 16*/);
......
195 210

  
196 211
void ff_init_scantable(uint8_t *, ScanTable *st, const uint8_t *src_scantable);
197 212

  
198
void ff_emulated_edge_mc(uint8_t *buf, const uint8_t *src, int linesize,
199
                         int block_w, int block_h,
213
#define EMULATED_EDGE(depth) \
214
void ff_emulated_edge_mc_ ## depth (uint8_t *buf, const uint8_t *src, int linesize,\
215
                         int block_w, int block_h,\
200 216
                         int src_x, int src_y, int w, int h);
201 217

  
218
EMULATED_EDGE(8)
219
EMULATED_EDGE(9)
220
EMULATED_EDGE(10)
221

  
222
#define ff_emulated_edge_mc ff_emulated_edge_mc_8
223

  
202 224
void ff_add_pixels_clamped_c(const DCTELEM *block, uint8_t *dest, int linesize);
203 225
void ff_put_pixels_clamped_c(const DCTELEM *block, uint8_t *dest, int linesize);
204 226
void ff_put_signed_pixels_clamped_c(const DCTELEM *block, uint8_t *dest, int linesize);
......
570 592
void ff_set_cmp(DSPContext* c, me_cmp_func *cmp, int type);
571 593

  
572 594
#define         BYTE_VEC32(c)   ((c)*0x01010101UL)
595
#define         BYTE_VEC64(c)   ((c)*0x0001000100010001UL)
573 596

  
574 597
static inline uint32_t rnd_avg32(uint32_t a, uint32_t b)
575 598
{
......
581 604
    return (a & b) + (((a ^ b) & ~BYTE_VEC32(0x01)) >> 1);
582 605
}
583 606

  
607
static inline uint64_t rnd_avg64(uint64_t a, uint64_t b)
608
{
609
    return (a | b) - (((a ^ b) & ~BYTE_VEC64(0x01)) >> 1);
610
}
611

  
612
static inline uint64_t no_rnd_avg64(uint64_t a, uint64_t b)
613
{
614
    return (a & b) + (((a ^ b) & ~BYTE_VEC64(0x01)) >> 1);
615
}
616

  
584 617
static inline int get_penalty_factor(int lambda, int lambda2, int type){
585 618
    switch(type&0xFF){
586 619
    default:
libavcodec/dsputil_internal.h
27 27
 * DSP utils
28 28
 */
29 29

  
30
#include "dsputil.h"
30
#include "h264_high_depth.h"
31 31

  
32
#define BIT_DEPTH 8
32
static inline void FUNC(copy_block2)(uint8_t *dst, const uint8_t *src, int dstStride, int srcStride, int h)
33
{
34
    int i;
35
    for(i=0; i<h; i++)
36
    {
37
        AV_WN2P(dst   , AV_RN2P(src   ));
38
        dst+=dstStride;
39
        src+=srcStride;
40
    }
41
}
33 42

  
34
#define pixel  uint8_t
35
#define pixel2 uint16_t
36
#define pixel4 uint32_t
37
#define dctcoef int16_t
43
static inline void FUNC(copy_block4)(uint8_t *dst, const uint8_t *src, int dstStride, int srcStride, int h)
44
{
45
    int i;
46
    for(i=0; i<h; i++)
47
    {
48
        AV_WN4P(dst   , AV_RN4P(src   ));
49
        dst+=dstStride;
50
        src+=srcStride;
51
    }
52
}
38 53

  
39
#define FUNC(a)  a
40
#define FUNCC(a) a ## _c
41
#define INIT_CLIP uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
42
#define CLIP(a) cm[a]
43
#define AV_RN2P AV_RN16
44
#define AV_RN4P AV_RN32
45
#define PIXEL_MAX ((1<<BIT_DEPTH)-1)
54
static inline void FUNC(copy_block8)(uint8_t *dst, const uint8_t *src, int dstStride, int srcStride, int h)
55
{
56
    int i;
57
    for(i=0; i<h; i++)
58
    {
59
        AV_WN4P(dst                , AV_RN4P(src                ));
60
        AV_WN4P(dst+4*sizeof(pixel), AV_RN4P(src+4*sizeof(pixel)));
61
        dst+=dstStride;
62
        src+=srcStride;
63
    }
64
}
46 65

  
47
#define no_rnd_avg_pixel4 no_rnd_avg32
48
#define    rnd_avg_pixel4    rnd_avg32
66
static inline void FUNC(copy_block16)(uint8_t *dst, const uint8_t *src, int dstStride, int srcStride, int h)
67
{
68
    int i;
69
    for(i=0; i<h; i++)
70
    {
71
        AV_WN4P(dst                 , AV_RN4P(src                 ));
72
        AV_WN4P(dst+ 4*sizeof(pixel), AV_RN4P(src+ 4*sizeof(pixel)));
73
        AV_WN4P(dst+ 8*sizeof(pixel), AV_RN4P(src+ 8*sizeof(pixel)));
74
        AV_WN4P(dst+12*sizeof(pixel), AV_RN4P(src+12*sizeof(pixel)));
75
        dst+=dstStride;
76
        src+=srcStride;
77
    }
78
}
49 79

  
50 80
/* draw the edges of width 'w' of an image of size width, height */
51 81
//FIXME check that this is ok for mpeg4 interlaced
......
1319 1349
#undef op2_put
1320 1350
#endif
1321 1351

  
1322
#define put_h264_qpel8_mc00_c  ff_put_pixels8x8_c
1323
#define avg_h264_qpel8_mc00_c  ff_avg_pixels8x8_c
1324
#define put_h264_qpel16_mc00_c ff_put_pixels16x16_c
1325
#define avg_h264_qpel16_mc00_c ff_avg_pixels16x16_c
1352
#if BIT_DEPTH == 8
1353
#   define put_h264_qpel8_mc00_8_c  ff_put_pixels8x8_8_c
1354
#   define avg_h264_qpel8_mc00_8_c  ff_avg_pixels8x8_8_c
1355
#   define put_h264_qpel16_mc00_8_c ff_put_pixels16x16_8_c
1356
#   define avg_h264_qpel16_mc00_8_c ff_avg_pixels16x16_8_c
1357
#elif BIT_DEPTH == 9
1358
#   define put_h264_qpel8_mc00_9_c  ff_put_pixels8x8_9_c
1359
#   define avg_h264_qpel8_mc00_9_c  ff_avg_pixels8x8_9_c
1360
#   define put_h264_qpel16_mc00_9_c ff_put_pixels16x16_9_c
1361
#   define avg_h264_qpel16_mc00_9_c ff_avg_pixels16x16_9_c
1362
#elif BIT_DEPTH == 10
1363
#   define put_h264_qpel8_mc00_10_c  ff_put_pixels8x8_10_c
1364
#   define avg_h264_qpel8_mc00_10_c  ff_avg_pixels8x8_10_c
1365
#   define put_h264_qpel16_mc00_10_c ff_put_pixels16x16_10_c
1366
#   define avg_h264_qpel16_mc00_10_c ff_avg_pixels16x16_10_c
1367
#endif
1326 1368

  
1327 1369
void FUNCC(ff_put_pixels8x8)(uint8_t *dst, uint8_t *src, int stride) {
1328 1370
    FUNCC(put_pixels8)(dst, src, stride, 8);
libavcodec/h264.c
894 894
    dst->list_counts              = src->list_counts;
895 895

  
896 896
    dst->s.obmc_scratchpad = NULL;
897
    ff_h264_pred_init(&dst->hpc, src->s.codec_id);
897
    ff_h264_pred_init(&dst->hpc, src->s.codec_id, src->sps.bit_depth_luma);
898 898
}
899 899

  
900 900
/**
......
922 922
    s->height = s->avctx->height;
923 923
    s->codec_id= s->avctx->codec->id;
924 924

  
925
    ff_h264dsp_init(&h->h264dsp);
926
    ff_h264_pred_init(&h->hpc, s->codec_id);
925
    ff_h264dsp_init(&h->h264dsp, 8);
926
    ff_h264_pred_init(&h->hpc, s->codec_id, 8);
927 927

  
928 928
    h->dequant_coeff_pps= -1;
929 929
    s->unrestricted_mv=1;
......
1005 1005

  
1006 1006
    ff_h264_decode_init_vlc();
1007 1007

  
1008
    h->sps.bit_depth_luma = 8;
1008
    h->sps.bit_depth_luma = avctx->bits_per_raw_sample = 8;
1009 1009
    h->pixel_size = 1;
1010 1010

  
1011 1011
    h->thread_context[0] = h;
......
3467 3467

  
3468 3468
            if(avctx->has_b_frames < 2)
3469 3469
                avctx->has_b_frames= !s->low_delay;
3470

  
3471
            if (avctx->bits_per_raw_sample != h->sps.bit_depth_luma) {
3472
                if (h->sps.bit_depth_luma >= 8 && h->sps.bit_depth_luma <= 10) {
3473
                    avctx->bits_per_raw_sample = h->sps.bit_depth_luma;
3474
                    h->pixel_size = (h->sps.bit_depth_luma+7)/8;
3475

  
3476
                    ff_h264dsp_init(&h->h264dsp, h->sps.bit_depth_luma);
3477
                    ff_h264_pred_init(&h->hpc, s->codec_id, h->sps.bit_depth_luma);
3478
                    dsputil_init(&s->dsp, s->avctx);
3479
                } else {
3480
                    av_log(avctx, AV_LOG_DEBUG, "Unsupported bit depth: %d\n", h->sps.bit_depth_luma);
3481
                    return -1;
3482
                }
3483
            }
3470 3484
            break;
3471 3485
        case NAL_PPS:
3472 3486
            init_get_bits(&s->gb, ptr, bit_length);
libavcodec/h264_high_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_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

  
libavcodec/h264dsp.c
29 29
#include "avcodec.h"
30 30
#include "h264dsp.h"
31 31

  
32
#define BIT_DEPTH 8
32 33
#include "h264dsp_internal.h"
34
#undef BIT_DEPTH
33 35

  
34
void ff_h264dsp_init(H264DSPContext *c)
35
{
36
    c->h264_idct_add= ff_h264_idct_add_c;
37
    c->h264_idct8_add= ff_h264_idct8_add_c;
38
    c->h264_idct_dc_add= ff_h264_idct_dc_add_c;
39
    c->h264_idct8_dc_add= ff_h264_idct8_dc_add_c;
40
    c->h264_idct_add16     = ff_h264_idct_add16_c;
41
    c->h264_idct8_add4     = ff_h264_idct8_add4_c;
42
    c->h264_idct_add8      = ff_h264_idct_add8_c;
43
    c->h264_idct_add16intra= ff_h264_idct_add16intra_c;
44
    c->h264_luma_dc_dequant_idct= ff_h264_luma_dc_dequant_idct_c;
45
    c->h264_chroma_dc_dequant_idct= ff_h264_chroma_dc_dequant_idct_c;
36
#define BIT_DEPTH 9
37
#include "h264dsp_internal.h"
38
#undef BIT_DEPTH
39

  
40
#define BIT_DEPTH 10
41
#include "h264dsp_internal.h"
42
#undef BIT_DEPTH
46 43

  
47
    c->weight_h264_pixels_tab[0]= weight_h264_pixels16x16_c;
48
    c->weight_h264_pixels_tab[1]= weight_h264_pixels16x8_c;
49
    c->weight_h264_pixels_tab[2]= weight_h264_pixels8x16_c;
50
    c->weight_h264_pixels_tab[3]= weight_h264_pixels8x8_c;
51
    c->weight_h264_pixels_tab[4]= weight_h264_pixels8x4_c;
52
    c->weight_h264_pixels_tab[5]= weight_h264_pixels4x8_c;
53
    c->weight_h264_pixels_tab[6]= weight_h264_pixels4x4_c;
54
    c->weight_h264_pixels_tab[7]= weight_h264_pixels4x2_c;
55
    c->weight_h264_pixels_tab[8]= weight_h264_pixels2x4_c;
56
    c->weight_h264_pixels_tab[9]= weight_h264_pixels2x2_c;
57
    c->biweight_h264_pixels_tab[0]= biweight_h264_pixels16x16_c;
58
    c->biweight_h264_pixels_tab[1]= biweight_h264_pixels16x8_c;
59
    c->biweight_h264_pixels_tab[2]= biweight_h264_pixels8x16_c;
60
    c->biweight_h264_pixels_tab[3]= biweight_h264_pixels8x8_c;
61
    c->biweight_h264_pixels_tab[4]= biweight_h264_pixels8x4_c;
62
    c->biweight_h264_pixels_tab[5]= biweight_h264_pixels4x8_c;
63
    c->biweight_h264_pixels_tab[6]= biweight_h264_pixels4x4_c;
64
    c->biweight_h264_pixels_tab[7]= biweight_h264_pixels4x2_c;
65
    c->biweight_h264_pixels_tab[8]= biweight_h264_pixels2x4_c;
66
    c->biweight_h264_pixels_tab[9]= biweight_h264_pixels2x2_c;
44
void ff_h264dsp_init(H264DSPContext *c, const int bit_depth)
45
{
46
#undef FUNC
47
#define FUNC(a, depth) a ## _ ## depth ## _c
67 48

  
68
    c->h264_v_loop_filter_luma= h264_v_loop_filter_luma_c;
69
    c->h264_h_loop_filter_luma= h264_h_loop_filter_luma_c;
70
    c->h264_v_loop_filter_luma_intra= h264_v_loop_filter_luma_intra_c;
71
    c->h264_h_loop_filter_luma_intra= h264_h_loop_filter_luma_intra_c;
72
    c->h264_v_loop_filter_chroma= h264_v_loop_filter_chroma_c;
73
    c->h264_h_loop_filter_chroma= h264_h_loop_filter_chroma_c;
74
    c->h264_v_loop_filter_chroma_intra= h264_v_loop_filter_chroma_intra_c;
75
    c->h264_h_loop_filter_chroma_intra= h264_h_loop_filter_chroma_intra_c;
49
#define H264_DSP(depth) \
50
    c->h264_idct_add                   = FUNC(ff_h264_idct_add               , depth);\
51
    c->h264_idct8_add                  = FUNC(ff_h264_idct8_add              , depth);\
52
    c->h264_idct_dc_add                = FUNC(ff_h264_idct_dc_add            , depth);\
53
    c->h264_idct8_dc_add               = FUNC(ff_h264_idct8_dc_add           , depth);\
54
    c->h264_idct_add16                 = FUNC(ff_h264_idct_add16             , depth);\
55
    c->h264_idct8_add4                 = FUNC(ff_h264_idct8_add4             , depth);\
56
    c->h264_idct_add8                  = FUNC(ff_h264_idct_add8              , depth);\
57
    c->h264_idct_add16intra            = FUNC(ff_h264_idct_add16intra        , depth);\
58
    c->h264_luma_dc_dequant_idct       = FUNC(ff_h264_luma_dc_dequant_idct   , depth);\
59
    c->h264_chroma_dc_dequant_idct     = FUNC(ff_h264_chroma_dc_dequant_idct , depth);\
60
\
61
    c->weight_h264_pixels_tab[0]       = FUNC(  weight_h264_pixels16x16      , depth);\
62
    c->weight_h264_pixels_tab[1]       = FUNC(  weight_h264_pixels16x8       , depth);\
63
    c->weight_h264_pixels_tab[2]       = FUNC(  weight_h264_pixels8x16       , depth);\
64
    c->weight_h264_pixels_tab[3]       = FUNC(  weight_h264_pixels8x8        , depth);\
65
    c->weight_h264_pixels_tab[4]       = FUNC(  weight_h264_pixels8x4        , depth);\
66
    c->weight_h264_pixels_tab[5]       = FUNC(  weight_h264_pixels4x8        , depth);\
67
    c->weight_h264_pixels_tab[6]       = FUNC(  weight_h264_pixels4x4        , depth);\
68
    c->weight_h264_pixels_tab[7]       = FUNC(  weight_h264_pixels4x2        , depth);\
69
    c->weight_h264_pixels_tab[8]       = FUNC(  weight_h264_pixels2x4        , depth);\
70
    c->weight_h264_pixels_tab[9]       = FUNC(  weight_h264_pixels2x2        , depth);\
71
    c->biweight_h264_pixels_tab[0]     = FUNC(biweight_h264_pixels16x16      , depth);\
72
    c->biweight_h264_pixels_tab[1]     = FUNC(biweight_h264_pixels16x8       , depth);\
73
    c->biweight_h264_pixels_tab[2]     = FUNC(biweight_h264_pixels8x16       , depth);\
74
    c->biweight_h264_pixels_tab[3]     = FUNC(biweight_h264_pixels8x8        , depth);\
75
    c->biweight_h264_pixels_tab[4]     = FUNC(biweight_h264_pixels8x4        , depth);\
76
    c->biweight_h264_pixels_tab[5]     = FUNC(biweight_h264_pixels4x8        , depth);\
77
    c->biweight_h264_pixels_tab[6]     = FUNC(biweight_h264_pixels4x4        , depth);\
78
    c->biweight_h264_pixels_tab[7]     = FUNC(biweight_h264_pixels4x2        , depth);\
79
    c->biweight_h264_pixels_tab[8]     = FUNC(biweight_h264_pixels2x4        , depth);\
80
    c->biweight_h264_pixels_tab[9]     = FUNC(biweight_h264_pixels2x2        , depth);\
81
\
82
    c->h264_v_loop_filter_luma         = FUNC(h264_v_loop_filter_luma        , depth);\
83
    c->h264_h_loop_filter_luma         = FUNC(h264_h_loop_filter_luma        , depth);\
84
    c->h264_v_loop_filter_luma_intra   = FUNC(h264_v_loop_filter_luma_intra  , depth);\
85
    c->h264_h_loop_filter_luma_intra   = FUNC(h264_h_loop_filter_luma_intra  , depth);\
86
    c->h264_v_loop_filter_chroma       = FUNC(h264_v_loop_filter_chroma      , depth);\
87
    c->h264_h_loop_filter_chroma       = FUNC(h264_h_loop_filter_chroma      , depth);\
88
    c->h264_v_loop_filter_chroma_intra = FUNC(h264_v_loop_filter_chroma_intra, depth);\
89
    c->h264_h_loop_filter_chroma_intra = FUNC(h264_h_loop_filter_chroma_intra, depth);\
76 90
    c->h264_loop_filter_strength= NULL;
77 91

  
78
    if (ARCH_ARM) ff_h264dsp_init_arm(c);
79
    if (HAVE_ALTIVEC) ff_h264dsp_init_ppc(c);
80
    if (HAVE_MMX) ff_h264dsp_init_x86(c);
92
    switch (bit_depth) {
93
        case 9:
94
            H264_DSP(9);
95
            break;
96
        case 10:
97
            H264_DSP(10);
98
            break;
99
        default:
100
            H264_DSP(8);
101
            break;
102
    }
103

  
104
    if (ARCH_ARM) ff_h264dsp_init_arm(c, bit_depth);
105
    if (HAVE_ALTIVEC) ff_h264dsp_init_ppc(c, bit_depth);
106
    if (HAVE_MMX) ff_h264dsp_init_x86(c, bit_depth);
81 107
}
libavcodec/h264dsp.h
71 71
    void (*h264_chroma_dc_dequant_idct)(DCTELEM *block, int qmul);
72 72
}H264DSPContext;
73 73

  
74
void ff_h264dsp_init(H264DSPContext *c);
75
void ff_h264dsp_init_arm(H264DSPContext *c);
76
void ff_h264dsp_init_ppc(H264DSPContext *c);
77
void ff_h264dsp_init_x86(H264DSPContext *c);
74
void ff_h264dsp_init(H264DSPContext *c, const int bit_depth);
75
void ff_h264dsp_init_arm(H264DSPContext *c, const int bit_depth);
76
void ff_h264dsp_init_ppc(H264DSPContext *c, const int bit_depth);
77
void ff_h264dsp_init_x86(H264DSPContext *c, const int bit_depth);
78 78

  
79 79
#endif /* AVCODEC_H264DSP_H */
libavcodec/h264dsp_internal.h
25 25
 * @author Michael Niedermayer <michaelni@gmx.at>
26 26
 */
27 27

  
28
#include "dsputil.h"
29

  
30
#define BIT_DEPTH 8
31
#define pixel uint8_t
32
#define av_clip_pixel av_clip_uint8
33
#define FUNCC(a) a ## _c
28
#include "h264_high_depth.h"
34 29

  
35 30
#define op_scale1(x)  block[x] = av_clip_pixel( (block[x]*weight + offset) >> log2_denom )
36 31
#define op_scale2(x)  dst[x] = av_clip_pixel( (src[x]*weights + dst[x]*weightd + offset) >> (log2_denom+1))
libavcodec/h264idct.c
25 25
 * @author Michael Niedermayer <michaelni@gmx.at>
26 26
 */
27 27

  
28
#define BIT_DEPTH 8
28 29
#include "h264idct_internal.h"
30
#undef BIT_DEPTH
31

  
32
#define BIT_DEPTH 9
33
#include "h264idct_internal.h"
34
#undef BIT_DEPTH
35

  
36
#define BIT_DEPTH 10
37
#include "h264idct_internal.h"
38
#undef BIT_DEPTH
libavcodec/h264idct_internal.h
25 25
 * @author Michael Niedermayer <michaelni@gmx.at>
26 26
 */
27 27

  
28
#include "dsputil.h"
28
#include "h264_high_depth.h"
29 29

  
30 30
#ifndef AVCODEC_H264IDCT_INTERNAL_H
31 31
#define AVCODEC_H264IDCT_INTERNAL_H
......
42 42
};
43 43
#endif
44 44

  
45
#define pixel  uint8_t
46
#define dctcoef DCTELEM
47
#define INIT_CLIP uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
48
#define CLIP(a) cm[a]
49
#define FUNCC(a) a ## _c
50

  
51 45
static av_always_inline void FUNCC(idct_internal)(uint8_t *p_dst, DCTELEM *p_block, int stride, int block_stride, int shift, int add){
52 46
    int i;
53 47
    INIT_CLIP
libavcodec/h264pred.c
26 26
 */
27 27

  
28 28
#include "h264pred.h"
29

  
30
#define BIT_DEPTH 8
31
#include "h264pred_internal.h"
32
#undef BIT_DEPTH
33

  
34
#define BIT_DEPTH 9
35
#include "h264pred_internal.h"
36
#undef BIT_DEPTH
37

  
38
#define BIT_DEPTH 10
29 39
#include "h264pred_internal.h"
40
#undef BIT_DEPTH
30 41

  
31 42
/**
32 43
 * Set the intra prediction function pointers.
33 44
 */
34
void ff_h264_pred_init(H264PredContext *h, int codec_id){
45
void ff_h264_pred_init(H264PredContext *h, int codec_id, const int bit_depth){
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff