Parent Directory
|
Revision Log
Revision 1.1.1.1 - (view) (download)
1 : | Isibaar | 1.1 | /************************************************************************** |
2 : | * | ||
3 : | * XVID MPEG-4 VIDEO CODEC | ||
4 : | * 8bit<->16bit transfer | ||
5 : | * | ||
6 : | * This program is an implementation of a part of one or more MPEG-4 | ||
7 : | * Video tools as specified in ISO/IEC 14496-2 standard. Those intending | ||
8 : | * to use this software module in hardware or software products are | ||
9 : | * advised that its use may infringe existing patents or copyrights, and | ||
10 : | * any such use would be at such party's own risk. The original | ||
11 : | * developer of this software module and his/her company, and subsequent | ||
12 : | * editors and their companies, will have no liability for use of this | ||
13 : | * software or modifications or derivatives thereof. | ||
14 : | * | ||
15 : | * This program is free software; you can redistribute it and/or modify | ||
16 : | * it under the terms of the GNU General Public License as published by | ||
17 : | * the Free Software Foundation; either version 2 of the License, or | ||
18 : | * (at your option) any later version. | ||
19 : | * | ||
20 : | * This program is distributed in the hope that it will be useful, | ||
21 : | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
22 : | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
23 : | * GNU General Public License for more details. | ||
24 : | * | ||
25 : | * You should have received a copy of the GNU General Public License | ||
26 : | * along with this program; if not, write to the Free Software | ||
27 : | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
28 : | * | ||
29 : | *************************************************************************/ | ||
30 : | |||
31 : | /************************************************************************** | ||
32 : | * | ||
33 : | * History: | ||
34 : | * | ||
35 : | * 07.01.2002 merge functions from compensate; rename functions | ||
36 : | * 22.12.2001 transfer_8to8add16 limit fix | ||
37 : | * 07.11.2001 initial version; (c)2001 peter ross <pross@cs.rmit.edu.au> | ||
38 : | |||
39 : | *************************************************************************/ | ||
40 : | |||
41 : | TRANSFER_8TO16SUB_PTR transfer_8to16sub; | ||
42 : | TRANSFER_8TO16SUB2_PTR transfer_8to16sub2; | ||
43 : | TRANSFER_16TO8ADD_PTR transfer_16to8add; | ||
44 : | |||
45 : | // function pointers | ||
46 : | TRANSFER_8TO16COPY_PTR transfer_8to16copy; | ||
47 : | TRANSFER_16TO8COPY_PTR transfer_16to8copy; | ||
48 : | * | ||
49 : | TRANSFER_8TO16SUB_PTR transfer_8to16sub; | ||
50 : | TRANSFER_16TO8ADD_PTR transfer_16to8add; | ||
51 : | * This is typically used during motion compensation, that's why some | ||
52 : | TRANSFER8X8_COPY_PTR transfer8x8_copy; | ||
53 : | * so called transfer. | ||
54 : | * | ||
55 : | */ | ||
56 : | void transfer_8to16copy_c(int16_t * const dst, | ||
57 : | const uint8_t * const src, | ||
58 : | uint32_t stride) | ||
59 : | |||
60 : | /* | ||
61 : | * SRC - the source buffer | ||
62 : | * DST - the destination buffer | ||
63 : | * | ||
64 : | dst[j * 8 + i] = (int16_t)src[j * stride + i]; | ||
65 : | * | ||
66 : | * SRC (16bit) = SRC | ||
67 : | * DST (8bit) = max(min(SRC, 255), 0) | ||
68 : | */ | ||
69 : | |||
70 : | void transfer_16to8copy_c(uint8_t * const dst, | ||
71 : | const int16_t * const src, | ||
72 : | uint32_t stride) | ||
73 : | } else if (pixel > 255) { | ||
74 : | pixel = 255; | ||
75 : | } | ||
76 : | dst[j * stride + i] = (uint8_t) pixel; | ||
77 : | } | ||
78 : | } | ||
79 : | |||
80 : | |||
81 : | |||
82 : | |||
83 : | } | ||
84 : | dst[j * stride + i] = (uint8_t)pixel; | ||
85 : | * R - the reference buffer | ||
86 : | * DCT - the dct coefficient buffer | ||
87 : | * | ||
88 : | * Then the function does the 8->16 bit transfer and this serie of operations : | ||
89 : | * | ||
90 : | * R (8bit) = R | ||
91 : | * C (8bit) = R | ||
92 : | * DCT (16bit) = C - R | ||
93 : | perform motion compensation (and 8bit->16bit dct transfer) | ||
94 : | */ | ||
95 : | void transfer_8to16sub_c(int16_t * const dct, | ||
96 : | uint8_t * const cur, | ||
97 : | const uint8_t * ref, | ||
98 : | const uint32_t stride) | ||
99 : | dct[j * 8 + i] = (int16_t) c - (int16_t) r; | ||
100 : | } | ||
101 : | } | ||
102 : | for (j = 0; j < 8; j++) | ||
103 : | { | ||
104 : | for (i = 0; i < 8; i++) | ||
105 : | { | ||
106 : | |||
107 : | /* | ||
108 : | * R1 - the 1st reference buffer | ||
109 : | dct[j * 8 + i] = (int16_t)c - (int16_t)r; | ||
110 : | * Then the function does the 16->8 bit transfer and this serie of operations : | ||
111 : | * | ||
112 : | * SRC (16bit) = SRC | ||
113 : | * DST (8bit) = max(min(DST+SRC, 255), 0) | ||
114 : | */ | ||
115 : | void transfer_16to8add_c(uint8_t * const dst, | ||
116 : | if (pixel < 0) { | ||
117 : | pixel = 0; | ||
118 : | } else if (pixel > 255) { | ||
119 : | pixel = 255; | ||
120 : | } | ||
121 : | dst[j * stride + i] = (uint8_t) pixel; | ||
122 : | } | ||
123 : | int16_t pixel = (int16_t)dst[j * stride + i] + src[j * 8 + i]; | ||
124 : | |||
125 : | /* | ||
126 : | * SRC - the source buffer | ||
127 : | * DST - the destination buffer | ||
128 : | } | ||
129 : | dst[j * stride + i] = (uint8_t)pixel; | ||
130 : | * | ||
131 : | * SRC (8bit) = SRC | ||
132 : | * DST (8bit) = SRC | ||
133 : | */ | ||
134 : | |||
135 : | |||
136 : | |||
137 : | void transfer8x8_copy_c(uint8_t * const dst, | ||
138 : | const uint8_t * const src, | ||
139 : | const uint32_t stride) | ||
140 : |
No admin address has been configured | ViewVC Help |
Powered by ViewVC 1.0.4 |