mpegvideo_iwmmxt.c
资源名称:tcpmp.rar [点击查看]
上传用户:wstnjxml
上传日期:2014-04-03
资源大小:7248k
文件大小:4k
源码类别:
Windows CE
开发平台:
C/C++
- #include "../dsputil.h"
- #include "../mpegvideo.h"
- #include "../avcodec.h"
- static void dct_unquantize_h263_intra_iwmmxt(MpegEncContext *s,
- DCTELEM *block, int n, int qscale)
- {
- int level, qmul, qadd;
- int nCoeffs;
- DCTELEM *block_orig = block;
- assert(s->block_last_index[n]>=0);
- qmul = qscale << 1;
- if (!s->h263_aic) {
- if (n < 4)
- level = block[0] * s->y_dc_scale;
- else
- level = block[0] * s->c_dc_scale;
- qadd = (qscale - 1) | 1;
- }else{
- qadd = 0;
- level = block[0];
- }
- if(s->ac_pred)
- nCoeffs=63;
- else
- nCoeffs= s->inter_scantable.raster_end[ s->block_last_index[n] ];
- __asm__ __volatile__ (
- /* "movd %1, %%mm6 nt" //qmul */
- /* "packssdw %%mm6, %%mm6 nt" */
- /* "packssdw %%mm6, %%mm6 nt" */
- "tbcsth wr6, %[qmul] nt"
- /* "movd %2, %%mm5 nt" //qadd */
- /* "packssdw %%mm5, %%mm5 nt" */
- /* "packssdw %%mm5, %%mm5 nt" */
- "tbcsth wr5, %[qadd] nt"
- "wzero wr7 nt" /* "pxor %%mm7, %%mm7 nt" */
- "wzero wr4 nt" /* "pxor %%mm4, %%mm4 nt" */
- "wsubh wr7, wr5, wr7 nt" /* "psubw %%mm5, %%mm7 nt" */
- "1: nt"
- "wldrd wr2, [%[block]] nt" /* "movq (%0, %3), %%mm0 nt" */
- "wldrd wr3, [%[block], #8] nt" /* "movq 8(%0, %3), %%mm1 nt" */
- "wmulsl wr0, wr6, wr2 nt" /* "pmullw %%mm6, %%mm0 nt" */
- "wmulsl wr1, wr6, wr3 nt" /* "pmullw %%mm6, %%mm1 nt" */
- /* "movq (%0, %3), %%mm2 nt" */
- /* "movq 8(%0, %3), %%mm3 nt" */
- "wcmpgtsh wr2, wr4, wr2 nt" /* "pcmpgtw %%mm4, %%mm2 nt" // block[i] < 0 ? -1 : 0 */
- "wcmpgtsh wr3, wr4, wr2 nt" /* "pcmpgtw %%mm4, %%mm3 nt" // block[i] < 0 ? -1 : 0 */
- "wxor wr0, wr2, wr0 nt" /* "pxor %%mm2, %%mm0 nt" */
- "wxor wr1, wr3, wr1 nt" /* "pxor %%mm3, %%mm1 nt" */
- "waddh wr0, wr7, wr0 nt" /* "paddw %%mm7, %%mm0 nt" */
- "waddh wr1, wr7, wr1 nt" /* "paddw %%mm7, %%mm1 nt" */
- "wxor wr2, wr0, wr2 nt" /* "pxor %%mm0, %%mm2 nt" */
- "wxor wr3, wr1, wr3 nt" /* "pxor %%mm1, %%mm3 nt" */
- "wcmpeqh wr0, wr7, wr0 nt" /* "pcmpeqw %%mm7, %%mm0 nt" // block[i] == 0 ? -1 : 0 */
- "wcmpeqh wr1, wr7, wr1 nt" /* "pcmpeqw %%mm7, %%mm1 nt" // block[i] == 0 ? -1 : 0 */
- "wandn wr0, wr2, wr0 nt" /* "pandn %%mm2, %%mm0 nt" */
- "wandn wr1, wr3, wr1 nt" /* "pandn %%mm3, %%mm1 nt" */
- "wstrd wr0, [%[block]] nt" /* "movq %%mm0, (%0, %3) nt" */
- "wstrd wr1, [%[block], #8] nt" /* "movq %%mm1, 8(%0, %3) nt" */
- "add %[block], %[block], #16 nt" /* "addl $16, %3 nt" */
- "subs %[i], %[i], #1 nt"
- "bne 1b nt" /* "jng 1b nt" */
- :[block]"+r"(block)
- :[i]"r"((nCoeffs + 8) / 8), [qmul]"r"(qmul), [qadd]"r"(qadd)
- :"memory");
- block_orig[0] = level;
- }
- #if 0
- static void dct_unquantize_h263_inter_iwmmxt(MpegEncContext *s,
- DCTELEM *block, int n, int qscale)
- {
- int nCoeffs;
- assert(s->block_last_index[n]>=0);
- if(s->ac_pred)
- nCoeffs=63;
- else
- nCoeffs= s->inter_scantable.raster_end[ s->block_last_index[n] ];
- ippiQuantInvInter_Compact_H263_16s_I(block, nCoeffs+1, qscale);
- }
- #endif
- void MPV_common_init_iwmmxt(MpegEncContext *s)
- {
- if (!(mm_flags & MM_IWMMXT)) return;
- s->dct_unquantize_h263_intra = dct_unquantize_h263_intra_iwmmxt;
- #if 0
- s->dct_unquantize_h263_inter = dct_unquantize_h263_inter_iwmmxt;
- #endif
- }