OLD | NEW |
1 /* | 1 /* |
2 * sh4 dsputil | 2 * sh4 dsputil |
3 * | 3 * |
4 * Copyright (c) 2003 BERO <bero@geocities.co.jp> | 4 * Copyright (c) 2003 BERO <bero@geocities.co.jp> |
5 * | 5 * |
6 * This file is part of FFmpeg. | 6 * This file is part of FFmpeg. |
7 * | 7 * |
8 * FFmpeg is free software; you can redistribute it and/or | 8 * FFmpeg is free software; you can redistribute it and/or |
9 * modify it under the terms of the GNU Lesser General Public | 9 * modify it under the terms of the GNU Lesser General Public |
10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
11 * version 2.1 of the License, or (at your option) any later version. | 11 * version 2.1 of the License, or (at your option) any later version. |
12 * | 12 * |
13 * FFmpeg is distributed in the hope that it will be useful, | 13 * FFmpeg is distributed in the hope that it will be useful, |
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
16 * Lesser General Public License for more details. | 16 * Lesser General Public License for more details. |
17 * | 17 * |
18 * You should have received a copy of the GNU Lesser General Public | 18 * You should have received a copy of the GNU Lesser General Public |
19 * License along with FFmpeg; if not, write to the Free Software | 19 * License along with FFmpeg; if not, write to the Free Software |
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | 20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
21 */ | 21 */ |
22 | 22 |
23 #include "libavcodec/avcodec.h" | 23 #include "libavcodec/avcodec.h" |
24 #include "libavcodec/dsputil.h" | 24 #include "libavcodec/dsputil.h" |
| 25 #include "dsputil_sh4.h" |
25 #include "sh4.h" | 26 #include "sh4.h" |
26 | 27 |
27 static void memzero_align8(void *dst,size_t size) | 28 static void memzero_align8(void *dst,size_t size) |
28 { | 29 { |
29 int fpscr; | 30 int fpscr; |
30 fp_single_enter(fpscr); | 31 fp_single_enter(fpscr); |
31 dst = (char *)dst + size; | 32 dst = (char *)dst + size; |
32 size /= 32; | 33 size /= 32; |
33 __asm__ volatile ( | 34 __asm__ volatile ( |
34 " fldi0 fr0\n" | 35 " fldi0 fr0\n" |
35 " fldi0 fr1\n" | 36 " fldi0 fr1\n" |
36 " fschg\n" // double | 37 " fschg\n" // double |
37 "1: \n" \ | 38 "1: \n" \ |
38 " dt %1\n" | 39 " dt %1\n" |
39 " fmov dr0,@-%0\n" | 40 " fmov dr0,@-%0\n" |
40 " fmov dr0,@-%0\n" | 41 " fmov dr0,@-%0\n" |
41 " fmov dr0,@-%0\n" | 42 " fmov dr0,@-%0\n" |
42 " bf.s 1b\n" | 43 " bf.s 1b\n" |
43 " fmov dr0,@-%0\n" | 44 " fmov dr0,@-%0\n" |
44 " fschg" //back to single | 45 " fschg" //back to single |
45 : "+r"(dst),"+r"(size) :: "memory" ); | 46 : "+r"(dst),"+r"(size) :: "memory" ); |
46 fp_single_leave(fpscr); | 47 fp_single_leave(fpscr); |
47 } | 48 } |
48 | 49 |
49 static void clear_blocks_sh4(DCTELEM *blocks) | 50 static void clear_blocks_sh4(DCTELEM *blocks) |
50 { | 51 { |
51 memzero_align8(blocks,sizeof(DCTELEM)*6*64); | 52 memzero_align8(blocks,sizeof(DCTELEM)*6*64); |
52 } | 53 } |
53 | 54 |
54 void idct_sh4(DCTELEM *block); | |
55 static void idct_put(uint8_t *dest, int line_size, DCTELEM *block) | 55 static void idct_put(uint8_t *dest, int line_size, DCTELEM *block) |
56 { | 56 { |
57 int i; | 57 int i; |
58 uint8_t *cm = ff_cropTbl + MAX_NEG_CROP; | 58 uint8_t *cm = ff_cropTbl + MAX_NEG_CROP; |
59 idct_sh4(block); | 59 idct_sh4(block); |
60 for(i=0;i<8;i++) { | 60 for(i=0;i<8;i++) { |
61 dest[0] = cm[block[0]]; | 61 dest[0] = cm[block[0]]; |
62 dest[1] = cm[block[1]]; | 62 dest[1] = cm[block[1]]; |
63 dest[2] = cm[block[2]]; | 63 dest[2] = cm[block[2]]; |
64 dest[3] = cm[block[3]]; | 64 dest[3] = cm[block[3]]; |
(...skipping 17 matching lines...) Expand all Loading... |
82 dest[3] = cm[dest[3]+block[3]]; | 82 dest[3] = cm[dest[3]+block[3]]; |
83 dest[4] = cm[dest[4]+block[4]]; | 83 dest[4] = cm[dest[4]+block[4]]; |
84 dest[5] = cm[dest[5]+block[5]]; | 84 dest[5] = cm[dest[5]+block[5]]; |
85 dest[6] = cm[dest[6]+block[6]]; | 85 dest[6] = cm[dest[6]+block[6]]; |
86 dest[7] = cm[dest[7]+block[7]]; | 86 dest[7] = cm[dest[7]+block[7]]; |
87 dest+=line_size; | 87 dest+=line_size; |
88 block+=8; | 88 block+=8; |
89 } | 89 } |
90 } | 90 } |
91 | 91 |
92 void dsputil_init_align(DSPContext* c, AVCodecContext *avctx); | |
93 | |
94 void dsputil_init_sh4(DSPContext* c, AVCodecContext *avctx) | 92 void dsputil_init_sh4(DSPContext* c, AVCodecContext *avctx) |
95 { | 93 { |
96 const int idct_algo= avctx->idct_algo; | 94 const int idct_algo= avctx->idct_algo; |
97 dsputil_init_align(c,avctx); | 95 dsputil_init_align(c,avctx); |
98 | 96 |
99 c->clear_blocks = clear_blocks_sh4; | 97 c->clear_blocks = clear_blocks_sh4; |
100 if(idct_algo==FF_IDCT_AUTO || idct_algo==FF_IDCT_SH4){ | 98 if(idct_algo==FF_IDCT_AUTO || idct_algo==FF_IDCT_SH4){ |
101 c->idct_put = idct_put; | 99 c->idct_put = idct_put; |
102 c->idct_add = idct_add; | 100 c->idct_add = idct_add; |
103 c->idct = idct_sh4; | 101 c->idct = idct_sh4; |
104 c->idct_permutation_type= FF_NO_IDCT_PERM; | 102 c->idct_permutation_type= FF_NO_IDCT_PERM; |
105 } | 103 } |
106 } | 104 } |
OLD | NEW |