Mercurial > cgi-bin > hgwebdir.cgi > PR > Applications > VSs > VSs__H264__App
diff libavcodec/arm/mpegvideo_iwmmxt.c @ 2:897f711a7157
rearrange to work with autoconf
| author | Nina Engelhardt <nengel@mailbox.tu-berlin.de> |
|---|---|
| date | Tue, 25 Sep 2012 15:55:33 +0200 |
| parents | |
| children |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/libavcodec/arm/mpegvideo_iwmmxt.c Tue Sep 25 15:55:33 2012 +0200 1.3 @@ -0,0 +1,120 @@ 1.4 +/* 1.5 + * copyright (c) 2004 AGAWA Koji 1.6 + * 1.7 + * This file is part of FFmpeg. 1.8 + * 1.9 + * FFmpeg is free software; you can redistribute it and/or 1.10 + * modify it under the terms of the GNU Lesser General Public 1.11 + * License as published by the Free Software Foundation; either 1.12 + * version 2.1 of the License, or (at your option) any later version. 1.13 + * 1.14 + * FFmpeg is distributed in the hope that it will be useful, 1.15 + * but WITHOUT ANY WARRANTY; without even the implied warranty of 1.16 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 1.17 + * Lesser General Public License for more details. 1.18 + * 1.19 + * You should have received a copy of the GNU Lesser General Public 1.20 + * License along with FFmpeg; if not, write to the Free Software 1.21 + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 1.22 + */ 1.23 + 1.24 +#include "libavcodec/avcodec.h" 1.25 +#include "libavcodec/dsputil.h" 1.26 +#include "libavcodec/mpegvideo.h" 1.27 +#include "mpegvideo_arm.h" 1.28 + 1.29 +static void dct_unquantize_h263_intra_iwmmxt(MpegEncContext *s, 1.30 + DCTELEM *block, int n, int qscale) 1.31 +{ 1.32 + int level, qmul, qadd; 1.33 + int nCoeffs; 1.34 + DCTELEM *block_orig = block; 1.35 + 1.36 + assert(s->block_last_index[n]>=0); 1.37 + 1.38 + qmul = qscale << 1; 1.39 + 1.40 + if (!s->h263_aic) { 1.41 + if (n < 4) 1.42 + level = block[0] * s->y_dc_scale; 1.43 + else 1.44 + level = block[0] * s->c_dc_scale; 1.45 + qadd = (qscale - 1) | 1; 1.46 + }else{ 1.47 + qadd = 0; 1.48 + level = block[0]; 1.49 + } 1.50 + if(s->ac_pred) 1.51 + nCoeffs=63; 1.52 + else 1.53 + nCoeffs= s->inter_scantable.raster_end[ s->block_last_index[n] ]; 1.54 + 1.55 + __asm__ volatile ( 1.56 +/* "movd %1, %%mm6 \n\t" //qmul */ 1.57 +/* "packssdw %%mm6, %%mm6 \n\t" */ 1.58 +/* "packssdw %%mm6, %%mm6 \n\t" */ 1.59 + "tbcsth wr6, %[qmul] \n\t" 1.60 +/* "movd %2, %%mm5 \n\t" //qadd */ 1.61 +/* "packssdw %%mm5, %%mm5 \n\t" */ 1.62 +/* "packssdw %%mm5, %%mm5 \n\t" */ 1.63 + "tbcsth wr5, %[qadd] \n\t" 1.64 + "wzero wr7 \n\t" /* "pxor %%mm7, %%mm7 \n\t" */ 1.65 + "wzero wr4 \n\t" /* "pxor %%mm4, %%mm4 \n\t" */ 1.66 + "wsubh wr7, wr5, wr7 \n\t" /* "psubw %%mm5, %%mm7 \n\t" */ 1.67 + "1: \n\t" 1.68 + "wldrd wr2, [%[block]] \n\t" /* "movq (%0, %3), %%mm0 \n\t" */ 1.69 + "wldrd wr3, [%[block], #8] \n\t" /* "movq 8(%0, %3), %%mm1 \n\t" */ 1.70 + "wmulsl wr0, wr6, wr2 \n\t" /* "pmullw %%mm6, %%mm0 \n\t" */ 1.71 + "wmulsl wr1, wr6, wr3 \n\t" /* "pmullw %%mm6, %%mm1 \n\t" */ 1.72 +/* "movq (%0, %3), %%mm2 \n\t" */ 1.73 +/* "movq 8(%0, %3), %%mm3 \n\t" */ 1.74 + "wcmpgtsh wr2, wr4, wr2 \n\t" /* "pcmpgtw %%mm4, %%mm2 \n\t" // block[i] < 0 ? -1 : 0 */ 1.75 + "wcmpgtsh wr3, wr4, wr2 \n\t" /* "pcmpgtw %%mm4, %%mm3 \n\t" // block[i] < 0 ? -1 : 0 */ 1.76 + "wxor wr0, wr2, wr0 \n\t" /* "pxor %%mm2, %%mm0 \n\t" */ 1.77 + "wxor wr1, wr3, wr1 \n\t" /* "pxor %%mm3, %%mm1 \n\t" */ 1.78 + "waddh wr0, wr7, wr0 \n\t" /* "paddw %%mm7, %%mm0 \n\t" */ 1.79 + "waddh wr1, wr7, wr1 \n\t" /* "paddw %%mm7, %%mm1 \n\t" */ 1.80 + "wxor wr2, wr0, wr2 \n\t" /* "pxor %%mm0, %%mm2 \n\t" */ 1.81 + "wxor wr3, wr1, wr3 \n\t" /* "pxor %%mm1, %%mm3 \n\t" */ 1.82 + "wcmpeqh wr0, wr7, wr0 \n\t" /* "pcmpeqw %%mm7, %%mm0 \n\t" // block[i] == 0 ? -1 : 0 */ 1.83 + "wcmpeqh wr1, wr7, wr1 \n\t" /* "pcmpeqw %%mm7, %%mm1 \n\t" // block[i] == 0 ? -1 : 0 */ 1.84 + "wandn wr0, wr2, wr0 \n\t" /* "pandn %%mm2, %%mm0 \n\t" */ 1.85 + "wandn wr1, wr3, wr1 \n\t" /* "pandn %%mm3, %%mm1 \n\t" */ 1.86 + "wstrd wr0, [%[block]] \n\t" /* "movq %%mm0, (%0, %3) \n\t" */ 1.87 + "wstrd wr1, [%[block], #8] \n\t" /* "movq %%mm1, 8(%0, %3) \n\t" */ 1.88 + "add %[block], %[block], #16 \n\t" /* "addl $16, %3 \n\t" */ 1.89 + "subs %[i], %[i], #1 \n\t" 1.90 + "bne 1b \n\t" /* "jng 1b \n\t" */ 1.91 + :[block]"+r"(block) 1.92 + :[i]"r"((nCoeffs + 8) / 8), [qmul]"r"(qmul), [qadd]"r"(qadd) 1.93 + :"memory"); 1.94 + 1.95 + block_orig[0] = level; 1.96 +} 1.97 + 1.98 +#if 0 1.99 +static void dct_unquantize_h263_inter_iwmmxt(MpegEncContext *s, 1.100 + DCTELEM *block, int n, int qscale) 1.101 +{ 1.102 + int nCoeffs; 1.103 + 1.104 + assert(s->block_last_index[n]>=0); 1.105 + 1.106 + if(s->ac_pred) 1.107 + nCoeffs=63; 1.108 + else 1.109 + nCoeffs= s->inter_scantable.raster_end[ s->block_last_index[n] ]; 1.110 + 1.111 + ippiQuantInvInter_Compact_H263_16s_I(block, nCoeffs+1, qscale); 1.112 +} 1.113 +#endif 1.114 + 1.115 +void MPV_common_init_iwmmxt(MpegEncContext *s) 1.116 +{ 1.117 + if (!(mm_flags & FF_MM_IWMMXT)) return; 1.118 + 1.119 + s->dct_unquantize_h263_intra = dct_unquantize_h263_intra_iwmmxt; 1.120 +#if 0 1.121 + s->dct_unquantize_h263_inter = dct_unquantize_h263_inter_iwmmxt; 1.122 +#endif 1.123 +}
