diff --git a/libavcodec/huffyuvdec.c b/libavcodec/huffyuvdec.c index c1e029db2f..ced22f620a 100644 --- a/libavcodec/huffyuvdec.c +++ b/libavcodec/huffyuvdec.c @@ -725,6 +725,32 @@ static void add_bytes(HYuvContext *s, uint8_t *dst, uint8_t *src, int w) } } +static void add_median_prediction(HYuvContext *s, uint8_t *dst, const uint8_t *src, const uint8_t *diff, int w, int *left, int *left_top) +{ + 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; idata[plane][0]; decode_plane_bitstream(s, w, plane); - s->dsp.add_hfyu_median_prediction(p->data[plane] + fake_stride, p->data[plane], s->temp[0], w, &left, &lefttop); + add_median_prediction(s, p->data[plane] + fake_stride, p->data[plane], s->temp[0], w, &left, &lefttop); y++; for (; ydata[plane] + p->linesize[plane] * y; - s->dsp.add_hfyu_median_prediction(dst, dst - fake_stride, s->temp[0], w, &left, &lefttop); + add_median_prediction(s, dst, dst - fake_stride, s->temp[0], w, &left, &lefttop); } break; diff --git a/libavcodec/huffyuvenc.c b/libavcodec/huffyuvenc.c index 5a690c1916..5fb7d0cea7 100644 --- a/libavcodec/huffyuvenc.c +++ b/libavcodec/huffyuvenc.c @@ -153,6 +153,33 @@ static inline void sub_left_prediction_rgb24(HYuvContext *s, uint8_t *dst, *blue = src[(w - 1) * 3 + 2]; } +static void sub_median_prediction(HYuvContext *s, uint8_t *dst, const uint8_t *src1, const uint8_t *src2, int w, int *left, int *left_top) +{ + if (s->bps <= 8) { + s->dsp.sub_hfyu_median_prediction(dst, src1, src2, w , left, left_top); + } else { + int i; + uint16_t l, lt; + const uint16_t *src116 = (const uint16_t *)src1; + const uint16_t *src216 = (const uint16_t *)src2; + uint16_t *dst16 = ( uint16_t *)dst; + unsigned mask = s->n - 1; + + l = *left; + lt = *left_top; + + for(i=0; idata[plane] + p->linesize[plane] * y; - s->dsp.sub_hfyu_median_prediction(s->temp[0], dst - fake_stride, dst, w , &left, &lefttop); + sub_median_prediction(s, s->temp[0], dst - fake_stride, dst, w , &left, &lefttop); encode_plane_bitstream(s, w, plane); }