3 |
* XVID MPEG-4 VIDEO CODEC |
* XVID MPEG-4 VIDEO CODEC |
4 |
* - QPel interpolation - |
* - QPel interpolation - |
5 |
* |
* |
6 |
|
* Copyright(C) 2003 Pascal Massimino <skal@planet-d.net> |
7 |
|
* |
8 |
* This program is free software ; you can redistribute it and/or modify |
* 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 |
* 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 |
* the Free Software Foundation ; either version 2 of the License, or |
19 |
* along with this program ; if not, write to the Free Software |
* along with this program ; if not, write to the Free Software |
20 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
21 |
* |
* |
22 |
*****************************************************************************/ |
* $Id: qpel.h,v 1.1.4.4 2003-09-30 18:20:31 edgomez Exp $ |
|
|
|
|
/************************************************************************** |
|
|
* |
|
|
* History: |
|
23 |
* |
* |
24 |
* 22.10.2002 initial coding - Skal - |
****************************************************************************/ |
|
* |
|
|
*************************************************************************/ |
|
25 |
|
|
26 |
#ifndef _XVID_QPEL_H_ |
#ifndef _XVID_QPEL_H_ |
27 |
#define _XVID_QPEL_H_ |
#define _XVID_QPEL_H_ |
37 |
|
|
38 |
typedef XVID_QP_PASS_SIGNATURE(XVID_QP_PASS); |
typedef XVID_QP_PASS_SIGNATURE(XVID_QP_PASS); |
39 |
|
|
40 |
// We put everything in a single struct so it can easily be passed |
/* We put everything in a single struct so it can easily be passed |
41 |
// to prediction functions as a whole... |
* to prediction functions as a whole... */ |
42 |
|
|
43 |
struct XVID_QP_FUNCS { |
typedef struct _XVID_QP_FUNCS { |
44 |
|
|
45 |
// filter for QPel 16x? prediction |
/* filter for QPel 16x? prediction */ |
46 |
|
|
47 |
XVID_QP_PASS *H_Pass; |
XVID_QP_PASS *H_Pass; |
48 |
XVID_QP_PASS *H_Pass_Avrg; |
XVID_QP_PASS *H_Pass_Avrg; |
51 |
XVID_QP_PASS *V_Pass_Avrg; |
XVID_QP_PASS *V_Pass_Avrg; |
52 |
XVID_QP_PASS *V_Pass_Avrg_Up; |
XVID_QP_PASS *V_Pass_Avrg_Up; |
53 |
|
|
54 |
// filter for QPel 8x? prediction |
/* filter for QPel 8x? prediction */ |
55 |
|
|
56 |
XVID_QP_PASS *H_Pass_8; |
XVID_QP_PASS *H_Pass_8; |
57 |
XVID_QP_PASS *H_Pass_Avrg_8; |
XVID_QP_PASS *H_Pass_Avrg_8; |
59 |
XVID_QP_PASS *V_Pass_8; |
XVID_QP_PASS *V_Pass_8; |
60 |
XVID_QP_PASS *V_Pass_Avrg_8; |
XVID_QP_PASS *V_Pass_Avrg_8; |
61 |
XVID_QP_PASS *V_Pass_Avrg_Up_8; |
XVID_QP_PASS *V_Pass_Avrg_Up_8; |
62 |
}; |
} XVID_QP_FUNCS; |
|
typedef struct XVID_QP_FUNCS XVID_QP_FUNCS; |
|
63 |
|
|
64 |
/***************************************************************************** |
/***************************************************************************** |
65 |
* fwd dcl |
* fwd dcl |
66 |
****************************************************************************/ |
****************************************************************************/ |
67 |
|
extern void xvid_Init_QP(); |
68 |
|
|
69 |
extern XVID_QP_FUNCS xvid_QP_Funcs_C; // for P-frames |
extern XVID_QP_FUNCS xvid_QP_Funcs_C; /* for P-frames */ |
70 |
extern XVID_QP_FUNCS xvid_QP_Add_Funcs_C; // for B-frames |
extern XVID_QP_FUNCS xvid_QP_Add_Funcs_C; /* for B-frames */ |
71 |
|
|
72 |
|
#ifdef ARCH_IS_IA32 |
73 |
extern XVID_QP_FUNCS xvid_QP_Funcs_mmx; |
extern XVID_QP_FUNCS xvid_QP_Funcs_mmx; |
74 |
extern XVID_QP_FUNCS xvid_QP_Add_Funcs_mmx; |
extern XVID_QP_FUNCS xvid_QP_Add_Funcs_mmx; |
75 |
extern void xvid_Init_QP_mmx(); // should be called at mmx initialization |
#endif |
76 |
|
|
77 |
extern XVID_QP_FUNCS *xvid_QP_Funcs; // <- main pointer for enc/dec structure |
extern XVID_QP_FUNCS *xvid_QP_Funcs; /* <- main pointer for enc/dec structure */ |
78 |
extern XVID_QP_FUNCS *xvid_QP_Add_Funcs; // <- main pointer for enc/dec structure |
extern XVID_QP_FUNCS *xvid_QP_Add_Funcs; /* <- main pointer for enc/dec structure */ |
79 |
|
|
80 |
/***************************************************************************** |
/***************************************************************************** |
81 |
* macros |
* macros |
97 |
|
|
98 |
****************************************************************************/ |
****************************************************************************/ |
99 |
|
|
100 |
static __inline void new_interpolate16x16_quarterpel( |
static void __inline |
101 |
uint8_t * const cur, |
new_interpolate16x16_quarterpel(uint8_t * const cur, |
102 |
uint8_t * const refn, |
uint8_t * const refn, |
103 |
uint8_t * const refh, |
uint8_t * const refh, |
104 |
uint8_t * const refv, |
uint8_t * const refv, |
119 |
const int32_t xRef = x*4 + dx; |
const int32_t xRef = x*4 + dx; |
120 |
const int32_t yRef = y*4 + dy; |
const int32_t yRef = y*4 + dy; |
121 |
|
|
122 |
Ops = xvid_QP_Funcs; // TODO: pass as argument |
Ops = xvid_QP_Funcs; /* TODO: pass as argument */ |
123 |
quads = (dx&3) | ((dy&3)<<2); |
quads = (dx&3) | ((dy&3)<<2); |
124 |
|
|
125 |
x_int = xRef/4; |
x_int = xRef/4; |
133 |
dst = cur + y * stride + x; |
dst = cur + y * stride + x; |
134 |
src = refn + y_int * stride + x_int; |
src = refn + y_int * stride + x_int; |
135 |
|
|
136 |
tmp = refh; // we need at least a 16 x stride scratch block |
tmp = refh; /* we need at least a 16 x stride scratch block */ |
137 |
|
|
138 |
switch(quads) { |
switch(quads) { |
139 |
case 0: |
case 0: |
199 |
} |
} |
200 |
} |
} |
201 |
|
|
202 |
static __inline void new_interpolate16x8_quarterpel( |
static void __inline |
203 |
uint8_t * const cur, |
new_interpolate16x8_quarterpel(uint8_t * const cur, |
204 |
uint8_t * const refn, |
uint8_t * const refn, |
205 |
uint8_t * const refh, |
uint8_t * const refh, |
206 |
uint8_t * const refv, |
uint8_t * const refv, |
221 |
const int32_t xRef = x*4 + dx; |
const int32_t xRef = x*4 + dx; |
222 |
const int32_t yRef = y*4 + dy; |
const int32_t yRef = y*4 + dy; |
223 |
|
|
224 |
Ops = xvid_QP_Funcs; // TODO: pass as argument |
Ops = xvid_QP_Funcs; /* TODO: pass as argument */ |
225 |
quads = (dx&3) | ((dy&3)<<2); |
quads = (dx&3) | ((dy&3)<<2); |
226 |
|
|
227 |
x_int = xRef/4; |
x_int = xRef/4; |
235 |
dst = cur + y * stride + x; |
dst = cur + y * stride + x; |
236 |
src = refn + y_int * stride + x_int; |
src = refn + y_int * stride + x_int; |
237 |
|
|
238 |
tmp = refh; // we need at least a 16 x stride scratch block |
tmp = refh; /* we need at least a 16 x stride scratch block */ |
239 |
|
|
240 |
switch(quads) { |
switch(quads) { |
241 |
case 0: |
case 0: |
299 |
} |
} |
300 |
} |
} |
301 |
|
|
302 |
static __inline void new_interpolate8x8_quarterpel( |
static void __inline |
303 |
uint8_t * const cur, |
new_interpolate8x8_quarterpel(uint8_t * const cur, |
304 |
uint8_t * const refn, |
uint8_t * const refn, |
305 |
uint8_t * const refh, |
uint8_t * const refh, |
306 |
uint8_t * const refv, |
uint8_t * const refv, |
321 |
const int32_t xRef = x*4 + dx; |
const int32_t xRef = x*4 + dx; |
322 |
const int32_t yRef = y*4 + dy; |
const int32_t yRef = y*4 + dy; |
323 |
|
|
324 |
Ops = xvid_QP_Funcs; // TODO: pass as argument |
Ops = xvid_QP_Funcs; /* TODO: pass as argument */ |
325 |
quads = (dx&3) | ((dy&3)<<2); |
quads = (dx&3) | ((dy&3)<<2); |
326 |
|
|
327 |
x_int = xRef/4; |
x_int = xRef/4; |
335 |
dst = cur + y * stride + x; |
dst = cur + y * stride + x; |
336 |
src = refn + y_int * stride + x_int; |
src = refn + y_int * stride + x_int; |
337 |
|
|
338 |
tmp = refh; // we need at least a 16 x stride scratch block |
tmp = refh; /* we need at least a 16 x stride scratch block */ |
339 |
|
|
340 |
switch(quads) { |
switch(quads) { |
341 |
case 0: |
case 0: |
397 |
break; |
break; |
398 |
} |
} |
399 |
} |
} |
|
/*****************************************************************************/ |
|
400 |
|
|
401 |
#endif /* _XVID_QPEL_H_ */ |
#endif /* _XVID_QPEL_H_ */ |