1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-04-02 20:35:37 +02:00

avcodec/pixlet: simplify lowpass_prediction() function

Signed-off-by: Paul B Mahol <onemda@gmail.com>
This commit is contained in:
Paul B Mahol 2016-12-24 16:42:00 +01:00
parent c4152fc42e
commit 25c4035529

View File

@ -343,21 +343,18 @@ static int read_highpass(AVCodecContext *avctx, uint8_t *ptr, int plane, AVFrame
static void lowpass_prediction(int16_t *dst, int16_t *pred, int width, int height, ptrdiff_t stride) static void lowpass_prediction(int16_t *dst, int16_t *pred, int width, int height, ptrdiff_t stride)
{ {
int16_t *next, val; int16_t val;
int i, j; int i, j;
memset(pred, 0, width * sizeof(*pred)); memset(pred, 0, width * sizeof(*pred));
for (i = 0; i < height; i++) { for (i = 0; i < height; i++) {
val = pred[0] + dst[0]; val = pred[0] + dst[0];
dst[0] = val; dst[0] = pred[0] = val;
pred[0] = val; for (j = 1; j < width; j++) {
next = dst + 2; val = pred[j] + dst[j];
for (j = 1; j < width; j++, next++) { dst[j] = pred[j] = val;
val = pred[j] + next[-1]; dst[j] += dst[j-1];
next[-1] = val;
pred[j] = val;
next[-1] += next[-2];
} }
dst += stride; dst += stride;
} }