annotate indeo3.c @ 9351:4b801f9ae493 libavcodec

Add convenience macros for 5.0/5.1 back speaker configurations.
author jbr
date Mon, 06 Apr 2009 01:07:09 +0000
parents 48c89edff557
children 54bc8a2727b0
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
1 /*
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
2 * Intel Indeo 3 (IV31, IV32, etc.) video decoder for ffmpeg
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
3 * written, produced, and directed by Alan Smithee
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
4 *
3947
c8c591fe26f8 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 3776
diff changeset
5 * This file is part of FFmpeg.
c8c591fe26f8 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 3776
diff changeset
6 *
c8c591fe26f8 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 3776
diff changeset
7 * FFmpeg is free software; you can redistribute it and/or
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
8 * modify it under the terms of the GNU Lesser General Public
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
9 * License as published by the Free Software Foundation; either
3947
c8c591fe26f8 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 3776
diff changeset
10 * version 2.1 of the License, or (at your option) any later version.
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
11 *
3947
c8c591fe26f8 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 3776
diff changeset
12 * FFmpeg is distributed in the hope that it will be useful,
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
15 * Lesser General Public License for more details.
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
16 *
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
17 * You should have received a copy of the GNU Lesser General Public
3947
c8c591fe26f8 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 3776
diff changeset
18 * License along with FFmpeg; if not, write to the Free Software
3036
0b546eab515d Update licensing information: The FSF changed postal address.
diego
parents: 2979
diff changeset
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
20 */
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
21
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
22 #include <stdio.h>
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
23 #include <stdlib.h>
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
24 #include <string.h>
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
25 #include <unistd.h>
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
26
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
27 #include "avcodec.h"
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
28 #include "dsputil.h"
6239
e270eccc622f Use bytestream.
michael
parents: 6218
diff changeset
29 #include "bytestream.h"
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
30
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
31 #include "indeo3data.h"
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
32
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
33 typedef struct
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
34 {
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
35 uint8_t *Ybuf;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
36 uint8_t *Ubuf;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
37 uint8_t *Vbuf;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
38 unsigned short y_w, y_h;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
39 unsigned short uv_w, uv_h;
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
40 } YUVBufs;
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
41
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
42 typedef struct Indeo3DecodeContext {
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
43 AVCodecContext *avctx;
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
44 int width, height;
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
45 AVFrame frame;
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
46
7952
7f123fad56ea Move allocated buffer out of YUV buffer structure.
benoit
parents: 7951
diff changeset
47 uint8_t *buf;
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
48 YUVBufs iv_frame[2];
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
49 YUVBufs *cur_frame;
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
50 YUVBufs *ref_frame;
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
51
7947
70e83ea6a20a use uint8_t instead of unsigned char
benoit
parents: 7946
diff changeset
52 uint8_t *ModPred;
7946
cbb9b2f88ccb Corrector type fits in 8 bits.
benoit
parents: 7945
diff changeset
53 uint8_t *corrector_type;
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
54 } Indeo3DecodeContext;
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
55
7944
518521276932 Change table types to uint8_t
benoit
parents: 7040
diff changeset
56 static const uint8_t corrector_type_0[24] = {
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
57 195, 159, 133, 115, 101, 93, 87, 77,
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
58 195, 159, 133, 115, 101, 93, 87, 77,
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
59 128, 79, 79, 79, 79, 79, 79, 79
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
60 };
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
61
7944
518521276932 Change table types to uint8_t
benoit
parents: 7040
diff changeset
62 static const uint8_t corrector_type_2[8] = { 9, 7, 6, 8, 5, 4, 3, 2 };
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
63
7950
9d2399045441 Check allocations on init.
benoit
parents: 7949
diff changeset
64 static av_cold int build_modpred(Indeo3DecodeContext *s)
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
65 {
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
66 int i, j;
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
67
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
68 if (!(s->ModPred = av_malloc(8 * 128)))
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
69 return AVERROR(ENOMEM);
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
70
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
71 for (i=0; i < 128; ++i) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
72 s->ModPred[i+0*128] = i > 126 ? 254 : 2*(i + 1 - ((i + 1) % 2));
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
73 s->ModPred[i+1*128] = i == 7 ? 20 :
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
74 i == 119 ||
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
75 i == 120 ? 236 : 2*(i + 2 - ((i + 1) % 3));
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
76 s->ModPred[i+2*128] = i > 125 ? 248 : 2*(i + 2 - ((i + 2) % 4));
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
77 s->ModPred[i+3*128] = 2*(i + 1 - ((i - 3) % 5));
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
78 s->ModPred[i+4*128] = i == 8 ? 20 : 2*(i + 1 - ((i - 3) % 6));
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
79 s->ModPred[i+5*128] = 2*(i + 4 - ((i + 3) % 7));
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
80 s->ModPred[i+6*128] = i > 123 ? 240 : 2*(i + 4 - ((i + 4) % 8));
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
81 s->ModPred[i+7*128] = 2*(i + 5 - ((i + 4) % 9));
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
82 }
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
83
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
84 if (!(s->corrector_type = av_malloc(24 * 256)))
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
85 return AVERROR(ENOMEM);
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
86
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
87 for (i=0; i < 24; ++i) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
88 for (j=0; j < 256; ++j) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
89 s->corrector_type[i*256+j] = j < corrector_type_0[i] ? 1 :
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
90 j < 248 || (i == 16 && j == 248) ? 0 :
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
91 corrector_type_2[j - 248];
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
92 }
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
93 }
7950
9d2399045441 Check allocations on init.
benoit
parents: 7949
diff changeset
94
9d2399045441 Check allocations on init.
benoit
parents: 7949
diff changeset
95 return 0;
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
96 }
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
97
7950
9d2399045441 Check allocations on init.
benoit
parents: 7949
diff changeset
98 static av_cold int iv_alloc_frames(Indeo3DecodeContext *s)
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
99 {
7963
474794ff86df Merge declaration and assignment.
benoit
parents: 7957
diff changeset
100 int luma_width = (s->width + 3) & ~3,
474794ff86df Merge declaration and assignment.
benoit
parents: 7957
diff changeset
101 luma_height = (s->height + 3) & ~3,
474794ff86df Merge declaration and assignment.
benoit
parents: 7957
diff changeset
102 chroma_width = ((luma_width >> 2) + 3) & ~3,
474794ff86df Merge declaration and assignment.
benoit
parents: 7957
diff changeset
103 chroma_height = ((luma_height >> 2) + 3) & ~3,
474794ff86df Merge declaration and assignment.
benoit
parents: 7957
diff changeset
104 luma_pixels = luma_width * luma_height,
474794ff86df Merge declaration and assignment.
benoit
parents: 7957
diff changeset
105 chroma_pixels = chroma_width * chroma_height,
474794ff86df Merge declaration and assignment.
benoit
parents: 7957
diff changeset
106 i;
474794ff86df Merge declaration and assignment.
benoit
parents: 7957
diff changeset
107 unsigned int bufsize = luma_pixels * 2 + luma_width * 3 +
474794ff86df Merge declaration and assignment.
benoit
parents: 7957
diff changeset
108 (chroma_pixels + chroma_width) * 4;
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
109
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
110 if(!(s->buf = av_malloc(bufsize)))
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
111 return AVERROR(ENOMEM);
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
112 s->iv_frame[0].y_w = s->iv_frame[1].y_w = luma_width;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
113 s->iv_frame[0].y_h = s->iv_frame[1].y_h = luma_height;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
114 s->iv_frame[0].uv_w = s->iv_frame[1].uv_w = chroma_width;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
115 s->iv_frame[0].uv_h = s->iv_frame[1].uv_h = chroma_height;
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
116
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
117 s->iv_frame[0].Ybuf = s->buf + luma_width;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
118 i = luma_pixels + luma_width * 2;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
119 s->iv_frame[1].Ybuf = s->buf + i;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
120 i += (luma_pixels + luma_width);
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
121 s->iv_frame[0].Ubuf = s->buf + i;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
122 i += (chroma_pixels + chroma_width);
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
123 s->iv_frame[1].Ubuf = s->buf + i;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
124 i += (chroma_pixels + chroma_width);
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
125 s->iv_frame[0].Vbuf = s->buf + i;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
126 i += (chroma_pixels + chroma_width);
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
127 s->iv_frame[1].Vbuf = s->buf + i;
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
128
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
129 for(i = 1; i <= luma_width; i++)
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
130 s->iv_frame[0].Ybuf[-i] = s->iv_frame[1].Ybuf[-i] =
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
131 s->iv_frame[0].Ubuf[-i] = 0x80;
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
132
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
133 for(i = 1; i <= chroma_width; i++) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
134 s->iv_frame[1].Ubuf[-i] = 0x80;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
135 s->iv_frame[0].Vbuf[-i] = 0x80;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
136 s->iv_frame[1].Vbuf[-i] = 0x80;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
137 s->iv_frame[1].Vbuf[chroma_pixels+i-1] = 0x80;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
138 }
7950
9d2399045441 Check allocations on init.
benoit
parents: 7949
diff changeset
139
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
140 return 0;
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
141 }
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
142
6517
48759bfbd073 Apply 'cold' attribute to init/uninit functions in libavcodec
zuxy
parents: 6450
diff changeset
143 static av_cold void iv_free_func(Indeo3DecodeContext *s)
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
144 {
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
145 av_free(s->buf);
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
146 av_free(s->ModPred);
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
147 av_free(s->corrector_type);
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
148 }
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
149
8314
e983153e2d72 Replace 'typedef struct ustr_t' by 'struct ustr', _t is POSIX namespace.
diego
parents: 7975
diff changeset
150 struct ustr {
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
151 long xpos;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
152 long ypos;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
153 long width;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
154 long height;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
155 long split_flag;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
156 long split_direction;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
157 long usl7;
8314
e983153e2d72 Replace 'typedef struct ustr_t' by 'struct ustr', _t is POSIX namespace.
diego
parents: 7975
diff changeset
158 };
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
159
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
160
1198
cae31b22b14e code redundancy reduction, courtesy of suxen_drol -at- hotmail.com
tmmm
parents: 1190
diff changeset
161 #define LV1_CHECK(buf1,rle_v3,lv1,lp2) \
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
162 if((lv1 & 0x80) != 0) { \
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
163 if(rle_v3 != 0) \
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
164 rle_v3 = 0; \
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
165 else { \
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
166 rle_v3 = 1; \
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
167 buf1 -= 2; \
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
168 } \
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
169 } \
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
170 lp2 = 4;
1198
cae31b22b14e code redundancy reduction, courtesy of suxen_drol -at- hotmail.com
tmmm
parents: 1190
diff changeset
171
cae31b22b14e code redundancy reduction, courtesy of suxen_drol -at- hotmail.com
tmmm
parents: 1190
diff changeset
172
cae31b22b14e code redundancy reduction, courtesy of suxen_drol -at- hotmail.com
tmmm
parents: 1190
diff changeset
173 #define RLE_V3_CHECK(buf1,rle_v1,rle_v2,rle_v3) \
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
174 if(rle_v3 == 0) { \
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
175 rle_v2 = *buf1; \
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
176 rle_v1 = 1; \
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
177 if(rle_v2 > 32) { \
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
178 rle_v2 -= 32; \
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
179 rle_v1 = 0; \
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
180 } \
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
181 rle_v3 = 1; \
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
182 } \
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
183 buf1--;
1198
cae31b22b14e code redundancy reduction, courtesy of suxen_drol -at- hotmail.com
tmmm
parents: 1190
diff changeset
184
cae31b22b14e code redundancy reduction, courtesy of suxen_drol -at- hotmail.com
tmmm
parents: 1190
diff changeset
185
cae31b22b14e code redundancy reduction, courtesy of suxen_drol -at- hotmail.com
tmmm
parents: 1190
diff changeset
186 #define LP2_CHECK(buf1,rle_v3,lp2) \
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
187 if(lp2 == 0 && rle_v3 != 0) \
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
188 rle_v3 = 0; \
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
189 else { \
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
190 buf1--; \
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
191 rle_v3 = 1; \
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
192 }
1198
cae31b22b14e code redundancy reduction, courtesy of suxen_drol -at- hotmail.com
tmmm
parents: 1190
diff changeset
193
cae31b22b14e code redundancy reduction, courtesy of suxen_drol -at- hotmail.com
tmmm
parents: 1190
diff changeset
194
cae31b22b14e code redundancy reduction, courtesy of suxen_drol -at- hotmail.com
tmmm
parents: 1190
diff changeset
195 #define RLE_V2_CHECK(buf1,rle_v2, rle_v3,lp2) \
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
196 rle_v2--; \
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
197 if(rle_v2 == 0) { \
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
198 rle_v3 = 0; \
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
199 buf1 += 2; \
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
200 } \
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
201 lp2 = 4;
1198
cae31b22b14e code redundancy reduction, courtesy of suxen_drol -at- hotmail.com
tmmm
parents: 1190
diff changeset
202
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
203 static void iv_Decode_Chunk(Indeo3DecodeContext *s,
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
204 uint8_t *cur, uint8_t *ref, int width, int height,
7975
d9faf3f9f379 Rename some variables and add some comments to try to be a bit more clear.
benoit
parents: 7965
diff changeset
205 const uint8_t *buf1, long cb_offset, const uint8_t *hdr,
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
206 const uint8_t *buf2, int min_width_160)
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
207 {
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
208 uint8_t bit_buf;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
209 unsigned long bit_pos, lv, lv1, lv2;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
210 long *width_tbl, width_tbl_arr[10];
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
211 const signed char *ref_vectors;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
212 uint8_t *cur_frm_pos, *ref_frm_pos, *cp, *cp2;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
213 uint32_t *cur_lp, *ref_lp;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
214 const uint32_t *correction_lp[2], *correctionloworder_lp[2], *correctionhighorder_lp[2];
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
215 uint8_t *correction_type_sp[2];
8314
e983153e2d72 Replace 'typedef struct ustr_t' by 'struct ustr', _t is POSIX namespace.
diego
parents: 7975
diff changeset
216 struct ustr strip_tbl[20], *strip;
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
217 int i, j, k, lp1, lp2, flag1, cmd, blks_width, blks_height, region_160_width,
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
218 rle_v1, rle_v2, rle_v3;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
219 unsigned short res;
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
220
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
221 bit_buf = 0;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
222 ref_vectors = NULL;
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
223
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
224 width_tbl = width_tbl_arr + 1;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
225 i = (width < 0 ? width + 3 : width)/4;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
226 for(j = -1; j < 8; j++)
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
227 width_tbl[j] = i * j;
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
228
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
229 strip = strip_tbl;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
230
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
231 for(region_160_width = 0; region_160_width < (width - min_width_160); region_160_width += min_width_160);
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
232
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
233 strip->ypos = strip->xpos = 0;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
234 for(strip->width = min_width_160; width > strip->width; strip->width *= 2);
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
235 strip->height = height;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
236 strip->split_direction = 0;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
237 strip->split_flag = 0;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
238 strip->usl7 = 0;
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
239
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
240 bit_pos = 0;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
241
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
242 rle_v1 = rle_v2 = rle_v3 = 0;
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
243
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
244 while(strip >= strip_tbl) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
245 if(bit_pos <= 0) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
246 bit_pos = 8;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
247 bit_buf = *buf1++;
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
248 }
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
249
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
250 bit_pos -= 2;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
251 cmd = (bit_buf >> bit_pos) & 0x03;
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
252
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
253 if(cmd == 0) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
254 strip++;
8669
16b978f64d9e Fix an exploit in indeo by checking we are not writing out of the strip array.
benoit
parents: 8323
diff changeset
255 if(strip >= strip_tbl + FF_ARRAY_ELEMS(strip_tbl)) {
16b978f64d9e Fix an exploit in indeo by checking we are not writing out of the strip array.
benoit
parents: 8323
diff changeset
256 av_log(s->avctx, AV_LOG_WARNING, "out of range strip\n");
16b978f64d9e Fix an exploit in indeo by checking we are not writing out of the strip array.
benoit
parents: 8323
diff changeset
257 break;
16b978f64d9e Fix an exploit in indeo by checking we are not writing out of the strip array.
benoit
parents: 8323
diff changeset
258 }
8323
fa328586b9ce indeo3: replace sizeof(struct ...) by sizeof(*var)
aurel
parents: 8314
diff changeset
259 memcpy(strip, strip-1, sizeof(*strip));
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
260 strip->split_flag = 1;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
261 strip->split_direction = 0;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
262 strip->height = (strip->height > 8 ? ((strip->height+8)>>4)<<3 : 4);
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
263 continue;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
264 } else if(cmd == 1) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
265 strip++;
8669
16b978f64d9e Fix an exploit in indeo by checking we are not writing out of the strip array.
benoit
parents: 8323
diff changeset
266 if(strip >= strip_tbl + FF_ARRAY_ELEMS(strip_tbl)) {
16b978f64d9e Fix an exploit in indeo by checking we are not writing out of the strip array.
benoit
parents: 8323
diff changeset
267 av_log(s->avctx, AV_LOG_WARNING, "out of range strip\n");
16b978f64d9e Fix an exploit in indeo by checking we are not writing out of the strip array.
benoit
parents: 8323
diff changeset
268 break;
16b978f64d9e Fix an exploit in indeo by checking we are not writing out of the strip array.
benoit
parents: 8323
diff changeset
269 }
8323
fa328586b9ce indeo3: replace sizeof(struct ...) by sizeof(*var)
aurel
parents: 8314
diff changeset
270 memcpy(strip, strip-1, sizeof(*strip));
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
271 strip->split_flag = 1;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
272 strip->split_direction = 1;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
273 strip->width = (strip->width > 8 ? ((strip->width+8)>>4)<<3 : 4);
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
274 continue;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
275 } else if(cmd == 2) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
276 if(strip->usl7 == 0) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
277 strip->usl7 = 1;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
278 ref_vectors = NULL;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
279 continue;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
280 }
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
281 } else if(cmd == 3) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
282 if(strip->usl7 == 0) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
283 strip->usl7 = 1;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
284 ref_vectors = (const signed char*)buf2 + (*buf1 * 2);
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
285 buf1++;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
286 continue;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
287 }
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
288 }
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
289
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
290 cur_frm_pos = cur + width * strip->ypos + strip->xpos;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
291
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
292 if((blks_width = strip->width) < 0)
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
293 blks_width += 3;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
294 blks_width >>= 2;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
295 blks_height = strip->height;
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
296
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
297 if(ref_vectors != NULL) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
298 ref_frm_pos = ref + (ref_vectors[0] + strip->ypos) * width +
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
299 ref_vectors[1] + strip->xpos;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
300 } else
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
301 ref_frm_pos = cur_frm_pos - width_tbl[4];
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
302
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
303 if(cmd == 2) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
304 if(bit_pos <= 0) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
305 bit_pos = 8;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
306 bit_buf = *buf1++;
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
307 }
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
308
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
309 bit_pos -= 2;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
310 cmd = (bit_buf >> bit_pos) & 0x03;
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
311
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
312 if(cmd == 0 || ref_vectors != NULL) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
313 for(lp1 = 0; lp1 < blks_width; lp1++) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
314 for(i = 0, j = 0; i < blks_height; i++, j += width_tbl[1])
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
315 ((uint32_t *)cur_frm_pos)[j] = ((uint32_t *)ref_frm_pos)[j];
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
316 cur_frm_pos += 4;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
317 ref_frm_pos += 4;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
318 }
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
319 } else if(cmd != 1)
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
320 return;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
321 } else {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
322 k = *buf1 >> 4;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
323 j = *buf1 & 0x0f;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
324 buf1++;
7975
d9faf3f9f379 Rename some variables and add some comments to try to be a bit more clear.
benoit
parents: 7965
diff changeset
325 lv = j + cb_offset;
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
326
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
327 if((lv - 8) <= 7 && (k == 0 || k == 3 || k == 10)) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
328 cp2 = s->ModPred + ((lv - 8) << 7);
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
329 cp = ref_frm_pos;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
330 for(i = 0; i < blks_width << 2; i++) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
331 int v = *cp >> 1;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
332 *(cp++) = cp2[v];
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
333 }
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
334 }
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
335
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
336 if(k == 1 || k == 4) {
7975
d9faf3f9f379 Rename some variables and add some comments to try to be a bit more clear.
benoit
parents: 7965
diff changeset
337 lv = (hdr[j] & 0xf) + cb_offset;
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
338 correction_type_sp[0] = s->corrector_type + (lv << 8);
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
339 correction_lp[0] = correction + (lv << 8);
7975
d9faf3f9f379 Rename some variables and add some comments to try to be a bit more clear.
benoit
parents: 7965
diff changeset
340 lv = (hdr[j] >> 4) + cb_offset;
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
341 correction_lp[1] = correction + (lv << 8);
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
342 correction_type_sp[1] = s->corrector_type + (lv << 8);
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
343 } else {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
344 correctionloworder_lp[0] = correctionloworder_lp[1] = correctionloworder + (lv << 8);
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
345 correctionhighorder_lp[0] = correctionhighorder_lp[1] = correctionhighorder + (lv << 8);
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
346 correction_type_sp[0] = correction_type_sp[1] = s->corrector_type + (lv << 8);
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
347 correction_lp[0] = correction_lp[1] = correction + (lv << 8);
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
348 }
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
349
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
350 switch(k) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
351 case 1:
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
352 case 0: /********** CASE 0 **********/
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
353 for( ; blks_height > 0; blks_height -= 4) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
354 for(lp1 = 0; lp1 < blks_width; lp1++) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
355 for(lp2 = 0; lp2 < 4; ) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
356 k = *buf1++;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
357 cur_lp = ((uint32_t *)cur_frm_pos) + width_tbl[lp2];
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
358 ref_lp = ((uint32_t *)ref_frm_pos) + width_tbl[lp2];
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
359
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
360 switch(correction_type_sp[0][k]) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
361 case 0:
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
362 *cur_lp = le2me_32(((le2me_32(*ref_lp) >> 1) + correction_lp[lp2 & 0x01][k]) << 1);
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
363 lp2++;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
364 break;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
365 case 1:
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
366 res = ((le2me_16(((unsigned short *)(ref_lp))[0]) >> 1) + correction_lp[lp2 & 0x01][*buf1]) << 1;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
367 ((unsigned short *)cur_lp)[0] = le2me_16(res);
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
368 res = ((le2me_16(((unsigned short *)(ref_lp))[1]) >> 1) + correction_lp[lp2 & 0x01][k]) << 1;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
369 ((unsigned short *)cur_lp)[1] = le2me_16(res);
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
370 buf1++;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
371 lp2++;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
372 break;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
373 case 2:
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
374 if(lp2 == 0) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
375 for(i = 0, j = 0; i < 2; i++, j += width_tbl[1])
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
376 cur_lp[j] = ref_lp[j];
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
377 lp2 += 2;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
378 }
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
379 break;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
380 case 3:
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
381 if(lp2 < 2) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
382 for(i = 0, j = 0; i < (3 - lp2); i++, j += width_tbl[1])
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
383 cur_lp[j] = ref_lp[j];
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
384 lp2 = 3;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
385 }
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
386 break;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
387 case 8:
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
388 if(lp2 == 0) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
389 RLE_V3_CHECK(buf1,rle_v1,rle_v2,rle_v3)
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
390
7965
d4ae40057dd3 Fix indentation.
benoit
parents: 7964
diff changeset
391 if(rle_v1 == 1 || ref_vectors != NULL) {
d4ae40057dd3 Fix indentation.
benoit
parents: 7964
diff changeset
392 for(i = 0, j = 0; i < 4; i++, j += width_tbl[1])
d4ae40057dd3 Fix indentation.
benoit
parents: 7964
diff changeset
393 cur_lp[j] = ref_lp[j];
d4ae40057dd3 Fix indentation.
benoit
parents: 7964
diff changeset
394 }
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
395
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
396 RLE_V2_CHECK(buf1,rle_v2, rle_v3,lp2)
7965
d4ae40057dd3 Fix indentation.
benoit
parents: 7964
diff changeset
397 break;
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
398 } else {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
399 rle_v1 = 1;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
400 rle_v2 = *buf1 - 1;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
401 }
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
402 case 5:
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
403 LP2_CHECK(buf1,rle_v3,lp2)
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
404 case 4:
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
405 for(i = 0, j = 0; i < (4 - lp2); i++, j += width_tbl[1])
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
406 cur_lp[j] = ref_lp[j];
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
407 lp2 = 4;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
408 break;
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
409
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
410 case 7:
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
411 if(rle_v3 != 0)
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
412 rle_v3 = 0;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
413 else {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
414 buf1--;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
415 rle_v3 = 1;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
416 }
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
417 case 6:
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
418 if(ref_vectors != NULL) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
419 for(i = 0, j = 0; i < 4; i++, j += width_tbl[1])
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
420 cur_lp[j] = ref_lp[j];
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
421 }
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
422 lp2 = 4;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
423 break;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
424
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
425 case 9:
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
426 lv1 = *buf1++;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
427 lv = (lv1 & 0x7F) << 1;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
428 lv += (lv << 8);
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
429 lv += (lv << 16);
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
430 for(i = 0, j = 0; i < 4; i++, j += width_tbl[1])
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
431 cur_lp[j] = lv;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
432
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
433 LV1_CHECK(buf1,rle_v3,lv1,lp2)
7965
d4ae40057dd3 Fix indentation.
benoit
parents: 7964
diff changeset
434 break;
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
435 default:
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
436 return;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
437 }
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
438 }
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
439
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
440 cur_frm_pos += 4;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
441 ref_frm_pos += 4;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
442 }
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
443
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
444 cur_frm_pos += ((width - blks_width) * 4);
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
445 ref_frm_pos += ((width - blks_width) * 4);
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
446 }
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
447 break;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
448
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
449 case 4:
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
450 case 3: /********** CASE 3 **********/
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
451 if(ref_vectors != NULL)
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
452 return;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
453 flag1 = 1;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
454
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
455 for( ; blks_height > 0; blks_height -= 8) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
456 for(lp1 = 0; lp1 < blks_width; lp1++) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
457 for(lp2 = 0; lp2 < 4; ) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
458 k = *buf1++;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
459
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
460 cur_lp = ((uint32_t *)cur_frm_pos) + width_tbl[lp2 * 2];
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
461 ref_lp = ((uint32_t *)cur_frm_pos) + width_tbl[(lp2 * 2) - 1];
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
462
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
463 switch(correction_type_sp[lp2 & 0x01][k]) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
464 case 0:
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
465 cur_lp[width_tbl[1]] = le2me_32(((le2me_32(*ref_lp) >> 1) + correction_lp[lp2 & 0x01][k]) << 1);
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
466 if(lp2 > 0 || flag1 == 0 || strip->ypos != 0)
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
467 cur_lp[0] = ((cur_lp[-width_tbl[1]] >> 1) + (cur_lp[width_tbl[1]] >> 1)) & 0xFEFEFEFE;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
468 else
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
469 cur_lp[0] = le2me_32(((le2me_32(*ref_lp) >> 1) + correction_lp[lp2 & 0x01][k]) << 1);
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
470 lp2++;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
471 break;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
472
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
473 case 1:
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
474 res = ((le2me_16(((unsigned short *)ref_lp)[0]) >> 1) + correction_lp[lp2 & 0x01][*buf1]) << 1;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
475 ((unsigned short *)cur_lp)[width_tbl[2]] = le2me_16(res);
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
476 res = ((le2me_16(((unsigned short *)ref_lp)[1]) >> 1) + correction_lp[lp2 & 0x01][k]) << 1;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
477 ((unsigned short *)cur_lp)[width_tbl[2]+1] = le2me_16(res);
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
478
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
479 if(lp2 > 0 || flag1 == 0 || strip->ypos != 0)
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
480 cur_lp[0] = ((cur_lp[-width_tbl[1]] >> 1) + (cur_lp[width_tbl[1]] >> 1)) & 0xFEFEFEFE;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
481 else
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
482 cur_lp[0] = cur_lp[width_tbl[1]];
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
483 buf1++;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
484 lp2++;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
485 break;
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
486
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
487 case 2:
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
488 if(lp2 == 0) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
489 for(i = 0, j = 0; i < 4; i++, j += width_tbl[1])
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
490 cur_lp[j] = *ref_lp;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
491 lp2 += 2;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
492 }
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
493 break;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
494
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
495 case 3:
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
496 if(lp2 < 2) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
497 for(i = 0, j = 0; i < 6 - (lp2 * 2); i++, j += width_tbl[1])
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
498 cur_lp[j] = *ref_lp;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
499 lp2 = 3;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
500 }
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
501 break;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
502
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
503 case 6:
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
504 lp2 = 4;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
505 break;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
506
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
507 case 7:
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
508 if(rle_v3 != 0)
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
509 rle_v3 = 0;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
510 else {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
511 buf1--;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
512 rle_v3 = 1;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
513 }
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
514 lp2 = 4;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
515 break;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
516
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
517 case 8:
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
518 if(lp2 == 0) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
519 RLE_V3_CHECK(buf1,rle_v1,rle_v2,rle_v3)
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
520
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
521 if(rle_v1 == 1) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
522 for(i = 0, j = 0; i < 8; i++, j += width_tbl[1])
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
523 cur_lp[j] = ref_lp[j];
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
524 }
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
525
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
526 RLE_V2_CHECK(buf1,rle_v2, rle_v3,lp2)
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
527 break;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
528 } else {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
529 rle_v2 = (*buf1) - 1;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
530 rle_v1 = 1;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
531 }
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
532 case 5:
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
533 LP2_CHECK(buf1,rle_v3,lp2)
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
534 case 4:
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
535 for(i = 0, j = 0; i < 8 - (lp2 * 2); i++, j += width_tbl[1])
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
536 cur_lp[j] = *ref_lp;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
537 lp2 = 4;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
538 break;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
539
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
540 case 9:
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
541 av_log(s->avctx, AV_LOG_ERROR, "UNTESTED.\n");
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
542 lv1 = *buf1++;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
543 lv = (lv1 & 0x7F) << 1;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
544 lv += (lv << 8);
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
545 lv += (lv << 16);
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
546
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
547 for(i = 0, j = 0; i < 4; i++, j += width_tbl[1])
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
548 cur_lp[j] = lv;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
549
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
550 LV1_CHECK(buf1,rle_v3,lv1,lp2)
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
551 break;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
552
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
553 default:
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
554 return;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
555 }
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
556 }
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
557
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
558 cur_frm_pos += 4;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
559 }
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
560
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
561 cur_frm_pos += (((width * 2) - blks_width) * 4);
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
562 flag1 = 0;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
563 }
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
564 break;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
565
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
566 case 10: /********** CASE 10 **********/
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
567 if(ref_vectors == NULL) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
568 flag1 = 1;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
569
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
570 for( ; blks_height > 0; blks_height -= 8) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
571 for(lp1 = 0; lp1 < blks_width; lp1 += 2) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
572 for(lp2 = 0; lp2 < 4; ) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
573 k = *buf1++;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
574 cur_lp = ((uint32_t *)cur_frm_pos) + width_tbl[lp2 * 2];
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
575 ref_lp = ((uint32_t *)cur_frm_pos) + width_tbl[(lp2 * 2) - 1];
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
576 lv1 = ref_lp[0];
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
577 lv2 = ref_lp[1];
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
578 if(lp2 == 0 && flag1 != 0) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
579 #ifdef WORDS_BIGENDIAN
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
580 lv1 = lv1 & 0xFF00FF00;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
581 lv1 = (lv1 >> 8) | lv1;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
582 lv2 = lv2 & 0xFF00FF00;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
583 lv2 = (lv2 >> 8) | lv2;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
584 #else
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
585 lv1 = lv1 & 0x00FF00FF;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
586 lv1 = (lv1 << 8) | lv1;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
587 lv2 = lv2 & 0x00FF00FF;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
588 lv2 = (lv2 << 8) | lv2;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
589 #endif
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
590 }
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
591
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
592 switch(correction_type_sp[lp2 & 0x01][k]) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
593 case 0:
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
594 cur_lp[width_tbl[1]] = le2me_32(((le2me_32(lv1) >> 1) + correctionloworder_lp[lp2 & 0x01][k]) << 1);
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
595 cur_lp[width_tbl[1]+1] = le2me_32(((le2me_32(lv2) >> 1) + correctionhighorder_lp[lp2 & 0x01][k]) << 1);
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
596 if(lp2 > 0 || strip->ypos != 0 || flag1 == 0) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
597 cur_lp[0] = ((cur_lp[-width_tbl[1]] >> 1) + (cur_lp[width_tbl[1]] >> 1)) & 0xFEFEFEFE;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
598 cur_lp[1] = ((cur_lp[-width_tbl[1]+1] >> 1) + (cur_lp[width_tbl[1]+1] >> 1)) & 0xFEFEFEFE;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
599 } else {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
600 cur_lp[0] = cur_lp[width_tbl[1]];
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
601 cur_lp[1] = cur_lp[width_tbl[1]+1];
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
602 }
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
603 lp2++;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
604 break;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
605
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
606 case 1:
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
607 cur_lp[width_tbl[1]] = le2me_32(((le2me_32(lv1) >> 1) + correctionloworder_lp[lp2 & 0x01][*buf1]) << 1);
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
608 cur_lp[width_tbl[1]+1] = le2me_32(((le2me_32(lv2) >> 1) + correctionloworder_lp[lp2 & 0x01][k]) << 1);
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
609 if(lp2 > 0 || strip->ypos != 0 || flag1 == 0) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
610 cur_lp[0] = ((cur_lp[-width_tbl[1]] >> 1) + (cur_lp[width_tbl[1]] >> 1)) & 0xFEFEFEFE;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
611 cur_lp[1] = ((cur_lp[-width_tbl[1]+1] >> 1) + (cur_lp[width_tbl[1]+1] >> 1)) & 0xFEFEFEFE;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
612 } else {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
613 cur_lp[0] = cur_lp[width_tbl[1]];
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
614 cur_lp[1] = cur_lp[width_tbl[1]+1];
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
615 }
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
616 buf1++;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
617 lp2++;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
618 break;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
619
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
620 case 2:
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
621 if(lp2 == 0) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
622 if(flag1 != 0) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
623 for(i = 0, j = width_tbl[1]; i < 3; i++, j += width_tbl[1]) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
624 cur_lp[j] = lv1;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
625 cur_lp[j+1] = lv2;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
626 }
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
627 cur_lp[0] = ((cur_lp[-width_tbl[1]] >> 1) + (cur_lp[width_tbl[1]] >> 1)) & 0xFEFEFEFE;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
628 cur_lp[1] = ((cur_lp[-width_tbl[1]+1] >> 1) + (cur_lp[width_tbl[1]+1] >> 1)) & 0xFEFEFEFE;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
629 } else {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
630 for(i = 0, j = 0; i < 4; i++, j += width_tbl[1]) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
631 cur_lp[j] = lv1;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
632 cur_lp[j+1] = lv2;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
633 }
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
634 }
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
635 lp2 += 2;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
636 }
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
637 break;
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
638
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
639 case 3:
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
640 if(lp2 < 2) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
641 if(lp2 == 0 && flag1 != 0) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
642 for(i = 0, j = width_tbl[1]; i < 5; i++, j += width_tbl[1]) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
643 cur_lp[j] = lv1;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
644 cur_lp[j+1] = lv2;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
645 }
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
646 cur_lp[0] = ((cur_lp[-width_tbl[1]] >> 1) + (cur_lp[width_tbl[1]] >> 1)) & 0xFEFEFEFE;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
647 cur_lp[1] = ((cur_lp[-width_tbl[1]+1] >> 1) + (cur_lp[width_tbl[1]+1] >> 1)) & 0xFEFEFEFE;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
648 } else {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
649 for(i = 0, j = 0; i < 6 - (lp2 * 2); i++, j += width_tbl[1]) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
650 cur_lp[j] = lv1;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
651 cur_lp[j+1] = lv2;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
652 }
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
653 }
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
654 lp2 = 3;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
655 }
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
656 break;
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
657
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
658 case 8:
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
659 if(lp2 == 0) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
660 RLE_V3_CHECK(buf1,rle_v1,rle_v2,rle_v3)
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
661 if(rle_v1 == 1) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
662 if(flag1 != 0) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
663 for(i = 0, j = width_tbl[1]; i < 7; i++, j += width_tbl[1]) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
664 cur_lp[j] = lv1;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
665 cur_lp[j+1] = lv2;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
666 }
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
667 cur_lp[0] = ((cur_lp[-width_tbl[1]] >> 1) + (cur_lp[width_tbl[1]] >> 1)) & 0xFEFEFEFE;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
668 cur_lp[1] = ((cur_lp[-width_tbl[1]+1] >> 1) + (cur_lp[width_tbl[1]+1] >> 1)) & 0xFEFEFEFE;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
669 } else {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
670 for(i = 0, j = 0; i < 8; i++, j += width_tbl[1]) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
671 cur_lp[j] = lv1;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
672 cur_lp[j+1] = lv2;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
673 }
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
674 }
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
675 }
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
676 RLE_V2_CHECK(buf1,rle_v2, rle_v3,lp2)
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
677 break;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
678 } else {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
679 rle_v1 = 1;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
680 rle_v2 = (*buf1) - 1;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
681 }
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
682 case 5:
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
683 LP2_CHECK(buf1,rle_v3,lp2)
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
684 case 4:
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
685 if(lp2 == 0 && flag1 != 0) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
686 for(i = 0, j = width_tbl[1]; i < 7; i++, j += width_tbl[1]) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
687 cur_lp[j] = lv1;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
688 cur_lp[j+1] = lv2;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
689 }
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
690 cur_lp[0] = ((cur_lp[-width_tbl[1]] >> 1) + (cur_lp[width_tbl[1]] >> 1)) & 0xFEFEFEFE;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
691 cur_lp[1] = ((cur_lp[-width_tbl[1]+1] >> 1) + (cur_lp[width_tbl[1]+1] >> 1)) & 0xFEFEFEFE;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
692 } else {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
693 for(i = 0, j = 0; i < 8 - (lp2 * 2); i++, j += width_tbl[1]) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
694 cur_lp[j] = lv1;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
695 cur_lp[j+1] = lv2;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
696 }
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
697 }
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
698 lp2 = 4;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
699 break;
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
700
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
701 case 6:
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
702 lp2 = 4;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
703 break;
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
704
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
705 case 7:
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
706 if(lp2 == 0) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
707 if(rle_v3 != 0)
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
708 rle_v3 = 0;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
709 else {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
710 buf1--;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
711 rle_v3 = 1;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
712 }
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
713 lp2 = 4;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
714 }
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
715 break;
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
716
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
717 case 9:
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
718 av_log(s->avctx, AV_LOG_ERROR, "UNTESTED.\n");
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
719 lv1 = *buf1;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
720 lv = (lv1 & 0x7F) << 1;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
721 lv += (lv << 8);
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
722 lv += (lv << 16);
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
723 for(i = 0, j = 0; i < 8; i++, j += width_tbl[1])
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
724 cur_lp[j] = lv;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
725 LV1_CHECK(buf1,rle_v3,lv1,lp2)
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
726 break;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
727
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
728 default:
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
729 return;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
730 }
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
731 }
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
732
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
733 cur_frm_pos += 8;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
734 }
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
735
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
736 cur_frm_pos += (((width * 2) - blks_width) * 4);
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
737 flag1 = 0;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
738 }
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
739 } else {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
740 for( ; blks_height > 0; blks_height -= 8) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
741 for(lp1 = 0; lp1 < blks_width; lp1 += 2) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
742 for(lp2 = 0; lp2 < 4; ) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
743 k = *buf1++;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
744 cur_lp = ((uint32_t *)cur_frm_pos) + width_tbl[lp2 * 2];
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
745 ref_lp = ((uint32_t *)ref_frm_pos) + width_tbl[lp2 * 2];
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
746
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
747 switch(correction_type_sp[lp2 & 0x01][k]) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
748 case 0:
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
749 lv1 = correctionloworder_lp[lp2 & 0x01][k];
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
750 lv2 = correctionhighorder_lp[lp2 & 0x01][k];
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
751 cur_lp[0] = le2me_32(((le2me_32(ref_lp[0]) >> 1) + lv1) << 1);
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
752 cur_lp[1] = le2me_32(((le2me_32(ref_lp[1]) >> 1) + lv2) << 1);
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
753 cur_lp[width_tbl[1]] = le2me_32(((le2me_32(ref_lp[width_tbl[1]]) >> 1) + lv1) << 1);
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
754 cur_lp[width_tbl[1]+1] = le2me_32(((le2me_32(ref_lp[width_tbl[1]+1]) >> 1) + lv2) << 1);
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
755 lp2++;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
756 break;
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
757
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
758 case 1:
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
759 lv1 = correctionloworder_lp[lp2 & 0x01][*buf1++];
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
760 lv2 = correctionloworder_lp[lp2 & 0x01][k];
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
761 cur_lp[0] = le2me_32(((le2me_32(ref_lp[0]) >> 1) + lv1) << 1);
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
762 cur_lp[1] = le2me_32(((le2me_32(ref_lp[1]) >> 1) + lv2) << 1);
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
763 cur_lp[width_tbl[1]] = le2me_32(((le2me_32(ref_lp[width_tbl[1]]) >> 1) + lv1) << 1);
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
764 cur_lp[width_tbl[1]+1] = le2me_32(((le2me_32(ref_lp[width_tbl[1]+1]) >> 1) + lv2) << 1);
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
765 lp2++;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
766 break;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
767
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
768 case 2:
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
769 if(lp2 == 0) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
770 for(i = 0, j = 0; i < 4; i++, j += width_tbl[1]) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
771 cur_lp[j] = ref_lp[j];
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
772 cur_lp[j+1] = ref_lp[j+1];
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
773 }
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
774 lp2 += 2;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
775 }
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
776 break;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
777
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
778 case 3:
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
779 if(lp2 < 2) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
780 for(i = 0, j = 0; i < 6 - (lp2 * 2); i++, j += width_tbl[1]) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
781 cur_lp[j] = ref_lp[j];
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
782 cur_lp[j+1] = ref_lp[j+1];
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
783 }
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
784 lp2 = 3;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
785 }
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
786 break;
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
787
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
788 case 8:
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
789 if(lp2 == 0) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
790 RLE_V3_CHECK(buf1,rle_v1,rle_v2,rle_v3)
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
791 for(i = 0, j = 0; i < 8; i++, j += width_tbl[1]) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
792 ((uint32_t *)cur_frm_pos)[j] = ((uint32_t *)ref_frm_pos)[j];
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
793 ((uint32_t *)cur_frm_pos)[j+1] = ((uint32_t *)ref_frm_pos)[j+1];
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
794 }
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
795 RLE_V2_CHECK(buf1,rle_v2, rle_v3,lp2)
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
796 break;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
797 } else {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
798 rle_v1 = 1;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
799 rle_v2 = (*buf1) - 1;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
800 }
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
801 case 5:
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
802 case 7:
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
803 LP2_CHECK(buf1,rle_v3,lp2)
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
804 case 6:
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
805 case 4:
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
806 for(i = 0, j = 0; i < 8 - (lp2 * 2); i++, j += width_tbl[1]) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
807 cur_lp[j] = ref_lp[j];
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
808 cur_lp[j+1] = ref_lp[j+1];
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
809 }
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
810 lp2 = 4;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
811 break;
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
812
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
813 case 9:
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
814 av_log(s->avctx, AV_LOG_ERROR, "UNTESTED.\n");
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
815 lv1 = *buf1;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
816 lv = (lv1 & 0x7F) << 1;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
817 lv += (lv << 8);
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
818 lv += (lv << 16);
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
819 for(i = 0, j = 0; i < 8; i++, j += width_tbl[1])
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
820 ((uint32_t *)cur_frm_pos)[j] = ((uint32_t *)cur_frm_pos)[j+1] = lv;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
821 LV1_CHECK(buf1,rle_v3,lv1,lp2)
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
822 break;
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
823
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
824 default:
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
825 return;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
826 }
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
827 }
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
828
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
829 cur_frm_pos += 8;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
830 ref_frm_pos += 8;
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
831 }
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
832
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
833 cur_frm_pos += (((width * 2) - blks_width) * 4);
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
834 ref_frm_pos += (((width * 2) - blks_width) * 4);
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
835 }
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
836 }
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
837 break;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
838
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
839 case 11: /********** CASE 11 **********/
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
840 if(ref_vectors == NULL)
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
841 return;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
842
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
843 for( ; blks_height > 0; blks_height -= 8) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
844 for(lp1 = 0; lp1 < blks_width; lp1++) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
845 for(lp2 = 0; lp2 < 4; ) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
846 k = *buf1++;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
847 cur_lp = ((uint32_t *)cur_frm_pos) + width_tbl[lp2 * 2];
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
848 ref_lp = ((uint32_t *)ref_frm_pos) + width_tbl[lp2 * 2];
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
849
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
850 switch(correction_type_sp[lp2 & 0x01][k]) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
851 case 0:
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
852 cur_lp[0] = le2me_32(((le2me_32(*ref_lp) >> 1) + correction_lp[lp2 & 0x01][k]) << 1);
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
853 cur_lp[width_tbl[1]] = le2me_32(((le2me_32(ref_lp[width_tbl[1]]) >> 1) + correction_lp[lp2 & 0x01][k]) << 1);
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
854 lp2++;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
855 break;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
856
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
857 case 1:
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
858 lv1 = (unsigned short)(correction_lp[lp2 & 0x01][*buf1++]);
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
859 lv2 = (unsigned short)(correction_lp[lp2 & 0x01][k]);
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
860 res = (unsigned short)(((le2me_16(((unsigned short *)ref_lp)[0]) >> 1) + lv1) << 1);
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
861 ((unsigned short *)cur_lp)[0] = le2me_16(res);
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
862 res = (unsigned short)(((le2me_16(((unsigned short *)ref_lp)[1]) >> 1) + lv2) << 1);
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
863 ((unsigned short *)cur_lp)[1] = le2me_16(res);
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
864 res = (unsigned short)(((le2me_16(((unsigned short *)ref_lp)[width_tbl[2]]) >> 1) + lv1) << 1);
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
865 ((unsigned short *)cur_lp)[width_tbl[2]] = le2me_16(res);
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
866 res = (unsigned short)(((le2me_16(((unsigned short *)ref_lp)[width_tbl[2]+1]) >> 1) + lv2) << 1);
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
867 ((unsigned short *)cur_lp)[width_tbl[2]+1] = le2me_16(res);
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
868 lp2++;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
869 break;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
870
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
871 case 2:
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
872 if(lp2 == 0) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
873 for(i = 0, j = 0; i < 4; i++, j += width_tbl[1])
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
874 cur_lp[j] = ref_lp[j];
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
875 lp2 += 2;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
876 }
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
877 break;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
878
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
879 case 3:
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
880 if(lp2 < 2) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
881 for(i = 0, j = 0; i < 6 - (lp2 * 2); i++, j += width_tbl[1])
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
882 cur_lp[j] = ref_lp[j];
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
883 lp2 = 3;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
884 }
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
885 break;
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
886
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
887 case 8:
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
888 if(lp2 == 0) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
889 RLE_V3_CHECK(buf1,rle_v1,rle_v2,rle_v3)
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
890
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
891 for(i = 0, j = 0; i < 8; i++, j += width_tbl[1])
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
892 cur_lp[j] = ref_lp[j];
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
893
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
894 RLE_V2_CHECK(buf1,rle_v2, rle_v3,lp2)
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
895 break;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
896 } else {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
897 rle_v1 = 1;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
898 rle_v2 = (*buf1) - 1;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
899 }
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
900 case 5:
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
901 case 7:
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
902 LP2_CHECK(buf1,rle_v3,lp2)
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
903 case 4:
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
904 case 6:
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
905 for(i = 0, j = 0; i < 8 - (lp2 * 2); i++, j += width_tbl[1])
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
906 cur_lp[j] = ref_lp[j];
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
907 lp2 = 4;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
908 break;
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
909
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
910 case 9:
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
911 av_log(s->avctx, AV_LOG_ERROR, "UNTESTED.\n");
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
912 lv1 = *buf1++;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
913 lv = (lv1 & 0x7F) << 1;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
914 lv += (lv << 8);
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
915 lv += (lv << 16);
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
916 for(i = 0, j = 0; i < 4; i++, j += width_tbl[1])
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
917 cur_lp[j] = lv;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
918 LV1_CHECK(buf1,rle_v3,lv1,lp2)
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
919 break;
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
920
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
921 default:
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
922 return;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
923 }
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
924 }
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
925
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
926 cur_frm_pos += 4;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
927 ref_frm_pos += 4;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
928 }
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
929
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
930 cur_frm_pos += (((width * 2) - blks_width) * 4);
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
931 ref_frm_pos += (((width * 2) - blks_width) * 4);
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
932 }
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
933 break;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
934
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
935 default:
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
936 return;
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
937 }
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
938 }
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
939
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
940 for( ; strip >= strip_tbl; strip--) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
941 if(strip->split_flag != 0) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
942 strip->split_flag = 0;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
943 strip->usl7 = (strip-1)->usl7;
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
944
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
945 if(strip->split_direction) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
946 strip->xpos += strip->width;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
947 strip->width = (strip-1)->width - strip->width;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
948 if(region_160_width <= strip->xpos && width < strip->width + strip->xpos)
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
949 strip->width = width - strip->xpos;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
950 } else {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
951 strip->ypos += strip->height;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
952 strip->height = (strip-1)->height - strip->height;
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
953 }
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
954 break;
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
955 }
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
956 }
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
957 }
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
958 }
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
959
6517
48759bfbd073 Apply 'cold' attribute to init/uninit functions in libavcodec
zuxy
parents: 6450
diff changeset
960 static av_cold int indeo3_decode_init(AVCodecContext *avctx)
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
961 {
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
962 Indeo3DecodeContext *s = avctx->priv_data;
7950
9d2399045441 Check allocations on init.
benoit
parents: 7949
diff changeset
963 int ret = 0;
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
964
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
965 s->avctx = avctx;
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
966 s->width = avctx->width;
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
967 s->height = avctx->height;
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
968 avctx->pix_fmt = PIX_FMT_YUV410P;
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
969
7950
9d2399045441 Check allocations on init.
benoit
parents: 7949
diff changeset
970 if (!(ret = build_modpred(s)))
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
971 ret = iv_alloc_frames(s);
7950
9d2399045441 Check allocations on init.
benoit
parents: 7949
diff changeset
972 if (ret)
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
973 iv_free_func(s);
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
974
7950
9d2399045441 Check allocations on init.
benoit
parents: 7949
diff changeset
975 return ret;
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
976 }
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
977
8986
4d5d7e08f1d3 Some buffer checks for indeo3
alexc
parents: 8670
diff changeset
978 static int iv_decode_frame(Indeo3DecodeContext *s,
8988
48c89edff557 Reindent after last commit
alexc
parents: 8986
diff changeset
979 const uint8_t *buf, int buf_size)
7957
fbe8fabdbc63 Move iv_decode_frame function to remove a forward declaration.
benoit
parents: 7956
diff changeset
980 {
7975
d9faf3f9f379 Rename some variables and add some comments to try to be a bit more clear.
benoit
parents: 7965
diff changeset
981 unsigned int image_width, image_height,
7957
fbe8fabdbc63 Move iv_decode_frame function to remove a forward declaration.
benoit
parents: 7956
diff changeset
982 chroma_width, chroma_height;
7975
d9faf3f9f379 Rename some variables and add some comments to try to be a bit more clear.
benoit
parents: 7965
diff changeset
983 unsigned long flags, cb_offset, data_size,
d9faf3f9f379 Rename some variables and add some comments to try to be a bit more clear.
benoit
parents: 7965
diff changeset
984 y_offset, v_offset, u_offset, mc_vector_count;
7957
fbe8fabdbc63 Move iv_decode_frame function to remove a forward declaration.
benoit
parents: 7956
diff changeset
985 const uint8_t *hdr_pos, *buf_pos;
fbe8fabdbc63 Move iv_decode_frame function to remove a forward declaration.
benoit
parents: 7956
diff changeset
986
fbe8fabdbc63 Move iv_decode_frame function to remove a forward declaration.
benoit
parents: 7956
diff changeset
987 buf_pos = buf;
7975
d9faf3f9f379 Rename some variables and add some comments to try to be a bit more clear.
benoit
parents: 7965
diff changeset
988 buf_pos += 18; /* skip OS header (16 bytes) and version number */
7957
fbe8fabdbc63 Move iv_decode_frame function to remove a forward declaration.
benoit
parents: 7956
diff changeset
989
7975
d9faf3f9f379 Rename some variables and add some comments to try to be a bit more clear.
benoit
parents: 7965
diff changeset
990 flags = bytestream_get_le16(&buf_pos);
d9faf3f9f379 Rename some variables and add some comments to try to be a bit more clear.
benoit
parents: 7965
diff changeset
991 data_size = bytestream_get_le32(&buf_pos);
d9faf3f9f379 Rename some variables and add some comments to try to be a bit more clear.
benoit
parents: 7965
diff changeset
992 cb_offset = *buf_pos++;
d9faf3f9f379 Rename some variables and add some comments to try to be a bit more clear.
benoit
parents: 7965
diff changeset
993 buf_pos += 3; /* skip reserved byte and checksum */
d9faf3f9f379 Rename some variables and add some comments to try to be a bit more clear.
benoit
parents: 7965
diff changeset
994 image_height = bytestream_get_le16(&buf_pos);
d9faf3f9f379 Rename some variables and add some comments to try to be a bit more clear.
benoit
parents: 7965
diff changeset
995 image_width = bytestream_get_le16(&buf_pos);
7957
fbe8fabdbc63 Move iv_decode_frame function to remove a forward declaration.
benoit
parents: 7956
diff changeset
996
7975
d9faf3f9f379 Rename some variables and add some comments to try to be a bit more clear.
benoit
parents: 7965
diff changeset
997 if(avcodec_check_dimensions(NULL, image_width, image_height))
7957
fbe8fabdbc63 Move iv_decode_frame function to remove a forward declaration.
benoit
parents: 7956
diff changeset
998 return -1;
fbe8fabdbc63 Move iv_decode_frame function to remove a forward declaration.
benoit
parents: 7956
diff changeset
999
7975
d9faf3f9f379 Rename some variables and add some comments to try to be a bit more clear.
benoit
parents: 7965
diff changeset
1000 chroma_height = ((image_height >> 2) + 3) & 0x7ffc;
d9faf3f9f379 Rename some variables and add some comments to try to be a bit more clear.
benoit
parents: 7965
diff changeset
1001 chroma_width = ((image_width >> 2) + 3) & 0x7ffc;
d9faf3f9f379 Rename some variables and add some comments to try to be a bit more clear.
benoit
parents: 7965
diff changeset
1002 y_offset = bytestream_get_le32(&buf_pos);
d9faf3f9f379 Rename some variables and add some comments to try to be a bit more clear.
benoit
parents: 7965
diff changeset
1003 v_offset = bytestream_get_le32(&buf_pos);
d9faf3f9f379 Rename some variables and add some comments to try to be a bit more clear.
benoit
parents: 7965
diff changeset
1004 u_offset = bytestream_get_le32(&buf_pos);
d9faf3f9f379 Rename some variables and add some comments to try to be a bit more clear.
benoit
parents: 7965
diff changeset
1005 buf_pos += 4; /* reserved */
7957
fbe8fabdbc63 Move iv_decode_frame function to remove a forward declaration.
benoit
parents: 7956
diff changeset
1006 hdr_pos = buf_pos;
7975
d9faf3f9f379 Rename some variables and add some comments to try to be a bit more clear.
benoit
parents: 7965
diff changeset
1007 if(data_size == 0x80) return 4;
7957
fbe8fabdbc63 Move iv_decode_frame function to remove a forward declaration.
benoit
parents: 7956
diff changeset
1008
8986
4d5d7e08f1d3 Some buffer checks for indeo3
alexc
parents: 8670
diff changeset
1009 if(FFMAX3(y_offset, v_offset, u_offset) >= buf_size-16) {
4d5d7e08f1d3 Some buffer checks for indeo3
alexc
parents: 8670
diff changeset
1010 av_log(s->avctx, AV_LOG_ERROR, "y/u/v offset outside buffer\n");
4d5d7e08f1d3 Some buffer checks for indeo3
alexc
parents: 8670
diff changeset
1011 return -1;
4d5d7e08f1d3 Some buffer checks for indeo3
alexc
parents: 8670
diff changeset
1012 }
4d5d7e08f1d3 Some buffer checks for indeo3
alexc
parents: 8670
diff changeset
1013
7975
d9faf3f9f379 Rename some variables and add some comments to try to be a bit more clear.
benoit
parents: 7965
diff changeset
1014 if(flags & 0x200) {
7957
fbe8fabdbc63 Move iv_decode_frame function to remove a forward declaration.
benoit
parents: 7956
diff changeset
1015 s->cur_frame = s->iv_frame + 1;
fbe8fabdbc63 Move iv_decode_frame function to remove a forward declaration.
benoit
parents: 7956
diff changeset
1016 s->ref_frame = s->iv_frame;
fbe8fabdbc63 Move iv_decode_frame function to remove a forward declaration.
benoit
parents: 7956
diff changeset
1017 } else {
fbe8fabdbc63 Move iv_decode_frame function to remove a forward declaration.
benoit
parents: 7956
diff changeset
1018 s->cur_frame = s->iv_frame;
fbe8fabdbc63 Move iv_decode_frame function to remove a forward declaration.
benoit
parents: 7956
diff changeset
1019 s->ref_frame = s->iv_frame + 1;
fbe8fabdbc63 Move iv_decode_frame function to remove a forward declaration.
benoit
parents: 7956
diff changeset
1020 }
fbe8fabdbc63 Move iv_decode_frame function to remove a forward declaration.
benoit
parents: 7956
diff changeset
1021
7975
d9faf3f9f379 Rename some variables and add some comments to try to be a bit more clear.
benoit
parents: 7965
diff changeset
1022 buf_pos = buf + 16 + y_offset;
d9faf3f9f379 Rename some variables and add some comments to try to be a bit more clear.
benoit
parents: 7965
diff changeset
1023 mc_vector_count = bytestream_get_le32(&buf_pos);
8986
4d5d7e08f1d3 Some buffer checks for indeo3
alexc
parents: 8670
diff changeset
1024 if(2LL*mc_vector_count >= buf_size-16-y_offset) {
4d5d7e08f1d3 Some buffer checks for indeo3
alexc
parents: 8670
diff changeset
1025 av_log(s->avctx, AV_LOG_ERROR, "mc_vector_count too large\n");
4d5d7e08f1d3 Some buffer checks for indeo3
alexc
parents: 8670
diff changeset
1026 return -1;
4d5d7e08f1d3 Some buffer checks for indeo3
alexc
parents: 8670
diff changeset
1027 }
7957
fbe8fabdbc63 Move iv_decode_frame function to remove a forward declaration.
benoit
parents: 7956
diff changeset
1028
7975
d9faf3f9f379 Rename some variables and add some comments to try to be a bit more clear.
benoit
parents: 7965
diff changeset
1029 iv_Decode_Chunk(s, s->cur_frame->Ybuf, s->ref_frame->Ybuf, image_width,
d9faf3f9f379 Rename some variables and add some comments to try to be a bit more clear.
benoit
parents: 7965
diff changeset
1030 image_height, buf_pos + mc_vector_count * 2, cb_offset, hdr_pos, buf_pos,
d9faf3f9f379 Rename some variables and add some comments to try to be a bit more clear.
benoit
parents: 7965
diff changeset
1031 FFMIN(image_width, 160));
7957
fbe8fabdbc63 Move iv_decode_frame function to remove a forward declaration.
benoit
parents: 7956
diff changeset
1032
fbe8fabdbc63 Move iv_decode_frame function to remove a forward declaration.
benoit
parents: 7956
diff changeset
1033 if (!(s->avctx->flags & CODEC_FLAG_GRAY))
fbe8fabdbc63 Move iv_decode_frame function to remove a forward declaration.
benoit
parents: 7956
diff changeset
1034 {
fbe8fabdbc63 Move iv_decode_frame function to remove a forward declaration.
benoit
parents: 7956
diff changeset
1035
7975
d9faf3f9f379 Rename some variables and add some comments to try to be a bit more clear.
benoit
parents: 7965
diff changeset
1036 buf_pos = buf + 16 + v_offset;
d9faf3f9f379 Rename some variables and add some comments to try to be a bit more clear.
benoit
parents: 7965
diff changeset
1037 mc_vector_count = bytestream_get_le32(&buf_pos);
8986
4d5d7e08f1d3 Some buffer checks for indeo3
alexc
parents: 8670
diff changeset
1038 if(2LL*mc_vector_count >= buf_size-16-v_offset) {
4d5d7e08f1d3 Some buffer checks for indeo3
alexc
parents: 8670
diff changeset
1039 av_log(s->avctx, AV_LOG_ERROR, "mc_vector_count too large\n");
4d5d7e08f1d3 Some buffer checks for indeo3
alexc
parents: 8670
diff changeset
1040 return -1;
4d5d7e08f1d3 Some buffer checks for indeo3
alexc
parents: 8670
diff changeset
1041 }
7957
fbe8fabdbc63 Move iv_decode_frame function to remove a forward declaration.
benoit
parents: 7956
diff changeset
1042
fbe8fabdbc63 Move iv_decode_frame function to remove a forward declaration.
benoit
parents: 7956
diff changeset
1043 iv_Decode_Chunk(s, s->cur_frame->Vbuf, s->ref_frame->Vbuf, chroma_width,
7975
d9faf3f9f379 Rename some variables and add some comments to try to be a bit more clear.
benoit
parents: 7965
diff changeset
1044 chroma_height, buf_pos + mc_vector_count * 2, cb_offset, hdr_pos, buf_pos,
7957
fbe8fabdbc63 Move iv_decode_frame function to remove a forward declaration.
benoit
parents: 7956
diff changeset
1045 FFMIN(chroma_width, 40));
fbe8fabdbc63 Move iv_decode_frame function to remove a forward declaration.
benoit
parents: 7956
diff changeset
1046
7975
d9faf3f9f379 Rename some variables and add some comments to try to be a bit more clear.
benoit
parents: 7965
diff changeset
1047 buf_pos = buf + 16 + u_offset;
d9faf3f9f379 Rename some variables and add some comments to try to be a bit more clear.
benoit
parents: 7965
diff changeset
1048 mc_vector_count = bytestream_get_le32(&buf_pos);
8986
4d5d7e08f1d3 Some buffer checks for indeo3
alexc
parents: 8670
diff changeset
1049 if(2LL*mc_vector_count >= buf_size-16-u_offset) {
4d5d7e08f1d3 Some buffer checks for indeo3
alexc
parents: 8670
diff changeset
1050 av_log(s->avctx, AV_LOG_ERROR, "mc_vector_count too large\n");
4d5d7e08f1d3 Some buffer checks for indeo3
alexc
parents: 8670
diff changeset
1051 return -1;
4d5d7e08f1d3 Some buffer checks for indeo3
alexc
parents: 8670
diff changeset
1052 }
7957
fbe8fabdbc63 Move iv_decode_frame function to remove a forward declaration.
benoit
parents: 7956
diff changeset
1053
fbe8fabdbc63 Move iv_decode_frame function to remove a forward declaration.
benoit
parents: 7956
diff changeset
1054 iv_Decode_Chunk(s, s->cur_frame->Ubuf, s->ref_frame->Ubuf, chroma_width,
7975
d9faf3f9f379 Rename some variables and add some comments to try to be a bit more clear.
benoit
parents: 7965
diff changeset
1055 chroma_height, buf_pos + mc_vector_count * 2, cb_offset, hdr_pos, buf_pos,
7957
fbe8fabdbc63 Move iv_decode_frame function to remove a forward declaration.
benoit
parents: 7956
diff changeset
1056 FFMIN(chroma_width, 40));
fbe8fabdbc63 Move iv_decode_frame function to remove a forward declaration.
benoit
parents: 7956
diff changeset
1057
fbe8fabdbc63 Move iv_decode_frame function to remove a forward declaration.
benoit
parents: 7956
diff changeset
1058 }
fbe8fabdbc63 Move iv_decode_frame function to remove a forward declaration.
benoit
parents: 7956
diff changeset
1059
fbe8fabdbc63 Move iv_decode_frame function to remove a forward declaration.
benoit
parents: 7956
diff changeset
1060 return 8;
fbe8fabdbc63 Move iv_decode_frame function to remove a forward declaration.
benoit
parents: 7956
diff changeset
1061 }
fbe8fabdbc63 Move iv_decode_frame function to remove a forward declaration.
benoit
parents: 7956
diff changeset
1062
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
1063 static int indeo3_decode_frame(AVCodecContext *avctx,
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
1064 void *data, int *data_size,
7947
70e83ea6a20a use uint8_t instead of unsigned char
benoit
parents: 7946
diff changeset
1065 const uint8_t *buf, int buf_size)
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
1066 {
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
1067 Indeo3DecodeContext *s=avctx->priv_data;
7947
70e83ea6a20a use uint8_t instead of unsigned char
benoit
parents: 7946
diff changeset
1068 uint8_t *src, *dest;
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
1069 int y;
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
1070
8986
4d5d7e08f1d3 Some buffer checks for indeo3
alexc
parents: 8670
diff changeset
1071 if (iv_decode_frame(s, buf, buf_size) < 0)
4d5d7e08f1d3 Some buffer checks for indeo3
alexc
parents: 8670
diff changeset
1072 return -1;
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
1073
1228
d63e0185a90f release buffer cleanup
michaelni
parents: 1198
diff changeset
1074 if(s->frame.data[0])
d63e0185a90f release buffer cleanup
michaelni
parents: 1198
diff changeset
1075 avctx->release_buffer(avctx, &s->frame);
d63e0185a90f release buffer cleanup
michaelni
parents: 1198
diff changeset
1076
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
1077 s->frame.reference = 0;
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
1078 if(avctx->get_buffer(avctx, &s->frame) < 0) {
1598
932d306bf1dc av_log() patch by (Michel Bardiaux <mbardiaux at peaktime dot be>)
michael
parents: 1481
diff changeset
1079 av_log(s->avctx, AV_LOG_ERROR, "get_buffer() failed\n");
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
1080 return -1;
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
1081 }
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
1082
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
1083 src = s->cur_frame->Ybuf;
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
1084 dest = s->frame.data[0];
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
1085 for (y = 0; y < s->height; y++) {
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
1086 memcpy(dest, src, s->cur_frame->y_w);
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
1087 src += s->cur_frame->y_w;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
1088 dest += s->frame.linesize[0];
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
1089 }
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
1090
2244
4a0cfd63f078 greyscale decoding (option to skip u,v planes) support
alex
parents: 2028
diff changeset
1091 if (!(s->avctx->flags & CODEC_FLAG_GRAY))
4a0cfd63f078 greyscale decoding (option to skip u,v planes) support
alex
parents: 2028
diff changeset
1092 {
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
1093 src = s->cur_frame->Ubuf;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
1094 dest = s->frame.data[1];
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
1095 for (y = 0; y < s->height / 4; y++) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
1096 memcpy(dest, src, s->cur_frame->uv_w);
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
1097 src += s->cur_frame->uv_w;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
1098 dest += s->frame.linesize[1];
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
1099 }
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
1100
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
1101 src = s->cur_frame->Vbuf;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
1102 dest = s->frame.data[2];
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
1103 for (y = 0; y < s->height / 4; y++) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
1104 memcpy(dest, src, s->cur_frame->uv_w);
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
1105 src += s->cur_frame->uv_w;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
1106 dest += s->frame.linesize[2];
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
1107 }
2244
4a0cfd63f078 greyscale decoding (option to skip u,v planes) support
alex
parents: 2028
diff changeset
1108 }
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
1109
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
1110 *data_size=sizeof(AVFrame);
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
1111 *(AVFrame*)data= s->frame;
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
1112
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
1113 return buf_size;
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
1114 }
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
1115
6517
48759bfbd073 Apply 'cold' attribute to init/uninit functions in libavcodec
zuxy
parents: 6450
diff changeset
1116 static av_cold int indeo3_decode_end(AVCodecContext *avctx)
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
1117 {
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
1118 Indeo3DecodeContext *s = avctx->priv_data;
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
1119
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
1120 iv_free_func(s);
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
1121
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
1122 return 0;
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
1123 }
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
1124
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
1125 AVCodec indeo3_decoder = {
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
1126 "indeo3",
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
1127 CODEC_TYPE_VIDEO,
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
1128 CODEC_ID_INDEO3,
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
1129 sizeof(Indeo3DecodeContext),
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
1130 indeo3_decode_init,
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
1131 NULL,
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
1132 indeo3_decode_end,
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
1133 indeo3_decode_frame,
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
1134 0,
6710
a4104482ceef Add long names to many AVCodec declarations.
diego
parents: 6517
diff changeset
1135 NULL,
7040
e943e1409077 Make AVCodec long_names definition conditional depending on CONFIG_SMALL.
stefano
parents: 6710
diff changeset
1136 .long_name = NULL_IF_CONFIG_SMALL("Intel Indeo 3"),
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
1137 };