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>
20
* clear_blocks_mmi() by BroadQ
23
#include "../dsputil.h"
26
void ff_mmi_idct_put(uint8_t *dest, int line_size, DCTELEM *block);
27
void ff_mmi_idct_add(uint8_t *dest, int line_size, DCTELEM *block);
28
void ff_mmi_idct(DCTELEM *block);
30
static void clear_blocks_mmi(DCTELEM * blocks)
34
"addiu $9, %0, 768 \n"
46
: "+r" (blocks) :: "$8", "$9", "memory" );
50
static void get_pixels_mmi(DCTELEM *block, const uint8_t *pixels, int line_size)
60
"pextlb $8, $0, $8 \n\t"
64
"pextlb $9, $0, $9 \n\t"
68
"pextlb $10, $0, $10 \n\t"
72
"pextlb $8, $0, $8 \n\t"
76
"pextlb $9, $0, $9 \n\t"
80
"pextlb $10, $0, $10 \n\t"
82
"pextlb $8, $0, $8 \n\t"
84
"pextlb $9, $0, $9 \n\t"
87
: "+r" (pixels) : "r" (block), "r" (line_size) : "$8", "$9", "$10", "memory" );
91
static void put_pixels8_mmi(uint8_t *block, const uint8_t *pixels, int line_size, int h)
98
"addiu %2, %2, -1 \n\t"
100
"add %1, %1, %3 \n\t"
102
"add %0, %0, %3 \n\t"
105
: "+r" (block), "+r" (pixels), "+r" (h) : "r" (line_size)
110
static void put_pixels16_mmi(uint8_t *block, const uint8_t *pixels, int line_size, int h)
117
"add $11, %1, %3 \n\t"
119
"add $10, %0, %3 \n\t"
121
"ldl $9, 15(%1) \n\t"
122
"ldr $12, 0($11) \n\t"
123
"add %1, $11, %3 \n\t"
124
"ldl $12, 7($11) \n\t"
125
"pcpyld $8, $9, $8 \n\t"
127
"ldr $13, 8($11) \n\t"
128
"addiu %2, %2, -2 \n\t"
129
"ldl $13, 15($11) \n\t"
130
"add %0, $10, %3 \n\t"
131
"pcpyld $12, $13, $12 \n\t"
132
"sq $12, 0($10) \n\t"
135
: "+r" (block), "+r" (pixels), "+r" (h) : "r" (line_size)
136
: "$8", "$9", "$10", "$11", "$12", "$13", "memory" );
140
void dsputil_init_mmi(DSPContext* c, AVCodecContext *avctx)
142
const int idct_algo= avctx->idct_algo;
144
c->clear_blocks = clear_blocks_mmi;
146
c->put_pixels_tab[1][0] = put_pixels8_mmi;
147
c->put_no_rnd_pixels_tab[1][0] = put_pixels8_mmi;
149
c->put_pixels_tab[0][0] = put_pixels16_mmi;
150
c->put_no_rnd_pixels_tab[0][0] = put_pixels16_mmi;
152
c->get_pixels = get_pixels_mmi;
154
if(idct_algo==FF_IDCT_AUTO || idct_algo==FF_IDCT_PS2){
155
c->idct_put= ff_mmi_idct_put;
156
c->idct_add= ff_mmi_idct_add;
157
c->idct = ff_mmi_idct;
158
c->idct_permutation_type= FF_LIBMPEG2_IDCT_PERM;