diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2012-08-22 16:17:31 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2012-08-22 20:30:38 +0200 |
commit | 12ad68b7e258ae8ce3b861ea1bd77c66238c436c (patch) | |
tree | 9aaa38584dbf125fe5a4d1ed7ca56fedb4727fb9 | |
parent | 729b2d02af234043dbceb9eee4c864103f6f0f6c (diff) | |
download | ffmpeg-12ad68b7e258ae8ce3b861ea1bd77c66238c436c.tar.gz |
utvideoenc: use dsp.sub_hfyu_median_prediction
Reviewed-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r-- | libavcodec/utvideoenc.c | 26 |
1 files changed, 6 insertions, 20 deletions
diff --git a/libavcodec/utvideoenc.c b/libavcodec/utvideoenc.c index 4a282fbf2b..e497333d06 100644 --- a/libavcodec/utvideoenc.c +++ b/libavcodec/utvideoenc.c @@ -262,7 +262,7 @@ static void left_predict(uint8_t *src, uint8_t *dst, int stride, } /* Write data to a plane with median prediction */ -static void median_predict(uint8_t *src, uint8_t *dst, int stride, +static void median_predict(UtvideoContext *c, uint8_t *src, uint8_t *dst, int stride, int width, int height) { int i, j; @@ -285,26 +285,12 @@ static void median_predict(uint8_t *src, uint8_t *dst, int stride, * Second line uses top prediction for the first sample, * and median for the rest. */ - C = src[-stride]; - *dst++ = src[0] - C; - A = src[0]; - for (i = 1; i < width; i++) { - B = src[i - stride]; - *dst++ = src[i] - mid_pred(A, B, (A + B - C) & 0xFF); - C = B; - A = src[i]; - } - - src += stride; + A = C = 0; /* Rest of the coded part uses median prediction */ - for (j = 2; j < height; j++) { - for (i = 0; i < width; i++) { - B = src[i - stride]; - *dst++ = src[i] - mid_pred(A, B, (A + B - C) & 0xFF); - C = B; - A = src[i]; - } + for (j = 1; j < height; j++) { + c->dsp.sub_hfyu_median_prediction(dst, src - stride, src, width, &A, &C); + dst += width; src += stride; } } @@ -413,7 +399,7 @@ static int encode_plane(AVCodecContext *avctx, uint8_t *src, for (i = 0; i < c->slices; i++) { sstart = send; send = height * (i + 1) / c->slices; - median_predict(src + sstart * stride, dst + sstart * width, + median_predict(c, src + sstart * stride, dst + sstart * width, stride, width, send - sstart); } break; |