dsputil_init_neon.c 3.21 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
/*
 * ARM NEON optimised DSP functions
 * Copyright (c) 2008 Mans Rullgard <mans@mansr.com>
 *
 * This file is part of FFmpeg.
 *
 * FFmpeg is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * FFmpeg is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with FFmpeg; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 */

#include <stdint.h>

24
#include "libavutil/attributes.h"
25
#include "libavcodec/avcodec.h"
26 27
#include "dsputil_arm.h"

Diego Biurrun's avatar
Diego Biurrun committed
28 29 30
void ff_simple_idct_neon(int16_t *data);
void ff_simple_idct_put_neon(uint8_t *dest, int line_size, int16_t *data);
void ff_simple_idct_add_neon(uint8_t *dest, int line_size, int16_t *data);
31

Diego Biurrun's avatar
Diego Biurrun committed
32 33
void ff_clear_block_neon(int16_t *block);
void ff_clear_blocks_neon(int16_t *blocks);
34

Diego Biurrun's avatar
Diego Biurrun committed
35 36 37
void ff_add_pixels_clamped_neon(const int16_t *, uint8_t *, int);
void ff_put_pixels_clamped_neon(const int16_t *, uint8_t *, int);
void ff_put_signed_pixels_clamped_neon(const int16_t *, uint8_t *, int);
38

39 40
void ff_vector_clipf_neon(float *dst, const float *src, float min, float max,
                          int len);
41 42
void ff_vector_clip_int32_neon(int32_t *dst, const int32_t *src, int32_t min,
                               int32_t max, unsigned int len);
43

44
int32_t ff_scalarproduct_int16_neon(const int16_t *v1, const int16_t *v2, int len);
45 46
int32_t ff_scalarproduct_and_madd_int16_neon(int16_t *v1, const int16_t *v2,
                                             const int16_t *v3, int len, int mul);
47

48
void ff_apply_window_int16_neon(int16_t *dst, const int16_t *src,
49
                                const int16_t *window, unsigned n);
50

51
av_cold void ff_dsputil_init_neon(DSPContext *c, AVCodecContext *avctx)
52
{
53
    const int high_bit_depth = avctx->bits_per_raw_sample > 8;
54

Michael Niedermayer's avatar
Michael Niedermayer committed
55
    if (!avctx->lowres && avctx->bits_per_raw_sample <= 8) {
56 57
        if (avctx->idct_algo == FF_IDCT_AUTO ||
            avctx->idct_algo == FF_IDCT_SIMPLENEON) {
Måns Rullgård's avatar
Måns Rullgård committed
58 59 60
            c->idct_put              = ff_simple_idct_put_neon;
            c->idct_add              = ff_simple_idct_add_neon;
            c->idct                  = ff_simple_idct_neon;
61 62 63 64
            c->idct_permutation_type = FF_PARTTRANS_IDCT_PERM;
        }
    }

65
    if (!high_bit_depth) {
66 67
        c->clear_block  = ff_clear_block_neon;
        c->clear_blocks = ff_clear_blocks_neon;
68
    }
69

70
    c->add_pixels_clamped = ff_add_pixels_clamped_neon;
71
    c->put_pixels_clamped = ff_put_pixels_clamped_neon;
72
    c->put_signed_pixels_clamped = ff_put_signed_pixels_clamped_neon;
73

Måns Rullgård's avatar
Måns Rullgård committed
74
    c->vector_clipf               = ff_vector_clipf_neon;
75
    c->vector_clip_int32          = ff_vector_clip_int32_neon;
76

77 78
    c->scalarproduct_int16 = ff_scalarproduct_int16_neon;
    c->scalarproduct_and_madd_int16 = ff_scalarproduct_and_madd_int16_neon;
79 80

    c->apply_window_int16 = ff_apply_window_int16_neon;
81
}