fast_copy.c
资源名称:VC++视频传输.rar [点击查看]
上传用户:hxb_1234
上传日期:2010-03-30
资源大小:8328k
文件大小:2k
源码类别:
VC书籍
开发平台:
Visual C++
- #include "postprocess_mmx.h"
- void fast_copy(unsigned char *src, int src_stride,
- unsigned char *dst, int dst_stride,
- int horizontal_size, int vertical_size) {
- uint8_t *pmm1;
- uint8_t *pmm2;
- int x, y;
- #ifdef PP_SELF_CHECK
- int j, k;
- #endif
- pmm1 = src;
- pmm2 = dst;
- for (y=0; y<vertical_size; y++) {
- x = - horizontal_size / 8;
- __asm {
- push edi
- push ebx
- push ecx
- mov edi, x
- mov ebx, pmm1
- mov ecx, pmm2
- L123: /* */
- movq mm0, [ebx] /* mm0 = *pmm1 */
- movq [ecx], mm0 /* *pmm2 = mm0 */
- add ecx, 8 /* pmm2 +=8 */
- #ifdef PREFETCH_ENABLE
- prefetcht0 32[ebx] /* prefetch ahead */
- #endif
- add ebx, 8 /* pmm1 +=8 */
- add edi, 1 /* increment loop counter */
- jne L123
- pop ecx
- pop ebx
- pop edi
- };
- pmm1 += src_stride;
- pmm2 += dst_stride;
- }
- #ifdef PP_SELF_CHECK
- for (k=0; k<vertical_size; k++) {
- for (j=0; j<horizontal_size; j++) {
- if (dst[k*dst_stride + j] != src[k*src_stride + j]) {
- printf("problem with MMX fast copy - Yn");
- }
- }
- }
- #endif
- __asm {
- emms
- };
- }