⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 h264dsp_mmx.c

📁 tcpmp播放器的flv插件
💻 C
📖 第 1 页 / 共 3 页
字号:
        "movd (%0), %%mm4		\n\t"\        "add %2, %0			\n\t"\        "punpcklbw %%mm7, %%mm0		\n\t"\        "punpcklbw %%mm7, %%mm1		\n\t"\        "punpcklbw %%mm7, %%mm2		\n\t"\        "punpcklbw %%mm7, %%mm3		\n\t"\        "punpcklbw %%mm7, %%mm4		\n\t"\        QPEL_H264V(%%mm0, %%mm1, %%mm2, %%mm3, %%mm4, %%mm5, OP)\        QPEL_H264V(%%mm1, %%mm2, %%mm3, %%mm4, %%mm5, %%mm0, OP)\        QPEL_H264V(%%mm2, %%mm3, %%mm4, %%mm5, %%mm0, %%mm1, OP)\        QPEL_H264V(%%mm3, %%mm4, %%mm5, %%mm0, %%mm1, %%mm2, OP)\        QPEL_H264V(%%mm4, %%mm5, %%mm0, %%mm1, %%mm2, %%mm3, OP)\        QPEL_H264V(%%mm5, %%mm0, %%mm1, %%mm2, %%mm3, %%mm4, OP)\        QPEL_H264V(%%mm0, %%mm1, %%mm2, %%mm3, %%mm4, %%mm5, OP)\        QPEL_H264V(%%mm1, %%mm2, %%mm3, %%mm4, %%mm5, %%mm0, OP)\         \        : "+a"(src), "+c"(dst)\        : "S"((long)srcStride), "D"((long)dstStride), "m"(ff_pw_5), "m"(ff_pw_16)\        : "memory"\     );\     src += 4-13*srcStride;\     dst +=  4-8*dstStride;\   }\}\static void OPNAME ## h264_qpel8_hv_lowpass_ ## MMX(uint8_t *dst, int16_t *tmp, uint8_t *src, int dstStride, int tmpStride, int srcStride){\    int h=8;\    int w=4;\    src -= 2*srcStride+2;\    while(w--){\        asm volatile(\            "pxor %%mm7, %%mm7			\n\t"\            "movd (%0), %%mm0			\n\t"\            "add %2, %0				\n\t"\            "movd (%0), %%mm1			\n\t"\            "add %2, %0				\n\t"\            "movd (%0), %%mm2			\n\t"\            "add %2, %0				\n\t"\            "movd (%0), %%mm3			\n\t"\            "add %2, %0				\n\t"\            "movd (%0), %%mm4			\n\t"\            "add %2, %0				\n\t"\            "punpcklbw %%mm7, %%mm0		\n\t"\            "punpcklbw %%mm7, %%mm1		\n\t"\            "punpcklbw %%mm7, %%mm2		\n\t"\            "punpcklbw %%mm7, %%mm3		\n\t"\            "punpcklbw %%mm7, %%mm4		\n\t"\            QPEL_H264HV(%%mm0, %%mm1, %%mm2, %%mm3, %%mm4, %%mm5, 0*8*4)\            QPEL_H264HV(%%mm1, %%mm2, %%mm3, %%mm4, %%mm5, %%mm0, 1*8*4)\            QPEL_H264HV(%%mm2, %%mm3, %%mm4, %%mm5, %%mm0, %%mm1, 2*8*4)\            QPEL_H264HV(%%mm3, %%mm4, %%mm5, %%mm0, %%mm1, %%mm2, 3*8*4)\            QPEL_H264HV(%%mm4, %%mm5, %%mm0, %%mm1, %%mm2, %%mm3, 4*8*4)\            QPEL_H264HV(%%mm5, %%mm0, %%mm1, %%mm2, %%mm3, %%mm4, 5*8*4)\            QPEL_H264HV(%%mm0, %%mm1, %%mm2, %%mm3, %%mm4, %%mm5, 6*8*4)\            QPEL_H264HV(%%mm1, %%mm2, %%mm3, %%mm4, %%mm5, %%mm0, 7*8*4)\             \            : "+a"(src)\            : "c"(tmp), "S"((long)srcStride), "m"(ff_pw_5)\            : "memory"\        );\        tmp += 4;\        src += 4 - 13*srcStride;\    }\    tmp -= 4*4;\    asm volatile(\        "movq %4, %%mm6			\n\t"\        "1:				\n\t"\        "movq     (%0), %%mm0		\n\t"\        "movq    8(%0), %%mm3		\n\t"\        "movq    2(%0), %%mm1		\n\t"\        "movq   10(%0), %%mm4		\n\t"\        "paddw   %%mm4, %%mm0		\n\t"\        "paddw   %%mm3, %%mm1		\n\t"\        "paddw  18(%0), %%mm3		\n\t"\        "paddw  16(%0), %%mm4		\n\t"\        "movq    4(%0), %%mm2		\n\t"\        "movq   12(%0), %%mm5		\n\t"\        "paddw   6(%0), %%mm2		\n\t"\        "paddw  14(%0), %%mm5		\n\t"\        "psubw %%mm1, %%mm0		\n\t"\        "psubw %%mm4, %%mm3		\n\t"\        "psraw $2, %%mm0		\n\t"\        "psraw $2, %%mm3		\n\t"\        "psubw %%mm1, %%mm0		\n\t"\        "psubw %%mm4, %%mm3		\n\t"\        "paddsw %%mm2, %%mm0		\n\t"\        "paddsw %%mm5, %%mm3		\n\t"\        "psraw $2, %%mm0		\n\t"\        "psraw $2, %%mm3		\n\t"\        "paddw %%mm6, %%mm2		\n\t"\        "paddw %%mm6, %%mm5		\n\t"\        "paddw %%mm2, %%mm0		\n\t"\        "paddw %%mm5, %%mm3		\n\t"\        "psraw $6, %%mm0		\n\t"\        "psraw $6, %%mm3		\n\t"\        "packuswb %%mm3, %%mm0		\n\t"\        OP(%%mm0, (%1),%%mm7, q)\        "add $32, %0			\n\t"\        "add %3, %1			\n\t"\        "decl %2			\n\t"\        " jnz 1b			\n\t"\        : "+a"(tmp), "+c"(dst), "+m"(h)\        : "S"((long)dstStride), "m"(ff_pw_32)\        : "memory"\    );\}\static void OPNAME ## h264_qpel16_v_lowpass_ ## MMX(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\    OPNAME ## h264_qpel8_v_lowpass_ ## MMX(dst  , src  , dstStride, srcStride);\    OPNAME ## h264_qpel8_v_lowpass_ ## MMX(dst+8, src+8, dstStride, srcStride);\    src += 8*srcStride;\    dst += 8*dstStride;\    OPNAME ## h264_qpel8_v_lowpass_ ## MMX(dst  , src  , dstStride, srcStride);\    OPNAME ## h264_qpel8_v_lowpass_ ## MMX(dst+8, src+8, dstStride, srcStride);\}\\static void OPNAME ## h264_qpel16_h_lowpass_ ## MMX(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\    OPNAME ## h264_qpel8_h_lowpass_ ## MMX(dst  , src  , dstStride, srcStride);\    OPNAME ## h264_qpel8_h_lowpass_ ## MMX(dst+8, src+8, dstStride, srcStride);\    src += 8*srcStride;\    dst += 8*dstStride;\    OPNAME ## h264_qpel8_h_lowpass_ ## MMX(dst  , src  , dstStride, srcStride);\    OPNAME ## h264_qpel8_h_lowpass_ ## MMX(dst+8, src+8, dstStride, srcStride);\}\\static void OPNAME ## h264_qpel16_hv_lowpass_ ## MMX(uint8_t *dst, int16_t *tmp, uint8_t *src, int dstStride, int tmpStride, int srcStride){\    OPNAME ## h264_qpel8_hv_lowpass_ ## MMX(dst  , tmp  , src  , dstStride, tmpStride, srcStride);\    OPNAME ## h264_qpel8_hv_lowpass_ ## MMX(dst+8, tmp  , src+8, dstStride, tmpStride, srcStride);\    src += 8*srcStride;\    dst += 8*dstStride;\    OPNAME ## h264_qpel8_hv_lowpass_ ## MMX(dst  , tmp  , src  , dstStride, tmpStride, srcStride);\    OPNAME ## h264_qpel8_hv_lowpass_ ## MMX(dst+8, tmp  , src+8, dstStride, tmpStride, srcStride);\}\#define H264_MC(OPNAME, SIZE, MMX) \static void OPNAME ## h264_qpel ## SIZE ## _mc00_ ## MMX (uint8_t *dst, uint8_t *src, int stride){\    OPNAME ## pixels ## SIZE ## _mmx(dst, src, stride, SIZE);\}\\static void OPNAME ## h264_qpel ## SIZE ## _mc10_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\    uint64_t temp[SIZE*SIZE/8];\    uint8_t * const half= (uint8_t*)temp;\    put_h264_qpel ## SIZE ## _h_lowpass_ ## MMX(half, src, SIZE, stride);\    OPNAME ## pixels ## SIZE ## _l2_ ## MMX(dst, src, half, stride, stride, SIZE);\}\\static void OPNAME ## h264_qpel ## SIZE ## _mc20_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\    OPNAME ## h264_qpel ## SIZE ## _h_lowpass_ ## MMX(dst, src, stride, stride);\}\\static void OPNAME ## h264_qpel ## SIZE ## _mc30_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\    uint64_t temp[SIZE*SIZE/8];\    uint8_t * const half= (uint8_t*)temp;\    put_h264_qpel ## SIZE ## _h_lowpass_ ## MMX(half, src, SIZE, stride);\    OPNAME ## pixels ## SIZE ## _l2_ ## MMX(dst, src+1, half, stride, stride, SIZE);\}\\static void OPNAME ## h264_qpel ## SIZE ## _mc01_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\    uint64_t temp[SIZE*SIZE/8];\    uint8_t * const half= (uint8_t*)temp;\    put_h264_qpel ## SIZE ## _v_lowpass_ ## MMX(half, src, SIZE, stride);\    OPNAME ## pixels ## SIZE ## _l2_ ## MMX(dst, src, half, stride, stride, SIZE);\}\\static void OPNAME ## h264_qpel ## SIZE ## _mc02_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\    OPNAME ## h264_qpel ## SIZE ## _v_lowpass_ ## MMX(dst, src, stride, stride);\}\\static void OPNAME ## h264_qpel ## SIZE ## _mc03_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\    uint64_t temp[SIZE*SIZE/8];\    uint8_t * const half= (uint8_t*)temp;\    put_h264_qpel ## SIZE ## _v_lowpass_ ## MMX(half, src, SIZE, stride);\    OPNAME ## pixels ## SIZE ## _l2_ ## MMX(dst, src+stride, half, stride, stride, SIZE);\}\\static void OPNAME ## h264_qpel ## SIZE ## _mc11_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\    uint64_t temp[SIZE*SIZE/4];\    uint8_t * const halfH= (uint8_t*)temp;\    uint8_t * const halfV= ((uint8_t*)temp) + SIZE*SIZE;\    put_h264_qpel ## SIZE ## _h_lowpass_ ## MMX(halfH, src, SIZE, stride);\    put_h264_qpel ## SIZE ## _v_lowpass_ ## MMX(halfV, src, SIZE, stride);\    OPNAME ## pixels ## SIZE ## _l2_ ## MMX(dst, halfH, halfV, stride, SIZE, SIZE);\}\\static void OPNAME ## h264_qpel ## SIZE ## _mc31_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\    uint64_t temp[SIZE*SIZE/4];\    uint8_t * const halfH= (uint8_t*)temp;\    uint8_t * const halfV= ((uint8_t*)temp) + SIZE*SIZE;\    put_h264_qpel ## SIZE ## _h_lowpass_ ## MMX(halfH, src, SIZE, stride);\    put_h264_qpel ## SIZE ## _v_lowpass_ ## MMX(halfV, src+1, SIZE, stride);\    OPNAME ## pixels ## SIZE ## _l2_ ## MMX(dst, halfH, halfV, stride, SIZE, SIZE);\}\\static void OPNAME ## h264_qpel ## SIZE ## _mc13_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\    uint64_t temp[SIZE*SIZE/4];\    uint8_t * const halfH= (uint8_t*)temp;\    uint8_t * const halfV= ((uint8_t*)temp) + SIZE*SIZE;\    put_h264_qpel ## SIZE ## _h_lowpass_ ## MMX(halfH, src + stride, SIZE, stride);\    put_h264_qpel ## SIZE ## _v_lowpass_ ## MMX(halfV, src, SIZE, stride);\    OPNAME ## pixels ## SIZE ## _l2_ ## MMX(dst, halfH, halfV, stride, SIZE, SIZE);\}\\static void OPNAME ## h264_qpel ## SIZE ## _mc33_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\    uint64_t temp[SIZE*SIZE/4];\    uint8_t * const halfH= (uint8_t*)temp;\    uint8_t * const halfV= ((uint8_t*)temp) + SIZE*SIZE;\    put_h264_qpel ## SIZE ## _h_lowpass_ ## MMX(halfH, src + stride, SIZE, stride);\    put_h264_qpel ## SIZE ## _v_lowpass_ ## MMX(halfV, src+1, SIZE, stride);\    OPNAME ## pixels ## SIZE ## _l2_ ## MMX(dst, halfH, halfV, stride, SIZE, SIZE);\}\\static void OPNAME ## h264_qpel ## SIZE ## _mc22_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\    uint64_t temp[SIZE*(SIZE+8)/4];\    int16_t * const tmp= (int16_t*)temp;\    OPNAME ## h264_qpel ## SIZE ## _hv_lowpass_ ## MMX(dst, tmp, src, stride, SIZE, stride);\}\\static void OPNAME ## h264_qpel ## SIZE ## _mc21_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\    uint64_t temp[SIZE*(SIZE+8)/4 + SIZE*SIZE/4];\    uint8_t * const halfH= (uint8_t*)temp;\    uint8_t * const halfHV= ((uint8_t*)temp) + SIZE*SIZE;\    int16_t * const tmp= ((int16_t*)temp) + SIZE*SIZE;\    put_h264_qpel ## SIZE ## _h_lowpass_ ## MMX(halfH, src, SIZE, stride);\    put_h264_qpel ## SIZE ## _hv_lowpass_ ## MMX(halfHV, tmp, src, SIZE, SIZE, stride);\    OPNAME ## pixels ## SIZE ## _l2_ ## MMX(dst, halfH, halfHV, stride, SIZE, SIZE);\}\\static void OPNAME ## h264_qpel ## SIZE ## _mc23_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\    uint64_t temp[SIZE*(SIZE+8)/4 + SIZE*SIZE/4];\    uint8_t * const halfH= (uint8_t*)temp;\    uint8_t * const halfHV= ((uint8_t*)temp) + SIZE*SIZE;\    int16_t * const tmp= ((int16_t*)temp) + SIZE*SIZE;\    put_h264_qpel ## SIZE ## _h_lowpass_ ## MMX(halfH, src + stride, SIZE, stride);\    put_h264_qpel ## SIZE ## _hv_lowpass_ ## MMX(halfHV, tmp, src, SIZE, SIZE, stride);\    OPNAME ## pixels ## SIZE ## _l2_ ## MMX(dst, halfH, halfHV, stride, SIZE, SIZE);\}\\static void OPNAME ## h264_qpel ## SIZE ## _mc12_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\    uint64_t temp[SIZE*(SIZE+8)/4 + SIZE*SIZE/4];\    uint8_t * const halfV= (uint8_t*)temp;\    uint8_t * const halfHV= ((uint8_t*)temp) + SIZE*SIZE;\    int16_t * const tmp= ((int16_t*)temp) + SIZE*SIZE;\    put_h264_qpel ## SIZE ## _v_lowpass_ ## MMX(halfV, src, SIZE, stride);\    put_h264_qpel ## SIZE ## _hv_lowpass_ ## MMX(halfHV, tmp, src, SIZE, SIZE, stride);\    OPNAME ## pixels ## SIZE ## _l2_ ## MMX(dst, halfV, halfHV, stride, SIZE, SIZE);\}\\static void OPNAME ## h264_qpel ## SIZE ## _mc32_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\    uint64_t temp[SIZE*(SIZE+8)/4 + SIZE*SIZE/4];\    uint8_t * const halfV= (uint8_t*)temp;\    uint8_t * const halfHV= ((uint8_t*)temp) + SIZE*SIZE;\    int16_t * const tmp= ((int16_t*)temp) + SIZE*SIZE;\    put_h264_qpel ## SIZE ## _v_lowpass_ ## MMX(halfV, src+1, SIZE, stride);\    put_h264_qpel ## SIZE ## _hv_lowpass_ ## MMX(halfHV, tmp, src, SIZE, SIZE, stride);\    OPNAME ## pixels ## SIZE ## _l2_ ## MMX(dst, halfV, halfHV, stride, SIZE, SIZE);\}\#define PUT_OP(a,b,temp, size) "mov" #size " " #a ", " #b "	\n\t"#define AVG_3DNOW_OP(a,b,temp, size) \"mov" #size " " #b ", " #temp "	\n\t"\"pavgusb " #temp ", " #a "	\n\t"\"mov" #size " " #a ", " #b "	\n\t"#define AVG_MMX2_OP(a,b,temp, size) \"mov" #size " " #b ", " #temp "	\n\t"\"pavgb " #temp ", " #a "	\n\t"\"mov" #size " " #a ", " #b "	\n\t"QPEL_H264(put_,       PUT_OP, 3dnow)QPEL_H264(avg_, AVG_3DNOW_OP, 3dnow)QPEL_H264(put_,       PUT_OP, mmx2)QPEL_H264(avg_,  AVG_MMX2_OP, mmx2)H264_MC(put_, 4, 3dnow)H264_MC(put_, 8, 3dnow)H264_MC(put_, 16,3dnow)H264_MC(avg_, 4, 3dnow)H264_MC(avg_, 8, 3dnow)H264_MC(avg_, 16,3dnow)H264_MC(put_, 4, mmx2)H264_MC(put_, 8, mmx2)H264_MC(put_, 16,mmx2)H264_MC(avg_, 4, mmx2)H264_MC(avg_, 8, mmx2)H264_MC(avg_, 16,mmx2)#define H264_CHROMA_OP(S,D)#define H264_CHROMA_MC8_TMPL put_h264_chroma_mc8_mmx#include "dsputil_h264_template_mmx.c"#undef H264_CHROMA_OP#undef H264_CHROMA_MC8_TMPL#define H264_CHROMA_OP(S,D) "pavgb " #S ", " #D " \n\t"#define H264_CHROMA_MC8_TMPL avg_h264_chroma_mc8_mmx2#include "dsputil_h264_template_mmx.c"#undef H264_CHROMA_OP#undef H264_CHROMA_MC8_TMPL#define H264_CHROMA_OP(S,D) "pavgusb " #S ", " #D " \n\t"#define H264_CHROMA_MC8_TMPL avg_h264_chroma_mc8_3dnow#include "dsputil_h264_template_mmx.c"#undef H264_CHROMA_OP#undef H264_CHROMA_MC8_TMPL

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -