我正在尝试使用Visual Studio 2010编译huffyuv。组装asm文件时收到错误消息A2070。我粘贴了以下相关代码(部分):
YUV_SHIFT MACRO mmb,mma,uyvy ; clobbers mm4,5
; mma:mmb = ABCDEFGHIJKLMNOP (VYUYVYUY...) - backwards from mem order
; we want mmb = EDGFIHKJ (prev pixel of same channel)
movq mm4,mmb
punpcklbw mmb,mma ; mm4:mmb = AIBJCKDLEMFNGOHP
punpckhbw mm4,mma
movq mm5,mmb
punpcklbw mmb,mm4 ; mm5:mmb = AEIMBFJNCGKODHLP
punpckhbw mm5,mm4
movq mm4,mmb
punpcklbw mmb,mm5 ; mm4:mmb = ACEGIKMOBDFHJLNP
punpckhbw mm4,mm5
psllq mmb,8+8*&uyvy ; mm4:mmb = EGIKMO__DFHJLNP_
psllq mm4,16-8*&uyvy
punpckhbw mmb,mm4 ; mmb = EDGFIHKJ (for YUY2; different for UYVY)
ENDM
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
MEDIAN_PREDICT_PROC MACRO procname,uyvy
PUBLIC C _&procname
;void __cdecl mmx_MedianPredict(
; [esp+ 4] unsigned char* src,
; [esp+ 8] unsigned char* dst,
; [esp+12] unsigned char* src_end,
; [esp+16] int stride);
_&procname PROC
push ebp
mov ebp,esp
push edi
push esi
push ebx
; do the first row
mov esi,[ebp+4+4]
mov edi,[ebp+8+4]
mov ebx,[ebp+16+4]
lea ecx,[ebx+esi+8]
neg ebx
pxor mm2,mm2
movq mm3,[esi] ; for use in next loop
loop0:
movq mm0,[esi]
YUV_SHIFT mm2,mm0,uyvy
add esi,8
movq mm1,mm0
psubb mm1,mm2
movq [edi],mm1
movq mm2,mm0
add edi,8
cmp esi,ecx
jb loop0
mov ecx,[ebp+8+4] ; recopy first group of four, just for consistency with other compression methods
movd [ecx],mm3
; do the remaining rows
mov ecx,[ebp+12+4]
; mm2,3 are already initialized from previous loop
align 32
; pixel arrangement:
; mm3 mm1
; mm2 mm0
loop1:
; mm2,3 <- appropriate left and above-left pixels
movq mm0,[esi]
movq mm1,[esi+ebx]
YUV_SHIFT mm2,mm0,uyvy ; note: clobbers mm4,5
add esi,8
YUV_SHIFT mm3,mm1,uyvy
; mm4 <- median of mm1,mm2,(mm1+mm2-mm3)
movq mm4,mm2 ; (mm2,mm4) <- (min(mm1,mm2),max(mm1,mm2))
movq mm5,mm2 ; mm5 <- mm1+mm2-mm3
psubusb mm4,mm1
paddb mm5,mm1
psubb mm2,mm4
psubb mm5,mm3
paddb mm4,mm1
psubusb mm2,mm5 ; mm2 = max(mm2,mm5)
paddb mm2,mm5
movq mm5,mm4 ; mm4 = min(mm2,mm4)
psubusb mm5,mm2
psubb mm4,mm5 ; now mm4 = median
; write out the result and loop
movq mm2,mm0
movq mm3,mm1
psubb mm0,mm4
movq [edi],mm0
cmp esi,ecx
lea edi,[edi+8]
jb loop1
emms
pop ebx
pop esi
pop edi
pop ebp
retn
_&procname ENDP
ENDM
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
MEDIAN_PREDICT_PROC mmx_MedianPredictYUY2,0 ; I get the error on this line
MEDIAN_PREDICT_PROC mmx_MedianPredictUYVY,1 ; and this as well
这是我得到的第一个错误(后来我得到了更多同样的错误,但如果我知道如何修复第一个错误,我可以修复其余的错误。)
1>C:\Development\huffyuv\huffyuv_a.asm(526): error A2070: invalid instruction operands
1> MEDIAN_PREDICT_PROC(41): Macro Called From
1> C:\Development\huffyuv\huffyuv_a.asm(526): Main Line Code
1>C:\Development\huffyuv\huffyuv_a.asm(527): error A2070: invalid instruction operands
1> MEDIAN_PREDICT_PROC(41): Macro Called From
1> C:\Development\huffyuv\huffyuv_a.asm(527): Main Line Code
我不太了解汇编代码,所以如果有人能告诉我问题在哪里,以及如何解决,我会很高兴。