Revision 622348f9 libavcodec/motion_est.c

View differences:

libavcodec/motion_est.c
277 277
#undef INIT
278 278
#undef CMP__DIRECT
279 279

  
280

  
281
static int zero_cmp(void *s, uint8_t *a, uint8_t *b, int stride, int h){
282
    return 0;
283
}
284

  
285
static void set_cmp(MpegEncContext *s, me_cmp_func *cmp, int type){
286
    DSPContext* c= &s->dsp;
287
    int i;
288
    
289
    memset(cmp, 0, sizeof(void*)*5);
290
        
291
    for(i=0; i<4; i++){
292
        switch(type&0xFF){
293
        case FF_CMP_SAD:
294
            cmp[i]= c->sad[i];
295
            break;
296
        case FF_CMP_SATD:
297
            cmp[i]= c->hadamard8_diff[i];
298
            break;
299
        case FF_CMP_SSE:
300
            cmp[i]= c->sse[i];
301
            break;
302
        case FF_CMP_DCT:
303
            cmp[i]= c->dct_sad[i];
304
            break;
305
        case FF_CMP_PSNR:
306
            cmp[i]= c->quant_psnr[i];
307
            break;
308
        case FF_CMP_BIT:
309
            cmp[i]= c->bit[i];
310
            break;
311
        case FF_CMP_RD:
312
            cmp[i]= c->rd[i];
313
            break;
314
        case FF_CMP_ZERO:
315
            cmp[i]= zero_cmp;
316
            break;
317
        default:
318
            av_log(s->avctx, AV_LOG_ERROR,"internal error in cmp function selection\n");
319
        }
320
    }
321
}
322

  
323 280
static inline int get_penalty_factor(MpegEncContext *s, int type){
324 281
    switch(type&0xFF){
325 282
    default:
......
340 297
}
341 298

  
342 299
void ff_init_me(MpegEncContext *s){
343
    set_cmp(s, s->dsp.me_pre_cmp, s->avctx->me_pre_cmp);
344
    set_cmp(s, s->dsp.me_cmp, s->avctx->me_cmp);
345
    set_cmp(s, s->dsp.me_sub_cmp, s->avctx->me_sub_cmp);
346
    set_cmp(s, s->dsp.mb_cmp, s->avctx->mb_cmp);
300
    ff_set_cmp(&s->dsp, s->dsp.me_pre_cmp, s->avctx->me_pre_cmp);
301
    ff_set_cmp(&s->dsp, s->dsp.me_cmp, s->avctx->me_cmp);
302
    ff_set_cmp(&s->dsp, s->dsp.me_sub_cmp, s->avctx->me_sub_cmp);
303
    ff_set_cmp(&s->dsp, s->dsp.mb_cmp, s->avctx->mb_cmp);
347 304

  
348 305
    if(s->flags&CODEC_FLAG_QPEL){
349 306
        if(s->avctx->me_sub_cmp&FF_CMP_CHROMA)
......
1783 1740
        }
1784 1741
         //FIXME something smarter
1785 1742
        if(dmin>256*256*16) type&= ~CANDIDATE_MB_TYPE_DIRECT; //dont try direct mode if its invalid for this MB
1743
#if 0        
1744
        if(s->out_format == FMT_MPEG1)
1745
            type |= CANDIDATE_MB_TYPE_INTRA;
1746
#endif
1786 1747
    }
1787 1748

  
1788 1749
    s->mb_type[mb_y*s->mb_stride + mb_x]= type;

Also available in: Unified diff