• Main Page
  • Related Pages
  • Modules
  • Data Structures
  • Files
  • File List
  • Globals

libavcodec/arm/dsputil_arm.c

Go to the documentation of this file.
00001 /*
00002  * ARM optimized DSP utils
00003  * Copyright (c) 2001 Lionel Ulmer
00004  *
00005  * This file is part of FFmpeg.
00006  *
00007  * FFmpeg is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU Lesser General Public
00009  * License as published by the Free Software Foundation; either
00010  * version 2.1 of the License, or (at your option) any later version.
00011  *
00012  * FFmpeg is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015  * Lesser General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU Lesser General Public
00018  * License along with FFmpeg; if not, write to the Free Software
00019  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
00020  */
00021 
00022 #include "libavcodec/dsputil.h"
00023 #if HAVE_IPP
00024 #include <ipp.h>
00025 #endif
00026 
00027 void dsputil_init_iwmmxt(DSPContext* c, AVCodecContext *avctx);
00028 void ff_float_init_arm_vfp(DSPContext* c, AVCodecContext *avctx);
00029 void ff_dsputil_init_neon(DSPContext *c, AVCodecContext *avctx);
00030 
00031 void j_rev_dct_ARM(DCTELEM *data);
00032 void simple_idct_ARM(DCTELEM *data);
00033 
00034 void simple_idct_armv5te(DCTELEM *data);
00035 void simple_idct_put_armv5te(uint8_t *dest, int line_size, DCTELEM *data);
00036 void simple_idct_add_armv5te(uint8_t *dest, int line_size, DCTELEM *data);
00037 
00038 void ff_simple_idct_armv6(DCTELEM *data);
00039 void ff_simple_idct_put_armv6(uint8_t *dest, int line_size, DCTELEM *data);
00040 void ff_simple_idct_add_armv6(uint8_t *dest, int line_size, DCTELEM *data);
00041 
00042 void ff_simple_idct_neon(DCTELEM *data);
00043 void ff_simple_idct_put_neon(uint8_t *dest, int line_size, DCTELEM *data);
00044 void ff_simple_idct_add_neon(uint8_t *dest, int line_size, DCTELEM *data);
00045 
00046 void ff_vp3_idct_neon(DCTELEM *data);
00047 void ff_vp3_idct_put_neon(uint8_t *dest, int line_size, DCTELEM *data);
00048 void ff_vp3_idct_add_neon(uint8_t *dest, int line_size, DCTELEM *data);
00049 
00050 /* XXX: local hack */
00051 static void (*ff_put_pixels_clamped)(const DCTELEM *block, uint8_t *pixels, int line_size);
00052 static void (*ff_add_pixels_clamped)(const DCTELEM *block, uint8_t *pixels, int line_size);
00053 
00054 void put_pixels8_arm(uint8_t *block, const uint8_t *pixels, int line_size, int h);
00055 void put_pixels8_x2_arm(uint8_t *block, const uint8_t *pixels, int line_size, int h);
00056 void put_pixels8_y2_arm(uint8_t *block, const uint8_t *pixels, int line_size, int h);
00057 void put_pixels8_xy2_arm(uint8_t *block, const uint8_t *pixels, int line_size, int h);
00058 
00059 void put_no_rnd_pixels8_x2_arm(uint8_t *block, const uint8_t *pixels, int line_size, int h);
00060 void put_no_rnd_pixels8_y2_arm(uint8_t *block, const uint8_t *pixels, int line_size, int h);
00061 void put_no_rnd_pixels8_xy2_arm(uint8_t *block, const uint8_t *pixels, int line_size, int h);
00062 
00063 void put_pixels16_arm(uint8_t *block, const uint8_t *pixels, int line_size, int h);
00064 
00065 void ff_prefetch_arm(void *mem, int stride, int h);
00066 
00067 CALL_2X_PIXELS(put_pixels16_x2_arm , put_pixels8_x2_arm , 8)
00068 CALL_2X_PIXELS(put_pixels16_y2_arm , put_pixels8_y2_arm , 8)
00069 CALL_2X_PIXELS(put_pixels16_xy2_arm, put_pixels8_xy2_arm, 8)
00070 CALL_2X_PIXELS(put_no_rnd_pixels16_x2_arm , put_no_rnd_pixels8_x2_arm , 8)
00071 CALL_2X_PIXELS(put_no_rnd_pixels16_y2_arm , put_no_rnd_pixels8_y2_arm , 8)
00072 CALL_2X_PIXELS(put_no_rnd_pixels16_xy2_arm, put_no_rnd_pixels8_xy2_arm, 8)
00073 
00074 void ff_add_pixels_clamped_ARM(short *block, unsigned char *dest,
00075                                       int line_size);
00076 
00077 /* XXX: those functions should be suppressed ASAP when all IDCTs are
00078    converted */
00079 static void j_rev_dct_ARM_put(uint8_t *dest, int line_size, DCTELEM *block)
00080 {
00081     j_rev_dct_ARM (block);
00082     ff_put_pixels_clamped(block, dest, line_size);
00083 }
00084 static void j_rev_dct_ARM_add(uint8_t *dest, int line_size, DCTELEM *block)
00085 {
00086     j_rev_dct_ARM (block);
00087     ff_add_pixels_clamped(block, dest, line_size);
00088 }
00089 static void simple_idct_ARM_put(uint8_t *dest, int line_size, DCTELEM *block)
00090 {
00091     simple_idct_ARM (block);
00092     ff_put_pixels_clamped(block, dest, line_size);
00093 }
00094 static void simple_idct_ARM_add(uint8_t *dest, int line_size, DCTELEM *block)
00095 {
00096     simple_idct_ARM (block);
00097     ff_add_pixels_clamped(block, dest, line_size);
00098 }
00099 
00100 #if HAVE_IPP
00101 static void simple_idct_ipp(DCTELEM *block)
00102 {
00103     ippiDCT8x8Inv_Video_16s_C1I(block);
00104 }
00105 static void simple_idct_ipp_put(uint8_t *dest, int line_size, DCTELEM *block)
00106 {
00107     ippiDCT8x8Inv_Video_16s8u_C1R(block, dest, line_size);
00108 }
00109 
00110 void add_pixels_clamped_iwmmxt(const DCTELEM *block, uint8_t *pixels, int line_size);
00111 
00112 static void simple_idct_ipp_add(uint8_t *dest, int line_size, DCTELEM *block)
00113 {
00114     ippiDCT8x8Inv_Video_16s_C1I(block);
00115 #if HAVE_IWMMXT
00116     add_pixels_clamped_iwmmxt(block, dest, line_size);
00117 #else
00118     ff_add_pixels_clamped_ARM(block, dest, line_size);
00119 #endif
00120 }
00121 #endif
00122 
00123 int mm_support(void)
00124 {
00125     return HAVE_IWMMXT * FF_MM_IWMMXT;
00126 }
00127 
00128 void dsputil_init_arm(DSPContext* c, AVCodecContext *avctx)
00129 {
00130     int idct_algo= avctx->idct_algo;
00131 
00132     ff_put_pixels_clamped = c->put_pixels_clamped;
00133     ff_add_pixels_clamped = c->add_pixels_clamped;
00134 
00135     if (avctx->lowres == 0) {
00136         if(idct_algo == FF_IDCT_AUTO){
00137 #if   HAVE_IPP
00138             idct_algo = FF_IDCT_IPP;
00139 #elif HAVE_NEON
00140             idct_algo = FF_IDCT_SIMPLENEON;
00141 #elif HAVE_ARMV6
00142             idct_algo = FF_IDCT_SIMPLEARMV6;
00143 #elif HAVE_ARMV5TE
00144             idct_algo = FF_IDCT_SIMPLEARMV5TE;
00145 #else
00146             idct_algo = FF_IDCT_ARM;
00147 #endif
00148         }
00149 
00150         if(idct_algo==FF_IDCT_ARM){
00151             c->idct_put= j_rev_dct_ARM_put;
00152             c->idct_add= j_rev_dct_ARM_add;
00153             c->idct    = j_rev_dct_ARM;
00154             c->idct_permutation_type= FF_LIBMPEG2_IDCT_PERM;
00155         } else if (idct_algo==FF_IDCT_SIMPLEARM){
00156             c->idct_put= simple_idct_ARM_put;
00157             c->idct_add= simple_idct_ARM_add;
00158             c->idct    = simple_idct_ARM;
00159             c->idct_permutation_type= FF_NO_IDCT_PERM;
00160 #if HAVE_ARMV6
00161         } else if (idct_algo==FF_IDCT_SIMPLEARMV6){
00162             c->idct_put= ff_simple_idct_put_armv6;
00163             c->idct_add= ff_simple_idct_add_armv6;
00164             c->idct    = ff_simple_idct_armv6;
00165             c->idct_permutation_type= FF_LIBMPEG2_IDCT_PERM;
00166 #endif
00167 #if HAVE_ARMV5TE
00168         } else if (idct_algo==FF_IDCT_SIMPLEARMV5TE){
00169             c->idct_put= simple_idct_put_armv5te;
00170             c->idct_add= simple_idct_add_armv5te;
00171             c->idct    = simple_idct_armv5te;
00172             c->idct_permutation_type = FF_NO_IDCT_PERM;
00173 #endif
00174 #if HAVE_IPP
00175         } else if (idct_algo==FF_IDCT_IPP){
00176             c->idct_put= simple_idct_ipp_put;
00177             c->idct_add= simple_idct_ipp_add;
00178             c->idct    = simple_idct_ipp;
00179             c->idct_permutation_type= FF_NO_IDCT_PERM;
00180 #endif
00181 #if HAVE_NEON
00182         } else if (idct_algo==FF_IDCT_SIMPLENEON){
00183             c->idct_put= ff_simple_idct_put_neon;
00184             c->idct_add= ff_simple_idct_add_neon;
00185             c->idct    = ff_simple_idct_neon;
00186             c->idct_permutation_type = FF_PARTTRANS_IDCT_PERM;
00187         } else if ((CONFIG_VP3_DECODER || CONFIG_VP5_DECODER || CONFIG_VP6_DECODER || CONFIG_THEORA_DECODER) &&
00188                    idct_algo==FF_IDCT_VP3){
00189             c->idct_put= ff_vp3_idct_put_neon;
00190             c->idct_add= ff_vp3_idct_add_neon;
00191             c->idct    = ff_vp3_idct_neon;
00192             c->idct_permutation_type = FF_TRANSPOSE_IDCT_PERM;
00193 #endif
00194         }
00195     }
00196 
00197     c->put_pixels_tab[0][0] = put_pixels16_arm;
00198     c->put_pixels_tab[0][1] = put_pixels16_x2_arm;
00199     c->put_pixels_tab[0][2] = put_pixels16_y2_arm;
00200     c->put_pixels_tab[0][3] = put_pixels16_xy2_arm;
00201     c->put_no_rnd_pixels_tab[0][0] = put_pixels16_arm;
00202     c->put_no_rnd_pixels_tab[0][1] = put_no_rnd_pixels16_x2_arm;
00203     c->put_no_rnd_pixels_tab[0][2] = put_no_rnd_pixels16_y2_arm;
00204     c->put_no_rnd_pixels_tab[0][3] = put_no_rnd_pixels16_xy2_arm;
00205     c->put_pixels_tab[1][0] = put_pixels8_arm;
00206     c->put_pixels_tab[1][1] = put_pixels8_x2_arm;
00207     c->put_pixels_tab[1][2] = put_pixels8_y2_arm;
00208     c->put_pixels_tab[1][3] = put_pixels8_xy2_arm;
00209     c->put_no_rnd_pixels_tab[1][0] = put_pixels8_arm;
00210     c->put_no_rnd_pixels_tab[1][1] = put_no_rnd_pixels8_x2_arm;
00211     c->put_no_rnd_pixels_tab[1][2] = put_no_rnd_pixels8_y2_arm;
00212     c->put_no_rnd_pixels_tab[1][3] = put_no_rnd_pixels8_xy2_arm;
00213 
00214 #if HAVE_ARMV5TE
00215     c->prefetch = ff_prefetch_arm;
00216 #endif
00217 
00218 #if HAVE_IWMMXT
00219     dsputil_init_iwmmxt(c, avctx);
00220 #endif
00221 #if HAVE_ARMVFP
00222     ff_float_init_arm_vfp(c, avctx);
00223 #endif
00224 #if HAVE_NEON
00225     ff_dsputil_init_neon(c, avctx);
00226 #endif
00227 }

Generated on Sat Feb 16 2013 09:23:11 for ffmpeg by  doxygen 1.7.1