1/**
2 * @file
3 * VP6 DSP-oriented functions
4 *
5 * Copyright (C) 2006  Aurelien Jacobs <aurel@gnuage.org>
6 *
7 * This file is part of FFmpeg.
8 *
9 * FFmpeg is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License as published by the Free Software Foundation; either
12 * version 2.1 of the License, or (at your option) any later version.
13 *
14 * FFmpeg is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17 * Lesser General Public License for more details.
18 *
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with FFmpeg; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22 */
23
24#include "libavutil/common.h"
25#include "dsputil.h"
26
27
28void ff_vp6_filter_diag4_c(uint8_t *dst, uint8_t *src, int stride,
29                           const int16_t *h_weights, const int16_t *v_weights)
30{
31    int x, y;
32    int tmp[8*11];
33    int *t = tmp;
34
35    src -= stride;
36
37    for (y=0; y<11; y++) {
38        for (x=0; x<8; x++) {
39            t[x] = av_clip_uint8((  src[x-1] * h_weights[0]
40                               + src[x  ] * h_weights[1]
41                               + src[x+1] * h_weights[2]
42                               + src[x+2] * h_weights[3] + 64) >> 7);
43        }
44        src += stride;
45        t += 8;
46    }
47
48    t = tmp + 8;
49    for (y=0; y<8; y++) {
50        for (x=0; x<8; x++) {
51            dst[x] = av_clip_uint8((  t[x-8 ] * v_weights[0]
52                                 + t[x   ] * v_weights[1]
53                                 + t[x+8 ] * v_weights[2]
54                                 + t[x+16] * v_weights[3] + 64) >> 7);
55        }
56        dst += stride;
57        t += 8;
58    }
59}
60