libavcodec/arm/h264dsp_init_arm.c
Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2010 Mans Rullgard <mans@mansr.com>
00003  *
00004  * This file is part of FFmpeg.
00005  *
00006  * FFmpeg is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU Lesser General Public
00008  * License as published by the Free Software Foundation; either
00009  * version 2.1 of the License, or (at your option) any later version.
00010  *
00011  * FFmpeg is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014  * Lesser General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU Lesser General Public
00017  * License along with FFmpeg; if not, write to the Free Software
00018  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
00019  */
00020 
00021 #include <stdint.h>
00022 
00023 #include "libavcodec/dsputil.h"
00024 #include "libavcodec/h264dsp.h"
00025 
00026 void ff_h264_v_loop_filter_luma_neon(uint8_t *pix, int stride, int alpha,
00027                                      int beta, int8_t *tc0);
00028 void ff_h264_h_loop_filter_luma_neon(uint8_t *pix, int stride, int alpha,
00029                                      int beta, int8_t *tc0);
00030 void ff_h264_v_loop_filter_chroma_neon(uint8_t *pix, int stride, int alpha,
00031                                        int beta, int8_t *tc0);
00032 void ff_h264_h_loop_filter_chroma_neon(uint8_t *pix, int stride, int alpha,
00033                                        int beta, int8_t *tc0);
00034 
00035 void ff_weight_h264_pixels_16_neon(uint8_t *dst, int stride, int height,
00036                                    int log2_den, int weight, int offset);
00037 void ff_weight_h264_pixels_8_neon(uint8_t *dst, int stride, int height,
00038                                   int log2_den, int weight, int offset);
00039 void ff_weight_h264_pixels_4_neon(uint8_t *dst, int stride, int height,
00040                                   int log2_den, int weight, int offset);
00041 
00042 void ff_biweight_h264_pixels_16_neon(uint8_t *dst, uint8_t *src, int stride,
00043                                      int height, int log2_den, int weightd,
00044                                      int weights, int offset);
00045 void ff_biweight_h264_pixels_8_neon(uint8_t *dst, uint8_t *src, int stride,
00046                                     int height, int log2_den, int weightd,
00047                                     int weights, int offset);
00048 void ff_biweight_h264_pixels_4_neon(uint8_t *dst, uint8_t *src, int stride,
00049                                     int height, int log2_den, int weightd,
00050                                     int weights, int offset);
00051 
00052 void ff_h264_idct_add_neon(uint8_t *dst, DCTELEM *block, int stride);
00053 void ff_h264_idct_dc_add_neon(uint8_t *dst, DCTELEM *block, int stride);
00054 void ff_h264_idct_add16_neon(uint8_t *dst, const int *block_offset,
00055                              DCTELEM *block, int stride,
00056                              const uint8_t nnzc[6*8]);
00057 void ff_h264_idct_add16intra_neon(uint8_t *dst, const int *block_offset,
00058                                   DCTELEM *block, int stride,
00059                                   const uint8_t nnzc[6*8]);
00060 void ff_h264_idct_add8_neon(uint8_t **dest, const int *block_offset,
00061                             DCTELEM *block, int stride,
00062                             const uint8_t nnzc[6*8]);
00063 
00064 void ff_h264_idct8_add_neon(uint8_t *dst, DCTELEM *block, int stride);
00065 void ff_h264_idct8_dc_add_neon(uint8_t *dst, DCTELEM *block, int stride);
00066 void ff_h264_idct8_add4_neon(uint8_t *dst, const int *block_offset,
00067                              DCTELEM *block, int stride,
00068                              const uint8_t nnzc[6*8]);
00069 
00070 static void ff_h264dsp_init_neon(H264DSPContext *c, const int bit_depth, const int chroma_format_idc)
00071 {
00072     if (bit_depth == 8) {
00073     c->h264_v_loop_filter_luma   = ff_h264_v_loop_filter_luma_neon;
00074     c->h264_h_loop_filter_luma   = ff_h264_h_loop_filter_luma_neon;
00075     if(chroma_format_idc == 1){
00076     c->h264_v_loop_filter_chroma = ff_h264_v_loop_filter_chroma_neon;
00077     c->h264_h_loop_filter_chroma = ff_h264_h_loop_filter_chroma_neon;
00078     }
00079 
00080     c->weight_h264_pixels_tab[0] = ff_weight_h264_pixels_16_neon;
00081     c->weight_h264_pixels_tab[1] = ff_weight_h264_pixels_8_neon;
00082     c->weight_h264_pixels_tab[2] = ff_weight_h264_pixels_4_neon;
00083 
00084     c->biweight_h264_pixels_tab[0] = ff_biweight_h264_pixels_16_neon;
00085     c->biweight_h264_pixels_tab[1] = ff_biweight_h264_pixels_8_neon;
00086     c->biweight_h264_pixels_tab[2] = ff_biweight_h264_pixels_4_neon;
00087 
00088     c->h264_idct_add        = ff_h264_idct_add_neon;
00089     c->h264_idct_dc_add     = ff_h264_idct_dc_add_neon;
00090     c->h264_idct_add16      = ff_h264_idct_add16_neon;
00091     c->h264_idct_add16intra = ff_h264_idct_add16intra_neon;
00092     if (chroma_format_idc == 1)
00093         c->h264_idct_add8   = ff_h264_idct_add8_neon;
00094     c->h264_idct8_add       = ff_h264_idct8_add_neon;
00095     c->h264_idct8_dc_add    = ff_h264_idct8_dc_add_neon;
00096     c->h264_idct8_add4      = ff_h264_idct8_add4_neon;
00097     }
00098 }
00099 
00100 void ff_h264dsp_init_arm(H264DSPContext *c, const int bit_depth, const int chroma_format_idc)
00101 {
00102     if (HAVE_NEON) ff_h264dsp_init_neon(c, bit_depth, chroma_format_idc);
00103 }