deblock_vert_copy_and_unpack.c
资源名称:VC++视频传输.rar [点击查看]
上传用户:hxb_1234
上传日期:2010-03-30
资源大小:8328k
文件大小:2k
源码类别:
VC书籍
开发平台:
Visual C++
- #include "postprocess_mmx.h"
- INLINE void deblock_vert_copy_and_unpack(int stride, uint8_t *source, uint64_t *dest, int n) {
- uint64_t *pmm1 = (uint64_t *)source;
- uint64_t *pmm2 = (uint64_t *)dest;
- int i = -n / 2;
- #ifdef PP_SELF_CHECK
- int j, k;
- #endif
- __asm {
- push edi
- push eax
- push ebx
- mov edi, i
- mov eax, pmm1
- mov ebx, pmm2
- pxor mm7, mm7 /* set mm7 = 0 */
- deblock_v_L1: /* now p1 is in mm1 */
- movq mm0, [eax] /* mm0 = v[0*stride] */
- #ifdef PREFETCH_ENABLE
- prefetcht0 0[ebx]
- #endif
- add eax, stride /* p_data += stride */
- movq mm1, mm0 /* mm1 = v[0*stride] */
- punpcklbw mm0, mm7 /* unpack low bytes (left hand 4) */
- movq mm2, [eax] /* mm2 = v[0*stride] */
- punpckhbw mm1, mm7 /* unpack high bytes (right hand 4)*/
- movq mm3, mm2 /* mm3 = v[0*stride] */
- punpcklbw mm2, mm7 /* unpack low bytes (left hand 4) */
- movq [ebx], mm0 /* v_local[n] = mm0 (left) */
- add eax, stride /* p_data += stride */
- movq 8[ebx], mm1 /* v_local[n+8] = mm1 (right) */
- punpckhbw mm3, mm7 /* unpack high bytes (right hand 4)*/
- movq 16[ebx], mm2 /* v_local[n+16] = mm2 (left) */
- movq 24[ebx], mm3 /* v_local[n+24] = mm3 (right) */
- add ebx, 32 /* p_data2 += 8 */
- add i, 1 /* increment loop counter */
- jne deblock_v_L1
- pop ebx
- pop eax
- pop edi
- };
- #ifdef PP_SELF_CHECK
- for (k=0; k<n; k++) {
- for (j=0; j<8; j++) {
- if ( ((uint16_t *)dest)[k*8+j] != source[k*stride+j] ) {
- printf("ERROR: MMX copy block is flawed at (%d, %d)n", j, k);
- }
- }
- }
- #endif
- }