diff --git a/libavcodec/huffyuvdec.c b/libavcodec/huffyuvdec.c index 59d58a8271..e11012499c 100644 --- a/libavcodec/huffyuvdec.c +++ b/libavcodec/huffyuvdec.c @@ -698,25 +698,7 @@ static void add_median_prediction(HYuvContext *s, uint8_t *dst, const uint8_t *s if (s->bps <= 8) { s->dsp.add_hfyu_median_prediction(dst, src, diff, w, left, left_top); } else { - //FIXME optimize - unsigned mask = s->n-1; - int i; - uint16_t l, lt; - const uint16_t *src16 = (const uint16_t *)src; - const uint16_t *diff16 = (const uint16_t *)diff; - uint16_t *dst16 = ( uint16_t *)dst; - - l = *left; - lt = *left_top; - - for(i=0; illviddsp.add_hfyu_median_prediction_int16((uint16_t *)dst, (const uint16_t *)src, (const uint16_t *)diff, s->n-1, w, left, left_top); } } static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, diff --git a/libavcodec/lossless_videodsp.c b/libavcodec/lossless_videodsp.c index e494072ae3..8279901f1e 100644 --- a/libavcodec/lossless_videodsp.c +++ b/libavcodec/lossless_videodsp.c @@ -19,6 +19,7 @@ */ #include "avcodec.h" #include "lossless_videodsp.h" +#include "libavcodec/mathops.h" static void add_int16_c(uint16_t *dst, const uint16_t *src, unsigned mask, int w){ long i; @@ -59,6 +60,23 @@ static void diff_int16_c(uint16_t *dst, const uint16_t *src1, const uint16_t *sr dst[i] = (src1[i] - src2[i]) & mask; } +static void add_hfyu_median_prediction_int16_c(uint16_t *dst, const uint16_t *src, const uint16_t *diff, unsigned mask, int w, int *left, int *left_top){ + int i; + uint16_t l, lt; + + l = *left; + lt = *left_top; + + for(i=0; iadd_int16 = add_int16_c; c->diff_int16= diff_int16_c; c->add_hfyu_left_prediction_int16 = add_hfyu_left_prediction_int16_c; + c->add_hfyu_median_prediction_int16 = add_hfyu_median_prediction_int16_c; if (ARCH_X86) ff_llviddsp_init_x86(c); diff --git a/libavcodec/lossless_videodsp.h b/libavcodec/lossless_videodsp.h index 3f768ad6bb..87b133a5b2 100644 --- a/libavcodec/lossless_videodsp.h +++ b/libavcodec/lossless_videodsp.h @@ -28,6 +28,8 @@ typedef struct LLVidDSPContext { void (*add_int16)(uint16_t *dst/*align 16*/, const uint16_t *src/*align 16*/, unsigned mask, int w); void (*diff_int16)(uint16_t *dst/*align 16*/, const uint16_t *src1/*align 16*/, const uint16_t *src2/*align 1*/, unsigned mask, int w); + + void (*add_hfyu_median_prediction_int16)(uint16_t *dst, const uint16_t *top, const uint16_t *diff, unsigned mask, int w, int *left, int *left_top); int (*add_hfyu_left_prediction_int16)(uint16_t *dst, const uint16_t *src, unsigned mask, int w, int left); } LLVidDSPContext;