Revision 12802ec0 libavcodec/vc1dsp.c

View differences:

libavcodec/vc1dsp.c
25 25
 *
26 26
 */
27 27

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

  
30 30

  
31 31
/** Apply overlap transform to horizontal edge
......
612 612
PUT_VC1_MSPEL(2, 3)
613 613
PUT_VC1_MSPEL(3, 3)
614 614

  
615
av_cold void ff_vc1dsp_init(DSPContext* dsp, AVCodecContext *avctx) {
615
static void put_no_rnd_vc1_chroma_mc8_c(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*/, int stride, int h, int x, int y){
616
    const int A=(8-x)*(8-y);
617
    const int B=(  x)*(8-y);
618
    const int C=(8-x)*(  y);
619
    const int D=(  x)*(  y);
620
    int i;
621

  
622
    assert(x<8 && y<8 && x>=0 && y>=0);
623

  
624
    for(i=0; i<h; i++)
625
    {
626
        dst[0] = (A*src[0] + B*src[1] + C*src[stride+0] + D*src[stride+1] + 32 - 4) >> 6;
627
        dst[1] = (A*src[1] + B*src[2] + C*src[stride+1] + D*src[stride+2] + 32 - 4) >> 6;
628
        dst[2] = (A*src[2] + B*src[3] + C*src[stride+2] + D*src[stride+3] + 32 - 4) >> 6;
629
        dst[3] = (A*src[3] + B*src[4] + C*src[stride+3] + D*src[stride+4] + 32 - 4) >> 6;
630
        dst[4] = (A*src[4] + B*src[5] + C*src[stride+4] + D*src[stride+5] + 32 - 4) >> 6;
631
        dst[5] = (A*src[5] + B*src[6] + C*src[stride+5] + D*src[stride+6] + 32 - 4) >> 6;
632
        dst[6] = (A*src[6] + B*src[7] + C*src[stride+6] + D*src[stride+7] + 32 - 4) >> 6;
633
        dst[7] = (A*src[7] + B*src[8] + C*src[stride+7] + D*src[stride+8] + 32 - 4) >> 6;
634
        dst+= stride;
635
        src+= stride;
636
    }
637
}
638

  
639
#define avg2(a,b) ((a+b+1)>>1)
640
static void avg_no_rnd_vc1_chroma_mc8_c(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*/, int stride, int h, int x, int y){
641
    const int A=(8-x)*(8-y);
642
    const int B=(  x)*(8-y);
643
    const int C=(8-x)*(  y);
644
    const int D=(  x)*(  y);
645
    int i;
646

  
647
    assert(x<8 && y<8 && x>=0 && y>=0);
648

  
649
    for(i=0; i<h; i++)
650
    {
651
        dst[0] = avg2(dst[0], ((A*src[0] + B*src[1] + C*src[stride+0] + D*src[stride+1] + 32 - 4) >> 6));
652
        dst[1] = avg2(dst[1], ((A*src[1] + B*src[2] + C*src[stride+1] + D*src[stride+2] + 32 - 4) >> 6));
653
        dst[2] = avg2(dst[2], ((A*src[2] + B*src[3] + C*src[stride+2] + D*src[stride+3] + 32 - 4) >> 6));
654
        dst[3] = avg2(dst[3], ((A*src[3] + B*src[4] + C*src[stride+3] + D*src[stride+4] + 32 - 4) >> 6));
655
        dst[4] = avg2(dst[4], ((A*src[4] + B*src[5] + C*src[stride+4] + D*src[stride+5] + 32 - 4) >> 6));
656
        dst[5] = avg2(dst[5], ((A*src[5] + B*src[6] + C*src[stride+5] + D*src[stride+6] + 32 - 4) >> 6));
657
        dst[6] = avg2(dst[6], ((A*src[6] + B*src[7] + C*src[stride+6] + D*src[stride+7] + 32 - 4) >> 6));
658
        dst[7] = avg2(dst[7], ((A*src[7] + B*src[8] + C*src[stride+7] + D*src[stride+8] + 32 - 4) >> 6));
659
        dst+= stride;
660
        src+= stride;
661
    }
662
}
663

  
664
av_cold void ff_vc1dsp_init(VC1DSPContext* dsp) {
616 665
    dsp->vc1_inv_trans_8x8 = vc1_inv_trans_8x8_c;
617 666
    dsp->vc1_inv_trans_4x8 = vc1_inv_trans_4x8_c;
618 667
    dsp->vc1_inv_trans_8x4 = vc1_inv_trans_8x4_c;
......
663 712
    dsp->avg_vc1_mspel_pixels_tab[13] = avg_vc1_mspel_mc13_c;
664 713
    dsp->avg_vc1_mspel_pixels_tab[14] = avg_vc1_mspel_mc23_c;
665 714
    dsp->avg_vc1_mspel_pixels_tab[15] = avg_vc1_mspel_mc33_c;
715

  
716
    dsp->put_no_rnd_vc1_chroma_pixels_tab[0]= put_no_rnd_vc1_chroma_mc8_c;
717
    dsp->avg_no_rnd_vc1_chroma_pixels_tab[0]= avg_no_rnd_vc1_chroma_mc8_c;
718

  
719
    if (HAVE_ALTIVEC)
720
        ff_vc1dsp_init_altivec(dsp);
721
    if (HAVE_MMX)
722
        ff_vc1dsp_init_mmx(dsp);
666 723
}

Also available in: Unified diff