2 * MMI optimized DSP utils
3 * Copyright (c) 2000, 2001 Fabrice Bellard.
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 * MMI optimization by Leon van Stuivenberg <leonvs@iae.nl>
22 #include "../dsputil.h"
25 /* the provided 'as' in binutils 2.9EE doesn't support
26 the EE's mips3 instructions properly */
30 static void clear_blocks_mmi(DCTELEM * blocks)
33 for (i = 0; i < 6; i++) {
42 "sq $0, 112(%0) \n\t" :: "r" (blocks) : "memory" );
48 static void get_pixels_mmi(DCTELEM *block, const UINT8 *pixels, int line_size)
56 "pextlb $8, $0, $8 \n\t"
57 "sq $8, 0(%0) \n\t" :: "r" (block), "r" (pixels), "r" (line_size) : "$8", "memory" );
62 "pextlb $8, $0, $8 \n\t"
63 "sq $8, 0(%0) \n\t" :: "r" (block), "r" (pixels), "r" (line_size) : "$8", "memory" );
70 static void put_pixels8_mmi(uint8_t *block, const uint8_t *pixels, int line_size, int h)
77 asm volatile ( "add $5, $5, $6 \n\t" );
79 asm volatile ( "add $4, $4, $6 \n\t" );
86 "add %0, %0, %2 \n\t" :: "r" (block), "r" (pixels), "r" (line_size) : "$8", "memory" );
92 static void put_pixels16_mmi(uint8_t *block, const uint8_t *pixels, int line_size, int h)
101 asm volatile ( "add $5, $5, $6 \n\t" );
104 asm volatile ( "add $4, $4, $6 \n\t" );
110 "ldl $9, 15(%1) \n\t"
111 "add %1, %1, %2 \n\t"
112 "pcpyld $8, $9, $8 \n\t"
114 "add %0, %0, %2 \n\t" :: "r" (block), "r" (pixels), "r" (line_size) : "$8", "$9", "memory" );
120 void dsputil_init_mmi(void)
122 clear_blocks = clear_blocks_mmi;
124 put_pixels_tab[1][0] = put_pixels8_mmi;
125 put_no_rnd_pixels_tab[1][0] = put_pixels8_mmi;
127 put_pixels_tab[0][0] = put_pixels16_mmi;
128 put_no_rnd_pixels_tab[0][0] = put_pixels16_mmi;
130 get_pixels = get_pixels_mmi;