Use 3Dnow! Pavgusb For Mpeg-2 Motion Compensation - AMD Athlon Processor x86 Optimization Manual

X86 code optimization
Table of Contents

Advertisement

22007E/0—November 1999
;;
;;
PXOR
MM0, MM0
MOVQ
MM1, MM6
MOVQ
MM4, MM5
PUNPCKHDQ MM1, MM1
MOVQ
MM3, MM6
MOVQ
MM2, MM5
PFSUBR
MM3, MM0
PFSUBR
MM2, MM0
PUNPCKLDQ MM3, MM6
PFCMPGT
MM4, MM1
MOVQ
MM0, QWORD PTR [ABOVE_RIGHT]
PFCMPGT
MM3, MM1
PFCMPGT
MM2, MM1
MOVQ
MM1, QWORD PTR [BEHIND_BEFORE] ; BEHIND | BEFORE
PAND
MM4, MM0
MOVQ
MM0, QWORD PTR [BELOW_LEFT]
PAND
MM3, MM1
PAND
MM2, MM0
POR
MM2, MM4
POR
MM2, MM3
MOVQ
MM1, MM2
PUNPCKHDQ MM2, MM2
POR
MM2, MM1
Use 3DNow!™ PAVGUSB for MPEG-2 Motion Compensation
Use 3DNow!™ PAVGUSB for MPEG-2 Motion Compensation
DESTROYS
MM0,MM1,MM2,MM3,MM4
Use the 3DNow! PAVGUSB instruction for MPEG-2 motion
compensation. The PAVGUSB instruction produces the rounded
averages of the eight unsigned 8-bit integer values in the source
operand (a MMX register or a 64-bit memory location) and the
eight corresponding unsigned 8-bit integer values in the
destination operand (a MMX register). The PAVGUSB
instruction is extremely useful in DVD (MPEG-2) decoding
where motion compensation performs a lot of byte averaging
between and within macroblocks. The PAVGUSB instruction
helps speed up these operations. In addition, PAVGUSB can
free up some registers and make unrolling the averaging loops
possible.
The following code fragment uses original MMX code to
perform averaging between the source macroblock and
destination macroblock:
AMD Athlon™ Processor x86 Code Optimization
; 0 | 0
; w | z
; y | x
; w | w
; w | z
; y | x
; -w | -z
; -y | -x
;
z | -z
;
y>w?FFFFFFFF:0 | x>w?FFFFFFFF:0
; ABOVE | RIGHT
;
z>w?FFFFFFFF:0 | -z>w>FFFFFFFF:0
; -y>w?FFFFFFFF:0 | -x>w?FFFFFFFF:0
; y > w ? ABOVE:0
; BELOW | LEFT
; z > w ? BEHIND:0 | -z > w ? BEFORE:0
; -y > w ? BELOW:0 | -x > w ? LEFT:0
; BELOW,ABOVE | LEFT,RIGHT
; BELOW,ABOVE,BEHIND | LEFT,RIGHT,BEFORE
; BELOW,ABOVE,BEHIND | LEFT,RIGHT,BEFORE
; BELOW,ABOVE,BEHIND | BELOW,ABOVE,BEHIND
; zclip, yclip, xclip = clip code
| x > w ? RIGHT:0
123

Advertisement

Table of Contents
loading

Table of Contents