4 * Copyright (c) 2003 BERO <bero@geocities.co.jp>
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 #include "../avcodec.h"
22 #include "../dsputil.h"
24 static void memzero_align8(void *dst
,size_t size
)
26 #if defined(__SH4__) || defined(__SH4_SINGLE__) || defined(__SH4_SINGLE_ONLY__)
31 " fschg\n" //single float mode
43 #if defined(__SH4_SINGLE__) || defined(__SH4_SINGLE_ONLY__)
44 " fschg" //back to single
46 : : "r"(dst
),"r"(size
): "memory" );
60 static void clear_blocks_sh4(DCTELEM
*blocks
)
62 // if (((int)blocks&7)==0)
63 memzero_align8(blocks
,sizeof(DCTELEM
)*6*64);
66 extern void idct_sh4(DCTELEM
*block
);
67 static void idct_put(uint8_t *dest
, int line_size
, DCTELEM
*block
)
71 uint8_t *cm
= cropTbl
+ MAX_NEG_CROP
;
73 dest
[0] = cm
[block
[0]];
74 dest
[1] = cm
[block
[1]];
75 dest
[2] = cm
[block
[2]];
76 dest
[3] = cm
[block
[3]];
77 dest
[4] = cm
[block
[4]];
78 dest
[5] = cm
[block
[5]];
79 dest
[6] = cm
[block
[6]];
80 dest
[7] = cm
[block
[7]];
85 static void idct_add(uint8_t *dest
, int line_size
, DCTELEM
*block
)
89 uint8_t *cm
= cropTbl
+ MAX_NEG_CROP
;
91 dest
[0] = cm
[dest
[0]+block
[0]];
92 dest
[1] = cm
[dest
[1]+block
[1]];
93 dest
[2] = cm
[dest
[2]+block
[2]];
94 dest
[3] = cm
[dest
[3]+block
[3]];
95 dest
[4] = cm
[dest
[4]+block
[4]];
96 dest
[5] = cm
[dest
[5]+block
[5]];
97 dest
[6] = cm
[dest
[6]+block
[6]];
98 dest
[7] = cm
[dest
[7]+block
[7]];
104 extern void dsputil_init_align(DSPContext
* c
, AVCodecContext
*avctx
);
106 void dsputil_init_sh4(DSPContext
* c
, AVCodecContext
*avctx
)
108 const int idct_algo
= avctx
->idct_algo
;
109 dsputil_init_align(c
,avctx
);
111 c
->clear_blocks
= clear_blocks_sh4
;
112 if(idct_algo
==FF_IDCT_AUTO
|| idct_algo
==FF_IDCT_SH4
){
113 c
->idct_put
= idct_put
;
114 c
->idct_add
= idct_add
;
116 c
->idct_permutation_type
= FF_NO_IDCT_PERM
; //FF_SIMPLE_IDCT_PERM; //FF_LIBMPEG2_IDCT_PERM;