2010-03-16 02:17:00 +01:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2010 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>
|
|
|
|
|
2013-02-01 10:31:59 +01:00
|
|
|
#include "libavutil/attributes.h"
|
2012-04-21 16:31:10 +02:00
|
|
|
#include "libavutil/arm/cpu.h"
|
2010-03-16 02:17:00 +01:00
|
|
|
#include "libavcodec/h264dsp.h"
|
2014-07-21 17:25:48 +02:00
|
|
|
#include "libavcodec/arm/startcode.h"
|
2013-08-05 14:12:48 +02:00
|
|
|
|
2010-03-16 02:17:00 +01:00
|
|
|
void ff_h264_v_loop_filter_luma_neon(uint8_t *pix, int stride, int alpha,
|
|
|
|
int beta, int8_t *tc0);
|
|
|
|
void ff_h264_h_loop_filter_luma_neon(uint8_t *pix, int stride, int alpha,
|
|
|
|
int beta, int8_t *tc0);
|
|
|
|
void ff_h264_v_loop_filter_chroma_neon(uint8_t *pix, int stride, int alpha,
|
|
|
|
int beta, int8_t *tc0);
|
|
|
|
void ff_h264_h_loop_filter_chroma_neon(uint8_t *pix, int stride, int alpha,
|
|
|
|
int beta, int8_t *tc0);
|
|
|
|
|
2011-10-21 09:00:39 +02:00
|
|
|
void ff_weight_h264_pixels_16_neon(uint8_t *dst, int stride, int height,
|
|
|
|
int log2_den, int weight, int offset);
|
|
|
|
void ff_weight_h264_pixels_8_neon(uint8_t *dst, int stride, int height,
|
|
|
|
int log2_den, int weight, int offset);
|
|
|
|
void ff_weight_h264_pixels_4_neon(uint8_t *dst, int stride, int height,
|
|
|
|
int log2_den, int weight, int offset);
|
2010-03-16 02:17:00 +01:00
|
|
|
|
2011-10-21 09:00:39 +02:00
|
|
|
void ff_biweight_h264_pixels_16_neon(uint8_t *dst, uint8_t *src, int stride,
|
|
|
|
int height, int log2_den, int weightd,
|
|
|
|
int weights, int offset);
|
|
|
|
void ff_biweight_h264_pixels_8_neon(uint8_t *dst, uint8_t *src, int stride,
|
|
|
|
int height, int log2_den, int weightd,
|
|
|
|
int weights, int offset);
|
|
|
|
void ff_biweight_h264_pixels_4_neon(uint8_t *dst, uint8_t *src, int stride,
|
|
|
|
int height, int log2_den, int weightd,
|
|
|
|
int weights, int offset);
|
2010-03-16 02:17:00 +01:00
|
|
|
|
2013-01-20 01:02:29 +01:00
|
|
|
void ff_h264_idct_add_neon(uint8_t *dst, int16_t *block, int stride);
|
|
|
|
void ff_h264_idct_dc_add_neon(uint8_t *dst, int16_t *block, int stride);
|
2010-03-16 02:17:00 +01:00
|
|
|
void ff_h264_idct_add16_neon(uint8_t *dst, const int *block_offset,
|
2013-01-20 01:02:29 +01:00
|
|
|
int16_t *block, int stride,
|
2010-03-16 02:17:00 +01:00
|
|
|
const uint8_t nnzc[6*8]);
|
|
|
|
void ff_h264_idct_add16intra_neon(uint8_t *dst, const int *block_offset,
|
2013-01-20 01:02:29 +01:00
|
|
|
int16_t *block, int stride,
|
2010-03-16 02:17:00 +01:00
|
|
|
const uint8_t nnzc[6*8]);
|
|
|
|
void ff_h264_idct_add8_neon(uint8_t **dest, const int *block_offset,
|
2013-01-20 01:02:29 +01:00
|
|
|
int16_t *block, int stride,
|
2010-03-16 02:17:00 +01:00
|
|
|
const uint8_t nnzc[6*8]);
|
|
|
|
|
2013-01-20 01:02:29 +01:00
|
|
|
void ff_h264_idct8_add_neon(uint8_t *dst, int16_t *block, int stride);
|
|
|
|
void ff_h264_idct8_dc_add_neon(uint8_t *dst, int16_t *block, int stride);
|
2010-08-05 21:45:57 +02:00
|
|
|
void ff_h264_idct8_add4_neon(uint8_t *dst, const int *block_offset,
|
2013-01-20 01:02:29 +01:00
|
|
|
int16_t *block, int stride,
|
2010-08-05 21:45:57 +02:00
|
|
|
const uint8_t nnzc[6*8]);
|
|
|
|
|
2013-04-20 21:49:09 +02:00
|
|
|
static av_cold void h264dsp_init_neon(H264DSPContext *c, const int bit_depth,
|
|
|
|
const int chroma_format_idc)
|
2010-03-16 02:17:00 +01:00
|
|
|
{
|
2012-08-07 13:26:40 +02:00
|
|
|
#if HAVE_NEON
|
2011-03-29 17:48:59 +02:00
|
|
|
if (bit_depth == 8) {
|
2014-01-07 10:15:49 +01:00
|
|
|
c->h264_v_loop_filter_luma = ff_h264_v_loop_filter_luma_neon;
|
|
|
|
c->h264_h_loop_filter_luma = ff_h264_h_loop_filter_luma_neon;
|
2014-01-08 05:13:25 +01:00
|
|
|
if(chroma_format_idc == 1){
|
2014-01-07 10:15:49 +01:00
|
|
|
c->h264_v_loop_filter_chroma = ff_h264_v_loop_filter_chroma_neon;
|
|
|
|
c->h264_h_loop_filter_chroma = ff_h264_h_loop_filter_chroma_neon;
|
2014-01-08 05:13:25 +01:00
|
|
|
}
|
2010-03-16 02:17:00 +01:00
|
|
|
|
2014-01-07 10:15:49 +01:00
|
|
|
c->weight_h264_pixels_tab[0] = ff_weight_h264_pixels_16_neon;
|
|
|
|
c->weight_h264_pixels_tab[1] = ff_weight_h264_pixels_8_neon;
|
|
|
|
c->weight_h264_pixels_tab[2] = ff_weight_h264_pixels_4_neon;
|
2010-03-16 02:17:00 +01:00
|
|
|
|
2014-01-07 10:15:49 +01:00
|
|
|
c->biweight_h264_pixels_tab[0] = ff_biweight_h264_pixels_16_neon;
|
|
|
|
c->biweight_h264_pixels_tab[1] = ff_biweight_h264_pixels_8_neon;
|
|
|
|
c->biweight_h264_pixels_tab[2] = ff_biweight_h264_pixels_4_neon;
|
2010-03-16 02:17:00 +01:00
|
|
|
|
2014-01-07 10:15:49 +01:00
|
|
|
c->h264_idct_add = ff_h264_idct_add_neon;
|
|
|
|
c->h264_idct_dc_add = ff_h264_idct_dc_add_neon;
|
|
|
|
c->h264_idct_add16 = ff_h264_idct_add16_neon;
|
|
|
|
c->h264_idct_add16intra = ff_h264_idct_add16intra_neon;
|
|
|
|
if (chroma_format_idc <= 1)
|
|
|
|
c->h264_idct_add8 = ff_h264_idct_add8_neon;
|
|
|
|
c->h264_idct8_add = ff_h264_idct8_add_neon;
|
|
|
|
c->h264_idct8_dc_add = ff_h264_idct8_dc_add_neon;
|
|
|
|
c->h264_idct8_add4 = ff_h264_idct8_add4_neon;
|
2011-03-29 17:48:59 +02:00
|
|
|
}
|
2012-08-07 13:26:40 +02:00
|
|
|
#endif // HAVE_NEON
|
2010-03-16 02:17:00 +01:00
|
|
|
}
|
|
|
|
|
2013-02-01 10:31:59 +01:00
|
|
|
av_cold void ff_h264dsp_init_arm(H264DSPContext *c, const int bit_depth,
|
|
|
|
const int chroma_format_idc)
|
2010-03-16 02:17:00 +01:00
|
|
|
{
|
2012-04-21 16:31:10 +02:00
|
|
|
int cpu_flags = av_get_cpu_flags();
|
|
|
|
|
2014-07-21 15:53:06 +02:00
|
|
|
if (have_setend(cpu_flags))
|
2014-07-21 17:25:48 +02:00
|
|
|
c->startcode_find_candidate = ff_startcode_find_candidate_armv6;
|
2012-04-21 16:31:10 +02:00
|
|
|
if (have_neon(cpu_flags))
|
2013-04-20 21:49:09 +02:00
|
|
|
h264dsp_init_neon(c, bit_depth, chroma_format_idc);
|
2010-03-16 02:17:00 +01:00
|
|
|
}
|