
Use 3DNow!™ PAVGUSB for MPEG-2 Motion Compensation
123
22007E/0—November 1999
AMD Athlon™ Processor x86 Code Optimization
;;
;; DESTROYS MM0,MM1,MM2,MM3,MM4
PXOR MM0, MM0 ; 0 | 0
MOVQ MM1, MM6 ; w | z
MOVQ MM4, MM5 ; y | x
PUNPCKHDQ MM1, MM1 ; w | w
MOVQ MM3, MM6 ; w | z
MOVQ MM2, MM5 ; y | x
PFSUBR MM3, MM0 ; -w | -z
PFSUBR MM2, MM0 ; -y | -x
PUNPCKLDQ MM3, MM6 ; z | -z
PFCMPGT MM4, MM1 ; y>w?FFFFFFFF:0 | x>w?FFFFFFFF:0
MOVQ MM0, QWORD PTR [ABOVE_RIGHT] ; ABOVE | RIGHT
PFCMPGT MM3, MM1 ; z>w?FFFFFFFF:0 | -z>w>FFFFFFFF:0
PFCMPGT MM2, MM1 ; -y>w?FFFFFFFF:0 | -x>w?FFFFFFFF:0
MOVQ MM1, QWORD PTR [BEHIND_BEFORE] ; BEHIND | BEFORE
PAND MM4, MM0 ; y > w ? ABOVE:0 | x > w ? RIGHT:0
MOVQ MM0, QWORD PTR [BELOW_LEFT] ; BELOW | LEFT
PAND MM3, MM1 ; z > w ? BEHIND:0 | -z > w ? BEFORE:0
PAND MM2, MM0 ; -y > w ? BELOW:0 | -x > w ? LEFT:0
POR MM2, MM4 ; BELOW,ABOVE | LEFT,RIGHT
POR MM2, MM3 ; BELOW,ABOVE,BEHIND | LEFT,RIGHT,BEFORE
MOVQ MM1, MM2 ; BELOW,ABOVE,BEHIND | LEFT,RIGHT,BEFORE
PUNPCKHDQ MM2, MM2 ; BELOW,ABOVE,BEHIND | BELOW,ABOVE,BEHIND
POR MM2, MM1 ; zclip, yclip, xclip = clip code
Use 3DNow!™ PAVGUSB for MPEG-2 Motion Compensation
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
d e s t ina t i on o p e ra n d ( a MM X re g is t e r ) . Th e PAVG U S B
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:
Содержание Athlon Processor x86
Страница 1: ...AMD Athlon Processor x86 Code Optimization Guide TM...
Страница 12: ...xii List of Figures AMD Athlon Processor x86 Code Optimization 22007E 0 November 1999...
Страница 16: ...xvi Revision History AMD Athlon Processor x86 Code Optimization 22007E 0 November 1999...
Страница 60: ...44 Code Padding Using Neutral Code Fillers AMD Athlon Processor x86 Code Optimization 22007E 0 November 1999...
Страница 92: ...76 Push Memory Data Carefully AMD Athlon Processor x86 Code Optimization 22007E 0 November 1999...
Страница 122: ...106 Take Advantage of the FSINCOS Instruction AMD Athlon Processor x86 Code Optimization 22007E 0 November 1999...
Страница 156: ...140 AMD Athlon Processor Microarchitecture AMD Athlon Processor x86 Code Optimization 22007E 0 November 1999...
Страница 176: ...160 Write Combining Operations AMD Athlon Processor x86 Code Optimization 22007E 0 November 1999...
Страница 202: ...186 Page Attribute Table PAT AMD Athlon Processor x86 Code Optimization 22007E 0 November 1999...
Страница 252: ...236 VectorPath Instructions AMD Athlon Processor x86 Code Optimization 22007E 0 November 1999...
Страница 256: ...240 Index AMD Athlon Processor x86 Code Optimization 22007E 0 November 1999...