Mercurial > libavcodec.hg
diff huffyuv.c @ 8760:31138c296ac6 libavcodec
ff_add_hfyu_median_prediction_mmx2
overall ffvhuff decoding speedup: 28% on core2, 25% on k8.
author | lorenm |
---|---|
date | Sun, 08 Feb 2009 17:45:30 +0000 |
parents | e9d9d946f213 |
children | 043574c5c153 |
line wrap: on
line diff
--- a/huffyuv.c Sun Feb 08 17:44:04 2009 +0000 +++ b/huffyuv.c Sun Feb 08 17:45:30 2009 +0000 @@ -31,7 +31,6 @@ #include "avcodec.h" #include "bitstream.h" #include "dsputil.h" -#include "mathops.h" #define VLC_BITS 11 @@ -148,23 +147,6 @@ return acc; } -static inline void add_median_prediction(uint8_t *dst, uint8_t *src1, uint8_t *diff, int w, int *left, int *left_top){ - int i; - uint8_t l, lt; - - l= *left; - lt= *left_top; - - for(i=0; i<w; i++){ - l= mid_pred(l, src1[i], (l + src1[i] - lt)&0xFF) + diff[i]; - lt= src1[i]; - dst[i]= l; - } - - *left= l; - *left_top= lt; -} - static inline void add_left_prediction_bgr32(uint8_t *dst, uint8_t *src, int w, int *red, int *green, int *blue){ int i; int r,g,b; @@ -1106,12 +1088,12 @@ /* next line except the first 4 pixels is median predicted */ lefttopy= p->data[0][3]; decode_422_bitstream(s, width-4); - add_median_prediction(p->data[0] + fake_ystride+4, p->data[0]+4, s->temp[0], width-4, &lefty, &lefttopy); + s->dsp.add_hfyu_median_prediction(p->data[0] + fake_ystride+4, p->data[0]+4, s->temp[0], width-4, &lefty, &lefttopy); if(!(s->flags&CODEC_FLAG_GRAY)){ lefttopu= p->data[1][1]; lefttopv= p->data[2][1]; - add_median_prediction(p->data[1] + fake_ustride+2, p->data[1]+2, s->temp[1], width2-2, &leftu, &lefttopu); - add_median_prediction(p->data[2] + fake_vstride+2, p->data[2]+2, s->temp[2], width2-2, &leftv, &lefttopv); + s->dsp.add_hfyu_median_prediction(p->data[1] + fake_ustride+2, p->data[1]+2, s->temp[1], width2-2, &leftu, &lefttopu); + s->dsp.add_hfyu_median_prediction(p->data[2] + fake_vstride+2, p->data[2]+2, s->temp[2], width2-2, &leftv, &lefttopv); } y++; cy++; @@ -1122,7 +1104,7 @@ while(2*cy > y){ decode_gray_bitstream(s, width); ydst= p->data[0] + p->linesize[0]*y; - add_median_prediction(ydst, ydst - fake_ystride, s->temp[0], width, &lefty, &lefttopy); + s->dsp.add_hfyu_median_prediction(ydst, ydst - fake_ystride, s->temp[0], width, &lefty, &lefttopy); y++; } if(y>=height) break; @@ -1135,10 +1117,10 @@ udst= p->data[1] + p->linesize[1]*cy; vdst= p->data[2] + p->linesize[2]*cy; - add_median_prediction(ydst, ydst - fake_ystride, s->temp[0], width, &lefty, &lefttopy); + s->dsp.add_hfyu_median_prediction(ydst, ydst - fake_ystride, s->temp[0], width, &lefty, &lefttopy); if(!(s->flags&CODEC_FLAG_GRAY)){ - add_median_prediction(udst, udst - fake_ustride, s->temp[1], width2, &leftu, &lefttopu); - add_median_prediction(vdst, vdst - fake_vstride, s->temp[2], width2, &leftv, &lefttopv); + s->dsp.add_hfyu_median_prediction(udst, udst - fake_ustride, s->temp[1], width2, &leftu, &lefttopu); + s->dsp.add_hfyu_median_prediction(vdst, vdst - fake_vstride, s->temp[2], width2, &leftv, &lefttopv); } }