libavcodec/h264pred.c
Go to the documentation of this file.
00001 /*
00002  * H.26L/H.264/AVC/JVT/14496-10/... encoder/decoder
00003  * Copyright (c) 2003 Michael Niedermayer <michaelni@gmx.at>
00004  *
00005  * This file is part of Libav.
00006  *
00007  * Libav is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU Lesser General Public
00009  * License as published by the Free Software Foundation; either
00010  * version 2.1 of the License, or (at your option) any later version.
00011  *
00012  * Libav is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015  * Lesser General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU Lesser General Public
00018  * License along with Libav; if not, write to the Free Software
00019  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
00020  */
00021 
00028 #include "h264pred.h"
00029 
00030 #define BIT_DEPTH 8
00031 #include "h264pred_template.c"
00032 #undef BIT_DEPTH
00033 
00034 #define BIT_DEPTH 9
00035 #include "h264pred_template.c"
00036 #undef BIT_DEPTH
00037 
00038 #define BIT_DEPTH 10
00039 #include "h264pred_template.c"
00040 #undef BIT_DEPTH
00041 
00042 static void pred4x4_vertical_vp8_c(uint8_t *src, const uint8_t *topright, int stride){
00043     const unsigned lt = src[-1-1*stride];
00044     LOAD_TOP_EDGE
00045     LOAD_TOP_RIGHT_EDGE
00046     uint32_t v = PACK_4U8((lt + 2*t0 + t1 + 2) >> 2,
00047                           (t0 + 2*t1 + t2 + 2) >> 2,
00048                           (t1 + 2*t2 + t3 + 2) >> 2,
00049                           (t2 + 2*t3 + t4 + 2) >> 2);
00050 
00051     AV_WN32A(src+0*stride, v);
00052     AV_WN32A(src+1*stride, v);
00053     AV_WN32A(src+2*stride, v);
00054     AV_WN32A(src+3*stride, v);
00055 }
00056 
00057 static void pred4x4_horizontal_vp8_c(uint8_t *src, const uint8_t *topright, int stride){
00058     const unsigned lt = src[-1-1*stride];
00059     LOAD_LEFT_EDGE
00060 
00061     AV_WN32A(src+0*stride, ((lt + 2*l0 + l1 + 2) >> 2)*0x01010101);
00062     AV_WN32A(src+1*stride, ((l0 + 2*l1 + l2 + 2) >> 2)*0x01010101);
00063     AV_WN32A(src+2*stride, ((l1 + 2*l2 + l3 + 2) >> 2)*0x01010101);
00064     AV_WN32A(src+3*stride, ((l2 + 2*l3 + l3 + 2) >> 2)*0x01010101);
00065 }
00066 
00067 static void pred4x4_down_left_svq3_c(uint8_t *src, const uint8_t *topright, int stride){
00068     LOAD_TOP_EDGE
00069     LOAD_LEFT_EDGE
00070 
00071     src[0+0*stride]=(l1 + t1)>>1;
00072     src[1+0*stride]=
00073     src[0+1*stride]=(l2 + t2)>>1;
00074     src[2+0*stride]=
00075     src[1+1*stride]=
00076     src[0+2*stride]=
00077     src[3+0*stride]=
00078     src[2+1*stride]=
00079     src[1+2*stride]=
00080     src[0+3*stride]=
00081     src[3+1*stride]=
00082     src[2+2*stride]=
00083     src[1+3*stride]=
00084     src[3+2*stride]=
00085     src[2+3*stride]=
00086     src[3+3*stride]=(l3 + t3)>>1;
00087 }
00088 
00089 static void pred4x4_down_left_rv40_c(uint8_t *src, const uint8_t *topright, int stride){
00090     LOAD_TOP_EDGE
00091     LOAD_TOP_RIGHT_EDGE
00092     LOAD_LEFT_EDGE
00093     LOAD_DOWN_LEFT_EDGE
00094 
00095     src[0+0*stride]=(t0 + t2 + 2*t1 + 2 + l0 + l2 + 2*l1 + 2)>>3;
00096     src[1+0*stride]=
00097     src[0+1*stride]=(t1 + t3 + 2*t2 + 2 + l1 + l3 + 2*l2 + 2)>>3;
00098     src[2+0*stride]=
00099     src[1+1*stride]=
00100     src[0+2*stride]=(t2 + t4 + 2*t3 + 2 + l2 + l4 + 2*l3 + 2)>>3;
00101     src[3+0*stride]=
00102     src[2+1*stride]=
00103     src[1+2*stride]=
00104     src[0+3*stride]=(t3 + t5 + 2*t4 + 2 + l3 + l5 + 2*l4 + 2)>>3;
00105     src[3+1*stride]=
00106     src[2+2*stride]=
00107     src[1+3*stride]=(t4 + t6 + 2*t5 + 2 + l4 + l6 + 2*l5 + 2)>>3;
00108     src[3+2*stride]=
00109     src[2+3*stride]=(t5 + t7 + 2*t6 + 2 + l5 + l7 + 2*l6 + 2)>>3;
00110     src[3+3*stride]=(t6 + t7 + 1 + l6 + l7 + 1)>>2;
00111 }
00112 
00113 static void pred4x4_down_left_rv40_nodown_c(uint8_t *src, const uint8_t *topright, int stride){
00114     LOAD_TOP_EDGE
00115     LOAD_TOP_RIGHT_EDGE
00116     LOAD_LEFT_EDGE
00117 
00118     src[0+0*stride]=(t0 + t2 + 2*t1 + 2 + l0 + l2 + 2*l1 + 2)>>3;
00119     src[1+0*stride]=
00120     src[0+1*stride]=(t1 + t3 + 2*t2 + 2 + l1 + l3 + 2*l2 + 2)>>3;
00121     src[2+0*stride]=
00122     src[1+1*stride]=
00123     src[0+2*stride]=(t2 + t4 + 2*t3 + 2 + l2 + 3*l3 + 2)>>3;
00124     src[3+0*stride]=
00125     src[2+1*stride]=
00126     src[1+2*stride]=
00127     src[0+3*stride]=(t3 + t5 + 2*t4 + 2 + l3*4 + 2)>>3;
00128     src[3+1*stride]=
00129     src[2+2*stride]=
00130     src[1+3*stride]=(t4 + t6 + 2*t5 + 2 + l3*4 + 2)>>3;
00131     src[3+2*stride]=
00132     src[2+3*stride]=(t5 + t7 + 2*t6 + 2 + l3*4 + 2)>>3;
00133     src[3+3*stride]=(t6 + t7 + 1 + 2*l3 + 1)>>2;
00134 }
00135 
00136 static void pred4x4_vertical_left_rv40(uint8_t *src, const uint8_t *topright, int stride,
00137                                        const int l0, const int l1, const int l2, const int l3, const int l4){
00138     LOAD_TOP_EDGE
00139     LOAD_TOP_RIGHT_EDGE
00140 
00141     src[0+0*stride]=(2*t0 + 2*t1 + l1 + 2*l2 + l3 + 4)>>3;
00142     src[1+0*stride]=
00143     src[0+2*stride]=(t1 + t2 + 1)>>1;
00144     src[2+0*stride]=
00145     src[1+2*stride]=(t2 + t3 + 1)>>1;
00146     src[3+0*stride]=
00147     src[2+2*stride]=(t3 + t4+ 1)>>1;
00148     src[3+2*stride]=(t4 + t5+ 1)>>1;
00149     src[0+1*stride]=(t0 + 2*t1 + t2 + l2 + 2*l3 + l4 + 4)>>3;
00150     src[1+1*stride]=
00151     src[0+3*stride]=(t1 + 2*t2 + t3 + 2)>>2;
00152     src[2+1*stride]=
00153     src[1+3*stride]=(t2 + 2*t3 + t4 + 2)>>2;
00154     src[3+1*stride]=
00155     src[2+3*stride]=(t3 + 2*t4 + t5 + 2)>>2;
00156     src[3+3*stride]=(t4 + 2*t5 + t6 + 2)>>2;
00157 }
00158 
00159 static void pred4x4_vertical_left_rv40_c(uint8_t *src, const uint8_t *topright, int stride){
00160     LOAD_LEFT_EDGE
00161     LOAD_DOWN_LEFT_EDGE
00162 
00163     pred4x4_vertical_left_rv40(src, topright, stride, l0, l1, l2, l3, l4);
00164 }
00165 
00166 static void pred4x4_vertical_left_rv40_nodown_c(uint8_t *src, const uint8_t *topright, int stride){
00167     LOAD_LEFT_EDGE
00168 
00169     pred4x4_vertical_left_rv40(src, topright, stride, l0, l1, l2, l3, l3);
00170 }
00171 
00172 static void pred4x4_vertical_left_vp8_c(uint8_t *src, const uint8_t *topright, int stride){
00173     LOAD_TOP_EDGE
00174     LOAD_TOP_RIGHT_EDGE
00175 
00176     src[0+0*stride]=(t0 + t1 + 1)>>1;
00177     src[1+0*stride]=
00178     src[0+2*stride]=(t1 + t2 + 1)>>1;
00179     src[2+0*stride]=
00180     src[1+2*stride]=(t2 + t3 + 1)>>1;
00181     src[3+0*stride]=
00182     src[2+2*stride]=(t3 + t4 + 1)>>1;
00183     src[0+1*stride]=(t0 + 2*t1 + t2 + 2)>>2;
00184     src[1+1*stride]=
00185     src[0+3*stride]=(t1 + 2*t2 + t3 + 2)>>2;
00186     src[2+1*stride]=
00187     src[1+3*stride]=(t2 + 2*t3 + t4 + 2)>>2;
00188     src[3+1*stride]=
00189     src[2+3*stride]=(t3 + 2*t4 + t5 + 2)>>2;
00190     src[3+2*stride]=(t4 + 2*t5 + t6 + 2)>>2;
00191     src[3+3*stride]=(t5 + 2*t6 + t7 + 2)>>2;
00192 }
00193 
00194 static void pred4x4_horizontal_up_rv40_c(uint8_t *src, const uint8_t *topright, int stride){
00195     LOAD_LEFT_EDGE
00196     LOAD_DOWN_LEFT_EDGE
00197     LOAD_TOP_EDGE
00198     LOAD_TOP_RIGHT_EDGE
00199 
00200     src[0+0*stride]=(t1 + 2*t2 + t3 + 2*l0 + 2*l1 + 4)>>3;
00201     src[1+0*stride]=(t2 + 2*t3 + t4 + l0 + 2*l1 + l2 + 4)>>3;
00202     src[2+0*stride]=
00203     src[0+1*stride]=(t3 + 2*t4 + t5 + 2*l1 + 2*l2 + 4)>>3;
00204     src[3+0*stride]=
00205     src[1+1*stride]=(t4 + 2*t5 + t6 + l1 + 2*l2 + l3 + 4)>>3;
00206     src[2+1*stride]=
00207     src[0+2*stride]=(t5 + 2*t6 + t7 + 2*l2 + 2*l3 + 4)>>3;
00208     src[3+1*stride]=
00209     src[1+2*stride]=(t6 + 3*t7 + l2 + 3*l3 + 4)>>3;
00210     src[3+2*stride]=
00211     src[1+3*stride]=(l3 + 2*l4 + l5 + 2)>>2;
00212     src[0+3*stride]=
00213     src[2+2*stride]=(t6 + t7 + l3 + l4 + 2)>>2;
00214     src[2+3*stride]=(l4 + l5 + 1)>>1;
00215     src[3+3*stride]=(l4 + 2*l5 + l6 + 2)>>2;
00216 }
00217 
00218 static void pred4x4_horizontal_up_rv40_nodown_c(uint8_t *src, const uint8_t *topright, int stride){
00219     LOAD_LEFT_EDGE
00220     LOAD_TOP_EDGE
00221     LOAD_TOP_RIGHT_EDGE
00222 
00223     src[0+0*stride]=(t1 + 2*t2 + t3 + 2*l0 + 2*l1 + 4)>>3;
00224     src[1+0*stride]=(t2 + 2*t3 + t4 + l0 + 2*l1 + l2 + 4)>>3;
00225     src[2+0*stride]=
00226     src[0+1*stride]=(t3 + 2*t4 + t5 + 2*l1 + 2*l2 + 4)>>3;
00227     src[3+0*stride]=
00228     src[1+1*stride]=(t4 + 2*t5 + t6 + l1 + 2*l2 + l3 + 4)>>3;
00229     src[2+1*stride]=
00230     src[0+2*stride]=(t5 + 2*t6 + t7 + 2*l2 + 2*l3 + 4)>>3;
00231     src[3+1*stride]=
00232     src[1+2*stride]=(t6 + 3*t7 + l2 + 3*l3 + 4)>>3;
00233     src[3+2*stride]=
00234     src[1+3*stride]=l3;
00235     src[0+3*stride]=
00236     src[2+2*stride]=(t6 + t7 + 2*l3 + 2)>>2;
00237     src[2+3*stride]=
00238     src[3+3*stride]=l3;
00239 }
00240 
00241 static void pred4x4_tm_vp8_c(uint8_t *src, const uint8_t *topright, int stride){
00242     uint8_t *cm = ff_cropTbl + MAX_NEG_CROP - src[-1-stride];
00243     uint8_t *top = src-stride;
00244     int y;
00245 
00246     for (y = 0; y < 4; y++) {
00247         uint8_t *cm_in = cm + src[-1];
00248         src[0] = cm_in[top[0]];
00249         src[1] = cm_in[top[1]];
00250         src[2] = cm_in[top[2]];
00251         src[3] = cm_in[top[3]];
00252         src += stride;
00253     }
00254 }
00255 
00256 static void pred16x16_plane_svq3_c(uint8_t *src, int stride){
00257     pred16x16_plane_compat_8_c(src, stride, 1, 0);
00258 }
00259 
00260 static void pred16x16_plane_rv40_c(uint8_t *src, int stride){
00261     pred16x16_plane_compat_8_c(src, stride, 0, 1);
00262 }
00263 
00264 static void pred16x16_tm_vp8_c(uint8_t *src, int stride){
00265     uint8_t *cm = ff_cropTbl + MAX_NEG_CROP - src[-1-stride];
00266     uint8_t *top = src-stride;
00267     int y;
00268 
00269     for (y = 0; y < 16; y++) {
00270         uint8_t *cm_in = cm + src[-1];
00271         src[0]  = cm_in[top[0]];
00272         src[1]  = cm_in[top[1]];
00273         src[2]  = cm_in[top[2]];
00274         src[3]  = cm_in[top[3]];
00275         src[4]  = cm_in[top[4]];
00276         src[5]  = cm_in[top[5]];
00277         src[6]  = cm_in[top[6]];
00278         src[7]  = cm_in[top[7]];
00279         src[8]  = cm_in[top[8]];
00280         src[9]  = cm_in[top[9]];
00281         src[10] = cm_in[top[10]];
00282         src[11] = cm_in[top[11]];
00283         src[12] = cm_in[top[12]];
00284         src[13] = cm_in[top[13]];
00285         src[14] = cm_in[top[14]];
00286         src[15] = cm_in[top[15]];
00287         src += stride;
00288     }
00289 }
00290 
00291 static void pred8x8_left_dc_rv40_c(uint8_t *src, int stride){
00292     int i;
00293     unsigned dc0;
00294 
00295     dc0=0;
00296     for(i=0;i<8; i++)
00297         dc0+= src[-1+i*stride];
00298     dc0= 0x01010101*((dc0 + 4)>>3);
00299 
00300     for(i=0; i<8; i++){
00301         ((uint32_t*)(src+i*stride))[0]=
00302         ((uint32_t*)(src+i*stride))[1]= dc0;
00303     }
00304 }
00305 
00306 static void pred8x8_top_dc_rv40_c(uint8_t *src, int stride){
00307     int i;
00308     unsigned dc0;
00309 
00310     dc0=0;
00311     for(i=0;i<8; i++)
00312         dc0+= src[i-stride];
00313     dc0= 0x01010101*((dc0 + 4)>>3);
00314 
00315     for(i=0; i<8; i++){
00316         ((uint32_t*)(src+i*stride))[0]=
00317         ((uint32_t*)(src+i*stride))[1]= dc0;
00318     }
00319 }
00320 
00321 static void pred8x8_dc_rv40_c(uint8_t *src, int stride){
00322     int i;
00323     unsigned dc0 = 0;
00324 
00325     for(i=0;i<4; i++){
00326         dc0+= src[-1+i*stride] + src[i-stride];
00327         dc0+= src[4+i-stride];
00328         dc0+= src[-1+(i+4)*stride];
00329     }
00330     dc0= 0x01010101*((dc0 + 8)>>4);
00331 
00332     for(i=0; i<4; i++){
00333         ((uint32_t*)(src+i*stride))[0]= dc0;
00334         ((uint32_t*)(src+i*stride))[1]= dc0;
00335     }
00336     for(i=4; i<8; i++){
00337         ((uint32_t*)(src+i*stride))[0]= dc0;
00338         ((uint32_t*)(src+i*stride))[1]= dc0;
00339     }
00340 }
00341 
00342 static void pred8x8_tm_vp8_c(uint8_t *src, int stride){
00343     uint8_t *cm = ff_cropTbl + MAX_NEG_CROP - src[-1-stride];
00344     uint8_t *top = src-stride;
00345     int y;
00346 
00347     for (y = 0; y < 8; y++) {
00348         uint8_t *cm_in = cm + src[-1];
00349         src[0] = cm_in[top[0]];
00350         src[1] = cm_in[top[1]];
00351         src[2] = cm_in[top[2]];
00352         src[3] = cm_in[top[3]];
00353         src[4] = cm_in[top[4]];
00354         src[5] = cm_in[top[5]];
00355         src[6] = cm_in[top[6]];
00356         src[7] = cm_in[top[7]];
00357         src += stride;
00358     }
00359 }
00360 
00364 void ff_h264_pred_init(H264PredContext *h, int codec_id, const int bit_depth, const int chroma_format_idc){
00365 //    MpegEncContext * const s = &h->s;
00366 
00367 #undef FUNC
00368 #undef FUNCC
00369 #define FUNC(a, depth) a ## _ ## depth
00370 #define FUNCC(a, depth) a ## _ ## depth ## _c
00371 #define FUNCD(a) a ## _c
00372 
00373 #define H264_PRED(depth) \
00374     if(codec_id != CODEC_ID_RV40){\
00375         if(codec_id == CODEC_ID_VP8) {\
00376             h->pred4x4[VERT_PRED       ]= FUNCD(pred4x4_vertical_vp8);\
00377             h->pred4x4[HOR_PRED        ]= FUNCD(pred4x4_horizontal_vp8);\
00378         } else {\
00379             h->pred4x4[VERT_PRED       ]= FUNCC(pred4x4_vertical          , depth);\
00380             h->pred4x4[HOR_PRED        ]= FUNCC(pred4x4_horizontal        , depth);\
00381         }\
00382         h->pred4x4[DC_PRED             ]= FUNCC(pred4x4_dc                , depth);\
00383         if(codec_id == CODEC_ID_SVQ3)\
00384             h->pred4x4[DIAG_DOWN_LEFT_PRED ]= FUNCD(pred4x4_down_left_svq3);\
00385         else\
00386             h->pred4x4[DIAG_DOWN_LEFT_PRED ]= FUNCC(pred4x4_down_left     , depth);\
00387         h->pred4x4[DIAG_DOWN_RIGHT_PRED]= FUNCC(pred4x4_down_right        , depth);\
00388         h->pred4x4[VERT_RIGHT_PRED     ]= FUNCC(pred4x4_vertical_right    , depth);\
00389         h->pred4x4[HOR_DOWN_PRED       ]= FUNCC(pred4x4_horizontal_down   , depth);\
00390         if (codec_id == CODEC_ID_VP8) {\
00391             h->pred4x4[VERT_LEFT_PRED  ]= FUNCD(pred4x4_vertical_left_vp8);\
00392         } else\
00393             h->pred4x4[VERT_LEFT_PRED  ]= FUNCC(pred4x4_vertical_left     , depth);\
00394         h->pred4x4[HOR_UP_PRED         ]= FUNCC(pred4x4_horizontal_up     , depth);\
00395         if(codec_id != CODEC_ID_VP8) {\
00396             h->pred4x4[LEFT_DC_PRED    ]= FUNCC(pred4x4_left_dc           , depth);\
00397             h->pred4x4[TOP_DC_PRED     ]= FUNCC(pred4x4_top_dc            , depth);\
00398             h->pred4x4[DC_128_PRED     ]= FUNCC(pred4x4_128_dc            , depth);\
00399         } else {\
00400             h->pred4x4[TM_VP8_PRED     ]= FUNCD(pred4x4_tm_vp8);\
00401             h->pred4x4[DC_127_PRED     ]= FUNCC(pred4x4_127_dc            , depth);\
00402             h->pred4x4[DC_129_PRED     ]= FUNCC(pred4x4_129_dc            , depth);\
00403             h->pred4x4[VERT_VP8_PRED   ]= FUNCC(pred4x4_vertical          , depth);\
00404             h->pred4x4[HOR_VP8_PRED    ]= FUNCC(pred4x4_horizontal        , depth);\
00405         }\
00406     }else{\
00407         h->pred4x4[VERT_PRED           ]= FUNCC(pred4x4_vertical          , depth);\
00408         h->pred4x4[HOR_PRED            ]= FUNCC(pred4x4_horizontal        , depth);\
00409         h->pred4x4[DC_PRED             ]= FUNCC(pred4x4_dc                , depth);\
00410         h->pred4x4[DIAG_DOWN_LEFT_PRED ]= FUNCD(pred4x4_down_left_rv40);\
00411         h->pred4x4[DIAG_DOWN_RIGHT_PRED]= FUNCC(pred4x4_down_right        , depth);\
00412         h->pred4x4[VERT_RIGHT_PRED     ]= FUNCC(pred4x4_vertical_right    , depth);\
00413         h->pred4x4[HOR_DOWN_PRED       ]= FUNCC(pred4x4_horizontal_down   , depth);\
00414         h->pred4x4[VERT_LEFT_PRED      ]= FUNCD(pred4x4_vertical_left_rv40);\
00415         h->pred4x4[HOR_UP_PRED         ]= FUNCD(pred4x4_horizontal_up_rv40);\
00416         h->pred4x4[LEFT_DC_PRED        ]= FUNCC(pred4x4_left_dc           , depth);\
00417         h->pred4x4[TOP_DC_PRED         ]= FUNCC(pred4x4_top_dc            , depth);\
00418         h->pred4x4[DC_128_PRED         ]= FUNCC(pred4x4_128_dc            , depth);\
00419         h->pred4x4[DIAG_DOWN_LEFT_PRED_RV40_NODOWN]= FUNCD(pred4x4_down_left_rv40_nodown);\
00420         h->pred4x4[HOR_UP_PRED_RV40_NODOWN]= FUNCD(pred4x4_horizontal_up_rv40_nodown);\
00421         h->pred4x4[VERT_LEFT_PRED_RV40_NODOWN]= FUNCD(pred4x4_vertical_left_rv40_nodown);\
00422     }\
00423 \
00424     h->pred8x8l[VERT_PRED           ]= FUNCC(pred8x8l_vertical            , depth);\
00425     h->pred8x8l[HOR_PRED            ]= FUNCC(pred8x8l_horizontal          , depth);\
00426     h->pred8x8l[DC_PRED             ]= FUNCC(pred8x8l_dc                  , depth);\
00427     h->pred8x8l[DIAG_DOWN_LEFT_PRED ]= FUNCC(pred8x8l_down_left           , depth);\
00428     h->pred8x8l[DIAG_DOWN_RIGHT_PRED]= FUNCC(pred8x8l_down_right          , depth);\
00429     h->pred8x8l[VERT_RIGHT_PRED     ]= FUNCC(pred8x8l_vertical_right      , depth);\
00430     h->pred8x8l[HOR_DOWN_PRED       ]= FUNCC(pred8x8l_horizontal_down     , depth);\
00431     h->pred8x8l[VERT_LEFT_PRED      ]= FUNCC(pred8x8l_vertical_left       , depth);\
00432     h->pred8x8l[HOR_UP_PRED         ]= FUNCC(pred8x8l_horizontal_up       , depth);\
00433     h->pred8x8l[LEFT_DC_PRED        ]= FUNCC(pred8x8l_left_dc             , depth);\
00434     h->pred8x8l[TOP_DC_PRED         ]= FUNCC(pred8x8l_top_dc              , depth);\
00435     h->pred8x8l[DC_128_PRED         ]= FUNCC(pred8x8l_128_dc              , depth);\
00436 \
00437     if (chroma_format_idc == 1) {\
00438         h->pred8x8[VERT_PRED8x8   ]= FUNCC(pred8x8_vertical               , depth);\
00439         h->pred8x8[HOR_PRED8x8    ]= FUNCC(pred8x8_horizontal             , depth);\
00440     } else {\
00441         h->pred8x8[VERT_PRED8x8   ]= FUNCC(pred8x16_vertical              , depth);\
00442         h->pred8x8[HOR_PRED8x8    ]= FUNCC(pred8x16_horizontal            , depth);\
00443     }\
00444     if (codec_id != CODEC_ID_VP8) {\
00445         if (chroma_format_idc == 1) {\
00446             h->pred8x8[PLANE_PRED8x8]= FUNCC(pred8x8_plane                , depth);\
00447         } else {\
00448             h->pred8x8[PLANE_PRED8x8]= FUNCC(pred8x16_plane               , depth);\
00449         }\
00450     } else\
00451         h->pred8x8[PLANE_PRED8x8]= FUNCD(pred8x8_tm_vp8);\
00452     if(codec_id != CODEC_ID_RV40 && codec_id != CODEC_ID_VP8){\
00453         if (chroma_format_idc == 1) {\
00454             h->pred8x8[DC_PRED8x8     ]= FUNCC(pred8x8_dc                     , depth);\
00455             h->pred8x8[LEFT_DC_PRED8x8]= FUNCC(pred8x8_left_dc                , depth);\
00456             h->pred8x8[TOP_DC_PRED8x8 ]= FUNCC(pred8x8_top_dc                 , depth);\
00457             h->pred8x8[ALZHEIMER_DC_L0T_PRED8x8 ]= FUNC(pred8x8_mad_cow_dc_l0t, depth);\
00458             h->pred8x8[ALZHEIMER_DC_0LT_PRED8x8 ]= FUNC(pred8x8_mad_cow_dc_0lt, depth);\
00459             h->pred8x8[ALZHEIMER_DC_L00_PRED8x8 ]= FUNC(pred8x8_mad_cow_dc_l00, depth);\
00460             h->pred8x8[ALZHEIMER_DC_0L0_PRED8x8 ]= FUNC(pred8x8_mad_cow_dc_0l0, depth);\
00461         } else {\
00462             h->pred8x8[DC_PRED8x8     ]= FUNCC(pred8x16_dc                    , depth);\
00463             h->pred8x8[LEFT_DC_PRED8x8]= FUNCC(pred8x16_left_dc               , depth);\
00464             h->pred8x8[TOP_DC_PRED8x8 ]= FUNCC(pred8x16_top_dc                , depth);\
00465             h->pred8x8[ALZHEIMER_DC_L0T_PRED8x8 ]= FUNC(pred8x16_mad_cow_dc_l0t, depth);\
00466             h->pred8x8[ALZHEIMER_DC_0LT_PRED8x8 ]= FUNC(pred8x16_mad_cow_dc_0lt, depth);\
00467             h->pred8x8[ALZHEIMER_DC_L00_PRED8x8 ]= FUNC(pred8x16_mad_cow_dc_l00, depth);\
00468             h->pred8x8[ALZHEIMER_DC_0L0_PRED8x8 ]= FUNC(pred8x16_mad_cow_dc_0l0, depth);\
00469         }\
00470     }else{\
00471         h->pred8x8[DC_PRED8x8     ]= FUNCD(pred8x8_dc_rv40);\
00472         h->pred8x8[LEFT_DC_PRED8x8]= FUNCD(pred8x8_left_dc_rv40);\
00473         h->pred8x8[TOP_DC_PRED8x8 ]= FUNCD(pred8x8_top_dc_rv40);\
00474         if (codec_id == CODEC_ID_VP8) {\
00475             h->pred8x8[DC_127_PRED8x8]= FUNCC(pred8x8_127_dc              , depth);\
00476             h->pred8x8[DC_129_PRED8x8]= FUNCC(pred8x8_129_dc              , depth);\
00477         }\
00478     }\
00479     if (chroma_format_idc == 1) {\
00480         h->pred8x8[DC_128_PRED8x8 ]= FUNCC(pred8x8_128_dc                 , depth);\
00481     } else {\
00482         h->pred8x8[DC_128_PRED8x8 ]= FUNCC(pred8x16_128_dc                , depth);\
00483     }\
00484 \
00485     h->pred16x16[DC_PRED8x8     ]= FUNCC(pred16x16_dc                     , depth);\
00486     h->pred16x16[VERT_PRED8x8   ]= FUNCC(pred16x16_vertical               , depth);\
00487     h->pred16x16[HOR_PRED8x8    ]= FUNCC(pred16x16_horizontal             , depth);\
00488     switch(codec_id){\
00489     case CODEC_ID_SVQ3:\
00490        h->pred16x16[PLANE_PRED8x8  ]= FUNCD(pred16x16_plane_svq3);\
00491        break;\
00492     case CODEC_ID_RV40:\
00493        h->pred16x16[PLANE_PRED8x8  ]= FUNCD(pred16x16_plane_rv40);\
00494        break;\
00495     case CODEC_ID_VP8:\
00496        h->pred16x16[PLANE_PRED8x8  ]= FUNCD(pred16x16_tm_vp8);\
00497        h->pred16x16[DC_127_PRED8x8]= FUNCC(pred16x16_127_dc               , depth);\
00498        h->pred16x16[DC_129_PRED8x8]= FUNCC(pred16x16_129_dc               , depth);\
00499        break;\
00500     default:\
00501        h->pred16x16[PLANE_PRED8x8  ]= FUNCC(pred16x16_plane               , depth);\
00502        break;\
00503     }\
00504     h->pred16x16[LEFT_DC_PRED8x8]= FUNCC(pred16x16_left_dc                , depth);\
00505     h->pred16x16[TOP_DC_PRED8x8 ]= FUNCC(pred16x16_top_dc                 , depth);\
00506     h->pred16x16[DC_128_PRED8x8 ]= FUNCC(pred16x16_128_dc                 , depth);\
00507 \
00508     /* special lossless h/v prediction for h264 */ \
00509     h->pred4x4_add  [VERT_PRED   ]= FUNCC(pred4x4_vertical_add            , depth);\
00510     h->pred4x4_add  [ HOR_PRED   ]= FUNCC(pred4x4_horizontal_add          , depth);\
00511     h->pred8x8l_add [VERT_PRED   ]= FUNCC(pred8x8l_vertical_add           , depth);\
00512     h->pred8x8l_add [ HOR_PRED   ]= FUNCC(pred8x8l_horizontal_add         , depth);\
00513     if (chroma_format_idc == 1) {\
00514     h->pred8x8_add  [VERT_PRED8x8]= FUNCC(pred8x8_vertical_add            , depth);\
00515     h->pred8x8_add  [ HOR_PRED8x8]= FUNCC(pred8x8_horizontal_add          , depth);\
00516     } else {\
00517         h->pred8x8_add  [VERT_PRED8x8]= FUNCC(pred8x16_vertical_add            , depth);\
00518         h->pred8x8_add  [ HOR_PRED8x8]= FUNCC(pred8x16_horizontal_add          , depth);\
00519     }\
00520     h->pred16x16_add[VERT_PRED8x8]= FUNCC(pred16x16_vertical_add          , depth);\
00521     h->pred16x16_add[ HOR_PRED8x8]= FUNCC(pred16x16_horizontal_add        , depth);\
00522 
00523     switch (bit_depth) {
00524         case 9:
00525             H264_PRED(9)
00526             break;
00527         case 10:
00528             H264_PRED(10)
00529             break;
00530         default:
00531             H264_PRED(8)
00532             break;
00533     }
00534 
00535     if (ARCH_ARM) ff_h264_pred_init_arm(h, codec_id, bit_depth, chroma_format_idc);
00536     if (HAVE_MMX) ff_h264_pred_init_x86(h, codec_id, bit_depth, chroma_format_idc);
00537 }