[FFmpeg-devel] [PATCH 3/6] avcodec/vp8dsp: add VP7 idct and loop filter

Ronald S. Bultje rsbultje at gmail.com
Thu Feb 6 21:13:20 CET 2014


Hi,

On Thu, Feb 6, 2014 at 8:19 AM, Peter Ross <pross at xvid.org> wrote:

> Signed-off-by: Peter Ross <pross at xvid.org>
> ---
>  libavcodec/arm/vp8dsp.h            |   4 +-
>  libavcodec/arm/vp8dsp_init_arm.c   |   6 +-
>  libavcodec/arm/vp8dsp_init_armv6.c |   4 +-
>  libavcodec/arm/vp8dsp_init_neon.c  |   4 +-
>  libavcodec/vp8.c                   |   2 +-
>  libavcodec/vp8dsp.c                | 273
> ++++++++++++++++++++++++++-----------
>  libavcodec/vp8dsp.h                |   6 +-
>  libavcodec/x86/vp8dsp_init.c       |  20 ++-
>  8 files changed, 229 insertions(+), 90 deletions(-)

[..]

> +static const int16_t vp7_dct_matrix[4][4] =
> +{
> +    { 23170,  30274,  23170,  12540 },
> +    { 23170,  12540, -23170, -30274 },
> +    { 23170, -12540, -23170,  30274 },
> +    { 23170, -30274,  23170, -12540 }
> +};
> +
> +static void vp7_luma_dc_wht_c(int16_t block[4][4][16], int16_t dc[16])
> +{
> +    int i, j, k;
> +    short temp[4][4];
> +    int sum;
> +
> +    for (i = 0; i < 4; i++) {
> +        for (j = 0; j < 4; j++) {
> +            sum = 0;
> +            for (k = 0; k < 4; k++)
> +                sum += dc[i*4 + k] * vp7_dct_matrix[j][k];
> +            temp[i][j] = (sum >> 14);
> +        }
> +    }
> +
> +    for (i = 0; i < 4; i++) {
> +        for (j = 0; j < 4; j++) {
> +            sum = 0;
> +            for (k = 0; k < 4; k++)
> +                sum += vp7_dct_matrix[i][k] * temp[k][j];
> +            block[i][j][0] = (sum + 0x20000) >> 18;
> +        }
> +    }
> +}

[..]

> +static void vp7_idct_add_c(uint8_t *dst, int16_t block[16], ptrdiff_t
> stride)
> +{
> +    int i, j, k;
> +    short temp[4][4];
> +    int sum;
> +
> +    for (i = 0; i < 4; i++) {
> +        for (j = 0; j < 4; j++) {
> +            sum = 0;
> +            for (k = 0; k < 4; k++)
> +                sum += block[i*4 + k] * vp7_dct_matrix[j][k];
> +            temp[i][j] = (sum >> 14);
> +        }
> +    }
> +
> +    for (i = 0; i < 4; i++) {
> +        for (j = 0; j < 4; j++) {
> +            sum = 0;
> +            for (k = 0; k < 4; k++)
> +                sum += vp7_dct_matrix[i][k] * temp[k][j];
> +            dst[j] = av_clip_uint8(dst[j] + ((sum + 0x20000) >> 18));
> +        }
> +        dst += stride;
> +    }
> +}
>

Can this be rewritten as a butterfly instead of matrix-multiply? This is a
lot of operations for an idct...

Ronald


More information about the ffmpeg-devel mailing list