yading@10: /* yading@10: * ARM NEON optimised DSP functions yading@10: * Copyright (c) 2008 Mans Rullgard yading@10: * yading@10: * This file is part of FFmpeg. yading@10: * yading@10: * FFmpeg is free software; you can redistribute it and/or yading@10: * modify it under the terms of the GNU Lesser General Public yading@10: * License as published by the Free Software Foundation; either yading@10: * version 2.1 of the License, or (at your option) any later version. yading@10: * yading@10: * FFmpeg is distributed in the hope that it will be useful, yading@10: * but WITHOUT ANY WARRANTY; without even the implied warranty of yading@10: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU yading@10: * Lesser General Public License for more details. yading@10: * yading@10: * You should have received a copy of the GNU Lesser General Public yading@10: * License along with FFmpeg; if not, write to the Free Software yading@10: * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA yading@10: */ yading@10: yading@10: #include yading@10: yading@10: #include "libavutil/attributes.h" yading@10: #include "libavcodec/avcodec.h" yading@10: #include "dsputil_arm.h" yading@10: yading@10: void ff_simple_idct_neon(int16_t *data); yading@10: void ff_simple_idct_put_neon(uint8_t *dest, int line_size, int16_t *data); yading@10: void ff_simple_idct_add_neon(uint8_t *dest, int line_size, int16_t *data); yading@10: yading@10: void ff_clear_block_neon(int16_t *block); yading@10: void ff_clear_blocks_neon(int16_t *blocks); yading@10: yading@10: void ff_add_pixels_clamped_neon(const int16_t *, uint8_t *, int); yading@10: void ff_put_pixels_clamped_neon(const int16_t *, uint8_t *, int); yading@10: void ff_put_signed_pixels_clamped_neon(const int16_t *, uint8_t *, int); yading@10: yading@10: void ff_vector_clipf_neon(float *dst, const float *src, float min, float max, yading@10: int len); yading@10: void ff_vector_clip_int32_neon(int32_t *dst, const int32_t *src, int32_t min, yading@10: int32_t max, unsigned int len); yading@10: yading@10: int32_t ff_scalarproduct_int16_neon(const int16_t *v1, const int16_t *v2, int len); yading@10: int32_t ff_scalarproduct_and_madd_int16_neon(int16_t *v1, const int16_t *v2, yading@10: const int16_t *v3, int len, int mul); yading@10: yading@10: void ff_apply_window_int16_neon(int16_t *dst, const int16_t *src, yading@10: const int16_t *window, unsigned n); yading@10: yading@10: av_cold void ff_dsputil_init_neon(DSPContext *c, AVCodecContext *avctx) yading@10: { yading@10: const int high_bit_depth = avctx->bits_per_raw_sample > 8; yading@10: yading@10: if (!avctx->lowres && avctx->bits_per_raw_sample <= 8) { yading@10: if (avctx->idct_algo == FF_IDCT_AUTO || yading@10: avctx->idct_algo == FF_IDCT_SIMPLENEON) { yading@10: c->idct_put = ff_simple_idct_put_neon; yading@10: c->idct_add = ff_simple_idct_add_neon; yading@10: c->idct = ff_simple_idct_neon; yading@10: c->idct_permutation_type = FF_PARTTRANS_IDCT_PERM; yading@10: } yading@10: } yading@10: yading@10: if (!high_bit_depth) { yading@10: c->clear_block = ff_clear_block_neon; yading@10: c->clear_blocks = ff_clear_blocks_neon; yading@10: } yading@10: yading@10: c->add_pixels_clamped = ff_add_pixels_clamped_neon; yading@10: c->put_pixels_clamped = ff_put_pixels_clamped_neon; yading@10: c->put_signed_pixels_clamped = ff_put_signed_pixels_clamped_neon; yading@10: yading@10: c->vector_clipf = ff_vector_clipf_neon; yading@10: c->vector_clip_int32 = ff_vector_clip_int32_neon; yading@10: yading@10: c->scalarproduct_int16 = ff_scalarproduct_int16_neon; yading@10: c->scalarproduct_and_madd_int16 = ff_scalarproduct_and_madd_int16_neon; yading@10: yading@10: c->apply_window_int16 = ff_apply_window_int16_neon; yading@10: }