Mercurial > libavcodec.hg
annotate sh4/dsputil_sh4.c @ 10484:ccad7a2ff75f libavcodec
Set the sample format for Smacker audio in the decoder rather than in the
demuxer.
author | jbr |
---|---|
date | Sun, 01 Nov 2009 15:08:49 +0000 |
parents | cf4d575b1982 |
children | c166792100a0 |
rev | line source |
---|---|
1259
e8c3884f2c7e
sh4 optimized idct & bswap patch by (BERO <bero at geocities dot co dot jp>)
michaelni
parents:
diff
changeset
|
1 /* |
e8c3884f2c7e
sh4 optimized idct & bswap patch by (BERO <bero at geocities dot co dot jp>)
michaelni
parents:
diff
changeset
|
2 * sh4 dsputil |
e8c3884f2c7e
sh4 optimized idct & bswap patch by (BERO <bero at geocities dot co dot jp>)
michaelni
parents:
diff
changeset
|
3 * |
e8c3884f2c7e
sh4 optimized idct & bswap patch by (BERO <bero at geocities dot co dot jp>)
michaelni
parents:
diff
changeset
|
4 * Copyright (c) 2003 BERO <bero@geocities.co.jp> |
e8c3884f2c7e
sh4 optimized idct & bswap patch by (BERO <bero at geocities dot co dot jp>)
michaelni
parents:
diff
changeset
|
5 * |
3947
c8c591fe26f8
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
3036
diff
changeset
|
6 * This file is part of FFmpeg. |
c8c591fe26f8
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
3036
diff
changeset
|
7 * |
c8c591fe26f8
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
3036
diff
changeset
|
8 * FFmpeg is free software; you can redistribute it and/or |
1259
e8c3884f2c7e
sh4 optimized idct & bswap patch by (BERO <bero at geocities dot co dot jp>)
michaelni
parents:
diff
changeset
|
9 * modify it under the terms of the GNU Lesser General Public |
e8c3884f2c7e
sh4 optimized idct & bswap patch by (BERO <bero at geocities dot co dot jp>)
michaelni
parents:
diff
changeset
|
10 * License as published by the Free Software Foundation; either |
3947
c8c591fe26f8
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
3036
diff
changeset
|
11 * version 2.1 of the License, or (at your option) any later version. |
1259
e8c3884f2c7e
sh4 optimized idct & bswap patch by (BERO <bero at geocities dot co dot jp>)
michaelni
parents:
diff
changeset
|
12 * |
3947
c8c591fe26f8
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
3036
diff
changeset
|
13 * FFmpeg is distributed in the hope that it will be useful, |
1259
e8c3884f2c7e
sh4 optimized idct & bswap patch by (BERO <bero at geocities dot co dot jp>)
michaelni
parents:
diff
changeset
|
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
e8c3884f2c7e
sh4 optimized idct & bswap patch by (BERO <bero at geocities dot co dot jp>)
michaelni
parents:
diff
changeset
|
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
e8c3884f2c7e
sh4 optimized idct & bswap patch by (BERO <bero at geocities dot co dot jp>)
michaelni
parents:
diff
changeset
|
16 * Lesser General Public License for more details. |
e8c3884f2c7e
sh4 optimized idct & bswap patch by (BERO <bero at geocities dot co dot jp>)
michaelni
parents:
diff
changeset
|
17 * |
e8c3884f2c7e
sh4 optimized idct & bswap patch by (BERO <bero at geocities dot co dot jp>)
michaelni
parents:
diff
changeset
|
18 * You should have received a copy of the GNU Lesser General Public |
3947
c8c591fe26f8
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
3036
diff
changeset
|
19 * License along with FFmpeg; if not, write to the Free Software |
3036
0b546eab515d
Update licensing information: The FSF changed postal address.
diego
parents:
2979
diff
changeset
|
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
1259
e8c3884f2c7e
sh4 optimized idct & bswap patch by (BERO <bero at geocities dot co dot jp>)
michaelni
parents:
diff
changeset
|
21 */ |
e8c3884f2c7e
sh4 optimized idct & bswap patch by (BERO <bero at geocities dot co dot jp>)
michaelni
parents:
diff
changeset
|
22 |
6763 | 23 #include "libavcodec/avcodec.h" |
24 #include "libavcodec/dsputil.h" | |
8178 | 25 #include "sh4.h" |
1259
e8c3884f2c7e
sh4 optimized idct & bswap patch by (BERO <bero at geocities dot co dot jp>)
michaelni
parents:
diff
changeset
|
26 |
e8c3884f2c7e
sh4 optimized idct & bswap patch by (BERO <bero at geocities dot co dot jp>)
michaelni
parents:
diff
changeset
|
27 static void memzero_align8(void *dst,size_t size) |
e8c3884f2c7e
sh4 optimized idct & bswap patch by (BERO <bero at geocities dot co dot jp>)
michaelni
parents:
diff
changeset
|
28 { |
8178 | 29 int fpscr; |
30 fp_single_enter(fpscr); | |
31 dst = (char *)dst + size; | |
32 size /= 32; | |
33 __asm__ volatile ( | |
2979 | 34 " fldi0 fr0\n" |
35 " fldi0 fr1\n" | |
36 " fschg\n" // double | |
37 "1: \n" \ | |
38 " dt %1\n" | |
39 " fmov dr0,@-%0\n" | |
40 " fmov dr0,@-%0\n" | |
41 " fmov dr0,@-%0\n" | |
42 " bf.s 1b\n" | |
43 " fmov dr0,@-%0\n" | |
44 " fschg" //back to single | |
8178 | 45 : "+r"(dst),"+r"(size) :: "memory" ); |
46 fp_single_leave(fpscr); | |
1259
e8c3884f2c7e
sh4 optimized idct & bswap patch by (BERO <bero at geocities dot co dot jp>)
michaelni
parents:
diff
changeset
|
47 } |
e8c3884f2c7e
sh4 optimized idct & bswap patch by (BERO <bero at geocities dot co dot jp>)
michaelni
parents:
diff
changeset
|
48 |
e8c3884f2c7e
sh4 optimized idct & bswap patch by (BERO <bero at geocities dot co dot jp>)
michaelni
parents:
diff
changeset
|
49 static void clear_blocks_sh4(DCTELEM *blocks) |
e8c3884f2c7e
sh4 optimized idct & bswap patch by (BERO <bero at geocities dot co dot jp>)
michaelni
parents:
diff
changeset
|
50 { |
2979 | 51 memzero_align8(blocks,sizeof(DCTELEM)*6*64); |
1259
e8c3884f2c7e
sh4 optimized idct & bswap patch by (BERO <bero at geocities dot co dot jp>)
michaelni
parents:
diff
changeset
|
52 } |
e8c3884f2c7e
sh4 optimized idct & bswap patch by (BERO <bero at geocities dot co dot jp>)
michaelni
parents:
diff
changeset
|
53 |
8250 | 54 void idct_sh4(DCTELEM *block); |
1259
e8c3884f2c7e
sh4 optimized idct & bswap patch by (BERO <bero at geocities dot co dot jp>)
michaelni
parents:
diff
changeset
|
55 static void idct_put(uint8_t *dest, int line_size, DCTELEM *block) |
e8c3884f2c7e
sh4 optimized idct & bswap patch by (BERO <bero at geocities dot co dot jp>)
michaelni
parents:
diff
changeset
|
56 { |
2979 | 57 int i; |
4176 | 58 uint8_t *cm = ff_cropTbl + MAX_NEG_CROP; |
8171 | 59 idct_sh4(block); |
2979 | 60 for(i=0;i<8;i++) { |
61 dest[0] = cm[block[0]]; | |
62 dest[1] = cm[block[1]]; | |
63 dest[2] = cm[block[2]]; | |
64 dest[3] = cm[block[3]]; | |
65 dest[4] = cm[block[4]]; | |
66 dest[5] = cm[block[5]]; | |
67 dest[6] = cm[block[6]]; | |
68 dest[7] = cm[block[7]]; | |
69 dest+=line_size; | |
70 block+=8; | |
71 } | |
1259
e8c3884f2c7e
sh4 optimized idct & bswap patch by (BERO <bero at geocities dot co dot jp>)
michaelni
parents:
diff
changeset
|
72 } |
e8c3884f2c7e
sh4 optimized idct & bswap patch by (BERO <bero at geocities dot co dot jp>)
michaelni
parents:
diff
changeset
|
73 static void idct_add(uint8_t *dest, int line_size, DCTELEM *block) |
e8c3884f2c7e
sh4 optimized idct & bswap patch by (BERO <bero at geocities dot co dot jp>)
michaelni
parents:
diff
changeset
|
74 { |
2979 | 75 int i; |
4176 | 76 uint8_t *cm = ff_cropTbl + MAX_NEG_CROP; |
8171 | 77 idct_sh4(block); |
2979 | 78 for(i=0;i<8;i++) { |
79 dest[0] = cm[dest[0]+block[0]]; | |
80 dest[1] = cm[dest[1]+block[1]]; | |
81 dest[2] = cm[dest[2]+block[2]]; | |
82 dest[3] = cm[dest[3]+block[3]]; | |
83 dest[4] = cm[dest[4]+block[4]]; | |
84 dest[5] = cm[dest[5]+block[5]]; | |
85 dest[6] = cm[dest[6]+block[6]]; | |
86 dest[7] = cm[dest[7]+block[7]]; | |
87 dest+=line_size; | |
88 block+=8; | |
89 } | |
1259
e8c3884f2c7e
sh4 optimized idct & bswap patch by (BERO <bero at geocities dot co dot jp>)
michaelni
parents:
diff
changeset
|
90 } |
e8c3884f2c7e
sh4 optimized idct & bswap patch by (BERO <bero at geocities dot co dot jp>)
michaelni
parents:
diff
changeset
|
91 |
8250 | 92 void dsputil_init_align(DSPContext* c, AVCodecContext *avctx); |
1259
e8c3884f2c7e
sh4 optimized idct & bswap patch by (BERO <bero at geocities dot co dot jp>)
michaelni
parents:
diff
changeset
|
93 |
e8c3884f2c7e
sh4 optimized idct & bswap patch by (BERO <bero at geocities dot co dot jp>)
michaelni
parents:
diff
changeset
|
94 void dsputil_init_sh4(DSPContext* c, AVCodecContext *avctx) |
e8c3884f2c7e
sh4 optimized idct & bswap patch by (BERO <bero at geocities dot co dot jp>)
michaelni
parents:
diff
changeset
|
95 { |
2979 | 96 const int idct_algo= avctx->idct_algo; |
97 dsputil_init_align(c,avctx); | |
1259
e8c3884f2c7e
sh4 optimized idct & bswap patch by (BERO <bero at geocities dot co dot jp>)
michaelni
parents:
diff
changeset
|
98 |
2979 | 99 c->clear_blocks = clear_blocks_sh4; |
100 if(idct_algo==FF_IDCT_AUTO || idct_algo==FF_IDCT_SH4){ | |
101 c->idct_put = idct_put; | |
102 c->idct_add = idct_add; | |
1324
7d328fd9d8a5
the return of the idct with 16bit output by ("Ivan Kalvachev" <ivan at cacad dot com>)
michaelni
parents:
1260
diff
changeset
|
103 c->idct = idct_sh4; |
8176 | 104 c->idct_permutation_type= FF_NO_IDCT_PERM; |
2979 | 105 } |
1259
e8c3884f2c7e
sh4 optimized idct & bswap patch by (BERO <bero at geocities dot co dot jp>)
michaelni
parents:
diff
changeset
|
106 } |