<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-GB">
	<id>http://www.alphalinux.org/wiki/index.php?action=history&amp;feed=atom&amp;title=Motion_Video_Instructions</id>
	<title>Motion Video Instructions - Revision history</title>
	<link rel="self" type="application/atom+xml" href="http://www.alphalinux.org/wiki/index.php?action=history&amp;feed=atom&amp;title=Motion_Video_Instructions"/>
	<link rel="alternate" type="text/html" href="http://www.alphalinux.org/wiki/index.php?title=Motion_Video_Instructions&amp;action=history"/>
	<updated>2026-04-28T06:15:09Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.31.7</generator>
	<entry>
		<id>http://www.alphalinux.org/wiki/index.php?title=Motion_Video_Instructions&amp;diff=84&amp;oldid=prev</id>
		<title>Gareth: Imported from http://web.archive.org/web/20100713090023/http://www.alphalinux.org/wiki/index.php?title=Motion_Video_Instructions&amp;action=edit</title>
		<link rel="alternate" type="text/html" href="http://www.alphalinux.org/wiki/index.php?title=Motion_Video_Instructions&amp;diff=84&amp;oldid=prev"/>
		<updated>2019-08-29T18:17:06Z</updated>

		<summary type="html">&lt;p&gt;Imported from http://web.archive.org/web/20100713090023/http://www.alphalinux.org/wiki/index.php?title=Motion_Video_Instructions&amp;amp;action=edit&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;Beginning with the [[Processors#PCA56|PCA56]] processor, [[Digital|DEC]] added the Motion Video Instructions (MVI) to accelerate algorithms related to motion video formats such as MPEG1 and MPEG2&amp;lt;ref&amp;gt;{{cite web&lt;br /&gt;
