PhD for Juan Carlos Rojas Title: Multimedia Macros for Portable Optimized Programs Abstract: Multimedia processor architectures offer a combination of long partitioned registers and complex instructions that can speed up applications significantly when programmed manually. Optimized programs for these architectures have been non-portable up to now, because of differences in the instruction sets, register lengths, alignment requirements and programming styles. This dissertation presents a method that overcomes all these obstacles by providing a virtual instruction set common to a group of target architectures. This virtual instruction set is implemented as a library of C pre-processor macros called MMM. The macros can emulate long registers on architectures with short ones, and emulate complex instructions that are missing in certain targets. This research is the first to provide a general solution to the portability of optimized multimedia programs. No other method to date allows an arbitrary program to take advantage of the complex partitioned operations available in multimedia instruction sets, while remaining portable. MMM libraries were implemented for MMX & SSE, SSE2, AltiVec and TriMedia TM1300 multimedia architectures. Three examples from video compression were implemented in a portable way using MMM. The examples include IDCT, block distance for motion estimation, and block distance with interpolation. The portable examples were automatically translated into optimized code for each of the targets. Their performance is comparable, and in several cases better, than equivalent examples optimized by the processor vendors.