Mercurial > libavcodec.hg
annotate roqvideo.c @ 1719:4e72fb256b25 libavcodec
denoise_dct_mmx()
author | michael |
---|---|
date | Fri, 02 Jan 2004 22:29:08 +0000 |
parents | 932d306bf1dc |
children | 141a9539e270 |
rev | line source |
---|---|
1439
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
1 /* |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
2 * Copyright (C) 2003 the ffmpeg project |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
3 * |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
4 * This library is free software; you can redistribute it and/or |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
5 * modify it under the terms of the GNU Lesser General Public |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
6 * License as published by the Free Software Foundation; either |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
7 * version 2 of the License, or (at your option) any later version. |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
8 * |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
9 * This library is distributed in the hope that it will be useful, |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
12 * Lesser General Public License for more details. |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
13 * |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
14 * You should have received a copy of the GNU Lesser General Public |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
15 * License along with this library; if not, write to the Free Software |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
17 * |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
18 */ |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
19 |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
20 /** |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
21 * @file roqvideo.c |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
22 * Id RoQ Video Decoder by Dr. Tim Ferguson |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
23 * For more information about the Id RoQ format, visit: |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
24 * http://www.csse.monash.edu.au/~timf/ |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
25 */ |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
26 |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
27 #include <stdio.h> |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
28 #include <stdlib.h> |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
29 #include <string.h> |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
30 #include <unistd.h> |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
31 |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
32 #include "common.h" |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
33 #include "avcodec.h" |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
34 #include "dsputil.h" |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
35 |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
36 typedef struct { |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
37 unsigned char y0, y1, y2, y3, u, v; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
38 } roq_cell; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
39 |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
40 typedef struct { |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
41 int idx[4]; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
42 } roq_qcell; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
43 |
1495
07029b2cd44f
experimental half-pel motion compensation for C planes, courtesy of Dr.
tmmm
parents:
1439
diff
changeset
|
44 static int uiclip[1024], *uiclp; /* clipping table */ |
07029b2cd44f
experimental half-pel motion compensation for C planes, courtesy of Dr.
tmmm
parents:
1439
diff
changeset
|
45 #define avg2(a,b) uiclp[(((int)(a)+(int)(b)+1)>>1)] |
07029b2cd44f
experimental half-pel motion compensation for C planes, courtesy of Dr.
tmmm
parents:
1439
diff
changeset
|
46 #define avg4(a,b,c,d) uiclp[(((int)(a)+(int)(b)+(int)(c)+(int)(d)+2)>>2)] |
1439
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
47 |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
48 typedef struct RoqContext { |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
49 |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
50 AVCodecContext *avctx; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
51 DSPContext dsp; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
52 AVFrame last_frame; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
53 AVFrame current_frame; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
54 int first_frame; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
55 int y_stride; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
56 int c_stride; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
57 |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
58 roq_cell cells[256]; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
59 roq_qcell qcells[256]; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
60 |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
61 unsigned char *buf; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
62 int size; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
63 |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
64 } RoqContext; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
65 |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
66 #define RoQ_INFO 0x1001 |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
67 #define RoQ_QUAD_CODEBOOK 0x1002 |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
68 #define RoQ_QUAD_VQ 0x1011 |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
69 #define RoQ_SOUND_MONO 0x1020 |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
70 #define RoQ_SOUND_STEREO 0x1021 |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
71 |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
72 #define RoQ_ID_MOT 0x00 |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
73 #define RoQ_ID_FCC 0x01 |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
74 #define RoQ_ID_SLD 0x02 |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
75 #define RoQ_ID_CCC 0x03 |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
76 |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
77 #define get_byte(in_buffer) *(in_buffer++) |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
78 #define get_word(in_buffer) ((unsigned short)(in_buffer += 2, \ |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
79 (in_buffer[-1] << 8 | in_buffer[-2]))) |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
80 #define get_long(in_buffer) ((unsigned long)(in_buffer += 4, \ |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
81 (in_buffer[-1] << 24 | in_buffer[-2] << 16 | in_buffer[-3] << 8 | in_buffer[-4]))) |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
82 |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
83 |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
84 static void apply_vector_2x2(RoqContext *ri, int x, int y, roq_cell *cell) |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
85 { |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
86 unsigned char *yptr; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
87 |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
88 yptr = ri->current_frame.data[0] + (y * ri->y_stride) + x; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
89 *yptr++ = cell->y0; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
90 *yptr++ = cell->y1; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
91 yptr += (ri->y_stride - 2); |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
92 *yptr++ = cell->y2; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
93 *yptr++ = cell->y3; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
94 ri->current_frame.data[1][(y/2) * (ri->c_stride) + x/2] = cell->u; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
95 ri->current_frame.data[2][(y/2) * (ri->c_stride) + x/2] = cell->v; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
96 } |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
97 |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
98 static void apply_vector_4x4(RoqContext *ri, int x, int y, roq_cell *cell) |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
99 { |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
100 unsigned long row_inc, c_row_inc; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
101 register unsigned char y0, y1, u, v; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
102 unsigned char *yptr, *uptr, *vptr; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
103 |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
104 yptr = ri->current_frame.data[0] + (y * ri->y_stride) + x; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
105 uptr = ri->current_frame.data[1] + (y/2) * (ri->c_stride) + x/2; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
106 vptr = ri->current_frame.data[2] + (y/2) * (ri->c_stride) + x/2; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
107 |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
108 row_inc = ri->y_stride - 4; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
109 c_row_inc = (ri->c_stride) - 2; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
110 *yptr++ = y0 = cell->y0; *uptr++ = u = cell->u; *vptr++ = v = cell->v; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
111 *yptr++ = y0; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
112 *yptr++ = y1 = cell->y1; *uptr++ = u; *vptr++ = v; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
113 *yptr++ = y1; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
114 |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
115 yptr += row_inc; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
116 |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
117 *yptr++ = y0; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
118 *yptr++ = y0; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
119 *yptr++ = y1; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
120 *yptr++ = y1; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
121 |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
122 yptr += row_inc; uptr += c_row_inc; vptr += c_row_inc; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
123 |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
124 *yptr++ = y0 = cell->y2; *uptr++ = u; *vptr++ = v; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
125 *yptr++ = y0; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
126 *yptr++ = y1 = cell->y3; *uptr++ = u; *vptr++ = v; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
127 *yptr++ = y1; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
128 |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
129 yptr += row_inc; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
130 |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
131 *yptr++ = y0; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
132 *yptr++ = y0; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
133 *yptr++ = y1; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
134 *yptr++ = y1; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
135 } |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
136 |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
137 static void apply_motion_4x4(RoqContext *ri, int x, int y, unsigned char mv, |
1495
07029b2cd44f
experimental half-pel motion compensation for C planes, courtesy of Dr.
tmmm
parents:
1439
diff
changeset
|
138 signed char mean_x, signed char mean_y) |
1439
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
139 { |
1495
07029b2cd44f
experimental half-pel motion compensation for C planes, courtesy of Dr.
tmmm
parents:
1439
diff
changeset
|
140 int i, hw, mx, my; |
1439
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
141 unsigned char *pa, *pb; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
142 |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
143 mx = x + 8 - (mv >> 4) - mean_x; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
144 my = y + 8 - (mv & 0xf) - mean_y; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
145 |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
146 pa = ri->current_frame.data[0] + (y * ri->y_stride) + x; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
147 pb = ri->last_frame.data[0] + (my * ri->y_stride) + mx; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
148 for(i = 0; i < 4; i++) { |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
149 pa[0] = pb[0]; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
150 pa[1] = pb[1]; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
151 pa[2] = pb[2]; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
152 pa[3] = pb[3]; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
153 pa += ri->y_stride; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
154 pb += ri->y_stride; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
155 } |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
156 |
1495
07029b2cd44f
experimental half-pel motion compensation for C planes, courtesy of Dr.
tmmm
parents:
1439
diff
changeset
|
157 #if 0 |
1439
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
158 pa = ri->current_frame.data[1] + (y/2) * (ri->c_stride) + x/2; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
159 pb = ri->last_frame.data[1] + (my/2) * (ri->c_stride) + (mx + 1)/2; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
160 for(i = 0; i < 2; i++) { |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
161 pa[0] = pb[0]; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
162 pa[1] = pb[1]; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
163 pa += ri->c_stride; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
164 pb += ri->c_stride; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
165 } |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
166 |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
167 pa = ri->current_frame.data[2] + (y/2) * (ri->c_stride) + x/2; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
168 pb = ri->last_frame.data[2] + (my/2) * (ri->c_stride) + (mx + 1)/2; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
169 for(i = 0; i < 2; i++) { |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
170 pa[0] = pb[0]; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
171 pa[1] = pb[1]; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
172 pa += ri->c_stride; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
173 pb += ri->c_stride; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
174 } |
1495
07029b2cd44f
experimental half-pel motion compensation for C planes, courtesy of Dr.
tmmm
parents:
1439
diff
changeset
|
175 #else |
07029b2cd44f
experimental half-pel motion compensation for C planes, courtesy of Dr.
tmmm
parents:
1439
diff
changeset
|
176 hw = ri->y_stride/2; |
07029b2cd44f
experimental half-pel motion compensation for C planes, courtesy of Dr.
tmmm
parents:
1439
diff
changeset
|
177 pa = ri->current_frame.data[1] + (y * ri->y_stride)/4 + x/2; |
07029b2cd44f
experimental half-pel motion compensation for C planes, courtesy of Dr.
tmmm
parents:
1439
diff
changeset
|
178 pb = ri->last_frame.data[1] + (my/2) * (ri->y_stride/2) + (mx + 1)/2; |
07029b2cd44f
experimental half-pel motion compensation for C planes, courtesy of Dr.
tmmm
parents:
1439
diff
changeset
|
179 |
07029b2cd44f
experimental half-pel motion compensation for C planes, courtesy of Dr.
tmmm
parents:
1439
diff
changeset
|
180 for(i = 0; i < 2; i++) { |
07029b2cd44f
experimental half-pel motion compensation for C planes, courtesy of Dr.
tmmm
parents:
1439
diff
changeset
|
181 switch(((my & 0x01) << 1) | (mx & 0x01)) { |
07029b2cd44f
experimental half-pel motion compensation for C planes, courtesy of Dr.
tmmm
parents:
1439
diff
changeset
|
182 |
07029b2cd44f
experimental half-pel motion compensation for C planes, courtesy of Dr.
tmmm
parents:
1439
diff
changeset
|
183 case 0: |
07029b2cd44f
experimental half-pel motion compensation for C planes, courtesy of Dr.
tmmm
parents:
1439
diff
changeset
|
184 pa[0] = pb[0]; |
07029b2cd44f
experimental half-pel motion compensation for C planes, courtesy of Dr.
tmmm
parents:
1439
diff
changeset
|
185 pa[1] = pb[1]; |
07029b2cd44f
experimental half-pel motion compensation for C planes, courtesy of Dr.
tmmm
parents:
1439
diff
changeset
|
186 pa[hw] = pb[hw]; |
07029b2cd44f
experimental half-pel motion compensation for C planes, courtesy of Dr.
tmmm
parents:
1439
diff
changeset
|
187 pa[hw+1] = pb[hw+1]; |
07029b2cd44f
experimental half-pel motion compensation for C planes, courtesy of Dr.
tmmm
parents:
1439
diff
changeset
|
188 break; |
07029b2cd44f
experimental half-pel motion compensation for C planes, courtesy of Dr.
tmmm
parents:
1439
diff
changeset
|
189 |
07029b2cd44f
experimental half-pel motion compensation for C planes, courtesy of Dr.
tmmm
parents:
1439
diff
changeset
|
190 case 1: |
07029b2cd44f
experimental half-pel motion compensation for C planes, courtesy of Dr.
tmmm
parents:
1439
diff
changeset
|
191 pa[0] = avg2(pb[0], pb[1]); |
07029b2cd44f
experimental half-pel motion compensation for C planes, courtesy of Dr.
tmmm
parents:
1439
diff
changeset
|
192 pa[1] = avg2(pb[1], pb[2]); |
07029b2cd44f
experimental half-pel motion compensation for C planes, courtesy of Dr.
tmmm
parents:
1439
diff
changeset
|
193 pa[hw] = avg2(pb[hw], pb[hw+1]); |
07029b2cd44f
experimental half-pel motion compensation for C planes, courtesy of Dr.
tmmm
parents:
1439
diff
changeset
|
194 pa[hw+1] = avg2(pb[hw+1], pb[hw+2]); |
07029b2cd44f
experimental half-pel motion compensation for C planes, courtesy of Dr.
tmmm
parents:
1439
diff
changeset
|
195 break; |
07029b2cd44f
experimental half-pel motion compensation for C planes, courtesy of Dr.
tmmm
parents:
1439
diff
changeset
|
196 |
07029b2cd44f
experimental half-pel motion compensation for C planes, courtesy of Dr.
tmmm
parents:
1439
diff
changeset
|
197 case 2: |
07029b2cd44f
experimental half-pel motion compensation for C planes, courtesy of Dr.
tmmm
parents:
1439
diff
changeset
|
198 pa[0] = avg2(pb[0], pb[hw]); |
07029b2cd44f
experimental half-pel motion compensation for C planes, courtesy of Dr.
tmmm
parents:
1439
diff
changeset
|
199 pa[1] = avg2(pb[1], pb[hw+1]); |
07029b2cd44f
experimental half-pel motion compensation for C planes, courtesy of Dr.
tmmm
parents:
1439
diff
changeset
|
200 pa[hw] = avg2(pb[hw], pb[hw*2]); |
07029b2cd44f
experimental half-pel motion compensation for C planes, courtesy of Dr.
tmmm
parents:
1439
diff
changeset
|
201 pa[hw+1] = avg2(pb[hw+1], pb[(hw*2)+1]); |
07029b2cd44f
experimental half-pel motion compensation for C planes, courtesy of Dr.
tmmm
parents:
1439
diff
changeset
|
202 break; |
07029b2cd44f
experimental half-pel motion compensation for C planes, courtesy of Dr.
tmmm
parents:
1439
diff
changeset
|
203 |
07029b2cd44f
experimental half-pel motion compensation for C planes, courtesy of Dr.
tmmm
parents:
1439
diff
changeset
|
204 case 3: |
07029b2cd44f
experimental half-pel motion compensation for C planes, courtesy of Dr.
tmmm
parents:
1439
diff
changeset
|
205 pa[0] = avg4(pb[0], pb[1], pb[hw], pb[hw+1]); |
07029b2cd44f
experimental half-pel motion compensation for C planes, courtesy of Dr.
tmmm
parents:
1439
diff
changeset
|
206 pa[1] = avg4(pb[1], pb[2], pb[hw+1], pb[hw+2]); |
07029b2cd44f
experimental half-pel motion compensation for C planes, courtesy of Dr.
tmmm
parents:
1439
diff
changeset
|
207 pa[hw] = avg4(pb[hw], pb[hw+1], pb[hw*2], pb[(hw*2)+1]); |
07029b2cd44f
experimental half-pel motion compensation for C planes, courtesy of Dr.
tmmm
parents:
1439
diff
changeset
|
208 pa[hw+1] = avg4(pb[hw+1], pb[hw+2], pb[(hw*2)+1], pb[(hw*2)+1]); |
07029b2cd44f
experimental half-pel motion compensation for C planes, courtesy of Dr.
tmmm
parents:
1439
diff
changeset
|
209 break; |
07029b2cd44f
experimental half-pel motion compensation for C planes, courtesy of Dr.
tmmm
parents:
1439
diff
changeset
|
210 } |
07029b2cd44f
experimental half-pel motion compensation for C planes, courtesy of Dr.
tmmm
parents:
1439
diff
changeset
|
211 |
07029b2cd44f
experimental half-pel motion compensation for C planes, courtesy of Dr.
tmmm
parents:
1439
diff
changeset
|
212 pa = ri->current_frame.data[2] + (y * ri->y_stride)/4 + x/2; |
07029b2cd44f
experimental half-pel motion compensation for C planes, courtesy of Dr.
tmmm
parents:
1439
diff
changeset
|
213 pb = ri->last_frame.data[2] + (my/2) * (ri->y_stride/2) + (mx + 1)/2; |
07029b2cd44f
experimental half-pel motion compensation for C planes, courtesy of Dr.
tmmm
parents:
1439
diff
changeset
|
214 } |
07029b2cd44f
experimental half-pel motion compensation for C planes, courtesy of Dr.
tmmm
parents:
1439
diff
changeset
|
215 #endif |
1439
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
216 } |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
217 |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
218 static void apply_motion_8x8(RoqContext *ri, int x, int y, |
1495
07029b2cd44f
experimental half-pel motion compensation for C planes, courtesy of Dr.
tmmm
parents:
1439
diff
changeset
|
219 unsigned char mv, signed char mean_x, signed char mean_y) |
1439
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
220 { |
1495
07029b2cd44f
experimental half-pel motion compensation for C planes, courtesy of Dr.
tmmm
parents:
1439
diff
changeset
|
221 int mx, my, i, j, hw; |
1439
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
222 unsigned char *pa, *pb; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
223 |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
224 mx = x + 8 - (mv >> 4) - mean_x; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
225 my = y + 8 - (mv & 0xf) - mean_y; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
226 |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
227 pa = ri->current_frame.data[0] + (y * ri->y_stride) + x; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
228 pb = ri->last_frame.data[0] + (my * ri->y_stride) + mx; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
229 for(i = 0; i < 8; i++) { |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
230 pa[0] = pb[0]; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
231 pa[1] = pb[1]; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
232 pa[2] = pb[2]; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
233 pa[3] = pb[3]; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
234 pa[4] = pb[4]; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
235 pa[5] = pb[5]; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
236 pa[6] = pb[6]; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
237 pa[7] = pb[7]; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
238 pa += ri->y_stride; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
239 pb += ri->y_stride; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
240 } |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
241 |
1495
07029b2cd44f
experimental half-pel motion compensation for C planes, courtesy of Dr.
tmmm
parents:
1439
diff
changeset
|
242 #if 0 |
1439
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
243 pa = ri->current_frame.data[1] + (y/2) * (ri->c_stride) + x/2; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
244 pb = ri->last_frame.data[1] + (my/2) * (ri->c_stride) + (mx + 1)/2; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
245 for(i = 0; i < 4; i++) { |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
246 pa[0] = pb[0]; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
247 pa[1] = pb[1]; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
248 pa[2] = pb[2]; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
249 pa[3] = pb[3]; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
250 pa += ri->c_stride; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
251 pb += ri->c_stride; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
252 } |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
253 |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
254 pa = ri->current_frame.data[2] + (y/2) * (ri->c_stride) + x/2; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
255 pb = ri->last_frame.data[2] + (my/2) * (ri->c_stride) + (mx + 1)/2; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
256 for(i = 0; i < 4; i++) { |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
257 pa[0] = pb[0]; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
258 pa[1] = pb[1]; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
259 pa[2] = pb[2]; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
260 pa[3] = pb[3]; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
261 pa += ri->c_stride; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
262 pb += ri->c_stride; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
263 } |
1495
07029b2cd44f
experimental half-pel motion compensation for C planes, courtesy of Dr.
tmmm
parents:
1439
diff
changeset
|
264 #else |
07029b2cd44f
experimental half-pel motion compensation for C planes, courtesy of Dr.
tmmm
parents:
1439
diff
changeset
|
265 hw = ri->c_stride; |
07029b2cd44f
experimental half-pel motion compensation for C planes, courtesy of Dr.
tmmm
parents:
1439
diff
changeset
|
266 pa = ri->current_frame.data[1] + (y * ri->y_stride)/4 + x/2; |
07029b2cd44f
experimental half-pel motion compensation for C planes, courtesy of Dr.
tmmm
parents:
1439
diff
changeset
|
267 pb = ri->last_frame.data[1] + (my/2) * (ri->y_stride/2) + (mx + 1)/2; |
07029b2cd44f
experimental half-pel motion compensation for C planes, courtesy of Dr.
tmmm
parents:
1439
diff
changeset
|
268 for(j = 0; j < 2; j++) { |
07029b2cd44f
experimental half-pel motion compensation for C planes, courtesy of Dr.
tmmm
parents:
1439
diff
changeset
|
269 for(i = 0; i < 4; i++) { |
07029b2cd44f
experimental half-pel motion compensation for C planes, courtesy of Dr.
tmmm
parents:
1439
diff
changeset
|
270 switch(((my & 0x01) << 1) | (mx & 0x01)) { |
07029b2cd44f
experimental half-pel motion compensation for C planes, courtesy of Dr.
tmmm
parents:
1439
diff
changeset
|
271 |
07029b2cd44f
experimental half-pel motion compensation for C planes, courtesy of Dr.
tmmm
parents:
1439
diff
changeset
|
272 case 0: |
07029b2cd44f
experimental half-pel motion compensation for C planes, courtesy of Dr.
tmmm
parents:
1439
diff
changeset
|
273 pa[0] = pb[0]; |
07029b2cd44f
experimental half-pel motion compensation for C planes, courtesy of Dr.
tmmm
parents:
1439
diff
changeset
|
274 pa[1] = pb[1]; |
07029b2cd44f
experimental half-pel motion compensation for C planes, courtesy of Dr.
tmmm
parents:
1439
diff
changeset
|
275 pa[2] = pb[2]; |
07029b2cd44f
experimental half-pel motion compensation for C planes, courtesy of Dr.
tmmm
parents:
1439
diff
changeset
|
276 pa[3] = pb[3]; |
07029b2cd44f
experimental half-pel motion compensation for C planes, courtesy of Dr.
tmmm
parents:
1439
diff
changeset
|
277 break; |
07029b2cd44f
experimental half-pel motion compensation for C planes, courtesy of Dr.
tmmm
parents:
1439
diff
changeset
|
278 |
07029b2cd44f
experimental half-pel motion compensation for C planes, courtesy of Dr.
tmmm
parents:
1439
diff
changeset
|
279 case 1: |
07029b2cd44f
experimental half-pel motion compensation for C planes, courtesy of Dr.
tmmm
parents:
1439
diff
changeset
|
280 pa[0] = avg2(pb[0], pb[1]); |
07029b2cd44f
experimental half-pel motion compensation for C planes, courtesy of Dr.
tmmm
parents:
1439
diff
changeset
|
281 pa[1] = avg2(pb[1], pb[2]); |
07029b2cd44f
experimental half-pel motion compensation for C planes, courtesy of Dr.
tmmm
parents:
1439
diff
changeset
|
282 pa[2] = avg2(pb[2], pb[3]); |
07029b2cd44f
experimental half-pel motion compensation for C planes, courtesy of Dr.
tmmm
parents:
1439
diff
changeset
|
283 pa[3] = avg2(pb[3], pb[4]); |
07029b2cd44f
experimental half-pel motion compensation for C planes, courtesy of Dr.
tmmm
parents:
1439
diff
changeset
|
284 break; |
07029b2cd44f
experimental half-pel motion compensation for C planes, courtesy of Dr.
tmmm
parents:
1439
diff
changeset
|
285 |
07029b2cd44f
experimental half-pel motion compensation for C planes, courtesy of Dr.
tmmm
parents:
1439
diff
changeset
|
286 case 2: |
07029b2cd44f
experimental half-pel motion compensation for C planes, courtesy of Dr.
tmmm
parents:
1439
diff
changeset
|
287 pa[0] = avg2(pb[0], pb[hw]); |
07029b2cd44f
experimental half-pel motion compensation for C planes, courtesy of Dr.
tmmm
parents:
1439
diff
changeset
|
288 pa[1] = avg2(pb[1], pb[hw+1]); |
07029b2cd44f
experimental half-pel motion compensation for C planes, courtesy of Dr.
tmmm
parents:
1439
diff
changeset
|
289 pa[2] = avg2(pb[2], pb[hw+2]); |
07029b2cd44f
experimental half-pel motion compensation for C planes, courtesy of Dr.
tmmm
parents:
1439
diff
changeset
|
290 pa[3] = avg2(pb[3], pb[hw+3]); |
07029b2cd44f
experimental half-pel motion compensation for C planes, courtesy of Dr.
tmmm
parents:
1439
diff
changeset
|
291 break; |
07029b2cd44f
experimental half-pel motion compensation for C planes, courtesy of Dr.
tmmm
parents:
1439
diff
changeset
|
292 |
07029b2cd44f
experimental half-pel motion compensation for C planes, courtesy of Dr.
tmmm
parents:
1439
diff
changeset
|
293 case 3: |
07029b2cd44f
experimental half-pel motion compensation for C planes, courtesy of Dr.
tmmm
parents:
1439
diff
changeset
|
294 pa[0] = avg4(pb[0], pb[1], pb[hw], pb[hw+1]); |
07029b2cd44f
experimental half-pel motion compensation for C planes, courtesy of Dr.
tmmm
parents:
1439
diff
changeset
|
295 pa[1] = avg4(pb[1], pb[2], pb[hw+1], pb[hw+2]); |
07029b2cd44f
experimental half-pel motion compensation for C planes, courtesy of Dr.
tmmm
parents:
1439
diff
changeset
|
296 pa[2] = avg4(pb[2], pb[3], pb[hw+2], pb[hw+3]); |
07029b2cd44f
experimental half-pel motion compensation for C planes, courtesy of Dr.
tmmm
parents:
1439
diff
changeset
|
297 pa[3] = avg4(pb[3], pb[4], pb[hw+3], pb[hw+4]); |
07029b2cd44f
experimental half-pel motion compensation for C planes, courtesy of Dr.
tmmm
parents:
1439
diff
changeset
|
298 break; |
07029b2cd44f
experimental half-pel motion compensation for C planes, courtesy of Dr.
tmmm
parents:
1439
diff
changeset
|
299 } |
07029b2cd44f
experimental half-pel motion compensation for C planes, courtesy of Dr.
tmmm
parents:
1439
diff
changeset
|
300 pa += ri->c_stride; |
07029b2cd44f
experimental half-pel motion compensation for C planes, courtesy of Dr.
tmmm
parents:
1439
diff
changeset
|
301 pb += ri->c_stride; |
07029b2cd44f
experimental half-pel motion compensation for C planes, courtesy of Dr.
tmmm
parents:
1439
diff
changeset
|
302 } |
07029b2cd44f
experimental half-pel motion compensation for C planes, courtesy of Dr.
tmmm
parents:
1439
diff
changeset
|
303 |
07029b2cd44f
experimental half-pel motion compensation for C planes, courtesy of Dr.
tmmm
parents:
1439
diff
changeset
|
304 pa = ri->current_frame.data[2] + (y * ri->y_stride)/4 + x/2; |
07029b2cd44f
experimental half-pel motion compensation for C planes, courtesy of Dr.
tmmm
parents:
1439
diff
changeset
|
305 pb = ri->last_frame.data[2] + (my/2) * (ri->y_stride/2) + (mx + 1)/2; |
07029b2cd44f
experimental half-pel motion compensation for C planes, courtesy of Dr.
tmmm
parents:
1439
diff
changeset
|
306 } |
07029b2cd44f
experimental half-pel motion compensation for C planes, courtesy of Dr.
tmmm
parents:
1439
diff
changeset
|
307 #endif |
1439
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
308 } |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
309 |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
310 static void roqvideo_decode_frame(RoqContext *ri) |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
311 { |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
312 unsigned int chunk_id = 0, chunk_arg = 0; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
313 unsigned long chunk_size = 0; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
314 int i, j, k, nv1, nv2, vqflg = 0, vqflg_pos = -1; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
315 int vqid, bpos, xpos, ypos, xp, yp, x, y; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
316 int frame_stats[2][4] = {{0},{0}}; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
317 roq_qcell *qcell; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
318 unsigned char *buf = ri->buf; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
319 unsigned char *buf_end = ri->buf + ri->size; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
320 |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
321 while (buf < buf_end) { |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
322 chunk_id = get_word(buf); |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
323 chunk_size = get_long(buf); |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
324 chunk_arg = get_word(buf); |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
325 |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
326 if(chunk_id == RoQ_QUAD_VQ) |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
327 break; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
328 if(chunk_id == RoQ_QUAD_CODEBOOK) { |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
329 if((nv1 = chunk_arg >> 8) == 0) |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
330 nv1 = 256; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
331 if((nv2 = chunk_arg & 0xff) == 0 && nv1 * 6 < chunk_size) |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
332 nv2 = 256; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
333 for(i = 0; i < nv1; i++) { |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
334 ri->cells[i].y0 = get_byte(buf); |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
335 ri->cells[i].y1 = get_byte(buf); |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
336 ri->cells[i].y2 = get_byte(buf); |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
337 ri->cells[i].y3 = get_byte(buf); |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
338 ri->cells[i].u = get_byte(buf); |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
339 ri->cells[i].v = get_byte(buf); |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
340 } |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
341 for(i = 0; i < nv2; i++) |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
342 for(j = 0; j < 4; j++) |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
343 ri->qcells[i].idx[j] = get_byte(buf); |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
344 } |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
345 } |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
346 |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
347 bpos = xpos = ypos = 0; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
348 while(bpos < chunk_size) { |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
349 for (yp = ypos; yp < ypos + 16; yp += 8) |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
350 for (xp = xpos; xp < xpos + 16; xp += 8) { |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
351 if (vqflg_pos < 0) { |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
352 vqflg = buf[bpos++]; vqflg |= (buf[bpos++] << 8); |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
353 vqflg_pos = 7; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
354 } |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
355 vqid = (vqflg >> (vqflg_pos * 2)) & 0x3; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
356 frame_stats[0][vqid]++; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
357 vqflg_pos--; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
358 |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
359 switch(vqid) { |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
360 case RoQ_ID_MOT: |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
361 apply_motion_8x8(ri, xp, yp, 0, 8, 8); |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
362 break; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
363 case RoQ_ID_FCC: |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
364 apply_motion_8x8(ri, xp, yp, buf[bpos++], chunk_arg >> 8, |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
365 chunk_arg & 0xff); |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
366 break; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
367 case RoQ_ID_SLD: |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
368 qcell = ri->qcells + buf[bpos++]; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
369 apply_vector_4x4(ri, xp, yp, ri->cells + qcell->idx[0]); |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
370 apply_vector_4x4(ri, xp+4, yp, ri->cells + qcell->idx[1]); |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
371 apply_vector_4x4(ri, xp, yp+4, ri->cells + qcell->idx[2]); |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
372 apply_vector_4x4(ri, xp+4, yp+4, ri->cells + qcell->idx[3]); |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
373 break; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
374 case RoQ_ID_CCC: |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
375 for (k = 0; k < 4; k++) { |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
376 x = xp; y = yp; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
377 if(k & 0x01) x += 4; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
378 if(k & 0x02) y += 4; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
379 |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
380 if (vqflg_pos < 0) { |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
381 vqflg = buf[bpos++]; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
382 vqflg |= (buf[bpos++] << 8); |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
383 vqflg_pos = 7; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
384 } |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
385 vqid = (vqflg >> (vqflg_pos * 2)) & 0x3; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
386 frame_stats[1][vqid]++; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
387 vqflg_pos--; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
388 switch(vqid) { |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
389 case RoQ_ID_MOT: |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
390 apply_motion_4x4(ri, x, y, 0, 8, 8); |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
391 break; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
392 case RoQ_ID_FCC: |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
393 apply_motion_4x4(ri, x, y, buf[bpos++], |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
394 chunk_arg >> 8, chunk_arg & 0xff); |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
395 break; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
396 case RoQ_ID_SLD: |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
397 qcell = ri->qcells + buf[bpos++]; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
398 apply_vector_2x2(ri, x, y, ri->cells + qcell->idx[0]); |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
399 apply_vector_2x2(ri, x+2, y, ri->cells + qcell->idx[1]); |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
400 apply_vector_2x2(ri, x, y+2, ri->cells + qcell->idx[2]); |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
401 apply_vector_2x2(ri, x+2, y+2, ri->cells + qcell->idx[3]); |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
402 break; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
403 case RoQ_ID_CCC: |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
404 apply_vector_2x2(ri, x, y, ri->cells + buf[bpos]); |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
405 apply_vector_2x2(ri, x+2, y, ri->cells + buf[bpos+1]); |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
406 apply_vector_2x2(ri, x, y+2, ri->cells + buf[bpos+2]); |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
407 apply_vector_2x2(ri, x+2, y+2, ri->cells + buf[bpos+3]); |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
408 bpos += 4; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
409 break; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
410 } |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
411 } |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
412 break; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
413 default: |
1598
932d306bf1dc
av_log() patch by (Michel Bardiaux <mbardiaux at peaktime dot be>)
michael
parents:
1495
diff
changeset
|
414 av_log(ri->avctx, AV_LOG_ERROR, "Unknown vq code: %d\n", vqid); |
1439
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
415 } |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
416 } |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
417 |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
418 xpos += 16; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
419 if (xpos >= ri->avctx->width) { |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
420 xpos -= ri->avctx->width; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
421 ypos += 16; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
422 } |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
423 if(ypos >= ri->avctx->height) |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
424 break; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
425 } |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
426 } |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
427 |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
428 |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
429 static int roq_decode_init(AVCodecContext *avctx) |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
430 { |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
431 RoqContext *s = avctx->priv_data; |
1495
07029b2cd44f
experimental half-pel motion compensation for C planes, courtesy of Dr.
tmmm
parents:
1439
diff
changeset
|
432 int i; |
1439
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
433 |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
434 s->avctx = avctx; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
435 s->first_frame = 1; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
436 avctx->pix_fmt = PIX_FMT_YUV420P; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
437 avctx->has_b_frames = 0; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
438 dsputil_init(&s->dsp, avctx); |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
439 |
1495
07029b2cd44f
experimental half-pel motion compensation for C planes, courtesy of Dr.
tmmm
parents:
1439
diff
changeset
|
440 uiclp = uiclip+512; |
07029b2cd44f
experimental half-pel motion compensation for C planes, courtesy of Dr.
tmmm
parents:
1439
diff
changeset
|
441 for(i = -512; i < 512; i++) |
07029b2cd44f
experimental half-pel motion compensation for C planes, courtesy of Dr.
tmmm
parents:
1439
diff
changeset
|
442 uiclp[i] = (i < 0 ? 0 : (i > 255 ? 255 : i)); |
07029b2cd44f
experimental half-pel motion compensation for C planes, courtesy of Dr.
tmmm
parents:
1439
diff
changeset
|
443 |
1439
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
444 return 0; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
445 } |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
446 |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
447 static int roq_decode_frame(AVCodecContext *avctx, |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
448 void *data, int *data_size, |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
449 uint8_t *buf, int buf_size) |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
450 { |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
451 RoqContext *s = avctx->priv_data; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
452 |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
453 *data_size = 0; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
454 |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
455 if (avctx->get_buffer(avctx, &s->current_frame)) { |
1598
932d306bf1dc
av_log() patch by (Michel Bardiaux <mbardiaux at peaktime dot be>)
michael
parents:
1495
diff
changeset
|
456 av_log(avctx, AV_LOG_ERROR, " RoQ: get_buffer() failed\n"); |
1439
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
457 return -1; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
458 } |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
459 s->y_stride = s->current_frame.linesize[0]; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
460 s->c_stride = s->current_frame.linesize[1]; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
461 |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
462 s->buf = buf; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
463 s->size = buf_size; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
464 roqvideo_decode_frame(s); |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
465 |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
466 /* release the last frame if it is allocated */ |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
467 if (s->first_frame) |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
468 s->first_frame = 0; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
469 else |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
470 avctx->release_buffer(avctx, &s->last_frame); |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
471 |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
472 /* shuffle frames */ |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
473 s->last_frame = s->current_frame; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
474 |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
475 *data_size = sizeof(AVFrame); |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
476 *(AVFrame*)data = s->current_frame; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
477 |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
478 return buf_size; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
479 } |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
480 |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
481 static int roq_decode_end(AVCodecContext *avctx) |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
482 { |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
483 RoqContext *s = avctx->priv_data; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
484 |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
485 /* release the last frame */ |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
486 avctx->release_buffer(avctx, &s->last_frame); |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
487 |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
488 return 0; |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
489 } |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
490 |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
491 AVCodec roq_decoder = { |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
492 "roqvideo", |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
493 CODEC_TYPE_VIDEO, |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
494 CODEC_ID_ROQ, |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
495 sizeof(RoqContext), |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
496 roq_decode_init, |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
497 NULL, |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
498 roq_decode_end, |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
499 roq_decode_frame, |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
500 CODEC_CAP_DR1, |
a4d00b1f0271
initial commit for Id RoQ and Interplay MVE multimedia subsystems
tmmm
parents:
diff
changeset
|
501 }; |