20 |
* along with this program ; if not, write to the Free Software |
* along with this program ; if not, write to the Free Software |
21 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
22 |
* |
* |
23 |
* $Id: decoder.c,v 1.61 2004-07-10 17:49:31 edgomez Exp $ |
* $Id: decoder.c,v 1.63 2004-07-24 11:46:08 edgomez Exp $ |
24 |
* |
* |
25 |
****************************************************************************/ |
****************************************************************************/ |
26 |
|
|
48 |
#include "image/interpolate8x8.h" |
#include "image/interpolate8x8.h" |
49 |
#include "image/reduced.h" |
#include "image/reduced.h" |
50 |
#include "image/font.h" |
#include "image/font.h" |
51 |
|
#include "image/qpel.h" |
52 |
|
|
53 |
#include "bitstream/mbcoding.h" |
#include "bitstream/mbcoding.h" |
54 |
#include "prediction/mbprediction.h" |
#include "prediction/mbprediction.h" |
62 |
#include "image/postprocessing.h" |
#include "image/postprocessing.h" |
63 |
#include "utils/mem_align.h" |
#include "utils/mem_align.h" |
64 |
|
|
65 |
|
#ifdef ARCH_IS_IA32 |
66 |
|
#define interpolate16x16_quarterpel new_interpolate16x16_quarterpel |
67 |
|
#define interpolate8x8_quarterpel new_interpolate8x8_quarterpel |
68 |
|
#endif |
69 |
|
|
70 |
static int |
static int |
71 |
decoder_resize(DECODER * dec) |
decoder_resize(DECODER * dec) |
72 |
{ |
{ |
1044 |
if (!direct) { |
if (!direct) { |
1045 |
uv_dx = pMB->mvs[0].x; |
uv_dx = pMB->mvs[0].x; |
1046 |
uv_dy = pMB->mvs[0].y; |
uv_dy = pMB->mvs[0].y; |
|
|
|
1047 |
b_uv_dx = pMB->b_mvs[0].x; |
b_uv_dx = pMB->b_mvs[0].x; |
1048 |
b_uv_dy = pMB->b_mvs[0].y; |
b_uv_dy = pMB->b_mvs[0].y; |
1049 |
|
|
1056 |
|
|
1057 |
uv_dx = (uv_dx >> 1) + roundtab_79[uv_dx & 0x3]; |
uv_dx = (uv_dx >> 1) + roundtab_79[uv_dx & 0x3]; |
1058 |
uv_dy = (uv_dy >> 1) + roundtab_79[uv_dy & 0x3]; |
uv_dy = (uv_dy >> 1) + roundtab_79[uv_dy & 0x3]; |
|
|
|
1059 |
b_uv_dx = (b_uv_dx >> 1) + roundtab_79[b_uv_dx & 0x3]; |
b_uv_dx = (b_uv_dx >> 1) + roundtab_79[b_uv_dx & 0x3]; |
1060 |
b_uv_dy = (b_uv_dy >> 1) + roundtab_79[b_uv_dy & 0x3]; |
b_uv_dy = (b_uv_dy >> 1) + roundtab_79[b_uv_dy & 0x3]; |
1061 |
|
|
1062 |
} else { |
} else { |
|
if(dec->quarterpel) { |
|
|
uv_dx = (pMB->mvs[0].x / 2) + (pMB->mvs[1].x / 2) + (pMB->mvs[2].x / 2) + (pMB->mvs[3].x / 2); |
|
|
uv_dy = (pMB->mvs[0].y / 2) + (pMB->mvs[1].y / 2) + (pMB->mvs[2].y / 2) + (pMB->mvs[3].y / 2); |
|
|
b_uv_dx = (pMB->b_mvs[0].x / 2) + (pMB->b_mvs[1].x / 2) + (pMB->b_mvs[2].x / 2) + (pMB->b_mvs[3].x / 2); |
|
|
b_uv_dy = (pMB->b_mvs[0].y / 2) + (pMB->b_mvs[1].y / 2) + (pMB->b_mvs[2].y / 2) + (pMB->b_mvs[3].y / 2); |
|
|
} else { |
|
1063 |
uv_dx = pMB->mvs[0].x + pMB->mvs[1].x + pMB->mvs[2].x + pMB->mvs[3].x; |
uv_dx = pMB->mvs[0].x + pMB->mvs[1].x + pMB->mvs[2].x + pMB->mvs[3].x; |
1064 |
uv_dy = pMB->mvs[0].y + pMB->mvs[1].y + pMB->mvs[2].y + pMB->mvs[3].y; |
uv_dy = pMB->mvs[0].y + pMB->mvs[1].y + pMB->mvs[2].y + pMB->mvs[3].y; |
1065 |
b_uv_dx = pMB->b_mvs[0].x + pMB->b_mvs[1].x + pMB->b_mvs[2].x + pMB->b_mvs[3].x; |
b_uv_dx = pMB->b_mvs[0].x + pMB->b_mvs[1].x + pMB->b_mvs[2].x + pMB->b_mvs[3].x; |
1066 |
b_uv_dy = pMB->b_mvs[0].y + pMB->b_mvs[1].y + pMB->b_mvs[2].y + pMB->b_mvs[3].y; |
b_uv_dy = pMB->b_mvs[0].y + pMB->b_mvs[1].y + pMB->b_mvs[2].y + pMB->b_mvs[3].y; |
1067 |
|
|
1068 |
|
if (dec->quarterpel) { |
1069 |
|
uv_dx /= 2; |
1070 |
|
uv_dy /= 2; |
1071 |
|
b_uv_dx /= 2; |
1072 |
|
b_uv_dy /= 2; |
1073 |
} |
} |
1074 |
|
|
1075 |
uv_dx = (uv_dx >> 3) + roundtab_76[uv_dx & 0xf]; |
uv_dx = (uv_dx >> 3) + roundtab_76[uv_dx & 0xf]; |
1153 |
interpolate8x8_avg2(dec->cur.y + (16 * y_pos * stride) + 16 * x_pos, |
interpolate8x8_avg2(dec->cur.y + (16 * y_pos * stride) + 16 * x_pos, |
1154 |
dec->cur.y + (16 * y_pos * stride) + 16 * x_pos, |
dec->cur.y + (16 * y_pos * stride) + 16 * x_pos, |
1155 |
dec->tmp.y + (16 * y_pos * stride) + 16 * x_pos, |
dec->tmp.y + (16 * y_pos * stride) + 16 * x_pos, |
1156 |
stride, 1, 8); |
stride, 0, 8); |
1157 |
|
|
1158 |
interpolate8x8_avg2(dec->cur.y + (16 * y_pos * stride) + 16 * x_pos + 8, |
interpolate8x8_avg2(dec->cur.y + (16 * y_pos * stride) + 16 * x_pos + 8, |
1159 |
dec->cur.y + (16 * y_pos * stride) + 16 * x_pos + 8, |
dec->cur.y + (16 * y_pos * stride) + 16 * x_pos + 8, |
1160 |
dec->tmp.y + (16 * y_pos * stride) + 16 * x_pos + 8, |
dec->tmp.y + (16 * y_pos * stride) + 16 * x_pos + 8, |
1161 |
stride, 1, 8); |
stride, 0, 8); |
1162 |
|
|
1163 |
interpolate8x8_avg2(dec->cur.y + ((16 * y_pos + 8) * stride) + 16 * x_pos, |
interpolate8x8_avg2(dec->cur.y + ((16 * y_pos + 8) * stride) + 16 * x_pos, |
1164 |
dec->cur.y + ((16 * y_pos + 8) * stride) + 16 * x_pos, |
dec->cur.y + ((16 * y_pos + 8) * stride) + 16 * x_pos, |
1165 |
dec->tmp.y + ((16 * y_pos + 8) * stride) + 16 * x_pos, |
dec->tmp.y + ((16 * y_pos + 8) * stride) + 16 * x_pos, |
1166 |
stride, 1, 8); |
stride, 0, 8); |
1167 |
|
|
1168 |
interpolate8x8_avg2(dec->cur.y + ((16 * y_pos + 8) * stride) + 16 * x_pos + 8, |
interpolate8x8_avg2(dec->cur.y + ((16 * y_pos + 8) * stride) + 16 * x_pos + 8, |
1169 |
dec->cur.y + ((16 * y_pos + 8) * stride) + 16 * x_pos + 8, |
dec->cur.y + ((16 * y_pos + 8) * stride) + 16 * x_pos + 8, |
1170 |
dec->tmp.y + ((16 * y_pos + 8) * stride) + 16 * x_pos + 8, |
dec->tmp.y + ((16 * y_pos + 8) * stride) + 16 * x_pos + 8, |
1171 |
stride, 1, 8); |
stride, 0, 8); |
1172 |
|
|
1173 |
interpolate8x8_avg2(dec->cur.u + (8 * y_pos * stride2) + 8 * x_pos, |
interpolate8x8_avg2(dec->cur.u + (8 * y_pos * stride2) + 8 * x_pos, |
1174 |
dec->cur.u + (8 * y_pos * stride2) + 8 * x_pos, |
dec->cur.u + (8 * y_pos * stride2) + 8 * x_pos, |
1175 |
dec->tmp.u + (8 * y_pos * stride2) + 8 * x_pos, |
dec->tmp.u + (8 * y_pos * stride2) + 8 * x_pos, |
1176 |
stride2, 1, 8); |
stride2, 0, 8); |
1177 |
|
|
1178 |
interpolate8x8_avg2(dec->cur.v + (8 * y_pos * stride2) + 8 * x_pos, |
interpolate8x8_avg2(dec->cur.v + (8 * y_pos * stride2) + 8 * x_pos, |
1179 |
dec->cur.v + (8 * y_pos * stride2) + 8 * x_pos, |
dec->cur.v + (8 * y_pos * stride2) + 8 * x_pos, |
1180 |
dec->tmp.v + (8 * y_pos * stride2) + 8 * x_pos, |
dec->tmp.v + (8 * y_pos * stride2) + 8 * x_pos, |
1181 |
stride2, 1, 8); |
stride2, 0, 8); |
1182 |
|
|
1183 |
stop_comp_timer(); |
stop_comp_timer(); |
1184 |
|
|