Revision 84705403 libavcodec/huffyuv.c

View differences:

libavcodec/huffyuv.c
153 153
    *left_top= lt;
154 154
}
155 155

  
156
//FIXME optimize
157
static inline void sub_median_prediction(uint8_t *dst, uint8_t *src1, uint8_t *src2, int w, int *left, int *left_top){
158
    int i;
159
    uint8_t l, lt;
160

  
161
    l= *left;
162
    lt= *left_top;
163

  
164
    for(i=0; i<w; i++){
165
        const int pred= mid_pred(l, src1[i], (l + src1[i] - lt)&0xFF);
166
        lt= src1[i];
167
        l= src2[i];
168
        dst[i]= l - pred;
169
    }    
170

  
171
    *left= l;
172
    *left_top= lt;
173
}
174

  
175 156
static inline void add_left_prediction_bgr32(uint8_t *dst, uint8_t *src, int w, int *red, int *green, int *blue){
176 157
    int i;
177 158
    int r,g,b;
......
999 980
            lefttopy= p->data[0][3];
1000 981
            lefttopu= p->data[1][1];
1001 982
            lefttopv= p->data[2][1];
1002
            sub_median_prediction(s->temp[0], p->data[0]+4, p->data[0] + fake_ystride+4, width-4 , &lefty, &lefttopy);
1003
            sub_median_prediction(s->temp[1], p->data[1]+2, p->data[1] + fake_ustride+2, width2-2, &leftu, &lefttopu);
1004
            sub_median_prediction(s->temp[2], p->data[2]+2, p->data[2] + fake_vstride+2, width2-2, &leftv, &lefttopv);
983
            s->dsp.sub_hfyu_median_prediction(s->temp[0], p->data[0]+4, p->data[0] + fake_ystride+4, width-4 , &lefty, &lefttopy);
984
            s->dsp.sub_hfyu_median_prediction(s->temp[1], p->data[1]+2, p->data[1] + fake_ustride+2, width2-2, &leftu, &lefttopu);
985
            s->dsp.sub_hfyu_median_prediction(s->temp[2], p->data[2]+2, p->data[2] + fake_vstride+2, width2-2, &leftv, &lefttopv);
1005 986
            encode_422_bitstream(s, width-4);
1006 987
            y++; cy++;
1007 988

  
......
1011 992
                if(s->bitstream_bpp==12){
1012 993
                    while(2*cy > y){
1013 994
                        ydst= p->data[0] + p->linesize[0]*y;
1014
                        sub_median_prediction(s->temp[0], ydst - fake_ystride, ydst, width , &lefty, &lefttopy);
995
                        s->dsp.sub_hfyu_median_prediction(s->temp[0], ydst - fake_ystride, ydst, width , &lefty, &lefttopy);
1015 996
                        encode_gray_bitstream(s, width);
1016 997
                        y++;
1017 998
                    }
......
1021 1002
                udst= p->data[1] + p->linesize[1]*cy;
1022 1003
                vdst= p->data[2] + p->linesize[2]*cy;
1023 1004

  
1024
                sub_median_prediction(s->temp[0], ydst - fake_ystride, ydst, width , &lefty, &lefttopy);
1025
                sub_median_prediction(s->temp[1], udst - fake_ustride, udst, width2, &leftu, &lefttopu);
1026
                sub_median_prediction(s->temp[2], vdst - fake_vstride, vdst, width2, &leftv, &lefttopv);
1005
                s->dsp.sub_hfyu_median_prediction(s->temp[0], ydst - fake_ystride, ydst, width , &lefty, &lefttopy);
1006
                s->dsp.sub_hfyu_median_prediction(s->temp[1], udst - fake_ustride, udst, width2, &leftu, &lefttopu);
1007
                s->dsp.sub_hfyu_median_prediction(s->temp[2], vdst - fake_vstride, vdst, width2, &leftv, &lefttopv);
1027 1008

  
1028 1009
                encode_422_bitstream(s, width);
1029 1010
            }

Also available in: Unified diff