00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #include "libavutil/cpu.h"
00022 #include "libavcodec/avcodec.h"
00023 #include "libavcodec/dsputil.h"
00024 #include "libavcodec/mpegvideo.h"
00025 #include "mpegvideo_arm.h"
00026
00027 static void dct_unquantize_h263_intra_iwmmxt(MpegEncContext *s,
00028 DCTELEM *block, int n, int qscale)
00029 {
00030 int level, qmul, qadd;
00031 int nCoeffs;
00032 DCTELEM *block_orig = block;
00033
00034 assert(s->block_last_index[n]>=0);
00035
00036 qmul = qscale << 1;
00037
00038 if (!s->h263_aic) {
00039 if (n < 4)
00040 level = block[0] * s->y_dc_scale;
00041 else
00042 level = block[0] * s->c_dc_scale;
00043 qadd = (qscale - 1) | 1;
00044 }else{
00045 qadd = 0;
00046 level = block[0];
00047 }
00048 if(s->ac_pred)
00049 nCoeffs=63;
00050 else
00051 nCoeffs= s->inter_scantable.raster_end[ s->block_last_index[n] ];
00052
00053 __asm__ volatile (
00054
00055
00056
00057 "tbcsth wr6, %[qmul] \n\t"
00058
00059
00060
00061 "tbcsth wr5, %[qadd] \n\t"
00062 "wzero wr7 \n\t"
00063 "wzero wr4 \n\t"
00064 "wsubh wr7, wr5, wr7 \n\t"
00065 "1: \n\t"
00066 "wldrd wr2, [%[block]] \n\t"
00067 "wldrd wr3, [%[block], #8] \n\t"
00068 "wmulsl wr0, wr6, wr2 \n\t"
00069 "wmulsl wr1, wr6, wr3 \n\t"
00070
00071
00072 "wcmpgtsh wr2, wr4, wr2 \n\t"
00073 "wcmpgtsh wr3, wr4, wr2 \n\t"
00074 "wxor wr0, wr2, wr0 \n\t"
00075 "wxor wr1, wr3, wr1 \n\t"
00076 "waddh wr0, wr7, wr0 \n\t"
00077 "waddh wr1, wr7, wr1 \n\t"
00078 "wxor wr2, wr0, wr2 \n\t"
00079 "wxor wr3, wr1, wr3 \n\t"
00080 "wcmpeqh wr0, wr7, wr0 \n\t"
00081 "wcmpeqh wr1, wr7, wr1 \n\t"
00082 "wandn wr0, wr2, wr0 \n\t"
00083 "wandn wr1, wr3, wr1 \n\t"
00084 "wstrd wr0, [%[block]] \n\t"
00085 "wstrd wr1, [%[block], #8] \n\t"
00086 "add %[block], %[block], #16 \n\t"
00087 "subs %[i], %[i], #1 \n\t"
00088 "bne 1b \n\t"
00089 :[block]"+r"(block)
00090 :[i]"r"((nCoeffs + 8) / 8), [qmul]"r"(qmul), [qadd]"r"(qadd)
00091 :"memory");
00092
00093 block_orig[0] = level;
00094 }
00095
00096 void MPV_common_init_iwmmxt(MpegEncContext *s)
00097 {
00098 if (!(mm_flags & AV_CPU_FLAG_IWMMXT)) return;
00099
00100 s->dct_unquantize_h263_intra = dct_unquantize_h263_intra_iwmmxt;
00101 }