| url         = http://www.alasir.com/articles/alpha_history/press/samsung_ev6_announce.html&lt;br /&gt;
| title       = Samsung Introduces Alpha 21264, World's Fastest Microprocessor -- Sets Standards for 64-bit Visual and Enterprise Computing&lt;br /&gt;
| accessdate  = Nov 29, 2008&lt;br /&gt;
| date        = April 6, 1998&lt;br /&gt;
| publisher   = Samsung Semiconductor&lt;br /&gt;
}}&amp;lt;/ref&amp;gt;. Compared to other [http://en.wikipedia.org/wiki/SIMD SIMD] instruction sets of the time, MVI is very simple. In order to prevent complicating the instruction decode logic, the MVI extension contains only 13 SIMD instructions.&lt;br /&gt;
&lt;br /&gt;
Unlike Intel's MMX and SSE SIMD extensions, MVIs use the Alpha's general purpose registers.&lt;br /&gt;
&lt;br /&gt;
== Added Instructions ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;font-size:97%;&amp;quot;&lt;br /&gt;
! Mnemonic&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
! minub8&lt;br /&gt;
| minimum of packed unsigned bytes&lt;br /&gt;
|-&lt;br /&gt;
! maxub8&lt;br /&gt;
| maximum of packed unsigned bytes&lt;br /&gt;
|-&lt;br /&gt;
! minsb8&lt;br /&gt;
| minimum of packed signed bytes&lt;br /&gt;
|-&lt;br /&gt;
! maxsb8&lt;br /&gt;
| maximum of packed signed bytes&lt;br /&gt;
|-&lt;br /&gt;
! minuw4&lt;br /&gt;
| minimum of packed unsigned words&lt;br /&gt;
|-&lt;br /&gt;
! maxuw4&lt;br /&gt;
| maximum of packed unsigned words&lt;br /&gt;
|-&lt;br /&gt;
! minsw4&lt;br /&gt;
| minimum of packed signed words&lt;br /&gt;
|-&lt;br /&gt;
! maxsw4&lt;br /&gt;
| maximum of packed signed words&lt;br /&gt;
|-&lt;br /&gt;
! pkwb&lt;br /&gt;
| pack words into bytes&lt;br /&gt;
|-&lt;br /&gt;
! unpkwb&lt;br /&gt;
| unpack words into bytes&lt;br /&gt;
|-&lt;br /&gt;
! pklb&lt;br /&gt;
| pack longs into bytes&lt;br /&gt;
|-&lt;br /&gt;
! unpklb&lt;br /&gt;
| unpack longs into bytes&lt;br /&gt;
|-&lt;br /&gt;
! perr&lt;br /&gt;
| sum the absolute differences of each byte (pixel error)&amp;lt;ref&amp;gt;{{cite web|url=http://www.alphalinux.org/docs/MVI-full.html|title=Motion Video Instructions (MVI)|author=James Hicks|coauthors=Richard Weiss|year=1999|month=February|format=HTML|publisher=Compaq Computer Corporation}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Determining Presence ==&lt;br /&gt;
&lt;br /&gt;
To determine the presence of MVI, use the [[amask]] instruction.&lt;br /&gt;
&lt;br /&gt;
== Latency and Slotting ==&lt;br /&gt;
&lt;br /&gt;
On the in-order PCA56, all MVIs have a latency of 2 cycles. This means, at least one instruction must separate MVIs to prevent stalling. On the out-of-order [[Processors#EV6|EV6]] and newer, MVIs have a latency of 3 cycles and are slotted U0&amp;lt;ref&amp;gt;{{cite web|url=http://h18002.www1.hp.com/alphaserver/technology/literature/cmpwrgd.pdf|title=Compiler Writer’s Guide for the Alpha 21264|year=1999|month=June|format=PDF|publisher=Compaq Computer Corporation|pages=35-38}}&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Usage ==&lt;br /&gt;
&lt;br /&gt;
=== Unsigned Saturated Arithmetic ===&lt;br /&gt;
&lt;br /&gt;
By using the packed minimum, packed unsigned saturated addition and subtraction can be easily performed.&lt;br /&gt;
&lt;br /&gt;
For instance, to add the packed unsigned bytes stored in $16 with those in $17 with saturation and store the result in $0:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;ornot  $31,$16,$1&lt;br /&gt;
minub8 $17,$1,$17&lt;br /&gt;
addq   $16,$17,$0&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To subtract the packed unsigned bytes stored in $16 with those in $17 with saturation and store the result in $0:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;minub8 $17,$16,$17&lt;br /&gt;
subq   $16,$17,$0&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note, these are not optimized for register usage or latency.&lt;br /&gt;
&lt;br /&gt;
To use this in C, the following functions may be used.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;#define __minub8        __builtin_alpha_minub8&lt;br /&gt;
#define __minuw4        __builtin_alpha_minuw4&lt;br /&gt;
&lt;br /&gt;
/* Add the 8-bit values in M1 to the 8-bit values in M2 using unsigned&lt;br /&gt;
 * saturated arithmetic (MMX equivalent: paddusb) */&lt;br /&gt;
static inline __m64&lt;br /&gt;
addusb8(__m64 m1, __m64 m2) {&lt;br /&gt;
        return m1 + __minub8(m2, ~m1);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/* Add the 16-bit values in M1 to the 16-bit values in M2 using unsigned&lt;br /&gt;
 * saturating arithmetic (MMX equilvant: paddusw) */&lt;br /&gt;
static inline __m64&lt;br /&gt;
addusw4(__m64 m1, __m64 m2) {&lt;br /&gt;
        return m1 + __minuw4(m2, ~m1);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/* Subtract the 8-bit values in M1 to the 8-bit values in M2 using unsigned&lt;br /&gt;
 * saturated arithmetic (MMX equivalent: psubusb) */&lt;br /&gt;
static inline __m64&lt;br /&gt;
subusb8(__m64 m1, __m64 m2) {&lt;br /&gt;
        return m1 - __minub8(m2, m1);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/* Subtract the 16-bit values in M1 to the 16-bit values in M2 using unsigned&lt;br /&gt;
 * saturating arithmetic (MMX equivalent: psubusw) */&lt;br /&gt;
static inline __m64&lt;br /&gt;
subusw4(__m64 m1, __m64 m2) {&lt;br /&gt;
        return m1 - __minuw4(m2, m1);&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== External Links ==&lt;br /&gt;
* [http://alphalinux.org/documents/mvi-code-ex.pdf MVI Code Examples]&lt;br /&gt;
* [http://alphalinux.org/documents/pmvi.pdf Digital's Motion Video Instruction Extensions for Alpha Whitepaper]&lt;br /&gt;
* [http://alphalinux.org/documents/digi_add_multimedia.pdf ''Digital, MIPS Add Multimedia Extensions'']&lt;br /&gt;
* [http://alphalinux.org/documents/1997DEC01_MSD_TAC19.pdf ''Real Time MPEG-I and MPEG-II Compression with the Alpha Microprocessors'']&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Programming]]&lt;/div&gt;</summary>
		<author><name>Gareth</name></author>
		
	</entry>
</feed>