Parent Directory
|
Revision Log
Revision 1.1.2.3 - (view) (download)
1 : | edgomez | 1.1.2.3 | /***************************************************************************** |
2 : | chl | 1.1.2.1 | * |
3 : | edgomez | 1.1.2.3 | * XVID MPEG-4 VIDEO CODEC |
4 : | * - GMC interpolation module header - | ||
5 : | chl | 1.1.2.1 | * |
6 : | edgomez | 1.1.2.3 | * Copyright(C) 2002-2003 Pascal Massimino <skal@planet-d.net> |
7 : | chl | 1.1.2.1 | * |
8 : | edgomez | 1.1.2.3 | * This program is free software ; you can redistribute it and/or modify |
9 : | * it under the terms of the GNU General Public License as published by | ||
10 : | * the Free Software Foundation ; either version 2 of the License, or | ||
11 : | * (at your option) any later version. | ||
12 : | * | ||
13 : | * This program is distributed in the hope that it will be useful, | ||
14 : | * but WITHOUT ANY WARRANTY ; without even the implied warranty of | ||
15 : | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
16 : | * GNU General Public License for more details. | ||
17 : | * | ||
18 : | * You should have received a copy of the GNU General Public License | ||
19 : | * along with this program ; if not, write to the Free Software | ||
20 : | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
21 : | * | ||
22 : | * $Id$ | ||
23 : | * | ||
24 : | ****************************************************************************/ | ||
25 : | chl | 1.1.2.1 | |
26 : | #include "../portab.h" | ||
27 : | #include "../global.h" | ||
28 : | |||
29 : | /* This is borrowed from decoder.c */ | ||
30 : | edgomez | 1.1.2.3 | static __inline int |
31 : | gmc_sanitize(int value, int quarterpel, int fcode) | ||
32 : | chl | 1.1.2.1 | { |
33 : | int length = 1 << (fcode+4); | ||
34 : | |||
35 : | edgomez | 1.1.2.3 | if (quarterpel) value *= 2; |
36 : | chl | 1.1.2.1 | |
37 : | if (value < -length) | ||
38 : | return -length; | ||
39 : | else if (value >= length) | ||
40 : | return length-1; | ||
41 : | else return value; | ||
42 : | } | ||
43 : | |||
44 : | |||
45 : | /* And this is borrowed from bitstream.c until we find a common solution */ | ||
46 : | static uint32_t __inline | ||
47 : | log2bin(uint32_t value) | ||
48 : | { | ||
49 : | /* Changed by Chenm001 */ | ||
50 : | #if !defined(_MSC_VER) | ||
51 : | int n = 0; | ||
52 : | |||
53 : | while (value) { | ||
54 : | syskin | 1.1.2.2 | value >>= 1; |
55 : | n++; | ||
56 : | chl | 1.1.2.1 | } |
57 : | return n; | ||
58 : | #else | ||
59 : | __asm { | ||
60 : | syskin | 1.1.2.2 | bsr eax, value |
61 : | inc eax | ||
62 : | chl | 1.1.2.1 | } |
63 : | #endif | ||
64 : | } | ||
65 : | /* 16*sizeof(int) -> 1 or 2 cachelines */ | ||
66 : | /* table lookup might be faster! (still to be benchmarked) */ | ||
67 : | |||
68 : | /* | ||
69 : | static int log2bin_table[16] = | ||
70 : | { 0, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 4}; | ||
71 : | */ | ||
72 : | syskin | 1.1.2.2 | /* 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 */ |
73 : | chl | 1.1.2.1 | |
74 : | #define RDIV(a,b) (((a)>0 ? (a) + ((b)>>1) : (a) - ((b)>>1))/(b)) | ||
75 : | #define RSHIFT(a,b) ( (a)>0 ? ((a) + (1<<((b)-1)))>>(b) : ((a) + (1<<((b)-1))-1)>>(b)) | ||
76 : | |||
77 : | #define MLT(i) (((16-(i))<<16) + (i)) | ||
78 : | static const uint32_t MTab[16] = { | ||
79 : | MLT( 0), MLT( 1), MLT( 2), MLT( 3), MLT( 4), MLT( 5), MLT( 6), MLT( 7), | ||
80 : | MLT( 8), MLT( 9), MLT(10), MLT(11), MLT(12), MLT(13), MLT(14), MLT(15) | ||
81 : | }; | ||
82 : | #undef MLT | ||
83 : | |||
84 : | ////////////////////////////////////////////////////////// | ||
85 : | // Pts = 2 or 3 | ||
86 : | |||
87 : | // Warning! *src is the global frame pointer (that is: adress | ||
88 : | // of pixel 0,0), not the macroblock one. | ||
89 : | // Conversely, *dst is the macroblock top-left adress. | ||
90 : | |||
91 : | void Predict_16x16_C(const NEW_GMC_DATA * const This, | ||
92 : | syskin | 1.1.2.2 | uint8_t *dst, const uint8_t *src, |
93 : | int dststride, int srcstride, int x, int y, int rounding); | ||
94 : | chl | 1.1.2.1 | |
95 : | void Predict_8x8_C(const NEW_GMC_DATA * const This, | ||
96 : | syskin | 1.1.2.2 | uint8_t *uDst, const uint8_t *uSrc, |
97 : | uint8_t *vDst, const uint8_t *vSrc, | ||
98 : | int dststride, int srcstride, int x, int y, int rounding); | ||
99 : | chl | 1.1.2.1 | |
100 : | syskin | 1.1.2.2 | void get_average_mv_C(const NEW_GMC_DATA * const Dsp, VECTOR * const mv, |
101 : | int x, int y, int qpel); | ||
102 : | chl | 1.1.2.1 | |
103 : | /* ************************************************************ */ | ||
104 : | // simplified version for 1 warp point | ||
105 : | |||
106 : | void Predict_1pt_16x16_C(const NEW_GMC_DATA * const This, | ||
107 : | syskin | 1.1.2.2 | uint8_t *Dst, const uint8_t *Src, |
108 : | int dststride, int srcstride, int x, int y, int rounding); | ||
109 : | chl | 1.1.2.1 | |
110 : | void Predict_1pt_8x8_C(const NEW_GMC_DATA * const This, | ||
111 : | syskin | 1.1.2.2 | uint8_t *uDst, const uint8_t *uSrc, |
112 : | uint8_t *vDst, const uint8_t *vSrc, | ||
113 : | int dststride, int srcstride, int x, int y, int rounding); | ||
114 : | chl | 1.1.2.1 | |
115 : | syskin | 1.1.2.2 | void get_average_mv_1pt_C(const NEW_GMC_DATA * const Dsp, VECTOR * const mv, |
116 : | int x, int y, int qpel); | ||
117 : | chl | 1.1.2.1 | |
118 : | /* ************************************************************* */ | ||
119 : | |||
120 : | |||
121 : | // Warning! It's Accuracy being passed, not 'resolution'! | ||
122 : | |||
123 : | syskin | 1.1.2.2 | void generate_GMCparameters(int nb_pts, const int accuracy, |
124 : | const WARPPOINTS *const pts, | ||
125 : | const int width, const int height, | ||
126 : | NEW_GMC_DATA *const gmc); | ||
127 : | chl | 1.1.2.1 | |
128 : | /* ******************************************************************* */ | ||
129 : | |||
130 : | |||
131 : | void | ||
132 : | generate_GMCimage( const NEW_GMC_DATA *const gmc_data, // [input] precalculated data | ||
133 : | const IMAGE *const pRef, // [input] | ||
134 : | const int mb_width, | ||
135 : | const int mb_height, | ||
136 : | const int stride, | ||
137 : | const int stride2, | ||
138 : | const int fcode, // [input] some parameters... | ||
139 : | const int32_t quarterpel, // [input] for rounding avgMV | ||
140 : | const int reduced_resolution, // [input] ignored | ||
141 : | const int32_t rounding, // [input] for rounding image data | ||
142 : | MACROBLOCK *const pMBs, // [output] average motion vectors | ||
143 : | IMAGE *const pGMC); // [output] full warped image | ||
144 : |
No admin address has been configured | ViewVC Help |
Powered by ViewVC 1.0.4 |