[Ffmpeg-devel] Duplication of macros for 16-bit multiplication in many places

Siarhei Siamashka siarhei.siamashka
Mon Sep 18 07:14:07 CEST 2006

Hello All,

Some architectures have special instructions for fast 16-bit multiply and
multiply&accumulate operations. At least armv5te supports such instructions
and apparently ARCH_POWERPC_405 has them too.

Having special macros for fast performing 16-bit multiplication with inline
assembler in one place and reusing them everywhere can help adding support 
for more similar architectures easier. Right now macros for 16-bit
multiplication are spread across the sources and defined in each 
module separately. Here as a list:

mpegaudiodec.c (MULS and MACS macro)
fft.c (MUL16 macro?)
ac3enc.c (MUL16 macro?)
simple_idct.c (MAC16 and MUL16 macro)
jfdctint.c (MULTIPLY16C16 macro)
jrevdct.c (MULTIPLY macro)

Also armv5 has a special instruction for single clock 16-bit * 32-bit
multiplication with getting high 32-bits of the result (48-bit result is
16-bit shifted right). Maybe the following sources can make use of this 
instruction by adding some new macro but I'm not sure:

4xm.c (MULTIPLY macro)
jfdctfst.c (MULTIPLY macro)

More information about the ffmpeg-devel mailing list